xref: /onnv-gate/usr/src/common/openssl/doc/crypto/ERR_get_error.pod (revision 2175:b0b2f052a486)
1*2175Sjp161948=pod
2*2175Sjp161948
3*2175Sjp161948=head1 NAME
4*2175Sjp161948
5*2175Sjp161948ERR_get_error, ERR_peek_error, ERR_peek_last_error,
6*2175Sjp161948ERR_get_error_line, ERR_peek_error_line, ERR_peek_last_error_line,
7*2175Sjp161948ERR_get_error_line_data, ERR_peek_error_line_data,
8*2175Sjp161948ERR_peek_last_error_line_data - obtain error code and data
9*2175Sjp161948
10*2175Sjp161948=head1 SYNOPSIS
11*2175Sjp161948
12*2175Sjp161948 #include <openssl/err.h>
13*2175Sjp161948
14*2175Sjp161948 unsigned long ERR_get_error(void);
15*2175Sjp161948 unsigned long ERR_peek_error(void);
16*2175Sjp161948 unsigned long ERR_peek_last_error(void);
17*2175Sjp161948
18*2175Sjp161948 unsigned long ERR_get_error_line(const char **file, int *line);
19*2175Sjp161948 unsigned long ERR_peek_error_line(const char **file, int *line);
20*2175Sjp161948 unsigned long ERR_peek_last_error_line(const char **file, int *line);
21*2175Sjp161948
22*2175Sjp161948 unsigned long ERR_get_error_line_data(const char **file, int *line,
23*2175Sjp161948         const char **data, int *flags);
24*2175Sjp161948 unsigned long ERR_peek_error_line_data(const char **file, int *line,
25*2175Sjp161948         const char **data, int *flags);
26*2175Sjp161948 unsigned long ERR_peek_last_error_line_data(const char **file, int *line,
27*2175Sjp161948         const char **data, int *flags);
28*2175Sjp161948
29*2175Sjp161948=head1 DESCRIPTION
30*2175Sjp161948
31*2175Sjp161948ERR_get_error() returns the earliest error code from the thread's error
32*2175Sjp161948queue and removes the entry. This function can be called repeatedly
33*2175Sjp161948until there are no more error codes to return.
34*2175Sjp161948
35*2175Sjp161948ERR_peek_error() returns the earliest error code from the thread's
36*2175Sjp161948error queue without modifying it.
37*2175Sjp161948
38*2175Sjp161948ERR_peek_last_error() returns the latest error code from the thread's
39*2175Sjp161948error queue without modifying it.
40*2175Sjp161948
41*2175Sjp161948See L<ERR_GET_LIB(3)|ERR_GET_LIB(3)> for obtaining information about
42*2175Sjp161948location and reason of the error, and
43*2175Sjp161948L<ERR_error_string(3)|ERR_error_string(3)> for human-readable error
44*2175Sjp161948messages.
45*2175Sjp161948
46*2175Sjp161948ERR_get_error_line(), ERR_peek_error_line() and
47*2175Sjp161948ERR_peek_last_error_line() are the same as the above, but they
48*2175Sjp161948additionally store the file name and line number where
49*2175Sjp161948the error occurred in *B<file> and *B<line>, unless these are B<NULL>.
50*2175Sjp161948
51*2175Sjp161948ERR_get_error_line_data(), ERR_peek_error_line_data() and
52*2175Sjp161948ERR_get_last_error_line_data() store additional data and flags
53*2175Sjp161948associated with the error code in *B<data>
54*2175Sjp161948and *B<flags>, unless these are B<NULL>. *B<data> contains a string
55*2175Sjp161948if *B<flags>&B<ERR_TXT_STRING>. If it has been allocated by OPENSSL_malloc(),
56*2175Sjp161948*B<flags>&B<ERR_TXT_MALLOCED> is true.
57*2175Sjp161948
58*2175Sjp161948=head1 RETURN VALUES
59*2175Sjp161948
60*2175Sjp161948The error code, or 0 if there is no error in the queue.
61*2175Sjp161948
62*2175Sjp161948=head1 SEE ALSO
63*2175Sjp161948
64*2175Sjp161948L<err(3)|err(3)>, L<ERR_error_string(3)|ERR_error_string(3)>,
65*2175Sjp161948L<ERR_GET_LIB(3)|ERR_GET_LIB(3)>
66*2175Sjp161948
67*2175Sjp161948=head1 HISTORY
68*2175Sjp161948
69*2175Sjp161948ERR_get_error(), ERR_peek_error(), ERR_get_error_line() and
70*2175Sjp161948ERR_peek_error_line() are available in all versions of SSLeay and
71*2175Sjp161948OpenSSL. ERR_get_error_line_data() and ERR_peek_error_line_data()
72*2175Sjp161948were added in SSLeay 0.9.0.
73*2175Sjp161948ERR_peek_last_error(), ERR_peek_last_error_line() and
74*2175Sjp161948ERR_peek_last_error_line_data() were added in OpenSSL 0.9.7.
75*2175Sjp161948
76*2175Sjp161948=cut
77