On 03/03/2011 10:33 PM, Eric Blake wrote:
I just createdhttp://sourceware.org/bugzilla/show_bug.cgi?id=12539 - it would be nice if the kernel and glibc would give us a way to atomically set the FD_CLOEXEC flag on fd's created by recvfd. But even without atomic support from the kernel, it would be nice for gnulib to provide provide something like recvfd2(int sock, int flags), where flags can be O_CLOEXEC (or maybe SOCK_CLOEXEC), as a way to set it as soon as possible after receiving the fd, in anticipation of the kernel catching up and providing such an interface.
Good idea. This is already implemented in the kernel as MSG_CMSG_CLOEXEC, but I like mapping it to O_CLOEXEC in the gnulib API.
Paolo