[PATCH] consolidate sys_shmat

Signed-off-by: Stephen Rothwell <sfr@canb.auug.org.au>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
This commit is contained in:
Stephen Rothwell 2005-05-01 08:59:12 -07:00 committed by Linus Torvalds
parent 434498d532
commit 7d87e14c23
17 changed files with 21 additions and 106 deletions

View File

@ -457,22 +457,6 @@ osf_getdomainname(char __user *name, int namelen)
return 0; return 0;
} }
asmlinkage long
osf_shmat(int shmid, void __user *shmaddr, int shmflg)
{
unsigned long raddr;
long err;
err = do_shmat(shmid, shmaddr, shmflg, &raddr);
/*
* This works because all user-level addresses are
* non-negative longs!
*/
return err ? err : (long)raddr;
}
/* /*
* The following stuff should move into a header file should it ever * The following stuff should move into a header file should it ever
* be labeled "officially supported." Right now, there is just enough * be labeled "officially supported." Right now, there is just enough

View File

@ -227,7 +227,7 @@ sys_call_table:
.quad sys_semop .quad sys_semop
.quad osf_utsname .quad osf_utsname
.quad sys_lchown .quad sys_lchown
.quad osf_shmat .quad sys_shmat
.quad sys_shmctl /* 210 */ .quad sys_shmctl /* 210 */
.quad sys_shmdt .quad sys_shmdt
.quad sys_shmget .quad sys_shmget

View File

@ -227,18 +227,6 @@ asmlinkage int sys_ipc(uint call, int first, int second, int third,
} }
} }
asmlinkage long sys_shmat(int shmid, char __user *shmaddr, int shmflg,
unsigned long __user *addr)
{
unsigned long ret;
long err;
err = do_shmat(shmid, shmaddr, shmflg, &ret);
if (err == 0)
err = put_user(ret, addr);
return err;
}
/* Fork a new task - this creates a new program thread. /* Fork a new task - this creates a new program thread.
* This is called indirectly via a small wrapper * This is called indirectly via a small wrapper
*/ */

View File

@ -1417,7 +1417,7 @@ sys_call_table:
data8 sys_msgrcv data8 sys_msgrcv
data8 sys_msgctl data8 sys_msgctl
data8 sys_shmget data8 sys_shmget
data8 ia64_shmat data8 sys_shmat
data8 sys_shmdt // 1115 data8 sys_shmdt // 1115
data8 sys_shmctl data8 sys_shmctl
data8 sys_syslog data8 sys_syslog

View File

@ -92,20 +92,6 @@ sys_getpagesize (void)
return PAGE_SIZE; return PAGE_SIZE;
} }
asmlinkage unsigned long
ia64_shmat (int shmid, void __user *shmaddr, int shmflg)
{
unsigned long raddr;
int retval;
retval = do_shmat(shmid, shmaddr, shmflg, &raddr);
if (retval < 0)
return retval;
force_successful_syscall_return();
return raddr;
}
asmlinkage unsigned long asmlinkage unsigned long
ia64_brk (unsigned long brk) ia64_brk (unsigned long brk)
{ {

View File

@ -373,22 +373,6 @@ asmlinkage int sys_ipc (uint call, int first, int second,
} }
} }
/*
* Native ABI that is O32 or N64 version
*/
asmlinkage long sys_shmat(int shmid, char __user *shmaddr,
int shmflg, unsigned long *addr)
{
unsigned long raddr;
int err;
err = do_shmat(shmid, shmaddr, shmflg, &raddr);
if (err)
return err;
return put_user(raddr, addr);
}
/* /*
* No implemented yet ... * No implemented yet ...
*/ */

View File

@ -161,17 +161,6 @@ asmlinkage unsigned long sys_mmap(unsigned long addr, unsigned long len,
} }
} }
long sys_shmat_wrapper(int shmid, char __user *shmaddr, int shmflag)
{
unsigned long raddr;
int r;
r = do_shmat(shmid, shmaddr, shmflag, &raddr);
if (r < 0)
return r;
return raddr;
}
/* Fucking broken ABI */ /* Fucking broken ABI */
#ifdef CONFIG_64BIT #ifdef CONFIG_64BIT

View File

@ -297,7 +297,7 @@
ENTRY_DIFF(msgrcv) ENTRY_DIFF(msgrcv)
ENTRY_SAME(msgget) /* 190 */ ENTRY_SAME(msgget) /* 190 */
ENTRY_SAME(msgctl) ENTRY_SAME(msgctl)
ENTRY_SAME(shmat_wrapper) ENTRY_SAME(shmat)
ENTRY_SAME(shmdt) ENTRY_SAME(shmdt)
ENTRY_SAME(shmget) ENTRY_SAME(shmget)
ENTRY_SAME(shmctl) /* 195 */ ENTRY_SAME(shmctl) /* 195 */

View File

@ -283,18 +283,3 @@ asmlinkage int sys_uname(struct old_utsname * name)
up_read(&uts_sem); up_read(&uts_sem);
return err?-EFAULT:0; return err?-EFAULT:0;
} }
/* Copy from mips version */
asmlinkage long sys_shmatcall(int shmid, char __user *shmaddr,
int shmflg)
{
unsigned long raddr;
int err;
err = do_shmat(shmid, shmaddr, shmflg, &raddr);
if (err)
return err;
err = raddr;
return err;
}

View File

