From mboxrd@z Thu Jan 1 00:00:00 1970 Message-ID: <51bafa132d22fc7541d738f7269e2f2a.axp-list@archive.invalid> X-Archive-Original-Message-ID: <199709241305.PAA04758@blinky.bfr.co.il> Date: Wed, 24 Sep 1997 15:05:21 +0200 From: Harvey J. Stein Subject: messy include files - pid_t undefined? It seems that pid_t is undefined by default on linux/axp, even though the man pages say it should be defined in unistd.h: hjstein@randy:~$ uname -a Linux randy.bloomberg.com 2.0.30 #1 Tue Apr 22 16:32:38 EDT 1997 alpha unknown hjstein@randy:~$ cat ppid_test.c #include foo (void) { pid_t n; } hjstein@randy:~$ gcc -c -o ppid_test.o ppid_test.c ppid_test.c: In function `foo': ppid_test.c:4: `pid_t' undeclared (first use this function) ppid_test.c:4: (Each undeclared identifier is reported only once ppid_test.c:4: for each function it appears in.) ppid_test.c:4: parse error before `n' Compare this to linux/intel: hjstein@blinky:~$ uname -a Linux blinky 2.0.30 #1 Thu Jul 10 18:38:08 IDT 1997 i586 hjstein@blinky:~$ gcc -c -o ppid_test.o ppid_test.c Eventually, I discovered pid_t declared in /usr/include/linux/types.h, but wrapped with an #ifndef __KERNEL_STRICT_NAMES/#endif. I then found that on the alpha, __KERNEL_STRICT_NAMES is defined in /usr/include/features.h, but is not defined anywhere in the linux/intel headers. It says in /usr/include/features.h on the alpha that: #undef __KERNEL_STRICT_NAMES /* Suppress kernel-name space pollution unless user expressedly asks for it. */ #ifndef _LOOSE_KERNEL_NAMES # define __KERNEL_STRICT_NAMES #endif However, if I define _LOOSE_KERNEL_NAMES then although the above compiles, it still gives a warning: hjstein@randy:~$ gcc -D_LOOSE_KERNEL_NAMES -c -o ppid_test.o ppid_test.c In file included from ppid_test.c:1: /usr/include/unistd.h:151: warning: redefinition of `ssize_t' /usr/include/linux/types.h:35: warning: `ssize_t' previously declared here Finally, if I add #include to the top of the code (as Donald Lewine's POSIX Programmer's Guide indicates is needed), the code compiles without problem *without* -D_LOOSE_KERNEL_NAMES, and causes *many* warnings when compiled *with* -D_LOOSE_KERNEL_NAMES. Of course, the alpha box is using glibc-0.961212, and the intel box is using libc-5.3.12. So evidently there is a bug either in the glibc headers, or the libc headers & the man pages. So, which is it & who should I email about it? Is there someone on this list looking into/fixing such things, or should I email a glibc mailing list or the linux libc mailing list or a particular person or ...? In general I've been seeing various warnings from the standard header files when compiling on the alpha. Again, are they being fixed, or should I email this list, or some other list, or someone in particular with the ones I've seen? Thanks, -- Harvey J. Stein Berger Financial Research hjstein@bfr.co.il -- To unsubscribe: send e-mail to axp-list-request@redhat.com with 'unsubscribe' as the subject. Do not send it to axp-list@redhat.com