summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorKacper <kacper@mail.openlinux.dev>2025-12-07 22:22:16 +0100
committerKacper <kacper@mail.openlinux.dev>2025-12-07 22:22:16 +0100
commit8f9e448b2ef6db7cd905540c21f3c5b190e7a1e7 (patch)
treeae0285dd15042d1e9236a5ce2e60daf65acbdca0 /include
parentfc00c656c96528112d05cf0edf8631bd5eaea446 (diff)
Add bin/true and bin/false implementations
- Added assembly implementations for `true` and `false` commands. - Updated Kbuild files to include new binaries. - Removed unused libraries and headers. - Cleaned up makefile and unused code.
Diffstat (limited to 'include')
-rw-r--r--include/assert.h21
-rw-r--r--include/bits/errno.h12
-rw-r--r--include/bits/sigevent.h2
-rw-r--r--include/bits/timespec.h2
-rw-r--r--include/bits/wait.h22
-rw-r--r--include/fnmatch.h4
-rw-r--r--include/monetary.h11
-rw-r--r--include/net/if.h4
-rw-r--r--include/stdbool.h4
-rw-r--r--include/stdckdint.h8
-rw-r--r--include/stddef.h3
-rw-r--r--include/stdint.h4
-rw-r--r--include/stdio.h3
-rw-r--r--include/stdlib.h23
-rw-r--r--include/string.h7
-rw-r--r--include/sys/wait.h21
-rw-r--r--include/time.h5
-rw-r--r--include/wchar.h112
-rw-r--r--include/wctype.h49
19 files changed, 84 insertions, 233 deletions
diff --git a/include/assert.h b/include/assert.h
index f69aa43d..56d7d1e2 100644
--- a/include/assert.h
+++ b/include/assert.h
@@ -5,27 +5,6 @@
#define assert(ignore) ((void)0)
#else
-/**
- * @def assert(expr)
- * @brief Macro to perform runtime assertions.
- *
- * The assert() macro shall insert diagnostics into programs; it shall expand to
- * a void expression. When it is executed, if expression (which shall have a
- * scalar type) is false (that is, compares equal to 0), assert() shall write
- * information about the particular call that failed on stderr and shall call
- * abort(). The information written about the call that failed shall include the
- * text of the argument, the name of the source file, the source file line
- * number, and the name of the enclosing function; the latter are, respectively,
- * the values of the preprocessing * macros __FILE__ and __LINE__ and of the
- * identifier __func__. Forcing a definition of the name NDEBUG, either from the
- * compiler command line or with the preprocessor control statement #define
- * NDEBUG ahead of the #include <assert.h> statement, shall stop assertions from
- * being compiled into the program.
- *
- * @param expr The expression to be evaluated.
- *
- * @see abort
- */
#define assert(__expr) \
((__expr) ? \
(void)0 : \
diff --git a/include/bits/errno.h b/include/bits/errno.h
new file mode 100644
index 00000000..4789fef8
--- /dev/null
+++ b/include/bits/errno.h
@@ -0,0 +1,12 @@
+#ifndef __BITS_ERRNO_H
+#define __BITS_ERRNO_H
+
+#ifndef __BITS_ERRNO_H_
+#error "Internal header — include the public API header instead."
+#else
+#undef __BITS_ERRNO_H_
+#endif
+
+typedef int errno_t;
+
+#endif
diff --git a/include/bits/sigevent.h b/include/bits/sigevent.h
index b36e676c..ddf4c4d7 100644
--- a/include/bits/sigevent.h
+++ b/include/bits/sigevent.h
@@ -3,6 +3,8 @@
#ifndef __BITS_SIGEVENT_H_
#error "Internal header — include the public API header instead."
+#else
+#undef __BITS_SIGEVENT_H_
#endif
union sigval {
diff --git a/include/bits/timespec.h b/include/bits/timespec.h
index ebcacf76..646c76f7 100644
--- a/include/bits/timespec.h
+++ b/include/bits/timespec.h
@@ -3,6 +3,8 @@
#ifndef __BITS_TIMESPEC_H_
#error "Never include <bits/timespec.h> directly; use <time.h> instead."
+#else
+#undef __BITS_TIMESPEC_H_
#endif
typedef __INT64_TYPE__ time_t;
diff --git a/include/bits/wait.h b/include/bits/wait.h
new file mode 100644
index 00000000..5e346276
--- /dev/null
+++ b/include/bits/wait.h
@@ -0,0 +1,22 @@
+#ifndef __BITS_WAIT_H
+#define __BITS_WAIT_H
+
+#ifndef __BITS_WAIT_H_
+#error "Internal header — include the public API header instead."
+#else
+#undef __BITS_WAIT_H_
+#endif
+
+#define WNOHANG 0x00000001
+#define WUNTRACED 0x00000002
+
+#define WEXITSTATUS(__status) (((__status) & 0xff00) >> 8)
+#define WCOREDUMP(__status) ((__status) & 0x80)
+#define WTERMSIG(__status) ((__status) & 0x7f)
+#define WSTOPSIG(__status) WEXITSTATUS(__status)
+#define WIFEXITED(__status) (WTERMSIG(__status) == 0)
+#define WIFSTOPPED(__status) (((__status) & 0xff) == 0x7f)
+#define WIFSIGNALED(__status) (((__status) & 0xffff) - 1U < 0xffu)
+#define WSTOPSIG(__status) WEXITSTATUS(__status)
+
+#endif
diff --git a/include/fnmatch.h b/include/fnmatch.h
index 0f3c71be..2067f595 100644
--- a/include/fnmatch.h
+++ b/include/fnmatch.h
@@ -1,5 +1,5 @@
-#ifndef __FNMATCH_H__
-#define __FNMATCH_H__
+#ifndef __FNMATCH_H
+#define __FNMATCH_H
#define FNM_PATHNAME 0x1
#define FNM_NOESCAPE 0x2
diff --git a/include/monetary.h b/include/monetary.h
deleted file mode 100644
index 6a17a7c4..00000000
--- a/include/monetary.h
+++ /dev/null
@@ -1,11 +0,0 @@
-#ifndef __MONETARY_H
-#define __MONETARY_H
-
-typedef struct __locale_t *locale_t;
-typedef __SIZE_TYPE__ size_t;
-typedef __INT64_TYPE__ ssize_t;
-
-ssize_t strfmon(char *restrict, size_t, const char *restrict, ...);
-ssize_t strfmon_l(char *restrict, size_t, locale_t, const char *restrict, ...);
-
-#endif
diff --git a/include/net/if.h b/include/net/if.h
index fcebbc62..3bb6b5c8 100644
--- a/include/net/if.h
+++ b/include/net/if.h
@@ -1,5 +1,5 @@
-#ifndef __NET_IF_H__
-#define __NET_IF_H__
+#ifndef __NET_IF_H
+#define __NET_IF_H
struct if_nameindex {
unsigned if_index;
diff --git a/include/stdbool.h b/include/stdbool.h
index 4b677e27..3d942ff4 100644
--- a/include/stdbool.h
+++ b/include/stdbool.h
@@ -1,5 +1,5 @@
-#ifndef __STDBOOL_H__
-#define __STDBOOL_H__
+#ifndef __STDBOOL_H
+#define __STDBOOL_H
#define bool _Bool
#define true 1
diff --git a/include/stdckdint.h b/include/stdckdint.h
new file mode 100644
index 00000000..52c88a12
--- /dev/null
+++ b/include/stdckdint.h
@@ -0,0 +1,8 @@
+#ifndef __STDCKDINT_H
+#define __STDCKDINT_H
+
+#define ckd_add(R, A, B) __builtin_add_overflow((A), (B), (R))
+#define ckd_sub(R, A, B) __builtin_sub_overflow((A), (B), (R))
+#define ckd_mul(R, A, B) __builtin_mul_overflow((A), (B), (R))
+
+#endif
diff --git a/include/stddef.h b/include/stddef.h
index bb8d1925..dfae9a12 100644
--- a/include/stddef.h
+++ b/include/stddef.h
@@ -1,6 +1,9 @@
#ifndef __STDDEF_H
#define __STDDEF_H
+#define __BITS_ERRNO_H_
+#include <bits/errno.h>
+
#ifndef NULL
#define NULL ((void *)0)
#endif
diff --git a/include/stdint.h b/include/stdint.h
index 87b72193..a1a2768d 100644
--- a/include/stdint.h
+++ b/include/stdint.h
@@ -1,5 +1,5 @@
-#ifndef __STDINT_H__
-#define __STDINT_H__
+#ifndef __STDINT_H
+#define __STDINT_H
#undef WCHAR_MAX
#undef WCHAR_MIN
diff --git a/include/stdio.h b/include/stdio.h
index 3cc457b3..c6067775 100644
--- a/include/stdio.h
+++ b/include/stdio.h
@@ -1,6 +1,9 @@
#ifndef __STDIO_H
#define __STDIO_H
+#define __BITS_ERRNO_H_
+#include <bits/errno.h>
+
#ifndef NULL
#define NULL ((void *)0)
#endif
diff --git a/include/stdlib.h b/include/stdlib.h
index 4f9c1eb8..a9480d38 100644
--- a/include/stdlib.h
+++ b/include/stdlib.h
@@ -1,5 +1,11 @@
-#ifndef __STDLIB_H__
-#define __STDLIB_H__
+#ifndef __STDLIB_H
+#define __STDLIB_H
+
+#define __BITS_WAIT_H_
+#include <bits/wait.h>
+
+#define __BITS_ERRNO_H_
+#include <bits/errno.h>
#ifndef NULL
#define NULL ((void *)0)
@@ -8,18 +14,7 @@
#define EXIT_FAILURE 1
#define EXIT_SUCCESS 0
-#define WNOHANG 1
-#define WUNTRACED 2
-
-#define WEXITSTATUS(s) (((s) & 0xff00) >> 8)
-#define WTERMSIG(s) ((s) & 0x7f)
-#define WSTOPSIG(s) WEXITSTATUS(s)
-#define WIFEXITED(s) (!WTERMSIG(s))
-#define WIFSTOPPED(s) ((short)((((s) & 0xffff) * 0x10001U) >> 8) > 0x7f00)
-#define WIFSIGNALED(s) (((s) & 0xffff) - 1U < 0xffu)
-
-int ___mb_cur_max(void);
-#define MB_CUR_MAX (___mb_cur_max())
+#define MB_CUR_MAX 1
#define RAND_MAX (0x7fffffff)
diff --git a/include/string.h b/include/string.h
index f9a1a829..17ad87e5 100644
--- a/include/string.h
+++ b/include/string.h
@@ -1,13 +1,16 @@
#ifndef __STRING_H
#define __STRING_H
-typedef __SIZE_TYPE__ size_t;
-typedef struct __locale_t *locale_t;
+#define __BITS_ERRNO_H_
+#include <bits/errno.h>
#ifndef NULL
#define NULL ((void *)0)
#endif
+typedef __SIZE_TYPE__ size_t;
+typedef struct __locale_t *locale_t;
+
void *memccpy(void *restrict, const void *restrict, int, size_t);
void *memchr(const void *, int, size_t);
int memcmp(const void *, const void *, size_t);
diff --git a/include/sys/wait.h b/include/sys/wait.h
index bbe8a8fe..2a7438d7 100644
--- a/include/sys/wait.h
+++ b/include/sys/wait.h
@@ -1,20 +1,13 @@
#ifndef __WAIT_H
#define __WAIT_H
-#define WCONTINUED 0x00000008
-#define WNOHANG 0x00000001
-#define WUNTRACED 0x00000002
-#define WCOREDUMP(__s) ((__s) & 0x80)
-#define WIFCONTINUED(__s) ((__s) == 0xffff)
-#define WIFEXITED(__s) (!WTERMSIG(__s))
-#define WIFSIGNALED(__s) (((s) & 0xffff) - 1U < 0xffu)
-#define WIFSTOPPED(__s) ((short)((((__s) & 0xffff) * 0x10001U) >> 8) > 0x7f00)
-#define WSTOPSIG(__s) WEXITSTATUS(__s)
-#define WTERMSIG(__s) ((__s) & 0x7f)
-
-#define WEXITED
-#define WNOWAIT
-#define WSTOPPED
+#define __BITS_WAIT_H_
+#include <bits/wait.h>
+
+#define WCONTINUED 0x00000008
+#define WEXITED 0x00000004
+#define WNOWAIT 0x01000000
+#define WSTOPPED WUNTRACED
typedef __UINT32_TYPE__ id_t;
typedef __INT64_TYPE__ pid_t;
diff --git a/include/time.h b/include/time.h
index 745e626c..fc089cda 100644
--- a/include/time.h
+++ b/include/time.h
@@ -3,11 +3,12 @@
#define __BITS_TIMESPEC_H_
#include <bits/timespec.h>
-#undef __BITS_TIMESPEC_H_
#define __BITS_SIGEVENT_H_
#include <bits/sigevent.h>
-#undef __BITS_SIGEVENT_H_
+
+#define __BITS_ERRNO_H_
+#include <bits/errno.h>
#ifndef NULL
#define NULL ((void *)0)
diff --git a/include/wchar.h b/include/wchar.h
deleted file mode 100644
index 85e58328..00000000
--- a/include/wchar.h
+++ /dev/null
@@ -1,112 +0,0 @@
-#ifndef __WCHAR_H__
-#define __WCHAR_H__
-
-typedef struct __FILE FILE;
-typedef struct __locale_t *locale_t;
-typedef struct __mbstate_t mbstate_t;
-typedef __SIZE_TYPE__ size_t;
-typedef __builtin_va_list va_list;
-typedef __WCHAR_TYPE__ wchar_t;
-typedef unsigned wint_t;
-struct tm;
-
-#undef WCHAR_MAX
-#undef WCHAR_MIN
-#if L'\0' - 1 > 0
-#define WCHAR_MAX (0xffffffffu + L'\0')
-#define WCHAR_MIN (0 + L'\0')
-#else
-#define WCHAR_MAX (0x7fffffff + L'\0')
-#define WCHAR_MIN (-1 - 0x7fffffff + L'\0')
-#endif
-
-#undef WEOF
-#define WEOF 0xffffffffU
-
-#undef NULL
-#define NULL ((void *)0)
-
-wint_t btowc(int);
-wint_t fgetwc(FILE *);
-wchar_t *fgetws(wchar_t *restrict, int, FILE *restrict);
-wint_t fputwc(wchar_t, FILE *);
-int fputws(const wchar_t *restrict, FILE *restrict);
-int fwide(FILE *, int);
-int fwprintf(FILE *restrict, const wchar_t *restrict, ...);
-int fwscanf(FILE *restrict, const wchar_t *restrict, ...);
-wint_t getwc(FILE *);
-wint_t getwchar(void);
-size_t mbrlen(const char *restrict, size_t, mbstate_t *restrict);
-size_t mbrtowc(wchar_t *restrict, const char *restrict, size_t,
- mbstate_t *restrict);
-int mbsinit(const mbstate_t *);
-size_t mbsnrtowcs(wchar_t *restrict, const char **restrict, size_t, size_t,
- mbstate_t *restrict);
-size_t mbsrtowcs(wchar_t *restrict, const char **restrict, size_t,
- mbstate_t *restrict);
-FILE *open_wmemstream(wchar_t **, size_t *);
-wint_t putwc(wchar_t, FILE *);
-wint_t putwchar(wchar_t);
-int swprintf(wchar_t *restrict, size_t, const wchar_t *restrict, ...);
-int swscanf(const wchar_t *restrict, const wchar_t *restrict, ...);
-wint_t ungetwc(wint_t, FILE *);
-int vfwprintf(FILE *restrict, const wchar_t *restrict, va_list);
-int vfwscanf(FILE *restrict, const wchar_t *restrict, va_list);
-int vswprintf(wchar_t *restrict, size_t, const wchar_t *restrict, va_list);
-int vswscanf(const wchar_t *restrict, const wchar_t *restrict, va_list);
-int vwprintf(const wchar_t *restrict, va_list);
-int vwscanf(const wchar_t *restrict, va_list);
-wchar_t *wcpcpy(wchar_t *restrict, const wchar_t *restrict);
-wchar_t *wcpncpy(wchar_t *restrict, const wchar_t *restrict, size_t);
-size_t wcrtomb(char *restrict, wchar_t, mbstate_t *restrict);
-int wcscasecmp(const wchar_t *, const wchar_t *);
-int wcscasecmp_l(const wchar_t *, const wchar_t *, locale_t);
-wchar_t *wcscat(wchar_t *restrict, const wchar_t *restrict);
-wchar_t *wcschr(const wchar_t *, wchar_t);
-int wcscmp(const wchar_t *, const wchar_t *);
-int wcscoll(const wchar_t *, const wchar_t *);
-int wcscoll_l(const wchar_t *, const wchar_t *, locale_t);
-wchar_t *wcscpy(wchar_t *restrict, const wchar_t *restrict);
-size_t wcscspn(const wchar_t *, const wchar_t *);
-wchar_t *wcsdup(const wchar_t *);
-size_t wcsftime(wchar_t *restrict, size_t, const wchar_t *restrict,
- const struct tm *restrict);
-size_t wcslcat(wchar_t *restrict, const wchar_t *restrict, size_t);
-size_t wcslcpy(wchar_t *restrict, const wchar_t *restrict, size_t);
-size_t wcslen(const wchar_t *);
-int wcsncasecmp(const wchar_t *, const wchar_t *, size_t);
-int wcsncasecmp_l(const wchar_t *, const wchar_t *, size_t, locale_t);
-wchar_t *wcsncat(wchar_t *restrict, const wchar_t *restrict, size_t);
-int wcsncmp(const wchar_t *, const wchar_t *, size_t);
-wchar_t *wcsncpy(wchar_t *restrict, const wchar_t *restrict, size_t);
-size_t wcsnlen(const wchar_t *, size_t);
-size_t wcsnrtombs(char *restrict, const wchar_t **restrict, size_t, size_t,
- mbstate_t *restrict);
-wchar_t *wcspbrk(const wchar_t *, const wchar_t *);
-wchar_t *wcsrchr(const wchar_t *, wchar_t);
-size_t wcsrtombs(char *restrict, const wchar_t **restrict, size_t,
- mbstate_t *restrict);
-size_t wcsspn(const wchar_t *, const wchar_t *);
-wchar_t *wcsstr(const wchar_t *restrict, const wchar_t *restrict);
-double wcstod(const wchar_t *restrict, wchar_t **restrict);
-float wcstof(const wchar_t *restrict, wchar_t **restrict);
-wchar_t *wcstok(wchar_t *restrict, const wchar_t *restrict, wchar_t **restrict);
-long wcstol(const wchar_t *restrict, wchar_t **restrict, int);
-long double wcstold(const wchar_t *restrict, wchar_t **restrict);
-long long wcstoll(const wchar_t *restrict, wchar_t **restrict, int);
-unsigned long wcstoul(const wchar_t *restrict, wchar_t **restrict, int);
-unsigned long long wcstoull(const wchar_t *restrict, wchar_t **restrict, int);
-int wcswidth(const wchar_t *, size_t);
-size_t wcsxfrm(wchar_t *restrict, const wchar_t *restrict, size_t);
-size_t wcsxfrm_l(wchar_t *restrict, const wchar_t *restrict, size_t, locale_t);
-int wctob(wint_t);
-int wcwidth(wchar_t);
-wchar_t *wmemchr(const wchar_t *, wchar_t, size_t);
-int wmemcmp(const wchar_t *, const wchar_t *, size_t);
-wchar_t *wmemcpy(wchar_t *restrict, const wchar_t *restrict, size_t);
-wchar_t *wmemmove(wchar_t *, const wchar_t *, size_t);
-wchar_t *wmemset(wchar_t *, wchar_t, size_t);
-int wprintf(const wchar_t *restrict, ...);
-int wscanf(const wchar_t *restrict, ...);
-
-#endif
diff --git a/include/wctype.h b/include/wctype.h
deleted file mode 100644
index 391c3d6b..00000000
--- a/include/wctype.h
+++ /dev/null
@@ -1,49 +0,0 @@
-#ifndef __WCTYPE_H
-#define __WCTYPE_H
-
-#undef WEOF
-#define WEOF 0xffffffffU
-
-typedef unsigned wint_t;
-typedef const int *wctrans_t;
-typedef unsigned long wctype_t;
-typedef struct __locale_t *locale_t;
-
-int iswalnum(wint_t);
-int iswalnum_l(wint_t, locale_t);
-int iswalpha(wint_t);
-int iswalpha_l(wint_t, locale_t);
-int iswblank(wint_t);
-int iswblank_l(wint_t, locale_t);
-int iswcntrl(wint_t);
-int iswcntrl_l(wint_t, locale_t);
-int iswctype(wint_t, wctype_t);
-int iswctype_l(wint_t, wctype_t, locale_t);
-int iswdigit(wint_t);
-int iswdigit_l(wint_t, locale_t);
-int iswgraph(wint_t);
-int iswgraph_l(wint_t, locale_t);
-int iswlower(wint_t);
-int iswlower_l(wint_t, locale_t);
-int iswprint(wint_t);
-int iswprint_l(wint_t, locale_t);
-int iswpunct(wint_t);
-int iswpunct_l(wint_t, locale_t);
-int iswspace(wint_t);
-int iswspace_l(wint_t, locale_t);
-int iswupper(wint_t);
-int iswupper_l(wint_t, locale_t);
-int iswxdigit(wint_t);
-int iswxdigit_l(wint_t, locale_t);
-wint_t towctrans(wint_t, wctrans_t);
-wint_t towctrans_l(wint_t, wctrans_t, locale_t);
-wint_t towlower(wint_t);
-wint_t towlower_l(wint_t, locale_t);
-wint_t towupper(wint_t);
-wint_t towupper_l(wint_t, locale_t);
-wctrans_t wctrans(const char *);
-wctrans_t wctrans_l(const char *, locale_t);
-wctype_t wctype(const char *);
-wctype_t wctype_l(const char *, locale_t);
-
-#endif