Commit Graph

169 Commits

Author SHA1 Message Date
Bananymous 1cd12b5f16 LibC: Implement length modifiers to printf 2023-09-28 11:42:57 +03:00
Bananymous 8d5369fafe Kernel: Add some functionality to disable TTY input/output
Userspace programs can call tty_ctrl() to disable/enable tty from
handling input and displaying output.

This API is probably going to change in the future to ioctl calls
but I'm not sure how ioctl is used and what functionality should it
have. I decided to create whole new function and syscall for now.

Next I will expose framebuffer in /dev/fb0 and then I can start work
on graphical environment! :D
2023-09-27 15:44:05 +03:00
Bananymous 6cb8bda6e1 LibC: add syncsync() to unistd.h
This is my own WELL NAMED (:D) function that takes a paramemeter
to make the sync operation synchronous.
2023-09-27 00:35:36 +03:00
Bananymous fc953df281 Kernel/LibC: remove PATH resoltion from kernel
I have no idea why I had made PATH environment variable parsing
to be part of the kernel. Now the shell does the parsing and
environment syscall is no longer needed.
2023-09-23 03:08:14 +03:00
Bananymous fe2dca16f0 Kernel/LibC: add flag to enable/disable sse support
SSE support is very experimental and causes GP. I decided to make
SSE not default until I get to fixing it :)
2023-09-23 02:28:25 +03:00
Bananymous f662aa6da2 Kernel/LibC: userspace malloc now uses mmap to get memory
We could remove syscalls to allocate more memory. This was not
something the kernel should have done.
2023-09-23 02:26:23 +03:00
Bananymous fee3677fb9 Kernel/LibC: add mmap for private anonymous mappings
This will be used by the userspace to get more memory. Currently
kernel handles all allocations, which is not preferable.
2023-09-22 23:01:14 +03:00
Bananymous 5fae3cec2a Kernel: Implement SYS_SYNC and add sync executable to userspace
You can (and have to) manually sync disk after writes to it.
2023-09-11 01:26:27 +03:00
Bananymous 720bc418a6 All: Clear lines with only whitspace in them 2023-09-10 00:31:42 +03:00
Bananymous 9e4a87021c Kernel: Fix directory permissions
We did not care about X bit in directories and instead used only the
R bit for search/read.
2023-09-08 11:46:53 +03:00
Bananymous 0ec4f970f7 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 a15ffcb071 LibC: add time() implementation 2023-09-04 13:52:58 +03:00
Bananymous 692b77fb8e LibC: Add rand() and srand() implementation
This code is from the wikipedia page for Permuted congruential generator
2023-09-04 13:52:13 +03:00
Bananymous 044378cfa3 Kernel: Add basic nanosleep, only millisecond percision 2023-09-04 12:59:50 +03:00
Bananymous 19d0fb6fcd Kernel: add basic fcntl() with couple of commands and no validation 2023-09-04 12:57:09 +03:00
Bananymous e8a73f9696 BuildSystem: use -a with rsync
This allows cmake to not rebuild whole project every time
2023-08-28 11:38:17 +03:00
Bananymous 1a0d114861 LibC: Don't undef needed values in inttypes.h 2023-08-24 15:48:14 +03:00
Bananymous b05cf9ef09 BuildSystem: Base sysroot is now distributed as a tar ball
This allows file and directory permissions work as intended.

