Should sys/types.h include sys/sysmacros.h?

Joerg Schilling schilling@fokus.gmd.de
Thu May 2 03:04:00 GMT 2002


>From: Jason Tishler <jason@tishler.net>

>In the process of trying to build the latest Python CVS, I get a link
>error due to the following line:

>    res = mknod(filename, mode, makedev(major, minor));

>After building successfully under Linux, I determined that the above
>works because Linux's sys/types.h includes sys/sysmacros.h.

>Should newlib's sys/types.h include sys/sysmacros.h (possibly only for
>Cygwin)?

>I tried searching:

>    http://www.opengroup.org/onlinepubs/007908799/index.html

>but came up empty.

First, SUSv2 is outdated by POSIX.1-2001 (aka. SUSv3 / The Open Group Base Specifications Issue 6)

For curiosity: although major/minor numbers are mentioned in the standard
for the ustar/pax archive format, it seems that anything bejond the granularity
of a dev_t (like st_rdev) is bejond the scope of the standard.

In addition: I am not sure where sysmacros.h comes from, but here is a quote
from one of my portability files:

/*
 * On generic SVR4, major is a function (defined in sys/mkdev.h).
 * On Solaris it is defined ...
 * As we cannot just test if major is #define'd, we have to 
 * define _FOUND_MAJOR_ instead.
 *
 * WARNING: Do never include <sys/sysmacros.h> in SVR4, it contains
 * an old definition for major()/minor() defining 8 minorbits.
 * Use <sys/mkdev.h> instead.
 */



Jörg

 EMail:joerg@schily.isdn.cs.tu-berlin.de (home) Jörg Schilling D-13353 Berlin
       js@cs.tu-berlin.de		(uni)  If you don't have iso-8859-1
       schilling@fokus.gmd.de		(work) chars I am J"org Schilling
 URL:  http://www.fokus.gmd.de/usr/schilling   ftp://ftp.fokus.gmd.de/pub/unix



More information about the Cygwin-developers mailing list