Ideas for changes to Unix filesystem

Dan Bernstein brnstnd at kramden.acf.nyu.edu
Sun Feb 10 21:35:04 AEST 1991


In article <27B18AD8.2F15 at tct.uucp> chip at tct.uucp (Chip Salzenberg) writes:
  [ on flink() ]
> It's a convenient way to create lock files -- if, that is, the kernel
> also supports fdcreat(), which creates a plain file with no links.

A few months ago I briefly discussed with Keith Bostic the top three
calls on my BSD-extensions list: fdlink(), fdtemp(), and fdunlink(). The
first was the same as flink(); the second was the same as fdcreat(); the
third was the same as unlink(), but returned a file descriptor pointing
to the removed file. He didn't believe that my examples of race
conditions were problems in practice.

> Also, the obvious companion fdunlink(int fd, char *path) is something
> I've always wanted.  It unlinks the given path if and only if it is a
> name for fd.

Hmmm. I already have fdunldilink() listed; it only removes a file if it
has a specified number of hard links, device, and inode, with 0 for no
restriction. I think fdunldilink(0,st.st_dev,st.st_ino,path) would do
the trick after an fstat(fd,&st).

---Dan



More information about the Comp.unix.internals mailing list