Commit Graph

232 Commits

Author SHA1 Message Date
Giacomo Tesio ea21d3cd2d libposix: add support for O_NONBLOCK
We keep a list of non blocking fds and use awake to
make them not block on read, write, pread and pwrite.
2018-01-15 22:37:27 +01:00
Giacomo Tesio 96f5c08548 cmd: hmi/pipeconsole -P serve /dev/tty instead of /dev/cons (for use with mksh) 2018-01-08 01:23:52 +01:00
Giacomo Tesio 2bf39bf38a kern: rename /dev/swap in /dev/sysmem
Jehanne has no SWAP.

And I do not want to explain to my daughters what SWAP **was**.
2018-01-07 07:14:08 +01:00
Giacomo Tesio d04c776f3c Fix Minnich's Copyrights
As far as I can remember the new `dc` argument added to the `mount`
system call is the only API innovation that I imported from Harvey-OS
in the Jehanne's kernel.

It's a great idea of Ronald G. Minnich, introduced at

	72777a1fab

Since he didn't amended the copyright statements in Harvey, I forgot
to amend it here.

Sorry, my fault.
2018-01-06 01:09:04 +01:00
Giacomo Tesio dd9aa0e0a6 More explicit Copyright in files 2018-01-06 01:09:04 +01:00
Giacomo Tesio c7d0f621c9 Clarify Forsyth's and 9front's copyrights
I'm very grateful to Charles Forsyth for creating most of Jehanne's kernel
and to 9front's guys for all the code and ideas they freely share.

Here I make their copyrights explicit as they had been erroneusly omitted
or messed up before. Sorry.
2018-01-05 02:30:45 +01:00
Giacomo Tesio 8ed3e74c3f libposix: fix setpgid: if the target process is already a group leader, do nothing 2017-12-25 13:13:09 +01:00
Giacomo Tesio 464eee3ed8 rc: use /dev/tty as a tty (not only /dev/cons) 2017-12-18 23:02:44 +01:00
Giacomo Tesio 001069aa7b libposix: deep refactor; add sys/posixly command
With these changes, libposix (and newlib) can run MirBSD Korn Shell.
2017-12-18 23:02:36 +01:00
Giacomo Tesio 2f99fb162f hmi/console: fix file owner for screenconsole
When boot starts screenconsole, the hostowner is still empty
2017-12-15 02:58:09 +01:00
Giacomo Tesio dcbea5d48d hmi/console: fix Qroot listing 2017-12-15 02:58:09 +01:00
Giacomo Tesio 1639097200 hmi/console: fix fd leak 2017-12-15 02:58:09 +01:00
Giacomo Tesio a86e2b506a sys/ctrace: try to restart stopped processes (why does not work?) 2017-12-15 02:58:09 +01:00
Giacomo Tesio f6e3784639 sys/ctrace: restart traced process when stopped by note 2017-12-15 02:58:09 +01:00
Giacomo Tesio bdce6c7f9c sys/ctrace: keep reading on exited process till there is something to read 2017-12-15 02:58:09 +01:00
Giacomo Tesio d9345701c5 sys/ctrace: use waitstop for command started with -c (since they imply hang) 2017-12-15 02:58:09 +01:00
Giacomo Tesio 8b3be08c21 cmds: use pexec in ns/clone 2017-12-15 02:58:09 +01:00
Giacomo Tesio 3ed0e3d41a cmds: add vt to the build 2017-12-15 02:58:09 +01:00
Giacomo Tesio dc76580668 cmd/acme: removed obsolete PATH manipulation 2017-12-15 02:58:09 +01:00
Giacomo Tesio 66e9a1b676 cmd/vt: export /dev/tty as alias for /dev/cons 2017-12-15 02:58:09 +01:00
Giacomo Tesio 132f2ccee0 cmd/vt: include envvars.h 2017-12-15 02:58:09 +01:00
Giacomo Tesio 5a2f74a22c cmds: sys/ctrace -o file; fix rfork handling
Added a -o option to sys/ctrace (if provided, must be the first option)
to redirect the output to a file.
2017-12-15 02:58:09 +01:00
Giacomo Tesio fd30599a90 cmds: fix rfork handling in sys/ctrace 2017-12-15 02:58:09 +01:00
Giacomo Tesio fc2e066ca0 cmd: import pstree from 9front 2017-12-15 02:58:09 +01:00
Giacomo Tesio 8c5dff6c0b libc: add pexec() to execute a command in $PATH 2017-12-15 02:58:09 +01:00
Giacomo Tesio 2dcdf47b04 libc: simplify getuser 2017-12-15 02:58:09 +01:00
Giacomo Tesio 7f1ba356f1 kern: devproc: forbid open(OWRITE) of notes in Broken proceses 2017-12-15 02:58:09 +01:00
Giacomo Tesio c48d0e46ec kern: do not read wdir size on Broken processes 2017-12-15 02:58:09 +01:00
Giacomo Tesio e0b8a369d0 kern: align stack pointer to 16 byte in notify 2017-12-15 02:58:09 +01:00
Giacomo Tesio a3918b108d kern: awake must not interrupt flushes in dev9p
While sending Tflush after a wakeup, we might call sleep.

