rlimits: redo do_setrlimit to more generic do_prlimit

It now allows also reading of limits. I.e. all read and writes will
later use this function.

It takes two parameters, new and old limits which can be both NULL.
If new is non-NULL, the value in it is set to rlimits.
If old is non-NULL, current rlimits are stored there.
If both are non-NULL, old are stored prior to setting the new ones,
atomically.
(Similar to sigaction.)

Signed-off-by: Jiri Slaby <jslaby@suse.cz>
This commit is contained in:
Jiri Slaby
2010-03-24 16:11:29 +01:00
committed by Jiri Slaby
parent 6a1d5e2c85
commit 5b41535aac
2 changed files with 39 additions and 36 deletions

View File

@@ -80,8 +80,8 @@ struct rlimit64 {
struct task_struct;
int getrusage(struct task_struct *p, int who, struct rusage __user *ru);
int do_setrlimit(struct task_struct *tsk, unsigned int resource,
struct rlimit *new_rlim);
int do_prlimit(struct task_struct *tsk, unsigned int resource,
struct rlimit *new_rlim, struct rlimit *old_rlim);
#endif /* __KERNEL__ */