List of routines safe to use in signals?

Geoff Clare gwc at root.co.uk
Tue Dec 18 03:22:58 AEST 1990


In <RANG.90Dec10231747 at nexus.cs.wisc.edu> rang at cs.wisc.edu (Anton Rang) writes:

>  Is there a list of library routines which can safely be used within
>a signal handler under any of the "standard" UNIX versions (preferably
>POSIX, but I'd like BSD 4.3 and SVR4 info as well)?  Presumably this
>is in the POSIX standard, but if anybody has an online copy of such a
>list, I'd appreciate it.

I've seen a lot of replies to this question saying effectively that the only
safe thing you can do in a signal handler is set a flag of type sig_atomic_t.

That may be what the 'C' standard, says but this is comp.unix.programmer,
not comp.lang.c!  And Anton specifically asked about POSIX in his question!
There is a long list of interfaces that POSIX guarantees are safe to use
in signal handlers.  I've been waiting to see if anyone else posts the list,
but nobody has, so I'll do it.  I don't have the text of POSIX.1 on line,
but I do have the latest draft of POSIX.3, and the list should be the same
(I haven't checked it).  Here it is:

	_exit, access, alarm, cfgetispeed, cfgetospeed, cfsetispeed,
	cfsetospeed, chdir, chmod, chown, close, creat, dup, dup2,
	execle, execve, fcntl, fork, fstat, getegid, geteuid, getgid,
	getgroups, getpgrp, getpid, getppid, getuid, kill, kill, link,
	lseek, mkdir, mkfifo, open, pathconf, pause, pipe, read, rename,
	rmdir, setgid, setpgid, setsid, setuid, sigaction, sigaddset,
	sigdelset, sigemptyset, sigfillset, sigpending, sigprocmask,
	sigprocmask, sigsimember, sigsuspend, sleep, stat, sysconf,
	tcflow, tcflush, tcgetattr, tcgetpgrp, tcsendbreak, tcsetattr,
	tcsetpgrp, time, times, umask, uname, unlink, ustat, utime
	wait, waitpid, and write.

-- 
Geoff Clare <gwc at root.co.uk>  (Dumb American mailers: ...!uunet!root.co.uk!gwc)
UniSoft Limited, Hayne Street, London EC1A 9HH, England.   Tel: +44-71-315-6600



More information about the Comp.unix.programmer mailing list