简体   繁体   中英

Code for directory monitor using Unix concepts in C language

On a server, a process monitors the files in a Unix file system.

If a client sends the file name to be monitored, the server has to send the report to the client whether that file got changed or deleted.

For server-client communication, we should use either message queues or sockets.

For every change in the file, the server has to notify that change.

For all changes in all files, the server has to maintain one logfile so that user can view it through the command line interface.

Server could use two threads: one for communication, the other for monitoring.

How can you do this efficiently?

Have a look at inotify at http://en.wikipedia.org/wiki/Inotify - linux only I'm afraid.

BSD has kqueue - see http://en.wikipedia.org/wiki/Kqueue .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM