Let's try again.
The C standard says this:
4 The functions in the standard library are not guaranteed to be
reentrant and may modify objects with static storage
duration.158)
158) Thus, a signal handler cannot, in general, call
standard library functions.
...
5 If the signal occurs other than as the result of calling the
abort or raise function, the behavior is undefined if the
signal handler refers to any object with static storage
duration other than by assigning a value to an object
declared as volatile sig_atomic_t, or the signal handler
calls any function in the standard library other than the
abort function, the _Exit function, or the signal function
with the first argument equal to the signal number
corresponding to the signal that caused the invocation of
the handler. Furthermore, if such a call to the signal
function results in a SIG_ERR return, the value of errno is
indeterminate.211)
So, here's your list: abort(), _Exit(), and (with some
restrictions) signal().
It'd be better to ask about that in a GNU or Linux group.
Indeed. I think this list is a little short. Attached below is
the list we supply our customers (on request) of writable static
data and how we protect it. We use:
TLS -- thread-local storage
MALLOC -- thread lock for mallocs (when heap is shared)
LOCALE -- thread lock for locales (when locales are shared)
STREAM -- thread lock for each FILE object (when streams are shared)
UNPROTECTED -- for program termination
Most of the time the file name suggests the corresponding
function, so I won't bother to translate.
HTH,
P.J. Plauger
Dinkumware, Ltd.
http://www.dinkumware.com
-------
asctime.c -- contains time formatting information that can be changed by
a call to setlocale, plus the default time string buffer [TLS]
atexit.c -- contains the stack of functions to call at exit time [MALLOC]
exit.c -- pops the stack of functions to call at exit time [UNPROTECTED]
fclose.c -- contains the list of files to close at exit time [UNPROTECTED]
localeco.c -- contains numeric, monetary, and message information that
can be changed by a call to setlocale [TLS]
localtim.c -- contains timezone information that can be changed by a call
to setlocale [TLS]
malloc.c -- contains the root of the heap [MALLOC]
mbrlen.c -- contains a default mbstate_t object [TLS]
mbrtowc.c -- contains a default mbstate_t object [TLS]
mbsrtowc.c -- contains a default mbstate_t object [TLS]
mbtowc.c -- contains a default mbstate_t object [TLS]
rand.c -- contains the seed for random numbers [TLS]
setlocal.c -- contains current locale information that can be changed by
a call to setlocale [TLS]
signal.c -- contains a table of signal handlers that can be changed by
a call to signal [MALLOC]
strtok.c -- contains a pointer to the string currently being parsed [TLS]
tmpnam.c -- contains the current temporary file name [MALLOC]
wcrtomb.c -- contains a default mbstate_t object [TLS]
wcsrtomb.c -- contains a default mbstate_t object [TLS]
wctomb.c -- contains a default mbstate_t object [TLS]
xfiles.c -- contains the FILE objects [fclose/fflush/fopen STREAM]
xgetloc.c -- contains locale information that can be changed by
a call to setlocale [LOCALE]
xgetzone.c -- contains timezone information that can be changed by
a call to setlocale [LOCALE]
xisdst.c -- contains timezone information that can be changed by
a call to setlocale [TLS]
xstrerro.c -- contains the default buffer used by strerror [TLS]
xctype.c -- contains ctype information that can be changed by
a call to setlocale [TLS]
xdefloc.c -- contains default locale information that can be changed by
a call to setlocale [LOCALE]
xlocterm.c -- contains locale parsing information that can be changed
by a call to setlocale [TLS]
xstate.c -- contains ctype information that can be changed by
a call to setlocale [TLS]
xtolotab.c -- contains ctype information that can be changed by
a call to setlocale [TLS]
xtouptab.c -- contains ctype information that can be changed by
a call to setlocale [TLS]
xttotm.c -- contains default tm structure used by gmtime and localtime [TLS]
xwctrtab.c -- contains ctype information that can be changed by
a call to setlocale [TLS]
xwctytab.c -- contains ctype information that can be changed by
a call to setlocale [TLS]