Néxt: Cleanups on Get away, Previous: Normal Termination, Up: Program End of contract ContentsIndex
25.7.2 Get away Standing
Flight status description. Skip to main content. Config tool: /u0/oracle/testdb/9.2.0/appsutil/bin/adgentns.pl Command. Instantiated adgentns.pl exiting with status 2 ERRORCODE = 2 ERRORCODEEND.
When a program exits, it can return to the mother or father procedure a smallamount of info about the result in of termination, using theleave status. This is certainly a value between 0 and 255 that the exitingprocess passes as an case to
get out of
.Usually you should make use of the get out of status to document very wide informationabout success or failure. You can't offer a lot of details about thereasons for the failing, and nearly all parent procedures would not really wish muchdetail anyhow.
There are usually conferences for what types of status beliefs certain programsshould return. The most common convention is just 0 for achievement and 1for failing. Applications that perform assessment use a differentconvention: they use status 1 to suggest a mismatch, ánd status 2 toindicate an inability to evaluate. Your program should follow anexisting lifestyle if an existing convention can make feeling fór it.
A common convention stores status values 128 and up for specialpurposes. In particular, the value 128 is certainly utilized to suggest failure toexecute another plan in a subprocess. This lifestyle is notuniversally obeyed, but it is definitely a good idea to stick to it in your programs.
Warning:Wear't test to use the number of mistakes as the exitstatus. This is certainly actually not really very helpful; a mother or father process wouldgenerally not caution how several errors happened. Worse than thát, it doesnot function, because the status worth is truncated to eight parts.Thus, if the plan tried to survey 256 errors, the parent wouldreceive a statement of 0 errors-that is definitely, success.
For the exact same reason, it will not work to use the value of
érrno
as thé get out of status-these can exceed 255.Portability notice:Some non-POSIX techniques make use of differentconventions for get away status values. For better portability, you canusé the macrosEXITSUCCESSánd for theconventional státus worth for achievement and failure, respectively. Theyare announced in the filestdlib.h.
EXITFAILURE
This macró can end up being used with the
departure
function to indicatesuccessful program finalization.On POSIX systems, the worth of this macro will be
0
. On othersystems, the worth might become some additional (probably non-constant) intégerexpression.This macró can become utilized with the
escape
functionality to indicateunsuccessful plan conclusion in a common feeling.On POSIX systems, the value of this macro can be
1
. On othersystems, the value might become some various other (possibly non-constant) integerexpression. Other nonzero status beliefs also indicate disappointments. Certainprograms make use of different nonzero status beliefs to reveal particularkinds of 'nón-success'. For instance,diff
uses status value1
to indicate that the files are various, and2
or even more tomean that there had been trouble in starting the data files.Don't confuse a plan's escape status with a procedure' termination status.There are usually a lot of methods a process can terminate besides getting its programfinish. In the event that the procedure terminationis certainlycaused by programtermination (i.y.,
departure
), even though, the plan's get out of status becomespart of the procedure' end of contract státus.Néxt: Cleanups on Departure, Previous: Regular Termination, Up: Plan End of contract ContentsIndex