Documentation Archive Developer
Search
ADC Home > Reference Library > Reference > Mac OS X > Mac OS X Man Pages

 

This document is a Mac OS X manual page. Manual pages are a command-line technology for providing documentation. You can view these manual pages locally using the man(1) command. These manual pages come from many different sources, and thus, have a variety of writing styles.

For more information about the manual page format, see the manual page for manpages(5).



MKDIR(2)                    BSD System Calls Manual                   MKDIR(2)

NAME
     mkdir -- make a directory file

SYNOPSIS
     #include <sys/stat.h>

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

DESCRIPTION
     The directory path is created with the access permissions specified by
     mode and restricted by the umask(2) of the calling process.

     The directory's owner ID is set to the process's effective user ID.  The
     directory's group ID is set to that of the parent directory in which it
     is created.

RETURN VALUES
     A 0 return value indicates success.  A -1 return value indicates an
     error, and an error code is stored in errno.

ERRORS
     Mkdir() will fail and no directory will be created if:

     [EACCES]           Search permission is denied for a component of the
                        path prefix.

     [EACCES]           Write permission is denied for the parent directory.

     [EDQUOT]           The new directory cannot be created because the user's
                        quota of disk blocks on the file system that will con-tain contain
                        tain the directory has been exhausted.

     [EDQUOT]           The user's quota of inodes on the file system on which
                        the directory is being created has been exhausted.

     [EEXIST]           The named file exists.

     [EFAULT]           Path points outside the process's allocated address
                        space.

     [EIO]              An I/O error occurred while making the directory entry
                        or allocating the inode.

     [EIO]              An I/O error occurred while reading from or writing to
                        the file system.

     [ELOOP]            Too many symbolic links were encountered in translat-ing translating
                        ing the pathname.  This is taken to be indicative of a
                        looping symbolic link.

     [EMLINK]           The parent directory already has {LINK_MAX} links.

     [ENAMETOOLONG]     A component of a pathname exceeded {NAME_MAX} charac-ters, characters,
                        ters, or an entire path name exceeded {PATH_MAX} char-acters. characters.
                        acters.

     [ENOENT]           A component of the path prefix does not exist or path
                        is an empty string.

     [ENOSPC]           The new directory cannot be created because there is
                        no space left on the file system that would contain
                        it.

     [ENOSPC]           There are no free inodes on the file system on which
                        the directory is being created.

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

     [EROFS]            The parent directory resides on a read-only file sys-tem. system.
                        tem.

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

     The include file <sys/types.h> is necessary.

SEE ALSO
     chmod(2), stat(2), umask(2), compat(5)

STANDARDS
     The mkdir() function conforms to IEEE Std 1003.1-1988 (``POSIX.1'').

4.2 Berkeley Distribution      December 11, 1993     4.2 Berkeley Distribution