Update feature macros for interfaces added to POSIX 2024.
This commit begins the work of implementing POSIX 2024, which was
largely already implemented as extensions.
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).
Previously if argv ended with a long option that required an argument
followed by said argument, getopt_long(3) would generate an error saying
that the option requires an argument even though it was provided. This
was because the comparison of optind against argc did not account for
the fact that optind had already been incremented, causing an
off-by-one.
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>
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.
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.
This change refactors the Unix socket / pipe backend to have a ring buffer
containing segments, where each segment has an optional leading ancillary
buffer containing control messages followed by a normal data buffer.
The SCM_RIGHTS control message has been implemented which transfers file
descriptors to the receiving process. File descriptors are reference counted
and cycles are prevented using the following restrictions:
1) Unix sockets cannot be sent on themselves (on either end).
2) Unix sockets themselves being sent cannot be sent on.
3) Unix sockets cannot send a Unix socket being sent on.
This is a compatible ABI change.