Skip to contentSkip to conversation

oslib-posix: Remove OpenBSD workaround for fcntl("/dev/null", F_SETFL, O_NONBLOCK) failure

PATCH Applied Brad Smith 2 participants 4 messages Apr 1, 2021 – May 31, 2021

lore
Share & tools
lore

Brad Smith

author
#0 lore raw

PATCH 1/1 oslib-posix: Remove OpenBSD workaround for fcntl("/dev/null", F_SETFL, O_NONBLOCK) failure

OpenBSD prior to 6.3 required a workaround to utilize fcntl(F_SETFL) on memory devices.

Since modern verions of OpenBSD that are only officialy supported and buildable on do not have this issue I am garbage collecting this workaround.

util/oslib-posix.c +0 -11
index 36820fec16..7b4bec1402 100644
@@ -273,17 +273,6 @@ int qemu_try_set_nonblock(int fd)
         return -errno;
     }
     if (fcntl(fd, F_SETFL, f | O_NONBLOCK) == -1) {
-#ifdef __OpenBSD__
-        /*
-         * Previous to OpenBSD 6.3, fcntl(F_SETFL) is not permitted on
-         * memory devices and sets errno to ENODEV.
-         * It's OK if we fail to set O_NONBLOCK on devices like /dev/null,
-         * because they will never block anyway.
-         */
-        if (errno == ENODEV) {
-            return 0;
-        }
-#endif
         return -errno;
     }
     return 0;
author
#1 lore raw

ping.

Quoted 31 lines · Brad Smith

OpenBSD prior to 6.3 required a workaround to utilize fcntl(F_SETFL) on memory devices.

Since modern verions of OpenBSD that are only officialy supported and buildable on do not have this issue I am garbage collecting this workaround.

util/oslib-posix.c +0 -11
index 36820fec16..7b4bec1402 100644
@@ -273,17 +273,6 @@ int qemu_try_set_nonblock(int fd)
          return -errno;
      }
      if (fcntl(fd, F_SETFL, f | O_NONBLOCK) == -1) {
-#ifdef __OpenBSD__
-        /*
-         * Previous to OpenBSD 6.3, fcntl(F_SETFL) is not permitted on
-         * memory devices and sets errno to ENODEV.
-         * It's OK if we fail to set O_NONBLOCK on devices like /dev/null,
-         * because they will never block anyway.
-         */
-        if (errno == ENODEV) {
-            return 0;
-        }
-#endif
          return -errno;
      }
      return 0;
author
#2 lore raw
In reply to Brad Smith

ping.

Quoted 31 lines · Brad Smith

OpenBSD prior to 6.3 required a workaround to utilize fcntl(F_SETFL) on memory devices.

Since modern verions of OpenBSD that are only officialy supported and buildable on do not have this issue I am garbage collecting this workaround.

util/oslib-posix.c +0 -11
index 36820fec16..7b4bec1402 100644
@@ -273,17 +273,6 @@ int qemu_try_set_nonblock(int fd)
          return -errno;
      }
      if (fcntl(fd, F_SETFL, f | O_NONBLOCK) == -1) {
-#ifdef __OpenBSD__
-        /*
-         * Previous to OpenBSD 6.3, fcntl(F_SETFL) is not permitted on
-         * memory devices and sets errno to ENODEV.
-         * It's OK if we fail to set O_NONBLOCK on devices like /dev/null,
-         * because they will never block anyway.
-         */
-        if (errno == ENODEV) {
-            return 0;
-        }
-#endif
          return -errno;
      }
      return 0;
#3 lore raw
In reply to Brad Smith
Quoted 22 lines · Brad Smith

OpenBSD prior to 6.3 required a workaround to utilize fcntl(F_SETFL) on memory devices.

Since modern verions of OpenBSD that are only officialy supported and buildable on do not have this issue I am garbage collecting this workaround.

util/oslib-posix.c +0 -4
index 36820fec16..7b4bec1402 100644
@@ -273,17 +273,6 @@ int qemu_try_set_nonblock(int fd)
          return -errno;
      }
      if (fcntl(fd, F_SETFL, f | O_NONBLOCK) == -1) {
-#ifdef __OpenBSD__
-        /*
-         * Previous to OpenBSD 6.3, fcntl(F_SETFL) is not permitted on
-         * memory devices and sets errno to ENODEV.

util/oslib-posix.c int qemu_try_set_nonblock(int fd) · line 278

Quoted 10 lines
util/oslib-posix.c +0 -7
-         * It's OK if we fail to set O_NONBLOCK on devices like /dev/null,
-         * because they will never block anyway.
-         */
-        if (errno == ENODEV) {
-            return 0;
-        }
-#endif
          return -errno;
      }
      return 0;

Queued, thanks.

Paolo