• v0.6.0 fd402083d7

    apio released this 2024-01-06 18:46:42 +00:00 | 191 commits to main since this release

    Happy new year!

    As you can see from the date of the previous release, monthly beta releases are a thing of the past. I don't think I can manage doing a full release every month (depends on what you call a release), as I've not been working on Luna that much, and I prefer not having a deadline. From now on, releases will be whenever there's enough interesting things to show and the system is reasonably stable :)

    And yes, I know this release is still beta, but I decided the changes here were enough to warrant a new release name.

    The big change (drum roll...)

    Screenshot from 2024-01-06 18-18-42.png

    Luna has gone graphical! (#38)

    I had a lot of fun implementing the GUI over the summer, but I kept delaying making a release out of it since I felt it was not good enough for a release. During the following months, I have been adding a few nice features (event loops, running as a separate user, client side decorations), and although it is still far from complete, I feel it is good enough (and stable) to release!

    Part of this has been removing the virtual terminal support from the kernel. I think a full-blown terminal emulator should not be built into the kernel, but for people who want a full-CLI environment, the kernel provides enough primitives to implement one in userspace (something like kmscon for example).

    Additionally, I don't want to build a GUI on top of a TTY. In Linux (as far as I know), GUI sessions are started inside an obligatory TTY session (for example /dev/tty1). I prefer having the CLI be optional.

    The GUI system is made up of:

    • A display server, /usr/bin/wind. (The name stands for WINdow Daemon, even though it's not a daemon, I liked the name). The display server only handles window compositing (the windows are rendered directly as provided by client programs, even the titlebar is client-side) and moving, and input, everything else is done by other programs. The idea is to make the GUI as modular as possible. Applications connect to the display server through the UNIX socket located at /tmp/wind.sock. This means only one GUI session can run at a time, I'll see if I want to change this in the future or not.
    • A UI library, libui. This library communicates with the display server, draws window titlebars (in the future, applications will be allowed to override this and make their own titlebars if they so desire), dispatches events to their proper handlers and provides a widget system for applications to compose UIs. It also contains code to draw PSF font glyphs, and decode and draw TGA images.
    • A taskbar, /usr/bin/taskbar. It operates completely independently from the display server, and uses the same APIs as any other UI program (it does not have any special privileges within the UI system). It does not draw a titlebar, and queries the screen size to draw itself in the correct position (which any application could do if they wanted to). The entries in the taskbar are built-in for now. One problem that stems from the fact that it is treated as a normal window is that windows can be dragged on top, and clicking on it can remove the focus from another window. I might change this in the future, however for now I'm not sure how I want to do it.
    • UI applications! Currently only a terminal emulator, a clock, an about dialog, a game of life simulation, and a 2048 game (must be run from the terminal, since it is not on the taskbar yet. The program is at /bin/2048).

    Other significant features

    1. Pseudoterminals

    PTYs were a prerequisite for implementing a GUI terminal in userspace.

    2. POSIX timers and setitimer()

    Programs might want more flexible timers than alarm(), with precision less than one second. First, setitimer() was added, then the POSIX timer API, which lets you create multiple timers at once. This can be used with libos's EventLoops using the os::Timer class.

    3. Supplementary groups

    Extra groups were added in this release, which were needed to run the display server as a separate user while still making sure programs could connect to it. No id program to read your supplementary groups yet though.

    4. POSIX sessions

    Allows for greater control over pseudoterminals, also used in the GUI system.

    5. GCC can be compiled for Luna

    Note the use of the word "compiled": a GCC executable for Luna can be produced. Programs cannot be compiled with it yet. It used to crash soon after startup because of an issue we had with global constructors, but that was fixed. Now it crashes in the middle of the compilation process. Woo, progress!!

    Other features:

    • Add support for files larger than 4MB in the ext2 driver
    • Improve the kernel mutex system
    • Add POLLHUP to the poll() syscall and store it when a polled socket's peer disconnects
    • Add basic IPC message framework to libos
    • Allow performing extra actions when opening an inode
    • Allow sending signals to process groups from userspace
    • Allow mapping the framebuffer even if its size is not page-aligned
    • Remove the kernel TTY and support only userspace terminals
    • Move pseudoterminal input processing to kernel-space
    • Implement openpty() and forkpty()
    • Add support for WorkingDirectory keys to init
    • Support the -R flag and add better verbose messages to cp
    • Add a 2048 game
    • Add a clock application
    • Lookup and print symbols for addresses in backtraces
    • Handle SIGCHLD signals in init
    • Add /dev/tty
    • Add ctermid, pclose, WUNTRACED, and a madvise stub
    • Move kernel file descriptor code into its own separate file
    • Add a registry for file system implementations
    • Implement thread stopping and continuing
    • Add a timer queue with more versatility than simple alarm()
    • Add setitimer()
    • Add support for supplementary groups
    • Allow disabled passwords and support supplementary groups in su
    • Recognize sockets properly in stat
    • Add stack diagnostics to userspace fault reporting
    • Add a useful script to develop ports

    Fixes:

    • Fix sector number calculation for ATA drives
    • Remove unused legacy variable from sys_mmap()
    • Remove some shared pointers in libos and change them to owned/live on the stack
    • Fix the poll() syscall
    • Handle interrupted reads properly in IPC code
    • Fix sending signals to threads that are in a long syscall
    • Start clearing caches when free memory is lower than 4MiB
    • Schedule cache clears only on certain checkpoints
    • Do not allow sending signals to dying threads
    • Avoid page faults when reading from a slave pseudoterminal after the master is destroyed
    • Rename Scheduler::new_userspace_thread in the kernel to clarify that it's only meant for init
    • Remove unused stray script file
    • Fix off-by-one error in kernel symbol lookup and add locking
    • Add locking to BinaryFormat and DeviceRegistry
    • Show symbols correctly when at the beginning of a function
    • Rework the entire time system to use modular clocks
    • Set the initial foreground process group when acquiring a controlling terminal
    • Correctly register file times for more file systems and file types
    • Call global constructors in userspace code
    • Show stacktraces on all signal terminations
    • Reenable stack tracing in kernel-mode exceptions
    • Unify panic messages
    • Fix kernel panic when adding a timer before another one
    • Read password from /dev/tty instead of stdin in su

    Try this release: Luna-0.6.0.iso

    Command: qemu-system-x86_64 -cdrom Luna-0.6.0.iso -enable-kvm -m 1G -serial stdio

    Downloads