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. |
Notices |
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
Are you new to LinuxQuestions.org? Visit the following links:
Site Howto |
Site FAQ |
Sitemap |
Register Now
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
|
 |
07-31-2001, 01:17 PM
|
#1
|
LQ Newbie
Registered: Jul 2001
Posts: 4
Rep:
|
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.
|
|
|
07-31-2001, 02:49 PM
|
#2
|
LQ Guru
Registered: Jan 2001
Posts: 24,149
|
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.
|
|
|
07-31-2001, 03:14 PM
|
#3
|
Member
Registered: Apr 2001
Location: NY
Distribution: used to be Redhat, now Debian Sarge
Posts: 291
Rep:
|
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).
|
|
|
07-31-2001, 03:47 PM
|
#4
|
LQ Newbie
Registered: Jul 2001
Posts: 4
Original Poster
Rep:
|
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.
|
|
|
07-31-2001, 05:27 PM
|
#5
|
LQ Newbie
Registered: Jul 2001
Posts: 23
Rep:
|
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.
|
|
|
07-31-2001, 05:34 PM
|
#6
|
Member
Registered: Apr 2001
Location: NY
Distribution: used to be Redhat, now Debian Sarge
Posts: 291
Rep:
|
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.
|
|
|
07-31-2001, 06:07 PM
|
#7
|
Senior Member
Registered: Jun 2001
Posts: 1,635
Rep:
|
you need to check out the www.enlightenment.org 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.
www.whoop.org - this is the website of the guy who's writing efsd.
oss.sgi.com/projects/fam - the sgi site for fam and imon. they're both still in early development.
|
|
|
All times are GMT -5. The time now is 09:30 AM.
|
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.
|
Latest Threads
LQ News
|
|