HP 3000 Manuals

mknod [ MPE/iX Developer's Kit Reference Manual Volume I ] MPE/iX 5.0 Documentation


MPE/iX Developer's Kit Reference Manual Volume I

mknod 

Make a FIFO special file. 

Makes a directory, or a special or regular file.

Syntax 

     #include <sys/stat.h>
     int mknod(const char *path, mode_t mode, dev_t dev);

Parameters 

path       The pathname of a file.

mode       Specifies the file type and file access permission.

dev        Specifies the major and minor device numbers.

Return Values 

0          Successful completion

-1         Error and errno is set to indicate the error.

Description 

mknod() creates a new file named by the path name pointed to by path.
The mode of the new file is specified by the mode argument.

Symbolic constants defining the file type and file access permission bits
are found in the <sys/stat.h> header file and are used to construct the
mode argument.  The value of the mode argument should be the bit-wise
inclusive OR of the values of the desired file type, miscellaneous mode
bits, and access permissions.  See stat(5) for a description of the
components of the file mode.

The owner ID of the file is set to the effective-user-ID of the process.
If the set-group-ID bit of the parent directory is set, the new file's
group ID is set to the group ID of the parent directory.  Otherwise, the
new file's group ID is set to the effective-group-ID of the process.

The file access permission bits of mode are modified by the process's
file mode creation mask:  for each bit set in the process's file mode
creation mask, the corresponding bit in the file's mode is cleared (see
umask(2)).

The new file is created with three base access-control-list (ACL)
entries, corresponding to the file access permission bits.

The dev argument is meaningful only if mode indicates a block
or character special file, and is ignored otherwise.  It is an
implementation- and configuration-dependent specification of a character
or block I/O device.  The value of dev is created by using the makedev()
macro defined in <sys/mknod.h>.  The makedev() macro takes as arguments
the major and minor device numbers, and returns a device identification
number which is of type dev_t.  The value and interpretation of the major
and minor device numbers are implementation-dependent.  For more
information, see mknod(5) and the System Administration manuals for your
system.

Only users with appropriate privileges can invoke mknod for file types
other than FIFO files.

Implementation Considerations 

Proper discretion should be used when using mkrnod to create generic
device files in an HP Clustered Environment.  A generic device file
accessed from different cnodes in a cluster applies to different physical
devices.  Thus the file's ownership and permissions might not be
appropriate in the context of every individual cnode in the cluster.

Errors 

If an error occurs, errno is set to one of the following values:

EACCES            CAUSE           One of the following:
                                     *   The directory in which path would be created
                                         denies write permission, mode is for a FIFO
                                         file and the caller does not have appropriate
                                         privileges.
                                     *   A component of the path prefix denies search
                                         permission.
                  ACTION          One of the following:
                                     *   Make sure that the calling process has search
                                         permission to all components of t he pathname.

                                     *   Make sure that the calling process has execute
                                         permission to the file.

EEXIST            CAUSE           The named path already exists.

                  ACTION          Make sure that path specifies a directory that does
                                  not already exist.

EFAULT            CAUSE           The path argument points outside the process's
                                  allocated address space.  The reliable detection of
                                  this error is implementation dependent.
                  ACTION          Make sure that the pointer is correctly initialized.

ELOOP             CAUSE           Too many symbolic links were encountered in
                                  translating the path name.
                  ACTION          Make sure that there is not a loop in the symbolic
                                  links that loops more than POSIX_SYMLOOP.

ENAMETOOLONG      CAUSE           The length of the specified path name exceeds
                                  PATH_MAX bytes, or the length of a component of the
                                  path name exceeds NAME_MAX bytes while
                                  _POSIX_NO_TRUNC is in effect.
                  ACTION          Make sure that both the component's length and the
                                  full pathname length do not exceed the {NAME_MAX} or
                                  {PATH_MAX} limits.

ENOENT            CAUSE           Either of the following:

                                     *   The path argument is null.
                                     *   A component of the path prefix does not exist.

                  ACTION          Specify a valid pathname.

          Table 4-0.  (cont.) 

ENOSPC            CAUSE           Not enough space on the file system.
                  ACTION          Extend accounting limits for the directory in which
                                  the file is located, or fr ee up disk space.

ENOTDIR           CAUSE           A component of the path prefix is not a directory.
                  ACTION          Specify a valid pathname.

EPERM             CAUSE           The effective-user-ID of the process does not match
                                  that of the super-user, and the file type is not FIFO
                                  special.
                  ACTION          Refer to the kill() function description for signal
                                  permission rules.

EROFS             CAUSE           The directory in which the file is to be created is
                                  located on a read-only file system.
                  ACTION          Create the slink on a writable volume (file system).

See Also 

mknod(1M), chmod(2), exec(2), mkdir(2), setacl(2), umask(2), cdf(4),
fs(4), acl(5), mknod(5), stat(5), types(5).



MPE/iX 5.0 Documentation