001/*
002 *  This file is part of the Jikes RVM project (http://jikesrvm.org).
003 *
004 *  This file is licensed to You under the Eclipse Public License (EPL);
005 *  You may not use this file except in compliance with the License. You
006 *  may obtain a copy of the License at
007 *
008 *      http://www.opensource.org/licenses/eclipse-1.0.php
009 *
010 *  See the COPYRIGHT.txt file distributed with this work for information
011 *  regarding copyright ownership.
012 */
013package org.jikesrvm.runtime;
014
015/** Exit status codes for the Jikes RVM virtual machine.
016 * <p>
017 * These process exit status codes are used by the virtual machine whenever it
018 * must exit with some failure condition.  By default, if all goes well, the
019 * virtual machine will exit with status zero.
020 */
021public final class ExitStatus {
022  /* Exit statuses, pending a better location.
023
024     <p>Please keep this list in numerical order.
025
026     <p>You might somewhere find uses of the explicit constant -1 as an exit
027     status (it gets mapped to 255).  I think they're all dead, but it is
028     possible that some have crept in. Please do not use -1 any more.  That's
029     because on Cygwin, exiting with status -1 will not map to 255 -- instead
030     (according to Brian Carlstrom) it gets mapped to status 0, and we
031     certainly don't want to give a false impression of success!  Please
032     replace it with {@link #EXIT_STATUS_MISC_TROUBLE}.
033  */
034  public static final int EXIT_STATUS_RECURSIVELY_SHUTTING_DOWN = 128;
035  /* Note that XARGS uses status codes 123 through 127 specially.  You are
036   * warned.  We keep out of the namespace from 129 upwards to 180 or so,
037   * because Bash and other SH-compatible shells treat a command that dies
038   * from an uncaught signal as if it had died with an exit status of 128 plus
039   * the signal number.  For example, dying with SIGABRT (signal #6) gives an
040   * exit status of 134.  */
041  /** Traditionally the shell and xargs use status 127 to mean that
042   * they were unable to find something to execute.
043   * To quote the bash manpage, "If a command is found
044   *  but is not executable, the return status is 126."
045   * We shall adopt those customs here. --Steve Augart*/
046  public static final int EXIT_STATUS_EXECUTABLE_NOT_FOUND = 127;
047  public static final int EXIT_STATUS_COULD_NOT_EXECUTE = 126;
048  public static final int EXIT_STATUS_IMPOSSIBLE_LIBRARY_FUNCTION_ERROR = 125;
049  public static final int EXIT_STATUS_DUMP_STACK_AND_DIE = 124;
050  public static final int EXIT_STATUS_MAIN_THREAD_COULD_NOT_LAUNCH = 123;
051  public static final int EXIT_STATUS_MISC_TROUBLE = 122;
052  public static final int EXIT_STATUS_SYSFAIL = EXIT_STATUS_DUMP_STACK_AND_DIE;
053  public static final int EXIT_STATUS_SYSCALL_TROUBLE = 121;
054  public static final int EXIT_STATUS_TIMER_TROUBLE = EXIT_STATUS_SYSCALL_TROUBLE;
055  public static final int EXIT_STATUS_UNEXPECTED_CALL_TO_SYS = 120;
056  public static final int EXIT_STATUS_UNSUPPORTED_INTERNAL_OP = EXIT_STATUS_UNEXPECTED_CALL_TO_SYS;
057  public static final int EXIT_STATUS_DYING_WITH_UNCAUGHT_EXCEPTION = 113;
058  public static final int EXIT_STATUS_OPT_COMPILER_FAILED = 101;
059  /** same as OPT compiler */
060  public static final int EXIT_STATUS_JNI_COMPILER_FAILED = 101;
061  public static final int EXIT_STATUS_BOGUS_COMMAND_LINE_ARG = 100;
062  public static final int EXIT_STATUS_TOO_MANY_THROWABLE_ERRORS = 99;
063  public static final int EXIT_STATUS_TOO_MANY_OUT_OF_MEMORY_ERRORS = EXIT_STATUS_TOO_MANY_THROWABLE_ERRORS;
064  public static final int EXIT_STATUS_JNI_TROUBLE = 98;
065  /** Used in 0005fProcess.C */
066  public static final int EXIT_STATUS_BAD_WORKING_DIR = EXIT_STATUS_JNI_TROUBLE;
067  /** What exit status should we use after we have printed out a help message?
068   *  Some common utilities exit with 1, some with 0.  Jikes RVM seems
069   *  to be using 1, so let's keep doing so. */
070  public static final int EXIT_STATUS_PRINTED_HELP_MESSAGE = 1;
071
072  private ExitStatus() {
073    // prevent instantiation
074  }
075
076}