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