aboutsummaryrefslogtreecommitdiffstats
path: root/ipc
diff options
context:
space:
mode:
authorIngo Molnar <mingo@elte.hu>2009-02-12 07:08:57 -0500
committerIngo Molnar <mingo@elte.hu>2009-02-12 07:08:57 -0500
commit871cafcc962fa1655c44b4f0e54d4c5cc14e273c (patch)
treefdb7bc65d2606c85b7be6c33ba0dfd5b4e472245 /ipc
parentcf2592f59c0e8ed4308adbdb2e0a88655379d579 (diff)
parentb578f3fcca1e78624dfb5f358776e63711d7fda2 (diff)
Merge branch 'linus' into core/softlockup
Diffstat (limited to 'ipc')
-rw-r--r--ipc/mqueue.c28
-rw-r--r--ipc/msg.c12
-rw-r--r--ipc/sem.c18
-rw-r--r--ipc/shm.c22
4 files changed, 47 insertions, 33 deletions
diff --git a/ipc/mqueue.c b/ipc/mqueue.c
index 23fdb8492b8e..54b4077fed79 100644
--- a/ipc/mqueue.c
+++ b/ipc/mqueue.c
@@ -650,8 +650,8 @@ static struct file *do_open(struct dentry *dentry, int oflag)
650 return dentry_open(dentry, mqueue_mnt, oflag, cred); 650 return dentry_open(dentry, mqueue_mnt, oflag, cred);
651} 651}
652 652
653asmlinkage long sys_mq_open(const char __user *u_name, int oflag, mode_t mode, 653SYSCALL_DEFINE4(mq_open, const char __user *, u_name, int, oflag, mode_t, mode,
654 struct mq_attr __user *u_attr) 654 struct mq_attr __user *, u_attr)
655{ 655{
656 struct dentry *dentry; 656 struct dentry *dentry;
657 struct file *filp; 657 struct file *filp;
@@ -721,7 +721,7 @@ out_putname:
721 return fd; 721 return fd;
722} 722}
723 723
724asmlinkage long sys_mq_unlink(const char __user *u_name) 724SYSCALL_DEFINE1(mq_unlink, const char __user *, u_name)
725{ 725{
726 int err; 726 int err;
727 char *name; 727 char *name;
@@ -814,9 +814,9 @@ static inline void pipelined_receive(struct mqueue_inode_info *info)
814 sender->state = STATE_READY; 814 sender->state = STATE_READY;
815} 815}
816 816
817asmlinkage long sys_mq_timedsend(mqd_t mqdes, const char __user *u_msg_ptr, 817SYSCALL_DEFINE5(mq_timedsend, mqd_t, mqdes, const char __user *, u_msg_ptr,
818 size_t msg_len, unsigned int msg_prio, 818 size_t, msg_len, unsigned int, msg_prio,
819 const struct timespec __user *u_abs_timeout) 819 const struct timespec __user *, u_abs_timeout)
820{ 820{
821 struct file *filp; 821 struct file *filp;
822 struct inode *inode; 822 struct inode *inode;
@@ -907,9 +907,9 @@ out:
907 return ret; 907 return ret;
908} 908}
909 909
910asmlinkage ssize_t sys_mq_timedreceive(mqd_t mqdes, char __user *u_msg_ptr, 910SYSCALL_DEFINE5(mq_timedreceive, mqd_t, mqdes, char __user *, u_msg_ptr,
911 size_t msg_len, unsigned int __user *u_msg_prio, 911 size_t, msg_len, unsigned int __user *, u_msg_prio,
912 const struct timespec __user *u_abs_timeout) 912 const struct timespec __user *, u_abs_timeout)
913{ 913{
914 long timeout; 914 long timeout;
915 ssize_t ret; 915 ssize_t ret;
@@ -997,8 +997,8 @@ out:
997 * and he isn't currently owner of notification, will be silently discarded. 997 * and he isn't currently owner of notification, will be silently discarded.
998 * It isn't explicitly defined in the POSIX. 998 * It isn't explicitly defined in the POSIX.
999 */ 999 */
1000asmlinkage long sys_mq_notify(mqd_t mqdes, 1000SYSCALL_DEFINE2(mq_notify, mqd_t, mqdes,
1001 const struct sigevent __user *u_notification) 1001 const struct sigevent __user *, u_notification)
1002{ 1002{
1003 int ret; 1003 int ret;
1004 struct file *filp; 1004 struct file *filp;
@@ -1123,9 +1123,9 @@ out:
1123 return ret; 1123 return ret;
1124} 1124}
1125 1125
1126asmlinkage long sys_mq_getsetattr(mqd_t mqdes, 1126SYSCALL_DEFINE3(mq_getsetattr, mqd_t, mqdes,
1127 const struct mq_attr __user *u_mqstat, 1127 const struct mq_attr __user *, u_mqstat,
1128 struct mq_attr __user *u_omqstat) 1128 struct mq_attr __user *, u_omqstat)
1129{ 1129{
1130 int ret; 1130 int ret;
1131 struct mq_attr mqstat, omqstat; 1131 struct mq_attr mqstat, omqstat;
diff --git a/ipc/msg.c b/ipc/msg.c
index b4eee1c6101d..2ceab7f12fcb 100644
--- a/ipc/msg.c
+++ b/ipc/msg.c
@@ -309,7 +309,7 @@ static inline int msg_security(struct kern_ipc_perm *ipcp, int msgflg)
309 return security_msg_queue_associate(msq, msgflg); 309 return security_msg_queue_associate(msq, msgflg);
310} 310}
311 311
312asmlinkage long sys_msgget(key_t key, int msgflg) 312SYSCALL_DEFINE2(msgget, key_t, key, int, msgflg)
313{ 313{
314 struct ipc_namespace *ns; 314 struct ipc_namespace *ns;
315 struct ipc_ops msg_ops; 315 struct ipc_ops msg_ops;
@@ -466,7 +466,7 @@ out_up:
466 return err; 466 return err;
467} 467}
468 468
469asmlinkage long sys_msgctl(int msqid, int cmd, struct msqid_ds __user *buf) 469SYSCALL_DEFINE3(msgctl, int, msqid, int, cmd, struct msqid_ds __user *, buf)
470{ 470{
471 struct msg_queue *msq; 471 struct msg_queue *msq;
472 int err, version; 472 int err, version;
@@ -723,8 +723,8 @@ out_free:
723 return err; 723 return err;
724} 724}
725 725
726asmlinkage long 726SYSCALL_DEFINE4(msgsnd, int, msqid, struct msgbuf __user *, msgp, size_t, msgsz,
727sys_msgsnd(int msqid, struct msgbuf __user *msgp, size_t msgsz, int msgflg) 727 int, msgflg)
728{ 728{
729 long mtype; 729 long mtype;
730 730
@@ -904,8 +904,8 @@ out_unlock:
904 return msgsz; 904 return msgsz;
905} 905}
906 906
907asmlinkage long sys_msgrcv(int msqid, struct msgbuf __user *msgp, size_t msgsz, 907SYSCALL_DEFINE5(msgrcv, int, msqid, struct msgbuf __user *, msgp, size_t, msgsz,
908 long msgtyp, int msgflg) 908 long, msgtyp, int, msgflg)
909{ 909{
910 long err, mtype; 910 long err, mtype;
911 911
diff --git a/ipc/sem.c b/ipc/sem.c
index c68cd3f8f0c9..16a2189e96f9 100644
--- a/ipc/sem.c
+++ b/ipc/sem.c
@@ -308,7 +308,7 @@ static inline int sem_more_checks(struct kern_ipc_perm *ipcp,
308 return 0; 308 return 0;
309} 309}
310 310
311asmlinkage long sys_semget(key_t key, int nsems, int semflg) 311SYSCALL_DEFINE3(semget, key_t, key, int, nsems, int, semflg)
312{ 312{
313 struct ipc_namespace *ns; 313 struct ipc_namespace *ns;
314 struct ipc_ops sem_ops; 314 struct ipc_ops sem_ops;
@@ -887,7 +887,7 @@ out_up:
887 return err; 887 return err;
888} 888}
889 889
890asmlinkage long sys_semctl (int semid, int semnum, int cmd, union semun arg) 890SYSCALL_DEFINE(semctl)(int semid, int semnum, int cmd, union semun arg)
891{ 891{
892 int err = -EINVAL; 892 int err = -EINVAL;
893 int version; 893 int version;
@@ -923,6 +923,13 @@ asmlinkage long sys_semctl (int semid, int semnum, int cmd, union semun arg)
923 return -EINVAL; 923 return -EINVAL;
924 } 924 }
925} 925}
926#ifdef CONFIG_HAVE_SYSCALL_WRAPPERS
927asmlinkage long SyS_semctl(int semid, int semnum, int cmd, union semun arg)
928{
929 return SYSC_semctl((int) semid, (int) semnum, (int) cmd, arg);
930}
931SYSCALL_ALIAS(sys_semctl, SyS_semctl);
932#endif
926 933
927/* If the task doesn't already have a undo_list, then allocate one 934/* If the task doesn't already have a undo_list, then allocate one
928 * here. We guarantee there is only one thread using this undo list, 935 * here. We guarantee there is only one thread using this undo list,
@@ -1048,8 +1055,8 @@ out:
1048 return un; 1055 return un;
1049} 1056}
1050 1057
1051asmlinkage long sys_semtimedop(int semid, struct sembuf __user *tsops, 1058SYSCALL_DEFINE4(semtimedop, int, semid, struct sembuf __user *, tsops,
1052 unsigned nsops, const struct timespec __user *timeout) 1059 unsigned, nsops, const struct timespec __user *, timeout)
1053{ 1060{
1054 int error = -EINVAL; 1061 int error = -EINVAL;
1055 struct sem_array *sma; 1062 struct sem_array *sma;
@@ -1225,7 +1232,8 @@ out_free:
1225 return error; 1232 return error;
1226} 1233}
1227 1234
1228asmlinkage long sys_semop (int semid, struct sembuf __user *tsops, unsigned nsops) 1235SYSCALL_DEFINE3(semop, int, semid, struct sembuf __user *, tsops,
1236 unsigned, nsops)
1229{ 1237{
1230 return sys_semtimedop(semid, tsops, nsops, NULL); 1238 return sys_semtimedop(semid, tsops, nsops, NULL);
1231} 1239}
diff --git a/ipc/shm.c b/ipc/shm.c
index d0ab5527bf45..05d51d2a792c 100644
--- a/ipc/shm.c
+++ b/ipc/shm.c
@@ -340,6 +340,7 @@ static int newseg(struct ipc_namespace *ns, struct ipc_params *params)
340 struct file * file; 340 struct file * file;
341 char name[13]; 341 char name[13];
342 int id; 342 int id;
343 int acctflag = 0;
343 344
344 if (size < SHMMIN || size > ns->shm_ctlmax) 345 if (size < SHMMIN || size > ns->shm_ctlmax)
345 return -EINVAL; 346 return -EINVAL;
@@ -364,18 +365,19 @@ static int newseg(struct ipc_namespace *ns, struct ipc_params *params)
364 365
365 sprintf (name, "SYSV%08x", key); 366 sprintf (name, "SYSV%08x", key);
366 if (shmflg & SHM_HUGETLB) { 367 if (shmflg & SHM_HUGETLB) {
367 /* hugetlb_file_setup takes care of mlock user accounting */ 368 /* hugetlb_file_setup applies strict accounting */
368 file = hugetlb_file_setup(name, size); 369 if (shmflg & SHM_NORESERVE)
370 acctflag = VM_NORESERVE;
371 file = hugetlb_file_setup(name, size, acctflag);
369 shp->mlock_user = current_user(); 372 shp->mlock_user = current_user();
370 } else { 373 } else {
371 int acctflag = VM_ACCOUNT;
372 /* 374 /*
373 * Do not allow no accounting for OVERCOMMIT_NEVER, even 375 * Do not allow no accounting for OVERCOMMIT_NEVER, even
374 * if it's asked for. 376 * if it's asked for.
375 */ 377 */
376 if ((shmflg & SHM_NORESERVE) && 378 if ((shmflg & SHM_NORESERVE) &&
377 sysctl_overcommit_memory != OVERCOMMIT_NEVER) 379 sysctl_overcommit_memory != OVERCOMMIT_NEVER)
378 acctflag = 0; 380 acctflag = VM_NORESERVE;
379 file = shmem_file_setup(name, size, acctflag); 381 file = shmem_file_setup(name, size, acctflag);
380 } 382 }
381 error = PTR_ERR(file); 383 error = PTR_ERR(file);
@@ -440,7 +442,7 @@ static inline int shm_more_checks(struct kern_ipc_perm *ipcp,
440 return 0; 442 return 0;
441} 443}
442 444
443asmlinkage long sys_shmget (key_t key, size_t size, int shmflg) 445SYSCALL_DEFINE3(shmget, key_t, key, size_t, size, int, shmflg)
444{ 446{
445 struct ipc_namespace *ns; 447 struct ipc_namespace *ns;
446 struct ipc_ops shm_ops; 448 struct ipc_ops shm_ops;
@@ -565,11 +567,15 @@ static void shm_get_stat(struct ipc_namespace *ns, unsigned long *rss,
565 struct hstate *h = hstate_file(shp->shm_file); 567 struct hstate *h = hstate_file(shp->shm_file);
566 *rss += pages_per_huge_page(h) * mapping->nrpages; 568 *rss += pages_per_huge_page(h) * mapping->nrpages;
567 } else { 569 } else {
570#ifdef CONFIG_SHMEM
568 struct shmem_inode_info *info = SHMEM_I(inode); 571 struct shmem_inode_info *info = SHMEM_I(inode);
569 spin_lock(&info->lock); 572 spin_lock(&info->lock);
570 *rss += inode->i_mapping->nrpages; 573 *rss += inode->i_mapping->nrpages;
571 *swp += info->swapped; 574 *swp += info->swapped;
572 spin_unlock(&info->lock); 575 spin_unlock(&info->lock);
576#else
577 *rss += inode->i_mapping->nrpages;
578#endif
573 } 579 }
574 580
575 total++; 581 total++;
@@ -621,7 +627,7 @@ out_up:
621 return err; 627 return err;
622} 628}
623 629
624asmlinkage long sys_shmctl(int shmid, int cmd, struct shmid_ds __user *buf) 630SYSCALL_DEFINE3(shmctl, int, shmid, int, cmd, struct shmid_ds __user *, buf)
625{ 631{
626 struct shmid_kernel *shp; 632 struct shmid_kernel *shp;
627 int err, version; 633 int err, version;
@@ -939,7 +945,7 @@ out_put_dentry:
939 goto out_nattch; 945 goto out_nattch;
940} 946}
941 947
942asmlinkage long sys_shmat(int shmid, char __user *shmaddr, int shmflg) 948SYSCALL_DEFINE3(shmat, int, shmid, char __user *, shmaddr, int, shmflg)
943{ 949{
944 unsigned long ret; 950 unsigned long ret;
945 long err; 951 long err;
@@ -955,7 +961,7 @@ asmlinkage long sys_shmat(int shmid, char __user *shmaddr, int shmflg)
955 * detach and kill segment if marked destroyed. 961 * detach and kill segment if marked destroyed.
956 * The work is done in shm_close. 962 * The work is done in shm_close.
957 */ 963 */
958asmlinkage long sys_shmdt(char __user *shmaddr) 964SYSCALL_DEFINE1(shmdt, char __user *, shmaddr)
959{ 965{
960 struct mm_struct *mm = current->mm; 966 struct mm_struct *mm = current->mm;
961 struct vm_area_struct *vma, *next; 967 struct vm_area_struct *vma, *next;