Commit Graph

76 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 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 90c3415176 kernel: fix _procfdprint to use chan's flags 2017-10-25 01:17:31 +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 f3b882ba4a qa: add setsid test to newlib 2017-09-08 00:15:12 +02:00
Giacomo Tesio a97830e493 newlib: add qa test for setjmp/longjmp 2017-09-03 17:41:55 +02:00
Giacomo Tesio 6fd5c75ab3 qa/check: allow tests to SKIP themselves 2017-08-31 00:29:52 +02:00
Giacomo Tesio e888e52502 qa: newlib: fix 102-files so that it works with disk based roots (runDisk.sh) 2017-08-30 00:15:50 +02:00
Giacomo Tesio 713eb8843f libc: simplify access; libposix: let access lie
There are a few issues with Plan 9's `access`:

- it has side effects: to test the actual access (that the file
  servers can allow or deny according to complex custom rules)
  it opens and then closes the file, allocating (and disposing) the fd
- it does not work on directories, since
  - they cannot be opened for writing, despite the fact that to
    create a file in a directory you must be granted write access on
    that directory
  - they cannot be opened for execution, despite the fact that to
    access a file in a directory you must be granted execution access
    on that directory

Despite the fact that `access` (even on UNIX) is a violation of the
"tell, don't ask" principle (the access could be forbidden just after
its successful return, making subsequent `open` fail anyway), this
fact smells of a little design error in the file interface.

So, right now we choose to let the libposix's `access` lie on directories:
it will always return 0 on AWRITE and AEXEC for them, accepting that
a successive create/mkdir may fail.

However, a cleaner file API and protocol should allow a simpler `access`
to be implemented for directories too.
2017-08-29 00:17:51 +02:00
Giacomo Tesio fe173086f7 qa: improved newlib/103-files.c (testing access, mkdir, chdir and getcwd) 2017-08-28 23:04:31 +02:00
Giacomo Tesio 9bdbd9b09d qa: improve newlib/040-gettimeofday.c 2017-08-28 23:04:31 +02:00
Giacomo Tesio b78613615d libposix: add access 2017-08-28 23:04:12 +02:00
Giacomo Tesio 44fa703f84 qa: fix test newlib/040-gettimeofday.c 2017-08-25 23:33:10 +02:00
Giacomo Tesio bd149a18f1 libposix: implement gettimeofday 2017-08-25 00:53:10 +02:00
Giacomo Tesio 2409419ba2 qa: fix 199-files-CLEAR.runner 2017-08-24 00:14:02 +02:00
Giacomo Tesio 6158d0e166 qa: newlib test for chdir and mkdir 2017-08-23 04:25:30 +02:00
Giacomo Tesio 511bbd36af qa: newlib: better messages in 100-files 2017-08-22 02:45:49 +02:00
Giacomo Tesio 97c4c2bccb qa: add test for opendir/readdir/closedir in newlib 2017-08-22 01:41:15 +02:00
Giacomo Tesio 6dd00801dc libposix: introduce pause() (still to be integrated in newlib) 2017-08-18 00:50:07 +02:00
Giacomo Tesio ef6aa99b74 qa: libc: slow note handlers cant't break sleep 2017-08-16 00:37:39 +02:00
Giacomo Tesio d796c73e89 qa: fix broken.runner 2017-08-15 00:53:04 +02:00
Giacomo Tesio df8bc2ce43 qa: increase rlockt1 timeout 2017-08-14 18:46:23 +02:00
Giacomo Tesio 1b4b6d1574 qa: reenable newlib's tests 2017-08-13 12:33:18 +02:00
Giacomo Tesio d573d0a39c qa: disable newlib's test 202-signals 2017-08-13 00:06:04 +02:00
Giacomo Tesio 99124f1578 qa: disable newlib's test 201-signals
For some reason it hangs on travis-ci.
2017-08-12 23:55:39 +02:00
Giacomo Tesio e57ff30b63 qa: release cpu on newlib/201-signals and newlib/202-signals 2017-08-12 23:33:38 +02:00
Giacomo Tesio 93dfad6b0b kernel: print proc info on addbroken 2017-08-12 23:32:35 +02:00
Giacomo Tesio 1c4a04cd30 qa: various fix to tests 2017-08-11 03:18:32 +02:00
Giacomo Tesio 2a38ee6ab6 qa: fix typo in test 2017-06-06 19:53:45 +02:00
Giacomo Tesio 4f97f4a80b qa: disable broken tests 2017-06-05 22:11:36 +02:00
Giacomo Tesio 9f4472c3bb kernel: simplified fork_chain test 2017-06-05 19:25:08 +02:00
Giacomo Tesio 2269a4bbd0 kernel: minimal test that panic the mmu code 2017-06-03 23:23:42 +02:00
Giacomo Tesio a64a7b0d0e qa: check that notes cannot eat wait messages 2017-05-30 01:00:03 +02:00
Giacomo Tesio a8d42cecc9 newlib: use SIGINT to avoid abort 2017-05-29 23:45:00 +02:00
Giacomo Tesio 9dc9001469 newlib: test ignored signals (broken) 2017-05-29 01:53:37 +02:00
Giacomo Tesio 559e5429ed newlib: tests for sigchld 2017-05-29 01:42:08 +02:00
Giacomo Tesio fe168aa55d newlib: introduce tests for SIGCHLD 2017-05-26 02:12:42 +02:00
Giacomo Tesio 5ca0ef085c newlib: fix test for SIGSTOP/SIGCONT 2017-05-26 00:39:47 +02:00
Giacomo Tesio 439326fa1f newlib: enabled more tests for signals (still broken) 2017-05-25 22:43:38 +02:00
Giacomo Tesio f9c63742bb qa: simplify test that crash with -O2 2017-05-22 23:18:47 +02:00
Giacomo Tesio 1eb450510a qa: add test that crash with -O2 2017-05-21 23:16:41 +02:00
Giacomo Tesio fa15f817c4 qa: avoid cast that preclude strict aliasing 2017-05-19 01:09:51 +02:00
Giacomo Tesio 960e8a0d4e qa/kern: more tests for awake 2017-05-17 00:52:16 +02:00
Giacomo Tesio f9b2e9aba4 kernel: generalize awake
Awake can now interrupt several blocking syscalls (even
during note handling).

Among others, it can interrupt await, pread and pwrite.

It cannot interrupt several others for different reasons:

- awake cannot be interrupted by awake;
- syscalls like remove and create can be used for kernel comunication
  and it would be hard to know if the effect occurred in the
  receiving fs if they were interrupted;
- other syscalls do not need awake since they just provide access
  to kernel infos (eg seek or fd2path)

NOTE: awakes registered before a note cannot occur during the note
handling and will be deferred till the next call to noted.
2017-05-15 00:05:59 +02:00
Giacomo Tesio d62ca1162f Merge branch 'libposix-new-signals' of https://bitbucket.org/tesio/jehanne into libposix-new-signals 2017-05-08 22:54:34 +02:00
Giacomo Tesio 48ea61ab9c newlib: more tests for signals 2017-05-08 00:36:04 +02:00
Giacomo Tesio 1263399c0b qa: check devproc start/stop ctl msg 2017-05-07 19:32:55 +02:00
Giacomo Tesio ecd6dddf86 qa/kern: ensure awake in signal handlers is not affected by sleep 2017-05-04 19:55:55 +02:00