jehanne/sys/src/lib/c/9sys
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
..
access.c libc: simplify access; libposix: let access lie 2017-08-29 00:17:51 +02:00
announce.c libc: introduce "jehanne_" namespace 2017-04-19 23:48:21 +02:00
awakened.c libc: introduce "jehanne_" namespace 2017-04-19 23:48:21 +02:00
chdir.c libc: introduce "jehanne_" namespace 2017-04-19 23:48:21 +02:00
convD2M.c libc: introduce "jehanne_" namespace 2017-04-19 23:48:21 +02:00
convM2D.c libc: introduce "jehanne_" namespace 2017-04-19 23:48:21 +02:00
cputime.c libc: introduce "jehanne_" namespace 2017-04-19 23:48:21 +02:00
ctime.c libc: introduce "jehanne_" namespace 2017-04-19 23:48:21 +02:00
dial.c libc: introduce "jehanne_" namespace 2017-04-19 23:48:21 +02:00
dirfstat.c libc: introduce "jehanne_" namespace 2017-04-19 23:48:21 +02:00
dirfwstat.c libc: introduce "jehanne_" namespace 2017-04-19 23:48:21 +02:00
dirmodefmt.c libc: introduce "jehanne_" namespace 2017-04-19 23:48:21 +02:00
dirread.c libc: introduce "jehanne_" namespace 2017-04-19 23:48:21 +02:00
dirstat.c libc: introduce "jehanne_" namespace 2017-04-19 23:48:21 +02:00
dirwstat.c libc: introduce "jehanne_" namespace 2017-04-19 23:48:21 +02:00
dup.c libc: introduce "jehanne_" namespace 2017-04-19 23:48:21 +02:00
fork.c libc: introduce "jehanne_" namespace 2017-04-19 23:48:21 +02:00
getenv.c libc: introduce "jehanne_" namespace 2017-04-19 23:48:21 +02:00
getmainpid.c libc: introduce "jehanne_" namespace 2017-04-19 23:48:21 +02:00
getnetconninfo.c libc: introduce "jehanne_" namespace 2017-04-19 23:48:21 +02:00
getpid.c libc: introduce "jehanne_" namespace 2017-04-19 23:48:21 +02:00
getppid.c libc: introduce "jehanne_" namespace 2017-04-19 23:48:21 +02:00
getwd.c libc: introduce "jehanne_" namespace 2017-04-19 23:48:21 +02:00
iounit.c libc: introduce "jehanne_" namespace 2017-04-19 23:48:21 +02:00
nsec.c libc: introduce "jehanne_" namespace 2017-04-19 23:48:21 +02:00
nulldir.c libc: introduce "jehanne_" namespace 2017-04-19 23:48:21 +02:00
ocreate.c libc: introduce "jehanne_" namespace 2017-04-19 23:48:21 +02:00
pipe.c libc: introduce "jehanne_" namespace 2017-04-19 23:48:21 +02:00
postnote.c libc: introduce "jehanne_" namespace 2017-04-19 23:48:21 +02:00
privalloc.c libc: introduce "jehanne_" namespace 2017-04-19 23:48:21 +02:00
pushssl.c libc: introduce "jehanne_" namespace 2017-04-19 23:48:21 +02:00
putenv.c libc: introduce "jehanne_" namespace 2017-04-19 23:48:21 +02:00
qlock.c libc: fix libthread by fixing RENDEZVOUS in qlock.c 2017-08-11 05:26:53 +02:00
read.c first usable version of kernel and commands 2016-11-26 03:49:29 +01:00
rerrstr.c libc: introduce "jehanne_" namespace 2017-04-19 23:48:21 +02:00
segattach.c libc: introduce "jehanne_" namespace 2017-04-19 23:48:21 +02:00
segbrk.c libc: introduce "jehanne_" namespace 2017-04-19 23:48:21 +02:00
setnetmtpt.c libc: introduce "jehanne_" namespace 2017-04-19 23:48:21 +02:00
sleep.c libc: sleep's argument must be unsigned 2017-08-16 00:58:21 +02:00
stat.c libc: introduce "jehanne_" namespace 2017-04-19 23:48:21 +02:00
sysfatal.c kern: move tsemaquire to userspace (given a generalized awake) 2017-05-12 11:13:19 +02:00
syslog.c libc: introduce "jehanne_" namespace 2017-04-19 23:48:21 +02:00
sysname.c libc: introduce "jehanne_" namespace 2017-04-19 23:48:21 +02:00
time.c libc: introduce "jehanne_" namespace 2017-04-19 23:48:21 +02:00
times.c libc: introduce "jehanne_" namespace 2017-04-19 23:48:21 +02:00
tm2sec.c libc: introduce "jehanne_" namespace 2017-04-19 23:48:21 +02:00
truerand.c libc: introduce "jehanne_" namespace 2017-04-19 23:48:21 +02:00
tsemacquire.c kern: move tsemaquire to userspace (given a generalized awake) 2017-05-12 11:13:19 +02:00
wait.c libc: simplify Waitmsg 2017-05-26 01:55:09 +02:00
waitpid.c libc: introduce "jehanne_" namespace 2017-04-19 23:48:21 +02:00
werrstr.c libc: introduce "jehanne_" namespace 2017-04-19 23:48:21 +02:00
write.c first usable version of kernel and commands 2016-11-26 03:49:29 +01:00