Using the SC_SINGLE Option
The SC_SINGLE option causes the device driver to issue a normal open, but does not allow another caller to issue another open until the first caller has closed the device. This request gives the caller an exclusive open to the selected device.
If this openx is attempted when the device is already open, a return value of -1 is passed, with the errno global variable set to a value of EBUSY.
Once successfully opened, the device is placed in Exclusive Access mode. If another caller tries to do any type of open, a return value of -1 is passed, with the errno global variable set to a value of EACCES.
The following table shows how the various combinations of ext options should be handled in the device driver.
| EXT OPTIONS openx ext option | Device Driver Action | |
|---|---|---|
| Open | Close | |
| None | Normal | Normal |
| diag | No commands | No commands |
| diag + force | Removes a reservation; otherwise, no commands issued | No commands |
| diag + force + no_reserve | Removes a reservation; otherwise, no commands issued | No commands |
| diag + force + no_reserve + single | Removes a reservation; otherwise, no commands issued | No commands |
| diag + force + retain | Removes a reservation; otherwise, no commands issued | No commands |
| diag + force + retain + no_reserve | Removes a reservation; otherwise, no commands issued | No commands |
| diag + force + retain + no_reserve + single | Removes a reservation; otherwise, no commands issued | No commands |
| diag + force + retain + single | Removes a reservation; otherwise, no commands issued | No commands |
| diag + force + single | Removes a reservation; otherwise, no commands issued | No commands |
| diag + no_reserve | No commands | No commands |
| diag + retain | No commands | No commands |
| diag + retain + no_reserve | No commands | No commands |
| diag + retain + no_reserve + single | No commands | No commands |
| diag + retain + single | No commands | No commands |
| diag + single | No commands | No commands |
| diag + single + no_reserve | No commands | No commands |
| force | Normal, except that a reservation is removed before any commands are issued | Normal |
| force + no_reserve | Normal, except that a reservation is removed before any commands are issued | Normal except no RELEASE |
| force + retain | Normal, except that a reservation is removed before any commands are issued | No RELEASE |
| force + retain + no_reserve | Normal, except that a reservation is removed before any commands are issued | No RELEASE |
| force + retain + no_reserve + single | Normal, except that a reservation is removed before any commands are issued | No RELEASE |
| force + retain + single | Normal, except that a reservation is removed before any commands are issued | No RELEASE |
| force + single | Normal, except that a reservation is removed before any commands are issued | Normal |
| force + single + no_reserve | Normal, except that a reservation is removed before any commands are issued | No RELEASE |
| no_reserve | No RESERVE | No RELEASE |
| retain | Normal | No RELEASE |
| retain + no_reserve | No RESERVE | No RELEASE |
| retain + single | Normal | No RELEASE |
| retain + single + no_reserve | Normal, except no RESERVE command issued. | No RELEASE |
| single | Normal | Normal |
| single + no_reserve | No RESERVE | No RELEASE |