coccinelle: O_NDELAY → O_NONBLOCK

Apparently O_NONBLOCK is the modern name used in most documentation and
for most cases in our sources. Let's hence replace the old alias
O_NDELAY and stick to O_NONBLOCK everywhere.
This commit is contained in:
Lennart Poettering 2018-01-24 11:09:29 +01:00
parent 81b1dc271f
commit db4a47e9fe
7 changed files with 14 additions and 8 deletions

4
coccinelle/o-ndelay.occi Normal file
View File

@ -0,0 +1,4 @@
@@
@@
- O_NDELAY
+ O_NONBLOCK

View File

@ -1497,7 +1497,8 @@ static int server_open_hostname(Server *s) {
assert(s);
s->hostname_fd = open("/proc/sys/kernel/hostname", O_RDONLY|O_CLOEXEC|O_NDELAY|O_NOCTTY);
s->hostname_fd = open("/proc/sys/kernel/hostname",
O_RDONLY|O_CLOEXEC|O_NONBLOCK|O_NOCTTY);
if (s->hostname_fd < 0)
return log_error_errno(errno, "Failed to open /proc/sys/kernel/hostname: %m");

View File

@ -305,7 +305,7 @@ int inhibitor_create_fifo(Inhibitor *i) {
/* Open reading side */
if (i->fifo_fd < 0) {
i->fifo_fd = open(i->fifo_path, O_RDONLY|O_CLOEXEC|O_NDELAY);
i->fifo_fd = open(i->fifo_path, O_RDONLY|O_CLOEXEC|O_NONBLOCK);
if (i->fifo_fd < 0)
return -errno;
}
@ -321,7 +321,7 @@ int inhibitor_create_fifo(Inhibitor *i) {
}
/* Open writing side */
r = open(i->fifo_path, O_WRONLY|O_CLOEXEC|O_NDELAY);
r = open(i->fifo_path, O_WRONLY|O_CLOEXEC|O_NONBLOCK);
if (r < 0)
return -errno;

View File

@ -962,7 +962,7 @@ int session_create_fifo(Session *s) {
/* Open reading side */
if (s->fifo_fd < 0) {
s->fifo_fd = open(s->fifo_path, O_RDONLY|O_CLOEXEC|O_NDELAY);
s->fifo_fd = open(s->fifo_path, O_RDONLY|O_CLOEXEC|O_NONBLOCK);
if (s->fifo_fd < 0)
return -errno;
@ -981,7 +981,7 @@ int session_create_fifo(Session *s) {
}
/* Open writing side */
r = open(s->fifo_path, O_WRONLY|O_CLOEXEC|O_NDELAY);
r = open(s->fifo_path, O_WRONLY|O_CLOEXEC|O_NONBLOCK);
if (r < 0)
return -errno;

View File

@ -488,7 +488,8 @@ static int manager_watch_hostname(Manager *m) {
assert(m);
m->hostname_fd = open("/proc/sys/kernel/hostname", O_RDONLY|O_CLOEXEC|O_NDELAY|O_NOCTTY);
m->hostname_fd = open("/proc/sys/kernel/hostname",
O_RDONLY|O_CLOEXEC|O_NONBLOCK|O_NOCTTY);
if (m->hostname_fd < 0) {
log_warning_errno(errno, "Failed to watch hostname: %m");
return 0;

View File

@ -330,7 +330,7 @@ static int write_to_terminal(const char *tty, const char *message) {
assert(tty);
assert(message);
fd = open(tty, O_WRONLY|O_NDELAY|O_NOCTTY|O_CLOEXEC);
fd = open(tty, O_WRONLY|O_NONBLOCK|O_NOCTTY|O_CLOEXEC);
if (fd < 0 || !isatty(fd))
return -errno;

View File

@ -8352,7 +8352,7 @@ static int talk_initctl(void) {
request.runlevel = rl;
fd = open(INIT_FIFO, O_WRONLY|O_NDELAY|O_CLOEXEC|O_NOCTTY);
fd = open(INIT_FIFO, O_WRONLY|O_NONBLOCK|O_CLOEXEC|O_NOCTTY);
if (fd < 0) {
if (errno == ENOENT)
return 0;