From owner-svn-src-head@FreeBSD.ORG Thu May 6 22:06:15 2010 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 8A5F31065755; Thu, 6 May 2010 22:06:15 +0000 (UTC) (envelope-from jilles@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [69.147.83.44]) by mx1.freebsd.org (Postfix) with ESMTP id 42CE08FC19; Thu, 6 May 2010 22:06:15 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o46M6FjU003517; Thu, 6 May 2010 22:06:15 GMT (envelope-from jilles@svn.freebsd.org) Received: (from jilles@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o46M6FXB003515; Thu, 6 May 2010 22:06:15 GMT (envelope-from jilles@svn.freebsd.org) Message-Id: <201005062206.o46M6FXB003515@svn.freebsd.org> From: Jilles Tjoelker Date: Thu, 6 May 2010 22:06:15 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r207734 - head/lib/libc/sys X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 06 May 2010 22:06:15 -0000 Author: jilles Date: Thu May 6 22:06:14 2010 New Revision: 207734 URL: http://svn.freebsd.org/changeset/base/207734 Log: sigaltstack(2): document some modernizations: * un-document 'struct sigaltstack' tag for stack_t as this is BSD-specific; this doesn't seem useful enough to document as such * alternate stacks are per thread, not per process * update error codes to what the kernel does and POSIX requires MFC after: 1 week Modified: head/lib/libc/sys/sigaltstack.2 Modified: head/lib/libc/sys/sigaltstack.2 ============================================================================== --- head/lib/libc/sys/sigaltstack.2 Thu May 6 21:57:38 2010 (r207733) +++ head/lib/libc/sys/sigaltstack.2 Thu May 6 22:06:14 2010 (r207734) @@ -28,7 +28,7 @@ .\" @(#)sigaltstack.2 8.2 (Berkeley) 5/1/95 .\" $FreeBSD$ .\" -.Dd May 1, 1995 +.Dd May 6, 2010 .Dt SIGALTSTACK 2 .Os .Sh NAME @@ -39,7 +39,7 @@ .Sh SYNOPSIS .In signal.h .Bd -literal -typedef struct sigaltstack { +typedef struct { char *ss_sp; size_t ss_size; int ss_flags; @@ -51,25 +51,25 @@ typedef struct sigaltstack { The .Fn sigaltstack system call -allows users to define an alternate stack on which signals -are to be processed. +allows defining an alternate stack on which signals +are to be processed for the current thread. If .Fa ss is non-zero, it specifies a pointer to and the size of a .Em "signal stack" -on which to deliver signals, -and tells the system if the process is currently executing -on that stack. +on which to deliver signals. When a signal's action indicates its handler should execute on the signal stack (specified with a .Xr sigaction 2 system call), the system checks to see -if the process is currently executing on that stack. -If the process is not currently executing on the signal stack, +if the thread is currently executing on that stack. +If the thread is not currently executing on the signal stack, the system arranges a switch to the signal stack for the duration of the signal handler's execution. .Pp +An active stack cannot be modified. +.Pp If .Dv SS_DISABLE is set in @@ -78,12 +78,6 @@ is set in and .Fa ss_size are ignored and the signal stack will be disabled. -Trying to disable an active stack will cause -.Fn sigaltstack -to return -1 with -.Va errno -set to -.Er EINVAL . A disabled stack will cause all signals to be taken on the regular user stack. If the stack is later re-enabled then all signals that were specified @@ -96,7 +90,7 @@ The .Fa ss_flags field will contain the value .Dv SS_ONSTACK -if the process is currently on a signal stack and +if the thread is currently on a signal stack and .Dv SS_DISABLE if the signal stack is currently disabled. .Sh NOTES @@ -146,8 +140,12 @@ or .Fa oss points to memory that is not a valid part of the process address space. +.It Bq Er EPERM +An attempt was made to modify an active stack. .It Bq Er EINVAL -An attempt was made to disable an active stack. +The +.Fa ss_flags +field was invalid. .It Bq Er ENOMEM Size of alternate stack area is less than or equal to .Dv MINSIGSTKSZ .