Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 25 Mar 2016 08:09:08 +1100 (EST)
From:      Bruce Evans <brde@optusnet.com.au>
To:        Edward Tomasz =?utf-8?Q?Napiera=C5=82a?= <trasz@freebsd.org>
Cc:        Warner Losh <imp@bsdimp.com>, Ian Lepore <ian@freebsd.org>,  Alexander Motin <mavbsd@gmail.com>,  =?iso-8859-1?Q?Jean-S=E9bastien_P=E9dron?= <jean-sebastien.pedron@dumbbell.fr>, src-committers <src-committers@freebsd.org>,  "svn-src-all@freebsd.org" <svn-src-all@freebsd.org>,  "svn-src-head@freebsd.org" <svn-src-head@freebsd.org>
Subject:   Re: svn commit: r297190 - head/sys/kern
Message-ID:  <20160325071420.K2059@besplex.bde.org>
In-Reply-To: <20160324173359.GA1238@brick.home>
References:  <201603221346.u2MDk1XH029623@repo.freebsd.org> <1458662141.1091.16.camel@freebsd.org> <56F29654.8030806@dumbbell.fr> <20160323174537.GA1826@brick.home> <56F3B441.6030602@dumbbell.fr> <20160324134222.GA1442@brick.home> <56F3F52F.9040705@gmail.com> <20160324150151.GA1277@brick.home> <1458834410.1091.54.camel@freebsd.org> <CANCZdfr9b=2DnVxgpJN=3q634tgMDX3mO8B127or682-5Z35bw@mail.gmail.com> <20160324173359.GA1238@brick.home>

next in thread | previous in thread | raw e-mail | index | archive | help
On Thu, 24 Mar 2016, Edward Tomasz [utf-8] Napiera=C5~Ba wrote:

> On 0324T1015, Warner Losh wrote:
>> On Thu, Mar 24, 2016 at 9:46 AM, Ian Lepore <ian@freebsd.org> wrote:
>>
>>> On Thu, 2016-03-24 at 16:01 +0100, Edward Tomasz Napiera=C5=82a wrote:
>>>> On 0324T1609, Alexander Motin wrote:
>>>>> On 24.03.16 15:42, Edward Tomasz Napiera=C5=82a wrote:
>>>>>> On 0324T1032, Jean-S=C3=A9bastien P=C3=A9dron wrote:
>>>>>>> On 23/03/2016 18:45, Edward Tomasz Napierala wrote:
>>>>>>>>> So maybe callouts are disabled in this situation. If there
>>>>>>>>> is a way to
>>>>>>>>> detect that, then vt(4) can go back to a "synchronous mode"
>>>>>>>>> where it
>>>>>>>>> refreshes the screen after each typed character, like it
>>>>>>>>> does when ddb
>>>>>>>>> is active.
>>>>>>>>
>>>>>>>> Looks like that's the case: for some reason the callouts
>>>>>>>> don't work.
>>>>>>>> This trivial hack is a (mostly) working workaround:
>>>>>>>>
>>>>>>>> Index: svn/head/sys/kern/kern_cons.c
>>>>>>>> =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
>>>>>>>> =3D=3D=3D=3D=3D=3D
>>>>>>>> --- svn/head/sys/kern/kern_cons.c     (revision 297210)
>>>>>>>> +++ svn/head/sys/kern/kern_cons.c     (working copy)
>>>>>>>> @@ -430,6 +430,7 @@ cngets(char *cp, size_t size, int
>>>>>>>> visible)
>>>>>>>>       lp =3D cp;
>>>>>>>>       end =3D cp + size - 1;
>>>>>>>>       for (;;) {
>>>>>>>> +             pause("meh", 1);
>>>>>>>
>>>>>>> Could you please explain how this works to me? Does calling
>>>>>>> pause() here
>>>>>>> give a chance to interrupt handlers or other threads of
>>>>>>> running?
>>>>>>
>>>>>> It looks like it allows the callout to run.  I've did an
>>>>>> experiment
>>>>>> and added a simple callout that printed something each second;
>>>>>> during
>>>>>> the root mount prompt it doesn't get run unless you type '.',
>>>>>> which
>>>>>> calls pause(9).
>>>>>
>>>>> Kernel threads run with absolute priorities, so if somehow this
>>>>> threads
>>>>> happen to have higher or equal priority then callout thread, or the
>>>>> kernel is built without PREEMPTION, then the last may never be
>>>>> executed
>>>>> until this thread get to sleep or at least call sched_yield().
>>>>
>>>> The callout's td_priority seems to be 40; the thread running the
>>>> prompt
>>>> is 84, so it's lower.
>>>>
>>>> I've just noticed another curious thing, though: when you press
>>>> ScrLk,
>>>> the screen gets immediately refreshed; also, pressing arrows works
>>>> just
>>>> the way it should.  In other words, the refresh is broken except for
>>>> the ScrlLk mode, where it works as it should.
>>>
>>> Since cngets() is used only by the mountroot prompt and the geli pw
>>> entry, pausing/yielding within the input loop seems like a good idea.
>>>  It would allow for things like plugging in a usb device and having it
>>> actually appear without having to enter a '.' several times.
>>>
>>> It would be nice if the pause were done with pause_sbt() and a shorter
>>> timeout, maybe a millisecond or even 100uS.  Otherwise things like
>>> pasting text at that prompt in a serial console is likely to drop
>>> chars.
>>>
>>> Hmmm... speaking of the geli pw prompt... what's the locking situation
>>> there?  Will there be any problems calling pause() from that context?
>>
>> PVM isn't an ideal priority to wait at. PWAIT would be better. However,
>> if the only reason to call pause is run the scheduler after each charact=
er,
>> perhaps a better solution would be to call kern_yield() instead? We coul=
d
>> do that instead of cpu_waitspin() inside of cngetc, but that would break
>> the debugger's use of it....

Console drivers can't block or depend on timeouts.  Perhaps cngets() can,
because it is only called in simple contexts, but the simple contexts
make it especially easy for it to work using the same synchronous i/o that
is needed in more complicated contexts.

> I think we should first try to figure out why this doesn't work in the fi=
rst
> place.
>
> Basically, even though the interrupts are running, scheduler seems to be =
ok,
> and the thread that's calling this has a lower priority than the callouts
> thread, it can't be preempted.  This doesn't seem to be caused by vt(4);
> with syscons the callouts don't get called either (it just doesn't break
> the echo in this case).  To demonstrate the problem you can add add
> a callout that calls printf each second and then does an infinite loop.

