Beispiel #1
0
static void rst_tcp_repair_off(struct rst_tcp_sock *rts)
{
	int aux, ret;

	aux = rts->reuseaddr;
	pr_debug("pie: Turning repair off for %d (reuse %d)\n", rts->sk, aux);
	tcp_repair_off(rts->sk);

	ret = sys_setsockopt(rts->sk, SOL_SOCKET, SO_REUSEADDR, &aux, sizeof(aux));
	if (ret < 0)
		pr_perror("Failed to restore of SO_REUSEADDR on socket (%d)", ret);
}
Beispiel #2
0
asmlinkage int sunos_setsockopt(int fd, int level, int optname, u32 optval,
				int optlen)
{
	int tr_opt = optname;
	int ret;

	if (level == SOL_IP) {
		/* Multicast socketopts (ttl, membership) */
		if (tr_opt >=2 && tr_opt <= 6)
			tr_opt += 30;
	}
	ret = sys_setsockopt(fd, level, tr_opt, (char *)A(optval), optlen);
	return ret;
}
Beispiel #3
0
Datei: dev9.c Projekt: kyuba/dev9
static void connect_to_netlink(struct dfs *fs)
{
    struct sockaddr_nl nls = { 0, 0, 0, 0 };
    int fd;
    struct io *io;
    int newlength = NETLINK_BUFFER;
    struct exec_context *context;

    nls.nl_family = AF_NETLINK;
    nls.nl_pid = sys_getpid();
    nls.nl_groups = -1;

    fd = sys_socket(PF_NETLINK, SOCK_DGRAM, NETLINK_KOBJECT_UEVENT);

    if (fd < 0) { cexit (17); }

    if (sys_bind(fd, (void *)&nls, sizeof(struct sockaddr_nl)) < 0) {
        cexit (18);
    }

    if (sys_setsockopt (fd, SOL_SOCKET, SO_RCVBUF, (char *)&newlength,
                        sizeof (int)) < 0) {
        cexit(19);
    }

    if (sys_fcntl (fd, F_SETFD, FD_CLOEXEC) < 0) {
        cexit(20);
    }

    if (sys_fcntl(fd, F_SETFL, O_NONBLOCK) < 0) {
        cexit(21);
    }

    io = io_open (fd);
    io->type = iot_read;

    multiplex_add_io (io, on_netlink_read, on_netlink_close, (void *)fs);

    context = execute(EXEC_CALL_NO_IO, (char **)0, (char **)0);
    switch (context->pid)
    {
        case -1:
            cexit (25);
        case 0:
            ping_for_uevents ("/sys/(bus|class|block)/.+/.+/uevent");
            cexit (0);
        default:
            multiplex_add_process(context, mx_on_subprocess_death, (void *)0);
    }
}
Beispiel #4
0
asmlinkage long compat_sys_setsockopt(int fd, int level, int optname,
				char __user *optval, int optlen)
{
	/* SO_SET_REPLACE seems to be the same in all levels */
	if (optname == IPT_SO_SET_REPLACE)
		return do_netfilter_replace(fd, level, optname,
					    optval, optlen);
	if (level == SOL_SOCKET && optname == SO_ATTACH_FILTER)
		return do_set_attach_filter(fd, level, optname,
					    optval, optlen);
	if (level == SOL_SOCKET &&
	    (optname == SO_RCVTIMEO || optname == SO_SNDTIMEO))
		return do_set_sock_timeout(fd, level, optname, optval, optlen);

	return sys_setsockopt(fd, level, optname, optval, optlen);
}
Beispiel #5
0
int 
setsockopt(int s, int level, int name, const void *val, socklen_t valsize)
{
    struct sys_setsockopt_args args;
    int res, error;
    SYSCALLARG(args,s) = s;
    SYSCALLARG(args,level) = level;
    SYSCALLARG(args,name) = name;
    SYSCALLARG(args,val) = val;
    SYSCALLARG(args,valsize) = valsize;
    error = sys_setsockopt(&args, &res);
    if (error) {
        errno = error;
        return -1;
    } else {
        return 0;
    }
}
Beispiel #6
0
static int do_set_attach_filter(int fd, int level, int optname,
				char __user *optval, int optlen)
{
	struct compat_sock_fprog __user *fprog32 = (struct compat_sock_fprog __user *)optval;
	struct sock_fprog __user *kfprog = compat_alloc_user_space(sizeof(struct sock_fprog)); 
	compat_uptr_t ptr;
	u16 len;

	if (!access_ok(VERIFY_READ, fprog32, sizeof(*fprog32)) ||
	    !access_ok(VERIFY_WRITE, kfprog, sizeof(struct sock_fprog)) ||
	    __get_user(len, &fprog32->len) ||
	    __get_user(ptr, &fprog32->filter) ||
	    __put_user(len, &kfprog->len) ||
	    __put_user(compat_ptr(ptr), &kfprog->filter))
		return -EFAULT;

	return sys_setsockopt(fd, level, optname, (char __user *)kfprog, 
			      sizeof(struct sock_fprog));
}
asmlinkage int sunos_setsockopt(u32 __fd, u32 __level, u32 __optname,
				char __user *optval, u32 __optlen)
{
	int fd = (int) __fd;
	int level = (int) __level;
	int optname = (int) __optname;
	int optlen = (int) __optlen;
	int tr_opt = optname;
	int ret;

	if (level == SOL_IP) {
		/* Multicast socketopts (ttl, membership) */
		if (tr_opt >=2 && tr_opt <= 6)
			tr_opt += 30;
	}
	ret = sys_setsockopt(fd, level, tr_opt,
			     optval, optlen);
	return ret;
}
Beispiel #8
0
static int do_set_sock_timeout(int fd, int level, int optname, char __user *optval, int optlen)
{
	struct compat_timeval __user *up = (struct compat_timeval __user *) optval;
	struct timeval ktime;
	mm_segment_t old_fs;
	int err;

	if (optlen < sizeof(*up))
		return -EINVAL;
	if (!access_ok(VERIFY_READ, up, sizeof(*up)) ||
	    __get_user(ktime.tv_sec, &up->tv_sec) ||
	    __get_user(ktime.tv_usec, &up->tv_usec))
		return -EFAULT;
	old_fs = get_fs();
	set_fs(KERNEL_DS);
	err = sys_setsockopt(fd, level, optname, (char *) &ktime, sizeof(ktime));
	set_fs(old_fs);

	return err;
}
Beispiel #9
0
void handle_faf_setsockopt (struct rpc_desc *desc,
			    void *msgIn, size_t size)
{
	struct faf_setsockopt_msg *msg = msgIn;
	struct prev_root prev_root;
	const struct cred *old_cred;
	int r, err;

	err = unpack_context(desc, &prev_root, &old_cred);
	if (err) {
		rpc_cancel(desc);
		return;
	}

	err = prepare_ruaccess(desc);
	if (err)
		goto out_err;
	r = sys_setsockopt(msg->server_fd, msg->level, msg->optname,
			   msg->optval, msg->optlen);
	err = cleanup_ruaccess(desc);
	if (err)
		goto out_err;
	err = rpc_pack_type(desc, r);
	if (err)
		goto out_err;

exit:
	restore_context(&prev_root, old_cred);

	return;

out_err:
	rpc_cancel(desc);
	if (err > 0)
		err = -ENOMEM;
	r = err;
	goto exit;
}
Beispiel #10
0
/*
 * Set socket option.
 */
