Is there any reasonably complete list of which functions in POSIX are interrupted with EINTR
when a signal is received or handled, even if there is no signal handler or if the handler was installed with SA_RESTART
? Some examples:
select
nanosleep
Signal handlers can be interrupted by signals, including their own. If a signal is not reset before its handler is called, the handler can interrupt its own execution. A handler that always successfully executes its code despite interrupting itself or being interrupted is async-signal-safe.
SA_RESTART. This flag affects the behavior of interruptible functions; that is, those specified to fail with errno set to [EINTR]. If set, and a function specified as interruptible is interrupted by this signal, the function shall restart and shall not fail with [EINTR] unless otherwise specified.
The signal() function does not (necessarily) block other signals from arriving while the current handler is executing; sigaction() can block other signals until the current handler returns. The signal() function (usually) resets the signal action back to SIG_DFL (default) for almost all signals.
(Two signals, SIGKILL and SIGSTOP , cannot be blocked. These signals also cannot be handled and, therefore, always cause their default actions.)
tcsetattr is also not restartable, at least in Linux 2.6.18
POSIX says:
If the signal-catching function executes a return statement, the behavior of the interrupted function shall be as described individually for that function, except as noted for unsafe functions.
So, either you look through all functions individually or filter your man pages for EINTR and POSIX. I did the latter and got:
accept, aio_suspend, catclose, catgets, chmod, chown, clock_nanosleep, close, closedir, connect, dup, errno, exec, fallocate, fchdir, fchmod, fchown, fclose, fcntl, fflush, fgetc, fgetwc, fopen, fork, fputc, fputwc, freopen, fseek, fsetpos, fsync, ftruncate, getgrent, getgrgid, getgrnam, getmsg, getpwent, getpwnam, getpwuid, ioctl, lchown, lio_listio, lockf, mq_open, mq_receive, mq_send, msgop, msgrcv, msgsnd, nanosleep, open, pause, pclose, poll, posix_fallocate, posix_mem_offset, posix_trace_create, posix_trace_get_filter, posix_trace_getnext_event, posix_trace_open, posix_trace_start, posix_typed_mem_get_info, posix_typed_mem_open, printf, pthread_atfork, pthread_attr_getdetachstate, pthread_attr_getguardsize, pthread_attr_getinheritsched, pthread_attr_getschedparam, pthread_attr_getschedpolicy, pthread_attr_getscope, pthread_attr_getstack, pthread_attr_getstackaddr, pthread_attr_getstacksize, pthread_attr_init, pthread_barrier_init, pthread_barrier_wait, pthread_barrierattr_getpshared, pthread_barrierattr_init, pthread_cancel, pthread_cleanup_push, pthread_cond_init, pthread_cond_signal, pthread_cond_wait, pthread_condattr_getclock, pthread_condattr_getpshared, pthread_condattr_init, pthread_create, pthread_detach, pthread_equal, pthread_getconcurrency, pthread_getschedparam, pthread_getspecific, pthread_join, pthread_key_create, pthread_key_delete, pthread_kill, pthread_mutex_getprioceiling, pthread_mutex_init, pthread_mutex_lock, pthread_mutex_timedlock, pthread_mutexattr_getprioceiling, pthread_mutexattr_getprotocol, pthread_mutexattr_getpshared, pthread_mutexattr_gettype, pthread_mutexattr_init, pthread_once, pthread_rwlock_init, pthread_rwlock_rdlock, pthread_rwlock_timedrdlock, pthread_rwlock_timedwrlock, pthread_rwlock_unlock, pthread_rwlock_wrlock, pthread_rwlockattr_getpshared, pthread_rwlockattr_init, pthread_self, pthread_setschedprio, pthread_spin_init, pthread_spin_lock, pthread_spin_unlock, pthread_testcancel, putmsg, read, recv, recvfrom, recvmsg, scanf, select, select_tut, sem_open, sem_timedwait, sem_wait, semop, send, sendmsg, sendto, shm_open, sigaction, siginterrupt, sigpause, sigprocmask, sigset, sigsuspend, sigvec, sigwaitinfo, statfs, statvfs, system, tcdrain, tcsetattr, tmpfile, truncate, ualarm, usleep, wait, waitid and write
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With