|
|
1.1 ! root 1: .TH CREAT 2 "2 July 1983" ! 2: .UC 4 ! 3: .SH NAME ! 4: creat \- create a new file ! 5: .SH SYNOPSIS ! 6: .nf ! 7: .B creat(name, mode) ! 8: .B char *name; ! 9: .fi ! 10: .SH DESCRIPTION ! 11: .B "This interface is obsoleted by open(2). ! 12: .PP ! 13: .I Creat ! 14: creates a new file or prepares to rewrite an existing ! 15: file called ! 16: .IR name , ! 17: given as the address of a null-terminated string. ! 18: If the file did not exist, it is given ! 19: mode ! 20: .IR mode , ! 21: as modified by the process's mode mask (see ! 22: .IR umask (2)). ! 23: Also see ! 24: .IR chmod (2) ! 25: for the ! 26: construction of the ! 27: .I mode ! 28: argument. ! 29: .PP ! 30: If the file did exist, its mode and owner remain unchanged ! 31: but it is truncated to 0 length. ! 32: .PP ! 33: The file is also opened for writing, and its file descriptor ! 34: is returned. ! 35: .SH NOTES ! 36: The ! 37: .I mode ! 38: given is arbitrary; it need not allow ! 39: writing. ! 40: This feature has been used in the past by ! 41: programs to construct a simple exclusive locking ! 42: mechanism. It is replaced by the O_EXCL open ! 43: mode, or ! 44: .IR flock (2) ! 45: facilitity. ! 46: .SH "RETURN VALUE ! 47: The value \-1 is returned if an error occurs. Otherwise, ! 48: the call returns a non-negative descriptor which only permits ! 49: writing. ! 50: .SH ERRORS ! 51: .I Creat ! 52: will fail and the file will not be created or truncated ! 53: if one of the following occur: ! 54: .TP 15 ! 55: [EPERM] ! 56: The argument contains a byte with the high-order bit set. ! 57: .TP 15 ! 58: [ENOTDIR] ! 59: A component of the path prefix is not a directory. ! 60: .TP 15 ! 61: [EACCES] ! 62: A needed directory does not have search permission. ! 63: .TP 15 ! 64: [EACCES] ! 65: The file does not exist and the directory ! 66: in which it is to be created is not writable. ! 67: .TP 15 ! 68: [EACCES] ! 69: The file exists, but it is unwritable. ! 70: .TP 15 ! 71: [EISDIR] ! 72: The file is a directory. ! 73: .TP 15 ! 74: [EMFILE] ! 75: There are already too many files open. ! 76: .TP 15 ! 77: [EROFS] ! 78: The named file resides on a read-only file system. ! 79: .TP 15 ! 80: [ENXIO] ! 81: The file is a character special or block special file, and ! 82: the associated device does not exist. ! 83: .TP 15 ! 84: [ETXTBSY] ! 85: The file is a pure procedure (shared text) file that is being ! 86: executed. ! 87: .TP 15 ! 88: [EFAULT] ! 89: .I Name ! 90: points outside the process's allocated address space. ! 91: .TP 15 ! 92: [ELOOP] ! 93: Too many symbolic links were encountered in translating the ! 94: pathname. ! 95: .TP 15 ! 96: [EOPNOTSUPP] ! 97: The file was a socket (not currently implemented). ! 98: .SH "SEE ALSO" ! 99: 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.