Commit Graph

30 Commits

Author SHA1 Message Date
Bananymous ac9e71d9c7 LibC: Fix parsing mode from string 2024-02-20 13:25:24 +02:00
Bananymous 1ba883719a LibC: Implement popen and pclose 2024-02-14 17:22:45 +02:00
Bananymous de629291b9 LibC: Implement freopen, rewind and fix bugs in code
Now everything will be properly locked once threads are implemented.
All functions "lock" the stream for the wanted operation
2024-02-14 16:36:48 +02:00
Bananymous b56fa4a29d LibC: Implement fscanf
I had missed this when I was implementing *scanf functions
2024-02-14 14:39:22 +02:00
Bananymous 692cec8458 Kernel/Userspace/LibC: Implement basic dprintln for userspace 2024-02-05 01:24:09 +02:00
Bananymous 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
Bananymous 606a7cb313 LibC: Implement almost POSIX compliant *scanf functions
Only wchar strings and floating point values are not parsed
2024-01-24 10:33:12 +02:00
Bananymous 694cda6e40 LibC: Implement remove for stdio 2023-12-14 10:58:50 +02:00
Bananymous 00d57d783e LibC+userspace: Make everything compile with -Wall -Wextra -Werror
I added -Wall -Wextra -Werror as public compile flags to libc. Now
everything in userspace in compiled using these flags. I made all
necessary changes to allow compilation to work.

Only exception is execvp which has a large stack usage. Maybe it
should use malloc for the buffer but posix allows ENOMEM only when
kernel is out of memory... This can be fixed when fexecve is
implemented and there is no need for absolute path.
2023-12-10 19:20:14 +02:00
Bananymous 894065a67e LibC: cleanup and fix fgets
My quick fix for fgets wrote non-nullterminated newline if size was
one.

POSIX doesn't specify what happens if size == 0, so I do the same as
glibc and return NULL without setting errno.
2023-12-05 10:00:43 +02:00
Bananymous 95fc894303 LibC: fix fgets when reading empty line 2023-12-05 07:46:14 +02:00
Bananymous 921d95d18f All: Clear lines with only whitspace in them 2023-09-10 00:31:42 +03:00
Bananymous 5972c73950 LibC: fix fread implementation
fread() should read until either size*nitems bytes are read or eof
is reached.
2023-09-07 16:00:47 +03:00
Bananymous 85c6149138 LibC: add fileno() and fdopen()
fdopen() doesn't currently care about mode and will have same mode
as the underlying file descriptor.
2023-08-17 12:03:59 +03:00
Bananymous 78536f9678 Kernel/Userspace: Add basic init process
This process parses /etc/passwd and promps login screen.
When an username is entered, it will launch that users shell
2023-06-11 22:37:00 +03:00
Bananymous 68ec443e07 LibC: implement close 2023-06-11 03:29:22 +03:00
Bananymous fb17af4844 Kernel/LibC: opening standard files is done in libc 2023-05-29 20:21:19 +03:00
Bananymous dd4973ac35 LibC: fputs uses fputc instead of putc 2023-05-28 17:48:34 +03:00
Bananymous faf14b880e LibC: Rewrite all the headers.
We now have more or less posix issue 2018 conforming libc headers.

This was a really time consuming and boring operation but it had to
be done.

Now we get to actually start implementing libc :)
2023-05-26 22:31:21 +03:00
Bananymous 80d9f6131b Kernel/LibC: move file offset back to kernel
This makes keeping track of offsets easier and more proper
2023-05-26 22:31:21 +03:00
Bananymous 8ec675cca6 LibC: fix bugs with printf 2023-05-15 22:47:08 +03:00
Bananymous 49fe3d0d4f LibC: add probably functional *printf
I wrote a general printf function that takes an putc function
pointer. We can use this to implement all the printf family
functions. I haven't done thorough testing with this, but it seems
to be functional for the most part
2023-05-10 02:00:28 +03:00
Bananymous ff2e2937a5 Kernel: Remove offset from OpenFileDescriptor
This is now handled on the libc side. There might be reasons to
have it in kernel side, but for simplicity's sake I'm moving it
to libc for now :)
2023-05-09 20:31:22 +03:00
Bananymous 0cc1fb53d5 LibC: Fix bug in *printf 2023-05-09 20:30:12 +03:00
Bananymous 054c5450df LibC: syscall() now returns -1 on error and updates errno 2023-05-07 01:51:39 +03:00
Bananymous 1d42b26fce LibC: Fix some bugs 2023-04-25 13:27:01 +03:00
Bananymous 79812b34b0 LibC: fread() now does a single syscall 2023-04-25 12:38:08 +03:00
Bananymous cd74b2167d LibC: Write mostly functioning stdio 2023-04-23 14:32:37 +03:00
Bananymous ff8c0086e2 LibC: puts() now just calls syscall(SYS_WRITE, ...) 2023-04-22 15:29:38 +03:00
Bananymous a5830c5424 LibC: add stubs for a lot of functions 2023-04-05 23:58:40 +03:00