dirwatcher.cmo
fifowatcher.cmx: splice.cmx inotify.cmi globals.cmx fdwatcher.cmx \
dirwatcher.cmx
-frontend.cmo: globals.cmo directfifowatcher.cmo
-frontend.cmx: globals.cmx directfifowatcher.cmx
-main.cmo: inotify.cmi globals.cmo frontend.cmo fifowatcher.cmo fdwatcher.cmo \
- dirwatcher.cmo conffile.cmo backend.cmo
-main.cmx: inotify.cmi globals.cmx frontend.cmx fifowatcher.cmx fdwatcher.cmx \
- dirwatcher.cmx conffile.cmx backend.cmx
+frontend.cmo: unixsocketwatcher.cmo globals.cmo directfifowatcher.cmo
+frontend.cmx: unixsocketwatcher.cmx globals.cmx directfifowatcher.cmx
+main.cmo: inotify.cmi globals.cmo frontend.cmo fdwatcher.cmo dirwatcher.cmo \
+ directfifowatcher.cmo conffile.cmo backend.cmo
+main.cmx: inotify.cmi globals.cmx frontend.cmx fdwatcher.cmx dirwatcher.cmx \
+ directfifowatcher.cmx conffile.cmx backend.cmx
let fqp = String.concat "/" [root_dir;rel] in
let fqp_in = String.concat "." [fqp;"in"] in
let fqp_out = String.concat "." [fqp;"out"] in
- Directfifowatcher.closeentry fqp;
- try
- Unix.unlink fqp_in;
- Unix.unlink fqp_out
- with _ ->
- logprint "Hm. %s disappeared. Looks like slice %s shot itself in the foot\n" fqp (this#get_slice_name ())
+ let fqp_control = String.concat "." [fqp;"out"] in
+
+ if (this#is_fd_passer rel) then
+ begin
+ Unixsocketwatcher.closeentry fqp;
+ try
+ Unix.unlink fqp_control
+ with _ ->
+ logprint "Hm. %s disappeared. Looks like slice %s shot itself in the foot\n" fqp (this#get_slice_name ())
+ end
+ else
+ begin
+ Directfifowatcher.closeentry fqp;
+ try
+ Unix.unlink fqp_in;
+ Unix.unlink fqp_out
+ with _ ->
+ logprint "Hm. %s disappeared. Looks like slice %s shot itself in the foot\n" fqp (this#get_slice_name ())
+ end
method rmdir rp =
match rp with Relpath(rel) ->
let close_if_open fd = (try (ignore(close fd);) with _ -> ())
-type in_pathname = string
-type directory = string
-type base_pathname = string
+type control_path_name = string
type slice_name = string
-let unix_socket_table: (in_pathname,(directory*base_pathname*slice_name*Unix.file_descr) option) Hashtbl.t =
+let unix_socket_table: (control_path_name,Unix.file_descr option) Hashtbl.t =
Hashtbl.create 1024
-let pidmap: (int,in_pathname * Unix.file_descr) Hashtbl.t = Hashtbl.create 1024
-
-let move_gate fname =
- let tmpfname=String.concat "." [fname;"tmp"] in
- Unix.rename fname tmpfname;
- tmpfname
-
-let move_ungate fname restore =
- Unix.rename restore fname
-
let list_check lst elt _ =
let rec list_check_rec lst =
match lst with
(** Close fifos that just got removed *)
let closeentry fqp =
let control_filename = String.concat "." [fqp;"control"] in
- let entry = try Hashtbl.find direct_fifo_table fqp_in with Not_found -> None in
+ let entry = try Hashtbl.find direct_fifo_table control_filename with Not_found -> None in
match entry with
| None -> ()
| Some(_,_,_,fd) ->
- close_if_open fd;
- Hashtbl.remove direct_fifo_table fqp_in
-
-let sigchld_handle s =
- let pid,_=Unix.waitpid [Unix.WNOHANG] 0 in
- try
- let fqp_in,fd_out = Hashtbl.find pidmap pid in
- begin
- reopenentry fqp_in
- end
- with _ -> ()
+ shutdown fd SHUTDOWN_ALL;
+ close_if_open fd
let rec add_dir_watch fqp =
Dirwatcher.add_watch fqp [S_Open] direct_fifo_handler