1 /*
   2  * Copyright (c) 2003, Oracle and/or its affiliates. All rights reserved.
   3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   4  *
   5  * This code is free software; you can redistribute it and/or modify it
   6  * under the terms of the GNU General Public License version 2 only, as
   7  * published by the Free Software Foundation.
   8  *
   9  * This code is distributed in the hope that it will be useful, but WITHOUT
  10  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  11  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  12  * version 2 for more details (a copy is included in the LICENSE file that
  13  * accompanied this code).
  14  *
  15  * You should have received a copy of the GNU General Public License version
  16  * 2 along with this work; if not, write to the Free Software Foundation,
  17  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  18  *
  19  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  20  * or visit www.oracle.com if you need additional information or have any
  21  * questions.
  22  *
  23  */
  24 
  25 package sun.jvm.hotspot.runtime.bsd;
  26 
  27 public class BsdSignals {
  28   private static String[] signalNames = {
  29     "",           /* No signal 0 */
  30     "SIGHUP",     /* hangup */
  31     "SIGINT",     /* interrupt */
  32     "SIGQUIT",    /* quit */
  33     "SIGILL",     /* illegal instr. (not reset when caught) */
  34     "SIGTRAP",    /* trace trap (not reset when caught) */
  35     "SIGABRT",    /* abort() */
  36     "SIGEMT",     /* EMT instruction */
  37     "SIGFPE",     /* floating point exception */
  38     "SIGKILL",    /* kill (cannot be caught or ignored) */
  39     "SIGBUS",     /* bus error */
  40     "SIGSEGV",    /* segmentation violation */
  41     "SIGSYS",     /* non-existent system call invoked */
  42     "SIGPIPE",    /* write on a pipe with no one to read it */
  43     "SIGALRM",    /* alarm clock */
  44     "SIGTERM",    /* software termination signal from kill */
  45     "SIGURG",     /* urgent condition on IO channel */
  46     "SIGSTOP",    /* sendable stop signal not from tty */
  47     "SIGTSTP",    /* stop signal from tty */
  48     "SIGCONT",    /* continue a stopped process */
  49     "SIGCHLD",    /* to parent on child stop or exit */
  50     "SIGTTIN",    /* to readers pgrp upon background tty read */
  51     "SIGTTOU",    /* like TTIN if (tp->t_local&LTOSTOP) */
  52     "SIGIO",      /* input/output possible signal */
  53     "SIGXCPU",    /* exceeded CPU time limit */
  54     "SIGXFSZ",    /* exceeded file size limit */
  55     "SIGVTALRM",  /* virtual time alarm */
  56     "SIGPROF",    /* profiling time alarm */
  57     "SIGWINCH",   /* window size changes */
  58     "SIGINFO",    /* information request */
  59     "SIGUSR1",    /* user defined signal 1 */
  60     "SIGUSR2"     /* user defined signal 2 */
  61   };
  62 
  63   public static String getSignalName(int sigNum) {
  64     if ((sigNum <= 0) || (sigNum >= signalNames.length)) {
  65       // Probably best to fail in a non-destructive way
  66       return "<Error: Illegal signal number " + sigNum + ">";
  67     }
  68     return signalNames[sigNum];
  69   }
  70 }