Using the SC_RETAIN_RESERVATION Option

The SC_RETAIN_RESERVATION option causes the SCSI device driver not to issue the SCSI release command during the close of the device. This guarantees a calling program control of the device (using SCSI reservation) through open and close cycles.

For shared devices (for example, disk or CD-ROM), the SCSI device driver must OR together this option for all opens to a given device. If any caller requests this option, the close routine does not issue the release even if other opens to the device do not set SC_RETAIN_RESERVATION. The SCSI device driver should require the caller to have appropriate authority to request the SC_RETAIN_RESERVATION option because this request can allow a program to monopolize a device (for example, if this is a nonshared device). If the caller attempts to initiate this system call without the proper authority, the SCSI device driver should return a value of -1, with the errno global variable set to a value of EPERM.