cngets() is even correctly wrapped by cngrab()/cnungrab().  This is suppose=
d
to put the console driver in a special synchronous mode for the duration of
the grabbing.  (Console drivers still need to be reentrant, so that they
can do i/o when the grabbed section is reentered for ddb or another
non-maskable trap.)  syscons and vt have similar too-simple grab handlers
which start with a screen switch in the !cold case.  This should refresh
the screen and/or switch it to special low-level console screen(s).

Screen switching in ddb is noticeably more broken for vt than for syscons.
Indeed, it just doesn't work in vt (except for the initial switch to vty0).
This might be related.

Bruce
From owner-svn-src-head@freebsd.org  Thu Mar 24 21:47:18 2016
Return-Path: <owner-svn-src-head@freebsd.org>
Delivered-To: svn-src-head@mailman.ysv.freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org
 [IPv6:2001:1900:2254:206a::19:1])
 by mailman.ysv.freebsd.org (Postfix) with ESMTP id AB5F2ADC6D1;
 Thu, 24 Mar 2016 21:47:18 +0000 (UTC) (envelope-from ed@FreeBSD.org)
Received: from repo.freebsd.org (repo.freebsd.org
 [IPv6:2610:1c1:1:6068::e6a:0])
 (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits))
 (Client did not present a certificate)
 by mx1.freebsd.org (Postfix) with ESMTPS id 623141E71;
 Thu, 24 Mar 2016 21:47:18 +0000 (UTC) (envelope-from ed@FreeBSD.org)
Received: from repo.freebsd.org ([127.0.1.37])
 by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u2OLlHP3064607;
 Thu, 24 Mar 2016 21:47:17 GMT (envelope-from ed@FreeBSD.org)
Received: (from ed@localhost)
 by repo.freebsd.org (8.15.2/8.15.2/Submit) id u2OLlFNo064585;
 Thu, 24 Mar 2016 21:47:15 GMT (envelope-from ed@FreeBSD.org)
Message-Id: <201603242147.u2OLlFNo064585@repo.freebsd.org>
X-Authentication-Warning: repo.freebsd.org: ed set sender to ed@FreeBSD.org
 using -f
From: Ed Schouten <ed@FreeBSD.org>
Date: Thu, 24 Mar 2016 21:47:15 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
 svn-src-head@freebsd.org
Subject: svn commit: r297247 - in head: lib/libsysdecode sys/compat/cloudabi
 sys/compat/cloudabi64 sys/contrib/cloudabi usr.bin/truss
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.21
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
 <svn-src-head.freebsd.org>
List-Unsubscribe: <https://lists.freebsd.org/mailman/options/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head/>;
List-Post: <mailto:svn-src-head@freebsd.org>
List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help>
List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=subscribe>
X-List-Received-Date: Thu, 24 Mar 2016 21:47:18 -0000

Author: ed
Date: Thu Mar 24 21:47:15 2016
New Revision: 297247
URL: https://svnweb.freebsd.org/changeset/base/297247

