Linux Kernel  3.7.1
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
Macros | Functions | Variables
sys.c File Reference
#include <linux/export.h>
#include <linux/mm.h>
#include <linux/utsname.h>
#include <linux/mman.h>
#include <linux/reboot.h>
#include <linux/prctl.h>
#include <linux/highuid.h>
#include <linux/fs.h>
#include <linux/kmod.h>
#include <linux/perf_event.h>
#include <linux/resource.h>
#include <linux/kernel.h>
#include <linux/kexec.h>
#include <linux/workqueue.h>
#include <linux/capability.h>
#include <linux/device.h>
#include <linux/key.h>
#include <linux/times.h>
#include <linux/posix-timers.h>
#include <linux/security.h>
#include <linux/dcookies.h>
#include <linux/suspend.h>
#include <linux/tty.h>
#include <linux/signal.h>
#include <linux/cn_proc.h>
#include <linux/getcpu.h>
#include <linux/task_io_accounting_ops.h>
#include <linux/seccomp.h>
#include <linux/cpu.h>
#include <linux/personality.h>
#include <linux/ptrace.h>
#include <linux/fs_struct.h>
#include <linux/file.h>
#include <linux/mount.h>
#include <linux/gfp.h>
#include <linux/syscore_ops.h>
#include <linux/version.h>
#include <linux/ctype.h>
#include <linux/compat.h>
#include <linux/syscalls.h>
#include <linux/kprobes.h>
#include <linux/user_namespace.h>
#include <linux/kmsg_dump.h>
#include <generated/utsrelease.h>
#include <asm/uaccess.h>
#include <asm/io.h>
#include <asm/unistd.h>

Go to the source code of this file.

Macros

#define SET_UNALIGN_CTL(a, b)   (-EINVAL)
 
#define GET_UNALIGN_CTL(a, b)   (-EINVAL)
 
#define SET_FPEMU_CTL(a, b)   (-EINVAL)
 
#define GET_FPEMU_CTL(a, b)   (-EINVAL)
 
#define SET_FPEXC_CTL(a, b)   (-EINVAL)
 
#define GET_FPEXC_CTL(a, b)   (-EINVAL)
 
#define GET_ENDIAN(a, b)   (-EINVAL)
 
#define SET_ENDIAN(a, b)   (-EINVAL)
 
#define GET_TSC_CTL(a)   (-EINVAL)
 
#define SET_TSC_CTL(a)   (-EINVAL)
 
#define override_architecture(name)   0
 

Functions

 EXPORT_SYMBOL (overflowuid)
 
 EXPORT_SYMBOL (overflowgid)
 
 EXPORT_SYMBOL (fs_overflowuid)
 
 EXPORT_SYMBOL (fs_overflowgid)
 
 EXPORT_SYMBOL (cad_pid)
 
 SYSCALL_DEFINE3 (setpriority, int, which, int, who, int, niceval)
 
 SYSCALL_DEFINE2 (getpriority, int, which, int, who)
 
void emergency_restart (void)
 
 EXPORT_SYMBOL_GPL (emergency_restart)
 
void kernel_restart_prepare (char *cmd)
 
int register_reboot_notifier (struct notifier_block *nb)
 
 EXPORT_SYMBOL (register_reboot_notifier)
 
int unregister_reboot_notifier (struct notifier_block *nb)
 
 EXPORT_SYMBOL (unregister_reboot_notifier)
 
void kernel_restart (char *cmd)
 
 EXPORT_SYMBOL_GPL (kernel_restart)
 
void kernel_halt (void)
 
 EXPORT_SYMBOL_GPL (kernel_halt)
 
void kernel_power_off (void)
 
 EXPORT_SYMBOL_GPL (kernel_power_off)
 
 SYSCALL_DEFINE4 (reboot, int, magic1, int, magic2, unsigned int, cmd, void __user *, arg)
 
void ctrl_alt_del (void)
 
 SYSCALL_DEFINE2 (setregid, gid_t, rgid, gid_t, egid)
 
 SYSCALL_DEFINE1 (setgid, gid_t, gid)
 
 SYSCALL_DEFINE2 (setreuid, uid_t, ruid, uid_t, euid)
 
 SYSCALL_DEFINE1 (setuid, uid_t, uid)
 
 SYSCALL_DEFINE3 (setresuid, uid_t, ruid, uid_t, euid, uid_t, suid)
 
 SYSCALL_DEFINE3 (getresuid, uid_t __user *, ruidp, uid_t __user *, euidp, uid_t __user *, suidp)
 
 SYSCALL_DEFINE3 (setresgid, gid_t, rgid, gid_t, egid, gid_t, sgid)
 
 SYSCALL_DEFINE3 (getresgid, gid_t __user *, rgidp, gid_t __user *, egidp, gid_t __user *, sgidp)
 
 SYSCALL_DEFINE1 (setfsuid, uid_t, uid)
 
 SYSCALL_DEFINE1 (setfsgid, gid_t, gid)
 
