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

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



Author: ps-guest
Date: 2013-10-13 18:07:37 +0000 (Sun, 13 Oct 2013)
New Revision: 5732

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



Modified: glibc-package/branches/eglibc-2.18/debian/changelog
===================================================================
--- glibc-package/branches/eglibc-2.18/debian/changelog	2013-10-13 18:06:36 UTC (rev 5731)
+++ glibc-package/branches/eglibc-2.18/debian/changelog	2013-10-13 18:07:37 UTC (rev 5732)
@@ -61,7 +61,7 @@
     expected-results-i686-gnu-i386: Update testsuite result.
 
   [ Petr Salinger ]
-  * kfreebsd/local-sysdeps.diff: update to revision xxxx (from glibc-bsd).
+  * kfreebsd/local-sysdeps.diff: update to revision 5050 (from glibc-bsd).
   * kfreebsd/local-fbtl.diff: likewise
   * update symbols file for kfreebsd
   * update testsuite-checking/expected-results-*-kfreebsd-gnu-*

Modified: glibc-package/branches/eglibc-2.18/debian/patches/kfreebsd/local-fbtl.diff
===================================================================
--- glibc-package/branches/eglibc-2.18/debian/patches/kfreebsd/local-fbtl.diff	2013-10-13 18:06:36 UTC (rev 5731)
+++ glibc-package/branches/eglibc-2.18/debian/patches/kfreebsd/local-fbtl.diff	2013-10-13 18:07:37 UTC (rev 5732)
@@ -13472,7 +13472,7 @@
 +sysd-rules-patterns += ptw-%:%
 --- /dev/null
 +++ b/fbtl/Makefile
-@@ -0,0 +1,619 @@
+@@ -0,0 +1,655 @@
 +# Copyright (C) 2002-2013 Free Software Foundation, Inc.
 +# This file is part of the GNU C Library.
 +
@@ -13493,7 +13493,6 @@
 +#
 +#	Sub-makefile for NPTL portion of the library.
 +#
-+
 +include ../option-groups.mak
 +
 +subdir	:= fbtl
@@ -13590,16 +13589,18 @@
 +		      pt-raise pt-system \
 +		      flockfile ftrylockfile funlockfile \
 +		      sigaction \
-+		      herrno res pt-allocrtsig \
++		      pt-allocrtsig \
 +		      pthread_kill_other_threads \
++		      pthread_getaffinity pthread_setaffinity \
++		      pthread_attr_getaffinity pthread_attr_setaffinity \
 +		      cleanup_routine unwind-forcedunwind \
++		      pthread_setname pthread_getname \
 +
-+# 		lowlevelrobustlock
++#		lowlevelrobustlock
 +#		pthread_sigqueue
-+		      
++
 +# post linuxthreads interfaces
-+#		      pthread_getaffinity pthread_setaffinity \
-+#		      pthread_attr_getaffinity pthread_attr_setaffinity \
++
 +#		      pthread_mutexattr_getrobust pthread_mutexattr_setrobust \
 +#		      pthread_mutex_consistent \
 +#		      pthread_mutexattr_getprotocol \
@@ -13608,16 +13609,17 @@
 +#		      pthread_mutexattr_setprioceiling tpp \
 +#		      pthread_mutex_getprioceiling \
 +#		      pthread_mutex_setprioceiling \
-+#		      pthread_setname pthread_getname \
 +#		      pthread_setattr_default_np pthread_getattr_default_np
-+		      
-+		      
++
 +# commented out also in nptl
++
 +#		      pthread_setuid pthread_seteuid pthread_setreuid \
 +#		      pthread_setresuid \
 +#		      pthread_setgid pthread_setegid pthread_setregid \
 +#		      pthread_setresgid
 +
++libpthread-routines-$(OPTION_EGLIBC_INET) := herrno res 
++
 +libpthread-shared-only-routines = version pt-allocrtsig unwind-forcedunwind
 +libpthread-static-only-routines = pthread_atfork
 +
@@ -13728,14 +13730,14 @@
 +	tst-cancel6 tst-cancel7 tst-cancel8 tst-cancel9 tst-cancel10 \
 +	tst-cancel11 tst-cancel12 tst-cancel13 tst-cancel14 tst-cancel15 \
 +	tst-cancel16 tst-cancel17 tst-cancel18 tst-cancel19 tst-cancel20 \
-+	tst-cancel21 tst-cancel22 tst-cancel23 tst-cancel24 tst-cancel25 \
++	tst-cancel21 tst-cancel22 tst-cancel23 tst-cancel25 \
 +	tst-cancel-self tst-cancel-self-cancelstate \
 +	tst-cancel-self-canceltype tst-cancel-self-testcancel \
 +	tst-cleanup0 tst-cleanup1 tst-cleanup2 tst-cleanup3 tst-cleanup4 \
 +	tst-flock1 tst-flock2 \
 +	tst-signal1 tst-signal2 tst-signal3 tst-signal4 tst-signal5 \
 +	tst-signal6 tst-signal7 \
-+	tst-exec1 tst-exec2 tst-exec3 tst-exec4 \
++	tst-exec2 tst-exec3 tst-exec4 \
 +	tst-exit1 tst-exit2 tst-exit3 \
 +	tst-stdio1 tst-stdio2 \
 +	tst-stack1 tst-stack2 tst-stack3 tst-pthread-getattr \
@@ -13743,13 +13745,12 @@
 +	tst-unload \
 +	tst-dlsym1 \
 +	tst-sysconf \
-+	tst-locale1 tst-locale2 \
++	tst-locale2 \
 +	tst-umask1 \
 +	tst-popen1 \
 +	tst-clock1 \
 +	tst-context1 \
 +	tst-sched1 \
-+	tst-backtrace1 \
 +	tst-abstime \
 +	tst-vfork1 tst-vfork2 tst-vfork1x tst-vfork2x \
 +	tst-getpid1 tst-getpid2 tst-getpid3 \
@@ -13757,6 +13758,17 @@
 +xtests = tst-setuid1 tst-setuid1-static tst-mutexpp1 tst-mutexpp6 tst-mutexpp10
 +test-srcs = tst-oddstacklimit
 +
++# This test uses the posix_spawn functions.
++tests-$(OPTION_EGLIBC_SPAWN) += tst-exec1
++
++# This test uses the 'backtrace' functions.
++tests-$(OPTION_EGLIBC_BACKTRACE) += tst-backtrace1
++
++# This test is written in C++.
++tests-$(OPTION_EGLIBC_CXX_TESTS) += tst-cancel24
++
++tests-$(OPTION_EGLIBC_LOCALE_CODE) += tst-locale1 
++
 +# Files which must not be linked with libpthread.
 +tests-nolibpthread = tst-unload
 +
@@ -13775,8 +13787,13 @@
 +	 tst-oncex3 tst-oncex4
 +endif
 +ifeq ($(build-shared),yes)
-+tests += tst-atfork2 tst-tls3 tst-tls4 tst-tls5 tst-_res1 tst-fini1 \
++tests += tst-atfork2 tst-tls3 tst-tls4 tst-tls5 tst-fini1 \
 +	 tst-stackguard1
++ifeq ($(versioning),yes)
++# struct __res_state _res is only available with
++# symbol versioning after GLIBC_2.2.
++tests += tst-_res1
++endif
 +tests-nolibpthread += tst-fini1
 +ifeq ($(have-z-execstack),yes)
 +tests += tst-execstack
@@ -13915,6 +13932,35 @@
 +CFLAGS-tst-cleanupx4.c += -fexceptions
 +CFLAGS-tst-oncex3.c += -fexceptions
 +CFLAGS-tst-oncex4.c += -fexceptions
++
++ldflags-libgcc_s = -Wl,--as-needed -lgcc_s -Wl,--no-as-needed
++LDFLAGS-tst-cancelx2 += $(ldflags-libgcc_s)
++LDFLAGS-tst-cancelx3 += $(ldflags-libgcc_s)
++LDFLAGS-tst-cancelx4 += $(ldflags-libgcc_s)
++LDFLAGS-tst-cancelx5 += $(ldflags-libgcc_s)
++LDFLAGS-tst-cancelx6 += $(ldflags-libgcc_s)
++LDFLAGS-tst-cancelx7 += $(ldflags-libgcc_s)
++LDFLAGS-tst-cancelx8 += $(ldflags-libgcc_s)
++LDFLAGS-tst-cancelx9 += $(ldflags-libgcc_s)
++LDFLAGS-tst-cancelx10 += $(ldflags-libgcc_s)
++LDFLAGS-tst-cancelx11 += $(ldflags-libgcc_s)
++LDFLAGS-tst-cancelx12 += $(ldflags-libgcc_s)
++LDFLAGS-tst-cancelx13 += $(ldflags-libgcc_s)
++LDFLAGS-tst-cancelx14 += $(ldflags-libgcc_s)
++LDFLAGS-tst-cancelx15 += $(ldflags-libgcc_s)
++LDFLAGS-tst-cancelx16 += $(ldflags-libgcc_s)
++LDFLAGS-tst-cancelx17 += $(ldflags-libgcc_s)
++LDFLAGS-tst-cancelx18 += $(ldflags-libgcc_s)
++LDFLAGS-tst-cancelx20 += $(ldflags-libgcc_s)
++LDFLAGS-tst-cancelx21 += $(ldflags-libgcc_s)
++LDFLAGS-tst-cleanupx0 += $(ldflags-libgcc_s)
++LDFLAGS-tst-cleanupx1 += $(ldflags-libgcc_s)
++LDFLAGS-tst-cleanupx2 += $(ldflags-libgcc_s)
++LDFLAGS-tst-cleanupx3 += $(ldflags-libgcc_s)
++LDFLAGS-tst-cleanupx4 += $(ldflags-libgcc_s)
++LDFLAGS-tst-oncex3 += $(ldflags-libgcc_s)
++LDFLAGS-tst-oncex4 += $(ldflags-libgcc_s)
++
 +CFLAGS-tst-align.c += $(stack-align-test-flags)
 +CFLAGS-tst-align3.c += $(stack-align-test-flags)
 +CFLAGS-tst-initializers1.c = -W -Wall -Werror
@@ -13925,7 +13971,7 @@
 +CFLAGS-tst-initializers1-gnu89.c = $(CFLAGS-tst-initializers1-<)
 +CFLAGS-tst-initializers1-gnu99.c = $(CFLAGS-tst-initializers1-<)
 +
-+tst-cancel7-ARGS = --command "exec $(host-built-program-cmd)"
++tst-cancel7-ARGS = --command "exec $(host-test-program-cmd)"
 +tst-cancelx7-ARGS = $(tst-cancel7-ARGS)
 +tst-umask1-ARGS = $(objpfx)tst-umask1.temp
 +
@@ -13965,8 +14011,8 @@
 +		       $(objpfx)tst-tls5moda.so $(objpfx)tst-tls5modb.so \
 +		       $(objpfx)tst-tls5modc.so $(objpfx)tst-tls5modd.so \
 +		       $(objpfx)tst-tls5mode.so $(objpfx)tst-tls5modf.so
-+	$(BASH) $< $(common-objpfx) $(elf-objpfx) \
-+		$(rtld-installed-name) '$(test-wrapper-env)'
++	$(BASH) $< $(common-objpfx) '$(test-via-rtld-prefix)' \
++	  '$(test-wrapper-env)'
 +endif
 +
 +$(objpfx)tst-dlsym1: $(libdl) $(shared-thread-library)
@@ -13995,16 +14041,6 @@
 +$(objpfx)libpthread.so: +preinit += $(addprefix $(objpfx),$(crti-objs))
 +$(objpfx)libpthread.so: +postinit += $(addprefix $(objpfx),$(crtn-objs))
 +
