source: trunk/minix/man/man2/intro.2@ 9

Last change on this file since 9 was 9, checked in by Mattia Monga, 13 years ago

Minix 3.1.2a

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