aboutsummaryrefslogtreecommitdiffstats
path: root/kernel/sys.c
diff options
context:
space:
mode:
Diffstat (limited to 'kernel/sys.c')
-rw-r--r--kernel/sys.c70
1 files changed, 36 insertions, 34 deletions
diff --git a/kernel/sys.c b/kernel/sys.c
index 763c3c17ded3..e7dc0e10a485 100644
--- a/kernel/sys.c
+++ b/kernel/sys.c
@@ -143,7 +143,7 @@ out:
143 return error; 143 return error;
144} 144}
145 145
146asmlinkage long sys_setpriority(int which, int who, int niceval) 146SYSCALL_DEFINE3(setpriority, int, which, int, who, int, niceval)
147{ 147{
148 struct task_struct *g, *p; 148 struct task_struct *g, *p;
149 struct user_struct *user; 149 struct user_struct *user;
@@ -208,7 +208,7 @@ out:
208 * has been offset by 20 (ie it returns 40..1 instead of -20..19) 208 * has been offset by 20 (ie it returns 40..1 instead of -20..19)
209 * to stay compatible. 209 * to stay compatible.
210 */ 210 */
211asmlinkage long sys_getpriority(int which, int who) 211SYSCALL_DEFINE2(getpriority, int, which, int, who)
212{ 212{
213 struct task_struct *g, *p; 213 struct task_struct *g, *p;
214 struct user_struct *user; 214 struct user_struct *user;
@@ -355,7 +355,8 @@ EXPORT_SYMBOL_GPL(kernel_power_off);
355 * 355 *
356 * reboot doesn't sync: do that yourself before calling this. 356 * reboot doesn't sync: do that yourself before calling this.
357 */ 357 */
358asmlinkage long sys_reboot(int magic1, int magic2, unsigned int cmd, void __user * arg) 358SYSCALL_DEFINE4(reboot, int, magic1, int, magic2, unsigned int, cmd,
359 void __user *, arg)
359{ 360{
360 char buffer[256]; 361 char buffer[256];
361 362
@@ -478,7 +479,7 @@ void ctrl_alt_del(void)
478 * SMP: There are not races, the GIDs are checked only by filesystem 479 * SMP: There are not races, the GIDs are checked only by filesystem
479 * operations (as far as semantic preservation is concerned). 480 * operations (as far as semantic preservation is concerned).
480 */ 481 */
481asmlinkage long sys_setregid(gid_t rgid, gid_t egid) 482SYSCALL_DEFINE2(setregid, gid_t, rgid, gid_t, egid)
482{ 483{
483 const struct cred *old; 484 const struct cred *old;
484 struct cred *new; 485 struct cred *new;
@@ -529,7 +530,7 @@ error:
529 * 530 *
530 * SMP: Same implicit races as above. 531 * SMP: Same implicit races as above.
531 */ 532 */
532asmlinkage long sys_setgid(gid_t gid) 533SYSCALL_DEFINE1(setgid, gid_t, gid)
533{ 534{
534 const struct cred *old; 535 const struct cred *old;
535 struct cred *new; 536 struct cred *new;
@@ -597,7 +598,7 @@ static int set_user(struct cred *new)
597 * 100% compatible with BSD. A program which uses just setuid() will be 598 * 100% compatible with BSD. A program which uses just setuid() will be
598 * 100% compatible with POSIX with saved IDs. 599 * 100% compatible with POSIX with saved IDs.
599 */ 600 */
600asmlinkage long sys_setreuid(uid_t ruid, uid_t euid) 601SYSCALL_DEFINE2(setreuid, uid_t, ruid, uid_t, euid)
601{ 602{
602 const struct cred *old; 603 const struct cred *old;
603 struct cred *new; 604 struct cred *new;
@@ -661,7 +662,7 @@ error:
661 * will allow a root program to temporarily drop privileges and be able to 662 * will allow a root program to temporarily drop privileges and be able to
662 * regain them by swapping the real and effective uid. 663 * regain them by swapping the real and effective uid.
663 */ 664 */
664asmlinkage long sys_setuid(uid_t uid) 665SYSCALL_DEFINE1(setuid, uid_t, uid)
665{ 666{
666 const struct cred *old; 667 const struct cred *old;
667 struct cred *new; 668 struct cred *new;
@@ -705,7 +706,7 @@ error:
705 * This function implements a generic ability to update ruid, euid, 706 * This function implements a generic ability to update ruid, euid,
706 * and suid. This allows you to implement the 4.4 compatible seteuid(). 707 * and suid. This allows you to implement the 4.4 compatible seteuid().
707 */ 708 */
708asmlinkage long sys_setresuid(uid_t ruid, uid_t euid, uid_t suid) 709SYSCALL_DEFINE3(setresuid, uid_t, ruid, uid_t, euid, uid_t, suid)
709{ 710{
710 const struct cred *old; 711 const struct cred *old;
711 struct cred *new; 712 struct cred *new;
@@ -756,7 +757,7 @@ error:
756 return retval; 757 return retval;
757} 758}
758 759
759asmlinkage long sys_getresuid(uid_t __user *ruid, uid_t __user *euid, uid_t __user *suid) 760SYSCALL_DEFINE3(getresuid, uid_t __user *, ruid, uid_t __user *, euid, uid_t __user *, suid)
760{ 761{
761 const struct cred *cred = current_cred(); 762 const struct cred *cred = current_cred();
762 int retval; 763 int retval;
@@ -771,7 +772,7 @@ asmlinkage long sys_getresuid(uid_t __user *ruid, uid_t __user *euid, uid_t __us
771/* 772/*
772 * Same as above, but for rgid, egid, sgid. 773 * Same as above, but for rgid, egid, sgid.
773 */ 774 */
774asmlinkage long sys_setresgid(gid_t rgid, gid_t egid, gid_t sgid) 775SYSCALL_DEFINE3(setresgid, gid_t, rgid, gid_t, egid, gid_t, sgid)
775{ 776{
776 const struct cred *old; 777 const struct cred *old;
777 struct cred *new; 778 struct cred *new;
@@ -814,7 +815,7 @@ error:
814 return retval; 815 return retval;
815} 816}
816 817
817asmlinkage long sys_getresgid(gid_t __user *rgid, gid_t __user *egid, gid_t __user *sgid) 818SYSCALL_DEFINE3(getresgid, gid_t __user *, rgid, gid_t __user *, egid, gid_t __user *, sgid)
818{ 819{
819 const struct cred *cred = current_cred(); 820 const struct cred *cred = current_cred();
820 int retval; 821 int retval;
@@ -833,7 +834,7 @@ asmlinkage long sys_getresgid(gid_t __user *rgid, gid_t __user *egid, gid_t __us
833 * whatever uid it wants to). It normally shadows "euid", except when 834 * whatever uid it wants to). It normally shadows "euid", except when
834 * explicitly set by setfsuid() or for access.. 835 * explicitly set by setfsuid() or for access..
835 */ 836 */
836asmlinkage long sys_setfsuid(uid_t uid) 837SYSCALL_DEFINE1(setfsuid, uid_t, uid)
837{ 838{
838 const struct cred *old; 839 const struct cred *old;
839 struct cred *new; 840 struct cred *new;
@@ -870,7 +871,7 @@ change_okay:
870/* 871/*
871 * Samma på svenska.. 872 * Samma på svenska..
872 */ 873 */
873asmlinkage long sys_setfsgid(gid_t gid) 874SYSCALL_DEFINE1(setfsgid, gid_t, gid)
874{ 875{
875 const struct cred *old; 876 const struct cred *old;
876 struct cred *new; 877 struct cred *new;
@@ -919,7 +920,7 @@ void do_sys_times(struct tms *tms)
919 tms->tms_cstime = cputime_to_clock_t(cstime); 920 tms->tms_cstime = cputime_to_clock_t(cstime);
920} 921}
921 922
922asmlinkage long sys_times(struct tms __user * tbuf) 923SYSCALL_DEFINE1(times, struct tms __user *, tbuf)
923{ 924{
924 if (tbuf) { 925 if (tbuf) {
925 struct tms tmp; 926 struct tms tmp;
@@ -944,7 +945,7 @@ asmlinkage long sys_times(struct tms __user * tbuf)
944 * Auch. Had to add the 'did_exec' flag to conform completely to POSIX. 945 * Auch. Had to add the 'did_exec' flag to conform completely to POSIX.
945 * LBT 04.03.94 946 * LBT 04.03.94
946 */ 947 */
947asmlinkage long sys_setpgid(pid_t pid, pid_t pgid) 948SYSCALL_DEFINE2(setpgid, pid_t, pid, pid_t, pgid)
948{ 949{
949 struct task_struct *p; 950 struct task_struct *p;
950 struct task_struct *group_leader = current->group_leader; 951 struct task_struct *group_leader = current->group_leader;
@@ -1015,7 +1016,7 @@ out:
1015 return err; 1016 return err;
1016} 1017}
1017 1018
1018asmlinkage long sys_getpgid(pid_t pid) 1019SYSCALL_DEFINE1(getpgid, pid_t, pid)
1019{ 1020{
1020 struct task_struct *p; 1021 struct task_struct *p;
1021 struct pid *grp; 1022 struct pid *grp;
@@ -1045,14 +1046,14 @@ out:
1045 1046
1046#ifdef __ARCH_WANT_SYS_GETPGRP 1047#ifdef __ARCH_WANT_SYS_GETPGRP
1047 1048
1048asmlinkage long sys_getpgrp(void) 1049SYSCALL_DEFINE0(getpgrp)
1049{ 1050{
1050 return sys_getpgid(0); 1051 return sys_getpgid(0);
1051} 1052}
1052 1053
1053#endif 1054#endif
1054 1055
1055asmlinkage long sys_getsid(pid_t pid) 1056SYSCALL_DEFINE1(getsid, pid_t, pid)
1056{ 1057{
1057 struct task_struct *p; 1058 struct task_struct *p;
1058 struct pid *sid; 1059 struct pid *sid;
@@ -1080,7 +1081,7 @@ out:
1080 return retval; 1081 return retval;
1081} 1082}
1082 1083
1083asmlinkage long sys_setsid(void) 1084SYSCALL_DEFINE0(setsid)
1084{ 1085{
1085 struct task_struct *group_leader = current->group_leader; 1086 struct task_struct *group_leader = current->group_leader;
1086 struct pid *sid = task_pid(group_leader); 1087 struct pid *sid = task_pid(group_leader);
@@ -1311,7 +1312,7 @@ int set_current_groups(struct group_info *group_info)
1311 1312
1312EXPORT_SYMBOL(set_current_groups); 1313EXPORT_SYMBOL(set_current_groups);
1313 1314
1314asmlinkage long sys_getgroups(int gidsetsize, gid_t __user *grouplist) 1315SYSCALL_DEFINE2(getgroups, int, gidsetsize, gid_t __user *, grouplist)
1315{ 1316{
1316 const struct cred *cred = current_cred(); 1317 const struct cred *cred = current_cred();
1317 int i; 1318 int i;
@@ -1340,7 +1341,7 @@ out:
1340 * without another task interfering. 1341 * without another task interfering.
1341 */ 1342 */
1342 1343
1343asmlinkage long sys_setgroups(int gidsetsize, gid_t __user *grouplist) 1344SYSCALL_DEFINE2(setgroups, int, gidsetsize, gid_t __user *, grouplist)
1344{ 1345{
1345 struct group_info *group_info; 1346 struct group_info *group_info;
1346 int retval; 1347 int retval;
@@ -1394,7 +1395,7 @@ EXPORT_SYMBOL(in_egroup_p);
1394 1395
1395DECLARE_RWSEM(uts_sem); 1396DECLARE_RWSEM(uts_sem);
1396 1397
1397asmlinkage long sys_newuname(struct new_utsname __user * name) 1398SYSCALL_DEFINE1(newuname, struct new_utsname __user *, name)
1398{ 1399{
1399 int errno = 0; 1400 int errno = 0;
1400 1401
@@ -1405,7 +1406,7 @@ asmlinkage long sys_newuname(struct new_utsname __user * name)
1405 return errno; 1406 return errno;
1406} 1407}
1407 1408
1408asmlinkage long sys_sethostname(char __user *name, int len) 1409SYSCALL_DEFINE2(sethostname, char __user *, name, int, len)
1409{ 1410{
1410 int errno; 1411 int errno;
1411 char tmp[__NEW_UTS_LEN]; 1412 char tmp[__NEW_UTS_LEN];
@@ -1429,7 +1430,7 @@ asmlinkage long sys_sethostname(char __user *name, int len)
1429 1430
1430#ifdef __ARCH_WANT_SYS_GETHOSTNAME 1431#ifdef __ARCH_WANT_SYS_GETHOSTNAME
1431 1432
1432asmlinkage long sys_gethostname(char __user *name, int len) 1433SYSCALL_DEFINE2(gethostname, char __user *, name, int, len)
1433{ 1434{
1434 int i, errno; 1435 int i, errno;
1435 struct new_utsname *u; 1436 struct new_utsname *u;
@@ -1454,7 +1455,7 @@ asmlinkage long sys_gethostname(char __user *name, int len)
1454 * Only setdomainname; getdomainname can be implemented by calling 1455 * Only setdomainname; getdomainname can be implemented by calling
1455 * uname() 1456 * uname()
1456 */ 1457 */
1457asmlinkage long sys_setdomainname(char __user *name, int len) 1458SYSCALL_DEFINE2(setdomainname, char __user *, name, int, len)
1458{ 1459{
1459 int errno; 1460 int errno;
1460 char tmp[__NEW_UTS_LEN]; 1461 char tmp[__NEW_UTS_LEN];
@@ -1477,7 +1478,7 @@ asmlinkage long sys_setdomainname(char __user *name, int len)
1477 return errno; 1478 return errno;
1478} 1479}
1479 1480
1480asmlinkage long sys_getrlimit(unsigned int resource, struct rlimit __user *rlim) 1481SYSCALL_DEFINE2(getrlimit, unsigned int, resource, struct rlimit __user *, rlim)
1481{ 1482{
1482 if (resource >= RLIM_NLIMITS) 1483 if (resource >= RLIM_NLIMITS)
1483 return -EINVAL; 1484 return -EINVAL;
@@ -1496,7 +1497,8 @@ asmlinkage long sys_getrlimit(unsigned int resource, struct rlimit __user *rlim)
1496 * Back compatibility for getrlimit. Needed for some apps. 1497 * Back compatibility for getrlimit. Needed for some apps.
1497 */ 1498 */
1498 1499
1499asmlinkage long sys_old_getrlimit(unsigned int resource, struct rlimit __user *rlim) 1500SYSCALL_DEFINE2(old_getrlimit, unsigned int, resource,
1501 struct rlimit __user *, rlim)
1500{ 1502{
1501 struct rlimit x; 1503 struct rlimit x;
1502 if (resource >= RLIM_NLIMITS) 1504 if (resource >= RLIM_NLIMITS)
@@ -1514,7 +1516,7 @@ asmlinkage long sys_old_getrlimit(unsigned int resource, struct rlimit __user *r
1514 1516
1515#endif 1517#endif
1516 1518
1517asmlinkage long sys_setrlimit(unsigned int resource, struct rlimit __user *rlim) 1519SYSCALL_DEFINE2(setrlimit, unsigned int, resource, struct rlimit __user *, rlim)
1518{ 1520{
1519 struct rlimit new_rlim, *old_rlim; 1521 struct rlimit new_rlim, *old_rlim;
1520 int retval; 1522 int retval;
@@ -1687,7 +1689,7 @@ int getrusage(struct task_struct *p, int who, struct rusage __user *ru)
1687 return copy_to_user(ru, &r, sizeof(r)) ? -EFAULT : 0; 1689 return copy_to_user(ru, &r, sizeof(r)) ? -EFAULT : 0;
1688} 1690}
1689 1691
1690asmlinkage long sys_getrusage(int who, struct rusage __user *ru) 1692SYSCALL_DEFINE2(getrusage, int, who, struct rusage __user *, ru)
1691{ 1693{
1692 if (who != RUSAGE_SELF && who != RUSAGE_CHILDREN && 1694 if (who != RUSAGE_SELF && who != RUSAGE_CHILDREN &&
1693 who != RUSAGE_THREAD) 1695 who != RUSAGE_THREAD)
@@ -1695,14 +1697,14 @@ asmlinkage long sys_getrusage(int who, struct rusage __user *ru)
1695 return getrusage(current, who, ru); 1697 return getrusage(current, who, ru);
1696} 1698}
1697 1699
1698asmlinkage long sys_umask(int mask) 1700SYSCALL_DEFINE1(umask, int, mask)
1699{ 1701{
1700 mask = xchg(&current->fs->umask, mask & S_IRWXUGO); 1702 mask = xchg(&current->fs->umask, mask & S_IRWXUGO);
1701 return mask; 1703 return mask;
1702} 1704}
1703 1705
1704asmlinkage long sys_prctl(int option, unsigned long arg2, unsigned long arg3, 1706SYSCALL_DEFINE5(prctl, int, option, unsigned long, arg2, unsigned long, arg3,
1705 unsigned long arg4, unsigned long arg5) 1707 unsigned long, arg4, unsigned long, arg5)
1706{ 1708{
1707 struct task_struct *me = current; 1709 struct task_struct *me = current;
1708 unsigned char comm[sizeof(me->comm)]; 1710 unsigned char comm[sizeof(me->comm)];
@@ -1815,8 +1817,8 @@ asmlinkage long sys_prctl(int option, unsigned long arg2, unsigned long arg3,
1815 return error; 1817 return error;
1816} 1818}
1817 1819
1818asmlinkage long sys_getcpu(unsigned __user *cpup, unsigned __user *nodep, 1820SYSCALL_DEFINE3(getcpu, unsigned __user *, cpup, unsigned __user *, nodep,
1819 struct getcpu_cache __user *unused) 1821 struct getcpu_cache __user *, unused)
1820{ 1822{
1821 int err = 0; 1823 int err = 0;
1822 int cpu = raw_smp_processor_id(); 1824 int cpu = raw_smp_processor_id();