@ -268,7 +268,7 @@ sys_call_table:
.long sys_msgrcv .long sys_msgrcv
.long sys_msgget .long sys_msgget
.long sys_msgctl .long sys_msgctl
.long sys_shmatcall .long sys_shmat
.long sys_shmdt /* 245 */ .long sys_shmdt /* 245 */
.long sys_shmget .long sys_shmget
.long sys_shmctl .long sys_shmctl

View File

@ -26,7 +26,6 @@ extern syscall_handler_t *ia32_sys_call_table[];
extern long old_mmap(unsigned long addr, unsigned long len, extern long old_mmap(unsigned long addr, unsigned long len,
unsigned long prot, unsigned long flags, unsigned long prot, unsigned long flags,
unsigned long fd, unsigned long pgoff); unsigned long fd, unsigned long pgoff);
extern syscall_handler_t wrap_sys_shmat;
extern syscall_handler_t sys_modify_ldt; extern syscall_handler_t sys_modify_ldt;
extern syscall_handler_t sys_arch_prctl; extern syscall_handler_t sys_arch_prctl;

View File

@ -14,14 +14,6 @@
#include "asm/prctl.h" /* XXX This should get the constants from libc */ #include "asm/prctl.h" /* XXX This should get the constants from libc */
#include "choose-mode.h" #include "choose-mode.h"
/* XXX: copied from x86-64: arch/x86_64/kernel/sys_x86_64.c */
asmlinkage long wrap_sys_shmat(int shmid, char __user *shmaddr, int shmflg)
{
unsigned long raddr;
return do_shmat(shmid, shmaddr, shmflg, &raddr) ?: (long) raddr;
}
asmlinkage long sys_uname64(struct new_utsname __user * name) asmlinkage long sys_uname64(struct new_utsname __user * name)
{ {
int err; int err;

View File

@ -152,12 +152,6 @@ asmlinkage long sys_uname(struct new_utsname __user * name)
return err ? -EFAULT : 0; return err ? -EFAULT : 0;
} }
asmlinkage long wrap_sys_shmat(int shmid, char __user *shmaddr, int shmflg)
{
unsigned long raddr;
return do_shmat(shmid,shmaddr,shmflg,&raddr) ?: (long)raddr;
}
asmlinkage long sys_time64(long __user * tloc) asmlinkage long sys_time64(long __user * tloc)
{ {
struct timeval now; struct timeval now;

View File

@ -76,7 +76,7 @@ __SYSCALL(__NR_madvise, sys_madvise)
#define __NR_shmget 29 #define __NR_shmget 29
__SYSCALL(__NR_shmget, sys_shmget) __SYSCALL(__NR_shmget, sys_shmget)
#define __NR_shmat 30 #define __NR_shmat 30
__SYSCALL(__NR_shmat, wrap_sys_shmat) __SYSCALL(__NR_shmat, sys_shmat)
#define __NR_shmctl 31 #define __NR_shmctl 31
__SYSCALL(__NR_shmctl, sys_shmctl) __SYSCALL(__NR_shmctl, sys_shmctl)

View File

@ -456,8 +456,7 @@ asmlinkage long sys_semctl(int semid, int semnum, int cmd, union semun arg);
asmlinkage long sys_semtimedop(int semid, struct sembuf __user *sops, asmlinkage long sys_semtimedop(int semid, struct sembuf __user *sops,
unsigned nsops, unsigned nsops,
const struct timespec __user *timeout); const struct timespec __user *timeout);
asmlinkage long sys_shmat(int shmid, char __user *shmaddr, asmlinkage long sys_shmat(int shmid, char __user *shmaddr, int shmflg);
int shmflg, unsigned long __user *addr);
asmlinkage long sys_shmget(key_t key, size_t size, int flag); asmlinkage long sys_shmget(key_t key, size_t size, int flag);
asmlinkage long sys_shmdt(char __user *shmaddr); asmlinkage long sys_shmdt(char __user *shmaddr);
asmlinkage long sys_shmctl(int shmid, int cmd, struct shmid_ds __user *buf); asmlinkage long sys_shmctl(int shmid, int cmd, struct shmid_ds __user *buf);

View File

@ -28,6 +28,8 @@
#include <linux/security.h> #include <linux/security.h>
#include <linux/syscalls.h> #include <linux/syscalls.h>
#include <linux/audit.h> #include <linux/audit.h>
#include <linux/ptrace.h>
#include <asm/uaccess.h> #include <asm/uaccess.h>
#include "util.h" #include "util.h"
@ -771,6 +773,18 @@ long do_shmat(int shmid, char __user *shmaddr, int shmflg, ulong *raddr)
return err; return err;
} }
asmlinkage long sys_shmat(int shmid, char __user *shmaddr, int shmflg)
{
unsigned long ret;
long err;
err = do_shmat(shmid, shmaddr, shmflg, &ret);
if (err)
return err;
force_successful_syscall_return();
return (long)ret;
}
/* /*
* detach and kill segment if marked destroyed. * detach and kill segment if marked destroyed.
* The work is done in shm_close. * The work is done in shm_close.

View File

@ -52,6 +52,7 @@ cond_syscall(sys_msgsnd);
cond_syscall(sys_msgrcv); cond_syscall(sys_msgrcv);
cond_syscall(sys_msgctl); cond_syscall(sys_msgctl);
cond_syscall(sys_shmget); cond_syscall(sys_shmget);
cond_syscall(sys_shmat);
cond_syscall(sys_shmdt); cond_syscall(sys_shmdt);
cond_syscall(sys_shmctl); cond_syscall(sys_shmctl);
cond_syscall(sys_mq_open); cond_syscall(sys_mq_open);