DBUS_TYPE_LINUX_CRED ?

Thiago Macieira thiago at kde.org
Fri Dec 13 20:26:22 PST 2013


On sábado, 14 de dezembro de 2013 04:30:22, Lennart Poettering wrote:
> I'd certainly enjoy it if we could get fds to processes by opening
> /proc/$PID, and then get translated access to its properties, and best
> would even be if we get a POLLHUP or so when the process dies... And if
> the exit status would be retrievable via /proc/$PID, too, and the PID
> not released until the last fd to it is closed. If we had that then we
> suddenly would have a useful identifier for a process that is not
> subject to reuse, that is race-free and quite comprehensive, and nobody
> would have to deal anymore with that awful nonsense that is wait()...

Hear hear.

But we could do that by having forkfd too: get a file descriptor that 
represents the child process. When the child exits, the fd becomes readable 
and you get to read a struct siginfo_t from it (which contains the exit 
status).

Since it's a file descriptor, you can pass it to other processes, that can then 
wait for the process, not just the parent process or PID 1.

More importantly, forkfd would be thread-safe and have thread-safe exit 
notifications. Handling SIGCHLD thread-safely from a library is impossible and 
it gets worse when you have multiple libraries competing for the signal 
handler.

-- 
Thiago Macieira - thiago (AT) macieira.info - thiago (AT) kde.org
   Software Architect - Intel Open Source Technology Center
      PGP/GPG: 0x6EF45358; fingerprint:
      E067 918B B660 DBD1 105C  966C 33F5 F005 6EF4 5358
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 190 bytes
Desc: This is a digitally signed message part.
URL: <http://lists.freedesktop.org/archives/dbus/attachments/20131213/c97a1ffa/attachment.pgp>


More information about the dbus mailing list