Lines Matching +full:control +full:-

12 .Nd socket control message routines for ancillary data access
26 The control message API is used to construct ancillary data objects for
27 use in control messages sent and received across sockets.
29 Control messages are passed around by the
38 is used to specify a chain of control messages.
40 These routines should be used instead of directly accessing the control
45 .Bl -tag -width Ds
47 This routine accesses the data portion of the control message header
52 This routine accesses the first control message attached to the
55 If no control messages are attached to the message, this routine
59 This routine determines the size in bytes of a control message,
60 which includes the control message header.
62 specifies the length of the data held by the control message.
65 of each control message.
69 This routine returns the location of the control message following
75 is the last control message in the chain, this routine returns
78 This routine determines the size in bytes needed to hold a control
81 which includes the control message header.
85 ancillary data as well as any needed to pad the next control message.
88 The following example constructs a control message containing a file descriptor
89 in the parent process and passes it over a pre-shared socket over the child
93 .Bd -literal
117 if (socketpair(PF_LOCAL, SOCK_STREAM, 0, presharedfd) == -1)
118 err(EX_OSERR, "failed to create a pre-shared socket pair");
127 case -1:
133 if (recvmsg(presharedfd[1], &msg, 0) == -1)
136 errx(EX_IOERR, "control message truncated");
139 if (cmsg->cmsg_len == CMSG_LEN(sizeof(int)) &&
140 cmsg->cmsg_level == SOL_SOCKET &&
141 cmsg->cmsg_type == SCM_RIGHTS) {
144 if (write(hellofd[1], buf, HELLOLEN) == -1)
152 if (socketpair(PF_LOCAL, SOCK_STREAM, 0, hellofd) == -1)
156 cmsg->cmsg_len = CMSG_LEN(sizeof(int));
157 cmsg->cmsg_level = SOL_SOCKET;
158 cmsg->cmsg_type = SCM_RIGHTS;
161 if (sendmsg(presharedfd[0], &msg, 0) == -1)
165 if (read(hellofd[0], buf, HELLOLEN) == -1)
182 .Bl -item
203 The control message API first appeared in