> From: "Todd C. Miller" <todd.mil...@courtesan.com>
> Date: Tue, 14 Apr 2015 10:52:47 -0600
> 
> The situation is a little complicated.  POSIX defines the third
> argument to the sa_sigaction handler as void * and says it may be
> cast to ucontext_t.  On OpenBSD, it is really a pointer to struct
> sigcontext but this is really an implementation detail.
> 
>  - todd
> 
> Index: lib/libc/sys/sigaction.2
> ===================================================================
> RCS file: /cvs/src/lib/libc/sys/sigaction.2,v
> retrieving revision 1.68
> diff -u -p -u -r1.68 sigaction.2
> --- lib/libc/sys/sigaction.2  14 Dec 2014 07:42:50 -0000      1.68
> +++ lib/libc/sys/sigaction.2  14 Apr 2015 16:49:48 -0000
> @@ -352,7 +352,7 @@ If the
>  option is enabled, the canonical way to declare it is:
>  .Bd -literal -offset indent
>  void
> -handler(int sig, siginfo_t *sip, struct sigcontext *scp)
> +handler(int sig, siginfo_t *sip, void *ctx)
>  .Ed
>  .Pp
>  Here
> @@ -375,13 +375,19 @@ The function specified in
>  .Fa sa_sigaction
>  will be called instead of the function specified by
>  .Fa sa_handler
> -(Note that in some implementations these are in fact the same).
> -.Fa scp
> -is a pointer to the
> +(note that in some implementations these are in fact the same).
> +.Fa ctx
> +may be cast to a pointer to
> +.Fa ucontext_t
> +which can be used to restore the thread's context from before the signal.
> +On
> +.Ox ,
> +.Fa ucontext_t
> +is an alias for the
>  .Fa sigcontext
> -structure (defined in
> -.In signal.h ) ,
> -used to restore the context from before the signal.
> +structure defined in
> +.In signal.h .
> +The contents of this structure are machine-dependent.
>  .Sh ERRORS
>  .Fn sigaction
>  will fail and no new signal handler will be installed if one

Not sure if mentioning ucontext_t is such a good idea.  While POSIX
does contain similar text. it doesn't actually tell you which header
provides ucontext_t.  There used to be a <ucontext.h> header file, but
that one is gone now.  Personally I'd just state that on OpenBSD (and
other BSD-derived systems) the third argument is a pointer to a struct
sigcontext.  But meh.

Reply via email to