PJ_DEF(pj_status_t) pj_sock_setsockopt( pj_sock_t sockfd,
					pj_uint16_t level,
					pj_uint16_t optname,
					const void *optval,
					int optlen)
{
    long err;
    mm_segment_t oldfs;

    PJ_CHECK_STACK();


    oldfs = get_fs();
    set_fs(KERNEL_DS);

    err = sys_setsockopt( sockfd, level, optname, (void*)optval, optlen);

    set_fs(oldfs);

    if (err)
	return PJ_RETURN_OS_ERROR(-err);
    else
	return PJ_SUCCESS;
}
Beispiel #11
0
static int do_netfilter_replace(int fd, int level, int optname,
				char __user *optval, int optlen)
{
	struct compat_ipt_replace __user *urepl;
	struct ipt_replace __user *repl_nat;
	char name[IPT_TABLE_MAXNAMELEN];
	u32 origsize, tmp32, num_counters;
	unsigned int repl_nat_size;
	int ret;
	int i;
	compat_uptr_t ucntrs;

	urepl = (struct compat_ipt_replace __user *)optval;
	if (get_user(origsize, &urepl->size))
		return -EFAULT;

	/* Hack: Causes ipchains to give correct error msg --RR */
	if (optlen != sizeof(*urepl) + origsize)
		return -ENOPROTOOPT;

	/* XXX Assumes that size of ipt_entry is the same both in
	 *     native and compat environments.
	 */
	repl_nat_size = sizeof(*repl_nat) + origsize;
	repl_nat = compat_alloc_user_space(repl_nat_size);

	ret = -EFAULT;
	if (put_user(origsize, &repl_nat->size))
		goto out;

	if (!access_ok(VERIFY_READ, urepl, optlen) ||
	    !access_ok(VERIFY_WRITE, repl_nat, optlen))
		goto out;

	if (__copy_from_user(name, urepl->name, sizeof(urepl->name)) ||
	    __copy_to_user(repl_nat->name, name, sizeof(repl_nat->name)))
		goto out;

	if (__get_user(tmp32, &urepl->valid_hooks) ||
	    __put_user(tmp32, &repl_nat->valid_hooks))
		goto out;

	if (__get_user(tmp32, &urepl->num_entries) ||
	    __put_user(tmp32, &repl_nat->num_entries))
		goto out;

	if (__get_user(num_counters, &urepl->num_counters) ||
	    __put_user(num_counters, &repl_nat->num_counters))
		goto out;

	if (__get_user(ucntrs, &urepl->counters) ||
	    __put_user(compat_ptr(ucntrs), &repl_nat->counters))
		goto out;

	if (__copy_in_user(&repl_nat->entries[0],
			   &urepl->entries[0],
			   origsize))
		goto out;

	for (i = 0; i < NF_IP_NUMHOOKS; i++) {
		if (__get_user(tmp32, &urepl->hook_entry[i]) ||
		    __put_user(tmp32, &repl_nat->hook_entry[i]) ||
		    __get_user(tmp32, &urepl->underflow[i]) ||
		    __put_user(tmp32, &repl_nat->underflow[i]))
			goto out;
	}

	/*
	 * Since struct ipt_counters just contains two u_int64_t members
	 * we can just do the access_ok check here and pass the (converted)
	 * pointer into the standard syscall.  We hope that the pointer is
	 * not misaligned ...
	 */
	if (!access_ok(VERIFY_WRITE, compat_ptr(ucntrs),
		       num_counters * sizeof(struct ipt_counters)))
		goto out;


	ret = sys_setsockopt(fd, level, optname,
			     (char __user *)repl_nat, repl_nat_size);

out:
	return ret;
}
Beispiel #12
0
DEFINE_SYSCALL(socketcall, int, call, uintptr_t *, args)
{
	if (call < 1 || call > SYS_SENDMMSG)
		return -L_EINVAL;
	if (!mm_check_read(args, nargs[call]))
		return -L_EFAULT;
	switch (call)
	{
	case SYS_SOCKET:
		return sys_socket(args[0], args[1], args[2]);

	case SYS_BIND:
		return sys_bind(args[0], (const struct sockaddr *)args[1], args[2]);

	case SYS_CONNECT:
		return sys_connect(args[0], (const struct sockaddr *)args[1], args[2]);

	case SYS_LISTEN:
		return sys_listen(args[0], args[1]);

	case SYS_ACCEPT:
		return sys_accept(args[0], (struct sockaddr *)args[1], (int *)args[2]);

	case SYS_GETSOCKNAME:
		return sys_getsockname(args[0], (struct sockaddr *)args[1], (int *)args[2]);

	case SYS_GETPEERNAME:
		return sys_getpeername(args[0], (struct sockaddr *)args[1], (int *)args[2]);

	case SYS_SEND:
		return sys_send(args[0], (const void *)args[1], args[2], args[3]);

	case SYS_RECV:
		return sys_recv(args[0], (void *)args[1], args[2], args[3]);

	case SYS_SENDTO:
		return sys_sendto(args[0], (const void *)args[1], args[2], args[3], (const struct sockaddr *)args[4], args[5]);
		
	case SYS_RECVFROM:
		return sys_recvfrom(args[0], (void *)args[1], args[2], args[3], (struct sockaddr *)args[4], (int *)args[5]);

	case SYS_SHUTDOWN:
		return sys_shutdown(args[0], args[1]);

	case SYS_SETSOCKOPT:
		return sys_setsockopt(args[0], args[1], args[2], (const void *)args[3], args[4]);

	case SYS_GETSOCKOPT:
		return sys_getsockopt(args[0], args[1], args[2], (void *)args[3], (int *)args[4]);

	case SYS_SENDMSG:
		return sys_sendmsg(args[0], (const struct msghdr *)args[1], args[2]);

	case SYS_RECVMSG:
		return sys_recvmsg(args[0], (struct msghdr *)args[1], args[2]);

	case SYS_ACCEPT4:
		return sys_accept4(args[0], (struct sockaddr *)args[1], (int *)args[2], args[3]);

	case SYS_SENDMMSG:
		return sys_sendmmsg(args[0], (struct mmsghdr *)args[1], args[2], args[3]);

	default:
	{
		log_error("Unimplemented socketcall: %d", call);
		return -L_EINVAL;
	}
	}
}
Beispiel #13
0
int
so_socksys(struct socksysreq *req)
{
	int err = -EINVAL;
	int cmd = req->args[0];

	if ((1 << cmd) & ((1 << SO_ACCEPT) | (1 << SO_BIND) | (1 << SO_CONNECT) |
			  (1 << SO_GETPEERNAME) | (1 << SO_GETSOCKNAME) | (1 << SO_GETSOCKOPT) |
			  (1 << SO_LISTEN) | (1 << SO_RECV) | (1 << SO_RECVFROM) | (1 << SO_SEND) |
			  (1 << SO_SENDTO) | (1 << SO_SETSOCKOPT) | (1 << SO_SHUTDOWN) |
			  (1 << SO_RECVMSG) | (1 << SO_SENDMSG))) {
		int fd = req->args[1];

		(void) fd;
		/* These are all socket related and accept a file (socket) descriptor as their
		   first argument.  In situations where we are incapable of providing back a real
		   socket, we must here first distinguish if the file descriptor corresponds to a
		   socket or a stream. */
#if 0
		if (it_is_a_socket) {
#endif
			/* In this case, we have a real socket from the operating system's
			   perspective and we can simply pass the arguments to the appropriate
			   system call. */
#if 0
			switch (cmd) {
			case SO_ACCEPT:
				/* FIXME: 32/64 conversion */
				err = sys_accept(fd, (struct sockaddr *) req->args[2],
						 req->args[3]);
				break;
			case SO_BIND:
				/* FIXME: 32/64 conversion */
				err = sys_bind(fd, (struct sockaddr *) req->args[2], req->args[3]);
				break;
			case SO_CONNECT:
				/* FIXME: 32/64 conversion */
				err = sys_connect(fd, (struct sockaddr *) req->args[2],
						  req->args[3]);
				break;
			case SO_GETPEERNAME:
				/* FIXME: 32/64 conversion */
				err = sys_getpeername(fd, (struct sockaddr *) req->args[2],
						      (int *) req->args[3]);
				break;
			case SO_GETSOCKNAME:
				/* FIXME: 32/64 conversion */
				err = sys_getsockname(fd, (struct sockaddr *) req->args[2],
						      (int *) req->args[3]);
				break;
			case SO_GETSOCKOPT:
				/* FIXME: 32/64 conversion */
				err = sys_getsockopt(fd, req->args[2], req->args[3],
						     (char *) req->args[4], (int *) req->args[5]);
				break;
			case SO_LISTEN:
				/* FIXME: 32/64 conversion */
				err = sys_listen(fd, req->args[2]);
				break;
			case SO_RECV:
				/* FIXME: 32/64 conversion */
				err = sys_recv(fd, (void *) req->args[2], req->args[3],
					       req->args[4]);
				break;
			case SO_RECVFROM:
				/* FIXME: 32/64 conversion */
				err = sys_recvfrom(fd, (void *) req->args[2], req->args[3],
						   req->args[4], (struct sockaddr *) req->args[5],
						   (int *) req->args[6]);
				break;
			case SO_SEND:
				/* FIXME: 32/64 conversion */
				err = sys_send(fd, (void *) req->args[2], req->args[3],
					       req->args[4]);
				break;
			case SO_SENDTO:
				/* FIXME: 32/64 conversion */
				err = sys_sendto(fd, (void *) req->args[2], req->args[3],
						 req->args[4], (struct sockaddr *) req->args[5],
						 req->args[6]);
				break;
			case SO_SETSOCKOPT:
				/* FIXME: 32/64 conversion */
				err = sys_setsockopt(fd, req->args[2], req->args[3],
						     (char *) req->args[4], req->args[5]);
				break;
			case SO_SHUTDOWN:
				/* FIXME: 32/64 conversion */
				err = sys_shutdown(fd, req->args[2]);
				break;
			case SO_RECVMSG:
				/* FIXME: 32/64 conversion */
				err = sys_recvmsg(fd, (struct msghdr *) req->args[2], req->args[3]);
				break;
			case SO_SENDMSG:
				/* FIXME: 32/64 conversion */
				err = sys_sendmsg(fd, (struct msghdr *) req->args[2], req->args[3]);
				break;
			}
#endif
#if 0
		} else {
			/* In this case, we do not have a real socket, but have a TPI stream from
			   the operating system's perspective, and we will directly call the
			   associated TPI routine. */
			switch (cmd) {
			case SO_ACCEPT:
				/* FIXME: 32/64 conversion */
				err = tpi_accept(fd, (struct sockaddr *) req->args[2],
						 req->args[3]);
				break;
			case SO_BIND:
				/* FIXME: 32/64 conversion */
				err = tpi_bind(fd, (struct sockaddr *) req->args[2], req->args[3]);
				break;
			case SO_CONNECT:
				/* FIXME: 32/64 conversion */
				err = tpi_connect(fd, (struct sockaddr *) req->args[2],
						  req->args[3]);
				break;
			case SO_GETPEERNAME:
				/* FIXME: 32/64 conversion */
				err = tpi_getpeername(fd, (struct sockaddr *) req->args[2],
						      (int *) req->args[3]);
				break;
			case SO_GETSOCKNAME:
				/* FIXME: 32/64 conversion */
				err = tpi_getsockname(fd, (struct sockaddr *) req->args[2],
						      (int *) req->args[3]);
				break;
			case SO_GETSOCKOPT:
				/* FIXME: 32/64 conversion */
				err = tpi_getsockopt(fd, req->args[2], req->args[3],
						     (char *) req->args[4], (int *) req->args[5]);
				break;
			case SO_LISTEN:
				/* FIXME: 32/64 conversion */
				err = tpi_listen(fd, req->args[2]);
				break;
			case SO_RECV:
				/* FIXME: 32/64 conversion */
				err = tpi_recv(fd, (void *) req->args[2], req->args[3],
					       req->args[4]);
				break;
			case SO_RECVFROM:
				/* FIXME: 32/64 conversion */
				err = tpi_recvfrom(fd, (void *) req->args[2], req->args[3],
						   req->args[4], (struct sockaddr *) req->args[5],
						   (int *) req->args[6]);
				break;
			case SO_SEND:
				/* FIXME: 32/64 conversion */
				err = tpi_send(fd, (void *) req->args[2], req->args[3],
					       req->args[4]);
				break;
			case SO_SENDTO:
				/* FIXME: 32/64 conversion */
				err = tpi_sendto(fd, (void *) req->args[2], req->args[3],
						 req->args[4], (struct sockaddr *) req->args[5],
						 req->args[6]);
				break;
			case SO_SETSOCKOPT:
				/* FIXME: 32/64 conversion */
				err = tpi_setsockopt(fd, req->args[2], req->args[3],
						     (char *) req->args[4], req->args[5]);
				break;
			case SO_SHUTDOWN:
				/* FIXME: 32/64 conversion */
				err = tpi_shutdown(fd, req->args[2]);
				break;
			case SO_RECVMSG:
				/* FIXME: 32/64 conversion */
				err = tpi_recvmsg(fd, (struct msghdr *) req->args[2], req->args[3]);
				break;
			case SO_SENDMSG:
				/* FIXME: 32/64 conversion */
				err = tpi_sendmsg(fd, (struct msghdr *) req->args[2], req->args[3]);
				break;
			}
		}
#endif
	}
	if ((1 << cmd) & ((1 << SO_SOCKET) | (1 << SO_SOCKPAIR) | (1 << SO_SELECT) |
			  (1 << SO_GETIPDOMAIN) | (1 << SO_SETIPDOMAIN) | (1 << SO_ADJTIME) |
			  (1 << SO_SETREUID) | (1 << SO_SETREGID) | (1 << SO_GETTIME) |
			  (1 << SO_SETTIME) | (1 << SO_GETITIMER) | (1 << SO_SETITIMER))) {
		/* These are BSD compatibiltiy functions and are how we create sockets in the first
		   place.  The BSD compatibility functions all have system calls in Linux, but we
		   provide them for backward compatibility (to what!?). */
#if 0
		switch (cmd) {
		case SO_SOCKET:
			/* FIXME: 32/64 conversion */
			/* XXX: don't think so..., after checking for a stream */
			err = sys_socket(req->args[1], req->args[2], req->args[3]);
			break;
		case SO_SOCKPAIR:
			/* FIXME: 32/64 conversion */
			/* XXX: don't think so..., after checking for a stream */
			err = sys_socketpair(req->args[1], req->args[2], req->args[3],
					     (int *) req->args[4]);
			err = -EOPNOTSUPP;
			break;
		case SO_SELECT:
			/* FIXME: 32/64 conversion */
			err = sys_select(req->args[1], (fd_set *) req->args[2],
					 (fd_set *) req->args[3], (fd_set *) req->args[4],
					 (struct timeval *) req->args[5]);
			break;
		case SO_GETIPDOMAIN:
			/* FIXME: 32/64 conversion */
			todo(("Process SO_GETIPDOMAIN for compatibility.\n"));
			/* does not exist in Linux, need to use sys_newuname and copy the
			   domainname portion */
			err = -ENOSYS;
			break;
		case SO_SETIPDOMAIN:
			/* FIXME: 32/64 conversion */
			err = sys_setdomainname((char *) req->args[1], req->args[2]);
			break;
		case SO_ADJTIME:
			/* FIXME: 32/64 conversion */
			err = sys_admtimex((struct timex *) req->args[1]);
			break;
		case SO_SETREUID:
			/* FIXME: 32/64 conversion */
			err = sys_setreuid(req->args[1], req->args[2]);
			break;
		case SO_SETREGID:
			/* FIXME: 32/64 conversion */
			err = sys_setregid(req->args[1], req->args[2]);
			break;
		case SO_GETTIME:
			/* FIXME: 32/64 conversion */
			err = sys_gettimeofday((struct timeval *) req->args[1],
					       (struct timezone *) req->args[2]);
			break;
		case SO_SETTIME:
			/* FIXME: 32/64 conversion */
			err = sys_settimeofday((struct timeval *) req->args[1],
					       (struct timezone *) req->args[2]);
			break;
		case SO_GETITIMER:
			/* FIXME: 32/64 conversion */
			err = sys_getitimer(req->args[1], (struct itimerval *) req->args[2]);
			break;
		case SO_SETITIMER:
			/* FIXME: 32/64 conversion */
			err = sys_getitimer(req->args[1], (struct itimerval *) req->args[2],
					    (struct itimerval *) req->args[3]);
			break;
		}
#endif
	}

	return (err);
}
Beispiel #14
0
/*
 * system call vectors. since i want to rewrite sockets as streams, we have
 * this level of indirection. not a lot of overhead, since more of the work is
 * done via read/write/select directly
 */
