O_SYNC
Corinna Vinschen
vinschen@redhat.com
Wed Dec 14 09:16:00 GMT 2005
On Dec 13 15:42, Jeff Johnston wrote:
> Corinna Vinschen wrote:
> >Hi,
> >
> >in libc/include/sys/fcntl.h, the O_SYNC flag is guarded by "#ifndef
> >_POSIX_SOURCE", together with these unlucky BSD defines FAPPEND, FSYNC,
> >etc. However, O_SYNC is defined by SUSv3 as part of the "Synchronized
> >Input and Output" extension [SIO], together with its siblings O_DSYNC
> >and O_RSYNC. Shouldn't O_SYNC be taken out of the "#ifndef _POSIX_SOURCE"
> >guarded part and be always defined instead?
> >
>
> Yes, it is documented in the POSIX standard and should be outside of the
> #ifndef.
Ok, thanks. I've applied the below patch. It also fixes a typo in
a comment.
Corinna
* libc/include/sys/fcntl.h: Define O_SYNC unconditionally. Fix
typo in O_NDELAY comment.
Index: libc/include/sys/fcntl.h
===================================================================
RCS file: /cvs/src/src/newlib/libc/include/sys/fcntl.h,v
retrieving revision 1.5
diff -u -p -r1.5 fcntl.h
--- libc/include/sys/fcntl.h 1 Dec 2003 17:27:01 -0000 1.5
+++ libc/include/sys/fcntl.h 14 Dec 2005 08:46:11 -0000
@@ -37,9 +37,9 @@ extern "C" {
#define O_CREAT _FCREAT
#define O_TRUNC _FTRUNC
#define O_EXCL _FEXCL
-/* O_SYNC _FSYNC not posix, defined below */
+#define O_SYNC _FSYNC
/* O_NDELAY _FNDELAY set in include/fcntl.h */
-/* O_NDELAY _FNBIO set in 5include/fcntl.h */
+/* O_NDELAY _FNBIO set in include/fcntl.h */
#define O_NONBLOCK _FNONBLOCK
#define O_NOCTTY _FNOCTTY
/* For machines which care - */
@@ -68,8 +68,6 @@ extern "C" {
#ifndef _POSIX_SOURCE
-#define O_SYNC _FSYNC
-
/*
* Flags that work for fcntl(fd, F_SETFL, FXXXX)
*/
--
Corinna Vinschen
Cygwin Project Co-Leader
Red Hat, Inc.
More information about the Newlib
mailing list