[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

r5853 - in glibc-package/branches/eglibc-2.18/debian: . patches/kfreebsd



Author: aurel32
Date: 2013-12-03 13:28:55 +0000 (Tue, 03 Dec 2013)
New Revision: 5853

Modified:
   glibc-package/branches/eglibc-2.18/debian/changelog
   glibc-package/branches/eglibc-2.18/debian/patches/kfreebsd/local-sysdeps.diff
Log:
kfreebsd/local-sysdeps.diff: update to revision 5214 (from glibc-bsd).



Modified: glibc-package/branches/eglibc-2.18/debian/changelog
===================================================================
--- glibc-package/branches/eglibc-2.18/debian/changelog	2013-12-03 10:22:12 UTC (rev 5852)
+++ glibc-package/branches/eglibc-2.18/debian/changelog	2013-12-03 13:28:55 UTC (rev 5853)
@@ -114,7 +114,7 @@
 
   [ Petr Salinger ]
   * debian/*: change version occurences from 2.17 to 2.18 for upgrades/deps.
-  * kfreebsd/local-sysdeps.diff: update to revision 5173 (from glibc-bsd).
+  * kfreebsd/local-sysdeps.diff: update to revision 5214 (from glibc-bsd).
   * kfreebsd/local-fbtl.diff: likewise
   * sysdeps/kfreebsd.mk: pt_chown is mandatory
   * update symbols file for kfreebsd

Modified: glibc-package/branches/eglibc-2.18/debian/patches/kfreebsd/local-sysdeps.diff
===================================================================
--- glibc-package/branches/eglibc-2.18/debian/patches/kfreebsd/local-sysdeps.diff	2013-12-03 10:22:12 UTC (rev 5852)
+++ glibc-package/branches/eglibc-2.18/debian/patches/kfreebsd/local-sysdeps.diff	2013-12-03 13:28:55 UTC (rev 5853)
@@ -483,7 +483,7 @@
 +#endif /* __A_OUT_GNU_H__ */
 --- /dev/null
 +++ b/ports/sysdeps/unix/bsd/bsd4.4/kfreebsd/access.c
-@@ -0,0 +1,68 @@
+@@ -0,0 +1,67 @@
 +/* Copyright (C) 2009 Free Software Foundation, Inc.
 +   This file is part of the GNU C Library.
 +
@@ -509,7 +509,6 @@
 +#include <string.h>
 +#include <unistd.h>
 +#include <sys/types.h>
-+#include <sys/sysctl.h>
 +#include <sys/user.h>
 +#include <sysdep.h>
 +
@@ -5452,7 +5451,7 @@
 +weak_alias (__clone, clone)
 --- /dev/null
 +++ b/ports/sysdeps/unix/bsd/bsd4.4/kfreebsd/configure
-@@ -0,0 +1,432 @@
+@@ -0,0 +1,423 @@
 +# This file is generated from configure.in by Autoconf.  DO NOT EDIT!
 + # Local configure fragment for sysdeps/unix/bsd/bsd4.4/kfreebsd.
 +
@@ -5783,38 +5782,29 @@
 +libc_cv_gcc_unwind_find_fde=no
 +
 +
-+# Under kFreeBSD the LinuxThreads or (may be later) FBTL add-on should be available.
++# Under kFreeBSD the FBTL add-on should be available.
 +case $add_ons in
-+  # Only one of the add-ons should be available.
-+  *linuxthreads*fbtl*|*fbtl*linuxthreads*)
-+    echo "\
-+*** LinuxThreads and FBTL add-ons are both available.  Only one must be used."
-+    exit 1
-+    ;;
 +  # It is available.  Good.
-+  *linuxthreads*)
-+    linuxthreads_missing=
-+    ;;
 +  *fbtl*)
-+    linuxthreads_missing=
++    fbtl_missing=
 +    ;;
 +  *)
-+    linuxthreads_missing=yes
++    fbtl_missing=yes
 +    ;;
 +esac
 +
-+if test "$linuxthreads_missing"; then
++if test "$fbtl_missing"; then
 +  if test $enable_sanity = yes; then
 +    echo "\
 +*** On GNU/kFreeBSD systems it is normal to compile GNU libc with the
-+*** \`linuxthreads' add-on.  Without that, the library will be
++*** \`fbtl' add-on.  Without that, the library will be
 +*** incompatible with normal GNU/kFreeBSD systems.
 +*** If you really mean to not use this add-on, run configure again
 +*** using the extra parameter \`--disable-sanity-checks'."
 +    exit 1
 +  else
 +    echo "\
-+*** WARNING: Are you sure you do not want to use the \`linuxthreads'
++*** WARNING: Are you sure you do not want to use the \`fbtl'
 +*** add-on?"
 +  fi
 +fi
@@ -5887,7 +5877,7 @@
 +
 --- /dev/null
 +++ b/ports/sysdeps/unix/bsd/bsd4.4/kfreebsd/configure.in
-@@ -0,0 +1,267 @@
+@@ -0,0 +1,258 @@
 +GLIBC_PROVIDES dnl See aclocal.m4 in the top level source directory.
 +# Local configure fragment for sysdeps/unix/bsd/bsd4.4/kfreebsd.
 +
@@ -6056,38 +6046,29 @@
 +libc_cv_gcc_unwind_find_fde=no
 +
 +
-+# Under kFreeBSD the LinuxThreads or (may be later) FBTL add-on should be available.
++# Under kFreeBSD the FBTL add-on should be available.
 +case $add_ons in
-+  # Only one of the add-ons should be available.
-+  *linuxthreads*fbtl*|*fbtl*linuxthreads*)
-+    echo "\
-+*** LinuxThreads and FBTL add-ons are both available.  Only one must be used."
-+    exit 1
-+    ;;
 +  # It is available.  Good.
-+  *linuxthreads*)
-+    linuxthreads_missing=
-+    ;;
 +  *fbtl*)
-+    linuxthreads_missing=
++    fbtl_missing=
 +    ;;
 +  *)
-+    linuxthreads_missing=yes
++    fbtl_missing=yes
 +    ;;
 +esac
 +
-+if test "$linuxthreads_missing"; then
++if test "$fbtl_missing"; then
 +  if test $enable_sanity = yes; then
 +    echo "\
 +*** On GNU/kFreeBSD systems it is normal to compile GNU libc with the
-+*** \`linuxthreads' add-on.  Without that, the library will be
++*** \`fbtl' add-on.  Without that, the library will be
 +*** incompatible with normal GNU/kFreeBSD systems.
 +*** If you really mean to not use this add-on, run configure again
 +*** using the extra parameter \`--disable-sanity-checks'."
 +    exit 1
 +  else
 +    echo "\
-+*** WARNING: Are you sure you do not want to use the \`linuxthreads'
++*** WARNING: Are you sure you do not want to use the \`fbtl'
 +*** add-on?"
 +  fi
 +fi
@@ -7124,7 +7105,7 @@
 +#include <sysdeps/unix/sysv/linux/execve.c>
 --- /dev/null
 +++ b/ports/sysdeps/unix/bsd/bsd4.4/kfreebsd/faccessat.c
-@@ -0,0 +1,69 @@
+@@ -0,0 +1,68 @@
 +/* Test for access to file, relative to open directory.  Linux version.
 +   Copyright (C) 2006 Free Software Foundation, Inc.
 +   This file is part of the GNU C Library.
@@ -7151,7 +7132,6 @@
 +#include <string.h>
 +#include <unistd.h>
 +#include <sys/types.h>
-+#include <sys/sysctl.h>
 +#include <sys/user.h>
 +#include <kernel-features.h>
 +#include <sysdep.h>
@@ -12573,7 +12553,7 @@
 +/* 'ftruncate64' is the same as 'ftruncate', because __off64_t == __off_t.  */
 --- /dev/null
 +++ b/ports/sysdeps/unix/bsd/bsd4.4/kfreebsd/futimesat.c
-@@ -0,0 +1,48 @@
+@@ -0,0 +1,47 @@
 +/* Copyright (C) 2009 Free Software Foundation, Inc.
 +   This file is part of the GNU C Library.
 +
@@ -12601,7 +12581,6 @@
 +#include <string.h>
 +#include <sysdep.h>
 +#include <sys/time.h>
-+#include <sys/sysctl.h>
 +#include <sys/user.h>
 +#include <kernel-features.h>
 +
@@ -12720,7 +12699,7 @@
 +hidden_def (__fxstat64)
 --- /dev/null
 +++ b/ports/sysdeps/unix/bsd/bsd4.4/kfreebsd/fxstatat.c
-@@ -0,0 +1,67 @@
+@@ -0,0 +1,66 @@
 +/* Copyright (C) 2009 Free Software Foundation, Inc.
 +   This file is part of the GNU C Library.
 +
@@ -12748,7 +12727,6 @@
 +#include <string.h>
 +#include <sysdep.h>
 +#include <sys/stat.h>
-+#include <sys/sysctl.h>
 +#include <sys/user.h>
 +#include <kernel-features.h>
 +
@@ -12790,7 +12768,7 @@
 +libc_hidden_def (__fxstatat)
 --- /dev/null
 +++ b/ports/sysdeps/unix/bsd/bsd4.4/kfreebsd/fxstatat64.c
-@@ -0,0 +1,61 @@
+@@ -0,0 +1,60 @@
 +/* Copyright (C) 2009 Free Software Foundation, Inc.
 +   This file is part of the GNU C Library.
 +
@@ -12818,7 +12796,6 @@
 +#include <string.h>
 +#include <sysdep.h>
 +#include <sys/stat.h>
-+#include <sys/sysctl.h>
 +#include <sys/user.h>
 +#include <kernel-features.h>
 +
@@ -14242,14 +14219,10 @@
 +unix/bsd/bsd4.4/kfreebsd/x86
 --- /dev/null
 +++ b/ports/sysdeps/unix/bsd/bsd4.4/kfreebsd/i386/Makefile
-@@ -0,0 +1,31 @@
+@@ -0,0 +1,27 @@
 +# The default ABI is 32.
 +default-abi := 32
 +
-+ifeq ($(subdir),linuxthreads)
-+CFLAGS-pt-initfini.s += -fno-asynchronous-unwind-tables
-+endif
-+
 +# Additional header files to be installed in $prefix/include:
 +
 +ifeq ($(subdir),misc)
@@ -15369,393 +15342,6 @@
 +  { "libc.so.8", FLAG_ELF_LIBC5 },				\
 +  { "libm.so.8", FLAG_ELF_LIBC5 },
 --- /dev/null
-+++ b/ports/sysdeps/unix/bsd/bsd4.4/kfreebsd/i386/linuxthreads/pt-machine.h
-@@ -0,0 +1,79 @@
-+/* Machine-dependent pthreads configuration and inline functions.
-+   ix86 version for FreeBSD.
-+   Copyright (C) 1996-2001, 2002 Free Software Foundation, Inc.
-+   This file is part of the GNU C Library.
-+   Contributed by Petr Salinger, 2005.
-+
-+   The GNU C Library is free software; you can redistribute it and/or
-+   modify it under the terms of the GNU Lesser General Public License as
-+   published by the Free Software Foundation; either version 2.1 of the
-+   License, or (at your option) any later version.
-+
-+   The GNU C Library is distributed in the hope that it will be useful,
-+   but WITHOUT ANY WARRANTY; without even the implied warranty of
-+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-+   Lesser General Public License for more details.
-+
-+   You should have received a copy of the GNU Lesser General Public
-+   License along with the GNU C Library; see the file COPYING.LIB.  If not,
-+   write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
-+   Boston, MA 02111-1307, USA.  */
-+
-+#ifndef _FREEBSD_PT_MACHINE_H
-+#define _FREEBSD_PT_MACHINE_H   1
-+
-+#define HAVE___THREAD 1
-+#define USE_TLS 1
-+
-+/*
-+  some parts are common with linux/i386 version
-+
-+  linux specific parts should be in
-+  linuxthreads/sysdeps/unix/sysv/linux/i386/
-+  but they are included directly in
-+  linuxthreads/sysdeps/i386/
-+
-+  so include them
-+
-+ */
-+
-+#include <linuxthreads/sysdeps/i386/pt-machine.h>
-+#include <linuxthreads/sysdeps/i386/useldt.h>
-+
-+/* hack them */
-+
-+#ifndef __ASSEMBLER__
-+
-+#undef INIT_THREAD_SELF
-+#undef FREE_THREAD
-+
-+/* The P4 and above really want some help to prevent overheating.  */
-+#define BUSY_WAIT_NOP   __asm__ ("rep; nop")
-+
-+/* and add few FreeBSD specifics */
-+
-+#include <sysarch.h>
-+
-+/* Initialize the thread-unique value. */
-+
-+#define INIT_THREAD_SELF(descr, nr)		\
-+{						\
-+  long tmp;					\
-+  tmp = (long) descr;				\
-+  if (sysarch(I386_SET_GSBASE, &tmp)  != 0)	\
-+  {						\
-+    abort();					\
-+  }						\
-+}
-+
-+#define FREE_THREAD(descr, nr) do { } while (0)
-+
-+#endif /* __ASSEMBLER__ */
-+
-+/* We want the OS to assign stack addresses.  */
-+#define FLOATING_STACKS 1
-+
-+/* Maximum size of the stack if the rlimit is unlimited.  */
-+#define ARCH_STACK_MAX_SIZE     8*1024*1024
-+
-+#endif /* _FREEBSD_PT_MACHINE_H  */
---- /dev/null
-+++ b/ports/sysdeps/unix/bsd/bsd4.4/kfreebsd/i386/linuxthreads/sysdep-cancel.h
-@@ -0,0 +1,147 @@
-+/* Copyright (C) 2002, 2003, 2004 Free Software Foundation, Inc.
-+   This file is part of the GNU C Library.
-+   Contributed by Jakub Jelinek <jakub@redhat.com>, 2002.
-+   Modification for FreeBSD by Petr Salinger, 2005.
-+
-+   The GNU C Library is free software; you can redistribute it and/or
-+   modify it under the terms of the GNU Lesser General Public
-+   License as published by the Free Software Foundation; either
-+   version 2.1 of the License, or (at your option) any later version.
-+
-+   The GNU C Library is distributed in the hope that it will be useful,
-+   but WITHOUT ANY WARRANTY; without even the implied warranty of
-+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-+   Lesser General Public License for more details.
-+
-+   You should have received a copy of the GNU Lesser General Public
-+   License along with the GNU C Library; if not, write to the Free
-+   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-+   02111-1307 USA.  */
-+
-+#include <sysdep.h>
-+#include <tls.h>
-+#include <pt-machine.h>
-+#ifndef __ASSEMBLER__
-+# include <linuxthreads/internals.h>
-+#endif
-+
-+#if !defined NOT_IN_libc || defined IS_IN_libpthread || defined IS_IN_librt
-+
-+# undef PSEUDO
-+# define PSEUDO(name, syscall_name, args)				      \
-+  .text;								      \
-+  ENTRY (name)								      \
-+    SINGLE_THREAD_P;							      \
-+    jne L(pseudo_cancel);						      \
-+    DO_CALL (syscall_name, args);					      \
-+    jb SYSCALL_ERROR_LABEL;						      \
-+    ret;								      \
-+  L(pseudo_cancel):							      \
-+    CENABLE								      \
-+    movl %eax, %ecx;							      \
-+    movl $SYS_ify (syscall_name), %eax;					      \
-+    int $0x80;								      \
-+    PUSHRESULT;							      	      \
-+    movl %ecx, %eax; 							      \
-+    CDISABLE;							 	      \
-+    POPRESULT;							      	      \
-+    jb SYSCALL_ERROR_LABEL;						      \
-+  L(pseudo_end):
-+
-+/*
-+  on FreeBSD some syscalls return result in pair edx+eax,
-+  therefore proper way would be
-+
-+# define PUSHRESULT	pushl %edx; pushl %eax; pushfl
-+# define POPRESULT	popfl; popl %eax; popl %edx
-+
-+  for FreeBSD 5.4 affected syscalls are
-+
-+	lseek()
-+	fork()
-+	vfork()
-+	rfork()
-+	pipe()
-+
-+   none of them is cancelable, therefore
-+*/
-+
-+# define PUSHRESULT	pushl %eax; cfi_adjust_cfa_offset (4);  pushfl;    cfi_adjust_cfa_offset (4)
-+# define POPRESULT	popfl;      cfi_adjust_cfa_offset (-4); popl %eax; cfi_adjust_cfa_offset (-4)
-+
-+# ifdef IS_IN_libpthread
-+#  define CENABLE	call __pthread_enable_asynccancel;
-+#  define CDISABLE	call __pthread_disable_asynccancel
-+# elif defined IS_IN_librt
-+#  ifdef PIC
-+#   define CENABLE	pushl %ebx; \
-+			cfi_adjust_cfa_offset (4); \
-+			cfi_rel_offset (ebx, 0); \
-+			call __i686.get_pc_thunk.bx; \
-+			addl     $_GLOBAL_OFFSET_TABLE_, %ebx; \
-+			call __librt_enable_asynccancel@PLT; \
-+			popl %ebx; \
-+			cfi_adjust_cfa_offset (-4); \
-+			cfi_restore (ebx);
-+#   define CDISABLE	pushl %ebx; \
-+			cfi_adjust_cfa_offset (4); \
-+			cfi_rel_offset (ebx, 0); \
-+			call __i686.get_pc_thunk.bx; \
-+			addl     $_GLOBAL_OFFSET_TABLE_, %ebx; \
-+			call __librt_disable_asynccancel@PLT; \
-+			popl %ebx; \
-+			cfi_adjust_cfa_offset (-4); \
-+			cfi_restore (ebx);
-+#  else
-+#   define CENABLE	call __librt_enable_asynccancel;
-+#   define CDISABLE	call __librt_disable_asynccancel
-+#  endif
-+# else
-+#  define CENABLE	call __libc_enable_asynccancel;
-+#  define CDISABLE	call __libc_disable_asynccancel
-+# endif
-+
-+#if !defined NOT_IN_libc
-+# define __local_multiple_threads __libc_multiple_threads
-+#elif defined IS_IN_libpthread
-+# define __local_multiple_threads __pthread_multiple_threads
-+#else
-+# define __local_multiple_threads __librt_multiple_threads
-+#endif
-+
-+# ifndef __ASSEMBLER__
-+#  if defined PIC
-+#   define SINGLE_THREAD_P \
-+  __builtin_expect (THREAD_GETMEM (THREAD_SELF,				      \
-+				   p_header.data.multiple_threads) == 0, 1)
-+#  else
-+extern int __local_multiple_threads
-+#   if !defined NOT_IN_libc || defined IS_IN_libpthread
-+  attribute_hidden;
-+#   else
-+  ;
-+#   endif
-+#   define SINGLE_THREAD_P __builtin_expect (__local_multiple_threads == 0, 1)
-+#  endif
-+# else
-+#  if !defined PIC
-+#   define SINGLE_THREAD_P cmpl $0, __local_multiple_threads
-+#  else
-+#   define SINGLE_THREAD_P cmpl $0, %gs:MULTIPLE_THREADS_OFFSET
-+#  endif
-+# endif
-+
-+#elif !defined __ASSEMBLER__
-+
-+/* This code should never be used but we define it anyhow.  */
-+# define SINGLE_THREAD_P (1)
-+# define NO_CANCELLATION 1
-+
-+#endif
-+
-+#ifndef __ASSEMBLER__
-+# define RTLD_SINGLE_THREAD_P \
-+  __builtin_expect (THREAD_GETMEM (THREAD_SELF, \
-+                                     p_header.data.multiple_threads) == 0, 1)
-+#endif
-+
---- /dev/null
-+++ b/ports/sysdeps/unix/bsd/bsd4.4/kfreebsd/i386/linuxthreads/tls.h
-@@ -0,0 +1,80 @@
-+/* Definition for thread-local data handling.  linuxthreads/i386 version.
-+   Copyright (C) 2002, 2003, 2004 Free Software Foundation, Inc.
-+   This file is part of the GNU C Library.
-+   Modification for FreeBSD by Petr Salinger, 2005.
-+
-+   The GNU C Library is free software; you can redistribute it and/or
-+   modify it under the terms of the GNU Lesser General Public
-+   License as published by the Free Software Foundation; either
-+   version 2.1 of the License, or (at your option) any later version.
-+
-+   The GNU C Library is distributed in the hope that it will be useful,
-+   but WITHOUT ANY WARRANTY; without even the implied warranty of
-+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-+   Lesser General Public License for more details.
-+
-+   You should have received a copy of the GNU Lesser General Public
-+   License along with the GNU C Library; if not, write to the Free
-+   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-+   02111-1307 USA.  */
-+
-+#ifndef _FREEBSD_TLS_H
-+#define _FREEBSD_TLS_H
-+
-+#include <linuxthreads/sysdeps/i386/tls.h>
-+
-+# ifndef __ASSEMBLER__
-+
-+#undef TLS_INIT_TP
-+#undef TLS_SETUP_GS_SEGMENT
-+
-+#include <sysarch.h>
-+#include <sys/syscall.h>
-+
-+
-+/* Code to initially initialize the thread pointer.  This might need
-+   special attention since 'errno' is not yet available and if the
-+   operation can cause a failure 'errno' must not be touched. */
-+
-+#  define TLS_DO_SET_GSBASE(descr)		\
-+({                                      	\
-+  long base = (long) descr;             	\
-+  int result;                           	\
-+  asm volatile (                        	\
-+                "pushl %3\n\t"          	\
-+                "pushl %2\n\t"          	\
-+                "pushl %1\n\t"       		\
-+                "int $0x80\n\t"         	\
-+                "popl %3\n\t"        		\
-+                "popl %3\n\t"        		\
-+                "popl %3\n\t"        		\
-+                : "=a" (result)         	\
-+                : "0" (SYS_sysarch),     	\
-+                  "i" (I386_SET_GSBASE),       	\
-+                  "d" (&base)			\
-+                : "memory", "cc" );    		\
-+  result;                                       \
-+})
-+
-+#   define TLS_SETUP_GS_SEGMENT(descr, secondcall)                            \
-+  (TLS_DO_SET_GSBASE(descr)                                                   \
-+   ? "set_thread_area failed when setting up thread-local storage\n" : NULL)
-+
-+/*   The value of this macro is null if successful, or an error string.  */
-+
-+#  define TLS_INIT_TP(descr, secondcall)				      \
-+  ({									      \
-+    void *_descr = (descr);						      \
-+    tcbhead_t *head = _descr;						      \
-+									      \
-+    head->tcb = _descr;							      \
-+    /* For now the thread descriptor is at the same address.  */	      \
-+    head->self = _descr;						      \
-+									      \
-+    INIT_SYSINFO;							      \
-+    TLS_SETUP_GS_SEGMENT (_descr, secondcall);				      \
-+  })
-+
-+# endif /* __ASSEMBLER__ */
-+
-+#endif	/* _FREEBSD_TLS_H */
---- /dev/null
-+++ b/ports/sysdeps/unix/bsd/bsd4.4/kfreebsd/i386/linuxthreads/vfork.S
-@@ -0,0 +1,69 @@
-+/* Copyright (C) 1999, 2002 Free Software Foundation, Inc.
-+   This file is part of the GNU C Library.
-+
-+   The GNU C Library is free software; you can redistribute it and/or
-+   modify it under the terms of the GNU Lesser General Public
-+   License as published by the Free Software Foundation; either
-+   version 2.1 of the License, or (at your option) any later version.
-+
-+   The GNU C Library is distributed in the hope that it will be useful,
-+   but WITHOUT ANY WARRANTY; without even the implied warranty of
-+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-+   Lesser General Public License for more details.
-+
-+   You should have received a copy of the GNU Lesser General Public
-+   License along with the GNU C Library; if not, write to the Free
-+   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-+   02111-1307 USA.  */
-+
-+#include <sysdep.h>
-+
-+/* Clone the calling process, but without copying the whole address space.
-+   The calling process is suspended until the new process exits or is
-+   replaced by a call to `execve'.  Return -1 for errors, 0 to the new process,
-+   and the process ID of the new process to the old process.  */
-+
-+ENTRY (__vfork)
-+
-+# ifdef SHARED
-+	call	GET_PC_THUNK(cx)
-+	addl	$_GLOBAL_OFFSET_TABLE_, %ecx
-+	cmpl	$0, __libc_pthread_functions@GOTOFF(%ecx)
-+# else
-+	.weak	pthread_create
-+	movl	$pthread_create, %eax
-+	testl	%eax, %eax
-+# endif
-+	jne	HIDDEN_JUMPTARGET (__fork)
-+
-+	/* Pop the return PC value into ECX.  */
-+	popl	%ecx
-+	cfi_adjust_cfa_offset(-4)
-+
-+	/* Perform the system call.  */
-+	DO_CALL (vfork, 0)
-+	jb	L(error)	/* Branch forward if it failed.  */
-+
-+	/* In the parent process, %edx == 0, %eax == child pid.  */
-+	/* In the child process, %edx == 1, %eax == parent pid.  */
-+
-+	/* Change %eax to be 0 in the child process.  */
-+	decl	%edx
-+	andl	%edx, %eax
-+
-+	/* Jump to the return PC.  */
-+	jmp	*%ecx
-+
-+L(error):
-+	/* Push back the return PC.  */
-+	pushl	%ecx
-+	cfi_adjust_cfa_offset(4)
-+
-+	/* Branch to the error handler, hidden in PSEUDO_END.  */
-+	jmp	SYSCALL_ERROR_LABEL
-+L(pseudo_end):
-+	ret
-+PSEUDO_END (__vfork)
-+libc_hidden_def (__vfork)
-+
-+weak_alias (__vfork, vfork)
---- /dev/null
 +++ b/ports/sysdeps/unix/bsd/bsd4.4/kfreebsd/i386/lseek.S
 @@ -0,0 +1,53 @@
 +/* Copyright (C) 2002 Free Software Foundation, Inc.
@@ -18593,1361 +18179,6 @@
 +
 +#endif /* ldsodefs.h */
 --- /dev/null
-+++ b/ports/sysdeps/unix/bsd/bsd4.4/kfreebsd/linuxthreads/Implies
-@@ -0,0 +1 @@
-+pthread
---- /dev/null
-+++ b/ports/sysdeps/unix/bsd/bsd4.4/kfreebsd/linuxthreads/Makefile
-@@ -0,0 +1,8 @@
-+ifeq ($(subdir),linuxthreads)
-+sysdep_routines += register-atfork unregister-atfork
-+libpthread-routines += ptw-sigprocmask ptw-ioctl
-+endif
-+
-+ifeq ($(subdir),rt)
-+librt-sysdep_routines += timer_routines
-+endif
---- /dev/null
-+++ b/ports/sysdeps/unix/bsd/bsd4.4/kfreebsd/linuxthreads/Versions
-@@ -0,0 +1,5 @@
-+libc {
-+  GLIBC_2.3.2 {
-+    __register_atfork;
-+  }
-+}
---- /dev/null
-+++ b/ports/sysdeps/unix/bsd/bsd4.4/kfreebsd/linuxthreads/allocrtsig.c
-@@ -0,0 +1 @@
-+#include <linuxthreads/sysdeps/unix/sysv/linux/allocrtsig.c>
---- /dev/null
-+++ b/ports/sysdeps/unix/bsd/bsd4.4/kfreebsd/linuxthreads/bits/local_lim.h
-@@ -0,0 +1,48 @@
-+/* Minimum guaranteed maximum values for system limits.  FreeBSD version.
-+   Copyright (C) 1993-1998, 2000, 2002 Free Software Foundation, Inc.
-+   This file is part of the GNU C Library.
-+
-+   The GNU C Library is free software; you can redistribute it and/or
-+   modify it under the terms of the GNU Lesser General Public
-+   License as published by the Free Software Foundation; either
-+   version 2.1 of the License, or (at your option) any later version.
-+
-+   The GNU C Library is distributed in the hope that it will be useful,
-+   but WITHOUT ANY WARRANTY; without even the implied warranty of
-+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-+   Lesser General Public License for more details.
-+
-+   You should have received a copy of the GNU Lesser General Public
-+   License along with the GNU C Library; if not, write to the Free
-+   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-+   02111-1307 USA.  */
-+
-+#include <sys/syslimits.h>
-+
-+/* The number of data keys per process.  */
-+#define _POSIX_THREAD_KEYS_MAX	128
-+/* This is the value this implementation supports.  */
-+#define PTHREAD_KEYS_MAX	1024
-+
-+/* Controlling the iterations of destructors for thread-specific data.  */
-+#define _POSIX_THREAD_DESTRUCTOR_ITERATIONS	4
-+/* Number of iterations this implementation does.  */
-+#define PTHREAD_DESTRUCTOR_ITERATIONS	_POSIX_THREAD_DESTRUCTOR_ITERATIONS
-+
-+/* The number of threads per process.  */
-+#define _POSIX_THREAD_THREADS_MAX	64
-+/* This is the value this implementation supports.  */
-+#define PTHREAD_THREADS_MAX	1024
-+
-+/* Maximum amount by which a process can descrease its asynchronous I/O
-+   priority level.  */
-+#define AIO_PRIO_DELTA_MAX	20
-+
-+/* Minimum size for a thread.  We are free to choose a reasonable value.  */
-+#define PTHREAD_STACK_MIN	16384
-+
-+/* Maximum number of POSIX timers available.  */
-+#define TIMER_MAX	256
-+
-+/* Maximum number of timer expiration overruns.  */
-+#define DELAYTIMER_MAX	2147483647
---- /dev/null
-+++ b/ports/sysdeps/unix/bsd/bsd4.4/kfreebsd/linuxthreads/bits/posix_opt.h
-@@ -0,0 +1,192 @@
-+/* Define POSIX options for FreeBSD.
-+   Copyright (C) 1996-1997, 1999, 2000, 2002 Free Software Foundation, Inc.
-+   This file is part of the GNU C Library.
-+
-+   The GNU C Library is free software; you can redistribute it and/or
-+   modify it under the terms of the GNU Lesser General Public
-+   License as published by the Free Software Foundation; either
-+   version 2.1 of the License, or (at your option) any later version.
-+
-+   The GNU C Library is distributed in the hope that it will be useful,
-+   but WITHOUT ANY WARRANTY; without even the implied warranty of
-+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-+   Lesser General Public License for more details.
-+
-+   You should have received a copy of the GNU Lesser General Public
-+   License along with the GNU C Library; if not, write to the Free
-+   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-+   02111-1307 USA.  */
-+
-+/*
-+ * Never include this file directly; use <unistd.h> instead.
-+ */
-+
-+#ifndef	_BITS_POSIX_OPT_H
-+#define	_BITS_POSIX_OPT_H	1
-+
-+#include <bits/os-unistd.h> 
-+
-+/* Job control is supported.  */
-+#define	_POSIX_JOB_CONTROL	1
-+
-+/* Processes have a saved set-user-ID and a saved set-group-ID.  */
-+#define	_POSIX_SAVED_IDS	1
-+
-+/* Priority scheduling is supported.  */
-+#define	_POSIX_PRIORITY_SCHEDULING	200809L
-+
-+/* Synchronizing file data is supported.  */
-+#define	_POSIX_SYNCHRONIZED_IO	200809L
-+
-+/* The fsync function is present.  */
-+#define	_POSIX_FSYNC	200809L
-+
-+/* Mapping of files to memory is supported.  */
-+#define	_POSIX_MAPPED_FILES	200809L
-+
-+/* Locking of all memory is supported.  */
-+#define	_POSIX_MEMLOCK	200809L
-+
-+/* Locking of ranges of memory is supported.  */
-+#define	_POSIX_MEMLOCK_RANGE	200809L
-+
-+/* Setting of memory protections is supported.  */
-+#define	_POSIX_MEMORY_PROTECTION	200809L
-+
-+/* Only root can change owner of file.  */
-+#define	_POSIX_CHOWN_RESTRICTED	1
-+
-+/* `c_cc' member of 'struct termios' structure can be disabled by
-+   using the value _POSIX_VDISABLE.  */
-+#define	_POSIX_VDISABLE	((unsigned char)'\377')
-+
-+/* Filenames are not silently truncated.  */
-+#define	_POSIX_NO_TRUNC	1
-+/* X/Open realtime support is only partially available.  */
-+#define _XOPEN_REALTIME	-1
-+
-+/* X/Open realtime thread support is only partially available.  */
-+#define _XOPEN_REALTIME_THREADS	-1
-+
-+/* Implementation supports `poll' function.  */
-+#define	_POSIX_POLL	1
-+
-+/* Implementation supports `select' and `pselect' functions.  */
-+#define	_POSIX_SELECT	1
-+
-+/* XPG4.2 shared memory is supported.  */
-+#define	_XOPEN_SHM	1
-+
-+/* Tell we have POSIX threads.  */
-+#define _POSIX_THREADS	200809L
-+
-+/* We have the reentrant functions described in POSIX.  */
-+#define _POSIX_REENTRANT_FUNCTIONS	1
-+#define _POSIX_THREAD_SAFE_FUNCTIONS	200809L
-+
-+/* We provide priority scheduling for threads.  */
-+#define _POSIX_THREAD_PRIORITY_SCHEDULING	200809L
-+
-+/* We support user-defined stack sizes.  */
-+#define _POSIX_THREAD_ATTR_STACKSIZE	200809L
-+
-+/* We support user-defined stacks.  */
-+#define _POSIX_THREAD_ATTR_STACKADDR	200809L
-+
-+/* We support POSIX.1b semaphores, but only the non-shared form for now.  */
-+#define _POSIX_SEMAPHORES	200809L
-+
-+/* Real-time signals are not available.  */
-+#define _POSIX_REALTIME_SIGNALS	-1
-+
-+/* We support asynchronous I/O.  */
-+#define _POSIX_ASYNCHRONOUS_IO	200809L
-+#define _POSIX_ASYNC_IO		1
-+/* Alternative name for Unix98.  */
-+#define _LFS_ASYNCHRONOUS_IO	1
-+/* Support for prioritization is not available.  */
-+#define _POSIX_PRIORITIZED_IO	-1
-+
-+/* The LFS support in asynchronous I/O is also available.  */
-+#define _LFS64_ASYNCHRONOUS_IO	1
-+
-+/* The rest of the LFS is also available.  */
-+#define _LFS_LARGEFILE		1
-+#define _LFS64_LARGEFILE	1
-+#define _LFS64_STDIO		1
-+
-+/* POSIX shared memory objects are implemented.  */
-+#define _POSIX_SHARED_MEMORY_OBJECTS	200809L
-+
-+/* CPU-time clocks somewhere supported.  */
-+#define _POSIX_CPUTIME	0
-+
-+/* We support somewhere the clock also in threads.  */
-+#define _POSIX_THREAD_CPUTIME	0
-+
-+/* GNU libc provides regular expression handling.  */
-+#define _POSIX_REGEXP	1
-+
-+/* Reader/Writer locks are available.  */
-+#define _POSIX_READER_WRITER_LOCKS	200809L
-+
-+/* We have a POSIX shell.  */
-+#define _POSIX_SHELL	1
-+
-+/* We support the Timeouts option.  */
-+#define _POSIX_TIMEOUTS	200809L
-+
-+/* We support spinlocks.  */
-+#define _POSIX_SPIN_LOCKS	200809L
-+
-+/* The `spawn' function family is supported.  */
-+#define _POSIX_SPAWN	200809L
-+
-+/* We have POSIX timers.  */
-+#define _POSIX_TIMERS	200809L
-+
-+/* The barrier functions are available.  */
-+#define _POSIX_BARRIERS	200809L
-+
-+/* POSIX message queues are not available.  */
-+#define _POSIX_MESSAGE_PASSING	-1
-+
-+/* Thread process-shared synchronization is not supported.  */
-+#define _POSIX_THREAD_PROCESS_SHARED	-1
-+
-+/* The monotonic clock is available.  */
-+#define _POSIX_MONOTONIC_CLOCK	200809L
-+
-+/* The clock selection interfaces are not available.  */
-+#define _POSIX_CLOCK_SELECTION	-1
-+
-+/* Advisory information interfaces are not available.  */
-+#define _POSIX_ADVISORY_INFO	-1
-+
-+/* IPv6 support is available.  */
-+#define _POSIX_IPV6	200809L
-+
-+/* Raw socket support is available.  */
-+#define _POSIX_RAW_SOCKETS	200809L
-+
-+/* We have at least one terminal.  */
-+#define _POSIX2_CHAR_TERM	200809L
-+
-+/* Neither process nor thread sporadic server interfaces is available.  */
-+#define _POSIX_SPORADIC_SERVER	-1
-+#define _POSIX_THREAD_SPORADIC_SERVER	-1
-+
-+/* trace.h is not available.  */
-+#define _POSIX_TRACE	-1
-+#define _POSIX_TRACE_EVENT_FILTER	-1
-+#define _POSIX_TRACE_INHERIT	-1
-+#define _POSIX_TRACE_LOG	-1
-+
-+/* Typed memory objects are not available.  */
-+#define _POSIX_TYPED_MEMORY_OBJECTS	-1
-+
-+/* No support for priority inheritance or protection.  */
-+#define _POSIX_THREAD_PRIO_INHERIT	-1
-+#define _POSIX_THREAD_PRIO_PROTECT	-1
-+
-+#endif /* bits/posix_opt.h */
---- /dev/null
-+++ b/ports/sysdeps/unix/bsd/bsd4.4/kfreebsd/linuxthreads/bits/sigthread.h
-@@ -0,0 +1,38 @@
-+/* Signal handling function for threaded programs.
-+   Copyright (C) 1998, 1999, 2000, 2002 Free Software Foundation, Inc.
-+   This file is part of the GNU C Library.
-+
-+   The GNU C Library is free software; you can redistribute it and/or
-+   modify it under the terms of the GNU Lesser General Public
-+   License as published by the Free Software Foundation; either
-+   version 2.1 of the License, or (at your option) any later version.
-+
-+   The GNU C Library is distributed in the hope that it will be useful,
-+   but WITHOUT ANY WARRANTY; without even the implied warranty of
-+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-+   Lesser General Public License for more details.
-+
-+   You should have received a copy of the GNU Lesser General Public
-+   License along with the GNU C Library; if not, write to the Free
-+   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-+   02111-1307 USA.  */
-+
-+#ifndef _BITS_SIGTHREAD_H
-+#define _BITS_SIGTHREAD_H	1
-+
-+#if !defined _SIGNAL_H && !defined _PTHREAD_H
-+# error "Never include this file directly.  Use <pthread.h> instead"
-+#endif
-+
-+/* Functions for handling signals. */
-+
-+/* Modify the signal mask for the calling thread.  The arguments have
-+   the same meaning as for sigprocmask(2). */
-+extern int pthread_sigmask (int __how,
-+			    __const __sigset_t *__restrict __newmask,
-+			    __sigset_t *__restrict __oldmask) __THROW;
-+
-+/* Send signal SIGNO to the given thread. */
-+extern int pthread_kill (pthread_t __threadid, int __signo) __THROW;
-+
-+#endif	/* bits/sigthread.h */
---- /dev/null
-+++ b/ports/sysdeps/unix/bsd/bsd4.4/kfreebsd/linuxthreads/bits/typesizes.h
-@@ -0,0 +1,91 @@
-+/* bits/typesizes.h -- underlying types for *_t.  kFreeBSD version.
-+   Copyright (C) 2002, 2003, 2010 Free Software Foundation, Inc.
-+   This file is part of the GNU C Library.
-+
-+   The GNU C Library is free software; you can redistribute it and/or
-+   modify it under the terms of the GNU Lesser General Public
-+   License as published by the Free Software Foundation; either
-+   version 2.1 of the License, or (at your option) any later version.
-+
-+   The GNU C Library is distributed in the hope that it will be useful,
-+   but WITHOUT ANY WARRANTY; without even the implied warranty of
-+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-+   Lesser General Public License for more details.
-+
-+   You should have received a copy of the GNU Lesser General Public
-+   License along with the GNU C Library; if not, write to the Free
-+   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-+   02111-1307 USA.  */
-+
-+#ifndef _BITS_TYPES_H
-+# error "Never include <bits/typesizes.h> directly; use <sys/types.h> instead."
-+#endif
-+
-+#ifndef	_BITS_TYPESIZES_H
-+#define	_BITS_TYPESIZES_H	1
-+
-+/* See <bits/types.h> for the meaning of these macros.  This file exists so
-+   that <bits/types.h> need not vary across different GNU platforms.  */
-+
-+#define __DEV_T_TYPE		__U32_TYPE
-+#define __UID_T_TYPE		__U32_TYPE
-+#define __GID_T_TYPE		__U32_TYPE
-+#define __INO_T_TYPE		__U32_TYPE
-+#define __INO64_T_TYPE		__UQUAD_TYPE
-+#define __MODE_T_TYPE		__U16_TYPE
-+#define __NLINK_T_TYPE		__U16_TYPE
-+#define __OFF_T_TYPE		__SQUAD_TYPE
-+#define __OFF64_T_TYPE		__SQUAD_TYPE
-+#define __PID_T_TYPE		__S32_TYPE
-+#define __RLIM_T_TYPE		__SQUAD_TYPE
-+#define __RLIM64_T_TYPE		__SQUAD_TYPE
-+#define	__BLKCNT_T_TYPE		__SQUAD_TYPE
-+#define	__BLKCNT64_T_TYPE	__SQUAD_TYPE
-+#define	__FSBLKCNT_T_TYPE	__ULONGWORD_TYPE
-+#define	__FSBLKCNT64_T_TYPE	__UQUAD_TYPE
-+#define	__FSFILCNT_T_TYPE	__ULONGWORD_TYPE
-+#define	__FSFILCNT64_T_TYPE	__UQUAD_TYPE
-+#define	__ID_T_TYPE		__U32_TYPE
-+#define __CLOCK_T_TYPE		__S32_TYPE
-+#define	__FSWORD_T_TYPE		__SWORD_TYPE
-+
-+/*
-+ * This one is a bit tricky.  It needs to match the size
-+ * in the sys/${arch}/include/_types.h typedefs.
-+ *
-+ * However, for i386 and amd64 we started with __SLONGWORD_TYPE
-+ * and we need to maintain ABI.  Even if size is the same, using
-+ * a different type may affect C++ ABI (this distinction is
-+ * necessary to implement function overload), so it must stay
-+ * with __SLONGWORD_TYPE.
-+ */
-+#if defined(__i386__) || defined(__amd64__) || defined(__powerpc__)
-+#define __TIME_T_TYPE		__SLONGWORD_TYPE
-+#else
-+#define __TIME_T_TYPE		__S64_TYPE
-+#endif
-+
-+#define __USECONDS_T_TYPE	__U32_TYPE
-+#define __SUSECONDS_T_TYPE	__SLONGWORD_TYPE
-+#define __DADDR_T_TYPE		__SQUAD_TYPE
-+#define __SWBLK_T_TYPE		__S32_TYPE
-+#define __KEY_T_TYPE		__SLONGWORD_TYPE
-+#define __CLOCKID_T_TYPE	__S32_TYPE
-+#define __TIMER_T_TYPE		__S32_TYPE
-+#define __BLKSIZE_T_TYPE	__U32_TYPE
-+#define __FSID_T_TYPE		union { int __val[2]; int val[2]; }
-+#define __SSIZE_T_TYPE		__SWORD_TYPE
-+#define __SNSECONDS_T_TYPE	__SLONGWORD_TYPE
-+#define __SYSCALL_SLONG_TYPE	__SLONGWORD_TYPE
-+#define __SYSCALL_ULONG_TYPE	__ULONGWORD_TYPE
-+
-+/* Tell the libc code that off_t and off64_t are actually the same type
-+   for all ABI purposes, even if possibly expressed as different base types
-+   for C type-checking purposes.  */
-+#define __OFF_T_MATCHES_OFF64_T 1
-+
-+/* Number of descriptors that can fit in an `fd_set'.  */
-+#define	__FD_SETSIZE		1024
-+
-+
-+#endif /* bits/typesizes.h */
---- /dev/null
-+++ b/ports/sysdeps/unix/bsd/bsd4.4/kfreebsd/linuxthreads/execve.c
-@@ -0,0 +1,2 @@
-+#include <linuxthreads/sysdeps/unix/sysv/linux/execve.c>
-+libc_hidden_proto (__syscall_execve )
---- /dev/null
-+++ b/ports/sysdeps/unix/bsd/bsd4.4/kfreebsd/linuxthreads/fatal-prepare.h
-@@ -0,0 +1,39 @@
-+/* Copyright (C) 2003, 2007 Free Software Foundation, Inc.
-+   This file is part of the GNU C Library.
-+
-+   The GNU C Library is free software; you can redistribute it and/or
-+   modify it under the terms of the GNU Lesser General Public
-+   License as published by the Free Software Foundation; either
-+   version 2.1 of the License, or (at your option) any later version.
-+
-+   The GNU C Library is distributed in the hope that it will be useful,
-+   but WITHOUT ANY WARRANTY; without even the implied warranty of
-+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-+   Lesser General Public License for more details.
-+
-+   You should have received a copy of the GNU Lesser General Public
-+   License along with the GNU C Library; if not, write to the Free
-+   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-+   02111-1307 USA.  */
-+
-+#include <pthread.h>
-+
-+/* We have to completely disable cancellation.  assert() must not be a
-+   cancellation point but the implementation uses write() etc.  */
-+#ifdef SHARED
-+# include <pthread-functions.h>
-+# define FATAL_PREPARE \
-+  {									      \
-+    int (*fp) (int, int *);                                                   \
-+    fp = __libc_pthread_functions.ptr_pthread_setcancelstate;                 \
-+    if (fp != NULL)                                                           \
-+      fp (PTHREAD_CANCEL_DISABLE, NULL);                                      \
-+  }
-+#else
-+# pragma weak pthread_setcancelstate
-+# define FATAL_PREPARE \
-+  {									      \
-+    if (pthread_setcancelstate != NULL)					      \
-+      pthread_setcancelstate (PTHREAD_CANCEL_DISABLE, NULL);		      \
-+  }
-+#endif
---- /dev/null
-+++ b/ports/sysdeps/unix/bsd/bsd4.4/kfreebsd/linuxthreads/fork.c
-@@ -0,0 +1 @@
-+#include <linuxthreads/sysdeps/unix/sysv/linux/fork.c>
---- /dev/null
-+++ b/ports/sysdeps/unix/bsd/bsd4.4/kfreebsd/linuxthreads/fork.h
-@@ -0,0 +1 @@
-+#include <linuxthreads/sysdeps/unix/sysv/linux/fork.h>
---- /dev/null
-+++ b/ports/sysdeps/unix/bsd/bsd4.4/kfreebsd/linuxthreads/jmp-unwind.c
-@@ -0,0 +1 @@
-+#include <linuxthreads/sysdeps/unix/sysv/linux/jmp-unwind.c>
---- /dev/null
-+++ b/ports/sysdeps/unix/bsd/bsd4.4/kfreebsd/linuxthreads/kernel-posix-timers.h
-@@ -0,0 +1,126 @@
-+/* Copyright (C) 2003, 2007, 2012 Free Software Foundation, Inc.
-+   This file is part of the GNU C Library.
-+   Contributed by Ulrich Drepper <drepper@redhat.com>, 2003.
-+
-+   The GNU C Library is free software; you can redistribute it and/or
-+   modify it under the terms of the GNU Lesser General Public License as
-+   published by the Free Software Foundation; either version 2.1 of the
-+   License, or (at your option) any later version.
-+
-+   The GNU C Library is distributed in the hope that it will be useful,
-+   but WITHOUT ANY WARRANTY; without even the implied warranty of
-+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-+   Lesser General Public License for more details.
-+
-+   You should have received a copy of the GNU Lesser General Public
-+   License along with the GNU C Library; see the file COPYING.LIB.  If not,
-+   write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
-+   Boston, MA 02111-1307, USA.  */
-+
-+#include <pthread.h>
-+#include <setjmp.h>
-+#include <signal.h>
-+#include <sys/types.h>
-+#include <sys/_types.h>
-+
-+/* The signal used for asynchronous cancelation.  */
-+#define SIGCANCEL	(PTHREAD_SIGBASE + 1)
-+
-+/* Signal needed for the kernel-supported POSIX timer implementation.
-+   We can reuse the cancellation signal since we can distinguish
-+   cancellation from timer expirations.  */
-+#define SIGTIMER	SIGCANCEL
-+
-+/* Nonzero if the system calls are not available.  */
-+extern int __no_posix_timers attribute_hidden;
-+
-+/* Callback to start helper thread.  */
-+extern void __start_helper_thread (void) attribute_hidden;
-+
-+/* Control variable for helper thread creation.  */
-+extern pthread_once_t __helper_once attribute_hidden;
-+
-+/* TID of the helper thread.  */
-+extern __lwpid_t __helper_tid attribute_hidden;
-+
-+/* List of active SIGEV_THREAD timers.  */
-+extern struct timer *__active_timer_sigev_thread attribute_hidden;
-+/* Lock for the __active_timer_sigev_thread.  */
-+extern pthread_mutex_t __active_timer_sigev_thread_lock attribute_hidden;
-+
-+
-+/* Type of timers in the kernel.  */
-+typedef int kernel_timer_t;
-+
-+
-+/* Internal representation of timer.  */
-+struct timer
-+{
-+  /* Notification mechanism.  */
-+  int sigev_notify;
-+
-+  /* Timer ID returned by the kernel.  */
-+  kernel_timer_t ktimerid;
-+
-+  /* All new elements must be added after ktimerid.  And if the thrfunc
-+     element is not the third element anymore the memory allocation in
-+     timer_create needs to be changed.  */
-+
-+  /* Parameters for the thread to be started for SIGEV_THREAD.  */
-+  void (*thrfunc) (sigval_t);
-+  sigval_t sival;
-+  pthread_attr_t attr;
-+
-+  /* Next element in list of active SIGEV_THREAD timers.  */
-+  struct timer *next;
-+};
-+
-+extern struct timer *__all_timers[TIMER_MAX];
-+
-+static inline struct timer *
-+__kfreebsd_timer_alloc ()
-+{
-+  unsigned int i;
-+  struct timer *timer = malloc (sizeof (struct timer));
-+
-+  /* Find a free slot (and reserve it atomically).  */
-+  for (i = 0; i < TIMER_MAX; i++)
-+    if (atomic_compare_and_exchange_val_acq (&__all_timers[i],
-+					     timer, NULL) == NULL)
-+      return timer;
-+
-+  errno = EAGAIN;
-+  return NULL;
-+}
-+
-+static inline struct timer *
-+__kfreebsd_timer_id2ptr (timer_t id)
-+{
-+  void *ret = NULL;
-+
-+  if (id >= 0 && id < TIMER_MAX)
-+    ret = __all_timers[id];
-+
-+  if (! ret)
-+    errno = EINVAL;
-+
-+  return ret;
-+}
-+
-+static inline timer_t
-+__kfreebsd_timer_ptr2id (struct timer *ptr)
-+{
-+  unsigned int i;
-+  for (i = 0; i < TIMER_MAX; i++)
-+    if (__all_timers[i] == ptr)
-+      return i;
-+
-+  return -1;
-+}
-+
-+void static inline
-+__kfreebsd_timer_free (struct timer *ptr)
-+{
-+  __all_timers[__kfreebsd_timer_ptr2id (ptr)] = NULL;
-+  free (ptr);
-+}
---- /dev/null
-+++ b/ports/sysdeps/unix/bsd/bsd4.4/kfreebsd/linuxthreads/lowlevellock.h
-@@ -0,0 +1,47 @@
-+/* Copyright (C) 2007 Free Software Foundation, Inc.
-+   This file is part of the GNU C Library.
-+
-+   The GNU C Library is free software; you can redistribute it and/or
-+   modify it under the terms of the GNU Lesser General Public
-+   License as published by the Free Software Foundation; either
-+   version 2.1 of the License, or (at your option) any later version.
-+
-+   The GNU C Library is distributed in the hope that it will be useful,
-+   but WITHOUT ANY WARRANTY; without even the implied warranty of
-+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.	 See the GNU
-+   Lesser General Public License for more details.
-+
-+   You should have received a copy of the GNU Lesser General Public
-+   License along with the GNU C Library; if not, write to the Free
-+   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-+   02111-1307 USA.  */
-+
-+#ifndef _LOWLEVELLOCK_H
-+#define _LOWLEVELLOCK_H	1
-+
-+#include <atomic.h>
-+
-+typedef union
-+{
-+  volatile void *	uv;	/* in fact struct umtx from <sys/umtx.h> */
-+  volatile int		iv;
-+  volatile long		lv;
-+
-+} __rtld_mrlock_t;
-+
-+#define UMTX_OP_WAIT	2	/*  <sys/umtx.h> */
-+#define UMTX_OP_WAKE	3	/*  <sys/umtx.h> */
-+
-+extern int __syscall__umtx_op(void *, int, long, void*, void*);
-+
-+static inline void lll_futex_wake(long *umtx, unsigned int nr_wakeup)
-+{
-+  __syscall__umtx_op(umtx, UMTX_OP_WAKE, nr_wakeup, NULL, NULL);
-+}
-+
-+static inline void lll_futex_wait(long *umtx, unsigned int old_val)
-+{
-+  __syscall__umtx_op(umtx, UMTX_OP_WAIT, old_val, NULL, NULL);
-+}
-+
-+#endif	/* lowlevellock.h */
---- /dev/null
-+++ b/ports/sysdeps/unix/bsd/bsd4.4/kfreebsd/linuxthreads/pt-crti.S
-@@ -0,0 +1,43 @@
-+/* Special .init and .fini section support for libpthread.
-+   Copyright (C) 2012 Free Software Foundation, Inc.
-+   This file is part of the GNU C Library.
-+
-+   The GNU C Library is free software; you can redistribute it and/or
-+   modify it under the terms of the GNU Lesser General Public
-+   License as published by the Free Software Foundation; either
-+   version 2.1 of the License, or (at your option) any later version.
-+
-+   In addition to the permissions in the GNU Lesser General Public
-+   License, the Free Software Foundation gives you unlimited
-+   permission to link the compiled version of this file with other
-+   programs, and to distribute those programs without any restriction
-+   coming from the use of this file. (The GNU Lesser General Public
-+   License restrictions do apply in other respects; for example, they
-+   cover modification of the file, and distribution when not linked
-+   into another program.)
-+
-+   Note that people who make modified versions of this file are not
-+   obligated to grant this special exception for their modified
-+   versions; it is their choice whether to do so. The GNU Lesser
-+   General Public License gives permission to release a modified
-+   version without this exception; this exception also makes it
-+   possible to release a modified version which carries forward this
-+   exception.
-+
-+   The GNU C Library is distributed in the hope that it will be useful,
-+   but WITHOUT ANY WARRANTY; without even the implied warranty of
-+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-+   Lesser General Public License for more details.
-+
-+   You should have received a copy of the GNU Lesser General Public
-+   License along with the GNU C Library; if not, see
-+   <http://www.gnu.org/licenses/>.  */
-+
-+/* Arrange for __pthread_initialize_minimal to be called at
-+   libpthread startup, instead of conditionally calling
-+   __gmon_start__.  */
-+
-+#define PREINIT_FUNCTION __pthread_initialize_minimal
-+#define PREINIT_FUNCTION_WEAK 0
-+
-+#include <crti.S>
---- /dev/null
-+++ b/ports/sysdeps/unix/bsd/bsd4.4/kfreebsd/linuxthreads/pt-sigsuspend.S
-@@ -0,0 +1,29 @@
-+/* Internal sigsuspend system call for LinuxThreads. FreeBSD version.
-+   Copyright (C) 2003 Free Software Foundation, Inc.
-+   This file is part of the GNU C Library.
-+
-+   The GNU C Library is free software; you can redistribute it and/or
-+   modify it under the terms of the GNU Lesser General Public
-+   License as published by the Free Software Foundation; either
-+   version 2.1 of the License, or (at your option) any later version.
-+
-+   The GNU C Library is distributed in the hope that it will be useful,
-+   but WITHOUT ANY WARRANTY; without even the implied warranty of
-+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-+   Lesser General Public License for more details.
-+
-+   You should have received a copy of the GNU Lesser General Public
-+   License along with the GNU C Library; if not, write to the Free
-+   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-+   02111-1307 USA.  */
-+
-+
-+#include <sysdep.h>
-+
-+PSEUDO_NOERRNO(__pthread_sigsuspend, sigsuspend, 1)
-+	ret_NOERRNO
-+PSEUDO_END_NOERRNO(__pthread_sigsuspend)
-+
-+PSEUDO(__syscall_sigsuspend, sigsuspend, 1)
-+	ret
-+PSEUDO_END(__syscall_sigsuspend)
---- /dev/null
-+++ b/ports/sysdeps/unix/bsd/bsd4.4/kfreebsd/linuxthreads/raise.c
-@@ -0,0 +1 @@
-+#include <linuxthreads/sysdeps/unix/sysv/linux/raise.c>
---- /dev/null
-+++ b/ports/sysdeps/unix/bsd/bsd4.4/kfreebsd/linuxthreads/register-atfork.c
-@@ -0,0 +1 @@
-+#include <linuxthreads/sysdeps/unix/sysv/linux/register-atfork.c>
---- /dev/null
-+++ b/ports/sysdeps/unix/bsd/bsd4.4/kfreebsd/linuxthreads/smp.h
-@@ -0,0 +1,36 @@
-+/* Determine whether the host has multiple processors.  FreeBSD version.
-+   Copyright (C) 1996, 2002 Free Software Foundation, Inc.
-+   This file is part of the GNU C Library.
-+
-+   The GNU C Library is free software; you can redistribute it and/or
-+   modify it under the terms of the GNU Library General Public License as
-+   published by the Free Software Foundation; either version 2 of the
-+   License, or (at your option) any later version.
-+
-+   The GNU C Library is distributed in the hope that it will be useful,
-+   but WITHOUT ANY WARRANTY; without even the implied warranty of
-+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-+   Library General Public License for more details.
-+
-+   You should have received a copy of the GNU Library General Public
-+   License along with the GNU C Library; see the file COPYING.LIB.  If not,
-+   write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
-+   Boston, MA 02111-1307, USA.  */
-+
-+#include <sys/sysctl.h>
-+
-+/* Test whether the machine has more than one processor.  */
-+static inline int
-+is_smp_system (void)
-+{
-+  /* Fetch sysctl value of "hw.ncpu".  */
-+  int request[] = { CTL_HW, HW_NCPU };
-+  int result;
-+  size_t result_len = sizeof (result);
-+
-+  if (__sysctl (request, 2, &result, &result_len, NULL, 0) < 0)
-+    /* Dummy result.  */
-+    return 0;
-+
-+  return (result > 1);
-+}
---- /dev/null
-+++ b/ports/sysdeps/unix/bsd/bsd4.4/kfreebsd/linuxthreads/timer_create.c
-@@ -0,0 +1,165 @@
-+/* Copyright (C) 2003,2004, 2007, 2009, 2012 Free Software Foundation, Inc.
-+   This file is part of the GNU C Library.
-+   Contributed by Ulrich Drepper <drepper@redhat.com>, 2003.
-+
-+   The GNU C Library is free software; you can redistribute it and/or
-+   modify it under the terms of the GNU Lesser General Public License as
-+   published by the Free Software Foundation; either version 2.1 of the
-+   License, or (at your option) any later version.
-+
-+   The GNU C Library is distributed in the hope that it will be useful,
-+   but WITHOUT ANY WARRANTY; without even the implied warranty of
-+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-+   Lesser General Public License for more details.
-+
-+   You should have received a copy of the GNU Lesser General Public
-+   License along with the GNU C Library; see the file COPYING.LIB.  If not,
-+   write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
-+   Boston, MA 02111-1307, USA.  */
-+
-+#include <errno.h>
-+#include <pthread.h>
-+#include <signal.h>
-+#include <stdlib.h>
-+#include <string.h>
-+#include <time.h>
-+#include <sysdep.h>
-+#include <kernel-features.h>
-+#include "kernel-posix-timers.h"
-+#include "kernel-posix-cpu-timers.h"
-+
-+
-+int
-+timer_create (clock_id, evp, timerid)
-+     clockid_t clock_id;
-+     struct sigevent *evp;
-+     timer_t *timerid;
-+{
-+    {
-+      /* If the user wants notification via a thread we need to handle
-+	 this special.  */
-+      if (evp == NULL
-+	  || __builtin_expect (evp->sigev_notify != SIGEV_THREAD, 1))
-+	{
-+	  struct sigevent local_evp;
-+
-+	  struct timer *newp = __kfreebsd_timer_alloc ();
-+
-+	  if (newp == NULL)
-+	    /* No more memory.  */
-+	    return -1;
-+
-+	  if (evp == NULL)
-+	    {
-+	      /* The kernel has to pass up the timer ID which is a
-+		 userlevel object.  Therefore we cannot leave it up to
-+		 the kernel to determine it.  */
-+	      local_evp.sigev_notify = SIGEV_SIGNAL;
-+	      local_evp.sigev_signo = SIGALRM;
-+	      local_evp.sigev_value.sival_int = __kfreebsd_timer_ptr2id (newp);
-+
-+	      evp = &local_evp;
-+	    }
-+
-+	  kernel_timer_t ktimerid;
-+	  int retval = INLINE_SYSCALL (ktimer_create, 3, clock_id, evp,
-+				       &ktimerid);
-+
-+	    {
-+
-+	      if (retval != -1)
-+		{
-+		  newp->sigev_notify = (evp != NULL
-+					? evp->sigev_notify : SIGEV_SIGNAL);
-+		  newp->ktimerid = ktimerid;
-+
-+		  *timerid = __kfreebsd_timer_ptr2id (newp);
-+		}
-+	      else
-+		{
-+		  /* Cannot allocate the timer, fail.  */
-+		  __kfreebsd_timer_free (newp);
-+		  retval = -1;
-+		}
-+
-+	      return retval;
-+	    }
-+	}
-+      else
-+	{
-+	    {
-+	      /* Create the helper thread.  */
-+	      pthread_once (&__helper_once, __start_helper_thread);
-+	      if (__helper_tid == 0)
-+		{
-+		  /* No resources to start the helper thread.  */
-+		  __set_errno (EAGAIN);
-+		  return -1;
-+		}
-+
-+	      struct timer *newp;
-+	      newp = __kfreebsd_timer_alloc ();
-+	      if (newp == NULL)
-+		return -1;
-+
-+	      /* Copy the thread parameters the user provided.  */
-+	      newp->sival = evp->sigev_value;
-+	      newp->thrfunc = evp->sigev_notify_function;
-+	      newp->sigev_notify = SIGEV_THREAD;
-+
-+	      /* We cannot simply copy the thread attributes since the
-+		 implementation might keep internal information for
-+		 each instance.  */
-+	      (void) pthread_attr_init (&newp->attr);
-+	      if (evp->sigev_notify_attributes != NULL)
-+		{
-+		  pthread_attr_t *nattr;
-+		  pthread_attr_t *oattr;
-+
-+		  nattr = (pthread_attr_t *) &newp->attr;
-+		  oattr = (pthread_attr_t *) evp->sigev_notify_attributes;
-+
-+		  nattr->__schedparam = oattr->__schedparam;
-+		  nattr->__schedpolicy = oattr->__schedpolicy;
-+		  nattr->__guardsize = oattr->__guardsize;
-+		  nattr->__stackaddr = oattr->__stackaddr;
-+		  nattr->__stacksize = oattr->__stacksize;
-+		}
-+
-+	      /* In any case set the detach flag.  */
-+	      (void) pthread_attr_setdetachstate (&newp->attr,
-+						  PTHREAD_CREATE_DETACHED);
-+
-+	      /* Create the event structure for the kernel timer.  */
-+	      struct sigevent sev =
-+		{ .sigev_value.sival_ptr = newp,
-+		  .sigev_signo = SIGTIMER,
-+		  .sigev_notify = SIGEV_THREAD_ID,
-+		  .sigev_notify_thread_id = __helper_tid,
-+		};
-+
-+	      /* Create the timer.  */
-+	      int res;
-+	      res = INLINE_SYSCALL (ktimer_create, 3,
-+				      clock_id, &sev, &newp->ktimerid);
-+	      if (res != -1)
-+		{
-+		  /* Add to the queue of active timers with thread
-+		     delivery.  */
-+		  pthread_mutex_lock (&__active_timer_sigev_thread_lock);
-+		  newp->next = __active_timer_sigev_thread;
-+		  __active_timer_sigev_thread = newp;
-+		  pthread_mutex_unlock (&__active_timer_sigev_thread_lock);
-+
-+		  *timerid = __kfreebsd_timer_ptr2id (newp);
-+		  return 0;
-+		}
-+
-+	      /* Free the resources.  */
-+	      __kfreebsd_timer_free (newp);
-+
-+	      return -1;
-+	    }
-+	}
-+    }
-+}
---- /dev/null
-+++ b/ports/sysdeps/unix/bsd/bsd4.4/kfreebsd/linuxthreads/timer_delete.c
-@@ -0,0 +1,71 @@
-+/* Copyright (C) 2003, 2007, 2012 Free Software Foundation, Inc.
-+   This file is part of the GNU C Library.
-+   Contributed by Ulrich Drepper <drepper@redhat.com>, 2003.
-+
-+   The GNU C Library is free software; you can redistribute it and/or
-+   modify it under the terms of the GNU Lesser General Public License as
-+   published by the Free Software Foundation; either version 2.1 of the
-+   License, or (at your option) any later version.
-+
-+   The GNU C Library is distributed in the hope that it will be useful,
-+   but WITHOUT ANY WARRANTY; without even the implied warranty of
-+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-+   Lesser General Public License for more details.
-+
-+   You should have received a copy of the GNU Lesser General Public
-+   License along with the GNU C Library; see the file COPYING.LIB.  If not,
-+   write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
-+   Boston, MA 02111-1307, USA.  */
-+
-+#include <errno.h>
-+#include <stdlib.h>
-+#include <time.h>
-+#include <sysdep.h>
-+#include <kernel-features.h>
-+#include "kernel-posix-timers.h"
-+
-+
-+int
-+timer_delete (timerid)
-+     timer_t timerid;
-+{
-+      struct timer *kt = __kfreebsd_timer_id2ptr (timerid);
-+      if (! kt)
-+	return -1;
-+
-+      /* Delete the kernel timer object.  */
-+      int res = INLINE_SYSCALL (ktimer_delete, 1, kt->ktimerid);
-+
-+      if (res == 0)
-+	{
-+	  if (kt->sigev_notify == SIGEV_THREAD)
-+	    {
-+	      /* Remove the timer from the list.  */
-+	      pthread_mutex_lock (&__active_timer_sigev_thread_lock);
-+	      if (__active_timer_sigev_thread == kt)
-+		__active_timer_sigev_thread = kt->next;
-+	      else
-+		{
-+		  struct timer *prevp = __active_timer_sigev_thread;
-+		  while (prevp->next != NULL)
-+		    if (prevp->next == kt)
-+		      {
-+			prevp->next = kt->next;
-+			break;
-+		      }
-+		    else
-+		      prevp = prevp->next;
-+		}
-+	      pthread_mutex_unlock (&__active_timer_sigev_thread_lock);
-+	    }
-+
-+	  /* Free the memory.  */
-+	  (void) __kfreebsd_timer_free (kt);
-+
-+	  return 0;
-+	}
-+
-+      /* The kernel timer is not known or something else bad happened.
-+	 Return the error.  */
-+	  return -1;
-+}
---- /dev/null
-+++ b/ports/sysdeps/unix/bsd/bsd4.4/kfreebsd/linuxthreads/timer_getoverr.c
-@@ -0,0 +1,37 @@
-+/* Copyright (C) 2003, 2012 Free Software Foundation, Inc.
-+   This file is part of the GNU C Library.
-+   Contributed by Ulrich Drepper <drepper@redhat.com>, 2003.
-+
-+   The GNU C Library is free software; you can redistribute it and/or
-+   modify it under the terms of the GNU Lesser General Public License as
-+   published by the Free Software Foundation; either version 2.1 of the
-+   License, or (at your option) any later version.
-+
-+   The GNU C Library is distributed in the hope that it will be useful,
-+   but WITHOUT ANY WARRANTY; without even the implied warranty of
-+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-+   Lesser General Public License for more details.
-+
-+   You should have received a copy of the GNU Lesser General Public
-+   License along with the GNU C Library; see the file COPYING.LIB.  If not,
-+   write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
-+   Boston, MA 02111-1307, USA.  */
-+
-+#include <errno.h>
-+#include <time.h>
-+#include <sysdep.h>
-+#include <kernel-features.h>
-+#include "kernel-posix-timers.h"
-+
-+
-+int
-+timer_getoverrun (timerid)
-+     timer_t timerid;
-+{
-+      struct timer *kt = __kfreebsd_timer_id2ptr (timerid);
-+      if (! kt)
-+	return -1;
-+
-+      /* Get the information from the kernel.  */
-+      return INLINE_SYSCALL (ktimer_getoverrun, 1, kt->ktimerid);
-+}
---- /dev/null
-+++ b/ports/sysdeps/unix/bsd/bsd4.4/kfreebsd/linuxthreads/timer_gettime.c
-@@ -0,0 +1,39 @@
-+/* Copyright (C) 2003, 2012 Free Software Foundation, Inc.
-+   This file is part of the GNU C Library.
-+   Contributed by Ulrich Drepper <drepper@redhat.com>, 2003.
-+
-+   The GNU C Library is free software; you can redistribute it and/or
-+   modify it under the terms of the GNU Lesser General Public License as
-+   published by the Free Software Foundation; either version 2.1 of the
-+   License, or (at your option) any later version.
-+
-+   The GNU C Library is distributed in the hope that it will be useful,
-+   but WITHOUT ANY WARRANTY; without even the implied warranty of
-+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-+   Lesser General Public License for more details.
-+
-+   You should have received a copy of the GNU Lesser General Public
-+   License along with the GNU C Library; see the file COPYING.LIB.  If not,
-+   write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
-+   Boston, MA 02111-1307, USA.  */
-+
-+#include <errno.h>
-+#include <stdlib.h>
-+#include <time.h>
-+#include <sysdep.h>
-+#include <kernel-features.h>
-+#include "kernel-posix-timers.h"
-+
-+
-+int
-+timer_gettime (timerid, value)
-+     timer_t timerid;
-+     struct itimerspec *value;
-+{
-+      struct timer *kt = __kfreebsd_timer_id2ptr (timerid);
-+      if (! kt)
-+	return -1;
-+
-+      /* Delete the kernel timer object.  */
-+      return INLINE_SYSCALL (ktimer_gettime, 2, kt->ktimerid, value);
-+}
---- /dev/null
-+++ b/ports/sysdeps/unix/bsd/bsd4.4/kfreebsd/linuxthreads/timer_routines.c
-@@ -0,0 +1,208 @@
-+/* Copyright (C) 2003, 2004, 2005, 2006, 2007, 2012 Free Software Foundation, Inc.
-+   This file is part of the GNU C Library.
-+   Contributed by Ulrich Drepper <drepper@redhat.com>, 2003.
-+
-+   The GNU C Library is free software; you can redistribute it and/or
-+   modify it under the terms of the GNU Lesser General Public License as
-+   published by the Free Software Foundation; either version 2.1 of the
-+   License, or (at your option) any later version.
-+
-+   The GNU C Library is distributed in the hope that it will be useful,
-+   but WITHOUT ANY WARRANTY; without even the implied warranty of
-+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-+   Lesser General Public License for more details.
-+
-+   You should have received a copy of the GNU Lesser General Public
-+   License along with the GNU C Library; see the file COPYING.LIB.  If not,
-+   write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
-+   Boston, MA 02111-1307, USA.  */
-+
-+#include <errno.h>
-+#include <setjmp.h>
-+#include <signal.h>
-+#include <stdbool.h>
-+#include <sysdep.h>
-+#include <sys/_types.h> /* __lwpid_t */
-+#include <atomic.h>
-+#include <kernel-features.h>
-+#include <linuxthreads/internals.h>	/* LIBC_CANCEL_ASYNC */
-+#include <semaphore.h>
-+#include "kernel-posix-timers.h"
-+
-+/* NPTL/Linux simply casts "timer_t" to "struct timer *", but on
-+   kFreeBSD timer_t may not be large enough to hold a pointer.
-+   So we store the pointers here... (sigh) */
-+struct timer *__all_timers[TIMER_MAX];
-+
-+/* List of active SIGEV_THREAD timers.  */
-+struct timer *__active_timer_sigev_thread;
-+/* Lock for the __active_timer_sigev_thread.  */
-+pthread_mutex_t __active_timer_sigev_thread_lock = PTHREAD_MUTEX_INITIALIZER;
-+
-+
-+struct thread_start_data
-+{
-+  void (*thrfunc) (sigval_t);
-+  sigval_t sival;
-+};
-+
-+/* TID of the helper thread.  */
-+__lwpid_t __helper_tid attribute_hidden;
-+sem_t __helper_tid_semaphore attribute_hidden;
-+
-+/* Helper thread to call the user-provided function.  */
-+static void *
-+timer_sigev_thread (void *arg)
-+{
-+  /* The parent thread has all signals blocked.  This is a bit
-+     surprising for user code, although valid.  We unblock all
-+     signals.  */
-+  sigset_t ss;
-+  sigemptyset (&ss);
-+  sigprocmask (SIG_SETMASK, &ss, NULL);
-+
-+  struct thread_start_data *td = (struct thread_start_data *) arg;
-+
-+  void (*thrfunc) (sigval_t) = td->thrfunc;
-+  sigval_t sival = td->sival;
-+
-+  /* The TD object was allocated in timer_helper_thread.  */
-+  free (td);
-+
-+  /* Call the user-provided function.  */
-+  thrfunc (sival);
-+
-+  return NULL;
-+}
-+
-+
-+/* Helper function to support starting threads for SIGEV_THREAD.  */
-+static void *
-+timer_helper_thread (void *arg)
-+{
-+  /* Wait for the SIGTIMER signal, allowing the setXid signal, and
-+     none else.  */
-+  sigset_t ss;
-+  sigemptyset (&ss);
-+  __sigaddset (&ss, SIGTIMER);
-+
-+  syscall (SYS_thr_self, &__helper_tid);
-+  sem_post (&__helper_tid_semaphore);
-+
-+  /* Endless loop of waiting for signals.  The loop is only ended when
-+     the thread is canceled.  */
-+  while (1)
-+    {
-+      siginfo_t si;
-+
-+      /* sigwaitinfo cannot be used here, since it deletes
-+	 SIGCANCEL == SIGTIMER from the set.  */
-+
-+      int oldtype = LIBC_CANCEL_ASYNC ();
-+
-+      /* XXX The size argument hopefully will have to be changed to the
-+	 real size of the user-level sigset_t.  */
-+      int result = sigtimedwait (&ss, &si, NULL);
-+
-+      LIBC_CANCEL_RESET (oldtype);
-+
-+      if (result > 0)
-+	{
-+	  if (si.si_code == SI_TIMER)
-+	    {
-+	      struct timer *tk = (struct timer *) si.si_value.sival_ptr;
-+
-+	      /* Check the timer is still used and will not go away
-+		 while we are reading the values here.  */
-+	      pthread_mutex_lock (&__active_timer_sigev_thread_lock);
-+
-+	      struct timer *runp = __active_timer_sigev_thread;
-+	      while (runp != NULL)
-+		if (runp == tk)
-+		  break;
-+		else
-+		  runp = runp->next;
-+
-+	      if (runp != NULL)
-+		{
-+		  struct thread_start_data *td = malloc (sizeof (*td));
-+
-+		  /* There is not much we can do if the allocation fails.  */
-+		  if (td != NULL)
-+		    {
-+		      /* This is the signal we are waiting for.  */
-+		      td->thrfunc = tk->thrfunc;
-+		      td->sival = tk->sival;
-+
-+		      pthread_t th;
-+		      (void) pthread_create (&th, &tk->attr,
-+					     timer_sigev_thread, td);
-+		    }
-+		}
-+
-+	      pthread_mutex_unlock (&__active_timer_sigev_thread_lock);
-+	    }
-+	  else if (si.si_code == SI_LWP
-+		   /* Backward compatibility (see rev 211732 in -CURRENT).  */
-+		   || si.si_code == SI_USER)
-+	    /* The thread is canceled.  */
-+	    pthread_exit (NULL);
-+	}
-+    }
-+}
-+
-+
-+/* Control variable for helper thread creation.  */
-+pthread_once_t __helper_once attribute_hidden;
-+
-+
-+/* Reset variables so that after a fork a new helper thread gets started.  */
-+static void
-+reset_helper_control (void)
-+{
-+  __helper_once = PTHREAD_ONCE_INIT;
-+  __helper_tid = 0;
-+  sem_destroy (&__helper_tid_semaphore);
-+}
-+
-+
-+void
-+attribute_hidden
-+__start_helper_thread (void)
-+{
-+  /* The helper thread needs only very little resources
-+     and should go away automatically when canceled.  */
-+  pthread_attr_t attr;
-+  (void) pthread_attr_init (&attr);
-+  (void) pthread_attr_setstacksize (&attr, PTHREAD_STACK_MIN);
-+
-+  /* Block all signals in the helper thread but SIGSETXID.  To do this
-+     thoroughly we temporarily have to block all signals here.  The
-+     helper can lose wakeups if SIGCANCEL is not blocked throughout,
-+     but sigfillset omits it SIGSETXID.  So, we add SIGCANCEL back
-+     explicitly here.  */
-+  sigset_t ss;
-+  sigset_t oss;
-+  sigfillset (&ss);
-+  __sigaddset (&ss, SIGCANCEL);
-+  sigprocmask (SIG_SETMASK, &ss, &oss);
-+
-+  sem_init (&__helper_tid_semaphore, 0, 0);
-+
-+  /* Create the helper thread for this timer.  */
-+  pthread_t th;
-+  int res = pthread_create (&th, &attr, timer_helper_thread, NULL);
-+  if (res == 0)
-+    /* We managed to start the helper thread.  */
-+    sem_wait (&__helper_tid_semaphore);
-+
-+  /* Restore the signal mask.  */
-+  sigprocmask (SIG_SETMASK, &oss, NULL);
-+
-+  /* No need for the attribute anymore.  */
-+  (void) pthread_attr_destroy (&attr);
-+
-+  /* We have to make sure that after fork()ing a new helper thread can
-+     be created.  */
-+  pthread_atfork (NULL, NULL, reset_helper_control);
-+}
---- /dev/null
-+++ b/ports/sysdeps/unix/bsd/bsd4.4/kfreebsd/linuxthreads/timer_settime.c
-@@ -0,0 +1,42 @@
-+/* Copyright (C) 2003, 2012 Free Software Foundation, Inc.
-+   This file is part of the GNU C Library.
-+   Contributed by Ulrich Drepper <drepper@redhat.com>, 2003.
-+
-+   The GNU C Library is free software; you can redistribute it and/or
-+   modify it under the terms of the GNU Lesser General Public License as
-+   published by the Free Software Foundation; either version 2.1 of the
-+   License, or (at your option) any later version.
-+
-+   The GNU C Library is distributed in the hope that it will be useful,
-+   but WITHOUT ANY WARRANTY; without even the implied warranty of
-+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-+   Lesser General Public License for more details.
-+
-+   You should have received a copy of the GNU Lesser General Public
-+   License along with the GNU C Library; see the file COPYING.LIB.  If not,
-+   write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
-+   Boston, MA 02111-1307, USA.  */
-+
-+#include <errno.h>
-+#include <stdlib.h>
-+#include <time.h>
-+#include <sysdep.h>
-+#include <kernel-features.h>
-+#include "kernel-posix-timers.h"
-+
-+int
-+timer_settime (timerid, flags, value, ovalue)
-+     timer_t timerid;
-+     int flags;
-+     const struct itimerspec *value;
-+     struct itimerspec *ovalue;
-+{
-+      struct timer *kt = __kfreebsd_timer_id2ptr (timerid);
-+      if (! kt)
-+	return -1;
-+
-+      /* Set the kernel timer object.  */
-+      return INLINE_SYSCALL (ktimer_settime, 4, kt->ktimerid, flags,
-+				value, ovalue);
-+
-+}
---- /dev/null
-+++ b/ports/sysdeps/unix/bsd/bsd4.4/kfreebsd/linuxthreads/unregister-atfork.c
-@@ -0,0 +1 @@
-+#include <linuxthreads/sysdeps/unix/sysv/linux/unregister-atfork.c>
---- /dev/null
 +++ b/ports/sysdeps/unix/bsd/bsd4.4/kfreebsd/llseek.c
 @@ -0,0 +1,6 @@
 +/* We don't need a definition since the lseek64 function is what we need.  */
@@ -20311,301 +18542,6 @@
 +
 +#define ENTRY_POINT __start
 --- /dev/null
-+++ b/ports/sysdeps/unix/bsd/bsd4.4/kfreebsd/mips/linuxthreads/pt-machine.h
-@@ -0,0 +1,52 @@
-+/* Machine-dependent pthreads configuration and inline functions.
-+   MIPS kFreeBSD version.
-+   Copyright (C) 2001, 2002, 2003, 2004, 2010 Free Software Foundation, Inc.
-+   This file is part of the GNU C Library.
-+
-+   The GNU C Library is free software; you can redistribute it and/or
-+   modify it under the terms of the GNU Lesser General Public
-+   License as published by the Free Software Foundation; either
-+   version 2.1 of the License, or (at your option) any later version.
-+
-+   The GNU C Library is distributed in the hope that it will be useful,
-+   but WITHOUT ANY WARRANTY; without even the implied warranty of
-+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-+   Lesser General Public License for more details.
-+
-+   You should have received a copy of the GNU Lesser General Public
-+   License along with the GNU C Library; if not, write to the Free
-+   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-+   02111-1307 USA.  */
-+
-+#ifndef _FREEBSD_PT_MACHINE_H
-+#define _FREEBSD_PT_MACHINE_H   1
-+
-+#define HAVE___THREAD 1
-+#define USE_TLS 1
-+
-+/*
-+  almost all parts are common with linux version
-+ */
-+
-+#include <linuxthreads/sysdeps/mips/pt-machine.h>
-+
-+#ifndef __ASSEMBLER__
-+
-+/* and only one FreeBSD specifics */
-+
-+#include <machine/sysarch.h>
-+
-+/* Initialize the thread-unique value. */
-+
-+#undef INIT_THREAD_SELF
-+#define INIT_THREAD_SELF(descr, nr)			\
-+  {							\
-+    if (sysarch (MIPS_SET_TLS, descr) != 0)		\
-+      {							\
-+	abort();					\
-+      }							\
-+  }
-+
-+#endif /* !__ASSEMBLER__ */
-+
-+#endif /* pt-machine.h */
---- /dev/null
-+++ b/ports/sysdeps/unix/bsd/bsd4.4/kfreebsd/mips/linuxthreads/sysdep-cancel.h
-@@ -0,0 +1,29 @@
-+/* Copyright (C) 2010 Free Software Foundation, Inc.
-+   This file is part of the GNU C Library.
-+   Contributed by Robert Millan.
-+
-+   The GNU C Library is free software; you can redistribute it and/or
-+   modify it under the terms of the GNU Lesser General Public
-+   License as published by the Free Software Foundation; either
-+   version 2.1 of the License, or (at your option) any later version.
-+
-+   The GNU C Library is distributed in the hope that it will be useful,
-+   but WITHOUT ANY WARRANTY; without even the implied warranty of
-+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-+   Lesser General Public License for more details.
-+
-+   You should have received a copy of the GNU Lesser General Public
-+   License along with the GNU C Library; if not, write to the Free
-+   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-+   02111-1307 USA.  */
-+
-+#include <linuxthreads/sysdeps/unix/sysv/linux/mips/sysdep-cancel.h>
-+
-+/* workarounds for http://sources.redhat.com/bugzilla/show_bug.cgi?id=12300 */
-+#ifdef __ASSEMBLER__
-+# if !defined NOT_IN_libc || defined IS_IN_libpthread || defined IS_IN_librt
-+#  define RTLD_SINGLE_THREAD_P(reg) SINGLE_THREAD_P(reg)
-+# endif
-+#else
-+# define RTLD_SINGLE_THREAD_P SINGLE_THREAD_P
-+#endif
---- /dev/null
-+++ b/ports/sysdeps/unix/bsd/bsd4.4/kfreebsd/mips/linuxthreads/tls.h
-@@ -0,0 +1,205 @@
-+/* Definitions for thread-local data handling.  linuxthreads/MIPS version.
-+   Copyright (C) 2005 Free Software Foundation, Inc.
-+   This file is part of the GNU C Library.
-+
-+   The GNU C Library is free software; you can redistribute it and/or
-+   modify it under the terms of the GNU Lesser General Public
-+   License as published by the Free Software Foundation; either
-+   version 2.1 of the License, or (at your option) any later version.
-+
-+   The GNU C Library is distributed in the hope that it will be useful,
-+   but WITHOUT ANY WARRANTY; without even the implied warranty of
-+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-+   Lesser General Public License for more details.
-+
-+   You should have received a copy of the GNU Lesser General Public
-+   License along with the GNU C Library; if not, write to the Free
-+   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-+   02111-1307 USA.  */
-+
-+#ifndef _TLS_H
-+#define _TLS_H
-+
-+#ifndef __ASSEMBLER__
-+
-+# include <stdbool.h>
-+# include <pt-machine.h>
-+# include <stddef.h>
-+
-+/* Type for the dtv.  */
-+typedef union dtv
-+{
-+  size_t counter;
-+  struct
-+  {
-+    void *val;
-+    bool is_static;
-+  } pointer;
-+} dtv_t;
-+
-+# define READ_THREAD_POINTER() \
-+    ({ void *__result;							      \
-+       asm volatile (".set\tpush\n\t.set\tmips32r2\n\t"			      \
-+		     "rdhwr\t%0, $29\n\t.set\tpop" : "=v" (__result));	      \
-+       __result; })
-+
-+#else /* __ASSEMBLER__ */
-+# include <tcb-offsets.h>
-+
-+/* Note: rd must be $v1 to be ABI-conformant.  */
-+# define READ_THREAD_POINTER(rd) \
-+	.set	push;							      \
-+	.set	mips32r2;						      \
-+	rdhwr	rd, $29;						      \
-+	.set	pop
-+#endif /* __ASSEMBLER__ */
-+
-+/* LinuxThreads can only use TLS if both floating stacks (in the MIPS case,
-+   that means support for "rdhwr") and support from the tools are available.
-+
-+   We have to define USE_TLS consistently, or ldsodefs.h will lay out types
-+   differently between an NPTL build and a LinuxThreads build.  It can be set
-+   for libc.so and not libpthread.so, but only if we provide appropriate padding
-+   in the _pthread_descr_struct.
-+
-+   Currently nothing defines FLOATING_STACKS.  We could assume this based on
-+   kernel version once the TLS patches are available in kernel.org, but
-+   it hardly seems worth it.  Use NPTL if you can.
-+
-+   To avoid bothering with the TLS support code at all, use configure
-+   --without-tls.  */
-+
-+#if defined FLOATING_STACKS || !defined IS_IN_libpthread
-+
-+/* Signal that TLS support is available.  */
-+# define USE_TLS	1
-+
-+/* Include padding in _pthread_descr_struct so that libc can find p_errno,
-+   if libpthread will only include the padding because of the !IS_IN_libpthread
-+   check.  */
-+#ifndef FLOATING_STACKS
-+# define INCLUDE_TLS_PADDING	1
-+#endif
-+
-+# ifndef __ASSEMBLER__
-+
-+/* This layout is actually wholly private and not affected by the ABI.
-+   Nor does it overlap the pthread data structure, so we need nothing
-+   extra here at all.  */
-+typedef struct
-+{
-+  dtv_t *dtv;
-+  void *private;
-+# ifdef __FreeBSD_kernel__
-+  long gscope_flag;
-+# else
-+  int gscope_flag;
-+# endif
-+} tcbhead_t;
-+
-+/* This is the size of the initial TCB.  */
-+#  define TLS_INIT_TCB_SIZE	0
-+
-+/* Alignment requirements for the initial TCB.  */
-+#  define TLS_INIT_TCB_ALIGN	__alignof__ (struct _pthread_descr_struct)
-+
-+/* This is the size of the TCB.  */
-+#  define TLS_TCB_SIZE		0
-+
-+/* Alignment requirements for the TCB.  */
-+#  define TLS_TCB_ALIGN		__alignof__ (struct _pthread_descr_struct)
-+
-+/* This is the size we need before TCB.  */
-+#  define TLS_PRE_TCB_SIZE \
-+  (sizeof (struct _pthread_descr_struct)				      \
-+   + ((sizeof (tcbhead_t) + TLS_TCB_ALIGN - 1) & ~(TLS_TCB_ALIGN - 1)))
-+
-+/* The thread pointer (in hardware register $29) points to the end of
-+   the TCB + 0x7000, as for PowerPC.  The pthread_descr structure is
-+   immediately in front of the TCB.  */
-+#define TLS_TCB_OFFSET		0x7000
-+
-+/* The DTV is allocated at the TP; the TCB is placed elsewhere.  */
-+/* This is not really true for powerpc64.  We are following alpha
-+   where the DTV pointer is first doubleword in the TCB.  */
-+#  define TLS_DTV_AT_TP 1
-+
-+/* Install the dtv pointer.  The pointer passed is to the element with
-+   index -1 which contain the length.  */
-+#  define INSTALL_DTV(TCBP, DTVP) \
-+  (((tcbhead_t *) (TCBP))[-1].dtv = (DTVP) + 1)
-+
-+/* Install new dtv for current thread.  */
-+#  define INSTALL_NEW_DTV(DTV) (THREAD_DTV() = (DTV))
-+
-+/* Return dtv of given thread descriptor.  */
-+#  define GET_DTV(TCBP)	(((tcbhead_t *) (TCBP))[-1].dtv)
-+
-+/* Get system call information.  */
-+#  include <sysdep.h>
-+#  include <machine/sysarch.h>
-+
-+/* Code to initially initialize the thread pointer.  This might need
-+   special attention since 'errno' is not yet available and if the
-+   operation can cause a failure 'errno' must not be touched.  */
-+# define TLS_INIT_TP(tcbp, secondcall)					\
-+  ({ INTERNAL_SYSCALL_DECL (err);					\
-+  long result_var;							\
-+  result_var = INTERNAL_SYSCALL (sysarch, err, 2,			\
-+				 MIPS_SET_TLS,				\
-+				 (char *) (tcbp) + TLS_TCB_OFFSET);	\
-+  INTERNAL_SYSCALL_ERROR_P (result_var, err)				\
-+    ? "unknown error" : NULL; })
-+
-+/* Return the address of the dtv for the current thread.  */
-+# define THREAD_DTV() \
-+  (((tcbhead_t *) (READ_THREAD_POINTER () - TLS_TCB_OFFSET))[-1].dtv)
-+
-+/* Return the thread descriptor for the current thread.  */
-+#  undef THREAD_SELF
-+#  define THREAD_SELF \
-+    ((pthread_descr) (READ_THREAD_POINTER () \
-+		      - TLS_TCB_OFFSET - TLS_PRE_TCB_SIZE))
-+
-+/* Get the thread descriptor definition.  */
-+#  include <linuxthreads/descr.h>
-+
-+/* l_tls_offset == 0 is perfectly valid on MIPS, so we have to use some
-+   different value to mean unset l_tls_offset.  */
-+#  define NO_TLS_OFFSET	-1
-+
-+/* Initializing the thread pointer requires a syscall which may not be
-+   available, so don't do it if we don't need to.  */
-+#  define TLS_INIT_TP_EXPENSIVE 1
-+
-+
-+// fix based on local-linuxthreads-gscope.diff from debian
-+
-+/* Get and set the global scope generation counter in struct pthread.  */
-+#  define THREAD_GSCOPE_FLAG_UNUSED 0
-+#  define THREAD_GSCOPE_FLAG_USED   1
-+#  define THREAD_GSCOPE_FLAG_WAIT   2
-+#  define THREAD_GSCOPE_RESET_FLAG()					\
-+  do									\
-+    { int __res								\
-+	= atomic_exchange_rel (&THREAD_SELF->p_gscope_flag,		\
-+			       THREAD_GSCOPE_FLAG_UNUSED);		\
-+      if (__res == THREAD_GSCOPE_FLAG_WAIT)				\
-+	lll_futex_wake (&THREAD_SELF->p_gscope_flag, 1);		\
-+    }									\
-+  while (0)
-+#  define THREAD_GSCOPE_SET_FLAG()					\
-+  do									\
-+    {									\
-+      THREAD_SELF->p_gscope_flag = THREAD_GSCOPE_FLAG_USED;		\
-+      atomic_write_barrier ();						\
-+    }									\
-+  while (0)
-+#  define THREAD_GSCOPE_WAIT()			\
-+  GL(dl_wait_lookup_done) ()
-+
-+# endif /* __ASSEMBLER__ */
-+
-+#endif /* FLOATING_STACKS || !IS_IN_libpthread */
-+
-+#endif	/* tls.h */
---- /dev/null
 +++ b/ports/sysdeps/unix/bsd/bsd4.4/kfreebsd/mips/mips32/Makefile
 @@ -0,0 +1,2 @@
 +# pull in __syscall_error routine (needed by sysdep.h in this directory)
@@ -23554,7 +21490,7 @@
 +   O_LARGEFILE == 0.  */
 --- /dev/null
 +++ b/ports/sysdeps/unix/bsd/bsd4.4/kfreebsd/openat.c
-@@ -0,0 +1,74 @@
+@@ -0,0 +1,73 @@
 +/* Copyright (C) 2005, 2006, 2007 Free Software Foundation, Inc.
 +   This file is part of the GNU C Library.
 +
@@ -23582,7 +21518,6 @@
 +#include <sysdep.h>
 +#include <sys/stat.h>
 +#include <sys/time.h>
-+#include <sys/sysctl.h>
 +#include <sys/user.h>
 +#include <kernel-features.h>
 +#include <sysdep-cancel.h>
@@ -23713,7 +21648,7 @@
 +#endif /* !_PATHS_H_ */
 --- /dev/null
 +++ b/ports/sysdeps/unix/bsd/bsd4.4/kfreebsd/posix_fadvise.c
-@@ -0,0 +1,52 @@
+@@ -0,0 +1,51 @@
 +/* Copyright (C) 2013 Free Software Foundation, Inc.
 +   This file is part of the GNU C Library.
 +
@@ -23741,7 +21676,6 @@
 +#include <string.h>
 +#include <sysdep.h>
 +#include <sys/stat.h>
-+#include <sys/sysctl.h>
 +#include <sys/user.h>
 +#include <kernel-features.h>
 +
@@ -23960,7 +21894,7 @@
 +libc_hidden_def (__profile_frequency)
 --- /dev/null
 +++ b/ports/sysdeps/unix/bsd/bsd4.4/kfreebsd/ptsname.c
-@@ -0,0 +1,110 @@
+@@ -0,0 +1,109 @@
 +/* Copyright (C) 1998-2013 Free Software Foundation, Inc.
 +   This file is part of the GNU C Library.
 +
@@ -23985,7 +21919,6 @@
 +#include <sys/ioctl.h>
 +#include <sys/stat.h>
 +#include <sys/sysmacros.h>
-+#include <sys/sysctl.h>
 +#include <termios.h>
 +#include <unistd.h>
 +
@@ -28268,7 +26201,7 @@
 +#include <sysdeps/posix/telldir.c>
 --- /dev/null
 +++ b/ports/sysdeps/unix/bsd/bsd4.4/kfreebsd/testrtsig.h
-@@ -0,0 +1,31 @@
+@@ -0,0 +1,30 @@
 +/* Test whether RT signals are really available.
 +   Copyright (C) 2008 Free Software Foundation, Inc.
 +   This file is part of the GNU C Library.
@@ -28288,7 +26221,6 @@
 +   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
 +   02111-1307 USA.  */
 +
-+#include <sys/sysctl.h>
 +#include <errno.h>
 +#include <string.h>
 +
@@ -30912,7 +28844,7 @@
 --- /dev/null
 +++ b/ports/sysdeps/unix/bsd/bsd4.4/kfreebsd/x86_64/fbtl/tls.h
 @@ -0,0 +1,73 @@
-+/* Definitions for thread-local data handling.  linuxthreads/x86-64 version.
++/* Definitions for thread-local data handling.  fbtl/x86-64 version.
 +   Copyright (C) 2002 Free Software Foundation, Inc.
 +   This file is part of the GNU C Library.
 +   Modification for FreeBSD by Petr Salinger, 2006.
@@ -31152,354 +29084,6 @@
 +add_env="$add_env LD_LIBRARY_VERSION=\\$verify_out"
 +s_^\(RTLDLIST=\)\(.*lib\)\(\|64\)\(/[^/]*\)\(-kfreebsd-x86-64\)\(\.so\.[0-9.]*\)[ 	]*$_\1"\2\4\6 \2\4\5\6"_
 --- /dev/null
-+++ b/ports/sysdeps/unix/bsd/bsd4.4/kfreebsd/x86_64/linuxthreads/Makefile
-@@ -0,0 +1,4 @@
-+ifeq ($(subdir),linuxthreads)
-+CFLAGS-pt-initfini.s = -g0 -fPIC -fno-inline-functions \
-+		       -fno-asynchronous-unwind-tables $(fno-unit-at-a-time)
-+endif
---- /dev/null
-+++ b/ports/sysdeps/unix/bsd/bsd4.4/kfreebsd/x86_64/linuxthreads/asm/prctl.h
-@@ -0,0 +1 @@
-+/* placeholder to make linuxthreads/sysdeps/x86_64/pt-machine.h happy */
---- /dev/null
-+++ b/ports/sysdeps/unix/bsd/bsd4.4/kfreebsd/x86_64/linuxthreads/pt-machine.h
-@@ -0,0 +1,54 @@
-+/* Machine-dependent pthreads configuration and inline functions.
-+   x86-64 FreeBSD version.
-+   Copyright (C) 2001, 2002, 2003, 2004 Free Software Foundation, Inc.
-+   This file is part of the GNU C Library.
-+
-+   The GNU C Library is free software; you can redistribute it and/or
-+   modify it under the terms of the GNU Lesser General Public
-+   License as published by the Free Software Foundation; either
-+   version 2.1 of the License, or (at your option) any later version.
-+
-+   The GNU C Library is distributed in the hope that it will be useful,
-+   but WITHOUT ANY WARRANTY; without even the implied warranty of
-+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-+   Lesser General Public License for more details.
-+
-+   You should have received a copy of the GNU Lesser General Public
-+   License along with the GNU C Library; if not, write to the Free
-+   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-+   02111-1307 USA.  */
-+
-+#ifndef _FREEBSD_PT_MACHINE_H
-+#define _FREEBSD_PT_MACHINE_H   1
-+
-+#define HAVE___THREAD 1
-+#define USE_TLS 1
-+
-+/*
-+  almost all parts are common with linux version
-+ */
-+
-+#include <linuxthreads/sysdeps/x86_64/pt-machine.h>
-+
-+#ifndef __ASSEMBLER__
-+
-+/* and only one FreeBSD specifics */
-+
-+#include <sysarch.h>
-+
-+/* Initialize the thread-unique value. */
-+
-+#undef INIT_THREAD_SELF
-+#define INIT_THREAD_SELF(descr, nr)             \
-+{                                               \
-+  long tmp;                                     \
-+  tmp = (long) descr;                           \
-+  if (sysarch(AMD64_SET_FSBASE, &tmp)  != 0)    \
-+  {                                             \
-+    abort();                                    \
-+  }                                             \
-+}
-+
-+#endif /* !__ASSEMBLER__ */
-+
-+#endif /* pt-machine.h */
---- /dev/null
-+++ b/ports/sysdeps/unix/bsd/bsd4.4/kfreebsd/x86_64/linuxthreads/sysdep-cancel.h
-@@ -0,0 +1,145 @@
-+/* Copyright (C) 2002, 2003 Free Software Foundation, Inc.
-+   This file is part of the GNU C Library.
-+   Contributed by Jakub Jelinek <jakub@redhat.com>, 2002.
-+   Modification for FreeBSD contributed by Petr Salinger, 2006.
-+
-+   The GNU C Library is free software; you can redistribute it and/or
-+   modify it under the terms of the GNU Lesser General Public
-+   License as published by the Free Software Foundation; either
-+   version 2.1 of the License, or (at your option) any later version.
-+
-+   The GNU C Library is distributed in the hope that it will be useful,
-+   but WITHOUT ANY WARRANTY; without even the implied warranty of
-+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-+   Lesser General Public License for more details.
-+
-+   You should have received a copy of the GNU Lesser General Public
-+   License along with the GNU C Library; if not, write to the Free
-+   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-+   02111-1307 USA.  */
-+
-+#include <sysdep.h>
-+#include <tls.h>
-+#include <pt-machine.h>
-+#ifndef __ASSEMBLER__
-+# include <linuxthreads/internals.h>
-+#endif
-+
-+/* Syscalls with more than 6 arguments are not supported here.  */
-+
-+#if !defined NOT_IN_libc || defined IS_IN_libpthread || defined IS_IN_librt
-+
-+# undef PSEUDO
-+# define PSEUDO(name, syscall_name, args)				      \
-+  .text;								      \
-+  ENTRY (name)								      \
-+    SINGLE_THREAD_P;							      \
-+    jne L(pseudo_cancel);						      \
-+    DO_CALL (syscall_name, args);					      \
-+    jb SYSCALL_ERROR_LABEL;						      \
-+    ret;								      \
-+  L(pseudo_cancel):							      \
-+    /* Save registers that might get destroyed.  */			      \
-+    SAVESTK_##args							      \
-+    PUSHARGS_##args							      \
-+    CENABLE								      \
-+    /* Restore registers.  */						      \
-+    POPARGS_##args							      \
-+    RESTSTK_##args							      \
-+    /* The return value from CENABLE is argument for CDISABLE.  */	      \
-+    movq %rax, (%rsp);							      \
-+    movl $SYS_ify (syscall_name), %eax;					      \
-+    syscall;								      \
-+    popq %rdi; cfi_adjust_cfa_offset(-8);				      \
-+    pushfq; cfi_adjust_cfa_offset(8);					      \
-+    /* Save %rax since it's the return/error code from the syscall.  */	      \
-+    movq %rax, 8(%rsp);							      \
-+    CDISABLE								      \
-+    popfq; cfi_adjust_cfa_offset(-8);                                         \
-+    /* fetch the error code from the syscall.  */              		      \
-+    popq %rax; cfi_adjust_cfa_offset(-8);                                     \
-+    /* adjust rsp, do not change flags	*/				      \
-+    popq %rdx; cfi_adjust_cfa_offset(-8);                                     \
-+    jb SYSCALL_ERROR_LABEL;						      \
-+  L(pseudo_end):
-+
-+# define PUSHARGS_0	/* Nothing.  */
-+# define PUSHARGS_1	PUSHARGS_0 movq %rdi, 8(%rsp);
-+# define PUSHARGS_2	PUSHARGS_1 movq %rsi, 16(%rsp);
-+# define PUSHARGS_3	PUSHARGS_2 movq %rdx, 24(%rsp);
-+# define PUSHARGS_4	PUSHARGS_3 movq %rcx, 32(%rsp);
-+# define PUSHARGS_5	PUSHARGS_4 movq %r8, 40(%rsp);
-+# define PUSHARGS_6	PUSHARGS_5 movq %r9, 48(%rsp);
-+
-+# define POPARGS_0	/* Nothing.  */
-+# define POPARGS_1	POPARGS_0 movq 8(%rsp), %rdi;
-+# define POPARGS_2	POPARGS_1 movq 16(%rsp), %rsi;
-+# define POPARGS_3	POPARGS_2 movq 24(%rsp), %rdx;
-+# define POPARGS_4	POPARGS_3 movq 32(%rsp), %r10;
-+# define POPARGS_5	POPARGS_4 movq 40(%rsp), %r8;
-+# define POPARGS_6	POPARGS_5 movq 48(%rsp), %r9;
-+
-+/* We always have to align the stack before calling a function.  */
-+# define SAVESTK_0	subq $24, %rsp;cfi_adjust_cfa_offset(24);
-+# define SAVESTK_1	SAVESTK_0
-+# define SAVESTK_2	SAVESTK_1
-+# define SAVESTK_3	subq $40, %rsp;cfi_adjust_cfa_offset(40);
-+# define SAVESTK_4	SAVESTK_3
-+# define SAVESTK_5	subq $56, %rsp;cfi_adjust_cfa_offset(56);
-+# define SAVESTK_6	SAVESTK_5
-+
-+# define RESTSTK_0	/* Nothing.  */
-+# define RESTSTK_1	RESTSTK_0
-+# define RESTSTK_2	RESTSTK_1
-+# define RESTSTK_3	addq $16, %rsp;cfi_adjust_cfa_offset(-16);
-+# define RESTSTK_4	RESTSTK_3
-+# define RESTSTK_5	addq $32, %rsp;cfi_adjust_cfa_offset(-32);
-+# define RESTSTK_6	RESTSTK_5
-+
-+# ifdef IS_IN_libpthread
-+#  define CENABLE	call __pthread_enable_asynccancel;
-+#  define CDISABLE	call __pthread_disable_asynccancel;
-+#  define __local_multiple_threads __pthread_multiple_threads
-+# elif !defined NOT_IN_libc
-+#  define CENABLE	call __libc_enable_asynccancel;
-+#  define CDISABLE	call __libc_disable_asynccancel;
-+#  define __local_multiple_threads __libc_multiple_threads
-+# else
-+#  define CENABLE	call __librt_enable_asynccancel@plt;
-+#  define CDISABLE	call __librt_disable_asynccancel@plt;
-+# endif
-+
-+# if defined IS_IN_libpthread || !defined NOT_IN_libc
-+#  ifndef __ASSEMBLER__
-+extern int __local_multiple_threads attribute_hidden;
-+#   define SINGLE_THREAD_P \
-+  __builtin_expect (__local_multiple_threads == 0, 1)
-+#  else
-+#   define SINGLE_THREAD_P cmpl $0, __local_multiple_threads(%rip)
-+#  endif
-+
-+# else
-+
-+#  ifndef __ASSEMBLER__
-+#   define SINGLE_THREAD_P \
-+  __builtin_expect (THREAD_GETMEM (THREAD_SELF, \
-+				   p_header.data.multiple_threads) == 0, 1)
-+#  else
-+#   define SINGLE_THREAD_P cmpl $0, %fs:MULTIPLE_THREADS_OFFSET
-+#  endif
-+
-+# endif
-+
-+#elif !defined __ASSEMBLER__
-+
-+/* This code should never be used but we define it anyhow.  */
-+# define SINGLE_THREAD_P (1)
-+# define NO_CANCELLATION 1
-+
-+#endif
-+
-+#ifndef __ASSEMBLER__
-+# define RTLD_SINGLE_THREAD_P \
-+  __builtin_expect (THREAD_GETMEM (THREAD_SELF, \
-+                                     p_header.data.multiple_threads) == 0, 1)
-+#endif
---- /dev/null
-+++ b/ports/sysdeps/unix/bsd/bsd4.4/kfreebsd/x86_64/linuxthreads/tls.h
-@@ -0,0 +1,59 @@
-+/* Definitions for thread-local data handling.  linuxthreads/x86-64 version.
-+   Copyright (C) 2002 Free Software Foundation, Inc.
-+   This file is part of the GNU C Library.
-+   Modification for FreeBSD by Petr Salinger, 2006.
-+
-+   The GNU C Library is free software; you can redistribute it and/or
-+   modify it under the terms of the GNU Lesser General Public
-+   License as published by the Free Software Foundation; either
-+   version 2.1 of the License, or (at your option) any later version.
-+
-+   The GNU C Library is distributed in the hope that it will be useful,
-+   but WITHOUT ANY WARRANTY; without even the implied warranty of
-+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-+   Lesser General Public License for more details.
-+
-+   You should have received a copy of the GNU Lesser General Public
-+   License along with the GNU C Library; if not, write to the Free
-+   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-+   02111-1307 USA.  */
-+
-+#ifndef _FREEBSD_TLS_H
-+#define _FREEBSD_TLS_H
-+
-+#include <linuxthreads/sysdeps/x86_64/tls.h>
-+
-+#ifndef __ASSEMBLER__
-+
-+#include <sysarch.h>
-+#include <sys/syscall.h>
-+
-+/* Code to initially initialize the thread pointer.  This might need
-+   special attention since 'errno' is not yet available and if the
-+   operation can cause a failure 'errno' must not be touched.  */
-+
-+# undef TLS_INIT_TP
-+# define TLS_INIT_TP(descr, secondcall)					      \
-+  ({									      \
-+    void *_descr = (descr);						      \
-+    tcbhead_t *head = _descr;						      \
-+    long int _result;							      \
-+									      \
-+    head->tcb = _descr;							      \
-+    /* For now the thread descriptor is at the same address.  */	      \
-+    head->self = _descr;						      \
-+									      \
-+    asm volatile ("syscall"						      \
-+		  : "=a" (_result)					      \
-+		  : "0" ((unsigned long int) SYS_sysarch),		      \
-+		    "D" ((unsigned long int) AMD64_SET_FSBASE),		      \
-+		    "S" (&_descr)					      \
-+		  : "memory", "cc", "cx", "dx", "r8", "r9", "r10", "r11");    \
-+									      \
-+    _result ? "cannot set %fs base address for thread-local storage" : 0;     \
-+  })
-+
-+
-+#endif /* __ASSEMBLER__ */
-+
-+#endif	/* tls.h */
---- /dev/null
-+++ b/ports/sysdeps/unix/bsd/bsd4.4/kfreebsd/x86_64/linuxthreads/vfork.S
-@@ -0,0 +1,67 @@
-+/* Copyright (C) 1999, 2002 Free Software Foundation, Inc.
-+   This file is part of the GNU C Library.
-+
-+   The GNU C Library is free software; you can redistribute it and/or
-+   modify it under the terms of the GNU Lesser General Public
-+   License as published by the Free Software Foundation; either
-+   version 2.1 of the License, or (at your option) any later version.
-+
-+   The GNU C Library is distributed in the hope that it will be useful,
-+   but WITHOUT ANY WARRANTY; without even the implied warranty of
-+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-+   Lesser General Public License for more details.
-+
-+   You should have received a copy of the GNU Lesser General Public
-+   License along with the GNU C Library; if not, write to the Free
-+   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-+   02111-1307 USA.  */
-+
-+#include <sysdep.h>
-+
-+/* Clone the calling process, but without copying the whole address space.
-+   The calling process is suspended until the new process exits or is
-+   replaced by a call to `execve'.  Return -1 for errors, 0 to the new process,
-+   and the process ID of the new process to the old process.  */
-+
-+ENTRY (__vfork)
-+
-+#ifdef SHARED
-+	cmpq	$0, __libc_pthread_functions(%rip)
-+#else
-+	.weak	pthread_create
-+	movq	$pthread_create, %rax
-+	testq	%rax, %rax
-+#endif
-+	jne	HIDDEN_JUMPTARGET (__fork)
-+
-+	/* Pop the return PC value into ESI.  */
-+	popq	%rsi
-+	cfi_adjust_cfa_offset(-8)
-+
-+	/* Perform the system call.  */
-+	DO_CALL (vfork, 0)
-+	jb	L(error)	/* Branch forward if it failed.  */
-+
-+	/* In the parent process, %rdx == 0, %rax == child pid.  */
-+	/* In the child process, %rdx == 1, %rax == parent pid.  */
-+
-+	/* Change %rax to be 0 in the child process.  */
-+	decq	%rdx
-+	andq	%rdx, %rax
-+
-+	/* Jump to the return PC.  */
-+	jmp	*%rsi
-+
-+L(error):
-+	/* Push back the return PC.  */
-+	pushq	%rsi
-+	cfi_adjust_cfa_offset(8)
-+
-+	/* Branch to the error handler, hidden in PSEUDO_END.  */
-+	jmp	SYSCALL_ERROR_LABEL
-+L(pseudo_end):
-+	ret
-+PSEUDO_END (__vfork)
-+libc_hidden_def (__vfork)
-+
-+weak_alias (__vfork, vfork)
---- /dev/null
 +++ b/ports/sysdeps/unix/bsd/bsd4.4/kfreebsd/x86_64/makecontext.S
 @@ -0,0 +1,146 @@
 +/* makecontext() for FreeBSD/amd64.
@@ -33152,7 +30736,7 @@
 +weak_alias (__xmknod, _xmknod)
 --- /dev/null
 +++ b/ports/sysdeps/unix/bsd/bsd4.4/kfreebsd/xmknodat.c
-@@ -0,0 +1,60 @@
+@@ -0,0 +1,59 @@
 +/* Copyright (C) 2009 Free Software Foundation, Inc.
 +   This file is part of the GNU C Library.
 +
@@ -33180,7 +30764,6 @@
 +#include <string.h>
 +#include <sysdep.h>
 +#include <sys/stat.h>
-+#include <sys/sysctl.h>
 +#include <sys/user.h>
 +#include <kernel-features.h>
 +



Reply to: