Commit Graph

445 Commits

Author SHA1 Message Date
Jonas 'Sortie' Termansen 0ff1b68c09 Add WCOREDUMP. 2024-06-23 23:22:50 +02:00
Jonas 'Sortie' Termansen c3c59403c9 Add NSIG_MAX. 2024-06-23 22:50:02 +02:00
Jonas 'Sortie' Termansen 5c896e027a Add ESOCKTNOSUPPORT. 2024-06-23 19:56:50 +02:00
Jonas 'Sortie' Termansen 8618c1adf5 Add GETENTROPY_MAX. 2024-06-23 13:50:27 +02:00
Jonas 'Sortie' Termansen 442aa49070 Modernize process and thread member variable names. 2024-06-22 18:25:49 +02:00
Jonas 'Sortie' Termansen bfa2083ff0 Fix ppoll(2) EINTR handling. 2024-06-22 18:25:49 +02:00
Jonas 'Sortie' Termansen 6e51c1ae51 Add init groups.
Every process now has an init process like it has a session, and each
session belong to an init. Orphaned processes are reparented to its init
process. All descendent processes are SIGKILL'd when an init process exits
and creating additional processes/threads fails.

Add setinit(2) for becoming the init process for your child processes and
add getinit(2) for locating your init process.

Add TIOCSCTTY force flag that releases a terminal from its current session
and makes it the controlling terminal for the current session. This ioctl
is essential to transferring the controlling terminal to a nested init,
which has its own session.

Add TIOCUCTTY that releases the terminal as the controlling terminal for
its current session.

Remove INIT_PID as it is replaced by getinit(2).
2024-06-22 18:25:49 +02:00
Jonas 'Sortie' Termansen 12ef28d590 Revert "Schedule interactive threads fairly under load."
This reverts commit 47731b91c37933943a73010c5a4494101cce52dc.

There is a rare freeze when the scheduler fails to run anything.
2024-06-22 18:25:48 +02:00
Jonas 'Sortie' Termansen a2b6b05838 Schedule interactive threads fairly under load.
Preempted threads are now removed from the runnable list until every
other thread has been preempted or the system goes idle. This ensures
threads that roundtrip to other threads get a full chance to perform
their work cooperatively without being starved by CPU intensive threads
whenever they yield.
2024-06-22 18:25:48 +02:00
Jonas 'Sortie' Termansen 784481dab6 Add kernel(7) --firmware option. 2024-06-22 18:25:48 +02:00
Jonas 'Sortie' Termansen c6f6aaa285 Add terminal and interrupt support to com(4). 2024-06-22 18:25:48 +02:00
Jonas 'Sortie' Termansen 39072cbcff Work around pty deadlock. 2024-06-22 18:25:48 +02:00
Jonas 'Sortie' Termansen c9917c00a1 Revert "Parallelize driver initialization."
This reverts commit 0fef08bbc4.
2024-06-22 18:25:48 +02:00
Jonas 'Sortie' Termansen f0d03cdd57 Parallelize driver initialization. 2024-06-22 18:25:48 +02:00
Jonas 'Sortie' Termansen a8eba7e85f Speed up ata(4) 400 ns waits.
Waiting for any non-zero duration currently waits for at least one timer
cycle (10 ms), which is especially expensive during early boot.

The current workaround of simply reading the status 14 times seems really
suspicious although the osdev wiki documents it, but let's see how well it
works on real hardware, it's probably good enough.

