Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

For example, the IDE I'm using at the moment (Aptana Studio) notifies me as soon as a file's contents it has open have been changed by some external program.

I can imagine having a periodic loop run stat() on a file and check the time of last data modification. Is this how it's normally done or is there a blocking interrupt-like mechanism used instead?

share|improve this question
    
I think you are on the right track. Have a look at http://www.steve.org.uk/Reference/Unix/faq_3.html#SEC36 –  user1146332 Aug 21 '12 at 19:53
add comment

1 Answer

up vote 3 down vote accepted

The inotify system on Linux, or the kqueue system on BSD/OSX, gives you an event-driven ("interrupt-like") mechanism to do this.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.