Skip to content

Instantly share code, notes, and snippets.

@faern
Created March 17, 2015 20:09
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save faern/3e4c1e7dff7977a83a85 to your computer and use it in GitHub Desktop.
Save faern/3e4c1e7dff7977a83a85 to your computer and use it in GitHub Desktop.
RLIMIT_* constants on OS X 10.10.2
/*
* Possible values of the first parameter to getrlimit()/setrlimit(), to
* indicate for which resource the operation is being performed.
*/
#define RLIMIT_CPU 0 /* cpu time per process */
#define RLIMIT_FSIZE 1 /* file size */
#define RLIMIT_DATA 2 /* data segment size */
#define RLIMIT_STACK 3 /* stack size */
#define RLIMIT_CORE 4 /* core file size */
#define RLIMIT_AS 5 /* address space (resident set size) */
#if __DARWIN_C_LEVEL >= __DARWIN_C_FULL
#define RLIMIT_RSS RLIMIT_AS /* source compatibility alias */
#define RLIMIT_MEMLOCK 6 /* locked-in-memory address space */
#define RLIMIT_NPROC 7 /* number of processes */
#endif /* __DARWIN_C_LEVEL >= __DARWIN_C_FULL */
#define RLIMIT_NOFILE 8 /* number of open files */
#if __DARWIN_C_LEVEL >= __DARWIN_C_FULL
#define RLIM_NLIMITS 9 /* total number of resource limits */
#endif /* __DARWIN_C_LEVEL >= __DARWIN_C_FULL */
#define _RLIMIT_POSIX_FLAG 0x1000 /* Set bit for strict POSIX */
/*
* A structure representing a resource limit. The address of an instance
* of this structure is the second parameter to getrlimit()/setrlimit().
*/
struct rlimit {
rlim_t rlim_cur; /* current (soft) limit */
rlim_t rlim_max; /* maximum value for rlim_cur */
};
#if __DARWIN_C_LEVEL >= __DARWIN_C_FULL
/*
* proc_rlimit_control()
*
* Resource limit flavors
*/
#define RLIMIT_WAKEUPS_MONITOR 0x1 /* Configure the wakeups monitor. */
#define RLIMIT_CPU_USAGE_MONITOR 0x2 /* Configure the CPU usage monitor. */
#define RLIMIT_THREAD_CPULIMITS 0x3 /* Configure a blocking, per-thread, CPU limits. */
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment