Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

PATCH: Add nonblock to sysopen



A while back CcxWrk on IRC noted sysopen doesn't support O_NONBLOCK.

The POSIX spec for open requires O_NONBLOCK; however, since the spec
also requires O_CLOEXEC, O_NOFOLLOW, and O_SYNC, I wrapped nonblock in
an ifdef as well.

While here, the name member of the struct ought to be const.


diff --git a/Doc/Zsh/mod_system.yo b/Doc/Zsh/mod_system.yo
index 399b6fe03..884c3e753 100644
--- a/Doc/Zsh/mod_system.yo
+++ b/Doc/Zsh/mod_system.yo
@@ -62,6 +62,9 @@ suppress updating of the file atime
 item(tt(nofollow))(
 fail if var(file) is a symbolic link
 )
+item(tt(nonblock))(
+the file is opened in nonblocking mode
+)
 item(tt(sync))(
 request that writes wait until data has been physically written
 )
diff --git a/Src/Modules/system.c b/Src/Modules/system.c
index ecd4e2546..71745548f 100644
--- a/Src/Modules/system.c
+++ b/Src/Modules/system.c
@@ -280,7 +280,7 @@ bin_syswrite(char *nam, char **args, Options ops, UNUSED(int func))
 }
 
 
-static struct { char *name; int oflag; } openopts[] = {
+static struct { const char *name; int oflag; } openopts[] = {
 #ifdef O_CLOEXEC
     { "cloexec", O_CLOEXEC },
 #else
@@ -296,6 +296,9 @@ static struct { char *name; int oflag; } openopts[] = {
 #endif
 #ifdef O_NOATIME
     { "noatime", O_NOATIME },
+#endif
+#ifdef O_NONBLOCK
+    { "nonblock", O_NONBLOCK},
 #endif
     { "excl", O_EXCL | O_CREAT },
     { "creat", O_CREAT },




Messages sorted by: Reverse Date, Date, Thread, Author