161183Sbostic.\" Copyright (c) 1983, 1991, 1993 261183Sbostic.\" The Regents of the University of California. All rights reserved. 320243Smckusick.\" 443568Strent.\" %sccs.include.redist.man% 520243Smckusick.\" 6*65100Smckusick.\" @(#)mkdir.2 8.2 (Berkeley) 12/11/93 738053Sbostic.\" 847208Scael.Dd 947208Scael.Dt MKDIR 2 1047208Scael.Os BSD 4.2 1147208Scael.Sh NAME 1247208Scael.Nm mkdir 1347208Scael.Nd make a directory file 1447208Scael.Sh SYNOPSIS 1547208Scael.Fd #include <sys/stat.h> 1647208Scael.Ft int 1747208Scael.Fn mkdir "const char *path" "mode_t mode" 1847208Scael.Sh DESCRIPTION 1947208ScaelThe directory 2047208Scael.Fa path 2147208Scaelis created with the access permissions specified by 2247208Scael.Fa mode 2347208Scaeland restricted by the the 2447208Scael.Xr umask 2 2547208Scaelof the calling process. 2647208Scael.Pp 2720243SmckusickThe directory's owner ID is set to the process's effective user ID. 2820243SmckusickThe directory's group ID is set to that of the parent directory in 2920243Smckusickwhich it is created. 3047208Scael.Sh RETURN VALUES 3147208ScaelA 0 return value indicates success. A -1 return value 3220243Smckusickindicates an error, and an error code is stored in 3347208Scael.Va errno . 3447208Scael.Sh ERRORS 3547208Scael.Fn Mkdir 3620243Smckusickwill fail and no directory will be created if: 3747208Scael.Bl -tag -width ENAMETOOLO 3847208Scael.It Bq Er ENOTDIR 3921004SmckusickA component of the path prefix is not a directory. 4047208Scael.It Bq Er EINVAL 4121004SmckusickThe pathname contains a character with the high-order bit set. 4247208Scael.It Bq Er ENAMETOOLONG 4321004SmckusickA component of a pathname exceeded 255 characters, 4421004Smckusickor an entire path name exceeded 1023 characters. 4547208Scael.It Bq Er ENOENT 4621004SmckusickA component of the path prefix does not exist. 4747208Scael.It Bq Er EACCES 4821004SmckusickSearch permission is denied for a component of the path prefix. 4947208Scael.It Bq Er ELOOP 5021004SmckusickToo many symbolic links were encountered in translating the pathname. 5147208Scael.It Bq Er EPERM 5247208ScaelThe 5347208Scael.Fa path 5447208Scaelargument contains a byte with the high-order bit set. 5547208Scael.It Bq Er EROFS 5620243SmckusickThe named file resides on a read-only file system. 5747208Scael.It Bq Er EEXIST 5820243SmckusickThe named file exists. 5947208Scael.It Bq Er ENOSPC 60*65100SmckusickThe new directory cannot be created because there is no space left 61*65100Smckusickon the file system that will contain the directory. 6247208Scael.It Bq Er ENOSPC 6324440SmckusickThere are no free inodes on the file system on which the 6424440Smckusickdirectory is being created. 6547208Scael.It Bq Er EDQUOT 6624440SmckusickThe new directory cannot be created because the user's 6724440Smckusickquota of disk blocks on the file system that will 6824440Smckusickcontain the directory has been exhausted. 6947208Scael.It Bq Er EDQUOT 7024440SmckusickThe user's quota of inodes on the file system on 7124440Smckusickwhich the directory is being created has been exhausted. 7247208Scael.It Bq Er EIO 7321004SmckusickAn I/O error occurred while making the directory entry or allocating the inode. 7447208Scael.It Bq Er EIO 7524440SmckusickAn I/O error occurred while reading from or writing to the file system. 7647208Scael.It Bq Er EFAULT 7747208Scael.Fa Path 7820243Smckusickpoints outside the process's allocated address space. 7947208Scael.El 8047208Scael.Sh SEE ALSO 8147208Scael.Xr chmod 2 , 8247208Scael.Xr stat 2 , 8347208Scael.Xr umask 2 8447208Scael.Sh STANDARDS 8547208Scael.Fn Mkdir 8647208Scaelconforms to IEEE Std 1003.1-1988 8747208Scael.Pq Dq Tn POSIX . 88