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]

[PATCH 1/2] Feature test macros overhaul: sparc64


sparc64 has a number of its own headers which override the generic ones.
These too need to use feature test macros properly.

These changes correspond to the generic fcntl.h and sys/stat.h changes
in commit d2df6d381b36f3f76420bc3bab965fbbdc3c3a8c and
commit 069e400c913659432c5d1953c4fa9a696b06e340.

Signed-off-by: Yaakov Selkowitz <yselkowi@redhat.com>
---
 newlib/libc/sys/sparc64/sys/fcntl.h | 24 ++++++++++++------------
 newlib/libc/sys/sparc64/sys/stat.h  |  7 ++++---
 2 files changed, 16 insertions(+), 15 deletions(-)

diff --git a/newlib/libc/sys/sparc64/sys/fcntl.h b/newlib/libc/sys/sparc64/sys/fcntl.h
index 940649a..b52932b 100644
--- a/newlib/libc/sys/sparc64/sys/fcntl.h
+++ b/newlib/libc/sys/sparc64/sys/fcntl.h
@@ -12,6 +12,7 @@ extern "C" {
 #endif
 
 #include <_ansi.h>
+#include <sys/cdefs.h>
 
 #define	_FOPEN		(-1)	/* from sys/file.h, kernel use only */
 #define	_FREAD		0x0001	/* read enabled */
@@ -58,11 +59,10 @@ extern "C" {
 /*	O_NDELAY	_FNBIO 		set in 5include/fcntl.h */
 #define	O_NONBLOCK	_FNONBLOCK
 #define	O_NOCTTY	_FNOCTTY
-
-#ifndef	_POSIX_SOURCE
-
 #define	O_SYNC		_FSYNC
 
+#if __MISC_VISIBLE
+
 /*
  * Flags that work for fcntl(fd, F_SETFL, FXXXX)
  */
@@ -93,7 +93,7 @@ extern "C" {
 #define	FEXCL		_FEXCL
 #define	FNOCTTY		_FNOCTTY
 
-#endif	!_POSIX_SOURCE
+#endif /* __MISC_VISIBLE */
 
 /* XXX close on exec request; must match UF_EXCLOSE in user.h */
 #define	FD_CLOEXEC	1	/* posix */
@@ -104,7 +104,7 @@ extern "C" {
 #define	F_SETFD		2	/* Set fildes flags (close on exec) */
 #define	F_GETFL		3	/* Get file flags */
 #define	F_SETFL		4	/* Set file flags */
-#ifndef	_POSIX_SOURCE
+#if __BSD_VISIBLE || __POSIX_VISIBLE >= 200112
 #ifdef __svr4__
 #define	F_GETOWN 	23	/* Get owner - for ASYNC */
 #define	F_SETOWN 	24	/* Set owner - for ASYNC */
@@ -112,7 +112,7 @@ extern "C" {
 #define	F_GETOWN 	5	/* Get owner - for ASYNC */
 #define	F_SETOWN 	6	/* Set owner - for ASYNC */
 #endif
-#endif	/* !_POSIX_SOURCE */
+#endif	/* __BSD_VISIBLE || __POSIX_VISIBLE >= 200112 */
 #ifdef __svr4__
 #define	F_GETLK  	14	/* Get record-locking information */
 #define	F_SETLK		6	/* Set or Clear a record-lock (Non-Blocking) */
@@ -122,20 +122,20 @@ extern "C" {
 #define	F_SETLK  	8	/* Set or Clear a record-lock (Non-Blocking) */
 #define	F_SETLKW 	9	/* Set or Clear a record-lock (Blocking) */
 #endif
-#ifndef	_POSIX_SOURCE
+#if __MISC_VISIBLE
 #define	F_RGETLK 	10	/* Test a remote lock to see if it is blocked */
 #define	F_RSETLK 	11	/* Set or unlock a remote lock */
 #define	F_CNVT 		12	/* Convert a fhandle to an open fd */
 #define	F_RSETLKW 	13	/* Set or Clear remote record-lock(Blocking) */
-#endif	/* !_POSIX_SOURCE */
+#endif	/* __MISC_VISIBLE */
 
 /* fcntl(2) flags (l_type field of flock structure) */
 #define	F_RDLCK		1	/* read lock */
 #define	F_WRLCK		2	/* write lock */
 #define	F_UNLCK		3	/* remove lock(s) */
-#ifndef	_POSIX_SOURCE
+#if __MISC_VISIBLE
 #define	F_UNLKSYS	4	/* remove remote locks for a given system */
-#endif	/* !_POSIX_SOURCE */
+#endif	/* __MISC_VISIBLE */
 
 /*#include <sys/stdtypes.h>*/
 
@@ -149,7 +149,7 @@ struct flock {
 	short	l_xxx;		/* reserved for future use */
 };
 
-#ifndef	_POSIX_SOURCE
+#if __MISC_VISIBLE
 /* extended file segment locking set data type */
 struct eflock {
 	short	l_type;		/* F_RDLCK, F_WRLCK, or F_UNLCK */
@@ -161,7 +161,7 @@ struct eflock {
 	long	l_rpid;		/* Remote process id wanting this lock */
 	long	l_rsys;		/* Remote system id wanting this lock */
 };
-#endif	/* !_POSIX_SOURCE */
+#endif	/* __MISC_VISIBLE */
 
 
 #include <sys/types.h>
diff --git a/newlib/libc/sys/sparc64/sys/stat.h b/newlib/libc/sys/sparc64/sys/stat.h
index 26ed53f..7464067 100644
--- a/newlib/libc/sys/sparc64/sys/stat.h
+++ b/newlib/libc/sys/sparc64/sys/stat.h
@@ -78,14 +78,15 @@ struct	stat
 
 #define	S_ISUID		0004000	/* set user id on execution */
 #define	S_ISGID		0002000	/* set group id on execution */
-#ifndef	_POSIX_SOURCE
 #define	S_ISVTX		0001000	/* save swapped text even after use */
+#if __BSD_VISIBLE
 #define	S_IREAD		0000400	/* read permission, owner */
 #define	S_IWRITE 	0000200	/* write permission, owner */
 #define	S_IEXEC		0000100	/* execute/search permission, owner */
-
 #define	S_ENFMT 	0002000	/* enforcement-mode locking */
+#endif /* __BSD_VISIBLE */
 
+#if __POSIX_VISIBLE >= 200112
 #define	S_IFMT		_IFMT
 #define	S_IFDIR		_IFDIR
 #define	S_IFCHR		_IFCHR
@@ -94,7 +95,7 @@ struct	stat
 #define	S_IFLNK		_IFLNK
 #define	S_IFSOCK	_IFSOCK
 #define	S_IFIFO		_IFIFO
-#endif	/* !_POSIX_SOURCE */
+#endif	/* __POSIX_VISIBLE >= 200112 */
 
 
 #define	S_IRWXU 	0000700	/* rwx, owner */
-- 
2.7.0


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