The mknod callable service creates a new directory, a regular file, a character special file, or a FIFO special file (named pipe).
Operation | Environment |
---|---|
Authorization: | Supervisor state or problem state, any PSW key |
Dispatchable unit mode: | Task |
Cross memory mode: | PASN = HASN |
AMODE (BPX1MKN): | 31-bit |
AMODE (BPX4MKN): | 64-bit |
ASC mode: | Primary mode |
Interrupt status: | Enabled for interrupts |
Locks: | Unlocked |
Control parameters: | All parameters must be addressable by the caller and in the primary address space. |
|
AMODE 64 callers use BPX4MKN with the same parameters.
The name of a fullword that contains the length of the Pathname of the special file to be created.
The name of a field that contains the pathname of the file. The length of this field is specified in Pathname_length.
The name of a fullword in which the mode field is specified. The mode field specifies the file type and the permissions you grant to yourself, to your group, and to any user. Specify the file type with the BPXYFTYP mapping macro, and specify permissions with the BPXYMODE mapping macro. See BPXYFTYP — File type definitions and BPXYMODE — Map the mode constants of the file services.
The name of a fullword that contains a device identifier, or 0. The high-order 16 bits of Device_identifier is the device major number. The device major number corresponds to a device driver that supports a class of devices—for example, interactive terminals. The low-order 16 bits of Device_identifier is the device minor number. The device minor number corresponds to a specific device within the class of devices that are referred to by the device major number. Specify Device_identifier if you are creating a character special file.
If a FIFO, directory, or regular file is being created, Device_identifier is ignored.
Device major numbers | Device class |
---|---|
1 | Master pseudoterminal |
2 | Slave pseudoterminal |
3 | /dev/tty |
4 | /dev/null, /dev/zero, and /dev/random |
5 | /dev/fdn |
6 | Sockets |
7 | OCSRTY |
8 | OCSADMIN |
9 | /dev/console |
For device major numbers 1, 2, and 7, the device minor numbers refer to specific pseudoterminal pairs and the values range from 0 and one less than the maximum number of pseudoterminal pairs defined by the installation.
For device major numbers 3, 6, 8, and 9, the device minor number is ignored.
Device minor numbers for device major number 4 | File |
---|---|
0 | /dev/null |
1 | /dev/zero |
2 | /dev/random and /dev/urandom |
For device major number 5, the device minor number value represents the file descriptor to be referred to. For example, device minor 0 refers to file descriptor 0.
The name of a fullword in which the mknod service returns 0 if the request is successful, or -1 if it is not successful.
Return_code | Explanation |
---|---|
EACCES | The process does not have permission to search some component of Pathname; or does not have write permission for the directory of the file to be created. |
EEXIST | A file or directory named Pathname already exists. The following reason code can accompany the return code: JRSpFileExists. |
EFBIG | A request to create a new file is prohibited because the file size limit for the process is set to 0. |
EINVAL | The file type specified in the Mode parameter is not 1, 2, 3 or 4. The following reason code can accompany the return code: JRMknodInvalidType. |
ELOOP | A loop exists in symbolic links that were encountered during resolution of the Pathname argument. This error is issued if more than 24 symbolic links are detected in the resolution of Pathname. |
ENAMETOOLONG | Pathname is longer than 1023 characters; or a component Pathname has a name longer than 255 characters. |
ENOENT | A component of Pathname was not found; or no pathname was specified. The following reason code can accompany the return code: JREndingSlashMknod. |
ENOTDIR | A component of Pathname is not a directory. |
EPERM | The operation is not permitted. The operation requested requires a superuser authority. The following reason code can accompany the return code: JrUserNotPrivileged. |
EROFS | The directory of the file is on a read-only file system. The following reason code can accompany the return code: JRReadOnlyFilesetMknodReq. |
The name of a fullword in which the mknod service stores the reason code. The mknod service returns Reason_code only if Return_value is -1. Reason_code further qualifies the Return_code value. For the reason codes, see z/OS UNIX System Services Messages and Codes.
When the mknod service is requested to create a character special file, a directory or a regular file, it is a privileged operation and requires superuser authority.
For an example using this callable service, see BPX1MKN (mknod) example.