mirror of
git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2025-09-18 22:14:16 +00:00
tools/nolibc: move gettimeofday() to sys/time.h
This is the location regular userspace expects this 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-8-a069a3f1d145@linutronix.de Signed-off-by: Thomas Weißschuh <linux@weissschuh.net>
This commit is contained in:
parent
0fd55773f4
commit
face777a44
4 changed files with 38 additions and 21 deletions
|
@ -48,6 +48,7 @@ all_files := \
|
|||
sys/mman.h \
|
||||
sys/stat.h \
|
||||
sys/syscall.h \
|
||||
sys/time.h \
|
||||
time.h \
|
||||
types.h \
|
||||
unistd.h \
|
||||
|
|
|
@ -100,6 +100,7 @@
|
|||
#include "sys/mman.h"
|
||||
#include "sys/stat.h"
|
||||
#include "sys/syscall.h"
|
||||
#include "sys/time.h"
|
||||
#include "ctype.h"
|
||||
#include "elf.h"
|
||||
#include "signal.h"
|
||||
|
|
|
@ -487,27 +487,6 @@ int getpagesize(void)
|
|||
}
|
||||
|
||||
|
||||
/*
|
||||
* int gettimeofday(struct timeval *tv, struct timezone *tz);
|
||||
*/
|
||||
|
||||
static __attribute__((unused))
|
||||
int sys_gettimeofday(struct timeval *tv, struct timezone *tz)
|
||||
{
|
||||
#ifdef __NR_gettimeofday
|
||||
return my_syscall2(__NR_gettimeofday, tv, tz);
|
||||
#else
|
||||
return __nolibc_enosys(__func__, tv, tz);
|
||||
#endif
|
||||
}
|
||||
|
||||
static __attribute__((unused))
|
||||
int gettimeofday(struct timeval *tv, struct timezone *tz)
|
||||
{
|
||||
return __sysret(sys_gettimeofday(tv, tz));
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* uid_t getuid(void);
|
||||
*/
|
||||
|
|
36
tools/include/nolibc/sys/time.h
Normal file
36
tools/include/nolibc/sys/time.h
Normal file
|
@ -0,0 +1,36 @@
|
|||
/* SPDX-License-Identifier: LGPL-2.1 OR MIT */
|
||||
/*
|
||||
* time definitions for NOLIBC
|
||||
* Copyright (C) 2017-2021 Willy Tarreau <w@1wt.eu>
|
||||
*/
|
||||
|
||||
#ifndef _NOLIBC_SYS_TIME_H
|
||||
#define _NOLIBC_SYS_TIME_H
|
||||
|
||||
#include "../arch.h"
|
||||
#include "../sys.h"
|
||||
|
||||
/*
|
||||
* int gettimeofday(struct timeval *tv, struct timezone *tz);
|
||||
*/
|
||||
|
||||
static __attribute__((unused))
|
||||
int sys_gettimeofday(struct timeval *tv, struct timezone *tz)
|
||||
{
|
||||
#ifdef __NR_gettimeofday
|
||||
return my_syscall2(__NR_gettimeofday, tv, tz);
|
||||
#else
|
||||
return __nolibc_enosys(__func__, tv, tz);
|
||||
#endif
|
||||
}
|
||||
|
||||
static __attribute__((unused))
|
||||
int gettimeofday(struct timeval *tv, struct timezone *tz)
|
||||
{
|
||||
return __sysret(sys_gettimeofday(tv, tz));
|
||||
}
|
||||
|
||||
/* make sure to include all global symbols */
|
||||
#include "../nolibc.h"
|
||||
|
||||
#endif /* _NOLIBC_SYS_TIME_H */
|
Loading…
Add table
Reference in a new issue