sigaction: queried SA_RESTART value varies by FreeBSD version?

From: Robert Watson <rwatson_at_FreeBSD.org>
Date: Sun, 6 May 2007 13:43:50 +0100 (BST)
While writing a regression test for signal-handling as related to socket 
locking, I ran into the following slightly surprising issue.  In order to test 
properly, I need the recv(2) system call to not automatically restart.  Being 
a bit on the cautious side, I decided I would check the SA_RESTART disposition 
of the signal before setting it, and was a bit surprised to see that the 
debugging output varied across FreeBSD versions.  In particular, I was using 
SIGHUP in my tests, which seems to have recently changed (if kernel versions 
are at all meaningful -- perhaps the field is just garbage).

I will be the first to admit I don't know how this is supposed to work, but 
variation in the default value of SA_RESTART for signals strikes me as a 
worrying thing.  Could someone point me in the right direction here?

Robert N M Watson
Computer Laboratory
University of Cambridge

pemaquid:/tmp> uname -a
FreeBSD pemaquid.x 4.11-STABLE FreeBSD 4.11-STABLE #10: Wed Dec 28 
01:05:22 EST 2005     x_at_pemaquid.x:/usr/obj/usr/src/sys/PEMAQUID  i386
pemaquid:/tmp> ./sarestart
SIGHUP: (0x00000002) SA_RESTART
SIGINT: (0x00000002) SA_RESTART
SIGQUIT: (0x00000002) SA_RESTART
SIGILL: (0x00000000)
SIGTRAP: (0x00000002) SA_RESTART
SIGABRT: (0x00000000)
SIGEMT: (0x00000002) SA_RESTART
SIGFPE: (0x00000000)
SIGKILL: (0x00000002) SA_RESTART
SIGBUS: (0x00000000)
SIGSEGV: (0x00000000)
SIGSYS: (0x00000000)
SIGPIPE: (0x00000002) SA_RESTART
SIGALRM: (0x00000002) SA_RESTART
SIGTERM: (0x00000002) SA_RESTART
SIGURG: (0x00000002) SA_RESTART
SIGSTOP: (0x00000002) SA_RESTART
SIGTSTP: (0x00000002) SA_RESTART
SIGCONT: (0x00000002) SA_RESTART
SIGCHLD: (0x00000002) SA_RESTART
SIGTTIN: (0x00000002) SA_RESTART
SIGTTOU: (0x00000002) SA_RESTART
SIGIO: (0x00000002) SA_RESTART
SIGXCPU: (0x00000002) SA_RESTART
SIGXFSZ: (0x00000002) SA_RESTART
SIGVTALRM: (0x00000002) SA_RESTART
SIGPROF: (0x00000002) SA_RESTART
SIGWINCH: (0x00000002) SA_RESTART
SIGINFO: (0x00000002) SA_RESTART
SIGUSR1: (0x00000000)
SIGUSR2: (0x00000000)

fledge:/tmp> uname -a
FreeBSD fledge.watson.org 6.2-STABLE FreeBSD 6.2-STABLE #11: Mon Apr  2 
17:45:01 BST 2007     robert_at_fledge.watson.org:/usr/obj/usr/src/sys/FLEDGE 
i386
fledge:/tmp> ./sarestart
SIGHUP: (0x00000002) SA_RESTART
SIGINT: (0x00000002) SA_RESTART
SIGQUIT: (0x00000002) SA_RESTART
SIGILL: (0x00000000)
SIGTRAP: (0x00000002) SA_RESTART
SIGABRT: (0x00000000)
SIGEMT: (0x00000002) SA_RESTART
SIGFPE: (0x00000000)
SIGKILL: (0x00000002) SA_RESTART
SIGBUS: (0x00000000)
SIGSEGV: (0x00000000)
SIGSYS: (0x00000000)
SIGPIPE: (0x00000000)
SIGALRM: (0x00000002) SA_RESTART
SIGTERM: (0x00000002) SA_RESTART
SIGURG: (0x00000002) SA_RESTART
SIGSTOP: (0x00000002) SA_RESTART
SIGTSTP: (0x00000002) SA_RESTART
SIGCONT: (0x00000002) SA_RESTART
SIGCHLD: (0x00000002) SA_RESTART
SIGTTIN: (0x00000002) SA_RESTART
SIGTTOU: (0x00000002) SA_RESTART
SIGIO: (0x00000002) SA_RESTART
SIGXCPU: (0x00000002) SA_RESTART
SIGXFSZ: (0x00000002) SA_RESTART
SIGVTALRM: (0x00000002) SA_RESTART
SIGPROF: (0x00000002) SA_RESTART
SIGWINCH: (0x00000002) SA_RESTART
SIGINFO: (0x00000002) SA_RESTART
SIGUSR1: (0x00000000)
SIGUSR2: (0x00000000)
SIGTHR: (0x00000002) SA_RESTART