void do_sys_times (struct tms *tms)
 
 SYSCALL_DEFINE1 (times, struct tms __user *, tbuf)
 
 SYSCALL_DEFINE2 (setpgid, pid_t, pid, pid_t, pgid)
 
 SYSCALL_DEFINE1 (getpgid, pid_t, pid)
 
 SYSCALL_DEFINE1 (getsid, pid_t, pid)
 
 SYSCALL_DEFINE0 (setsid)
 
 DECLARE_RWSEM (uts_sem)
 
 SYSCALL_DEFINE1 (newuname, struct new_utsname __user *, name)
 
 SYSCALL_DEFINE2 (sethostname, char __user *, name, int, len)
 
 SYSCALL_DEFINE2 (setdomainname, char __user *, name, int, len)
 
 SYSCALL_DEFINE2 (getrlimit, unsigned int, resource, struct rlimit __user *, rlim)
 
int do_prlimit (struct task_struct *tsk, unsigned int resource, struct rlimit *new_rlim, struct rlimit *old_rlim)
 
 SYSCALL_DEFINE4 (prlimit64, pid_t, pid, unsigned int, resource, const struct rlimit64 __user *, new_rlim, struct rlimit64 __user *, old_rlim)
 
 SYSCALL_DEFINE2 (setrlimit, unsigned int, resource, struct rlimit __user *, rlim)
 
int getrusage (struct task_struct *p, int who, struct rusage __user *ru)
 
 SYSCALL_DEFINE2 (getrusage, int, who, struct rusage __user *, ru)
 
 SYSCALL_DEFINE1 (umask, int, mask)
 
 SYSCALL_DEFINE5 (prctl, int, option, unsigned long, arg2, unsigned long, arg3, unsigned long, arg4, unsigned long, arg5)
 
 SYSCALL_DEFINE3 (getcpu, unsigned __user *, cpup, unsigned __user *, nodep, struct getcpu_cache __user *, unused)
 
int orderly_poweroff (bool force)
 
 EXPORT_SYMBOL_GPL (orderly_poweroff)
 

Variables

int overflowuid = DEFAULT_OVERFLOWUID
 
int overflowgid = DEFAULT_OVERFLOWGID
 
int fs_overflowuid = DEFAULT_FS_OVERFLOWUID
 
int fs_overflowgid = DEFAULT_FS_OVERFLOWUID
 
int C_A_D = 1
 
struct pidcad_pid
 
void(* pm_power_off_prepare )(void)
 
char poweroff_cmd [POWEROFF_CMD_PATH_LEN] = "/sbin/poweroff"
 

Macro Definition Documentation

#define GET_ENDIAN (   a,
  b 
)    (-EINVAL)

Definition at line 78 of file sys.c.

#define GET_FPEMU_CTL (   a,
  b 
)    (-EINVAL)

Definition at line 69 of file sys.c.

#define GET_FPEXC_CTL (   a,
  b 
)    (-EINVAL)

Definition at line 75 of file sys.c.

#define GET_TSC_CTL (   a)    (-EINVAL)

Definition at line 84 of file sys.c.

#define GET_UNALIGN_CTL (   a,
  b 
)    (-EINVAL)

Definition at line 63 of file sys.c.

#define override_architecture (   name)    0

Definition at line 1261 of file sys.c.

#define SET_ENDIAN (   a,
  b 
)    (-EINVAL)

Definition at line 81 of file sys.c.

#define SET_FPEMU_CTL (   a,
  b 
)    (-EINVAL)

Definition at line 66 of file sys.c.

#define SET_FPEXC_CTL (   a,
  b 
)    (-EINVAL)

Definition at line 72 of file sys.c.

#define SET_TSC_CTL (   a)    (-EINVAL)

Definition at line 87 of file sys.c.

#define SET_UNALIGN_CTL (   a,
  b 
)    (-EINVAL)

Definition at line 60 of file sys.c.

