1 #include <sys/resource.h> 2 #include <errno.h> 3 #include "syscall.h" 4 5 #define FIX(x) do{ if ((x)>=SYSCALL_RLIM_INFINITY) (x)=RLIM_INFINITY; }while(0) 6 getrlimit(int resource,struct rlimit * rlim)7int getrlimit(int resource, struct rlimit *rlim) 8 { 9 unsigned long long k_rlim[2]; 10 11 if (syscall(SYS_getrlimit, resource, k_rlim) < 0) 12 return -1; 13 14 rlim->rlim_cur = k_rlim[0]; 15 rlim->rlim_max = k_rlim[1]; 16 17 return 0; 18 } 19 20 weak_alias(getrlimit, getrlimit64); 21