diff options
author | dchagin <dchagin@FreeBSD.org> | 2009-06-01 20:42:27 +0000 |
---|---|---|
committer | dchagin <dchagin@FreeBSD.org> | 2009-06-01 20:42:27 +0000 |
commit | 0cc88e7ca3ae43c15437a869b4f410740d56a881 (patch) | |
tree | a24a5ee07c8c7b8b44ab4a93265bafa48f7c48e1 | |
parent | e45af7ed8716cba103335d75c35ca84f34c9070d (diff) | |
download | FreeBSD-src-0cc88e7ca3ae43c15437a869b4f410740d56a881.zip FreeBSD-src-0cc88e7ca3ae43c15437a869b4f410740d56a881.tar.gz |
Split linux_accept() syscall onto linux_accept_common() which should
be used by linuxulator and linux_accept() itself.
Approved by: kib (mentor)
MFC after: 1 month
-rw-r--r-- | sys/compat/linux/linux_socket.c | 35 |
1 files changed, 22 insertions, 13 deletions
diff --git a/sys/compat/linux/linux_socket.c b/sys/compat/linux/linux_socket.c index 2dd4df8..62cfc61 100644 --- a/sys/compat/linux/linux_socket.c +++ b/sys/compat/linux/linux_socket.c @@ -763,14 +763,9 @@ linux_listen(struct thread *td, struct linux_listen_args *args) return (listen(td, &bsd_args)); } -struct linux_accept_args { - int s; - l_uintptr_t addr; - l_uintptr_t namelen; -}; - static int -linux_accept(struct thread *td, struct linux_accept_args *args) +linux_accept_common(struct thread *td, int s, l_uintptr_t addr, + l_uintptr_t namelen) { struct accept_args /* { int s; @@ -779,19 +774,19 @@ linux_accept(struct thread *td, struct linux_accept_args *args) } */ bsd_args; int error, fd; - bsd_args.s = args->s; + bsd_args.s = s; /* XXX: */ - bsd_args.name = (struct sockaddr * __restrict)PTRIN(args->addr); - bsd_args.anamelen = PTRIN(args->namelen);/* XXX */ + bsd_args.name = (struct sockaddr * __restrict)PTRIN(addr); + bsd_args.anamelen = PTRIN(namelen);/* XXX */ error = accept(td, &bsd_args); bsd_to_linux_sockaddr((struct sockaddr *)bsd_args.name); if (error) { - if (error == EFAULT && args->namelen != sizeof(struct sockaddr_in)) + if (error == EFAULT && namelen != sizeof(struct sockaddr_in)) return (EINVAL); return (error); } - if (args->addr) { - error = linux_sa_put(PTRIN(args->addr)); + if (addr) { + error = linux_sa_put(PTRIN(addr)); if (error) { (void)kern_close(td, td->td_retval[0]); return (error); @@ -809,6 +804,20 @@ linux_accept(struct thread *td, struct linux_accept_args *args) return (0); } +struct linux_accept_args { + int s; + l_uintptr_t addr; + l_uintptr_t namelen; +}; + +static int +linux_accept(struct thread *td, struct linux_accept_args *args) +{ + + return (linux_accept_common(td, args->s, args->addr, + args->namelen)); +} + struct linux_getsockname_args { int s; l_uintptr_t addr; |