-+# the next rule is pre-2.18 only
-+# Depend on libc.so so a DT_NEEDED is generated in the shared objects.
-+# This ensures they will load libc.so for needed symbols if loaded by
-+# a statically-linked program that hasn't already loaded it.
-+# Depend on ld.so too to get proper versions of ld.so symbols.
-+$(objpfx)libpthread.so: $(common-objpfx)libc.so \
-+			$(common-objpfx)libc_nonshared.a \
-+			$(elfobjdir)/ld.so
-+
-+
 +# Make sure we link with the thread library.
 +ifeq ($(build-shared),yes)
 +$(addprefix $(objpfx), \
@@ -14070,7 +14106,7 @@
 +endif
 +endif
 +
-+tst-exec4-ARGS = $(host-built-program-cmd)
++tst-exec4-ARGS = $(host-test-program-cmd)
 +
 +$(objpfx)tst-execstack: $(libdl)
 +$(objpfx)tst-execstack.out: $(objpfx)tst-execstack-mod.so
@@ -14078,14 +14114,14 @@
 +
 +$(objpfx)tst-fini1mod.so: $(shared-thread-library)
 +
-+tst-stackguard1-ARGS = --command "$(host-built-program-cmd) --child"
++tst-stackguard1-ARGS = --command "$(host-test-program-cmd) --child"
 +tst-stackguard1-static-ARGS = --command "$(objpfx)tst-stackguard1-static --child"
 +
 +ifeq ($(run-built-tests),yes)
 +tests: $(objpfx)tst-oddstacklimit.out
 +
 +$(objpfx)tst-oddstacklimit.out: $(objpfx)tst-oddstacklimit $(objpfx)tst-basic1
-+	$(run-program-prefix) $< --command '$(host-built-program-cmd)' > $@
++	$(test-program-prefix) $< --command '$(host-test-program-cmd)' > $@
 +endif
 +
 +# The tests here better do not run in parallel
@@ -14793,7 +14829,7 @@
 +  what to test?
 --- /dev/null
 +++ b/fbtl/Versions
-@@ -0,0 +1,235 @@
+@@ -0,0 +1,245 @@
 +libc {
 +  GLIBC_2.0 {
 +    pthread_attr_destroy; pthread_attr_init;
@@ -15019,10 +15055,20 @@
 +    # affinity interfaces without size parameter
 +    # have not been in linuxthreads and 
 +    # will be overriden by version from GLIBC_2.3.4
-+    #pthread_getaffinity_np; pthread_setaffinity_np;
-+    #pthread_attr_getaffinity_np; pthread_attr_setaffinity_np;
++    pthread_getaffinity_np; pthread_setaffinity_np;
++    pthread_attr_getaffinity_np; pthread_attr_setaffinity_np;
 +  }
 +
++  GLIBC_2.3.4 {
++    # New affinity interfaces.
++    pthread_getaffinity_np; pthread_setaffinity_np;
++    pthread_attr_getaffinity_np; pthread_attr_setaffinity_np;
++  }
++
++  GLIBC_2.12 {
++    pthread_setname_np; pthread_getname_np;
++  };
++
 +  GLIBC_PRIVATE {
 +    __pthread_initialize_minimal;
 +    __pthread_clock_gettime; __pthread_clock_settime;

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-10-13 18:06:36 UTC (rev 5731)
+++ glibc-package/branches/eglibc-2.18/debian/patches/kfreebsd/local-sysdeps.diff	2013-10-13 18:07:37 UTC (rev 5732)
@@ -139,7 +139,7 @@
 +sysdep_routines += sys_fork sys_execve sys_sigaction sys_close sys_fcntl
 +sysdep_routines += sys_clock_getres sys_clock_gettime sys_clock_settime
 +sysdep_routines += sys_ktimer_create sys_ktimer_gettime sys_ktimer_settime sys_ktimer_getoverrun sys_ktimer_delete
-+sysdep_routines += sys_semctl
++sysdep_routines += sys_semctl sys_shmctl sys_msgctl
 +endif
 +
 +ifeq ($(subdir),posix)
@@ -183,7 +183,7 @@
 +endif
 --- /dev/null
 +++ b/ports/sysdeps/unix/bsd/bsd4.4/kfreebsd/Versions
-@@ -0,0 +1,118 @@
+@@ -0,0 +1,126 @@
 +libc {
 +  # The comment lines with "#errlist-compat" are magic; see errlist-compat.awk.
 +  # When you get an error from errlist-compat.awk, you need to add a new
@@ -284,6 +284,14 @@
 +    jail_get;
 +    jail_set;
 +  }
++  GLIBC_2.18 {
++    msgctl;
++    semctl;
++    shmctl;
++    waitid;
++    #errlist-compat 97
++    _sys_errlist; sys_errlist; _sys_nerr; sys_nerr;
++  }
 +  GLIBC_PRIVATE {
 +    # needed by libpthread.
 +    __clone; __libc_fork; __libc_sigaction; __kernel_getosreldate;
@@ -647,6 +655,53 @@
 +
 +weak_alias (__bind, bind)
 --- /dev/null
++++ b/ports/sysdeps/unix/bsd/bsd4.4/kfreebsd/bits/auxv.h
+@@ -0,0 +1,44 @@
++/* Copyright (C) 1995-2013 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, see
++   <http://www.gnu.org/licenses/>.  */
++
++/* Legal values for a_type (entry type).  */
++
++#define AT_NULL		0		/* End of vector */
++#define AT_IGNORE	1		/* Entry should be ignored */
++#define AT_EXECFD	2		/* File descriptor of program */
++#define AT_PHDR		3		/* Program headers for program */
++#define AT_PHENT	4		/* Size of program header entry */
++#define AT_PHNUM	5		/* Number of program headers */
++#define AT_PAGESZ	6		/* System page size */
++#define AT_BASE		7		/* Base address of interpreter */
++#define AT_FLAGS	8		/* Flags */
++#define AT_ENTRY	9		/* Entry point of program */
++#define AT_NOTELF	10		/* Program is not ELF */
++#define AT_UID		11		/* Real uid */
++#define AT_EUID		12		/* Effective uid */
++#define AT_GID		13		/* Real gid */
++#define AT_EGID		14		/* Effective gid */
++
++#define	AT_EXECPATH	15	/* Path to the executable. */
++#define	AT_CANARY	16	/* Canary for SSP. */
++#define	AT_CANARYLEN	17	/* Length of the canary. */
++#define	AT_OSRELDATE	18	/* OSRELDATE. */
++#define	AT_NCPUS	19	/* Number of CPUs. */
++#define	AT_PAGESIZES	20	/* Pagesizes. */
++#define	AT_PAGESIZESLEN	21	/* Number of pagesizes. */
++#define	AT_STACKPROT	23	/* Initial stack protection. */
++
+--- /dev/null
 +++ b/ports/sysdeps/unix/bsd/bsd4.4/kfreebsd/bits/dirent.h
 @@ -0,0 +1,55 @@
 +/* Directory entry structure `struct dirent'.  FreeBSD version.
@@ -705,48 +760,8 @@
 +/* Inform libc code that these two types are effectively identical.  */
 +# define _DIRENT_MATCHES_DIRENT64       1
 --- /dev/null
-+++ b/ports/sysdeps/unix/bsd/bsd4.4/kfreebsd/bits/elf.h
-@@ -0,0 +1,37 @@
-+/* This file defines standard ELF types, structures, and macros.
-+   Copyright (C) 1995-2003,2004,2005,2006,2007,2008,2009,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_ELF_H
-+#define _BITS_ELF_H
-+
-+__BEGIN_DECLS
-+
-+#define	AT_EXECPATH	15	/* Path to the executable. */
-+#define	AT_CANARY	16	/* Canary for SSP. */
-+#define	AT_CANARYLEN	17	/* Length of the canary. */
-+#define	AT_OSRELDATE	18	/* OSRELDATE. */
-+#define	AT_NCPUS	19	/* Number of CPUs. */
-+#define	AT_PAGESIZES	20	/* Pagesizes. */
-+#define	AT_PAGESIZESLEN	21	/* Number of pagesizes. */
-+#define	AT_STACKPROT	23	/* Initial stack protection. */
-+
-+__END_DECLS
-+
-+#endif	/* elf.h */
---- /dev/null
 +++ b/ports/sysdeps/unix/bsd/bsd4.4/kfreebsd/bits/errno.h
-@@ -0,0 +1,192 @@
+@@ -0,0 +1,195 @@
 +/*-
 + * Copyright (c) 1982, 1986, 1989, 1993
 + *	The Regents of the University of California.  All rights reserved.
@@ -906,8 +921,11 @@
 +#define	EPROTO		92		/* Protocol error */
 +
 +#define	ENOTCAPABLE	93		/* Capabilities insufficient */
++#define	ECAPMODE	94		/* Not permitted in capability mode */
++#define	ENOTRECOVERABLE	95		/* State not recoverable */
++#define	EOWNERDEAD	96		/* Previous owner died */
 +
-+#define	ELAST		93		/* Must be equal largest errno */
++#define	ELAST		96		/* Must be equal largest errno */
 +
 +#ifdef _KERNEL
 +/* pseudo-errors returned inside kernel to modify return to process */
@@ -1610,7 +1628,7 @@
 +#define IPC_STAT	2		/* get `ipc_perm' options */
 +
 +/* Special key values.  */
-+#define IPC_PRIVATE	((key_t) 0)	/* private key */
++#define IPC_PRIVATE	((__key_t) 0)	/* private key */
 +
 +#ifdef __USE_BSD
 +/* Common mode bits.  */
@@ -1622,15 +1640,15 @@
 +
 +/* Data structure used to pass permission information to IPC operations.  */
 +struct ipc_perm
-+  {
-+    __uint16_t /* yuck! */ cuid;	/* creator's user ID */
-+    __uint16_t /* yuck! */ cgid;	/* creator's group ID */
-+    __uint16_t /* yuck! */ uid;		/* owner's user ID */
-+    __uint16_t /* yuck! */ gid;		/* owner's group ID */
-+    __mode_t mode;			/* read/write permission */
-+    __uint16_t __seq;
-+    __key_t __key;
-+  };
++{
++    __uid_t		cuid;	/* creator user id */
++    __gid_t		cgid;	/* creator group id */
++    __uid_t		uid;	/* user id */
++    __gid_t		gid;	/* group id */
++    __mode_t		mode;	/* r/w permission */
++    __uint16_t		__seq;	/* sequence # (to generate unique ipcid) */
++    __key_t		__key;	/* user specified msg/sem/shm key */
++};
 --- /dev/null
 +++ b/ports/sysdeps/unix/bsd/bsd4.4/kfreebsd/bits/local_lim.h
 @@ -0,0 +1,25 @@
@@ -1794,7 +1812,7 @@
 +#endif /* Use BSD */
 --- /dev/null
 +++ b/ports/sysdeps/unix/bsd/bsd4.4/kfreebsd/bits/msq.h
-@@ -0,0 +1,69 @@
+@@ -0,0 +1,65 @@
 +/* Copyright (C) 1995, 1997, 2000, 2002 Free Software Foundation, Inc.
 +   This file is part of the GNU C Library.
 +
@@ -1831,21 +1849,17 @@
 +   The type `struct __msg' is opaque.  */
 +struct msqid_ds
 +{
-+  struct ipc_perm msg_perm;	/* structure describing operation permission */
-+  void *__msg_first;
-+  void *__msg_last;
-+  msglen_t __msg_cbytes;	/* current number of bytes on queue */
-+  msgqnum_t msg_qnum;		/* number of messages currently on queue */
-+  msglen_t msg_qbytes;		/* max number of bytes allowed on queue */
-+  __pid_t msg_lspid;		/* pid of last msgsnd() */
-+  __pid_t msg_lrpid;		/* pid of last msgrcv() */
-+  __time_t msg_stime;		/* time of last msgsnd command */
-+  long __unused1;
-+  __time_t msg_rtime;		/* time of last msgrcv command */
-+  long __unused2;
-+  __time_t msg_ctime;		/* time of last change */
-+  long __unused3;
-+  long __unused4[4];
++	struct	ipc_perm msg_perm;	/* msg queue permission bits */
++	void *__msg_first;		/* first message in the queue */
++	void *__msg_last;		/* last message in the queue */
++	msglen_t __msg_cbytes;	/* number of bytes in use on the queue */
++	msgqnum_t msg_qnum;	/* number of msgs in the queue */
++	msglen_t msg_qbytes;	/* max # of bytes on the queue */
++	__pid_t	msg_lspid;	/* pid of last msgsnd() */
++	__pid_t	msg_lrpid;	/* pid of last msgrcv() */
++	__time_t msg_stime;	/* time of last msgsnd() */
++	__time_t msg_rtime;	/* time of last msgrcv() */
++	__time_t msg_ctime;	/* time of last msgctl() */
 +};
 +
 +#ifdef __USE_MISC
@@ -2234,7 +2248,7 @@
 +#endif /* bits/posix_opt.h */
 --- /dev/null
 +++ b/ports/sysdeps/unix/bsd/bsd4.4/kfreebsd/bits/resource.h
-@@ -0,0 +1,211 @@
+@@ -0,0 +1,220 @@
 +/* Bit values & structures for resource limits.  FreeBSD version.
 +   Copyright (C) 1994, 1996-1998, 2002 Free Software Foundation, Inc.
 +   This file is part of the GNU C Library.
@@ -2318,8 +2332,17 @@
 +  /* Address space limit.  */
 +  RLIMIT_AS = 10,
 +#define RLIMIT_AS RLIMIT_AS
++  RLIMIT_VMEM = RLIMIT_AS,
 +
-+  __RLIMIT_NLIMITS = 11,
++  /* Pseudo-terminals.  */
++  RLIMIT_NPTS = 11,
++#define RLIMIT_NPTS RLIMIT_NPTS
++
++  /* Swap used.  */
++  RLIMIT_SWAP = 12,
++#define RLIMIT_SWAP RLIMIT_SWAP
++
++  __RLIMIT_NLIMITS = 13,
 +  __RLIM_NLIMITS = __RLIMIT_NLIMITS
 +#define RLIMIT_NLIMITS __RLIMIT_NLIMITS
 +#define RLIM_NLIMITS __RLIM_NLIMITS
@@ -2634,7 +2657,7 @@
 +#endif
 --- /dev/null
 +++ b/ports/sysdeps/unix/bsd/bsd4.4/kfreebsd/bits/sem.h
-@@ -0,0 +1,95 @@
+@@ -0,0 +1,93 @@
 +/* Copyright (C) 1995-1998, 2002 Free Software Foundation, Inc.
 +   This file is part of the GNU C Library.
 +
@@ -2678,18 +2701,16 @@
 +
 +
 +/* Data structure describing a set of semaphores.  */
-+struct semid_ds
++struct semid_ds 
 +{
-+  struct ipc_perm sem_perm;		/* operation permission struct */
-+  void *__sem_base;
-+  unsigned short int sem_nsems;		/* number of semaphores in set */
-+  __time_t sem_otime;			/* last semop() time */
-+  long __unused1;
-+  __time_t sem_ctime;			/* last time changed by semctl() */
-+  long __unused2;
-+  long __unused3[4];
++    struct ipc_perm	sem_perm;	/* operation permission struct */
++    void		*__sem_base;	/* pointer to first semaphore in set */
++    unsigned short	sem_nsems;	/* number of sems in set */
++    __time_t		sem_otime;	/* last operation time */
++    __time_t		sem_ctime;	/* last change time */
++    					/* Times measured in secs since */
++    					/* 00:00:00 GMT, Jan. 1, 1970 */
 +};
-+
 +/* The user should define a union like the following to use it for arguments
 +   for `semctl'.
 +
@@ -2732,7 +2753,7 @@
 +
 --- /dev/null
 +++ b/ports/sysdeps/unix/bsd/bsd4.4/kfreebsd/bits/shm.h
-@@ -0,0 +1,90 @@
+@@ -0,0 +1,89 @@
 +/* Copyright (C) 1995-1997, 2000, 2002 Free Software Foundation, Inc.
 +   This file is part of the GNU C Library.
 +
@@ -2779,20 +2800,19 @@
 +
 +
 +/* Type to count number of attaches.  */
-+typedef unsigned short int shmatt_t;
++typedef int shmatt_t;
 +
 +/* Data structure describing a set of semaphores.  */
 +struct shmid_ds
 +  {
 +    struct ipc_perm shm_perm;		/* operation permission struct */
-+    int shm_segsz;			/* size of segment in bytes */
++    size_t shm_segsz;			/* size of segment in bytes */
 +    __pid_t shm_lpid;			/* pid of last shmop */
 +    __pid_t shm_cpid;			/* pid of creator */
 +    shmatt_t shm_nattch;		/* number of current attaches */
 +    __time_t shm_atime;			/* time of last shmat() */
 +    __time_t shm_dtime;			/* time of last shmdt() */
 +    __time_t shm_ctime;			/* time of last change by shmctl() */
-+    void *__shm_internal;
 +  };
 +
 +#ifdef __USE_MISC
@@ -3374,7 +3394,7 @@
 +#endif /* ! _SIGSET_H_fns.  */
 --- /dev/null
 +++ b/ports/sysdeps/unix/bsd/bsd4.4/kfreebsd/bits/socket.h
-@@ -0,0 +1,397 @@
+@@ -0,0 +1,415 @@
 +/* System-specific socket constants and types.  FreeBSD version.
 +   Copyright (C) 1991-1992,1994-1999,2000-2002 Free Software Foundation, Inc.
 +   This file is part of the GNU C Library.
@@ -3739,8 +3759,26 @@
 +#define SO_ERROR SO_ERROR
 +    SO_STYLE = 0x1008,		/* Get socket connection style.  */
 +#define SO_STYLE SO_STYLE
-+    SO_TYPE = SO_STYLE		/* Compatible name for SO_STYLE.  */
++    SO_TYPE = SO_STYLE,		/* Compatible name for SO_STYLE.  */
 +#define SO_TYPE SO_TYPE
++    SO_LABEL = 0x1009,
++#define SO_LABEL SO_LABEL
++    SO_PEERLABEL = 0x1010,
++#define SO_PEERLABEL SO_PEERLABEL
++    SO_LISTENQLIMIT = 0x1011,
++#define SO_LISTENQLIMIT SO_LISTENQLIMIT
++    SO_LISTENQLEN = 0x1012,
++#define SO_LISTENQLEN SO_LISTENQLEN
++    SO_LISTENINCQLEN = 0x1013,
++#define SO_LISTENINCQLEN SO_LISTENINCQLEN
++    SO_SETFIB = 0x1014,
++#define SO_SETFIB SO_SETFIB
++    SO_USER_COOKIE = 0x1015,
++#define SO_USER_COOKIE SO_USER_COOKIE
++    SO_PROTOCOL = 0x1016,
++#define SO_PROTOCOL SO_PROTOCOL
++    SO_PROTOTYPE = SO_PROTOCOL
++#define SO_PROTOTYPE SO_PROTOTYPE
 +  };
 +
 +/* Socket options. */
@@ -4862,7 +4900,7 @@
 +#define _UTSNAME_VERSION_LENGTH 256
 --- /dev/null
 +++ b/ports/sysdeps/unix/bsd/bsd4.4/kfreebsd/bits/waitflags.h
-@@ -0,0 +1,37 @@
+@@ -0,0 +1,82 @@
 +/* Definitions of flag bits for `waitpid' et al.
 +   Copyright (C) 1992, 1996-1997, 2000, 2002 Free Software Foundation, Inc.
 +   This file is part of the GNU C Library.
@@ -4895,11 +4933,56 @@
 +#define	WSTOPPED	2	/* Report stopped child (same as WUNTRACED). */
 +#define	WCONTINUED	4	/* Report continued child.  */
 +#define	WNOWAIT		8	/* Poll only. Don't delete the proc entry. */
-+
++#define WEXITED         16      /* Wait for exited processes. */
++#define WTRAPPED        32      /* Wait for a process to hit a trap or
++                                   a breakpoint. */
++                                   
 +#define __WCLONE	0x80000000	/* Wait for cloned process.  */
 +#ifdef __USE_BSD
 +# define WLINUXCLONE	__WCLONE	/* FreeBSD name for __WCLONE.  */
 +#endif
++
++
++/* The following values are used by the `waitid' function.  */
++#if defined __USE_SVID || defined __USE_XOPEN || defined __USE_XOPEN2K8
++# ifndef __ENUM_IDTYPE_T
++# define __ENUM_IDTYPE_T 1
++
++typedef enum
++{
++        /*
++         * These names were mostly lifted from Solaris source code and
++         * still use Solaris style naming to avoid breaking any
++         * OpenSolaris code which has been ported to FreeBSD.  There
++         * is no clear FreeBSD counterpart for all of the names, but
++         * some have a clear correspondence to FreeBSD entities.
++         *
++         * The numerical values are kept synchronized with the Solaris
++         * values.
++         */
++        P_PID,                  /* A process identifier. */
++        P_PPID,                 /* A parent process identifier. */
++        P_PGID,                 /* A process group identifier. */
++        P_SID,                  /* A session identifier. */
++        P_CID,                  /* A scheduling class identifier. */
++        P_UID,                  /* A user identifier. */
++        P_GID,                  /* A group identifier. */
++        P_ALL,                  /* All processes. */
++        P_LWPID,                /* An LWP identifier. */
++        P_TASKID,               /* A task identifier. */
++        P_PROJID,               /* A project identifier. */
++        P_POOLID,               /* A pool identifier. */
++        P_JAILID,               /* A zone identifier. */
++        P_CTID,                 /* A (process) contract identifier. */
++        P_CPUID,                /* CPU identifier. */
++        P_PSETID                /* Processor set identifier. */
++} idtype_t;                     /* The type of id_t we are using. */
++
++#  if defined __USE_BSD
++#  define P_ZONEID        P_JAILID
++#  endif
++# endif
++#endif
 --- /dev/null
 +++ b/ports/sysdeps/unix/bsd/bsd4.4/kfreebsd/bits/waitstatus.h
 @@ -0,0 +1,105 @@
@@ -6140,6 +6223,61 @@
 +weak_alias (__libc_connect, connect)
 +libc_hidden_weak (__connect)
 --- /dev/null
++++ b/ports/sysdeps/unix/bsd/bsd4.4/kfreebsd/cpuset-kern.h
+@@ -0,0 +1,52 @@
++/* Copyright (C) 2013 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.  */
++
++/* From <sys/cpuset.h> */
++
++
++/*
++ * Valid cpulevel_t values.
++ */
++#define	CPU_LEVEL_ROOT		1	/* All system cpus. */
++#define	CPU_LEVEL_CPUSET	2	/* Available cpus for which. */
++#define	CPU_LEVEL_WHICH		3	/* Actual mask/id for which. */
++
++/*
++ * Valid cpuwhich_t values.
++ */
++#define	CPU_WHICH_TID		1	/* Specifies a thread id. */
++#define	CPU_WHICH_PID		2	/* Specifies a process id. */
++#define	CPU_WHICH_CPUSET	3	/* Specifies a set id. */
++#define	CPU_WHICH_IRQ		4	/* Specifies an irq #. */
++#define	CPU_WHICH_JAIL		5	/* Specifies a jail id. */
++
++/*
++ * Reserved cpuset identifiers.
++ */
++#define	CPUSET_INVALID	-1
++#define	CPUSET_DEFAULT	0
++
++extern int __syscall_cpuset_getaffinity(int level, int which, int64_t id,
++					size_t setsize, cpu_set_t *mask);
++libc_hidden_proto(__syscall_cpuset_getaffinity)
++
++
++extern int __syscall_cpuset_setaffinity(int level, int which, int64_t id,
++					size_t setsize, const cpu_set_t *mask);
++libc_hidden_proto(__syscall_cpuset_setaffinity)
++
+--- /dev/null
 +++ b/ports/sysdeps/unix/bsd/bsd4.4/kfreebsd/devname.c
 @@ -0,0 +1,69 @@
 +/*
@@ -6540,7 +6678,7 @@
 +
 --- /dev/null
 +++ b/ports/sysdeps/unix/bsd/bsd4.4/kfreebsd/dl-support.c
-@@ -0,0 +1,44 @@
+@@ -0,0 +1,46 @@
 +/* Dynamic linker system dependencies for GNU/kFreeBSD.
 +   Copyright (C) 2011 Free Software Foundation, Inc.
 +   This file is part of the GNU C Library.
@@ -6560,12 +6698,11 @@
 +   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
 +   02111-1307 USA.  */
 +
-+#define _dl_aux_init _dl_aux_init_ignored_code
-+#include <elf/dl-support.c>
-+#include <bits/elf.h>
-+#undef _dl_aux_init
++#include <ldsodefs.h>
++#ifdef HAVE_AUX_VECTOR
++#include <bits/auxv.h>
++int _dl_clktck;
 +
-+#ifdef HAVE_AUX_VECTOR
 +void
 +internal_function
 +_dl_aux_init (ElfW(auxv_t) *av)
@@ -6584,13 +6721,15 @@
 +	break;
 +      }
 +}
++#undef HAVE_AUX_VECTOR
 +#endif
++
++#include <elf/dl-support.c>
 --- /dev/null
 +++ b/ports/sysdeps/unix/bsd/bsd4.4/kfreebsd/dl-sysdep.c
-@@ -0,0 +1,261 @@
-+/* Dynamic linker system dependencies for GNU/kFreeBSD.
-+   Copyright (C) 1995-1998,2000-2008,2009,2010,2011
-+        Free Software Foundation, Inc.
+@@ -0,0 +1,315 @@
++/* Operating system support for run-time dynamic linker.  GNU/kFreeBSD version.
++   Copyright (C) 1995-2013 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
@@ -6604,28 +6743,75 @@
 +   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.  */
++   License along with the GNU C Library; if not, see
++   <http://www.gnu.org/licenses/>.  */
 +
-+/* For SHARED, use the generic dynamic linker system interface code. */
-+/* otherwise the code is in dl-support.c */
++/* We conditionalize the whole of this file rather than simply eliding it
++   from the static build, because other sysdeps/ versions of this file
++   might define things needed by a static build.  */
 +
++#include <stdlib.h>
++#include <sys/sysctl.h>
++
++#ifdef SHARED
++
++#include <assert.h>
++#include <elf.h>
++#include <errno.h>
++#include <fcntl.h>
++#include <libintl.h>
 +#include <string.h>
-+#include <fcntl.h>
 +#include <unistd.h>
-+#include <sys/sysctl.h>
++#include <sys/types.h>
++#include <sys/stat.h>
++#include <sys/mman.h>
 +#include <ldsodefs.h>
-+#include <kernel-features.h>
++#include <_itoa.h>
++#include <fpu_control.h>
 +
-+#ifdef SHARED
-+# define _dl_sysdep_start _dl_sysdep_start_ignored_code
-+# define _dl_show_auxv _dl_show_auxv_ignored_code
-+# include <elf/dl-sysdep.c>
-+# include <bits/elf.h>
-+# undef _dl_sysdep_start
-+# undef _dl_show_auxv
++#include <entry.h>
++#include <dl-machine.h>
++#include <dl-procinfo.h>
++#include <dl-osinfo.h>
++#include <hp-timing.h>
++#include <tls.h>
 +
++extern char **_environ attribute_hidden;
++extern char _end[] attribute_hidden;
++
++/* Protect SUID program against misuse of file descriptors.  */
++extern void __libc_check_standard_fds (void);
++
++#ifdef NEED_DL_BASE_ADDR
++ElfW(Addr) _dl_base_addr;
++#endif
++int __libc_enable_secure attribute_relro = 0;
++INTVARDEF(__libc_enable_secure)
++int __libc_multiple_libcs = 0;	/* Defining this here avoids the inclusion
++				   of init-first.  */
++/* This variable contains the lowest stack address ever used.  */
++void *__libc_stack_end attribute_relro = NULL;
++rtld_hidden_data_def(__libc_stack_end)
++void *_dl_random attribute_relro = NULL;
++
++#ifndef DL_FIND_ARG_COMPONENTS
++# define DL_FIND_ARG_COMPONENTS(cookie, argc, argv, envp, auxp)	\
++  do {									      \
++    void **_tmp;							      \
++    (argc) = *(long int *) cookie;					      \
++    (argv) = (char **) ((long int *) cookie + 1);			      \
++    (envp) = (argv) + (argc) + 1;					      \
++    for (_tmp = (void **) (envp); *_tmp; ++_tmp)			      \
++      continue;								      \
++    (auxp) = (void *) ++_tmp;						      \
++  } while (0)
++#endif
++
++#ifndef DL_STACK_END
++# define DL_STACK_END(cookie) ((void *) (cookie))
++#endif
++
++
 +extern const char *_self_program_name_from_auxv attribute_hidden;
 +
 +ElfW(Addr)
@@ -6816,8 +7002,16 @@
 +      _dl_printf ("AT_??? (0x%s): 0x%s\n", val, val2);
 +    }
 +}
