[MIPS] Replace sys32_socketcall with the generic compat_sys_socketcall.
Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
This commit is contained in:
parent
440537ef40
commit
08274cefdc
|
@ -544,120 +544,6 @@ asmlinkage long sys32_sync_file_range(int fd, int __pad,
|
|||
flags);
|
||||
}
|
||||
|
||||
/* Argument list sizes for sys_socketcall */
|
||||
#define AL(x) ((x) * sizeof(unsigned int))
|
||||
static unsigned char socketcall_nargs[18]={AL(0),AL(3),AL(3),AL(3),AL(2),AL(3),
|
||||
AL(3),AL(3),AL(4),AL(4),AL(4),AL(6),
|
||||
AL(6),AL(2),AL(5),AL(5),AL(3),AL(3)};
|
||||
#undef AL
|
||||
|
||||
/*
|
||||
* System call vectors.
|
||||
*
|
||||
* Argument checking cleaned up. Saved 20% in size.
|
||||
* This function doesn't need to set the kernel lock because
|
||||
* it is set by the callees.
|
||||
*/
|
||||
|
||||
asmlinkage long sys32_socketcall(int call, unsigned int __user *args32)
|
||||
{
|
||||
unsigned int a[6];
|
||||
unsigned int a0,a1;
|
||||
int err;
|
||||
|
||||
extern asmlinkage long sys_socket(int family, int type, int protocol);
|
||||
extern asmlinkage long sys_bind(int fd, struct sockaddr __user *umyaddr, int addrlen);
|
||||
extern asmlinkage long sys_connect(int fd, struct sockaddr __user *uservaddr, int addrlen);
|
||||
extern asmlinkage long sys_listen(int fd, int backlog);
|
||||
extern asmlinkage long sys_accept(int fd, struct sockaddr __user *upeer_sockaddr, int __user *upeer_addrlen);
|
||||
extern asmlinkage long sys_getsockname(int fd, struct sockaddr __user *usockaddr, int __user *usockaddr_len);
|
||||
extern asmlinkage long sys_getpeername(int fd, struct sockaddr __user *usockaddr, int __user *usockaddr_len);
|
||||
extern asmlinkage long sys_socketpair(int family, int type, int protocol, int __user *usockvec);
|
||||
extern asmlinkage long sys_send(int fd, void __user * buff, size_t len, unsigned flags);
|
||||
extern asmlinkage long sys_sendto(int fd, void __user * buff, size_t len, unsigned flags,
|
||||
struct sockaddr __user *addr, int addr_len);
|
||||
extern asmlinkage long sys_recv(int fd, void __user * ubuf, size_t size, unsigned flags);
|
||||
extern asmlinkage long sys_recvfrom(int fd, void __user * ubuf, size_t size, unsigned flags,
|
||||
struct sockaddr __user *addr, int __user *addr_len);
|
||||
extern asmlinkage long sys_shutdown(int fd, int how);
|
||||
extern asmlinkage long sys_setsockopt(int fd, int level, int optname, char __user *optval, int optlen);
|
||||
extern asmlinkage long sys_getsockopt(int fd, int level, int optname, char __user *optval, int __user *optlen);
|
||||
extern asmlinkage long sys_sendmsg(int fd, struct msghdr __user *msg, unsigned flags);
|
||||
extern asmlinkage long sys_recvmsg(int fd, struct msghdr __user *msg, unsigned int flags);
|
||||
|
||||
|
||||
if(call<1||call>SYS_RECVMSG)
|
||||
return -EINVAL;
|
||||
|
||||
/* copy_from_user should be SMP safe. */
|
||||
if (copy_from_user(a, args32, socketcall_nargs[call]))
|
||||
return -EFAULT;
|
||||
|
||||
a0=a[0];
|
||||
a1=a[1];
|
||||
|
||||
switch(call)
|
||||
{
|
||||
case SYS_SOCKET:
|
||||
err = sys_socket(a0,a1,a[2]);
|
||||
break;
|
||||
case SYS_BIND:
|
||||
err = sys_bind(a0,(struct sockaddr __user *)A(a1), a[2]);
|
||||
break;
|
||||
case SYS_CONNECT:
|
||||
err = sys_connect(a0, (struct sockaddr __user *)A(a1), a[2]);
|
||||
break;
|
||||
case SYS_LISTEN:
|
||||
err = sys_listen(a0,a1);
|
||||
break;
|
||||
case SYS_ACCEPT:
|
||||
err = sys_accept(a0,(struct sockaddr __user *)A(a1), (int __user *)A(a[2]));
|
||||
break;
|
||||
case SYS_GETSOCKNAME:
|
||||
err = sys_getsockname(a0,(struct sockaddr __user *)A(a1), (int __user *)A(a[2]));
|
||||
break;
|
||||
case SYS_GETPEERNAME:
|
||||
err = sys_getpeername(a0, (struct sockaddr __user *)A(a1), (int __user *)A(a[2]));
|
||||
break;
|
||||
case SYS_SOCKETPAIR:
|
||||
err = sys_socketpair(a0,a1, a[2], (int __user *)A(a[3]));
|
||||
break;
|
||||
case SYS_SEND:
|
||||
err = sys_send(a0, (void __user *)A(a1), a[2], a[3]);
|
||||
break;
|
||||
case SYS_SENDTO:
|
||||
err = sys_sendto(a0,(void __user *)A(a1), a[2], a[3],
|
||||
(struct sockaddr __user *)A(a[4]), a[5]);
|
||||
break;
|
||||
case SYS_RECV:
|
||||
err = sys_recv(a0, (void __user *)A(a1), a[2], a[3]);
|
||||
break;
|
||||
case SYS_RECVFROM:
|
||||
err = sys_recvfrom(a0, (void __user *)A(a1), a[2], a[3],
|
||||
(struct sockaddr __user *)A(a[4]), (int __user *)A(a[5]));
|
||||
break;
|
||||
case SYS_SHUTDOWN:
|
||||
err = sys_shutdown(a0,a1);
|
||||
break;
|
||||
case SYS_SETSOCKOPT:
|
||||
err = sys_setsockopt(a0, a1, a[2], (char __user *)A(a[3]), a[4]);
|
||||
break;
|
||||
case SYS_GETSOCKOPT:
|
||||
err = sys_getsockopt(a0, a1, a[2], (char __user *)A(a[3]), (int __user *)A(a[4]));
|
||||
break;
|
||||
case SYS_SENDMSG:
|
||||
err = sys_sendmsg(a0, (struct msghdr __user *) A(a1), a[2]);
|
||||
break;
|
||||
case SYS_RECVMSG:
|
||||
err = sys_recvmsg(a0, (struct msghdr __user *) A(a1), a[2]);
|
||||
break;
|
||||
default:
|
||||
err = -EINVAL;
|
||||
break;
|
||||
}
|
||||
return err;
|
||||
}
|
||||
|
||||
struct sigevent32 {
|
||||
u32 sigev_value;
|
||||
u32 sigev_signo;
|
||||
|
|
|
@ -307,7 +307,7 @@ sys_call_table:
|
|||
PTR compat_sys_statfs
|
||||
PTR compat_sys_fstatfs /* 4100 */
|
||||
PTR sys_ni_syscall /* sys_ioperm */
|
||||
PTR sys32_socketcall
|
||||
PTR compat_sys_socketcall
|
||||
PTR sys_syslog
|
||||
PTR compat_sys_setitimer
|
||||
PTR compat_sys_getitimer /* 4105 */
|
||||
|
|
Loading…
Reference in New Issue