home *** CD-ROM | disk | FTP | other *** search
/ minnie.tuhs.org / unixen.tar / unixen / PDP-11 / Trees / V6 / usr / man / man2 / intro.2 < prev    next >
Encoding:
Text File  |  1975-06-26  |  6.3 KB  |  225 lines

  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 successful 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 EINTR "Interrupted system call"
  85. An asynchronous signal (such as interrupt or quit),
  86. which the user has elected to catch,
  87. occurred during a system call.
  88. If execution is resumed
  89. after processing the signal,
  90. it will appear as if the interrupted system call
  91. returned this error condition.
  92. .en 5 EIO "I/O error"
  93. Some physical I/O error occurred during a
  94. .it read
  95. or
  96. .it write.
  97. This error may in some cases occur
  98. on a call following the one to which it actually applies.
  99. .en 6 ENXIO "No such device or address"
  100. I/O on a special file refers to a subdevice which does not
  101. exist,
  102. or beyond the limits of the device.
  103. It may also occur when, for example, a tape drive
  104. is not dialled in or no disk pack is loaded on a drive.
  105. .en 7 E2BIG "Arg list too long"
  106. An argument list longer than 512 bytes
  107. (counting the null at the end of each argument)
  108. is presented to
  109. .it exec.
  110. .en 8 ENOEXEC "Exec format error"
  111. A request is made to execute a file
  112. which, although it has the appropriate permissions,
  113. does not start with one of the magic numbers
  114. 407 or 410.
  115. .en 9 EBADF "Bad file number"
  116. Either a file descriptor refers to no
  117. open file,
  118. or a read (resp. write) request is made to
  119. a file which is open only for writing (resp. reading).
  120. .en 10 ECHILD "No children"
  121. .it Wait
  122. and the process has no
  123. living or unwaited-for children.
  124. .en 11 EAGAIN "No more processes"
  125. In a
  126. .it fork,
  127. the system's process table is full and no
  128. more processes can for the moment be created.
  129. .en 12 ENOMEM "Not enough core"
  130. During an
  131. .it exec
  132. or
  133. .it break,
  134. a program asks for more core than the system is able to supply.
  135. This is not a temporary condition; the maximum core size
  136. is a system parameter.
  137. The error may also occur if the arrangement
  138. of text, data, and stack segments is such as to
  139. require more than the existing 8 segmentation registers.
  140. .en 13 EACCES "Permission denied"
  141. An attempt was made to access a file in a way forbidden
  142. by the protection system.
  143. .en 14 \(mi (unused)
  144. .en 15 ENOTBLK "Block device required"
  145. A plain file was mentioned where a block device was required,
  146. e.g. in
  147. .it mount.
  148. .en 16 EBUSY "Mount device busy"
  149. An attempt to mount a device that was already mounted or
  150. an attempt was made to dismount a device
  151. on which there is an open file or some process's current
  152. directory.
  153. .en 17 EEXIST "File exists"
  154. An existing file was mentioned in an inappropriate context,
  155. e.g.
  156. .it link.
  157. .en 18 EXDEV "Cross-device link"
  158. A link to a file on another device
  159. was attempted.
  160. .en 19 ENODEV "No such device"
  161. An attempt was made to apply an inappropriate
  162. system call to a device;
  163. e.g. read a write-only device.
  164. .en 20 ENOTDIR "Not a directory"
  165. A non-directory was specified where a directory
  166. is required,
  167. for example in a path name or
  168. as an argument to
  169. .it chdir.
  170. .en 21 EISDIR "Is a directory"
  171. An attempt to write on a directory.
  172. .en 22 EINVAL "Invalid argument"
  173. Some invalid argument:
  174. currently, dismounting a non-mounted
  175. device,
  176. mentioning an unknown signal in
  177. .it signal,
  178. and giving an unknown request in
  179. .it stty
  180. to the TIU special file.
  181. .en 23 ENFILE "File table overflow"
  182. The system's table of open files is full,
  183. and temporarily no more
  184. .it opens
  185. can be accepted.
  186. .en 24 EMFILE "Too many open files"
  187. Only 15 files can be open per process.
  188. .en 25 ENOTTY "Not a typewriter"
  189. The file mentioned in
  190. .it stty
  191. or
  192. .it gtty
  193. is not a typewriter or one of the other
  194. devices to which these calls apply.
  195. .en 26 ETXTBSY "Text file busy"
  196. An attempt to execute a pure-procedure
  197. program which is currently open for writing
  198. (or reading!).
  199. Also an attempt to open for writing a pure-procedure
  200. program that is being executed.
  201. .en 27 EFBIG "File too large"
  202. An attempt to make a file larger than the maximum of 32768 blocks.
  203. .en 28 ENOSPC "No space left on device"
  204. During a
  205. .it write
  206. to an ordinary file,
  207. there is no free space left on the device.
  208. .en 29 ESPIPE "Seek on pipe"
  209. A
  210. .it seek
  211. was issued to a pipe.
  212. This error should also be issued for
  213. other non-seekable devices.
  214. .en 30 EROFS "Read-only file system"
  215. An attempt to modify a file or directory
  216. was made
  217. on a device mounted read-only.
  218. .en 31 EMLINK "Too many links"
  219. An attempt to make more than 127 links to a file.
  220. .en 32 EPIPE "Write on broken pipe"
  221. A write on a pipe for which there is no process
  222. to read the data.
  223. This condition normally generates a signal;
  224. the error is returned if the signal is ignored.
  225.