The Linux SCSI Generic (sg) HOWTO
Prev | Chapter 8. Ioctl()s | Next

# 8.10. SG_GET_NUM_WAITING

SG_GET_NUM_WAITING 0x227d. Assumes 3rd argument points to an int and places the number of packets waiting to be read in it. Only those requests that have been issued by a write() and are now available to be read() are counted. In other words any ioctl(SG_IO) operations underway on this file descriptor will not effect this count [1].

### Notes

[1] | If ioctl(SG_SET_KEEP_ORPHAN) is set to 1 and a ioctl(SG_IO) operation is interrupted (e.g. by control-C by the user) then when the response arrives then the "num_waiting" will be incremented to indicate a read() can now pick up the response.

Prev | Home | Next
SG_NEXT_CMD_LEN | Up | SG_SET_FORCE_PACK_ID