Commit Graph

262 Commits

Author SHA1 Message Date
1dc26d3c06 Kernel: Cleanup inode stat updating
Inode now handles stat upates itself and calls sync function to make
updates visible on the underlying filesystem
2026-05-19 13:00:05 +03:00
a05fcdde8c Kernel: Move UTIME_OMIT handling to the syscall from inode 2026-05-19 11:56:12 +03:00
deb2f52a35 Kernel: Add support for named pipes
These only copy inodes stat when created, if you fchmod/fchown a named
pipe, the change will not be visible on the filesystem
2026-05-19 00:15:25 +03:00
8224659c48 Kernel: Allow creating FIFOs in tmpfs 2026-05-19 00:05:22 +03:00
ef2738bfb7 Kernel: Disable devfs device add/remove logging 2026-05-17 03:38:18 +03:00
b2f795b1e1 Kernel: Pipe ignore tc attr ioctls 2026-05-15 21:23:19 +03:00
16967cd9c0 Kernel: Replace is_* with kind field
Replaced the is_* virtual functions with a kind field instead
2026-05-15 21:23:12 +03:00
647d6a273d Kernel: Changed stat values from func to be field
- Removed virtual functions for all of the stat stuff.
This did however introduce some issues, mainly with /proc
becoming out of sync if you changed your ID. I propose we
do the linux thing and just have a stat update function
which is optional, but allows dynamic updates of stat fields
for cases such as those in uid/gid in /proc.
- Simplified the API, although still kind of annoying
it is a bit simpler.
- Moved some of the FS structure from having the FS inode inside
the in memory inode to a Serialise <-> Deserialise model where
Inodes are deserialised from disk into in memory ones and then
back into on disk ones when it comes time for syncing.
This makes it semantically better in my opinion, as it explicitly
separates disk and non-disk functionality.
2026-05-15 20:49:04 +03:00
c352fb600f Kernel: Reduce ext2 locking
Replace the mutex with a rwlock and lock when its not necessary
2026-05-14 17:23:06 +03:00
5f237abc3b Kernel: Don't lock Ext2FS while reading and writing blocks
There is really no reason for this. The underlying block devices are
(should be) thread safe themselves
2026-05-09 23:28:00 +03:00
0bf7328e04 Kernel: Handle TIOC{G,S}WINSZ on pipes
GCC likes to do this a lot and debug logging is excessive
2026-05-09 23:28:00 +03:00
9f4271f6d8 Kernel: Remove the big inode lock
This moves locking to the inodes themselves which allows reducing lock
times significantly. Main inodes (ext2 and tmpfs) still do contain a
single big mutex that gets locked during operations but now we have the
architecture to optimize these.
2026-05-09 23:28:00 +03:00
dfe24b69e0 Kernel: Don't keep devfs locked while performing disk sync 2026-05-04 20:26:02 +03:00
c849293f3d Kernel: Add support for loading gzip compressed initrd 2026-04-13 16:48:57 +03:00
c1a424a635 Kernel: Implement linux's eventfd 2026-03-17 20:24:06 +02:00
8b8af1a9d9 Kernel: Rewrite pipes using the new ring buffer 2026-02-28 14:20:52 +02:00
a51a81b6cd Kernel: Move {set,get}sockopt to sockets
Sockets can now actually implement socket options :D
2026-02-08 19:27:16 +02:00
c9a8f5b456 Kernel: Fix ext2 fileystem super block backups
Check if rev >= 1 sets sparse superblock feature instead of assuming it
is set
2026-01-11 19:55:10 +02:00
cae2b3bd14 Kernel: Cleanup ext2 indirect block lookup
If we are not allocating and the block is null, add a fast path to
delete it. This also prevents possibly blocking filesystem block wrapper
allocation
2026-01-11 04:00:04 +02:00
5637b8602b Kernel: Fix setting ext2 symbolic link target
If a link was >= 60 bytes but got shrinked to 60 bytes, reading it would
rebort garbage and unlinking it would leak blocks
2026-01-11 03:58:48 +02:00
ed82a18e2a Kernel: Fix deadlock in ext2 filesystem
If multiple threads were waiting for more block buffers without anyone
releasing them, they ended up in a deadlock.

