kernel&all: create() syscall only sends Tcreate
In Plan9 the create syscall fallback on a open(OTRUNC) if the path provided already exists. This is actually a common requirement as most programs (editors, cat...) simply requires that a file is there and is empty, and doesn't care overwriting existing contents (note that this is particularily sensible with something like fossil). In Jehanne the application is responsible of actually handle this "file exists" error but libc provides ocreate() to mimic the Plan9 behaviour. Note that ocreate introduce a subtle race too: the path is walked several times if the file exists, thus it could misbehave on concurrent namespace changes. However I guess this is not going to happen often enough to care now. NOTE we will probably address this rare race too, with a more drammatic change to syscalls: a new walk() syscall that will provide an unopen fd.
This commit is contained in:
@@ -20,10 +20,11 @@
|
||||
#define NP_ORDWR 2 /* read and write */
|
||||
#define NP_OEXEC 3 /* execute, == read but check execute permission */
|
||||
#define NP_OTRUNC 16 /* or'ed in (except for exec), truncate file first */
|
||||
#define NP_OCEXEC 32 /* or'ed in, close on exec */
|
||||
#define NP_ORCLOSE 64 /* or'ed in, remove on close */
|
||||
|
||||
/* bits that must be zero in open/create mode */
|
||||
#define NP_OZEROES ~(NP_OREAD|NP_OWRITE|NP_ORDWR|NP_OEXEC|NP_OTRUNC|NP_ORCLOSE)
|
||||
#define NP_OZEROES ~(NP_OREAD|NP_OWRITE|NP_ORDWR|NP_OEXEC|NP_OTRUNC|NP_OCEXEC|NP_ORCLOSE)
|
||||
|
||||
typedef enum NinepMsgType
|
||||
{
|
||||
|
Reference in New Issue
Block a user