Museum

Home

Lab Overview

Retrotechnology Articles

⇒ Online Manual

Media Vault

Software Library

Restoration Projects

Artifacts Sought

Related Articles

chmod(8)

mkdir(1)

mknod(8)

chmod(2)

mknod(2)

rmdir(2)

stat(2)

umask(2)



  mkdir(2)                            CLIX                            mkdir(2)



  NAME

    mkdir - Creates a directory

  LIBRARY

    Standard C Library (libc.a)

  SYNOPSIS

    #include <sys/types.h>

    #include <sys/stat.h>

    int mkdir(
      char *path ,
      mode_t mode );

  PARAMETERS

    path   Points to the name of the new directory.

    mode   Specifies the mask for the read, write, and execute (RWX) flags for
           owner, group, and others.  The mode parameter specifies the
           directory permissions and attributes.  This parameter is
           constructed by a logical OR of the values described in the
           <sys/stat.h> header file.  The file permission bits of the mode
           parameter are modified by the process's file creation mask.  (See
           the umask() function.)

  DESCRIPTION

    The mkdir() function creates a new directory with the following
    characteristics:

    ⊕  Owner ID set to the process effective user ID.

    ⊕  Group ID is set to the process effective group ID.

    ⊕  Permission and attribute bits set according to the value of the mode
       parameter.  The file permission bits of the mode parameter are modified
       by the process file creation mask.  (See the umask() function.)

    ⊕  The newly created directory is empty with the possible exception of
       entries for the current (.) and parent (..) directories.

    To execute the mkdir() function, a process must have search permission to
    get to the parent directory of the path parameter and write permission in
    the parent directory of the path parameter.

  EXAMPLES



  2/94 - Intergraph Corporation                                              1






  mkdir(2)                            CLIX                            mkdir(2)



    To create the directory newdir, with read-only permissions for all users:

    if (mkdir("newdir", S_IRUSR | S_IRGRP | S_IROTH) == -1)
            perror("Mkdir failed");


  RETURN VALUES

    Upon successful completion, mkdir() returns a value of 0.  If mkdir fails,
    a value of -1 is returned, and the global variable errno is set to
    indicate the error.

  ERRORS

    The mkdir() function fails and the directory is not created if one or more
    of the following are true:

    [EACCES]
           Search permission is denied on a component of the path prefix, or
           write permission is denied on the parent directory of the directory
           to be created.

    [EEXIST]
           The named file already exists.

    [EROFS]
           The named file resides on a read-only file system.

    [ENOSPC]
           The file system does not contain enough space to hold the contents
           of the new directory or to extend the parent directory of the new
           directory.

    [ENAMETOOLONG]
           The length of the path parameter exceeds PATH_MAX, or a pathname
           component is longer that NAME_MAX while _POSIX_NO_TRUNC is in
           effect.

    [EMLINK]
           The maximum number of links to the parent directory would be
           exceeded.

    [ENOENT]
           A component of the path prefix does not exist.

    [ENOENT]
           The path is longer than the maximum allowed.

    [ENOTDIR]
           A component of the path prefix is not a directory.




  2                                              Intergraph Corporation - 2/94






  mkdir(2)                            CLIX                            mkdir(2)



    [ENOLINK]
           The path parameter points to a remote machine and the link to that
           machine is no longer active.

    [EMULTIHOP]
           Components of path require hopping to multiple remote machines.

    [EFAULT]
           The path parameter points outside the allocated address space of
           the process.

    [EIO]  An I/O error has occurred while accessing the file system.

  RELATED INFORMATION

    Commands:  chmod(8), mkdir(1), mknod(8)

    Functions:  chmod(2), mknod(2), rmdir(2), stat(2), umask(2)




































  2/94 - Intergraph Corporation                                              3




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