lib/passfd.c


Log

Author Commit Date CI Message
Jim Meyering 1602f0af 2012-01-01T10:04:58 maint: update all copyright year number ranges Run "make update-copyright".
Bruno Haible 89d10938 2011-04-30T14:05:52 passfd: Add comments. * lib/passfd.c: Add comments about platforms.
Eric Blake 722fc0ac 2011-04-27T09:52:00 passfd: avoid compiler warning Detected on Fedora 13 with -Wshadow. * lib/passfd.c (sendfd, recvfd): Avoid shadowing names. Reported by Laine Stump. Signed-off-by: Eric Blake <eblake@redhat.com>
Eric Blake e5535531 2011-04-21T11:48:22 passfd: speed up configure and drop unused code Ultimately, it would be nice to provide a sendmsg and recvmsg module, and have those provide a replacement struct msghdr and silently convert msg_accrights into the replacement struct's msg_control, when targeting older BSD. But until that point in time, this is a nice cleanup. SCM_RIGHTS really only works on Unix sockets; however, there is nothing in passfd.c that needs to be hard-coded to this (rather, the hard-coding of the address family is done externally when the socket or socketpair is created). * m4/afunix.m4 (gl_SOCKET_AFUNIX): Rename... * m4/passfd.m4 (gl_PASSFD): ...to something more fitting of its use. Drop test for setting unused HAVE_UNIXSOCKET_SCM_RIGHTS. Instead of probing at configure for unix_scm_rights_bsd44_way, instead probe for CMSG_FIRSTHDR at compile time. Simplify BSD 4.3 check to a struct member probe. * lib/passfd.c (includes): Nothing here requires <sys/un.h>. (sendfd, recvfd): Update preprocessor checks. * modules/passfd (Files): Reflect rename, and drop unused file. (Depends-on): Drop unused dependency. Signed-off-by: Eric Blake <eblake@redhat.com>
Eric Blake 06d76f63 2011-04-21T07:16:20 passfd: allow compilation on mingw The passfd module now skips on mingw, rather than failing to compile. It may be nice to add a sendmsg and recvmsg module in the future, but for now passfd is the only client that cares. * modules/sys_socket (Depends-on): Add sys_uio. * lib/sys_socket.in.h [!@HAVE_SYS_SOCKET_H@]: Use it for struct iovec and a minimal struct msghdr. * tests/test-sys_socket.c (main): Enhance test. * m4/afunix.m4 (gl_SOCKET_AFUNIX): Detect recvmsg/sendmsg. * lib/passfd.c (include): Drop <sys/uio.h>; <sys/sockets.h> is guaranteed to provide what we need. (sendmsg, recvmsg): Declare fallbacks if we lack sendmsg. * modules/passfd-tests (Depends-on): Add sys_wait. * tests/test-passfd.c (main): Skip test on mingw, for now. * doc/posix-headers/sys_socket.texi (sys/socket.h): Document the partial 'struct msghdr' implementation. Signed-off-by: Eric Blake <eblake@redhat.com>
Eric Blake f711a2d5 2011-03-30T18:15:33 passfd: fix scoping bug The scoping bug was the cause of the NetBSD hang. * lib/passfd.c (sendfd, passfd): Don't let buf go out of scope before sendmsg/recvmsg. Signed-off-by: Eric Blake <eblake@redhat.com>
Eric Blake 2f681c52 2011-03-30T15:30:13 passfd: standardize coding conventions * m4/afunix.m4 (gl_SOCKET_AFUNIX): Drop check for something that can be learned at compile time. * lib/passfd.c (MSG_CMSG_CLOEXEC): Reduce number of in-function ifdefs. (passfd, recvfd): Follow gnulib code conventions. Signed-off-by: Eric Blake <eblake@redhat.com>
Eric Blake f607f2cd 2011-03-30T14:46:02 passfd: fix incorrect sendmsg arguments The unit test hung on NetBSD, which pointed out a couple of bugs. * lib/passfd.c (sendfd): Avoid uninitialized msg_flags field, and incorrect msg_controllen value. * modules/passfd-tests (Depends-on): Check for alarm. * tests/test-passfd.c (main) [HAVE_DECL_ALARM]: Avoid hanging test. Reported by Bastien ROUCARIES. Signed-off-by: Eric Blake <eblake@redhat.com>
Bruno Haible b24d8be2 2011-03-13T23:45:25 passfd: Fix compilation error on OpenBSD. * lib/passfd.c: Include <sys/uio.h>.
Bastien Roucariès 5d16175c 2011-03-13T16:36:30 passfd module, part 3. * lib/passfd.h (recvfd): Add a flags argument. * lib/passfd.c: Include <fcntl.h>, cloexec.h. (recvfd): Add a flags argument. * m4/afunix.m4 (gl_SOCKET_AFUNIX): Test whether MSG_CMSG_CLOEXEC exists. * modules/passfd (Depends-on): Add cloexec. Suggested by Eric Blake.
Bruno Haible c18d3b0d 2011-03-13T15:36:47 passfd module, part 2, tweaks. * modules/passfd (Files): Reorder. (Depends-on): Remove errno. (Include): Remove <sys/socket.h>, <sys/un.h>. * lib/passfd.h: Use a GPLv3+ header. Make C++ safe. * lib/passfd.c: Untabify. Use a GPLv3+ header. Really include the specification header. Include <sys/socket.h> always. Don't include <winsock2.h>. Use "#if HAVE_..." instead of "#ifdef HAVE_...". (sendfd): Clarify that it sets errno when it fails. (recvfd): Fix specification.
Bastien Roucariès ee195daf 2011-03-13T15:06:52 passfd module, part 2. * modules/passfd: New file. * lib/passfd.h: New file. * lib/passfd.c: New file.