1KEXIT(2) LAM LOCAL LIBRARY KEXIT(2)
2
3
4
6 kexit, _kexit, atkexit - Terminate LAM process.
7
9 int kexit (int errcode);
10 int _kexit (int errcode);
11 int atkexit (int (*func)(), char *arg);
12
14 subroutine KXIT (errcode)
15 integer errcode
16
18 A LAM process that calls kenter(2) must call kexit() to terminate.
19 kexit() calls all registered LAM exit functions before informing the
20 local daemon of its death.
21
22 _kexit() may be used instead of kexit() to avoid calling the exit func‐
23 tions.
24
25 The argument to kexit() and _kexit() is an exit code which is sent in a
26 message to the parent process, if requested by the parent process when
27 the process was created. See rploadgo(2) and rpwait(2). By convention
28 the exit code is 0 if the process successfully completed.
29
30 An exit function is registered by calling atkexit(). The arguments
31 passed to atkexit() are the address of the exit function to be called
32 upon kexit(), and an argument to pass to the exit function when it is
33 called. (Note that the function may ignore the argument, reverting to
34 the ANSI standard C library atexit(3) behavior, where no argument is
35 passable.) There is a limit on how many exit functions may be regis‐
36 tered. Exit functions are called in reverse order of their registra‐
37 tion. Some system modules register their own cleanup functions.
38
39 kexit() eventually calls kdetach(2) to gracefully detach from the LAM
40 daemon and exit(3) to actually terminate within the host operating sys‐
41 tem.
42
44 kexit() and _kexit() do not return. Upon successful completion,
45 atkexit() returns 0. Otherwise, -1 is returned and the global variable
46 errno is set to indicate the error.
47
49 ENOEXDESCRIPTORS There is no room left in the internal table of exit
50 functions.
51
53 If too many user functions are registered with atkexit() before calling
54 system functions that also call atkexit(), the latter calls to
55 atkexit() may fail and some system functions may not be registered. If
56 the missing exit function is for LAM stream file I/O, some output data
57 may be lost.
58
60 kdetach(2), kenter(2)
61
62
63
64LAM 7.1.2 March, 2006 KEXIT(2)