[MLton] MinGW signals

Vesa Karvonen vesa.a.j.k at gmail.com
Fri Apr 20 05:12:07 PDT 2007


The signal numbers in runtime/platform/mingw.h seem a bit odd:

 #define SIGHUP 1
 #define SIGKILL 2
 #define SIGPIPE 3
 #define SIGQUIT 9
 #define SIGALRM 13
 #define SIGBUS 14
 #define SIGSTOP 16
 #define SIGTSTP 18
 #define SIGCHLD 20
 #define SIGTTIN 21
 #define SIGTTOU 22
 #define SIGCONT 25
 #define SIGUSR1 25
 #define SIGUSR2 26
 #define SIGVTALRM 26    /* virtual time alarm */
 #define SIGPROF 27      /* profiling time alarm */

First of all, signal support in Windows is, well, rather minimal (at
least if you
don't count the Interix SDK):

 http://msdn2.microsoft.com/en-us/library/xdkz3x12(VS.71).aspx

Both the MinGW and MSVC++ version of the <signal.h> header define:

 #define SIGINT          2       /* interrupt */
 #define SIGILL          4       /* illegal instruction - invalid
function image */
 #define SIGFPE          8       /* floating point exception */
 #define SIGSEGV         11      /* segment violation */
 #define SIGTERM         15      /* Software termination signal from kill */
 #define SIGBREAK        21      /* Ctrl-Break sequence */
 #define SIGABRT         22      /* abnormal termination triggered by
abort call */

If you look carefully, you can see that MLton maps SIGKILL to SIGINT,
SIGTTIN to SIGBREAK, and SIGTTOU to SIGABRT.

So, I wonder about the origin of the signal numbers in mingw.h?  Is there
some specific reason to use those particular signal numbers?

(I'm looking at this stuff because I'd like to get a signal when my program
is requested to terminate by Windows in certain situations.)

-Vesa Karvonen



More information about the MLton mailing list