++void
++internal_function
++_dl_sysdep_start_cleanup (void)
++{
++}
++
++
 +#endif
 +
++
 +int
 +attribute_hidden
 +_dl_discover_osversion (void)
@@ -6879,6 +7073,47 @@
 +# define HAVE_DL_DISCOVER_OSVERSION	1
 +#endif
 --- /dev/null
++++ b/ports/sysdeps/unix/bsd/bsd4.4/kfreebsd/dl-writev.h
+@@ -0,0 +1,38 @@
++/* Message-writing for the dynamic linker.
++   Copyright (C) 2013 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, see
++   <http://www.gnu.org/licenses/>.  */
++
++#include <sys/uio.h>
++#include <sysdep.h>
++
++/* This is used from only one place: dl-misc.c:_dl_debug_vdprintf.
++   Hence it's in a header with the expectation it will be inlined.
++
++   This is writev, but with a constraint added and others loosened:
++
++   1. Under RTLD_PRIVATE_ERRNO, it must not clobber the private errno
++      when another thread holds the dl_load_lock.
++   2. It is not obliged to detect and report errors at all.
++   3. It's not really obliged to deliver a single atomic write
++      (though it may be preferable).  */
++
++static inline void
++_dl_writev (int fd, const struct iovec *iov, size_t niov)
++{
++  INTERNAL_SYSCALL_DECL (err);
++  INTERNAL_SYSCALL (writev, err, 3, fd, iov, niov);
++}
+--- /dev/null
 +++ b/ports/sysdeps/unix/bsd/bsd4.4/kfreebsd/execve.c
 @@ -0,0 +1,5 @@
 +int __syscall_execve(const char *filename, 
@@ -7674,7 +7909,7 @@
 +strong_alias (__clock_getres, clock_getres)
 --- /dev/null
 +++ b/ports/sysdeps/unix/bsd/bsd4.4/kfreebsd/fbtl/clock_gettime.c
-@@ -0,0 +1,42 @@
+@@ -0,0 +1,43 @@
 +/* Copyright (C) 2013 Free Software Foundation, Inc.
 +   This file is part of the GNU C Library.
 +
@@ -7716,7 +7951,8 @@
 +   */    
 +  return INLINE_SYSCALL (clock_gettime, 2, clock_id, tp);
 +}
