🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.std.unix
Article #442

Re: POSIX vs SVID

#442
From: Dave Decot
Date: Thu, 16 Aug 1990 00:38
42 lines
2509 bytes
From:  decot@hpisod2.cup.hp.com (Dave Decot)

> I have been comparing SVID Issue 3 (for V.4) to IEEE Std 1003.1-1988. 
> I noticed that the SVID specifies header files in the synopsis for 
> various functions that are not required for POSIX.  For example,
> POSIX says that setuid() requires that <sys/types.h> be included.  
> The SVID requires that both <sys/types.h> and <unistd.h> be included.

POSIX.1-1988 also says that <unistd.h> is required, but it says it
elsewhere, in section 2.8.3:

    If a function is not listed below, it shall have its prototype
    appear in <unistd.h>, which is presumed to be #included-ed whenever
    any function declared in it is used, whether or not it is mentioned
    in the Synopsis section for that function.

> Question: Is there anything wrong with this?  If I write a strictly
> conforming application, can I include <unistd.h> for SVID 
> compatibility even if POSIX does not require it?  Is there any 
> problem with including "extra" header files (other than the obvious 
> restrictions on the namespace)?

You can always include any POSIX.1 header wherever you want in a POSIX.1
conforming program (except where it would cause a syntax error, such as
in the middle of a declaration or statement :-).

> BTW, looking at the SVR4 code there is nothing in <unistd.h> that 
> would require it to be included for setuid().  There do not seem to 
> be any symbols in the header file that are prohibited.  However, this 
> is a standards questions and reading the .h files is cheating!

The declaration or function prototype for setuid() must appear
in <unistd.h>, and the application must #include it.  In some cases,
the header might contain a faster macro version of the function.

Future versions of POSIX.1 will not require the application to #include
<sys/types.h> for any purpose, since any needed types for a given function
will also be available from the header which declares that function.

Dave Decot

Volume-Number: Volume 21, Number 38
Technical Details
Message-ID: <436@usenix.ORG>
Path: arc1-ca.pugleaf.net!utzoo!utgpu!news-server.csri.toronto.edu!mailrus!uwm.edu!cs.utexas.edu!uunet!usenix!std-unix
References: <11188@cs.utexas.edu>

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!utgpu!news-server.csri.toronto.edu!mailrus!uwm.edu!cs.utexas.edu!uunet!usenix!std-unix
From: decot@hpisod2.cup.hp.com (Dave Decot)
Newsgroups: comp.std.unix
Subject: Re: POSIX vs SVID
Message-ID: <436@usenix.ORG>
Date: 16 Aug 90 00:38:14 GMT
References: <11188@cs.utexas.edu>
Sender: std-unix@usenix.ORG
Organization: Hewlett Packard, Cupertino
Lines: 42
Approved: jsq@usenix.org (Moderator, John Quarterman)
X-Submissions: std-unix@uunet.uu.net