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

Brad Smith posted 1 patch 4 years, 10 months ago
Test checkpatch passed
Patches applied successfully (tree, apply log)
git fetch https://github.com/patchew-project/qemu tags/patchew/YGYECGXQhdamEJgC@humpty.home.comstyle.com
Maintainers: Paolo Bonzini <pbonzini@redhat.com>, Brad Smith <brad@comstyle.com>
[PATCH] oslib-posix: Remove OpenBSD workaround for fcntl("/dev/null", F_SETFL, O_NONBLOCK) failure
Posted by Brad Smith 4 years, 10 months ago
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.


Signed-off-by: Brad Smith <brad@comstyle.com>

diff --git a/util/oslib-posix.c b/util/oslib-posix.c
index 36820fec16..7b4bec1402 100644
--- a/util/oslib-posix.c
+++ b/util/oslib-posix.c
@@ -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;

Re: [PATCH] oslib-posix: Remove OpenBSD workaround for fcntl("/dev/null", F_SETFL, O_NONBLOCK) failure
Posted by Brad Smith 4 years, 9 months ago
ping.

On 4/1/2021 1:34 PM, Brad Smith wrote:
> 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.
>
>
> Signed-off-by: Brad Smith <brad@comstyle.com>
>
> diff --git a/util/oslib-posix.c b/util/oslib-posix.c
> index 36820fec16..7b4bec1402 100644
> --- a/util/oslib-posix.c
> +++ b/util/oslib-posix.c
> @@ -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;

Re: [PATCH] oslib-posix: Remove OpenBSD workaround for fcntl("/dev/null", F_SETFL, O_NONBLOCK) failure
Posted by Brad Smith 4 years, 8 months ago
ping.

On 4/1/2021 1:34 PM, Brad Smith wrote:
> 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.
>
>
> Signed-off-by: Brad Smith <brad@comstyle.com>
>
> diff --git a/util/oslib-posix.c b/util/oslib-posix.c
> index 36820fec16..7b4bec1402 100644
> --- a/util/oslib-posix.c
> +++ b/util/oslib-posix.c
> @@ -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;

Re: [PATCH] oslib-posix: Remove OpenBSD workaround for fcntl("/dev/null", F_SETFL, O_NONBLOCK) failure
Posted by Paolo Bonzini 4 years, 8 months ago
On 01/04/21 19:34, Brad Smith wrote:
> 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.
> 
> 
> Signed-off-by: Brad Smith <brad@comstyle.com>
> 
> diff --git a/util/oslib-posix.c b/util/oslib-posix.c
> index 36820fec16..7b4bec1402 100644
> --- a/util/oslib-posix.c
> +++ b/util/oslib-posix.c
> @@ -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;
> 

Queued, thanks.

Paolo