Try to determine the initial selected drive to save one drive selection.
2024-06-22 18:25:48 +02:00
Jonas 'Sortie' Termansen 61c6f65839 Decrease PS/2 timeouts. 2024-06-22 18:25:48 +02:00
Jonas 'Sortie' Termansen fd58b62068 Add kernel virtual address space usage debug information. 2024-06-22 18:25:48 +02:00
Jonas 'Sortie' Termansen f636b310f6 Debug TCP socket state listing. 2024-06-22 18:25:48 +02:00
Jonas 'Sortie' Termansen eb1f28c738 Add kernel heap allocation tracing debug facility. 2024-06-22 18:25:48 +02:00
Jonas 'Sortie' Termansen bf1d15957e Implement SIGWINCH. 2024-06-22 17:23:51 +02:00
Jonas 'Sortie' Termansen ecd5217da8 Separate filesystem socket namespace inside chroots. 2024-06-22 17:23:51 +02:00
Jonas 'Sortie' Termansen 8b0911c672 Fix SIGHUP not being sent to only the foreground process group. 2024-06-18 22:17:06 +02:00
Jonas 'Sortie' Termansen 6ef4f49dad Add unix(4) SO_ERROR. 2024-05-22 13:27:34 +02:00
Jonas 'Sortie' Termansen 153cd1817b Remove unused <sortix/types.h>. 2024-05-22 13:27:34 +02:00
Jonas 'Sortie' Termansen 3152413ff0 Avoid pedantic warnings in POSIX <signal.h>.
The -Wpedantic warnings are only supported in C <signal.h> mode, but the GCC
build and other ports use this kinda-unsupported mode and produce a lot of
these needless warnings, so remove the trailing commas in the enums.
2024-03-25 23:21:39 +01:00
Juhani Krekelä fc20a4f6a3 Support CSI n L and CSI n M in console and terminal(1).
With these escapes supported, include definitions for line deletion
(dl1, dl) and insertion (il1, il) in terminfo for "sortix".
2023-12-26 19:24:00 +02:00
Jonas 'Sortie' Termansen 95cf3fba98 Save kernel options upon installation. 2023-12-19 00:05:42 +01:00
Jonas 'Sortie' Termansen dc98bcf0ca Add options to kernelinfo(2). 2023-12-19 00:05:42 +01:00
Jonas 'Sortie' Termansen 4533a2ade2 Remove mkinitrd(8). 2023-08-26 14:15:12 +02:00
Jonas 'Sortie' Termansen d189183900 Third generation Tix.
The .tix.tar.xz binary package format now stores the contents in the root
rather than the data/ subdirectory and the tix metadata now has the same
layout as the loose files in /tix, such that a .tix.tar.xz package can
simply be directly extracted into the filesystem. The /tix/manifest/ is now
included in the binary package rather than being generated on installation.

The /tix/collection.conf and /tix/tixinfo metadata files are now in the
tix-vars(1) format in the style of port(5).

The /tix/installed.list file has been removed since it isn't loose file
compatible and one can list the /tix/tixinfo directory instead.

The /tix/repository.list file has been removed since the feature is unused
and doesn't match the future direction of tix.

The kernel support for tix binary packages has been removed since it will
simply install by extracting the tar archive into the root filesystem.

Add the post-install sha256sum to the port version stamp.
2023-07-15 16:43:27 +02:00
Jonas 'Sortie' Termansen ffc1b02b94 Remove workaround for qemu 1.4.x and 1.5.x.
These releases are now 10 years old and are no longer a concern.
2023-07-12 21:54:57 +02:00
Jonas 'Sortie' Termansen e933eb5a1c Replace mkinitrd(1) with tar(1).
The custom initrd format was originally useful when it was mounted,
however it has been extracted into the ramfs for a very long time and
has no advantages over the standard tar format which can be readily
created and modified using standard tools. The kernel initrd(7) support
already supports tar, so this change simply switches the format.
2023-07-12 21:45:11 +02:00
Jonas 'Sortie' Termansen caa92556c5 Try the router when ARP hasn't found neighbors. 2023-04-08 17:17:30 +02:00
Jonas 'Sortie' Termansen cb88c18bf0 Fix system calls returning errno values instead of setting errno. 2023-04-06 23:26:10 +02:00
Jonas 'Sortie' Termansen 9033153c47 Add sub_leap_seconds(3) and add_leap_seconds(3).
Advertise leap seconds being counted via CLOCK_REALTIME_HAS_LEAP_SECONDS.
2023-03-27 00:06:33 +02:00
Jonas 'Sortie' Termansen 8a4548db7d Add memory statistics to struct psctl_stat.
This is an incompatible ABI change.
2023-03-09 20:27:18 +01:00
Jonas 'Sortie' Termansen 2cd7361294 Add memusage(2).
Switch xz to memusage(2) and fix native self-cross issue.

