diff options
Diffstat (limited to 'ipc/shm.c')
-rw-r--r-- | ipc/shm.c | 22 |
1 files changed, 10 insertions, 12 deletions
@@ -34,8 +34,6 @@ | |||
34 | 34 | ||
35 | #include "util.h" | 35 | #include "util.h" |
36 | 36 | ||
37 | #define shm_flags shm_perm.mode | ||
38 | |||
39 | static struct file_operations shm_file_operations; | 37 | static struct file_operations shm_file_operations; |
40 | static struct vm_operations_struct shm_vm_ops; | 38 | static struct vm_operations_struct shm_vm_ops; |
41 | 39 | ||
@@ -148,7 +146,7 @@ static void shm_close (struct vm_area_struct *shmd) | |||
148 | shp->shm_dtim = get_seconds(); | 146 | shp->shm_dtim = get_seconds(); |
149 | shp->shm_nattch--; | 147 | shp->shm_nattch--; |
150 | if(shp->shm_nattch == 0 && | 148 | if(shp->shm_nattch == 0 && |
151 | shp->shm_flags & SHM_DEST) | 149 | shp->shm_perm.mode & SHM_DEST) |
152 | shm_destroy (shp); | 150 | shm_destroy (shp); |
153 | else | 151 | else |
154 | shm_unlock(shp); | 152 | shm_unlock(shp); |
@@ -205,7 +203,7 @@ static int newseg (key_t key, int shmflg, size_t size) | |||
205 | return -ENOMEM; | 203 | return -ENOMEM; |
206 | 204 | ||
207 | shp->shm_perm.key = key; | 205 | shp->shm_perm.key = key; |
208 | shp->shm_flags = (shmflg & S_IRWXUGO); | 206 | shp->shm_perm.mode = (shmflg & S_IRWXUGO); |
209 | shp->mlock_user = NULL; | 207 | shp->mlock_user = NULL; |
210 | 208 | ||
211 | shp->shm_perm.security = NULL; | 209 | shp->shm_perm.security = NULL; |
@@ -345,7 +343,7 @@ static inline unsigned long copy_shmid_from_user(struct shm_setbuf *out, void __ | |||
345 | 343 | ||
346 | out->uid = tbuf.shm_perm.uid; | 344 | out->uid = tbuf.shm_perm.uid; |
347 | out->gid = tbuf.shm_perm.gid; | 345 | out->gid = tbuf.shm_perm.gid; |
348 | out->mode = tbuf.shm_flags; | 346 | out->mode = tbuf.shm_perm.mode; |
349 | 347 | ||
350 | return 0; | 348 | return 0; |
351 | } | 349 | } |
@@ -358,7 +356,7 @@ static inline unsigned long copy_shmid_from_user(struct shm_setbuf *out, void __ | |||
358 | 356 | ||
359 | out->uid = tbuf_old.shm_perm.uid; | 357 | out->uid = tbuf_old.shm_perm.uid; |
360 | out->gid = tbuf_old.shm_perm.gid; | 358 | out->gid = tbuf_old.shm_perm.gid; |
361 | out->mode = tbuf_old.shm_flags; | 359 | out->mode = tbuf_old.shm_perm.mode; |
362 | 360 | ||
363 | return 0; | 361 | return 0; |
364 | } | 362 | } |
@@ -560,13 +558,13 @@ asmlinkage long sys_shmctl (int shmid, int cmd, struct shmid_ds __user *buf) | |||
560 | if (!is_file_hugepages(shp->shm_file)) { | 558 | if (!is_file_hugepages(shp->shm_file)) { |
561 | err = shmem_lock(shp->shm_file, 1, user); | 559 | err = shmem_lock(shp->shm_file, 1, user); |
562 | if (!err) { | 560 | if (!err) { |
563 | shp->shm_flags |= SHM_LOCKED; | 561 | shp->shm_perm.mode |= SHM_LOCKED; |
564 | shp->mlock_user = user; | 562 | shp->mlock_user = user; |
565 | } | 563 | } |
566 | } | 564 | } |
567 | } else if (!is_file_hugepages(shp->shm_file)) { | 565 | } else if (!is_file_hugepages(shp->shm_file)) { |
568 | shmem_lock(shp->shm_file, 0, shp->mlock_user); | 566 | shmem_lock(shp->shm_file, 0, shp->mlock_user); |
569 | shp->shm_flags &= ~SHM_LOCKED; | 567 | shp->shm_perm.mode &= ~SHM_LOCKED; |
570 | shp->mlock_user = NULL; | 568 | shp->mlock_user = NULL; |
571 | } | 569 | } |
572 | shm_unlock(shp); | 570 | shm_unlock(shp); |
@@ -605,7 +603,7 @@ asmlinkage long sys_shmctl (int shmid, int cmd, struct shmid_ds __user *buf) | |||
605 | goto out_unlock_up; | 603 | goto out_unlock_up; |
606 | 604 | ||
607 | if (shp->shm_nattch){ | 605 | if (shp->shm_nattch){ |
608 | shp->shm_flags |= SHM_DEST; | 606 | shp->shm_perm.mode |= SHM_DEST; |
609 | /* Do not find it any more */ | 607 | /* Do not find it any more */ |
610 | shp->shm_perm.key = IPC_PRIVATE; | 608 | shp->shm_perm.key = IPC_PRIVATE; |
611 | shm_unlock(shp); | 609 | shm_unlock(shp); |
@@ -644,7 +642,7 @@ asmlinkage long sys_shmctl (int shmid, int cmd, struct shmid_ds __user *buf) | |||
644 | 642 | ||
645 | shp->shm_perm.uid = setbuf.uid; | 643 | shp->shm_perm.uid = setbuf.uid; |
646 | shp->shm_perm.gid = setbuf.gid; | 644 | shp->shm_perm.gid = setbuf.gid; |
647 | shp->shm_flags = (shp->shm_flags & ~S_IRWXUGO) | 645 | shp->shm_perm.mode = (shp->shm_perm.mode & ~S_IRWXUGO) |
648 | | (setbuf.mode & S_IRWXUGO); | 646 | | (setbuf.mode & S_IRWXUGO); |
649 | shp->shm_ctim = get_seconds(); | 647 | shp->shm_ctim = get_seconds(); |
650 | break; | 648 | break; |
@@ -777,7 +775,7 @@ invalid: | |||
777 | BUG(); | 775 | BUG(); |
778 | shp->shm_nattch--; | 776 | shp->shm_nattch--; |
779 | if(shp->shm_nattch == 0 && | 777 | if(shp->shm_nattch == 0 && |
780 | shp->shm_flags & SHM_DEST) | 778 | shp->shm_perm.mode & SHM_DEST) |
781 | shm_destroy (shp); | 779 | shm_destroy (shp); |
782 | else | 780 | else |
783 | shm_unlock(shp); | 781 | shm_unlock(shp); |
@@ -902,7 +900,7 @@ static int sysvipc_shm_proc_show(struct seq_file *s, void *it) | |||
902 | return seq_printf(s, format, | 900 | return seq_printf(s, format, |
903 | shp->shm_perm.key, | 901 | shp->shm_perm.key, |
904 | shp->id, | 902 | shp->id, |
905 | shp->shm_flags, | 903 | shp->shm_perm.mode, |
906 | shp->shm_segsz, | 904 | shp->shm_segsz, |
907 | shp->shm_cprid, | 905 | shp->shm_cprid, |
908 | shp->shm_lprid, | 906 | shp->shm_lprid, |