This is the mail archive of the
libc-alpha@sourceware.org
mailing list for the glibc project.
PATCH: Include <sys/stat.h> only if libc_hidden_proto is defined
- From: "H.J. Lu" <hongjiu dot lu at intel dot com>
- To: GNU C Library <libc-alpha at sourceware dot org>
- Date: Wed, 23 Dec 2009 10:49:02 -0800
- Subject: PATCH: Include <sys/stat.h> only if libc_hidden_proto is defined
- Reply-to: "H.J. Lu" <hjl dot tools at gmail dot com>
I got
make[4]: *** [/export/build/gnu/glibc/build-x86_64-linux/stdlib/isomac.out] Error 2
since include/stdlib.h includes <sys/stat.h> which leads to
stdlib.h
#define S_ISCHR(mode) __S_ISTYPE((mode), __S_IFCHR)
#define S_ISREG(mode) __S_ISTYPE((mode), __S_IFREG)
#define S_ISGID __S_ISGID
#define S_IXOTH (S_IXGRP >> 3)
#define S_IRWXG (S_IRWXU >> 3)
#define S_IRWXO (S_IRWXG >> 3)
#define S_IRWXU (__S_IREAD|__S_IWRITE|__S_IEXEC)
#define fstat(fd,buf) __fxstat (_STAT_VER, fd, buf)
#define S_ISDIR(mode) __S_ISTYPE((mode), __S_IFDIR)
#define lstat64(fname,buf) __lxstat64 (_STAT_VER, fname, buf)
#define S_IWUSR __S_IWRITE
#define stat(fname,buf) __xstat (_STAT_VER, fname, buf)
#define S_ISFIFO(mode) __S_ISTYPE((mode), __S_IFIFO)
#define S_IWGRP (S_IWUSR >> 3)
#define S_IRUSR __S_IREAD
#define fstat64(fd,buf) __fxstat64 (_STAT_VER, fd, buf)
#define S_ISBLK(mode) __S_ISTYPE((mode), __S_IFBLK)
#define S_IXUSR __S_IEXEC
#define S_IWOTH (S_IWGRP >> 3)
#define S_IRGRP (S_IRUSR >> 3)
#define lstat(fname,buf) __lxstat (_STAT_VER, fname, buf)
#define stat64(fname,buf) __xstat64 (_STAT_VER, fname, buf)
#define S_ISLNK(mode) __S_ISTYPE((mode), __S_IFLNK)
#define S_IXGRP (S_IXUSR >> 3)
#define S_ISUID __S_ISUID
#define S_IROTH (S_IRGRP >> 3)
This patch includes <sys/stat.h> and declares __ptsname_internal only if
libc_hidden_proto is defined. Tested on Linux/Intel64.
H.J.
---
2009-12-23 H.J. Lu <hongjiu.lu@intel.com>
* include/stdlib.h: Include <sys/stat.h> and declare
__ptsname_internal only if libc_hidden_proto is defined.
diff --git a/include/stdlib.h b/include/stdlib.h
index f540bec..dbe2a8c 100644
--- a/include/stdlib.h
+++ b/include/stdlib.h
@@ -9,7 +9,6 @@
/* Now define the internal interfaces. */
#ifndef __Need_M_And_C
-# include <sys/stat.h>
__BEGIN_DECLS
@@ -78,8 +77,6 @@ extern int __clearenv (void);
extern char *__canonicalize_file_name (__const char *__name);
extern char *__realpath (__const char *__name, char *__resolved);
extern int __ptsname_r (int __fd, char *__buf, size_t __buflen);
-extern int __ptsname_internal (int fd, char *buf, size_t buflen,
- struct stat64 *stp);
extern int __getpt (void);
extern int __posix_openpt (int __oflag);
@@ -219,6 +216,11 @@ extern int __qfcvt_r (long double __value, int __ndigit,
# define __cxa_atexit(func, arg, d) INTUSE(__cxa_atexit) (func, arg, d)
# endif
+# ifdef libc_hidden_proto
+# include <sys/stat.h>
+extern int __ptsname_internal (int fd, char *buf, size_t buflen,
+ struct stat64 *stp);
+# endif
#endif
extern void *__default_morecore (ptrdiff_t) __THROW;