Function Documentation

void ctrl_alt_del ( void  )

Definition at line 530 of file sys.c.

DECLARE_RWSEM ( uts_sem  )
int do_prlimit ( struct task_struct tsk,
unsigned int  resource,
struct rlimit new_rlim,
struct rlimit old_rlim 
)

Definition at line 1514 of file sys.c.

void do_sys_times ( struct tms tms)

Definition at line 1044 of file sys.c.

void emergency_restart ( void  )

emergency_restart - reboot the system

Without shutting down any hardware or taking any locks reboot the system. This is called when we know we are in trouble so this is our best effort to reboot. This is safe to call in interrupt context.

Definition at line 313 of file sys.c.

EXPORT_SYMBOL ( overflowuid  )
EXPORT_SYMBOL ( overflowgid  )
EXPORT_SYMBOL ( fs_overflowuid  )
EXPORT_SYMBOL ( fs_overflowgid  )
EXPORT_SYMBOL ( cad_pid  )
EXPORT_SYMBOL ( register_reboot_notifier  )
EXPORT_SYMBOL ( unregister_reboot_notifier  )
EXPORT_SYMBOL_GPL ( emergency_restart  )
EXPORT_SYMBOL_GPL ( kernel_restart  )
EXPORT_SYMBOL_GPL ( kernel_halt  )
EXPORT_SYMBOL_GPL ( kernel_power_off  )
EXPORT_SYMBOL_GPL ( orderly_poweroff  )
int getrusage ( struct task_struct p,
int  who,
struct rusage __user ru 
)

Definition at line 1770 of file sys.c.

void kernel_halt ( void  )

kernel_halt - halt the system

Shutdown everything and perform a clean system halt.

Definition at line 394 of file sys.c.

void kernel_power_off ( void  )

kernel_power_off - power_off the system

Shutdown everything and perform a clean system power_off.

Definition at line 410 of file sys.c.

void kernel_restart ( char cmd)

kernel_restart - reboot the system : pointer to buffer containing command to execute for restart or NULL

Shutdown everything and perform a clean reboot. This is not safe to call in interrupt context.

Definition at line 368 of file sys.c.

void kernel_restart_prepare ( char cmd)

Definition at line 320 of file sys.c.

int orderly_poweroff ( bool  force)

orderly_poweroff - Trigger an orderly system poweroff : force poweroff if command execution fails

This may be called from any context to trigger a system shutdown. If the orderly shutdown fails, it will force an immediate shutdown.

Definition at line 2225 of file sys.c.

int register_reboot_notifier ( struct notifier_block nb)

register_reboot_notifier - Register function to be called at reboot time : Info about notifier function to be called

Registers a function with the list of functions to be called at reboot time.

Currently always returns zero, as blocking_notifier_chain_register() always returns zero.

Definition at line 339 of file sys.c.

SYSCALL_DEFINE0 ( setsid  )

Definition at line 1220 of file sys.c.

SYSCALL_DEFINE1 ( setgid  ,
gid_t  ,
gid   
)

Definition at line 615 of file sys.c.

SYSCALL_DEFINE1 ( setuid  ,
uid_t  ,
uid   
)

Definition at line 762 of file sys.c.

SYSCALL_DEFINE1 ( setfsuid  ,
uid_t  ,
uid   
)

Definition at line 970 of file sys.c.

SYSCALL_DEFINE1 ( setfsgid  ,
gid_t  ,
gid   
)

Definition at line 1009 of file sys.c.

SYSCALL_DEFINE1 ( times  ,
struct tms __user ,
tbuf   
)

Definition at line 1059 of file sys.c.

SYSCALL_DEFINE1 ( getpgid  ,
pid_t  ,
pid   
)

Definition at line 1155 of file sys.c.

SYSCALL_DEFINE1 ( getsid  ,
pid_t  ,
pid   
)

Definition at line 1192 of file sys.c.

SYSCALL_DEFINE1 ( newuname  ,
struct new_utsname __user ,
name   
)

Definition at line 1294 of file sys.c.

SYSCALL_DEFINE1 ( umask  ,
int  ,
mask   
)

Definition at line 1785 of file sys.c.

SYSCALL_DEFINE2 ( getpriority  ,
int  ,
which  ,
int  ,
who   
)

Definition at line 241 of file sys.c.

SYSCALL_DEFINE2 ( setregid  ,
gid_t  ,
rgid  ,
gid_t  ,
egid   
)

