Skip to contentSkip to conversation

sg utils sg_io -i 0x24 -y "12 00:00:00 24 00"

DISCUSSION Pat LaVarre 1 participant 1 message Dec 3, 2003 SCSI

lore
Share & tools
lore
#0 lore raw
Quoted 6 lines
Quoted 2 lines

- O_RDWR
+ O_RDONLY|O_NONBLOCK

...
I dreamed up this patch only by guessing from
hints found on the web, not from reading a
document anywhere.

Possibly we recommend open O_NONBLOCK for SG_IO.

Evidence in favour of that conjecture includes the following, not close to block/scsi_ioctl.c in the kernel source, but yes close in author space:

---

From: linux-2.6.0-test11/Documentation/cdrom/cdrom-standard.tex
...
1997/12/28 ...
...
We therefore propose to use the flag $O_NONBLOCK$ to indicate that the device is opened just for issuing $ioctl$ commands. Strictly, the meaning of $O_NONBLOCK$ is that opening and subsequent calls to the device don't cause the calling process to wait. We could interpret this as ``don't wait until someone has inserted some valid data-\cdrom.'' Thus, our proposal of the implementation for the $open()$ call for \cdrom s is:
...
\begin{itemize}
...
\item If no other flags are set than $O_RDONLY$, the device is opened for data transfer, and the return value will be 0 only upon successful initialization of the transfer. The call may even induce some actions on the \cdrom, such as closing the tray.
...
\item If the option flag $O_NONBLOCK$ is set, opening will always be successful, unless the whole device doesn't exist. The drive will take no actions whatsoever.
...
\end{itemize}

---

Pat LaVarre