RTEMS Logo

RTEMS 4.10.2 On-Line Library


File and Directory Commands mknod - make device special file

PREV UP NEXT Bookshelf RTEMS Shell User's Guide

3.2.10: mknod - make device special file

SYNOPSYS:

mknod [-rR] [-F fmt] [-g gid] [-m mode] [-u uid] name [c | b]
      [driver | major] minor
mknod [-rR] [-F fmt] [-g gid] [-m mode] [-u uid] name [c | b]
      major unit subunit
mknod [-rR] [-g gid] [-m mode] [-u uid] name [c | b] number
mknod [-rR] [-g gid] [-m mode] [-u uid] name p

DESCRIPTION:

The mknod command creates device special files, or fifos. Normally the shell script /dev/MAKEDEV is used to create special files for commonly known devices; it executes mknod with the appropriate arguments and can make all the files required for the device.

To make nodes manually, the arguments are:

-r
Replace an existing file if its type is incorrect.
-R
Replace an existing file if its type is incorrect. Correct the mode, user and group.
-g gid
Specify the group for the device node. The gid operand may be a numeric group ID or a group name. If a group name is also a numeric group ID, the operand is used as a group name. Precede a numeric group ID with a # to stop it being treated as a name.
-m mode
Specify the mode for the device node. The mode may be absolute or symbolic, see chmod.
-u uid
Specify the user for the device node. The uid operand may be a numeric user ID or a user name. If a user name is also a numeric user ID, the operand is used as a user name. Precede a numeric user ID with a # to stop it being treated as a name.
name
Device name, for example ``tty'' for a termios serial device or ``hd'' for a disk.
b | c | p
Type of device. If the device is a block type device such as a tape or disk drive which needs both cooked and raw special files, the type is b. All other devices are character type devices, such as terminal and pseudo devices, and are type c. Specifying p creates fifo files.
driver | major
The major device number is an integer number which tells the kernel which device driver entry point to use. If the device driver is configured into the current kernel it may be specified by driver name or major number.
minor
The minor device number tells the kernel which one of several similar devices the node corresponds to; for example, it may be a specific serial port or pty.
unit and subunit
The unit and subunit numbers select a subset of a device; for example, the unit may specify a particular disk, and the subunit a partition on that disk. (Currently this form of specification is only supported by the bsdos format, for compatibility with the BSD/OS mknod).
number
A single opaque device number. Useful for netbooted computers which require device numbers packed in a format that isn't supported by -F.

EXIT STATUS:

The mknod utility exits 0 on success, and >0 if an error occurs.

NOTES:

NONE

EXAMPLES:

SHLL [/] mknod c 3 0 /dev/ttyS10

CONFIGURATION:

This command is included in the default shell command set. When building a custom command set, define CONFIGURE_SHELL_COMMAND_MKNOD to have this command included.

This command can be excluded from the shell command set by defining CONFIGURE_SHELL_NO_COMMAND_MKNOD when all shell commands have been configured.

PROGRAMMING INFORMATION:

The mknod command is implemented by a C language function which has the following prototype:

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

The configuration structure for the mknod has the following prototype:

extern rtems_shell_cmd_t rtems_shell_MKNOD_Command;

ORIGIN:

The implementation and portions of the documentation for this command are from NetBSD 4.0.


PREV UP NEXT Bookshelf RTEMS Shell User's Guide

Copyright © 1988-2008 OAR Corporation