Finito con wait & C (spero).
[gapil.git] / errors.tex
1 \chapter{I codici di errore}
2 \label{cha:errors}
3
4 Si riportano in questa appendice tutti i codici di errore. Essi sono
5 accessibili attraverso l'inclusione del file di header \file{errno.h}, che
6 definisce anche la variabile globale \var{errno}. Per ogni errore definito
7 riporteremo la stringa stampata da \func{perror} ed una breve spiegazione. Si
8 tenga presente che spiegazioni più particolareggiate, qualora necessarie per
9 il caso specifico, possono essere trovate nella descrizione del prototipo
10 della funzione.
11
12 I codici di errore sono riportati come costanti di tipo \type{int}, i valori
13 delle costanti sono definiti da macro di preprocessore nel file citato, e
14 possono variare da architettura a architettura; è pertanto necessario
15 riferirsi ad essi tramite i nomi simbolici. Le funzioni \func{perror} e
16 \func{strerror} (vedi \secref{sec:intro_strerror}) possono essere usate per
17 ottenere dei messaggi di errore più espliciti.
18
19
20 \section{Gli errori dei file}
21 \label{sec:err_file_errors}
22
23 In questa sezione riassumeremo gli errori restituiti dalle funzioni di
24 libreria che operano sui file.
25
26 \begin{description}
27   
28 \item \macro{EPERM} \textit{Operation not permitted}. L'operazione non è
29   permessa: solo il proprietario del file o un processo con sufficienti
30   privilegi può eseguire l'operazione.
31 \item \macro{ENOENT} \textit{No such file or directory}. Il file indicato dal
32   pathname non esiste: o una delle componenti non esiste o il pathname
33   contiene un link simbolico spezzato. Errore tipico di un riferimento ad un
34   file che si suppone erroneamente essere esistente.
35 \item \macro{EIO} \textit{Input/output error}. Errore di input/output: usato
36   per riportare errori hardware in lettura/scrittura su un dispositivo.
37 \item \macro{ENXIO} \textit{No such device or address}. Device inesistente: il
38   sistema ha tentato di usare un dispositivo attraverso il file specificato,
39   ma non lo ha trovato. Può significare che il file di dispositivo non è
40   corretto, che il modulo relativo non è stato caricato nel kernel, o che il
41   dispositivo è fisicamente assente o non funzionante.
42 \item \macro{ENOEXEC} \textit{Invalid executable file format}. Il file non ha
43   un formato eseguibile, è un errore riscontrato dalle funzioni \func{exec}.
44 \item \macro{EBADF} \textit{Bad file descriptor}. File descriptor non valido:
45   si è usato un file descriptor inesistente, o aperto in sola lettura per
46   scrivere, o viceversa, o si è cercato di eseguire un'operazione non
47   consentita per quel tipo di file descriptor.
48 \item \macro{EACCESS} \textit{Permission denied}. Permesso negato; l'accesso
49   al file non è consentito: i permessi del file o della directory non
50   consentono l'operazione.
51 \item \macro{ELOOP} \textit{Too many symbolic links encountered}. Ci sono
52   troppi link simbolici nella risoluzione di un pathname.  
53 \item \macro{ENAMETOOLONG} \textit{File name too long}. Si è indicato un
54   pathname troppo lungo.
55 \item \macro{ENOTBLK} \textit{Block device required}. Si è specificato un file
56   che non è un \textit{block device} in un contesto in cui era necessario
57   specificare un \textit{block device} (ad esempio si è tentato di montare un
58   file ordinario).
59 \item \macro{EEXIST} \textit{File exists}. Si è specficato un file esistente
60   in un constesto in cui ha senso solo specificare un nuovo file.
61 \item \macro{EBUSY} \textit{Resource busy}. Una risorsa di sistema che non può
62   essere condivisa è occupata. Ad esempio si è tentato di cancellare la
63   directory su cui si è montato un filesistem. 
64 \item \macro{EXDEV} \textit{Cross-device link}. Si è tentato di creare un link
65   diretto che attraversa due filesystem differenti.
66 \item \macro{ENODEV} \textit{No such device}. Si è indicato un tipo di device
67   sbagliato ad una funzione che ne richiede uno specifico.
68 \item \macro{ENOTDIR} \textit{Not a directory}. Si è specificato un file che
69   non è una directory in una operazione che richiede una directory.
70 \item \macro{EISDIR} \textit{Is a directory}. Il file specificato è una
71   directory, non può essere aperto in scrittura, né si possono creare o
72   rimuovere link diretti ad essa.
73 \item \macro{EMFILE} \textit{Too many open files}. Il processo corrente ha
74   troppi file aperti e non può aprirne altri. Anche i descrittori duplicati
75   vengono tenuti in conto\footnote{Il numero massimo di file aperti è
76     controllabile dal sistema, in Linux si può usare il comando \cmd{ulimit}}.
77 \item \macro{ENFILE} \textit{File table overflow}. Ci sono troppi file aperti
78   nel sistema. 
79 \item \macro{ENOTTY} \textit{Not a terminal}. Si è tentata una operazione di
80   controllo relativa ad un terminale su un file che non lo è.
81 \item \macro{ETXTBSY} \textit{Text file busy}. Si è cercato di eseguire un
82   file che è aperto in scrittura, o scrivere un file che è in esecuzione. 
83 \item \macro{EFBIG} \textit{File too big}. Si è ecceduto il limite imposto dal
84   sistema sulla dimensione massima che un file può avere.
85 \item \macro{ENOSPC} \textit{No space left on device}. la directory in cui si
86   vuole creare il link non ha spazio per ulteriori voci.
87 \item \macro{ESPIPE} \textit{Invalid seek operation}. 
88 \item \macro{EROFS} \textit{Read-only file system}.  il file risiede su un filesystem read-only.
89 \item \macro{EMLINK} \textit{Too many links}. Ci sono troppi link al file (il
90    numero massimo è specificato dalla variabile \macro{LINK\_MAX}, vedi
91   \secref{sec:xxx_limits}).
92 \item \macro{EPIPE} \textit{Broken pipe}. 
93
94
95
96 \section{Gli errori dei processi}
97 \label{sec:err_proc_errors}
98
99 In questa sezione riassumeremo gli errori restituiti dalle funzioni di
100 libreria che operano sui processi.
101
102 \begin{description}
103
104 \item \macro{ESRCH} \textit{No process matches the specified process ID}. Non
105   esiste un processo con il \acr{pid} specificato.
106 \item \macro{EINTR} \textit{Interrupted function call}. Una funzione di
107   libreria è stata interrotta. In genere questo avviene causa di un segnale
108   asincrono al processo che impedisce la conclusione della chiamata. In questo
109   caso è necessario ripetere la chiamata alla funzione. 
110 \item \macro{E2BIG} \textit{Argument list too long}. Lista degli argomenti
111   troppo lunga: è una condizione prevista da POSIX quando la lista degli
112   argomenti passata ad una delle funzioni \func{exec} occupa troppa memoria,
113   non può mai accadere in GNU/Linux.
114 \item \macro{ECHILD} \textit{There are no child processes}. Non esiste un
115   processo figlio. Viene rilevato dalle funzioni per la gestione dei processi
116   figli. 
117
118
119 \section{Gli errori di rete}
120 \label{sec:err_network}
121
122
123 \item \macro{EDOM} \textit{Domain error}. 
124 \item \macro{ERANGE} \textit{Range error}. 
125 \item \macro{EAGAIN} \textit{Resource temporarily unavailable}. 
126 \item \macro{EWOULDBLOCK} \textit{Operation would block}. In Linux è identico
127   a \macro{EAGAIN}.
128 \item \macro{EINPROGRESS} \textit{Operation now in progress}. 
129 \item \macro{EALREADY} \textit{Operation already in progress}. 
130 \item \macro{ENOTSOCK} \textit{Socket operation on non-socket}. 
131 \item \macro{EMSGSIZE} \textit{Message too long}. 
132 \item \macro{EPROTOTYPE} \textit{Protocol wrong type for socket}. 
133 \item \macro{ENOPROTOOPT} \textit{Protocol not available}. 
134 \item \macro{EPROTONOSUPPORT} \textit{Protocol not supported}. 
135 \item \macro{ESOCKTNOSUPPORT} \textit{Socket type not supported}. 
136 \item \macro{EOPNOTSUPP} \textit{Operation not supported on transport endpoint}. 
137 \item \macro{EPFNOSUPPORT} \textit{Protocol family not supported}. 
138 \item \macro{EAFNOSUPPORT} \textit{Address family not supported by protocol}. 
139 \item \macro{EADDRINUSE} \textit{Address already in use}. 
140 \item \macro{EADDRNOTAVAIL} \textit{Cannot assign requested address}. 
141 \item \macro{ENETDOWN} \textit{Network is down}. 
142 \item \macro{ENETUNREACH} \textit{Network is unreachable}. 
143 \item \macro{ENETRESET} \textit{Network dropped connection because of reset}. 
144 \item \macro{ECONNABORTED} \textit{Software caused connection abort}. 
145 \item \macro{ECONNRESET} \textit{Connection reset by peer}. 
146 \item \macro{ENOBUFS} \textit{No buffer space available}. 
147 \item \macro{EISCONN} \textit{Transport endpoint is already connected}. 
148 \item \macro{ENOTCONN} \textit{Transport endpoint is not connected}. 
149 \item \macro{EDESTADDRREQ} \textit{Destination address required}. 
150 \item \macro{ESHUTDOWN} \textit{Cannot send after transport endpoint shutdown}. 
151 \item \macro{ETOOMANYREFS} \textit{Too many references: cannot splice}. 
152 \item \macro{ETIMEDOUT} \textit{Connection timed out}. 
153 \item \macro{ECONNREFUSED} \textit{Connection refused}. 
154   
155 \item \macro{EHOSTDOWN} \textit{Host is down}. 
156 \item \macro{EHOSTUNREACH} \textit{No route to host}. 
157 \item \macro{ENOTEMPTY} \textit{Directory not empty}. 
158 \item \macro{EPROCLIM} \textit{}. 
159 \item \macro{EUSERS} \textit{Too many users}. 
160 \item \macro{EDQUOT} \textit{Quota exceeded}. 
161 \item \macro{ESTALE} \textit{Stale NFS file handle}. 
162 \item \macro{EREMOTE} \textit{Object is remote}. 
163 %\item \macro{EBADRPC} \textit{}. 
164 %\item \macro{ERPCMISMATCH} \textit{}. 
165 %\item \macro{EPROGUNAVAIL} \textit{}. 
166 %\item \macro{EPROGMISMATCH} \textit{}. 
167 %\item \macro{EPROCUNAVAIL} \textit{}. 
168 \item \macro{ENOLCK} \textit{No locks available}. 
169 \item \macro{EFTYPE} \textit{Inappropriate file type or format}. 
170 %\item \macro{EAUTH} \textit{}. 
171 \item \macro{ENEEDAUTH} \textit{}. 
172 \item \macro{ENOSYS} \textit{Function not implemented}. 
173 \item \macro{ENOTSUP} \textit{Not supported}. 
174 \item \macro{EILSEQ} \textit{Illegal byte sequence}. 
175 %\item \macro{EBACKGROUND} \textit{}. 
176 %\item \macro{EDIED} \textit{}. 
177 %\item \macro{ED} \textit{}. 
178 %\item \macro{EGREGIOUS} \textit{}. 
179 %\item \macro{EIEIO} \textit{}. 
180 %\item \macro{EGRATUITOUS} \textit{}. 
181 \item \macro{EBADMSG} \textit{Not a data message}. 
182 \item \macro{EIDRM} \textit{Identifier removed}. 
183 \item \macro{EMULTIHOP} \textit{Multihop attempted}. 
184 \item \macro{ENODATA} \textit{No data available}. 
185 \item \macro{ENOLINK} \textit{Link has been severed}. 
186 \item \macro{ENOMSG} \textit{No message of desired type}. 
187 \item \macro{ENOSR} \textit{Out of streams resources}. 
188 \item \macro{ENOSTR} \textit{Device not a stream}. 
189 \item \macro{EOVERFLOW} \textit{Value too large for defined data type}. 
190 \item \macro{EPROTO} \textit{Protocol error}. 
191 \item \macro{ETIME} \textit{Timer expired}. 
192
193
194 \section{Errori del kernel}
195 \label{sec:err_kernel_err}
196
197 \item \macro{ERESTART} \textit{Interrupted system call should be restarted}. 
198 \item \macro{ECHRNG} \textit{Channel number out of range}. 
199 \item \macro{EL2NSYNC} \textit{Level 2 not synchronized}. 
200 \item \macro{EL3HLT} \textit{Level 3 halted}. 
201 \item \macro{EL3RST} \textit{Level 3 reset}. 
202 \item \macro{ELNRNG} \textit{Link number out of range}. 
203 \item \macro{EUNATCH} \textit{Protocol driver not attached}. 
204 \item \macro{ENOCSI} \textit{No CSI structure available}. 
205 \item \macro{EL2HLT} \textit{Level 2 halted}. 
206 \item \macro{EBADE} \textit{Invalid exchange}. 
207 \item \macro{EBADR} \textit{Invalid request descriptor}. 
208 \item \macro{EXFULL} \textit{Exchange full}. 
209 \item \macro{ENOANO} \textit{No anode}. 
210 \item \macro{EBADRQC} \textit{Invalid request code}. 
211 \item \macro{EBADSLT} \textit{Invalid slot}. 
212 \item \macro{EDEADLOCK} Identico a \macro{EDEADLK}. 
213 \item \macro{EBFONT} \textit{Bad font file format}. 
214 \item \macro{ENONET} \textit{Machine is not on the network}. 
215 \item \macro{ENOPKG} \textit{Package not installed}. 
216 \item \macro{EADV} \textit{Advertise error}. 
217 \item \macro{ESRMNT} \textit{Srmount error}. 
218 \item \macro{ECOMM} \textit{Communication error on send}. 
219 \item \macro{EDOTDOT} \textit{RFS specific error}. 
220 \item \macro{ENOTUNIQ} \textit{Name not unique on network}. 
221 \item \macro{EBADFD} \textit{File descriptor in bad state}. 
222 \item \macro{EREMCHG} \textit{Remote address changed}. 
223 \item \macro{ELIBACC} \textit{Can not access a needed shared library}. 
224 \item \macro{ELIBBAD} \textit{Accessing a corrupted shared library}. 
225 \item \macro{ELIBSCN} \textit{.lib section in a.out corrupted}. 
226 \item \macro{ELIBMAX} \textit{Attempting to link in too many shared libraries}. 
227 \item \macro{ELIBEXEC} \textit{Cannot exec a shared library directly}. 
228 \item \macro{ESTRPIPE} \textit{Streams pipe error}. 
229 \item \macro{EUCLEAN} \textit{Structure needs cleaning}. 
230 \item \macro{ENAVAIL} \textit{No XENIX semaphores available}. 
231 \item \macro{EISNAM} \textit{Is a named type file}. 
232 \item \macro{EREMOTEIO} \textit{Remote I/O error}. 
233 \item \macro{ENOMEDIUM} \textit{No medium found}. 
234 \item \macro{EMEDIUMTYPE} \textit{Wrong medium type}. 
235 \item \macro{} \textit{}. 
236
237
238 \end{description}
239
240
241
242 \section{Altri errori}
243 \label{sec:err_others}
244
245 \item \macro{ENOMEM} \textit{No memory available}. Il kernel non è in grado di
246   allocare ulteriore memoria per completare l'operazione richiesta.
247 \item \macro{EDEADLK} \textit{Deadlock avoided}. L'allocazione di una risorsa
248   avrebbe causato un deadlock. Non sempre il sistema è in grado di riconoscere
249   queste situazioni, nel qual caso si avrebbe in blocco. 
250 \item \macro{EFAULT} \textit{Bad address}. Una stringa passata come parametro
251   è fuori dello spazio di indirizzi del processo, in genere questa situazione
252   provoca l'emissione di un sengale di \textit{segment violation}
253   (\macro{SIGSEGV}).
254 \item \macro{EINVAL} \textit{Invalid argument}. Errore utilizzato per
255   segnalare vari tipi di problemi dovuti all'aver passato un argomento
256   sbagliato ad una funzione di libreria.
257
258
259
260
261 \end{description}
262
263