sys/systat.h and S_IFMT definition
I have a program that includes:
#include <sys/stat.h>
but gives me the follow errors:
ls2.c: In function `filemode':
ls2.c:91: `S_IFMT' undeclared (first use in this function)
ls2.c:91: (Each undeclared identifier is reported only once
ls2.c:91: for each function it appears in.)
ls2.c:92: `S_IFREG' undeclared (first use in this function)
ls2.c:93: `S_IFDIR' undeclared (first use in this function)
ls2.c:94: `S_IFCHR' undeclared (first use in this function)
ls2.c:95: `S_IFBLK' undeclared (first use in this function)
when I compile it with:
gcc -std=gnu99 -D_POSIX_C_SOURCE=200112L -g -Wall ls2.c -o ls2
Adding a "-D_XOPEN_SOURCE=600" gets rid of the errors. But ...
Isn't S_IFMT defined as part of POSIX and not part of the XSI extensions?
http://www.opengroup.org/onlinepubs/007904975/basedefs/sys/stat.h.html
I understand that S_IFREG, S_IFDIR, etc. are part of XSI, but my reading
of The Open Group Base Specifications Issue 6, IEEE Std 1003.1, 2003
Edition has S_IFMT defined *outside* of XSI, so the error reported by
gcc version 3.2 20020903 (Red Hat Linux 8.0 3.2-7) on line 91 is
in error.
Is this right?
Thanks.
--- Vladimir
------------------------------------------------------------------------
Vladimir G. Ivanovic http://leonora.org/~vladimir
2770 Cowper St. vladimir@xxxxxxx
Palo Alto, CA 94306-2447 +1 650 678 8014
_______________________________________________
Redhat-devel-list mailing list
Redhat-devel-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/redhat-devel-list
[Kernel Newbies]
[Red Hat General]
[Fedora]
[Red Hat Install]
[Linux Kernel Development]
[Yosemite News]