int
sys_socketcall(int call, unsigned long *args)
{
	switch (call) {
	case SYS_SOCKET:
		verify_area(args, 3 * sizeof(long));
		return sock_socket(get_fs_long(args+0),
				   get_fs_long(args+1),
				   get_fs_long(args+2));

	case SYS_BIND:
		verify_area(args, 3 * sizeof(long));
		return sock_bind(get_fs_long(args+0),
				 (struct sockaddr *)get_fs_long(args+1),
				 get_fs_long(args+2));

	case SYS_CONNECT:
		verify_area(args, 3 * sizeof(long));
		return sock_connect(get_fs_long(args+0),
				    (struct sockaddr *)get_fs_long(args+1),
				    get_fs_long(args+2));

	case SYS_LISTEN:
		verify_area(args, 2 * sizeof(long));
		return sock_listen(get_fs_long(args+0),
				   get_fs_long(args+1));

	case SYS_ACCEPT:
		verify_area(args, 3 * sizeof(long));
		return sock_accept(get_fs_long(args+0),
				   (struct sockaddr *)get_fs_long(args+1),
				   (int *)get_fs_long(args+2));

	case SYS_GETSOCKNAME:
		verify_area(args, 3 * sizeof(long));
		return sock_getsockname(get_fs_long(args+0),
					(struct sockaddr *)get_fs_long(args+1),
					(int *)get_fs_long(args+2));

	case SYS_GETPEERNAME:
		verify_area(args, 3 * sizeof(long));
		return sock_getpeername(get_fs_long(args+0),
					(struct sockaddr *)get_fs_long(args+1),
					(int *)get_fs_long(args+2));

	case SYS_SOCKETPAIR:
		verify_area(args, 4 * sizeof(long));
		return sock_socketpair(get_fs_long(args+0),
				       get_fs_long(args+1),
				       get_fs_long(args+2),
				       (int *)get_fs_long(args+3));

      case SYS_SEND:
	  verify_area(args, 4 * sizeof (unsigned long));
	  return ( sys_send (get_fs_long(args+0),
			     (void *)get_fs_long(args+1),
			     get_fs_long(args+2),
			     get_fs_long(args+3)));
			     
      case SYS_SENDTO:
	  verify_area(args, 6 * sizeof (unsigned long));
	  return ( sys_sendto (get_fs_long(args+0),
			     (void *)get_fs_long(args+1),
			     get_fs_long(args+2),
			     get_fs_long(args+3),
			     (struct sockaddr *)get_fs_long(args+4),
			     get_fs_long(args+5)));

    
      case SYS_RECV:
	  verify_area(args, 4 * sizeof (unsigned long));
	  return ( sys_recv (get_fs_long(args+0),
			     (void *)get_fs_long(args+1),
			     get_fs_long(args+2),
			     get_fs_long(args+3)));
			     
      case SYS_RECVFROM:
	  verify_area(args, 6 * sizeof (unsigned long));
	  return ( sys_recvfrom (get_fs_long(args+0),
				 (void *)get_fs_long(args+1),
				 get_fs_long(args+2),
				 get_fs_long(args+3),
				 (struct sockaddr *)get_fs_long(args+4),
				 (int *)get_fs_long(args+5)));

      case SYS_SHUTDOWN:
	  verify_area (args, 2* sizeof (unsigned long));
	  return ( sys_shutdown (get_fs_long (args+0),
				 get_fs_long (args+1)));

      case SYS_SETSOCKOPT:
	  verify_area (args, 5*sizeof (unsigned long));
	  return (sys_setsockopt (get_fs_long (args+0),
				  get_fs_long (args+1),
				  get_fs_long (args+2),
				  (char *)get_fs_long (args+3),
				  get_fs_long (args+4)));


      case SYS_GETSOCKOPT:
	  verify_area (args, 5*sizeof (unsigned long));
	  return (sys_getsockopt (get_fs_long (args+0),
				  get_fs_long (args+1),
				  get_fs_long (args+2),
				  (char *)get_fs_long (args+3),
				  (int *)get_fs_long (args+4)));

	default:
		return -EINVAL;
	}
}