Commit Graph

2599 Commits

Author SHA1 Message Date
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 3ae81f08b3 Add install-cross-toolchain Makefile target. 2022-07-09 20:51:13 +02:00
Jonas 'Sortie' Termansen 85e9fcde94 Change strverscmp(3) non-digit behavior to match GNU sort -V.
This behavior differs from glibc strverscmp(3) but is useful and matches
the behavior of GNU sort -V and musl strverscmp(3.
2022-07-09 20:51:13 +02:00
Jonas 'Sortie' Termansen 802b0ef1d1 Add verify-ports presubmit. 2022-07-09 20:51:13 +02:00
Jonas 'Sortie' Termansen 86f6cdb718 Fix libtheora non-safe PATH use and libpng incompatibility. 2022-07-09 20:51:12 +02:00
Jonas 'Sortie' Termansen 36d9de7f54 Fix python modules not using sysroot. 2022-07-09 20:41:15 +02:00
Jonas 'Sortie' Termansen 00681172dc Fix tix-port(8) default mirror directory. 2022-07-09 20:40:18 +02:00
Jonas 'Sortie' Termansen c4d4ba17a1 Fix extract-ports creating repository directory. 2022-07-09 20:33:12 +02:00
Jonas 'Sortie' Termansen 79327e7b5f Fix distclean-ports removing ports in development. 2022-07-09 20:33:12 +02:00
Juhani Krekelä 184f99e1ee Add -u option to date(1).
Co-authored-by: Dennis Wölfing <denniswoelfing@gmx.de>
2022-06-17 00:33:53 +03:00
Jonas 'Sortie' Termansen 5679b74675 Use SPDX license identifiers for LICENSE. 2022-06-16 00:07:48 +02:00
Jonas 'Sortie' Termansen 921e5e0d88 Fix tix.port(8) --destination=. .version file. 2022-06-16 00:03:26 +02:00
Jonas 'Sortie' Termansen 9588b0d3db Add ports to the Sortix repository.
This change imports the ports collection from the former porttix and srctix
repositories and converts them to port(5) files with metadata pointing to
the upstream release tarballs with patches checked into this repository.
Ports are now developed and versioned along with the operating system and
are automatically built per the PACKAGES environment variable. The patches
are licensed under the same license as the relevant ports.

Tix has gained support for the new port(5) format. tix-port(8) is the new
high level ports build even point that handles downloading pstream releases
into the new mirror cache directory, applying the patches, building the port
with the lower-level tix-build(8), and finally installing the binary
package. The new tix-vars(8) program parses port(5) files and the new
tix-rmdiff(8) program produces input for tix-rmpatch(8).

The old doc/ directory is discontinued in favor of manual pages documenting
the new ports system.

The obsolete porttix-create(8) and srctix-create(8) programs are removed.
2022-06-13 22:29:53 +02:00
Jonas 'Sortie' Termansen 81978ae938 Fix missing 'and' typo in installation(7) confirmation. 2022-06-11 21:33:59 +02:00
Jonas 'Sortie' Termansen c0e03e5c62 Fix tix-iso-liveconfig(8) not creating /etc in some cases. 2022-06-11 21:33:59 +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
Jonas 'Sortie' Termansen 0f0c6a3232 Include the main kernel header in some kernel files. 2022-04-26 01:08:42 +02:00
Jonas 'Sortie' Termansen a0a4030dd3 Fix kernelinfo(2) user-space pointer deference. 2022-04-26 01:08:39 +02:00
Jonas 'Sortie' Termansen fe729d6032 Fix typo in <malloc.h>. 2022-04-26 01:08:31 +02:00
Jonas 'Sortie' Termansen 4e56b01e9e Fix getopt error handling in pstree(1). 2022-04-26 01:08:28 +02:00
Jonas 'Sortie' Termansen 322c8317d6 Fix non-throwing operator new failure checks being optimized away. 2022-04-26 01:08:19 +02:00
Jonas 'Sortie' Termansen 4b376c7f16 Fix tix-build variables when using sysroot natively. 2022-04-26 01:08:18 +02:00
Jonas 'Sortie' Termansen 5eb34b4a00 Never deliver signals during stat(2), readlink(2), open(2), and truncate(2). 2022-04-26 00:50:54 +02:00
auronandace 4698562f64 Use find(1) -delete feature in tix-eradicate-libtool-la(1). 2022-04-17 19:30:25 +01:00
Juhani Krekelä e9c4946ff7 Document getdnsconfig(2) and setdnsconfig(2). 2022-03-06 16:18:12 +02:00
Jonas 'Sortie' Termansen 14960319a6 Fix find(1) always failing on exec plus. 2022-03-05 19:28:08 +01:00
Jonas 'Sortie' Termansen df9b1ded9a Implement local and remote addresses in filesystem sockets. 2022-03-03 20:52:15 +01:00
Jonas 'Sortie' Termansen 251dcda980 Flush stdout after tix-install verbose message. 2022-03-03 00:15:48 +01:00
Jonas 'Sortie' Termansen 2413627058 Fix missing function in tix-iso-bootconfig(8). 2022-03-03 00:15:48 +01:00
auronandace 292aeb3fe7 Rename CLOCK_BOOT to CLOCK_BOOTTIME. 2022-02-22 18:01:57 +00:00
Mathew John Roberts d41beab4a8 Make execve(2) require 1 <= argc. 2022-02-13 16:31:41 +00:00
auronandace aa7c6855f7 Return EBADF on negative fds for dup2(2) and dup3(2). 2022-02-10 17:56:25 +00:00
Juhani Krekelä 332d39445c Fix handling of bad file descriptors in dup(2).
Previously, sys_dup() would do dtable->Get() on the passed in-file
descriptor and then pass the result directly to dtable->Allocate(). If
the file descriptor is not valid, dtable->Get() returns a NULL reference
and sets errno to mark the error. Since sys_dup() did not check the
return value of dtable->Get() and dtable->Allocate() does not check
whether the passed in Ref<Descriptor> is a NULL reference, dup(2) with
invalid file descriptor would succesfully allocate a new file descriptor
with garbage contents.

This commit changes sys_dup() to use a variant of dtable->Allocate()
that takes in a file descriptor as an integer and properly validates it
before use.
2022-02-10 00:06:25 +02:00
auronandace f8d4d3d635 Replace perror(3) with err(3). 2022-02-05 18:20:08 +00:00
Jonas 'Sortie' Termansen 23832546d5 Fix chown(2) not supporting -1 to not set the owner and group. 2022-01-15 20:48:54 +01:00
Jonas 'Sortie' Termansen 432e5ddeaf Add bootloader setting for not loading the src initrd. 2022-01-12 21:34:26 +01:00
Jonas 'Sortie' Termansen 31e3a20bca Fix wrong minor ABI version in sysmerge(8) ABI transition notice. 2022-01-12 21:19:53 +01:00
Jonas 'Sortie' Termansen 4e86394e3d Fix the kernel having an .init section linked at a high address.
The .init section for global constructors in the kernel is unused at the
moment as the _init function is never invoked, but its existence means
it got linked at 128 MiB on i686. This address isn't mapped by the
kernel and the bootloader requires the machine to have that much
physical memory. Unfortunately that meant the i686 build didn't work on
machines with less than 129 MiB of memory.
2022-01-12 21:19:53 +01:00
Juhani Krekelä ffc3751713 Fix typos in hier(7), installation(7), and upgrade(7). 2022-01-10 15:20:30 +02:00
Juhani Krekelä 4e72c78dc1 Support i686 without SSE.
Previously Sortix would initialize SSE unconditionally as part of the
boot process. Since earlier i686 CPUs like Pentium 2 did not include
SSE, Sortix would not run on them. With this SSE is only enabled for
CPUs that include it, which should theoretically allow Sortix to boot on
all i686 CPUs. Additionally, this removes -msse -msse2 compiler flags
from trianglix/Makefile.
2022-01-09 23:38:16 +02:00
Jonas 'Sortie' Termansen ac9c24219b Implement RFC5424 syslog version 1. 2022-01-05 22:00:53 +01:00
Jonas 'Sortie' Termansen 3c43f71084 Implement file descriptor passing.
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.
2021-12-31 22:24:11 +01:00
Jonas 'Sortie' Termansen b9898086c6 Add file descriptor table reservations.
The file descriptor table now allows reserving room for multiple file
descriptors without assigning their numbers. This functionality means
any error conditions happen up front and the subsequent number
assignment will never fail.

This change uses the new functionality to fix troublesome error handling
when allocating multiple file descriptors. One pty allocation error path
was even wrong.

There were subtle race conditions where one (kernel) thread may have
allocated one file descriptor, and another thread spuciously replaces it
with something else, and then the second file descriptor allocation
failed in the first thread, and it closes the first file descriptor now
pointing to a different file description. This case seems harmless but
it's not a great class of bugs to exist in the first place. The new
behavior means the file descriptions appear in the file descriptor table
without fail and never needs to be cleaned up midway and is certainly
immune to shenangians from other threads.

Reviewed-by: Pedro Falcato <pedro.falcato@gmail.com>
2021-12-31 22:24:07 +01:00
Juhani Krekelä 42f6a359d1 Add search to editor(1). 2021-12-13 09:52:21 +02:00
Jonas 'Sortie' Termansen 20648e03d7 Send SIGCHLD to init even for reparented processes. 2021-12-12 22:13:05 +01:00
Jonas 'Sortie' Termansen db4ab331c7 Fix <psctl.h> using the same include guard as <sys/ioctl.h>. 2021-12-12 22:13:05 +01:00
Jonas 'Sortie' Termansen e65ff1827c Add __stack_chk_fail_local needed by some architectures. 2021-12-12 22:13:05 +01:00
Jonas 'Sortie' Termansen 4ed2bb1c50 Fix unused variable warning in pstree(1). 2021-12-12 22:13:05 +01:00
Jonas 'Sortie' Termansen cd8dcdec55 Add -gp options to pstree(1). 2021-12-12 19:47:38 +01:00