1 #include <sys/socket.h>
7 ssize_t sendmsg(int fd, const struct msghdr *msg, int flags)
11 /* Kernels before 2.6.38 set SCM_MAX_FD to 255, allocate enough
12 * space to support an SCM_RIGHTS ancillary message with 255 fds.
13 * Kernels since 2.6.38 set SCM_MAX_FD to 253. */
14 struct cmsghdr chbuf[CMSG_SPACE(255*sizeof(int))/sizeof(struct cmsghdr)+1], *c;
17 h.__pad1 = h.__pad2 = 0;
19 if (h.msg_controllen) {
20 if (h.msg_controllen > sizeof chbuf) {
24 memcpy(chbuf, h.msg_control, h.msg_controllen);
25 h.msg_control = chbuf;
26 for (c=CMSG_FIRSTHDR(&h); c; c=CMSG_NXTHDR(&h,c))
31 return socketcall_cp(sendmsg, fd, msg, flags, 0, 0, 0);