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.
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.
Jehanne's notes (like Plan9 ones) are not reentrant.
Thus an alarm can not be used to interrupt a syscall in a note handler.
Awake instead works properly also in a note handler.