Commit | Line | Data |
---|---|---|
e6817382 BJ |
1 | .TH INTRO 2 |
2 | .de en | |
3 | .HP | |
4 | \\$1 \\$2 \\$3 | |
5 | .br | |
6 | .. | |
7 | .SH NAME | |
8 | intro, errno \- introduction to system calls and error numbers | |
9 | .SH SYNOPSIS | |
10 | .B #include <errno.h> | |
11 | .SH DESCRIPTION | |
12 | Section 2 of this manual | |
13 | lists all the entries into the system. | |
14 | Most of these calls have an error return. | |
15 | .pg | |
16 | An error condition is indicated by an otherwise | |
17 | impossible returned value. | |
18 | Almost always this is \(mi1; | |
19 | the individual sections specify the details. | |
20 | An error number is also made available | |
21 | in the external variable | |
22 | .IR errno . | |
23 | .I Errno | |
24 | is not cleared on successful calls, so it should be tested only | |
25 | after an error has occurred. | |
26 | .PP | |
27 | There is a table of messages | |
28 | associated with each error, and a routine for printing the | |
29 | message; | |
30 | See | |
31 | .IR perror (3). | |
32 | The possible error numbers | |
33 | are not recited with each writeup in section 2, since many | |
34 | errors are possible for most of the calls. | |
35 | Here is a list of the error numbers, | |
36 | their names as defined in <errno.h>, | |
37 | and the messages available using | |
38 | .IR perror . | |
39 | .en 0 \h'\w'EIO'u' "Error 0 | |
40 | Unused. | |
41 | .en 1 EPERM "Not owner | |
42 | Typically this error indicates | |
43 | an attempt to modify a file in some way forbidden | |
44 | except to its owner or super-user. | |
45 | It is also returned for attempts | |
46 | by ordinary users to do things | |
47 | allowed only to the super-user. | |
48 | .en 2 ENOENT "No such file or directory | |
49 | This error occurs when a file name is specified | |
50 | and the file should exist but doesn't, or when one | |
51 | of the directories in a path name does not exist. | |
52 | .en 3 ESRCH "No such process | |
53 | The process whose number was given to | |
54 | .I signal | |
55 | and | |
56 | .I ptrace | |
57 | does not exist, or is already dead. | |
58 | .en 4 EINTR "Interrupted system call | |
59 | An asynchronous signal (such as interrupt or quit), | |
60 | which the user has elected to catch, | |
61 | occurred during a system call. | |
62 | If execution is resumed | |
63 | after processing the signal, | |
64 | it will appear as if the interrupted system call | |
65 | returned this error condition. | |
66 | .en 5 EIO "I/O error | |
67 | Some physical I/O error occurred during a | |
68 | .I read | |
69 | or | |
70 | .IR write . | |
71 | This error may in some cases occur | |
72 | on a call following the one to which it actually applies. | |
73 | .en 6 ENXIO "No such device or address | |
74 | I/O on a special file refers to a subdevice which does not | |
75 | exist, | |
76 | or beyond the limits of the device. | |
77 | It may also occur when, for example, a tape drive | |
78 | is not dialled in or no disk pack is loaded on a drive. | |
79 | .en 7 E2BIG "Arg list too long | |
80 | An argument list longer than 5120 bytes | |
81 | is presented to | |
82 | .IR exec . | |
83 | .en 8 ENOEXEC "Exec format error | |
84 | A request is made to execute a file | |
85 | which, although it has the appropriate permissions, | |
86 | does not start with a valid magic number, see | |
87 | .IR a.out (5). | |
88 | .en 9 EBADF "Bad file number | |
89 | Either a file descriptor refers to no | |
90 | open file, | |
91 | or a read (resp. write) request is made to | |
92 | a file which is open only for writing (resp. reading). | |
93 | .en 10 ECHILD "No children | |
94 | .I Wait | |
95 | and the process has no | |
96 | living or unwaited-for children. | |
97 | .en 11 EAGAIN "No more processes | |
98 | In a | |
99 | .I fork, | |
100 | the system's process table is full | |
101 | or the user is not allowed to create any more | |
102 | processes. | |
103 | .en 12 ENOMEM "Not enough core | |
104 | During an | |
105 | .I exec | |
106 | or | |
107 | .I break, | |
108 | a program asks for more core than the system is able to supply. | |
109 | This is not a temporary condition; the maximum core size | |
110 | is a system parameter. | |
111 | The error may also occur if the arrangement | |
112 | of text, data, and stack segments | |
113 | requires too many segmentation registers. | |
114 | .en 13 EACCES "Permission denied | |
115 | An attempt was made to access a file in a way forbidden | |
116 | by the protection system. | |
117 | .en 14 EFAULT "Bad address | |
118 | The system encountered a hardware fault in attempting to | |
119 | access the arguments of a system call. | |
120 | .en 15 ENOTBLK "Block device required | |
121 | A plain file was mentioned where a block device was required, | |
122 | e.g. in | |
123 | .IR mount . | |
124 | .en 16 EBUSY "Mount device busy | |
125 | An attempt to mount a device that was already mounted or | |
126 | an attempt was made to dismount a device | |
127 | on which there is an active file | |
128 | directory. | |
129 | (open file, current directory, mounted-on file, active text segment). | |
130 | .en 17 EEXIST "File exists | |
131 | An existing file was mentioned in an inappropriate context, | |
132 | e.g. | |
133 | .IR link . | |
134 | .en 18 EXDEV "Cross-device link | |
135 | A link to a file on another device | |
136 | was attempted. | |
137 | .en 19 ENODEV "No such device | |
138 | An attempt was made to apply an inappropriate | |
139 | system call to a device; | |
140 | e.g. read a write-only device. | |
141 | .en 20 ENOTDIR "Not a directory | |
142 | A non-directory was specified where a directory | |
143 | is required, | |
144 | for example in a path name or | |
145 | as an argument to | |
146 | .IR chdir . | |
147 | .en 21 EISDIR "Is a directory | |
148 | An attempt to write on a directory. | |
149 | .en 22 EINVAL "Invalid argument | |
150 | Some invalid argument: | |
151 | dismounting a non-mounted | |
152 | device, | |
153 | mentioning an unknown signal in | |
154 | .I signal, | |
155 | reading or writing a file for which | |
156 | .I seek | |
157 | has generated a negative pointer. | |
158 | Also set by math functions, see | |
159 | .IR intro (3). | |
160 | .en 23 ENFILE "File table overflow | |
161 | The system's table of open files is full, | |
162 | and temporarily no more | |
163 | .I opens | |
164 | can be accepted. | |
165 | .en 24 EMFILE "Too many open files | |
166 | Customary configuration limit is 20 per process. | |
167 | .en 25 ENOTTY "Not a typewriter | |
168 | The file mentioned in | |
169 | .I stty | |
170 | or | |
171 | .I gtty | |
172 | is not a terminal or one of the other | |
173 | devices to which these calls apply. | |
174 | .en 26 ETXTBSY "Text file busy | |
175 | An attempt to execute a pure-procedure | |
176 | program which is currently open for writing | |
177 | (or reading!). | |
178 | Also an attempt to open for writing a pure-procedure | |
179 | program that is being executed. | |
180 | .en 27 EFBIG "File too large | |
181 | The size of a file exceeded the maximum (about | |
182 | .if t 10\u\s-29\s+2\d | |
183 | .if n 1.0E9 | |
184 | bytes). | |
185 | .en 28 ENOSPC "No space left on device | |
186 | During a | |
187 | .I write | |
188 | to an ordinary file, | |
189 | there is no free space left on the device. | |
190 | .en 29 ESPIPE "Illegal seek | |
191 | An | |
192 | .I lseek | |
193 | was issued to a pipe. | |
194 | This error should also be issued for | |
195 | other non-seekable devices. | |
196 | .en 30 EROFS "Read-only file system | |
197 | An attempt to modify a file or directory | |
198 | was made | |
199 | on a device mounted read-only. | |
200 | .en 31 EMLINK "Too many links | |
201 | An attempt to make more than 32767 links to a file. | |
202 | .en 32 EPIPE "Broken pipe | |
203 | A write on a pipe for which there is no process | |
204 | to read the data. | |
205 | This condition normally generates a signal; | |
206 | the error is returned if the signal is ignored. | |
207 | .en 33 EDOM "Math argument | |
208 | The argument of a function in the math package (3M) | |
209 | is out of the domain of the function. | |
210 | .en 34 ERANGE "Result too large | |
211 | The value of a function in the math package (3M) | |
212 | is unrepresentable within machine precision. | |
213 | .SH SEE ALSO | |
214 | intro(3) | |
215 | .SH "ASSEMBLER (PDP-11)" | |
216 | .B as /usr/include/sys.s file ... | |
217 | .PP | |
218 | The PDP11 assembly language interface is given for each | |
219 | system call. | |
220 | The assembler symbols are defined in `/usr/include/sys.s'. | |
221 | .PP | |
222 | Return values appear in registers r0 and r1; | |
223 | it is unwise to count on these registers being preserved | |
224 | when no value is expected. | |
225 | An erroneous call is always | |
226 | indicated by turning on the c-bit of the condition codes. | |
227 | The error number is returned in r0. | |
228 | The presence of an error is most easily tested | |
229 | by the instructions | |
230 | .I bes | |
231 | and | |
232 | .I bec | |
233 | (`branch on error set (or clear)'). | |
234 | These are synonyms for | |
235 | the | |
236 | .I bcs | |
237 | and | |
238 | .I bcc | |
239 | instructions. | |
240 | .PP | |
241 | On the Interdata 8/32, the system call arguments | |
242 | correspond well to the arguments of the C routines. | |
243 | The sequence is: | |
244 | .IP | |
245 | .nf | |
246 | la %2,errno | |
247 | l %0,&callno | |
248 | svc 0,args | |
249 | .fi | |
250 | .PP | |
251 | Thus register 2 points to a word into which the error number will be | |
252 | stored as needed; it is cleared if no error occurs. | |
253 | Register 0 contains the system call number; the nomenclature | |
254 | is identical to that on the PDP11. | |
255 | The argument of the | |
256 | .I svc | |
257 | is the address of the arguments, laid out in storage | |
258 | as in the C calling sequence. | |
259 | The return value is in register 2 (possibly 3 also, as in | |
260 | .IR pipe ) | |
261 | and is \-1 in case of error. | |
262 | The overflow bit in the program status word is also | |
263 | set when errors occur. | |
264 | .PP | |
265 | On the VAX-11 a system call follows exactly the same conventions as a | |
266 | C procedure. Namely, register | |
267 | .B ap | |
268 | points to a long word containing the number of arguments, and the | |
269 | arguments follow in successive long words. Values are returned in registers | |
270 | .B r0 | |
271 | and | |
272 | .BR r1 . | |
273 | An error is indicated by setting the C (carry) bit in the processor status | |
274 | word; the error number is placed in | |
275 | .BR r0 . |