Package: libc6-dev Version: 2.10.2-6 Severity: wishlist File issock.c: ---------------------------------------- #include <sys/stat.h> int foo(mode_t mode) { return S_ISSOCK(mode); } int main(int argc, char *argv[]) { return foo(0); } ----------------------------------------
Compilation results: ---------------------------------------- $ gcc -std=c99 -D_POSIX_C_SOURCE=200112L -o issock issock.c issock.c: In function ‘foo’: issock.c:2: warning: implicit declaration of function ‘S_ISSOCK’ /tmp/ccUoCGe4.o: In function `foo': issock.c:(.text+0x16): undefined reference to `S_ISSOCK' collect2: ld returned 1 exit status $ gcc -std=c99 -D_POSIX_C_SOURCE=200809L -o issock issock.c issock.c: In function ‘foo’: issock.c:2: warning: implicit declaration of function ‘S_ISSOCK’ /tmp/ccsSvaAx.o: In function `foo': issock.c:(.text+0x16): undefined reference to `S_ISSOCK' collect2: ld returned 1 exit status ---------------------------------------- Using gcc -E -dM, it is possible to observe that S_ISSOCK does not get defined as a macro at any point. With -D_GNU_SOURCE or no feature test macros at all, issock.c compiles fine. /usr/include/sys/stat.h on my machine has at line 146: ---------------------------------------- #if (defined __USE_BSD || defined __USE_UNIX98) \ && defined __S_IFSOCK # define S_ISSOCK(mode) __S_ISTYPE((mode), __S_IFSOCK) #endif ---------------------------------------- This seems to be along the lines of only defining S_ISSOCK when BSD or X/Open features are being selected (my glance at __USE_UNIX98 yielded vague understanding at best), but according to [1], POSIX:2001 declares that sys/stat.h defines the macro S_ISSOCK without any extension tags (such as the XSI tag), which would seem to me to make it a POSIX feature. [1] http://www.opengroup.org/onlinepubs/000095399/basedefs/sys/stat.h.html ---> Drake Wilson -- System Information: Debian Release: squeeze/sid APT prefers unstable APT policy: (990, 'unstable'), (500, 'testing'), (1, 'experimental') Architecture: amd64 (x86_64) Kernel: Linux 2.6.29-1-amd64 (SMP w/2 CPU cores) Locale: LANG=en_US.UTF-8, LC_CTYPE=en_US.UTF-8 (charmap=UTF-8) Shell: /bin/sh linked to /bin/bash Versions of packages libc6-dev depends on: ii libc-dev-bin 2.10.2-6 Embedded GNU C Library: Developmen ii libc6 2.10.2-6 Embedded GNU C Library: Shared lib ii linux-libc-dev 2.6.32-6 Linux support headers for userspac Versions of packages libc6-dev recommends: ii gcc [c-compiler] 4:4.4.2-3 The GNU C compiler ii gcc-3.4 [c-compiler] 3.4.6-10 The GNU C compiler ii gcc-4.3 [c-compiler] 4.3.4-6 The GNU C compiler ii gcc-4.4 [c-compiler] 4.4.3-2 The GNU C compiler Versions of packages libc6-dev suggests: ii glibc-doc 2.10.2-5 Embedded GNU C Library: Documentat ii manpages-dev 3.23-1 Manual pages about using GNU/Linux -- no debconf information -- To UNSUBSCRIBE, email to debian-bugs-dist-requ...@lists.debian.org with a subject of "unsubscribe". Trouble? Contact listmas...@lists.debian.org