aboutsummaryrefslogtreecommitdiffstats
path: root/arch/mips/kernel
diff options
context:
space:
mode:
authorRalf Baechle <ralf@linux-mips.org>2007-02-26 20:11:28 -0500
committerRalf Baechle <ralf@linux-mips.org>2007-03-04 14:02:30 -0500
commit08274cefdc9efe709540be5d8e7c002346592d6d (patch)
treea1f17091927262fda2327feb4c7e4315ee681fd2 /arch/mips/kernel
parent440537ef409c7013134116a7ca155d43d25eb492 (diff)
[MIPS] Replace sys32_socketcall with the generic compat_sys_socketcall.
Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
Diffstat (limited to 'arch/mips/kernel')
-rw-r--r--arch/mips/kernel/linux32.c114
-rw-r--r--arch/mips/kernel/scall64-o32.S2
2 files changed, 1 insertions, 115 deletions
diff --git a/arch/mips/kernel/linux32.c b/arch/mips/kernel/linux32.c
index 9e8100a214c4..b701ecb47cbd 100644
--- a/arch/mips/kernel/linux32.c
+++ b/arch/mips/kernel/linux32.c
@@ -544,120 +544,6 @@ asmlinkage long sys32_sync_file_range(int fd, int __pad,
544 flags); 544 flags);
545} 545}
546 546
547/* Argument list sizes for sys_socketcall */
548#define AL(x) ((x) * sizeof(unsigned int))
549static unsigned char socketcall_nargs[18]={AL(0),AL(3),AL(3),AL(3),AL(2),AL(3),
550 AL(3),AL(3),AL(4),AL(4),AL(4),AL(6),
551 AL(6),AL(2),AL(5),AL(5),AL(3),AL(3)};
552#undef AL
553
554/*
555 * System call vectors.
556 *
557 * Argument checking cleaned up. Saved 20% in size.
558 * This function doesn't need to set the kernel lock because
559 * it is set by the callees.
560 */
561
562asmlinkage long sys32_socketcall(int call, unsigned int __user *args32)
563{
564 unsigned int a[6];
565 unsigned int a0,a1;
566 int err;
567
568 extern asmlinkage long sys_socket(int family, int type, int protocol);
569 extern asmlinkage long sys_bind(int fd, struct sockaddr __user *umyaddr, int addrlen);
570 extern asmlinkage long sys_connect(int fd, struct sockaddr __user *uservaddr, int addrlen);
571 extern asmlinkage long sys_listen(int fd, int backlog);
572 extern asmlinkage long sys_accept(int fd, struct sockaddr __user *upeer_sockaddr, int __user *upeer_addrlen);
573 extern asmlinkage long sys_getsockname(int fd, struct sockaddr __user *usockaddr, int __user *usockaddr_len);
574 extern asmlinkage long sys_getpeername(int fd, struct sockaddr __user *usockaddr, int __user *usockaddr_len);
575 extern asmlinkage long sys_socketpair(int family, int type, int protocol, int __user *usockvec);
576 extern asmlinkage long sys_send(int fd, void __user * buff, size_t len, unsigned flags);
577 extern asmlinkage long sys_sendto(int fd, void __user * buff, size_t len, unsigned flags,
578 struct sockaddr __user *addr, int addr_len);
579 extern asmlinkage long sys_recv(int fd, void __user * ubuf, size_t size, unsigned flags);
580 extern asmlinkage long sys_recvfrom(int fd, void __user * ubuf, size_t size, unsigned flags,
581 struct sockaddr __user *addr, int __user *addr_len);
582 extern asmlinkage long sys_shutdown(int fd, int how);
583 extern asmlinkage long sys_setsockopt(int fd, int level, int optname, char __user *optval, int optlen);
584 extern asmlinkage long sys_getsockopt(int fd, int level, int optname, char __user *optval, int __user *optlen);
585 extern asmlinkage long sys_sendmsg(int fd, struct msghdr __user *msg, unsigned flags);
586 extern asmlinkage long sys_recvmsg(int fd, struct msghdr __user *msg, unsigned int flags);
587
588
589 if(call<1||call>SYS_RECVMSG)
590 return -EINVAL;
591
592 /* copy_from_user should be SMP safe. */
593 if (copy_from_user(a, args32, socketcall_nargs[call]))
594 return -EFAULT;
595
596 a0=a[0];
597 a1=a[1];
598
599 switch(call)
600 {
601 case SYS_SOCKET:
602 err = sys_socket(a0,a1,a[2]);
603 break;
604 case SYS_BIND:
605 err = sys_bind(a0,(struct sockaddr __user *)A(a1), a[2]);
606 break;
607 case SYS_CONNECT:
608 err = sys_connect(a0, (struct sockaddr __user *)A(a1), a[2]);
609 break;
610 case SYS_LISTEN:
611 err = sys_listen(a0,a1);
612 break;
613 case SYS_ACCEPT:
614 err = sys_accept(a0,(struct sockaddr __user *)A(a1), (int __user *)A(a[2]));
615 break;
616 case SYS_GETSOCKNAME:
617 err = sys_getsockname(a0,(struct sockaddr __user *)A(a1), (int __user *)A(a[2]));
618 break;
619 case SYS_GETPEERNAME:
620 err = sys_getpeername(a0, (struct sockaddr __user *)A(a1), (int __user *)A(a[2]));
621 break;
622 case SYS_SOCKETPAIR:
623 err = sys_socketpair(a0,a1, a[2], (int __user *)A(a[3]));
624 break;
625 case SYS_SEND:
626 err = sys_send(a0, (void __user *)A(a1), a[2], a[3]);
627 break;
628 case SYS_SENDTO:
629 err = sys_sendto(a0,(void __user *)A(a1), a[2], a[3],
630 (struct sockaddr __user *)A(a[4]), a[5]);
631 break;
632 case SYS_RECV:
633 err = sys_recv(a0, (void __user *)A(a1), a[2], a[3]);
634 break;
635 case SYS_RECVFROM:
636 err = sys_recvfrom(a0, (void __user *)A(a1), a[2], a[3],
637 (struct sockaddr __user *)A(a[4]), (int __user *)A(a[5]));
638 break;
639 case SYS_SHUTDOWN:
640 err = sys_shutdown(a0,a1);
641 break;
642 case SYS_SETSOCKOPT:
643 err = sys_setsockopt(a0, a1, a[2], (char __user *)A(a[3]), a[4]);
644 break;
645 case SYS_GETSOCKOPT:
646 err = sys_getsockopt(a0, a1, a[2], (char __user *)A(a[3]), (int __user *)A(a[4]));
647 break;
648 case SYS_SENDMSG:
649 err = sys_sendmsg(a0, (struct msghdr __user *) A(a1), a[2]);
650 break;
651 case SYS_RECVMSG:
652 err = sys_recvmsg(a0, (struct msghdr __user *) A(a1), a[2]);
653 break;
654 default:
655 err = -EINVAL;
656 break;
657 }
658 return err;
659}
660
661struct sigevent32 { 547struct sigevent32 {
662 u32 sigev_value; 548 u32 sigev_value;
663 u32 sigev_signo; 549 u32 sigev_signo;
diff --git a/arch/mips/kernel/scall64-o32.S b/arch/mips/kernel/scall64-o32.S
index bcc42489dc3c..70e223352fe2 100644
--- a/arch/mips/kernel/scall64-o32.S
+++ b/arch/mips/kernel/scall64-o32.S
@@ -307,7 +307,7 @@ sys_call_table:
307 PTR compat_sys_statfs 307 PTR compat_sys_statfs
308 PTR compat_sys_fstatfs /* 4100 */ 308 PTR compat_sys_fstatfs /* 4100 */
309 PTR sys_ni_syscall /* sys_ioperm */ 309 PTR sys_ni_syscall /* sys_ioperm */
310 PTR sys32_socketcall 310 PTR compat_sys_socketcall
311 PTR sys_syslog 311 PTR sys_syslog
312 PTR compat_sys_setitimer 312 PTR compat_sys_setitimer
313 PTR compat_sys_getitimer /* 4105 */ 313 PTR compat_sys_getitimer /* 4105 */