Hi all !

In Dtools, when we call Init.init, is does:

  let init ?(prohibit_root=false) f =
    if prohibit_root then exit_when_root ();
    let signal_h i = () in
    Sys.set_signal Sys.sigterm (Sys.Signal_handle signal_h);
    Sys.set_signal Sys.sigint (Sys.Signal_handle signal_h);
    if conf_daemon#get
    then daemonize (main f)
    else catch (main f) (fun () -> ())

In FreeBSD the attached script (a shutdown 5 seconds after startup) fails to 
stop correctly. However, it closes correctly when commenting out the signal 
handling lines. 

Init.init is used main.ml with Tutils.main to create the main loop. 
Interestingly, the main loop ends, but the process does not quit.

Apparently, discarding all signal handlers on those signals in FreeBSD 
prevents the process from closing correctly.

Is there a reason for this piece of code ? How could we fix this (if not 
obviously by removing them/making them optional) ?


Romain
set("log.file",false)
set("log.stdout",true)
set("log.level",5)

def finish () = 
  print("end..")
  shutdown ()
  (-1.)
end

add_timeout(5.,finish)

out(blank())

------------------------------------------------------------------------------
OpenSolaris 2009.06 is a cutting edge operating system for enterprises 
looking to deploy the next generation of Solaris that includes the latest 
innovations from Sun and the OpenSource community. Download a copy and 
enjoy capabilities such as Networking, Storage and Virtualization. 
Go to: http://p.sf.net/sfu/opensolaris-get
_______________________________________________
Savonet-devl mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/savonet-devl

Répondre à