-+strong_alias (__clock_gettime, clock_gettime)
++weak_alias (__clock_gettime, clock_gettime)
++libc_hidden_def (__clock_gettime)
 --- /dev/null
 +++ b/ports/sysdeps/unix/bsd/bsd4.4/kfreebsd/fbtl/clock_nanosleep.c
 @@ -0,0 +1,99 @@
@@ -9242,6 +9478,227 @@
 +#endif			 
 +}
 --- /dev/null
++++ b/ports/sysdeps/unix/bsd/bsd4.4/kfreebsd/fbtl/pthread_attr_getaffinity.c
+@@ -0,0 +1,69 @@
++/* Copyright (C) 2003-2013 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; if not, see
++   <http://www.gnu.org/licenses/>.  */
++
++#include <assert.h>
++#include <errno.h>
++#include <pthreadP.h>
++#include <string.h>
++#include <sysdep.h>
++#include <sys/types.h>
++#include <shlib-compat.h>
++
++
++int
++__pthread_attr_getaffinity_new (const pthread_attr_t *attr, size_t cpusetsize,
++				cpu_set_t *cpuset)
++{
++  const struct pthread_attr *iattr;
++
++  assert (sizeof (*attr) >= sizeof (struct pthread_attr));
++  iattr = (const struct pthread_attr *) attr;
++
++  if (iattr->cpuset != NULL)
++    {
++      /* Check whether there are any bits set beyond the limits
++	 the user requested.  */
++      for (size_t cnt = cpusetsize; cnt < iattr->cpusetsize; ++cnt)
++	if (((char *) iattr->cpuset)[cnt] != 0)
++	  return EINVAL;
++
++      /* Copy over the cpuset from the thread attribute object.  Limit the copy
++	 to the minimum of the source and destination sizes to prevent a buffer
++	 overrun.  If the destination is larger, fill the remaining space with
++	 zeroes.  */
++      void *p = mempcpy (cpuset, iattr->cpuset,
++			 MIN (iattr->cpusetsize, cpusetsize));
++      if (cpusetsize > iattr->cpusetsize)
++	memset (p, '\0', cpusetsize - iattr->cpusetsize);
++    }
++  else
++    /* We have no information.  */
++    memset (cpuset, -1, cpusetsize);
++
++  return 0;
++}
++versioned_symbol (libpthread, __pthread_attr_getaffinity_new,
++		  pthread_attr_getaffinity_np, GLIBC_2_3_4);
++
++
++#if SHLIB_COMPAT (libpthread, GLIBC_2_3_3, GLIBC_2_3_4)
++/* The old interface have not been really exposed  */
++strong_alias (__pthread_attr_getaffinity_new, __pthread_attr_getaffinity_old)
++compat_symbol (libpthread, __pthread_attr_getaffinity_old,
++	       pthread_attr_getaffinity_np, GLIBC_2_3_3);
++#endif
+--- /dev/null
++++ b/ports/sysdeps/unix/bsd/bsd4.4/kfreebsd/fbtl/pthread_attr_setaffinity.c
+@@ -0,0 +1,76 @@
++/* Copyright (C) 2003-2013 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; if not, see
++   <http://www.gnu.org/licenses/>.  */
++
++#include <assert.h>
++#include <errno.h>
++#include <limits.h>
++#include <stdlib.h>
++#include <string.h>
++#include <pthreadP.h>
++#include <shlib-compat.h>
++
++
++
++
++int
++__pthread_attr_setaffinity_new (pthread_attr_t *attr, size_t cpusetsize,
++				const cpu_set_t *cpuset)
++{
++  struct pthread_attr *iattr;
++
++  assert (sizeof (*attr) >= sizeof (struct pthread_attr));
++  iattr = (struct pthread_attr *) attr;
++
++  if (cpuset == NULL || cpusetsize == 0)
++    {
++      free (iattr->cpuset);
++      iattr->cpuset = NULL;
++      iattr->cpusetsize = 0;
++    }
++  else
++    {
++      int ret = check_cpuset_attr (cpuset, cpusetsize);
++
++      if (ret)
++        return ret;
++
++      if (iattr->cpusetsize != cpusetsize)
++	{
++	  void *newp = (cpu_set_t *) realloc (iattr->cpuset, cpusetsize);
++	  if (newp == NULL)
++	    return ENOMEM;
++
++	  iattr->cpuset = newp;
++	  iattr->cpusetsize = cpusetsize;
++	}
++
++      memcpy (iattr->cpuset, cpuset, cpusetsize);
++    }
++
++  return 0;
++}
++versioned_symbol (libpthread, __pthread_attr_setaffinity_new,
++		  pthread_attr_setaffinity_np, GLIBC_2_3_4);
++
++
++#if SHLIB_COMPAT (libpthread, GLIBC_2_3_3, GLIBC_2_3_4)
++/* The old interface have not been really exposed  */
++strong_alias (__pthread_attr_setaffinity_new, __pthread_attr_setaffinity_old)
++compat_symbol (libpthread, __pthread_attr_setaffinity_old,
++	       pthread_attr_setaffinity_np, GLIBC_2_3_3);
++#endif
+--- /dev/null
++++ b/ports/sysdeps/unix/bsd/bsd4.4/kfreebsd/fbtl/pthread_getaffinity.c
+@@ -0,0 +1,67 @@
++/* Copyright (C) 2013 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, see
++   <http://www.gnu.org/licenses/>.  */
++
++#include <errno.h>
++#include <limits.h>
++#include <pthreadP.h>
++#include <string.h>
++#include <sysdep.h>
++#include <sys/param.h>
++#include <sys/types.h>
++#include <shlib-compat.h>
++
++#include "../cpuset-kern.h"
++
++int
++__pthread_getaffinity_new (pthread_t th, size_t cpusetsize, cpu_set_t *cpuset)
++{
++  const struct pthread *pd = (const struct pthread *) th;
++  int64_t id = pd->tid;
++  int res;
++  
++  if (cpusetsize > sizeof(cpu_set_t))
++    {
++      /* Clean the rest of the memory the kernel won't do.  */
++      memset ((char *) cpuset + sizeof(cpu_set_t), '\0', cpusetsize - sizeof(cpu_set_t));
++
++      cpusetsize = sizeof(cpu_set_t);
++    }
++
++  res = INLINE_SYSCALL (cpuset_getaffinity, 5, CPU_LEVEL_WHICH,
++			CPU_WHICH_TID, id, cpusetsize, cpuset);
++
++  if (res == 0)
++      return 0;
++      
++  if (errno == ERANGE)
++    {
++      return EINVAL;
++    }
++  
++  return errno;
++}
++strong_alias (__pthread_getaffinity_new, __pthread_getaffinity_np)
++versioned_symbol (libpthread, __pthread_getaffinity_new,
++		  pthread_getaffinity_np, GLIBC_2_3_4);
++
++
++#if SHLIB_COMPAT (libpthread, GLIBC_2_3_3, GLIBC_2_3_4)
++/* The old interface have not been really exposed  */
++strong_alias (__pthread_getaffinity_new, __pthread_getaffinity_old)
++compat_symbol (libpthread, __pthread_getaffinity_old, pthread_getaffinity_np,
++	       GLIBC_2_3_3);
++#endif
+--- /dev/null
 +++ b/ports/sysdeps/unix/bsd/bsd4.4/kfreebsd/fbtl/pthread_getcpuclockid.c
 @@ -0,0 +1,38 @@
 +/* Copyright (C) 2013 Free Software Foundation, Inc.
@@ -9283,6 +9740,59 @@
 +  return INLINE_SYSCALL(clock_getcpuclockid2, 3, pd->tid, CPUCLOCK_WHICH_TID, clockid);
 +}
 --- /dev/null
++++ b/ports/sysdeps/unix/bsd/bsd4.4/kfreebsd/fbtl/pthread_getname.c
+@@ -0,0 +1,50 @@
++/* pthread_getname_np -- Get  thread name.
++   Copyright (C) 2013 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; see the file COPYING.LIB.  If
++   not, see <http://www.gnu.org/licenses/>.  */
++
++#include <errno.h>
++#include <fcntl.h>
++#include <pthreadP.h>
++#include <stdio.h>
++#include <string.h>
++#include <unistd.h>
++#include <sys/ptrace.h>
++
++int
++pthread_getname_np (th, buf, len)
++     pthread_t th;
++     char *buf;
++     size_t len;
++{
++  const struct pthread *pd = (const struct pthread *) th;
++  struct ptrace_lwpinfo ti;
++  int res;
++  
++  ti.pl_tdname[0] = 0;
++  res = ptrace(PT_LWPINFO, pd->tid, (caddr_t)&ti, sizeof(struct ptrace_lwpinfo));
++
++  if (res != 0)
++      return errno;
++
++  res = strlen(ti.pl_tdname);
++
++  if (len < (res+1))
++      return ERANGE;
++      
++  memcpy(buf, ti.pl_tdname, res+1);
++  return 0;    
++}
+--- /dev/null
 +++ b/ports/sysdeps/unix/bsd/bsd4.4/kfreebsd/fbtl/pthread_getschedparam.c
 @@ -0,0 +1,79 @@
 +/* Copyright (C) 2002-2013 Free Software Foundation, Inc.
@@ -9550,6 +10060,119 @@
 +weak_alias (__pthread_once, pthread_once)
 +hidden_def (__pthread_once)
 --- /dev/null
++++ b/ports/sysdeps/unix/bsd/bsd4.4/kfreebsd/fbtl/pthread_setaffinity.c
+@@ -0,0 +1,70 @@
++/* Copyright (C) 2013 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, see
++   <http://www.gnu.org/licenses/>.  */
++
++#include <alloca.h>
++#include <errno.h>
++#include <pthreadP.h>
++#include <sysdep.h>
++#include <sys/types.h>
++#include <shlib-compat.h>
++
++#include "../cpuset-kern.h"
++
++
++size_t __kernel_cpumask_size attribute_hidden;
++
++/* Determine the current affinity.  As a side affect we learn
++   about the size of the cpumask_t in the kernel.  */
++int
++__determine_cpumask_size (pid_t tid)
++{
++  /* not yet dynamical */
++  __kernel_cpumask_size = sizeof(cpu_set_t);
++  return 0;
++}
++
++int
++__pthread_setaffinity_new (pthread_t th, size_t cpusetsize,
++			   const cpu_set_t *cpuset)
++{
++  const struct pthread *pd = (const struct pthread *) th;
++  int64_t id = pd->tid;
++  int res;
++
++  res = INLINE_SYSCALL (cpuset_setaffinity, 5, CPU_LEVEL_WHICH,
++			CPU_WHICH_TID, id, cpusetsize, cpuset);
++
++  if (res == 0)
++      return 0;
++      
++  if ((errno == ERANGE) || (errno == EDEADLK))
++    {
++      return EINVAL;
++    }
++  
++  return errno;
++}
++versioned_symbol (libpthread, __pthread_setaffinity_new,
++		  pthread_setaffinity_np, GLIBC_2_3_4);
++
++
++#if SHLIB_COMPAT (libpthread, GLIBC_2_3_3, GLIBC_2_3_4)
++/* The old interface have not been really exposed  */
++strong_alias (__pthread_setaffinity_new, __pthread_setaffinity_old)
++compat_symbol (libpthread, __pthread_setaffinity_old, pthread_setaffinity_np,
++	       GLIBC_2_3_3);
++#endif
+--- /dev/null
++++ b/ports/sysdeps/unix/bsd/bsd4.4/kfreebsd/fbtl/pthread_setname.c
+@@ -0,0 +1,37 @@
++/* pthread_setname_np -- Set  thread name
++   Copyright (C) 2013 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; see the file COPYING.LIB.  If
++   not, see <http://www.gnu.org/licenses/>.  */
++
++#include <errno.h>
++#include <fcntl.h>
++#include <pthreadP.h>
++#include <stdio.h>
++#include <string.h>
++#include <unistd.h>
++
++extern int __syscall_thr_set_name(long tid, char *name);
++libc_hidden_proto(__syscall_thr_set_name)
++
++int
++pthread_setname_np (th, name)
++     pthread_t th;
++     const char *name;
++{
++  const struct pthread *pd = (const struct pthread *) th;
++
++  return INLINE_SYSCALL(thr_set_name, 2, pd->tid, name);
++}
+--- /dev/null
 +++ b/ports/sysdeps/unix/bsd/bsd4.4/kfreebsd/fbtl/pthread_setschedparam.c
 @@ -0,0 +1,78 @@
 +/* Copyright (C) 2002-2013 Free Software Foundation, Inc.
@@ -12000,7 +12623,7 @@
 +}
 --- /dev/null
 +++ b/ports/sysdeps/unix/bsd/bsd4.4/kfreebsd/fxstat.c
-@@ -0,0 +1,48 @@
+@@ -0,0 +1,47 @@
 +/* fxstat using FreeBSD fstat, nfstat system calls.
 +   Copyright (C) 1991,1995-1997,2000,2002 Free Software Foundation, Inc.
 +   This file is part of the GNU C Library.
@@ -12023,7 +12646,6 @@
 +#include <errno.h>
 +#include <stddef.h>
 +#include <sys/stat.h>
-+#include <bp-checks.h>
 +
 +#include "stat16conv.c"
 +
@@ -12033,13 +12655,13 @@
 +  if (__builtin_expect (vers == _STAT_VER, 1))
 +    {
 +      struct stat16 buf16;
-+      int result = __syscall_fstat (fd, __ptrvalue (&buf16));
++      int result = __syscall_fstat (fd, &buf16);
 +      if (result == 0)
 +	stat16_to_stat (&buf16, buf);
 +      return result;
 +    }
 +  else if (__builtin_expect (vers == _STAT_VER_stat, 1))
-+    return __syscall_fstat (fd, CHECK_1 ((struct stat16 *) buf));
++    return __syscall_fstat (fd, (struct stat16 *) buf);
 +  else
 +    {
 +      __set_errno (EINVAL);
@@ -12051,7 +12673,7 @@
 +weak_alias (__fxstat, _fxstat)
 --- /dev/null
 +++ b/ports/sysdeps/unix/bsd/bsd4.4/kfreebsd/fxstat64.c
-@@ -0,0 +1,44 @@
+@@ -0,0 +1,43 @@
 +/* fxstat using FreeBSD fstat, nfstat system calls.
 +   Copyright (C) 1991,1995-1997,2000,2002 Free Software Foundation, Inc.
 +   This file is part of the GNU C Library.
@@ -12074,7 +12696,6 @@
 +#include <errno.h>
 +#include <stddef.h>
 +#include <sys/stat.h>
-+#include <bp-checks.h>
 +
 +#include "stat16conv.c"
 +
@@ -12084,7 +12705,7 @@
 +  if (__builtin_expect (vers == _STAT_VER, 1))
 +    {
 +      struct stat16 buf16;
-+      int result = __syscall_fstat (fd, __ptrvalue (&buf16));
++      int result = __syscall_fstat (fd, &buf16);
 +      if (result == 0)
 +	stat16_to_stat64 (&buf16, buf);
 +      return result;
@@ -12098,7 +12719,7 @@
 +hidden_def (__fxstat64)
 --- /dev/null
 +++ b/ports/sysdeps/unix/bsd/bsd4.4/kfreebsd/fxstatat.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.
 +
@@ -12129,7 +12750,6 @@
 +#include <sys/sysctl.h>
 +#include <sys/user.h>
 +#include <kernel-features.h>
-+#include <bp-checks.h>
 +
 +#include "stat16conv.c"
 +
@@ -12147,16 +12767,16 @@
 +	{
 +	  struct stat16 buf16;
 +	  result =
-+	    INLINE_SYSCALL (fstatat, 4, fd, CHECK_STRING (file),
-+			    __ptrvalue (&buf16), flag);
++	    INLINE_SYSCALL (fstatat, 4, fd, file,
++			    &buf16, flag);
 +	  if (result == 0)
 +	    stat16_to_stat (&buf16, st);
 +	}
 +      else if (__builtin_expect (vers == _STAT_VER_stat, 1))
 +	{
 +	  result =
-+	    INLINE_SYSCALL (fstatat, 4, fd, CHECK_STRING (file),
-+			    CHECK_1 ((struct stat16 *) st), flag);
++	    INLINE_SYSCALL (fstatat, 4, fd, file,
++			    (struct stat16 *) st, flag);
 +	}
 +      else
 +	{
@@ -12169,7 +12789,7 @@
 +libc_hidden_def (__fxstatat)
 --- /dev/null
 +++ b/ports/sysdeps/unix/bsd/bsd4.4/kfreebsd/fxstatat64.c
-@@ -0,0 +1,62 @@
+@@ -0,0 +1,61 @@
 +/* Copyright (C) 2009 Free Software Foundation, Inc.
 +   This file is part of the GNU C Library.
 +
@@ -12200,7 +12820,6 @@
 +#include <sys/sysctl.h>
 +#include <sys/user.h>
 +#include <kernel-features.h>
-+#include <bp-checks.h>
 +
 +#include "stat16conv.c"
 +
@@ -12218,8 +12837,8 @@
 +	{
 +	  struct stat16 buf16;
 +	  result =
-+	    INLINE_SYSCALL (fstatat, 4, fd, CHECK_STRING (file),
-+			    __ptrvalue (&buf16), flag);
++	    INLINE_SYSCALL (fstatat, 4, fd, file,
++			    &buf16, flag);
 +	  if (result == 0)
 +	    stat16_to_stat64 (&buf16, st);
 +	}
@@ -12277,7 +12896,7 @@
 +}
 --- /dev/null
 +++ b/ports/sysdeps/unix/bsd/bsd4.4/kfreebsd/getcwd.c
-@@ -0,0 +1,104 @@
+@@ -0,0 +1,103 @@
 +/* Determine current working directory.  FreeBSD version.
 +   Copyright (C) 2002 Free Software Foundation, Inc.
 +   This file is part of the GNU C Library.
@@ -12305,7 +12924,6 @@
 +#include <unistd.h>
 +
 +#include <sysdep.h>
-+#include <bp-checks.h>
 +
 +/* If we compile the file for use in ld.so we don't need the feature
 +   that getcwd() allocates the buffers itself.  */
