Manpage of DEVFSD


Section: Maintenance Commands (8)
Updated: 8 Mar 2002
Return to Main Contents



devfsd - optional daemon for managing devfs (the Linux Device Filesystem)



devfsd mntpnt [ -v ] [ -d ] [ -t num ] [ -D mask ] [ -fg ] [ -np ]



The devfsd programme is a daemon, run by the system boot scripts, which can provide for intelligent management of device entries in the Device Filesystem (devfs). It is desirable to start the daemon at the beginning of the boot scripts, in particular before filesystem checks.

As part of its setup phase devfsd creates certain symbolic links which are compiled into the code. These links are required by /usr/src/linux/Documentation/devices.txt. This behaviour may change in future revisions.

devfsd will read the special control file .devfsd in a mounted devfs, listening for the creation and removal of device entries (this is termed a change operation). For each change operation, devfsd can take many actions. The daemon will normally run itself in the background and send messages to syslog.

The opening of the syslog service is automatically delayed until /dev/log is created.

At startup, before switching to daemon mode, devfsd will scan the mounted device tree and will generate synthetic REGISTER events for each leaf node and directory.



This specifies a mount point for where devfs is mounted. This is typically "/dev". The daemon will change directory to this mount point before opening any files.
This option will print the protocol version numbers for devfsd and the kernel-side protocol version provided by devfs itself. The programme then exits.
Run devfsd in debug mode. Used for debugging the kernel-side protocol implemented by devfs. This also prints the protocol version numbers. In this mode the daemon runs in the foreground.
-t num
Set the trace level to num. If the level is greater than 0 then output is sent to stderr rather than syslog(3). If the level is greater than 1 then devfsd will run in trace mode. Higher levels yield more trace information.
-D mask
Set the debug mask for devfs.
Run the daemon in the foreground.
Exit after parsing the configuration file and processing synthetic REGISTER events. Do not poll for events. This is primarily used for creating compatibility entries without needing a daemon running in the background.



The configuration file /etc/devfs/devfsd.conf configures the devfsd programme. It is a simple ASCII file with one configuration option per line. Comment lines must start with a leading '#' character. Comment lines and blank lines are ignored. Each configuration option is a keyword followed by zero or more parameters, depending on the option. The following section details the configuration options. Below are the permitted keywords:
INCLUDE location
Include the configuration file named by location. Variable expansion is applied to location (see the section on VARIABLE EXPANSION below). If this is a directory, then all files (except those which start with '.') are read. This is recursive (i.e. files which are in fact subdirectories are also read).

If the first character of location is "+", then the rest of location is the name of an NIS map to load. This operation is silently ignored if the NIS domain has not yet been set (SIGHUP should then be sent after the NIS domain has been set).

As above, except that if the file does not exist, it is silently ignored.
Clear the current configuration.
RESTORE directory
This will restore entries previously saved under directory to devfs. Only symbolic links or entries with the sticky bit set will be restored. This action is taken as the configuration file is read. With appropriate COPY actions, complete persistence is acheived.

The config file can also be used to specify actions that should be taken at specified events. Each line specifies an event and action. Multiple actions (of the same or different types) per event may be specified (one action per line). Events are processed in order, with the first event config line being processed first. The syntax is:

EVENT devname ACTION [args...]
where EVENT is the event and ACTION is the action to take when the event occurs. The action is only taken when devname matches the name of the device entry affected (this does not include the mount point for the filesystem). This is processed as a regular expression. Some actions support extra arguments, passed as args.

Variable expansion is applied to the arguments (see the section on VARIABLE EXPANSION below). After variable expansion, regular expression substitution is performed (see the section on REGULAR EXPRESSION SUBSTITUTION). Note that the following special variable names are also recognised:

the full path name of the new device
the name of the new device inside the devfs namespace
the mode of the device entry in octal
the user ID of the process or inode
the group ID of the process or inode

The following events are recognised:

The device entry or directory was registered by a device driver.
The device entry was unregistered by a device driver.
The inode was opened (the opening process does not wait for a response).
The file was closed.
An inode lookup was performed and there was no device entry. This event is not sent if the initiating process is devfsd or one of its children.
Some inode attributes were changed.
An inode was created by a process.
An inode was deleted by a process.

The following actions are recognised:

