fix possible overflow in blocking detection, and reindent
[aversive.git] / include / aversive / errno.h
1 /*  
2  *  Copyright Droids Corporation, Microb Technology, Eirbot (2005)
3  * 
4  *  This program is free software; you can redistribute it and/or modify
5  *  it under the terms of the GNU General Public License as published by
6  *  the Free Software Foundation; either version 2 of the License, or
7  *  (at your option) any later version.
8  *
9  *  This program is distributed in the hope that it will be useful,
10  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
11  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12  *  GNU General Public License for more details.
13  *
14  *  You should have received a copy of the GNU General Public License
15  *  along with this program; if not, write to the Free Software
16  *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
17  *
18  *  Revision : $Id: errno.h,v 1.1.2.2 2009-01-23 23:05:39 zer0 Exp $
19  *
20  */
21
22 /* This file contains general errors that can be returned from functions 
23  * We have to be carreful and try to return these error as often as possible
24  * isntead of a function-specific value 
25  */
26
27 #ifndef _AVERSIVE_ERRNO_H_
28 #define _AVERSIVE_ERRNO_H_
29
30 /** No error */
31 #define ESUCCESS 0
32
33 #ifndef HOST_VERSION
34
35 /* from avr-libc, does not define a lots of errors */
36 #include <errno.h>
37
38 /** Operation not permitted */
39 #define EPERM    1
40 /** No such file or directory */
41 #define ENOENT   2
42 /** I/O error */
43 #define EIO      5
44 /** No such device or address */
45 #define ENXIO    6
46 /** Argument list too long */
47 #define E2BIG    7
48 /** Try again */
49 #define EAGAIN   11
50 /** Out of memory */
51 #define ENOMEM   12
52 /** Bad address */
53 #define EFAULT   14
54 /** Device or resource busy */
55 #define EBUSY    16
56 /** Invalid argument */
57 #define EINVAL   22
58 /** Domain error */
59 /* #define EDOM       33 */ /* in libc */
60 /** Range error */
61 /* #define ERANGE     34 */ /* in libc */
62 /** Not supported */
63 #define ENOTSUP  126 /* the correct number is 128 */
64 /** Unkwow error */
65 #define EUNKNOW  127
66
67 /* must not be > 127 because it can be stored on an int8_t */
68
69 #else /* HOST_VERSION */
70 #include <sys/errno.h>
71
72 #endif /* HOST_VERSION */
73
74 #endif /* AVERSIVE_ERRNO_H_ */