Definition at line 558 of file sys.c.

SYSCALL_DEFINE2 ( setreuid  ,
uid_t  ,
ruid  ,
uid_t  ,
euid   
)

Definition at line 691 of file sys.c.

SYSCALL_DEFINE2 ( setpgid  ,
pid_t  ,
pid  ,
pid_t  ,
pgid   
)

Definition at line 1084 of file sys.c.

SYSCALL_DEFINE2 ( sethostname  ,
char __user ,
name  ,
int  ,
len   
)

Definition at line 1368 of file sys.c.

SYSCALL_DEFINE2 ( setdomainname  ,
char __user ,
name  ,
int  ,
len   
)

Definition at line 1419 of file sys.c.

SYSCALL_DEFINE2 ( getrlimit  ,
unsigned  int,
resource  ,
struct rlimit __user ,
rlim   
)

Definition at line 1443 of file sys.c.

SYSCALL_DEFINE2 ( setrlimit  ,
unsigned  int,
resource  ,
struct rlimit __user ,
rlim   
)

Definition at line 1644 of file sys.c.

SYSCALL_DEFINE2 ( getrusage  ,
int  ,
who  ,
struct rusage __user ,
ru   
)

Definition at line 1777 of file sys.c.

SYSCALL_DEFINE3 ( setpriority  ,
int  ,
which  ,
int  ,
who  ,
int  ,
niceval   
)

Definition at line 172 of file sys.c.

SYSCALL_DEFINE3 ( setresuid  ,
uid_t  ,
ruid  ,
uid_t  ,
euid  ,
uid_t  ,
suid   
)

Definition at line 809 of file sys.c.

SYSCALL_DEFINE3 ( getresuid  ,
uid_t __user ,
ruidp  ,
uid_t __user ,
euidp  ,
uid_t __user ,
suidp   
)

Definition at line 874 of file sys.c.

SYSCALL_DEFINE3 ( setresgid  ,
gid_t  ,
rgid  ,
gid_t  ,
egid  ,
gid_t  ,
sgid   
)

Definition at line 894 of file sys.c.

SYSCALL_DEFINE3 ( getresgid  ,
gid_t __user ,
rgidp  ,
gid_t __user ,
egidp  ,
gid_t __user ,
sgidp   
)

Definition at line 946 of file sys.c.

SYSCALL_DEFINE3 ( getcpu  ,
unsigned __user ,
cpup  ,
unsigned __user ,
nodep  ,
struct getcpu_cache __user ,
unused   
)

Definition at line 2173 of file sys.c.

SYSCALL_DEFINE4 ( reboot  ,
int  ,
magic1  ,
int  ,
magic2  ,
unsigned  int,
cmd  ,
void __user ,
arg   
)

Definition at line 433 of file sys.c.

SYSCALL_DEFINE4 ( prlimit64  ,
pid_t  ,
pid  ,
unsigned  int,
resource  ,
const struct rlimit64 __user ,
new_rlim  ,
struct rlimit64 __user ,
old_rlim   
)

Definition at line 1602 of file sys.c.

SYSCALL_DEFINE5 ( prctl  ,
int  ,
option  ,
unsigned  long,
arg2  ,
unsigned  long,
arg3  ,
unsigned  long,
arg4  ,
unsigned  long,
arg5   
)

Definition at line 2002 of file sys.c.

int unregister_reboot_notifier ( struct notifier_block nb)

unregister_reboot_notifier - Unregister previously registered reboot notifier : Hook to be unregistered

Unregisters a previously registered reboot notifier function.

Returns zero on success, or %-ENOENT on failure.

Definition at line 354 of file sys.c.

Variable Documentation

int C_A_D = 1

Definition at line 116 of file sys.c.

struct pid* cad_pid

Definition at line 117 of file sys.c.

int fs_overflowgid = DEFAULT_FS_OVERFLOWUID

Definition at line 107 of file sys.c.

int fs_overflowuid = DEFAULT_FS_OVERFLOWUID

Definition at line 106 of file sys.c.

int overflowgid = DEFAULT_OVERFLOWGID

Definition at line 96 of file sys.c.

int overflowuid = DEFAULT_OVERFLOWUID

Definition at line 95 of file sys.c.

void(* pm_power_off_prepare)(void)

Definition at line 124 of file sys.c.

char poweroff_cmd[POWEROFF_CMD_PATH_LEN] = "/sbin/poweroff"

Definition at line 2185 of file sys.c.