Date: Mon, 11 Feb 2002 10:14:04 -0500 (EST) From: Daniel Eischen <eischen@pcnet1.pcnet.com> To: Bruce Evans <bde@zeta.org.au> Cc: Kevin Day <toasty@shell.dragondata.com>, current@FreeBSD.ORG, bde@FreeBSD.ORG Subject: Re: function name collision on "getcontext" with ports/editors/joe Message-ID: <Pine.GSO.4.10.10202111008440.16848-100000@pcnet1.pcnet.com> In-Reply-To: <20020211114221.H10505-100000@gamplex.bde.org>
next in thread | previous in thread | raw e-mail | index | archive | help
On Mon, 11 Feb 2002, Bruce Evans wrote:
> On Sun, 10 Feb 2002, Daniel Eischen wrote:
>
> > On Mon, 11 Feb 2002, Bruce Evans wrote:
> > > <sys/signal.h> includes <machine/signal.h> for the normal namespace
> > > pollution that was needed to use sigreturn(2) (except sigreturn(2)
> > > itself isn't actually declared anywhere). Including <sys/ucontext.h>
> > > gives the corresponding namespace pollution for using the current
> > > sigreturn(2). This is probably a mistake. (Don't believe the
> > > sigreturn man page; it documents osigreturn(2) for the i386 only.)
> > > Programs shouldn't have any problems with this, since they should
> > > define _POSIX_SOURCE if they only want the POSIX namespace ;-).
> >
> > Poking about on a Solaris 8 system shows that they have a
> > <ucontext.h> that defines the {get,set,make,swap}context
> > prototypes. <ucontext.h> also includes <sys/ucontext.h>
> > to get the definitions for ucontext_t.
>
> <sys/ucontext.h> is just as nonstandard as <machine/ucontext.h>.
>
> > Under FreeBSD, <ucontext.h> is a link to <sys/ucontext.h>,
> > which both declare ucontext_t and {get,set,make,swap}context.
>
> The link part is intentional. We have to have <sys/ucontext.h> for
> use in the kernel, so it is simpler not to have a separate user
> header. The only advantage of the Solaris implementation is that
> it punishes applications that include the nonstandard header.
>
> > What do you recommend we do? Should we not include <sys/ucontext.h>
> > from <sys/signal.h>, or do what Solaris does, or just leave
> > everything as is?
>
> Don't include <sys/ucontext.h> from <sys/signal.h>, and fix whatever
> breaks. I think applications that use the new sigreturn can be required
> to include both <signal.h> and <ucontext.h>. There should be fewer
> of them than there used to be -- they can now use setcontext(). The
> old sigcontext/sigreturn stuff should be cleaned up too (don't export
> it to userland).
It breaks more than that. Applications that just want to use
sigaction, sigaltstack, etc, only need to include <signal.h>,
but that also defines sigreturn as:
int sigreturn __P((ucontext_t *));
Removing <sys/ucontext.h> from <sys/signal.h> prevents ucontext_t
from being defined, so all users of <signal.h> would choke.
We can change the prototype of sigreturn back to struct sigcontext *,
or just forward declare ucontext_t in <signal.h> or <sys/signal.h>.
--
Dan Eischen
To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-current" in the body of the message
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?Pine.GSO.4.10.10202111008440.16848-100000>
