__error.c (fe920a4f2f80fda4a24c3991de0d593e06ae7f6f) __error.c (1235d276b78a769bded01d51c9bf3cdc480db9fb)
1/*-
2 * SPDX-License-Identifier: BSD-3-Clause
3 *
4 * Copyright (c) 1997 John Birrell <jb@cimlogic.com.au>.
5 * All rights reserved.
6 *
7 * Redistribution and use in source and binary forms, with or without
8 * modification, are permitted provided that the following conditions

--- 17 unchanged lines hidden (view full) ---

26 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
27 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
28 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
29 * SUCH DAMAGE.
30 */
31
32#include "libc_private.h"
33
1/*-
2 * SPDX-License-Identifier: BSD-3-Clause
3 *
4 * Copyright (c) 1997 John Birrell <jb@cimlogic.com.au>.
5 * All rights reserved.
6 *
7 * Redistribution and use in source and binary forms, with or without
8 * modification, are permitted provided that the following conditions

--- 17 unchanged lines hidden (view full) ---

26 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
27 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
28 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
29 * SUCH DAMAGE.
30 */
31
32#include "libc_private.h"
33
34int errno;
34int __libsys_errno;
35#ifdef LIBSYS
36__sym_compat(errno, __libsys_errno, FBSD_1.0);
37#endif
35
36static int *
37__error_unthreaded(void)
38{
38
39static int *
40__error_unthreaded(void)
41{
39
40 return (&errno);
42 return (&__libsys_errno);
41}
42
43static int *(*__error_selector)(void) = __error_unthreaded;
44
45void
46__set_error_selector(int *(*arg)(void))
47{
43}
44
45static int *(*__error_selector)(void) = __error_unthreaded;
46
47void
48__set_error_selector(int *(*arg)(void))
49{
48
49 __error_selector = arg;
50}
51
52int *
53__error(void)
54{
50 __error_selector = arg;
51}
52
53int *
54__error(void)
55{
55
56 return (__error_selector());
57}
56 return (__error_selector());
57}