1.\" Copyright (c) 1983, 1991, 1993 2.\" The Regents of the University of California. All rights reserved. 3.\" 4.\" %sccs.include.redist.man% 5.\" 6.\" @(#)mkdir.2 8.2 (Berkeley) 12/11/93 7.\" 8.Dd 9.Dt MKDIR 2 10.Os BSD 4.2 11.Sh NAME 12.Nm mkdir 13.Nd make a directory file 14.Sh SYNOPSIS 15.Fd #include <sys/stat.h> 16.Ft int 17.Fn mkdir "const char *path" "mode_t mode" 18.Sh DESCRIPTION 19The directory 20.Fa path 21is created with the access permissions specified by 22.Fa mode 23and restricted by the the 24.Xr umask 2 25of the calling process. 26.Pp 27The directory's owner ID is set to the process's effective user ID. 28The directory's group ID is set to that of the parent directory in 29which it is created. 30.Sh RETURN VALUES 31A 0 return value indicates success. A -1 return value 32indicates an error, and an error code is stored in 33.Va errno . 34.Sh ERRORS 35.Fn Mkdir 36will fail and no directory will be created if: 37.Bl -tag -width ENAMETOOLO 38.It Bq Er ENOTDIR 39A component of the path prefix is not a directory. 40.It Bq Er EINVAL 41The pathname contains a character with the high-order bit set. 42.It Bq Er ENAMETOOLONG 43A component of a pathname exceeded 255 characters, 44or an entire path name exceeded 1023 characters. 45.It Bq Er ENOENT 46A component of the path prefix does not exist. 47.It Bq Er EACCES 48Search permission is denied for a component of the path prefix. 49.It Bq Er ELOOP 50Too many symbolic links were encountered in translating the pathname. 51.It Bq Er EPERM 52The 53.Fa path 54argument contains a byte with the high-order bit set. 55.It Bq Er EROFS 56The named file resides on a read-only file system. 57.It Bq Er EEXIST 58The named file exists. 59.It Bq Er ENOSPC 60The new directory cannot be created because there is no space left 61on the file system that will contain the directory. 62.It Bq Er ENOSPC 63There are no free inodes on the file system on which the 64directory is being created. 65.It Bq Er EDQUOT 66The new directory cannot be created because the user's 67quota of disk blocks on the file system that will 68contain the directory has been exhausted. 69.It Bq Er EDQUOT 70The user's quota of inodes on the file system on 71which the directory is being created has been exhausted. 72.It Bq Er EIO 73An I/O error occurred while making the directory entry or allocating the inode. 74.It Bq Er EIO 75An I/O error occurred while reading from or writing to the file system. 76.It Bq Er EFAULT 77.Fa Path 78points outside the process's allocated address space. 79.El 80.Sh SEE ALSO 81.Xr chmod 2 , 82.Xr stat 2 , 83.Xr umask 2 84.Sh STANDARDS 85.Fn Mkdir 86conforms to IEEE Std 1003.1-1988 87.Pq Dq Tn POSIX . 88