Commit Graph

2555 Commits

Author SHA1 Message Date
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
Juhani Krekelä 79799b0084 Support historical syntax in head(1) and tail(1). 2021-08-17 00:03:32 +03:00
Juhani Krekelä 89b02af091 Fix release-iso-modification(7) to use modern tail(1) syntax.
Historically tail(1) used `tail -1` style syntax, but this has been
obsoleted by the modern conventional-style `tail -n 1`.
2021-08-16 21:49:00 +03:00
Juhani Krekelä 198c54ed25 Rewrite tail(1). 2021-08-15 16:16:19 +03:00
Juhani Krekelä 42c94ee36b Mark install(1) dependant on utils/cp.c and head(1) on utils/tail.c 2021-07-29 00:40:49 +03:00
Jonas 'Sortie' Termansen 63ce55e7e9 Fix reading directories not failing with EISDIR. 2021-07-28 22:21:41 +02:00
Jonas 'Sortie' Termansen 16bdb2ba84 Fix setuid(2) and setgid(2) not setting the effective user and group.
Thanks to samis for discovering this problem and the initial attempt at
fixing it.
2021-07-27 00:46:42 +02:00
Jonas 'Sortie' Termansen c28667fdf7 Add porttix-create support for a secondary tarball.
This functionality is needed for ports such as perl that needs
perl-cross extracted on top of it.
2021-07-21 14:01:06 +02:00
Jonas 'Sortie' Termansen 9a20f8cc37 Publish releases by the release name. 2021-07-20 22:11:27 +02:00
Jonas 'Sortie' Termansen 20df95f1ec Add /tix/tixinfo to the system manifest. 2021-07-20 22:08:11 +02:00
Juhani Krekelä 6385ea1957 Fix pipes reporting themselves as character devices through fstat(2). 2021-07-16 01:43:33 +03:00
Jonas 'Sortie' Termansen 2d841bae7c Fix kernel deadlock in ppoll(2). 2021-07-14 15:41:28 +02:00
Jonas 'Sortie' Termansen 6bca83b399 Add sh(1) exec builtin. 2021-06-27 15:29:26 +02:00
Jonas 'Sortie' Termansen 80f5ca398a Add ATAPI support to ata(4). 2021-06-27 13:54:56 +02:00
Jonas 'Sortie' Termansen bce37028f5 Store binary package repository in the release directory. 2021-06-24 22:35:39 +02:00
Jonas 'Sortie' Termansen fa5f1b826e Add sha256sum to release directory. 2021-06-24 22:35:39 +02:00
Jonas 'Sortie' Termansen cffa7fa7b7 Add manual pages to the release. 2021-06-24 22:35:39 +02:00
Jonas 'Sortie' Termansen aeb7e0ccfc Store kernel and initrds in the release directory. 2021-06-24 22:35:39 +02:00
Jonas 'Sortie' Termansen 5e7605fad2 Implement threading primitives that truly sleep.
The idle thread is now actually run when the system is idle because it
truly goes idle. The idle thread is made power efficient by using the hlt
instruction rather than a busy loop.

The new futex(2) system call is used to implement fast user-space mutexes,
condition variables, and semaphores. The same backend and design is used as
kutexes for truly sleeping kernel mutexes and condition variables.

The new exit_thread(2) flag EXIT_THREAD_FUTEX_WAKE wakes a futex.

Sleeping on clocks in the kernel now uses timers for true sleep.

The interrupt worker thread now truly sleeps when idle.

Kernel threads are now named.

This is a compatible ABI change.
2021-06-23 22:10:47 +02:00
Jonas 'Sortie' Termansen 29b14378e8 Fix usleep(2) sleeping 1000x too much regression. 2021-06-23 22:09:57 +02:00
Jonas 'Sortie' Termansen 4daedc31f7 Fix handling of overflow and non-canonical values in timespec APIs.
Support zero relative and absolute times in the timer API.
2021-06-22 21:48:27 +02:00
Jonas 'Sortie' Termansen 109a229b42 The Master Boot Record counts numbers of 512 bytes rather than sectors.
It seems that CD-ROMs with MBRs count number of 512 bytes rather than number
of 2048-byte sectors.
2021-06-17 23:58:19 +02:00
Jonas 'Sortie' Termansen 3b036b6c5d Add getdnsconfig(2) and setdnsconfig(2). 2021-06-13 23:27:52 +02:00
Jonas 'Sortie' Termansen 23ddc536bc Add -bdfgikhMnt options to sort(1). 2021-06-13 12:51:18 +02:00
Jonas 'Sortie' Termansen 27f81b09a6 Add /var/cache, /var/log, and /var/run. 2021-05-30 23:50:42 +02:00
Jonas 'Sortie' Termansen 9d87d76957 Abort on overlapping memcpy. 2021-05-30 23:48:19 +02:00
Jonas 'Sortie' Termansen 280ba8d64d Rewrite find(1). 2021-05-29 01:04:53 +02:00
Jonas 'Sortie' Termansen 1c9233e0c9 Add ENOMEDIUM. 2021-05-29 00:52:33 +02:00
Jonas 'Sortie' Termansen 18ba2d2fe3 Use example domain in serial-transfer(7). 2021-05-28 22:59:18 +02:00
Jonas 'Sortie' Termansen 11be0007b8 Remove ENOUSER and ENOGROUP.
The <pwd.h> and <grp.h> family of functions are supposed to return
nothing with no error set if there is no matching entry.
2021-05-10 23:26:31 +02:00
Juhani Krekelä 7f9a62d916 Implement Alt + key mapping to Esc followed by key in kernel tty 2021-05-05 00:19:56 +02:00
Juhani Krekelä 73e42780f4 Add more keybinds for scrolling in pager(1)
b commonly corresponds to Page Up, and f is added to match.

j and k for lines, ^F and ^B for pages, and g and G for home/end are from vi.

C-n and C-p for lines and C-v and M-v for pages are from Emacs.

< and > for home/end allow using Emacs M-< and M->, tho they are from less(1).
2021-05-04 22:14:47 +00:00
Juhani Krekelä 5e666dce8a Change `go to line` keybind in editor(1) from ^I to ^G
Since this is a console program, ctrl + letter gets mapped to a
control character in the range 1 to 26. Most of these control
characters are no longer in use and can safely be assumed to be
result of ctrl + letter, but ^I maps to the tab character.

I chose ^G since the keybind is memorable, and a user is unlikely
to try to type the BEL character.
2021-05-02 22:42:37 +02:00