Beefy Boxes and Bandwidth Generously Provided by pair Networks
Come for the quick hacks, stay for the epiphanies.
 
PerlMonks  

Re: Callback on file access

by Corion (Patriarch)
on Dec 13, 2009 at 16:19 UTC ( [id://812595]=note: print w/replies, xml ) Need Help??


in reply to Callback on file access

If you know what file your subprogram will try to read on, you can create a pipe via mkpipe and feed the program from that pipe. If you don't know what files the subprogram will try to read from, I fear you'll have to go the route of a user-installable filesystem via FUSE, or by going the roundabout way of installing Samba, Samba callbacks and then mounting the Samba share into Linux.

A second approach could be to override the system calls if the subprogram loads the C library dynamically and redirect the system calls into your program, much like FUSE, but completely in user space.

Neither of the solution is an in-process solution, unfortunately.

Replies are listed 'Best First'.
Re^2: Callback on file access
by tomazos (Deacon) on Dec 13, 2009 at 16:25 UTC
    What about Linux::Inotify2 and friends? Why wouldn't something like that work or be appropriate for this problem? -Andrew.

      Ah - a good approach - I thought the callback was supposed to supply data, but it seems that it's enough to just register the access. Then, potentially Inotify or truss or strace might produce the appropriate list of system calls as well.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://812595]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others pondering the Monastery: (4)
As of 2024-04-18 22:46 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found