Skip to content

Commit

Permalink
[PATCH] uninline capable()
Browse files Browse the repository at this point in the history
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 <[email protected]>
Signed-off-by: Andrew Morton <[email protected]>
Signed-off-by: Linus Torvalds <[email protected]>
  • Loading branch information
Ingo Molnar authored and Linus Torvalds committed Jan 12, 2006
1 parent a9fad4c commit e16885c
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 12 deletions.
13 changes: 1 addition & 12 deletions include/linux/sched.h
Original file line number Diff line number Diff line change
Expand Up @@ -1113,19 +1113,8 @@ static inline int sas_ss_flags(unsigned long sp)
}


#ifdef CONFIG_SECURITY
/* code is in security.c */
/* code is in security.c or kernel/sys.c if !SECURITY */
extern int capable(int cap);
#else
static inline int capable(int cap)
{
if (cap_raised(current->cap_effective, cap)) {
current->flags |= PF_SUPERPRIV;
return 1;
}
return 0;
}
#endif

/*
* Routines for handling mm_structs
Expand Down
12 changes: 12 additions & 0 deletions kernel/sys.c
Original file line number Diff line number Diff line change
Expand Up @@ -223,6 +223,18 @@ int unregister_reboot_notifier(struct notifier_block * nb)

EXPORT_SYMBOL(unregister_reboot_notifier);

#ifndef CONFIG_SECURITY
int capable(int cap)
{
if (cap_raised(current->cap_effective, cap)) {
current->flags |= PF_SUPERPRIV;
return 1;
}
return 0;
}
EXPORT_SYMBOL(capable);
#endif

static int set_one_prio(struct task_struct *p, int niceval, int error)
{
int no_nice;
Expand Down

0 comments on commit e16885c

Please sign in to comment.