I have no idea why libc had no optimizations enabled.
Weird thing is that memcpy optimized to infinite loop if I kept the
__restrict__ attributes in pointers. I don't think there was any ub.
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.
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
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 :)
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
We used to copy all headers everytime to sysroot which caused
rebuild of the whole os. Now we use the cmake command
'copy_directory_if_different' which seemed to fix this issue :)
I have been annoyed for a while since I had to build everything
when running the os since the buildsystem was really bad.
I wanted to rewrite the whole build system and changed to using cmake
:)