Path: utzoo!dptcdc!jarvis.csri.toronto.edu!mailrus!tut.cis.ohio-state.edu!cs.utexas.edu!uunet!mcvax!ukc!warwick!cudcv From: cudcv@warwick.ac.uk (Rob McMahon) Newsgroups: comp.unix.wizards Subject: Re: getcwd() and friends. Message-ID: <144@titania.warwick.ac.uk> Date: 17 Apr 89 19:44:50 GMT References: <3675@ficc.uu.net> <14689@rpp386.Dallas.TX.US> <16758@mimsy.UUCP> Reply-To: cudcv@warwick.ac.uk (Rob McMahon) Organization: Computing Services, Warwick University, UK Lines: 30 In article flee@shire.cs.psu.edu (Felix Lee) writes: >Imagine. You've unlinked a file right after you opened it, and now you've >changed your mind. You really do want to keep the data. What do you do? > >We can help you! We're FLINK! > int flink(int fd, char * path); I think I've said this before, but I think flink(2) would be really useful in conjuntion with open("...", O_CREAT|O_WRONLY|O_NOLINK, 0666) (or O_TEMP or something), which would create a file which had no directory entry. This would really clean up the creation of temporary files for things like file transfer programs, which then wouldn't have to try and think up temporary names, and wouldn't be in any danger of leaving garbage around in case they died or the system crashed. Programs that wanted temporary files which would automatically disappear on exit could use this instead of open/unlink. The `...' would have to be the destination of the intended flink, so that the file could be created on the right filesystem. Maybe the name of a directory could be allowed in this case for temporary files which were never going to be flinked. It would be best if flink acted like rename, atomically replacing an old filename if it existed. Or maybe this should be frename, since this conflicts with the existing `link' ? What do people think ? Would this be a useful addition ? Rob -- UUCP: ...!mcvax!ukc!warwick!cudcv PHONE: +44 203 523037 JANET: cudcv@uk.ac.warwick ARPA: cudcv@warwick.ac.uk Rob McMahon, Computing Services, Warwick University, Coventry CV4 7AL, England