Commit Graph

77 Commits

Author SHA1 Message Date
a51a81b6cd Kernel: Move {set,get}sockopt to sockets
Sockets can now actually implement socket options :D
2026-02-08 19:27:16 +02:00
4ec8f4a4bf Kernel/LibC: Implement rename{,at} 2025-11-22 23:55:10 +02:00
04d24bce70 Kernel/LibC: Implement {recv,send}msg as syscalls
This also removes the now old recvfrom and sendto syscalls. These are
now implemented as wrappers around recvmsg and sendmsg.

Also replace unnecessary spinlocks from unix socket with mutexes
2025-11-10 01:40:33 +02:00
f1369c8fd6 Kernel/LibC: Implement mprotect
There may be some race conditions with this but i think this is good
enough to start with
2025-08-05 03:09:24 +03:00
eecdad50a6 Kernel: Fix most of mutex + block race conditions
All block functions now take an optional mutex parameter that is
atomically unlocked instead of having the user unlock it before hand.
This prevents a ton of race conditions everywhere in the code!
2025-06-06 03:59:22 +03:00
9f4b451501 Kernel: Fix epoll deadlock
If epoll_wait and epoll_notify were called at the same time, there was a
possible deadlock when epoll was confirming the event from the inode
2025-06-01 13:48:03 +03:00
1bd454b8fd Kernel/LibC: Implement utime* family functions
This patch adds *working*
 - utime
 - utimes
 - utimensat
 - futimens