Since the awake was not yet consumed, the new sleep was interrupted
causing a new Tflush, in an infinite loop that consumes all tags.
2017-12-15 02:58:09 +01:00
Giacomo Tesio 799f99a40f kern: fix pprint on invalid address at syspread 2017-12-15 02:58:09 +01:00
Giacomo Tesio b73c2bce14 kern: awake & dev9p: do not interrupt Tflush to avoid consuming all tags 2017-12-15 02:58:09 +01:00
Giacomo Tesio 3946a06a98 kern: dev9p: Rwrite's count can be greater than Twrite's one 2017-12-15 02:58:09 +01:00
Giacomo Tesio 726217c766 kern: fix proc ref counting in procread 2017-12-15 02:58:09 +01:00
Giacomo Tesio df9c0d8fe4 kern: awake: fix syscall() check for awake_awakened(up) 2017-12-15 02:58:09 +01:00
Giacomo Tesio 2b62ed8010 kern: keep reading /proc/n/syscall after process death, to get all messages 2017-12-15 02:58:09 +01:00
Giacomo Tesio 9aea97a51f kern: fix fmtrwdata on nil buffers 2017-12-15 02:58:09 +01:00
Giacomo Tesio 8ea71b1c66 kern: fix very old bug in syscall tracing 2017-12-15 02:58:09 +01:00
Giacomo Tesio 7ae04d282f kern: devproc: add ppid; enable `rm -e noteid` 2017-12-15 02:56:57 +01:00
Giacomo Tesio 26bd1d8dc4 kern: fix working dir after ns clone
After sending the "clone" request to /proc/$pid/ns, the current process
will be moved to the working directory of $pid.

Otherwise the current process could still access the file and folders
on the service providing its dot, even if such service was not visible to $pid.

Also, keeping the original working directory means that the 'cd' line of the
current process's ns file would be different from that of $pid: the two ns
files must match since the command asked for a "clone".

See also https://marc.info/?l=9fans&m=150893734909969&w=2
2017-10-25 02:06:29 +02:00
Giacomo Tesio 2836ae4d66 kern: improve procfdprint and procfds in devproc 2017-10-25 01:35:34 +02:00
Giacomo Tesio c17d5bdb18 kern: cleanup procread for Qnote 2017-10-25 01:33:51 +02:00
Giacomo Tesio 70d5961022 kern: add missing poperror() to awake_gc_proc 2017-10-25 01:30:07 +02:00
Giacomo Tesio 430df16543 kernel: ignore errors on awake_gc_proc
Calling resrcwait in awake_gc_proc (that is called from pexit and thus
from sys_exits) means that we have to ignore errors that could cause
the syscall to return.

The funny part here was that one single test for newlib showed the
issue by faulting in a note handler AFTER completing with success:

	/arch/amd64/qa/lib/newlib/sigchld/213-sigqueue

The fact was that in the executable, the function notifier() was
located just after the exits() function, whose last line was a call
to _exits().

Thus, when the _exits returned, the notifier() code was executed.
2017-10-25 01:22:01 +02:00
Giacomo Tesio 7c017f5059 kern: fix %r13 management in syscallentry 2017-10-25 01:18:57 +02:00
Giacomo Tesio 90c3415176 kernel: fix _procfdprint to use chan's flags 2017-10-25 01:17:31 +02:00
Giacomo Tesio ba11888753 kern: proc, dup: _procfdprint OCEXEC and ORCLOSE
In _procfdprint print additional informations in the second column:

	E is printed if the file was open with OCEXEC flag
	D is printed if the file was open with ORCLOSE flag

Example output:
  3  rE  9   46 (0000000000000001 0 00)  8192       13 /dev/cons
2017-10-25 01:16:45 +02:00
Giacomo Tesio 9f8050aa4a libc: move exits to its own translation unit (another good idea from 9front) 2017-10-25 01:11:34 +02:00
Giacomo Tesio 2a4b3f26d6 cmds: add ns/clone
usage: ns/clone pid cmd [args...]

It starts cmd with provided arguments in a clone of the namespace
available to pid.
2017-10-25 01:02:32 +02:00
Giacomo Tesio 9d04fba8f2 cmds: rename `ns` to `ns/cat` 2017-10-25 00:22:26 +02:00