Seth Woolley's Man Viewer

Manual for mkdir - man 2 mkdir

([section] manual, -k keyword, -K [section] search, -f whatis)
man plain no title

MKDIR(2)                   Linux Programmer's Manual                  MKDIR(2)

       mkdir(1,2) - create a directory

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

       int mkdir(1,2)(const char *pathname, mode_t mode);

       mkdir(1,2) attempts to create a directory named(5,8) pathname.

       The  parameter mode specifies the permissions to use. It is modified by
       the process's umask in(1,8) the usual way: the permissions  of  the  created
       directory  are  (mode & ~umask & 0777).  Other mode bits of the created
       directory depend on the operating system.  For Linux, see below.

       The newly created directory will be owned by the effective user  ID  of
       the process.  If the directory containing the file(1,n) has the set(7,n,1 builtins) group ID
       bit set(7,n,1 builtins), or if(3,n) the filesystem is mounted with BSD group semantics,  the
       new  directory will inherit the group ownership from its parent; other-
       wise it will be owned by the effective group ID of the process.

       If the parent directory has the set(7,n,1 builtins) group ID bit set(7,n,1 builtins) then so  will  the
       newly created directory.

       mkdir(1,2)  returns  zero  on  success, or -1 if(3,n) an error(8,n) occurred (in(1,8) which
       case, errno is set(7,n,1 builtins) appropriately).

       EACCES The parent directory does not  allow  write(1,2)  permission  to  the
              process,  or  one  of  the directories in(1,8) pathname did not allow
              search permission.  (See also path_resolution(2).)

       EEXIST pathname already exists (not necessarily as a directory).   This
              includes the case where pathname is a symbolic link(1,2), dangling or

       EFAULT pathname points outside your accessible address space.

       ELOOP  Too many symbolic links were encountered in(1,8) resolving  pathname.

              pathname was too long.

       ENOENT A  directory  component  in(1,8) pathname does not exist or is a dan-
              gling symbolic link.

       ENOMEM Insufficient kernel memory was available.

       ENOSPC The device containing pathname has no room for  the  new  direc-

       ENOSPC The  new  directory  cannot  be  created because the user's disk
              quota(1,8) is exhausted.

              A component used as a directory in(1,8) pathname is not, in(1,8)  fact,  a

       EPERM  The filesystem containing pathname does not support the creation
              of directories.

       EROFS  pathname refers to a file(1,n) on a read-only filesystem.

       SVr4, POSIX, BSD, SYSV, X/OPEN.  SVr4 documents additional EIO, EMULTI-
       HOP and ENOLINK error(8,n) conditions; POSIX.1 omits ELOOP.

       Under  Linux  apart from the permission bits, only the S_ISVTX mode bit
       is honored. That is, under Linux the created  directory  actually  gets(3,n)
       mode (mode & ~umask & 01777).  See also stat(1,2)(2).

       There  are  many  infelicities in(1,8) the protocol underlying NFS.  Some of
       these affect mkdir(1,2).

       mkdir(1,2)(1), chmod(1,2)(2), mknod(1,2)(2), mount(2,8)(2),  path_resolution(2),  rmdir(1,2)(2),
       stat(1,2)(2), umask(2), unlink(1,2)(2)

Linux 2.4                         2003-12-09                          MKDIR(2)

References for this manual (incoming links)