@@ -12315,7 +12933,7 @@
 +
 +/* The system calls only makes a lookup in the VFS cache, which can easily
 +   fail.  Therefore we use the generic version as a fallback.  */
-+extern int __syscall_getcwd (char *__unbounded buf, unsigned int size);
++extern int __syscall_getcwd (char *buf, unsigned int size);
 +libc_hidden_proto (__syscall_getcwd)
 +
 +static char *generic_getcwd (char *buf, size_t size) internal_function;
@@ -14040,7 +14658,7 @@
 --- /dev/null
 +++ b/ports/sysdeps/unix/bsd/bsd4.4/kfreebsd/i386/dl-procinfo.h
 @@ -0,0 +1 @@
-+#include <sysdeps/unix/sysv/linux/i386/dl-procinfo.h>
++#include <sysdeps/i386/dl-procinfo.h>
 --- /dev/null
 +++ b/ports/sysdeps/unix/bsd/bsd4.4/kfreebsd/i386/fbtl/Implies
 @@ -0,0 +1 @@
@@ -15428,7 +16046,7 @@
 +  (handler)((signo), SIGCONTEXT_EXTRA_ARGS (ctx))
 --- /dev/null
 +++ b/ports/sysdeps/unix/bsd/bsd4.4/kfreebsd/i386/start.S
-@@ -0,0 +1,152 @@
+@@ -0,0 +1,151 @@
 +/* Startup code compliant to the ELF i386 ABI.
 +   Copyright (C) 1995-2012 Free Software Foundation, Inc.
 +   This file is part of the GNU C Library.
@@ -15483,7 +16101,6 @@
 +					NULL
 +*/
 +
-+#include "bp-sym.h"
 +#include <libc-symbols.h>
 +
 +	weak_extern (_end)
@@ -15531,11 +16148,11 @@
 +	pushl %ecx		/* Push second argument: argv.  */
 +	pushl %esi		/* Push first argument: argc.  */
 +
-+	pushl BP_SYM (main)@GOT(%ebx)
++	pushl main@GOT(%ebx)
 +
 +	/* Call the user's main function, and exit with its value.
 +	   But let the libc call main.    */
-+	call BP_SYM (__libc_start_main)@PLT
++	call __libc_start_main@PLT
 +#else
 +	/* Push address of our own entry points to .fini and .init.  */
 +	pushl $__libc_csu_fini
@@ -15544,11 +16161,11 @@
 +	pushl %ecx		/* Push second argument: argv.  */
 +	pushl %esi		/* Push first argument: argc.  */
 +
-+	pushl $BP_SYM (main)
++	pushl $main
 +
 +	/* Call the user's main function, and exit with its value.
 +	   But let the libc call main.    */
-+	call BP_SYM (__libc_start_main)
++	call __libc_start_main
 +#endif
 +
 +	hlt			/* Crash if somehow `exit' does return.  */
@@ -16476,7 +17093,7 @@
 +#endif	/* !PIC */
 --- /dev/null
 +++ b/ports/sysdeps/unix/bsd/bsd4.4/kfreebsd/i386/sysdep.h
-@@ -0,0 +1,202 @@
+@@ -0,0 +1,200 @@
 +/* Copyright (C) 1992,1993,1995-2000,2002,2003,2004
 +   Free Software Foundation, Inc.
 +   This file is part of the GNU C Library.
@@ -16502,8 +17119,6 @@
 +
 +/* There is some commonality.  */
 +#include <sysdeps/unix/i386/sysdep.h>
-+#include <bp-sym.h>
-+#include <bp-asm.h>
 +/* Defines RTLD_PRIVATE_ERRNO and USE_DL_SYSINFO.  */
 +#include <dl-sysdep.h>
 +#include <tls.h>
@@ -17714,6 +18329,62 @@
 +  abort ();
 +}
 --- /dev/null
++++ b/ports/sysdeps/unix/bsd/bsd4.4/kfreebsd/ipc_priv.h
+@@ -0,0 +1,53 @@
++/* 
++   Copyright (C) 2013 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.  */
++
++struct ipc_perm_old
++  {
++    __uint16_t /* yuck! */ cuid;	/* creator's user ID */
++    __uint16_t /* yuck! */ cgid;	/* creator's group ID */
++    __uint16_t /* yuck! */ uid;		/* owner's user ID */
++    __uint16_t /* yuck! */ gid;		/* owner's group ID */
++    __mode_t mode;			/* read/write permission */
++    __uint16_t __seq;
++    __key_t __key;
++  };
++
++static inline void
++ipc_perm_old2new(const struct ipc_perm_old *in, struct ipc_perm *out)
++{
++  out->cuid  = in->cuid;
++  out->cgid  = in->cgid;
++  out->uid   = in->uid;
++  out->gid   = in->gid;
++  out->mode  = in->mode;
++  out->__seq = in->__seq;
++  out->__key = in->__key;
++}
++
++static inline void
++ipc_perm_new2old(const struct ipc_perm *in, struct ipc_perm_old *out)
++{
++  out->cuid  = in->cuid;
++  out->cgid  = in->cgid;
++  out->uid   = in->uid;
++  out->gid   = in->gid;
++  out->mode  = in->mode;
++  out->__seq = in->__seq;
++  out->__key = in->__key;
++}
+--- /dev/null
 +++ b/ports/sysdeps/unix/bsd/bsd4.4/kfreebsd/kenv.h
 @@ -0,0 +1,39 @@
 +/*-
@@ -19419,7 +20090,7 @@
 +/* 'lseek64' is the same as 'lseek', because __off64_t == __off_t.  */
 --- /dev/null
 +++ b/ports/sysdeps/unix/bsd/bsd4.4/kfreebsd/lxstat.c
