General > Help

C:waitnotify not working on hosted AROS for EMU filesystem

(1/1)

paolone:
Hi. I have a quite nasty issue on Linux Hosted AROS (surely on ABIv0 32bit i386 Icaros Destkop, but it might be true for 64bit ABIv1 version as well).


If I give this command:
waitnotify t:pippo


it correctly works and the shell waits for me doing anything on that file, even simply creating it if it does not exist. However, if I give the very same command on the hosted filesystem, for instance:


waitnotify sys:pippo


I get this error instead:
WaitNotify: StartNotify() failed on "Sys:pippo"


I guess the EMU filesystem handler lacks of come notification feature, and this might have also something to do with the fact that I can't - for instance - connect a USB pendrive on Linux and have hosted AROS look into its contents (the folder /media/paolone/something, or wherever I mount it, remains empty). So I have a first question for you


1. would anyone be so kind to fix this? How much time/effort would be required?


Then, the workaround. Since I *NEED* to stop the execution of a shell script and wait for a file actually being created by a different process (which is running on the Linux host, so AROS wouldn't be aware of this happening in other ways), I wrote a very simple AROS shell script which basically accepts the file to be created (and some sort of time counter, if I express this in the form: S:waitforfile <filename>@@<number of cycles>). The problem is, obviously, that I can't invoke it from other scripts, unless anyone teaches me how to do that:



--- Code: ---.KEY w01/A
.BRA {
.KET }


FailAt 21


; DEBUG
; echo entered argument: ##{w01}##


; this script allows to wait for a while, until a file pops up!


; check for missing arguments
if "{w01}" EQ ""
   echo "Missing file to wait for. Usage:"
   echo "waitforfile path:to/file@@cycles"
   skip FINE
endif


echo "{w01}" >t:wffarg                 ; argument of waitforfile
grep -c "@@" t:wffarg >t:wffck         ; number of occurrences of @@ string


if ${t:wffck} GT 0 VAL
   ; ok, it seems we have a cycles number to wait for
   cut "{w01}" WORD 2 SEPARATOR @@ >t:wffcounter
   cut "{w01}" WORD 1 SEPARATOR @@ >t:wffarg
   set M=${t:wffcounter}
   delete t:wffcounter >NIL:
else
   ; set a number of cycles to timeout
   set M=7200
endif


delete t:wffck >NIL:


Set L=0     ; reset counter


Lab LOOP
 Set L=`eval $L+1`
  if EXISTS "${t:wffarg}"
   skip FINE
  endif
 if $L EQ $M VAL
  echo "Timeout reached, file not found."
  skip FINE
 endif
skip LOOP back






Lab FINE
; end of file
; echo $L
unset L >NIL:
unset M >NIL:

--- End code ---


I can easily replicate the central part of the script wherever I need it, but I wonder if we have a C utility that does almost the same thing here.


If you copy'n'paste, then save the script as S:waitforfile, and then protect +S it, you would be able to use it this way


execute s:waitforfile t:pippo   --> wait for t:pippo to be created, times out after ~10 minutes (7200 is the number of cycles to wait for it)
execute s:waitforfile t:pippo@@-1  --> wait for t:pippo to be created, forever (counter adding units would never reach -1, since it would be always superior)
execute s:waitforfile t:pippo@@1000  --> wait for t:pippo to be created, for 1000 cycles (more or less 1 minute, depending on your PC speed)

Navigation

[0] Message Index

Go to full version