| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1 | #ifndef _LINUX_RESOURCE_H | 
 | 2 | #define _LINUX_RESOURCE_H | 
 | 3 |  | 
 | 4 | #include <linux/time.h> | 
 | 5 |  | 
 | 6 | /* | 
 | 7 |  * Resource control/accounting header file for linux | 
 | 8 |  */ | 
 | 9 |  | 
 | 10 | /* | 
 | 11 |  * Definition of struct rusage taken from BSD 4.3 Reno | 
 | 12 |  *  | 
 | 13 |  * We don't support all of these yet, but we might as well have them.... | 
 | 14 |  * Otherwise, each time we add new items, programs which depend on this | 
 | 15 |  * structure will lose.  This reduces the chances of that happening. | 
 | 16 |  */ | 
 | 17 | #define	RUSAGE_SELF	0 | 
 | 18 | #define	RUSAGE_CHILDREN	(-1) | 
 | 19 | #define RUSAGE_BOTH	(-2)		/* sys_wait4() uses this */ | 
| Sripathi Kodi | 679c9cd | 2008-04-29 00:58:42 -0700 | [diff] [blame] | 20 | #define	RUSAGE_THREAD	1		/* only the calling thread */ | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 21 |  | 
 | 22 | struct	rusage { | 
 | 23 | 	struct timeval ru_utime;	/* user time used */ | 
 | 24 | 	struct timeval ru_stime;	/* system time used */ | 
 | 25 | 	long	ru_maxrss;		/* maximum resident set size */ | 
 | 26 | 	long	ru_ixrss;		/* integral shared memory size */ | 
 | 27 | 	long	ru_idrss;		/* integral unshared data size */ | 
 | 28 | 	long	ru_isrss;		/* integral unshared stack size */ | 
 | 29 | 	long	ru_minflt;		/* page reclaims */ | 
 | 30 | 	long	ru_majflt;		/* page faults */ | 
 | 31 | 	long	ru_nswap;		/* swaps */ | 
 | 32 | 	long	ru_inblock;		/* block input operations */ | 
 | 33 | 	long	ru_oublock;		/* block output operations */ | 
 | 34 | 	long	ru_msgsnd;		/* messages sent */ | 
 | 35 | 	long	ru_msgrcv;		/* messages received */ | 
 | 36 | 	long	ru_nsignals;		/* signals received */ | 
 | 37 | 	long	ru_nvcsw;		/* voluntary context switches */ | 
 | 38 | 	long	ru_nivcsw;		/* involuntary " */ | 
 | 39 | }; | 
 | 40 |  | 
 | 41 | struct rlimit { | 
 | 42 | 	unsigned long	rlim_cur; | 
 | 43 | 	unsigned long	rlim_max; | 
 | 44 | }; | 
 | 45 |  | 
| Jiri Slaby | 6a1d5e2 | 2010-03-24 17:06:58 +0100 | [diff] [blame] | 46 | #define RLIM64_INFINITY		(~0ULL) | 
 | 47 |  | 
 | 48 | struct rlimit64 { | 
 | 49 | 	__u64 rlim_cur; | 
 | 50 | 	__u64 rlim_max; | 
 | 51 | }; | 
 | 52 |  | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 53 | #define	PRIO_MIN	(-20) | 
 | 54 | #define	PRIO_MAX	20 | 
 | 55 |  | 
 | 56 | #define	PRIO_PROCESS	0 | 
 | 57 | #define	PRIO_PGRP	1 | 
 | 58 | #define	PRIO_USER	2 | 
 | 59 |  | 
 | 60 | /* | 
 | 61 |  * Limit the stack by to some sane default: root can always | 
 | 62 |  * increase this limit if needed..  8MB seems reasonable. | 
 | 63 |  */ | 
 | 64 | #define _STK_LIM	(8*1024*1024) | 
 | 65 |  | 
 | 66 | /* | 
| Kurt Garloff | 0833422 | 2008-10-29 14:00:48 -0700 | [diff] [blame] | 67 |  * GPG2 wants 64kB of mlocked memory, to make sure pass phrases | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 68 |  * and other sensitive information are never written to disk. | 
 | 69 |  */ | 
| Kurt Garloff | 0833422 | 2008-10-29 14:00:48 -0700 | [diff] [blame] | 70 | #define MLOCK_LIMIT	((PAGE_SIZE > 64*1024) ? PAGE_SIZE : 64*1024) | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 71 |  | 
 | 72 | /* | 
 | 73 |  * Due to binary compatibility, the actual resource numbers | 
 | 74 |  * may be different for different linux versions.. | 
 | 75 |  */ | 
 | 76 | #include <asm/resource.h> | 
 | 77 |  | 
| Jiri Slaby | 96d07d2 | 2009-11-20 14:16:33 +0100 | [diff] [blame] | 78 | #ifdef __KERNEL__ | 
 | 79 |  | 
 | 80 | struct task_struct; | 
 | 81 |  | 
| Adrian Bunk | 83cc5ed | 2006-06-25 05:47:41 -0700 | [diff] [blame] | 82 | int getrusage(struct task_struct *p, int who, struct rusage __user *ru); | 
| Jiri Slaby | 5b41535 | 2010-03-24 16:11:29 +0100 | [diff] [blame] | 83 | int do_prlimit(struct task_struct *tsk, unsigned int resource, | 
 | 84 | 		struct rlimit *new_rlim, struct rlimit *old_rlim); | 
| Adrian Bunk | 83cc5ed | 2006-06-25 05:47:41 -0700 | [diff] [blame] | 85 |  | 
| Jiri Slaby | 96d07d2 | 2009-11-20 14:16:33 +0100 | [diff] [blame] | 86 | #endif /* __KERNEL__ */ | 
 | 87 |  | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 88 | #endif |