summaryrefslogtreecommitdiff
path: root/Userland/Libraries/LibC
AgeCommit message (Collapse)Author
2021-04-11LibC: Make <limits.h> compatible with GCC so that it doesn't install a fixed ↵Gunnar Beutner
header GCC installs a fixed version of the <limits.h> header as per https://gcc.gnu.org/onlinedocs/gcc/Fixed-Headers.html. The fixed header doesn't include the target's <limits.h> which in turn means that some definitions (such as PATH_MAX) aren't available. This change requires rebuilding the toolchain (Toolchain/BuildIt.sh). This fixes the flatbuffers port. The commit also removes some non-standard defines (U*_MIN) which don't appear to be used anywhere. By definition they're always 0 though so they're not strictly necessary.
2021-04-11LibC: Provide macros for the <ctype.h> functionsGunnar Beutner
These are required for the 'tr' port.
2021-04-11LibC: Include additional headers in <arpa/inet.h>Gunnar Beutner
According to the Single UNIX Specification, Version 2 the <arpa/inet.h> header may optionally include <netinet/in.h> and <inttypes.h>. This helps with porting software like c-ray that expects this to be the case.
2021-04-10AK+Everywhere: Make StdLibExtras templates less wrapper-yAnotherTest
This commit makes the user-facing StdLibExtras templates and utilities arguably more nice-looking by removing the need to reach into the wrapper structs generated by them to get the value/type needed. The C++ standard library had to invent `_v` and `_t` variants (likely because of backwards compat), but we don't need to cater to any codebase except our own, so might as well have good things for free. :^)
2021-04-08Kernel/LibC: Make memset implementations the sameHendiadyoin1
I dont know why we do a fast path in the Kernel, but not in Userspace Also simplified the byte explosion in memset to "explode_byte" it even seemed so, that we missed the highest byte when memseting something
2021-04-08LibC: Fix coding style in scanf helpersAndreas Kling
2021-04-04LibC: Added strtoimax() and strtoumax()Manuel Palenzuela
They are the same as strtol() and strtoul() but if there is overflow/underflow then the maximum integer val/lower integer val/maximum uint val will be returned while also setting errno to ERANGE.
2021-04-04LibC: Teach `vsscanf()` to consume the width specifierJelle Raaijmakers
Previously, `vsscanf()` would crash whenever it encountered a width specification. Now, it consumes the width specification but does not yet do anything with it.
2021-04-04LibC: Add NI_MAXHOST and NI_MAXSERV constantsJelle Raaijmakers
These are not POSIX-defined but are almost always present in <netdb.h>.
2021-04-04LibC: Use 'long long' specialisations of scanf's read_element_concreteAnotherTest
...for 'long long' and 'unsigned long long', instead of reading them as 'long's and 'unsigned long's. Also add a test for values that can only fit in (unsigned) long long. Fixes #6096.
2021-04-03LibC: Fix FILE::flush() passing bogus arguments to lseek()Andreas Kling
This was a regression from the 64-bit off_t changes. When dropping buffered data after a flush, we would subtract the buffered amount from zero to get the seek offset. This didn't work right since the subtraction was done with a 32-bit size_t and we ended up with e.g (i64)0xfffffffc as the offset. Fixes #6003.
2021-03-31LibC+ping: Move internet_checksum to serenity headerIdan Horowitz
This will be useful for traceroute and any other packet related application, so this will reduce code duplication.
2021-03-31Kernel: Added TIOCSTI ioctl placeholder (#6037)Baitinq
Added a dummy TIOCSTI ioctl placeholder. This is a dangerous ioctl that can be used to inject input into a tty. Added for compatibility. Always fails with EIO.
2021-03-29LibC: Implement utimes functionJelle Raaijmakers
2021-03-29LibC: Mark atexit() entries as 'called' before calling themItamar
This guards as from recursing into an atexit callback if exit() is called from within it.
2021-03-28LibC: Implement asprintf() and vasprintf()Andreas Kling
These simply use StringBuilder::appendvf() internally which is not optimal in terms of heap allocations, but simple enough and I don't think they are performance sensitive functions anyway.
2021-03-28Kernel+LibC: Implement sys$ioctl() FIONBIOAndreas Kling
This is another (older) way of making a file descriptor non-blocking.
2021-03-28LibC: Add vfork() as a simple wrapper around fork()Andreas Kling
I don't know if we should implement optimized vfork(). I'm adding it here since SDL2 uses it.
2021-03-27LibC: Define F_GETLKJelle Raaijmakers
2021-03-27LibC: Add AF_INET6, PF_INET6 and IPPROTO_IPV6 macrosAndreas Kling
2021-03-27LibC: Add POSIX macros for the ai_flags field in struct addrinfoAndreas Kling
2021-03-27LibC: Add S_I{READ,WRITE,EXEC} macro aliases for BSD compatibilityAndreas Kling
These map as follows: S_IREAD -> S_IRUSR S_IWRITE -> S_IWUSR S_IEXEC -> S_IXUSR
2021-03-21LibC: Add x86_64 RegistersHendiadyoin1
2021-03-19CMake: Make libc.a self-containedItamar
Previously, libc.a contained undefined symbols from ssp and libsystem, which caused static compilation to fail. We now generate libc.a with a custom CMake rule that combines all object files from libc, ssp and libsystem to form libc.a Closes #5758.
2021-03-17LibC+Kernel: Switch off_t to 64 bitsJean-Baptiste Boric
2021-03-16Kernel: Add _SC_CLK_TCK to sysconf.thatdutchguy
Unbreaks the hatari port.
2021-03-14LibC: Rename feclearexcept{s,}Ben Wiederhake
This will also help with making ports compile again :D https://github.com/SerenityOS/serenity/pull/5762#issuecomment-798779561
2021-03-12Everywhere: Remove klog(), dbg() and purge all LogStream usage :^)Andreas Kling
Good-bye LogStream. Long live AK::Format!
2021-03-11Userland: Remove superfluous headersBen Wiederhake
Userland has no reason to access 'kmalloc'.
2021-03-09UserspaceEmulator+LibC: Use sys$emuctl() to pass malloc info to UEAndreas Kling
Get rid of the awkward secret handshake sequence between malloc and UE and simply use sys$emuctl() to notify UE of malloc, free and realloc.
2021-03-09LibC: Don't scrub memory in malloc/free when running in UEAndreas Kling
Since UE is keeping track of the heap anyway, we can skip the scrubbing and drastically improve the speed of malloc and free when emulating.
2021-03-09LibC: Add defines to float.hMițca Dumitru
This doesn't define FLT_EVAL_METHOD as I'm not sure what I should actually use for that
2021-03-09LibC: Add imaxdiv and lldivMițca Dumitru
2021-03-08LibC: Remove stdbool.h as it is provided by the compilerMițca Dumitru
2021-03-08LibC: Define static_assert in assert.h when it's being used in CMițca Dumitru
2021-03-04LibC: Fix typo in fenv.hMițca Dumitru
`FE_TOWARDSZERO` is actually spelled `FE_TOWARDZERO` (without the 'S')
2021-03-04Everywhere: Remove unnecessary `clang-format off`sWilliam McPherson
Mostly due to the fact that clang-format allows aligned comments via AlignTrailingComments. We could also use raw string literals in inline asm, which clang-format deals with properly (and would be nicer in a lot of places).
2021-03-01LibC: Implement fenv.hMițca Dumitru
2021-02-27LibRegex: Implement section B.1.4. of the ECMA262 specAnotherTest
This allows the parser to deal with crazy patterns like the one in #5517.
2021-02-25LibC: Make it compile on 64-bitAndreas Kling
It won't actually work on 64-bit yet, but let's do our future selves a favor and make it compile.
2021-02-25LibC: Add x86_64 implementation of setjmp() and longjmp()Andreas Kling
2021-02-24LibC: Avoid double memory clearing in calloc()Andreas Kling
calloc() was internally calling malloc_impl() which would scrub out all the allocated memory with the scrub byte (0xdc). We would then immediately zero-fill the memory. This was obviously a waste of time, and our hash tables were doing it all the time. :^)
2021-02-24LibC+DynamicLoader: Move "transactional memory" GCC stubs to LibCAndreas Kling
Instead of having a special case in the dynamic loader where we ignore TM-related GCC symbols, just stub them out in LibC like we already do for various other things we don't support.
2021-02-23Everywhere: Remove unused RELEASE_ASSERT macroAndreas Kling
2021-02-23Everywhere: Rename ASSERT => VERIFYAndreas Kling
(...and ASSERT_NOT_REACHED => VERIFY_NOT_REACHED) Since all of these checks are done in release builds as well, let's rename them to VERIFY to prevent confusion, as everyone is used to assertions being compiled out in release. We can introduce a new ASSERT macro that is specifically for debug checks, but I'm doing this wholesale conversion first since we've accumulated thousands of these already, and it's not immediately obvious which ones are suitable for ASSERT.
2021-02-21LibC: Don't #define away __{BEGIN,END}_DECLS in stdarg.hAnotherTest
That would force anything that includes this to have language-specific linkage, and absolutely break `sys/cdefs.h`. Fixes #5452.
2021-02-20AK+LibC: Remove dbgprintf() :^)Andreas Kling
Everything has been moved to dbgln() or other AK::Format-based APIs. We can finally get rid of this old thing.
2021-02-18LibC: Remove serenity.h.rejLinus Groh
2021-02-18LibC: Use "static inline" for inline functions in arpa/inet.h (#5392)jonno85uk
This makes it work when compiling as C.
2021-02-17LibC: Convert dbgprintf() => dbgln() in SSP handlerAndreas Kling