peppercorn:~/freebsd/sarestart> uname -a
FreeBSD peppercorn.cam.watson.org 7.0-CURRENT FreeBSD 7.0-CURRENT #10: Wed Feb 
7 12:56:20 GMT 2007 
robert_at_peppercorn.cam.watson.org:/usr/obj/usr/src/sys/PEPPERCORN  i386
peppercorn:~/freebsd/sarestart> ./sarestart
SIGHUP: (0x00000002) SA_RESTART
SIGINT: (0x00000002) SA_RESTART
SIGQUIT: (0x00000002) SA_RESTART
SIGILL: (0x00000040) SA_SIGINFO
SIGTRAP: (0x00000040) SA_SIGINFO
SIGABRT: (0x00000040) SA_SIGINFO
SIGEMT: (0x00000040) SA_SIGINFO
SIGFPE: (0x00000040) SA_SIGINFO
SIGKILL: (0x00000040) SA_SIGINFO
SIGBUS: (0x00000040) SA_SIGINFO
SIGSEGV: (0x00000040) SA_SIGINFO
SIGSYS: (0x00000040) SA_SIGINFO
SIGPIPE: (0x00000040) SA_SIGINFO
SIGALRM: (0x00000002) SA_RESTART
SIGTERM: (0x00000002) SA_RESTART
SIGURG: (0x00000040) SA_SIGINFO
SIGSTOP: (0x00000040) SA_SIGINFO
SIGTSTP: (0x00000002) SA_RESTART
SIGCONT: (0x00000040) SA_SIGINFO
SIGCHLD: (0x00000002) SA_RESTART
SIGTTIN: (0x00000002) SA_RESTART
SIGTTOU: (0x00000002) SA_RESTART
SIGIO: (0x00000040) SA_SIGINFO
SIGXCPU: (0x00000002) SA_RESTART
SIGXFSZ: (0x00000002) SA_RESTART
SIGVTALRM: (0x00000040) SA_SIGINFO
SIGPROF: (0x00000040) SA_SIGINFO
SIGWINCH: (0x00000002) SA_RESTART
SIGINFO: (0x00000040) SA_SIGINFO
SIGUSR1: (0x00000040) SA_SIGINFO
SIGUSR2: (0x00000040) SA_SIGINFO
SIGTHR: (0x00000002) SA_RESTART

hippo# uname -a
FreeBSD hippo 7.0-CURRENT FreeBSD 7.0-CURRENT #0: Mon Apr 30 07:34:29 EDT 2007 
rwatson_at_zoo.freebsd.org:/zoo/rwatson/current/src/sys/i386/compile/GENERIC 
i386
.hippo# ./sarestart
SIGHUP: (0x00000000)
SIGINT: (0x00000002) SA_RESTART
SIGQUIT: (0x00000002) SA_RESTART
SIGILL: (0x00000000)
SIGTRAP: (0x00000002) SA_RESTART
SIGABRT: (0x00000000)
SIGEMT: (0x00000002) SA_RESTART
SIGFPE: (0x00000000)
SIGKILL: (0x00000002) SA_RESTART
SIGBUS: (0x00000000)
SIGSEGV: (0x00000000)
SIGSYS: (0x00000000)
SIGPIPE: (0x00000002) SA_RESTART
SIGALRM: (0x00000000)
SIGTERM: (0x00000000)
SIGURG: (0x00000002) SA_RESTART
SIGSTOP: (0x00000002) SA_RESTART
SIGTSTP: (0x00000002) SA_RESTART
SIGCONT: (0x00000002) SA_RESTART
SIGCHLD: (0x00000000)
SIGTTIN: (0x00000002) SA_RESTART
SIGTTOU: (0x00000002) SA_RESTART
SIGIO: (0x00000002) SA_RESTART
SIGXCPU: (0x00000000)
SIGXFSZ: (0x00000000)
SIGVTALRM: (0x00000002) SA_RESTART
SIGPROF: (0x00000002) SA_RESTART
SIGWINCH: (0x00000002) SA_RESTART
SIGINFO: (0x00000002) SA_RESTART
SIGUSR1: (0x00000000)
SIGUSR2: (0x00000000)
SIGTHR: (0x00000002) SA_RESTART

elephant# uname -a
FreeBSD elephant.netperf.freebsd.org 7.0-CURRENT FreeBSD 7.0-CURRENT #26: Sun 
May  6 07:02:03 EDT 2007 
rwatson_at_zoo.freebsd.org:/zoo/usr.obj/rwatson/netperf/src/sys/GENERIC  i386
elephant# ./sarestart
SIGHUP: (0x00000000)
SIGINT: (0x00000002) SA_RESTART
SIGQUIT: (0x00000002) SA_RESTART
SIGILL: (0x00000000)
SIGTRAP: (0x00000002) SA_RESTART
SIGABRT: (0x00000000)
SIGEMT: (0x00000002) SA_RESTART
SIGFPE: (0x00000000)
SIGKILL: (0x00000002) SA_RESTART
SIGBUS: (0x00000000)
SIGSEGV: (0x00000000)
SIGSYS: (0x00000000)
SIGPIPE: (0x00000002) SA_RESTART
SIGALRM: (0x00000000)
SIGTERM: (0x00000000)
SIGURG: (0x00000002) SA_RESTART
SIGSTOP: (0x00000002) SA_RESTART
SIGTSTP: (0x00000002) SA_RESTART
SIGCONT: (0x00000002) SA_RESTART
SIGCHLD: (0x00000000)
SIGTTIN: (0x00000002) SA_RESTART
SIGTTOU: (0x00000002) SA_RESTART
SIGIO: (0x00000002) SA_RESTART
SIGXCPU: (0x00000000)
SIGXFSZ: (0x00000000)
SIGVTALRM: (0x00000002) SA_RESTART
SIGPROF: (0x00000002) SA_RESTART
SIGWINCH: (0x00000002) SA_RESTART
SIGINFO: (0x00000002) SA_RESTART
SIGUSR1: (0x00000000)
SIGUSR2: (0x00000000)
SIGTHR: (0x00000002) SA_RESTART
Received on Sun May 06 2007 - 10:43:51 UTC

This archive was generated by hypermail 2.4.0 : Wed May 19 2021 - 11:39:09 UTC