Incoming file trigger

If you've made a patch to quick fix a bug or to add a new feature not yet in the main tree then post it here so others can try it out.
Post Reply
W.
Posts: 108
Joined: Tue Apr 10, 2007 5:06 pm
Location: Latvia

Incoming file trigger

Post by W. »

Here comes another bit.

Implements file channel for incoming triggers. Should be used in read-only mode, hence name - RoFile, tested with ext3 fs on FC6 and with cifs mounted form xp pro. On ext3 if file is not there when zmtrigger.pl starts, it does not bail out but rather patiently waits for file to appear. If file is unlinked on course of action, again patiently waits for file to appear. If file is unlinked and recreated (the same name, different inode), it is closed and reopened. Unlinking and recreating file on xp pro does not really work (you can unlink the file, but can't recreate it until all handles to it are closed). On open eof is found, so any existing data in that file is skipped. If trigger source recreates file for each trigger it sends, change the trigger source not to do that, because you might lose triggers. If you are willing to cope with losing triggers and still want to use this channel, comment out line

Code: Select all

sysseek( *sfh, 0, SEEK_END );
To use files as trigger transfer medium, make sure there are no any buffers in between trigger source and trigger target (zmtrigger.pl in this case) or if there are, they are flushed as soon as data is written to file, otherwise you will get more or less random recordings of irrelevant stuff :) If using cifs, use directio option when mounting.

Caution: zmtrigger.pl is updated with this patch to show usage sample! Check before use.

http://www.o6.lv/files/rofile.patch.gz

as usual, no warranties, no nothing, you are on your own. if you want support, hire me ;)
if common sense is so uncommon, why is it called common then?
Post Reply