xref: /openssl/doc/man3/ERR_new.pod (revision 0f84cbc3)
1=pod
2
3=head1 NAME
4
5ERR_new, ERR_set_debug, ERR_set_error, ERR_vset_error
6- Error recording building blocks
7
8=head1 SYNOPSIS
9
10 #include <openssl/err.h>
11
12 void ERR_new(void);
13 void ERR_set_debug(const char *file, int line, const char *func);
14 void ERR_set_error(int lib, int reason, const char *fmt, ...);
15 void ERR_vset_error(int lib, int reason, const char *fmt, va_list args);
16
17=head1 DESCRIPTION
18
19The functions described here are generally not used directly, but
20rather through macros such as L<ERR_raise(3)>.
21They can still be useful for anyone that wants to make their own
22macros.
23
24ERR_new() allocates a new slot in the thread's error queue.
25
26ERR_set_debug() sets the debug information related to the current
27error in the thread's error queue.
28The values that can be given are the filename I<file>, line in the
29file I<line> and the name of the function I<func> where the error
30occurred.
31The names must be constant, this function will only save away the
32pointers, not copy the strings.
33
34ERR_set_error() sets the error information, which are the library
35number I<lib> and the reason code I<reason>, and additional data as a
36format string I<fmt> and an arbitrary number of arguments.
37The additional data is processed with L<BIO_snprintf(3)> to form the
38additional data string, which is allocated and store in the error
39record.
40
41ERR_vset_error() works like ERR_set_error(), but takes a B<va_list>
42argument instead of a variable number of arguments.
43
44=head1 RETURN VALUES
45
46ERR_new, ERR_set_debug, ERR_set_error and ERR_vset_error
47do not return any values.
48
49=head1 NOTES
50
51The library number is unique to each unit that records errors.
52OpenSSL has a number of preallocated ones for its own uses, but
53others may allocate their own library number dynamically with
54L<ERR_get_next_error_library(3)>.
55
56Reason codes are unique within each library, and may have an
57associated set of strings as a short description of the reason.
58For dynamically allocated library numbers, reason strings are recorded
59with L<ERR_load_strings(3)>.
60
61Provider authors are supplied with core versions of these functions,
62see L<provider-base(7)>.
63
64=head1 SEE ALSO
65
66L<ERR_raise(3)>, L<ERR_get_next_error_library(3)>,
67L<ERR_load_strings(3)>, L<BIO_snprintf(3)>, L<provider-base(7)>
68
69=head1 COPYRIGHT
70
71Copyright 2000-2020 The OpenSSL Project Authors. All Rights Reserved.
72
73Licensed under the Apache License 2.0 (the "License").  You may not use
74this file except in compliance with the License.  You can obtain a copy
75in the file LICENSE in the source distribution or at
76L<https://www.openssl.org/source/license.html>.
77
78=cut
79