9fans archive / 1998 / 02 / 32 /    prev next

From: G. David Butler gdb@dbS...
Subject: [9fans] create(2)/open(2) race for file creation
Date: Mon, 9 Feb 1998 10:42:59 -0600

I have seen serveral suggestions that I use a process somewhere
to control the create race.  I am trying to do just that.  The
process already exists!  It is in the 9P fileserver and the IPC
used to reach it is the Tcreate message.  What I'm trying to do
is determine the best way to get to it from a system call.

The current create(2) call, IMHO, is broken.  When the call was
implemented, it introduced a race condition that was not necessary
and can't be easily avoided.  Since Plan9 is a "research" system,
I don't consider the API set in stone and was trying to open a
discussion on the subject.  I offered two solutions, an option
to open (POSIX O_EXCL) or a fix to create(2).  There is a third
option that someone hinted at, implement a new system call which
provides access to the primitive create(5).

Since many of you see the problem with race well enough to suggest
the other process solution, perhaps we can focus on trying to
eliminate the problem instead of coding our way around it.

David Butler
gdb@dbS...