any plans for an "official" newlib snapshot ?

Werner Almesberger
Mon Nov 20 19:25:00 GMT 2000

J. Johnston wrote:
> The general newlib goal is ANSI C compliance (not necessarily full-function)
> and a reasonable set of POSIX / Unix extensions.  

Perfect ;-)

> Yes, that was what I was thinking.

Great, so let's start then. There's one major compatibility problem I
haven't fixed yet:
 - libc/include/sys/unistd.h defines MAXNAMLEN as 1024
 - on Linux, d_name in struct dirent is 256 bytes long

Right now, I define the right MAXNAMLEN in libc/sys/linux/sys/dirent.h,
so depending on what you include first, you get the correct value or
not. (libc/sys/sparc64/sys/dirent.h seems to fight with similar issues.
sun4 and decstation just have a plain #define. Not sure how well they
compile ...)

The easiest solution would be remove the #define from
libc/include/sys/unistd.h and to add the following to libc/include/dirent.h

#if !defined(MAXNAMLEN) && !defined(_POSIX_SOURCE)
#define MAXNAMLEN 1024

after including sys/dirent.h. That way, sys/dirent.h can reliably
provide the correct value.

But I'm not sure if this is compatible with wherever that MAXNAMLEN
appeared originally. (BTW, glibc 2.1.3 also defines it in dirent.h, not

Comments ?

- Werner

 / Werner Almesberger, ICA, EPFL, CH  /

More information about the Newlib mailing list