| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139 |
- .\" -*- mode: troff; coding: utf-8 -*-
- .\" Automatically generated by Pod::Man 5.01 (Pod::Simple 3.43)
- .\"
- .\" Standard preamble:
- .\" ========================================================================
- .de Sp \" Vertical space (when we can't use .PP)
- .if t .sp .5v
- .if n .sp
- ..
- .de Vb \" Begin verbatim text
- .ft CW
- .nf
- .ne \\$1
- ..
- .de Ve \" End verbatim text
- .ft R
- .fi
- ..
- .\" \*(C` and \*(C' are quotes in nroff, nothing in troff, for use with C<>.
- .ie n \{\
- . ds C` ""
- . ds C' ""
- 'br\}
- .el\{\
- . ds C`
- . ds C'
- 'br\}
- .\"
- .\" Escape single quotes in literal strings from groff's Unicode transform.
- .ie \n(.g .ds Aq \(aq
- .el .ds Aq '
- .\"
- .\" 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'.
- .de IX
- ..
- .nr rF 0
- .if \n(.g .if rF .nr rF 1
- .if (\n(rF:(\n(.g==0)) \{\
- . if \nF \{\
- . de IX
- . tm Index:\\$1\t\\n%\t"\\$2"
- ..
- . if !\nF==2 \{\
- . nr % 0
- . nr F 2
- . \}
- . \}
- .\}
- .rr rF
- .\" ========================================================================
- .\"
- .IX Title "OSSL_ERR_STATE_SAVE 3ossl"
- .TH OSSL_ERR_STATE_SAVE 3ossl 2025-01-17 3.4.0 OpenSSL
- .\" For nroff, turn off justification. Always turn off hyphenation; it makes
- .\" way too many mistakes in technical documents.
- .if n .ad l
- .nh
- .SH NAME
- OSSL_ERR_STATE_new, OSSL_ERR_STATE_save, OSSL_ERR_STATE_save_to_mark,
- OSSL_ERR_STATE_restore, OSSL_ERR_STATE_free \- saving and restoring error state
- .SH SYNOPSIS
- .IX Header "SYNOPSIS"
- .Vb 1
- \& #include <openssl/err.h>
- \&
- \& ERR_STATE *OSSL_ERR_STATE_new(void);
- \& void OSSL_ERR_STATE_save(ERR_STATE *es);
- \& void OSSL_ERR_STATE_save_to_mark(ERR_STATE *es);
- \& void OSSL_ERR_STATE_restore(const ERR_STATE *es);
- \& void OSSL_ERR_STATE_free(ERR_STATE *es);
- .Ve
- .SH DESCRIPTION
- .IX Header "DESCRIPTION"
- These functions save and restore the error state from the thread
- local error state to a preallocated error state structure.
- .PP
- \&\fBOSSL_ERR_STATE_new()\fR allocates an empty error state structure to
- be used when saving and restoring thread error state.
- .PP
- \&\fBOSSL_ERR_STATE_save()\fR saves the thread error state to \fIes\fR. It
- subsequently clears the thread error state. Any previously saved
- state in \fIes\fR is cleared prior to saving the new state.
- .PP
- \&\fBOSSL_ERR_STATE_save_to_mark()\fR is similar to \fBOSSL_ERR_STATE_save()\fR but only saves
- ERR entries up to the most recent mark on the ERR stack. These entries are moved
- to \fIes\fR and removed from the thread error state. However, the most recent
- marked ERR and any ERR state before it remains part of the thread error state
- and is not moved to the ERR_STATE. The mark is not cleared and must be cleared
- explicitly after a call to this function using \fBERR_pop_to_mark\fR\|(3) or
- \&\fBERR_clear_last_mark\fR\|(3). (Since a call to \fBOSSL_ERR_STATE_save_to_mark()\fR leaves
- the marked ERR as the top error, either of these functions will have the same
- effect.) If there is no marked ERR in the thread local error state, all ERR
- entries are copied and the effect is the same as for a call to
- \&\fBOSSL_ERR_STATE_save()\fR.
- .PP
- \&\fBOSSL_ERR_STATE_restore()\fR adds all the error entries from the
- saved state \fIes\fR to the thread error state. Existing entries in
- the thread error state are not affected if there is enough space
- for all the added entries. Any allocated data in the saved error
- entries is duplicated on adding to the thread state.
- .PP
- \&\fBOSSL_ERR_STATE_free()\fR frees the saved error state \fIes\fR.
- If the argument is NULL, nothing is done.
- .SH "RETURN VALUES"
- .IX Header "RETURN VALUES"
- \&\fBOSSL_ERR_STATE_new()\fR returns a pointer to the allocated ERR_STATE
- structure or NULL on error.
- .PP
- \&\fBOSSL_ERR_STATE_save()\fR, \fBOSSL_ERR_STATE_save_to_mark()\fR, \fBOSSL_ERR_STATE_restore()\fR,
- \&\fBOSSL_ERR_STATE_free()\fR do not return any values.
- .SH NOTES
- .IX Header "NOTES"
- \&\fBOSSL_ERR_STATE_save()\fR and \fBOSSL_ERR_STATE_save_to_mark()\fR cannot fail as it takes
- over any allocated data from the thread error state.
- .PP
- \&\fBOSSL_ERR_STATE_restore()\fR is a best effort function. The only failure
- that can happen during its operation is when memory allocation fails.
- Because it manipulates the thread error state it avoids raising memory
- errors on such failure. At worst the restored error entries will be
- missing the auxiliary error data.
- .SH "SEE ALSO"
- .IX Header "SEE ALSO"
- \&\fBERR_raise\fR\|(3), \fBERR_get_error\fR\|(3), \fBERR_clear_error\fR\|(3)
- .SH HISTORY
- .IX Header "HISTORY"
- All of these functions were added in OpenSSL 3.2.
- .SH COPYRIGHT
- .IX Header "COPYRIGHT"
- Copyright 2023\-2024 The OpenSSL Project Authors. All Rights Reserved.
- .PP
- Licensed under the Apache License 2.0 (the "License"). You may not use
- this file except in compliance with the License. You can obtain a copy
- in the file LICENSE in the source distribution or at
- <https://www.openssl.org/source/license.html>.
|