• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 #include <stdint.h>
2 #include <unistd.h>
3 
4 /* TODO: not thread-safe nor fork-safe */
5 extern volatile int t_status;
6 
7 #define T_LOC2(l) __FILE__ ":" #l
8 #define T_LOC1(l) T_LOC2(l)
9 #define t_error(...) t_printf(T_LOC1(__LINE__) ": " __VA_ARGS__)
10 
11 int t_printf(const char *s, ...);
12 
13 int t_vmfill(void **, size_t *, int);
14 int t_memfill(void);
15 
16 void t_fdfill(void);
17 
18 void t_randseed(uint64_t s);
19 uint64_t t_randn(uint64_t n);
20 uint64_t t_randint(uint64_t a, uint64_t b);
21 void t_shuffle(uint64_t *p, size_t n);
22 void t_randrange(uint64_t *p, size_t n);
23 int t_choose(uint64_t n, size_t k, uint64_t *p);
24 
25 char *t_pathrel(char *buf, size_t n, char *argv0, char *p);
26 
27 int t_setrlim(int r, long lim);
28 
29 int t_setutf8(void);
30 
31 #ifndef __arm__
32 #define __clock_gettime64 clock_gettime
33 #define __pthread_cond_timedwait_time64 pthread_cond_timedwait
34 #define  __nanosleep_time64 nanosleep
35 #define __fstat_time64 fstat
36 #define __lstat_time64 lstat
37 #define __stat_time64 stat
38 #define __utimensat_time64 utimensat
39 #define __adjtimex_time64 adjtimex
40 #define __clock_adjtime64 clock_adjtime
41 #define __clock_getres_time64 clock_getres
42 #define __clock_nanosleep_time64 clock_nanosleep
43 #define __clock_settime64 clock_settime
44 #define __cnd_timedwait_time64 cnd_timedwait
45 #define __ctime64 ctime
46 #define __ctime64_r ctime_r
47 #define __difftime64 difftime
48 #define __dlsym_time64 dlsym
49 #define __fstatat_time64 fstatat
50 #define __futimens_time64 futimens
51 #define __futimes_time64 futimes
52 #define __futimesat_time64 futimesat
53 #define __getitimer_time64 getitimer
54 #define __getrusage_time64 getrusage
55 #define __gettimeofday_time64 gettimeofday
56 #define __gmtime64 gmtime
57 #define __gmtime64_r gmtime_r
58 #define __localtime64 localtime
59 #define __localtime64_r localtime_r
60 #define __lutimes_time64 lutimes
61 #define __mktime64 mktime
62 #define __mtx_timedlock_time64 mtx_timedlock
63 #define __ppoll_time64 ppoll
64 #define __pselect_time64 pselect
65 #define __pthread_mutex_timedlock_time64 pthread_mutex_timedlock
66 #define __pthread_rwlock_timedrdlock_time64 pthread_rwlock_timedrdlock
67 #define __pthread_rwlock_timedwrlock_time64 pthread_rwlock_timedwrlock
68 #define __recvmmsg_time64 recvmmsg
69 #define __sched_rr_get_interval_time64 sched_rr_get_interval
70 #define __select_time64 select
71 #define __sem_timedwait_time64 sem_timedwait
72 #define __semtimedop_time64 semtimedop
73 #define __setitimer_time64 setitimer
74 #define __settimeofday_time64 settimeofday
75 #define __sigtimedwait_time64 sigtimedwait
76 #define __thrd_sleep_time64 thrd_sleep
77 #define __time64 time
78 #define __timegm_time64 timegm
79 #define __timer_gettime64 timer_gettime
80 #define __timer_settime64 timer_settime
81 #define __timerfd_gettime64 timerfd_gettime
82 #define __timerfd_settime64 timerfd_settime
83 #define __timespec_get_time64 timespec_get
84 #define __utime64 utime
85 #define __utimes_time64 utimes
86 #define __wait4_time64 wait4
87 #endif
88