diff mbox

Add support for catching system calls to native FreeBSD targets.

Message ID 20160614205751.11566-1-jhb@FreeBSD.org
State New
Headers show

Commit Message

John Baldwin June 14, 2016, 8:57 p.m. UTC
All platforms on FreeBSD use a shared system call table, so use a
single XML file to describe the system calls available on each FreeBSD
platform.

xRecent versions of FreeBSD include the identifier of the current
system call when reporting a system call entry or exit event in the
ptrace_lwpinfo structure obtained via PT_LWPINFO in fbsd_wait.  As
such, FreeBSD native targets do not use the gdbarch method to fetch
the system call code.  In addition, FreeBSD register sets fetched via
ptrace do not include an equivalent of 'orig_rax' (on amd64 for
example), so the system call code cannot be extracted from the
available registers during a system call exit.  However, GDB assumes
that system call catch points are not supported if the gdbarch method
is not present.  As a workaround, FreeBSD ABIs install a dummy gdbarch
method that throws an internal_error if it is ever invoked.

gdb/ChangeLog:

	* configure.ac: Check for support for system call LWP fields on
	FreeBSD.
	* config.in, configure: Rebuild.
	* data-directory/Makefile.in (SYSCALLS_FILES): Add freebsd.xml.
	* fbsd-nat.c (fbsd_wait) [HAVE_STRUCT_PTRACE_LWPINFO_PL_SYSCALL_CODE]:
	Report system call events.
	[HAVE_STRUCT_PTRACE_LWPINFO_PL_SYSCALL_CODE]
	(fbsd_set_syscall_catchpoint): New function.
	(fbsd_nat_add_target) [HAVE_STRUCT_PTRACE_LWPINFO_PL_SYSCALL_CODE]:
	Set "to_set_syscall_catchpoint" to "fbsd_set_syscall_catchpoint".
	* fbsd-tdep.c: Include xml-syscall.h
	(fbsd_get_syscall_number): New function.
	(fbsd_init_abi): Set XML system call file name.
	Add "get_syscall_number" gdbarch method.
	* syscalls/freebsd.xml: New file.
---
 gdb/ChangeLog                  |  18 ++
 gdb/config.in                  |   3 +
 gdb/configure                  |  14 ++
 gdb/configure.ac               |   5 +
 gdb/data-directory/Makefile.in |   3 +-
 gdb/fbsd-nat.c                 |  50 +++++
 gdb/fbsd-tdep.c                |  19 ++
 gdb/syscalls/freebsd.xml       | 410 +++++++++++++++++++++++++++++++++++++++++
 8 files changed, 521 insertions(+), 1 deletion(-)
 create mode 100644 gdb/syscalls/freebsd.xml

Comments

John Baldwin June 20, 2016, 4:58 p.m. UTC | #1
On Tuesday, June 14, 2016 01:57:51 PM John Baldwin wrote:
> All platforms on FreeBSD use a shared system call table, so use a
> single XML file to describe the system calls available on each FreeBSD
> platform.
> 
> xRecent versions of FreeBSD include the identifier of the current
> system call when reporting a system call entry or exit event in the
> ptrace_lwpinfo structure obtained via PT_LWPINFO in fbsd_wait.  As
> such, FreeBSD native targets do not use the gdbarch method to fetch
> the system call code.  In addition, FreeBSD register sets fetched via
> ptrace do not include an equivalent of 'orig_rax' (on amd64 for
> example), so the system call code cannot be extracted from the
> available registers during a system call exit.  However, GDB assumes
> that system call catch points are not supported if the gdbarch method
> is not present.  As a workaround, FreeBSD ABIs install a dummy gdbarch
> method that throws an internal_error if it is ever invoked.

Ping?  I don't think this conflicts with the pending patches to add
system call groups.  (Presumbly I would just need a followup change to
annotate the groups in freebsd.xml.)
Pedro Alves June 20, 2016, 10:56 p.m. UTC | #2
Hi John,

This looks good to me.  Just some minor nits below.

On 06/14/2016 09:57 PM, John Baldwin wrote:
> All platforms on FreeBSD use a shared system call table, so use a
> single XML file to describe the system calls available on each FreeBSD
> platform.
> 
> xRecent 

typo.

> versions of FreeBSD include the identifier of the current
> system call when reporting a system call entry or exit event in the
> ptrace_lwpinfo structure obtained via PT_LWPINFO in fbsd_wait.  As
> such, FreeBSD native targets do not use the gdbarch method to fetch
> the system call code.  In addition, FreeBSD register sets fetched via
> ptrace do not include an equivalent of 'orig_rax' (on amd64 for
> example), so the system call code cannot be extracted from the
> available registers during a system call exit.  However, GDB assumes
> that system call catch points are not supported if the gdbarch method
> is not present.  As a workaround, FreeBSD ABIs install a dummy gdbarch
> method that throws an internal_error if it is ever invoked.
> 

We should probably get rid of this gdbarch method, by making linux-nat.c
(the only caller) call an arch-specific target_ops override instead of
a gdbarch method, like gdbserver's equivalent code does.

To replace the break-catch-syscall.c error, I think that it'd be reasonable
to remove it altogether, and for Linux targets that don't implement
the gdbarch hook yet, instead just always intercept all syscalls, reporting
an <unknown> syscall number.

But what you did seems like a reasonable thing to do as long as do
have the gdbarch hook.  

