1 | .\" Copyright (c) 1980,1983,1986 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 | .\" @(#)intro.2 6.7 (Berkeley) 5/23/86
|
---|
6 | .\"
|
---|
7 | .TH INTRO 2 "June 30, 1986"
|
---|
8 | .UC 4
|
---|
9 | .de en
|
---|
10 | .HP
|
---|
11 | \\$1 \\$2 \\$3
|
---|
12 | .br
|
---|
13 | ..
|
---|
14 | .SH NAME
|
---|
15 | intro, errno \- introduction to system calls and error numbers
|
---|
16 | .SH SYNOPSIS
|
---|
17 | .B "#include <errno.h>"
|
---|
18 | .SH DESCRIPTION
|
---|
19 | This section describes all of the system calls. Most
|
---|
20 | of these calls have one or more error returns.
|
---|
21 | An error condition is indicated by an otherwise impossible return
|
---|
22 | value. This is almost always \-1; the individual descriptions
|
---|
23 | specify the details.
|
---|
24 | Note that a number of system calls overload the meanings of these
|
---|
25 | error numbers, and that the meanings must be interpreted according
|
---|
26 | to the type and circumstances of the call.
|
---|
27 | .PP
|
---|
28 | As with normal arguments, all return codes and values from
|
---|
29 | functions are of type integer unless otherwise noted.
|
---|
30 | An error number is also made available in the external
|
---|
31 | variable \fBerrno\fP, which is not cleared
|
---|
32 | on successful calls.
|
---|
33 | Thus \fBerrno\fP should be tested only after an error has occurred.
|
---|
34 | .PP
|
---|
35 | The following is a complete list of the errors and their
|
---|
36 | names as given in
|
---|
37 | .RI < sys/errno.h >:
|
---|
38 | .en 0 OK "Error 0
|
---|
39 | Unused. (The symbol "OK" is only used inside the kernel source.)
|
---|
40 | .en 1 EPERM "Not owner
|
---|
41 | Typically this error indicates
|
---|
42 | an attempt to modify a file in some way forbidden
|
---|
43 | except to its owner or super-user.
|
---|
44 | It is also returned for attempts
|
---|
45 | by ordinary users to do things
|
---|
46 | allowed only to the super-user.
|
---|
47 | .en 2 ENOENT "No such file or directory
|
---|
48 | This error occurs when a file name is specified
|
---|
49 | and the file should exist but doesn't, or when one
|
---|
50 | of the directories in a path name does not exist.
|
---|
51 | .en 3 ESRCH "No such process
|
---|
52 | The process or process group whose number was given
|
---|
53 | does not exist, or any such process is already dead.
|
---|
54 | .en 4 EINTR "Interrupted system call
|
---|
55 | An asynchronous signal (such as interrupt or quit)
|
---|
56 | that the user has elected to catch
|
---|
57 | occurred during a system call.
|
---|
58 | If execution is resumed
|
---|
59 | after processing the signal
|
---|
60 | and the system call is not restarted,
|
---|
61 | it will appear as if the interrupted system call
|
---|
62 | returned this error condition.
|
---|
63 | .en 5 EIO "I/O error
|
---|
64 | Some physical I/O error occurred during an I/O operation, usually
|
---|
65 | .B read
|
---|
66 | or
|
---|
67 | .BR write .
|
---|
68 | Operations on file descriptors that refer to devices that are forcefully
|
---|
69 | taken away or in a bad state will also provoke this error.
|
---|
70 | .en 6 ENXIO "No such device or address
|
---|
71 | I/O on a special file refers to a subdevice that does not
|
---|
72 | exist,
|
---|
73 | or beyond the limits of the device.
|
---|
74 | It may also occur when, for example, an illegal tape drive
|
---|
75 | unit number is selected
|
---|
76 | or a disk pack is not loaded on a drive.
|
---|
77 | .en 7 E2BIG "Arg list too long
|
---|
78 | An argument list longer than ARG_MAX bytes is presented to
|
---|
79 | .BR execve .
|
---|
80 | ARG_MAX is set to 4096 bytes for 16-bit MINIX 3, 16384 bytes for 32-bit
|
---|
81 | MINIX 3, and unlimited for Minix-vmd as these systems are released.
|
---|
82 | .en 8 ENOEXEC "Exec format error
|
---|
83 | A request is made to execute a file
|
---|
84 | that, although it has the appropriate permissions,
|
---|
85 | does not start with a valid magic number, (see
|
---|
86 | .BR a.out (5)).
|
---|
87 | .en 9 EBADF "Bad file number
|
---|
88 | Either a file descriptor refers to no
|
---|
89 | open file,
|
---|
90 | or a read (resp. write) request is made to
|
---|
91 | a file that is open only for writing (resp. reading).
|
---|
92 | .en 10 ECHILD "No children
|
---|
93 | .B Wait
|
---|
94 | and the process has no
|
---|
95 | living or unwaited-for children.
|
---|
96 | .en 11 EAGAIN "Resource temporarily unavailable
|
---|
97 | In a
|
---|
98 | .B fork,
|
---|
99 | the system's process table is full or the user is not allowed to create
|
---|
100 | any more processes, otherwise an operation that would cause a process to
|
---|
101 | block was attempted on an object in non-blocking mode (see \fBfcntl\fP(2)).
|
---|
102 | .en 12 ENOMEM "Not enough core
|
---|
103 | During an
|
---|
104 | .B execve
|
---|
105 | or
|
---|
106 | .B brk,
|
---|
107 | a program asks for more (virtual) memory than the system is
|
---|
108 | able to supply,
|
---|
109 | or a process size limit would be exceeded.
|
---|
110 | The maximum size
|
---|
111 | of the data+stack segment is set by the
|
---|
112 | .BR chmem (1)
|
---|
113 | program. For Minix-vmd a small data+stack size is increased to 3 megabytes
|
---|
114 | when a program is executed.
|
---|
115 | .en 13 EACCES "Permission denied
|
---|
116 | An attempt was made to access a file in a way forbidden
|
---|
117 | by the protection system. Also an attempt to open a device for writing
|
---|
118 | that is physically write protected.
|
---|
119 | .en 14 EFAULT "Bad address
|
---|
120 | An argument of a system call is outside the address space allocated to a
|
---|
121 | process.
|
---|
122 | .en 15 ENOTBLK "Block device required
|
---|
123 | A plain file was mentioned where a block device was required,
|
---|
124 | e.g., in
|
---|
125 | .BR mount .
|
---|
126 | .en 16 EBUSY "Resource busy
|
---|
127 | An attempt to mount a device that was already mounted or
|
---|
128 | an attempt was made to dismount a device
|
---|
129 | on which there is an active file
|
---|
130 | (open file, current directory, mounted-on file, or active text segment).
|
---|
131 | A request was made to an exclusive access device that was already in use.
|
---|
132 | .en 17 EEXIST "File exists
|
---|
133 | An existing file was mentioned in an inappropriate context,
|
---|
134 | e.g.,
|
---|
135 | .BR link .
|
---|
136 | .en 18 EXDEV "Cross-device link
|
---|
137 | A hard link to a file on another device
|
---|
138 | was attempted.
|
---|
139 | .en 19 ENODEV "No such device
|
---|
140 | An attempt was made to access a device that is not configured by the system,
|
---|
141 | i.e., there is no driver for the device.
|
---|
142 | .en 20 ENOTDIR "Not a directory
|
---|
143 | A non-directory was specified where a directory
|
---|
144 | is required,
|
---|
145 | for example, in a path name or
|
---|
146 | as an argument to
|
---|
147 | .BR chdir .
|
---|
148 | .en 21 EISDIR "Is a directory
|
---|
149 | An attempt to write on a directory.
|
---|
150 | .en 22 EINVAL "Invalid argument
|
---|
151 | Some invalid argument:
|
---|
152 | dismounting a non-mounted
|
---|
153 | device,
|
---|
154 | mentioning an unknown signal in
|
---|
155 | .B signal,
|
---|
156 | or some other argument inappropriate for the call.
|
---|
157 | Also set by math functions, (see
|
---|
158 | .BR math (3)).
|
---|
159 | .en 23 ENFILE "File table overflow
|
---|
160 | The system's table of open files is full,
|
---|
161 | and temporarily no more
|
---|
162 | .I opens
|
---|
163 | can be accepted.
|
---|
164 | .en 24 EMFILE "Too many open files
|
---|
165 | The limit on the number of open files per process, OPEN_MAX, is reached.
|
---|
166 | As released, this limit is 20 for MINIX 3, and 30 for Minix-vmd.
|
---|
167 | .en 25 ENOTTY "Not a typewriter
|
---|
168 | The file mentioned in an
|
---|
169 | .B ioctl
|
---|
170 | is not a terminal or one of the
|
---|
171 | devices to which this call applies. (Often seen error from programs with
|
---|
172 | bugs in their error reporting code.)
|
---|
173 | .en 26 ETXTBSY "Text file busy
|
---|
174 | Attempt to execute a program that is open for writing. Obsolete under MINIX 3.
|
---|
175 | .en 27 EFBIG "File too large
|
---|
176 | The size of a file exceeded the maximum (little over 64 megabytes for
|
---|
177 | the V2 file system).
|
---|
178 | .en 28 ENOSPC "No space left on device
|
---|
179 | A
|
---|
180 | .B write
|
---|
181 | to an ordinary file, the creation of a
|
---|
182 | directory or symbolic link, or the creation of a directory
|
---|
183 | entry failed because no more disk blocks are available
|
---|
184 | on the file system, or the allocation of an inode for a newly
|
---|
185 | created file failed because no more inodes are available
|
---|
186 | on the file system.
|
---|
187 | .en 29 ESPIPE "Illegal seek
|
---|
188 | An
|
---|
189 | .B lseek
|
---|
190 | was issued to a pipe or TCP/IP channel.
|
---|
191 | This error may also be issued for
|
---|
192 | other non-seekable devices.
|
---|
193 | .en 30 EROFS "Read-only file system
|
---|
194 | An attempt to modify a file or directory
|
---|
195 | was made
|
---|
196 | on a device mounted read-only.
|
---|
197 | .en 31 EMLINK "Too many links
|
---|
198 | An attempt to make more than a certain number of hard links to a file. The
|
---|
199 | advertized maximum, LINK_MAX, is 127, but Minix-vmd uses a much larger
|
---|
200 | maximum of 32767 for the V2 file system.
|
---|
201 | .en 32 EPIPE "Broken pipe
|
---|
202 | A write on a pipe or TCP/IP channel for which there is no process
|
---|
203 | to read the data.
|
---|
204 | This condition normally generates the signal SIGPIPE;
|
---|
205 | the error is returned if the signal is caught or ignored.
|
---|
206 | .en 33 EDOM "Math argument
|
---|
207 | The argument of a function in the math package
|
---|
208 | is out of the domain of the function.
|
---|
209 | .en 34 ERANGE "Result too large
|
---|
210 | The value of a function in the math package
|
---|
211 | is unrepresentable within machine precision.
|
---|
212 | .en 35 EDEADLK "Resource deadlock avoided
|
---|
213 | A process attempts to place a blocking lock on a file that is already
|
---|
214 | locked by another process and that process is waiting for the first
|
---|
215 | process to unlock a file that first process already has a lock on.
|
---|
216 | (The classic "lock A, lock B" by process 1, and "lock B, lock A" by
|
---|
217 | process 2.)
|
---|
218 | .en 36 ENAMETOOLONG "File name too long"
|
---|
219 | The path name exceeds PATH_MAX characters. PATH_MAX equals 255 as
|
---|
220 | distributed.
|
---|
221 | .en 37 ENOLCK "No locks available
|
---|
222 | The system's table of active locks is full.
|
---|
223 | .en 38 ENOSYS "Function not implemented
|
---|
224 | The system call is not supported. Either an old program uses an obsolete
|
---|
225 | call, or a program for a more capable system is run on a less capable
|
---|
226 | system.
|
---|
227 | .en 39 ENOTEMPTY "Directory not empty"
|
---|
228 | A directory with entries other than \*(lq.\*(rq and \*(lq..\*(rq
|
---|
229 | was supplied to a remove directory or rename call.
|
---|
230 | .en 40 ELOOP "Too many symbolic links"
|
---|
231 | A path name lookup involved more than SYMLOOP symbolic links. SYMLOOP
|
---|
232 | equals 8 as distributed.
|
---|
233 | (Minix-vmd)
|
---|
234 | .en 50 EPACKSIZE "Invalid packet size
|
---|
235 | .en 51 EOUTOFBUFS "Not enough buffers left
|
---|
236 | .en 52 EBADIOCTL "Illegal ioctl for device
|
---|
237 | .en 53 EBADMODE "Bad mode in ioctl
|
---|
238 | .en 54 EWOULDBLOCK "Would block
|
---|
239 | .en 55 EBADDEST "Bad destination address
|
---|
240 | .en 56 EDSTNOTRCH "Destination not reachable
|
---|
241 | .en 57 EISCONN "Already connected
|
---|
242 | .en 58 EADDRINUSE "Address in use
|
---|
243 | .en 59 ECONNREFUSED "Connection refused
|
---|
244 | .en 60 ECONNRESET "Connection reset
|
---|
245 | .en 61 ETIMEDOUT "Connection timed out
|
---|
246 | .en 62 EURG "Urgent data present
|
---|
247 | .en 63 ENOURG "No urgent data present
|
---|
248 | .en 64 ENOTCONN "No connection
|
---|
249 | .en 65 ESHUTDOWN "Already shutdown
|
---|
250 | .en 66 ENOCONN "No such connection
|
---|
251 | .en 67 EINPROGRESS "Operation now in progress
|
---|
252 | .en 68 EALREADY "Operation already in progress
|
---|
253 | .ig
|
---|
254 | .en XXX EDQUOT "Disc quota exceeded"
|
---|
255 | A
|
---|
256 | .B write
|
---|
257 | to an ordinary file, the creation of a
|
---|
258 | directory or symbolic link, or the creation of a directory
|
---|
259 | entry failed because the user's quota of disk blocks was
|
---|
260 | exhausted, or the allocation of an inode for a newly
|
---|
261 | created file failed because the user's quota of inodes
|
---|
262 | was exhausted.
|
---|
263 | .en XXX ESTALE "Stale NFS file handle"
|
---|
264 | A client referenced a an open file, when the file has been deleted.
|
---|
265 | .en XXX EREMOTE "Too many levels of remote in path"
|
---|
266 | An attempt was made to remotely mount a file system into a path which
|
---|
267 | already has a remotely mounted component.
|
---|
268 | ..
|
---|
269 | .SH DEFINITIONS
|
---|
270 | .TP 5
|
---|
271 | Process ID
|
---|
272 | .br
|
---|
273 | Each active process in the system is uniquely identified by a positive
|
---|
274 | integer called a process ID. The range of this ID is from 1 to 29999.
|
---|
275 | The special process with process ID 1 is
|
---|
276 | .BR init ,
|
---|
277 | the ancestor of all processes.
|
---|
278 | .TP 5
|
---|
279 | Parent process ID
|
---|
280 | .br
|
---|
281 | A new process is created by a currently active process; (see
|
---|
282 | .BR fork (2)).
|
---|
283 | The parent process ID of a process is the process ID of its creator,
|
---|
284 | unless the creator dies, then
|
---|
285 | .B init
|
---|
286 | becomes the parent of the orphaned process.
|
---|
287 | .TP 5
|
---|
288 | Process Group ID
|
---|
289 | .br
|
---|
290 | Each active process is a member of a process group that is identified by
|
---|
291 | a positive integer called the process group ID. This is the process
|
---|
292 | ID of the group leader. This grouping permits the signaling of related
|
---|
293 | processes (see
|
---|
294 | .BR kill (2)).
|
---|
295 | .TP 5
|
---|
296 | Real User ID and Real Group ID
|
---|
297 | .br
|
---|
298 | Each user on the system is identified by a positive integer
|
---|
299 | termed the real user ID.
|
---|
300 | .IP
|
---|
301 | Each user is also a member of one or more groups.
|
---|
302 | One of these groups is distinguished from others and
|
---|
303 | used in implementing accounting facilities. The positive
|
---|
304 | integer corresponding to this distinguished group is termed
|
---|
305 | the real group ID.
|
---|
306 | (Under standard MINIX 3 this is the only group a process can be a member of.)
|
---|
307 | .IP
|
---|
308 | All processes have a real user ID and real group ID.
|
---|
309 | These are initialized from the equivalent attributes
|
---|
310 | of the process that created it.
|
---|
311 | .TP 5
|
---|
312 | Effective User Id, Effective Group Id, and Access Groups
|
---|
313 | .br
|
---|
314 | Access to system resources is governed by three values:
|
---|
315 | the effective user ID, the effective group ID, and the
|
---|
316 | group access list.
|
---|
317 | .IP
|
---|
318 | The effective user ID and effective group ID are initially the
|
---|
319 | process's real user ID and real group ID respectively. Either
|
---|
320 | may be modified through execution of a set-user-ID or set-group-ID
|
---|
321 | file (possibly by one its ancestors) (see
|
---|
322 | .BR execve (2)).
|
---|
323 | .IP
|
---|
324 | The group access list is an additional set of group ID's
|
---|
325 | used only in determining resource accessibility. Access checks
|
---|
326 | are performed as described below in ``File Access Permissions''.
|
---|
327 | The maximum number of additional group ID's is NGROUPS_MAX.
|
---|
328 | For MINIX 3 this is 0, but Minix-vmd supports a list of up to 16
|
---|
329 | additional group ID's. (Also known as ``supplemental'' group ID's.)
|
---|
330 | .TP 5
|
---|
331 | Super-user
|
---|
332 | .br
|
---|
333 | A process is recognized as a
|
---|
334 | .I super-user
|
---|
335 | process and is granted special privileges if its effective user ID is 0.
|
---|
336 | .TP 5
|
---|
337 | Descriptor
|
---|
338 | .br
|
---|
339 | An integer assigned by the system when a file or device is referenced
|
---|
340 | by
|
---|
341 | .BR open (2),
|
---|
342 | .BR dup (2)
|
---|
343 | or
|
---|
344 | .BR fcntl (2)
|
---|
345 | which uniquely identifies an access path to that file or device from
|
---|
346 | a given process or any of its children.
|
---|
347 | .TP 5
|
---|
348 | File Descriptor
|
---|
349 | Older, and often used name for a descriptor.
|
---|
350 | .TP 5
|
---|
351 | File Name
|
---|
352 | .br
|
---|
353 | Names consisting of up to NAME_MAX characters may be used to name
|
---|
354 | an ordinary file, special file, or directory. NAME_MAX is the maximum
|
---|
355 | of the maximum file name lengths of the supported file systems.
|
---|
356 | Excess characters are ignored when too long file names are used for
|
---|
357 | files in a given file system.
|
---|
358 | The maximum file name length of the V1 and V2 file systems
|
---|
359 | is 14 characters. The Minix-vmd "flex" variants of V1 and V2 have a
|
---|
360 | 60 character maximum.
|
---|
361 | .IP
|
---|
362 | The characters in a file name may assume any value representable in
|
---|
363 | eight bits excluding 0 (null) and the ASCII code for / (slash).
|
---|
364 | .IP
|
---|
365 | Note that it is generally unwise to use one of \e'"<>();~$^&*|{}[]?
|
---|
366 | as part of file names because of the special meaning attached to these
|
---|
367 | characters by the shell.
|
---|
368 | .TP 5
|
---|
369 | Path Name
|
---|
370 | .br
|
---|
371 | A path name is a null-terminated character string starting with an
|
---|
372 | optional slash (/), followed by zero or more directory names separated
|
---|
373 | by slashes, optionally followed by a file name.
|
---|
374 | The total length of a path name must be less than PATH_MAX characters
|
---|
375 | (255 as distributed.)
|
---|
376 | .IP
|
---|
377 | If a path name begins with a slash, the path search begins at the
|
---|
378 | .I root
|
---|
379 | directory.
|
---|
380 | Otherwise, the search begins from the current working directory.
|
---|
381 | A slash by itself names the root directory. A null pathname is
|
---|
382 | illegal, use "." to refer to the current working directory.
|
---|
383 | .TP 5
|
---|
384 | Directory
|
---|
385 | .br
|
---|
386 | A directory is a special type of file that contains entries
|
---|
387 | that are references to other files.
|
---|
388 | Directory entries are called links. By convention, a directory
|
---|
389 | contains at least two links, . and .., referred to as
|
---|
390 | .I dot
|
---|
391 | and
|
---|
392 | .I dot-dot
|
---|
393 | respectively. Dot refers to the directory itself and
|
---|
394 | dot-dot refers to its parent directory.
|
---|
395 | .TP 5
|
---|
396 | Root Directory and Current Working Directory
|
---|
397 | .br
|
---|
398 | Each process has associated with it a concept of a root directory
|
---|
399 | and a current working directory for the purpose of resolving path
|
---|
400 | name searches. A process's root directory need not be the root
|
---|
401 | directory of the root file system.
|
---|
402 | .TP 5
|
---|
403 | File Access Permissions
|
---|
404 | .br
|
---|
405 | Every file in the file system has a set of access permissions.
|
---|
406 | These permissions are used in determining whether a process
|
---|
407 | may perform a requested operation on the file (such as opening
|
---|
408 | a file for writing). Access permissions are established at the
|
---|
409 | time a file is created. They may be changed at some later time
|
---|
410 | through the
|
---|
411 | .BR chmod (2)
|
---|
412 | call.
|
---|
413 | .IP
|
---|
414 | File access is broken down according to whether a file may be: read,
|
---|
415 | written, or executed. Directory files use the execute
|
---|
416 | permission to control if the directory may be searched.
|
---|
417 | .IP
|
---|
418 | File access permissions are interpreted by the system as
|
---|
419 | they apply to three different classes of users: the owner
|
---|
420 | of the file, those users in the file's group, anyone else.
|
---|
421 | Every file has an independent set of access permissions for
|
---|
422 | each of these classes. When an access check is made, the system
|
---|
423 | decides if permission should be granted by checking the access
|
---|
424 | information applicable to the caller.
|
---|
425 | .IP
|
---|
426 | Read, write, and execute/search permissions on
|
---|
427 | a file are granted to a process if:
|
---|
428 | .IP
|
---|
429 | The process's effective user ID is that of the super-user.
|
---|
430 | .IP
|
---|
431 | The process's effective user ID matches the user ID of the owner
|
---|
432 | of the file and the owner permissions allow the access.
|
---|
433 | .IP
|
---|
434 | The process's effective user ID does not match the user ID of the
|
---|
435 | owner of the file, and either the process's effective
|
---|
436 | group ID matches the group ID
|
---|
437 | of the file, or the group ID of the file is in
|
---|
438 | the process's group access list,
|
---|
439 | and the group permissions allow the access.
|
---|
440 | .IP
|
---|
441 | Neither the effective user ID nor effective group ID
|
---|
442 | and group access list of the process
|
---|
443 | match the corresponding user ID and group ID of the file,
|
---|
444 | but the permissions for ``other users'' allow access.
|
---|
445 | .IP
|
---|
446 | Otherwise, permission is denied.
|
---|
447 | .SH SEE ALSO
|
---|
448 | .BR intro (3),
|
---|
449 | .BR strerror (3).
|
---|