Subject: lib/1785: Should include ?
To: None <gnats-bugs@gnats.netbsd.org>
From: None <agc@sde.uts.amdahl.com>
List: netbsd-bugs
Date: 11/23/1995 06:03:00
>Number:         1785
>Category:       lib
>Synopsis:       Should <dirent.h> include <sys/types.h>?
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    lib-bug-people (Library Bug People)
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Thu Nov 23 09:20:00 1995
>Last-Modified:
>Originator:     Alistair G. Crooks
>Organization:
	Amdahl Corp.
>Release:        November 22nd sources
>Environment:
	NetBSD/i386 1.1, November 22nd sources
System: NetBSD pumpy.osg.uk.amdahl.com 1.1_ALPHA NetBSD 1.1_ALPHA (PUMPY) #0: Mon Nov 20 10:14:18 GMT 1995 root@pumpy.osg.uk.amdahl.com:/usr/src/sys/arch/i386/compile/PUMPY i386


>Description:
I came across a piece of software that included files thus:
#include <dirent.h>
#include <sys/types.h>
...
and cc puked on <dirent.h> because it couldn't find certain types defined
in <sys/types.h>. From a conversation with jtc, he informs me that
POSIX doesn't mandate that <dirent.h> include <sys/types.h>, but that
X/Open XPG4.2 does. This is therefore a placeholder send-pr, as he may be
a tad busy at the moment...

>How-To-Repeat:
#include <dirent.h>
#include <sys/types.h>

>Fix:
*** /usr/src/include/dirent.h    1995/11/23 13:55:17     1.1
--- /usr/src/include/dirent.h    1995/11/23 13:57:01
***************
*** 39,44 ****
--- 39,51 ----
  #define _DIRENT_H_
  
  /*
+  * POSIX doesn't mandate this, but X/Open XPG 4.2 does.
+  */
+ #ifndef _POSIX_SOURCE
+ #include <sys/types.h>
+ #endif
+ 
+ /*
   * The kernel defines the format of directory entries returned by 
   * the getdirentries(2) system call.
   */

>Audit-Trail:
>Unformatted: