Bug 812

Summary: unistd.h fails to define pid_t
Product: [Retired] Red Hat Raw Hide Reporter: Michael K. Johnson <johnsonm>
Component: glibcAssignee: Cristian Gafton <gafton>
Severity: medium Docs Contact:
Priority: medium    
Version: 1.0   
Target Milestone: ---   
Target Release: ---   
Hardware: All   
OS: Linux   
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 1999-03-18 22:10:57 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:

Description Michael K. Johnson 1999-01-13 04:08:15 UTC
unistd.h is supposed to define pid_t.  It doesn't.
Here's a test case.

$ cat test.c
#include <unistd.h>

main() {
  pid_t pid;
  pid = getpid();
  return 0;
$ make test
cc     test.c   -o test
test.c: In function `main':
test.c:5: `pid_t' undeclared (first use this function)
test.c:5: (Each undeclared identifier is reported only once
test.c:5: for each function it appears in.)
test.c:5: parse error before `pid'
test.c:6: `pid' undeclared (first use this function)
make: *** [test] Error 1

Comment 1 stewart 1999-01-13 04:31:59 UTC
Add -D_GNU_SOURCE to your compile line.  Then it works for me, on the

Looking at unistd.h the pid_t define is wrapped around: __USE_XOPEN