#include #include #include #include #include #include int getrlimit(int resource, struct rlimit* rlp) { switch (resource) { case RLIMIT_CORE: rlp->rlim_cur = 0; rlp->rlim_max = 0; return 0; case RLIMIT_CPU: rlp->rlim_cur = BAN::numeric_limits::max(); rlp->rlim_max = BAN::numeric_limits::max(); return 0; case RLIMIT_DATA: rlp->rlim_cur = BAN::numeric_limits::max(); rlp->rlim_max = BAN::numeric_limits::max(); return 0; case RLIMIT_FSIZE: rlp->rlim_cur = BAN::numeric_limits::max(); rlp->rlim_max = BAN::numeric_limits::max(); return 0; case RLIMIT_NOFILE: rlp->rlim_cur = OPEN_MAX; rlp->rlim_max = OPEN_MAX; return 0; case RLIMIT_STACK: rlp->rlim_cur = Kernel::Thread::userspace_stack_size; rlp->rlim_max = Kernel::Thread::userspace_stack_size; return 0; case RLIMIT_AS: rlp->rlim_cur = BAN::numeric_limits::max(); rlp->rlim_max = BAN::numeric_limits::max(); return 0; } errno = EINVAL; return -1; } int getrusage(int who, struct rusage* r_usage) { if (who != RUSAGE_CHILDREN && who != RUSAGE_SELF) { errno = EINVAL; return -1; } r_usage->ru_stime.tv_sec = 0; r_usage->ru_stime.tv_usec = 0; r_usage->ru_utime.tv_sec = 0; r_usage->ru_utime.tv_usec = 0; return 0; }