Museum

Home

Lab Overview

Retrotechnology Articles

Online Manuals

⇒ mknod(2) — DG/UX 4.30

Media Vault

Software Library

Restoration Projects

Artifacts Sought

Related Articles

mkdir(1)

chmod(2)

exec(2)

fstat(2)

dg_mstat(2)

lstat(2)

stat(2)

umask(2)

stat(5)



     mknod(2)                   DG/UX 4.30                    mknod(2)



     NAME
          mknod - Make a directory, or a special or ordinary file.

     SYNOPSIS
          #include <sys/types.h>
          #include <sys/stat.h>

          int   mknod  (path, mode, device)
          char *          path;
          int             mode;
          int             device;

     PARAMETERS
          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)
                       S_IFIFO          0010000         FIFO special.
                       S_IFCHR          0020000         Character special.
                       S_IFDIR          0040000         Directory.
                       S_IFBLK          0060000         Block special.
                       S_IFREG          0100000         Ordinary file.



                execution mode bits: (any combination)
                       S_ISUID          0004000         Set user id.
                       S_ISGID          0002000         Set group id.
                       S_ISVTX          0001000         Sticky bit.



     Licensed material--property of copyright holder(s)         Page 1





     mknod(2)                   DG/UX 4.30                    mknod(2)



                protection rights: (any combination)
                       S_IRUSR          0000400         Read by owner.
                       S_IWUSR          0000200         Write by owner.
                       S_IXUSR          0000100         Execute by owner.
                       S_IRGRP          0000040         Read by group.
                       S_IWGRP          0000020         Write by group.
                       S_IXGRP          0000010         Execute by group.
                       S_IROTH          0000004         Read by other.
                       S_IWOTH          0000002         Write by other.
                       S_IXOTH          0000001         Execute by other.



          You cannot make symbolic links 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 logical 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.

          *    The time last modified (st_mtime) and time of last



     Licensed material--property of copyright holder(s)         Page 2





     mknod(2)                   DG/UX 4.30                    mknod(2)



               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 effective user
          id of the process must be superuser to create a directory,
          special file, or ordinary file.

          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.

     EXCEPTIONS
          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



     Licensed material--property of copyright holder(s)         Page 3





     mknod(2)                   DG/UX 4.30                    mknod(2)



                         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
          The related manual sections:  mkdir(1),
          chmod(2), exec(2), fstat(2), dg_mstat(2), lstat(2), stat(2),
          umask(2),
          stat(5).



















     Licensed material--property of copyright holder(s)         Page 4



Typewritten Software • bear@typewritten.org • Edmonds, WA 98026