64 lines
1.3 KiB
C
64 lines
1.3 KiB
C
/*
|
|
* <sys/resource.h> stub for the MontaukOS git port.
|
|
*
|
|
* Reached only through git-compat-util.h's unconditional include and
|
|
* trace2's resource accounting, which is compiled out without getrusage.
|
|
* MontaukOS keeps no per-process resource accounting, so getrlimit reports
|
|
* "unlimited" and everything else fails.
|
|
*/
|
|
#ifndef _MONTAUK_GIT_SYS_RESOURCE_H_
|
|
#define _MONTAUK_GIT_SYS_RESOURCE_H_
|
|
|
|
#include <sys/time.h>
|
|
#include <errno.h>
|
|
|
|
#define RLIMIT_NOFILE 7
|
|
|
|
typedef unsigned long rlim_t;
|
|
|
|
#define RLIM_INFINITY (~(rlim_t)0)
|
|
|
|
struct rlimit {
|
|
rlim_t rlim_cur;
|
|
rlim_t rlim_max;
|
|
};
|
|
|
|
struct rusage {
|
|
struct timeval ru_utime;
|
|
struct timeval ru_stime;
|
|
long ru_maxrss;
|
|
long ru_minflt;
|
|
long ru_majflt;
|
|
long ru_inblock;
|
|
long ru_oublock;
|
|
long ru_nvcsw;
|
|
long ru_nivcsw;
|
|
};
|
|
|
|
#define RUSAGE_SELF 0
|
|
|
|
static inline int getrlimit(int resource, struct rlimit *rlim)
|
|
{
|
|
(void) resource;
|
|
if (rlim) {
|
|
rlim->rlim_cur = RLIM_INFINITY;
|
|
rlim->rlim_max = RLIM_INFINITY;
|
|
}
|
|
return 0;
|
|
}
|
|
|
|
static inline int setrlimit(int resource, const struct rlimit *rlim)
|
|
{
|
|
(void) resource; (void) rlim;
|
|
return 0;
|
|
}
|
|
|
|
static inline int getrusage(int who, struct rusage *usage)
|
|
{
|
|
(void) who; (void) usage;
|
|
errno = ENOSYS;
|
|
return -1;
|
|
}
|
|
|
|
#endif /* _MONTAUK_GIT_SYS_RESOURCE_H_ */
|