1 #ifndef __BIONIC_COMPAT_H 2 #define __BIONIC_COMPAT_H 3 4 /* These functions and definitions aren't candidates for adding to bionic: 5 * they've either been removed from POSIX or are glibc extensions. 6 */ 7 8 #define _GNU_SOURCE 9 #include <limits.h> 10 #include <stddef.h> 11 #include <stdlib.h> 12 #include <string.h> 13 #include <sys/resource.h> 14 #include <sys/sysmacros.h> 15 #include <sys/time.h> 16 #include <sys/types.h> 17 #include <sys/utsname.h> 18 #include <unistd.h> 19 20 /* Bionic doesn't support extended patterns and 21 * as of LTP20180515, this only used by read_all.c 22 * which is run from runtest/fs. 23 * 24 * LTP does not pass the argument that will end up 25 * going down the extended pattern match call, so 26 * we are safe here. This is for *build* purposes only 27 * and we don't alter behavior 28 */ 29 #define FNM_EXTMATCH 0 30 31 typedef unsigned long ulong; 32 valloc(size_t size)33static inline void *valloc(size_t size) 34 { 35 return memalign(sysconf(_SC_PAGESIZE), size); 36 } 37 get_current_dir_name(void)38static inline char *get_current_dir_name(void) 39 { 40 return getcwd(NULL, 0); 41 } 42 getdtablesize(void)43static inline int getdtablesize(void) 44 { 45 struct rlimit lim; 46 int err = getrlimit(RLIMIT_NOFILE, &lim); 47 if (err < 0) 48 return err; 49 50 return lim.rlim_cur; 51 } 52 pthread_testcancel(void)53static inline void pthread_testcancel(void) { } pthread_cancel(pthread_t thread)54static inline int pthread_cancel(pthread_t thread) { return 0; } 55 56 #endif /* __BIONIC_COMPAT_H */ 57