|
|
1.1 ! root 1: .th INTRO II 11/5/73 ! 2: .de pg ! 3: .sp ! 4: .. ! 5: .de en ! 6: .pg ! 7: .in 3 ! 8: .ti 0 ! 9: \\$1\t\\$2\t\\$3 ! 10: .br ! 11: .. ! 12: .sp 2 ! 13: .in 0 ! 14: .if t .ta 3 10 ! 15: .ce ! 16: INTRODUCTION TO SYSTEM CALLS ! 17: .sp ! 18: Section II of this manual ! 19: lists all the entries into the system. ! 20: In most cases two calling sequences are specified, ! 21: one of which is usable from assembly language, and the other from C. ! 22: Most of these calls have an error return. ! 23: From assembly language an erroneous call is always ! 24: indicated by turning on the c-bit of the condition codes. ! 25: The presence of an error is most easily tested ! 26: by the instructions ! 27: .it bes ! 28: and ! 29: .it bec ! 30: (``branch on error set (or clear)''). ! 31: These are synonyms for ! 32: the ! 33: .it bcs ! 34: and ! 35: .it bcc ! 36: instructions. ! 37: .pg ! 38: From C, an error condition is indicated by an otherwise ! 39: impossible returned value. ! 40: Almost always this is \(mi1; ! 41: the individual sections specify the details. ! 42: .pg ! 43: In both cases an error number is also available. ! 44: In assembly language, ! 45: this number is returned in r0 on erroneous calls. ! 46: From C, ! 47: the external variable ! 48: .it errno ! 49: is set to the error number. ! 50: .it Errno ! 51: is not cleared on succesful calls, so it should be tested only ! 52: after an error has occurred. ! 53: There is a table of messages ! 54: associated with each error, and a routine for printing the ! 55: message. ! 56: See ! 57: .it "perror (III)." ! 58: .pg ! 59: The possible error numbers ! 60: are not recited with each writeup in section II, since many ! 61: errors are possible for most of the calls. ! 62: Here is a list of the error numbers, ! 63: their names inside the system (for the benefit of ! 64: system-readers), ! 65: and the messages available using ! 66: .it perror. ! 67: A short explanation is also provided. ! 68: .en 0 \(mi (unused) ! 69: .en 1 EPERM "Not owner and not super-user" ! 70: Typically this error indicates ! 71: an attempt to modify a file in some way forbidden ! 72: except to its owner. ! 73: It is also returned for attempts ! 74: by ordinary users to do things ! 75: allowed only to the super-user. ! 76: .en 2 ENOENT "No such file or directory" ! 77: This error occurs when a file name is specified ! 78: and the file should exist but doesn't, or when one ! 79: of the directories in a path name does not exist. ! 80: .en 3 ESRCH "No such process" ! 81: The process whose number was given to ! 82: .it signal ! 83: does not exist, or is already dead. ! 84: .en 4 \(mi (unused) ! 85: .en 5 EIO "I/O error" ! 86: Some physical I/O error occurred during a ! 87: .it read ! 88: or ! 89: .it write. ! 90: This error may in some cases occur ! 91: on a call following the one to which it actually applies. ! 92: .en 6 ENXIO "No such device or address" ! 93: I/O on a special file refers to a subdevice which does not ! 94: exist, ! 95: or beyond the limits of the device. ! 96: It may also occur when, for example, a tape drive ! 97: is not dialled in or no disk pack is loaded on a drive. ! 98: .en 7 E2BIG "Arg list too long" ! 99: An argument list longer than 512 bytes ! 100: (counting the null at the end of each argument) ! 101: is presented to ! 102: .it exec. ! 103: .en 8 ENOEXEC "Exec format error" ! 104: A request is made to execute a file ! 105: which, although it has the appropriate permissions, ! 106: does not start with one of the magic numbers ! 107: 407 or 410. ! 108: .en 9 EBADF "Bad file number" ! 109: Either a file descriptor refers to no ! 110: open file, ! 111: or a read (resp. write) request is made to ! 112: a file which is open only for writing (resp. reading). ! 113: .en 10 ECHILD "No children" ! 114: .it Wait ! 115: and the process has no ! 116: living or unwaited-for children. ! 117: .en 11 EAGAIN "No more processes" ! 118: In a ! 119: .it fork, ! 120: the system's process table is full and no ! 121: more processes can for the moment be created. ! 122: .en 12 ENOMEM "Not enough core" ! 123: During an ! 124: .it exec ! 125: or ! 126: .it break, ! 127: a program asks for more core than the system is able to supply. ! 128: This is not a temporary condition; the maximum core size ! 129: is a system parameter. ! 130: The error may also occur if the arrangement ! 131: of text, data, and stack segments is such as to ! 132: require more than the existing 8 segmentation registers. ! 133: .en 13 EACCES "Permission denied" ! 134: An attempt was made to access a file in a way forbidden ! 135: by the protection system. ! 136: .en 14 \(mi (unused) ! 137: .en 15 ENOTBLK "Block device required" ! 138: A plain file was mentioned where a block device was required, ! 139: e.g. in ! 140: .it mount. ! 141: .en 16 EBUSY "Mount device busy" ! 142: An attempt was made to dismount a device ! 143: on which there is an open file or some process's current ! 144: directory. ! 145: .en 17 EEXIST "File exists" ! 146: In existing file was mentioned in a context in which ! 147: it should not have, ! 148: e.g. ! 149: .it link. ! 150: .en 18 EXDEV "Cross-device link" ! 151: A link to a file on another device ! 152: was attempted. ! 153: .en 19 ENODEV "No such device" ! 154: An attempt was made to apply an inappropriate ! 155: system call to a device; ! 156: e.g. read a write-only device. ! 157: .en 20 ENOTDIR "Not a directory" ! 158: A non-directory was specified where a directory ! 159: is required, ! 160: for example in a path name or ! 161: as an argument to ! 162: .it chdir. ! 163: .en 21 EISDIR "Is a directory" ! 164: An attempt to write on a directory. ! 165: .en 22 EINVAL "Invalid argument" ! 166: Some invalid argument: ! 167: currently, dismounting a non-mounted ! 168: device, ! 169: mentioning an unknown signal in ! 170: .it signal, ! 171: and giving an unknown request in ! 172: .it stty ! 173: to the TIU special file. ! 174: .en 23 ENFILE "File table overflow" ! 175: The system's table of open files is full, ! 176: and temporarily no more ! 177: .it opens ! 178: can be accepted. ! 179: .en 24 EMFILE "Too many open files" ! 180: Only 10 files can be open per process; ! 181: this error occurs when the eleventh is opened. ! 182: .en 25 ENOTTY "Not a typewriter" ! 183: The file mentioned in ! 184: .it stty ! 185: or ! 186: .it gtty ! 187: is not a typewriter or one of the other ! 188: devices to which these calls apply. ! 189: .en 26 ETXTBSY "Text file busy" ! 190: An attempt to execute a pure-procedure ! 191: program which is currently open for writing ! 192: (or reading!). ! 193: .en 27 EFBIG "File too large" ! 194: An attempt to make a file larger than the maximum of 2048 blocks. ! 195: .en 28 ENOSPC "No space left on device" ! 196: During a ! 197: .it write ! 198: to an ordinary file, ! 199: there is no free space left on the device. ! 200: .en 29 ESPIPE "Seek on pipe" ! 201: A ! 202: .it seek ! 203: was issued to a pipe. ! 204: This error should also be issued for ! 205: other non-seekable devices.
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.