Help with file locking

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



John Fraser wrote:
> 
> Hello;
> 
> We are working on an application that needs to grab files put onto an ext3
> filesystem as soon as they are written.  We've looked at lsof, and other
> tools, and are having troubles finding just the right mechanism to tell when
> a file has been completely written and the other process has closed the
> file.
> 
> In most cases it will be Samba users putting the files onto the ext3
> filesystem that we need to process immediatitely, and we will also need to
> allow NFS users to put files onto the ext3 filesystem.  In both cases, we
> need low-level knowledge of when the file is written completely so we can
> grab the sucker right away.
> 

That actually sounds like a fairly useful feature addition
for the directory notification code.

include/linux/fcntl.h:

#define DN_ACCESS       0x00000001      /* File accessed */
#define DN_MODIFY       0x00000002      /* File modified */
#define DN_CREATE       0x00000004      /* File created */
#define DN_DELETE       0x00000008      /* File removed */
#define DN_RENAME       0x00000010      /* File renamed */
#define DN_ATTRIB       0x00000020      /* File changed attibutes */

It would probably be a simple exercise to add "DN_CLOSE",
and then run around and implement it.

(That being said, what was wrong with polling `lsof'
output for the absence of the file?)





[Index of Archives]         [Linux RAID]     [Kernel Development]     [Red Hat Install]     [Video 4 Linux]     [Postgresql]     [Fedora]     [Gimp]     [Yosemite News]

  Powered by Linux