Mac OS X,  Mac Security

Unix Signals

When you run a kill command to stop a process from bash or the javax.realtime.POSIXSignalHandler class, you’re sending what’s known as a POSIX signal to the process. These signals can be called via their numeric representations or the signal (e.g. with the -s option of the kill command). Signals include the following:

  • 1: SIGHUP – Close the controlling terminal when the controlling process dies
  • 2: SIGINT – Send a keyboard interrupt
  • 3: SIGQUIT – Quit from a keyboard/terminal
  • 4: SIGILL – Terminate illegal instruction with a core dump and don’t restart
  • 5: SIGTRAP – Send a trace/break trap (with core dump)
  • 6: SIGABRT – Process an abort signal
  • 7: SIGEMT – Send the signal when emulator traps happen
  • 8:SIGFPE – Terminate floating point errors (erroneous arithmetic operations) with a core dump
  • 9: SIGKILL – Kill a signal outright (kill cannot be ignored)
  • 10: SIGBUS – Terminate access (some portion of a memory object) with a core dump
  • 11: SIGSEGV – Terminate with a core dump – Invalid memory reference
  • 12: SIGSYS – Bad system call
  • 13: SIGPIPE – Terminate and write on the pipe
  • 14: SIGALRM – Timed kill of a signal
  • 15: SIGTERM – Software termination of a signal
  • 16: SIGUSR1 – User defined signal 1, with SIGUSR2 as user defined signal 2
  • 17: SIGTERM – Software termination of a signal
  • 18: SIGCHLD – Child status change
  • 19: SIGPWR – Send the signal when the system encounters a power failure
  • 20: SIGWINCH – Send the signal to a process when the window changes
  • 21: SIGURG – Ignore signal, high bandwidth data
  • 22: SIGIO – Terminate pollable event
  • 23: SIGSTOP – Stop executing (cannot be ignored or caught by an exception)
  • 24: SIGTSTP – Terminate a stop signal.
  • 25: SIGCONT – If stopped, continue executing a process
  • 26: SIGTTIN – Background process is attempting to read
  • 27: SIGTTOU – Background process is attempting to write
  • 28: SIGVTALTM – Expired virtual timer
  • 29: SIGPROF – Terminate Profiling timer
  • 30: SIGXCPU – Past the CPU time limit, terminate with a core dump
  • 31: SIGXFSZ – Past the file size limit, terminate with a core dump
  • 32: SIGWAITING – Suspend execution of the process until a defined signal is sent
  • 33: SIGLWP – Send when the implementing threading requires a signal
  • 34: SIGFREEZE – Deprecated
  • 35: SIGTHAW – Deprecated
  • 36: SIGCANCEL – Deprecated
  • 37: SIGLOST – Send the signal when encountering a lost file lock

To put these in practice, let’s use the kill command from bash, with the -s option followed by SIGTERM and then the pid number:

sudo kill -s SIGTERM 20341