Re: Stdio.File()->notify

Arne Goedeke <[email protected]>
Newsgroups gmane.comp.lang.pike.user
Message-ID <[email protected]>
Its about time it gets into stable pike releases, considering that
inotify was added to the linux kernel in 2005.

I am not sure how the notify() API is supposed to be used. I think it
never really got finished. Anyway, as it currently exists, its not
usable. Even when setting up the signal handler correctly, I don't see a
way to decide which file object actually corresponds to the file
descriptor which triggered the event.

Arne

On Tue, 23 Sep 2014, Pontus Ã~Vstlund wrote:

> Cool! I guess Inotify is a fairly recent addition to Pike so I had to pull
> down Pike 8, but I got it working after that.
>
> Thanks a bunch! :)
>
> # Pontus
>
> 2014-09-23 11:20 GMT+02:00 Arne Goedeke <[email protected]>:
>
>> The second argument (a callback) is not actually used by the notify()
>> code. Instead, you would need  to add a signal handler. I would suggest
>> using System.Inotify, it should work as documented and is much more
>> flexible.
>>
>> So, no, you are not doing anything wrong. notify() is not documented
>> correctly and should probably be removed completely.
>>
>> Arne
>>
>>
>> On Tue, 23 Sep 2014, Pontus 獸Vstlund wrote:
>>
>>  Hello!
>>>
>>> I have a question about the notify method in Stdio.File which I can't get
>>> to work. Maybe I'm using it wrong or maybe it just doesn't work, I don't
>>> know.
>>>
>>> I'd like to listen for changes in a directory:
>>>
>>> Stdio.File dir = Stdio.File("/my/dir");
>>> dir->notify(
>>>    Stdio.DN_MULTISHOT |
>>>    Stdio.DN_MODIFY |
>>>    Stdio.DN_CREATE |
>>>    Stdio.DN_DELETE |
>>>    Stdio.DN_RENAME,
>>>    lambda() {
>>>        werror("Hello\n");
>>>    }
>>> );
>>>
>>> but nothing seems to happen. Am I doing something wrong?
>>>
>>> And yes, I'm using Linux.
>>>
>>> Regards
>>> # Pontus
>>>
>>
>
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.