summaryrefslogtreecommitdiff
path: root/LibC/stdlib.cpp
AgeCommit message (Collapse)Author
2019-05-13LibC+Shell: Make system() actually work.Andreas Kling
system() will now fork off a child process and execute the command via /bin/sh -c. There are probably some things to fix here, but it's a start.
2019-05-02LibC: Implement a simple freelist-based malloc() with size classes.Andreas Kling
It's not thread-safe yet, and there is lots of room for improvement. Still it's a lot faster than the first-fit bitmap-based one it replaces.
2019-04-30LibC: Log all malloc() calls if LIBC_LOG_MALLOC is set.Andreas Kling
This makes it easier to quickly determine if a userspace process is getting bogged down in memory allocation.
2019-04-27LibC: Make the malloc()/free() scrubbing runtime optional (default on.)Andreas Kling
Memory returned by malloc() is normally memset with 0x85. Memory passed to free() is normally memset with 0x82. These behaviors can now be disabled by setting one or both of LIBC_NOSCRUB_MALLOC and LIBC_NOSCRUB_FREE in your environment. :^)
2019-04-23Put assertions behind a DEBUG flag to make it easy to build without them.Andreas Kling
2019-04-23Do a pass of compiler warning fixes.Andreas Kling
This is really making me question not using 64-bit integers more.
2019-04-17LibC: Bring the C library close enough to newlib to trick GCC.Andreas Kling
Now we can build GCC with --with-newlib, which hopefully cuts down on weird toolchain build issues.
2019-03-27LibC: Remove the validate_mallocation() stuff since Binutils hates it.Andreas Kling
2019-03-27LibC: Implement atexit() and strtoul().Andreas Kling
2019-03-21LibC: malloc() should use mmap() directly for allocations >= PAGE_SIZE.Andreas Kling
This is a solid speedup on PNG loading, and basically everything else. Once again I find a way to defer writing a better allocator for now. :^)
2019-03-14Terminal: Enough compat work for Lynx to actually load web pages.Andreas Kling
2019-03-14LibC: A whole bunch of compat work towards porting Lynx.Andreas Kling
2019-02-27More compat work towards porting vim.Andreas Kling
It now builds and runs in the small-featureset configuration. :^)
2019-02-26Compat work towards porting vim.Andreas Kling
2019-02-26More compat work.Andreas Kling
Move syscall to int 0x82 since using int 0x80 was kinda prone to fork bombs when building things on Linux. :^)
2019-02-24LibC: A bunch of compat work towards porting GCC.Andreas Kling
2019-02-23LibC: Enough compat work to make binutils-2.32 build and run.Andreas Kling
2019-02-17Add ability to switch video modes from the system menu.Andreas Kling
I had to change PhysicalPage around a bit for this. Physical pages can now be instantiated for any arbitrary physical address without worrying that such pages end up in the kernel page allocator when released. Most of the pieces were already in place, I just glued everything together.
2019-02-15LibC: Fix busted realloc() implementation.Andreas Kling
2019-02-08LibC: Implement enough missing stuff to get bash-5.0 running. :^)Andreas Kling
2019-02-05LibC: Add some integer functionality needed for NASM.Andreas Kling
2019-02-03LibC: Implement various things to get GNU bc building and running.Andreas Kling
Looks like that's all we needed, and bc now runs. :^)
2019-02-01LibC: Add some things needed to build GNU bc.Andreas Kling
This patch adds vprintf(), sig_atomic_t, random() and strdup(). bc doesn't build yet, but it will.
2019-01-23LibC: Let malloc(0) return nullptr.Andreas Kling
2019-01-23LibC: Add vsnprintf(), snprintf(), execvp() and abs().Andreas Kling
2019-01-15Add basic PTY support.Andreas Kling
For now, there are four hard-coded PTYs: /dev/pt{m,s}[0123] Use this in the Terminal to open a pty pair and spawn a shell.
2019-01-14Share GraphicsBitmaps between the windowing server and the client process.Andreas Kling
This is pretty cool. :^) GraphicsBitmaps are now mapped into both the server and the client address space (usually at different addresses but that doesn't matter.) Added a GUI syscall for getting a window's backing store, and another one for invalidating a window so that the server redraws it.
2018-12-03Implement basic support for times().Andreas Kling
The kernel now bills processes for time spent in kernelspace and userspace separately. The accounting is forwarded to the parent process in reap(). This makes the "time" builtin in bash work.
2018-11-19Make /proc/PID/vm more readable.Andreas Kling
And move the unreadable detail-heavy mess to /proc/PID/vmo.
2018-11-19Some improvements to LibC malloc().Andreas Kling
2018-11-19Adapt kmalloc() for userspace.Andreas Kling
A slightly more useful malloc() for userspace. The max allocation limit is still 128 kB, but at least now free() is able to recycle memory.
2018-11-17Various stubs while trying to get an old coreutils to build.Andreas Kling
2018-11-16Add fcntl() F_DUPFD which is slightly different from dup2().Andreas Kling
2018-11-11Rage hacking to get bash to run. It finally runs. So cool! :^)Andreas Kling
2018-11-11Add really cheap atol() since sizeof(int) == sizeof(long) here anyway.Andreas Kling
2018-11-09Fix all current build warnings in LibC.Andreas Kling
2018-11-08Start working on memory-mapped files.Andreas Kling
First of all, change sys$mmap to take a struct SC_mmap_params since our sycsall calling convention can't handle more than 3 arguments. This exposed a bug in Syscall::invoke() needing to use clobber lists. It was a bit confusing to debug. :^)
2018-11-06Change syscall naming scheme.Andreas Kling
2018-10-31Enough compatibility work to make figlet build and run!Andreas Kling
I ran out of steam writing library routines and imported two BSD-licensed libc routines: sscanf() and getopt(). I will most likely rewrite them sooner or later. For now I just wanted to see figlet running.
2018-10-28Add sys$set_mmap_name and use it from LibC's malloc.Andreas Kling
It's nice to be able to identify mmap's in /proc/PID/vm.
2018-10-28Canonicalize the path used by sh.Andreas Kling
With a bunch of LibC work to support the feature. LibC now initializes AK::StringImpl by default. It's now fine to use AK in LibC/Userland! :^)
2018-10-24Lots of hacking to make a very simple "ls" utility.Andreas Kling
I added a dead-simple malloc that only allows allocations < 4096 bytes. It just forwards the request to mmap() every time. I also added simplified versions of opendir() and readdir().