Review your favorite Linux distribution.
Go Back > Forums > Linux Forums > Linux - General
User Name
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.


  Search this Thread
Old 07-31-2001, 01:17 PM   #1
Micha Agovic
LQ Newbie
Registered: Jul 2001
Posts: 4

Rep: Reputation: 0
Question UNIX file system changes

Is it possible to make a program that would react on any UNIX file system modification, i.e. whenever some file is created, deleted or changed? Could it be possible to intercept a signal whenevr one of these three actions has happened?

I am talking about a real-tim C program here.
Old 07-31-2001, 02:49 PM   #2
LQ Guru
Registered: Jan 2001
Posts: 24,149

Rep: Reputation: 261Reputation: 261Reputation: 261
I am sure it is possible, I am not a programmer, or at least C that is, just some webdesign, but I see how something like that could be possible.

But wouldn't it require the program to constantly scan the filesystem for changes??? Maybe someone else wounld know.. Probably get a quicker response in the Programming Forum.
Old 07-31-2001, 03:14 PM   #3
Registered: Apr 2001
Location: NY
Distribution: used to be Redhat, now Debian Sarge
Posts: 291

Rep: Reputation: 30
As far as i know, a program like that does not have to check the system constantly. I dont really know how to do it, or the steps on how to do it with C, but i wrote a similar program for windoze with Java (actually we did it with my bro).
Old 07-31-2001, 03:47 PM   #4
Micha Agovic
LQ Newbie
Registered: Jul 2001
Posts: 4

Original Poster
Rep: Reputation: 0
UNIX file system changes

This is my comment to the answer of "trickykid".

It is true that we could scan permanently on UNIX the file system in order to see the differences between the "old" and the "new" state. Then we can conclude what are the files created, modified and deleted. The problem is that this is a very slow method. Searching/scanning the file system costs too much (of time units).

The best solution would be to intercept the eventual signals sent by UNIX kernel whenever a file is created, deleted or modified. This would be a very fast way to get the information. The problem for me is that I do not know if such a signals exist, and if it is the case, if we can catch such a signals by our user program?!

Anyway, thank you very much for your help.
Old 07-31-2001, 05:27 PM   #5
LQ Newbie
Registered: Jul 2001
Posts: 23

Rep: Reputation: 15
I think you should look at interupt handling. If you watch the interupt for the hard drive(s) then you can tell when it is accessed and don't need to monitor the file system. I don't know how you could distinguish reads from writes using this method.
Old 07-31-2001, 05:34 PM   #6
Registered: Apr 2001
Location: NY
Distribution: used to be Redhat, now Debian Sarge
Posts: 291

Rep: Reputation: 30
do users connect to the computer remotely using ftp, ssh or telnet? If thats the case (maybe) you could get the commands from the ftp, ssh, or telnet server and do whatever you want with them. I dont know if you can do that though.
And looking at the old state and the new state of the computer would decrease your computers usage. Its not a big deal with linux (i mean not as much as windows) but it is still a concern.
Old 07-31-2001, 06:07 PM   #7
Senior Member
Registered: Jun 2001
Posts: 1,635

Rep: Reputation: 45
you need to check out the website - the efsd component of the desktop shell uses a program called fam and a kernel patch called imon to keep on top of file system changes. this is probably what you're looking for. - this is the website of the guy who's writing efsd. - the sgi site for fam and imon. they're both still in early development.


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
How to disable characters wich are added by the unix system after FTP a file TDABN77 Linux - Newbie 2 12-02-2005 01:54 PM
want to mount a remote unix-based file system to fc2, nfs the answer? how? parv Fedora 3 09-23-2004 12:28 PM
explain the ( very messy ) unix file system ? xconspirisist Linux - General 11 10-16-2003 12:52 PM
How to copy files from A computer of NT System to The other one of Unix system? whepin Linux - Newbie 5 04-06-2003 10:50 AM
Unix file system Swift&Smart General 4 02-17-2003 10:45 AM > Forums > Linux Forums > Linux - General

All times are GMT -5. The time now is 03:51 AM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration