Device driver open examples

The following are examples of irregular device handling taken from standard system device drivers. These are intended to illustrate the possible diversity of such device drivers.

/dev/null

/dev/null is a pseudo-device that has no data container. Data written to /dev/null is discarded and end-of-file (EOF) is always returned in response to read requests. Therefore, no MAC device restriction on open is required. For compatibility, DAC access on the /dev/null device file is required although this is not strictly necessary.

/dev/tty

When a process issues an open on /dev/tty, the device driver actually attempts to open the terminal that is the controlling terminal of the requesting process. Therefore, MIC, MAC, and DAC access must be checked for the process's controlling terminal process instead of for /dev/tty. For compatibility, DAC access to /dev/tty is required, although this is not strictly necessary.