2011-02-12 05:22:29 +00:00
|
|
|
#ifndef _SYS_RESOURCE_H
|
|
|
|
#define _SYS_RESOURCE_H
|
|
|
|
|
2011-11-11 01:40:06 +00:00
|
|
|
#ifdef __cplusplus
|
|
|
|
extern "C" {
|
|
|
|
#endif
|
|
|
|
|
2012-09-08 03:13:55 +00:00
|
|
|
#include <features.h>
|
|
|
|
|
2011-02-12 05:22:29 +00:00
|
|
|
#define __NEED_id_t
|
|
|
|
#define __NEED_time_t
|
|
|
|
#define __NEED_struct_timeval
|
|
|
|
|
2012-01-21 03:10:47 +00:00
|
|
|
#ifdef _GNU_SOURCE
|
|
|
|
#define __NEED_pid_t
|
|
|
|
#endif
|
|
|
|
|
2011-02-12 05:22:29 +00:00
|
|
|
#include <bits/alltypes.h>
|
|
|
|
|
|
|
|
typedef unsigned long long rlim_t;
|
|
|
|
|
|
|
|
struct rlimit
|
|
|
|
{
|
|
|
|
rlim_t rlim_cur;
|
|
|
|
rlim_t rlim_max;
|
|
|
|
};
|
|
|
|
|
|
|
|
struct rusage
|
|
|
|
{
|
|
|
|
struct timeval ru_utime;
|
|
|
|
struct timeval ru_stime;
|
|
|
|
/* linux extentions, but useful */
|
|
|
|
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;
|
|
|
|
/* room for more... */
|
|
|
|
long __reserved[16];
|
|
|
|
};
|
|
|
|
|
|
|
|
int getrlimit (int, struct rlimit *);
|
|
|
|
int setrlimit (int, const struct rlimit *);
|
|
|
|
int getrusage (int, struct rusage *);
|
|
|
|
|
|
|
|
int getpriority (int, id_t);
|
|
|
|
int setpriority (int, id_t, int);
|
|
|
|
|
2012-01-21 03:10:47 +00:00
|
|
|
#ifdef _GNU_SOURCE
|
|
|
|
int prlimit(pid_t, int, const struct rlimit *, struct rlimit *);
|
2012-09-21 08:05:01 +00:00
|
|
|
#define prlimit64 prlimit
|
2012-01-21 03:10:47 +00:00
|
|
|
#endif
|
|
|
|
|
2011-02-12 05:22:29 +00:00
|
|
|
#define PRIO_PROCESS 0
|
|
|
|
#define PRIO_PGRP 1
|
|
|
|
#define PRIO_USER 2
|
|
|
|
|
|
|
|
#define RUSAGE_SELF 0
|
|
|
|
#define RUSAGE_CHILDREN 1
|
|
|
|
|
|
|
|
#define RLIM_INFINITY (~0ULL)
|
|
|
|
#define RLIM_SAVED_CUR RLIM_INFINITY
|
|
|
|
#define RLIM_SAVED_MAX RLIM_INFINITY
|
|
|
|
|
|
|
|
#define RLIMIT_CPU 0
|
|
|
|
#define RLIMIT_FSIZE 1
|
|
|
|
#define RLIMIT_DATA 2
|
|
|
|
#define RLIMIT_STACK 3
|
|
|
|
#define RLIMIT_CORE 4
|
|
|
|
#define RLIMIT_RSS 5
|
|
|
|
#define RLIMIT_NOFILE 7
|
|
|
|
#define RLIMIT_AS 9
|
|
|
|
#define RLIMIT_NPROC 6
|
|
|
|
#define RLIMIT_MEMLOCK 8
|
|
|
|
#define RLIMIT_LOCKS 10
|
2011-04-12 15:50:14 +00:00
|
|
|
#define RLIMIT_SIGPENDING 11
|
|
|
|
#define RLIMIT_MSGQUEUE 12
|
|
|
|
#define RLIMIT_NICE 13
|
|
|
|
#define RLIMIT_RTPRIO 14
|
|
|
|
#define RLIMIT_NLIMITS 15
|
2011-02-12 05:22:29 +00:00
|
|
|
|
2011-04-13 17:22:19 +00:00
|
|
|
#define RLIM_NLIMITS RLIMIT_NLIMITS
|
2011-02-12 05:22:29 +00:00
|
|
|
|
2012-06-04 12:03:56 +00:00
|
|
|
#if defined(_LARGEFILE64_SOURCE) || defined(_GNU_SOURCE)
|
2012-05-04 04:31:25 +00:00
|
|
|
#define getrlimit64 getrlimit
|
|
|
|
#define setrlimit64 setrlimit
|
|
|
|
#define rlimit64 rlimit
|
|
|
|
#define rlim64_t rlim_t
|
|
|
|
#endif
|
2011-02-12 05:22:29 +00:00
|
|
|
|
2011-11-11 01:40:06 +00:00
|
|
|
#ifdef __cplusplus
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
2011-02-12 05:22:29 +00:00
|
|
|
#endif
|