lib/libc: remove builtin sysctl release information

Fixes #2003
This commit is contained in:
Emery Hemingway 2016-06-09 16:06:41 +02:00 committed by Christian Helmuth
parent b80939cc0a
commit ca4f956f21
3 changed files with 2 additions and 58 deletions

View File

@ -33,11 +33,6 @@ SRC_C += strcoll.c strxfrm.c wcscoll.c wcsxfrm.c
include $(REP_DIR)/lib/mk/libc-common.inc
#
# Version information for sysctl
#
include $(REP_DIR)/src/lib/libc/version.inc
vpath % $(REP_DIR)/src/lib/libc
vpath % $(LIBC_DIR)/lib/libc/string

View File

@ -222,18 +222,9 @@ extern "C" int __sysctl(int *name, u_int namelen, void *oldp, size_t *oldlenp,
return 0;
case KERN_OSRELEASE:
Genode::strncpy(buf, GENODE_OSRELEASE, *oldlenp);
*oldlenp = Genode::strlen(buf);
return 0;
case KERN_OSREV:
*(int*)oldp = int(GENODE_OSREV);
*oldlenp = sizeof(int);
return 0;
case KERN_VERSION:
Genode::strncpy(buf, GENODE_VERSION, *oldlenp);
*oldlenp = Genode::strlen(buf);
*oldlenp = 0;
return 0;
case KERN_HOSTNAME:
@ -246,8 +237,7 @@ extern "C" int __sysctl(int *name, u_int namelen, void *oldp, size_t *oldlenp,
case CTL_HW: switch(index_b) {
case HW_MACHINE:
Genode::strncpy(buf, GENODE_MACHINE, *oldlenp);
*oldlenp = Genode::strlen(buf);
*oldlenp = 0;
return 0;
case HW_NCPU:

View File

@ -1,41 +0,0 @@
#
# Provide version information to sysctl
#
GENODE_ROOT_DIR = $(REP_DIR)/../..
GENODE_OSRELEASE := $(shell cat $(GENODE_ROOT_DIR)/VERSION)
GENODE_OSREV := $(shell which git > /dev/null && git rev-list --count HEAD)
GENODE_VERSION := $(shell \
which git > /dev/null \
&& git -C $(GENODE_ROOT_DIR) describe 2> /dev/null \
&& exit 0 \
|| \
test -r $(GENODE_ROOT_DIR)/VERSION \
&& cat $(GENODE_ROOT_DIR)/VERSION \
&& exit 0 \
|| \
echo "<unknown version>")
CC_OPT += -DGENODE_OSRELEASE="\"$(GENODE_OSRELEASE)\""
CC_OPT += -DGENODE_OSREV="$(GENODE_OSREV)"
CC_OPT += -DGENODE_VERSION="\"$(GENODE_VERSION)\""
ifeq ($(findstring arm, $(SPECS)), arm)
CC_OPT += -DGENODE_MACHINE="\"arm\""
else
ifeq ($(findstring riscv, $(SPECS)), riscv)
CC_OPT += -DGENODE_MACHINE="\"riscv\""
else
ifeq ($(findstring x86_32, $(SPECS)), x86_32)
CC_OPT += -DGENODE_MACHINE="\"i686\""
else
ifeq ($(findstring x86_64, $(SPECS)), x86_64)
CC_OPT += -DGENODE_MACHINE="\"x86_64\""
else
CC_OPT += -DGENODE_MACHINE="\"unknown\""
endif
endif
endif
endif