This is the mail archive of the newlib@sourceware.org mailing list for the newlib project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: _POSIX_SOURCE


On 4/5/05, Shaun Jackman <sjackman@gmail.com> wrote:
> The following lines in linux/sys/stat.h are giving me trouble:
>
> #ifndef _POSIX_SOURCE
> int     _EXFUN(lstat,( const char *file_name, struct stat *buf));
> #endif /* _POSIX_SOURCE */
>
> Since _POSIX_SOURCE is defined in a header file (features.h), there's
> no clean way at build time to undefine it with a -U flag. The
> semantics of glibc's _POSIX_SOURCE are to include POSIX functions, not
> to disinclude BSD functions. This and other places should be #ifdef
> _BSD_SOURCE, to be compatible with glibc's features.h. Would you
> accept a patch against files that use the #ifndef _POSIX_SOURCE idiom?
>
> Cheers,
> Shaun

Since lstat is in SUSv3, I suggest removing the test on _POSIX_SOURCE
to declare lstat. The bigger issue is that newlib and glibc use the
_POSIX_SOURCE definition in incompatible ways. Since newlib uses
headers from glibc, great trouble ensues.

Cheers,
Shaun

2006-03-20  Shaun Jackman  <sjackman@gmail.com>

	* libc/sys/linux/sys/stat.h: Declare lstat regardless of
	_POSIX_SOURCE.

--- sys/linux/sys/stat.h        16 Dec 2005 19:11:10 -0000      1.5
+++ sys/linux/sys/stat.h        20 Mar 2006 21:03:14 -0000
@@ -23,11 +23,9 @@
 int     _EXFUN(stat,( const char *__path, struct stat *__sbuf ));
 mode_t  _EXFUN(umask,( mode_t __mask ));

-#ifndef _POSIX_SOURCE
 int     _EXFUN(fstat64,( int __fd, struct stat64 *__sbuf ));
 int    _EXFUN(lstat,( const char *file_name, struct stat64 *buf));
 int    _EXFUN(lstat64,( const char *file_name, struct stat64 *buf));
 int     _EXFUN(stat64,( const char *__path, struct stat64 *__sbuf ));
-#endif /* _POSIX_SOURCE */

 #endif /* _SYS_STAT_H */

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]