The manual
ginnOS
The reference: libc, the libraries and the kernel
Toggle main menu visibility
Loading...
Searching...
No Matches
errno.h
Go to the documentation of this file.
1
#pragma once
2
3
/**
4
* posix-compatible errno constants for ginnOS userspace. the numbers are
5
* ABI: src/kernel/errno.h has the same ones.
6
*
7
* syscalls return negative errno values on failure. the libc wrappers
8
* extract the error, store it in errno (one for each thread), and return -1
9
* (or NULL, etc.) to the caller.
10
*/
11
12
#define ENOSYS 1
/* function not implemented */
13
#define EBADF 2
/* bad file descriptor */
14
#define EINVAL 3
/* invalid argument */
15
#define ENOMEM 4
/* not enough memory */
16
#define ENOENT 5
/* no such file or directory */
17
#define EACCES 6
/* permission denied */
18
#define EPIPE 7
/* broken pipe */
19
#define ESPIPE 8
/* invalid seek */
20
#define EEXIST 9
/* file exists */
21
#define EISDIR 10
/* is a directory */
22
#define ENOTDIR 11
/* not a directory */
23
#define EMFILE 12
/* too many open files */
24
#define ENFILE 13
/* too many open files in system */
25
#define EIO 14
/* i/o error */
26
#define ENOSPC 15
/* no space left on device */
27
#define EBUSY 16
/* resource busy */
28
#define ERANGE 17
/* result too large */
29
#define EFAULT 18
/* bad address */
30
#define ESRCH 19
/* no such process */
31
#define ECHILD 20
/* no child processes */
32
#define ENOBUFS 21
/* no buffer space available */
33
#define ENOTTY 22
/* inappropriate ioctl for device */
34
#define ENODEV 23
/* no such device */
35
#define EINTR 24
/* interrupted system call */
36
#define EAGAIN 25
/* resource temporarily unavailable */
37
#define E2BIG 26
/* argument list too long */
38
#define ENOEXEC 27
/* exec format error */
39
#define ENOTEMPTY 28
/* directory not empty */
40
#define EXDEV 29
/* cross-device link */
41
#define ENAMETOOLONG 30
/* file name too long */
42
#define EPERM 31
/* operation not permitted */
43
#define ELOOP 32
/* too many levels of symbolic links */
44
#define EROFS 33
/* read-only file system */
45
#define ETIMEDOUT 34
/* timed out */
46
#define ENOTSOCK 35
/* not a socket */
47
#define EADDRINUSE 36
/* address in use */
48
#define ECONNREFUSED 37
/* connection refused */
49
#define EISCONN 38
/* already connected */
50
#define ENOTCONN 39
/* not connected */
51
#define EAFNOSUPPORT 40
/* address family not supported */
52
#define EPROTONOSUPPORT 41
/* protocol not supported */
53
#define EOPNOTSUPP 42
/* operation not supported */
54
#define ECANCELED 43
/* operation cancelled (by the program, not the kernel) */
55
#define EILSEQ 44
/* bytes that are not a character (UTF-8), from the libc */
56
#define EMLINK 45
/* too many links to a file */
57
#define EFBIG 46
/* a file would be too large */
58
#define ENOLCK 47
/* no locks left */
59
#define ENXIO 48
/* no such device or address */
60
#define EDEADLK 49
/* the lock would never be free (pthreads, from the libc) */
61
#define EOVERFLOW 50
/* a value would be too large for its type */
62
#define EADDRNOTAVAIL 51
/* address not available */
63
#define EDESTADDRREQ 52
/* destination address required */
64
#define EMSGSIZE 53
/* message too long */
65
#define ENETUNREACH 54
/* network unreachable */
66
#define EHOSTUNREACH 55
/* host unreachable */
67
#define ENOPROTOOPT 56
/* protocol not available */
68
#define EPROTOTYPE 57
/* wrong protocol type for socket */
69
#define ECONNRESET 58
/* connection reset by peer */
70
#define ECONNABORTED 59
/* connection aborted */
71
#define EINPROGRESS 60
/* operation in progress */
72
#define EALREADY 61
/* operation already in progress */
73
#define ENETDOWN 62
/* network is down */
74
#define EPROTO 63
/* protocol error */
75
76
#define ENOTSUP EOPNOTSUPP
77
78
#define EWOULDBLOCK EAGAIN
79
80
/**
81
* the calling thread's errno. each thread has its own (thread-local
82
* storage), as the functions of one thread must not see the errors of
83
* another.
84
* @return the address of the errno of the calling thread.
85
*/
86
int
*
__errno_location
(
void
);
87
88
/* the error of the last failed call in this thread, set by the libc */
89
#define errno (*__errno_location())
90
91
/**
92
* print a message followed by the string for the current errno.
93
* @param s prefix string (may be NULL).
94
*/
95
void
perror
(
const
char
*s);
96
97
/**
98
* return a string describing the given error number.
99
* @param errnum error number (one of the E* constants above).
100
* @return pointer to a static string.
101
*/
102
const
char
*
strerror
(
int
errnum);
strerror
const char * strerror(int errnum)
return a string describing the given error number.
__errno_location
int * __errno_location(void)
the calling thread's errno.
perror
void perror(const char *s)
print a message followed by the string for the current errno.
src
libc
include
errno.h
Generated by
1.18.0