> On 27 Dec 2000, at 10:11, Mark Murray wrote:
> > 
> > [use flock(2)]
> 
> But what part of the solution does flock solve?

It solves the problem of finding out whether the Perl script is
already running, but as I understood the original posting, this isn't
what you were asking.  See below.

> I'm not sure if my lack of comprehension stems from my initial 
> description being inadequete or my knowledge being too narrow.

Probably from it being a little confusing.  Here's how I understand
it.  You have some program putting files in directory /x.  You need
something that will be notified when a new file appears in /x.  That
something then starts a Perl script to process the files.

If you control the program that's putting files into /x, the easiest
way would be to have it send a signal to your daemon.  You can put its
PID in a well-known file for it to look at.  If, however, you don't
control the program, you may have to resort to looking at the
directory every now and then and checking for new files (``polling'').
Depending on your application, this may or may not be acceptable.

If you don't want to use polling, you might try fooling around with
the select(2), poll(2), or kqueue(2) interfaces.  The former two were
designed to be used with regular files or sockets, but in unix, a
directory is just a special type of file.  I don't know how they'd
react to it.  In particular, the EVFILT_VNODE filter with the
NOTE_EXTEND event/flag (notifies you when the file descriptor
specified was extended) looks promising.

Then again, I'm not a filesystem whiz, so this may all be nonsense.
Hopefully I've at least interpreted your question correctly.

Regards

                                                Dima Dorfman
                                                [EMAIL PROTECTED]



To Unsubscribe: send mail to [EMAIL PROTECTED]
with "unsubscribe freebsd-hackers" in the body of the message

Reply via email to