Thread View: comp.std.unix
3 messages
3 total messages
Started by Rainer Orth
Sat, 11 May 1991 04:06
Must POSIX 1003.1 include files be standalone?
Author: Rainer Orth
Date: Sat, 11 May 1991 04:06
Date: Sat, 11 May 1991 04:06
36 lines
1733 bytes
1733 bytes
Submitted-by: ro@thp.uni-koeln.de (Rainer Orth)
Recently while working on the command sources of Andy Tanenbaums Minix 1.6
(currently in beta and trying to become fully P1003.1 and .2 compatible),
there appeared the question whether code like
#include <pwd.h>
int main (void)
{
}
is required to work in a strictly conforming POSIX.1 implementation with
Standard C Bindings.
The problem is as follows:
<pwd.h> contains a prototype for struct passwd *getpwuid (uid_t)
and doesn't include <sys/types.h> by itself. I'm not shure if the
above program needs to #include <sys/types.h> itself or <pwd.h> is
wrong. From P1003.1-1988 <sys/types.h> needs to be included only if
the program uses getpwuid().
The same problem occurs in several other headers: e.g. <signal.h>, <grp.h>,
<unistd.h>, <sys/wait.h>.
Does P1003.1-1990 specify the correct behaviour?
Rainer
--
-----------------------------------------------------------------------------
Rainer Orth, Institute of Theoretical Physics, University of Cologne
Internet: ro@thp.Uni-Koeln.DE
Volume-Number: Volume 23, Number 65
Re: Must POSIX 1003.1 include files be standalone?
Author: Dave Decot
Date: Wed, 15 May 1991 22:19
Date: Wed, 15 May 1991 22:19
49 lines
2296 bytes
2296 bytes
Submitted-by: decot@hpcupt1.cup.hp.com (Dave Decot)
> Recently while working on the command sources of Andy Tanenbaums Minix 1.6
> (currently in beta and trying to become fully P1003.1 and .2 compatible),
> there appeared the question whether code like
>
> #include <pwd.h>
>
> int main (void)
> {
> }
>
> is required to work in a strictly conforming POSIX.1 implementation with
> Standard C Bindings.
No. But it is allowed to work. Note that POSIX.1 permits any symbols
ending in _t, including uid_t, to appear in any of its headers (i.e.,
those not imported from ANSI C).
> The problem is as follows:
>
> <pwd.h> contains a prototype for struct passwd *getpwuid (uid_t)
> and doesn't include <sys/types.h> by itself. I'm not shure if the
> above program needs to #include <sys/types.h> itself or <pwd.h> is
> wrong. From P1003.1-1988 <sys/types.h> needs to be included only if
> the program uses getpwuid().
To conform to POSIX.1-1988 or POSIX.1-1990, the program has to include
<sys/types.h> first.
> The same problem occurs in several other headers: e.g. <signal.h>, <grp.h>,
> <unistd.h>, <sys/wait.h>.
Same applies to them.
> Does P1003.1-1990 specify the correct behaviour?
It is clearer in this regard, although POSIX.1-1988 also required
that the prerequisite #includes be there as well.
POSIX.1-1991 will *require* that implementations provide stand-alone
headers. In addition, a program will need to include *at most* one header
in order to use a particular function (the one that contains the prototype
for the function).
Dave Decot
Volume-Number: Volume 23, Number 73
Re: Must POSIX 1003.1 include files be standalone?
Author: Arnold Robbins
Date: Fri, 17 May 1991 16:36
Date: Fri, 17 May 1991 16:36
18 lines
1558 bytes
1558 bytes
Submitted-by: arnold%audiofax.com@mathcs.emory.edu (Arnold Robbins) In article <1991May17.011208.6853@uunet.uu.net> decot@hpcupt1.cup.hp.com (Dave Decot) writes: >POSIX.1-1991 will *require* that implementations provide stand-alone >headers. In addition, a program will need to include *at most* one header >in order to use a particular function (the one that contains the prototype >for the function). Er, what is POSIX-1.1991? Didn't we just get through getting POSIX-1.1990? -- Arnold Robbins AudioFAX, Inc. | Threads are the 2000 Powers Ferry Road, Suite 200 / Marietta, GA. 30067 | lack of an idea. INTERNET: arnold@audiofax.com Phone: +1 404 618 4281 | -- Rob Pike UUCP: emory!audfax!arnold Fax-box: +1 404 618 4581 | [ Another year, another standard. -- mod ] Volume-Number: Volume 23, Number 74
Thread Navigation
This is a paginated view of messages in the thread with full content displayed inline.
Messages are displayed in chronological order, with the original post highlighted in green.
Use pagination controls to navigate through all messages in large threads.
Back to All Threads