From: Matthew Martin <phy1729@gmail.com>
To: zsh-workers@zsh.org
Subject: PATCH: Add nonblock to sysopen
Date: Wed, 30 Mar 2022 22:58:27 -0500 [thread overview]
Message-ID: <YkUm4wPqjVxZnWWk@CptOrmolo.darkstar> (raw)
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 },
reply other threads:[~2022-03-31 3:58 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=YkUm4wPqjVxZnWWk@CptOrmolo.darkstar \
--to=phy1729@gmail.com \
--cc=zsh-workers@zsh.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://git.vuxu.org/mirror/zsh/
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).