1*61183Sbostic.\" Copyright (c) 1983, 1991, 1993 2*61183Sbostic.\" The Regents of the University of California. All rights reserved. 320243Smckusick.\" 443568Strent.\" %sccs.include.redist.man% 520243Smckusick.\" 6*61183Sbostic.\" @(#)mkdir.2 8.1 (Berkeley) 06/04/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 6024440SmckusickThe directory in which the entry for the new directory is being placed 6124440Smckusickcannot be extended because there is no space left on the file 6224440Smckusicksystem containing the directory. 6347208Scael.It Bq Er ENOSPC 6424440SmckusickThe new directory cannot be created because there 6524440Smckusickthere is no space left on the file 6624440Smckusicksystem that will contain the directory. 6747208Scael.It Bq Er ENOSPC 6824440SmckusickThere are no free inodes on the file system on which the 6924440Smckusickdirectory is being created. 7047208Scael.It Bq Er EDQUOT 7124440SmckusickThe directory in which the entry for the new directory 7224440Smckusickis being placed cannot be extended because the 7324440Smckusickuser's quota of disk blocks on the file system 7424440Smckusickcontaining the directory has been exhausted. 7547208Scael.It Bq Er EDQUOT 7624440SmckusickThe new directory cannot be created because the user's 7724440Smckusickquota of disk blocks on the file system that will 7824440Smckusickcontain the directory has been exhausted. 7947208Scael.It Bq Er EDQUOT 8024440SmckusickThe user's quota of inodes on the file system on 8124440Smckusickwhich the directory is being created has been exhausted. 8247208Scael.It Bq Er EIO 8321004SmckusickAn I/O error occurred while making the directory entry or allocating the inode. 8447208Scael.It Bq Er EIO 8524440SmckusickAn I/O error occurred while reading from or writing to the file system. 8647208Scael.It Bq Er EFAULT 8747208Scael.Fa Path 8820243Smckusickpoints outside the process's allocated address space. 8947208Scael.El 9047208Scael.Sh SEE ALSO 9147208Scael.Xr chmod 2 , 9247208Scael.Xr stat 2 , 9347208Scael.Xr umask 2 9447208Scael.Sh STANDARDS 9547208Scael.Fn Mkdir 9647208Scaelconforms to IEEE Std 1003.1-1988 9747208Scael.Pq Dq Tn POSIX . 98