Log:
  Replace the CloudABI system call table by a machine generated version.
  
  The type definitions and constants that were used by COMPAT_CLOUDABI64
  are a literal copy of some headers stored inside of CloudABI's C
  library, cloudlibc. What is annoying is that we can't make use of
  cloudlibc's system call list, as the format is completely different and
  doesn't provide enough information. It had to be synced in manually.
  
  We recently decided to solve this (and some other problems) by moving
  the ABI definitions into a separate file:
  
  	https://github.com/NuxiNL/cloudabi/blob/master/cloudabi.txt
  
  This file is processed by a pile of Python scripts to generate the
  header files like before, documentation (markdown), but in our case more
  importantly: a FreeBSD system call table.
  
  This change discards the old files in sys/contrib/cloudabi and replaces
  them by the latest copies, which requires some minor changes here and
  there. Because cloudabi.txt also enforces consistent names of the system
  call arguments, we have to patch up a small number of system call
  implementations to use the new argument names.
  
  The new header files can also be included directly in FreeBSD kernel
  space without needing any includes/defines, so we can now remove
  cloudabi_syscalldefs.h and cloudabi64_syscalldefs.h. Patch up the
  sources to include the definitions directly from sys/contrib/cloudabi
  instead.

Added:
  head/sys/contrib/cloudabi/cloudabi64_types.h   (contents, props changed)
  head/sys/contrib/cloudabi/cloudabi_types_common.h   (contents, props changed)
  head/sys/contrib/cloudabi/syscalls.master
Deleted:
  head/sys/compat/cloudabi/cloudabi_syscalldefs.h
  head/sys/compat/cloudabi64/cloudabi64_syscalldefs.h
  head/sys/compat/cloudabi64/syscalls.master
  head/sys/contrib/cloudabi/syscalldefs_md.h
  head/sys/contrib/cloudabi/syscalldefs_mi.h
Modified:
  head/lib/libsysdecode/errno.c
  head/sys/compat/cloudabi/cloudabi_clock.c
  head/sys/compat/cloudabi/cloudabi_errno.c
  head/sys/compat/cloudabi/cloudabi_fd.c
  head/sys/compat/cloudabi/cloudabi_file.c
  head/sys/compat/cloudabi/cloudabi_futex.c
  head/sys/compat/cloudabi/cloudabi_mem.c
  head/sys/compat/cloudabi/cloudabi_proc.c
  head/sys/compat/cloudabi/cloudabi_proto.h
  head/sys/compat/cloudabi/cloudabi_sock.c
  head/sys/compat/cloudabi/cloudabi_thread.c
  head/sys/compat/cloudabi/cloudabi_util.h
  head/sys/compat/cloudabi64/Makefile
  head/sys/compat/cloudabi64/cloudabi64_fd.c
  head/sys/compat/cloudabi64/cloudabi64_module.c
  head/sys/compat/cloudabi64/cloudabi64_poll.c
  head/sys/compat/cloudabi64/cloudabi64_sock.c
  head/sys/compat/cloudabi64/cloudabi64_systrace_args.c
  head/sys/compat/cloudabi64/cloudabi64_thread.c
  head/sys/compat/cloudabi64/cloudabi64_util.h
  head/usr.bin/truss/syscalls.c

Modified: head/lib/libsysdecode/errno.c
==============================================================================
--- head/lib/libsysdecode/errno.c	Thu Mar 24 21:38:52 2016	(r297246)
+++ head/lib/libsysdecode/errno.c	Thu Mar 24 21:47:15 2016	(r297247)
@@ -56,7 +56,7 @@ static int bsd_to_linux_errno[ELAST + 1]
 #endif
 
 #if defined(__aarch64__) || defined(__amd64__)
-#include <compat/cloudabi/cloudabi_syscalldefs.h>
+#include <contrib/cloudabi/cloudabi_types_common.h>
 
 static const int cloudabi_errno_table[] = {
 	[CLOUDABI_E2BIG]		= E2BIG,

Modified: head/sys/compat/cloudabi/cloudabi_clock.c
==============================================================================
--- head/sys/compat/cloudabi/cloudabi_clock.c	Thu Mar 24 21:38:52 2016	(r297246)
+++ head/sys/compat/cloudabi/cloudabi_clock.c	Thu Mar 24 21:47:15 2016	(r297247)
@@ -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. */

Modified: head/sys/compat/cloudabi/cloudabi_errno.c
==============================================================================
--- head/sys/compat/cloudabi/cloudabi_errno.c	Thu Mar 24 21:38:52 2016	(r297246)
+++ head/sys/compat/cloudabi/cloudabi_errno.c	Thu Mar 24 21:47:15 2016	(r297247)
@@ -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. */

Modified: head/sys/compat/cloudabi/cloudabi_fd.c
==============================================================================
--- head/sys/compat/cloudabi/cloudabi_fd.c	Thu Mar 24 21:38:52 2016	(r297246)
+++ head/sys/compat/cloudabi/cloudabi_fd.c	Thu Mar 24 21:47:15 2016	(r297247)
@@ -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. */

Modified: head/sys/compat/cloudabi/cloudabi_file.c
==============================================================================
--- head/sys/compat/cloudabi/cloudabi_file.c	Thu Mar 24 21:38:52 2016	(r297246)
+++ head/sys/compat/cloudabi/cloudabi_file.c	Thu Mar 24 21:47:15 2016	(r297247)
@@ -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
 		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
 		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 *
 	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);

