From owner-freebsd-current@FreeBSD.ORG Sun May 6 12:43:51 2007 Return-Path: X-Original-To: current@FreeBSD.org Delivered-To: freebsd-current@FreeBSD.ORG Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 55FED16A40D for ; Sun, 6 May 2007 12:43:51 +0000 (UTC) (envelope-from rwatson@FreeBSD.org) Received: from cyrus.watson.org (cyrus.watson.org [209.31.154.42]) by mx1.freebsd.org (Postfix) with ESMTP id CAB9B13C483 for ; Sun, 6 May 2007 12:43:50 +0000 (UTC) (envelope-from rwatson@FreeBSD.org) Received: from fledge.watson.org (fledge.watson.org [209.31.154.41]) by cyrus.watson.org (Postfix) with ESMTP id 427FF46F8A for ; Sun, 6 May 2007 08:43:50 -0400 (EDT) Date: Sun, 6 May 2007 13:43:50 +0100 (BST) From: Robert Watson X-X-Sender: robert@fledge.watson.org To: current@FreeBSD.org Message-ID: <20070506131854.D24765@fledge.watson.org> MIME-Version: 1.0 Content-Type: MULTIPART/MIXED; BOUNDARY="0-1570903904-1178455430=:24765" X-Content-Filtered-By: Mailman/MimeDel 2.1.5 Cc: Subject: sigaction: queried SA_RESTART value varies by FreeBSD version? X-BeenThere: freebsd-current@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Discussions about the use of FreeBSD-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 06 May 2007 12:43:51 -0000 This message is in MIME format. The first part should be readable text, while the remaining parts are likely unreadable without MIME-aware tools. --0-1570903904-1178455430=:24765 Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed 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@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@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@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@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@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 --0-1570903904-1178455430=:24765--