blob: 390c46376eeba0c6d00344b93c846610af52f503 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
|
/**
* slibc — Yet another C library
* Copyright © 2015 Mattias Andrée (maandree@member.fsf.org)
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef _ERRNO_H
#define _ERRNO_H
#include <slibc/version.h>
#include <slibc/features.h>
/* TODO include error definitions */
#define ENOMEM 1
#define EINVAL 1
#define ERANGE 1
#define ENOENT 1
#define EBADF 1
#define ENOSYS 1
#define ELOOP 1
#define EISDIR 1
#define EACCES 1
#define ENOTSUP 1
/**
* A modifiable lvalue used to describe an error
* that has occurred in the thread.
*/
#define errno (*__errno())
/**
* Helper definition to `errno` used to
* assured that the value is thread-dependent
* and supported on all revisions of C.
*/
volatile int* __errno(void) /* TODO not implemented */
__GCC_ONLY(__attribute__((__const__)));
/**
* This is the name that was used to invoke the program
* running in the current process. This is the value
* of `argv[0]` from the `main` function (where `argv`
* is the second parameter). If `argc` is zero, this
* variable will have the value `NULL`. This is not
* necessarily a proper command name. For example,
* login shells are usually prefixes with a dash,
* for example "-bash", despite that there is no such
* command. Often, but not always, this will not contain
* directory.
*
* This string may be edited if `program_invocation_short_name`
* or `argv[0]` is edited.
*
* This is a GNU and slibc extension.
*/
#if defined(__GNU_SOURCE) || defined(__SLIBC_SOURCE)
extern char* program_invocation_name; /* TODO not implemented */
#endif
/**
* Variant of `program_invocation_name` that is
* guaranteed to not include the directory.
*
* This string may be edited if `program_invocation_name`
* or `argv[0]` is edited.
*
* This is a GNU extension.
*/
#if defined(__GNU_SOURCE)
extern char* program_invocation_short_name; /* TODO not implemented */
#endif
#endif
|