Path: utzoo!utgpu!jarvis.csri.toronto.edu!rutgers!apple!voder!pyramid!ctnews!mitisft!kemnitz From: kemnitz@mitisft.Convergent.COM (Gregory Kemnitz) Newsgroups: comp.unix.questions Subject: Re: truncating an open (locked) file Summary: Close frees flock() locks by definition... Keywords: truncate portable Message-ID: <697@mitisft.Convergent.COM> Date: 18 May 89 19:54:04 GMT References: <269@sawmill.UUCP> Distribution: comp Organization: Convergent Technologies, San Jose, CA Lines: 25 In article <269@sawmill.UUCP>, rjk@sawmill.UUCP (Richard Kuhns) writes: < < [stuff deleted] < Don't close(2) the second file descriptor! If you close *either* file < descriptor, the lock goes away. At least, it does on a 3B1 running 3.51 -- < is this behaviour standard? Yes. close() will free any locks on files. < < So now, I have a slight variation of my original question: Does anyone < have a portable way to truncate (to size 0) an open file, which both < maintains an existing lock on the file and doesn't waste a file < descriptor? < No. There is not. Only hope: there is a truncate() and ftruncate() call in POSIX, so there will be one in Sys V.4. -- ----------------------------------+-------------------------------------- Greg Kemnitz | "He who does not understand baseball kemnitz@Convergent.COM | will never understand America" | --Tocqueville