FAQ Search Today's Posts Mark Forums Read
» Video Reviews

» Linux Archive

Linux-archive is a website aiming to archive linux email lists and to make them easily accessible for linux users/developers.

» Sponsor

» Partners

» Sponsor

Go Back   Linux Archive > Ubuntu > Ubuntu Kernel Team

LinkBack Thread Tools
Old 12-02-2011, 03:30 PM
Paolo Pisati
Default resource: add helpers for fetching rlimits

From: Jiri Slaby <jslaby@suse.cz>

We want to be sure that compiler fetches the limit variable only
once, so add helpers for fetching current and maximal resource
limits which do that.

Add them to sched.h (instead of resource.h) due to circular dependency
Alternative would be to create a separate res_access.h or similar.

Signed-off-by: Jiri Slaby <jslaby@suse.cz>
Cc: James Morris <jmorris@namei.org>
Cc: Heiko Carstens <heiko.carstens@de.ibm.com>
Cc: Andrew Morton <akpm@linux-foundation.org>
Cc: Ingo Molnar <mingo@elte.hu>
Signed-off-by: Paolo Pisati <paolo.pisati@canonical.com>
include/linux/sched.h | 22 ++++++++++++++++++++++
1 files changed, 22 insertions(+), 0 deletions(-)

diff --git a/include/linux/sched.h b/include/linux/sched.h
index d1e5b06..51c7417 100644
--- a/include/linux/sched.h
+++ b/include/linux/sched.h
@@ -2486,6 +2486,28 @@ static inline void mm_init_owner(struct mm_struct *mm, struct task_struct *p)
#endif /* CONFIG_MM_OWNER */

+static inline unsigned long task_rlimit(const struct task_struct *tsk,
+ unsigned int limit)
+ return ACCESS_ONCE(tsk->signal->rlim[limit].rlim_cur);
+static inline unsigned long task_rlimit_max(const struct task_struct *tsk,
+ unsigned int limit)
+ return ACCESS_ONCE(tsk->signal->rlim[limit].rlim_max);
+static inline unsigned long rlimit(unsigned int limit)
+ return task_rlimit(current, limit);
+static inline unsigned long rlimit_max(unsigned int limit)
+ return task_rlimit_max(current, limit);

#endif /* __KERNEL__ */

kernel-team mailing list

Thread Tools

All times are GMT. The time now is 07:54 AM.

VBulletin, Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO ©2007, Crawlability, Inc.
Copyright 2007 - 2008, www.linux-archive.org