Commit Graph

470 Commits

Author SHA1 Message Date
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
Giacomo Tesio 320e6e6f35 kern: clone $pid's namespace writing #p/$pid/ns
Any process X can get a new copy of the namespace of a target
process Y by writing the string "clone" to the ns file of Y.

The same user must own both processes.
The process writing the ns file must be allowed to mount.

The Pgrp of the calling process is then replaced with a new copy of
the Pgrp of the target process.

After the operation, any change done by X to its own namespace does
not affect Y. Also, if mount was forbidden for Y, it will also be
forbidden for X after the clone.
2017-10-24 23:28:14 +02:00
Giacomo Tesio 9202b04504 rc: use some uppercase variables (PATH, USER...) 2017-10-22 13:22:37 +02:00
Giacomo Tesio d6d65887b2 libc: rename $apid to $APID 2017-10-20 02:05:13 +02:00
Giacomo Tesio fab9c1d80f libc: introduce <envvars.h>
The new header envvars.h contains the names of commonly used
environment variables, such as $user, $ifs, $path and so on.

These defines are useful for Jehanne core applications that
use them to comunicate some values.

They are not strictly required, but having such defines we
can easily change the naming convention (from lowercase to uppercase).
2017-10-20 01:22:48 +02:00
Giacomo Tesio 65d37f432f rc: rename $cflag in $rccmd 2017-10-20 00:14:43 +02:00
Giacomo Tesio a70f27680a lc: `rfork e` to avoid /env pollution
See https://marc.info/?l=9fans&m=150842120722399&w=2
2017-10-19 00:32:05 +02:00
Giacomo Tesio 9b0b9794c3 rc: write ENV_PATH and ENV_CDPATH as a colon separated string 2017-10-19 00:25:34 +02:00
Giacomo Tesio a5c14e60d7 rc: replace forgotten ENV_RCARGLIST 2017-10-19 00:16:19 +02:00
Giacomo Tesio d33221de34 rc: allow colons as separator in $path and $cdpath 2017-10-18 23:48:42 +02:00
Giacomo Tesio 0ef55939e8 rc: rm plan9.c (fix previous commit) 2017-10-18 22:41:31 +02:00
Giacomo Tesio 4017b73ab2 rc: define constants for rc variable names 2017-10-18 22:38:30 +02:00
Giacomo Tesio d3c2605d57 libc: set ERRMAX to 128 (to match genbuf in the kernel's Proc structure) 2017-10-18 01:40:40 +02:00
Giacomo Tesio b42f8bd4a8 rc: mv plan9.c jehanne.c 2017-10-18 01:20:52 +02:00
Giacomo Tesio 085f5dfa34 rc: import 9front's improvements 2017-10-18 01:10:06 +02:00
Giacomo Tesio 26a2f0a1be libposix: fix typos in get_noteid/set_noteid 2017-09-08 00:24:37 +02:00
Giacomo Tesio f3b882ba4a qa: add setsid test to newlib 2017-09-08 00:15:12 +02:00
Giacomo Tesio 3255a6aa47 devtools: improved newlib and mksh 2017-09-07 23:37:32 +02:00
Giacomo Tesio e206015f7f libposix: add getpgid 2017-09-07 23:27:33 +02:00
Giacomo Tesio 1f3203e6d3 libposix: add rename 2017-09-07 23:25:34 +02:00
Giacomo Tesio e3ff5b1004 libposix: add getpgrp; draft setsid, getsid and setpgid 2017-09-07 00:10:34 +02:00
Giacomo Tesio c06dfdc834 newlib: add umask, chmod and fchmodat 2017-09-06 23:04:01 +02:00
Giacomo Tesio e168dcb7fa libposix: add umask 2017-09-06 22:59:05 +02:00
Giacomo Tesio 61f0293e39 libposix: fake get/set functions for uid, gid, euid, egid, pgid, sid, reuid... 2017-09-05 23:53:40 +02:00
Giacomo Tesio 4f87ee109f Merge branch 'master' of https://bitbucket.org/tesio/jehanne 2017-09-05 23:09:59 +02:00
Giacomo Tesio 14edc758f4 libposix: add get/set functions for uid, gid, euid, egid, pgid, sid, reuid... 2017-09-05 00:15:37 +02:00
Giacomo Tesio d9b9309561 devtools: qemu: use -device and -netdev options instead of -redir 2017-09-04 23:41:25 +02:00
Giacomo Tesio b681752355 Merge branch 'master' of https://github.com/JehanneOS/jehanne 2017-09-04 00:10:37 +02:00
Giacomo Tesio eb3f4fdf97 newlib: various improvements; mksh: improvements 2017-09-04 00:02:50 +02:00
Giacomo Tesio 4be2181f89 libposix: add readlink and readlinkat (both failing with EINVAL) 2017-09-03 23:46:18 +02:00
Giacomo Tesio c5aaa72bbb libposix: add dup, dup2, getrusage, fstat and lstat 2017-09-03 17:51:44 +02:00