]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
coccinelle: O_NDELAY → O_NONBLOCK 7983/head
authorLennart Poettering <lennart@poettering.net>
Wed, 24 Jan 2018 10:09:29 +0000 (11:09 +0100)
committerLennart Poettering <lennart@poettering.net>
Wed, 24 Jan 2018 10:09:29 +0000 (11:09 +0100)
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.

coccinelle/o-ndelay.occi [new file with mode: 0644]
src/journal/journald-server.c
src/login/logind-inhibit.c
src/login/logind-session.c
src/resolve/resolved-manager.c
src/shared/utmp-wtmp.c
src/systemctl/systemctl.c

diff --git a/coccinelle/o-ndelay.occi b/coccinelle/o-ndelay.occi
new file mode 100644 (file)
index 0000000..669424a
--- /dev/null
@@ -0,0 +1,4 @@
+@@
+@@
+- O_NDELAY
++ O_NONBLOCK
index 74536e17152402ff0758f12f3869af7075b5a56a..5cd58e8a7794f18cc44d167329aaea50e4323bba 100644 (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");
 
index 8a6487ea45e899ab51e06ceed45354cb44982050..e14835292e6b75e5aca82c18495749ea09dbc748 100644 (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;
 
index c4bde80c0c7e7d246bb355e46110ba51d238b929..92eb2943fe7e1390d2d9faf1d652f0f1472b4803 100644 (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;
 
index 1311f04f75513322fd3f7192203392ba4586e498..2ee027791ade02193509db8d547a7ee8645ba040 100644 (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;
index 1715c0fb24ce50f4b3333b43f000d7e1259660c4..cab1cd6a2d147032635a9c8f578918ce94cda1c2 100644 (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;
 
index adfb1f01fe8dda91d20de63c0d31d68840fc0b34..30077d319dfb5871a457ec4abcf45958b9ae3172 100644 (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;