cmake is now filled with 'sudo' but with sudo timeout this should be
fine.
2023-08-23 10:38:21 +03:00
Bananymous 97ea4986af Kernel/LibC: implement proper getpgid and setpgid 2023-08-22 14:53:12 +03:00
Bananymous 42b90ae76c Kernel/LibC: Add {get,set}pgrp() 2023-08-22 11:36:33 +03:00
Bananymous b10168eb1c LibC: make printf buffer only 128 bytes
Only reason for it to be big is if you want super large zero padding
for your number. This will eventually be handled without the buffer.
2023-08-18 16:49:27 +03:00
Bananymous dc7391dc89 BuildSystem: only apply stack usage warning to libc 2023-08-17 20:49:52 +03:00
Bananymous dcd8374b89 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 8e4216215e Kernel/LibC: add dup() syscall and function 2023-08-17 12:03:29 +03:00
Bananymous 9a63d3b2da LibC: printf handles nan and inf 2023-08-16 10:49:34 +03:00
Bananymous bf02330db9 LibC: math.h defines is*() macros and uses builtins for values 2023-08-16 10:41:55 +03:00
Bananymous d34c0a5abe LibC: cleanup fstatat 2023-08-11 12:25:15 +03:00
Bananymous 165a379c73 LibC: Fix S_IF* macros and add macros for access/type masks 2023-08-11 10:30:50 +03:00
Bananymous c67a7cec5b LibC: fix typo 2023-08-02 22:10:12 +03:00
Bananymous 13852e865c LibC: sys/wait.h now has proper exit status macros
We use the same format as basically every implementation
2023-08-01 10:32:04 +03:00
Bananymous 679d47131d BuildSystem: Edit build flags regarding sse and warnings 2023-07-31 22:31:17 +03:00
Bananymous 8ec6d4c9fc LibC: we don't parse syscall arguments in unistd
We just call Kernel::syscall() with 5 arguments from the variadic function.

This was a necessary addition since the syscall() function
used over 2 KiB of stack space.
2023-07-31 22:24:11 +03:00
Bananymous 432c296b7b Kernel: Implement SYS_GET_PID and SYS_TCSETPGID
we don't have consept of process groups yet
2023-07-24 22:29:59 +03:00
Bananymous adb14ba373 Kernel: Userspace signal handlers are now called one at a time
I added a syscall for telling the kernel when signal execution has
finished. We should send a random hash or id to the signal trampoline
that we would include in the syscall, so validity of signal exit can
be confirmed.
2023-07-23 13:34:53 +03:00
Bananymous 7391d91317 Kernel/LibC: add SYS_SIGNAL/signal() 2023-07-21 20:08:13 +03:00
Bananymous 2149cec29f Kernel: Make signals more POSIX 2023-07-21 20:01:12 +03:00
Bananymous ad756c36fc Kernel/LibC: Add SYS_KILL/kill() 2023-07-21 19:27:38 +03:00
Bananymous dcd4d0daeb Kernel/LibC: Add bareboness signals
You can now call raise() to raise a signal. Signal handlers are
not yet supported, but the handling works :)
2023-07-21 15:45:02 +03:00
Bananymous bba09a3cd0 LibC: add getpwname() and getpwuid() 2023-07-13 12:01:16 +03:00
Bananymous 985df3532b LibC: implement endpwent(), getpwent() and setpwent() 2023-07-13 11:22:09 +03:00
Bananymous 4972284dde Kernel: open() and openat() now take mode as parameter
O_CREAT now tries to create file if O_CREAT is specified
2023-07-10 15:08:54 +03:00
Bananymous 6d93c1eb92 LibC: add NAME_MAX to limits.h
This is defined to 255 which is _XOPEN_NAME_MAX, smallest value
for XOPEN compliance
2023-07-10 11:48:11 +03:00
Bananymous 274ecbba78 LibC: limits.h now defined OPEN_MAX 2023-07-07 23:08:49 +03:00
Bananymous a549336530 Kernel/LibC: add basic dup2 2023-07-06 23:17:54 +03:00
Bananymous 4eb95c963d Kernel/LibC: Add basic pipe() syscall and command
You can now create pipes :)
2023-07-06 22:16:26 +03:00
Bananymous 22caacd2a9 LibC: add read() and write() to unistd 2023-07-06 22:15:55 +03:00
Bananymous 3c068aa0ae Kernel/LibC: add clock_gettime() for CLOCK_MONOTONIC
This gets the number of milliseconds since boot
2023-07-06 00:38:29 +03:00
Bananymous d99e704728 LibC: Fix syscall SYS_READ and SYS_WRITE arguments 2023-06-19 10:38:29 +03:00
Bananymous 0f63cfa43f Kernel/LibC: add SYS_{SET,GET}_PWD and chdir, getpwd 2023-06-12 02:02:52 +03:00
Bananymous b254ade69b Kernel: Add SYS_GET_{,E}{UID,GID} 2023-06-11 22:37:00 +03:00