home *** CD-ROM | disk | FTP | other *** search
/ Usenet 1994 January / usenetsourcesnewsgroupsinfomagicjanuary1994.iso / sources / std_unix / v21 / 038 < prev    next >
Internet Message Format  |  1990-12-05  |  3KB

  1. From news@cs.utexas.edu  Thu Aug 16 15:17:40 1990
  2. Received: from cs.utexas.edu by uunet.uu.net (5.61/1.14) with SMTP 
  3.     id AA12587; Thu, 16 Aug 90 15:17:40 -0400
  4. Posted-Date: 16 Aug 90 00:38:14 GMT
  5. Received: by cs.utexas.edu (5.64/1.70)
  6.     id AA16735; Thu, 16 Aug 90 14:17:37 -0500
  7. From: Dave Decot <decot@hpisod2.cup.hp.com>
  8. Newsgroups: comp.std.unix
  9. Subject: Re: POSIX vs SVID
  10. Message-Id: <436@usenix.ORG>
  11. References: <11188@cs.utexas.edu>
  12. Sender: std-unix@usenix.ORG
  13. Organization: Hewlett Packard, Cupertino
  14. X-Submissions: std-unix@uunet.uu.net
  15. Date: 16 Aug 90 00:38:14 GMT
  16. Apparently-To: std-unix-list@uunet.uu.net
  17.  
  18. From:  decot@hpisod2.cup.hp.com (Dave Decot)
  19.  
  20. > I have been comparing SVID Issue 3 (for V.4) to IEEE Std 1003.1-1988. 
  21. > I noticed that the SVID specifies header files in the synopsis for 
  22. > various functions that are not required for POSIX.  For example,
  23. > POSIX says that setuid() requires that <sys/types.h> be included.  
  24. > The SVID requires that both <sys/types.h> and <unistd.h> be included.
  25.  
  26. POSIX.1-1988 also says that <unistd.h> is required, but it says it
  27. elsewhere, in section 2.8.3:
  28.  
  29.     If a function is not listed below, it shall have its prototype
  30.     appear in <unistd.h>, which is presumed to be #included-ed whenever
  31.     any function declared in it is used, whether or not it is mentioned
  32.     in the Synopsis section for that function.
  33.  
  34. > Question: Is there anything wrong with this?  If I write a strictly
  35. > conforming application, can I include <unistd.h> for SVID 
  36. > compatibility even if POSIX does not require it?  Is there any 
  37. > problem with including "extra" header files (other than the obvious 
  38. > restrictions on the namespace)?
  39.  
  40. You can always include any POSIX.1 header wherever you want in a POSIX.1
  41. conforming program (except where it would cause a syntax error, such as
  42. in the middle of a declaration or statement :-).
  43.  
  44. > BTW, looking at the SVR4 code there is nothing in <unistd.h> that 
  45. > would require it to be included for setuid().  There do not seem to 
  46. > be any symbols in the header file that are prohibited.  However, this 
  47. > is a standards questions and reading the .h files is cheating!
  48.  
  49. The declaration or function prototype for setuid() must appear
  50. in <unistd.h>, and the application must #include it.  In some cases,
  51. the header might contain a faster macro version of the function.
  52.  
  53. Future versions of POSIX.1 will not require the application to #include
  54. <sys/types.h> for any purpose, since any needed types for a given function
  55. will also be available from the header which declares that function.
  56.  
  57. Dave Decot
  58.  
  59. Volume-Number: Volume 21, Number 38
  60.  
  61.