MKNOD — Create a character special file

Format

MKNOD 'pathname'
      MAJOR(device_major_number)
      MINOR(device_minor_number)
      MODE(file_permission_bits)

Description

MKNOD creates a character special file in a file system.

Restriction: MKNOD can be used only by a superuser.

Parameters

pathname
Specifies the name of the character special file to be created. The name can be a relative path name or an absolute path name. It must be enclosed in single quotes. A relative path name is relative to the working directory of the TSO/E session (usually the HOME directory). Therefore, you should usually specify an absolute path name. The name can be up to 1023 characters long. The name is case-sensitive; the system stores each character in the case entered. This operand is required.

All directories in the path name must exist. If the specified file already exists, no new file is created.

MAJOR(device_major_number)
Specifies the device major number, which can be a decimal number between 0 and 65␠535 (64K minus 1). See z/OS UNIX System Services Planning for information about specifying the device major number. This operand is required.
MINOR(device_minor_number)
Specifies the device minor number, which can be a decimal number between 0 and 65␠535 (64K minus 1). See z/OS UNIX System Services Planning for information about specifying the device minor number. This operand is required.
MODE(file_permission_bits)
Specifies the file permission bits as three octal numbers, from 0 to 7, separated by commas or blanks. The octal values represent read (r), write (w), and execute (x) access for: user, group, and other.

User permission is the permission given to the file owner. Group permission is the permission given to the group the owner is a member of. Other permission is the permission given to any other user.

The access indicated by each of the numbers from 0 to 7 is:
0
No access
1
Search (x) access
2
Write-only (w) access
3
Write and execute (wx) access
4
Read-only (r) access
5
Read and execute (rx) access
6
Read and write (rw) access
7
Read, write, and execute (rwx) access
When the MKNOD command is issued in the TSO interactive environment, the file is created with default permissions of 666, regardless of the user's umask setting, representing:
6
User: read and write access
6
Group: read and write access
6
Other: read and write access

Examples

  1. You want to create a character special file using an absolute path name, giving read, write, and execute access to the file owner and no access to others. The file name is tty1 in the existing directory /dev. The device major number is 2; the minor number is 1. You enter:
    MKNOD '/dev/tty1' MAJOR(2) MINOR(1) MODE(7,0,0)
  2. You want to create a character special file named ptty2 in the existing directory /dev. The device major number is 1; the device minor number is 457. You want the default permissions. You enter:
    MKNOD '/dev/ptty2' MAJOR(1) MINOR(457)
  3. You want to create a new tty pair using an absolute path name. The file name is ttyp0042 in the existing directory /dev. The device minor number is 42. You want the default permissions. You enter:
    MKNOD '/dev/ptyp0042' MAJOR(1) MINOR(42)
    MKNOD '/dev/ttyp0042' MAJOR(2) MINOR(42)