xref: /freebsd/secure/lib/libcrypto/man/man3/ERR_put_error.3 (revision e9e8876a4d6afc1ad5315faaa191b25121a813d7)
Automatically generated by Pod::Man 4.14 (Pod::Simple 3.43)

Standard preamble:
========================================================================
..
..
.. Set up some character translations and predefined strings. \*(-- will
give an unbreakable dash, \*(PI will give pi, \*(L" will give a left
double quote, and \*(R" will give a right double quote. \*(C+ will
give a nicer C++. Capital omega is used to do unbreakable dashes and
therefore won't be available. \*(C` and \*(C' expand to `' in nroff,
nothing in troff, for use with C<>.
.tr \(*W- . ds -- \(*W- . ds PI pi . if (\n(.H=4u)&(1m=24u) .ds -- \(*W\h'-12u'\(*W\h'-12u'-\" diablo 10 pitch . if (\n(.H=4u)&(1m=20u) .ds -- \(*W\h'-12u'\(*W\h'-8u'-\" diablo 12 pitch . ds L" "" . ds R" "" . ds C` "" . ds C' "" 'br\} . ds -- \|\(em\| . ds PI \(*p . ds L" `` . ds R" '' . ds C` . ds C' 'br\}
Escape single quotes in literal strings from groff's Unicode transform.

If the F register is >0, we'll generate index entries on stderr for
titles (.TH), headers (.SH), subsections (.SS), items (.Ip), and index
entries marked with X<> in POD. Of course, you'll have to process the
output yourself in some meaningful fashion.

Avoid warning from groff about undefined register 'F'.
.. .nr rF 0 . if \nF \{\ . de IX . tm Index:\\$1\t\\n%\t"\\$2" .. . if !\nF==2 \{\ . nr % 0 . nr F 2 . \} . \} .\} .rr rF
Accent mark definitions (@(#)ms.acc 1.5 88/02/08 SMI; from UCB 4.2).
Fear. Run. Save yourself. No user-serviceable parts.
. \" fudge factors for nroff and troff . ds #H 0 . ds #V .8m . ds #F .3m . ds #[ \f1 . ds #] .\} . ds #H ((1u-(\\\\n(.fu%2u))*.13m) . ds #V .6m . ds #F 0 . ds #[ \& . ds #] \& .\} . \" simple accents for nroff and troff . ds ' \& . ds ` \& . ds ^ \& . ds , \& . ds ~ ~ . ds / .\} . ds ' \\k:\h'-(\\n(.wu*8/10-\*(#H)'\'\h"|\\n:u" . ds ` \\k:\h'-(\\n(.wu*8/10-\*(#H)'\`\h'|\\n:u' . ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'^\h'|\\n:u' . ds , \\k:\h'-(\\n(.wu*8/10)',\h'|\\n:u' . ds ~ \\k:\h'-(\\n(.wu-\*(#H-.1m)'~\h'|\\n:u' . ds / \\k:\h'-(\\n(.wu*8/10-\*(#H)'\z\(sl\h'|\\n:u' .\} . \" troff and (daisy-wheel) nroff accents . \" corrections for vroff . \" for low resolution devices (crt and lpr) \{\ . ds : e . ds 8 ss . ds o a . ds d- d\h'-1'\(ga . ds D- D\h'-1'\(hy . ds th \o'bp' . ds Th \o'LP' . ds ae ae . ds Ae AE .\} ========================================================================

Title "ERR_PUT_ERROR 3"
ERR_PUT_ERROR 3 "2021-12-14" "1.1.1m" "OpenSSL"
For nroff, turn off justification. Always turn off hyphenation; it makes
way too many mistakes in technical documents.
"NAME"
ERR_put_error, ERR_add_error_data, ERR_add_error_vdata - record an error
"SYNOPSIS"
Header "SYNOPSIS" .Vb 1 #include <openssl/err.h> \& void ERR_put_error(int lib, int func, int reason, const char *file, int line); \& void ERR_add_error_data(int num, ...); void ERR_add_error_vdata(int num, va_list arg); .Ve
"DESCRIPTION"
Header "DESCRIPTION" \fBERR_put_error() adds an error code to the thread's error queue. It signals that the error of reason code reason occurred in function \fBfunc of library lib, in line number line of file. This function is usually called by a macro.

\fBERR_add_error_data() associates the concatenation of its num string arguments with the error code added last. \fBERR_add_error_vdata() is similar except the argument is a va_list.

\fBERR_load_strings\|(3) can be used to register error strings so that the application can a generate human-readable error messages for the error code.

"Reporting errors"
Subsection "Reporting errors" Each sub-library has a specific macro XXXerr() that is used to report errors. Its first argument is a function code \s-1XXX_F_...\s0, the second argument is a reason code \s-1XXX_R_...\s0. Function codes are derived from the function names; reason codes consist of textual error descriptions. For example, the function ssl3_read_bytes() reports a \*(L"handshake failure\*(R" as follows:

.Vb 1 SSLerr(SSL_F_SSL3_READ_BYTES, SSL_R_SSL_HANDSHAKE_FAILURE); .Ve

Function and reason codes should consist of uppercase characters, numbers and underscores only. The error file generation script translates function codes into function names by looking in the header files for an appropriate function name, if none is found it just uses the capitalized form such as \*(L"\s-1SSL3_READ_BYTES\*(R"\s0 in the above example.

The trailing section of a reason code (after the \*(L"_R_\*(R") is translated into lowercase and underscores changed to spaces.

Although a library will normally report errors using its own specific XXXerr macro, another library's macro can be used. This is normally only done when a library wants to include \s-1ASN1\s0 code which must use the ASN1err() macro.

"RETURN VALUES"
Header "RETURN VALUES" \fBERR_put_error() and ERR_add_error_data() return no values.
"SEE ALSO"
Header "SEE ALSO" \fBERR_load_strings\|(3)
"COPYRIGHT"
Header "COPYRIGHT" Copyright 2000-2020 The OpenSSL Project Authors. All Rights Reserved.

Licensed under the OpenSSL license (the \*(L"License\*(R"). You may not use this file except in compliance with the License. You can obtain a copy in the file \s-1LICENSE\s0 in the source distribution or at <https://www.openssl.org/source/license.html>.