POSIX vs SVID

Bob Goudreau goudreau at larrybud.rtp.dg.com
Thu Aug 16 06:30:35 AEST 1990


From:  Bob Goudreau <goudreau at larrybud.rtp.dg.com>

In article <11188 at cs.utexas.edu>, Don_Lewine at dgc.ceo.dg.com writes:
>
> 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.
>  
> 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)?
>  
> 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!

At least for the case of implementations claiming to conform to ANSI C,
POSIX.1-1988 does indeed require that <unistd.h> must contain a
prototype for setuid().  Here's the relevant text, from section 2.8.3:

	Implementations claiming C Standard Language-Dependent Support
	shall declare function prototypes for all functions.

	Implementations claiming Common Usage C Language-Dependent
	Support shall declare the result type for all functions not
	returning a "plain" _int_.

	These function prototypes (if required) shall appear in the
	headers listed below.  If a function is not listed below, it
	shall have its prototype appear in <unistd.h>, which is
	presumed to be #include-ed whenever any function declared in it
	is used, whether or not it is mentioned in the Synopsis
	section for that function.
 
------------------------------------------------------------------------
Bob Goudreau				+1 919 248 6231
Data General Corporation
62 Alexander Drive			goudreau at dg-rtp.dg.com
Research Triangle Park, NC  27709	...!mcnc!rti!xyzzy!goudreau
USA


Volume-Number: Volume 21, Number 35



More information about the Comp.std.unix mailing list