Commit graph

2510 commits

Author SHA1 Message Date
Jonas 'Sortie' Termansen
245ec6458a Fix poll(2) not just clearing revents on negative fds. 2020-03-15 23:04:28 +01:00
Jonas 'Sortie' Termansen
221fa7d954 Rewrite scanf(3) to be standards compliant.
This change adds missing features:

* %[ for pattern matching with a scanset.
* %m for allocation of strings.
* %p for pointers.
* Field width for integers.

The following features remain unimplemented, like with printf(3):

* Floating point support.
* Wide character support.
* %n$ positional parameters.

The code has been completely refactored to be much more maintainable.

The implemented features should now be standards compliant. A large number
of edge cases have been fixed.

The vscanf_callback(3) function has been renamed to vcbscanf(3) and a new
cbscanf(3) function has been added.
2020-03-07 23:31:05 +01:00
Jonas 'Sortie' Termansen
976d686779 Fix fputc(3) potentially miswriting the next byte after flushing. 2020-03-06 00:08:59 +01:00
Alexandros Alexandrou
48d826bfc5 Fix indentation in editor/display.c. 2019-04-09 15:11:53 +02:00
Jonas 'Sortie' Termansen
20c1f1d0d4 Add signal mask support to ppoll(2). 2018-12-08 22:54:28 +01:00
Jonas 'Sortie' Termansen
9993a1c0fc Add --append-to kernel(7) multiboot module option. 2018-12-08 22:54:28 +01:00
Jonas 'Sortie' Termansen
d0ab651fbd Document the options for the kernel(7) multiboot modules. 2018-12-08 22:54:28 +01:00
Jonas 'Sortie' Termansen
494ae2dc09 Recommend rw(1) in installation(7). 2018-12-08 22:38:29 +01:00
Jonas 'Sortie' Termansen
b3e9865e53 Handle SOCK_NONBLOCK at the file descriptor level. 2018-12-08 22:34:50 +01:00
Jonas 'Sortie' Termansen
bc8093f4ff Fix typos in release-iso-bootconfig(7). 2018-12-08 22:34:49 +01:00
Jonas 'Sortie' Termansen
1f659c49c6 Fix multiboot header not coming first in the executable.
The default linker script places .text.unlikely prior to .text.
2018-12-08 22:34:49 +01:00
Jonas 'Sortie' Termansen
d3a64e1163 Fix chmod(2), chown(2), and utimens(2) opening the path for writing.
The change 9d29e96c3b "Fix open(2) allowing
opening directories invalidly and check O_TRUNC errors." broke the chmod(2),
chown(2), and utimens(2) system calls on directories, because they can no
longer be opened for writing.

This changes fixes the regression by opening such paths for reading. There
is currently no filesystem permission checks for those system calls. However,
those system calls should check the permissions at the time of the operation
rather than relying on the file having been opened for writing previously.
2018-09-01 17:24:40 +02:00
Jonas 'Sortie' Termansen
5837421478 Don't unblock SIGABRT in abort(3) before calling raise(SIGABRT).
The language in POSIX mentioning overriding blocking or ignoring SIGABRT
refers to the inevitability of exiting by SIGABRT if SIGABRT isn't caught or
if the handler does return.

This implementation of abort(3) implements the standard by raising SIGABRT,
allowing the signal to be caught; and if the signal is blocked or ignored or
the handler returns, then exit_thread(2) forcefully exits the process as if
by SIGABRT.
2018-09-01 12:56:07 +02:00
Jonas 'Sortie' Termansen
918160450f Use /share/sysinstall/hooks to keep of whether hooks have run. 2018-08-15 22:51:22 +02:00
Jonas 'Sortie' Termansen
4baa7b5409 Remove superfluous 'the' in upgrade.conf(5). 2018-08-15 22:44:46 +02:00
Jonas 'Sortie' Termansen
b1ad606303 Fix system calls panicing when creating threads in the kernel process.
This fixes a regression in 62bd9bf901.
2018-08-12 23:24:42 +02:00
Kartik Agaram
9d29e96c3b Fix open(2) allowing opening directories invalidly and check O_TRUNC errors.
Among other things, redirecting to a directory will now display an error
as it should.

Also fix a bug when opening /dev/pts: O_WRITE on a directory is a POSIX
violation.
2018-08-09 23:19:07 +02:00
Jonas 'Sortie' Termansen
b767063c9a Fix deadlock when resizing display when a graphical process is running. 2018-08-08 23:46:19 +02:00
Jonas 'Sortie' Termansen
969a3e599b Fix signal dispatch if sigreturn is NULL. 2018-08-07 23:55:57 +02:00
Jonas 'Sortie' Termansen
ab228e1062 Fix Clock::LockLock setting we_disabled_interrupts before disabling interrupts. 2018-08-07 23:55:57 +02:00
Jonas 'Sortie' Termansen
5be7b52422 Fix LFBTextBuffer GetChar starting worker thread when paused. 2018-08-06 23:59:35 +02:00
Jonas 'Sortie' Termansen
4a33c460f6 Fix accidental dead code after continue in sysinstall(8). 2018-08-06 23:59:35 +02:00
Jonas 'Sortie' Termansen
62bd9bf901 Fix pid 1 deadlocking when exiting with children.
The child processes of pid 1 were being reparented to pid 1, causing an
infinite loop. This change fixes the problem by adding a hook that runs in
the last thread about to exit in a process. When pid 1 exits, the hook will
prevent more processes and threads from being created, and then broadcast
kill all processes and threads. The hook is not run in LastPrayer(), as that
function runs in a worker thread and it can't block waiting for another
thread to run LastPrayer() in the same thread.
2018-08-06 23:59:35 +02:00
Jonas 'Sortie' Termansen
c14e6c05b9 Fix waitpid(2) when the status pointer is NULL. 2018-08-06 23:59:35 +02:00
Jonas 'Sortie' Termansen
f744e80b88 Fix memory leak in mkinitrd(1) AddRulesFromFile error path. 2018-08-06 23:59:35 +02:00
Jonas 'Sortie' Termansen
e8a9d3dc04 Fix code assuming struct winsize fields are size_t. 2018-08-06 23:59:35 +02:00
Jonas 'Sortie' Termansen
8467102662 Fix ls(1) not checking stat_record()'s error correctly. 2018-08-06 23:59:34 +02:00
Jonas 'Sortie' Termansen
db90720c01 Fix code relying on <stdio.h> including <stdarg.h>. 2018-08-06 23:59:34 +02:00
Jonas 'Sortie' Termansen
29555d72bb Fix <fcntl.h> including <sys/stat.h> namespace pollution.
POSIX allows <fcntl.h> to include <sys/stat.h>, but doesn't require it.
There's little reason to do that, since they are separate headers, and
<fcntl.h> just needs the mode_t constants. Fix the code accidentally
relying on <fcntl.h> including <sys/stat.h>. The mode_t constants are now
provided in their own kernel header <sortix/mode.h>.

Additionally fix <sys/stat.h> pulling in all of <sys/types.h>, which is not
allowed by POSIX, which only requires a few types to be declared. Fix the
code accidentally relying on <sys/stat.h> including <sys/types.h>.

Finally fix <dirent.h> pulling in <stdint.h> through <sortix/dirent.h>.

The <sortix/__/dt.h> and <sortix/__/stat.h> headers are no longer required
and their contents have been merged into <sortix/__/dirent.h>.
2018-08-06 23:59:34 +02:00
Jonas 'Sortie' Termansen
9c3af039ca Fix <stdio.h> pulling in <pthread.h> through <FILE.h> when __is_sortix_libc. 2018-07-17 12:25:52 +02:00
Jonas 'Sortie' Termansen
b8a330af3b Fix carray(1) wrongly mentioning the -i option that is currently compatibility. 2018-07-17 12:25:52 +02:00
64f4f5701c Fix typos in sort(1). 2018-04-15 18:06:49 +02:00
Jonas 'Sortie' Termansen
29587a27ca Include <strings.h> in rw(1) to get strcasecmp(3). 2018-04-15 18:06:49 +02:00
Jonas 'Sortie' Termansen
02d9d888f1 Fix more typos in rw(1). 2018-04-15 18:06:48 +02:00
Juhani Krekelä
3261f766b6 Fix typo when sysinstall(8) says have to set up bootloading yourself. 2018-04-08 21:38:50 +02:00
Jonas 'Sortie' Termansen
3654b370f1 Add -R option to sort(1). 2018-04-08 20:56:46 +02:00
Jonas 'Sortie' Termansen
a209c89233 Fix POSIX comformance issues in sort(1).
Fix -C disabling checking rather than checking quietly.

Fix sort(1) exiting 1 on certain errors, as POSIX requires sort(1) to only
exit if the input wasn't sorted when -c.

Fix -o opening the output file for truncation before all the input has been
read, as POSIX requires allowing -o to be an input file.

POSIX requires sort(1) to handle input errors by either erroring with no
output, or by erroring and sorting the input read so far. Change the current
behavior of continuing to the next file to simply failing hard on the first
input error.

Don't increment the last line number on the end of the standard input.

Report -c/-C as incompatible with -o.

Exit unsuccessfully on any output errors.

Update to current coding conventions and add documentation while here.
2018-04-08 20:56:46 +02:00
Jonas 'Sortie' Termansen
53592a6e3f Fix getdelim(3) not returning a final line without a delimiter. 2018-04-08 20:35:30 +02:00
Jonas 'Sortie' Termansen
6d15ed575f Fix incorrect check for zero output block size in rw(1). 2018-04-02 14:54:11 +02:00
Jonas 'Sortie' Termansen
23438327b5 Fix quantity typo and clarify block size options in rw(1). 2018-03-31 18:22:43 +02:00
a0aed89d0a Fix typos in rw(1)'s comments. 2018-03-31 16:24:52 +02:00
Jonas 'Sortie' Termansen
397bac9862 Add support for modifying release iso images. 2018-03-31 00:55:33 +02:00
Jonas 'Sortie' Termansen
d1c3433353 Add rw(1). 2018-03-31 00:55:33 +02:00
Jonas 'Sortie' Termansen
d393b67d72 Fix st_blksize and st_blocks kernel values. 2018-03-31 00:55:33 +02:00
Jonas 'Sortie' Termansen
13658db632 Fix byte unit suffixes being called prefixes in disked(8). 2018-03-30 23:42:37 +02:00
Jonas 'Sortie' Termansen
d7e5539c35 Fix sysinstall(8) typo when selecting root filesystem. 2018-03-30 23:42:37 +02:00
Jonas 'Sortie' Termansen
66b35fb74c Fix incompatibilities in the kernel tar extraction. 2018-03-30 23:42:37 +02:00
Alexandros Alexandrou
5723610d0a Fix Ctrl+Down selecting text instead of moving cursor in editor(1). 2018-03-11 18:39:00 +02:00
Alexandros Alexandrou
82b98b4899 Fix indention in editor(1). 2018-03-11 18:10:09 +02:00
Jonas 'Sortie' Termansen
9380ed82ac Fix typo in getentropy(2). 2018-02-04 13:39:37 +01:00