This is the mail archive of the
glibc-bugs@sourceware.org
mailing list for the glibc project.
[Bug libc/3127] New: Header "unistd.h." does not contain needed type definition
- From: "nico-linux-glibc at schottelius dot org" <sourceware-bugzilla at sourceware dot org>
- To: glibc-bugs at sources dot redhat dot com
- Date: 25 Aug 2006 08:44:13 -0000
- Subject: [Bug libc/3127] New: Header "unistd.h." does not contain needed type definition
- Reply-to: sourceware-bugzilla at sourceware dot org
I am using glibc 2.3.6-16 (debian version) and I am trying to use fork() like
specified in POSIX.
This does not work, because unistd.h does not offer the type pid_t:
gcc -Wall -c fork_cmd.c -o fork_cmd.o
fork_cmd.c: In function 'fork_cmd':
fork_cmd.c:17: error: 'pid_t' undeclared (first use in this function)
fork_cmd.c:17: error: (Each undeclared identifier is reported only once
fork_cmd.c:17: error: for each function it appears in.)
fork_cmd.c:17: error: expected ';' before 'pid'
fork_cmd.c:21: error: 'pid' undeclared (first use in this function)
Code:
#include <unistd.h> /* fork */
int fork_cmd()
{
pid_t pid;
pid = fork();
...
The fork command defined by Posix is described under
http://www.opengroup.org/onlinepubs/009695399/functions/fork.html
and only mentions unistd.h as needed header.
This is a change in posix in issue 6:
"The requirement to include <sys/types.h> has been removed. Although
<sys/types.h> was required for conforming implementations of previous POSIX
specifications, it was not required for UNIX applications." (quote
from the above url)
Please fix it, so one can relay on posix standards and program portable
programs.
--
Summary: Header "unistd.h." does not contain needed type
definition
Product: glibc
Version: unspecified
Status: NEW
Severity: normal
Priority: P1
Component: libc
AssignedTo: drepper at redhat dot com
ReportedBy: nico-linux-glibc at schottelius dot org
CC: glibc-bugs at sources dot redhat dot com
http://sourceware.org/bugzilla/show_bug.cgi?id=3127
------- You are receiving this mail because: -------
You are on the CC list for the bug, or are watching someone who is.