Prepare headers to support file descriptor passing over UNIX Domain Sockets.
Contributed by Thomas Cort.
This commit is contained in:
parent
a0bb199f69
commit
2297e26660
6 changed files with 54 additions and 12 deletions
|
@ -111,6 +111,7 @@ extern int errno; /* place where the error numbers go */
|
|||
#define ENOTSUP EOPNOTSUPP /* Not supported */
|
||||
#define ENETDOWN (_SIGN 77) /* network is down */
|
||||
#define EPFNOSUPPORT (_SIGN 78) /* Protocol family not supported */
|
||||
#define EDESTADDRREQ (_SIGN 79) /* Destination address required */
|
||||
|
||||
/* The following are not POSIX errors, but they can still happen.
|
||||
* All of these are generated by the kernel and relate to message passing.
|
||||
|
|
|
@ -119,5 +119,19 @@ typedef struct {
|
|||
|
||||
#define IS_VFS_RQ(type) (((type) & ~0xff) == VFS_BASE)
|
||||
|
||||
#define PFS_BASE (VFS_BASE + 100)
|
||||
|
||||
#define PFS_REQ_CHECK_PERMS (PFS_BASE + 1)
|
||||
#define PFS_REQ_VERIFY_FD (PFS_BASE + 2)
|
||||
#define PFS_REQ_SET_FILP (PFS_BASE + 3)
|
||||
#define PFS_REQ_COPY_FILP (PFS_BASE + 4)
|
||||
#define PFS_REQ_PUT_FILP (PFS_BASE + 5)
|
||||
#define PFS_REQ_CANCEL_FD (PFS_BASE + 6)
|
||||
|
||||
#define PFS_NREQS 7
|
||||
|
||||
#define IS_PFS_VFS_RQ(type) (type >= PFS_BASE && \
|
||||
type < (PFS_BASE + PFS_NREQS))
|
||||
|
||||
#endif
|
||||
|
||||
|
|
|
@ -9,6 +9,19 @@
|
|||
#include <minix/ioctl.h>
|
||||
#include <sys/un.h>
|
||||
|
||||
#ifndef _SOCKLEN_T
|
||||
#define _SOCKLEN_T
|
||||
typedef int32_t socklen_t;
|
||||
#endif /* _SOCKLEN_T */
|
||||
|
||||
#define MSG_CONTROL_MAX (1024 - sizeof(socklen_t))
|
||||
struct msg_control
|
||||
{
|
||||
char msg_control[MSG_CONTROL_MAX];
|
||||
socklen_t msg_controllen;
|
||||
};
|
||||
|
||||
|
||||
/* Network ioctls. */
|
||||
#define NWIOSETHOPT _IOW('n', 16, struct nwio_ethopt)
|
||||
#define NWIOGETHOPT _IOR('n', 17, struct nwio_ethopt)
|
||||
|
@ -51,17 +64,19 @@
|
|||
#define NWIOGUDPOPT _IOR('n', 65, struct nwio_udpopt)
|
||||
#define NWIOUDPPEEK _IOR('n', 66, struct udp_io_hdr)
|
||||
|
||||
#define NWIOGUDSFADDR _IOR('n', 67, struct sockaddr_un) /* recvfrom() */
|
||||
#define NWIOSUDSTADDR _IOW('n', 68, struct sockaddr_un) /* sendto() */
|
||||
#define NWIOSUDSADDR _IOW('n', 69, struct sockaddr_un) /* bind() */
|
||||
#define NWIOGUDSADDR _IOR('n', 70, struct sockaddr_un) /* getsockname() */
|
||||
#define NWIOGUDSPADDR _IOR('n', 71, struct sockaddr_un) /* getpeername() */
|
||||
#define NWIOSUDSTYPE _IOW('n', 72, int) /* socket() */
|
||||
#define NWIOSUDSBLOG _IOW('n', 73, int) /* listen() */
|
||||
#define NWIOSUDSCONN _IOW('n', 74, struct sockaddr_un) /* connect() */
|
||||
#define NWIOSUDSSHUT _IOW('n', 75, int) /* shutdown() */
|
||||
#define NWIOSUDSPAIR _IOW('n', 76, dev_t) /* socketpair() */
|
||||
#define NWIOSUDSACCEPT _IOW('n', 77, struct sockaddr_un) /* accept() */
|
||||
#define NWIOGUDSFADDR _IOR ('n', 67, struct sockaddr_un) /* recvfrom() */
|
||||
#define NWIOSUDSTADDR _IOW ('n', 68, struct sockaddr_un) /* sendto() */
|
||||
#define NWIOSUDSADDR _IOW ('n', 69, struct sockaddr_un) /* bind() */
|
||||
#define NWIOGUDSADDR _IOR ('n', 70, struct sockaddr_un) /* getsockname() */
|
||||
#define NWIOGUDSPADDR _IOR ('n', 71, struct sockaddr_un) /* getpeername() */
|
||||
#define NWIOSUDSTYPE _IOW ('n', 72, int) /* socket() */
|
||||
#define NWIOSUDSBLOG _IOW ('n', 73, int) /* listen() */
|
||||
#define NWIOSUDSCONN _IOW ('n', 74, struct sockaddr_un) /* connect() */
|
||||
#define NWIOSUDSSHUT _IOW ('n', 75, int) /* shutdown() */
|
||||
#define NWIOSUDSPAIR _IOW ('n', 76, dev_t) /* socketpair() */
|
||||
#define NWIOSUDSACCEPT _IOW ('n', 77, struct sockaddr_un) /* accept() */
|
||||
#define NWIOSUDSCTRL _IOW ('n', 78, struct msg_control) /* sendmsg() */
|
||||
#define NWIOGUDSCTRL _IORW('n', 79, struct msg_control) /* recvmsg() */
|
||||
|
||||
#define NWIOSPSIPOPT _IOW('n', 80, struct nwio_psipopt)
|
||||
#define NWIOGPSIPOPT _IOR('n', 81, struct nwio_psipopt)
|
||||
|
|
|
@ -45,7 +45,10 @@ sys/socket.h
|
|||
typedef uint8_t sa_family_t;
|
||||
#endif /* _SA_FAMILY_T */
|
||||
|
||||
#ifndef _SOCKLEN_T
|
||||
#define _SOCKLEN_T
|
||||
typedef int32_t socklen_t;
|
||||
#endif /* _SOCKLEN_T */
|
||||
|
||||
struct sockaddr
|
||||
{
|
||||
|
@ -94,6 +97,12 @@ struct cmsghdr
|
|||
#define CMSG_DATA(cmsg) \
|
||||
( (unsigned char *)(cmsg) + CMSG_ALIGN(sizeof(struct cmsghdr)) )
|
||||
|
||||
#define CMSG_SPACE(len) \
|
||||
( CMSG_ALIGN(len) + CMSG_ALIGN(sizeof(struct cmsghdr)) )
|
||||
|
||||
#define CMSG_LEN(len) \
|
||||
( len + CMSG_ALIGN(sizeof(struct cmsghdr)) )
|
||||
|
||||
#define SCM_RIGHTS 0x01
|
||||
#define SCM_CREDENTIALS 0x02
|
||||
#define SCM_SECURITY 0x04
|
||||
|
|
|
@ -86,6 +86,7 @@ const char *_sys_errlist[] = {
|
|||
"Operation not supported", /* EOPNOTSUPP */
|
||||
"Network is down", /* ENETDOWN */
|
||||
"Protocol family not supported", /* EPFNOSUPPORT */
|
||||
"Destination address required", /* EDESTADDRREQ */
|
||||
};
|
||||
|
||||
const int _sys_nerr = sizeof(_sys_errlist) / sizeof(_sys_errlist[0]);
|
||||
|
|
|
@ -365,8 +365,10 @@ for example, trying to
|
|||
a connection on a datagram socket.
|
||||
.It Er 77 ENETDOWN Em "Network is down" .
|
||||
A socket operation encountered a dead network.
|
||||
.It Er 77 EPFNOSUPPORT Em "Protocol family not supported" .
|
||||
.It Er 78 EPFNOSUPPORT Em "Protocol family not supported" .
|
||||
A socket operation specified an unsupported protocol family.
|
||||
.It Er 79 EDESTADDRREQ Em "Destination address required" .
|
||||
A required address was omitted from an operation on a socket.
|
||||
.El
|
||||
.Sh DEFINITIONS
|
||||
.Bl -tag -width Ds
|
||||
|
|
Loading…
Reference in a new issue