Alan Somers
2023-12-01 16:26:51 UTC
fork() is not async-signal-safe, and therefore can't be used in a
signal handler. Nor can it be used from a multithreaded program
(unless the child only executes aysnc-signal-safe functions).
_Fork(), OTOH, is async-signal-safe. According to fork(2), "It can be
used safely from signal handlers, but then no userspace services
(malloc(3) or rtld(1)) are available in the child if forked from
multi-threaded parent."
But can you use malloc and rtld in the child if _Fork was invoked from
a multi-threaded process, but not from a signal handler? That's not
clear to me.
And what about pdfork? Neither sigaction(2) nor pdfork(2) specify
whether pdfork is async-signal-safe. Is it?
FYI the reason I'm asking is that I'm trying to determine whether it
would be possible to make cap_init() async-signal-safe.
-Alan
--
Posted automagically by a mail2news gateway at muc.de e.V.
Please direct questions, flames, donations, etc. to news-***@muc.de
signal handler. Nor can it be used from a multithreaded program
(unless the child only executes aysnc-signal-safe functions).
_Fork(), OTOH, is async-signal-safe. According to fork(2), "It can be
used safely from signal handlers, but then no userspace services
(malloc(3) or rtld(1)) are available in the child if forked from
multi-threaded parent."
But can you use malloc and rtld in the child if _Fork was invoked from
a multi-threaded process, but not from a signal handler? That's not
clear to me.
And what about pdfork? Neither sigaction(2) nor pdfork(2) specify
whether pdfork is async-signal-safe. Is it?
FYI the reason I'm asking is that I'm trying to determine whether it
would be possible to make cap_init() async-signal-safe.
-Alan
--
Posted automagically by a mail2news gateway at muc.de e.V.
Please direct questions, flames, donations, etc. to news-***@muc.de