diff options
author | Ingo Molnar <mingo@elte.hu> | 2006-01-11 15:17:45 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@g5.osdl.org> | 2006-01-11 21:42:13 -0500 |
commit | e16885c5ad624a6efe1b1bf764e075d75f65a788 (patch) | |
tree | de137e799ddc0a696bb288b34fade65af1708a5e | |
parent | a9fad4cc3975573a359a92ad047f5995d8391631 (diff) |
[PATCH] uninline capable()
Uninline capable(). Saves 2K of kernel text on a generic .config, and 1K on a
tiny config. In addition it makes the use of capable more consistent between
CONFIG_SECURITY and !CONFIG_SECURITY
Signed-off-by: Ingo Molnar <mingo@elte.hu>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
-rw-r--r-- | include/linux/sched.h | 13 | ||||
-rw-r--r-- | kernel/sys.c | 12 |
2 files changed, 13 insertions, 12 deletions
diff --git a/include/linux/sched.h b/include/linux/sched.h index c4ee35dd18ae..2ae8711bfba1 100644 --- a/include/linux/sched.h +++ b/include/linux/sched.h | |||
@@ -1113,19 +1113,8 @@ static inline int sas_ss_flags(unsigned long sp) | |||
1113 | } | 1113 | } |
1114 | 1114 | ||
1115 | 1115 | ||
1116 | #ifdef CONFIG_SECURITY | 1116 | /* code is in security.c or kernel/sys.c if !SECURITY */ |
1117 | /* code is in security.c */ | ||
1118 | extern int capable(int cap); | 1117 | extern int capable(int cap); |
1119 | #else | ||
1120 | static inline int capable(int cap) | ||
1121 | { | ||
1122 | if (cap_raised(current->cap_effective, cap)) { | ||
1123 | current->flags |= PF_SUPERPRIV; | ||
1124 | return 1; | ||
1125 | } | ||
1126 | return 0; | ||
1127 | } | ||
1128 | #endif | ||
1129 | 1118 | ||
1130 | /* | 1119 | /* |
1131 | * Routines for handling mm_structs | 1120 | * Routines for handling mm_structs |
diff --git a/kernel/sys.c b/kernel/sys.c index b6941e06d5d5..9ccf713491f9 100644 --- a/kernel/sys.c +++ b/kernel/sys.c | |||
@@ -223,6 +223,18 @@ int unregister_reboot_notifier(struct notifier_block * nb) | |||
223 | 223 | ||
224 | EXPORT_SYMBOL(unregister_reboot_notifier); | 224 | EXPORT_SYMBOL(unregister_reboot_notifier); |
225 | 225 | ||
226 | #ifndef CONFIG_SECURITY | ||
227 | int capable(int cap) | ||
228 | { | ||
229 | if (cap_raised(current->cap_effective, cap)) { | ||
230 | current->flags |= PF_SUPERPRIV; | ||
231 | return 1; | ||
232 | } | ||
233 | return 0; | ||
234 | } | ||
235 | EXPORT_SYMBOL(capable); | ||
236 | #endif | ||
237 | |||
226 | static int set_one_prio(struct task_struct *p, int niceval, int error) | 238 | static int set_one_prio(struct task_struct *p, int niceval, int error) |
227 | { | 239 | { |
228 | int no_nice; | 240 | int no_nice; |