Eric Blake <e...@byu.net> writes:

> According to Robert Millan on 1/1/2010 5:56 AM:
>> When importing getline.c into GNU GRUB, it failed to build due to undefined
>> ssize_t.  Here's a fix (I believe including <sys/types.h> is portable enough,
>> please let me know if I'm wrong).
>
> Hmm.  The prototype for getline lives in <stdio.h>, so the real bug is
> that our replacement <stdio.h> is not guaranteeing that ssize_t is
> defined.  Which platform was this failure on?  Perhaps it resulted from
> Bruno's attempts to reduce namespace pollution on glibc machines, coupled
> with an older glibc that didn't yet expose everything required by POSIX 2008?

Is there really a requirement for stdio.h to define ssize_t?  Glibc's
stdio.h doesn't define ssize_t:

j...@mocca:~$ cat>foo.c
#include <stdio.h>
int main (void) { ssize_t foo = 42; }
j...@mocca:~$ gcc -o foo foo.c
foo.c: In function ‘main’:
foo.c:2: error: ‘ssize_t’ undeclared (first use in this function)
foo.c:2: error: (Each undeclared identifier is reported only once
foo.c:2: error: for each function it appears in.)
foo.c:2: error: expected ‘;’ before ‘foo’
j...@mocca:~$ 

It is possible to declare functions with ssize_t-parameters without
using ssize_t directly, which is what glibc is doing.

/Simon


Reply via email to