1// SPDX-FileCopyrightText: 2023 UnionTech Software Technology Co., Ltd.
2//
3// SPDX-License-Identifier: GPL-3.0-or-later
4
5#include <unistd.h>
6#include <stdio.h>
7#include <stdlib.h>
8#include <dlfcn.h>
9#include <memory.h>
10//#include <sys/time.h>
11#include <sys/syscall.h>
12
13/* build:
14gcc -g -O0 -o libvdsopreload.so vdsopreload.c -fPIC -shared -D_GNU_SOURCE -ldl
15
16 usage:
17 LD_PRELOAD=libdbuspreload.so dbus-send
18*/
19
20int clock_gettime(clockid_t clk_id, struct timespec *tp)
21{
22 return syscall(SYS_clock_gettime, clk_id, tp);
23}
24
25#if defined(__x86_64__)
26time_t time(time_t *tloc)
27{
28 return syscall(SYS_time, tloc);
29}
30#endif
31
32#if 0
33int getcpu(unsigned *cpu, unsigned *node, struct getcpu_cache *tcache)
34{
35 return syscall(SYS_getcpu, cpu, node, tcache);
36}
37#endif
38
39static void __attribute__((constructor)) init_process(void) {
40}
41