vnop_mknod Entry Point

Purpose

Creates a special file.

Syntax

int vnop_mknod (dvp, name, mode, dev, crp)
struct vnode * dvp;
caddr_t * name;
int  mode;
dev_t  dev;
struct ucred * crp;

Parameters

Item Description
dvp Points to the virtual node (v-node) for the directory to contain the new file. This v-node is held for the duration of the vnop_mknod entry point.
name Specifies the name of a new file.
mode Identifies the integer mode that indicates the type of file and its permissions.
dev Identifies an integer device number.
crp Points to the cred structure. This structure contains data that applications can use to validate access permission.

Description

The vnop_mknod entry point is invoked by the logical file system as the result of a mknod subroutine. The underlying file system is expected to create a new file in the given directory. The file type bits of the mode parameter indicate the type of file (regular, character special, or block special) to be created. If a special file is to be created, the dev parameter indicates the device number of the new special file.

The logical file system verifies that the dvp parameter does not reside in a read-only file system.

Execution Environment

The vnop_mknod entry point can be called from the process environment only.

Return Values

Item Description
0 Indicates success.

Nonzero return values are returned from the /usr/include/sys/errno.h file to indicate failure.