Re: function name collision on getcontext with ports/editors/joe

2002-02-17 Thread Daniel Eischen

On Sun, 10 Feb 2002, Kevin Day wrote:
 
 I'm the maintainer for ports/editors/joe, and just tried compiling it under
 -CURRENT.
 
 signal.h includes sys/signal.h which includes ucontext.h
 
  cc -O -pipe  -c umath.c
  In file included from b.h:6,
   from bw.h:23,
   from umath.c:5:
  rc.h:41: conflicting types for `getcontext'
  /usr/include/sys/ucontext.h:54: previous declaration of `getcontext'
  *** Error code 1
  
  Stop in /usr/ports/editors/joe/work/joe.
 
 
 I can rename getcontext in joe, but getcontext seems like a pretty common
 function name, I know I've used it in projects before. Not including
 signal.h isn't really an option either.

The ucontext related namespace pollution should be fixed now.  Let
me know otherwise.

-- 
Dan Eischen


To Unsubscribe: send mail to [EMAIL PROTECTED]
with unsubscribe freebsd-current in the body of the message



Re: function name collision on getcontext with ports/editors/joe

2002-02-14 Thread Daniel Eischen

On Mon, 11 Feb 2002, Bruce Evans wrote:
 On Sun, 10 Feb 2002, Daniel Eischen wrote:
  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).

Finally getting buildworld to work again...

More problems in the kernel though.  ucontext_t is used as a
parameter to sigreturn (and getsetcontext soon), so it is
referenced in sys/sysproto.h.  Lots of stuff includes
sys/sysproto.h.  Do we,

  a) Include sys/ucontext.h conditionally from
 sys/signal.h based on _KERNEL, or
  b) Change makesyscalls.sh to emit #include\tsys/ucontext.h
 when generating sysproto.h, or,
  c) Add includes for sys/ucontext.h to all files that
 include sys/sysproto.h

-- 
Dan Eischen


To Unsubscribe: send mail to [EMAIL PROTECTED]
with unsubscribe freebsd-current in the body of the message



Re: function name collision on getcontext with ports/editors/joe

2002-02-14 Thread Bruce Evans

On Fri, 15 Feb 2002, Daniel Eischen wrote:

 Finally getting buildworld to work again...

 More problems in the kernel though.  ucontext_t is used as a
 parameter to sigreturn (and getsetcontext soon), so it is
 referenced in sys/sysproto.h.  Lots of stuff includes
 sys/sysproto.h.  Do we,

   a) Include sys/ucontext.h conditionally from
  sys/signal.h based on _KERNEL, or
   b) Change makesyscalls.sh to emit #include\tsys/ucontext.h
  when generating sysproto.h, or,
   c) Add includes for sys/ucontext.h to all files that
  include sys/sysproto.h

None of the above)  Change syscalls.master in the same way as signal.h
to use struct __ucontext * instead of ucontext_t *, and maybe
forward-declare struct __ucontext in sys/signal.h so that sysproto.h
can see it (sysproto.h really shouldn't include sys/signal.h, but it
doesn, and I think the forward declaration isn't be automatically
generated [yet?]).

