1 #pragma once
2 
3 #include <sys/types.h>
4 #include <sys/stat.h>
5 #include <sys/mman.h>
6 #include <fcntl.h>
7 #include <errno.h>
8 #include <unistd.h>
9 
10 static inline void
_dl_exit(int status)11 _dl_exit(int status) { exit(status); }
12 
13 static inline int
_dl_mprotect(void * addr,size_t len,int prot)14 _dl_mprotect(void *addr, size_t len, int prot)
15 { (void)addr; (void)len; (void)prot; return -1; } //mprotect(addr, len, prot); }
16 
17 static inline int
_dl_stat(const char * path,struct stat * buf)18 _dl_stat(const char *path, struct stat * buf)
19 { return stat(path, buf); }
20 
21 static inline int
_dl_fstat(int fd,struct stat * buf)22 _dl_fstat(int fd, struct stat *buf)
23 { return fstat(fd, buf); }
24 
25 static inline int
_dl_getuid(void)26 _dl_getuid(void)
27 { return 0; }
28 
29  static inline int
_dl_geteuid(void)30 _dl_geteuid(void)
31 { return 0; }
32 
33 static inline int
_dl_getgid(void)34 _dl_getgid(void)
35 { return 0; }
36 
37 static inline int
_dl_getegid(void)38 _dl_getegid(void)
39 { return 0; }
40 
41 
42 
43 static inline int
_dl_munmap(void * start,size_t len)44 _dl_munmap(void *start, size_t len)
45 { return munmap(start, len); }
46 
47 static inline int
_dl_mmap_check_error(void * x)48 _dl_mmap_check_error(void *x)
49 { return x == MAP_FAILED; }
50 
51 extern int open (const char *__file, int __oflag, ...) __nonnull ((1));
52 
53 static inline int
_dl_open(char const * path,int flags,int mode)54 _dl_open(char const *path, int flags, int mode)
55 { return open(path, flags, mode); }
56 
57 static inline int
_dl_close(int fd)58 _dl_close(int fd)
59 { return close(fd); }
60 
61 static inline int
_dl_read(int fd,void * buf,size_t len)62 _dl_read(int fd, void *buf, size_t len)
63 { return read(fd, buf, len); }
64 
65 static inline int
_dl_write(int fd,char const * str,size_t len)66 _dl_write(int fd, char const *str, size_t len)
67 { (void)fd; (void)str; (void)len; return -1; }
68 
69 static inline int
_dl_getpid(void)70 _dl_getpid(void)
71 { return 10; }
72 
73 static inline int
_dl_cap_equal(unsigned long a,unsigned long b)74 _dl_cap_equal(unsigned long a, unsigned long b)
75 {
76   (void)a;
77   (void)b;
78   return 0;
79 }
80 
81 
82 static inline void *
_dl_mmap(void * start,size_t len,int prot,int flags,int fd,off_t offset)83 _dl_mmap(void *start, size_t len, int prot, int flags, int fd, off_t offset)
84 { return mmap(start, len, prot, flags, fd, offset); }
85 #ifdef SHARED
86 #define _dl_errno errno
87 #else
88 extern int _dl_errno;
89 #endif
90