-@@ -0,0 +1,49 @@
+@@ -0,0 +1,47 @@
 +/* lxstat using FreeBSD lstat, nlstat system calls.
 +   Copyright (C) 1991,1995-1997,2000,2002 Free Software Foundation, Inc.
 +   This file is part of the GNU C Library.
@@ -19442,7 +20113,6 @@
 +#include <errno.h>
 +#include <stddef.h>
 +#include <sys/stat.h>
-+#include <bp-checks.h>
 +
 +#include "stat16conv.c"
 +
@@ -19452,14 +20122,13 @@
 +  if (__builtin_expect (vers == _STAT_VER, 1))
 +    {
 +      struct stat16 buf16;
-+      int result = __syscall_lstat (CHECK_STRING (file), __ptrvalue (&buf16));
++      int result = __syscall_lstat (file, &buf16);
 +      if (result == 0)
 +	stat16_to_stat (&buf16, buf);
 +      return result;
 +    }
 +  else if (__builtin_expect (vers == _STAT_VER_stat, 1))
-+    return __syscall_lstat (CHECK_STRING (file),
-+			    CHECK_1 ((struct stat16 *) buf));
++    return __syscall_lstat (file, (struct stat16 *) buf);
 +  else
 +    {
 +      __set_errno (EINVAL);
@@ -19471,7 +20140,7 @@
 +weak_alias (__lxstat, _lxstat)
 --- /dev/null
 +++ b/ports/sysdeps/unix/bsd/bsd4.4/kfreebsd/lxstat64.c
-@@ -0,0 +1,44 @@
+@@ -0,0 +1,43 @@
 +/* lxstat using FreeBSD lstat, nlstat system calls.
 +   Copyright (C) 1991,1995-1997,2000,2002 Free Software Foundation, Inc.
 +   This file is part of the GNU C Library.
@@ -19494,7 +20163,6 @@
 +#include <errno.h>
 +#include <stddef.h>
 +#include <sys/stat.h>
-+#include <bp-checks.h>
 +
 +#include "stat16conv.c"
 +
@@ -19504,7 +20172,7 @@
 +  if (__builtin_expect (vers == _STAT_VER, 1))
 +    {
 +      struct stat16 buf16;
-+      int result = __syscall_lstat (CHECK_STRING (file), __ptrvalue (&buf16));
++      int result = __syscall_lstat (file, &buf16);
 +      if (result == 0)
 +	stat16_to_stat64 (&buf16, buf);
 +      return result;
@@ -20669,6 +21337,113 @@
 @@ -0,0 +1 @@
 +/* 'mmap64' is the same as 'mmap', because __off64_t == __off_t.  */
 --- /dev/null
++++ b/ports/sysdeps/unix/bsd/bsd4.4/kfreebsd/msgctl.c
+@@ -0,0 +1,104 @@
++/* Copyright (C) 2013 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, see
++   <http://www.gnu.org/licenses/>.  */
++
++#include <errno.h>
++#include <sys/msg.h>
++#include <ipc_priv.h>
++
++#include <sysdep.h>
++#include <string.h>
++#include <sys/syscall.h>
++#include <bits/wordsize.h>
++#include <shlib-compat.h>
++
++#include <kernel-features.h>
++
++/* Provide operations to control over shared memory segments.  */
++
++extern int __syscall_msgctl(int msqid, int cmd, struct msqid_ds *buf);
++libc_hidden_proto (__syscall_msgctl)
++
++int
++__new_msgctl(int msqid, int cmd, struct msqid_ds *buf)
++{
++  return INLINE_SYSCALL (msgctl, 3, msqid, cmd, buf);
++}
++versioned_symbol (libc, __new_msgctl, msgctl, GLIBC_2_18);
++
++#if SHLIB_COMPAT (libc, GLIBC_2_0, GLIBC_2_18)
++struct msqid_ds_old
++{
++  struct ipc_perm_old msg_perm;	/* structure describing operation permission */
++  void *__msg_first;
++  void *__msg_last;
++  msglen_t __msg_cbytes;	/* current number of bytes on queue */
++  msgqnum_t msg_qnum;		/* number of messages currently on queue */
++  msglen_t msg_qbytes;		/* max number of bytes allowed on queue */
++  __pid_t msg_lspid;		/* pid of last msgsnd() */
++  __pid_t msg_lrpid;		/* pid of last msgrcv() */
++  __time_t msg_stime;		/* time of last msgsnd command */
++  long __unused1;
++  __time_t msg_rtime;		/* time of last msgrcv command */
++  long __unused2;
++  __time_t msg_ctime;		/* time of last change */
++  long __unused3;
++  long __unused4[4];
++};
++
++int
++attribute_compat_text_section
++__old_msgctl(int msqid, int cmd, struct msqid_ds_old *buf)
++{
++    struct msqid_ds newbuf;
++    int rv;
++    
++    if (cmd == IPC_SET)
++    {
++        ipc_perm_old2new(&(buf->msg_perm), &(newbuf.msg_perm));
++        newbuf.__msg_first   = buf->__msg_first;
++        newbuf.__msg_last    = buf->__msg_first;
++        newbuf.__msg_cbytes  = buf->__msg_cbytes;
++        newbuf.msg_qnum      = buf->msg_qnum;
++        newbuf.msg_qbytes    = buf->msg_qbytes;
++        newbuf.msg_lspid     = buf->msg_lspid;
++        newbuf.msg_lrpid     = buf->msg_lrpid;
++        newbuf.msg_stime     = buf->msg_stime;
++        newbuf.msg_rtime     = buf->msg_rtime;
++        newbuf.msg_ctime     = buf->msg_ctime;
++    }
++    
++    rv = __new_msgctl (msqid, cmd, &newbuf);
++    
++    if ((rv != -1) && (cmd == IPC_STAT))
++    {
++        ipc_perm_new2old(&(newbuf.msg_perm), &(buf->msg_perm));
++        buf->__msg_first   = newbuf.__msg_first;
++        buf->__msg_last    = newbuf.__msg_first;
++        buf->__msg_cbytes  = newbuf.__msg_cbytes;
++        buf->msg_qnum      = newbuf.msg_qnum;
++        buf->msg_qbytes    = newbuf.msg_qbytes;
++        buf->msg_lspid     = newbuf.msg_lspid;
++        buf->msg_lrpid     = newbuf.msg_lrpid;
++        buf->msg_stime     = newbuf.msg_stime;
++        buf->msg_rtime     = newbuf.msg_rtime;
++        buf->msg_ctime     = newbuf.msg_ctime;   
++    }
++        
++    return rv;
++}
++compat_symbol (libc, __old_msgctl, msgctl, GLIBC_2_0);
++#endif
+--- /dev/null
 +++ b/ports/sysdeps/unix/bsd/bsd4.4/kfreebsd/munmap.c
 @@ -0,0 +1,41 @@
 +/* Copyright (C) 2006 Free Software Foundation, Inc.
@@ -22699,71 +23474,6 @@
 +#define sigsuspend_not_cancel(set) \
 +  INLINE_SYSCALL (sigsuspend, 1, set)
 --- /dev/null
-+++ b/ports/sysdeps/unix/bsd/bsd4.4/kfreebsd/ntp_gettime.c
-@@ -0,0 +1,62 @@
-+/* Copyright (C) 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/timex.h>
-+#include <sys/sysctl.h>
-+#include <stddef.h>
-+
-+#ifndef ntptimeval
-+#define ntptimeval ntptimeval4
-+#endif
-+
-+int
-+ntp_gettime (struct ntptimeval *ntv)
-+{
-+  /* Fetch sysctl value of "kern.ntp_pll.gettime".  */
-+  /* The 'struct ntptimeval' has grown in size.  */
-+  union
-+    {
-+      struct ntptimeval3 tv3;
-+      struct ntptimeval4 tv4;
-+    } tv;
-+  size_t size = sizeof (tv);
-+  int request[2] = { CTL_KERN, KERN_NTP_PLL };
-+
-+  if (__sysctl (request, 2, &tv, &size, NULL, 0) >= 0)
-+    {
-+      if (size == sizeof (struct ntptimeval3))
-+	{
-+	  if (ntv)
-+	    {
-+	      ntv->time = tv.tv3.time;
-+	      ntv->maxerror = tv.tv3.maxerror;
-+	      ntv->esterror = tv.tv3.esterror;
-+	      ntv->tai = 0;
-+	      ntv->time_state = tv.tv3.time_state;
-+	    }
-+	  return tv.tv3.time_state;
-+	}
-+      if (size == sizeof (struct ntptimeval4))
-+	{
-+	  if (ntv)
-+	    *ntv = tv.tv4;
-+	  return tv.tv4.time_state;
-+	}
-+    }
-+  return TIME_ERROR;
-+}
---- /dev/null
 +++ b/ports/sysdeps/unix/bsd/bsd4.4/kfreebsd/open.c
 @@ -0,0 +1,63 @@
 +/* Copyright (C) 1999, 2000, 2002 Free Software Foundation, Inc.
@@ -22835,13 +23545,8 @@
 +/* 'open64' is the same as 'open', because __off64_t == __off_t and
 +   O_LARGEFILE == 0.  */
 --- /dev/null
-+++ b/ports/sysdeps/unix/bsd/bsd4.4/kfreebsd/open_2.c
-@@ -0,0 +1,2 @@
-+#include <sysdeps/unix/sysv/linux/open_2.c>
-+strong_alias (__open_2, __open64_2)
---- /dev/null
 +++ b/ports/sysdeps/unix/bsd/bsd4.4/kfreebsd/openat.c
-@@ -0,0 +1,88 @@
+@@ -0,0 +1,74 @@
 +/* Copyright (C) 2005, 2006, 2007 Free Software Foundation, Inc.
 +   This file is part of the GNU C Library.
 +
@@ -22916,20 +23621,6 @@
 +strong_alias (__openat, __openat64)
 +libc_hidden_def (__openat64)
 +weak_alias (__openat64, openat64)
-+
-+int
-+__openat_2 (fd, file, oflag)
-+     int fd;
-+     const char *file;
-+     int oflag;
-+{
-+  if (oflag & O_CREAT)
-+    __fortify_fail ("invalid openat call: O_CREAT without mode");
-+
-+  return __openat (fd, file, oflag);
-+}
-+
-+strong_alias (__openat_2, __openat64_2)
 --- /dev/null
 +++ b/ports/sysdeps/unix/bsd/bsd4.4/kfreebsd/openat64.c
 @@ -0,0 +1,2 @@
@@ -23519,7 +24210,7 @@
 +}
 --- /dev/null
 +++ b/ports/sysdeps/unix/bsd/bsd4.4/kfreebsd/readv.c
-@@ -0,0 +1,57 @@
+@@ -0,0 +1,56 @@
 +/* readv for FreeBSD.
 +   Copyright (C) 1997-1998, 2000, 2002 Free Software Foundation, Inc.
 +   This file is part of the GNU C Library.
@@ -23546,10 +24237,9 @@
 +
 +#include <sysdep.h>
 +#include <sys/syscall.h>
-+#include <bp-checks.h>
 +#include <sysdep-cancel.h>
 +
-+extern ssize_t __syscall_readv (int, __const struct iovec *__unbounded, int);
++extern ssize_t __syscall_readv (int, __const struct iovec *, int);
 +libc_hidden_proto(__syscall_readv)
 +
 +static ssize_t __atomic_readv_replacement (int, __const struct iovec *,
@@ -23561,10 +24251,10 @@
 +  if (count <= UIO_MAXIOV)
 +  {
 +    if (SINGLE_THREAD_P)
-+      return INLINE_SYSCALL (readv, 3, fd, CHECK_N (vector, count), count);
++      return INLINE_SYSCALL (readv, 3, fd, vector, count);
 +
 +    int oldtype = LIBC_CANCEL_ASYNC ();
-+    ssize_t result = INLINE_SYSCALL (readv, 3, fd, CHECK_N (vector, count), count);
++    ssize_t result = INLINE_SYSCALL (readv, 3, fd, vector, count);
 +    LIBC_CANCEL_RESET (oldtype);
 +    return result;
 +
@@ -23854,7 +24544,7 @@
 +#include <misc/sbrk.c>
 --- /dev/null
 +++ b/ports/sysdeps/unix/bsd/bsd4.4/kfreebsd/sched_getaffinity.c
-@@ -0,0 +1,64 @@
+@@ -0,0 +1,65 @@
 +/* Copyright (C) 2002, 2003, 2004, 2005, 2006 Free Software Foundation, Inc.
 +   This file is part of the GNU C Library.
 +
@@ -23880,24 +24570,25 @@
 +#include <unistd.h>
 +#include <sys/types.h>
 +
-+/* From <sys/cpuset.h> */
-+#define CPU_LEVEL_WHICH         3       /* Actual mask/id for which. */
-+#define CPU_WHICH_PID           2       /* Specifies a process id. */
++#include "cpuset-kern.h"
 +
