(** Open fifos for a session. SHOULD NOt shutdown vsys if the fifos don't exist *)
-let openentry_in root_dir fqp_in backend_spec =
- Dirwatcher.mask_watch root_dir;
+let openentry_in rp root_dir fqp_in backend_spec =
+ match rp with
+ |
+ |
+ Dirwatcher.mask_watch root_dir fqp_in;
let fd_in = openentry_int fqp_in in
- Dirwatcher.unmask_watch root_dir [S_Open];
+ Dirwatcher.unmask_watch root_dir fqp_in;
let (fqp,slice_name) = backend_spec in
Hashtbl.replace direct_fifo_table fqp_in (Some(root_dir,fqp,slice_name,fd_in))
Hashtbl.find direct_fifo_table fqp_in with _ -> None in
match entry_info with
| Some(_,execpath,slice_name,fifo_fdin) ->
- fprintf logfd "Executing %s for slice %s\n" execpath slice_name;flush logfd;
+ (*fprintf logfd "Executing %s for slice %s\n" execpath
+ * slice_name;flush logfd;*)
begin
let len = String.length fqp_in in
let fqp = String.sub fqp_in 0 (len-3) in
clear_nonblock fifo_fdin;
let pid=try Some(create_process execpath [|execpath;slice_name|] fifo_fdin fifo_fdout fifo_fdout) with e -> None in
match pid with
- | Some(pid) ->Hashtbl.add pidmap pid (fqp_in,fifo_fdout)
+ | Some(pid) ->
+ if (fifo_fdout <> stdout) then close_if_open fifo_fdout;
+ Hashtbl.add pidmap pid (fqp_in,fifo_fdout)
| None ->fprintf logfd "Error executing service: %s\n" execpath;flush logfd;reopenentry fqp_in
);
ignore(sigprocmask SIG_UNBLOCK [Sys.sigchld]);
try
let fqp_in,fd_out = Hashtbl.find pidmap pid in
begin
- reopenentry fqp_in;
- if (fd_out <> stdout) then close_if_open fd_out
+ reopenentry fqp_in
end
with _ -> ()