The following table from the POSIX standard [IEEE Std 1003.1:2013] defines a set of functions that are asynchronous-signal-safe. Applications may invoke these functions, without restriction, from a signal handler.
Asynchronous-Signal-Safe Functions Functions
All functions not listed in this table are considered to be unsafe with respect to signals. In the presence of signals, all POSIX functions behave as defined when called from or interrupted by a signal handler, with a single exception: when a signal interrupts an unsafe function and the signal handler calls an unsafe function, the behavior is undefined.
Subclause 188.8.131.52, paragraph 4, of the C Standard [ISO/IEC 9899:2011] states:
If the signal occurs as the result of calling the
raisefunctionthe abort or raise function, the signal handler shall not call the
raisefunctionthe raise function.
However, in the description of
signal(), POSIX states:
This restriction does not apply to POSIX applications, as POSIX.1-2008 requires
raise()to be async-signal-safe
See also undefined behavior 131.
signal() manual page lists a few additional functions that are asynchronous-safe in OpenBSD but "probably not on other systems," including
syslog_r() (but only when the
syslog_data struct is initialized as a local variable).