Subj : Re: How to aviod a process from deleting an opened file To : comp.os.linux From : robertharvey Date : Thu Jul 29 2004 06:43 pm vanjina_murthy@rediffmail.com (murthy) wrote in message news:<1d1f73fd.0407282032.1cc3e6dd@posting.google.com>... > I am developing an application using C .... > What i want is that if a file is opened by one process either for > reading/writing it should not be deleted or even can be opened by > other process(i.e open should fail). Anyone knows, how it can > achieved. err.. File locking? man flock man fcntl man lockf, for the more standardised approach Read up on mandatory locking - mandatory.txt should be on your hard disk. err.. This is one of the oldest bits of Unix. I can remmber having to delete lock files from /var/lock after processes crashed. I'm not sure, but I reckon file locking is now handled more elegantly, although things like serial ports are certainly still locked in /var/lock. .