If you change the sigreturn line in syscalls.master, please fix the name
of the parameter there and in the functions (it is still sigcntxp,
but should have been scp and should now be ucp).  Also try adding `const'.
Almost all of the pointers to input parameters in syscalls.master are
missing `const' and adding them tends to require const poisoning all
over the kernel, but `const' should be used for at least syscalls newer
than C90.

Bruce


To Unsubscribe: send mail to [EMAIL PROTECTED]
with unsubscribe freebsd-current in the body of the message



Re: function name collision on getcontext with ports/editors/joe

2002-02-12 Thread Bruce Evans

On Mon, 11 Feb 2002, Daniel Eischen wrote:

 On Mon, 11 Feb 2002, Garrett Wollman wrote:
  On Mon, 11 Feb 2002 12:16:44 -0500 (EST), Daniel Eischen 
[EMAIL PROTECTED] said:
 
   How do you easily forward declare something that is a typedef?
 
  There is a reason style(9) says not to use such typedefs.
  Unfortunately, this one it written into a standard.  Since We Are The
  Implementation, there is no difficulty in simply writing the
  appropriate structure type into the relevant declarations.

 OK, thanks.

I believe there is a difficulty: POSIX at least used to require
applications to be able to declare prototypes for functions in POSIX
headers using lexically the same definition as in the standard.

In the case of ucontext_t, this might not be a problem, since the
implementation can declare ucontext_t as an incomplete struct type.
The both the implementation and applications can use ucontext_t *
in prototypes.  OTOH, sigreturn() is not a POSIX function so the
POSIX rules don't apply directly.

Bruce


To Unsubscribe: send mail to [EMAIL PROTECTED]
with unsubscribe freebsd-current in the body of the message



Re: function name collision on getcontext with ports/editors/joe

2002-02-12 Thread Bruce Evans

On Mon, 11 Feb 2002, Daniel Eischen wrote:

 On Mon, 11 Feb 2002, Terry Lambert wrote:
  Daniel Eischen wrote:
   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.
 
  Forward declare it.  People who need its internals will
  include the proper header.

That header is traditionally signal.h :-).

 How do you easily forward declare something that is a typedef?
 You could forward declare struct __ucontext and use a pointer
 to that as the argument to sigreturn, but that doesn't seem
 right as it is relying on how ucontext_t is defined.

This is OK for the implementation -- see other followups.

Bruce


To Unsubscribe: send mail to [EMAIL PROTECTED]
with unsubscribe freebsd-current in the body of the message



Re: function name collision on getcontext with ports/editors/joe

2002-02-11 Thread Garrett Wollman

On Mon, 11 Feb 2002 12:16:44 -0500 (EST), Daniel Eischen [EMAIL PROTECTED] 
said:

 How do you easily forward declare something that is a typedef?

There is a reason style(9) says not to use such typedefs.
Unfortunately, this one it written into a standard.  Since We Are The
Implementation, there is no difficulty in simply writing the
appropriate structure type into the relevant declarations.

-GAWollman


To Unsubscribe: send mail to [EMAIL PROTECTED]
with unsubscribe freebsd-current in the body of the message

To Unsubscribe: send mail to [EMAIL PROTECTED]
with unsubscribe freebsd-current in the body of the message



Re: function name collision on getcontext with ports/editors/joe

2002-02-11 Thread Daniel Eischen

On Mon, 11 Feb 2002, Garrett Wollman wrote:
 On Mon, 11 Feb 2002 12:16:44 -0500 (EST), Daniel Eischen 
[EMAIL PROTECTED] said:
 
  How do you easily forward declare something that is a typedef?
 
 There is a reason style(9) says not to use such typedefs.
 Unfortunately, this one it written into a standard.  Since We Are The
 Implementation, there is no difficulty in simply writing the
 appropriate structure type into the relevant declarations.

OK, thanks.

-- 
Dan Eischen


To Unsubscribe: send mail to [EMAIL PROTECTED]
with unsubscribe freebsd-current in the body of the message

To Unsubscribe: send mail to [EMAIL PROTECTED]
with unsubscribe freebsd-current in the body of the message



function name collision on getcontext with ports/editors/joe

2002-02-11 Thread Kevin Day


I'm the maintainer for ports/editors/joe, and just tried compiling it under
-CURRENT.

signal.h includes sys/signal.h which includes ucontext.h

 cc -O -pipe  -c umath.c
 In file included from b.h:6,
  from bw.h:23,
  from umath.c:5:
 rc.h:41: conflicting types for `getcontext'
 /usr/include/sys/ucontext.h:54: previous declaration of `getcontext'
 *** Error code 1
 
 Stop in /usr/ports/editors/joe/work/joe.


I can rename getcontext in joe, but getcontext seems like a pretty common
function name, I know I've used it in projects before. Not including
signal.h isn't really an option either.

I'm not familiar with any of the ucontext.h functions, are they complying
with some kind of standard and can't be renamed or have a prefix added to
it?

-- Kevin

To Unsubscribe: send mail to [EMAIL PROTECTED]
with unsubscribe freebsd-current in the body of the message

To Unsubscribe: send mail to [EMAIL PROTECTED]
with unsubscribe freebsd-current in the body of the message



Re: function name collision on getcontext with ports/editors/joe

2002-02-11 Thread Daniel Eischen

On Sun, 10 Feb 2002, Kevin Day wrote:
 
 I'm the maintainer for ports/editors/joe, and just tried compiling it under
 -CURRENT.
 
 signal.h includes sys/signal.h which includes ucontext.h
 
  cc -O -pipe  -c umath.c
  In file included from b.h:6,
   from bw.h:23,
   from umath.c:5:
  rc.h:41: conflicting types for `getcontext'
  /usr/include/sys/ucontext.h:54: previous declaration of `getcontext'
  *** Error code 1
  
  Stop in /usr/ports/editors/joe/work/joe.
 
 
 I can rename getcontext in joe, but getcontext seems like a pretty common
 function name, I know I've used it in projects before. Not including
 signal.h isn't really an option either.
 
 I'm not familiar with any of the ucontext.h functions, are they complying
 with some kind of standard and can't be renamed or have a prefix added to
 it?

Yea, getcontext is part of SUSv2 and the 2001 POSIX spec.  It has been
present in at least Solaris for years now, so it's kind of weird that
joe hasn't had the problem when built for it [Solaris].

Hmm, sys/signal.h includes sys/ucontext.h.  I'm not sure why though.
bde might know.

-- 
Dan Eischen


To Unsubscribe: send mail to [EMAIL PROTECTED]
with unsubscribe freebsd-current in the body of the message

To Unsubscribe: send mail to [EMAIL PROTECTED]
with unsubscribe freebsd-current in the body of the message



Re: function name collision on getcontext with ports/editors/joe

2002-02-10 Thread Daniel Eischen

On Sun, 10 Feb 2002, Kevin Day wrote:
 
 I'm the maintainer for ports/editors/joe, and just tried compiling it under
 -CURRENT.
 
 signal.h includes sys/signal.h which includes ucontext.h
 
  cc -O -pipe  -c umath.c
  In file included from b.h:6,
   from bw.h:23,
   from umath.c:5:
  rc.h:41: conflicting types for `getcontext'
  /usr/include/sys/ucontext.h:54: previous declaration of `getcontext'
  *** Error code 1
  
  Stop in /usr/ports/editors/joe/work/joe.
 
 
 I can rename getcontext in joe, but getcontext seems like a pretty common
 function name, I know I've used it in projects before. Not including
 signal.h isn't really an option either.
 
 I'm not familiar with any of the ucontext.h functions, are they complying
 with some kind of standard and can't be renamed or have a prefix added to
 it?

Yea, getcontext is part of SUSv2 and the 2001 POSIX spec.  It has been
present in at least Solaris for years now, so it's kind of weird that
joe hasn't had the problem when built for it [Solaris].

Hmm, sys/signal.h includes sys/ucontext.h.  I'm not sure why though.
bde might know.

-- 
Dan Eischen


To Unsubscribe: send mail to [EMAIL PROTECTED]
with unsubscribe freebsd-current in the body of the message



Re: function name collision on getcontext with ports/editors/joe

2002-02-10 Thread Daniel Eischen

On Mon, 11 Feb 2002, Bruce Evans wrote:
 On Sun, 10 Feb 2002, Daniel Eischen wrote:
 
  Hmm, sys/signal.h includes sys/ucontext.h.  I'm not sure why though.
  bde might know.
 
 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.

Under FreeBSD, ucontext.h is a link to sys/ucontext.h,
which both declare ucontext_t and {get,set,make,swap}context.

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?

-- 
Dan Eischen



To Unsubscribe: send mail to [EMAIL PROTECTED]
with unsubscribe freebsd-current in the body of the message



function name collision on getcontext with ports/editors/joe

2002-02-09 Thread Kevin Day


I'm the maintainer for ports/editors/joe, and just tried compiling it under
-CURRENT.

signal.h includes sys/signal.h which includes ucontext.h

 cc -O -pipe  -c umath.c
 In file included from b.h:6,
  from bw.h:23,
  from umath.c:5:
 rc.h:41: conflicting types for `getcontext'
 /usr/include/sys/ucontext.h:54: previous declaration of `getcontext'
 *** Error code 1
 
 Stop in /usr/ports/editors/joe/work/joe.


I can rename getcontext in joe, but getcontext seems like a pretty common
function name, I know I've used it in projects before. Not including
signal.h isn't really an option either.

I'm not familiar with any of the ucontext.h functions, are they complying
with some kind of standard and can't be renamed or have a prefix added to
it?

-- Kevin

To Unsubscribe: send mail to [EMAIL PROTECTED]
with unsubscribe freebsd-current in the body of the message