2025-06-01 13:48:03 +03:00
4d4fb3b6ec Kernel: Cleanup and fix pipe
pipe now sends SIGPIPE and returns EPIPE when writing and no readers are
open
2025-05-29 01:02:22 +03:00
12b93567f7 Kernel/LibC: Implement getpeername 2025-05-28 03:10:01 +03:00
0e0d7016b3 Kernel: Rename has_hangup -> has_hungup 2025-05-17 12:39:23 +03:00
553c76ab0f Kernel: Add locking to inode's epoll list
This was prone to crashing :)
2025-05-17 12:36:36 +03:00
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
15045cc486 Kernel: Make nonblocking sockets unblocking :) 2025-04-05 18:42:02 +03:00
713daf6cd3 Kernel/LibC: Add support for creating hardlinks 2024-12-03 16:12:26 +02:00
d58ca5f37a Kernel/LibC: Implement symlink{,at} 2024-12-02 20:13:38 +02:00
a10ca47657 Kernel/LibC: Implement {,f}statvfs 2024-12-02 20:13:37 +02:00
747c3b2a4b Kernel/LibC: Implement fsync 2024-12-02 20:13:37 +02:00
d59463d11b Kernel: Fix TTY reading one keyevent after disabling input handling 2024-09-22 17:13:10 +03:00
2b52ea4c6f Kernel: Make Inode::can_access const 2024-09-14 19:39:41 +03:00
467ac6c365 Kernel/LibC: Implement SOCK_CLOEXEC and SOCK_NONBLOCK
This removes the need for fcntl after creating a socket :)
2024-09-11 21:59:11 +03:00
c77ad5fb34 Kernel: Implement copy-on-write memory for file backed mmaps 2024-09-11 19:33:50 +03:00
bce16cdd6e Kernel: Fix how socket closing works
Sockets are now closed only when they are not referenced any more. This
allows child process to close socket and still keep it open for the
parent.
2024-06-19 10:39:44 +03:00
318ce5dec8 All: Fix a lot of compiler warnings from header files
While reworking build system, header files started to report warnings.
2024-06-18 23:02:10 +03:00
cad55a4da5 Kernel/LibC: Implement getsockname for ipv4 sockets 2024-06-17 20:54:45 +03:00
0af74fccda Kernel/LibC: Rework dirent structure
dirent now contains statically sized d_name. This allows using
sizeof on the name and dirent properly, which some programs seem
to be using.
2024-05-22 20:19:59 +03:00
d94f6388b7 Kernel: Fix all broken locks from new mutexes 2024-02-28 22:45:34 +02:00
3fc1edede0 Kernel/LibC: Implement super basic select
This does not really even block but it works... :D
2024-02-12 17:26:33 +02:00
ff49d8b84f Kernel: Cleanup OSI layer overlapping 2024-02-09 17:05:07 +02:00
e7dd03e551 Kernel: Implement basic connection-mode unix domain sockets 2024-02-08 02:28:19 +02:00
41cad88d6e Kernel/LibC: Implement dummy syscalls for accept, connect, listen 2024-02-07 15:57:45 +02:00
e1ffbb710b Kernel/LibC: Implement basic ioctl for network addresses 2024-02-03 01:50:10 +02:00
0f154c3173 Kernel: Implement basic recvfrom 2024-02-02 13:50:00 +02:00
ec2f21bb9f Kernel/LibC: Implement SYS_SENDTO 2024-02-02 03:16:01 +02:00
ab150b458a Kernel/LibC: Implement basic socket binding 2024-02-02 01:31:58 +02:00
dfe5a2d665 All: Cleanup all files
Add newline to end of files and remove whitespace from end of lines
2024-01-24 15:53:38 +02:00
96d831c31a Kernel/LibC/Userspace: Implement chown and set tty owner on login 2024-01-02 22:19:38 +02:00
12474addda Kernel: Make Inodes use the new lock
Also remove old lock from TTY since it can just use the one Inode
already has.
2023-12-07 13:19:12 +02:00
b7007016c0 BAN: Implement Ext2 file unlinking
Ext2 inodes can now be unlinked from directories and after last
inode closes (destructor gets called) we check if link count is 0
and cleanup the inode from filesystem
2023-10-25 21:43:36 +03:00
18e90d305d Kernel: Add Inode API for creating directories 2023-10-25 19:36:04 +03:00
627b8cc140 Kernel/LibC: implement chmod syscall + libc wrapper 2023-10-25 02:35:37 +03:00
f3d9da9549 Kernel: Rewrite all read/write functions to use BAN::ByteSpan
This allows us to not work with raw pointers and use sized containers
for reading and writing.
2023-10-24 11:56:00 +03:00
Bananymous
3e5645d453 Kernel: Add API for RamDirectoryInodes to delete containing inodes 2023-09-30 19:22:30 +03:00
Bananymous
43c23db4a6 Kernel: Implement MAP_SHARED for regular files
Every inode holds a weak pointer to shared file data. This contains
physical addresses of pages for inode file data. Physical addresses
are allocated and read on demand.

When last shared mapping is unmapped. The inodes shared data is freed
and written to the inode.
2023-09-29 18:59:20 +03:00
Bananymous
dd9af56e21 Kernel: Start work on making inodes more thread safe
All inode operations are now locked and thread blocked
2023-09-10 00:31:42 +03:00
Bananymous
b2139c0b1e Kernel: Add basic support for O_NONBLOCK (only for tty) 2023-09-04 12:57:52 +03:00
Bananymous
195ccf4f53 Kernel: Add missing ififo() to Inode::Mode 2023-08-31 21:38:31 +03:00
Bananymous
cd64c1cfec Kernel: add is_tty() to inode 2023-07-24 22:19:59 +03:00
Bananymous
9bcfb34524 Kernel: Rewrite whole device structure
We now have DevFileSystem which is derived from RamFileSystem. All
devices are RamInodes. We don't have separate DeviceManager anymore.
To iterate over devices, you can loop througn every inode in devfs.
2023-07-10 23:17:14 +03:00
Bananymous
d6408bcf17 Kernel: add O_TRUNC
this is not supported by anything yet
2023-07-10 15:48:18 +03:00
Bananymous
74fc0aa308 Kernel: Inode::create_file() now takes uid and gid as parameters 2023-07-10 13:32:10 +03:00