This is a compatible ABI change.
2023-03-09 20:27:17 +01:00
Jonas 'Sortie' Termansen 18cb2651be Support \e[6n for reporting cursor position. 2023-02-26 12:10:58 +01:00
Jonas 'Sortie' Termansen 28cff2f185 Fix listen(2) failing if called twice. 2023-02-17 23:26:05 +01:00
Jonas 'Sortie' Termansen 384218d787 Fix the the. 2023-02-17 23:25:40 +01:00
Jonas 'Sortie' Termansen f291054465 Add em(4) driver.
Co-authored-by: Meisaka Yukara <Meisaka.Yukara@gmail.com>
2023-01-09 23:58:19 +01:00
Jonas 'Sortie' Termansen 2ef6804ead Add networking stack.
This change adds all the kernel parts of a network stack. The network stack
is partial but implements many of the important parts.

Add if(4) network interface abstraction. Network interfaces are registered
in a global list that can be iterated and each assigned an unique integer
identifier.

Add reference counted packets with a cache that recycles recent packets.

Add support for lo(4) loopback and ether(4) ethernet network interfaces.
The /dev/lo0 loopback device is created automatically on boot.

Add arp(4) address resolution protocol driver for translation of inet(4)
network layer addresses into ether(4) link layer addresses. arp(4) entries
are cached and evicted from the cache when needed or when the entry has not
been used for a while. The cache is limited to 256 entries for now.

Add ip(4) internet protocol version 4 support. IP fragmentation and options
are not implemented yet.

Add tcp(4) transmission control protocol sockets for a reliable transport
layer protocol that provides a reliable byte stream connection between two
hosts. The implementation is incomplete and does not yet implement out of
band data, options, and high performance extensions.

Add udp(4) user datagram protocol sockets for a connectionless transport
layer that provides best-effort delivery of datagrams.

Add ping(4) sockets for a best-effort delivery of echo datagrams.

Change type of sa_family_t from unsigned short to uint16_t.

Add --disable-network-drivers to the kernel(7) options and expose it with a
bootloader menu. tix-iso-bootconfig can set this option by default.

Import CRC32 code from libz for the Ethernet checksum.

This is a compatible ABI change that adds features to socket(2) (AF_INET,
IPPROTO_TCP, IPPROTO_UDP, IPPROTO_PING), the ioctls for if(4), socket
options, and the lo0 loopback interface.

This commit is based on work by Meisaka Yukara contributed as the commit
bbf7f1e8a5238a2bd1fe8eb1d2cc5c9c2421e2c4. Almost no lines of this work
remains in this final commit as it has been rewritten or refactored away
over the years, see the individual file headers for which files contain
remnants of this work.

Co-authored-by: Meisaka Yukara <Meisaka.Yukara@gmail.com>
2022-12-11 13:40:34 +01:00
Jonas 'Sortie' Termansen 3154492dcf Fix deadlocks and lost wakeups in threading primitives.
The futex and kutex implementations used the same linked list for waiting,
however the futex implementation used kutexs and the same thread could be in
the same list twice in the case of contention. This case corrupted the wait
lists and led to deadlocks and lost wakeups. This change fixes the problem
by having separate data structures for futexes and kutexes.

Mutexes contended by multiple threads could lead to lost wakeups since only
one contended thread was awoken and subsequent unlocks are unaware of the
unawakened contended threads. This change fixes the problem with a temporary
solution of waking all the contended threads until a better design is
implemented.

Additional details are tweaked to be more reliable and simpler.
2022-12-10 21:29:23 +01:00
Jonas 'Sortie' Termansen cbf16b4891 Fix absolute timers triggering in the wrong order. 2022-12-03 22:43:33 +01:00
Jonas 'Sortie' Termansen 68a278ddb3 Fix pty write and read logic. 2022-12-03 22:36:34 +01:00
Jonas 'Sortie' Termansen a8c05711aa Switch bga(4) to the new PCI API. 2022-11-16 20:22:29 +01:00
Jonas 'Sortie' Termansen 0f348c192b Fix sethostname(2) nul termination. 2022-10-23 14:42:10 +02:00
Jonas 'Sortie' Termansen 611dc22e73 Standardize header include guards.
This change makes all the standard library and kernel headers use header
guards with a consistent scheme within the reserved namespace to avoid
conflicts with non-standard-library-implementation code.
2022-07-09 20:51:13 +02:00
Jonas 'Sortie' Termansen 0765ac2129 Fix dtable allocation overflow on INT_MAX. 2022-06-09 22:47:06 +02:00
Jonas 'Sortie' Termansen 22f4fd859e Remove kernel thread alignment since malloc is already 16-byte aligned. 2022-04-26 01:08:46 +02:00