home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Fresh Fish 8
/
FreshFishVol8-CD1.bin
/
gnu
/
man
/
cat2
/
intro.0
< prev
next >
Wrap
Text File
|
1993-12-07
|
27KB
|
529 lines
INTRO(2) UNIX Programmer's Manual INTRO(2)
NNAAMMEE
iinnttrroo - introduction to system calls and error numbers
SSYYNNOOPPSSIISS
##iinncclluuddee <<ssyyss//eerrrrnnoo..hh>>
DDEESSCCRRIIPPTTIIOONN
This section provides an overview of the system calls, their error re
turns, and other common definitions and concepts.
DDIIAAGGNNOOSSTTIICCSS
Nearly all of the system calls provide an error number in the external
variable _e_r_r_n_o, which is defined as:
extern int errno
When a system call detects an error, it returns an integer value indicat
ing failure (usually 1) and sets the variable _e_r_r_n_o accordingly. <This
allows interpretation of the failure on receiving a 1 and to take action
accordingly.> Successful calls never set _e_r_r_n_o; once set, it remains un
til another error occurs. It should only be examined after an error.
Note that a number of system calls overload the meanings of these error
numbers, and that the meanings must be interpreted according to the type
and circumstances of the call.
The following is a complete list of the errors and their names as given
in <_s_y_s_/_e_r_r_n_o_._h>.
0 _E_r_r_o_r _0. Not used.
1 EPERM _O_p_e_r_a_t_i_o_n _n_o_t _p_e_r_m_i_t_t_e_d _. An attempt was made to perform an oper
ation limited to processes with appropriate privileges or to the
owner of a file or other resources.
2 ENOENT _N_o _s_u_c_h _f_i_l_e _o_r _d_i_r_e_c_t_o_r_y. A component of a specified pathname
did not exist, or the pathname was an empty string.
3 ESRCH _N_o _s_u_c_h _p_r_o_c_e_s_s. No process could be found corresponding to that
specified by the given process ID.
4 EINTR _I_n_t_e_r_r_u_p_t_e_d _f_u_n_c_t_i_o_n _c_a_l_l. An asynchronous signal (such as SIGINT
or SIGQUIT) was caught by the process during the execution of an
interruptible function. If the signal handler performs a normal
return, the interupted function call will seem to have returned
the error condition.
5 EIO _I_n_p_u_t_/_o_u_t_p_u_t _e_r_r_o_r. Some physical input or output error occurred.
This error not be reported until a subsequent operation on the
same file descriptor and may be lost (over written) by any subse
quent errors.
6 ENXIO _N_o _s_u_c_h _d_e_v_i_c_e _o_r _a_d_d_r_e_s_s. Input or output on a special file re
ferred to a device that did not exist, or made a request beyond
the limits of the device. This error may also occur when, for
example, a tape drive is not online or no disk pack is is loaded
on a drive.
7 E2BIG _A_r_g _l_i_s_t _t_o_o _l_o_n_g. The number of bytes used for the argument and
environment list of the new process exceeded the current limit of
20480 bytes (NCARGS in <_s_y_s_/_p_a_r_a_m_._h>).
8 ENOEXEC _E_x_e_c _f_o_r_m_a_t _e_r_r_o_r. A request was made to execute a file that,
although it has the appropriate permissions, was not in the for
mat required for an executable file.
9 EBADF _B_a_d _f_i_l_e _d_e_s_c_r_i_p_t_o_r. A file descriptor argument was out of range,
referred to no open file, or a read (write) request was made to a
file that was only open for writing (reading).
10 ECHILD _N_o _c_h_i_l_d _p_r_o_c_e_s_s_e_s. A wait or waitpid function was executed by
a process that had no existing or unwaitedfor child processes.
11 EDEADLK _R_e_s_o_u_r_c_e _d_e_a_d_l_o_c_k _a_v_o_i_d_e_d. An attempt was made to lock a sys
tem resource that would have resulted in a deadlock situation.
12 ENOMEM _C_a_n_n_n_o_t _a_l_l_o_c_a_t_e _m_e_m_o_r_y. The new process image required more
memory than was allowed by the hardware or by systemimposed mem
ory management constraints. A lack of swap space is normally
temporary; however, a lack of core is not. Soft limits may be
increased to their corresponding hard limits.
13 EACCES _P_e_r_m_i_s_s_i_o_n _d_e_n_i_e_d. An attempt was made to access a file in a
way forbidden by its file access permissions.
14 EFAULT _B_a_d _a_d_d_r_e_s_s. The system detected an invalid address in attempt
ing to use an argument of a call.
15 ENOTBLK _N_o_t _a _b_l_o_c_k _d_e_v_i_c_e. A block device operation was attempted on
a nonblock device or file.
16 EBUSY _R_e_s_o_u_r_c_e _b_u_s_y. An attempt to use a system resource which was in
use at the time in a manner which would have conflicted with the
request.
17 EEXIST _F_i_l_e _e_x_i_s_t_s. An existing file was mentioned in an inappropriate
context, for instance, as the new link name in a link function.
18 EXDEV _I_m_p_r_o_p_e_r _l_i_n_k. A hard link to a file on another file system was
attempted.
19 ENODEV _O_p_e_r_a_t_i_o_n _n_o_t _s_u_p_p_o_r_t_e_d _b_y _d_e_v_i_c_e. An attempt was made to apply
an inappropriate function to a device, for example, trying to
read a writeonly device such as a printer.
20 ENOTDIR _N_o_t _a _d_i_r_e_c_t_o_r_y. A component of the specified pathname exist
ed, but it was not a directory, when a directory was expected.
21 EISDIR _I_s _a _d_i_r_e_c_t_o_r_y. An attempt was made to open a directory with
write mode specified.
22 EINVAL _I_n_v_a_l_i_d _a_r_g_u_m_e_n_t. Some invalid argument was supplied. (For ex
ample, specifying an undefined signal to a signal or kill func
tion).
23 ENFILE _T_o_o _m_a_n_y _o_p_e_n _f_i_l_e_s _i_n _s_y_s_t_e_m. Maximum number of file descrip
tors allowable on the system has been reached and a requests for
an open cannot be satisfied until at least one has been closed.
24 EMFILE _T_o_o _m_a_n_y _o_p_e_n _f_i_l_e_s. <As released, the limit on the number of
open files per process is 64.> Getdtablesize(2) will obtain the
current limit.
25 ENOTTY _I_n_a_p_p_r_o_p_r_i_a_t_e _i_o_c_t_l _f_o_r _d_e_v_i_c_e. A control function (see
ioctl(2)) was attempted for a file or special device for which
the operation was inappropriate.
26 ETXTBSY _T_e_x_t _f_i_l_e _b_u_s_y. The new process was a pure procedure (shared
text) file which was open for writing by another process, or the
pure procedure file was being executed an open call requested
write access.
27 EFBIG _F_i_l_e _t_o_o _l_a_r_g_e. The size of a file exceeded the maximum (about
2.1E9 bytes).
28 ENOSPC _D_e_v_i_c_e _o_u_t _o_f _s_p_a_c_e. A write to an ordinary file, the creation
of a directory or symbolic link, or the creation of a directory
entry failed because no more disk blocks are available on the
file system, or the allocation of an inode for a newly created
file failed because no more inodes are available on the file sys
tem.
29 ESPIPE _I_l_l_e_g_a_l _s_e_e_k. An lseek function was issued on a socket, pipe or
FIFO.
30 EROFS _R_e_a_d__o_n_l_y _f_i_l_e _s_y_s_t_e_m. An attempt was made to modify a file or
direc