提交 7d87e14c 编写于 作者: S Stephen Rothwell 提交者: Linus Torvalds

[PATCH] consolidate sys_shmat

Signed-off-by: NStephen Rothwell <sfr@canb.auug.org.au>
Signed-off-by: NAndrew Morton <akpm@osdl.org>
Signed-off-by: NLinus Torvalds <torvalds@osdl.org>
上级 434498d5
......@@ -457,22 +457,6 @@ osf_getdomainname(char __user *name, int namelen)
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
* be labeled "officially supported." Right now, there is just enough
......
......@@ -227,7 +227,7 @@ sys_call_table:
.quad sys_semop
.quad osf_utsname
.quad sys_lchown
.quad osf_shmat
.quad sys_shmat
.quad sys_shmctl /* 210 */
.quad sys_shmdt
.quad sys_shmget
......
......@@ -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.
* This is called indirectly via a small wrapper
*/
......
......@@ -1417,7 +1417,7 @@ sys_call_table:
data8 sys_msgrcv
data8 sys_msgctl
data8 sys_shmget
data8 ia64_shmat
data8 sys_shmat
data8 sys_shmdt // 1115
data8 sys_shmctl
data8 sys_syslog
......
......@@ -92,20 +92,6 @@ sys_getpagesize (void)
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
ia64_brk (unsigned long brk)
{
......
......@@ -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 ...
*/
......
......@@ -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 */
#ifdef CONFIG_64BIT
......
......@@ -297,7 +297,7 @@
ENTRY_DIFF(msgrcv)
ENTRY_SAME(msgget) /* 190 */
ENTRY_SAME(msgctl)
ENTRY_SAME(shmat_wrapper)
ENTRY_SAME(shmat)
ENTRY_SAME(shmdt)
ENTRY_SAME(shmget)
ENTRY_SAME(shmctl) /* 195 */
......
......@@ -283,18 +283,3 @@ asmlinkage int sys_uname(struct old_utsname * name)
up_read(&uts_sem);
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;
}
......@@ -268,7 +268,7 @@ sys_call_table:
.long sys_msgrcv
.long sys_msgget
.long sys_msgctl
.long sys_shmatcall
.long sys_shmat
.long sys_shmdt /* 245 */
.long sys_shmget
.long sys_shmctl
......
......@@ -26,7 +26,6 @@ extern syscall_handler_t *ia32_sys_call_table[];
extern long old_mmap(unsigned long addr, unsigned long len,
unsigned long prot, unsigned long flags,
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_arch_prctl;
......
......@@ -14,14 +14,6 @@
#include "asm/prctl.h" /* XXX This should get the constants from libc */
#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)
{
int err;
......
......@@ -152,12 +152,6 @@ asmlinkage long sys_uname(struct new_utsname __user * name)
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)
{
struct timeval now;
......
......@@ -76,7 +76,7 @@ __SYSCALL(__NR_madvise, sys_madvise)
#define __NR_shmget 29
__SYSCALL(__NR_shmget, sys_shmget)
#define __NR_shmat 30
__SYSCALL(__NR_shmat, wrap_sys_shmat)
__SYSCALL(__NR_shmat, sys_shmat)
#define __NR_shmctl 31
__SYSCALL(__NR_shmctl, sys_shmctl)
......
......@@ -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,
unsigned nsops,
const struct timespec __user *timeout);
asmlinkage long sys_shmat(int shmid, char __user *shmaddr,
int shmflg, unsigned long __user *addr);
asmlinkage long sys_shmat(int shmid, char __user *shmaddr, int shmflg);
asmlinkage long sys_shmget(key_t key, size_t size, int flag);
asmlinkage long sys_shmdt(char __user *shmaddr);
asmlinkage long sys_shmctl(int shmid, int cmd, struct shmid_ds __user *buf);
......
......@@ -28,6 +28,8 @@
#include <linux/security.h>
#include <linux/syscalls.h>
#include <linux/audit.h>
#include <linux/ptrace.h>
#include <asm/uaccess.h>
#include "util.h"
......@@ -771,6 +773,18 @@ long do_shmat(int shmid, char __user *shmaddr, int shmflg, ulong *raddr)
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.
* The work is done in shm_close.
......
......@@ -52,6 +52,7 @@ cond_syscall(sys_msgsnd);
cond_syscall(sys_msgrcv);
cond_syscall(sys_msgctl);
cond_syscall(sys_shmget);
cond_syscall(sys_shmat);
cond_syscall(sys_shmdt);
cond_syscall(sys_shmctl);
cond_syscall(sys_mq_open);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册