Museum

Home

Lab Overview

Retrotechnology Articles

⇒ Online Manual

Media Vault

Software Library

Restoration Projects

Artifacts Sought

Related Articles

mkdir(1)

rmdir(1)

rmdir(2)

stat(5)



mkdir(2)                       DG/UX R4.11MU05                      mkdir(2)


NAME
       mkdir - create a directory file

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

       int  mkdir (path, mode)
       const char * path;
       mode_t  mode;

   where:
       path      Address of a pathname

       mode      File mode of the new directory

DESCRIPTION
       Path points to a pathname naming a file.  If the file does not
       already exist, a directory of that name is created.  The indicated
       file must be on a file system device mounted read-write.  Terminal
       symbolic links are followed in path.

       The directory is initialized to contain two entries: '.' and '..',
       referring to itself and its parent directory.  The directory's
       attributes are set as follows:

       ·      The inode number (st_ino) refers to the per-file database
              allocated.

       ·      The device number (st_dev) is set to the device code of the
              containing virtual disk.

       ·      The represented device (st_rdev) is undefined.

       ·      The number of links (st_nlink) is set to two.  (One for the
              directory's own '.' entry, and one for the entry in the
              directory's parent.)

       ·      The file size (st_size) is set to reflect the presence of the
              '.' and '..' entries.

       ·      The file mode (st_mode) is set as follows: The file type is
              directory.  The protection rights are set to the low-order 9
              bits of mode modified by the process's file mode creation
              mask; all bits set in the process's creation mask are cleared
              in the directory's mode (see umask).  The sticky bit is
              cleared; the set-user-id and set-group-id bits are left as set
              in mode, but they have no meaning for a directory.

       ·      The user id (st_uid) is set to the process's effective user
              id.  The group id (st_gid) is set to the process's effective
              group id.

       ·      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 added to the directory's parent and is made to identify the
       newly created directory.  The attributes of the parent directory
       change as follows:

       ·      The number of links (st_nlink) is incremented, reflecting the
              '..' entry in the new directory.

       ·      The time last modified (st_mtime) and time of last attribute
              change (st_ctime) are set to the current time.

       ·      The file size (st_size) is updated.

       If the call fails, the directory is not created, and the attributes
       of the parent remain unchanged.

ACCESS CONTROL
       The calling process must have write permission to the parent
       directory.

       The process must have permission to resolve path.

RETURN VALUE
       0      The new directory 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.

       EIO            An I/O error occurred while writing to the file system
                      device.

       EACCES         Permission to add an entry to the parent directory is
                      denied.

       EROFS          The named file resides on a file system device mounted
                      read-only.

       EMLINK         The maximum number of links to the parent directory
                      would be exceeded by the directory creation.

       ENOSPC         No more contiguous space for file space or inodes.

       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          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), rmdir(1), rmdir(2), stat(5).


Licensed material--property of copyright holder(s)

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