Modified: head/sys/compat/cloudabi/cloudabi_futex.c
==============================================================================
--- head/sys/compat/cloudabi/cloudabi_futex.c	Thu Mar 24 21:38:52 2016	(r297246)
+++ head/sys/compat/cloudabi/cloudabi_futex.c	Thu Mar 24 21:47:15 2016	(r297247)
@@ -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>
 
 /*

Modified: head/sys/compat/cloudabi/cloudabi_mem.c
==============================================================================
--- head/sys/compat/cloudabi/cloudabi_mem.c	Thu Mar 24 21:38:52 2016	(r297246)
+++ head/sys/compat/cloudabi/cloudabi_mem.c	Thu Mar 24 21:47:15 2016	(r297247)
@@ -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

Modified: head/sys/compat/cloudabi/cloudabi_proc.c
==============================================================================
--- head/sys/compat/cloudabi/cloudabi_proc.c	Thu Mar 24 21:38:52 2016	(r297246)
+++ head/sys/compat/cloudabi/cloudabi_proc.c	Thu Mar 24 21:47:15 2016	(r297247)
@@ -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,

Modified: head/sys/compat/cloudabi/cloudabi_proto.h
==============================================================================
--- head/sys/compat/cloudabi/cloudabi_proto.h	Thu Mar 24 21:38:52 2016	(r297246)
+++ head/sys/compat/cloudabi/cloudabi_proto.h	Thu Mar 24 21:47:15 2016	(r297247)
@@ -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>

Modified: head/sys/compat/cloudabi/cloudabi_sock.c
==============================================================================
--- head/sys/compat/cloudabi/cloudabi_sock.c	Thu Mar 24 21:38:52 2016	(r297246)
+++ head/sys/compat/cloudabi/cloudabi_sock.c	Thu Mar 24 21:47:15 2016	(r297247)
@@ -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 *
 
 	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 
 	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 *
     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
     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
 	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
 
 	/* 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)));

Modified: head/sys/compat/cloudabi/cloudabi_thread.c
==============================================================================
--- head/sys/compat/cloudabi/cloudabi_thread.c	Thu Mar 24 21:38:52 2016	(r297246)
+++ head/sys/compat/cloudabi/cloudabi_thread.c	Thu Mar 24 21:47:15 2016	(r297247)
@@ -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,

Modified: head/sys/compat/cloudabi/cloudabi_util.h
==============================================================================
--- head/sys/compat/cloudabi/cloudabi_util.h	Thu Mar 24 21:38:52 2016	(r297246)
+++ head/sys/compat/cloudabi/cloudabi_util.h	Thu Mar 24 21:47:15 2016	(r297247)
@@ -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;

Modified: head/sys/compat/cloudabi64/Makefile
==============================================================================
--- head/sys/compat/cloudabi64/Makefile	Thu Mar 24 21:38:52 2016	(r297246)
+++ head/sys/compat/cloudabi64/Makefile	Thu Mar 24 21:47:15 2016	(r297247)
@@ -8,5 +8,7 @@ sysent: cloudabi64_sysent.c cloudabi64_s
 
 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

Modified: head/sys/compat/cloudabi64/cloudabi64_fd.c
==============================================================================
--- head/sys/compat/cloudabi64/cloudabi64_fd.c	Thu Mar 24 21:38:52 2016	(r297246)
+++ head/sys/compat/cloudabi64/cloudabi64_fd.c	Thu Mar 24 21:47:15 2016	(r297247)
@@ -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. */

Modified: head/sys/compat/cloudabi64/cloudabi64_module.c
==============================================================================
--- head/sys/compat/cloudabi64/cloudabi64_module.c	Thu Mar 24 21:38:52 2016	(r297246)
+++ head/sys/compat/cloudabi64/cloudabi64_module.c	Thu Mar 24 21:47:15 2016	(r297247)
@@ -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 *

Modified: head/sys/compat/cloudabi64/cloudabi64_poll.c
==============================================================================
--- head/sys/compat/cloudabi64/cloudabi64_poll.c	Thu Mar 24 21:38:52 2016	(r297246)
+++ head/sys/compat/cloudabi64/cloudabi64_poll.c	Thu Mar 24 21:47:15 2016	(r297247)
@@ -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, s
 	 * 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, s
 			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, s
 		}
 	}
 
-	return (kern_kevent_anonymous(td, uap->nevents, &copyops));
+	return (kern_kevent_anonymous(td, uap->nsubscriptions, &copyops));
 }
 
 int

