Thomas Hruska wrote:
> Knowledge Seeker wrote:
>
>> Paul Herring wrote:
>>
>>> On Wed, Jul 16, 2008 at 2:59 PM, Knowledge Seeker
>>> <[EMAIL PROTECTED] <mailto:knowledgeseeker78%40gmail.com>>
>>> wrote:
>>> [...]
>>>
>>>> Process A creates a txt file containing a line "A quick brown fox jumps
>>>> over the lazy little dog"
>>>> Process B reads the txt file and displays it on the screen and then
>>>> deletes the file.
>>>> Process A again does .... process b again does the same ...
>>>>
>>> Ah - homework.
>>>
>>> The canonical method of doing this is for process A to open for
>>> exclusive access a file (with filename returned from tmpnam() or
>>> similar), dump what it wants to in there, then close it.
>>>
>>> Process B looks for files that it's able to open, process them, then
>>> deletes them after.
>>>
>>> --
>>> PJH
>>>
>>> .
>>>
>>>
>>>
>> First of all its no homework, I am a professional of window's world
>> struggling in linux. I could have easily done it using win32 apis and
>> have not come over here for help.
>> And you are still not getting the problem I have asked for :), Brett
>> understood it and suggested me to 'man' for fstat.
>>
>> File and directory change notification (dnotify)
>> F_NOTIFY
>> (Linux 2.4 onwards) Provide notification when the
>> directory
>> referred to by fd or any of the files that it contains
>> is
>> changed. The events to be notified are specified in arg,
>> which
>> is a bit mask specified by ORing together zero or more of
>> the
>> following bits:
>>
>>
>> DN_CREATE A file was created (open, creat, mknod,
>> mkdir, link, symlink, rename)
>>
>>
>>
>> Let me see if I can understand that.
>>
>
> http://wiki.tcl.tk/9654
>
> Confirms that the method of using F_NOTIFY should be the solution to
> watching for directory changes.
>
> fcntl(fd, F_NOTIFY, DN_MODIFY | DN_CREATE | DN_MULTISHOT);
>
>
Thanks Thomas. And also a few more googling give me the whole
implementation, I would like share with you guys
http://os.cqu.edu.au/docs/kernel-doc/Documentation/dnotify.txt