summaryrefslogtreecommitdiffstats
path: root/sys/compat
diff options
context:
space:
mode:
authorgjb <gjb@FreeBSD.org>2016-04-04 23:55:32 +0000
committergjb <gjb@FreeBSD.org>2016-04-04 23:55:32 +0000
commit1dc4c40e3b35564cb2e787ad968e6b4a9fb7eb0f (patch)
treea027fe5a27446f32854d6a07b34b5f2a992bf283 /sys/compat
parent3669a0dced7e344be71d234ffc3a71530ef0ae08 (diff)
parent589cedfe0cde2b49d5f47fc240de37c8bf307abd (diff)
downloadFreeBSD-src-1dc4c40e3b35564cb2e787ad968e6b4a9fb7eb0f.zip
FreeBSD-src-1dc4c40e3b35564cb2e787ad968e6b4a9fb7eb0f.tar.gz
MFH
Sponsored by: The FreeBSD Foundation
Diffstat (limited to 'sys/compat')
-rw-r--r--sys/compat/cloudabi/cloudabi_clock.c3
-rw-r--r--sys/compat/cloudabi/cloudabi_errno.c3
-rw-r--r--sys/compat/cloudabi/cloudabi_fd.c3
-rw-r--r--sys/compat/cloudabi/cloudabi_file.c21
-rw-r--r--sys/compat/cloudabi/cloudabi_futex.c25
-rw-r--r--sys/compat/cloudabi/cloudabi_mem.c3
-rw-r--r--sys/compat/cloudabi/cloudabi_proc.c3
-rw-r--r--sys/compat/cloudabi/cloudabi_proto.h4
-rw-r--r--sys/compat/cloudabi/cloudabi_sock.c20
-rw-r--r--sys/compat/cloudabi/cloudabi_syscalldefs.h48
-rw-r--r--sys/compat/cloudabi/cloudabi_thread.c3
-rw-r--r--sys/compat/cloudabi/cloudabi_util.h8
-rw-r--r--sys/compat/cloudabi64/Makefile6
-rw-r--r--sys/compat/cloudabi64/cloudabi64_fd.c3
-rw-r--r--sys/compat/cloudabi64/cloudabi64_module.c4
-rw-r--r--sys/compat/cloudabi64/cloudabi64_poll.c9
-rw-r--r--sys/compat/cloudabi64/cloudabi64_proto.h44
-rw-r--r--sys/compat/cloudabi64/cloudabi64_sock.c7
-rw-r--r--sys/compat/cloudabi64/cloudabi64_syscall.h2
-rw-r--r--sys/compat/cloudabi64/cloudabi64_syscalldefs.h45
-rw-r--r--sys/compat/cloudabi64/cloudabi64_syscalls.c2
-rw-r--r--sys/compat/cloudabi64/cloudabi64_sysent.c4
-rw-r--r--sys/compat/cloudabi64/cloudabi64_systrace_args.c80
-rw-r--r--sys/compat/cloudabi64/cloudabi64_thread.c3
-rw-r--r--sys/compat/cloudabi64/cloudabi64_util.h2
-rw-r--r--sys/compat/cloudabi64/syscalls.master220
-rw-r--r--sys/compat/freebsd32/freebsd32_misc.c15
-rw-r--r--sys/compat/linux/linux_event.c21
-rw-r--r--sys/compat/linux/linux_mib.c47
-rw-r--r--sys/compat/linux/linux_misc.c44
-rw-r--r--sys/compat/linux/linux_socket.c40
-rw-r--r--sys/compat/linux/linux_stats.c59
-rw-r--r--sys/compat/linuxkpi/common/include/linux/bitops.h4
-rw-r--r--sys/compat/linuxkpi/common/include/linux/jiffies.h10
-rw-r--r--sys/compat/linuxkpi/common/include/linux/list.h1
-rw-r--r--sys/compat/linuxkpi/common/include/linux/wait.h47
-rw-r--r--sys/compat/linuxkpi/common/src/linux_compat.c10
-rw-r--r--sys/compat/ndis/kern_ndis.c4
38 files changed, 336 insertions, 541 deletions
diff --git a/sys/compat/cloudabi/cloudabi_clock.c b/sys/compat/cloudabi/cloudabi_clock.c
index ed32cf6..b26d98e 100644
--- a/sys/compat/cloudabi/cloudabi_clock.c
+++ b/sys/compat/cloudabi/cloudabi_clock.c
@@ -31,8 +31,9 @@ __FBSDID("$FreeBSD$");
#include <sys/stdint.h>
#include <sys/syscallsubr.h>
+#include <contrib/cloudabi/cloudabi_types_common.h>
+
#include <compat/cloudabi/cloudabi_proto.h>
-#include <compat/cloudabi/cloudabi_syscalldefs.h>
#include <compat/cloudabi/cloudabi_util.h>
/* Converts a CloudABI clock ID to a FreeBSD clock ID. */
diff --git a/sys/compat/cloudabi/cloudabi_errno.c b/sys/compat/cloudabi/cloudabi_errno.c
index 5193cfc..38520b9 100644
--- a/sys/compat/cloudabi/cloudabi_errno.c
+++ b/sys/compat/cloudabi/cloudabi_errno.c
@@ -28,7 +28,8 @@ __FBSDID("$FreeBSD$");
#include <sys/param.h>
-#include <compat/cloudabi/cloudabi_syscalldefs.h>
+#include <contrib/cloudabi/cloudabi_types_common.h>
+
#include <compat/cloudabi/cloudabi_util.h>
/* Converts a FreeBSD errno to a CloudABI errno. */
diff --git a/sys/compat/cloudabi/cloudabi_fd.c b/sys/compat/cloudabi/cloudabi_fd.c
index 17177d2..c044adc 100644
--- a/sys/compat/cloudabi/cloudabi_fd.c
+++ b/sys/compat/cloudabi/cloudabi_fd.c
@@ -38,8 +38,9 @@ __FBSDID("$FreeBSD$");
#include <sys/unistd.h>
#include <sys/vnode.h>
+#include <contrib/cloudabi/cloudabi_types_common.h>
+
#include <compat/cloudabi/cloudabi_proto.h>
-#include <compat/cloudabi/cloudabi_syscalldefs.h>
#include <compat/cloudabi/cloudabi_util.h>
/* Translation between CloudABI and Capsicum rights. */
diff --git a/sys/compat/cloudabi/cloudabi_file.c b/sys/compat/cloudabi/cloudabi_file.c
index cdf0585..f48b754 100644
--- a/sys/compat/cloudabi/cloudabi_file.c
+++ b/sys/compat/cloudabi/cloudabi_file.c
@@ -39,8 +39,9 @@ __FBSDID("$FreeBSD$");
#include <sys/uio.h>
#include <sys/vnode.h>
+#include <contrib/cloudabi/cloudabi_types_common.h>
+
#include <compat/cloudabi/cloudabi_proto.h>
-#include <compat/cloudabi/cloudabi_syscalldefs.h>
#include <compat/cloudabi/cloudabi_util.h>
#include <security/mac/mac_framework.h>
@@ -185,8 +186,8 @@ cloudabi_sys_file_link(struct thread *td,
return (error);
}
- error = kern_linkat(td, uap->fd1, uap->fd2, path1, path2,
- UIO_SYSSPACE, (uap->fd1 & CLOUDABI_LOOKUP_SYMLINK_FOLLOW) != 0 ?
+ error = kern_linkat(td, uap->fd1.fd, uap->fd2, path1, path2,
+ UIO_SYSSPACE, (uap->fd1.flags & CLOUDABI_LOOKUP_SYMLINK_FOLLOW) ?
FOLLOW : NOFOLLOW);
cloudabi_freestr(path1);
cloudabi_freestr(path2);
@@ -248,7 +249,7 @@ cloudabi_sys_file_open(struct thread *td,
fflags |= O_SYNC;
cap_rights_set(&rights, CAP_FSYNC);
}
- if ((uap->fd & CLOUDABI_LOOKUP_SYMLINK_FOLLOW) == 0)
+ if ((uap->dirfd.flags & CLOUDABI_LOOKUP_SYMLINK_FOLLOW) == 0)
fflags |= O_NOFOLLOW;
if (write && (fflags & (O_APPEND | O_TRUNC)) == 0)
cap_rights_set(&rights, CAP_SEEK);
@@ -265,7 +266,7 @@ cloudabi_sys_file_open(struct thread *td,
fdrop(fp, td);
return (error);
}
- NDINIT_ATRIGHTS(&nd, LOOKUP, FOLLOW, UIO_SYSSPACE, path, uap->fd,
+ NDINIT_ATRIGHTS(&nd, LOOKUP, FOLLOW, UIO_SYSSPACE, path, uap->dirfd.fd,
&rights, td);
error = vn_open(&nd, &fflags, 0777 & ~td->td_proc->p_fd->fd_cmask, fp);
cloudabi_freestr(path);
@@ -657,8 +658,8 @@ cloudabi_sys_file_stat_get(struct thread *td,
return (error);
error = kern_statat(td,
- (uap->fd & CLOUDABI_LOOKUP_SYMLINK_FOLLOW) != 0 ? 0 :
- AT_SYMLINK_NOFOLLOW, uap->fd, path, UIO_SYSSPACE, &sb, NULL);
+ (uap->fd.flags & CLOUDABI_LOOKUP_SYMLINK_FOLLOW) != 0 ? 0 :
+ AT_SYMLINK_NOFOLLOW, uap->fd.fd, path, UIO_SYSSPACE, &sb, NULL);
cloudabi_freestr(path);
if (error != 0)
return (error);
@@ -711,8 +712,8 @@ cloudabi_sys_file_stat_put(struct thread *td,
return (error);
convert_utimens_arguments(&fs, uap->flags, ts);
- error = kern_utimensat(td, uap->fd, path, UIO_SYSSPACE, ts,
- UIO_SYSSPACE, (uap->fd & CLOUDABI_LOOKUP_SYMLINK_FOLLOW) != 0 ?
+ error = kern_utimensat(td, uap->fd.fd, path, UIO_SYSSPACE, ts,
+ UIO_SYSSPACE, (uap->fd.flags & CLOUDABI_LOOKUP_SYMLINK_FOLLOW) ?
0 : AT_SYMLINK_NOFOLLOW);
cloudabi_freestr(path);
return (error);
@@ -751,7 +752,7 @@ cloudabi_sys_file_unlink(struct thread *td,
if (error != 0)
return (error);
- if (uap->flag & CLOUDABI_UNLINK_REMOVEDIR)
+ if (uap->flags & CLOUDABI_UNLINK_REMOVEDIR)
error = kern_rmdirat(td, uap->fd, path, UIO_SYSSPACE);
else
error = kern_unlinkat(td, uap->fd, path, UIO_SYSSPACE, 0);
diff --git a/sys/compat/cloudabi/cloudabi_futex.c b/sys/compat/cloudabi/cloudabi_futex.c
index aec2f33..d12b331 100644
--- a/sys/compat/cloudabi/cloudabi_futex.c
+++ b/sys/compat/cloudabi/cloudabi_futex.c
@@ -37,8 +37,9 @@ __FBSDID("$FreeBSD$");
#include <sys/systm.h>
#include <sys/umtx.h>
+#include <contrib/cloudabi/cloudabi_types_common.h>
+
#include <compat/cloudabi/cloudabi_proto.h>
-#include <compat/cloudabi/cloudabi_syscalldefs.h>
#include <compat/cloudabi/cloudabi_util.h>
/*
@@ -211,16 +212,16 @@ static int futex_user_cmpxchg(uint32_t *, uint32_t, uint32_t *, uint32_t);
static int
futex_address_create(struct futex_address *fa, struct thread *td,
- const void *object, cloudabi_mflags_t scope)
+ const void *object, cloudabi_scope_t scope)
{
KASSERT(td == curthread,
("Can only create umtx keys for the current thread"));
switch (scope) {
- case CLOUDABI_MAP_PRIVATE:
+ case CLOUDABI_SCOPE_PRIVATE:
return (umtx_key_get(object, TYPE_FUTEX, THREAD_SHARE,
&fa->fa_key));
- case CLOUDABI_MAP_SHARED:
+ case CLOUDABI_SCOPE_SHARED:
return (umtx_key_get(object, TYPE_FUTEX, AUTO_SHARE,
&fa->fa_key));
default:
@@ -258,7 +259,7 @@ futex_condvar_assert(const struct futex_condvar *fc)
static int
futex_condvar_lookup(struct thread *td, const cloudabi_condvar_t *address,
- cloudabi_mflags_t scope, struct futex_condvar **fcret)
+ cloudabi_scope_t scope, struct futex_condvar **fcret)
{
struct futex_address fa_condvar;
struct futex_condvar *fc;
@@ -285,8 +286,8 @@ futex_condvar_lookup(struct thread *td, const cloudabi_condvar_t *address,
static int
futex_condvar_lookup_or_create(struct thread *td,
- const cloudabi_condvar_t *condvar, cloudabi_mflags_t condvar_scope,
- const cloudabi_lock_t *lock, cloudabi_mflags_t lock_scope,
+ const cloudabi_condvar_t *condvar, cloudabi_scope_t condvar_scope,
+ const cloudabi_lock_t *lock, cloudabi_scope_t lock_scope,
struct futex_condvar **fcret)
{
struct futex_address fa_condvar, fa_lock;
@@ -384,7 +385,7 @@ futex_lock_assert(const struct futex_lock *fl)
static int
futex_lock_lookup(struct thread *td, const cloudabi_lock_t *address,
- cloudabi_mflags_t scope, struct futex_lock **flret)
+ cloudabi_scope_t scope, struct futex_lock **flret)
{
struct futex_address fa;
int error;
@@ -973,8 +974,8 @@ futex_user_cmpxchg(uint32_t *obj, uint32_t cmp, uint32_t *old, uint32_t new)
int
cloudabi_futex_condvar_wait(struct thread *td, cloudabi_condvar_t *condvar,
- cloudabi_mflags_t condvar_scope, cloudabi_lock_t *lock,
- cloudabi_mflags_t lock_scope, cloudabi_clockid_t clock_id,
+ cloudabi_scope_t condvar_scope, cloudabi_lock_t *lock,
+ cloudabi_scope_t lock_scope, cloudabi_clockid_t clock_id,
cloudabi_timestamp_t timeout, cloudabi_timestamp_t precision)
{
struct futex_condvar *fc;
@@ -1046,7 +1047,7 @@ cloudabi_futex_condvar_wait(struct thread *td, cloudabi_condvar_t *condvar,
int
cloudabi_futex_lock_rdlock(struct thread *td, cloudabi_lock_t *lock,
- cloudabi_mflags_t scope, cloudabi_clockid_t clock_id,
+ cloudabi_scope_t scope, cloudabi_clockid_t clock_id,
cloudabi_timestamp_t timeout, cloudabi_timestamp_t precision)
{
struct futex_lock *fl;
@@ -1065,7 +1066,7 @@ cloudabi_futex_lock_rdlock(struct thread *td, cloudabi_lock_t *lock,
int
cloudabi_futex_lock_wrlock(struct thread *td, cloudabi_lock_t *lock,
- cloudabi_mflags_t scope, cloudabi_clockid_t clock_id,
+ cloudabi_scope_t scope, cloudabi_clockid_t clock_id,
cloudabi_timestamp_t timeout, cloudabi_timestamp_t precision)
{
struct futex_lock *fl;
diff --git a/sys/compat/cloudabi/cloudabi_mem.c b/sys/compat/cloudabi/cloudabi_mem.c
index 9d82673..34ee14a 100644
--- a/sys/compat/cloudabi/cloudabi_mem.c
+++ b/sys/compat/cloudabi/cloudabi_mem.c
@@ -30,8 +30,9 @@ __FBSDID("$FreeBSD$");
#include <sys/mman.h>
#include <sys/sysproto.h>
+#include <contrib/cloudabi/cloudabi_types_common.h>
+
#include <compat/cloudabi/cloudabi_proto.h>
-#include <compat/cloudabi/cloudabi_syscalldefs.h>
/* Converts CloudABI's memory protection flags to FreeBSD's. */
static int
diff --git a/sys/compat/cloudabi/cloudabi_proc.c b/sys/compat/cloudabi/cloudabi_proc.c
index 8d0b6e7..139af2c 100644
--- a/sys/compat/cloudabi/cloudabi_proc.c
+++ b/sys/compat/cloudabi/cloudabi_proc.c
@@ -38,8 +38,9 @@ __FBSDID("$FreeBSD$");
#include <sys/syscallsubr.h>
#include <sys/unistd.h>
+#include <contrib/cloudabi/cloudabi_types_common.h>
+
#include <compat/cloudabi/cloudabi_proto.h>
-#include <compat/cloudabi/cloudabi_syscalldefs.h>
int
cloudabi_sys_proc_exec(struct thread *td,
diff --git a/sys/compat/cloudabi/cloudabi_proto.h b/sys/compat/cloudabi/cloudabi_proto.h
index e4baffd..95271fd 100644
--- a/sys/compat/cloudabi/cloudabi_proto.h
+++ b/sys/compat/cloudabi/cloudabi_proto.h
@@ -30,5 +30,7 @@
* calls. Unfortunately, we don't have a separate system call table for
* those, so rely on the system call table from COMPAT_CLOUDABI64.
*/
-#include <compat/cloudabi64/cloudabi64_syscalldefs.h>
+
+#include <contrib/cloudabi/cloudabi64_types.h>
+
#include <compat/cloudabi64/cloudabi64_proto.h>
diff --git a/sys/compat/cloudabi/cloudabi_sock.c b/sys/compat/cloudabi/cloudabi_sock.c
index cdccdff..b66f0ab 100644
--- a/sys/compat/cloudabi/cloudabi_sock.c
+++ b/sys/compat/cloudabi/cloudabi_sock.c
@@ -43,8 +43,9 @@ __FBSDID("$FreeBSD$");
#include <netinet/in.h>
+#include <contrib/cloudabi/cloudabi_types_common.h>
+
#include <compat/cloudabi/cloudabi_proto.h>
-#include <compat/cloudabi/cloudabi_syscalldefs.h>
#include <compat/cloudabi/cloudabi_util.h>
/* Converts FreeBSD's struct sockaddr to CloudABI's cloudabi_sockaddr_t. */
@@ -117,12 +118,12 @@ cloudabi_sys_sock_accept(struct thread *td,
if (uap->buf == NULL) {
/* Only return the new file descriptor number. */
- return (kern_accept(td, uap->s, NULL, NULL, NULL));
+ return (kern_accept(td, uap->sock, NULL, NULL, NULL));
} else {
/* Also return properties of the new socket descriptor. */
sal = MAX(sizeof(struct sockaddr_in),
sizeof(struct sockaddr_in6));
- error = kern_accept(td, uap->s, (void *)&sa, &sal, NULL);
+ error = kern_accept(td, uap->sock, (void *)&sa, &sal, NULL);
if (error != 0)
return (error);
@@ -143,7 +144,7 @@ cloudabi_sys_sock_bind(struct thread *td,
error = copyin_sockaddr_un(uap->path, uap->pathlen, &sun);
if (error != 0)
return (error);
- return (kern_bindat(td, uap->fd, uap->s, (struct sockaddr *)&sun));
+ return (kern_bindat(td, uap->fd, uap->sock, (struct sockaddr *)&sun));
}
int
@@ -156,7 +157,8 @@ cloudabi_sys_sock_connect(struct thread *td,
error = copyin_sockaddr_un(uap->path, uap->pathlen, &sun);
if (error != 0)
return (error);
- return (kern_connectat(td, uap->fd, uap->s, (struct sockaddr *)&sun));
+ return (kern_connectat(td, uap->fd, uap->sock,
+ (struct sockaddr *)&sun));
}
int
@@ -164,7 +166,7 @@ cloudabi_sys_sock_listen(struct thread *td,
struct cloudabi_sys_sock_listen_args *uap)
{
struct listen_args listen_args = {
- .s = uap->s,
+ .s = uap->sock,
.backlog = uap->backlog,
};
@@ -176,7 +178,7 @@ cloudabi_sys_sock_shutdown(struct thread *td,
struct cloudabi_sys_sock_shutdown_args *uap)
{
struct shutdown_args shutdown_args = {
- .s = uap->fd,
+ .s = uap->sock,
};
switch (uap->how) {
@@ -207,7 +209,7 @@ cloudabi_sys_sock_stat_get(struct thread *td,
struct socket *so;
int error;
- error = getsock_cap(td, uap->fd, cap_rights_init(&rights,
+ error = getsock_cap(td, uap->sock, cap_rights_init(&rights,
CAP_GETSOCKOPT, CAP_GETPEERNAME, CAP_GETSOCKNAME), &fp, NULL);
if (error != 0)
return (error);
@@ -243,7 +245,7 @@ cloudabi_sys_sock_stat_get(struct thread *td,
/* Set ss_state. */
if ((so->so_options & SO_ACCEPTCONN) != 0)
- ss.ss_state |= CLOUDABI_SOCKSTAT_ACCEPTCONN;
+ ss.ss_state |= CLOUDABI_SOCKSTATE_ACCEPTCONN;
fdrop(fp, td);
return (copyout(&ss, uap->buf, sizeof(ss)));
diff --git a/sys/compat/cloudabi/cloudabi_syscalldefs.h b/sys/compat/cloudabi/cloudabi_syscalldefs.h
deleted file mode 100644
index fc86eff..0000000
--- a/sys/compat/cloudabi/cloudabi_syscalldefs.h
+++ /dev/null
@@ -1,48 +0,0 @@
-/*-
- * Copyright (c) 2015 Nuxi, https://nuxi.nl/
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * $FreeBSD$
- */
-
-#ifndef _CLOUDABI_SYSCALLDEFS_H_
-#define _CLOUDABI_SYSCALLDEFS_H_
-
-#ifdef _KERNEL
-#include <sys/types.h>
-#include <sys/stdint.h>
-
-#define alignas _Alignas
-#define alignof _Alignof
-#define static_assert _Static_assert
-#else
-#include <assert.h>
-#include <stdalign.h>
-#include <stddef.h>
-#include <stdint.h>
-#endif
-
-/* Import machine-independent CloudABI definitions. */
-#include <contrib/cloudabi/syscalldefs_mi.h>
-
-#endif
diff --git a/sys/compat/cloudabi/cloudabi_thread.c b/sys/compat/cloudabi/cloudabi_thread.c
index 8aee708..37dc794 100644
--- a/sys/compat/cloudabi/cloudabi_thread.c
+++ b/sys/compat/cloudabi/cloudabi_thread.c
@@ -31,8 +31,9 @@ __FBSDID("$FreeBSD$");
#include <sys/sched.h>
#include <sys/syscallsubr.h>
+#include <contrib/cloudabi/cloudabi_types_common.h>
+
#include <compat/cloudabi/cloudabi_proto.h>
-#include <compat/cloudabi/cloudabi_syscalldefs.h>
int
cloudabi_sys_thread_exit(struct thread *td,
diff --git a/sys/compat/cloudabi/cloudabi_util.h b/sys/compat/cloudabi/cloudabi_util.h
index 10da229..c0a02aa 100644
--- a/sys/compat/cloudabi/cloudabi_util.h
+++ b/sys/compat/cloudabi/cloudabi_util.h
@@ -30,7 +30,7 @@
#include <sys/socket.h>
-#include <compat/cloudabi/cloudabi_syscalldefs.h>
+#include <contrib/cloudabi/cloudabi_types_common.h>
struct file;
struct thread;
@@ -67,13 +67,13 @@ int cloudabi_convert_timespec(const struct timespec *, cloudabi_timestamp_t *);
* sleep on a lock or condition variable.
*/
int cloudabi_futex_condvar_wait(struct thread *, cloudabi_condvar_t *,
- cloudabi_mflags_t, cloudabi_lock_t *, cloudabi_mflags_t, cloudabi_clockid_t,
+ cloudabi_scope_t, cloudabi_lock_t *, cloudabi_scope_t, cloudabi_clockid_t,
cloudabi_timestamp_t, cloudabi_timestamp_t);
int cloudabi_futex_lock_rdlock(struct thread *, cloudabi_lock_t *,
- cloudabi_mflags_t, cloudabi_clockid_t, cloudabi_timestamp_t,
+ cloudabi_scope_t, cloudabi_clockid_t, cloudabi_timestamp_t,
cloudabi_timestamp_t);
int cloudabi_futex_lock_wrlock(struct thread *, cloudabi_lock_t *,
- cloudabi_mflags_t, cloudabi_clockid_t, cloudabi_timestamp_t,
+ cloudabi_scope_t, cloudabi_clockid_t, cloudabi_timestamp_t,
cloudabi_timestamp_t);
#endif
diff --git a/sys/compat/cloudabi64/Makefile b/sys/compat/cloudabi64/Makefile
index 3fbef57..83d27a3 100644
--- a/sys/compat/cloudabi64/Makefile
+++ b/sys/compat/cloudabi64/Makefile
@@ -8,5 +8,7 @@ sysent: cloudabi64_sysent.c cloudabi64_syscall.h cloudabi64_proto.h \
cloudabi64_sysent.c cloudabi64_syscall.h cloudabi64_proto.h \
cloudabi64_syscalls.c cloudabi64_systrace_args.c: \
- ../../kern/makesyscalls.sh syscalls.master syscalls.conf
- sh ../../kern/makesyscalls.sh syscalls.master syscalls.conf
+ ../../kern/makesyscalls.sh ../../contrib/cloudabi/syscalls.master \
+ syscalls.conf
+ sh ../../kern/makesyscalls.sh ../../contrib/cloudabi/syscalls.master \
+ syscalls.conf
diff --git a/sys/compat/cloudabi64/cloudabi64_fd.c b/sys/compat/cloudabi64/cloudabi64_fd.c
index b2fd67d..7d0c69a 100644
--- a/sys/compat/cloudabi64/cloudabi64_fd.c
+++ b/sys/compat/cloudabi64/cloudabi64_fd.c
@@ -34,7 +34,8 @@ __FBSDID("$FreeBSD$");
#include <sys/systm.h>
#include <sys/uio.h>
-#include <compat/cloudabi64/cloudabi64_syscalldefs.h>
+#include <contrib/cloudabi/cloudabi64_types.h>
+
#include <compat/cloudabi64/cloudabi64_proto.h>
/* Copies in 64-bit iovec structures from userspace. */
diff --git a/sys/compat/cloudabi64/cloudabi64_module.c b/sys/compat/cloudabi64/cloudabi64_module.c
index ca8ecf4..de890bc 100644
--- a/sys/compat/cloudabi64/cloudabi64_module.c
+++ b/sys/compat/cloudabi64/cloudabi64_module.c
@@ -36,7 +36,8 @@ __FBSDID("$FreeBSD$");
#include <sys/sysent.h>
#include <sys/systm.h>
-#include <compat/cloudabi64/cloudabi64_syscalldefs.h>
+#include <contrib/cloudabi/cloudabi64_types.h>
+
#include <compat/cloudabi64/cloudabi64_util.h>
register_t *
@@ -98,6 +99,7 @@ cloudabi64_fixup(register_t **stack_base, struct image_params *imgp)
#define PTR(type, ptr) { .a_type = (type), .a_ptr = (uintptr_t)(ptr) }
PTR(CLOUDABI_AT_ARGDATA, argdata),
VAL(CLOUDABI_AT_ARGDATALEN, argdatalen),
+ VAL(CLOUDABI_AT_BASE, args->base),
PTR(CLOUDABI_AT_CANARY, canary),
VAL(CLOUDABI_AT_CANARYLEN, sizeof(canarybuf)),
VAL(CLOUDABI_AT_NCPUS, mp_ncpus),
diff --git a/sys/compat/cloudabi64/cloudabi64_poll.c b/sys/compat/cloudabi64/cloudabi64_poll.c
index c8f1811..e44d69f 100644
--- a/sys/compat/cloudabi64/cloudabi64_poll.c
+++ b/sys/compat/cloudabi64/cloudabi64_poll.c
@@ -30,9 +30,10 @@ __FBSDID("$FreeBSD$");
#include <sys/proc.h>
#include <sys/syscallsubr.h>
+#include <contrib/cloudabi/cloudabi64_types.h>
+
#include <compat/cloudabi/cloudabi_util.h>
-#include <compat/cloudabi64/cloudabi64_syscalldefs.h>
#include <compat/cloudabi64/cloudabi64_proto.h>
/* Converts a FreeBSD signal number to a CloudABI signal number. */
@@ -248,7 +249,7 @@ cloudabi64_sys_poll(struct thread *td, struct cloudabi64_sys_poll_args *uap)
* Bandaid to support CloudABI futex constructs that are not
* implemented through FreeBSD's kqueue().
*/
- if (uap->nevents == 1) {
+ if (uap->nsubscriptions == 1) {
cloudabi64_subscription_t sub;
cloudabi64_event_t ev = {};
int error;
@@ -291,7 +292,7 @@ cloudabi64_sys_poll(struct thread *td, struct cloudabi64_sys_poll_args *uap)
td->td_retval[0] = 1;
return (copyout(&ev, uap->out, sizeof(ev)));
}
- } else if (uap->nevents == 2) {
+ } else if (uap->nsubscriptions == 2) {
cloudabi64_subscription_t sub[2];
cloudabi64_event_t ev[2] = {};
int error;
@@ -365,7 +366,7 @@ cloudabi64_sys_poll(struct thread *td, struct cloudabi64_sys_poll_args *uap)
}
}
- return (kern_kevent_anonymous(td, uap->nevents, &copyops));
+ return (kern_kevent_anonymous(td, uap->nsubscriptions, &copyops));
}
int
diff --git a/sys/compat/cloudabi64/cloudabi64_proto.h b/sys/compat/cloudabi64/cloudabi64_proto.h
index 8c65fe3..79a0f60 100644
--- a/sys/compat/cloudabi64/cloudabi64_proto.h
+++ b/sys/compat/cloudabi64/cloudabi64_proto.h
@@ -3,7 +3,7 @@
*
* DO NOT EDIT-- this file is automatically generated.
* $FreeBSD$
- * created from FreeBSD: head/sys/compat/cloudabi64/syscalls.master 286318 2015-08-05 13:09:46Z ed
+ * created from FreeBSD: head/sys/contrib/cloudabi/syscalls.master 297468 2016-03-31 18:50:06Z ed
*/
#ifndef _CLOUDABI64_SYSPROTO_H_
@@ -43,7 +43,7 @@ struct cloudabi_sys_clock_time_get_args {
};
struct cloudabi_sys_condvar_signal_args {
char condvar_l_[PADL_(cloudabi_condvar_t *)]; cloudabi_condvar_t * condvar; char condvar_r_[PADR_(cloudabi_condvar_t *)];
- char scope_l_[PADL_(cloudabi_mflags_t)]; cloudabi_mflags_t scope; char scope_r_[PADR_(cloudabi_mflags_t)];
+ char scope_l_[PADL_(cloudabi_scope_t)]; cloudabi_scope_t scope; char scope_r_[PADR_(cloudabi_scope_t)];
char nwaiters_l_[PADL_(cloudabi_nthreads_t)]; cloudabi_nthreads_t nwaiters; char nwaiters_r_[PADR_(cloudabi_nthreads_t)];
};
struct cloudabi_sys_fd_close_args {
@@ -64,19 +64,19 @@ struct cloudabi_sys_fd_dup_args {
struct cloudabi64_sys_fd_pread_args {
char fd_l_[PADL_(cloudabi_fd_t)]; cloudabi_fd_t fd; char fd_r_[PADR_(cloudabi_fd_t)];
char iov_l_[PADL_(const cloudabi64_iovec_t *)]; const cloudabi64_iovec_t * iov; char iov_r_[PADR_(const cloudabi64_iovec_t *)];
- char iovcnt_l_[PADL_(cloudabi64_size_t)]; cloudabi64_size_t iovcnt; char iovcnt_r_[PADR_(cloudabi64_size_t)];
+ char iovcnt_l_[PADL_(size_t)]; size_t iovcnt; char iovcnt_r_[PADR_(size_t)];
char offset_l_[PADL_(cloudabi_filesize_t)]; cloudabi_filesize_t offset; char offset_r_[PADR_(cloudabi_filesize_t)];
};
struct cloudabi64_sys_fd_pwrite_args {
char fd_l_[PADL_(cloudabi_fd_t)]; cloudabi_fd_t fd; char fd_r_[PADR_(cloudabi_fd_t)];
char iov_l_[PADL_(const cloudabi64_ciovec_t *)]; const cloudabi64_ciovec_t * iov; char iov_r_[PADR_(const cloudabi64_ciovec_t *)];
- char iovcnt_l_[PADL_(cloudabi64_size_t)]; cloudabi64_size_t iovcnt; char iovcnt_r_[PADR_(cloudabi64_size_t)];
+ char iovcnt_l_[PADL_(size_t)]; size_t iovcnt; char iovcnt_r_[PADR_(size_t)];
char offset_l_[PADL_(cloudabi_filesize_t)]; cloudabi_filesize_t offset; char offset_r_[PADR_(cloudabi_filesize_t)];
};
struct cloudabi64_sys_fd_read_args {
char fd_l_[PADL_(cloudabi_fd_t)]; cloudabi_fd_t fd; char fd_r_[PADR_(cloudabi_fd_t)];
char iov_l_[PADL_(const cloudabi64_iovec_t *)]; const cloudabi64_iovec_t * iov; char iov_r_[PADR_(const cloudabi64_iovec_t *)];
- char iovcnt_l_[PADL_(cloudabi64_size_t)]; cloudabi64_size_t iovcnt; char iovcnt_r_[PADR_(cloudabi64_size_t)];
+ char iovcnt_l_[PADL_(size_t)]; size_t iovcnt; char iovcnt_r_[PADR_(size_t)];
};
struct cloudabi_sys_fd_replace_args {
char from_l_[PADL_(cloudabi_fd_t)]; cloudabi_fd_t from; char from_r_[PADR_(cloudabi_fd_t)];
@@ -102,7 +102,7 @@ struct cloudabi_sys_fd_sync_args {
struct cloudabi64_sys_fd_write_args {
char fd_l_[PADL_(cloudabi_fd_t)]; cloudabi_fd_t fd; char fd_r_[PADR_(cloudabi_fd_t)];
char iov_l_[PADL_(const cloudabi64_ciovec_t *)]; const cloudabi64_ciovec_t * iov; char iov_r_[PADR_(const cloudabi64_ciovec_t *)];
- char iovcnt_l_[PADL_(cloudabi64_size_t)]; cloudabi64_size_t iovcnt; char iovcnt_r_[PADR_(cloudabi64_size_t)];
+ char iovcnt_l_[PADL_(size_t)]; size_t iovcnt; char iovcnt_r_[PADR_(size_t)];
};
struct cloudabi_sys_file_advise_args {
char fd_l_[PADL_(cloudabi_fd_t)]; cloudabi_fd_t fd; char fd_r_[PADR_(cloudabi_fd_t)];
@@ -130,7 +130,7 @@ struct cloudabi_sys_file_link_args {
char path2len_l_[PADL_(size_t)]; size_t path2len; char path2len_r_[PADR_(size_t)];
};
struct cloudabi_sys_file_open_args {
- char fd_l_[PADL_(cloudabi_lookup_t)]; cloudabi_lookup_t fd; char fd_r_[PADR_(cloudabi_lookup_t)];
+ char dirfd_l_[PADL_(cloudabi_lookup_t)]; cloudabi_lookup_t dirfd; char dirfd_r_[PADR_(cloudabi_lookup_t)];
char path_l_[PADL_(const char *)]; const char * path; char path_r_[PADR_(const char *)];
char pathlen_l_[PADL_(size_t)]; size_t pathlen; char pathlen_r_[PADR_(size_t)];
char oflags_l_[PADL_(cloudabi_oflags_t)]; cloudabi_oflags_t oflags; char oflags_r_[PADR_(cloudabi_oflags_t)];
@@ -146,7 +146,7 @@ struct cloudabi_sys_file_readlink_args {
char fd_l_[PADL_(cloudabi_fd_t)]; cloudabi_fd_t fd; char fd_r_[PADR_(cloudabi_fd_t)];
char path_l_[PADL_(const char *)]; const char * path; char path_r_[PADR_(const char *)];
char pathlen_l_[PADL_(size_t)]; size_t pathlen; char pathlen_r_[PADR_(size_t)];
- char buf_l_[PADL_(void *)]; void * buf; char buf_r_[PADR_(void *)];
+ char buf_l_[PADL_(char *)]; char * buf; char buf_r_[PADR_(char *)];
char bufsize_l_[PADL_(size_t)]; size_t bufsize; char bufsize_r_[PADR_(size_t)];
};
struct cloudabi_sys_file_rename_args {
@@ -190,11 +190,11 @@ struct cloudabi_sys_file_unlink_args {
char fd_l_[PADL_(cloudabi_fd_t)]; cloudabi_fd_t fd; char fd_r_[PADR_(cloudabi_fd_t)];
char path_l_[PADL_(const char *)]; const char * path; char path_r_[PADR_(const char *)];
char pathlen_l_[PADL_(size_t)]; size_t pathlen; char pathlen_r_[PADR_(size_t)];
- char flag_l_[PADL_(cloudabi_ulflags_t)]; cloudabi_ulflags_t flag; char flag_r_[PADR_(cloudabi_ulflags_t)];
+ char flags_l_[PADL_(cloudabi_ulflags_t)]; cloudabi_ulflags_t flags; char flags_r_[PADR_(cloudabi_ulflags_t)];
};
struct cloudabi_sys_lock_unlock_args {
char lock_l_[PADL_(cloudabi_lock_t *)]; cloudabi_lock_t * lock; char lock_r_[PADR_(cloudabi_lock_t *)];
- char scope_l_[PADL_(cloudabi_mflags_t)]; cloudabi_mflags_t scope; char scope_r_[PADR_(cloudabi_mflags_t)];
+ char scope_l_[PADL_(cloudabi_scope_t)]; cloudabi_scope_t scope; char scope_r_[PADR_(cloudabi_scope_t)];
};
struct cloudabi_sys_mem_advise_args {
char addr_l_[PADL_(void *)]; void * addr; char addr_r_[PADR_(void *)];
@@ -234,7 +234,7 @@ struct cloudabi_sys_mem_unmap_args {
struct cloudabi64_sys_poll_args {
char in_l_[PADL_(const cloudabi64_subscription_t *)]; const cloudabi64_subscription_t * in; char in_r_[PADR_(const cloudabi64_subscription_t *)];
char out_l_[PADL_(cloudabi64_event_t *)]; cloudabi64_event_t * out; char out_r_[PADR_(cloudabi64_event_t *)];
- char nevents_l_[PADL_(cloudabi64_size_t)]; cloudabi64_size_t nevents; char nevents_r_[PADR_(cloudabi64_size_t)];
+ char nsubscriptions_l_[PADL_(size_t)]; size_t nsubscriptions; char nsubscriptions_r_[PADR_(size_t)];
};
struct cloudabi_sys_proc_exec_args {
char fd_l_[PADL_(cloudabi_fd_t)]; cloudabi_fd_t fd; char fd_r_[PADR_(cloudabi_fd_t)];
@@ -257,41 +257,41 @@ struct cloudabi_sys_random_get_args {
char nbyte_l_[PADL_(size_t)]; size_t nbyte; char nbyte_r_[PADR_(size_t)];
};
struct cloudabi_sys_sock_accept_args {
- char s_l_[PADL_(cloudabi_fd_t)]; cloudabi_fd_t s; char s_r_[PADR_(cloudabi_fd_t)];
+ char sock_l_[PADL_(cloudabi_fd_t)]; cloudabi_fd_t sock; char sock_r_[PADR_(cloudabi_fd_t)];
char buf_l_[PADL_(cloudabi_sockstat_t *)]; cloudabi_sockstat_t * buf; char buf_r_[PADR_(cloudabi_sockstat_t *)];
};
struct cloudabi_sys_sock_bind_args {
- char s_l_[PADL_(cloudabi_fd_t)]; cloudabi_fd_t s; char s_r_[PADR_(cloudabi_fd_t)];
+ char sock_l_[PADL_(cloudabi_fd_t)]; cloudabi_fd_t sock; char sock_r_[PADR_(cloudabi_fd_t)];
char fd_l_[PADL_(cloudabi_fd_t)]; cloudabi_fd_t fd; char fd_r_[PADR_(cloudabi_fd_t)];
char path_l_[PADL_(const char *)]; const char * path; char path_r_[PADR_(const char *)];
char pathlen_l_[PADL_(size_t)]; size_t pathlen; char pathlen_r_[PADR_(size_t)];
};
struct cloudabi_sys_sock_connect_args {
- char s_l_[PADL_(cloudabi_fd_t)]; cloudabi_fd_t s; char s_r_[PADR_(cloudabi_fd_t)];
+ char sock_l_[PADL_(cloudabi_fd_t)]; cloudabi_fd_t sock; char sock_r_[PADR_(cloudabi_fd_t)];
char fd_l_[PADL_(cloudabi_fd_t)]; cloudabi_fd_t fd; char fd_r_[PADR_(cloudabi_fd_t)];
char path_l_[PADL_(const char *)]; const char * path; char path_r_[PADR_(const char *)];
char pathlen_l_[PADL_(size_t)]; size_t pathlen; char pathlen_r_[PADR_(size_t)];
};
struct cloudabi_sys_sock_listen_args {
- char s_l_[PADL_(cloudabi_fd_t)]; cloudabi_fd_t s; char s_r_[PADR_(cloudabi_fd_t)];
+ char sock_l_[PADL_(cloudabi_fd_t)]; cloudabi_fd_t sock; char sock_r_[PADR_(cloudabi_fd_t)];
char backlog_l_[PADL_(cloudabi_backlog_t)]; cloudabi_backlog_t backlog; char backlog_r_[PADR_(cloudabi_backlog_t)];
};
struct cloudabi64_sys_sock_recv_args {
- char s_l_[PADL_(cloudabi_fd_t)]; cloudabi_fd_t s; char s_r_[PADR_(cloudabi_fd_t)];
+ char sock_l_[PADL_(cloudabi_fd_t)]; cloudabi_fd_t sock; char sock_r_[PADR_(cloudabi_fd_t)];
char in_l_[PADL_(const cloudabi64_recv_in_t *)]; const cloudabi64_recv_in_t * in; char in_r_[PADR_(const cloudabi64_recv_in_t *)];
char out_l_[PADL_(cloudabi64_recv_out_t *)]; cloudabi64_recv_out_t * out; char out_r_[PADR_(cloudabi64_recv_out_t *)];
};
struct cloudabi64_sys_sock_send_args {
- char s_l_[PADL_(cloudabi_fd_t)]; cloudabi_fd_t s; char s_r_[PADR_(cloudabi_fd_t)];
+ char sock_l_[PADL_(cloudabi_fd_t)]; cloudabi_fd_t sock; char sock_r_[PADR_(cloudabi_fd_t)];
char in_l_[PADL_(const cloudabi64_send_in_t *)]; const cloudabi64_send_in_t * in; char in_r_[PADR_(const cloudabi64_send_in_t *)];
char out_l_[PADL_(cloudabi64_send_out_t *)]; cloudabi64_send_out_t * out; char out_r_[PADR_(cloudabi64_send_out_t *)];
};
struct cloudabi_sys_sock_shutdown_args {
- char fd_l_[PADL_(cloudabi_fd_t)]; cloudabi_fd_t fd; char fd_r_[PADR_(cloudabi_fd_t)];
+ char sock_l_[PADL_(cloudabi_fd_t)]; cloudabi_fd_t sock; char sock_r_[PADR_(cloudabi_fd_t)];
char how_l_[PADL_(cloudabi_sdflags_t)]; cloudabi_sdflags_t how; char how_r_[PADR_(cloudabi_sdflags_t)];
};
struct cloudabi_sys_sock_stat_get_args {
- char fd_l_[PADL_(cloudabi_fd_t)]; cloudabi_fd_t fd; char fd_r_[PADR_(cloudabi_fd_t)];
+ char sock_l_[PADL_(cloudabi_fd_t)]; cloudabi_fd_t sock; char sock_r_[PADR_(cloudabi_fd_t)];
char buf_l_[PADL_(cloudabi_sockstat_t *)]; cloudabi_sockstat_t * buf; char buf_r_[PADR_(cloudabi_sockstat_t *)];
char flags_l_[PADL_(cloudabi_ssflags_t)]; cloudabi_ssflags_t flags; char flags_r_[PADR_(cloudabi_ssflags_t)];
};
@@ -300,7 +300,7 @@ struct cloudabi64_sys_thread_create_args {
};
struct cloudabi_sys_thread_exit_args {
char lock_l_[PADL_(cloudabi_lock_t *)]; cloudabi_lock_t * lock; char lock_r_[PADR_(cloudabi_lock_t *)];
- char scope_l_[PADL_(cloudabi_mflags_t)]; cloudabi_mflags_t scope; char scope_r_[PADR_(cloudabi_mflags_t)];
+ char scope_l_[PADL_(cloudabi_scope_t)]; cloudabi_scope_t scope; char scope_r_[PADR_(cloudabi_scope_t)];
};
struct cloudabi_sys_thread_tcb_set_args {
char tcb_l_[PADL_(void *)]; void * tcb; char tcb_r_[PADR_(void *)];
@@ -311,9 +311,9 @@ struct cloudabi_sys_thread_yield_args {
struct cloudabi64_sys_poll_fd_args {
char fd_l_[PADL_(cloudabi_fd_t)]; cloudabi_fd_t fd; char fd_r_[PADR_(cloudabi_fd_t)];
char in_l_[PADL_(const cloudabi64_subscription_t *)]; const cloudabi64_subscription_t * in; char in_r_[PADR_(const cloudabi64_subscription_t *)];
- char nin_l_[PADL_(cloudabi64_size_t)]; cloudabi64_size_t nin; char nin_r_[PADR_(cloudabi64_size_t)];
+ char nin_l_[PADL_(size_t)]; size_t nin; char nin_r_[PADR_(size_t)];
char out_l_[PADL_(cloudabi64_event_t *)]; cloudabi64_event_t * out; char out_r_[PADR_(cloudabi64_event_t *)];
- char nout_l_[PADL_(cloudabi64_size_t)]; cloudabi64_size_t nout; char nout_r_[PADR_(cloudabi64_size_t)];
+ char nout_l_[PADL_(size_t)]; size_t nout; char nout_r_[PADR_(size_t)];
char timeout_l_[PADL_(const cloudabi64_subscription_t *)]; const cloudabi64_subscription_t * timeout; char timeout_r_[PADR_(const cloudabi64_subscription_t *)];
};
int cloudabi_sys_clock_res_get(struct thread *, struct cloudabi_sys_clock_res_get_args *);
diff --git a/sys/compat/cloudabi64/cloudabi64_sock.c b/sys/compat/cloudabi64/cloudabi64_sock.c
index c612a32..e6b9c94 100644
--- a/sys/compat/cloudabi64/cloudabi64_sock.c
+++ b/sys/compat/cloudabi64/cloudabi64_sock.c
@@ -35,9 +35,10 @@ __FBSDID("$FreeBSD$");
#include <sys/systm.h>
#include <sys/uio.h>
+#include <contrib/cloudabi/cloudabi64_types.h>
+
#include <compat/cloudabi/cloudabi_util.h>
-#include <compat/cloudabi64/cloudabi64_syscalldefs.h>
#include <compat/cloudabi64/cloudabi64_proto.h>
static MALLOC_DEFINE(M_SOCKET, "socket", "CloudABI socket");
@@ -82,7 +83,7 @@ cloudabi64_sys_sock_recv(struct thread *td,
msghdr.msg_flags |= MSG_WAITALL;
/* TODO(ed): Add file descriptor passing. */
- error = kern_recvit(td, uap->s, &msghdr, UIO_SYSSPACE, NULL);
+ error = kern_recvit(td, uap->sock, &msghdr, UIO_SYSSPACE, NULL);
free(msghdr.msg_iov, M_SOCKET);
if (error != 0)
return (error);
@@ -132,7 +133,7 @@ cloudabi64_sys_sock_send(struct thread *td,
flags |= MSG_EOR;
/* TODO(ed): Add file descriptor passing. */
- error = kern_sendit(td, uap->s, &msghdr, flags, NULL, UIO_USERSPACE);
+ error = kern_sendit(td, uap->sock, &msghdr, flags, NULL, UIO_USERSPACE);
free(msghdr.msg_iov, M_SOCKET);
if (error != 0)
return (error);
diff --git a/sys/compat/cloudabi64/cloudabi64_syscall.h b/sys/compat/cloudabi64/cloudabi64_syscall.h
index 40c017a..b5694bf 100644
--- a/sys/compat/cloudabi64/cloudabi64_syscall.h
+++ b/sys/compat/cloudabi64/cloudabi64_syscall.h
@@ -3,7 +3,7 @@
*
* DO NOT EDIT-- this file is automatically generated.
* $FreeBSD$
- * created from FreeBSD: head/sys/compat/cloudabi64/syscalls.master 286318 2015-08-05 13:09:46Z ed
+ * created from FreeBSD: head/sys/contrib/cloudabi/syscalls.master 297468 2016-03-31 18:50:06Z ed
*/
#define CLOUDABI64_SYS_cloudabi_sys_clock_res_get 0
diff --git a/sys/compat/cloudabi64/cloudabi64_syscalldefs.h b/sys/compat/cloudabi64/cloudabi64_syscalldefs.h
deleted file mode 100644
index d57f5f4..0000000
--- a/sys/compat/cloudabi64/cloudabi64_syscalldefs.h
+++ /dev/null
@@ -1,45 +0,0 @@
-/*-
- * Copyright (c) 2015 Nuxi, https://nuxi.nl/
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * $FreeBSD$
- */
-
-#ifndef _CLOUDABI64_SYSCALLDEFS_H_
-#define _CLOUDABI64_SYSCALLDEFS_H_
-
-#include <sys/types.h>
-
-#include <compat/cloudabi/cloudabi_syscalldefs.h>
-
-typedef uint64_t cloudabi64_size_t;
-typedef uint64_t cloudabi64_uintptr_t;
-
-/* Import machine-dependent CloudABI definitions for 64-bit systems. */
-#define IDENT(ident) cloudabi64_##ident
-#define PTR(type) cloudabi64_uintptr_t
-#include <contrib/cloudabi/syscalldefs_md.h>
-#undef IDENT
-#undef PTR
-
-#endif
diff --git a/sys/compat/cloudabi64/cloudabi64_syscalls.c b/sys/compat/cloudabi64/cloudabi64_syscalls.c
index 5c0732b..03407ff 100644
--- a/sys/compat/cloudabi64/cloudabi64_syscalls.c
+++ b/sys/compat/cloudabi64/cloudabi64_syscalls.c
@@ -3,7 +3,7 @@
*
* DO NOT EDIT-- this file is automatically generated.
* $FreeBSD$
- * created from FreeBSD: head/sys/compat/cloudabi64/syscalls.master 286318 2015-08-05 13:09:46Z ed
+ * created from FreeBSD: head/sys/contrib/cloudabi/syscalls.master 297468 2016-03-31 18:50:06Z ed
*/
const char *cloudabi64_syscallnames[] = {
diff --git a/sys/compat/cloudabi64/cloudabi64_sysent.c b/sys/compat/cloudabi64/cloudabi64_sysent.c
index 2ed5042..50f4a65 100644
--- a/sys/compat/cloudabi64/cloudabi64_sysent.c
+++ b/sys/compat/cloudabi64/cloudabi64_sysent.c
@@ -3,12 +3,12 @@
*
* DO NOT EDIT-- this file is automatically generated.
* $FreeBSD$
- * created from FreeBSD: head/sys/compat/cloudabi64/syscalls.master 286318 2015-08-05 13:09:46Z ed
+ * created from FreeBSD: head/sys/contrib/cloudabi/syscalls.master 297468 2016-03-31 18:50:06Z ed
*/
#include <sys/sysent.h>
#include <sys/sysproto.h>
-#include <compat/cloudabi64/cloudabi64_syscalldefs.h>
+#include <contrib/cloudabi/cloudabi64_types.h>
#include <compat/cloudabi64/cloudabi64_proto.h>
#define AS(name) (sizeof(struct name) / sizeof(register_t))
diff --git a/sys/compat/cloudabi64/cloudabi64_systrace_args.c b/sys/compat/cloudabi64/cloudabi64_systrace_args.c
index b3176aa..9429e8e 100644
--- a/sys/compat/cloudabi64/cloudabi64_systrace_args.c
+++ b/sys/compat/cloudabi64/cloudabi64_systrace_args.c
@@ -30,7 +30,7 @@ systrace_args(int sysnum, void *params, uint64_t *uarg, int *n_args)
case 2: {
struct cloudabi_sys_condvar_signal_args *p = params;
uarg[0] = (intptr_t) p->condvar; /* cloudabi_condvar_t * */
- iarg[1] = p->scope; /* cloudabi_mflags_t */
+ iarg[1] = p->scope; /* cloudabi_scope_t */
iarg[2] = p->nwaiters; /* cloudabi_nthreads_t */
*n_args = 3;
break;
@@ -75,7 +75,7 @@ systrace_args(int sysnum, void *params, uint64_t *uarg, int *n_args)
struct cloudabi64_sys_fd_pread_args *p = params;
iarg[0] = p->fd; /* cloudabi_fd_t */
uarg[1] = (intptr_t) p->iov; /* const cloudabi64_iovec_t * */
- iarg[2] = p->iovcnt; /* cloudabi64_size_t */
+ uarg[2] = p->iovcnt; /* size_t */
iarg[3] = p->offset; /* cloudabi_filesize_t */
*n_args = 4;
break;
@@ -85,7 +85,7 @@ systrace_args(int sysnum, void *params, uint64_t *uarg, int *n_args)
struct cloudabi64_sys_fd_pwrite_args *p = params;
iarg[0] = p->fd; /* cloudabi_fd_t */
uarg[1] = (intptr_t) p->iov; /* const cloudabi64_ciovec_t * */
- iarg[2] = p->iovcnt; /* cloudabi64_size_t */
+ uarg[2] = p->iovcnt; /* size_t */
iarg[3] = p->offset; /* cloudabi_filesize_t */
*n_args = 4;
break;
@@ -95,7 +95,7 @@ systrace_args(int sysnum, void *params, uint64_t *uarg, int *n_args)
struct cloudabi64_sys_fd_read_args *p = params;
iarg[0] = p->fd; /* cloudabi_fd_t */
uarg[1] = (intptr_t) p->iov; /* const cloudabi64_iovec_t * */
- iarg[2] = p->iovcnt; /* cloudabi64_size_t */
+ uarg[2] = p->iovcnt; /* size_t */
*n_args = 3;
break;
}
@@ -145,7 +145,7 @@ systrace_args(int sysnum, void *params, uint64_t *uarg, int *n_args)
struct cloudabi64_sys_fd_write_args *p = params;
iarg[0] = p->fd; /* cloudabi_fd_t */
uarg[1] = (intptr_t) p->iov; /* const cloudabi64_ciovec_t * */
- iarg[2] = p->iovcnt; /* cloudabi64_size_t */
+ uarg[2] = p->iovcnt; /* size_t */
*n_args = 3;
break;
}
@@ -193,7 +193,7 @@ systrace_args(int sysnum, void *params, uint64_t *uarg, int *n_args)
/* cloudabi_sys_file_open */
case 21: {
struct cloudabi_sys_file_open_args *p = params;
- iarg[0] = p->fd; /* cloudabi_lookup_t */
+ iarg[0] = p->dirfd; /* cloudabi_lookup_t */
uarg[1] = (intptr_t) p->path; /* const char * */
uarg[2] = p->pathlen; /* size_t */
iarg[3] = p->oflags; /* cloudabi_oflags_t */
@@ -217,7 +217,7 @@ systrace_args(int sysnum, void *params, uint64_t *uarg, int *n_args)
iarg[0] = p->fd; /* cloudabi_fd_t */
uarg[1] = (intptr_t) p->path; /* const char * */
uarg[2] = p->pathlen; /* size_t */
- uarg[3] = (intptr_t) p->buf; /* void * */
+ uarg[3] = (intptr_t) p->buf; /* char * */
uarg[4] = p->bufsize; /* size_t */
*n_args = 5;
break;
@@ -289,7 +289,7 @@ systrace_args(int sysnum, void *params, uint64_t *uarg, int *n_args)
iarg[0] = p->fd; /* cloudabi_fd_t */
uarg[1] = (intptr_t) p->path; /* const char * */
uarg[2] = p->pathlen; /* size_t */
- iarg[3] = p->flag; /* cloudabi_ulflags_t */
+ iarg[3] = p->flags; /* cloudabi_ulflags_t */
*n_args = 4;
break;
}
@@ -297,7 +297,7 @@ systrace_args(int sysnum, void *params, uint64_t *uarg, int *n_args)
case 31: {
struct cloudabi_sys_lock_unlock_args *p = params;
uarg[0] = (intptr_t) p->lock; /* cloudabi_lock_t * */
- iarg[1] = p->scope; /* cloudabi_mflags_t */
+ iarg[1] = p->scope; /* cloudabi_scope_t */
*n_args = 2;
break;
}
@@ -369,7 +369,7 @@ systrace_args(int sysnum, void *params, uint64_t *uarg, int *n_args)
struct cloudabi64_sys_poll_args *p = params;
uarg[0] = (intptr_t) p->in; /* const cloudabi64_subscription_t * */
uarg[1] = (intptr_t) p->out; /* cloudabi64_event_t * */
- iarg[2] = p->nevents; /* cloudabi64_size_t */
+ uarg[2] = p->nsubscriptions; /* size_t */
*n_args = 3;
break;
}
@@ -414,7 +414,7 @@ systrace_args(int sysnum, void *params, uint64_t *uarg, int *n_args)
/* cloudabi_sys_sock_accept */
case 45: {
struct cloudabi_sys_sock_accept_args *p = params;
- iarg[0] = p->s; /* cloudabi_fd_t */
+ iarg[0] = p->sock; /* cloudabi_fd_t */
uarg[1] = (intptr_t) p->buf; /* cloudabi_sockstat_t * */
*n_args = 2;
break;
@@ -422,7 +422,7 @@ systrace_args(int sysnum, void *params, uint64_t *uarg, int *n_args)
/* cloudabi_sys_sock_bind */
case 46: {
struct cloudabi_sys_sock_bind_args *p = params;
- iarg[0] = p->s; /* cloudabi_fd_t */
+ iarg[0] = p->sock; /* cloudabi_fd_t */
iarg[1] = p->fd; /* cloudabi_fd_t */
uarg[2] = (intptr_t) p->path; /* const char * */
uarg[3] = p->pathlen; /* size_t */
@@ -432,7 +432,7 @@ systrace_args(int sysnum, void *params, uint64_t *uarg, int *n_args)
/* cloudabi_sys_sock_connect */
case 47: {
struct cloudabi_sys_sock_connect_args *p = params;
- iarg[0] = p->s; /* cloudabi_fd_t */
+ iarg[0] = p->sock; /* cloudabi_fd_t */
iarg[1] = p->fd; /* cloudabi_fd_t */
uarg[2] = (intptr_t) p->path; /* const char * */
uarg[3] = p->pathlen; /* size_t */
@@ -442,7 +442,7 @@ systrace_args(int sysnum, void *params, uint64_t *uarg, int *n_args)
/* cloudabi_sys_sock_listen */
case 48: {
struct cloudabi_sys_sock_listen_args *p = params;
- iarg[0] = p->s; /* cloudabi_fd_t */
+ iarg[0] = p->sock; /* cloudabi_fd_t */
iarg[1] = p->backlog; /* cloudabi_backlog_t */
*n_args = 2;
break;
@@ -450,7 +450,7 @@ systrace_args(int sysnum, void *params, uint64_t *uarg, int *n_args)
/* cloudabi64_sys_sock_recv */
case 49: {
struct cloudabi64_sys_sock_recv_args *p = params;
- iarg[0] = p->s; /* cloudabi_fd_t */
+ iarg[0] = p->sock; /* cloudabi_fd_t */
uarg[1] = (intptr_t) p->in; /* const cloudabi64_recv_in_t * */
uarg[2] = (intptr_t) p->out; /* cloudabi64_recv_out_t * */
*n_args = 3;
@@ -459,7 +459,7 @@ systrace_args(int sysnum, void *params, uint64_t *uarg, int *n_args)
/* cloudabi64_sys_sock_send */
case 50: {
struct cloudabi64_sys_sock_send_args *p = params;
- iarg[0] = p->s; /* cloudabi_fd_t */
+ iarg[0] = p->sock; /* cloudabi_fd_t */
uarg[1] = (intptr_t) p->in; /* const cloudabi64_send_in_t * */
uarg[2] = (intptr_t) p->out; /* cloudabi64_send_out_t * */
*n_args = 3;
@@ -468,7 +468,7 @@ systrace_args(int sysnum, void *params, uint64_t *uarg, int *n_args)
/* cloudabi_sys_sock_shutdown */
case 51: {
struct cloudabi_sys_sock_shutdown_args *p = params;
- iarg[0] = p->fd; /* cloudabi_fd_t */
+ iarg[0] = p->sock; /* cloudabi_fd_t */
iarg[1] = p->how; /* cloudabi_sdflags_t */
*n_args = 2;
break;
@@ -476,7 +476,7 @@ systrace_args(int sysnum, void *params, uint64_t *uarg, int *n_args)
/* cloudabi_sys_sock_stat_get */
case 52: {
struct cloudabi_sys_sock_stat_get_args *p = params;
- iarg[0] = p->fd; /* cloudabi_fd_t */
+ iarg[0] = p->sock; /* cloudabi_fd_t */
uarg[1] = (intptr_t) p->buf; /* cloudabi_sockstat_t * */
iarg[2] = p->flags; /* cloudabi_ssflags_t */
*n_args = 3;
@@ -493,7 +493,7 @@ systrace_args(int sysnum, void *params, uint64_t *uarg, int *n_args)
case 54: {
struct cloudabi_sys_thread_exit_args *p = params;
uarg[0] = (intptr_t) p->lock; /* cloudabi_lock_t * */
- iarg[1] = p->scope; /* cloudabi_mflags_t */
+ iarg[1] = p->scope; /* cloudabi_scope_t */
*n_args = 2;
break;
}
@@ -514,9 +514,9 @@ systrace_args(int sysnum, void *params, uint64_t *uarg, int *n_args)
struct cloudabi64_sys_poll_fd_args *p = params;
iarg[0] = p->fd; /* cloudabi_fd_t */
uarg[1] = (intptr_t) p->in; /* const cloudabi64_subscription_t * */
- iarg[2] = p->nin; /* cloudabi64_size_t */
+ uarg[2] = p->nin; /* size_t */
uarg[3] = (intptr_t) p->out; /* cloudabi64_event_t * */
- iarg[4] = p->nout; /* cloudabi64_size_t */
+ uarg[4] = p->nout; /* size_t */
uarg[5] = (intptr_t) p->timeout; /* const cloudabi64_subscription_t * */
*n_args = 6;
break;
@@ -561,7 +561,7 @@ systrace_entry_setargdesc(int sysnum, int ndx, char *desc, size_t descsz)
p = "cloudabi_condvar_t *";
break;
case 1:
- p = "cloudabi_mflags_t";
+ p = "cloudabi_scope_t";
break;
case 2:
p = "cloudabi_nthreads_t";
@@ -630,7 +630,7 @@ systrace_entry_setargdesc(int sysnum, int ndx, char *desc, size_t descsz)
p = "const cloudabi64_iovec_t *";
break;
case 2:
- p = "cloudabi64_size_t";
+ p = "size_t";
break;
case 3:
p = "cloudabi_filesize_t";
@@ -649,7 +649,7 @@ systrace_entry_setargdesc(int sysnum, int ndx, char *desc, size_t descsz)
p = "const cloudabi64_ciovec_t *";
break;
case 2:
- p = "cloudabi64_size_t";
+ p = "size_t";
break;
case 3:
p = "cloudabi_filesize_t";
@@ -668,7 +668,7 @@ systrace_entry_setargdesc(int sysnum, int ndx, char *desc, size_t descsz)
p = "const cloudabi64_iovec_t *";
break;
case 2:
- p = "cloudabi64_size_t";
+ p = "size_t";
break;
default:
break;
@@ -752,7 +752,7 @@ systrace_entry_setargdesc(int sysnum, int ndx, char *desc, size_t descsz)
p = "const cloudabi64_ciovec_t *";
break;
case 2:
- p = "cloudabi64_size_t";
+ p = "size_t";
break;
default:
break;
@@ -891,7 +891,7 @@ systrace_entry_setargdesc(int sysnum, int ndx, char *desc, size_t descsz)
p = "size_t";
break;
case 3:
- p = "void *";
+ p = "char *";
break;
case 4:
p = "size_t";
@@ -1043,7 +1043,7 @@ systrace_entry_setargdesc(int sysnum, int ndx, char *desc, size_t descsz)
p = "cloudabi_lock_t *";
break;
case 1:
- p = "cloudabi_mflags_t";
+ p = "cloudabi_scope_t";
break;
default:
break;
@@ -1171,7 +1171,7 @@ systrace_entry_setargdesc(int sysnum, int ndx, char *desc, size_t descsz)
p = "cloudabi64_event_t *";
break;
case 2:
- p = "cloudabi64_size_t";
+ p = "size_t";
break;
default:
break;
@@ -1377,7 +1377,7 @@ systrace_entry_setargdesc(int sysnum, int ndx, char *desc, size_t descsz)
p = "cloudabi_lock_t *";
break;
case 1:
- p = "cloudabi_mflags_t";
+ p = "cloudabi_scope_t";
break;
default:
break;
@@ -1406,13 +1406,13 @@ systrace_entry_setargdesc(int sysnum, int ndx, char *desc, size_t descsz)
p = "const cloudabi64_subscription_t *";
break;
case 2:
- p = "cloudabi64_size_t";
+ p = "size_t";
break;
case 3:
p = "cloudabi64_event_t *";
break;
case 4:
- p = "cloudabi64_size_t";
+ p = "size_t";
break;
case 5:
p = "const cloudabi64_subscription_t *";
@@ -1475,17 +1475,17 @@ systrace_return_setargdesc(int sysnum, int ndx, char *desc, size_t descsz)
/* cloudabi64_sys_fd_pread */
case 8:
if (ndx == 0 || ndx == 1)
- p = "cloudabi64_size_t";
+ p = "size_t";
break;
/* cloudabi64_sys_fd_pwrite */
case 9:
if (ndx == 0 || ndx == 1)
- p = "cloudabi64_size_t";
+ p = "size_t";
break;
/* cloudabi64_sys_fd_read */
case 10:
if (ndx == 0 || ndx == 1)
- p = "cloudabi64_size_t";
+ p = "size_t";
break;
/* cloudabi_sys_fd_replace */
case 11:
@@ -1515,7 +1515,7 @@ systrace_return_setargdesc(int sysnum, int ndx, char *desc, size_t descsz)
/* cloudabi64_sys_fd_write */
case 16:
if (ndx == 0 || ndx == 1)
- p = "cloudabi64_size_t";
+ p = "size_t";
break;
/* cloudabi_sys_file_advise */
case 17:
@@ -1630,7 +1630,7 @@ systrace_return_setargdesc(int sysnum, int ndx, char *desc, size_t descsz)
/* cloudabi64_sys_poll */
case 39:
if (ndx == 0 || ndx == 1)
- p = "cloudabi64_size_t";
+ p = "size_t";
break;
/* cloudabi_sys_proc_exec */
case 40:
@@ -1677,12 +1677,12 @@ systrace_return_setargdesc(int sysnum, int ndx, char *desc, size_t descsz)
/* cloudabi64_sys_sock_recv */
case 49:
if (ndx == 0 || ndx == 1)
- p = "cloudabi64_size_t";
+ p = "void";
break;
/* cloudabi64_sys_sock_send */
case 50:
if (ndx == 0 || ndx == 1)
- p = "cloudabi64_size_t";
+ p = "void";
break;
/* cloudabi_sys_sock_shutdown */
case 51:
@@ -1714,7 +1714,7 @@ systrace_return_setargdesc(int sysnum, int ndx, char *desc, size_t descsz)
/* cloudabi64_sys_poll_fd */
case 57:
if (ndx == 0 || ndx == 1)
- p = "cloudabi64_size_t";
+ p = "size_t";
break;
default:
break;
diff --git a/sys/compat/cloudabi64/cloudabi64_thread.c b/sys/compat/cloudabi64/cloudabi64_thread.c
index 04b1782..51961f8 100644
--- a/sys/compat/cloudabi64/cloudabi64_thread.c
+++ b/sys/compat/cloudabi64/cloudabi64_thread.c
@@ -30,7 +30,8 @@ __FBSDID("$FreeBSD$");
#include <sys/proc.h>
#include <sys/systm.h>
-#include <compat/cloudabi64/cloudabi64_syscalldefs.h>
+#include <contrib/cloudabi/cloudabi64_types.h>
+
#include <compat/cloudabi64/cloudabi64_proto.h>
#include <compat/cloudabi64/cloudabi64_util.h>
diff --git a/sys/compat/cloudabi64/cloudabi64_util.h b/sys/compat/cloudabi64/cloudabi64_util.h
index 180a01e..dcec70e 100644
--- a/sys/compat/cloudabi64/cloudabi64_util.h
+++ b/sys/compat/cloudabi64/cloudabi64_util.h
@@ -31,7 +31,7 @@
#include <sys/types.h>
#include <sys/imgact_elf.h>
-#include <compat/cloudabi64/cloudabi64_syscalldefs.h>
+#include <contrib/cloudabi/cloudabi64_types.h>
struct image_params;
struct thread;
diff --git a/sys/compat/cloudabi64/syscalls.master b/sys/compat/cloudabi64/syscalls.master
deleted file mode 100644
index 5fd6f7e..0000000
--- a/sys/compat/cloudabi64/syscalls.master
+++ /dev/null
@@ -1,220 +0,0 @@
- $FreeBSD$
-
-; System call table for CloudABI.
-;
-; All system calls that do not use any machine-dependent data types are
-; prefixed with cloudabi_sys_. The others are called cloudabi64_sys_.
-
-#include <sys/sysent.h>
-#include <sys/sysproto.h>
-
-#include <compat/cloudabi64/cloudabi64_syscalldefs.h>
-#include <compat/cloudabi64/cloudabi64_proto.h>
-
-0 AUE_NULL STD { cloudabi_timestamp_t \
- cloudabi_sys_clock_res_get( \
- cloudabi_clockid_t clock_id); }
-1 AUE_NULL STD { cloudabi_timestamp_t \
- cloudabi_sys_clock_time_get( \
- cloudabi_clockid_t clock_id, \
- cloudabi_timestamp_t precision); }
-
-2 AUE_NULL STD { void cloudabi_sys_condvar_signal( \
- cloudabi_condvar_t *condvar, \
- cloudabi_mflags_t scope, \
- cloudabi_nthreads_t nwaiters); }
-
-3 AUE_NULL STD { void cloudabi_sys_fd_close( \
- cloudabi_fd_t fd); }
-4 AUE_NULL STD { cloudabi_fd_t cloudabi_sys_fd_create1( \
- cloudabi_filetype_t type); }
-5 AUE_NULL STD { void cloudabi_sys_fd_create2( \
- cloudabi_filetype_t type); }
-6 AUE_NULL STD { void cloudabi_sys_fd_datasync( \
- cloudabi_fd_t fd); }
-7 AUE_NULL STD { cloudabi_fd_t cloudabi_sys_fd_dup( \
- cloudabi_fd_t from); }
-8 AUE_NULL STD { cloudabi64_size_t cloudabi64_sys_fd_pread( \
- cloudabi_fd_t fd, \
- const cloudabi64_iovec_t *iov, \
- cloudabi64_size_t iovcnt, \
- cloudabi_filesize_t offset); }
-9 AUE_NULL STD { cloudabi64_size_t cloudabi64_sys_fd_pwrite( \
- cloudabi_fd_t fd, \
- const cloudabi64_ciovec_t *iov, \
- cloudabi64_size_t iovcnt, \
- cloudabi_filesize_t offset); }
-10 AUE_NULL STD { cloudabi64_size_t cloudabi64_sys_fd_read( \
- cloudabi_fd_t fd, \
- const cloudabi64_iovec_t *iov, \
- cloudabi64_size_t iovcnt); }
-11 AUE_NULL STD { void cloudabi_sys_fd_replace( \
- cloudabi_fd_t from, \
- cloudabi_fd_t to); }
-12 AUE_NULL STD { cloudabi_filesize_t cloudabi_sys_fd_seek( \
- cloudabi_fd_t fd, \
- cloudabi_filedelta_t offset, \
- cloudabi_whence_t whence); }
-13 AUE_NULL STD { void cloudabi_sys_fd_stat_get( \
- cloudabi_fd_t fd, \
- cloudabi_fdstat_t *buf); }
-14 AUE_NULL STD { void cloudabi_sys_fd_stat_put( \
- cloudabi_fd_t fd, \
- const cloudabi_fdstat_t *buf, \
- cloudabi_fdsflags_t flags); }
-15 AUE_NULL STD { void cloudabi_sys_fd_sync( \
- cloudabi_fd_t fd); }
-16 AUE_NULL STD { cloudabi64_size_t cloudabi64_sys_fd_write( \
- cloudabi_fd_t fd, \
- const cloudabi64_ciovec_t *iov, \
- cloudabi64_size_t iovcnt); }
-
-17 AUE_NULL STD { void cloudabi_sys_file_advise( \
- cloudabi_fd_t fd, \
- cloudabi_filesize_t offset, \
- cloudabi_filesize_t len, \
- cloudabi_advice_t advice); }
-18 AUE_NULL STD { void cloudabi_sys_file_allocate( \
- cloudabi_fd_t fd, \
- cloudabi_filesize_t offset, \
- cloudabi_filesize_t len); }
-19 AUE_NULL STD { void cloudabi_sys_file_create( \
- cloudabi_fd_t fd, \
- const char *path, size_t pathlen, \
- cloudabi_filetype_t type); }
-20 AUE_NULL STD { void cloudabi_sys_file_link( \
- cloudabi_lookup_t fd1, \
- const char *path1, size_t path1len, \
- cloudabi_fd_t fd2, \
- const char *path2, size_t path2len); }
-21 AUE_NULL STD { cloudabi_fd_t cloudabi_sys_file_open( \
- cloudabi_lookup_t fd, \
- const char *path, size_t pathlen, \
- cloudabi_oflags_t oflags, \
- const cloudabi_fdstat_t *fds); }
-22 AUE_NULL STD { size_t cloudabi_sys_file_readdir( \
- cloudabi_fd_t fd, \
- void *buf, size_t nbyte, \
- cloudabi_dircookie_t cookie); }
-23 AUE_NULL STD { size_t cloudabi_sys_file_readlink( \
- cloudabi_fd_t fd, \
- const char *path, size_t pathlen, \
- void *buf, size_t bufsize); }
-24 AUE_NULL STD { void cloudabi_sys_file_rename( \
- cloudabi_fd_t oldfd, \
- const char *old, size_t oldlen, \
- cloudabi_fd_t newfd, \
- const char *new, size_t newlen); }
-25 AUE_NULL STD { void cloudabi_sys_file_stat_fget( \
- cloudabi_fd_t fd, \
- cloudabi_filestat_t *buf); }
-26 AUE_NULL STD { void cloudabi_sys_file_stat_fput( \
- cloudabi_fd_t fd, \
- const cloudabi_filestat_t *buf, \
- cloudabi_fsflags_t flags); }
-27 AUE_NULL STD { void cloudabi_sys_file_stat_get( \
- cloudabi_lookup_t fd, \
- const char *path, size_t pathlen, \
- cloudabi_filestat_t *buf); }
-28 AUE_NULL STD { void cloudabi_sys_file_stat_put( \
- cloudabi_lookup_t fd, \
- const char *path, size_t pathlen, \
- const cloudabi_filestat_t *buf, \
- cloudabi_fsflags_t flags); }
-29 AUE_NULL STD { void cloudabi_sys_file_symlink( \
- const char *path1, size_t path1len, \
- cloudabi_fd_t fd, \
- const char *path2, size_t path2len); }
-30 AUE_NULL STD { void cloudabi_sys_file_unlink( \
- cloudabi_fd_t fd, \
- const char *path, size_t pathlen, \
- cloudabi_ulflags_t flag); }
-
-31 AUE_NULL STD { void cloudabi_sys_lock_unlock( \
- cloudabi_lock_t *lock, \
- cloudabi_mflags_t scope); }
-
-32 AUE_NULL STD { void cloudabi_sys_mem_advise( \
- void *addr, size_t len, \
- cloudabi_advice_t advice); }
-33 AUE_NULL STD { void cloudabi_sys_mem_lock( \
- const void *addr, size_t len); }
-34 AUE_NULL STD { void cloudabi_sys_mem_map( \
- void *addr, size_t len, \
- cloudabi_mprot_t prot, \
- cloudabi_mflags_t flags, \
- cloudabi_fd_t fd, \
- cloudabi_filesize_t off); }
-35 AUE_NULL STD { void cloudabi_sys_mem_protect( \
- void *addr, size_t len, \
- cloudabi_mprot_t prot); }
-36 AUE_NULL STD { void cloudabi_sys_mem_sync( \
- void *addr, size_t len, \
- cloudabi_msflags_t flags); }
-37 AUE_NULL STD { void cloudabi_sys_mem_unlock( \
- const void *addr, size_t len); }
-38 AUE_NULL STD { void cloudabi_sys_mem_unmap( \
- void * addr, size_t len); }
-
-39 AUE_NULL STD { cloudabi64_size_t cloudabi64_sys_poll( \
- const cloudabi64_subscription_t *in, \
- cloudabi64_event_t *out, \
- cloudabi64_size_t nevents); }
-
-40 AUE_NULL STD { void cloudabi_sys_proc_exec( \
- cloudabi_fd_t fd, const void *data, \
- size_t datalen, \
- const cloudabi_fd_t *fds, \
- size_t fdslen); }
-41 AUE_NULL STD { void cloudabi_sys_proc_exit( \
- cloudabi_exitcode_t rval); }
-42 AUE_NULL STD { cloudabi_fd_t cloudabi_sys_proc_fork(); }
-43 AUE_NULL STD { void cloudabi_sys_proc_raise( \
- cloudabi_signal_t sig); }
-
-44 AUE_NULL STD { void cloudabi_sys_random_get( \
- void *buf, size_t nbyte); }
-
-45 AUE_NULL STD { cloudabi_fd_t cloudabi_sys_sock_accept( \
- cloudabi_fd_t s, \
- cloudabi_sockstat_t *buf); }
-46 AUE_NULL STD { void cloudabi_sys_sock_bind( \
- cloudabi_fd_t s, cloudabi_fd_t fd, \
- const char *path, size_t pathlen); }
-47 AUE_NULL STD { void cloudabi_sys_sock_connect( \
- cloudabi_fd_t s, cloudabi_fd_t fd, \
- const char *path, size_t pathlen); }
-48 AUE_NULL STD { void cloudabi_sys_sock_listen( \
- cloudabi_fd_t s, \
- cloudabi_backlog_t backlog); }
-49 AUE_NULL STD { cloudabi64_size_t cloudabi64_sys_sock_recv( \
- cloudabi_fd_t s, \
- const cloudabi64_recv_in_t *in, \
- cloudabi64_recv_out_t *out); }
-50 AUE_NULL STD { cloudabi64_size_t cloudabi64_sys_sock_send( \
- cloudabi_fd_t s, \
- const cloudabi64_send_in_t *in, \
- cloudabi64_send_out_t *out); }
-51 AUE_NULL STD { void cloudabi_sys_sock_shutdown( \
- cloudabi_fd_t fd, \
- cloudabi_sdflags_t how); }
-52 AUE_NULL STD { void cloudabi_sys_sock_stat_get( \
- cloudabi_fd_t fd, \
- cloudabi_sockstat_t *buf, \
- cloudabi_ssflags_t flags); }
-
-53 AUE_NULL STD { cloudabi_tid_t cloudabi64_sys_thread_create( \
- cloudabi64_threadattr_t *attr); }
-54 AUE_NULL STD { void cloudabi_sys_thread_exit( \
- cloudabi_lock_t *lock, \
- cloudabi_mflags_t scope); }
-55 AUE_NULL STD { void cloudabi_sys_thread_tcb_set(void *tcb); }
-56 AUE_NULL STD { void cloudabi_sys_thread_yield(); }
-
-57 AUE_NULL STD { cloudabi64_size_t cloudabi64_sys_poll_fd( \
- cloudabi_fd_t fd, \
- const cloudabi64_subscription_t *in, \
- cloudabi64_size_t nin, \
- cloudabi64_event_t *out, \
- cloudabi64_size_t nout, \
- const cloudabi64_subscription_t *timeout); }
diff --git a/sys/compat/freebsd32/freebsd32_misc.c b/sys/compat/freebsd32/freebsd32_misc.c
index bdcdf6f..598bdc5 100644
--- a/sys/compat/freebsd32/freebsd32_misc.c
+++ b/sys/compat/freebsd32/freebsd32_misc.c
@@ -1653,6 +1653,19 @@ freebsd32_do_sendfile(struct thread *td,
hdtr32.hdr_cnt, &hdr_uio);
if (error)
goto out;
+#ifdef COMPAT_FREEBSD4
+ /*
+ * In FreeBSD < 5.0 the nbytes to send also included
+ * the header. If compat is specified subtract the
+ * header size from nbytes.
+ */
+ if (compat) {
+ if (uap->nbytes > hdr_uio->uio_resid)
+ uap->nbytes -= hdr_uio->uio_resid;
+ else
+ uap->nbytes = 0;
+ }
+#endif
}
if (hdtr.trailers != NULL) {
iov32 = PTRIN(hdtr32.trailers);
@@ -1670,7 +1683,7 @@ freebsd32_do_sendfile(struct thread *td,
goto out;
error = fo_sendfile(fp, uap->s, hdr_uio, trl_uio, offset,
- uap->nbytes, &sbytes, uap->flags, compat ? SFK_COMPAT : 0, td);
+ uap->nbytes, &sbytes, uap->flags, td);
fdrop(fp, td);
if (uap->sbytes != NULL)
diff --git a/sys/compat/linux/linux_event.c b/sys/compat/linux/linux_event.c
index b1ceadf..3e5a15c 100644
--- a/sys/compat/linux/linux_event.c
+++ b/sys/compat/linux/linux_event.c
@@ -42,6 +42,7 @@ __FBSDID("$FreeBSD$");
#include <sys/user.h>
#include <sys/file.h>
#include <sys/filedesc.h>
+#include <sys/filio.h>
#include <sys/errno.h>
#include <sys/event.h>
#include <sys/poll.h>
@@ -750,6 +751,8 @@ retry:
if (UINT64_MAX - efd->efd_count <= count) {
if ((efd->efd_flags & LINUX_O_NONBLOCK) != 0) {
mtx_unlock(&efd->efd_lock);
+ /* Do not not return the number of bytes written */
+ uio->uio_resid += sizeof(eventfd_t);
return (EAGAIN);
}
error = mtx_sleep(&efd->efd_count, &efd->efd_lock,
@@ -871,8 +874,24 @@ static int
eventfd_ioctl(struct file *fp, u_long cmd, void *data,
struct ucred *active_cred, struct thread *td)
{
+ struct eventfd *efd;
- return (ENXIO);
+ efd = fp->f_data;
+ if (fp->f_type != DTYPE_LINUXEFD || efd == NULL)
+ return (EINVAL);
+
+ switch (cmd)
+ {
+ case FIONBIO:
+ if (*(int *)data)
+ efd->efd_flags |= LINUX_O_NONBLOCK;
+ else
+ efd->efd_flags &= ~LINUX_O_NONBLOCK;
+ case FIOASYNC:
+ return (0);
+ default:
+ return (ENXIO);
+ }
}
/*ARGSUSED*/
diff --git a/sys/compat/linux/linux_mib.c b/sys/compat/linux/linux_mib.c
index 396344b..a66ed80 100644
--- a/sys/compat/linux/linux_mib.c
+++ b/sys/compat/linux/linux_mib.c
@@ -168,9 +168,6 @@ linux_find_prison(struct prison *spr, struct prison **prp)
struct prison *pr;
struct linux_prison *lpr;
- if (!linux_osd_jail_slot)
- /* In case osd_register failed. */
- spr = &prison0;
for (pr = spr;; pr = pr->pr_parent) {
mtx_lock(&pr->pr_mtx);
lpr = (pr == &prison0)
@@ -189,15 +186,14 @@ linux_find_prison(struct prison *spr, struct prison **prp)
* Ensure a prison has its own Linux info. If lprp is non-null, point it to
* the Linux info and lock the prison.
*/
-static int
+static void
linux_alloc_prison(struct prison *pr, struct linux_prison **lprp)
{
struct prison *ppr;
struct linux_prison *lpr, *nlpr;
- int error;
+ void *rsv;
/* If this prison already has Linux info, return that. */
- error = 0;
lpr = linux_find_prison(pr, &ppr);
if (ppr == pr)
goto done;
@@ -207,29 +203,24 @@ linux_alloc_prison(struct prison *pr, struct linux_prison **lprp)
*/
mtx_unlock(&ppr->pr_mtx);
nlpr = malloc(sizeof(struct linux_prison), M_PRISON, M_WAITOK);
+ rsv = osd_reserve(linux_osd_jail_slot);
lpr = linux_find_prison(pr, &ppr);
if (ppr == pr) {
free(nlpr, M_PRISON);
+ osd_free_reserved(rsv);
goto done;
}
/* Inherit the initial values from the ancestor. */
mtx_lock(&pr->pr_mtx);
- error = osd_jail_set(pr, linux_osd_jail_slot, nlpr);
- if (error == 0) {
- bcopy(lpr, nlpr, sizeof(*lpr));
- lpr = nlpr;
- } else {
- free(nlpr, M_PRISON);
- lpr = NULL;
- }
+ (void)osd_jail_set_reserved(pr, linux_osd_jail_slot, rsv, nlpr);
+ bcopy(lpr, nlpr, sizeof(*lpr));
+ lpr = nlpr;
mtx_unlock(&ppr->pr_mtx);
done:
if (lprp != NULL)
*lprp = lpr;
else
mtx_unlock(&pr->pr_mtx);
-
- return (error);
}
/*
@@ -249,7 +240,8 @@ linux_prison_create(void *obj, void *data)
* Inherit a prison's initial values from its parent
* (different from JAIL_SYS_INHERIT which also inherits changes).
*/
- return (linux_alloc_prison(pr, NULL));
+ linux_alloc_prison(pr, NULL);
+ return (0);
}
static int
@@ -345,11 +337,7 @@ linux_prison_set(void *obj, void *data)
* "linux=new" or "linux.*":
* the prison gets its own Linux info.
*/
- error = linux_alloc_prison(pr, &lpr);
- if (error) {
- mtx_unlock(&pr->pr_mtx);
- return (error);
- }
+ linux_alloc_prison(pr, &lpr);
if (osrelease) {
error = linux_map_osrel(osrelease, &lpr->pr_osrel);
if (error) {
@@ -449,21 +437,18 @@ linux_osd_jail_register(void)
linux_osd_jail_slot =
osd_jail_register(linux_prison_destructor, methods);
- if (linux_osd_jail_slot > 0) {
- /* Copy the system linux info to any current prisons. */
- sx_xlock(&allprison_lock);
- TAILQ_FOREACH(pr, &allprison, pr_list)
- (void)linux_alloc_prison(pr, NULL);
- sx_xunlock(&allprison_lock);
- }
+ /* Copy the system linux info to any current prisons. */
+ sx_slock(&allprison_lock);
+ TAILQ_FOREACH(pr, &allprison, pr_list)
+ linux_alloc_prison(pr, NULL);
+ sx_sunlock(&allprison_lock);
}
void
linux_osd_jail_deregister(void)
{
- if (linux_osd_jail_slot)
- osd_jail_deregister(linux_osd_jail_slot);
+ osd_jail_deregister(linux_osd_jail_slot);
}
void
diff --git a/sys/compat/linux/linux_misc.c b/sys/compat/linux/linux_misc.c
index 7e9a0d5..98a842c 100644
--- a/sys/compat/linux/linux_misc.c
+++ b/sys/compat/linux/linux_misc.c
@@ -191,32 +191,33 @@ linux_alarm(struct thread *td, struct linux_alarm_args *args)
{
struct itimerval it, old_it;
u_int secs;
+ int error;
#ifdef DEBUG
if (ldebug(alarm))
printf(ARGS(alarm, "%u"), args->secs);
#endif
-
secs = args->secs;
-
- if (secs > INT_MAX)
- secs = INT_MAX;
-
- it.it_value.tv_sec = (long) secs;
- it.it_value.tv_usec = 0;
- it.it_interval.tv_sec = 0;
- it.it_interval.tv_usec = 0;
/*
- * According to POSIX and Linux implementation
- * the alarm() system call is always successfull.
- * Ignore errors and return 0 as a Linux does.
+ * Linux alarm() is always successfull. Limit secs to INT32_MAX / 2
+ * to match kern_setitimer()'s limit to avoid error from it.
+ *
+ * XXX. Linux limit secs to INT_MAX on 32 and does not limit on 64-bit
+ * platforms.
*/
- kern_setitimer(td, ITIMER_REAL, &it, &old_it);
- if (timevalisset(&old_it.it_value)) {
- if (old_it.it_value.tv_usec != 0)
- old_it.it_value.tv_sec++;
- td->td_retval[0] = old_it.it_value.tv_sec;
- }
+ if (secs > INT32_MAX / 2)
+ secs = INT32_MAX / 2;
+
+ it.it_value.tv_sec = secs;
+ it.it_value.tv_usec = 0;
+ timevalclear(&it.it_interval);
+ error = kern_setitimer(td, ITIMER_REAL, &it, &old_it);
+ KASSERT(error == 0, ("kern_setitimer returns %d", error));
+
+ if ((old_it.it_value.tv_sec == 0 && old_it.it_value.tv_usec > 0) ||
+ old_it.it_value.tv_usec >= 500000)
+ old_it.it_value.tv_sec++;
+ td->td_retval[0] = old_it.it_value.tv_sec;
return (0);
}
@@ -894,13 +895,14 @@ linux_utimensat(struct thread *td, struct linux_utimensat_args *args)
break;
}
timesp = times;
- }
- if (times[0].tv_nsec == UTIME_OMIT && times[1].tv_nsec == UTIME_OMIT)
/* This breaks POSIX, but is what the Linux kernel does
* _on purpose_ (documented in the man page for utimensat(2)),
* so we must follow that behaviour. */
- return (0);
+ if (times[0].tv_nsec == UTIME_OMIT &&
+ times[1].tv_nsec == UTIME_OMIT)
+ return (0);
+ }
if (args->pathname != NULL)
LCONVPATHEXIST_AT(td, args->pathname, &path, dfd);
diff --git a/sys/compat/linux/linux_socket.c b/sys/compat/linux/linux_socket.c
index 01b007c..741a45b 100644
--- a/sys/compat/linux/linux_socket.c
+++ b/sys/compat/linux/linux_socket.c
@@ -448,7 +448,7 @@ linux_to_bsd_msg_flags(int flags)
if (flags & LINUX_MSG_ERRQUEUE)
;
#endif
- return ret_flags;
+ return (ret_flags);
}
/*
@@ -463,15 +463,12 @@ bsd_to_linux_sockaddr(struct sockaddr *arg)
struct sockaddr sa;
size_t sa_len = sizeof(struct sockaddr);
int error;
-
+
if ((error = copyin(arg, &sa, sa_len)))
return (error);
-
+
*(u_short *)&sa = sa.sa_family;
-
- error = copyout(&sa, arg, sa_len);
-
- return (error);
+ return (copyout(&sa, arg, sa_len));
}
static int
@@ -486,10 +483,7 @@ linux_to_bsd_sockaddr(struct sockaddr *arg, int len)
sa.sa_family = *(sa_family_t *)&sa;
sa.sa_len = len;
-
- error = copyout(&sa, arg, sa_len);
-
- return (error);
+ return (copyout(&sa, arg, sa_len));
}
static int
@@ -511,11 +505,7 @@ linux_sa_put(struct osockaddr *osa)
return (EINVAL);
sa.sa_family = bdom;
- error = copyout(&sa, osa, sizeof(sa.sa_family));
- if (error)
- return (error);
-
- return (0);
+ return (copyout(&sa, osa, sizeof(sa.sa_family)));
}
static int
@@ -912,10 +902,7 @@ linux_getsockname(struct thread *td, struct linux_getsockname_args *args)
bsd_to_linux_sockaddr((struct sockaddr *)bsd_args.asa);
if (error)
return (error);
- error = linux_sa_put(PTRIN(args->addr));
- if (error)
- return (error);
- return (0);
+ return (linux_sa_put(PTRIN(args->addr)));
}
int
@@ -935,10 +922,7 @@ linux_getpeername(struct thread *td, struct linux_getpeername_args *args)
bsd_to_linux_sockaddr((struct sockaddr *)bsd_args.asa);
if (error)
return (error);
- error = linux_sa_put(PTRIN(args->addr));
- if (error)
- return (error);
- return (0);
+ return (linux_sa_put(PTRIN(args->addr)));
}
int
@@ -1003,7 +987,7 @@ linux_send(struct thread *td, struct linux_send_args *args)
bsd_args.flags = args->flags;
bsd_args.to = NULL;
bsd_args.tolen = 0;
- return sys_sendto(td, &bsd_args);
+ return (sys_sendto(td, &bsd_args));
}
struct linux_recv_args {
@@ -1040,7 +1024,6 @@ linux_sendto(struct thread *td, struct linux_sendto_args *args)
{
struct msghdr msg;
struct iovec aiov;
- int error;
if (linux_check_hdrincl(td, args->s) == 0)
/* IP_HDRINCL set, tweak the packet before sending */
@@ -1054,9 +1037,8 @@ linux_sendto(struct thread *td, struct linux_sendto_args *args)
msg.msg_flags = 0;
aiov.iov_base = PTRIN(args->msg);
aiov.iov_len = args->len;
- error = linux_sendit(td, args->s, &msg, args->flags, NULL,
- UIO_USERSPACE);
- return (error);
+ return (linux_sendit(td, args->s, &msg, args->flags, NULL,
+ UIO_USERSPACE));
}
int
diff --git a/sys/compat/linux/linux_stats.c b/sys/compat/linux/linux_stats.c
index 84ade7b..3638c6b 100644
--- a/sys/compat/linux/linux_stats.c
+++ b/sys/compat/linux/linux_stats.c
@@ -257,7 +257,7 @@ static int
stat_copyout(struct stat *buf, void *ubuf)
{
struct l_stat lbuf;
-
+
bzero(&lbuf, sizeof(lbuf));
lbuf.st_dev = buf->st_dev;
lbuf.st_ino = buf->st_ino;
@@ -303,7 +303,7 @@ linux_stat(struct thread *td, struct linux_stat_args *args)
return (error);
}
LFREEPATH(path);
- return(stat_copyout(&buf, args->up));
+ return (stat_copyout(&buf, args->up));
}
int
@@ -325,7 +325,7 @@ linux_lstat(struct thread *td, struct linux_lstat_args *args)
return (error);
}
LFREEPATH(path);
- return(stat_copyout(&buf, args->up));
+ return (stat_copyout(&buf, args->up));
}
#endif /* __i386__ || (__amd64__ && COMPAT_LINUX32) */
@@ -381,10 +381,22 @@ bsd_to_linux_ftype(const char *fstypename)
return (0L);
}
-static void
+static int
bsd_to_linux_statfs(struct statfs *bsd_statfs, struct l_statfs *linux_statfs)
{
+#if defined(__i386__) || (defined(__amd64__) && defined(COMPAT_LINUX32))
+ uint64_t tmp;
+#define LINUX_HIBITS 0xffffffff00000000ULL
+
+ tmp = bsd_statfs->f_blocks | bsd_statfs->f_bfree | bsd_statfs->f_files |
+ bsd_statfs->f_bsize;
+ if ((bsd_statfs->f_bavail != -1 && (bsd_statfs->f_bavail & LINUX_HIBITS)) ||
+ (bsd_statfs->f_ffree != -1 && (bsd_statfs->f_ffree & LINUX_HIBITS)) ||
+ (tmp & LINUX_HIBITS))
+ return (EOVERFLOW);
+#undef LINUX_HIBITS
+#endif
linux_statfs->f_type = bsd_to_linux_ftype(bsd_statfs->f_fstypename);
linux_statfs->f_bsize = bsd_statfs->f_bsize;
linux_statfs->f_blocks = bsd_statfs->f_blocks;
@@ -395,6 +407,8 @@ bsd_to_linux_statfs(struct statfs *bsd_statfs, struct l_statfs *linux_statfs)
linux_statfs->f_fsid.val[0] = bsd_statfs->f_fsid.val[0];
linux_statfs->f_fsid.val[1] = bsd_statfs->f_fsid.val[1];
linux_statfs->f_namelen = MAXNAMLEN;
+
+ return (0);
}
int
@@ -415,8 +429,10 @@ linux_statfs(struct thread *td, struct linux_statfs_args *args)
LFREEPATH(path);
if (error)
return (error);
- bsd_to_linux_statfs(&bsd_statfs, &linux_statfs);
- return copyout(&linux_statfs, args->buf, sizeof(linux_statfs));
+ error = bsd_to_linux_statfs(&bsd_statfs, &linux_statfs);
+ if (error)
+ return (error);
+ return (copyout(&linux_statfs, args->buf, sizeof(linux_statfs)));
}
#if defined(__i386__) || (defined(__amd64__) && defined(COMPAT_LINUX32))
@@ -458,7 +474,28 @@ linux_statfs64(struct thread *td, struct linux_statfs64_args *args)
if (error)
return (error);
bsd_to_linux_statfs64(&bsd_statfs, &linux_statfs);
- return copyout(&linux_statfs, args->buf, sizeof(linux_statfs));
+ return (copyout(&linux_statfs, args->buf, sizeof(linux_statfs)));
+}
+
+int
+linux_fstatfs64(struct thread *td, struct linux_fstatfs64_args *args)
+{
+ struct l_statfs64 linux_statfs;
+ struct statfs bsd_statfs;
+ int error;
+
+#ifdef DEBUG
+ if (ldebug(fstatfs64))
+ printf(ARGS(fstatfs64, "%d, *"), args->fd);
+#endif
+ if (args->bufsize != sizeof(struct l_statfs64))
+ return (EINVAL);
+
+ error = kern_fstatfs(td, args->fd, &bsd_statfs);
+ if (error)
+ return error;
+ bsd_to_linux_statfs64(&bsd_statfs, &linux_statfs);
+ return (copyout(&linux_statfs, args->buf, sizeof(linux_statfs)));
}
#endif /* __i386__ || (__amd64__ && COMPAT_LINUX32) */
@@ -475,9 +512,11 @@ linux_fstatfs(struct thread *td, struct linux_fstatfs_args *args)
#endif
error = kern_fstatfs(td, args->fd, &bsd_statfs);
if (error)
- return error;
- bsd_to_linux_statfs(&bsd_statfs, &linux_statfs);
- return copyout(&linux_statfs, args->buf, sizeof(linux_statfs));
+ return (error);
+ error = bsd_to_linux_statfs(&bsd_statfs, &linux_statfs);
+ if (error)
+ return (error);
+ return (copyout(&linux_statfs, args->buf, sizeof(linux_statfs)));
}
struct l_ustat
diff --git a/sys/compat/linuxkpi/common/include/linux/bitops.h b/sys/compat/linuxkpi/common/include/linux/bitops.h
index 0dcdfe0..b12050a 100644
--- a/sys/compat/linuxkpi/common/include/linux/bitops.h
+++ b/sys/compat/linuxkpi/common/include/linux/bitops.h
@@ -147,11 +147,11 @@ find_last_bit(unsigned long *addr, unsigned long size)
if (mask)
return (bit + __flsl(mask));
}
- while (--pos) {
+ while (pos--) {
addr--;
bit -= BITS_PER_LONG;
if (*addr)
- return (bit + __flsl(mask));
+ return (bit + __flsl(*addr));
}
return (size);
}
diff --git a/sys/compat/linuxkpi/common/include/linux/jiffies.h b/sys/compat/linuxkpi/common/include/linux/jiffies.h
index f7bc529..33629ec 100644
--- a/sys/compat/linuxkpi/common/include/linux/jiffies.h
+++ b/sys/compat/linuxkpi/common/include/linux/jiffies.h
@@ -95,4 +95,14 @@ get_jiffies_64(void)
return ((u64)(unsigned)ticks);
}
+static inline int
+linux_timer_jiffies_until(unsigned long expires)
+{
+ int delta = expires - jiffies;
+ /* guard against already expired values */
+ if (delta < 1)
+ delta = 1;
+ return (delta);
+}
+
#endif /* _LINUX_JIFFIES_H_ */
diff --git a/sys/compat/linuxkpi/common/include/linux/list.h b/sys/compat/linuxkpi/common/include/linux/list.h
index 63e8af5..1357555 100644
--- a/sys/compat/linuxkpi/common/include/linux/list.h
+++ b/sys/compat/linuxkpi/common/include/linux/list.h
@@ -61,6 +61,7 @@
#include <netinet/in.h>
#include <netinet/in_pcb.h>
#include <netinet/in_var.h>
+#include <netinet/tcp_lro.h>
#include <netinet6/in6_var.h>
#include <netinet6/nd6.h>
diff --git a/sys/compat/linuxkpi/common/include/linux/wait.h b/sys/compat/linuxkpi/common/include/linux/wait.h
index c62f735..8afea08 100644
--- a/sys/compat/linuxkpi/common/include/linux/wait.h
+++ b/sys/compat/linuxkpi/common/include/linux/wait.h
@@ -34,6 +34,7 @@
#include <linux/spinlock.h>
#include <linux/sched.h>
#include <linux/list.h>
+#include <linux/jiffies.h>
#include <sys/param.h>
#include <sys/systm.h>
@@ -113,6 +114,52 @@ do { \
-_error; \
})
+#define wait_event_interruptible_timeout(q, cond, timeout) \
+({ \
+ void *c = &(q).wchan; \
+ long end = jiffies + timeout; \
+ int __ret = 0; \
+ int __rc = 0; \
+ \
+ if (!(cond)) { \
+ for (; __rc == 0;) { \
+ sleepq_lock(c); \
+ if (cond) { \
+ sleepq_release(c); \
+ __ret = 1; \
+ break; \
+ } \
+ sleepq_add(c, NULL, "completion", \
+ SLEEPQ_SLEEP | SLEEPQ_INTERRUPTIBLE, 0); \
+ sleepq_set_timeout(c, linux_timer_jiffies_until(end));\
+ __rc = sleepq_timedwait_sig (c, 0); \
+ if (__rc != 0) { \
+ /* check for timeout or signal. \
+ * 0 if the condition evaluated to false\
+ * after the timeout elapsed, 1 if the \
+ * condition evaluated to true after the\
+ * timeout elapsed. \
+ */ \
+ if (__rc == EWOULDBLOCK) \
+ __ret = (cond); \
+ else \
+ __ret = -ERESTARTSYS; \
+ } \
+ \
+ } \
+ } else { \
+ /* return remaining jiffies (at least 1) if the \
+ * condition evaluated to true before the timeout \
+ * elapsed. \
+ */ \
+ __ret = (end - jiffies); \
+ if( __ret < 1 ) \
+ __ret = 1; \
+ } \
+ __ret; \
+})
+
+
static inline int
waitqueue_active(wait_queue_head_t *q)
{
diff --git a/sys/compat/linuxkpi/common/src/linux_compat.c b/sys/compat/linuxkpi/common/src/linux_compat.c
index b8a0801..d85d4ad 100644
--- a/sys/compat/linuxkpi/common/src/linux_compat.c
+++ b/sys/compat/linuxkpi/common/src/linux_compat.c
@@ -894,16 +894,6 @@ kasprintf(gfp_t gfp, const char *fmt, ...)
return (p);
}
-static int
-linux_timer_jiffies_until(unsigned long expires)
-{
- int delta = expires - jiffies;
- /* guard against already expired values */
- if (delta < 1)
- delta = 1;
- return (delta);
-}
-
static void
linux_timer_callback_wrapper(void *context)
{
diff --git a/sys/compat/ndis/kern_ndis.c b/sys/compat/ndis/kern_ndis.c
index 2ad1683..90e79b0 100644
--- a/sys/compat/ndis/kern_ndis.c
+++ b/sys/compat/ndis/kern_ndis.c
@@ -348,13 +348,13 @@ ndis_create_sysctls(arg)
ndis_add_sysctl(sc, "BusType", "Bus Type", buf, NDIS_FLAG_RDONLY);
if (sc->ndis_res_io != NULL) {
- sprintf(buf, "0x%lx", rman_get_start(sc->ndis_res_io));
+ sprintf(buf, "0x%jx", rman_get_start(sc->ndis_res_io));
ndis_add_sysctl(sc, "IOBaseAddress",
"Base I/O Address", buf, NDIS_FLAG_RDONLY);
}
if (sc->ndis_irq != NULL) {
- sprintf(buf, "%lu", rman_get_start(sc->ndis_irq));
+ sprintf(buf, "%ju", rman_get_start(sc->ndis_irq));
ndis_add_sysctl(sc, "InterruptNumber",
"Interrupt Number", buf, NDIS_FLAG_RDONLY);
}
OpenPOWER on IntegriCloud