Modified: head/sys/compat/cloudabi64/cloudabi64_sock.c
==============================================================================
--- head/sys/compat/cloudabi64/cloudabi64_sock.c	Thu Mar 24 21:38:52 2016	(r297246)
+++ head/sys/compat/cloudabi64/cloudabi64_sock.c	Thu Mar 24 21:47:15 2016	(r297247)
@@ -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 *
 		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 *
 		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);

Modified: head/sys/compat/cloudabi64/cloudabi64_systrace_args.c
==============================================================================
--- head/sys/compat/cloudabi64/cloudabi64_systrace_args.c	Thu Mar 24 21:38:52 2016	(r297246)
+++ head/sys/compat/cloudabi64/cloudabi64_systrace_args.c	Thu Mar 24 21:47:15 2016	(r297247)
@@ -75,7 +75,7 @@ systrace_args(int sysnum, void *params, 
 		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, 
 		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, 
 		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, 
 		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, 
 	/* 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, 
 		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, 
 		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;
 	}
@@ -369,7 +369,7 @@ systrace_args(int sysnum, void *params, 
 		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, 
 	/* 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, 
 	/* 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, 
 	/* 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, 
 	/* 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, 
 	/* 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, 
 	/* 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, 
 	/* 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, 
 	/* 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;
@@ -514,9 +514,9 @@ systrace_args(int sysnum, void *params, 
 		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;
@@ -630,7 +630,7 @@ systrace_entry_setargdesc(int sysnum, in
 			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, in
 			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, in
 			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, in
 			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, in
 			p = "size_t";
 			break;
 		case 3:
-			p = "void *";
+			p = "char *";
 			break;
 		case 4:
 			p = "size_t";
@@ -1171,7 +1171,7 @@ systrace_entry_setargdesc(int sysnum, in
 			p = "cloudabi64_event_t *";
 			break;
 		case 2:
-			p = "cloudabi64_size_t";
+			p = "size_t";
 			break;
 		default:
 			break;
@@ -1406,13 +1406,13 @@ systrace_entry_setargdesc(int sysnum, in
 			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, i
 	/* 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, i
 	/* 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, i
 	/* 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, i
 	/* 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, i
 	/* cloudabi64_sys_poll_fd */
 	case 57:
 		if (ndx == 0 || ndx == 1)
-			p = "cloudabi64_size_t";
+			p = "size_t";
 		break;
 	default:
 		break;

Modified: head/sys/compat/cloudabi64/cloudabi64_thread.c
==============================================================================
--- head/sys/compat/cloudabi64/cloudabi64_thread.c	Thu Mar 24 21:38:52 2016	(r297246)
+++ head/sys/compat/cloudabi64/cloudabi64_thread.c	Thu Mar 24 21:47:15 2016	(r297247)
@@ -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>
 

Modified: head/sys/compat/cloudabi64/cloudabi64_util.h
==============================================================================
--- head/sys/compat/cloudabi64/cloudabi64_util.h	Thu Mar 24 21:38:52 2016	(r297246)
+++ head/sys/compat/cloudabi64/cloudabi64_util.h	Thu Mar 24 21:47:15 2016	(r297247)
@@ -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;

Added: head/sys/contrib/cloudabi/cloudabi64_types.h
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/sys/contrib/cloudabi/cloudabi64_types.h	Thu Mar 24 21:47:15 2016	(r297247)
@@ -0,0 +1,222 @@
+// Copyright (c) 2016 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.
+
+// This file is automatically generated. Do not edit.
+// Source: https://github.com/NuxiNL/cloudabi
+
+#ifndef CLOUDABI64_TYPES_H
+#define CLOUDABI64_TYPES_H
+
+#include "cloudabi_types_common.h"
+
+typedef struct {
+	_Alignas(4) cloudabi_auxtype_t a_type;
+	union {
+		_Alignas(8) uint64_t a_val;
+		_Alignas(8) uint64_t a_ptr;
+	};
+} cloudabi64_auxv_t;
+_Static_assert(offsetof(cloudabi64_auxv_t, a_type) == 0, "Incorrect layout");
+_Static_assert(offsetof(cloudabi64_auxv_t, a_val) == 8, "Incorrect layout");
+_Static_assert(offsetof(cloudabi64_auxv_t, a_ptr) == 8, "Incorrect layout");
+_Static_assert(sizeof(cloudabi64_auxv_t) == 16, "Incorrect layout");
+_Static_assert(_Alignof(cloudabi64_auxv_t) == 8, "Incorrect layout");
+
+typedef struct {
+	_Alignas(8) uint64_t iov_base;
+	_Alignas(8) uint64_t iov_len;
+} cloudabi64_ciovec_t;
+_Static_assert(offsetof(cloudabi64_ciovec_t, iov_base) == 0, "Incorrect layout");
+_Static_assert(offsetof(cloudabi64_ciovec_t, iov_len) == 8, "Incorrect layout");
+_Static_assert(sizeof(cloudabi64_ciovec_t) == 16, "Incorrect layout");
+_Static_assert(_Alignof(cloudabi64_ciovec_t) == 8, "Incorrect layout");
+
+typedef struct {
+	_Alignas(8) cloudabi_userdata_t userdata;
+	_Alignas(2) cloudabi_errno_t error;
+	_Alignas(1) cloudabi_eventtype_t type;
+	union {
+		struct {
+			_Alignas(8) cloudabi_userdata_t identifier;
+		} clock;
+		struct {
+			_Alignas(8) uint64_t condvar;
+		} condvar;
+		struct {
+			_Alignas(8) cloudabi_filesize_t nbytes;
+			_Alignas(4) cloudabi_fd_t fd;
+			_Alignas(2) cloudabi_eventrwflags_t flags;
+		} fd_readwrite;
+		struct {
+			_Alignas(8) uint64_t lock;
+		} lock;
+		struct {
+			_Alignas(4) cloudabi_fd_t fd;
+			_Alignas(1) cloudabi_signal_t signal;
+			_Alignas(4) cloudabi_exitcode_t exitcode;
+		} proc_terminate;
+	};
+} cloudabi64_event_t;
+_Static_assert(offsetof(cloudabi64_event_t, userdata) == 0, "Incorrect layout");
+_Static_assert(offsetof(cloudabi64_event_t, error) == 8, "Incorrect layout");
+_Static_assert(offsetof(cloudabi64_event_t, type) == 10, "Incorrect layout");
+_Static_assert(offsetof(cloudabi64_event_t, clock.identifier) == 16, "Incorrect layout");
+_Static_assert(offsetof(cloudabi64_event_t, condvar.condvar) == 16, "Incorrect layout");
+_Static_assert(offsetof(cloudabi64_event_t, fd_readwrite.nbytes) == 16, "Incorrect layout");
+_Static_assert(offsetof(cloudabi64_event_t, fd_readwrite.fd) == 24, "Incorrect layout");
+_Static_assert(offsetof(cloudabi64_event_t, fd_readwrite.flags) == 28, "Incorrect layout");
+_Static_assert(offsetof(cloudabi64_event_t, lock.lock) == 16, "Incorrect layout");
+_Static_assert(offsetof(cloudabi64_event_t, proc_terminate.fd) == 16, "Incorrect layout");
+_Static_assert(offsetof(cloudabi64_event_t, proc_terminate.signal) == 20, "Incorrect layout");
+_Static_assert(offsetof(cloudabi64_event_t, proc_terminate.exitcode) == 24, "Incorrect layout");
+_Static_assert(sizeof(cloudabi64_event_t) == 32, "Incorrect layout");
+_Static_assert(_Alignof(cloudabi64_event_t) == 8, "Incorrect layout");
+
+typedef struct {
+	_Alignas(8) uint64_t iov_base;
+	_Alignas(8) uint64_t iov_len;
+} cloudabi64_iovec_t;
+_Static_assert(offsetof(cloudabi64_iovec_t, iov_base) == 0, "Incorrect layout");
+_Static_assert(offsetof(cloudabi64_iovec_t, iov_len) == 8, "Incorrect layout");
+_Static_assert(sizeof(cloudabi64_iovec_t) == 16, "Incorrect layout");
+_Static_assert(_Alignof(cloudabi64_iovec_t) == 8, "Incorrect layout");
+
+typedef struct {
+	_Alignas(8) uint64_t ri_data;
+	_Alignas(8) uint64_t ri_datalen;
+	_Alignas(8) uint64_t ri_fds;
+	_Alignas(8) uint64_t ri_fdslen;
+	_Alignas(2) cloudabi_msgflags_t ri_flags;
+} cloudabi64_recv_in_t;
+_Static_assert(offsetof(cloudabi64_recv_in_t, ri_data) == 0, "Incorrect layout");
+_Static_assert(offsetof(cloudabi64_recv_in_t, ri_datalen) == 8, "Incorrect layout");
+_Static_assert(offsetof(cloudabi64_recv_in_t, ri_fds) == 16, "Incorrect layout");
+_Static_assert(offsetof(cloudabi64_recv_in_t, ri_fdslen) == 24, "Incorrect layout");
+_Static_assert(offsetof(cloudabi64_recv_in_t, ri_flags) == 32, "Incorrect layout");
+_Static_assert(sizeof(cloudabi64_recv_in_t) == 40, "Incorrect layout");
+_Static_assert(_Alignof(cloudabi64_recv_in_t) == 8, "Incorrect layout");
+
+typedef struct {
+	_Alignas(8) uint64_t si_data;
+	_Alignas(8) uint64_t si_datalen;
+	_Alignas(8) uint64_t si_fds;
+	_Alignas(8) uint64_t si_fdslen;
+	_Alignas(2) cloudabi_msgflags_t si_flags;
+} cloudabi64_send_in_t;
+_Static_assert(offsetof(cloudabi64_send_in_t, si_data) == 0, "Incorrect layout");
+_Static_assert(offsetof(cloudabi64_send_in_t, si_datalen) == 8, "Incorrect layout");
+_Static_assert(offsetof(cloudabi64_send_in_t, si_fds) == 16, "Incorrect layout");
+_Static_assert(offsetof(cloudabi64_send_in_t, si_fdslen) == 24, "Incorrect layout");
+_Static_assert(offsetof(cloudabi64_send_in_t, si_flags) == 32, "Incorrect layout");
+_Static_assert(sizeof(cloudabi64_send_in_t) == 40, "Incorrect layout");
+_Static_assert(_Alignof(cloudabi64_send_in_t) == 8, "Incorrect layout");
+
+typedef struct {
+	_Alignas(8) uint64_t so_datalen;
+} cloudabi64_send_out_t;
+_Static_assert(offsetof(cloudabi64_send_out_t, so_datalen) == 0, "Incorrect layout");
+_Static_assert(sizeof(cloudabi64_send_out_t) == 8, "Incorrect layout");
+_Static_assert(_Alignof(cloudabi64_send_out_t) == 8, "Incorrect layout");
+
+typedef struct {
+	_Alignas(8) cloudabi_userdata_t userdata;
+	_Alignas(2) cloudabi_subflags_t flags;
+	_Alignas(1) cloudabi_eventtype_t type;
+	union {
+		struct {
+			_Alignas(8) cloudabi_userdata_t identifier;
+			_Alignas(4) cloudabi_clockid_t clock_id;
+			_Alignas(8) cloudabi_timestamp_t timeout;
+			_Alignas(8) cloudabi_timestamp_t precision;
+			_Alignas(2) cloudabi_subclockflags_t flags;
+		} clock;
+		struct {
+			_Alignas(8) uint64_t condvar;
+			_Alignas(8) uint64_t lock;
+			_Alignas(1) cloudabi_mflags_t condvar_scope;
+			_Alignas(1) cloudabi_mflags_t lock_scope;
+		} condvar;
+		struct {
+			_Alignas(4) cloudabi_fd_t fd;
+			_Alignas(2) cloudabi_subrwflags_t flags;
+		} fd_readwrite;
+		struct {
+			_Alignas(8) uint64_t lock;
+			_Alignas(1) cloudabi_mflags_t lock_scope;
+		} lock;
+		struct {
+			_Alignas(4) cloudabi_fd_t fd;
+		} proc_terminate;
+	};
+} cloudabi64_subscription_t;
+_Static_assert(offsetof(cloudabi64_subscription_t, userdata) == 0, "Incorrect layout");
+_Static_assert(offsetof(cloudabi64_subscription_t, flags) == 8, "Incorrect layout");
+_Static_assert(offsetof(cloudabi64_subscription_t, type) == 10, "Incorrect layout");
+_Static_assert(offsetof(cloudabi64_subscription_t, clock.identifier) == 16, "Incorrect layout");
+_Static_assert(offsetof(cloudabi64_subscription_t, clock.clock_id) == 24, "Incorrect layout");
+_Static_assert(offsetof(cloudabi64_subscription_t, clock.timeout) == 32, "Incorrect layout");
+_Static_assert(offsetof(cloudabi64_subscription_t, clock.precision) == 40, "Incorrect layout");
+_Static_assert(offsetof(cloudabi64_subscription_t, clock.flags) == 48, "Incorrect layout");
+_Static_assert(offsetof(cloudabi64_subscription_t, condvar.condvar) == 16, "Incorrect layout");
+_Static_assert(offsetof(cloudabi64_subscription_t, condvar.lock) == 24, "Incorrect layout");
+_Static_assert(offsetof(cloudabi64_subscription_t, condvar.condvar_scope) == 32, "Incorrect layout");
+_Static_assert(offsetof(cloudabi64_subscription_t, condvar.lock_scope) == 33, "Incorrect layout");
+_Static_assert(offsetof(cloudabi64_subscription_t, fd_readwrite.fd) == 16, "Incorrect layout");
+_Static_assert(offsetof(cloudabi64_subscription_t, fd_readwrite.flags) == 20, "Incorrect layout");
+_Static_assert(offsetof(cloudabi64_subscription_t, lock.lock) == 16, "Incorrect layout");
+_Static_assert(offsetof(cloudabi64_subscription_t, lock.lock_scope) == 24, "Incorrect layout");
+_Static_assert(offsetof(cloudabi64_subscription_t, proc_terminate.fd) == 16, "Incorrect layout");
+_Static_assert(sizeof(cloudabi64_subscription_t) == 56, "Incorrect layout");
+_Static_assert(_Alignof(cloudabi64_subscription_t) == 8, "Incorrect layout");
+
+typedef void cloudabi64_threadentry_t(cloudabi_tid_t tid, uint64_t aux);
+
+typedef struct {
+	_Alignas(8) uint64_t ro_datalen;
+	_Alignas(8) uint64_t ro_fdslen;
+	_Alignas(2) cloudabi_sockaddr_t ro_sockname;
+	_Alignas(2) cloudabi_sockaddr_t ro_peername;
+	_Alignas(2) cloudabi_msgflags_t ro_flags;
+} cloudabi64_recv_out_t;
+_Static_assert(offsetof(cloudabi64_recv_out_t, ro_datalen) == 0, "Incorrect layout");
+_Static_assert(offsetof(cloudabi64_recv_out_t, ro_fdslen) == 8, "Incorrect layout");
+_Static_assert(offsetof(cloudabi64_recv_out_t, ro_sockname) == 16, "Incorrect layout");
+_Static_assert(offsetof(cloudabi64_recv_out_t, ro_peername) == 36, "Incorrect layout");
+_Static_assert(offsetof(cloudabi64_recv_out_t, ro_flags) == 56, "Incorrect layout");
+_Static_assert(sizeof(cloudabi64_recv_out_t) == 64, "Incorrect layout");
+_Static_assert(_Alignof(cloudabi64_recv_out_t) == 8, "Incorrect layout");
+
+typedef struct {
+	_Alignas(8) uint64_t entry_point;
+	_Alignas(8) uint64_t stack;
+	_Alignas(8) uint64_t stack_size;
+	_Alignas(8) uint64_t argument;
+} cloudabi64_threadattr_t;
+_Static_assert(offsetof(cloudabi64_threadattr_t, entry_point) == 0, "Incorrect layout");
+_Static_assert(offsetof(cloudabi64_threadattr_t, stack) == 8, "Incorrect layout");
+_Static_assert(offsetof(cloudabi64_threadattr_t, stack_size) == 16, "Incorrect layout");
+_Static_assert(offsetof(cloudabi64_threadattr_t, argument) == 24, "Incorrect layout");
+_Static_assert(sizeof(cloudabi64_threadattr_t) == 32, "Incorrect layout");
+_Static_assert(_Alignof(cloudabi64_threadattr_t) == 8, "Incorrect layout");
+
+#endif

Added: head/sys/contrib/cloudabi/cloudabi_types_common.h
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/sys/contrib/cloudabi/cloudabi_types_common.h	Thu Mar 24 21:47:15 2016	(r297247)
@@ -0,0 +1,457 @@
+// Copyright (c) 2016 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.
+
+// This file is automatically generated. Do not edit.
+// Source: https://github.com/NuxiNL/cloudabi
+
+#ifndef CLOUDABI_TYPES_COMMON_H
+#define CLOUDABI_TYPES_COMMON_H
+
+#if defined(__FreeBSD__) && defined(_KERNEL)
+#include <sys/stdint.h>
+#elif defined(__linux__) && defined(__KERNEL__)
+#include <linux/types.h>
+#else
+#include <stddef.h>
+#include <stdint.h>
+#endif
+
+typedef uint8_t cloudabi_advice_t;
+#define CLOUDABI_ADVICE_DONTNEED   1
+#define CLOUDABI_ADVICE_NOREUSE    2
+#define CLOUDABI_ADVICE_NORMAL     3
+#define CLOUDABI_ADVICE_RANDOM     4
+#define CLOUDABI_ADVICE_SEQUENTIAL 5
+#define CLOUDABI_ADVICE_WILLNEED   6
+
+typedef uint32_t cloudabi_auxtype_t;
+#define CLOUDABI_AT_ARGDATA    256
+#define CLOUDABI_AT_ARGDATALEN 257
+#define CLOUDABI_AT_CANARY     258
+#define CLOUDABI_AT_CANARYLEN  259
+#define CLOUDABI_AT_NCPUS      260
+#define CLOUDABI_AT_NULL         0
+#define CLOUDABI_AT_PAGESZ       6
+#define CLOUDABI_AT_PHDR         3
+#define CLOUDABI_AT_PHNUM        4
+#define CLOUDABI_AT_TID        261
+
+typedef uint32_t cloudabi_backlog_t;
+
+typedef uint32_t cloudabi_clockid_t;
+#define CLOUDABI_CLOCK_MONOTONIC          1
+#define CLOUDABI_CLOCK_PROCESS_CPUTIME_ID 2
+#define CLOUDABI_CLOCK_REALTIME           3
+#define CLOUDABI_CLOCK_THREAD_CPUTIME_ID  4
+
+typedef uint32_t cloudabi_condvar_t;
+#define CLOUDABI_CONDVAR_HAS_NO_WAITERS 0
+
+typedef uint64_t cloudabi_device_t;

*** DIFF OUTPUT TRUNCATED AT 1000 LINES ***



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20160325071420.K2059>