|
|
1.1 ! root 1: .\" Copyright (c) 1980 Regents of the University of California. ! 2: .\" All rights reserved. The Berkeley software License Agreement ! 3: .\" specifies the terms and conditions for redistribution. ! 4: .\" ! 5: .\" @(#)creat.2 6.6 (Berkeley) 5/22/86 ! 6: .\" ! 7: .TH CREAT 2 "May 22, 1986" ! 8: .UC 4 ! 9: .SH NAME ! 10: creat \- create a new file ! 11: .SH SYNOPSIS ! 12: .nf ! 13: .B creat(name, mode) ! 14: .B char *name; ! 15: .fi ! 16: .SH DESCRIPTION ! 17: .B "This interface is made obsolete by open(2). ! 18: .PP ! 19: .I Creat ! 20: creates a new file or prepares to rewrite an existing ! 21: file called ! 22: .IR name , ! 23: given as the address of a null-terminated string. ! 24: If the file did not exist, it is given ! 25: mode ! 26: .IR mode , ! 27: as modified by the process's mode mask (see ! 28: .IR umask (2)). ! 29: Also see ! 30: .IR chmod (2) ! 31: for the ! 32: construction of the ! 33: .I mode ! 34: argument. ! 35: .PP ! 36: If the file did exist, its mode and owner remain unchanged ! 37: but it is truncated to 0 length. ! 38: .PP ! 39: The file is also opened for writing, and its file descriptor ! 40: is returned. ! 41: .SH NOTES ! 42: The ! 43: .I mode ! 44: given is arbitrary; it need not allow ! 45: writing. ! 46: This feature has been used in the past by ! 47: programs to construct a simple, exclusive locking ! 48: mechanism. It is replaced by the O_EXCL open ! 49: mode, or ! 50: .IR flock (2) ! 51: facility. ! 52: .SH "RETURN VALUE ! 53: The value \-1 is returned if an error occurs. Otherwise, ! 54: the call returns a non-negative descriptor that only permits ! 55: writing. ! 56: .SH ERRORS ! 57: .I Creat ! 58: will fail and the file will not be created or truncated ! 59: if one of the following occur: ! 60: .TP 15 ! 61: [ENOTDIR] ! 62: A component of the path prefix is not a directory. ! 63: .TP 15 ! 64: [EINVAL] ! 65: The pathname contains a character with the high-order bit set. ! 66: .TP 15 ! 67: [ENAMETOOLONG] ! 68: A component of a pathname exceeded 255 characters, ! 69: or an entire path name exceeded 1023 characters. ! 70: .TP 15 ! 71: [ENOENT] ! 72: The named file does not exist. ! 73: .TP 15 ! 74: [ELOOP] ! 75: Too many symbolic links were encountered in translating the pathname. ! 76: .TP 15 ! 77: [EACCES] ! 78: Search permission is denied for a component of the path prefix. ! 79: .TP 15 ! 80: [EACCES] ! 81: The file does not exist and the directory ! 82: in which it is to be created is not writable. ! 83: .TP 15 ! 84: [EACCES] ! 85: The file exists, but it is unwritable. ! 86: .TP 15 ! 87: [EISDIR] ! 88: The file is a directory. ! 89: .TP 15 ! 90: [EMFILE] ! 91: There are already too many files open. ! 92: .TP 15 ! 93: [ENFILE] ! 94: The system file table is full. ! 95: .TP 15 ! 96: [ENOSPC] ! 97: The directory in which the entry for the new file is being placed ! 98: cannot be extended because there is no space left on the file ! 99: system containing the directory. ! 100: .TP 15 ! 101: [ENOSPC] ! 102: There are no free inodes on the file system on which the ! 103: file is being created. ! 104: .TP 15 ! 105: [EDQUOT] ! 106: The directory in which the entry for the new file ! 107: is being placed cannot be extended because the ! 108: user's quota of disk blocks on the file system ! 109: containing the directory has been exhausted. ! 110: .TP 15 ! 111: [EDQUOT] ! 112: The user's quota of inodes on the file system on ! 113: which the file is being created has been exhausted. ! 114: .TP 15 ! 115: [EROFS] ! 116: The named file resides on a read-only file system. ! 117: .TP 15 ! 118: [ENXIO] ! 119: The file is a character special or block special file, and ! 120: the associated device does not exist. ! 121: .TP 15 ! 122: [ETXTBSY] ! 123: The file is a pure procedure (shared text) file that is being ! 124: executed. ! 125: .TP 15 ! 126: [EIO] ! 127: An I/O error occurred while making the directory entry or allocating the inode. ! 128: .TP 15 ! 129: [EFAULT] ! 130: .I Name ! 131: points outside the process's allocated address space. ! 132: .TP 15 ! 133: [EOPNOTSUPP] ! 134: The file was a socket (not currently implemented). ! 135: .SH "SEE ALSO" ! 136: open(2), write(2), close(2), chmod(2), umask(2)
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.