Commit Graph

1112 Commits

Author SHA1 Message Date
d5bc88584d LibC: Implement wcscasecmp and wcsncasecmp 2026-07-04 02:25:56 +03:00
63b2284324 Kernel/LibC: support RDTSCP based clock_gettime
RDTSCP seems to be faster than LSL and it removes the need for getting
the current cpu twice to make sure TSC is read on the correct CPU
2026-07-03 06:32:04 +03:00
917321eb5f LibC: Wait for thread before returning from pthread_create
We now make sure the thread starts up and sets its id. There was a race
condition where a process could create a thread and immediately try to
join it. If the thread had not initialized itself the join would fail
with EINVAL as we passed -1 as its id.
2026-07-03 02:14:10 +03:00
13bf1ba647 mkdir: Cleanup code and add better argument parsing 2026-07-02 22:54:45 +03:00
0a8b03d349 LibAudio: Make AudioLoaders return float instead of double
AudioBuffers already use floats internally so there is no need for
loaders to produces doubles
2026-07-02 22:54:45 +03:00
4473ee4d49 LibAudio: Add an API to query free space in audio buffer
Also optimize and cleanup sample queueing
2026-07-02 22:54:45 +03:00
ded722fb4c LibC: bump SYMLOOP_MAX to 128 2026-07-02 20:02:24 +03:00
facc17c5a1 LibC: Implement {get,free}ifaddrs 2026-07-02 20:02:24 +03:00
26abd4e18e LibC: Add posix_fallocate stub 2026-07-02 20:02:24 +03:00
50fd526e6f LibC: Implement pthread_{get,set}name_np 2026-07-02 20:02:24 +03:00
c0e091b647 LibC: Implement pthread_{get,set}attr_default_np 2026-07-02 20:02:24 +03:00
372da006d0 LibC: Implement pthread_getattr_np 2026-07-02 20:02:24 +03:00
0dc74beb0f Kernel/LibC: Allocate thread stacks in userspace
This adds support for pthread function for stack manipulation.

Also keep track of main threads stack in the uthread
2026-07-02 20:02:24 +03:00
7bdd9d19d0 LibC: Cleanup uthread initialization
This is now done in a constructor function in pthread.cpp
2026-07-02 20:02:24 +03:00
b19b7f064a LibC: Make pthread_t pointer to uthread instead of a thread id
This will allow getting info about other threads in userspace!
2026-07-02 20:02:24 +03:00
f449ca8161 Kenrel: Separate pthread API from kernel API
It didn't really make sense for the syscalls to be named as the pthread
equivalents. Now the kernel just uses thread ids
2026-07-02 20:02:24 +03:00
8be90c49bc LibC: use auxv for getpagesize 2026-07-02 20:02:24 +03:00
c5cfa82ffb LibC: Check for malloc failure in setenv 2026-07-02 20:02:24 +03:00
c0d38862f2 LibC: Add sys/auxv.h with getauxval 2026-07-02 20:02:24 +03:00
74e94eedae LibC: Fix malloc bitmap allocator allocation
Use full pages for bitmap allocators and fix the capacity extension
condition
2026-07-02 15:22:52 +03:00
d241975ce1 Kernel: Remove SYS_SLEEP and cleanup SYS_NANOSLEEP
`sleep` is now implemented in terms of `nanosleep`. `nanosleep` is now
more precise and handles overflow when calculating wakeup time. I don't
think anything was depending on this, but I could see a program sleeping
for max time to block until signal.
2026-07-02 15:22:52 +03:00
6f002f0c07 LibC: Make pthread_{equal,self,testcancel} static inline
This allows using ::pthread_self or &pthread_self
2026-06-30 20:14:38 +03:00
924576cf0d WindowServer: Fix invalidation for fullscreen windows 2026-06-30 20:14:37 +03:00
32c10f7db2 Userspace: Add very simple top program
This is very bare bones but does show what programs use most cpu and
memory
2026-06-30 20:14:37 +03:00
9919cbf66e Kernel: Pass interpreter base address in auxiliary vector 2026-06-30 20:14:37 +03:00
59ec05c898 Kernel: Make TSC based timer monotonic
Prior to this I was just blindly rebasing the current TSC stats every
once in a while. Now I check for drift and scale the multiplier
accordingly to keep the timer from drifting
2026-06-27 03:24:15 +03:00
689494db63 LibGUI/WindowServer: Allow querying global cursor position 2026-06-23 23:31:17 +03:00
1287c8e335 LibGUI: Cleanup packet creation 2026-06-23 23:30:42 +03:00
763a742f6d WindowServer: Fix client fd leaks 2026-06-23 21:08:57 +03:00
4ad586552d LibGUI/WindowServer: Send window move events 2026-06-23 20:52:12 +03:00
8bc93069be Terminal: Fix foreground and background colors when inverted
I was not checking for inverted colors in a lot of places :P
2026-06-23 20:16:25 +03:00
c79e412215 resolver: Fix UB and resolve localhost 2026-05-25 03:19:20 +03:00
43d03eb4a9 LibC: Add shm_open/shm_unlink
These can just open files in /tmp/shm. no need for anything fancier
2026-05-25 02:14:04 +03:00
2a6792b44a LibC: Make mlock, munlock and madvice no-ops
These don't have to do anything as I don't swap processes to disk
2026-05-25 02:14:04 +03:00
c72f2f9b31 LibC: Fix posix_spawn
signal was checking for NULL instead of SIG_ERR

there is no need to do post fork waiting in posix_spawn, we just have to
exit with 127 on error
2026-05-25 02:14:04 +03:00
62e2f4896a LibC: reorder LOCK_SH and LOCK_EX
Some software im porting has static asserts for these :)
2026-05-25 02:14:04 +03:00
9ccdebcd96 LibC: Implement/fix mk{,o}stemp{,s} 2026-05-25 02:14:04 +03:00
fe533c2e62 LibC: Fix freopen to preserve file state :) 2026-05-25 02:14:04 +03:00
ee5c225954 LibC: Add __fseterr
This is used by some ports to not require internal FILE structure
2026-05-25 02:14:04 +03:00
d5ee98708b TaskBar: Show CPU load in task bar! 2026-05-20 19:14:21 +03:00
7ce68b0488 LibGUI: Allow timeout with Window::wait_events 2026-05-20 19:03:11 +03:00
77796dd317 driver-install: implemented a simple installer 2026-05-20 17:52:19 +03:00
f1a72cc9da Kernel: Implemented banos - a WIP C driver API
Banos is a stable WIP C driver API that is supposed to provide a simple
interface to interact with the kernel and load the modules dynamically.
It is WIP and atm this just implements module loading with a custom
banos_install syscall. Banos will not try to substitute parts of the
kernel instead it will just expose kernel functionality via a stable
BINARY API. Meaning binaries (should) remain forward and backward
compatible on a binary level.

Banos modules work similarly to those in linux, you expose symbols via
BANOS_EXPORT which allows you to export a name + addr paired symbol.
It puts it in the .banos-export section. Drivers provide metadata about
themselves in the REQUIRED .banos-driver section. Symbols are resolved
at runtime. The kernel exposes the driver functionality via the same
.banos-export export mechanism.

Banos modules are elf RELOCATABLE files (object files) which have
partial linking (only banos symbols should remain). Modules will
eventually define dependencies, will export symbols and will allow you
to build a complex object hierarchy.

This patch adds the banos_install syscall which takes in the driver
image to install and may only be executed by super users. The API
doesn't validate already loaded modules, as thats something the
userspace MAY choose to keep track of. Multi-instance functionality
shall be implemented via driver specific behaviuor (exposed in the dev
filesystem or some other means).

Modules are supposed to allow you to alter kernel behavior and extend
it, allowing you to create filesystems, drivers, networking
modifications, schedulers, probers, and more (hopefully) whilst
remaining binary compatible with any version of the kernel (again,
hopefully).
2026-05-20 17:52:19 +03:00
45e55d8907 LibC: Don't compare equal elements in qsort
This seemed to break supertuxkart which returned `less` in this case
2026-05-20 05:54:45 +03:00
e9d6431728 DynamicLoader: Fix dynamic TLS init order 2026-05-20 05:03:20 +03:00
aa8be130f9 DynamicLoader: Cleanup lazy PLT relocations 2026-05-20 05:02:48 +03:00
d52ad29afa Kernel: Add missing tr cmake file 2026-05-19 13:57:56 +03:00
1922d78661 Kernel: Add support for mkfifo{,at} mkdir at
Opening FIFOs still dont work as expected but at least you can create
them now :D
2026-05-18 23:53:09 +03:00
9c79971bdc LibC/Kernel: Add support for detached pthreads 2026-05-17 00:40:56 +03:00
ff75c15ba3 LibC: Move pthread keys to TCB
This removes all TLS relocations from libc which may become handy ;)
2026-05-17 00:29:20 +03:00