- | Process(out_channel) ->
- let cont = ref true in
- while (!cont) do
- try
- printf "Reading...\n";flush Pervasives.stdout;
- let curline = input_line inchan_fd in
- fprintf out_channel "%s\n" curline;flush out_channel
- with
- |End_of_file->
- (
- match (evfname,fname_other) with
- | Some(str1),Some(str2)->
- reopenentry_int evfd str1 str2
- | Some(str1),None ->
- printf "Bug, nameless pipe\n";flush Pervasives.stdout;raise Bug
- | None,_ ->
- printf "Race condition -> user deleted file before closing it. Clever ploy, but won't work.\n";
- flush Pervasives.stdout
- );
- cont:=false
- |Sys_blocked_io ->printf "Sysblockedio\n";flush Pervasives.stdout;
- cont:=false
- | _ ->printf "Bug: unhandled exception\n";flush Pervasives.stdout;raise Bug
- done
- | _ -> printf "BUG! received process event from fifo\n";raise Bug
-
-
-let mkentry fqp abspath perm =
- printf "Making entry %s->%s\n" fqp abspath;flush Pervasives.stdout;
+ | Process(fifo_outfd) ->
+ begin
+ try
+ let transferred = ref 4096 in
+ while (!transferred == 4096) do
+ begin
+ transferred:=tee evfd fifo_outfd 4096;
+ printf "Transferred: %d\n" !transferred;flush Pervasives.stdout
+ end
+ done;
+ with Failure(str) ->
+ begin
+ fprintf logfd "Error connecting user to service: %s\n" str;
+ flush logfd
+ end;
+ ignore(sigprocmask SIG_UNBLOCK [Sys.sigchld]);
+ printf "Out of the loop\n";flush Pervasives.stdout
+
+ end
+ | BrokenPipe -> ()
+ | Fifo(_) -> fprintf logfd "BUG! received process event from fifo\n";raise Bug
+
+
+(** Make a pair of fifo entries *)
+let mkentry fqp abspath perm uname =
+ fprintf logfd "Making entry %s->%s\n" fqp abspath;flush logfd;