bug-gnulib
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[PATCH] fcntl-h: support GNU flags like O_IGNORE_CTTY


From: Paul Eggert
Subject: [PATCH] fcntl-h: support GNU flags like O_IGNORE_CTTY
Date: Mon, 15 Oct 2012 09:33:19 -0700
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:16.0) Gecko/20121009 Thunderbird/16.0

 ChangeLog                    | 11 +++++++++++
 doc/posix-headers/fcntl.texi |  7 ++++---
 lib/fcntl.in.h               | 12 ++++++++++++
 tests/test-fcntl-h.c         | 15 ++++++++++++---
 4 files changed, 39 insertions(+), 6 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 45637f3..ab27b51 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,14 @@
+2012-10-15  Paul Eggert  <address@hidden>
+
+       fcntl-h: support GNU flags like O_IGNORE_CTTY
+       * doc/posix-headers/fcntl.texi (fcntl.h): Support O_IGNORE_CTTY,
+       O_NOLINK, and O_NOTRANS.  These flags are nonzero on GNU/Hurd
+       systems.  Discovered when using fcntl-h with GNU Emacs, which uses
+       O_IGNORE_CTTY.  Fix misspelling of F_SETLKW.
+       * lib/fcntl.in.h (O_IGNORE_CTTY, O_NOLINK, O_NOTRANS):
+       Define to 0 if not already defined.
+       * tests/test-fcntl-h.c: Test these new flags.
+
 2012-10-14  Paul Eggert  <address@hidden>
 
        faccessat, etc.: support AT_FDCWD-only use
diff --git a/doc/posix-headers/fcntl.texi b/doc/posix-headers/fcntl.texi
index 10d5d8d..eaa885d 100644
--- a/doc/posix-headers/fcntl.texi
+++ b/doc/posix-headers/fcntl.texi
@@ -45,8 +45,9 @@ portability to native Windows platforms) are defined on some 
platforms but
 not on others.
 
 @item
address@hidden, @samp{O_NDELAY}, @samp{O_NOATIME},
-and @samp{O_NOLINKS} (not specified by POSIX) are defined
address@hidden, @samp{O_IGNORE_CTTY}, @samp{O_NDELAY},
address@hidden, @samp{O_NOLINK}, @samp{O_NOLINKS}, and
address@hidden (not specified by POSIX) are defined
 on some platforms but not on others.
 
 @item
@@ -77,7 +78,7 @@ Portability problems not fixed by Gnulib:
 @itemize
 @item
 @samp{F_SETFD}, @samp{F_GETFL}, @samp{F_SETFL}, @samp{F_GETLK},
address@hidden, @samp{F_SETLOKW}, @samp{F_GETOWN}, and @samp{F_SETOWN}
address@hidden, @samp{F_SETLKW}, @samp{F_GETOWN}, and @samp{F_SETOWN}
 are not defined on some platforms:
 mingw, MSVC 9.
 
diff --git a/lib/fcntl.in.h b/lib/fcntl.in.h
index 76e12f7..5fdac23 100644
--- a/lib/fcntl.in.h
+++ b/lib/fcntl.in.h
@@ -216,6 +216,10 @@ _GL_WARN_ON_USE (openat, "openat is not portable - "
 # define O_EXEC O_RDONLY /* This is often close enough in older systems.  */
 #endif
 
+#ifndef O_IGNORE_CTTY
+# define O_IGNORE_CTTY 0
+#endif
+
 #ifndef O_NDELAY
 # define O_NDELAY 0
 #endif
@@ -249,10 +253,18 @@ _GL_WARN_ON_USE (openat, "openat is not portable - "
 # define O_NOFOLLOW 0
 #endif
 
+#ifndef O_NOLINK
+# define O_NOLINK 0
+#endif
+
 #ifndef O_NOLINKS
 # define O_NOLINKS 0
 #endif
 
+#ifndef O_NOTRANS
+# define O_NOTRANS 0
+#endif
+
 #ifndef O_RSYNC
 # define O_RSYNC 0
 #endif
diff --git a/tests/test-fcntl-h.c b/tests/test-fcntl-h.c
index 00c5468..9515f82 100644
--- a/tests/test-fcntl-h.c
+++ b/tests/test-fcntl-h.c
@@ -21,9 +21,9 @@
 #include <fcntl.h>
 
 /* Check that the various O_* macros are defined.  */
-int o = O_DIRECT | O_DIRECTORY | O_DSYNC | O_NDELAY | O_NOATIME | O_NONBLOCK
-        | O_NOCTTY | O_NOFOLLOW | O_NOLINKS | O_RSYNC | O_SYNC | O_TTY_INIT
-        | O_BINARY | O_TEXT;
+int o = (O_DIRECT | O_DIRECTORY | O_DSYNC | O_IGNORE_CTTY | O_NDELAY | 
O_NOATIME
+        | O_NONBLOCK | O_NOCTTY | O_NOFOLLOW | O_NOLINK | O_NOLINKS | O_NOTRANS
+        | O_RSYNC | O_SYNC | O_TTY_INIT | O_BINARY | O_TEXT);
 
 /* Check that the various SEEK_* macros are defined.  */
 int sk[] = { SEEK_CUR, SEEK_END, SEEK_SET };
@@ -84,6 +84,9 @@ main (void)
 #if O_DSYNC
     case O_DSYNC:
 #endif
+#if O_IGNORE_CTTY
+    case O_IGNORE_CTTY:
+#endif
 #if O_NOATIME
     case O_NOATIME:
 #endif
@@ -96,9 +99,15 @@ main (void)
 #if O_NOFOLLOW
     case O_NOFOLLOW:
 #endif
+#if O_NOLINK
+    case O_NOLINK:
+#endif
 #if O_NOLINKS
     case O_NOLINKS:
 #endif
+#if O_NOTRANS
+    case O_NOTRANS:
+#endif
 #if O_RSYNC && O_RSYNC != O_DSYNC
     case O_RSYNC:
 #endif
-- 
1.7.11.7




reply via email to

[Prev in Thread] Current Thread [Next in Thread]