[ Bottom of Page | Previous Page | Next Page | Contents | Index | Library Home | Legal | Search ]

Commands Reference, Volume 3

mknod Command

Purpose

Creates a special file.

Syntax

Only executed by root or system group member

mknod Name { b | c } Major Minor

Creates FIFOs (named pipelines)

mknod Name { p }

Description

The mknod command makes a directory entry and corresponding i-node for a special file. The first parameter is the name of the Name entry device. Select a name that is descriptive of the device. The mknod command has two forms that have different flags.

The first form of the mknod command can only be executed by root or a member of the system group. In the first form, the b or c flag is used. The b flag indicates the special file is a block-oriented device (disk, diskette, or tape). The c flag indicates the special file is a character-oriented device (other devices).

The last two parameters of the first form are numbers specifying the Major device, which helps the operating system find the device driver code, and the Minor device, that is the unit drive or line number, which may be either decimal or octal. The major and minor numbers for a device are assigned by the device's configure method and are kept in the CuDvDr class in ODM. It is important that major and minor numbers be defined in this object class to insure consistency of device definitions through the system.

In the second form of the mknod command, the p flag is used to create FIFOs (named pipelines).

Flags

b Indicates the special file is a block-oriented device (disk, diskette, or tape).
c Indicates the special file is a character-oriented device (other devices).
p Creates FIFOs (named pipelines).

Examples

To create the special file for a new diskette drive, enter:


mknod /dev/fd2 b 1 2

This creates the /dev/fd2 special file that is a special block file with the major device number 1 and the minor device number 2.

Files

/usr/sbin/mknod Contains the mknod command.

Related Information

The mknod subroutine.

The List of Device Configuration Subroutines in AIX 5L Version 5.2 Kernel Extensions and Device Support Programming Concepts.

[ Top of Page | Previous Page | Next Page | Contents | Index | Library Home | Legal | Search ]