1erl_error(3) C Library Functions erl_error(3)
2
3
4
6 erl_error - Error print routines.
7
9 This module contains some error printing routines taken from "Advanced
10 Programming in the UNIX Environment" by W. Richard Stevens.
11
12 These functions are all called in the same manner as printf(), that is,
13 with a string containing format specifiers followed by a list of corre‐
14 sponding arguments. All output from these functions is to stderr.
15
17 void erl_err_msg(FormatStr, ... )
18
19 Types:
20
21 const char *FormatStr;
22
23 The message provided by the caller is printed. This function is
24 simply a wrapper for fprintf().
25
26 void erl_err_quit(FormatStr, ... )
27
28 Types:
29
30 const char *FormatStr;
31
32 Use this function when a fatal error has occurred that is not
33 because of a system call. The message provided by the caller is
34 printed and the process terminates with exit value 1. This func‐
35 tion does not return.
36
37 void erl_err_ret(FormatStr, ... )
38
39 Types:
40
41 const char *FormatStr;
42
43 Use this function after a failed system call. The message pro‐
44 vided by the caller is printed followed by a string describing
45 the reason for failure.
46
47 void erl_err_sys(FormatStr, ... )
48
49 Types:
50
51 const char *FormatStr;
52
53 Use this function after a failed system call. The message pro‐
54 vided by the caller is printed followed by a string describing
55 the reason for failure, and the process terminates with exit
56 value 1. This function does not return.
57
59 Most functions in Erl_Interface report failures to the caller by
60 returning some otherwise meaningless value (typically NULL or a nega‐
61 tive number). As this only tells you that things did not go well, exam‐
62 ine the error code in erl_errno if you want to find out more about the
63 failure.
64
66 volatile int erl_errno
67
68 erl_errno is initially (at program startup) zero and is then set
69 by many Erl_Interface functions on failure to a non-zero error
70 code to indicate what kind of error it encountered. A successful
71 function call can change erl_errno (by calling some other func‐
72 tion that fails), but no function does never set it to zero.
73 This means that you cannot use erl_errno to see if a function
74 call failed. Instead, each function reports failure in its own
75 way (usually by returning a negative number or NULL), in which
76 case you can examine erl_errno for details.
77
78 erl_errno uses the error codes defined in your system's
79 <errno.h>.
80
81 Note:
82 erl_errno is a "modifiable lvalue" (just like ISO C defines
83 errno to be) rather than a variable. This means it can be imple‐
84 mented as a macro (expanding to, for example, *_erl_errno()).
85 For reasons of thread safety (or task safety), this is exactly
86 what we do on most platforms.
87
88
89
90
91Ericsson AB erl_interface 3.11.3 erl_error(3)