> diff --git a/gdb/configure.ac b/gdb/configure.ac
> index 6a72f72..4ed706a 100644
> --- a/gdb/configure.ac
> +++ b/gdb/configure.ac
> @@ -1526,6 +1526,11 @@ fi
>  AC_CHECK_MEMBERS([struct ptrace_lwpinfo.pl_tdname], [], [],
>                   [#include <sys/ptrace.h>])
>  
> +# See if <sys/ptrace.h> supports syscall fields on FreeBSD

Missing period.

> +# Older FreeBSD versions don't have the pl_syscall_code member of
> +# `struct ptrace_lwpinfo'.

Can you replace "Older" with a non-relative version reference?

> +AC_CHECK_MEMBERS([struct ptrace_lwpinfo.pl_syscall_code], [], [],
> +                 [#include <sys/ptrace.h>])
>  

> diff --git a/gdb/fbsd-nat.c b/gdb/fbsd-nat.c
> index b582abe..741a96d 100644
> --- a/gdb/fbsd-nat.c
> +++ b/gdb/fbsd-nat.c
> @@ -707,6 +707,40 @@ fbsd_wait (struct target_ops *ops,
>  	      return wptid;
>  	    }
>  #endif
> +
> +	  /* Note that PL_FLAG_SCE is set for any event reported while
> +	     a thread is executing a system call in the kernel.  In
> +	     particular, signals that interrupt a sleep in a system
> +	     call will report this flag as part of their event.  Stops
> +	     explicitly for system call entry and exit always use
> +	     SIGTRAP, so only treat SIGTRAP events as system call
> +	     entriy/exit events.  */

Typo "entriy".  

> +	  if (pl.pl_flags & (PL_FLAG_SCE | PL_FLAG_SCX)
> +	      && ourstatus->value.sig == SIGTRAP)
> +	    {
> +#ifdef HAVE_STRUCT_PTRACE_LWPINFO_PL_SYSCALL_CODE
> +	      if (catch_syscall_enabled ())
> +		{
> +		  if (catching_syscall_number (pl.pl_syscall_code))
> +		    {
> +		      if (pl.pl_flags & PL_FLAG_SCE)
> +			ourstatus->kind = TARGET_WAITKIND_SYSCALL_ENTRY;
> +		      else
> +			ourstatus->kind = TARGET_WAITKIND_SYSCALL_RETURN;
> +		      ourstatus->value.syscall_number = pl.pl_syscall_code;
> +		      return wptid;
> +		    }
> +		}
> +#endif
> +	      /* If the core isn't interested in this event, just
> +		 continue the process explicitly and wait for another
> +		 event.  Note that PT_SYSCALL is "sticky" on FreeBSD
> +		 and once system call stops are enabled on a process
> +		 it stops for all system call entries and exits.  */
> +	      if (ptrace (PT_CONTINUE, pid, (caddr_t) 1, 0) == -1)
> +		perror_with_name (("ptrace"));
> +	      continue;
> +	    }
>  	}
>        return wptid;
>      }

>  #include "elf-bfd.h"
>  #include "fbsd-tdep.h"
> @@ -283,6 +284,20 @@ fbsd_make_corefile_notes (struct gdbarch *gdbarch, bfd *obfd, int *note_size)
>    return note_data;
>  }
>  
> +static LONGEST
> +fbsd_get_syscall_number (struct gdbarch *gdbarch,
> +			 ptid_t ptid)

Add the usual "implement foo gdbarch method" or some such comment.

> +{

Thanks,
Pedro Alves
John Baldwin June 24, 2016, 12:24 a.m. UTC | #3
On Monday, June 20, 2016 11:56:40 PM Pedro Alves wrote:
> Hi John,
> 
> This looks good to me.  Just some minor nits below.
> 
> On 06/14/2016 09:57 PM, John Baldwin wrote:
> > versions of FreeBSD include the identifier of the current
> > system call when reporting a system call entry or exit event in the
> > ptrace_lwpinfo structure obtained via PT_LWPINFO in fbsd_wait.  As
> > such, FreeBSD native targets do not use the gdbarch method to fetch
> > the system call code.  In addition, FreeBSD register sets fetched via
> > ptrace do not include an equivalent of 'orig_rax' (on amd64 for
> > example), so the system call code cannot be extracted from the
> > available registers during a system call exit.  However, GDB assumes
> > that system call catch points are not supported if the gdbarch method
> > is not present.  As a workaround, FreeBSD ABIs install a dummy gdbarch
> > method that throws an internal_error if it is ever invoked.
> > 
> 
> We should probably get rid of this gdbarch method, by making linux-nat.c
> (the only caller) call an arch-specific target_ops override instead of
> a gdbarch method, like gdbserver's equivalent code does.
> 
> To replace the break-catch-syscall.c error, I think that it'd be reasonable
> to remove it altogether, and for Linux targets that don't implement
> the gdbarch hook yet, instead just always intercept all syscalls, reporting
> an <unknown> syscall number.
> 
> But what you did seems like a reasonable thing to do as long as do
> have the gdbarch hook.  

So I'm not quite sure how to implement an arch-specific target_op.
There are various linux_nat_set_* functions that accept a function pointer
but then just set a global variable.  The amd64 version might have to copy
with different ABIs rather than depending on teh i386 gdbarch method, etc.

One option that is a bit smaller in scale would be to move the error
in break-catch-syscall.c into linux_child_set_syscall_catchpoint in
linux-nat.c.  It could return 1 to fail the request if the gdbarch
method wasn't present.
Pedro Alves June 24, 2016, 3:52 p.m. UTC | #4
On 06/24/2016 01:24 AM, John Baldwin wrote:

> So I'm not quite sure how to implement an arch-specific target_op.
> There are various linux_nat_set_* functions that accept a function pointer
> but then just set a global variable.  The amd64 version might have to copy
> with different ABIs rather than depending on teh i386 gdbarch method, etc.

See amd64-linux-nat.c:amd64_linux_siginfo_fixup for example.

> 
> One option that is a bit smaller in scale would be to move the error
> in break-catch-syscall.c into linux_child_set_syscall_catchpoint in
> linux-nat.c.  It could return 1 to fail the request if the gdbarch
> method wasn't present.

That might work indeed.

In any case, I think what you have is reasonable, given the current
framework.  Please do feel free to push what you already have with
the nits addressed.  I did not mean for you to go eliminate
the gdbarch hook as prerequisite; was really mainly thinking out loud.
Sorry if it sounded otherwise.

Thanks,
Pedro Alves
John Baldwin June 24, 2016, 5:56 p.m. UTC | #5
On Friday, June 24, 2016 04:52:23 PM Pedro Alves wrote:
> On 06/24/2016 01:24 AM, John Baldwin wrote:
> 
> > So I'm not quite sure how to implement an arch-specific target_op.
> > There are various linux_nat_set_* functions that accept a function pointer
> > but then just set a global variable.  The amd64 version might have to copy
> > with different ABIs rather than depending on teh i386 gdbarch method, etc.
> 
> See amd64-linux-nat.c:amd64_linux_siginfo_fixup for example.
> 
> > 
> > One option that is a bit smaller in scale would be to move the error
> > in break-catch-syscall.c into linux_child_set_syscall_catchpoint in
> > linux-nat.c.  It could return 1 to fail the request if the gdbarch
> > method wasn't present.
> 
> That might work indeed.
> 
> In any case, I think what you have is reasonable, given the current
> framework.  Please do feel free to push what you already have with
> the nits addressed.  I did not mean for you to go eliminate
> the gdbarch hook as prerequisite; was really mainly thinking out loud.
> Sorry if it sounded otherwise.

Oh, no worry.  I don't mind refactoring when it makes sense.  I've gone
ahead and pushed the current patch with nits addressed.
diff mbox

Patch

diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index 9e57431..08cf78c 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,5 +1,23 @@ 
 2016-06-14  John Baldwin  <jhb@FreeBSD.org>
 
+	* configure.ac: Check for support for system call LWP fields on
+	FreeBSD.
+	* config.in, configure: Rebuild.
+	* data-directory/Makefile.in (SYSCALLS_FILES): Add freebsd.xml.
+	* fbsd-nat.c (fbsd_wait) [HAVE_STRUCT_PTRACE_LWPINFO_PL_SYSCALL_CODE]:
+	Report system call events.
+	[HAVE_STRUCT_PTRACE_LWPINFO_PL_SYSCALL_CODE]
+	(fbsd_set_syscall_catchpoint): New function.
+	(fbsd_nat_add_target) [HAVE_STRUCT_PTRACE_LWPINFO_PL_SYSCALL_CODE]:
+	Set "to_set_syscall_catchpoint" to "fbsd_set_syscall_catchpoint".
+	* fbsd-tdep.c: Include xml-syscall.h
+	(fbsd_get_syscall_number): New function.
+	(fbsd_init_abi): Set XML system call file name.
+	Add "get_syscall_number" gdbarch method.
+	* syscalls/freebsd.xml: New file.
+
+2016-06-14  John Baldwin  <jhb@FreeBSD.org>
+
 	* v850-tdep.c (v850_use_struct_convention): Trim type length checks.
 
 2016-06-14  John Baldwin  <jhb@FreeBSD.org>
diff --git a/gdb/config.in b/gdb/config.in
index 905caf0..c82a5b4 100644
--- a/gdb/config.in
+++ b/gdb/config.in
@@ -456,6 +456,9 @@ 
 /* Define to 1 if `struct ptrace_lwpinfo' is a member of `pl_tdname'. */
 #undef HAVE_STRUCT_PTRACE_LWPINFO_PL_TDNAME
 
+/* Define to 1 if `struct ptrace_lwpinfo' is a member of `pl_syscall_code'. */
+#undef HAVE_STRUCT_PTRACE_LWPINFO_PL_SYSCALL_CODE
+
 /* Define to 1 if your system has struct reg in <machine/reg.h>. */
 #undef HAVE_STRUCT_REG
 
diff --git a/gdb/configure b/gdb/configure
index 60ea884..5cdfc98 100755
--- a/gdb/configure
+++ b/gdb/configure
@@ -12927,6 +12927,20 @@  _ACEOF
 fi
 
 
+# See if <sys/ptrace.h> supports syscall fields on FreeBSD
+# Older FreeBSD versions don't have the pl_syscall_code member of
+# `struct ptrace_lwpinfo'.
+ac_fn_c_check_member "$LINENO" "struct ptrace_lwpinfo" "pl_syscall_code" "ac_cv_member_struct_ptrace_lwpinfo_pl_syscall_code" "#include <sys/ptrace.h>
+"
+if test "x$ac_cv_member_struct_ptrace_lwpinfo_pl_syscall_code" = x""yes; then :
+
+cat >>confdefs.h <<_ACEOF
+#define HAVE_STRUCT_PTRACE_LWPINFO_PL_SYSCALL_CODE 1
+_ACEOF
+
+
+fi
+
 
 # Detect which type of /proc is in use, such as for Solaris.
 
diff --git a/gdb/configure.ac b/gdb/configure.ac
index 6a72f72..4ed706a 100644
--- a/gdb/configure.ac
+++ b/gdb/configure.ac
@@ -1526,6 +1526,11 @@  fi
 AC_CHECK_MEMBERS([struct ptrace_lwpinfo.pl_tdname], [], [],
                  [#include <sys/ptrace.h>])
 
+# See if <sys/ptrace.h> supports syscall fields on FreeBSD
+# Older FreeBSD versions don't have the pl_syscall_code member of
+# `struct ptrace_lwpinfo'.
+AC_CHECK_MEMBERS([struct ptrace_lwpinfo.pl_syscall_code], [], [],
+                 [#include <sys/ptrace.h>])
 
 # Detect which type of /proc is in use, such as for Solaris.
 
diff --git a/gdb/data-directory/Makefile.in b/gdb/data-directory/Makefile.in
index c05f379..0beca55 100644
--- a/gdb/data-directory/Makefile.in
+++ b/gdb/data-directory/Makefile.in
@@ -51,7 +51,8 @@  SYSCALLS_FILES = \
 	i386-linux.xml amd64-linux.xml \
 	sparc-linux.xml sparc64-linux.xml \
 	mips-o32-linux.xml mips-n32-linux.xml mips-n64-linux.xml \
-	s390-linux.xml s390x-linux.xml
+	s390-linux.xml s390x-linux.xml \
+	freebsd.xml
 
 PYTHON_DIR = python
 PYTHON_INSTALL_DIR = $(DESTDIR)$(GDB_DATADIR)/$(PYTHON_DIR)
diff --git a/gdb/fbsd-nat.c b/gdb/fbsd-nat.c
index b582abe..741a96d 100644
--- a/gdb/fbsd-nat.c
+++ b/gdb/fbsd-nat.c
@@ -707,6 +707,40 @@  fbsd_wait (struct target_ops *ops,
 	      return wptid;
 	    }
 #endif
+
+	  /* Note that PL_FLAG_SCE is set for any event reported while
+	     a thread is executing a system call in the kernel.  In
+	     particular, signals that interrupt a sleep in a system
+	     call will report this flag as part of their event.  Stops
+	     explicitly for system call entry and exit always use
+	     SIGTRAP, so only treat SIGTRAP events as system call
+	     entriy/exit events.  */
+	  if (pl.pl_flags & (PL_FLAG_SCE | PL_FLAG_SCX)
+	      && ourstatus->value.sig == SIGTRAP)
+	    {
+#ifdef HAVE_STRUCT_PTRACE_LWPINFO_PL_SYSCALL_CODE
+	      if (catch_syscall_enabled ())
+		{
+		  if (catching_syscall_number (pl.pl_syscall_code))
+		    {
+		      if (pl.pl_flags & PL_FLAG_SCE)
+			ourstatus->kind = TARGET_WAITKIND_SYSCALL_ENTRY;
+		      else
+			ourstatus->kind = TARGET_WAITKIND_SYSCALL_RETURN;
+		      ourstatus->value.syscall_number = pl.pl_syscall_code;
+		      return wptid;
+		    }
+		}
+#endif
+	      /* If the core isn't interested in this event, just
+		 continue the process explicitly and wait for another
+		 event.  Note that PT_SYSCALL is "sticky" on FreeBSD
+		 and once system call stops are enabled on a process
+		 it stops for all system call entries and exits.  */
+	      if (ptrace (PT_CONTINUE, pid, (caddr_t) 1, 0) == -1)
+		perror_with_name (("ptrace"));
+	      continue;
+	    }
 	}
       return wptid;
     }
@@ -817,6 +851,19 @@  fbsd_remove_exec_catchpoint (struct target_ops *self, int pid)
   return 0;
 }
 #endif
+
+#ifdef HAVE_STRUCT_PTRACE_LWPINFO_PL_SYSCALL_CODE
+static int
+fbsd_set_syscall_catchpoint (struct target_ops *self, int pid, int needed,
+			     int any_count, int table_size, int *table)
+{
+
+  /* Ignore the arguments.  inf-ptrace.c will use PT_SYSCALL which
+     will catch all system call entries and exits.  The system calls
+     are filtered by GDB rather than the kernel.  */
+  return 0;
+}
+#endif
 #endif
 
 void
@@ -849,6 +896,9 @@  fbsd_nat_add_target (struct target_ops *t)
   t->to_insert_exec_catchpoint = fbsd_insert_exec_catchpoint;
   t->to_remove_exec_catchpoint = fbsd_remove_exec_catchpoint;
 #endif
+#ifdef HAVE_STRUCT_PTRACE_LWPINFO_PL_SYSCALL_CODE
+  t->to_set_syscall_catchpoint = fbsd_set_syscall_catchpoint;
+#endif
 #endif
   add_target (t);
 }
diff --git a/gdb/fbsd-tdep.c b/gdb/fbsd-tdep.c
index 7310ea0..d7fe201 100644
--- a/gdb/fbsd-tdep.c
+++ b/gdb/fbsd-tdep.c
@@ -23,6 +23,7 @@ 
 #include "regcache.h"
 #include "regset.h"
 #include "gdbthread.h"
+#include "xml-syscall.h"
 
 #include "elf-bfd.h"
 #include "fbsd-tdep.h"
@@ -283,6 +284,20 @@  fbsd_make_corefile_notes (struct gdbarch *gdbarch, bfd *obfd, int *note_size)
   return note_data;
 }
 
+static LONGEST
+fbsd_get_syscall_number (struct gdbarch *gdbarch,
+			 ptid_t ptid)
+{
+
+  /* FreeBSD doesn't use gdbarch_get_syscall_number since FreeBSD
+     native targets fetch the system call number from the
+     'pl_syscall_code' member of struct ptrace_lwpinfo in fbsd_wait.
+     However, system call catching requires this function to be
+     set.  */
+
+  internal_error (__FILE__, __LINE__, _("fbsd_get_sycall_number called"));
+}
+
 /* To be called from GDB_OSABI_FREEBSD_ELF handlers. */
 
 void
@@ -291,4 +306,8 @@  fbsd_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch)
   set_gdbarch_core_pid_to_str (gdbarch, fbsd_core_pid_to_str);
   set_gdbarch_core_thread_name (gdbarch, fbsd_core_thread_name);
   set_gdbarch_make_corefile_notes (gdbarch, fbsd_make_corefile_notes);
