/[mldonkey]/mldonkey/src/daemon/driver/driverMain.ml
ViewVC logotype

Diff of /mldonkey/src/daemon/driver/driverMain.ml

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.74 by spiralvoice, Tue Sep 6 11:29:11 2005 UTC revision 1.75 by spiralvoice, Tue Sep 20 22:43:04 2005 UTC
# Line 51  let _s x = _s "DriverMain" x Line 51  let _s x = _s "DriverMain" x
51  let _b x = _b "DriverMain" x  let _b x = _b "DriverMain" x
52    
53  let keep_console_output = ref false  let keep_console_output = ref false
54    let pid = ref ""
55    
56  let do_daily () =  let do_daily () =
57    incr CommonWeb.days    incr CommonWeb.days
# Line 348  let load_config () = Line 349  let load_config () =
349            exit 64), _s " : this argument was removed, core will exit";            exit 64), _s " : this argument was removed, core will exit";
350        "-find_port", Arg.Set find_other_port,        "-find_port", Arg.Set find_other_port,
351        _s " : find another port when one is already used";        _s " : find another port when one is already used";
352          "-pid", Arg.String (fun s -> pid := s;
353          ),
354           _s ": directory for pid file (works only on non-Windows platforms)";
355      ] @      ] @
356        !more_args        !more_args
357        @        @
# Line 485  or getting a binary compiled with glibc Line 489  or getting a binary compiled with glibc
489    lprintf_nl (_b "If you connect from a remote machine adjust allowed_ips");    lprintf_nl (_b "If you connect from a remote machine adjust allowed_ips");
490    if Autoconf.system = "windows" && not !keep_console_output then lprintf (_b "%s") win_message;    if Autoconf.system = "windows" && not !keep_console_output then lprintf (_b "%s") win_message;
491    
   if Autoconf.system <> "windows" then  
     (* Doesn't work on windows with mingw, because getpid always returns 948 *)  
     (  
       let oc = open_out "mlnet.pid" in  
       output_string oc ( Printf.sprintf "%s\n" ( string_of_int ( Unix.getpid () ) ) );  
       close_out oc;  
       CommonGlobals.do_at_exit (fun _ -> try Sys.remove "mlnet.pid" with _ -> ());  
       if !verbose then lprintf_nl (_b "Starting with pid %s") (string_of_int(Unix.getpid ()))  
     );  
   
492    add_init_hook (fun _ ->    add_init_hook (fun _ ->
493        if not !gui_included && ( !!start_gui || !!ask_for_gui ) then        if not !gui_included && ( !!start_gui || !!ask_for_gui ) then
494        (try        (try
# Line 593  for config files at the end. *) Line 587  for config files at the end. *)
587    end;    end;
588    Unix32.external_start (CommonGlobals.version());    Unix32.external_start (CommonGlobals.version());
589    
590    (* Doesn't work on windows with mingw, because getpid always returns 948 *)
591      (
592        let pid_filename =
593          Printf.sprintf "%s.pid" (Filename.basename Sys.argv.(0))
594        in
595        let pid_file, s =
596          if Autoconf.system = "windows" then
597            pid_filename, "mlnet"
598          else
599            Filename.concat !pid pid_filename,
600            Printf.sprintf "%s\n" (string_of_int(Unix.getpid()))
601        in
602        let oc = open_out pid_file in
603        output_string oc s;
604        close_out oc;
605        CommonGlobals.do_at_exit (fun _ -> try Sys.remove pid_file with _ -> ());
606        if !verbose && Autoconf.system <> "windows" then
607          lprintf_nl (_b "Starting with pid %s") (string_of_int(Unix.getpid ()))
608      );
609    
610  (* When a core is spawned from a gui, the only way to know the startup has  (* When a core is spawned from a gui, the only way to know the startup has
611  succeeded is the string token "Core started". *)     succeeded is the string token "Core started". *)
612    if not !keep_console_output then    if not !keep_console_output then
613      begin      begin
614        Pervasives.output_string Pervasives.stdout (Printf.sprintf "%sCore started\n" (log_time ()));        Pervasives.output_string Pervasives.stdout (Printf.sprintf "%sCore started\n" (log_time ()));

Legend:
Removed from v.1.74  
changed lines
  Added in v.1.75

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26