Writing Device Drivers for Oracle® Solaris 11.2

Exit Print View

Updated: September 2014
 
 

Device User Command Interfaces

The fuser(1M) command is enhanced to display device usage information. The fuser(1M) command displays device usage information only if path represents a device minor node. The –d flag is valid for the fuser(1M) command only if you specify a path that represents a device minor node.

fuser path

Display information about application device consumers and kernel device consumers if path represents a device minor node.

fuser -d path

Display all users of the underlying device that is associated with the device minor node represented by path.

Kernel device consumers are reported in one of the following four formats. Kernel device consumers always are surrounded by square brackets ([]).

        [kernel_module_name]
        [kernel_module_name,dev_path=path]
        [kernel_module_name,dev=(major,minor)]
        [kernel_module_name,dev=(major,minor),dev_path=path]

When the fuser(1M) command displays file or device users, the output consists of a process ID on stdout followed by a character on stderr. The character on stderr describes how the file or device is being used. All kernel consumer information is displayed to stderr. No kernel consumer information is displayed to stdout.

If you do not use the –d flag, then the fuser(1M) command reports consumers of only the device minor node that is specified by path. If you use the –d flag, then the fuser(1M) command reports consumers of the device node that underlies the minor node specified by path. The following example illustrates the difference in report output in these two cases.

Example 14-11  Consumers of Underlying Device Nodes

Most network devices clone their minor node when the device is opened. If you request device usage information for the clone minor node, the usage information might show that no process is using the device. If instead you request device usage information for the underlying device node, the usage information might show that a process is using the device. In this example, no device consumers are reported when only a device path is passed to the fuser(1M) command. When the –d flag is used, the output shows that the device is being accessed by udp and udp6.

% fuser /dev/iprb0
/dev/iprb0:
% fuser -d /dev/iprb0
/dev/iprb0:  [udp,dev_path=/pseudo/udp@0] [udp6,dev_path=/pseudo/udp6@0]

Compare the output from this example to the output from Example 14–10.

Example 14-12  Consumer of the Keyboard Device

In this example, a kernel consumer is accessing /dev/kbd. The kernel consumer that is accessing the /dev/kbd device is the workstation console driver.

% fuser -d /dev/kbd
/dev/kbd:  [genunix] [wc,dev_path=/pseudo/wc@0]

Compare the output from this example to the output from Example 14–9.