mirror of
https://github.com/torvalds/linux.git
synced 2026-01-25 07:47:50 +00:00
tools/nolibc: move getauxval() to sys/auxv.h
This is the location regular userspace expects the definition. Signed-off-by: Thomas Weißschuh <thomas.weissschuh@linutronix.de> Acked-by: Willy Tarreau <w@1wt.eu> Link: https://lore.kernel.org/r/20250416-nolibc-split-sys-v1-4-a069a3f1d145@linutronix.de Signed-off-by: Thomas Weißschuh <linux@weissschuh.net>
This commit is contained in:
committed by
Thomas Weißschuh
parent
ecc091d93a
commit
9e67941dde
@@ -44,6 +44,7 @@ all_files := \
|
||||
stdlib.h \
|
||||
string.h \
|
||||
sys.h \
|
||||
sys/auxv.h \
|
||||
time.h \
|
||||
types.h \
|
||||
unistd.h \
|
||||
|
||||
@@ -96,6 +96,7 @@
|
||||
#include "arch.h"
|
||||
#include "types.h"
|
||||
#include "sys.h"
|
||||
#include "sys/auxv.h"
|
||||
#include "ctype.h"
|
||||
#include "elf.h"
|
||||
#include "signal.h"
|
||||
|
||||
@@ -102,32 +102,6 @@ char *getenv(const char *name)
|
||||
return NULL;
|
||||
}
|
||||
|
||||
static __attribute__((unused))
|
||||
unsigned long getauxval(unsigned long type)
|
||||
{
|
||||
const unsigned long *auxv = _auxv;
|
||||
unsigned long ret;
|
||||
|
||||
if (!auxv)
|
||||
return 0;
|
||||
|
||||
while (1) {
|
||||
if (!auxv[0] && !auxv[1]) {
|
||||
ret = 0;
|
||||
break;
|
||||
}
|
||||
|
||||
if (auxv[0] == type) {
|
||||
ret = auxv[1];
|
||||
break;
|
||||
}
|
||||
|
||||
auxv += 2;
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
static __attribute__((unused))
|
||||
void *malloc(size_t len)
|
||||
{
|
||||
|
||||
41
tools/include/nolibc/sys/auxv.h
Normal file
41
tools/include/nolibc/sys/auxv.h
Normal file
@@ -0,0 +1,41 @@
|
||||
/* SPDX-License-Identifier: LGPL-2.1 OR MIT */
|
||||
/*
|
||||
* auxv definitions for NOLIBC
|
||||
* Copyright (C) 2017-2021 Willy Tarreau <w@1wt.eu>
|
||||
*/
|
||||
|
||||
#ifndef _NOLIBC_SYS_AUXV_H
|
||||
#define _NOLIBC_SYS_AUXV_H
|
||||
|
||||
#include "../crt.h"
|
||||
|
||||
static __attribute__((unused))
|
||||
unsigned long getauxval(unsigned long type)
|
||||
{
|
||||
const unsigned long *auxv = _auxv;
|
||||
unsigned long ret;
|
||||
|
||||
if (!auxv)
|
||||
return 0;
|
||||
|
||||
while (1) {
|
||||
if (!auxv[0] && !auxv[1]) {
|
||||
ret = 0;
|
||||
break;
|
||||
}
|
||||
|
||||
if (auxv[0] == type) {
|
||||
ret = auxv[1];
|
||||
break;
|
||||
}
|
||||
|
||||
auxv += 2;
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
/* make sure to include all global symbols */
|
||||
#include "../nolibc.h"
|
||||
|
||||
#endif /* _NOLIBC_SYS_AUXV_H */
|
||||
Reference in New Issue
Block a user