Now we store 6 blocks for 8 threads. If a thread already has a block
buffer, it will not have to wait for a new one. Only if there are more
than 8 threads using blocks, will it block until there are free slots
for a thread available.
2026-01-10 00:30:30 +02:00
e26aac3067 Kernel: Decrease the number of syncs done by ext2 inodes
Each allocated inode used to call sync(). Each sync reads and writes
a block from the filesystem. Doing a 1 MiB write ended up syncing around
257 times
2026-01-01 23:54:09 +02:00
941e8aa5d5 Kernel: Optimize ext2 filesystem
block lookup can now also allocate blocks so there is no need to do
multiple lookups of the block did not exist
2026-01-01 23:15:35 +02:00
9fbd9288b2 Kernel: Fix symlink deletion from tmpfs
Small symlinks store their target in inline storage of data block
indices. Freeing blocks did not account for this and tried to interpret
the link target as block inidices to delete
2026-01-01 20:40:38 +02:00
7fdfad4088 Kernel: Mount /tmp with sticky bit set 2025-12-31 19:28:55 +02:00
9d0990e5e8 Kernel: Implement /proc/<n>/fd 2025-11-24 00:19:51 +02:00
4ec8f4a4bf Kernel/LibC: Implement rename{,at} 2025-11-22 23:55:10 +02:00
fff5139d80 Kernel: Add /proc/<n>/cwd
Also update /proc/<n>/* permissions to match what linux does :D
2025-11-18 05:40:36 +02:00
dd636ffcb2 Kernel: Add support for SA_SIGINFO 2025-11-17 05:26:07 +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
979059c804 Kernel: Implement ext2 symlinks with >= 60 byte target 2025-11-06 17:21:36 +02:00
da39e98adf Kernel: Make F11 drop disk cache
This can be useful to detect memory leaks or something
2025-08-31 00:36:59 +03:00
30215963b2 Kernel: Fix /proc/<pid>/exe permissions 2025-08-29 01:40:56 +03:00
391fc0c4c2 Kernel: Don't crash if Ext2 filesystem doing too many fileops
I had a hardlimit of 10 block buffers and if they ran out, the kernel
would crash. this patchs increases the number of buffers to 16 and
removes the crash condition when they run out :D
2025-08-28 15:55:40 +03:00
6976a2dae7 Kernel: Add hardlink support to USTAR
Also handle file types L and K for long file names and link names
2025-08-28 15:55:40 +03:00
51cd951b4c Kernel: Add hardlink support to tmpfs 2025-08-28 15:55:40 +03:00
16a5a234c1 Kernel: Cleanup hardlink creation 2025-08-28 15:55:40 +03:00
d9c91589f0 Kernel: Don't limit /tmp max size 2025-08-28 15:55:40 +03:00
abbe7b79d6 Kernel: Add /proc/<pid>/exe 2025-08-28 15:55:40 +03:00
e4abe75043 Kernel: Add /proc/self 2025-08-28 15:55:40 +03:00
9d6656451a LibC: Make time_t signed integer
Some port like python3 assumes this is the case
2025-08-19 16:23:30 +03:00
ef6ee78fd1 Kernel/LibC: Implement chroot 2025-08-11 14:07:37 +03:00
de7c3d3d29 Kernel: Don't try to create . in USTAR
Our build system adds . entry to the tar archive and it should be
handled as an no-op
2025-08-07 19:35:13 +03:00
f7c1084c3e Kernel: Expose boot command line in /proc/cmdline 2025-08-05 03:09:24 +03:00
d8a695a88d Kernel: Don't fail ustar unpack when creation fails 2025-08-05 03:09:24 +03:00
7a054787ca Kernel: Don't print error if root is empty
This is used when loading filesystem from initrd
2025-07-18 19:09:43 +03:00
5874fd640e Kernel: Fix TmpFS for 32 bit target
There was a problem when sizeof(size_t) != sizeof(PageInfo)
2025-07-18 19:07:32 +03:00
8a0269d29e Kernel: Remove kernel processes
Kernel can just use raw threads, pretty muchs the only thing that
process provides is syscalls which kernel threads of course don't
need.

Also this makes init process have pid 1 :D
2025-07-02 01:54:03 +03:00
a5b4cee298 Kernel: Load USTAR from a boot module if loading root partition fails
This allows banan-os to boot on hardware where we don't have working
storage driver or the storage driver fails (pretty common with my usb
mass storage drivers...)
2025-07-02 00:17:42 +03:00
c67198032f Kernel: Rewrite TmpFS block and inode allocation
This makes creating files and appending to then A LOT faster. Some code
I tested took 40 seconds in the previous implementation and less than a
second on the new one!

This code is really sketcy, I hope I'll never have to touch it again :)
2025-07-02 00:17:42 +03:00