I copied the constants and definitions from musl which we can presume is
correct. Relibc is missing some features which affects our sysconf as
well, such as constants in limits.h or a working resources.h.
Fish only requires BSHELL. The constants are implementation specific so
this header will evolve as needed.
Cbindgen doesn't emit defines for strings (even CStrs) so I only
provided what's needed for Fish in a C header for now with the ideal
implementation, in Rust, unbuilt.
* Fix PERROR to match musl/glibc better
* More unit tests + enabled on Linux
* Pack priority and facility into one i32 and check the bits with
bitflags
* Add LOG_UPTO (logic is straight from musl)
Not done:
* "%m" - this could just be added to printf
* LOG_CONS
Linux's syslog is a local socket, so this uses the recent UDS work.
* Most of redox.rs is refactored into mod.rs now which has all of the C
facing functions and consts.
* I wrapped the global logger in a Mutex instead of a RwLock. The logger
is almost always locked for writing so a Mutex is simpler as RwLock
provides no benefits.
* I implemented LOG_PERROR which also prints errors to stderr as well as
the log.
* Syslog should be sys/syslog.h with syslog.h as an alias (the
original code only had syslog.h).
The original expanded to 16 nibbles which is technically correct because
the standard defines USHRT_MAX as being at LEAST 65535. However, in
practice everything seems to set the max as the max length of two bytes.
This header is more or less the same across libc implementations.
`musl` uses its `_Noreturn` macro to detect which `noreturn`
should be used: C11 or GCC's extension as a fallback.
`glibc` simply defines `noreturn` as `_Noreturn`.
This implementation is based off of `musl`'s.
`_Noreturn` is deprecated as of C23.