+
+  /* `catch syscall' */
+  set_xml_syscall_file_name (gdbarch, "syscalls/freebsd.xml");
+  set_gdbarch_get_syscall_number (gdbarch, fbsd_get_syscall_number);
 }
diff --git a/gdb/syscalls/freebsd.xml b/gdb/syscalls/freebsd.xml
new file mode 100644
index 0000000..7d52168
--- /dev/null
+++ b/gdb/syscalls/freebsd.xml
@@ -0,0 +1,410 @@ 
+<?xml version="1.0"?>
+<!-- Copyright (C) 2009-2016 Free Software Foundation, Inc.
+
+     Copying and distribution of this file, with or without modification,
+     are permitted in any medium without royalty provided the copyright
+     notice and this notice are preserved.  -->
+
+<!DOCTYPE feature SYSTEM "gdb-syscalls.dtd">
+
+<!-- This file was generated using the following file:
+     
+     /usr/src/sys/sys/syscall.h
+
+     The file mentioned above belongs to the FreeBSD Kernel.  -->
+
+<syscalls_info>
+  <syscall name="syscall" number="0"/>
+  <syscall name="exit" number="1"/>
+  <syscall name="fork" number="2"/>
+  <syscall name="read" number="3"/>
+  <syscall name="write" number="4"/>
+  <syscall name="open" number="5"/>
+  <syscall name="close" number="6"/>
+  <syscall name="wait4" number="7"/>
+  <syscall name="link" number="9"/>
+  <syscall name="unlink" number="10"/>
+  <syscall name="chdir" number="12"/>
+  <syscall name="fchdir" number="13"/>
+  <syscall name="mknod" number="14"/>
+  <syscall name="chmod" number="15"/>
+  <syscall name="chown" number="16"/>
+  <syscall name="break" number="17"/>
+  <syscall name="getpid" number="20"/>
+  <syscall name="mount" number="21"/>
+  <syscall name="unmount" number="22"/>
+  <syscall name="setuid" number="23"/>
+  <syscall name="getuid" number="24"/>
+  <syscall name="geteuid" number="25"/>
+  <syscall name="ptrace" number="26"/>
+  <syscall name="recvmsg" number="27"/>
+  <syscall name="sendmsg" number="28"/>
+  <syscall name="recvfrom" number="29"/>
+  <syscall name="accept" number="30"/>
+  <syscall name="getpeername" number="31"/>
+  <syscall name="getsockname" number="32"/>
+  <syscall name="access" number="33"/>
+  <syscall name="chflags" number="34"/>
+  <syscall name="fchflags" number="35"/>
+  <syscall name="sync" number="36"/>
+  <syscall name="kill" number="37"/>
+  <syscall name="getppid" number="39"/>
+  <syscall name="dup" number="41"/>
+  <syscall name="pipe" number="42"/>
+  <syscall name="getegid" number="43"/>
+  <syscall name="profil" number="44"/>
+  <syscall name="ktrace" number="45"/>
+  <syscall name="getgid" number="47"/>
+  <syscall name="getlogin" number="49"/>
+  <syscall name="setlogin" number="50"/>
+  <syscall name="acct" number="51"/>
+  <syscall name="sigaltstack" number="53"/>
+  <syscall name="ioctl" number="54"/>
+  <syscall name="reboot" number="55"/>
+  <syscall name="revoke" number="56"/>
+  <syscall name="symlink" number="57"/>
+  <syscall name="readlink" number="58"/>
+  <syscall name="execve" number="59"/>
+  <syscall name="umask" number="60"/>
+  <syscall name="chroot" number="61"/>
+  <syscall name="msync" number="65"/>
+  <syscall name="vfork" number="66"/>
+  <syscall name="sbrk" number="69"/>
+  <syscall name="sstk" number="70"/>
+  <syscall name="vadvise" number="72"/>
+  <syscall name="munmap" number="73"/>
+  <syscall name="mprotect" number="74"/>
+  <syscall name="madvise" number="75"/>
+  <syscall name="mincore" number="78"/>
+  <syscall name="getgroups" number="79"/>
+  <syscall name="setgroups" number="80"/>
+  <syscall name="getpgrp" number="81"/>
+  <syscall name="setpgid" number="82"/>
+  <syscall name="setitimer" number="83"/>
+  <syscall name="swapon" number="85"/>
+  <syscall name="getitimer" number="86"/>
+  <syscall name="getdtablesize" number="89"/>
+  <syscall name="dup2" number="90"/>
+  <syscall name="fcntl" number="92"/>
+  <syscall name="select" number="93"/>
+  <syscall name="fsync" number="95"/>
+  <syscall name="setpriority" number="96"/>
+  <syscall name="socket" number="97"/>
+  <syscall name="connect" number="98"/>
+  <syscall name="getpriority" number="100"/>
+  <syscall name="bind" number="104"/>
+  <syscall name="setsockopt" number="105"/>
+  <syscall name="listen" number="106"/>
+  <syscall name="gettimeofday" number="116"/>
+  <syscall name="getrusage" number="117"/>
+  <syscall name="getsockopt" number="118"/>
+  <syscall name="readv" number="120"/>
+  <syscall name="writev" number="121"/>
+  <syscall name="settimeofday" number="122"/>
+  <syscall name="fchown" number="123"/>
+  <syscall name="fchmod" number="124"/>
+  <syscall name="setreuid" number="126"/>
+  <syscall name="setregid" number="127"/>
+  <syscall name="rename" number="128"/>
+  <syscall name="flock" number="131"/>
+  <syscall name="mkfifo" number="132"/>
+  <syscall name="sendto" number="133"/>
+  <syscall name="shutdown" number="134"/>
+  <syscall name="socketpair" number="135"/>
+  <syscall name="mkdir" number="136"/>
+  <syscall name="rmdir" number="137"/>
+  <syscall name="utimes" number="138"/>
+  <syscall name="adjtime" number="140"/>
+  <syscall name="setsid" number="147"/>
+  <syscall name="quotactl" number="148"/>
+  <syscall name="nlm_syscall" number="154"/>
+  <syscall name="nfssvc" number="155"/>
+  <syscall name="lgetfh" number="160"/>
+  <syscall name="getfh" number="161"/>
+  <syscall name="sysarch" number="165"/>
+  <syscall name="rtprio" number="166"/>
+  <syscall name="semsys" number="169"/>
+  <syscall name="msgsys" number="170"/>
+  <syscall name="shmsys" number="171"/>
+  <syscall name="setfib" number="175"/>
+  <syscall name="ntp_adjtime" number="176"/>
+  <syscall name="setgid" number="181"/>
+  <syscall name="setegid" number="182"/>
+  <syscall name="seteuid" number="183"/>
+  <syscall name="stat" number="188"/>
+  <syscall name="fstat" number="189"/>
+  <syscall name="lstat" number="190"/>
+  <syscall name="pathconf" number="191"/>
+  <syscall name="fpathconf" number="192"/>
+  <syscall name="getrlimit" number="194"/>
+  <syscall name="setrlimit" number="195"/>
+  <syscall name="getdirentries" number="196"/>
+  <syscall name="__syscall" number="198"/>
+  <syscall name="__sysctl" number="202"/>
+  <syscall name="mlock" number="203"/>
+  <syscall name="munlock" number="204"/>
+  <syscall name="undelete" number="205"/>
+  <syscall name="futimes" number="206"/>
+  <syscall name="getpgid" number="207"/>
+  <syscall name="poll" number="209"/>
+  <syscall name="freebsd7___semctl" number="220"/>
+  <syscall name="semget" number="221"/>
+  <syscall name="semop" number="222"/>
+  <syscall name="freebsd7_msgctl" number="224"/>
+  <syscall name="msgget" number="225"/>
+  <syscall name="msgsnd" number="226"/>
+  <syscall name="msgrcv" number="227"/>
+  <syscall name="shmat" number="228"/>
+  <syscall name="freebsd7_shmctl" number="229"/>
+  <syscall name="shmdt" number="230"/>
+  <syscall name="shmget" number="231"/>
+  <syscall name="clock_gettime" number="232"/>
+  <syscall name="clock_settime" number="233"/>
+  <syscall name="clock_getres" number="234"/>
+  <syscall name="ktimer_create" number="235"/>
+  <syscall name="ktimer_delete" number="236"/>
+  <syscall name="ktimer_settime" number="237"/>
+  <syscall name="ktimer_gettime" number="238"/>
+  <syscall name="ktimer_getoverrun" number="239"/>
+  <syscall name="nanosleep" number="240"/>
+  <syscall name="ffclock_getcounter" number="241"/>
+  <syscall name="ffclock_setestimate" number="242"/>
+  <syscall name="ffclock_getestimate" number="243"/>
+  <syscall name="clock_getcpuclockid2" number="247"/>
+  <syscall name="ntp_gettime" number="248"/>
+  <syscall name="minherit" number="250"/>
+  <syscall name="rfork" number="251"/>
+  <syscall name="openbsd_poll" number="252"/>
+  <syscall name="issetugid" number="253"/>
+  <syscall name="lchown" number="254"/>
+  <syscall name="aio_read" number="255"/>
+  <syscall name="aio_write" number="256"/>
+  <syscall name="lio_listio" number="257"/>
+  <syscall name="getdents" number="272"/>
+  <syscall name="lchmod" number="274"/>
+  <syscall name="netbsd_lchown" number="275"/>
+  <syscall name="lutimes" number="276"/>
+  <syscall name="netbsd_msync" number="277"/>
+  <syscall name="nstat" number="278"/>
+  <syscall name="nfstat" number="279"/>
+  <syscall name="nlstat" number="280"/>
+  <syscall name="preadv" number="289"/>
+  <syscall name="pwritev" number="290"/>
+  <syscall name="fhopen" number="298"/>
+  <syscall name="fhstat" number="299"/>
+  <syscall name="modnext" number="300"/>
+  <syscall name="modstat" number="301"/>
+  <syscall name="modfnext" number="302"/>
+  <syscall name="modfind" number="303"/>
+  <syscall name="kldload" number="304"/>
+  <syscall name="kldunload" number="305"/>
+  <syscall name="kldfind" number="306"/>
+  <syscall name="kldnext" number="307"/>
+  <syscall name="kldstat" number="308"/>
+  <syscall name="kldfirstmod" number="309"/>
+  <syscall name="getsid" number="310"/>
+  <syscall name="setresuid" number="311"/>
+  <syscall name="setresgid" number="312"/>
+  <syscall name="aio_return" number="314"/>
+  <syscall name="aio_suspend" number="315"/>
+  <syscall name="aio_cancel" number="316"/>
+  <syscall name="aio_error" number="317"/>
+  <syscall name="yield" number="321"/>
+  <syscall name="mlockall" number="324"/>
+  <syscall name="munlockall" number="325"/>
+  <syscall name="__getcwd" number="326"/>
+  <syscall name="sched_setparam" number="327"/>
+  <syscall name="sched_getparam" number="328"/>
+  <syscall name="sched_setscheduler" number="329"/>
+  <syscall name="sched_getscheduler" number="330"/>
+  <syscall name="sched_yield" number="331"/>
+  <syscall name="sched_get_priority_max" number="332"/>
+  <syscall name="sched_get_priority_min" number="333"/>
+  <syscall name="sched_rr_get_interval" number="334"/>
+  <syscall name="utrace" number="335"/>
+  <syscall name="kldsym" number="337"/>
+  <syscall name="jail" number="338"/>
+  <syscall name="nnpfs_syscall" number="339"/>
+  <syscall name="sigprocmask" number="340"/>
+  <syscall name="sigsuspend" number="341"/>
+  <syscall name="sigpending" number="343"/>
+  <syscall name="sigtimedwait" number="345"/>
+  <syscall name="sigwaitinfo" number="346"/>
+  <syscall name="__acl_get_file" number="347"/>
+  <syscall name="__acl_set_file" number="348"/>
+  <syscall name="__acl_get_fd" number="349"/>
+  <syscall name="__acl_set_fd" number="350"/>
+  <syscall name="__acl_delete_file" number="351"/>
+  <syscall name="__acl_delete_fd" number="352"/>
+  <syscall name="__acl_aclcheck_file" number="353"/>
+  <syscall name="__acl_aclcheck_fd" number="354"/>
+  <syscall name="extattrctl" number="355"/>
+  <syscall name="extattr_set_file" number="356"/>
+  <syscall name="extattr_get_file" number="357"/>
+  <syscall name="extattr_delete_file" number="358"/>
+  <syscall name="aio_waitcomplete" number="359"/>
+  <syscall name="getresuid" number="360"/>
+  <syscall name="getresgid" number="361"/>
+  <syscall name="kqueue" number="362"/>
+  <syscall name="kevent" number="363"/>
+  <syscall name="extattr_set_fd" number="371"/>
+  <syscall name="extattr_get_fd" number="372"/>
+  <syscall name="extattr_delete_fd" number="373"/>
+  <syscall name="__setugid" number="374"/>
+  <syscall name="eaccess" number="376"/>
+  <syscall name="afs3_syscall" number="377"/>
+  <syscall name="nmount" number="378"/>
+  <syscall name="__mac_get_proc" number="384"/>
+  <syscall name="__mac_set_proc" number="385"/>
+  <syscall name="__mac_get_fd" number="386"/>
+  <syscall name="__mac_get_file" number="387"/>
+  <syscall name="__mac_set_fd" number="388"/>
+  <syscall name="__mac_set_file" number="389"/>
+  <syscall name="kenv" number="390"/>
+  <syscall name="lchflags" number="391"/>
+  <syscall name="uuidgen" number="392"/>
+  <syscall name="sendfile" number="393"/>
+  <syscall name="mac_syscall" number="394"/>
+  <syscall name="getfsstat" number="395"/>
+  <syscall name="statfs" number="396"/>
+  <syscall name="fstatfs" number="397"/>
+  <syscall name="fhstatfs" number="398"/>
+  <syscall name="ksem_close" number="400"/>
+  <syscall name="ksem_post" number="401"/>
+  <syscall name="ksem_wait" number="402"/>
+  <syscall name="ksem_trywait" number="403"/>
+  <syscall name="ksem_init" number="404"/>
+  <syscall name="ksem_open" number="405"/>
+  <syscall name="ksem_unlink" number="406"/>
+  <syscall name="ksem_getvalue" number="407"/>
+  <syscall name="ksem_destroy" number="408"/>
+  <syscall name="__mac_get_pid" number="409"/>
+  <syscall name="__mac_get_link" number="410"/>
+  <syscall name="__mac_set_link" number="411"/>
+  <syscall name="extattr_set_link" number="412"/>
+  <syscall name="extattr_get_link" number="413"/>
+  <syscall name="extattr_delete_link" number="414"/>
+  <syscall name="__mac_execve" number="415"/>
+  <syscall name="sigaction" number="416"/>
+  <syscall name="sigreturn" number="417"/>
+  <syscall name="getcontext" number="421"/>
+  <syscall name="setcontext" number="422"/>
+  <syscall name="swapcontext" number="423"/>
+  <syscall name="swapoff" number="424"/>
+  <syscall name="__acl_get_link" number="425"/>
+  <syscall name="__acl_set_link" number="426"/>
+  <syscall name="__acl_delete_link" number="427"/>
+  <syscall name="__acl_aclcheck_link" number="428"/>
+  <syscall name="sigwait" number="429"/>
+  <syscall name="thr_create" number="430"/>
+  <syscall name="thr_exit" number="431"/>
+  <syscall name="thr_self" number="432"/>
+  <syscall name="thr_kill" number="433"/>
+  <syscall name="jail_attach" number="436"/>
+  <syscall name="extattr_list_fd" number="437"/>
+  <syscall name="extattr_list_file" number="438"/>
+  <syscall name="extattr_list_link" number="439"/>
+  <syscall name="ksem_timedwait" number="441"/>
+  <syscall name="thr_suspend" number="442"/>
+  <syscall name="thr_wake" number="443"/>
+  <syscall name="kldunloadf" number="444"/>
+  <syscall name="audit" number="445"/>
+  <syscall name="auditon" number="446"/>
+  <syscall name="getauid" number="447"/>
+  <syscall name="setauid" number="448"/>
+  <syscall name="getaudit" number="449"/>
+  <syscall name="setaudit" number="450"/>
+  <syscall name="getaudit_addr" number="451"/>
+  <syscall name="setaudit_addr" number="452"/>
+  <syscall name="auditctl" number="453"/>
+  <syscall name="_umtx_op" number="454"/>
+  <syscall name="thr_new" number="455"/>
+  <syscall name="sigqueue" number="456"/>
+  <syscall name="kmq_open" number="457"/>
+  <syscall name="kmq_setattr" number="458"/>
+  <syscall name="kmq_timedreceive" number="459"/>
+  <syscall name="kmq_timedsend" number="460"/>
+  <syscall name="kmq_notify" number="461"/>
+  <syscall name="kmq_unlink" number="462"/>
+  <syscall name="abort2" number="463"/>
+  <syscall name="thr_set_name" number="464"/>
+  <syscall name="aio_fsync" number="465"/>
+  <syscall name="rtprio_thread" number="466"/>
+  <syscall name="sctp_peeloff" number="471"/>
+  <syscall name="sctp_generic_sendmsg" number="472"/>
+  <syscall name="sctp_generic_sendmsg_iov" number="473"/>
+  <syscall name="sctp_generic_recvmsg" number="474"/>
+  <syscall name="pread" number="475"/>
+  <syscall name="pwrite" number="476"/>
+  <syscall name="mmap" number="477"/>
+  <syscall name="lseek" number="478"/>
+  <syscall name="truncate" number="479"/>
+  <syscall name="ftruncate" number="480"/>
+  <syscall name="thr_kill2" number="481"/>
+  <syscall name="shm_open" number="482"/>
+  <syscall name="shm_unlink" number="483"/>
+  <syscall name="cpuset" number="484"/>
+  <syscall name="cpuset_setid" number="485"/>
+  <syscall name="cpuset_getid" number="486"/>
+  <syscall name="cpuset_getaffinity" number="487"/>
+  <syscall name="cpuset_setaffinity" number="488"/>
+  <syscall name="faccessat" number="489"/>
+  <syscall name="fchmodat" number="490"/>
+  <syscall name="fchownat" number="491"/>
+  <syscall name="fexecve" number="492"/>
+  <syscall name="fstatat" number="493"/>
+  <syscall name="futimesat" number="494"/>
+  <syscall name="linkat" number="495"/>
+  <syscall name="mkdirat" number="496"/>
+  <syscall name="mkfifoat" number="497"/>
+  <syscall name="mknodat" number="498"/>
+  <syscall name="openat" number="499"/>
+  <syscall name="readlinkat" number="500"/>
+  <syscall name="renameat" number="501"/>
+  <syscall name="symlinkat" number="502"/>
+  <syscall name="unlinkat" number="503"/>
+  <syscall name="posix_openpt" number="504"/>
+  <syscall name="gssd_syscall" number="505"/>
+  <syscall name="jail_get" number="506"/>
+  <syscall name="jail_set" number="507"/>
+  <syscall name="jail_remove" number="508"/>
+  <syscall name="closefrom" number="509"/>
+  <syscall name="__semctl" number="510"/>
+  <syscall name="msgctl" number="511"/>
+  <syscall name="shmctl" number="512"/>
+  <syscall name="lpathconf" number="513"/>
+  <syscall name="__cap_rights_get" number="515"/>
+  <syscall name="cap_enter" number="516"/>
+  <syscall name="cap_getmode" number="517"/>
+  <syscall name="pdfork" number="518"/>
+  <syscall name="pdkill" number="519"/>
+  <syscall name="pdgetpid" number="520"/>
+  <syscall name="pselect" number="522"/>
+  <syscall name="getloginclass" number="523"/>
+  <syscall name="setloginclass" number="524"/>
+  <syscall name="rctl_get_racct" number="525"/>
+  <syscall name="rctl_get_rules" number="526"/>
+  <syscall name="rctl_get_limits" number="527"/>
+  <syscall name="rctl_add_rule" number="528"/>
+  <syscall name="rctl_remove_rule" number="529"/>
+  <syscall name="posix_fallocate" number="530"/>
+  <syscall name="posix_fadvise" number="531"/>
+  <syscall name="wait6" number="532"/>
+  <syscall name="cap_rights_limit" number="533"/>
+  <syscall name="cap_ioctls_limit" number="534"/>
+  <syscall name="cap_ioctls_get" number="535"/>
+  <syscall name="cap_fcntls_limit" number="536"/>
+  <syscall name="cap_fcntls_get" number="537"/>
+  <syscall name="bindat" number="538"/>
+  <syscall name="connectat" number="539"/>
+  <syscall name="chflagsat" number="540"/>
+  <syscall name="accept4" number="541"/>
+  <syscall name="pipe2" number="542"/>
+  <syscall name="aio_mlock" number="543"/>
+  <syscall name="procctl" number="544"/>
+  <syscall name="ppoll" number="545"/>
+  <syscall name="futimens" number="546"/>
+  <syscall name="utimensat" number="547"/>
+  <syscall name="numa_getaffinity" number="548"/>
+  <syscall name="numa_setaffinity" number="549"/>
+</syscalls_info>