1*10f1b536SBrooks Davis /*-
2*10f1b536SBrooks Davis * SPDX-License-Identifier: BSD-2-Clause
3*10f1b536SBrooks Davis *
4*10f1b536SBrooks Davis * Copyright (c) 2007 Peter Wemm
5*10f1b536SBrooks Davis *
6*10f1b536SBrooks Davis * Redistribution and use in source and binary forms, with or without
7*10f1b536SBrooks Davis * modification, are permitted provided that the following conditions
8*10f1b536SBrooks Davis * are met:
9*10f1b536SBrooks Davis * 1. Redistributions of source code must retain the above copyright
10*10f1b536SBrooks Davis * notice, this list of conditions and the following disclaimer.
11*10f1b536SBrooks Davis * 2. Redistributions in binary form must reproduce the above copyright
12*10f1b536SBrooks Davis * notice, this list of conditions and the following disclaimer in the
13*10f1b536SBrooks Davis * documentation and/or other materials provided with the distribution.
14*10f1b536SBrooks Davis *
15*10f1b536SBrooks Davis * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
16*10f1b536SBrooks Davis * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
17*10f1b536SBrooks Davis * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
18*10f1b536SBrooks Davis * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
19*10f1b536SBrooks Davis * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
20*10f1b536SBrooks Davis * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
21*10f1b536SBrooks Davis * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
22*10f1b536SBrooks Davis * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
23*10f1b536SBrooks Davis * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
24*10f1b536SBrooks Davis * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
25*10f1b536SBrooks Davis * SUCH DAMAGE.
26*10f1b536SBrooks Davis */
27*10f1b536SBrooks Davis
28*10f1b536SBrooks Davis #include <sys/param.h>
29*10f1b536SBrooks Davis #include <sys/sysctl.h>
30*10f1b536SBrooks Davis #include <errno.h>
31*10f1b536SBrooks Davis #include <link.h>
32*10f1b536SBrooks Davis #include "libc_private.h"
33*10f1b536SBrooks Davis
34*10f1b536SBrooks Davis /*
35*10f1b536SBrooks Davis * This is private to libc. It is intended for wrapping syscall stubs in order
36*10f1b536SBrooks Davis * to avoid having to put SIGSYS signal handlers in place to test for presence
37*10f1b536SBrooks Davis * of new syscalls. This caches the result in order to be as quick as possible.
38*10f1b536SBrooks Davis *
39*10f1b536SBrooks Davis * Use getosreldate(3) for public use as it respects the $OSVERSION environment
40*10f1b536SBrooks Davis * variable.
41*10f1b536SBrooks Davis */
42*10f1b536SBrooks Davis
43*10f1b536SBrooks Davis int
__getosreldate(void)44*10f1b536SBrooks Davis __getosreldate(void)
45*10f1b536SBrooks Davis {
46*10f1b536SBrooks Davis static int osreldate;
47*10f1b536SBrooks Davis
48*10f1b536SBrooks Davis if (osreldate != 0)
49*10f1b536SBrooks Davis return (osreldate);
50*10f1b536SBrooks Davis
51*10f1b536SBrooks Davis (void)_elf_aux_info(AT_OSRELDATE, &osreldate, sizeof(osreldate));
52*10f1b536SBrooks Davis return (osreldate);
53*10f1b536SBrooks Davis }
54