Subject: misc/1784: Incorrect reference to ss_sp in sigaltstack(2) manual page
To: None <gnats-bugs@gnats.netbsd.org>
From: None <agc@sde.uts.amdahl.com>
List: netbsd-bugs
Date: 11/23/1995 05:45:00
>Number:         1784
>Category:       misc
>Synopsis:       Incorrect reference to ss_sp in sigaltstack(2) manual page
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    misc-bug-people (Misc Bug People)
>State:          open
>Class:          doc-bug
>Submitter-Id:   net
>Arrival-Date:   Thu Nov 23 09:05:00 1995
>Last-Modified:
>Originator:     Alistair G. Crooks
>Organization:
	Amdahl Corp.
>Release:        NetBSD sources from November 22nd, 1995.
>Environment:
	NetBSD/i386 1.1_ALPHA, 95-11-22 sources
System: NetBSD pumpy.osg.uk.amdahl.com 1.1_ALPHA NetBSD 1.1_ALPHA (PUMPY) #0: Mon Nov 20 10:14:18 GMT 1995 root@pumpy.osg.uk.amdahl.com:/usr/src/sys/arch/i386/compile/PUMPY i386


>Description:
The documentation for sigaltstack contains the following information:

     #include <sys/types.h>
     #include <signal.h>
     struct sigaltstack {
             char   *ss_sp;
             int     ss_size;
             int     ss_flags;
     };
     ...
     The value SIGSTKSZ is defined to be the number of bytes/chars that would
     be used to cover the usual case when allocating an alternate stack area.
     The following code fragment is typically used to allocate an alternate
     stack.

           if ((sigstk.ss_sp = malloc(SIGSTKSZ)) == NULL)
                   /* error return */
           sigstk.ss_size = SIGSTKSZ;
           sigstk.ss_flags = 0;
           if (sigaltstack(&sigstk,0) < 0)
                   perror("sigaltstack");

but /usr/include/sys/signal.h contains the following structure definition:

/*
 * Structure used in sigaltstack call.
 */
struct  sigaltstack {
        char    *ss_base;               /* signal stack base */
        int     ss_size;                /* signal stack length */
        int     ss_flags;               /* SS_DISABLE and/or SS_ONSTACK */
};

(Hopefully, all the above will make it through send-pr.)

>How-To-Repeat:
man 2 sigaltstack
more /usr/include/sys/signal.h

-or-

try to make GNU m4 version 1.4
>Fix:
I think that correcting the documentation is probably the right
way to go about it, although you'll still have to hack at the GNU
sources for m4 to correct the bad field name.

*** /usr/src/lib/libc/sys/sigaltstack.2       1995/11/23 13:33:41     1.1
--- /usr/src/lib/libc/sys/sigaltstack.2       1995/11/23 13:34:08
***************
*** 44,50 ****
  .Fd #include <signal.h>
  .Bd -literal
  struct sigaltstack {
!       char   *ss_sp;
        int     ss_size;
        int     ss_flags;
  };
--- 44,50 ----
  .Fd #include <signal.h>
  .Bd -literal
  struct sigaltstack {
!       char   *ss_base;
        int     ss_size;
        int     ss_flags;
  };
***************
*** 76,82 ****
  .Dv SA_DISABLE
  is set in
  .Fa ss_flags ,
! .Fa ss_sp
  and
  .Fa ss_size
  are ignored and the signal stack will be disabled.
--- 76,82 ----
  .Dv SA_DISABLE
  is set in
  .Fa ss_flags ,
! .Fa ss_base
  and
  .Fa ss_size
  are ignored and the signal stack will be disabled.
***************
*** 108,114 ****
  the usual case when allocating an alternate stack area.
  The following code fragment is typically used to allocate an alternate stack.
  .Bd -literal -offset indent
! if ((sigstk.ss_sp = malloc(SIGSTKSZ)) == NULL)
        /* error return */
  sigstk.ss_size = SIGSTKSZ;
  sigstk.ss_flags = 0;
--- 108,114 ----
  the usual case when allocating an alternate stack area.
  The following code fragment is typically used to allocate an alternate stack.
  .Bd -literal -offset indent
! if ((sigstk.ss_base = malloc(SIGSTKSZ)) == NULL)
        /* error return */
  sigstk.ss_size = SIGSTKSZ;
  sigstk.ss_flags = 0;

>Audit-Trail:
>Unformatted: