Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Posting-Version: version B 2.10.2 9/18/84; site brl-tgr.ARPA Path: utzoo!watmath!clyde!burl!ulysses!allegra!mit-eddie!think!harvard!seismo!brl-tgr!tgr!Anw%maths.nottingham.ac.uk@UCL-CS.ARPA From: Anw%maths.nottingham.ac.uk@UCL-CS.ARPA Newsgroups: net.unix-wizards Subject: Re: /tmp versus temporary file types Message-ID: <2359@brl-tgr.ARPA> Date: Wed, 23-Oct-85 15:28:42 EDT Article-I.D.: brl-tgr.2359 Posted: Wed Oct 23 15:28:42 1985 Date-Received: Fri, 25-Oct-85 02:39:26 EDT Sender: news@brl-tgr.ARPA Lines: 45 boyd@basser.oz (Boyd Roberts) writes: > In article <1622@gatech.CSNET> arnold@gatech.CSNET (Arnold Robbins) writes: > >Why not do something like > > > > fd = open ("/dev/temp", O_RDWR); > > /* O_CREAT implied by the use of /dev/temp */ > > > > [...] >Yes, that's the way. Re-define the semantics of the system calls because >you want dodgy feature X. The UNIX file-system is clean and straight forward. >So too are the system calls. But, oh no, instead of using the interfaces >provided it's time to mash them into five zillion different flavours, with >no gain in functionality. [...] Ouch! But the system calls are not all THAT clean and s-f. Why does the ownership & mode of "fred" after 'creat ("fred", 0644);' depend on whether "fred" existed before? Why is "fred" opened for writing as well? Why, in standard V7 at least, can I not shorten a file, or open one by an existing descriptor? There is scope for making several of the system calls more orthogonal and more primitive, were it not for the dead hand of tradition. There IS a minor lack of functionality which would be cured by some form of anonymous or temporary file, and which is exemplified by the common and not entirely satisfactory sequence s = mktemp ("/tmp/eXXXXXX"); close (creat (s, 0600)); fd = open (s, 2); unlink (s); Here's my 2p-worth. Why not use an explicitly null file name to indicate an anonymous file (with no links) in the implied directory? Thus, fd = open ("/tmp/", 2); (simply) would be equivalent to the above. 'open ("", 2)' would do it in the current directory instead. (At least, how often has anyone used null file names in anger? Hands up anyone who is not slightly surprised by the behaviour of "mv junk ''", or of "date > ''".) No doubt some guru will suggest a clean way round the obvious problem with "/" (but the name of the root directory is already anomalous, and a counterexample to the c&sf-ness of the file system). -- Andy Walker, Maths Dept, Nottingham Univ anw@UK.AC.Nott.Maths