#pragma once
#if !defined(_WIN32)
#include <sys/resource.h>
#else
#include <cstdint>
#include <folly/portability/SysTime.h>
#define PRIO_PROCESS …
#define RLIMIT_CORE …
#define RLIMIT_NOFILE …
#define RLIMIT_DATA …
#define RLIMIT_STACK …
#define RLIM_INFINITY …
#define RUSAGE_SELF …
#define RUSAGE_CHILDREN …
#define RUSAGE_THREAD …
using rlim_t = size_t;
struct rlimit {
rlim_t rlim_cur;
rlim_t rlim_max;
};
struct rusage {
timeval ru_utime;
timeval ru_stime;
long ru_maxrss;
long ru_ixrss;
long ru_idrss;
long ru_isrss;
long ru_minflt;
long ru_majflt;
long ru_nswap;
long ru_inblock;
long ru_oublock;
long ru_msgsnd;
long ru_msgrcv;
long ru_nsignals;
long ru_nvcsw;
long ru_nivcsw;
};
extern "C" {
int getrlimit(int type, rlimit* dst);
int getrusage(int who, rusage* usage);
int setrlimit(int type, rlimit* src);
int getpriority(int which, int who);
int setpriority(int which, int who, int value);
}
#endif