libc: move __getosreldate to libsys

Reviewed by:	kib, emaste, imp
Pull Request:	https://github.com/freebsd/freebsd-src/pull/908
This commit is contained in:
Brooks Davis 2023-11-17 20:13:40 +00:00
parent f70c5a0925
commit 10f1b536ad
3 changed files with 3 additions and 15 deletions

View File

@ -6,7 +6,7 @@ CONFS+= group master.passwd shells
CONFSMODE_master.passwd= 600
CONFSPACKAGE= runtime
SRCS+= __getosreldate.c \
SRCS+= \
__pthread_mutex_init_calloc_cb_stub.c \
__xuname.c \
_pthread_stubs.c \

View File

@ -32,6 +32,7 @@ PSEUDO+= _clock_gettime.o _gettimeofday.o
# Sources common to both syscall interfaces:
SRCS+= \
__error.c \
__getosreldate.c \
_once_stub.c \
getpagesize.c \
getpagesizes.c \

View File

@ -44,23 +44,10 @@ int
__getosreldate(void)
{
static int osreldate;
size_t len;
int oid[2];
int error, osrel;
if (osreldate != 0)
return (osreldate);
error = _elf_aux_info(AT_OSRELDATE, &osreldate, sizeof(osreldate));
if (error == 0 && osreldate != 0)
return (osreldate);
oid[0] = CTL_KERN;
oid[1] = KERN_OSRELDATE;
osrel = 0;
len = sizeof(osrel);
error = sysctl(oid, 2, &osrel, &len, NULL, 0);
if (error == 0 && osrel > 0 && len == sizeof(osrel))
osreldate = osrel;
(void)_elf_aux_info(AT_OSRELDATE, &osreldate, sizeof(osreldate));
return (osreldate);
}