Sign Up
Log In
Log In
or
Sign Up
Places
All Projects
Status Monitor
Collapse sidebar
Please login to access the resource
openSUSE:Backports:SLE-15-SP4:RebuildFactoryUpdates
cpio
cpio-open_nonblock.patch
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
File cpio-open_nonblock.patch of Package cpio
From: Alexey Svistunov <svalx@svalx.net> Date: 2017-02-17 16:07:00 +0300 Subject: open device with O_NONBLOCK option References: https://savannah.gnu.org/patch/?9263, bnc#94449 Upstream: submitted When running the 2.6 kernel, "mt -f /dev/nst0 status" blocks if there is no media in the drive. The same occurs for other commands. When running the 2.4.24 kernel, "mt -f /dev/nst0 status" does not block when there is no tape in the drive. This behavior change is documented for the 2.6 kernel (see kernel-source-2.6.3/Documentation/scsi/st.txt for the full doc): If the open option O_NONBLOCK is used, open succeeds even if the drive is not ready. If O_NONBLOCK is not used, the driver waits for the drive to become ready. If this does not happen in ST_BLOCK_SECONDS seconds, open fails with the errno value EIO. With O_NONBLOCK the device can be opened for writing even if there is a write protected tape in the drive (commands trying to write something return error if attempted). It appears that the use of O_NONBLOCK is safe with pre-2.6 kernels. Suggest adding the use of O_NONBLOCK when opening the device. As it is, for long-running commands such as "fsf", one cannot tell if the command is progressing or if it's blocking waiting for media. Index: src/mt.c =================================================================== --- src/mt.c.orig +++ src/mt.c @@ -332,11 +332,11 @@ main (int argc, char **argv) #ifdef MTERASE case MTERASE: #endif - tapedesc = rmtopen (tapedev, O_WRONLY, 0, rsh_command_option); + tapedesc = rmtopen (tapedev, O_WRONLY | O_NONBLOCK, 0, rsh_command_option); break; default: - tapedesc = rmtopen (tapedev, O_RDONLY, 0, rsh_command_option); + tapedesc = rmtopen (tapedev, O_RDONLY | O_NONBLOCK, 0, rsh_command_option); } if (tapedesc == -1) Index: src/util.c =================================================================== --- src/util.c.orig +++ src/util.c @@ -799,14 +799,14 @@ open_archive (char *file) copy_in = process_copy_in; if (copy_function == copy_in) - fd = rmtopen (file, O_RDONLY | O_BINARY, MODE_RW, rsh_command_option); + fd = rmtopen (file, O_RDONLY | O_BINARY | O_NONBLOCK, MODE_RW, rsh_command_option); else { if (!append_flag) - fd = rmtopen (file, O_WRONLY | O_CREAT | O_TRUNC | O_BINARY, MODE_RW, + fd = rmtopen (file, O_WRONLY | O_CREAT | O_TRUNC | O_BINARY | O_NONBLOCK, MODE_RW, rsh_command_option); else - fd = rmtopen (file, O_RDWR | O_BINARY, MODE_RW, rsh_command_option); + fd = rmtopen (file, O_RDWR | O_BINARY | O_NONBLOCK, MODE_RW, rsh_command_option); } return fd;
Locations
Projects
Search
Status Monitor
Help
OpenBuildService.org
Documentation
API Documentation
Code of Conduct
Contact
Support
@OBShq
Terms
openSUSE Build Service is sponsored by
The Open Build Service is an
openSUSE project
.
Sign Up
Log In
Places
Places
All Projects
Status Monitor