File tree Expand file tree Collapse file tree 3 files changed +8
-3
lines changed Expand file tree Collapse file tree 3 files changed +8
-3
lines changed Original file line number Diff line number Diff line change @@ -70,11 +70,13 @@ let getpid (_sock, pid) = pid
7070
7171type 'a result = Success of string * 'a | Failure of string * exn
7272
73+ let temp_dir = " /var/run/nonpersistent/forkexecd/"
74+
7375(* * Creates a temporary file and opens it for logging. The fd is passed to the function
7476 'f'. The logfile is guaranteed to be closed afterwards, and unlinked if either the delete flag is set or the call fails. If the
7577 function 'f' throws an error then the log file contents are read in *)
76- let with_logfile_fd ?(delete = true ) prefix f =
77- let logfile = Filename. temp_file prefix " .log" in
78+ let with_logfile_fd ?(delete = true ) prefix f =
79+ let logfile = Filename. temp_file ~temp_dir prefix " .log" in
7880 let read_logfile () =
7981 let contents = Xapi_stdext_unix.Unixext. string_of_file logfile in
8082 Unix. unlink logfile;
Original file line number Diff line number Diff line change @@ -104,5 +104,7 @@ type 'a result =
104104 function [f] throws an error then the log file contents are read in *)
105105val with_logfile_fd : ?delete : bool -> string -> (Unix .file_descr -> 'a ) -> 'a result
106106
107+ (* * Temporary directory used for communication *)
108+ val temp_dir : string
107109
108110
Original file line number Diff line number Diff line change 11open Fe_debug
22
33let setup sock cmdargs id_to_fd_map syslog_stdout redirect_stderr_to_stdout env =
4- let fd_sock_path = Printf. sprintf " /var/xapi/forker/ fd_%s"
4+ let fd_sock_path = Printf. sprintf " %s/ fd_%s" Forkhelpers. temp_dir
55 (Uuidm. to_string (Uuidm. create `V4 )) in
66 let fd_sock = Fecomms. open_unix_domain_sock () in
77 Xapi_stdext_unix.Unixext. unlink_safe fd_sock_path;
@@ -44,6 +44,7 @@ let _ =
4444 Sys. set_signal Sys. sigpipe (Sys. Signal_ignore );
4545
4646 let main_sock = Fecomms. open_unix_domain_sock_server " /var/xapi/forker/main" in
47+ Xapi_stdext_unix.Unixext. mkdir_rec (Forkhelpers. temp_dir) 0o755 ;
4748
4849 Daemon. notify Daemon.State. Ready |> ignore;
4950
You can’t perform that action at this time.
0 commit comments