Commit Graph

2587 Commits

Author SHA1 Message Date
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
Juhani Krekelä c6e989909f Add header for working with the PS/2 mouse protocol. 2021-12-12 20:34:07 +02:00
Juhani Krekelä 8b57a79567 Change qsort(3) and qsort_r(3) to use heapsort.
Heapsort has O(n·log(n)) worst case runtime and O(1) space usage, which
is better than current implementation's best case, while still keeping
the code simple.

Co-authored-by: Jonas 'Sortie' Termansen <sortie@maxsi.org>
2021-12-12 15:18:26 +00:00
Juhani Krekelä 7e5a816749 Refactor movement code in editor(1).
Firstly, lots of places in editor(1) would do a move from (x₀,y₀) to
(x,y) by first moving to (x,y₀) or (x₀,y) and only then (x,y). If the
intermediate positions were not valid cursor positions, this might cause
out of bounds access. Categorically fixed this by removing functions for
moving only horizontally or only vertically.

Secondly, editor_select_set() would set the column before setting the
line. Since the code for setting the column accesses the currently set
line at the new cursor position, it might cause out of bounds access
even on valid cursor positions. Fixed this by swapping the order in
which column and row are set.

Thirdly, the order of arguments passed to row_column_smallest() and
row_column_biggest() was wrong, with column being passed before the row,
even though they were defined the other way. However, this did not
result in out of bounds memory accesses due to the parameters to
editor_cursor_set() also being swapped at relevant callsites.

Finally, the boundary condition for control-down was off by one.
2021-12-06 07:50:37 +02:00
Juhani Krekelä 2e193b6014 Fix possible overflow when resizing buffers and remove unncessary casts.
A line longer than 2G might overflow the size_t containing the buffer
length on 32-bit platform. Fix is to use reallocarray with second
parameter twice the size of the element to double the buffer size, since
it will error out if there was an overflow.
2021-11-02 02:11:18 +02:00
Juhani Krekelä cb4a631524 Fix indentation in switch-statement in utils/tail.c.
Sortix coding style does not indent the cases of a switch statement.
2021-10-31 00:46:13 +03:00
Jonas 'Sortie' Termansen db5b51d673 Fix spurious ptable assertion in the fork error path. 2021-10-10 00:07:06 +02:00
Jonas 'Sortie' Termansen 3048fdf7a1 Add presubmit. 2021-10-10 00:07:06 +02:00
Juhani Krekelä d4528e9401 Add dnsconfig(8). 2021-10-09 21:11:56 +03:00
Juhani Krekelä d605911ddc Make command-not-found(1) data-driven.
Previously command-not-found(1) encoded all its suggestions in code.
This changes it to use a data table to make it easier to understand and
to modify with new suggestions.
2021-10-06 23:37:08 +03:00
Jonas 'Sortie' Termansen c2088ae3ee Fix shell double quoting escaping non-special characters.
This bug was reported by Ricardo Grant.
2021-09-13 20:37:56 +02:00
Juhani Krekelä e02b84cb93 Update porting guide to reflect Sortix in upstream config.sub. 2021-08-20 13:06:46 +03:00
Juhani Krekelä 777ed060c6 Fix typos in doc/. 2021-08-20 13:03:42 +03:00