GeezerVisonThe World Wide Web, restored to 800 pixels of glory. | ||||||||||||||||||
| Home|About|Gaming cabinet|Archives|How it works|Starter sites | ||||||||||||||||||
GeezerVison is showing en.wikipedia.org — Exit status - Wikipedia (Redirected from Return code) "Exit code" redirects here. For the prefix used to place an international telephone call, see International direct dialing § International call prefix.
"Result code" and "return code" redirect here. For the result code of software in general, see error code.
In computing, the exit status (also exit code or exit value) of a terminated process is an integer number that is made available to its parent process (or caller). In DOS, this may be referred to as an errorlevel. When computer programs are executed, the operating system creates an abstract entity called a process in which the book-keeping for that program is maintained. In multitasking operating systems such as Unix or Linux, new processes can be created by active processes. The process that spawns another is called a parent process, while those created are child processes. Child processes run concurrently with the parent process. The technique of spawning child processes is used to delegate some work to a child process when there is no reason to stop the execution of the parent. When the child finishes executing, it exits by calling the exit system call. This system call facilitates passing the exit status code back to the parent, which can retrieve this value using the wait system call. SemanticsThe parent and the child can have an understanding about the meaning of the exit statuses. For example, it is common programming practice for a child process to return (exit with) zero to the parent signifying success. Apart from this return value from the child, other information like how the process exited, either normally or by a signal may also be available to the parent process. The specific set of codes returned is unique to the program that sets it. Typically it indicates success or failure. The value of the code returned by the function or program may indicate a specific cause of failure. On many systems, the higher the value, the more severe the cause of the error.[1] Alternatively, each bit may indicate a different condition, with these being evaluated by the or operator together to give the final value; for example, fsck does this. Sometimes, if the codes are designed with this purpose in mind, they can be used directly as a branch index upon return to the initiating program to avoid additional tests. AmigaOSIn AmigaOS, MorphOS and AROS, four levels are defined:
Shell and scriptsShell scripts typically execute commands and capture their exit statuses. For the shell's purposes, a command which exits with a zero exit status has succeeded. A nonzero exit status indicates failure. This seemingly counter-intuitive scheme is used so there is one well-defined way to indicate success and a variety of ways to indicate various failure modes. When a command is terminated by a signal whose number is If a command is not found, the shell should return a status of 127. If a command is found but is not executable, the return status should be 126.[2] Note that this is not the case for all shells. If a command fails because of an error during expansion or redirection, the exit status is greater than zero. C and C++The C and C++ programming languages allow programs exiting or returning from the main function to signal success or failure by returning an integer, or returning the macros The return value from Apart from C#In C#, the DOSIn DOS terminology, an errorlevel is an integer exit code returned by an executable program or subroutine. Errorlevels typically range from 0 to 255.[5][6][7][8] In DOS there are only 256 error codes available, but DR DOS 6.0 and higher support 16-bit error codes at least in CONFIG.SYS.[7] With 4DOS and DR-DOS COMMAND.COM, exit codes (in batchjobs) can be set by EXIT n[7] and (in CONFIG.SYS) through ERROR=n.[7] Exit statuses are often captured by batch programs through IF ERRORLEVEL commands.[5][7] Multiuser DOS supports a reserved environment variable %ERRORLVL% which gets automatically updated on return from applications. COMMAND.COM under DR-DOS 7.02 and higher supports a similar pseudo-environment variable %ERRORLVL% as well as %ERRORLEVEL%. In CONFIG.SYS, DR DOS 6.0 and higher supports ONERROR to test the load status and return code of device drivers and the exit code of programs.[7] JavaIn Java, the OpenVMSIn OpenVMS, success is indicated by odd values and failure by even values. The value is a 32-bit integer with sub-fields: control bits, facility number, message number and severity. Severity values are divided between success (Success, Informational) and failure (Warning, Error, Fatal).[10] Plan 9In Plan 9's C, exit status is indicated by a string passed to the exits() function, and function main() is type void. POSIXIn Unix and other POSIX-compatible systems, the parent process can retrieve the exit status of a child process using the The In the POSIX-compatible systems typically use a convention of zero for success and nonzero for error.[15] Some conventions have developed as to the relative meanings of various error codes; for example GNU recommend that codes with the high bit set be reserved for serious errors.[3] BSD-derived OS's have defined an extensive set of preferred interpretations: Meanings for 15 status codes 64 through 78 are defined in POSIX header The Advanced Bash-Scripting Guide has some information on the meaning of non-0 exit status codes.[18] RustIn Rust, Internally on the Rust runtime, these will return In the Rust standard library, the following types have implementations for
VM/CMS
WindowsMicrosoft Windows uses 32-bit unsigned integers as exit codes,[21][22] although the command interpreter treats them as signed.[23] Exit codes are directly referenced, for example, by the command line interpreter CMD.exe in the See alsoReferences
Hidden categories:
| ||||||||||||||||||
| You are visitor 01402503 — GeezerVison does not store the pages you look up. Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required. |