PERMISSIONS owner_and_group access_mode
owner_and_group specifies the owner and group that the file should be set to. This must be of the form "" and either "user" or "group" component may be symbolic or numeric. To specify that the user or group be left alone, use a numeric value of "-1" for the respective component. access_mode specifies the access mode the file should be set to. This must be either an octal value or a symbolic string of nine characters with the form "rwxrwxrwx". Where access is not given, a '-' character should be used in place (e.g. "rw-rw-r--" gives read and write access to the user and group and only read access to everybody else).
This action will pass "/dev/$devname" (i.e. "/dev/" prefixed to the device name) to the module loading facility. In addition, the /etc/modutils/devfs configuration file is used.
EXECUTE path [arg...]
This action allows you to run a programme. path is the pathname of the programme to run and arg is a set of optional arguments passed to the programme (maximum 6). path is the first argument (i.e. argv[0]) passed to the programme.
MFUNCTION path function [arg...]
This action allows you to run a "main"-style function within a shared object. path is the pathname of the shared object, with the special path of "GLOBAL" signifying all global symbols (e.g. from libc). The default directory is /lib/devfsd. function is the name of the function symbol to run and arg is a set of optional arguments passed to the function (maximum 5). path is the first argument (i.e. argv[0]) passed to the function. The prototype for this function is similar to the main function of C programmes. The prototype is:

int func (int argc, char **argv);

CFUNCTION path function [arg...]
This action is similar to the MFUNCTION action, except for the calling convention. The prototype for this function is:

int func (void *arg1, void *arg2, void *arg3, void *arg4, void *arg5);

Up to 5 arguments may be passed, each being of type void *. The following special arguments are recognised:

a struct devfsd_notify_struct * is passed

COPY source destination
This action will copy the device type and permissions of source to destination. The sticky bit is set on the destination inode if the source inode was create manually (i.e. not by a driver or devfsd).
This action causes all subsequent processing for the event to be ignored.
This action creates an "old" compatibility entry for the device.
This action creates a "new" compatibility entry for the device.
This action removes an "old" compatibility entry for the device.
This action removes a "new" compatibility entry for the device.



A subset of normal Bourne shell variable expansion is applied to various expressions. The currently supported subset is: $variable, ${variable} and ${variable:-word}. Variables are taken from the environment. The following variable names are also defined :
The hostname of the machine
The mount point for devfs



Sections of the matched regular expression can be included in an action. Use \0 to refer to the entire regular expression matched, \1 to refer to the first parenthesized subexpression, \2 to refer to the second, and so on. (Use \\ to include an actual backslash.)

See devfsd.conf(5) for examples of regular expression substitution.



devfsd responds to signals in a variety of ways:
devfsd will exit cleanly.
devfsd will exit cleanly.
The configuration file is re-read and any shared objects are reloaded. Then the mounted device tree is scanned and synthetic REGISTER events are generated for each leaf node.
The configuration file is re-read and any shared objects are reloaded. No synthetic REGISTER events are generated.



Create and destroy old compatibility entries:

Create and destroy new compatibility entries:


Load modules:

LOOKUP       .*           MODLOAD

Make and remove a symbolic link:

REGISTER     mydir/mydev  CFUNCTION GLOBAL mksymlink $devname mydev
UNREGISTER   mydir/mydev  CFUNCTION GLOBAL unlink  mydev

Give sndusers group access to sound drivers

REGISTER     sound/.*     PERMISSIONS root.sndusers rw-rw----



the configuration file. If this file is missing or has zero size, devfsd will exit after its setup phase.
the generic module configuration file (required for the MODLOAD action), which is installed with devfsd. This in turn includes /etc/modules.conf



Make sure you understand the implications of regular expression matching. For example, if you had a configuration line such as:

LOOKUP cdrom CFUNCTION GLOBAL mksymlink ${mntpnt}/cdroms/cdrom0 $devpath

then referencing "/dev/cdrom1" will create the symbolic link "/dev/cdrom1". Further, referencing "/dev/cdroms/1" would also create the "/dev/cdroms/1" symbolic link. This is probably not what you want. If there was not already a "/dev/cdroms" directory, then you would get a "/dev/cdrom" symbolic link. Definately not what you want! The correct configuration line would be:

LOOKUP ^cdrom$ CFUNCTION GLOBAL mksymlink ${mntpnt}/cdroms/cdrom0 $devpath



init(8), devfsd.conf(5), modprobe(8)



Richard Gooch (



The Device Filesystem daemon is available from:



It is strongly recommended to read the devfs FAQ, which contains configuration tips. It is available at:



A mailing list exists for devfs kernel patch and devfsd release announcements. This list also has a small amount of discussion traffic (a few messages per week). You may subscribe by sending a message to with subscribe devfs in the message body.




This document was created by man2html, using the manual pages.
Time: 01:13:27 GMT, March 05, 2024