-(** Make a pair of fifo entries *)
-let mkentry fqp abspath perm uname =
- logprint "Making control entry %s->%s\n" fqp abspath;
- let control_filename=sprintf "%s.control" fqp in
- try
- let listening_socket = socket PF_UNIX SOCK_STREAM 0 in
- (try Unix.unlink control_filename with _ -> ());
- let socket_address = ADDR_UNIX(control_filename) in
- bind listening_socket socket_address;
- ( (* Make the user the owner of the pipes in a non-chroot environment *)
- if (!Globals.nochroot) then
- let pwentry = Unix.getpwnam uname in
- Unix.chown control_filename pwentry.pw_uid pwentry.pw_gid
- );
- Success
- with
- e->logprint "Error creating FIFO: %s->%s. May be something wrong at the frontend.\n" fqp fifoout;Failed)
-
-
-(** 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 control_filename with Not_found -> None in
- match entry with
- | None -> ()
- | Some(_,_,_,fd) ->
- shutdown fd SHUTDOWN_ALL;
- close_if_open fd
-
-let rec add_dir_watch fqp =
- Dirwatcher.add_watch fqp [S_Open] direct_fifo_handler
-and
- direct_fifo_handler wd dirname evlist fname =
- let is_event = list_check evlist in
- if (is_event Open Attrib) then
- let fqp_in = String.concat "/" [dirname;fname] in
- connect_file fqp_in