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