-+extern int __syscall_cpuset_getaffinity(int level, int which, int64_t id,
-+					size_t setsize, cpu_set_t *mask);
-+libc_hidden_proto(__syscall_cpuset_getaffinity)
-+
 +int
 +__libc_sched_getaffinity (pid_t pid, size_t cpusetsize, cpu_set_t *cpuset)
 +{
 +  int res;
++  int64_t id;
 +
-+  if (pid == 0)
++  if (pid < 0)
 +    {
-+      pid = __getpid();
++      __set_errno(ESRCH);
++      return -1;
 +    }
 +
++  if (pid == 0)		// user   level "self"
++      id = -1;		// kernel level "self"
++  else
++      id = pid;
++
 +  if (cpusetsize > sizeof(cpu_set_t))
 +    {
 +      /* Clean the rest of the memory the kernel won't do.  */
@@ -23907,7 +24598,7 @@
 +    }
 +
 +  res = INLINE_SYSCALL (cpuset_getaffinity, 5, CPU_LEVEL_WHICH,
-+			CPU_WHICH_PID, pid, cpusetsize, cpuset);
++			CPU_WHICH_PID, id, cpusetsize, cpuset);
 +
 +  if (errno == ERANGE)
 +    {
@@ -23995,27 +24686,27 @@
 +#include <unistd.h>
 +#include <sys/types.h>
 +
-+/* From <sys/cpuset.h> */
-+#define CPU_LEVEL_WHICH         3       /* Actual mask/id for which. */
-+#define CPU_WHICH_PID           2       /* Specifies a process id. */
++#include "cpuset-kern.h"
 +
-+extern int __syscall_cpuset_setaffinity(int level, int which, int64_t id,
-+					size_t setsize, const cpu_set_t *mask);
-+libc_hidden_proto(__syscall_cpuset_setaffinity)
-+
 +int
 +__libc_sched_setaffinity (pid_t pid, size_t cpusetsize, const cpu_set_t *cpuset)
 +{
 +  int res;
++  int64_t id;
 +
-+  if (pid == 0)
++  if (pid < 0)
 +    {
-+      pid = __getpid();
++      __set_errno(ESRCH);
++      return -1;
 +    }
 +
++  if (pid == 0)		// user   level "self"
++      id = -1;		// kernel level "self"
++  else
++      id = pid;
 +
 +  res = INLINE_SYSCALL (cpuset_setaffinity, 5, CPU_LEVEL_WHICH,
-+			CPU_WHICH_PID, pid, cpusetsize, cpuset);
++			CPU_WHICH_PID, id, cpusetsize, cpuset);
 +
 +  if (errno == ERANGE || errno == EDEADLK)
 +    {
@@ -24034,7 +24725,7 @@
 +#include <sysdeps/posix/seekdir.c>
 --- /dev/null
 +++ b/ports/sysdeps/unix/bsd/bsd4.4/kfreebsd/semctl.c
-@@ -0,0 +1,89 @@
+@@ -0,0 +1,175 @@
 +/* Copyright (C) 2004, 2010 Free Software Foundation, Inc.
 +   This file is part of the GNU C Library.
 +   Contributed by Robert Millan
@@ -24086,7 +24777,15 @@
 +#include <stdarg.h> /* va_list */
 +#include <stdlib.h> /* NULL */
 +#include <unistd.h>
++#include <ipc_priv.h>
 +
++#include <sysdep.h>
++#include <string.h>
++#include <sys/syscall.h>
++#include <bits/wordsize.h>
++#include <shlib-compat.h>
++
++
 +/* union semun from FreeBSD <sys/sem.h> */
 +/*
 + * semctl's arg parameter structure
@@ -24095,6 +24794,7 @@
 +{
 +  int val;			/* value for SETVAL */
 +  struct semid_ds *buf;		/* buffer for IPC_STAT & IPC_SET */
++  struct semid_ds_old *oldbuf;	/* buffer for IPC_STAT & IPC_SET */
 +  unsigned short *array;	/* array for GETALL & SETALL */
 +};
 +
@@ -24103,27 +24803,104 @@
 +libc_hidden_proto (__syscall_semctl)
 +
 +int
-+semctl (int semid, int semnum, int cmd, ...)
++__new_semctl (int semid, int semnum, int cmd, ...)
 +{
-+  va_list ap;
-+  union semun semun;
-+  union semun *semun_ptr;
++    va_list ap;
++    union semun semun;
++    union semun *semun_ptr;
 +
-+  va_start (ap, cmd);
-+  if (cmd == IPC_SET || cmd == IPC_STAT || cmd == GETALL
-+      || cmd == SETVAL || cmd == SETALL)
++    va_start (ap, cmd);
++    switch (cmd) 
 +    {
-+      semun = va_arg (ap, union semun);
-+      semun_ptr = &semun;
++        case SEM_STAT:
++        case IPC_SET: 
++        case IPC_STAT: 
++        case GETALL:
++        case SETVAL:  
++        case SETALL:
++            semun = va_arg (ap, union semun);
++            semun_ptr = &semun;
++        break;
++        default:                                                  
++            semun_ptr = NULL;
 +    }
-+  else
++    va_end (ap);
++    return INLINE_SYSCALL (semctl, 4, semid, semnum, cmd, semun_ptr);
++}
++versioned_symbol (libc, __new_semctl, semctl, GLIBC_2_18);
++
++#if SHLIB_COMPAT (libc, GLIBC_2_0, GLIBC_2_18)
++
++struct semid_ds_old
++{
++  struct ipc_perm_old sem_perm;		/* operation permission struct */
++  void *__sem_base;
++  unsigned short int sem_nsems;		/* number of semaphores in set */
++  __time_t sem_otime;			/* last semop() time */
++  long __unused1;
++  __time_t sem_ctime;			/* last time changed by semctl() */
++  long __unused2;
++  long __unused3[4];
++};
++
++int
++attribute_compat_text_section
++__old_semctl (int semid, int semnum, int cmd, ...)
++{
++    struct semid_ds newbuf;
++    struct semid_ds_old *buf;
++    int rv;
++
++    va_list ap;
++    union semun semun;
++    union semun *semun_ptr;
++
++    va_start (ap, cmd);
++    switch (cmd) 
 +    {
-+      semun_ptr = NULL;
++        case SEM_STAT:
++        case IPC_SET: 
++        case IPC_STAT:
++            semun = va_arg (ap, union semun);
++            buf = semun.oldbuf;
++            semun.buf = &newbuf;
++	    semun_ptr = &semun;
++	break;
++        case GETALL:
++        case SETVAL:  
++        case SETALL:
++            semun = va_arg (ap, union semun);
++	    semun_ptr = &semun;
++        break;
++        default:                                                  
++            semun_ptr = NULL;
 +    }
-+  va_end (ap);
-+
-+  return INLINE_SYSCALL (semctl, 4, semid, semnum, cmd, semun_ptr);
++    va_end (ap);
++  
++    if (cmd == IPC_SET)
++    {
++        ipc_perm_old2new(&(buf->sem_perm), &(newbuf.sem_perm));
++        newbuf.__sem_base = buf->__sem_base;
++        newbuf.sem_nsems  = buf->sem_nsems;
++        newbuf.sem_otime  = buf->sem_otime;
++        newbuf.sem_ctime  = buf->sem_ctime;
++    }
++    
++    rv = INLINE_SYSCALL (semctl, 4, semid, semnum, cmd, semun_ptr);
++    
++    if ((rv != -1) && ((cmd == IPC_STAT) || (cmd == SEM_STAT)))
++    {
++        ipc_perm_new2old(&(newbuf.sem_perm), &(buf->sem_perm));
++        buf->__sem_base = newbuf.__sem_base;
++        buf->sem_nsems  = newbuf.sem_nsems;
++        buf->sem_otime  = newbuf.sem_otime;
++        buf->sem_ctime  = newbuf.sem_ctime;
++    }
++        
++    return rv;
 +}
++compat_symbol (libc, __old_semctl, semctl, GLIBC_2_0);
++#endif
 --- /dev/null
 +++ b/ports/sysdeps/unix/bsd/bsd4.4/kfreebsd/send.c
 @@ -0,0 +1,47 @@
@@ -24408,6 +25185,100 @@
 @@ -0,0 +1 @@
 +/* 'setrlimit64' is the same as 'setrlimit', because __rlim64_t == __rlim_t.  */
 --- /dev/null
++++ b/ports/sysdeps/unix/bsd/bsd4.4/kfreebsd/shmctl.c
+@@ -0,0 +1,91 @@
++/* Copyright (C) 2013 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, see
++   <http://www.gnu.org/licenses/>.  */
++
++#include <errno.h>
++#include <sys/shm.h>
++#include <ipc_priv.h>
++
++#include <sysdep.h>
++#include <string.h>
++#include <sys/syscall.h>
++#include <bits/wordsize.h>
++#include <shlib-compat.h>
++
++#include <kernel-features.h>
++
++/* Provide operations to control over shared memory segments.  */
++extern int __syscall_shmctl (int shmid, int cmd, struct shmid_ds *buf);
++libc_hidden_proto (__syscall_shmctl)
++
++
++int
++__new_shmctl (int shmid, int cmd, struct shmid_ds *buf)
++{
++  return INLINE_SYSCALL (shmctl, 3, shmid, cmd, buf);
++}
++versioned_symbol (libc, __new_shmctl, shmctl, GLIBC_2_18);
++
++#if SHLIB_COMPAT (libc, GLIBC_2_0, GLIBC_2_18)
++struct shmid_ds_old {
++        struct ipc_perm_old shm_perm;   /* operation permission structure */
++        int             shm_segsz;      /* size of segment in bytes */
++        pid_t           shm_lpid;   /* process ID of last shared memory op */
++        pid_t           shm_cpid;       /* process ID of creator */
++        unsigned short  shm_nattch;     /* number of current attaches */
++        time_t          shm_atime;      /* time of last shmat() */
++        time_t          shm_dtime;      /* time of last shmdt() */
++        time_t          shm_ctime;      /* time of last change by shmctl() */
++        void           *shm_internal;   /* sysv stupidity */
++};
++
++int
++attribute_compat_text_section
++__old_shmctl (int shmid, int cmd, struct shmid_ds_old *buf)
++{
++    struct shmid_ds newbuf;
++    int rv;
++    
++    if (cmd == IPC_SET)
++    {
++        ipc_perm_old2new(&(buf->shm_perm), &(newbuf.shm_perm));
++        newbuf.shm_segsz = buf->shm_segsz;
++        newbuf.shm_lpid  = buf->shm_lpid;
++        newbuf.shm_cpid  = buf->shm_cpid;
++        newbuf.shm_nattch= buf->shm_nattch;
++        newbuf.shm_atime = buf->shm_atime;
++        newbuf.shm_dtime = buf->shm_dtime;
++        newbuf.shm_ctime = buf->shm_ctime;
++    }
++    
++    rv = __new_shmctl (shmid, cmd, &newbuf);
++    
++    if ((rv != -1) && (cmd == IPC_STAT))
++    {
++        ipc_perm_new2old(&(newbuf.shm_perm), &(buf->shm_perm));
++        buf->shm_segsz = newbuf.shm_segsz;
++        buf->shm_lpid  = newbuf.shm_lpid;
++        buf->shm_cpid  = newbuf.shm_cpid;
++        buf->shm_nattch= newbuf.shm_nattch;
++        buf->shm_atime = newbuf.shm_atime;
++        buf->shm_dtime = newbuf.shm_dtime;
++        buf->shm_ctime = newbuf.shm_ctime;
++    }
++        
++    return rv;
++}
++compat_symbol (libc, __old_shmctl, shmctl, GLIBC_2_0);
++#endif
+--- /dev/null
 +++ b/ports/sysdeps/unix/bsd/bsd4.4/kfreebsd/sigaction.c
 @@ -0,0 +1,51 @@
 +/* Copyright (C) 1991,1995,1996,1997,2002,2004 Free Software Foundation, Inc.
@@ -24597,9 +25468,9 @@
 +#include <bits/stat16.h>
 +
 +extern int __syscall_fhstat (const fhandle_t *fhp, struct stat16 *buf);
-+extern int __syscall_fstat (int, struct stat16 *__unbounded);
-+extern int __syscall_lstat (const char *__unbounded, struct stat16 *__unbounded);
-+extern int __syscall_stat (const char *__unbounded, struct stat16 *__unbounded);
++extern int __syscall_fstat (int, struct stat16 *);
++extern int __syscall_lstat (const char *, struct stat16 *);
++extern int __syscall_stat (const char *, struct stat16 *);
 +libc_hidden_proto (__syscall_fhstat)
 +libc_hidden_proto (__syscall_fstat)
 +libc_hidden_proto (__syscall_lstat)
@@ -26569,8 +27440,8 @@
 +#define	SYS_jail_remove	508
 +#define	SYS_closefrom	509
 +#define	SYS___semctl	510
-+#define	SYS_msgctl	SYS_freebsd7_msgctl
-+#define	SYS_shmctl	SYS_freebsd7_shmctl
++#define	SYS_msgctl	511
++#define	SYS_shmctl	512
 +#define	SYS_lpathconf	513
 +#define	SYS_cap_new	514
 +#define	SYS_cap_rights_get	515
@@ -26606,7 +27477,7 @@
 +#define SYS_sysctl	SYS___sysctl
 +#define SYS_getcwd	SYS___getcwd
 +#define SYS_setugid	SYS___setugid
-+#define SYS_semctl	SYS_freebsd7___semctl
++#define SYS_semctl	SYS___semctl
 +
 +#define SYS_acl_get_file	SYS___acl_get_file
 +#define SYS_acl_set_file	SYS___acl_set_file
@@ -26963,7 +27834,7 @@
 +#endif
 --- /dev/null
 +++ b/ports/sysdeps/unix/bsd/bsd4.4/kfreebsd/syscalls.list
-@@ -0,0 +1,211 @@
+@@ -0,0 +1,212 @@
 +# File name		Caller	Syscall name		# args		Strong name	Weak names
 +sys_access		-	access			i:si		__syscall_access
 +acl_aclcheck_fd		-	acl_aclcheck_fd		i:iip		__acl_aclcheck_fd
@@ -27074,7 +27945,7 @@
 +modnext			-	modnext			i:i		modnext
 +modstat			-	modstat			i:ip		modstat
 +mount			-	mount			i:ssiP		mount
-+msgctl			-	msgctl			i:iip		msgctl
++sys_msgctl		-	msgctl			i:iip		__syscall_msgctl
 +msgget			-	msgget			i:ii		msgget
 +msgrcv			-	msgrcv			Ci:ibnii	__libc_msgrcv msgrcv
 +msgsnd			-	msgsnd			Ci:ibni		__libc_msgsnd msgsnd
@@ -27090,6 +27961,7 @@
 +nmount			-	nmount			i:pii		nmount
 +sys_nstat		-	nstat			i:sp		__syscall_nstat
 +ntp_adjtime		-	ntp_adjtime		i:p		ntp_adjtime
++ntp_gettime		-	ntp_gettime		i:p		ntp_gettime
 +obreak			-	obreak			i:a		__syscall_obreak
 +sys_open		-	open			i:siv		__syscall_open
 +sys_openat		-	openat			i:isii		__syscall_openat !__openat_nocancel  !__openat64_nocancel
@@ -27136,7 +28008,7 @@
 +shm_open		-	shm_open		i:sii		shm_open
 +shm_unlink		-	shm_unlink		i:s		shm_unlink
 +shmat			-	shmat			i:iai		shmat
-+shmctl			-	shmctl			i:iip		shmctl
++sys_shmctl		-	shmctl			i:iip		__syscall_shmctl
 +shmdt			-	shmdt			i:a		shmdt
 +shmget			-	shmget			i:iii		shmget
 +sys_sigaction		-	sigaction		i:ipp		__syscall_sigaction
@@ -27631,11 +28503,6 @@
 +
 +weak_alias (__ttyname_r, ttyname_r)
 --- /dev/null
-+++ b/ports/sysdeps/unix/bsd/bsd4.4/kfreebsd/ulimit.c
-@@ -0,0 +1,2 @@
-+/* just use linux variant */
-+#include <sysdeps/unix/sysv/linux/ulimit.c>
---- /dev/null
 +++ b/ports/sysdeps/unix/bsd/bsd4.4/kfreebsd/uname.c
 @@ -0,0 +1,110 @@
 +/* Copyright (C) 2002, 2006 Free Software Foundation, Inc.
@@ -28585,6 +29452,73 @@
 @@ -0,0 +1 @@
 +#include <sysdeps/unix/sysv/linux/wait3.c>
 --- /dev/null
++++ b/ports/sysdeps/unix/bsd/bsd4.4/kfreebsd/waitid.c
+@@ -0,0 +1,64 @@
++/* 
++   Copyright (C) 2004-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.
++
++   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/>.  */
++
++#include <shlib-compat.h>
++#include <stddef.h>
++#include <errno.h>
++#include <sys/wait.h>
++#include <sysdep.h>
++
++/* for now only the wrapper implementation */
++/* later on we will try to use wait6 when available */
++
++#define waitid __unused_waitid_alias
++#include <sysdeps/posix/waitid.c>
++#undef waitid
++
++versioned_symbol (libc, __waitid, waitid, GLIBC_2_18);
++
++#if SHLIB_COMPAT (libc, GLIBC_2_1, GLIBC_2_18)
++
++/* it used to be: */
++
++#define OLD_P_ALL	0
++#define OLD_P_PID	1
++#define OLD_P_PGID	2
++
++int
++__waitid_old (idtype_t oldtype, id_t id, siginfo_t *infop, int options)
++{
++  idtype_t newtype;
++
++  switch (oldtype)
++  {
++      case OLD_P_ALL:
++          newtype = P_ALL;
++      break;
++      case OLD_P_PID:
++          newtype = P_PID;
++      break;
++      case OLD_P_PGID:
++          newtype = P_PGID;
++      break;
++      default:
++          newtype = oldtype;
++   }
++  return __waitid(newtype, id, infop, options);
++}
++compat_symbol (libc, __waitid_old, waitid, GLIBC_2_1);
++#endif
+--- /dev/null
 +++ b/ports/sysdeps/unix/bsd/bsd4.4/kfreebsd/waitpid.c
 @@ -0,0 +1,56 @@
 +/* Copyright (C) 1991,95,96,97,2002 Free Software Foundation, Inc.
@@ -28645,7 +29579,7 @@
 +weak_alias (__libc_waitpid, waitpid)
 --- /dev/null
 +++ b/ports/sysdeps/unix/bsd/bsd4.4/kfreebsd/writev.c
-@@ -0,0 +1,57 @@
+@@ -0,0 +1,56 @@
 +/* writev for FreeBSD.
 +   Copyright (C) 1997-1998, 2000, 2002 Free Software Foundation, Inc.
 +   This file is part of the GNU C Library.
@@ -28672,10 +29606,9 @@
 +
 +#include <sysdep.h>
 +#include <sys/syscall.h>
-+#include <bp-checks.h>
 +#include <sysdep-cancel.h>
 +
-+extern ssize_t __syscall_writev (int, const struct iovec *__unbounded, int);
++extern ssize_t __syscall_writev (int, const struct iovec *, int);
 +
 +static ssize_t __atomic_writev_replacement (int, const struct iovec *,
 +					    int) internal_function;
@@ -28686,10 +29619,10 @@
 +  if (count <= UIO_MAXIOV)
 +  {
 +    if (SINGLE_THREAD_P)
-+      return INLINE_SYSCALL (writev, 3, fd, CHECK_N (vector, count), count);
++      return INLINE_SYSCALL (writev, 3, fd, vector, count);
 +
 +    int oldtype = LIBC_CANCEL_ASYNC ();
-+    ssize_t result =  INLINE_SYSCALL (writev, 3, fd, CHECK_N (vector, count), count);
++    ssize_t result =  INLINE_SYSCALL (writev, 3, fd, vector, count);
 +    LIBC_CANCEL_RESET (oldtype);
 +    return result;
 +
@@ -29558,8 +30491,12 @@
 +#include <sysdeps/unix/sysv/linux/x86_64/dl-procinfo.c>
 --- /dev/null
 +++ b/ports/sysdeps/unix/bsd/bsd4.4/kfreebsd/x86_64/dl-procinfo.h
-@@ -0,0 +1 @@
-+#include <sysdeps/unix/sysv/linux/x86_64/dl-procinfo.h>
+@@ -0,0 +1,5 @@
++#ifdef IS_IN_ldconfig
++# include <sysdeps/unix/bsd/bsd4.4/kfreebsd/i386/dl-procinfo.h>
++#else
++# include <sysdeps/generic/dl-procinfo.h>
++#endif
 --- /dev/null
 +++ b/ports/sysdeps/unix/bsd/bsd4.4/kfreebsd/x86_64/fbtl/Implies
 @@ -0,0 +1 @@
@@ -30846,7 +31783,7 @@
 +  (handler)((signo), SIGCONTEXT_EXTRA_ARGS (ctx))
 --- /dev/null
 +++ b/ports/sysdeps/unix/bsd/bsd4.4/kfreebsd/x86_64/start.S
-@@ -0,0 +1,157 @@
+@@ -0,0 +1,156 @@
 +/* Startup code for FreeBSD/amd64 ABI.
 +   Copyright (C) 2001, 2002, 2003 Free Software Foundation, Inc.
 +   This file is part of the GNU C Library.
@@ -30923,7 +31860,6 @@
 +
 +#include <sysdep.h>
 +#include <libc-symbols.h>
-+#include "bp-sym.h"
 +
 +	weak_extern (_end)
 +
@@ -30970,21 +31906,21 @@
 +	movq __libc_csu_fini@GOTPCREL(%rip), %r8
 +	movq __libc_csu_init@GOTPCREL(%rip), %rcx
 +
-+	movq BP_SYM (main)@GOTPCREL(%rip), %rdi
++	movq main@GOTPCREL(%rip), %rdi
 +
 +	/* Call the user's main function, and exit with its value.
 +	   But let the libc call main.	  */
-+	call BP_SYM (__libc_start_main)@PLT
++	call __libc_start_main@PLT
 +#else
 +	/* Pass address of our own entry points to .fini and .init.  */
 +	movq $__libc_csu_fini, %r8
 +	movq $__libc_csu_init, %rcx
 +
-+	movq $BP_SYM (main), %rdi
++	movq $main, %rdi
 +
 +	/* Call the user's main function, and exit with its value.
 +	   But let the libc call main.	  */
-+	call BP_SYM (__libc_start_main)
++	call __libc_start_main
 +#endif
 +
 +	hlt			/* Crash if somehow `exit' does return.	 */
@@ -31789,7 +32725,7 @@
 +#endif	/* !PIC */
 --- /dev/null
 +++ b/ports/sysdeps/unix/bsd/bsd4.4/kfreebsd/x86_64/sysdep.h
-@@ -0,0 +1,209 @@
+@@ -0,0 +1,207 @@
 +/* Copyright (C) 2001,02,03,04 Free Software Foundation, Inc.
 +   This file is part of the GNU C Library.
 +   Modification for FreeBSD contributed by Petr Salinger, 2006.
@@ -31814,8 +32750,6 @@
 +
 +/* There is some commonality.  */
 +#include <sysdeps/unix/x86_64/sysdep.h>
-+#include <bp-sym.h>
-+#include <bp-asm.h>
 +#include <tls.h>
 +
 +#ifdef IS_IN_rtld
@@ -32229,7 +33163,7 @@
 +libc_hidden_def (__xmknodat)
 --- /dev/null
 +++ b/ports/sysdeps/unix/bsd/bsd4.4/kfreebsd/xstat.c
-@@ -0,0 +1,49 @@
+@@ -0,0 +1,47 @@
 +/* xstat using FreeBSD stat, nstat system calls.
 +   Copyright (C) 1991,1995-1997,2000,2002 Free Software Foundation, Inc.
 +   This file is part of the GNU C Library.
@@ -32252,7 +33186,6 @@
 +#include <errno.h>
 +#include <stddef.h>
 +#include <sys/stat.h>
-+#include <bp-checks.h>
 +
 +#include "stat16conv.c"
 +
@@ -32262,14 +33195,13 @@
 +  if (__builtin_expect (vers == _STAT_VER, 1))
 +    {
 +      struct stat16 buf16;
-+      int result = __syscall_stat (CHECK_STRING (file), __ptrvalue (&buf16));
++      int result = __syscall_stat (file, &buf16);
 +      if (result == 0)
 +	stat16_to_stat (&buf16, buf);
 +      return result;
 +    }
 +  else if (__builtin_expect (vers == _STAT_VER_stat, 1))
-+    return __syscall_stat (CHECK_STRING (file),
-+			   CHECK_1 ((struct stat16 *) buf));
++    return __syscall_stat (file, (struct stat16 *) buf);
 +  else
 +    {
 +      __set_errno (EINVAL);
@@ -32281,7 +33213,7 @@
 +weak_alias (__xstat, _xstat)
 --- /dev/null
 +++ b/ports/sysdeps/unix/bsd/bsd4.4/kfreebsd/xstat64.c
-@@ -0,0 +1,44 @@
+@@ -0,0 +1,43 @@
 +/* xstat using FreeBSD stat, nstat system calls.
 +   Copyright (C) 1991,1995-1997,2000,2002 Free Software Foundation, Inc.
 +   This file is part of the GNU C Library.
@@ -32304,7 +33236,6 @@
 +#include <errno.h>
 +#include <stddef.h>
 +#include <sys/stat.h>
-+#include <bp-checks.h>
 +
 +#include "stat16conv.c"
 +
@@ -32314,7 +33245,7 @@
 +  if (__builtin_expect (vers == _STAT_VER, 1))
 +    {
 +      struct stat16 buf16;
-+      int result = __syscall_stat (CHECK_STRING (file), __ptrvalue (&buf16));
++      int result = __syscall_stat (file, &buf16);
 +      if (result == 0)
 +	stat16_to_stat64 (&buf16, buf);
 +      return result;



Reply to: