Bananymous
448632cf11
Kernel: Add fast path to pselect and ppoll
...
If events are available right away, don't create epoll object to wait
on. Also fix pselect return value to the number of bits set. Previously
return value could've been greater than that if epoll return EPOLLERR or
EPOLLHUP for events that were not listened to
2025-06-04 17:51:22 +03:00
Bananymous
31bcad2535
LibC: Implement truncate
2025-06-01 13:48:03 +03:00
Bananymous
b75970958e
Kernel/LibC: Implement unlinkat
2025-06-01 13:48:03 +03:00
Bananymous
dbdefa0f4a
LibC: Implement pthread cancelation
...
This code is not tested at all but it looks correct xD
2025-06-01 13:48:03 +03:00
Bananymous
56fdf6002c
Kernel/LibC: Implement pthread_kill
2025-06-01 13:48:03 +03:00
Bananymous
c957f1ddca
LibC: Cleanup pthread code and add some pthread_attr functions
...
errno, pthread cleanup and pthread id are now stored in uthread. This
allows using these without TLS
2025-06-01 13:48:03 +03:00
Bananymous
b1065fa01d
Kernel/LibC: Add ppoll syscall and fix poll
...
poll is now using its own syscall instead of wrapping aroung pselect.
This adds less overhead on top of poll and adds support for POLLHUP
2025-06-01 13:48:03 +03:00
Bananymous
9b875fb930
Kernel: Make epoll work with different fds pointing to same inode
2025-06-01 13:48:03 +03:00
Bananymous
1bd454b8fd
Kernel/LibC: Implement utime* family functions
...
This patch adds *working*
- utime
- utimes
- utimensat
- futimens
2025-06-01 13:48:03 +03:00
Bananymous
cd5b351ce4
Kernel: Fix fchmodat mode handling
...
Ignore file type bits instead of returning EINVAL if they are set
2025-05-29 03:24:31 +03:00
Bananymous
89c9bfd052
Kernel/LibC: Implement `socketpair` for UNIX sockets
2025-05-28 03:10:01 +03:00
Bananymous
12b93567f7
Kernel/LibC: Implement `getpeername`
2025-05-28 03:10:01 +03:00
Bananymous
79a2b84c81
Kernel: Fix process exit when there are multiple threads
2025-05-28 03:10:01 +03:00
Bananymous
44b762f916
Kernel/LibC: Implement pwrite and make pread non-locking
2025-05-28 03:10:01 +03:00
Bananymous
1bcd1edbf5
Kernel/LibC: Implement basic epoll
...
This implementation is on top of inodes instead of fds as linux does it.
If I start finding ports/software that relies on epoll allowing
duplicate inodes, I will do what linux does.
I'm probably missing multiple epoll_notify's which may cause hangs but
the system seems to work fine :dd:
2025-05-13 10:18:05 +03:00
Bananymous
143a00626b
Kernel: Fix fork cmdline copying and copy environ
2025-05-13 10:16:21 +03:00
Bananymous
592675022e
Kernel: Allow tcgetpgrp on pseudo terminal masters
2025-05-05 19:09:01 +03:00
Bananymous
b2e10d7e6e
Kernel: Remove unnecessary locks
2025-05-05 19:08:57 +03:00
Bananymous
f8e3ae0525
Kernel: Fix deadlock caused by multithreading
...
This allows multiple threads to concurrently call the most common
blocking syscalls:
- read
- write
- accept
- connect
- sendto
- recv
- pselect
This prevents a dead lock when for example process is waiting on a pipe,
but unable to write to it since process is locked.
This is the beginning of starting to remove processes own lock from
syscall and locking only necessary parts.
2025-04-22 04:51:53 +03:00
Bananymous
d54489bbcb
Kernel: Implement MemoryRegion pinning
...
This allows process to pin a MemoryRegion into users memory space for
syscall duration without allowing user to munmap the region.
2025-04-22 04:30:07 +03:00
Bananymous
808c97020a
Kernel/LibC: Implement SA_RESTART
...
I have been thinking how to do this for a long time but I finally
figured out a semi-clean way
2025-04-22 02:42:44 +03:00
Bananymous
252784ff5b
Kernel: Preserve kernel command line on fork
2025-04-19 21:29:52 +03:00
Bananymous
6f9dc2a9b8
Kernel/LibC: Implement `fchdir`, cleanup `chdir` and `getcwd`
2025-04-19 21:28:31 +03:00
Bananymous
4cdf218145
Kernel: Don't allow opening file with path ""
2025-04-18 02:37:16 +03:00
Bananymous
ac90800c3c
Kernel/LibC/DynamicLoader: Implement thread local storage
...
For some reason this does not work on 32 bit version, so it is disabled
on that platform. I'll have to look into it later to find the bug :)
2025-04-15 23:33:39 +03:00
Bananymous
08f5833ca8
Kernel/LibC: Implement pthread_attr_init
2025-04-15 23:31:17 +03:00
Bananymous
4bcd3ed86f
Kernel: Start working on TLS, add SYS_{SET,GET}_TLS
2025-04-15 23:31:17 +03:00
Bananymous
a933fabb86
Kernel: Define constant USERSPACE_END
...
This should be used for userspace generic allocations. Currently I used
KERNEL_OFFSET, but I want to limit userspace to the actual lower half of
the address space
2025-04-15 23:31:17 +03:00
Bananymous
36baf7b0af
Kernel/LibC/DynamicLoader: Update process start ABI
...
We now use SysV abi for process startup
2025-04-15 23:05:52 +03:00
Bananymous
4b1c20fa36
Kernel: Make SYS_{,P}READ work with count == 0
2025-04-15 21:36:00 +03:00
Bananymous
15045cc486
Kernel: Make nonblocking sockets unblocking :)
2025-04-05 18:42:02 +03:00
Bananymous
be786be67d
Kernel/LibC: Implement pthread_join
2025-04-02 12:58:39 +03:00
Bananymous
9066e62a97
Kernel/LibC: Implement sched_yield
2025-04-02 12:58:39 +03:00
Bananymous
5549696c3a
Kernel/LibC: Implement pthread_self
2025-04-02 02:39:29 +03:00
Bananymous
c1618e2b5d
Kernel/LibC: Add basic support for pthread_{create,exit}
2025-04-01 23:26:13 +03:00
Bananymous
b30a79c7fe
Kernel: Temporary hack to "fix" munmap
...
My current munmap implementation does not support partial unmaps and
GCC relies on this behaviour. This patch removes unmapping if the
address and len does not fully contain the mmap region.
2025-02-01 22:25:22 +02:00
Bananymous
5938cc4086
Kernel: Support pselect sigmask
2025-01-28 17:17:59 +02:00
Bananymous
cbcb9f9044
Kernel: Warn on unsupport `clock_gettime` `clock_id`s
2025-01-25 17:31:17 +02:00
Bananymous
2a16a67aed
Kernel: Ignore SA_RESTART flag on sigaction
...
This is a big hack but a lot of ports set this flag. This seems really
annoying to implement properly
2025-01-24 19:34:22 +02:00
Bananymous
ee078fc638
Kernel: Fix fd status/descriptor flag handling
...
I was not sharing status and offset on fork and I was sharing descriptor
flags on dup/dup2
2025-01-17 20:12:04 +02:00
Bananymous
9893c90e74
Kernel: Remove SYS_DUP and implement it using fcntl F_DUPFD
2025-01-17 19:29:47 +02:00
Bananymous
80ce9d546a
Kernel: Don't error out on SYS_WAIT with W{CONTINUED,UNTRACED}
...
As I don't support stopping and continuing processes these flags are
effecively no-ops
2025-01-17 16:14:52 +02:00
Bananymous
869f4011a1
Kernel: Replace the old AML interpreter by a new, better one
...
The old AML interpreter was trash and did not follow value/reference
semantics at all. It was also super slow, one of my machines taking over
7 seconds to parse ACPI namespace and call _INI and _STA.
2024-12-17 03:36:33 +02:00
Bananymous
2d0690ae2d
Kernel: Cleanup most of syscalls dealing with files
2024-12-07 05:33:04 +02:00
Bananymous
0a5aacfd87
Kernel: Allow open with O_CREAT bypass file permission checks
...
call to open(path, O_CREAT|O_EXCL|O_RDWR, 0444) should open file as
read-write although file is created as read-only on filesystem.
2024-12-03 16:17:34 +02:00
Bananymous
2dec3a6c95
Kernel: Add some sanity checks for existanse of threads
2024-12-03 16:16:50 +02:00
Bananymous
fcc2814199
Kernel: Remove process from alarm list after it dies
2024-12-03 16:16:08 +02:00
Bananymous
713daf6cd3
Kernel/LibC: Add support for creating hardlinks
2024-12-03 16:12:26 +02:00
Bananymous
d58ca5f37a
Kernel/LibC: Implement symlink{,at}
2024-12-02 20:13:38 +02:00
Bananymous
a10ca47657
Kernel/LibC: Implement {,f}statvfs
2024-12-02 20:13:37 +02:00