mknod(2) DG/UX R4.11MU05 mknod(2)
NAME
mknod - create a file entry in the file system
SYNOPSIS
#include <sys/types.h>
#include <sys/stat.h>
int mknod (path, mode, device)
char * path;
int mode;
int device;
where:
path Address of a pathname
mode Access mode of the new file
device Device specifier
DESCRIPTION
Path points to a pathname naming a file. Terminal symbolic links are
not followed if found in path. The file must not exist. The
indicated file must be on a file system device mounted read-write.
Device is only pertinent if the file being created is a block or
character special file, in which case it is a configuration-dependent
specification of a block or character I/O device.
The file's mode (st_mode) is initialized from mode. The values of
mode are constructed by or-ing flags from the following list:
file type: (only one may be specified)
SIFIFO 0010000 FIFO special.
SIFCHR 0020000 Character special.
SIFDIR 0040000 Directory.
SIFBLK 0060000 Block special.
SIFREG 0100000 Ordinary file.
execution mode bits: (any combination)
SISUID 0004000 Set user id.
SISGID 0002000 Set group id.
SISVTX 0001000 Sticky bit.
protection rights: (any combination)
SIRUSR 0000400 Read by owner.
SIWUSR 0000200 Write by owner.
SIXUSR 0000100 Execute by owner.
SIRGRP 0000040 Read by group.
SIWGRP 0000020 Write by group.
SIXGRP 0000010 Execute by group.
SIROTH 0000004 Read by other.
SIWOTH 0000002 Write by other.
SIXOTH 0000001 Execute by other.
You cannot make symbolic links , control point directories or socket
files via the mknod interface.
If a file type is not specified, it defaults to ordinary. Values of
mode other than those formed as described above are illegal. mode is
modified by the process's file mode creation mask: all bits set in
the process's file mode creation mask are cleared (see umask).
The file's other attributes are initialized as follows:
· The inode number (st_ino) is set to refer to the per-file
database allocated.
· The device number (st_dev) is set to the device code
containing the virtual disk. If the file is block or
character special, the represented device (st_rdev) is set to
device. For other file types, the represented device is
undefined.
· The number of links (st_nlink) is set to one.
· The file size (st_size) is set to zero.
· The user id (st_uid) is set to the effective user id of the
calling process. The group id (st_gid) is set to the
effective group id of the calling process.
· The time last accessed (st_atime), time last modified
(st_mtime), and time of last attribute change (st_ctime) are
set to the current time.
Path is created in the containing directory and is made to identify
the newly created file. The attributes of the directory the file is
contained in change as follows:
· The file size (st_size) is updated if the number of blocks
necessary to contain all the directory entries increases.
· The time last modified (st_mtime) and time of last attribute
change (st_ctime) are set to the current time.
If the call fails, the file is not created, and the attributes of the
directory the file is contained in are unchanged.
ACCESS CONTROL
Any process may create a FIFO file, but the calling process must have
appropriate privilege to create a directory, special file, or
ordinary file. For systems supporting the DG/UX Capability Option,
appropriate privilege is defined as having one or more specific
capabilities enabled in the effective capability set of the calling
process. See capdefaults(5) for the default capability for this
system call.
On systems without the DG/UX Capability Option, appropriate privilege
means that the process has an effective UID of root. See the
appropriateprivilege(5) man page for more information.
The process must have write access to the containing directory.
The process must have permission to resolve path.
RETURN VALUE
0 The new file was successfully created.
-1 An error occurred. errno is set to indicate the error.
DIAGNOSTICS
Errno may be set to one of the following error codes:
EEXIST The named file exists.
EINVAL An invalid file type was specified in mode.
EROFS The directory in which the file is to be created is
located on a file system device mounted read-only.
ENOSPC No more contiguous space left to allocate file space
or an inode.
ENOENT A non-terminal component of the pathname does not
exist.
ENOTDIR A non-terminal component of the pathname was not a
directory or symbolic link.
ENAMETOOLONG The pathname exceeds the length limit for pathnames.
ENAMETOOLONG A component of the pathname exceeds the length limit
for filenames.
ENOMEM There are not enough system resources to resolve the
pathname or to expand a symbolic link.
ELOOP The number of symbolic links encountered during
pathname resolution exceeded MAXSYMLINKS. A symbolic
link cycle is suspected.
EPERM Permission to create a directory, special file, or
ordinary file is denied.
EPERM The pathname contains a character not in the allowed
character set.
EFAULT The pathname does not completely reside in the
process's address space or the pathname does not
terminate in the process's address space.
SEE ALSO
mkdir(1), chmod(2), dgmstat(2), exec(2), fstat(2), lstat(2),
stat(2), umask(2) appropriateprivilege(5), stat(5).
capdefaults(5).
Licensed material--property of copyright holder(s)