#include <sys/types.h> #include <sys/stat.h>
int mknod(path, mode, dev) char *path; int mode, dev;
int mkfifo(path, mode) char *path; mode_t mode;
mknod() creates a new file named by the path name pointed to by path. The mode of the new file (including file type bits) is initialized from mode. The values of the file type bits which are permitted are:
#define S_IFCHR 0020000 /* character special */ #define S_IFBLK 0060000 /* block special */ #define S_IFREG 0100000 /* regular */ #define S_IFIFO 0010000 /* FIFO special */
Values of mode other than those above are undefined and should not be used.
The access permissions of the mode are modified by the process's mode mask (see umask.2v
The owner ID of the file is set to the effective user ID of the process. The group ID of the file is set to either:
If mode indicates a block or character special file, dev is a configuration dependent specification of a character or block I/O device. If mode does not indicate a block special or character special device, dev is ignored.
mknod() may be invoked only by the super-user for file types other than FIFO special.
mkfifo() creates a new FIFO special file named by the pathname pointed to by path. The access permissions of the new FIFO are initialized from mode. The access permissions of mode are modified by the process's file creation mask, see umask.2v Bits in mode other than the access permissions are ignored.
The FIFO's owner ID is set to the process's effective user ID. The FIFO's group ID is set to the group ID of the directory in which the FIFO is being created or to the process's effective group ID.
Upon successful completion, the mkfifo() function marks for update the st_atime, st_ctime, and st_mtime fields of the file. Also, the st_ctime and st_mtime fields of the directory that contains the new entry are marked for update.
mknod() returns:
mkfifo() returns:
mknod() fails and the file mode remains unchanged if:
A pathname component is longer than {NAME_MAX} (see sysconf.2v while {_POSIX_NO_TRUNC} is in effect (see pathconf.2v
mkfifo() may set errno to:
A pathname component is longer than {NAME_MAX} while {_POSIX_NO_TRUNC} is in effect (see pathconf.2v
path points to an empty string.
The file system is out of file allocation resources.
Created by unroff & hp-tools. © somebody (See intro for details). All Rights Reserved. Last modified 11/5/97