Unix FD Passing

Thiago Macieira thiago at kde.org
Sun Apr 26 01:15:49 PDT 2009

Havoc Pennington wrote:
>+                       |MSG_CMSG_CLOEXEC
>To work if this doesn't exist, we'd need to manually set cloexec later
>#ifndef MSG_CMSG_CLOEXEC, right? Or else un-#ifdef this and just
>assume we have this if we have fd passing.

Same problem as the other CLOEXEC: you can't guarantee that the kernel 
you're running on understands these flags.

I haven't checked the kernel sources, but if it uses flags here like in 
open(2), it will ignore unknown flags. That means you get no indication 
that the kernel doesn't support MSG_CMSG_CLOEXEC.

In other words, do fcntl(fd, F_SETFD, FD_CLOEXEC) anyways.

  Thiago Macieira  -  thiago (AT) macieira.info - thiago (AT) kde.org
    PGP/GPG: 0x6EF45358; fingerprint:
    E067 918B B660 DBD1 105C  966C 33F5 F005 6EF4 5358
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: This is a digitally signed message part.
Url : http://lists.freedesktop.org/archives/dbus/attachments/20090426/ab38db24/attachment-0001.pgp 

More information about the dbus mailing list