[T106][ZXW-22]7520V3SCV2.01.01.02P42U09_VEC_V0.8_AP_VEC origin source commit

Change-Id: Ic6e05d89ecd62fc34f82b23dcf306c93764aec4b
diff --git a/ap/build/uClibc/test/API/Makefile b/ap/build/uClibc/test/API/Makefile
new file mode 100644
index 0000000..458d6c5
--- /dev/null
+++ b/ap/build/uClibc/test/API/Makefile
@@ -0,0 +1,7 @@
+# uClibc API tests
+# Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
+
+top_builddir=../../
+include ../Rules.mak
+-include Makefile.in
+include ../Test.mak
diff --git a/ap/build/uClibc/test/API/Makefile.in b/ap/build/uClibc/test/API/Makefile.in
new file mode 100644
index 0000000..9e7cfdf
--- /dev/null
+++ b/ap/build/uClibc/test/API/Makefile.in
@@ -0,0 +1,26 @@
+# uClibc API tests
+# Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
+
+SHELL_TESTS := shell_tst-API
+run: $(SHELL_TESTS)
+
+define get_codes
+	$(subst .,,$(sort $(suffix $(subst -,.,$(foreach x,$(1),$(if $(findstring -,$(x)),$(x),))))))
+endef
+sym_files = $(patsubst %.syms,%,$(wildcard *.syms))
+stds = $(patsubst .%,%,$(sort $(suffix $(sym_files))))
+tests=$(foreach s,$(stds),$(patsubst %.$(s),%,$(sym_files)))
+codes=$(call get_codes,$(tests))
+
+shell_tst-API: uclibc_out=$(patsubst shell_%,%,$@).out
+shell_tst-API: glibc_out=$(patsubst shell_%,%_glibc,$@).out
+shell_tst-API:
+	@exec echo "DISABLED for now, needs improvement"
+shell_tst-API_DISABLED:
+	$(showtest)
+	$(Q)top_builddir=$(top_builddir) AWK=$(AWK) \
+	uclibc_out=$(uclibc_out) glibc_out=$(glibc_out) \
+	$(SHELL) \
+		$(patsubst shell_%,%.sh,$@) $(stds) "$(tests)"
+	$(do_showdiff) $(glibc_out) $(uclibc_out) ; \
+	exec diff -u "$(glibc_out)" "$(uclibc_out)"
diff --git a/ap/build/uClibc/test/API/aio.SUSv4.syms b/ap/build/uClibc/test/API/aio.SUSv4.syms
new file mode 100644
index 0000000..c7d13e0
--- /dev/null
+++ b/ap/build/uClibc/test/API/aio.SUSv4.syms
@@ -0,0 +1,8 @@
+aio_cancel
+aio_error
+aio_fsync
+aio_read
+aio_return
+aio_suspend
+aio_write
+lio_listio
diff --git a/ap/build/uClibc/test/API/arpa_inet.SUSv4.syms b/ap/build/uClibc/test/API/arpa_inet.SUSv4.syms
new file mode 100644
index 0000000..e61cc9f
--- /dev/null
+++ b/ap/build/uClibc/test/API/arpa_inet.SUSv4.syms
@@ -0,0 +1,8 @@
+htonl
+htons
+ntohl
+ntohs
+inet_addr
+inet_ntoa
+inet_ntop
+inet_pton
diff --git a/ap/build/uClibc/test/API/complex.SUSv4.syms b/ap/build/uClibc/test/API/complex.SUSv4.syms
new file mode 100644
index 0000000..ce7be69
--- /dev/null
+++ b/ap/build/uClibc/test/API/complex.SUSv4.syms
@@ -0,0 +1,66 @@
+cabs
+cabsf
+cabsl
+cacos
+cacosf
+cacosh
+cacoshf
+cacoshl
+cacosl
+carg
+cargf
+cargl
+casin
+casinf
+casinh
+casinhf
+casinhl
+casinl
+catan
+catanf
+catanh
+catanhf
+catanhl
+catanl
+ccos
+ccosf
+ccosh
+ccoshf
+ccoshl
+ccosl
+cexp
+cexpf
+cexpl
+cimag
+cimagf
+cimagl
+clog
+clogf
+clogl
+conj
+conjf
+conjl
+cpow
+cpowf
+cpowl
+cproj
+cprojf
+cprojl
+creal
+crealf
+creall
+csin
+csinf
+csinh
+csinhf
+csinhl
+csinl
+csqrt
+csqrtf
+csqrtl
+ctan
+ctanf
+ctanh
+ctanhf
+ctanhl
+ctanl
diff --git a/ap/build/uClibc/test/API/ctype-CX.SUSv4.syms b/ap/build/uClibc/test/API/ctype-CX.SUSv4.syms
new file mode 100644
index 0000000..3963c49
--- /dev/null
+++ b/ap/build/uClibc/test/API/ctype-CX.SUSv4.syms
@@ -0,0 +1,14 @@
+isalnum_l
+isalpha_l
+isblank_l
+iscntrl_l
+isdigit_l
+isgraph_l
+islower_l
+isprint_l
+ispunct_l
+isspace_l
+isupper_l
+isxdigit_l
+tolower_l
+toupper_l
diff --git a/ap/build/uClibc/test/API/ctype-OBXSI.SUSv4.syms b/ap/build/uClibc/test/API/ctype-OBXSI.SUSv4.syms
new file mode 100644
index 0000000..7a5ad9b
--- /dev/null
+++ b/ap/build/uClibc/test/API/ctype-OBXSI.SUSv4.syms
@@ -0,0 +1,2 @@
+isascii
+toascii
diff --git a/ap/build/uClibc/test/API/ctype.SUSv4.syms b/ap/build/uClibc/test/API/ctype.SUSv4.syms
new file mode 100644
index 0000000..fac123f
--- /dev/null
+++ b/ap/build/uClibc/test/API/ctype.SUSv4.syms
@@ -0,0 +1,14 @@
+isalnum
+isalpha
+isblank
+iscntrl
+isdigit
+isgraph
+islower
+isprint
+ispunct
+isspace
+isupper
+isxdigit
+tolower
+toupper
diff --git a/ap/build/uClibc/test/API/dirent-XSI.SUSv4.syms b/ap/build/uClibc/test/API/dirent-XSI.SUSv4.syms
new file mode 100644
index 0000000..9791070
--- /dev/null
+++ b/ap/build/uClibc/test/API/dirent-XSI.SUSv4.syms
@@ -0,0 +1,2 @@
+seekdir
+telldir
diff --git a/ap/build/uClibc/test/API/dirent.SUSv4.syms b/ap/build/uClibc/test/API/dirent.SUSv4.syms
new file mode 100644
index 0000000..e749efb
--- /dev/null
+++ b/ap/build/uClibc/test/API/dirent.SUSv4.syms
@@ -0,0 +1,9 @@
+alphasort
+closedir
+dirfd
+fdopendir
+opendir
+readdir
+readdir_r
+rewinddir
+scandir
diff --git a/ap/build/uClibc/test/API/dlfcn.SUSv4.syms b/ap/build/uClibc/test/API/dlfcn.SUSv4.syms
new file mode 100644
index 0000000..1e7500e
--- /dev/null
+++ b/ap/build/uClibc/test/API/dlfcn.SUSv4.syms
@@ -0,0 +1,4 @@
+dlclose
+dlerror
+dlopen
+dlsym
diff --git a/ap/build/uClibc/test/API/fcntl-ADV.SUSv4.syms b/ap/build/uClibc/test/API/fcntl-ADV.SUSv4.syms
new file mode 100644
index 0000000..899236e
--- /dev/null
+++ b/ap/build/uClibc/test/API/fcntl-ADV.SUSv4.syms
@@ -0,0 +1,2 @@
+posix_fadvise
+posix_fallocate
diff --git a/ap/build/uClibc/test/API/fcntl.SUSv4.syms b/ap/build/uClibc/test/API/fcntl.SUSv4.syms
new file mode 100644
index 0000000..588085b
--- /dev/null
+++ b/ap/build/uClibc/test/API/fcntl.SUSv4.syms
@@ -0,0 +1,4 @@
+creat
+fcntl
+open
+openat
diff --git a/ap/build/uClibc/test/API/fenv.SUSv4.syms b/ap/build/uClibc/test/API/fenv.SUSv4.syms
new file mode 100644
index 0000000..a9aebcb
--- /dev/null
+++ b/ap/build/uClibc/test/API/fenv.SUSv4.syms
@@ -0,0 +1,11 @@
+feclearexcept
+fegetenv
+fegetexceptflag
+fegetround
+feholdexcept
+feraiseexcept
+fesetenv
+fesetexceptflag
+fesetround
+fetestexcept
+feupdateenv
diff --git a/ap/build/uClibc/test/API/ftw-OB.SUSv4.syms b/ap/build/uClibc/test/API/ftw-OB.SUSv4.syms
new file mode 100644
index 0000000..87a440f
--- /dev/null
+++ b/ap/build/uClibc/test/API/ftw-OB.SUSv4.syms
@@ -0,0 +1 @@
+ftw
diff --git a/ap/build/uClibc/test/API/ftw.SUSv4.syms b/ap/build/uClibc/test/API/ftw.SUSv4.syms
new file mode 100644
index 0000000..35000c9
--- /dev/null
+++ b/ap/build/uClibc/test/API/ftw.SUSv4.syms
@@ -0,0 +1 @@
+nftw
diff --git a/ap/build/uClibc/test/API/glob.SUSv4.syms b/ap/build/uClibc/test/API/glob.SUSv4.syms
new file mode 100644
index 0000000..c2e4234
--- /dev/null
+++ b/ap/build/uClibc/test/API/glob.SUSv4.syms
@@ -0,0 +1,2 @@
+glob
+globfree
diff --git a/ap/build/uClibc/test/API/grp-XSI.SUSv4.syms b/ap/build/uClibc/test/API/grp-XSI.SUSv4.syms
new file mode 100644
index 0000000..e2b1c1d
--- /dev/null
+++ b/ap/build/uClibc/test/API/grp-XSI.SUSv4.syms
@@ -0,0 +1 @@
+setgrent
diff --git a/ap/build/uClibc/test/API/grp.SUSv4.syms b/ap/build/uClibc/test/API/grp.SUSv4.syms
new file mode 100644
index 0000000..77a8c6e
--- /dev/null
+++ b/ap/build/uClibc/test/API/grp.SUSv4.syms
@@ -0,0 +1,6 @@
+endgrent
+getgrent
+getgrgid
+getgrgid_r
+getgrnam
+getgrnam_r
diff --git a/ap/build/uClibc/test/API/html2input.sh b/ap/build/uClibc/test/API/html2input.sh
new file mode 100755
index 0000000..9ea68fe
--- /dev/null
+++ b/ap/build/uClibc/test/API/html2input.sh
@@ -0,0 +1,119 @@
+#!/bin/sh
+# vi: ft=awk :
+#
+# Script to extract functions and external variables off SUS html docs
+#
+# Copyright (C) 2010 Bernhard Reutner-Fischer
+# Public Domain
+
+# Usage:
+# wget http://www.opengroup.org/onlinepubs/9699919799/download/susv4.tgz
+# tar xzf susv4.tgz
+# SUS=susv4 html2input.sh -vFULL_DECLARATIONS=1
+# or
+# SUS=susv4 html2input.sh -vFULL_DECLARATIONS=0 -vSTDNAME=SUSv4
+# 
+# Bug in time.h.html of SUSv4:
+# It inconsistently reads "as variables" instead of "external variables" that
+# is used everywhere except in time.h.html
+
+test "x$SUS" = "x" && SUS="susv4"
+test "x$AWK" = "x" && AWK="AWK"
+test "x$GREP" = "x" && GREP="GREP"
+for h in \
+  $($GREP -l "shall be declared as functions" $SUS/basedefs/*.h.html) \
+  $($GREP -l "shall declare the following as variables" $SUS/basedefs/*.h.html) \
+  $($GREP -l "shall declare the following external variables" $SUS/basedefs/*.h.html)
+do
+$AWK $* '
+function get_filename () {
+	if (NR == 1) {
+		x=FILENAME
+		sub(".*/", "", x)
+		split(x, f , ".")
+		fname=f[1]
+		if (STDNAME)
+			fname=fname "." STDNAME
+		fname=fname ".in"
+		printf "" > fname
+	}
+}
+function unhtml (l) {
+	sub("<tt>", "", l)
+	sub("</tt>", "", l)
+	sub("<sup>", "", l)
+	sub("</sup>", "", l)
+	sub("<a [^>]*>", "", l)
+	sub("</a>", "", l)
+	if (l ~ /<img[^>]*Option[[:space:]][[:space:]]*Start[^>]*>/) {
+		sub("<img[^>]*>", "[Option Start]", l)
+	} else if (l ~ /<img[^>]*Option[[:space:]][[:space:]]*End[^>]*>/) {
+		sub("<img[^>]*>", "[Option End]", l)
+	}
+	sub("<.*>", "", l)
+	return l
+}
+function get_funcname (l) {
+	if (FULL_DECLARATIONS)
+		return l
+	if (l !~ /;$/)
+		return l
+	cnt = split(l, foo, " ")
+	if (cnt >= 2 && foo[2] ~ /^\(\*/) {
+		cnt = split(l, foo, "(")
+		# good enough for signal() and sigset()
+		if (cnt >= 2)
+			l=foo[2]
+	} else {
+		sub("\\(.*", "", l)
+	}
+	gsub("[[\\]\\*]", "", l)
+	i = split(l, a, " ")
+	if (i)
+		l = a[i]
+	return l
+}
+function get_varname (l) {
+	if (FULL_DECLARATIONS)
+		return l
+	if (l !~ /;$/)
+		return l
+	gsub(",[[:space:]][[:space:]]*", ",", l)
+	sub(";$", "", l)
+	i = split(l, a, " ")
+	if (i)
+		l = a[i]
+	gsub("[[\\]\\*]", "", l)
+	gsub(",", "\n", l)
+	return l
+}
+BEGIN{data=0;l=""}
+get_filename()
+/shall be declared as functions/{data=1;isvar=0;next;}
+/shall declare the following as variables/{data=1;isvar=1;next;}
+/shall declare the following external variables/{data=1;isvar=1;next;}
+/<pre>/{data++;next;}
+/<\/pre>/{data=0;next;}
+/.*/{
+	if (data == 2 && fname) {
+		tmp = $0
+		sub("^[[:space:]][[:space:]]*", " ", tmp)
+		l = l tmp
+		tmp = unhtml(l)
+		if (!tmp)
+			next
+		l = tmp
+		if (tmp !~ /;$/ && tmp !~ />$/ &&
+			tmp !~ /Option Start\]$/ && tmp !~ /Option End\]$/)
+			next
+		if (!isvar)
+			l = get_funcname(l)
+		else
+			l = get_varname(l)
+		if (l)
+			print l >> fname
+		l=""
+	}
+}
+' $h
+done
diff --git a/ap/build/uClibc/test/API/iconv.SUSv4.syms b/ap/build/uClibc/test/API/iconv.SUSv4.syms
new file mode 100644
index 0000000..0599520
--- /dev/null
+++ b/ap/build/uClibc/test/API/iconv.SUSv4.syms
@@ -0,0 +1,3 @@
+iconv
+iconv_close
+iconv_open
diff --git a/ap/build/uClibc/test/API/inttypes.SUSv4.syms b/ap/build/uClibc/test/API/inttypes.SUSv4.syms
new file mode 100644
index 0000000..6cbc3a2
--- /dev/null
+++ b/ap/build/uClibc/test/API/inttypes.SUSv4.syms
@@ -0,0 +1,6 @@
+imaxabs
+imaxdiv
+strtoimax
+strtoumax
+wcstoimax
+wcstoumax
diff --git a/ap/build/uClibc/test/API/libgen.SUSv4.syms b/ap/build/uClibc/test/API/libgen.SUSv4.syms
new file mode 100644
index 0000000..3d4945a
--- /dev/null
+++ b/ap/build/uClibc/test/API/libgen.SUSv4.syms
@@ -0,0 +1,2 @@
+basename
+dirname
diff --git a/ap/build/uClibc/test/API/locale-CX.SUSv4.syms b/ap/build/uClibc/test/API/locale-CX.SUSv4.syms
new file mode 100644
index 0000000..22ffcfc
--- /dev/null
+++ b/ap/build/uClibc/test/API/locale-CX.SUSv4.syms
@@ -0,0 +1,4 @@
+duplocale
+freelocale
+newlocale
+uselocale
diff --git a/ap/build/uClibc/test/API/locale.SUSv4.syms b/ap/build/uClibc/test/API/locale.SUSv4.syms
new file mode 100644
index 0000000..33f8cad
--- /dev/null
+++ b/ap/build/uClibc/test/API/locale.SUSv4.syms
@@ -0,0 +1,2 @@
+localeconv
+setlocale
diff --git a/ap/build/uClibc/test/API/math-XSI.SUSv4.syms b/ap/build/uClibc/test/API/math-XSI.SUSv4.syms
new file mode 100644
index 0000000..4ce15d8
--- /dev/null
+++ b/ap/build/uClibc/test/API/math-XSI.SUSv4.syms
@@ -0,0 +1,6 @@
+j0
+j1
+jn
+y0
+y1
+yn
diff --git a/ap/build/uClibc/test/API/math.SUSv4.syms b/ap/build/uClibc/test/API/math.SUSv4.syms
new file mode 100644
index 0000000..5343ac0
--- /dev/null
+++ b/ap/build/uClibc/test/API/math.SUSv4.syms
@@ -0,0 +1,171 @@
+acos
+acosf
+acosh
+acoshf
+acoshl
+acosl
+asin
+asinf
+asinh
+asinhf
+asinhl
+asinl
+atan
+atan2
+atan2f
+atan2l
+atanf
+atanh
+atanhf
+atanhl
+atanl
+cbrt
+cbrtf
+cbrtl
+ceil
+ceilf
+ceill
+copysign
+copysignf
+copysignl
+cos
+cosf
+cosh
+coshf
+coshl
+cosl
+erf
+erfc
+erfcf
+erfcl
+erff
+erfl
+exp
+exp2
+exp2f
+exp2l
+expf
+expl
+expm1
+expm1f
+expm1l
+fabs
+fabsf
+fabsl
+fdim
+fdimf
+fdiml
+floor
+floorf
+floorl
+fma
+fmaf
+fmal
+fmax
+fmaxf
+fmaxl
+fmin
+fminf
+fminl
+fmod
+fmodf
+fmodl
+frexp
+frexpf
+frexpl
+hypot
+hypotf
+hypotl
+ilogb
+ilogbf
+ilogbl
+ldexp
+ldexpf
+ldexpl
+lgamma
+lgammaf
+lgammal
+llrint
+llrintf
+llrintl
+llround
+llroundf
+llroundl
+log
+log10
+log10f
+log10l
+log1p
+log1pf
+log1pl
+log2
+log2f
+log2l
+logb
+logbf
+logbl
+logf
+logl
+lrint
+lrintf
+lrintl
+lround
+lroundf
+lroundl
+modf
+modff
+modfl
+nan
+nanf
+nanl
+nearbyint
+nearbyintf
+nearbyintl
+nextafter
+nextafterf
+nextafterl
+nexttoward
+nexttowardf
+nexttowardl
+pow
+powf
+powl
+remainder
+remainderf
+remainderl
+remquo
+remquof
+remquol
+rint
+rintf
+rintl
+round
+roundf
+roundl
+scalbln
+scalblnf
+scalblnl
+scalbn
+scalbnf
+scalbnl
+sin
+sinf
+sinh
+sinhf
+sinhl
+sinl
+sqrt
+sqrtf
+sqrtl
+tan
+tanf
+tanh
+tanhf
+tanhl
+tanl
+tgamma
+tgammaf
+tgammal
+trunc
+truncf
+truncl
diff --git a/ap/build/uClibc/test/API/monetary.SUSv4.syms b/ap/build/uClibc/test/API/monetary.SUSv4.syms
new file mode 100644
index 0000000..256b53a
--- /dev/null
+++ b/ap/build/uClibc/test/API/monetary.SUSv4.syms
@@ -0,0 +1,2 @@
+strfmon
+strfmon_l
diff --git a/ap/build/uClibc/test/API/mqueue.SUSv4.syms b/ap/build/uClibc/test/API/mqueue.SUSv4.syms
new file mode 100644
index 0000000..54c80a0
--- /dev/null
+++ b/ap/build/uClibc/test/API/mqueue.SUSv4.syms
@@ -0,0 +1,10 @@
+mq_close
+mq_getattr
+mq_notify
+mq_open
+mq_receive
+mq_send
+mq_setattr
+mq_timedreceive
+mq_timedsend
+mq_unlink
diff --git a/ap/build/uClibc/test/API/ndbm.SUSv4.syms b/ap/build/uClibc/test/API/ndbm.SUSv4.syms
new file mode 100644
index 0000000..70116bf
--- /dev/null
+++ b/ap/build/uClibc/test/API/ndbm.SUSv4.syms
@@ -0,0 +1,9 @@
+dbm_clearerr
+dbm_close
+dbm_delete
+dbm_error
+dbm_fetch
+dbm_firstkey
+dbm_nextkey
+dbm_open
+dbm_store
diff --git a/ap/build/uClibc/test/API/net_if.SUSv4.syms b/ap/build/uClibc/test/API/net_if.SUSv4.syms
new file mode 100644
index 0000000..828a0cd
--- /dev/null
+++ b/ap/build/uClibc/test/API/net_if.SUSv4.syms
@@ -0,0 +1,4 @@
+if_freenameindex
+if_indextoname
+if_nameindex
+if_nametoindex
diff --git a/ap/build/uClibc/test/API/netdb.SUSv4.syms b/ap/build/uClibc/test/API/netdb.SUSv4.syms
new file mode 100644
index 0000000..daf932b
--- /dev/null
+++ b/ap/build/uClibc/test/API/netdb.SUSv4.syms
@@ -0,0 +1,22 @@
+endhostent
+endnetent
+endprotoent
+endservent
+freeaddrinfo
+gai_strerror
+getaddrinfo
+gethostent
+getnameinfo
+getnetbyaddr
+getnetbyname
+getnetent
+getprotobyname
+getprotobynumber
+getprotoent
+getservbyname
+getservbyport
+getservent
+sethostent
+setnetent
+setprotoent
+setservent
diff --git a/ap/build/uClibc/test/API/nl_types.SUSv4.syms b/ap/build/uClibc/test/API/nl_types.SUSv4.syms
new file mode 100644
index 0000000..ea00599
--- /dev/null
+++ b/ap/build/uClibc/test/API/nl_types.SUSv4.syms
@@ -0,0 +1,3 @@
+catclose
+catgets
+catopen
diff --git a/ap/build/uClibc/test/API/pthread-MC1.SUSv4.syms b/ap/build/uClibc/test/API/pthread-MC1.SUSv4.syms
new file mode 100644
index 0000000..8a47a39
--- /dev/null
+++ b/ap/build/uClibc/test/API/pthread-MC1.SUSv4.syms
@@ -0,0 +1,2 @@
+pthread_mutexattr_getprotocol
+pthread_mutexattr_setprotocol
diff --git a/ap/build/uClibc/test/API/pthread-OBXSI.SUSv4.syms b/ap/build/uClibc/test/API/pthread-OBXSI.SUSv4.syms
new file mode 100644
index 0000000..140b53d
--- /dev/null
+++ b/ap/build/uClibc/test/API/pthread-OBXSI.SUSv4.syms
@@ -0,0 +1,2 @@
+pthread_getconcurrency
+pthread_setconcurrency
diff --git a/ap/build/uClibc/test/API/pthread-RPP|TPP.SUSv4.syms b/ap/build/uClibc/test/API/pthread-RPP|TPP.SUSv4.syms
new file mode 100644
index 0000000..b116695f
--- /dev/null
+++ b/ap/build/uClibc/test/API/pthread-RPP|TPP.SUSv4.syms
@@ -0,0 +1,4 @@
+pthread_mutex_getprioceiling
+pthread_mutex_setprioceiling
+pthread_mutexattr_getprioceiling
+pthread_mutexattr_setprioceiling
diff --git a/ap/build/uClibc/test/API/pthread-TCT.SUSv4.syms b/ap/build/uClibc/test/API/pthread-TCT.SUSv4.syms
new file mode 100644
index 0000000..7153787
--- /dev/null
+++ b/ap/build/uClibc/test/API/pthread-TCT.SUSv4.syms
@@ -0,0 +1 @@
+pthread_getcpuclockid
diff --git a/ap/build/uClibc/test/API/pthread-TPS.SUSv4.syms b/ap/build/uClibc/test/API/pthread-TPS.SUSv4.syms
new file mode 100644
index 0000000..76fcd95
--- /dev/null
+++ b/ap/build/uClibc/test/API/pthread-TPS.SUSv4.syms
@@ -0,0 +1,9 @@
+pthread_attr_getinheritsched
+pthread_attr_getschedpolicy
+pthread_attr_getscope
+pthread_attr_setinheritsched
+pthread_attr_setschedpolicy
+pthread_attr_setscope
+pthread_getschedparam
+pthread_setschedparam
+pthread_setschedprio
diff --git a/ap/build/uClibc/test/API/pthread-TSATSS.SUSv4.syms b/ap/build/uClibc/test/API/pthread-TSATSS.SUSv4.syms
new file mode 100644
index 0000000..5e03091
--- /dev/null
+++ b/ap/build/uClibc/test/API/pthread-TSATSS.SUSv4.syms
@@ -0,0 +1,2 @@
+pthread_attr_getstack
+pthread_attr_setstack
diff --git a/ap/build/uClibc/test/API/pthread-TSH.SUSv4.syms b/ap/build/uClibc/test/API/pthread-TSH.SUSv4.syms
new file mode 100644
index 0000000..717b232
--- /dev/null
+++ b/ap/build/uClibc/test/API/pthread-TSH.SUSv4.syms
@@ -0,0 +1,8 @@
+pthread_barrierattr_getpshared
+pthread_barrierattr_setpshared
+pthread_condattr_getpshared
+pthread_condattr_setpshared
+pthread_mutexattr_getpshared
+pthread_mutexattr_setpshared
+pthread_rwlockattr_getpshared
+pthread_rwlockattr_setpshared
diff --git a/ap/build/uClibc/test/API/pthread-TSS.SUSv4.syms b/ap/build/uClibc/test/API/pthread-TSS.SUSv4.syms
new file mode 100644
index 0000000..1092f88
--- /dev/null
+++ b/ap/build/uClibc/test/API/pthread-TSS.SUSv4.syms
@@ -0,0 +1,2 @@
+pthread_attr_getstacksize
+pthread_attr_setstacksize
diff --git a/ap/build/uClibc/test/API/pthread.SUSv4.syms b/ap/build/uClibc/test/API/pthread.SUSv4.syms
new file mode 100644
index 0000000..524a6fe
--- /dev/null
+++ b/ap/build/uClibc/test/API/pthread.SUSv4.syms
@@ -0,0 +1,70 @@
+pthread_atfork
+pthread_attr_destroy
+pthread_attr_getdetachstate
+pthread_attr_getguardsize
+pthread_attr_getschedparam
+pthread_attr_init
+pthread_attr_setdetachstate
+pthread_attr_setguardsize
+pthread_attr_setschedparam
+pthread_barrier_destroy
+pthread_barrier_init
+pthread_barrier_wait
+pthread_barrierattr_destroy
+pthread_barrierattr_init
+pthread_cancel
+pthread_cleanup_pop
+pthread_cleanup_push
+pthread_cond_broadcast
+pthread_cond_destroy
+pthread_cond_init
+pthread_cond_signal
+pthread_cond_timedwait
+pthread_cond_wait
+pthread_condattr_destroy
+pthread_condattr_getclock
+pthread_condattr_init
+pthread_condattr_setclock
+pthread_create
+pthread_detach
+pthread_equal
+pthread_exit
+pthread_getspecific
+pthread_join
+pthread_key_create
+pthread_key_delete
+pthread_mutex_consistent
+pthread_mutex_destroy
+pthread_mutex_init
+pthread_mutex_lock
+pthread_mutex_timedlock
+pthread_mutex_trylock
+pthread_mutex_unlock
+pthread_mutexattr_destroy
+pthread_mutexattr_getrobust
+pthread_mutexattr_gettype
+pthread_mutexattr_init
+pthread_mutexattr_setrobust
+pthread_mutexattr_settype
+pthread_once
+pthread_rwlock_destroy
+pthread_rwlock_init
+pthread_rwlock_rdlock
+pthread_rwlock_timedrdlock
+pthread_rwlock_timedwrlock
+pthread_rwlock_tryrdlock
+pthread_rwlock_trywrlock
+pthread_rwlock_unlock
+pthread_rwlock_wrlock
+pthread_rwlockattr_destroy
+pthread_rwlockattr_init
+pthread_self
+pthread_setcancelstate
+pthread_setcanceltype
+pthread_setspecific
+pthread_spin_destroy
+pthread_spin_init
+pthread_spin_lock
+pthread_spin_trylock
+pthread_spin_unlock
+pthread_testcancel
diff --git a/ap/build/uClibc/test/API/pwd-XSI.SUSv4.syms b/ap/build/uClibc/test/API/pwd-XSI.SUSv4.syms
new file mode 100644
index 0000000..8b0350a
--- /dev/null
+++ b/ap/build/uClibc/test/API/pwd-XSI.SUSv4.syms
@@ -0,0 +1,3 @@
+endpwent
+getpwent
+setpwent
diff --git a/ap/build/uClibc/test/API/pwd.SUSv4.syms b/ap/build/uClibc/test/API/pwd.SUSv4.syms
new file mode 100644
index 0000000..45328f6
--- /dev/null
+++ b/ap/build/uClibc/test/API/pwd.SUSv4.syms
@@ -0,0 +1,4 @@
+getpwnam
+getpwnam_r
+getpwuid
+getpwuid_r
diff --git a/ap/build/uClibc/test/API/regex.SUSv4.syms b/ap/build/uClibc/test/API/regex.SUSv4.syms
new file mode 100644
index 0000000..94bf9fa
--- /dev/null
+++ b/ap/build/uClibc/test/API/regex.SUSv4.syms
@@ -0,0 +1,4 @@
+regcomp
+regerror
+regexec
+regfree
diff --git a/ap/build/uClibc/test/API/sched-PS.SUSv4.syms b/ap/build/uClibc/test/API/sched-PS.SUSv4.syms
new file mode 100644
index 0000000..51ce62a
--- /dev/null
+++ b/ap/build/uClibc/test/API/sched-PS.SUSv4.syms
@@ -0,0 +1,4 @@
+sched_getparam
+sched_getscheduler
+sched_setparam
+sched_setscheduler
diff --git a/ap/build/uClibc/test/API/sched-PS|TPS.SUSv4.syms b/ap/build/uClibc/test/API/sched-PS|TPS.SUSv4.syms
new file mode 100644
index 0000000..67fdb60
--- /dev/null
+++ b/ap/build/uClibc/test/API/sched-PS|TPS.SUSv4.syms
@@ -0,0 +1,3 @@
+sched_get_priority_max
+sched_get_priority_min
+sched_rr_get_interval
diff --git a/ap/build/uClibc/test/API/sched.SUSv4.syms b/ap/build/uClibc/test/API/sched.SUSv4.syms
new file mode 100644
index 0000000..0b6b81d
--- /dev/null
+++ b/ap/build/uClibc/test/API/sched.SUSv4.syms
@@ -0,0 +1 @@
+sched_yield
diff --git a/ap/build/uClibc/test/API/search.SUSv4.syms b/ap/build/uClibc/test/API/search.SUSv4.syms
new file mode 100644
index 0000000..5bbf845
--- /dev/null
+++ b/ap/build/uClibc/test/API/search.SUSv4.syms
@@ -0,0 +1,11 @@
+hcreate
+hdestroy
+hsearch
+insque
+lfind
+lsearch
+remque
+tdelete
+tfind
+tsearch
+twalk
diff --git a/ap/build/uClibc/test/API/semaphore.SUSv4.syms b/ap/build/uClibc/test/API/semaphore.SUSv4.syms
new file mode 100644
index 0000000..1f291c5
--- /dev/null
+++ b/ap/build/uClibc/test/API/semaphore.SUSv4.syms
@@ -0,0 +1,10 @@
+sem_close
+sem_destroy
+sem_getvalue
+sem_init
+sem_open
+sem_post
+sem_timedwait
+sem_trywait
+sem_unlink
+sem_wait
diff --git a/ap/build/uClibc/test/API/separate.awk b/ap/build/uClibc/test/API/separate.awk
new file mode 100644
index 0000000..f7850c4
--- /dev/null
+++ b/ap/build/uClibc/test/API/separate.awk
@@ -0,0 +1,48 @@
+#!/usr/bin/awk -f
+# 
+# Usage: awk -f separate.awk foo.SUSv4.in
+# Input: http://www.opengroup.org/onlinepubs/9699919799/basedefs/unistd.h.html#tag_13_77_03_06
+# Output: foo-$CODE.SUSv4.syms, foo.SUSv4.syms
+#
+# Copyright (C) 2010 Bernhard Reutner-Fischer
+# Public domain
+
+function get_code(line)
+{
+	sub("\\]\\[.*", "", line)
+	sub("\\[", "", line)
+	sub(" ", "", line)
+	return line
+}
+BEGIN{
+	code="";# feature set; XSI, OB XSI, CX, etc
+
+}
+/\[Option Start\]/{
+	code = get_code($0)
+	next
+}
+/\[Option End\]/{ code = ""; next; }
+/.*/ {
+	if (!hdrname) {
+		split(FILENAME, fparts, ".")
+		hdrname = fparts[1]
+		stdname = fparts[2]
+		if (fparts[3] != "in") {
+			print "inputfilename may not be ok, exiting."
+			exit(1)
+		}
+	}
+	if (code) {
+		fname = hdrname "-" code "." stdname ".syms"
+	} else {
+		fname = hdrname "." stdname ".syms"
+	}
+	sub("^*", "", $0)
+	if (file[code]) {
+		print $0 >> fname
+	} else {
+		print $0 > fname
+		file[code] = 1
+	}
+}
diff --git a/ap/build/uClibc/test/API/setjmp-CX.SUSv4.syms b/ap/build/uClibc/test/API/setjmp-CX.SUSv4.syms
new file mode 100644
index 0000000..fb0fbbe
--- /dev/null
+++ b/ap/build/uClibc/test/API/setjmp-CX.SUSv4.syms
@@ -0,0 +1 @@
+siglongjmp
diff --git a/ap/build/uClibc/test/API/setjmp-OBXSI.SUSv4.syms b/ap/build/uClibc/test/API/setjmp-OBXSI.SUSv4.syms
new file mode 100644
index 0000000..8f2d5b1
--- /dev/null
+++ b/ap/build/uClibc/test/API/setjmp-OBXSI.SUSv4.syms
@@ -0,0 +1 @@
+_longjmp
diff --git a/ap/build/uClibc/test/API/setjmp.SUSv4.syms b/ap/build/uClibc/test/API/setjmp.SUSv4.syms
new file mode 100644
index 0000000..a51df77
--- /dev/null
+++ b/ap/build/uClibc/test/API/setjmp.SUSv4.syms
@@ -0,0 +1 @@
+longjmp
diff --git a/ap/build/uClibc/test/API/signal-CX.SUSv4.syms b/ap/build/uClibc/test/API/signal-CX.SUSv4.syms
new file mode 100644
index 0000000..3d77c5a
--- /dev/null
+++ b/ap/build/uClibc/test/API/signal-CX.SUSv4.syms
@@ -0,0 +1,18 @@
+kill
+psiginfo
+psignal
+pthread_kill
+pthread_sigmask
+sigaction
+sigaddset
+sigdelset
+sigemptyset
+sigfillset
+sigismember
+sigpending
+sigprocmask
+sigqueue
+sigsuspend
+sigtimedwait
+sigwait
+sigwaitinfo
diff --git a/ap/build/uClibc/test/API/signal-OBXSI.SUSv4.syms b/ap/build/uClibc/test/API/signal-OBXSI.SUSv4.syms
new file mode 100644
index 0000000..2a6341d
--- /dev/null
+++ b/ap/build/uClibc/test/API/signal-OBXSI.SUSv4.syms
@@ -0,0 +1,6 @@
+sighold
+sigignore
+siginterrupt
+sigpause
+sigrelse
+void
diff --git a/ap/build/uClibc/test/API/signal-XSI.SUSv4.syms b/ap/build/uClibc/test/API/signal-XSI.SUSv4.syms
new file mode 100644
index 0000000..f3df0c1
--- /dev/null
+++ b/ap/build/uClibc/test/API/signal-XSI.SUSv4.syms
@@ -0,0 +1,2 @@
+killpg
+sigaltstack
diff --git a/ap/build/uClibc/test/API/signal.SUSv4.syms b/ap/build/uClibc/test/API/signal.SUSv4.syms
new file mode 100644
index 0000000..2119c27
--- /dev/null
+++ b/ap/build/uClibc/test/API/signal.SUSv4.syms
@@ -0,0 +1,2 @@
+raise
+void
diff --git a/ap/build/uClibc/test/API/spawn-PS.SUSv4.syms b/ap/build/uClibc/test/API/spawn-PS.SUSv4.syms
new file mode 100644
index 0000000..f92ebbb
--- /dev/null
+++ b/ap/build/uClibc/test/API/spawn-PS.SUSv4.syms
@@ -0,0 +1,4 @@
+posix_spawnattr_getschedparam
+posix_spawnattr_getschedpolicy
+posix_spawnattr_setschedparam
+posix_spawnattr_setschedpolicy
diff --git a/ap/build/uClibc/test/API/spawn.SUSv4.syms b/ap/build/uClibc/test/API/spawn.SUSv4.syms
new file mode 100644
index 0000000..7481640
--- /dev/null
+++ b/ap/build/uClibc/test/API/spawn.SUSv4.syms
@@ -0,0 +1,17 @@
+posix_spawn
+posix_spawn_file_actions_addclose
+posix_spawn_file_actions_adddup2
+posix_spawn_file_actions_addopen
+posix_spawn_file_actions_destroy
+posix_spawn_file_actions_init
+posix_spawnattr_destroy
+posix_spawnattr_getflags
+posix_spawnattr_getpgroup
+posix_spawnattr_getsigdefault
+posix_spawnattr_getsigmask
+posix_spawnattr_init
+posix_spawnattr_setflags
+posix_spawnattr_setpgroup
+posix_spawnattr_setsigdefault
+posix_spawnattr_setsigmask
+posix_spawnp
diff --git a/ap/build/uClibc/test/API/stdio-CX.SUSv4.syms b/ap/build/uClibc/test/API/stdio-CX.SUSv4.syms
new file mode 100644
index 0000000..98742c3
--- /dev/null
+++ b/ap/build/uClibc/test/API/stdio-CX.SUSv4.syms
@@ -0,0 +1,20 @@
+ctermid
+fdopen
+fileno
+flockfile
+fmemopen
+fseeko
+ftello
+ftrylockfile
+funlockfile
+getc_unlocked
+getchar_unlocked
+getdelim
+getline
+open_memstream
+pclose
+popen
+putc_unlocked
+putchar_unlocked
+renameat
+vdprintf
diff --git a/ap/build/uClibc/test/API/stdio-OB.SUSv4.syms b/ap/build/uClibc/test/API/stdio-OB.SUSv4.syms
new file mode 100644
index 0000000..f874a6c
--- /dev/null
+++ b/ap/build/uClibc/test/API/stdio-OB.SUSv4.syms
@@ -0,0 +1,2 @@
+gets
+tmpnam
diff --git a/ap/build/uClibc/test/API/stdio-OBXSI.SUSv4.syms b/ap/build/uClibc/test/API/stdio-OBXSI.SUSv4.syms
new file mode 100644
index 0000000..644049e
--- /dev/null
+++ b/ap/build/uClibc/test/API/stdio-OBXSI.SUSv4.syms
@@ -0,0 +1 @@
+tempnam
diff --git a/ap/build/uClibc/test/API/stdio.SUSv4.syms b/ap/build/uClibc/test/API/stdio.SUSv4.syms
new file mode 100644
index 0000000..0840443
--- /dev/null
+++ b/ap/build/uClibc/test/API/stdio.SUSv4.syms
@@ -0,0 +1,44 @@
+clearerr
+fclose
+feof
+ferror
+fflush
+fgetc
+fgetpos
+fgets
+fopen
+fprintf
+fputc
+fputs
+fread
+freopen
+fscanf
+fseek
+fsetpos
+ftell
+fwrite
+getc
+getchar
+perror
+printf
+putc
+putchar
+puts
+remove
+rename
+rewind
+scanf
+setbuf
+setvbuf
+snprintf
+sprintf
+sscanf
+tmpfile
+ungetc
+vfprintf
+vfscanf
+vprintf
+vscanf
+vsnprintf
+vsprintf
+vsscanf
diff --git a/ap/build/uClibc/test/API/stdlib-ADV.SUSv4.syms b/ap/build/uClibc/test/API/stdlib-ADV.SUSv4.syms
new file mode 100644
index 0000000..bfb6685
--- /dev/null
+++ b/ap/build/uClibc/test/API/stdlib-ADV.SUSv4.syms
@@ -0,0 +1 @@
+posix_memalign
diff --git a/ap/build/uClibc/test/API/stdlib-CX.SUSv4.syms b/ap/build/uClibc/test/API/stdlib-CX.SUSv4.syms
new file mode 100644
index 0000000..10a7b1f
--- /dev/null
+++ b/ap/build/uClibc/test/API/stdlib-CX.SUSv4.syms
@@ -0,0 +1,4 @@
+mkdtemp
+mkstemp
+setenv
+unsetenv
diff --git a/ap/build/uClibc/test/API/stdlib-OBCX.SUSv4.syms b/ap/build/uClibc/test/API/stdlib-OBCX.SUSv4.syms
new file mode 100644
index 0000000..1947cc7
--- /dev/null
+++ b/ap/build/uClibc/test/API/stdlib-OBCX.SUSv4.syms
@@ -0,0 +1 @@
+rand_r
diff --git a/ap/build/uClibc/test/API/stdlib-XSI.SUSv4.syms b/ap/build/uClibc/test/API/stdlib-XSI.SUSv4.syms
new file mode 100644
index 0000000..6cb0f1b
--- /dev/null
+++ b/ap/build/uClibc/test/API/stdlib-XSI.SUSv4.syms
@@ -0,0 +1,22 @@
+a64l
+drand48
+erand48
+grantpt
+initstate
+jrand48
+l64a
+lcong48
+lrand48
+mrand48
+nrand48
+posix_openpt
+ptsname
+putenv
+random
+realpath
+seed48
+setkey
+setstate
+srand48
+srandom
+unlockpt
diff --git a/ap/build/uClibc/test/API/stdlib.SUSv4.syms b/ap/build/uClibc/test/API/stdlib.SUSv4.syms
new file mode 100644
index 0000000..aefd969
--- /dev/null
+++ b/ap/build/uClibc/test/API/stdlib.SUSv4.syms
@@ -0,0 +1,37 @@
+_Exit
+abort
+abs
+atexit
+atof
+atoi
+atol
+atoll
+bsearch
+calloc
+div
+exit
+free
+getenv
+getsubopt
+labs
+ldiv
+llabs
+lldiv
+malloc
+mblen
+mbstowcs
+mbtowc
+qsort
+rand
+realloc
+srand
+strtod
+strtof
+strtol
+strtold
+strtoll
+strtoul
+strtoull
+system
+wcstombs
+wctomb
diff --git a/ap/build/uClibc/test/API/string-CX.SUSv4.syms b/ap/build/uClibc/test/API/string-CX.SUSv4.syms
new file mode 100644
index 0000000..4f493d4
--- /dev/null
+++ b/ap/build/uClibc/test/API/string-CX.SUSv4.syms
@@ -0,0 +1,11 @@
+stpcpy
+stpncpy
+strcoll_l
+strdup
+strerror_l
+strerror_r
+strndup
+strnlen
+strsignal
+strtok_r
+strxfrm_l
diff --git a/ap/build/uClibc/test/API/string-XSI.SUSv4.syms b/ap/build/uClibc/test/API/string-XSI.SUSv4.syms
new file mode 100644
index 0000000..e0ee4e3
--- /dev/null
+++ b/ap/build/uClibc/test/API/string-XSI.SUSv4.syms
@@ -0,0 +1 @@
+memccpy
diff --git a/ap/build/uClibc/test/API/string.SUSv4.syms b/ap/build/uClibc/test/API/string.SUSv4.syms
new file mode 100644
index 0000000..3c5e2b8
--- /dev/null
+++ b/ap/build/uClibc/test/API/string.SUSv4.syms
@@ -0,0 +1,22 @@
+memchr
+memcmp
+memcpy
+memmove
+memset
+strcat
+strchr
+strcmp
+strcoll
+strcpy
+strcspn
+strerror
+strlen
+strncat
+strncmp
+strncpy
+strpbrk
+strrchr
+strspn
+strstr
+strtok
+strxfrm
diff --git a/ap/build/uClibc/test/API/strings-XSI.SUSv4.syms b/ap/build/uClibc/test/API/strings-XSI.SUSv4.syms
new file mode 100644
index 0000000..c1173c1
--- /dev/null
+++ b/ap/build/uClibc/test/API/strings-XSI.SUSv4.syms
@@ -0,0 +1 @@
+ffs
diff --git a/ap/build/uClibc/test/API/strings.SUSv4.syms b/ap/build/uClibc/test/API/strings.SUSv4.syms
new file mode 100644
index 0000000..b4bc233
--- /dev/null
+++ b/ap/build/uClibc/test/API/strings.SUSv4.syms
@@ -0,0 +1,4 @@
+strcasecmp
+strcasecmp_l
+strncasecmp
+strncasecmp_l
diff --git a/ap/build/uClibc/test/API/stropts.SUSv4.syms b/ap/build/uClibc/test/API/stropts.SUSv4.syms
new file mode 100644
index 0000000..796d388
--- /dev/null
+++ b/ap/build/uClibc/test/API/stropts.SUSv4.syms
@@ -0,0 +1,8 @@
+fattach
+fdetach
+getmsg
+getpmsg
+ioctl
+isastream
+putmsg
+putpmsg
diff --git a/ap/build/uClibc/test/API/sys_mman-ADV.SUSv4.syms b/ap/build/uClibc/test/API/sys_mman-ADV.SUSv4.syms
new file mode 100644
index 0000000..4598c3b
--- /dev/null
+++ b/ap/build/uClibc/test/API/sys_mman-ADV.SUSv4.syms
@@ -0,0 +1 @@
+posix_madvise
diff --git a/ap/build/uClibc/test/API/sys_mman-ML.SUSv4.syms b/ap/build/uClibc/test/API/sys_mman-ML.SUSv4.syms
new file mode 100644
index 0000000..de0f37d
--- /dev/null
+++ b/ap/build/uClibc/test/API/sys_mman-ML.SUSv4.syms
@@ -0,0 +1,2 @@
+mlockall
+munlockall
diff --git a/ap/build/uClibc/test/API/sys_mman-MLR.SUSv4.syms b/ap/build/uClibc/test/API/sys_mman-MLR.SUSv4.syms
new file mode 100644
index 0000000..aa8ea9c
--- /dev/null
+++ b/ap/build/uClibc/test/API/sys_mman-MLR.SUSv4.syms
@@ -0,0 +1,2 @@
+mlock
+munlock
diff --git a/ap/build/uClibc/test/API/sys_mman-SHM.SUSv4.syms b/ap/build/uClibc/test/API/sys_mman-SHM.SUSv4.syms
new file mode 100644
index 0000000..885119a
--- /dev/null
+++ b/ap/build/uClibc/test/API/sys_mman-SHM.SUSv4.syms
@@ -0,0 +1,2 @@
+shm_open
+shm_unlink
diff --git a/ap/build/uClibc/test/API/sys_mman-TYM.SUSv4.syms b/ap/build/uClibc/test/API/sys_mman-TYM.SUSv4.syms
new file mode 100644
index 0000000..68bc50e
--- /dev/null
+++ b/ap/build/uClibc/test/API/sys_mman-TYM.SUSv4.syms
@@ -0,0 +1,3 @@
+posix_mem_offset
+posix_typed_mem_get_info
+posix_typed_mem_open
diff --git a/ap/build/uClibc/test/API/sys_mman-XSI|SIO.SUSv4.syms b/ap/build/uClibc/test/API/sys_mman-XSI|SIO.SUSv4.syms
new file mode 100644
index 0000000..3a2f8c3
--- /dev/null
+++ b/ap/build/uClibc/test/API/sys_mman-XSI|SIO.SUSv4.syms
@@ -0,0 +1 @@
+msync
diff --git a/ap/build/uClibc/test/API/sys_mman.SUSv4.syms b/ap/build/uClibc/test/API/sys_mman.SUSv4.syms
new file mode 100644
index 0000000..46a46e7
--- /dev/null
+++ b/ap/build/uClibc/test/API/sys_mman.SUSv4.syms
@@ -0,0 +1,3 @@
+mmap
+mprotect
+munmap
diff --git a/ap/build/uClibc/test/API/sys_msg.SUSv4.syms b/ap/build/uClibc/test/API/sys_msg.SUSv4.syms
new file mode 100644
index 0000000..95c2ec1
--- /dev/null
+++ b/ap/build/uClibc/test/API/sys_msg.SUSv4.syms
@@ -0,0 +1,4 @@
+msgctl
+msgget
+msgrcv
+msgsnd
diff --git a/ap/build/uClibc/test/API/sys_resource.SUSv4.syms b/ap/build/uClibc/test/API/sys_resource.SUSv4.syms
new file mode 100644
index 0000000..72d3e1e
--- /dev/null
+++ b/ap/build/uClibc/test/API/sys_resource.SUSv4.syms
@@ -0,0 +1,5 @@
+getpriority
+getrlimit
+getrusage
+setpriority
+setrlimit
diff --git a/ap/build/uClibc/test/API/sys_select.SUSv4.syms b/ap/build/uClibc/test/API/sys_select.SUSv4.syms
new file mode 100644
index 0000000..40cf6d8
--- /dev/null
+++ b/ap/build/uClibc/test/API/sys_select.SUSv4.syms
@@ -0,0 +1,6 @@
+FD_CLR
+FD_ISSET
+FD_SET
+FD_ZERO
+pselect
+select
diff --git a/ap/build/uClibc/test/API/sys_sem.SUSv4.syms b/ap/build/uClibc/test/API/sys_sem.SUSv4.syms
new file mode 100644
index 0000000..173f1d9
--- /dev/null
+++ b/ap/build/uClibc/test/API/sys_sem.SUSv4.syms
@@ -0,0 +1,3 @@
+semctl
+semget
+semop
diff --git a/ap/build/uClibc/test/API/sys_shm.SUSv4.syms b/ap/build/uClibc/test/API/sys_shm.SUSv4.syms
new file mode 100644
index 0000000..f284402
--- /dev/null
+++ b/ap/build/uClibc/test/API/sys_shm.SUSv4.syms
@@ -0,0 +1,4 @@
+shmat
+shmctl
+shmdt
+shmget
diff --git a/ap/build/uClibc/test/API/sys_socket.SUSv4.syms b/ap/build/uClibc/test/API/sys_socket.SUSv4.syms
new file mode 100644
index 0000000..cc51c9e
--- /dev/null
+++ b/ap/build/uClibc/test/API/sys_socket.SUSv4.syms
@@ -0,0 +1,18 @@
+accept
+bind
+connect
+getpeername
+getsockname
+getsockopt
+listen
+recv
+recvfrom
+recvmsg
+send
+sendmsg
+sendto
+setsockopt
+shutdown
+sockatmark
+socket
+socketpair
diff --git a/ap/build/uClibc/test/API/sys_stat-XSI.SUSv4.syms b/ap/build/uClibc/test/API/sys_stat-XSI.SUSv4.syms
new file mode 100644
index 0000000..4800d00
--- /dev/null
+++ b/ap/build/uClibc/test/API/sys_stat-XSI.SUSv4.syms
@@ -0,0 +1,2 @@
+mknod
+mknodat
diff --git a/ap/build/uClibc/test/API/sys_stat.SUSv4.syms b/ap/build/uClibc/test/API/sys_stat.SUSv4.syms
new file mode 100644
index 0000000..3fe729f
--- /dev/null
+++ b/ap/build/uClibc/test/API/sys_stat.SUSv4.syms
@@ -0,0 +1,14 @@
+chmod
+fchmod
+fchmodat
+fstat
+fstatat
+futimens
+lstat
+mkdir
+mkdirat
+mkfifo
+mkfifoat
+stat
+umask
+utimensat
diff --git a/ap/build/uClibc/test/API/sys_statvfs.SUSv4.syms b/ap/build/uClibc/test/API/sys_statvfs.SUSv4.syms
new file mode 100644
index 0000000..c3fd5f4
--- /dev/null
+++ b/ap/build/uClibc/test/API/sys_statvfs.SUSv4.syms
@@ -0,0 +1,2 @@
+fstatvfs
+statvfs
diff --git a/ap/build/uClibc/test/API/sys_time-OB.SUSv4.syms b/ap/build/uClibc/test/API/sys_time-OB.SUSv4.syms
new file mode 100644
index 0000000..caf1f3f
--- /dev/null
+++ b/ap/build/uClibc/test/API/sys_time-OB.SUSv4.syms
@@ -0,0 +1,3 @@
+getitimer
+gettimeofday
+setitimer
diff --git a/ap/build/uClibc/test/API/sys_time.SUSv4.syms b/ap/build/uClibc/test/API/sys_time.SUSv4.syms
new file mode 100644
index 0000000..526a404
--- /dev/null
+++ b/ap/build/uClibc/test/API/sys_time.SUSv4.syms
@@ -0,0 +1,2 @@
+select
+utimes
diff --git a/ap/build/uClibc/test/API/sys_uio.SUSv4.syms b/ap/build/uClibc/test/API/sys_uio.SUSv4.syms
new file mode 100644
index 0000000..31caee5
--- /dev/null
+++ b/ap/build/uClibc/test/API/sys_uio.SUSv4.syms
@@ -0,0 +1,2 @@
+readv
+writev
diff --git a/ap/build/uClibc/test/API/sys_wait.SUSv4.syms b/ap/build/uClibc/test/API/sys_wait.SUSv4.syms
new file mode 100644
index 0000000..753c380
--- /dev/null
+++ b/ap/build/uClibc/test/API/sys_wait.SUSv4.syms
@@ -0,0 +1,3 @@
+wait
+waitid
+waitpid
diff --git a/ap/build/uClibc/test/API/syslog.SUSv4.syms b/ap/build/uClibc/test/API/syslog.SUSv4.syms
new file mode 100644
index 0000000..a44f514
--- /dev/null
+++ b/ap/build/uClibc/test/API/syslog.SUSv4.syms
@@ -0,0 +1,4 @@
+closelog
+openlog
+setlogmask
+syslog
diff --git a/ap/build/uClibc/test/API/termios.SUSv4.syms b/ap/build/uClibc/test/API/termios.SUSv4.syms
new file mode 100644
index 0000000..43ac836
--- /dev/null
+++ b/ap/build/uClibc/test/API/termios.SUSv4.syms
@@ -0,0 +1,11 @@
+cfgetispeed
+cfgetospeed
+cfsetispeed
+cfsetospeed
+tcdrain
+tcflow
+tcflush
+tcgetattr
+tcgetsid
+tcsendbreak
+tcsetattr
diff --git a/ap/build/uClibc/test/API/time-CPT.SUSv4.syms b/ap/build/uClibc/test/API/time-CPT.SUSv4.syms
new file mode 100644
index 0000000..278952e
--- /dev/null
+++ b/ap/build/uClibc/test/API/time-CPT.SUSv4.syms
@@ -0,0 +1 @@
+clock_getcpuclockid
diff --git a/ap/build/uClibc/test/API/time-CX.SUSv4.syms b/ap/build/uClibc/test/API/time-CX.SUSv4.syms
new file mode 100644
index 0000000..d2cbb77
--- /dev/null
+++ b/ap/build/uClibc/test/API/time-CX.SUSv4.syms
@@ -0,0 +1,15 @@
+clock_getres
+clock_gettime
+clock_nanosleep
+clock_settime
+gmtime_r
+localtime_r
+nanosleep
+strftime_l
+timer_create
+timer_delete
+timer_getoverrun
+timer_gettime
+timer_settime
+tzset
+tzname
diff --git a/ap/build/uClibc/test/API/time-OB.SUSv4.syms b/ap/build/uClibc/test/API/time-OB.SUSv4.syms
new file mode 100644
index 0000000..ce1dad0
--- /dev/null
+++ b/ap/build/uClibc/test/API/time-OB.SUSv4.syms
@@ -0,0 +1,2 @@
+asctime
+ctime
diff --git a/ap/build/uClibc/test/API/time-OBCX.SUSv4.syms b/ap/build/uClibc/test/API/time-OBCX.SUSv4.syms
new file mode 100644
index 0000000..b46018c
--- /dev/null
+++ b/ap/build/uClibc/test/API/time-OBCX.SUSv4.syms
@@ -0,0 +1,2 @@
+asctime_r
+ctime_r
diff --git a/ap/build/uClibc/test/API/time-XSI.SUSv4.syms b/ap/build/uClibc/test/API/time-XSI.SUSv4.syms
new file mode 100644
index 0000000..9bf1f62
--- /dev/null
+++ b/ap/build/uClibc/test/API/time-XSI.SUSv4.syms
@@ -0,0 +1,4 @@
+getdate
+strptime
+daylight
+timezone
diff --git a/ap/build/uClibc/test/API/time.SUSv4.syms b/ap/build/uClibc/test/API/time.SUSv4.syms
new file mode 100644
index 0000000..788e19e
--- /dev/null
+++ b/ap/build/uClibc/test/API/time.SUSv4.syms
@@ -0,0 +1,7 @@
+clock
+difftime
+gmtime
+localtime
+mktime
+strftime
+time
diff --git a/ap/build/uClibc/test/API/trace-TEF.SUSv4.syms b/ap/build/uClibc/test/API/trace-TEF.SUSv4.syms
new file mode 100644
index 0000000..bc9f47b
--- /dev/null
+++ b/ap/build/uClibc/test/API/trace-TEF.SUSv4.syms
@@ -0,0 +1,8 @@
+posix_trace_eventset_add
+posix_trace_eventset_del
+posix_trace_eventset_empty
+posix_trace_eventset_fill
+posix_trace_eventset_ismember
+posix_trace_get_filter
+posix_trace_set_filter
+posix_trace_trid_eventid_open
diff --git a/ap/build/uClibc/test/API/trace-TRI.SUSv4.syms b/ap/build/uClibc/test/API/trace-TRI.SUSv4.syms
new file mode 100644
index 0000000..ea5723d
--- /dev/null
+++ b/ap/build/uClibc/test/API/trace-TRI.SUSv4.syms
@@ -0,0 +1,2 @@
+posix_trace_attr_getinherited
+posix_trace_attr_setinherited
diff --git a/ap/build/uClibc/test/API/trace-TRL.SUSv4.syms b/ap/build/uClibc/test/API/trace-TRL.SUSv4.syms
new file mode 100644
index 0000000..763c7f4
--- /dev/null
+++ b/ap/build/uClibc/test/API/trace-TRL.SUSv4.syms
@@ -0,0 +1,9 @@
+posix_trace_attr_getlogfullpolicy
+posix_trace_attr_getlogsize
+posix_trace_attr_setlogfullpolicy
+posix_trace_attr_setlogsize
+posix_trace_close
+posix_trace_create_withlog
+posix_trace_flush
+posix_trace_open
+posix_trace_rewind
diff --git a/ap/build/uClibc/test/API/trace.SUSv4.syms b/ap/build/uClibc/test/API/trace.SUSv4.syms
new file mode 100644
index 0000000..c12b882
--- /dev/null
+++ b/ap/build/uClibc/test/API/trace.SUSv4.syms
@@ -0,0 +1,31 @@
+posix_trace_attr_destroy
+posix_trace_attr_getclockres
+posix_trace_attr_getcreatetime
+posix_trace_attr_getgenversion
+posix_trace_attr_getmaxdatasize
+posix_trace_attr_getmaxsystemeventsize
+posix_trace_attr_getmaxusereventsize
+posix_trace_attr_getname
+posix_trace_attr_getstreamfullpolicy
+posix_trace_attr_getstreamsize
+posix_trace_attr_init
+posix_trace_attr_setmaxdatasize
+posix_trace_attr_setname
+posix_trace_attr_setstreamfullpolicy
+posix_trace_attr_setstreamsize
+posix_trace_clear
+posix_trace_create
+posix_trace_event
+posix_trace_eventid_equal
+posix_trace_eventid_get_name
+posix_trace_eventid_open
+posix_trace_eventtypelist_getnext_id
+posix_trace_eventtypelist_rewind
+posix_trace_get_attr
+posix_trace_get_status
+posix_trace_getnext_event
+posix_trace_shutdown
+posix_trace_start
+posix_trace_stop
+posix_trace_timedgetnext_event
+posix_trace_trygetnext_event
diff --git a/ap/build/uClibc/test/API/tst-API.sh b/ap/build/uClibc/test/API/tst-API.sh
new file mode 100755
index 0000000..3d0302c
--- /dev/null
+++ b/ap/build/uClibc/test/API/tst-API.sh
@@ -0,0 +1,17 @@
+#!/bin/sh
+
+std="$1"
+shift
+cod="$*"
+
+result=0
+
+for l in $top_builddir/lib/lib*-*.so; do \
+	readelf -D -W -s $l | \
+	$AWK '
+/^[[:space:]]*[[:digit:]]/ { if ($8 != "UND") print $NF; }
+'; \
+	done | sort | uniq > $uclibc_out
+for code in $cod; do cat $code.$std.syms; done | sort | uniq > $glibc_out
+result=0
+exit $result
diff --git a/ap/build/uClibc/test/API/unistd-CX.SUSv4.syms b/ap/build/uClibc/test/API/unistd-CX.SUSv4.syms
new file mode 100644
index 0000000..4e183e4
--- /dev/null
+++ b/ap/build/uClibc/test/API/unistd-CX.SUSv4.syms
@@ -0,0 +1 @@
+ctermid
diff --git a/ap/build/uClibc/test/API/unistd-FSC.SUSv4.syms b/ap/build/uClibc/test/API/unistd-FSC.SUSv4.syms
new file mode 100644
index 0000000..e5c2ab2
--- /dev/null
+++ b/ap/build/uClibc/test/API/unistd-FSC.SUSv4.syms
@@ -0,0 +1 @@
+fsync
diff --git a/ap/build/uClibc/test/API/unistd-OBXSI.SUSv4.syms b/ap/build/uClibc/test/API/unistd-OBXSI.SUSv4.syms
new file mode 100644
index 0000000..4e6787f
--- /dev/null
+++ b/ap/build/uClibc/test/API/unistd-OBXSI.SUSv4.syms
@@ -0,0 +1 @@
+setpgrp
diff --git a/ap/build/uClibc/test/API/unistd-SIO.SUSv4.syms b/ap/build/uClibc/test/API/unistd-SIO.SUSv4.syms
new file mode 100644
index 0000000..2ed33b3
--- /dev/null
+++ b/ap/build/uClibc/test/API/unistd-SIO.SUSv4.syms
@@ -0,0 +1 @@
+fdatasync
diff --git a/ap/build/uClibc/test/API/unistd-XSI.SUSv4.syms b/ap/build/uClibc/test/API/unistd-XSI.SUSv4.syms
new file mode 100644
index 0000000..db54176
--- /dev/null
+++ b/ap/build/uClibc/test/API/unistd-XSI.SUSv4.syms
@@ -0,0 +1,9 @@
+crypt
+encrypt
+gethostid
+lockf
+nice
+setregid
+setreuid
+swab
+sync
diff --git a/ap/build/uClibc/test/API/unistd.SUSv4.syms b/ap/build/uClibc/test/API/unistd.SUSv4.syms
new file mode 100644
index 0000000..fec630d
--- /dev/null
+++ b/ap/build/uClibc/test/API/unistd.SUSv4.syms
@@ -0,0 +1,74 @@
+access
+alarm
+chdir
+chown
+close
+confstr
+dup
+dup2
+_exit
+execl
+execle
+execlp
+execv
+execve
+execvp
+faccessat
+fchdir
+fchown
+fchownat
+fexecve
+fork
+fpathconf
+ftruncate
+getcwd
+getegid
+geteuid
+getgid
+getgroups
+gethostname
+getlogin
+getlogin_r
+getopt
+getpgid
+getpgrp
+getpid
+getppid
+getsid
+getuid
+isatty
+lchown
+link
+linkat
+lseek
+pathconf
+pause
+pipe
+pread
+pwrite
+read
+readlink
+readlinkat
+rmdir
+setegid
+seteuid
+setgid
+setpgid
+setsid
+setuid
+sleep
+symlink
+symlinkat
+sysconf
+tcgetpgrp
+tcsetpgrp
+truncate
+ttyname
+ttyname_r
+unlink
+unlinkat
+write
+optarg
+opterr
+optind
+optopt
diff --git a/ap/build/uClibc/test/API/utmpx.SUSv4.syms b/ap/build/uClibc/test/API/utmpx.SUSv4.syms
new file mode 100644
index 0000000..1fd294a
--- /dev/null
+++ b/ap/build/uClibc/test/API/utmpx.SUSv4.syms
@@ -0,0 +1,6 @@
+endutxent
+getutxent
+getutxid
+getutxline
+pututxline
+setutxent
diff --git a/ap/build/uClibc/test/API/wchar-CX.SUSv4.syms b/ap/build/uClibc/test/API/wchar-CX.SUSv4.syms
new file mode 100644
index 0000000..0804938
--- /dev/null
+++ b/ap/build/uClibc/test/API/wchar-CX.SUSv4.syms
@@ -0,0 +1,13 @@
+mbsnrtowcs
+open_wmemstream
+wcpcpy
+wcpncpy
+wcscasecmp
+wcscasecmp_l
+wcscoll_l
+wcsdup
+wcsncasecmp
+wcsncasecmp_l
+wcsnlen
+wcsnrtombs
+wcsxfrm_l
diff --git a/ap/build/uClibc/test/API/wchar-OBXSI.SUSv4.syms b/ap/build/uClibc/test/API/wchar-OBXSI.SUSv4.syms
new file mode 100644
index 0000000..bc76ee6
--- /dev/null
+++ b/ap/build/uClibc/test/API/wchar-OBXSI.SUSv4.syms
@@ -0,0 +1,15 @@
+iswalnum
+iswalpha
+iswcntrl
+iswctype
+iswdigit
+iswgraph
+iswlower
+iswprint
+iswpunct
+iswspace
+iswupper
+iswxdigit
+towlower
+towupper
+wctype
diff --git a/ap/build/uClibc/test/API/wchar-XSI.SUSv4.syms b/ap/build/uClibc/test/API/wchar-XSI.SUSv4.syms
new file mode 100644
index 0000000..834731c
--- /dev/null
+++ b/ap/build/uClibc/test/API/wchar-XSI.SUSv4.syms
@@ -0,0 +1,2 @@
+wcswidth
+wcwidth
diff --git a/ap/build/uClibc/test/API/wchar.SUSv4.syms b/ap/build/uClibc/test/API/wchar.SUSv4.syms
new file mode 100644
index 0000000..d58f600
--- /dev/null
+++ b/ap/build/uClibc/test/API/wchar.SUSv4.syms
@@ -0,0 +1,59 @@
+btowc
+fgetwc
+fgetws
+fputwc
+fputws
+fwide
+fwprintf
+fwscanf
+getwc
+getwchar
+mbrlen
+mbrtowc
+mbsinit
+mbsrtowcs
+putwc
+putwchar
+swprintf
+swscanf
+ungetwc
+vfwprintf
+vfwscanf
+vswprintf
+vswscanf
+vwprintf
+vwscanf
+wcrtomb
+wcscat
+wcschr
+wcscmp
+wcscoll
+wcscpy
+wcscspn
+wcsftime
+wcslen
+wcsncat
+wcsncmp
+wcsncpy
+wcspbrk
+wcsrchr
+wcsrtombs
+wcsspn
+wcsstr
+wcstod
+wcstof
+wcstok
+wcstol
+wcstold
+wcstoll
+wcstoul
+wcstoull
+wcsxfrm
+wctob
+wmemchr
+wmemcmp
+wmemcpy
+wmemmove
+wmemset
+wprintf
+wscanf
diff --git a/ap/build/uClibc/test/API/wctype-CX.SUSv4.syms b/ap/build/uClibc/test/API/wctype-CX.SUSv4.syms
new file mode 100644
index 0000000..81c0331
--- /dev/null
+++ b/ap/build/uClibc/test/API/wctype-CX.SUSv4.syms
@@ -0,0 +1,18 @@
+iswalnum_l
+iswalpha_l
+iswblank_l
+iswcntrl_l
+iswctype_l
+iswdigit_l
+iswgraph_l
+iswlower_l
+iswprint_l
+iswpunct_l
+iswspace_l
+iswupper_l
+iswxdigit_l
+towctrans_l
+towlower_l
+towupper_l
+wctrans_l
+wctype_l
diff --git a/ap/build/uClibc/test/API/wctype.SUSv4.syms b/ap/build/uClibc/test/API/wctype.SUSv4.syms
new file mode 100644
index 0000000..fddc395
--- /dev/null
+++ b/ap/build/uClibc/test/API/wctype.SUSv4.syms
@@ -0,0 +1,18 @@
+iswalnum
+iswalpha
+iswblank
+iswcntrl
+iswctype
+iswdigit
+iswgraph
+iswlower
+iswprint
+iswpunct
+iswspace
+iswupper
+iswxdigit
+towctrans
+towlower
+towupper
+wctrans
+wctype
diff --git a/ap/build/uClibc/test/API/wordexp.SUSv4.syms b/ap/build/uClibc/test/API/wordexp.SUSv4.syms
new file mode 100644
index 0000000..3681b3c
--- /dev/null
+++ b/ap/build/uClibc/test/API/wordexp.SUSv4.syms
@@ -0,0 +1,2 @@
+wordexp
+wordfree
diff --git a/ap/build/uClibc/test/Makefile b/ap/build/uClibc/test/Makefile
new file mode 100644
index 0000000..da5424e
--- /dev/null
+++ b/ap/build/uClibc/test/Makefile
@@ -0,0 +1,76 @@
+# Makefile for uClibc
+#
+# Copyright (C) 2000-2005 Erik Andersen <andersen@uclibc.org>
+#
+# Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
+#
+
+top_builddir=../
+include Rules.mak
+
+ALL_SUBDIRS := $(patsubst %/Makefile,%,$(wildcard */Makefile))
+
+DIRS := $(ALL_SUBDIRS)
+ifneq ($(HAVE_SHARED)$(UCLIBC_HAS_THREADS),yy)
+	DIRS := $(filter-out dlopen,$(DIRS))
+endif
+ifneq ($(findstring -static,$(LDFLAGS)),)
+	DIRS := $(filter-out dlopen,$(DIRS))
+endif
+ifneq ($(UCLIBC_HAS_THREADS),y)
+	DIRS := $(filter-out pthread,$(DIRS))
+endif
+ifneq ($(UCLIBC_HAS_FULL_RPC),y)
+	DIRS := $(filter-out rpc,$(DIRS))
+endif
+ifneq ($(UCLIBC_HAS_REGEX),y)
+	DIRS := $(filter-out regex,$(DIRS))
+endif
+ifneq ($(UCLIBC_HAS_THREADS_NATIVE),y)
+	DIRS := $(filter-out tls nptl,$(DIRS))
+endif
+ifneq ($(UCLIBC_HAS_WCHAR),y)
+	DIRS := $(filter-out locale-mbwc,$(DIRS))
+endif
+ifneq ($(UCLIBC_HAS_LOCALE),y)
+	DIRS := $(filter-out locale,$(DIRS))
+endif
+ifneq ($(UCLIBC_HAS_CRYPT_IMPL),y)
+	DIRS := $(filter-out crypt,$(DIRS))
+endif
+ifeq ($(HAS_NO_THREADS),y)
+	DIRS := $(filter-out pthread,$(DIRS))
+endif
+
+test check all: run
+
+run: compile subdirs_run
+
+compile: $(top_builddir)/$(LOCAL_INSTALL_PATH) subdirs_compile
+
+$(top_builddir)/$(LOCAL_INSTALL_PATH):
+	$(Q)$(MAKE) -C $(top_builddir) $(LOCAL_INSTALL_PATH)
+
+tags:
+	ctags -R
+
+clean: subdirs_clean
+
+subdirs: $(patsubst %, _dir_%, $(DIRS))
+subdirs_compile: $(patsubst %, _dircompile_%, $(DIRS))
+subdirs_run: $(patsubst %, _dirrun_%, $(DIRS))
+subdirs_clean: $(patsubst %, _dirclean_%, $(ALL_SUBDIRS))
+
+$(patsubst %, _dir_%, $(DIRS)) : dummy
+	$(Q)$(MAKE) -C $(patsubst _dir_%, %, $@)
+
+$(patsubst %, _dirrun_%, $(DIRS)) : dummy
+	$(Q)$(MAKE) -C $(patsubst _dirrun_%, %, $@) run
+
+$(patsubst %, _dircompile_%, $(DIRS)) : dummy
+	$(Q)$(MAKE) -C $(patsubst _dircompile_%, %, $@) compile
+
+$(patsubst %, _dirclean_%, $(ALL_SUBDIRS)) : dummy
+	$(Q)$(MAKE) -C $(patsubst _dirclean_%, %, $@) clean
+
+.PHONY: all check clean dummy subdirs_compile subdirs_run subdirs subdirs_clean test run compile
diff --git a/ap/build/uClibc/test/README b/ap/build/uClibc/test/README
new file mode 100644
index 0000000..8fb12d9
--- /dev/null
+++ b/ap/build/uClibc/test/README
@@ -0,0 +1,85 @@
+-----------
+ For: User
+-----------
+Following make targets are avaialable
+
+make compile
+
+This will compile and link the tests
+
+make run
+
+This will check for binaries, if they are not there it
+will call 'compile' target, then it will execute all the tests.
+
+make check
+make all
+
+This will build and run tests.
+
+The following make variables may help you in testing:
+
+ - UCLIBC_ONLY  - only run tests against uClibc
+ - GLIBC_ONLY   - only run tests against glibc
+ - V / VERBOSE  - run tests with a lot of output
+ - TEST_INSTALLED_UCLIBC - Test installed libraries
+                           under /lib and /usr/lib.
+ - TIMEOUTFACTOR=nn - increase test timeout nn times.
+                  At least REGEX_OLD + regex/tst-regex2 needs it increased.
+
+So, to just run the uClibc tests, try this:
+make check UCLIBC_ONLY=1
+
+If you need to test just a subset of all test, delete subdirectories
+you do not need.
+
+As of 2009-07, build machinery does not track dependencies on uclibc.
+If you edit a header and re-run "make compile", it does not re-install it
+into ../install_dir. If you delete ../install_dir, "make compile"
+rebuilds uclibc as needed and re-installs ../install_dir,
+but still does not rebuild testcases.
+(You can work around it by "touch */*.c" for now).
+
+----------------
+ For: Developer
+----------------
+
+The structure of this test system is:
+ test/                    toplevel dir containing common test code
+ test/Rules.mak           Common build code
+ test/Test.mak            Runtime test make code
+ test/subdir/             code specific to a subsystem is stored in a subdir
+ test/subdir/Makefile.in  describe the tests to run
+ test/subdir/Makefile     test entry point, includes needed upper-level
+                          makefiles plus Makefile.in
+ test/subdir/*.c          the tests
+
+Each subdir has a Makefile (same for any subdir) that must include in strict order:
+  - the upper-level Rules.mak file
+  - the Makefile.in
+  - the upper-level Test.mak file
+Makefile.in may be used to define the TESTS and TESTS_DISABLED variables.
+If you do not, TESTS is built automatically based upon all the .c files in the subdir.
+TESTS := foo
+TESTS_DISABLED := bar
+Each test must use a similar .c name; so the "foo" test needs a "foo.c".
+
+Additionally, the following options further control specific test behavior:
+CFLAGS_foo    := extra cflags to use to compile test
+DODIFF_foo    := compare the output of the glibc and uClibc tests (see below)
+LDFLAGS_foo   := extra ldflags to use to link test
+OPTS_foo      := extra options to pass to test
+RET_foo       := expected exit code of test; default is 0
+WRAPPER_foo   := execute stuff just before test
+
+Or to control all tests in a subdir:
+EXTRA_CLEAN   := extra files to remove in the clean target
+EXTRA_DIRS    := extra directories to remove in the clean target
+EXTRA_CFLAGS  := -DFOO
+EXTRA_LDFLAGS := -lpthread
+OPTS          :=
+WRAPPER       :=
+
+If you want to compare the output of a test with known good output, then just
+create a local file named "foo.out.good" and the output generated by the test
+"foo" will be automatically stored in "foo.out" and compared to "foo.out.good".
diff --git a/ap/build/uClibc/test/Rules.mak b/ap/build/uClibc/test/Rules.mak
new file mode 100644
index 0000000..b5eb20b
--- /dev/null
+++ b/ap/build/uClibc/test/Rules.mak
@@ -0,0 +1,140 @@
+# Rules.mak for uClibc test subdirs
+#
+# Copyright (C) 2000-2006 Erik Andersen <andersen@uclibc.org>
+#
+# Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
+#
+
+.SUFFIXES:
+
+top_builddir ?= ../
+
+TESTDIR=$(top_builddir)test/
+
+include $(top_builddir)/Rules.mak
+ifndef TEST_INSTALLED_UCLIBC
+ifdef UCLIBC_LDSO
+ifeq (,$(findstring /,$(UCLIBC_LDSO)))
+UCLIBC_LDSO := $(top_builddir)lib/$(UCLIBC_LDSO)
+endif
+else
+UCLIBC_LDSO := $(firstword $(wildcard $(top_builddir)lib/ld*))
+endif
+endif
+#--------------------------------------------------------
+# Ensure consistent sort order, 'gcc -print-search-dirs' behavior, etc.
+LC_ALL:= C
+export LC_ALL
+
+ifeq ($(strip $(TARGET_ARCH)),)
+TARGET_ARCH:=$(shell $(CC) -dumpmachine | sed -e s'/-.*//' \
+	-e 's/i.86/i386/' \
+	-e 's/sun.*/sparc/' -e 's/sparc.*/sparc/' \
+	-e 's/sa110/arm/' -e 's/arm.*/arm/g' \
+	-e 's/m68k.*/m68k/' \
+	-e 's/parisc.*/hppa/' \
+	-e 's/ppc/powerpc/g' \
+	-e 's/v850.*/v850/g' \
+	-e 's/sh[234]/sh/' \
+	-e 's/mips.*/mips/' \
+	-e 's/cris.*/cris/' \
+	-e 's/xtensa.*/xtensa/' \
+	)
+endif
+export TARGET_ARCH
+
+RM_R = $(Q)$(RM) -r
+LN_S = $(Q)$(LN) -fs
+
+ifneq ($(KERNEL_HEADERS),)
+ifeq ($(patsubst /%,/,$(KERNEL_HEADERS)),/)
+# Absolute path in KERNEL_HEADERS
+KERNEL_INCLUDES += -I$(KERNEL_HEADERS)
+else
+# Relative path in KERNEL_HEADERS
+KERNEL_INCLUDES += -I$(top_builddir)$(KERNEL_HEADERS)
+endif
+endif
+
+XCOMMON_CFLAGS := -I$(top_builddir)test -D_GNU_SOURCE
+XWARNINGS      += $(CFLAG_-Wstrict-prototypes)
+CFLAGS         := -nostdinc -I$(top_builddir)$(LOCAL_INSTALL_PATH)/usr/include
+CFLAGS         += $(XCOMMON_CFLAGS) $(KERNEL_INCLUDES) $(CC_INC)
+CFLAGS         += $(OPTIMIZATION) $(CPU_CFLAGS) $(XWARNINGS)
+
+# Can't add $(OPTIMIZATION) here, it may be target-specific.
+# Just adding -Os for now.
+HOST_CFLAGS    += $(XCOMMON_CFLAGS) -Os $(XWARNINGS) -std=gnu99
+
+LDFLAGS        := $(CPU_LDFLAGS-y) -Wl,-z,now
+ifeq ($(DODEBUG),y)
+	CFLAGS        += -g
+	HOST_CFLAGS   += -g
+	LDFLAGS       += -Wl,-g
+	HOST_LDFLAGS  += -Wl,-g
+else
+	LDFLAGS       += -Wl,-s
+	HOST_LDFLAGS  += -Wl,-s
+endif
+
+ifneq ($(HAVE_SHARED),y)
+	LDFLAGS       += -Wl,-static -static-libgcc
+endif
+
+LDFLAGS += -B$(top_builddir)lib -Wl,-rpath,$(top_builddir)lib -Wl,-rpath-link,$(top_builddir)lib
+UCLIBC_LDSO_ABSPATH=$(shell pwd)
+ifdef TEST_INSTALLED_UCLIBC
+LDFLAGS += -Wl,-rpath,./
+UCLIBC_LDSO_ABSPATH=$(RUNTIME_PREFIX)$(MULTILIB_DIR)
+endif
+
+ifeq ($(findstring -static,$(LDFLAGS)),)
+LDFLAGS += -Wl,--dynamic-linker,$(UCLIBC_LDSO_ABSPATH)/$(UCLIBC_LDSO)
+endif
+
+ifeq ($(LDSO_GNU_HASH_SUPPORT),y)
+# Check for binutils support is done on root Rules.mak
+LDFLAGS += $(CFLAG_-Wl--hash-style=gnu)
+endif
+
+
+ifneq ($(findstring -s,$(MAKEFLAGS)),)
+DISP := sil
+Q    := @
+SCAT := -@true
+else
+ifneq ($(V)$(VERBOSE),)
+DISP := ver
+Q    :=
+SCAT := cat
+else
+DISP := pur
+Q    := @
+SCAT := -@true
+endif
+endif
+ifneq ($(Q),)
+MAKEFLAGS += --no-print-directory
+endif
+
+banner := ---------------------------------
+pur_showclean = echo "  "CLEAN $(notdir $(CURDIR))
+pur_showdiff  = echo "  "TEST_DIFF $(notdir $(CURDIR))/
+pur_showlink  = echo "  "TEST_LINK $(notdir $(CURDIR))/ $@
+pur_showtest  = echo "  "TEST_EXEC $(notdir $(CURDIR))/ $(@:.exe=)
+sil_showclean =
+sil_showdiff  = true
+sil_showlink  = true
+sil_showtest  = true
+ver_showclean =
+ver_showdiff  = true echo
+ver_showlink  = true echo
+ver_showtest  = printf "\n$(banner)\nTEST $(notdir $(CURDIR))/ $(@:.exe=)\n$(banner)\n"
+do_showclean  = $($(DISP)_showclean)
+do_showdiff   = $($(DISP)_showdiff)
+do_showlink   = $($(DISP)_showlink)
+do_showtest   = $($(DISP)_showtest)
+showclean = @$(do_showclean)
+showdiff  = @$(do_showdiff)
+showlink  = @$(do_showlink)
+showtest  = @$(do_showtest)
diff --git a/ap/build/uClibc/test/Test.mak b/ap/build/uClibc/test/Test.mak
new file mode 100644
index 0000000..dd3fcc3
--- /dev/null
+++ b/ap/build/uClibc/test/Test.mak
@@ -0,0 +1,129 @@
+# Common makefile rules for tests
+#
+# Copyright (C) 2000-2006 Erik Andersen <andersen@uclibc.org>
+#
+# Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
+
+ifeq ($(TESTS),)
+TESTS := $(patsubst %.c,%,$(wildcard *.c))
+endif
+ifneq ($(TESTS_DISABLED),)
+TESTS := $(filter-out $(TESTS_DISABLED),$(TESTS))
+endif
+ifeq ($(SHELL_TESTS),)
+SHELL_TESTS := $(patsubst %.sh,shell_%,$(wildcard *.sh))
+endif
+
+ifneq ($(filter-out test,$(strip $(TESTS))),$(strip $(TESTS)))
+$(error Sanity check: cannot have a test named "test.c")
+endif
+
+U_TARGETS := $(TESTS)
+G_TARGETS := $(addsuffix _glibc,$(U_TARGETS))
+
+ifneq ($(GLIBC_TESTS_DISABLED),)
+G_TARGETS := $(filter-out $(GLIBC_TESTS_DISABLED),$(G_TARGETS))
+endif
+
+ifeq ($(GLIBC_ONLY),)
+TARGETS   += $(U_TARGETS)
+endif
+ifeq ($(UCLIBC_ONLY),)
+TARGETS   += $(G_TARGETS)
+endif
+
+CLEAN_TARGETS := $(U_TARGETS) $(G_TARGETS)
+CLEAN_TARGETS += $(TESTS_DISABLED) $(addsuffix _glibc,$(TESTS_DISABLED)) $(GLIBC_TESTS_DISABLED)
+COMPILE_TARGETS :=  $(TARGETS)
+RUN_TARGETS := $(addsuffix .exe,$(TARGETS))
+# provide build rules even for disabled tests:
+U_TARGETS += $(TESTS_DISABLED)
+G_TARGETS += $(addsuffix _glibc,$(TESTS_DISABLED)) $(GLIBC_TESTS_DISABLED)
+TARGETS += $(SHELL_TESTS)
+CFLAGS += $(CFLAGS_$(notdir $(CURDIR)))
+
+define binary_name
+$(patsubst %.exe,%,$@)
+endef
+define tst_src_name
+$(patsubst %_glibc,%,$(binary_name))
+endef
+
+define diff_test
+	$(Q)\
+	for x in "$(binary_name).out" "$(tst_src_name).out" ; do \
+		test -e "$$x.good" && $(do_showdiff) "$(binary_name).out" "$$x.good" && exec diff -u "$(binary_name).out" "$$x.good" ; \
+	done ; \
+	true
+endef
+define uclibc_glibc_diff_test
+	$(Q)\
+	test -z "$(DODIFF_$(tst_src_name))" && exec true ; \
+	uclibc_out="$(binary_name).out" ; \
+	glibc_out="$(tst_src_name).out" ; \
+	$(do_showdiff) $$uclibc_out $$glibc_out ; \
+	exec diff -u "$$uclibc_out" "$$glibc_out"
+endef
+define exec_test
+	$(showtest)
+	$(Q)\
+	$(WRAPPER) $(WRAPPER_$(tst_src_name)) \
+	./$(binary_name) $(OPTS) $(OPTS_$(tst_src_name)) > "$(binary_name).out" 2>&1 ; \
+		ret=$$? ; \
+		expected_ret="$(RET_$(tst_src_name))" ; \
+		test -z "$$expected_ret" && export expected_ret=0 ; \
+	if ! test $$ret -eq $$expected_ret ; then \
+		echo "ret == $$ret ; expected_ret == $$expected_ret" ; \
+		echo "The output of failed test is:"; \
+		cat "$(binary_name).out"; \
+		exit 1 ; \
+	fi
+	$(SCAT) "$(binary_name).out"
+endef
+
+test check all: run
+run: $(RUN_TARGETS)
+$(RUN_TARGETS):
+	$(exec_test)
+	$(diff_test)
+ifeq ($(UCLIBC_ONLY),)
+	$(uclibc_glibc_diff_test)
+endif
+
+compile: $(COMPILE_TARGETS)
+
+G_TARGET_SRCS := $(addsuffix .c,$(G_TARGETS))
+U_TARGET_SRCS := $(addsuffix .c,$(U_TARGETS))
+
+$(MAKE_SRCS): Makefile $(TESTDIR)Makefile $(TESTDIR)Rules.mak $(TESTDIR)Test.mak
+
+$(U_TARGETS): $(U_TARGET_SRCS) $(MAKE_SRCS)
+	$(showlink)
+	$(Q)$(CC) $(CFLAGS) $(EXTRA_CFLAGS) $(CFLAGS_$(notdir $(CURDIR))) $(CFLAGS_$@) -c $@.c -o $@.o
+	$(Q)$(CC) $(LDFLAGS) $@.o -o $@ $(EXTRA_LDFLAGS) $(LDFLAGS_$@)
+
+$(G_TARGETS): $(U_TARGET_SRCS) $(MAKE_SRCS)
+	$(showlink)
+	$(Q)$(HOSTCC) $(HOST_CFLAGS) $(CFLAGS_$(notdir $(CURDIR))) $(CFLAGS_$(patsubst %_glibc,%,$@)) -c $(patsubst %_glibc,%,$@).c -o $@.o
+	$(Q)$(HOSTCC) $(HOST_LDFLAGS) $@.o -o $@ $(EXTRA_LDFLAGS) $(LDFLAGS_$(patsubst %_glibc,%,$@))
+
+
+shell_%:
+	$(showtest)
+	$(Q)$(if $(PRE_RUN_$(@)),$(PRE_RUN_$(@)))
+	$(Q)$(SHELL) $(patsubst shell_%,%.sh,$(binary_name))
+	$(Q)$(if $(POST_RUN_$(@)),$(POST_RUN_$(@)))
+
+%.so: %.c
+	$(showlink)
+	$(Q)$(CC) \
+		$(CFLAGS) $(EXTRA_CFLAGS) $(CFLAGS_$(patsubst %_glibc,%,$@)) \
+		-fPIC -shared $< -o $@ -Wl,-soname,$@ \
+		$(LDFLAGS) $(EXTRA_LIBS) $(LDFLAGS_$(patsubst %_glibc,%,$@))
+
+clean:
+	$(showclean)
+	$(Q)$(RM) *.a *.o *.so *~ core *.out *.gdb $(CLEAN_TARGETS) $(EXTRA_CLEAN)
+	$(Q)$(RM_R) $(EXTRA_DIRS)
+
+.PHONY: all check clean test run compile
diff --git a/ap/build/uClibc/test/args/Makefile b/ap/build/uClibc/test/args/Makefile
new file mode 100644
index 0000000..67ee452
--- /dev/null
+++ b/ap/build/uClibc/test/args/Makefile
@@ -0,0 +1,7 @@
+# uClibc args tests
+# Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
+
+top_builddir=../../
+include ../Rules.mak
+-include Makefile.in
+include ../Test.mak
diff --git a/ap/build/uClibc/test/args/Makefile.in b/ap/build/uClibc/test/args/Makefile.in
new file mode 100644
index 0000000..f4edab4
--- /dev/null
+++ b/ap/build/uClibc/test/args/Makefile.in
@@ -0,0 +1,9 @@
+# uClibc args tests
+# Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
+
+OPTS_arg_test = a b c d e f g h
+WRAPPER_arg_test = \
+	env -i \
+	ENVVAR=123 \
+	SOMETHING=sldajfasdf \
+	BLAHBLAH=" hi hi "
diff --git a/ap/build/uClibc/test/args/arg_test.c b/ap/build/uClibc/test/args/arg_test.c
new file mode 100644
index 0000000..86f3157
--- /dev/null
+++ b/ap/build/uClibc/test/args/arg_test.c
@@ -0,0 +1,40 @@
+/* vi: set sw=4 ts=4: */
+/*
+ * Test application for argc and argv handling
+ * Copyright (C) 2000-2006 by Erik Andersen <andersen@uclibc.org>
+ *
+ * Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
+ */
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <unistd.h>
+
+int main(int argc, char **argv)
+{
+	int i=0;
+	char** index=__environ;
+
+#ifdef __powerpc__
+	{
+		unsigned long sp;
+		sp = (unsigned long) __builtin_frame_address(0);
+		if(sp&0xf){
+			printf("stack pointer is unaligned! (%08lx)\n", sp);
+		}
+	}
+#endif
+
+	printf("argc=%d\n", argc);
+
+	for(i=0;i<argc;i++) {
+		printf("argv[%d]='%s'\n", i, argv[i]);
+	}
+
+	i=0;
+	while(*index) {
+		printf("environ[%d]='%s'\n", i++, *index++);
+	}
+
+	exit(0);
+}
diff --git a/ap/build/uClibc/test/args/arg_test.out.good b/ap/build/uClibc/test/args/arg_test.out.good
new file mode 100644
index 0000000..937a803
--- /dev/null
+++ b/ap/build/uClibc/test/args/arg_test.out.good
@@ -0,0 +1,13 @@
+argc=9
+argv[0]='./arg_test'
+argv[1]='a'
+argv[2]='b'
+argv[3]='c'
+argv[4]='d'
+argv[5]='e'
+argv[6]='f'
+argv[7]='g'
+argv[8]='h'
+environ[0]='ENVVAR=123'
+environ[1]='SOMETHING=sldajfasdf'
+environ[2]='BLAHBLAH= hi hi '
diff --git a/ap/build/uClibc/test/args/arg_test_glibc.out.good b/ap/build/uClibc/test/args/arg_test_glibc.out.good
new file mode 100644
index 0000000..af0efcb
--- /dev/null
+++ b/ap/build/uClibc/test/args/arg_test_glibc.out.good
@@ -0,0 +1,13 @@
+argc=9
+argv[0]='./arg_test_glibc'
+argv[1]='a'
+argv[2]='b'
+argv[3]='c'
+argv[4]='d'
+argv[5]='e'
+argv[6]='f'
+argv[7]='g'
+argv[8]='h'
+environ[0]='ENVVAR=123'
+environ[1]='SOMETHING=sldajfasdf'
+environ[2]='BLAHBLAH= hi hi '
diff --git a/ap/build/uClibc/test/assert/Makefile b/ap/build/uClibc/test/assert/Makefile
new file mode 100644
index 0000000..6913254
--- /dev/null
+++ b/ap/build/uClibc/test/assert/Makefile
@@ -0,0 +1,7 @@
+# uClibc assert tests
+# Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
+
+top_builddir=../../
+include ../Rules.mak
+-include Makefile.in
+include ../Test.mak
diff --git a/ap/build/uClibc/test/assert/Makefile.in b/ap/build/uClibc/test/assert/Makefile.in
new file mode 100644
index 0000000..8e3514f
--- /dev/null
+++ b/ap/build/uClibc/test/assert/Makefile.in
@@ -0,0 +1,5 @@
+# uClibc assert tests
+# Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
+
+RET_assert     := 134
+WRAPPER_assert := trap ":" ABRT ;
diff --git a/ap/build/uClibc/test/assert/assert.c b/ap/build/uClibc/test/assert/assert.c
new file mode 100644
index 0000000..c7058ff
--- /dev/null
+++ b/ap/build/uClibc/test/assert/assert.c
@@ -0,0 +1,47 @@
+/* vi: set sw=4 ts=4: */
+/*
+ * Test application for functions defined in ctype.h
+ * Copyright (C) 2000-2006 by Erik Andersen <andersen@uclibc.org>
+ *
+ * Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
+ */
+
+#undef NDEBUG
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <assert.h>
+#include <signal.h>
+#include "../testsuite.h"
+
+int got_abort;
+
+static void aborthandler(int junk)
+{
+	got_abort = 1;
+}
+
+int main(int argc, char *argv[])
+{
+	signal(SIGABRT, aborthandler);
+
+	init_testsuite("Testing functions defined in assert.h:\n\t");
+
+	got_abort=0;
+	assert(0 == 0);
+	TEST_NUMERIC(got_abort, 0);
+
+#define NDEBUG
+	got_abort = 0;
+	printf("Don't worry -- This next test is supposed to print an assert message:\n");
+	fprintf(stderr, "\t");
+	assert(0 == 1);
+	TEST_NUMERIC(got_abort, 0);
+
+#undef NDEBUG
+	got_abort = 0;
+	assert(0 == 1);
+	TEST_NUMERIC(got_abort, 1);
+
+	exit(0);
+}
diff --git a/ap/build/uClibc/test/build/Makefile b/ap/build/uClibc/test/build/Makefile
new file mode 100644
index 0000000..99a64d5
--- /dev/null
+++ b/ap/build/uClibc/test/build/Makefile
@@ -0,0 +1,7 @@
+# uClibc build tests
+# Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
+
+top_builddir=../../
+include ../Rules.mak
+-include Makefile.in
+include ../Test.mak
diff --git a/ap/build/uClibc/test/build/check_config_options.sh b/ap/build/uClibc/test/build/check_config_options.sh
new file mode 100755
index 0000000..086131f
--- /dev/null
+++ b/ap/build/uClibc/test/build/check_config_options.sh
@@ -0,0 +1,21 @@
+#!/bin/sh
+
+ret=0
+
+# Make sure nothing uses the ARCH_HAS_MMU option anymore
+result=$(
+find ../.. \
+	| grep -v \
+		-e include/bits/uClibc_config.h \
+		-e /test/ \
+		-e /.svn/ \
+	| xargs grep -sHI \
+		__ARCH_HAS_MMU__
+)
+if [ -n "$result" ] ; then
+	echo "The build system is incorrectly using ARCH_HAS_MMU:"
+	echo "$result"
+	ret=1
+fi
+
+exit $ret
diff --git a/ap/build/uClibc/test/crypt/Makefile b/ap/build/uClibc/test/crypt/Makefile
new file mode 100644
index 0000000..44bbde0
--- /dev/null
+++ b/ap/build/uClibc/test/crypt/Makefile
@@ -0,0 +1,7 @@
+# uClibc crypt tests
+# Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
+
+top_builddir=../../
+include ../Rules.mak
+-include Makefile.in
+include ../Test.mak
diff --git a/ap/build/uClibc/test/crypt/Makefile.in b/ap/build/uClibc/test/crypt/Makefile.in
new file mode 100644
index 0000000..1798a39
--- /dev/null
+++ b/ap/build/uClibc/test/crypt/Makefile.in
@@ -0,0 +1,13 @@
+# uClibc crypt tests
+# Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
+
+EXTRA_LDFLAGS := -lcrypt
+
+OPTS_crypt = < crypt.input
+
+ifneq ($(UCLIBC_HAS_SHA512_CRYPT_IMPL),y)
+TESTS_DISABLED += sha512c-test
+endif
+ifneq ($(UCLIBC_HAS_SHA256_CRYPT_IMPL),y)
+TESTS_DISABLED += sha256c-test
+endif
diff --git a/ap/build/uClibc/test/crypt/crypt.c b/ap/build/uClibc/test/crypt/crypt.c
new file mode 100644
index 0000000..7864647
--- /dev/null
+++ b/ap/build/uClibc/test/crypt/crypt.c
@@ -0,0 +1,103 @@
+
+/*
+ * This crypt(3) validation program shipped with UFC-crypt
+ * is derived from one distributed with Phil Karns PD DES package.
+ *
+ * @(#)cert.c	1.8 11 Aug 1996
+ */
+
+#include <stdio.h>
+#include <stdlib.h>
+#include "crypt.h"
+
+static int totfails = 0;
+
+static void good_bye (void) __attribute__ ((noreturn));
+static void good_bye (void)
+{
+  if(totfails == 0) {
+    printf("Passed DES validation suite\n");
+    exit(0);
+  } else {
+    printf("%d failures during DES validation suite!!!\n", totfails);
+    exit(1);
+  }
+}
+
+static void get8(char *cp)
+{
+	int i,j,t;
+
+	for(i=0;i<8;i++){
+		scanf("%2x",&t);
+		if(feof(stdin))
+		  good_bye();
+		for(j=0; j<8 ; j++) {
+		  *cp++ = (t & (0x01 << (7-j))) != 0;
+		}
+	}
+}
+
+static void put8(char *cp)
+{
+	int i,j,t;
+
+	for(i=0;i<8;i++){
+	  t = 0;
+	  for(j = 0; j<8; j++)
+	    t = (t<<1) | *cp++;
+	  printf("%02x", t);
+	}
+}
+
+int main(void)
+{
+	char key[64],plain[64],cipher[64],answer[64];
+	int i;
+	int test;
+	int fail;
+
+	for(test=0;!feof(stdin);test++){
+
+		get8(key);
+		printf(" K: "); put8(key);
+		setkey(key);
+
+		get8(plain);
+		printf(" P: "); put8(plain);
+
+		get8(answer);
+		printf(" C: "); put8(answer);
+
+		for(i=0;i<64;i++)
+			cipher[i] = plain[i];
+		encrypt(cipher, 0);
+
+		for(i=0;i<64;i++) {
+			if(cipher[i] != answer[i])
+				break;
+		}
+		fail = 0;
+		if(i != 64){
+			printf(" Encrypt FAIL");
+			fail++; totfails++;
+		}
+
+		encrypt(cipher, 1);
+
+		for(i=0;i<64;i++)
+			if(cipher[i] != plain[i])
+				break;
+		if(i != 64){
+			printf(" Decrypt FAIL");
+			fail++; totfails++;
+		}
+
+		if(fail == 0)
+			printf(" OK");
+		printf("\n");
+	}
+	good_bye();
+}
+
+
diff --git a/ap/build/uClibc/test/crypt/crypt.input b/ap/build/uClibc/test/crypt/crypt.input
new file mode 100644
index 0000000..d843fa8
--- /dev/null
+++ b/ap/build/uClibc/test/crypt/crypt.input
@@ -0,0 +1,171 @@
+0101010101010101 95f8a5e5dd31d900 8000000000000000
+0101010101010101 dd7f121ca5015619 4000000000000000
+0101010101010101 2e8653104f3834ea 2000000000000000
+0101010101010101 4bd388ff6cd81d4f 1000000000000000
+0101010101010101 20b9e767b2fb1456 0800000000000000
+0101010101010101 55579380d77138ef 0400000000000000
+0101010101010101 6cc5defaaf04512f 0200000000000000
+0101010101010101 0d9f279ba5d87260 0100000000000000
+0101010101010101 d9031b0271bd5a0a 0080000000000000
+0101010101010101 424250b37c3dd951 0040000000000000
+0101010101010101 b8061b7ecd9a21e5 0020000000000000
+0101010101010101 f15d0f286b65bd28 0010000000000000
+0101010101010101 add0cc8d6e5deba1 0008000000000000
+0101010101010101 e6d5f82752ad63d1 0004000000000000
+0101010101010101 ecbfe3bd3f591a5e 0002000000000000
+0101010101010101 f356834379d165cd 0001000000000000
+0101010101010101 2b9f982f20037fa9 0000800000000000
+0101010101010101 889de068a16f0be6 0000400000000000
+0101010101010101 e19e275d846a1298 0000200000000000
+0101010101010101 329a8ed523d71aec 0000100000000000
+0101010101010101 e7fce22557d23c97 0000080000000000
+0101010101010101 12a9f5817ff2d65d 0000040000000000
+0101010101010101 a484c3ad38dc9c19 0000020000000000
+0101010101010101 fbe00a8a1ef8ad72 0000010000000000
+0101010101010101 750d079407521363 0000008000000000
+0101010101010101 64feed9c724c2faf 0000004000000000
+0101010101010101 f02b263b328e2b60 0000002000000000
+0101010101010101 9d64555a9a10b852 0000001000000000
+0101010101010101 d106ff0bed5255d7 0000000800000000
+0101010101010101 e1652c6b138c64a5 0000000400000000
+0101010101010101 e428581186ec8f46 0000000200000000
+0101010101010101 aeb5f5ede22d1a36 0000000100000000
+0101010101010101 e943d7568aec0c5c 0000000080000000
+0101010101010101 df98c8276f54b04b 0000000040000000
+0101010101010101 b160e4680f6c696f 0000000020000000
+0101010101010101 fa0752b07d9c4ab8 0000000010000000
+0101010101010101 ca3a2b036dbc8502 0000000008000000
+0101010101010101 5e0905517bb59bcf 0000000004000000
+0101010101010101 814eeb3b91d90726 0000000002000000
+0101010101010101 4d49db1532919c9f 0000000001000000
+0101010101010101 25eb5fc3f8cf0621 0000000000800000
+0101010101010101 ab6a20c0620d1c6f 0000000000400000
+0101010101010101 79e90dbc98f92cca 0000000000200000
+0101010101010101 866ecedd8072bb0e 0000000000100000
+0101010101010101 8b54536f2f3e64a8 0000000000080000
+0101010101010101 ea51d3975595b86b 0000000000040000
+0101010101010101 caffc6ac4542de31 0000000000020000
+0101010101010101 8dd45a2ddf90796c 0000000000010000
+0101010101010101 1029d55e880ec2d0 0000000000008000
+0101010101010101 5d86cb23639dbea9 0000000000004000
+0101010101010101 1d1ca853ae7c0c5f 0000000000002000
+0101010101010101 ce332329248f3228 0000000000001000
+0101010101010101 8405d1abe24fb942 0000000000000800
+0101010101010101 e643d78090ca4207 0000000000000400
+0101010101010101 48221b9937748a23 0000000000000200
+0101010101010101 dd7c0bbd61fafd54 0000000000000100
+0101010101010101 2fbc291a570db5c4 0000000000000080
+0101010101010101 e07c30d7e4e26e12 0000000000000040
+0101010101010101 0953e2258e8e90a1 0000000000000020
+0101010101010101 5b711bc4ceebf2ee 0000000000000010
+0101010101010101 cc083f1e6d9e85f6 0000000000000008
+0101010101010101 d2fd8867d50d2dfe 0000000000000004
+0101010101010101 06e7ea22ce92708f 0000000000000002
+0101010101010101 166b40b44aba4bd6 0000000000000001
+8001010101010101 0000000000000000 95a8d72813daa94d
+4001010101010101 0000000000000000 0eec1487dd8c26d5
+2001010101010101 0000000000000000 7ad16ffb79c45926
+1001010101010101 0000000000000000 d3746294ca6a6cf3
+0801010101010101 0000000000000000 809f5f873c1fd761
+0401010101010101 0000000000000000 c02faffec989d1fc
+0201010101010101 0000000000000000 4615aa1d33e72f10
+0180010101010101 0000000000000000 2055123350c00858
+0140010101010101 0000000000000000 df3b99d6577397c8
+0120010101010101 0000000000000000 31fe17369b5288c9
+0110010101010101 0000000000000000 dfdd3cc64dae1642
+0108010101010101 0000000000000000 178c83ce2b399d94
+0104010101010101 0000000000000000 50f636324a9b7f80
+0102010101010101 0000000000000000 a8468ee3bc18f06d
+0101800101010101 0000000000000000 a2dc9e92fd3cde92
+0101400101010101 0000000000000000 cac09f797d031287
+0101200101010101 0000000000000000 90ba680b22aeb525
+0101100101010101 0000000000000000 ce7a24f350e280b6
+0101080101010101 0000000000000000 882bff0aa01a0b87
+0101040101010101 0000000000000000 25610288924511c2
+0101020101010101 0000000000000000 c71516c29c75d170
+0101018001010101 0000000000000000 5199c29a52c9f059
+0101014001010101 0000000000000000 c22f0a294a71f29f
+0101012001010101 0000000000000000 ee371483714c02ea
+0101011001010101 0000000000000000 a81fbd448f9e522f
+0101010801010101 0000000000000000 4f644c92e192dfed
+0101010401010101 0000000000000000 1afa9a66a6df92ae
+0101010201010101 0000000000000000 b3c1cc715cb879d8
+0101010180010101 0000000000000000 19d032e64ab0bd8b
+0101010140010101 0000000000000000 3cfaa7a7dc8720dc
+0101010120010101 0000000000000000 b7265f7f447ac6f3
+0101010110010101 0000000000000000 9db73b3c0d163f54
+0101010108010101 0000000000000000 8181b65babf4a975
+0101010104010101 0000000000000000 93c9b64042eaa240
+0101010102010101 0000000000000000 5570530829705592
+0101010101800101 0000000000000000 8638809e878787a0
+0101010101400101 0000000000000000 41b9a79af79ac208
+0101010101200101 0000000000000000 7a9be42f2009a892
+0101010101100101 0000000000000000 29038d56ba6d2745
+0101010101080101 0000000000000000 5495c6abf1e5df51
+0101010101040101 0000000000000000 ae13dbd561488933
+0101010101020101 0000000000000000 024d1ffa8904e389
+0101010101018001 0000000000000000 d1399712f99bf02e
+0101010101014001 0000000000000000 14c1d7c1cffec79e
+0101010101012001 0000000000000000 1de5279dae3bed6f
+0101010101011001 0000000000000000 e941a33f85501303
+0101010101010801 0000000000000000 da99dbbc9a03f379
+0101010101010401 0000000000000000 b7fc92f91d8e92e9
+0101010101010201 0000000000000000 ae8e5caa3ca04e85
+0101010101010180 0000000000000000 9cc62df43b6eed74
+0101010101010140 0000000000000000 d863dbb5c59a91a0
+0101010101010120 0000000000000000 a1ab2190545b91d7
+0101010101010110 0000000000000000 0875041e64c570f7
+0101010101010108 0000000000000000 5a594528bebef1cc
+0101010101010104 0000000000000000 fcdb3291de21f0c0
+0101010101010102 0000000000000000 869efd7f9f265a09
+1046913489980131 0000000000000000 88d55e54f54c97b4
+1007103489988020 0000000000000000 0c0cc00c83ea48fd
+10071034c8980120 0000000000000000 83bc8ef3a6570183
+1046103489988020 0000000000000000 df725dcad94ea2e9
+1086911519190101 0000000000000000 e652b53b550be8b0
+1086911519580101 0000000000000000 af527120c485cbb0
+5107b01519580101 0000000000000000 0f04ce393db926d5
+1007b01519190101 0000000000000000 c9f00ffc74079067
+3107915498080101 0000000000000000 7cfd82a593252b4e
+3107919498080101 0000000000000000 cb49a2f9e91363e3
+10079115b9080140 0000000000000000 00b588be70d23f56
+3107911598080140 0000000000000000 406a9a6ab43399ae
+1007d01589980101 0000000000000000 6cb773611dca9ada
+9107911589980101 0000000000000000 67fd21c17dbb5d70
+9107d01589190101 0000000000000000 9592cb4110430787
+1007d01598980120 0000000000000000 a6b7ff68a318ddd3
+1007940498190101 0000000000000000 4d102196c914ca16
+0107910491190401 0000000000000000 2dfa9f4573594965
+0107910491190101 0000000000000000 b46604816c0e0774
+0107940491190401 0000000000000000 6e7e6221a4f34e87
+19079210981a0101 0000000000000000 aa85e74643233199
+1007911998190801 0000000000000000 2e5a19db4d1962d6
+10079119981a0801 0000000000000000 23a866a809d30894
+1007921098190101 0000000000000000 d812d961f017d320
+100791159819010b 0000000000000000 055605816e58608f
+1004801598190101 0000000000000000 abd88e8b1b7716f1
+1004801598190102 0000000000000000 537ac95be69da1e1
+1004801598190108 0000000000000000 aed0f6ae3c25cdd8
+1002911598100104 0000000000000000 b3e35a5ee53e7b8d
+1002911598190104 0000000000000000 61c79c71921a2ef8
+1002911598100201 0000000000000000 e2f5728f0995013c
+1002911698100101 0000000000000000 1aeac39a61f0a464
+7ca110454a1a6e57 01a1d6d039776742 690f5b0d9a26939b
+0131d9619dc1376e 5cd54ca83def57da 7a389d10354bd271
+07a1133e4a0b2686 0248d43806f67172 868ebb51cab4599a
+3849674c2602319e 51454b582ddf440a 7178876e01f19b2a
+04b915ba43feb5b6 42fd443059577fa2 af37fb421f8c4095
+0113b970fd34f2ce 059b5e0851cf143a 86a560f10ec6d85b
+0170f175468fb5e6 0756d8e0774761d2 0cd3da020021dc09
+43297fad38e373fe 762514b829bf486a ea676b2cb7db2b7a
+07a7137045da2a16 3bdd119049372802 dfd64a815caf1a0f
+04689104c2fd3b2f 26955f6835af609a 5c513c9c4886c088
+37d06bb516cb7546 164d5e404f275232 0a2aeeae3ff4ab77
+1f08260d1ac2465e 6b056e18759f5cca ef1bf03e5dfa575a
+584023641aba6176 004bd6ef09176062 88bf0db6d70dee56
+025816164629b007 480d39006ee762f2 a1f9915541020b56
+49793ebc79b3258f 437540c8698f3cfa 6fbf1cafcffd0556
+4fb05e1515ab73a7 072d43a077075292 2f22e49bab7ca1ac
+49e95d6d4ca229bf 02fe55778117f12a 5a6b612cc26cce4a
+018310dc409b26d6 1d9d5c5018f728c2 5f4c038ed12b2e41
+1c587f1c13924fef 305532286d6f295a 63fac0d034d9f793
diff --git a/ap/build/uClibc/test/crypt/crypt.out.good b/ap/build/uClibc/test/crypt/crypt.out.good
new file mode 100644
index 0000000..073ab2b
--- /dev/null
+++ b/ap/build/uClibc/test/crypt/crypt.out.good
@@ -0,0 +1,172 @@
+ K: 0101010101010101 P: 95f8a5e5dd31d900 C: 8000000000000000 OK
+ K: 0101010101010101 P: dd7f121ca5015619 C: 4000000000000000 OK
+ K: 0101010101010101 P: 2e8653104f3834ea C: 2000000000000000 OK
+ K: 0101010101010101 P: 4bd388ff6cd81d4f C: 1000000000000000 OK
+ K: 0101010101010101 P: 20b9e767b2fb1456 C: 0800000000000000 OK
+ K: 0101010101010101 P: 55579380d77138ef C: 0400000000000000 OK
+ K: 0101010101010101 P: 6cc5defaaf04512f C: 0200000000000000 OK
+ K: 0101010101010101 P: 0d9f279ba5d87260 C: 0100000000000000 OK
+ K: 0101010101010101 P: d9031b0271bd5a0a C: 0080000000000000 OK
+ K: 0101010101010101 P: 424250b37c3dd951 C: 0040000000000000 OK
+ K: 0101010101010101 P: b8061b7ecd9a21e5 C: 0020000000000000 OK
+ K: 0101010101010101 P: f15d0f286b65bd28 C: 0010000000000000 OK
+ K: 0101010101010101 P: add0cc8d6e5deba1 C: 0008000000000000 OK
+ K: 0101010101010101 P: e6d5f82752ad63d1 C: 0004000000000000 OK
+ K: 0101010101010101 P: ecbfe3bd3f591a5e C: 0002000000000000 OK
+ K: 0101010101010101 P: f356834379d165cd C: 0001000000000000 OK
+ K: 0101010101010101 P: 2b9f982f20037fa9 C: 0000800000000000 OK
+ K: 0101010101010101 P: 889de068a16f0be6 C: 0000400000000000 OK
+ K: 0101010101010101 P: e19e275d846a1298 C: 0000200000000000 OK
+ K: 0101010101010101 P: 329a8ed523d71aec C: 0000100000000000 OK
+ K: 0101010101010101 P: e7fce22557d23c97 C: 0000080000000000 OK
+ K: 0101010101010101 P: 12a9f5817ff2d65d C: 0000040000000000 OK
+ K: 0101010101010101 P: a484c3ad38dc9c19 C: 0000020000000000 OK
+ K: 0101010101010101 P: fbe00a8a1ef8ad72 C: 0000010000000000 OK
+ K: 0101010101010101 P: 750d079407521363 C: 0000008000000000 OK
+ K: 0101010101010101 P: 64feed9c724c2faf C: 0000004000000000 OK
+ K: 0101010101010101 P: f02b263b328e2b60 C: 0000002000000000 OK
+ K: 0101010101010101 P: 9d64555a9a10b852 C: 0000001000000000 OK
+ K: 0101010101010101 P: d106ff0bed5255d7 C: 0000000800000000 OK
+ K: 0101010101010101 P: e1652c6b138c64a5 C: 0000000400000000 OK
+ K: 0101010101010101 P: e428581186ec8f46 C: 0000000200000000 OK
+ K: 0101010101010101 P: aeb5f5ede22d1a36 C: 0000000100000000 OK
+ K: 0101010101010101 P: e943d7568aec0c5c C: 0000000080000000 OK
+ K: 0101010101010101 P: df98c8276f54b04b C: 0000000040000000 OK
+ K: 0101010101010101 P: b160e4680f6c696f C: 0000000020000000 OK
+ K: 0101010101010101 P: fa0752b07d9c4ab8 C: 0000000010000000 OK
+ K: 0101010101010101 P: ca3a2b036dbc8502 C: 0000000008000000 OK
+ K: 0101010101010101 P: 5e0905517bb59bcf C: 0000000004000000 OK
+ K: 0101010101010101 P: 814eeb3b91d90726 C: 0000000002000000 OK
+ K: 0101010101010101 P: 4d49db1532919c9f C: 0000000001000000 OK
+ K: 0101010101010101 P: 25eb5fc3f8cf0621 C: 0000000000800000 OK
+ K: 0101010101010101 P: ab6a20c0620d1c6f C: 0000000000400000 OK
+ K: 0101010101010101 P: 79e90dbc98f92cca C: 0000000000200000 OK
+ K: 0101010101010101 P: 866ecedd8072bb0e C: 0000000000100000 OK
+ K: 0101010101010101 P: 8b54536f2f3e64a8 C: 0000000000080000 OK
+ K: 0101010101010101 P: ea51d3975595b86b C: 0000000000040000 OK
+ K: 0101010101010101 P: caffc6ac4542de31 C: 0000000000020000 OK
+ K: 0101010101010101 P: 8dd45a2ddf90796c C: 0000000000010000 OK
+ K: 0101010101010101 P: 1029d55e880ec2d0 C: 0000000000008000 OK
+ K: 0101010101010101 P: 5d86cb23639dbea9 C: 0000000000004000 OK
+ K: 0101010101010101 P: 1d1ca853ae7c0c5f C: 0000000000002000 OK
+ K: 0101010101010101 P: ce332329248f3228 C: 0000000000001000 OK
+ K: 0101010101010101 P: 8405d1abe24fb942 C: 0000000000000800 OK
+ K: 0101010101010101 P: e643d78090ca4207 C: 0000000000000400 OK
+ K: 0101010101010101 P: 48221b9937748a23 C: 0000000000000200 OK
+ K: 0101010101010101 P: dd7c0bbd61fafd54 C: 0000000000000100 OK
+ K: 0101010101010101 P: 2fbc291a570db5c4 C: 0000000000000080 OK
+ K: 0101010101010101 P: e07c30d7e4e26e12 C: 0000000000000040 OK
+ K: 0101010101010101 P: 0953e2258e8e90a1 C: 0000000000000020 OK
+ K: 0101010101010101 P: 5b711bc4ceebf2ee C: 0000000000000010 OK
+ K: 0101010101010101 P: cc083f1e6d9e85f6 C: 0000000000000008 OK
+ K: 0101010101010101 P: d2fd8867d50d2dfe C: 0000000000000004 OK
+ K: 0101010101010101 P: 06e7ea22ce92708f C: 0000000000000002 OK
+ K: 0101010101010101 P: 166b40b44aba4bd6 C: 0000000000000001 OK
+ K: 8001010101010101 P: 0000000000000000 C: 95a8d72813daa94d OK
+ K: 4001010101010101 P: 0000000000000000 C: 0eec1487dd8c26d5 OK
+ K: 2001010101010101 P: 0000000000000000 C: 7ad16ffb79c45926 OK
+ K: 1001010101010101 P: 0000000000000000 C: d3746294ca6a6cf3 OK
+ K: 0801010101010101 P: 0000000000000000 C: 809f5f873c1fd761 OK
+ K: 0401010101010101 P: 0000000000000000 C: c02faffec989d1fc OK
+ K: 0201010101010101 P: 0000000000000000 C: 4615aa1d33e72f10 OK
+ K: 0180010101010101 P: 0000000000000000 C: 2055123350c00858 OK
+ K: 0140010101010101 P: 0000000000000000 C: df3b99d6577397c8 OK
+ K: 0120010101010101 P: 0000000000000000 C: 31fe17369b5288c9 OK
+ K: 0110010101010101 P: 0000000000000000 C: dfdd3cc64dae1642 OK
+ K: 0108010101010101 P: 0000000000000000 C: 178c83ce2b399d94 OK
+ K: 0104010101010101 P: 0000000000000000 C: 50f636324a9b7f80 OK
+ K: 0102010101010101 P: 0000000000000000 C: a8468ee3bc18f06d OK
+ K: 0101800101010101 P: 0000000000000000 C: a2dc9e92fd3cde92 OK
+ K: 0101400101010101 P: 0000000000000000 C: cac09f797d031287 OK
+ K: 0101200101010101 P: 0000000000000000 C: 90ba680b22aeb525 OK
+ K: 0101100101010101 P: 0000000000000000 C: ce7a24f350e280b6 OK
+ K: 0101080101010101 P: 0000000000000000 C: 882bff0aa01a0b87 OK
+ K: 0101040101010101 P: 0000000000000000 C: 25610288924511c2 OK
+ K: 0101020101010101 P: 0000000000000000 C: c71516c29c75d170 OK
+ K: 0101018001010101 P: 0000000000000000 C: 5199c29a52c9f059 OK
+ K: 0101014001010101 P: 0000000000000000 C: c22f0a294a71f29f OK
+ K: 0101012001010101 P: 0000000000000000 C: ee371483714c02ea OK
+ K: 0101011001010101 P: 0000000000000000 C: a81fbd448f9e522f OK
+ K: 0101010801010101 P: 0000000000000000 C: 4f644c92e192dfed OK
+ K: 0101010401010101 P: 0000000000000000 C: 1afa9a66a6df92ae OK
+ K: 0101010201010101 P: 0000000000000000 C: b3c1cc715cb879d8 OK
+ K: 0101010180010101 P: 0000000000000000 C: 19d032e64ab0bd8b OK
+ K: 0101010140010101 P: 0000000000000000 C: 3cfaa7a7dc8720dc OK
+ K: 0101010120010101 P: 0000000000000000 C: b7265f7f447ac6f3 OK
+ K: 0101010110010101 P: 0000000000000000 C: 9db73b3c0d163f54 OK
+ K: 0101010108010101 P: 0000000000000000 C: 8181b65babf4a975 OK
+ K: 0101010104010101 P: 0000000000000000 C: 93c9b64042eaa240 OK
+ K: 0101010102010101 P: 0000000000000000 C: 5570530829705592 OK
+ K: 0101010101800101 P: 0000000000000000 C: 8638809e878787a0 OK
+ K: 0101010101400101 P: 0000000000000000 C: 41b9a79af79ac208 OK
+ K: 0101010101200101 P: 0000000000000000 C: 7a9be42f2009a892 OK
+ K: 0101010101100101 P: 0000000000000000 C: 29038d56ba6d2745 OK
+ K: 0101010101080101 P: 0000000000000000 C: 5495c6abf1e5df51 OK
+ K: 0101010101040101 P: 0000000000000000 C: ae13dbd561488933 OK
+ K: 0101010101020101 P: 0000000000000000 C: 024d1ffa8904e389 OK
+ K: 0101010101018001 P: 0000000000000000 C: d1399712f99bf02e OK
+ K: 0101010101014001 P: 0000000000000000 C: 14c1d7c1cffec79e OK
+ K: 0101010101012001 P: 0000000000000000 C: 1de5279dae3bed6f OK
+ K: 0101010101011001 P: 0000000000000000 C: e941a33f85501303 OK
+ K: 0101010101010801 P: 0000000000000000 C: da99dbbc9a03f379 OK
+ K: 0101010101010401 P: 0000000000000000 C: b7fc92f91d8e92e9 OK
+ K: 0101010101010201 P: 0000000000000000 C: ae8e5caa3ca04e85 OK
+ K: 0101010101010180 P: 0000000000000000 C: 9cc62df43b6eed74 OK
+ K: 0101010101010140 P: 0000000000000000 C: d863dbb5c59a91a0 OK
+ K: 0101010101010120 P: 0000000000000000 C: a1ab2190545b91d7 OK
+ K: 0101010101010110 P: 0000000000000000 C: 0875041e64c570f7 OK
+ K: 0101010101010108 P: 0000000000000000 C: 5a594528bebef1cc OK
+ K: 0101010101010104 P: 0000000000000000 C: fcdb3291de21f0c0 OK
+ K: 0101010101010102 P: 0000000000000000 C: 869efd7f9f265a09 OK
+ K: 1046913489980131 P: 0000000000000000 C: 88d55e54f54c97b4 OK
+ K: 1007103489988020 P: 0000000000000000 C: 0c0cc00c83ea48fd OK
+ K: 10071034c8980120 P: 0000000000000000 C: 83bc8ef3a6570183 OK
+ K: 1046103489988020 P: 0000000000000000 C: df725dcad94ea2e9 OK
+ K: 1086911519190101 P: 0000000000000000 C: e652b53b550be8b0 OK
+ K: 1086911519580101 P: 0000000000000000 C: af527120c485cbb0 OK
+ K: 5107b01519580101 P: 0000000000000000 C: 0f04ce393db926d5 OK
+ K: 1007b01519190101 P: 0000000000000000 C: c9f00ffc74079067 OK
+ K: 3107915498080101 P: 0000000000000000 C: 7cfd82a593252b4e OK
+ K: 3107919498080101 P: 0000000000000000 C: cb49a2f9e91363e3 OK
+ K: 10079115b9080140 P: 0000000000000000 C: 00b588be70d23f56 OK
+ K: 3107911598080140 P: 0000000000000000 C: 406a9a6ab43399ae OK
+ K: 1007d01589980101 P: 0000000000000000 C: 6cb773611dca9ada OK
+ K: 9107911589980101 P: 0000000000000000 C: 67fd21c17dbb5d70 OK
+ K: 9107d01589190101 P: 0000000000000000 C: 9592cb4110430787 OK
+ K: 1007d01598980120 P: 0000000000000000 C: a6b7ff68a318ddd3 OK
+ K: 1007940498190101 P: 0000000000000000 C: 4d102196c914ca16 OK
+ K: 0107910491190401 P: 0000000000000000 C: 2dfa9f4573594965 OK
+ K: 0107910491190101 P: 0000000000000000 C: b46604816c0e0774 OK
+ K: 0107940491190401 P: 0000000000000000 C: 6e7e6221a4f34e87 OK
+ K: 19079210981a0101 P: 0000000000000000 C: aa85e74643233199 OK
+ K: 1007911998190801 P: 0000000000000000 C: 2e5a19db4d1962d6 OK
+ K: 10079119981a0801 P: 0000000000000000 C: 23a866a809d30894 OK
+ K: 1007921098190101 P: 0000000000000000 C: d812d961f017d320 OK
+ K: 100791159819010b P: 0000000000000000 C: 055605816e58608f OK
+ K: 1004801598190101 P: 0000000000000000 C: abd88e8b1b7716f1 OK
+ K: 1004801598190102 P: 0000000000000000 C: 537ac95be69da1e1 OK
+ K: 1004801598190108 P: 0000000000000000 C: aed0f6ae3c25cdd8 OK
+ K: 1002911598100104 P: 0000000000000000 C: b3e35a5ee53e7b8d OK
+ K: 1002911598190104 P: 0000000000000000 C: 61c79c71921a2ef8 OK
+ K: 1002911598100201 P: 0000000000000000 C: e2f5728f0995013c OK
+ K: 1002911698100101 P: 0000000000000000 C: 1aeac39a61f0a464 OK
+ K: 7ca110454a1a6e57 P: 01a1d6d039776742 C: 690f5b0d9a26939b OK
+ K: 0131d9619dc1376e P: 5cd54ca83def57da C: 7a389d10354bd271 OK
+ K: 07a1133e4a0b2686 P: 0248d43806f67172 C: 868ebb51cab4599a OK
+ K: 3849674c2602319e P: 51454b582ddf440a C: 7178876e01f19b2a OK
+ K: 04b915ba43feb5b6 P: 42fd443059577fa2 C: af37fb421f8c4095 OK
+ K: 0113b970fd34f2ce P: 059b5e0851cf143a C: 86a560f10ec6d85b OK
+ K: 0170f175468fb5e6 P: 0756d8e0774761d2 C: 0cd3da020021dc09 OK
+ K: 43297fad38e373fe P: 762514b829bf486a C: ea676b2cb7db2b7a OK
+ K: 07a7137045da2a16 P: 3bdd119049372802 C: dfd64a815caf1a0f OK
+ K: 04689104c2fd3b2f P: 26955f6835af609a C: 5c513c9c4886c088 OK
+ K: 37d06bb516cb7546 P: 164d5e404f275232 C: 0a2aeeae3ff4ab77 OK
+ K: 1f08260d1ac2465e P: 6b056e18759f5cca C: ef1bf03e5dfa575a OK
+ K: 584023641aba6176 P: 004bd6ef09176062 C: 88bf0db6d70dee56 OK
+ K: 025816164629b007 P: 480d39006ee762f2 C: a1f9915541020b56 OK
+ K: 49793ebc79b3258f P: 437540c8698f3cfa C: 6fbf1cafcffd0556 OK
+ K: 4fb05e1515ab73a7 P: 072d43a077075292 C: 2f22e49bab7ca1ac OK
+ K: 49e95d6d4ca229bf P: 02fe55778117f12a C: 5a6b612cc26cce4a OK
+ K: 018310dc409b26d6 P: 1d9d5c5018f728c2 C: 5f4c038ed12b2e41 OK
+ K: 1c587f1c13924fef P: 305532286d6f295a C: 63fac0d034d9f793 OK
+Passed DES validation suite
diff --git a/ap/build/uClibc/test/crypt/md5c-test.c b/ap/build/uClibc/test/crypt/md5c-test.c
new file mode 100644
index 0000000..3c61540
--- /dev/null
+++ b/ap/build/uClibc/test/crypt/md5c-test.c
@@ -0,0 +1,19 @@
+#include <stdlib.h>
+#include <stdio.h>
+#include <string.h>
+#include <crypt.h>
+
+int
+main (int argc, char *argv[])
+{
+  const char salt[] = "$1$saltstring";
+  char *cp;
+
+  cp = crypt ("Hello world!", salt);
+  if (strcmp ("$1$saltstri$YMyguxXMBpd2TEZ.vS/3q1", cp)) {
+      fprintf(stderr, "Failed md5 crypt test!\n");
+      return EXIT_FAILURE;
+  }
+  fprintf(stderr, "Passed md5 crypt test!\n");
+  return EXIT_SUCCESS;
+}
diff --git a/ap/build/uClibc/test/crypt/sha256c-test.c b/ap/build/uClibc/test/crypt/sha256c-test.c
new file mode 100644
index 0000000..357f0d8
--- /dev/null
+++ b/ap/build/uClibc/test/crypt/sha256c-test.c
@@ -0,0 +1,62 @@
+#include <crypt.h>
+#include <stdio.h>
+#include <string.h>
+
+static const struct
+{
+  const char *salt;
+  const char *input;
+  const char *expected;
+} tests[] =
+{
+  { "$5$saltstring", "Hello world!",
+    "$5$saltstring$5B8vYYiY.CVt1RlTTf8KbXBH3hsxY/GNooZaBBGWEc5" },
+  { "$5$rounds=10000$saltstringsaltstring", "Hello world!",
+    "$5$rounds=10000$saltstringsaltst$3xv.VbSHBb41AL9AvLeujZkZRBAwqFMz2."
+    "opqey6IcA" },
+  { "$5$rounds=5000$toolongsaltstring", "This is just a test",
+    "$5$rounds=5000$toolongsaltstrin$Un/5jzAHMgOGZ5.mWJpuVolil07guHPvOW8"
+    "mGRcvxa5" },
+  { "$5$rounds=1400$anotherlongsaltstring",
+    "a very much longer text to encrypt.  This one even stretches over more"
+    "than one line.",
+    "$5$rounds=1400$anotherlongsalts$Rx.j8H.h8HjEDGomFU8bDkXm3XIUnzyxf12"
+    "oP84Bnq1" },
+  { "$5$rounds=77777$short",
+    "we have a short salt string but not a short password",
+    "$5$rounds=77777$short$JiO1O3ZpDAxGJeaDIuqCoEFysAe1mZNJRs3pw0KQRd/" },
+  { "$5$rounds=123456$asaltof16chars..", "a short string",
+    "$5$rounds=123456$asaltof16chars..$gP3VQ/6X7UUEW3HkBn2w1/Ptq2jxPyzV/"
+    "cZKmF/wJvD" },
+  { "$5$rounds=10$roundstoolow", "the minimum number is still observed",
+    "$5$rounds=1000$roundstoolow$yfvwcWrQ8l/K0DAWyuPMDNHpIVlTQebY9l/gL97"
+    "2bIC" },
+};
+#define ntests (sizeof (tests) / sizeof (tests[0]))
+
+
+
+static int
+do_test (void)
+{
+  int result = 0;
+  int i;
+
+  for (i = 0; i < ntests; ++i)
+    {
+      char *cp = crypt (tests[i].input, tests[i].salt);
+
+      if (strcmp (cp, tests[i].expected) != 0)
+	{
+	  printf ("test %d: expected \"%s\", got \"%s\"\n",
+		  i, tests[i].expected, cp);
+	  result = 1;
+	}
+    }
+
+  return result;
+}
+
+#define TIMEOUT 6
+#define TEST_FUNCTION do_test ()
+#include "../test-skeleton.c"
diff --git a/ap/build/uClibc/test/crypt/sha512c-test.c b/ap/build/uClibc/test/crypt/sha512c-test.c
new file mode 100644
index 0000000..c829242
--- /dev/null
+++ b/ap/build/uClibc/test/crypt/sha512c-test.c
@@ -0,0 +1,63 @@
+#include <crypt.h>
+#include <stdio.h>
+#include <string.h>
+
+static const struct
+{
+  const char *salt;
+  const char *input;
+  const char *expected;
+} tests[] =
+{
+  { "$6$saltstring", "Hello world!",
+    "$6$saltstring$svn8UoSVapNtMuq1ukKS4tPQd8iKwSMHWjl/O817G3uBnIFNjnQJu"
+    "esI68u4OTLiBFdcbYEdFCoEOfaS35inz1" },
+  { "$6$rounds=10000$saltstringsaltstring", "Hello world!",
+    "$6$rounds=10000$saltstringsaltst$OW1/O6BYHV6BcXZu8QVeXbDWra3Oeqh0sb"
+    "HbbMCVNSnCM/UrjmM0Dp8vOuZeHBy/YTBmSK6H9qs/y3RnOaw5v." },
+  { "$6$rounds=5000$toolongsaltstring", "This is just a test",
+    "$6$rounds=5000$toolongsaltstrin$lQ8jolhgVRVhY4b5pZKaysCLi0QBxGoNeKQ"
+    "zQ3glMhwllF7oGDZxUhx1yxdYcz/e1JSbq3y6JMxxl8audkUEm0" },
+  { "$6$rounds=1400$anotherlongsaltstring",
+    "a very much longer text to encrypt.  This one even stretches over more"
+    "than one line.",
+    "$6$rounds=1400$anotherlongsalts$POfYwTEok97VWcjxIiSOjiykti.o/pQs.wP"
+    "vMxQ6Fm7I6IoYN3CmLs66x9t0oSwbtEW7o7UmJEiDwGqd8p4ur1" },
+  { "$6$rounds=77777$short",
+    "we have a short salt string but not a short password",
+    "$6$rounds=77777$short$WuQyW2YR.hBNpjjRhpYD/ifIw05xdfeEyQoMxIXbkvr0g"
+    "ge1a1x3yRULJ5CCaUeOxFmtlcGZelFl5CxtgfiAc0" },
+  { "$6$rounds=123456$asaltof16chars..", "a short string",
+    "$6$rounds=123456$asaltof16chars..$BtCwjqMJGx5hrJhZywWvt0RLE8uZ4oPwc"
+    "elCjmw2kSYu.Ec6ycULevoBK25fs2xXgMNrCzIMVcgEJAstJeonj1" },
+  { "$6$rounds=10$roundstoolow", "the minimum number is still observed",
+    "$6$rounds=1000$roundstoolow$kUMsbe306n21p9R.FRkW3IGn.S9NPN0x50YhH1x"
+    "hLsPuWGsUSklZt58jaTfF4ZEQpyUNGc0dqbpBYYBaHHrsX." },
+};
+#define ntests (sizeof (tests) / sizeof (tests[0]))
+
+
+static int
+do_test (void)
+{
+  int result = 0;
+  int i;
+
+  for (i = 0; i < ntests; ++i)
+    {
+      char *cp = crypt (tests[i].input, tests[i].salt);
+
+      if (strcmp (cp, tests[i].expected) != 0)
+	{
+	  printf ("test %d: expected \"%s\", got \"%s\"\n",
+		  i, tests[i].expected, cp);
+	  result = 1;
+	}
+    }
+
+  return result;
+}
+
+#define TIMEOUT 6
+#define TEST_FUNCTION do_test ()
+#include "../test-skeleton.c"
diff --git a/ap/build/uClibc/test/ctype/Makefile b/ap/build/uClibc/test/ctype/Makefile
new file mode 100644
index 0000000..fd72584
--- /dev/null
+++ b/ap/build/uClibc/test/ctype/Makefile
@@ -0,0 +1,7 @@
+# uClibc ctype tests
+# Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
+
+top_builddir=../../
+include ../Rules.mak
+-include Makefile.in
+include ../Test.mak
diff --git a/ap/build/uClibc/test/ctype/Makefile.in b/ap/build/uClibc/test/ctype/Makefile.in
new file mode 100644
index 0000000..ee10d59
--- /dev/null
+++ b/ap/build/uClibc/test/ctype/Makefile.in
@@ -0,0 +1,4 @@
+# uClibc ctype tests
+# Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
+
+TESTS := ctype
diff --git a/ap/build/uClibc/test/ctype/ctype.c b/ap/build/uClibc/test/ctype/ctype.c
new file mode 100644
index 0000000..f38f722
--- /dev/null
+++ b/ap/build/uClibc/test/ctype/ctype.c
@@ -0,0 +1,250 @@
+/* vi: set sw=4 ts=4: */
+/*
+ * Test application for functions defined in ctype.h
+ * Copyright (C) 2000-2006 by Erik Andersen <andersen@uclibc.org>
+ *
+ * Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
+ */
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <stdarg.h>
+#include <ctype.h>
+#include "../testsuite.h"
+
+
+int main( int argc, char **argv)
+{
+	int i, c;
+
+
+    init_testsuite("Testing functions defined in ctype.h\n");
+
+	/* isalnum() */
+	{
+		int buffer[]={ '1', '4', 'a', 'z', 'A', 'Z', '5', -1};
+		for(i=0; buffer[i]!=-1; i++) {
+			c = buffer[i];
+			TEST( isalnum(c)!=0);
+		}
+	}
+	{
+		int buffer[]={  2, 128, 254, '\n', -1};
+		for(i=0; buffer[i]!=-1; i++) {
+			c = buffer[i];
+			TEST( isalnum(c)==0);
+		}
+	}
+
+
+
+	/* isalpha() */
+	{
+		int buffer[]={ 'a', 'z', 'A', 'Z', -1};
+		for(i=0; buffer[i]!=-1; i++) {
+			c = buffer[i];
+			TEST( isalpha(c)!=0);
+		}
+	}
+	{
+		int buffer[]={  2, 63, 128, 254, '\n', -1};
+		for(i=0; buffer[i]!=-1; i++) {
+			c = buffer[i];
+			TEST( isalpha(c)==0);
+		}
+	}
+
+
+
+#ifdef __UCLIBC_SUSV4_LEGACY__
+	/* isascii() */
+	{
+		int buffer[]={ 'a', 'z', 'A', 'Z', '\n', -1};
+		for(i=0; buffer[i]!=-1; i++) {
+			c = buffer[i];
+			TEST( isascii(c)!=0);
+		}
+	}
+	{
+		int buffer[]={  128, 254, -1};
+		for(i=0; buffer[i]!=-1; i++) {
+			c = buffer[i];
+			TEST( isascii(c)==0);
+		}
+	}
+#endif
+
+
+	/* iscntrl() */
+	{
+		int buffer[]={ 0x7F, 6, '\t', '\n', 0x7F, -1};
+		for(i=0; buffer[i]!=-1; i++) {
+			c = buffer[i];
+			TEST( iscntrl(c)!=0);
+		}
+	}
+	{
+		int buffer[]={  63, 128, 254, -1};
+		for(i=0; buffer[i]!=-1; i++) {
+			c = buffer[i];
+			TEST( iscntrl(c)==0);
+		}
+	}
+
+
+	/* isdigit() */
+	{
+		int buffer[]={ '1', '5', '7', '9', -1};
+		for(i=0; buffer[i]!=-1; i++) {
+			c = buffer[i];
+			TEST( isdigit(c)!=0);
+		}
+	}
+	{
+		int buffer[]={  2, 'a', 'z', 'A', 'Z', 63, 128, 254, '\n', -1};
+		for(i=0; buffer[i]!=-1; i++) {
+			c = buffer[i];
+			TEST( isdigit(c)==0);
+		}
+	}
+
+
+
+	/* isgraph() */
+	{
+		int buffer[]={ ')', '~', '9', -1};
+		for(i=0; buffer[i]!=-1; i++) {
+			c = buffer[i];
+			TEST( isgraph(c)!=0);
+		}
+	}
+	{
+		int buffer[]={ 9, ' ', '\t', '\n', 200, 0x7F, -1};
+		for(i=0; buffer[i]!=-1; i++) {
+			c = buffer[i];
+			TEST( isgraph(c)==0);
+		}
+	}
+
+
+	/* islower() */
+	{
+		int buffer[]={ 'a', 'g', 'z', -1};
+		for(i=0; buffer[i]!=-1; i++) {
+			c = buffer[i];
+			TEST( islower(c)!=0);
+		}
+	}
+	{
+		int buffer[]={ 9, 'A', 'Z', 128, 254, ' ', '\t', '\n', 0x7F, -1};
+		for(i=0; buffer[i]!=-1; i++) {
+			c = buffer[i];
+			TEST( islower(c)==0);
+		}
+	}
+
+
+	/* isprint() */
+	{
+		int buffer[]={ ' ', ')', '~', '9', -1};
+		for(i=0; buffer[i]!=-1; i++) {
+			c = buffer[i];
+			TEST( isprint(c)!=0);
+		}
+	}
+	{
+		int buffer[]={ '\b', '\t', '\n', 9, 128, 254, 200, 0x7F, -1};
+		for(i=0; buffer[i]!=-1; i++) {
+			c = buffer[i];
+			TEST( isprint(c)==0);
+		}
+	}
+
+
+	/* ispunct() */
+	{
+		int buffer[]={ '.', '#', '@', ';', -1};
+		for(i=0; buffer[i]!=-1; i++) {
+			c = buffer[i];
+			TEST( ispunct(c)!=0);
+		}
+	}
+	{
+		int buffer[]={  2, 'a', 'Z', '1', 128, 254, '\n', -1};
+		for(i=0; buffer[i]!=-1; i++) {
+			c = buffer[i];
+			TEST( ispunct(c)==0);
+		}
+	}
+
+
+	/* isspace() */
+	{
+		int buffer[]={ ' ', '\t', '\r', '\v', '\n', -1};
+		for(i=0; buffer[i]!=-1; i++) {
+			c = buffer[i];
+			TEST( isspace(c)!=0);
+		}
+	}
+	{
+		int buffer[]={  2, 'a', 'Z', '1', 128, 254, -1};
+		for(i=0; buffer[i]!=-1; i++) {
+			c = buffer[i];
+			TEST( isspace(c)==0);
+		}
+	}
+
+
+	/* isupper() */
+	{
+		int buffer[]={ 'A', 'G', 'Z', -1};
+		for(i=0; buffer[i]!=-1; i++) {
+			c = buffer[i];
+			TEST( isupper(c)!=0);
+		}
+	}
+	{
+		int buffer[]={  2, 'a', 'z', '1', 128, 254, -1};
+		for(i=0; buffer[i]!=-1; i++) {
+			c = buffer[i];
+			TEST( isupper(c)==0);
+		}
+	}
+
+
+
+	/* isxdigit() */
+	{
+		int buffer[]={ 'f', 'A', '1', '8', -1};
+		for(i=0; buffer[i]!=-1; i++) {
+			c = buffer[i];
+			TEST( isxdigit(c)!=0);
+		}
+	}
+	{
+		int buffer[]={  2, 'g', 'G', 'x', '\n', -1};
+		for(i=0; buffer[i]!=-1; i++) {
+			c = buffer[i];
+			TEST( isxdigit(c)==0);
+		}
+	}
+
+
+	/* tolower() */
+	c='A';
+	TEST_NUMERIC( tolower(c), 'a');
+	c='a';
+	TEST_NUMERIC( tolower(c), 'a');
+	c='#';
+	TEST_NUMERIC( tolower(c), c);
+
+	/* toupper() */
+	c='a';
+	TEST_NUMERIC( toupper(c), 'A');
+	c='A';
+	TEST_NUMERIC( toupper(c), 'A');
+	c='#';
+	TEST_NUMERIC( toupper(c), c);
+
+	exit(0);
+}
diff --git a/ap/build/uClibc/test/dlopen/Makefile b/ap/build/uClibc/test/dlopen/Makefile
new file mode 100644
index 0000000..92d14b9
--- /dev/null
+++ b/ap/build/uClibc/test/dlopen/Makefile
@@ -0,0 +1,12 @@
+# uClibc dlopen tests
+# Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
+
+top_builddir=../../
+include ../Rules.mak
+-include Makefile.in
+ifneq ($(HAVE_SHARED),y)
+TESTS_DISABLED := test3
+LDFLAGS_libtest.so := -lpthread
+endif
+
+include ../Test.mak
diff --git a/ap/build/uClibc/test/dlopen/Makefile.in b/ap/build/uClibc/test/dlopen/Makefile.in
new file mode 100644
index 0000000..22190d9
--- /dev/null
+++ b/ap/build/uClibc/test/dlopen/Makefile.in
@@ -0,0 +1,39 @@
+# uClibc dlopen tests
+# Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
+
+# rules need a little love to work with glibc ...
+export UCLIBC_ONLY := 1
+
+TESTS := dltest dltest2 dlstatic test1 test2 test3 dlundef dlafk dladdr
+
+CFLAGS_dltest    := -DLIBNAME="\"./libtest.so\""
+CFLAGS_dltest2   := -DLIBNAME="\"./libtest3.so\""
+
+LDFLAGS_dlstatic := -ldl
+LDFLAGS_dltest   := -ldl
+LDFLAGS_dltest2  := -ldl
+LDFLAGS_dlundef  := -ldl
+LDFLAGS_dlafk    := -ldl ./libafk.so -Wl,-rpath,.
+LDFLAGS_test1    := -ldl
+LDFLAGS_test2    := -ldl
+LDFLAGS_test3    := -ldl ./libtest1.so ./libtest2.so -Wl,-rpath,.
+LDFLAGS_dladdr   := -ldl
+
+DEBUG_LIBS := X
+WRAPPER := env $(DEBUG_LIBS)=all LD_LIBRARY_PATH="$$PWD:.:$(LD_LIBRARY_PATH)"
+
+dltest: libtest.so
+dltest2: libtest3.so
+dlstatic: libstatic.so
+dlundef: libundef.so
+dlafk: libafk.so
+libafk.so: libafk-temp.so
+LDFLAGS_libafk.so := ./libafk-temp.so -Wl,-rpath,.
+test1: libtest1.so
+test2: libtest1.so libtest2.so
+test3: libtest1.so libtest2.so
+libtest1.so: libtest2.so
+LDFLAGS_libtest.so := -lpthread
+LDFLAGS_libtest1.so := ./libtest2.so -Wl,-rpath,.
+LDFLAGS_libtest2.so := -Wl,-rpath,.
+LDFLAGS_libtest3.so := -lpthread -Wl,-rpath,.
diff --git a/ap/build/uClibc/test/dlopen/dladdr.c b/ap/build/uClibc/test/dlopen/dladdr.c
new file mode 100644
index 0000000..b64c000
--- /dev/null
+++ b/ap/build/uClibc/test/dlopen/dladdr.c
@@ -0,0 +1,25 @@
+#include <dlfcn.h>
+#include <stdlib.h>
+#include <stdio.h>
+#include <string.h>
+
+int main(int argc, char **argv)
+{
+	Dl_info info;
+	int res = 0;
+
+	memset(&info, '\0', sizeof(Dl_info));
+	res = dladdr((void *)1, &info);
+	if (res != 0) {
+		fprintf(stderr, "dladdr() should fail\n");
+		fprintf(stderr, "dli_fname = %s\n", info.dli_fname);
+		fprintf(stderr, "dli_fbase = 0x%08x\n", (unsigned int)info.dli_fbase);
+		fprintf(stderr, "dli_sname = %s\n", info.dli_sname);
+		fprintf(stderr, "dli_saddr = 0x%08x\n", (unsigned int)info.dli_saddr);
+		exit(1);
+        }
+
+	fprintf(stderr, "dladdr() failed as expected\n");
+	return EXIT_SUCCESS;
+}
+
diff --git a/ap/build/uClibc/test/dlopen/dlafk.c b/ap/build/uClibc/test/dlopen/dlafk.c
new file mode 100644
index 0000000..2eac4af
--- /dev/null
+++ b/ap/build/uClibc/test/dlopen/dlafk.c
@@ -0,0 +1,36 @@
+#include <fcntl.h>
+#include <stdlib.h>
+#include <stdio.h>
+#include <dlfcn.h>
+#include <stdint.h>
+#include <unistd.h>
+#include <errno.h>
+#include <string.h>
+
+#define LIBNAME "libafk.so"
+
+#define LIBAFK "libafk-temp.so"
+#define LIBAFK_BAK ".libafk-temp.so.temp"
+
+int main(int argc, char **argv)
+{
+	void *handle;
+
+	if (rename(LIBAFK, LIBAFK_BAK)) {
+		fprintf(stderr, "Unable to rename %s: %s\n", LIBAFK, strerror(errno));
+		return EXIT_FAILURE;
+	}
+
+	handle = dlopen(LIBNAME, RTLD_NOW);
+	if (!handle) {
+		fprintf(stderr, "Could not open ./%s: %s\n", LIBNAME, dlerror());
+		return EXIT_FAILURE;
+	}
+
+	if (rename(LIBAFK_BAK, LIBAFK)) {
+		fprintf(stderr, "Unable to rename %s: %s\n", LIBAFK_BAK, strerror(errno));
+		return EXIT_FAILURE;
+	}
+
+	return EXIT_SUCCESS;
+}
diff --git a/ap/build/uClibc/test/dlopen/dlstatic.c b/ap/build/uClibc/test/dlopen/dlstatic.c
new file mode 100644
index 0000000..57c8c5d
--- /dev/null
+++ b/ap/build/uClibc/test/dlopen/dlstatic.c
@@ -0,0 +1,43 @@
+#include <fcntl.h>
+#include <stdlib.h>
+#include <stdio.h>
+#include <dlfcn.h>
+#include <stdint.h>
+
+#define LIBNAME "libstatic.so"
+
+int load_and_test(void)
+{
+	void *handle;
+	int (*mystatic)(void);
+
+	handle = dlopen(LIBNAME, RTLD_LAZY);
+	if (!handle) {
+		fprintf(stderr, "Could not open ./%s: %s\n", LIBNAME, dlerror());
+		return 1;
+	}
+
+	mystatic = dlsym(handle, "static_test");
+	if (mystatic == NULL) {
+		fprintf(stderr, "Could not locate symbol 'static_test': %s\n", dlerror());
+		return 1;
+	}
+
+	if (!mystatic()) {
+		fprintf(stderr, "mystatic() failed: static vars were not setup properly\n");
+		return 1;
+	}
+
+	dlclose(handle);
+
+	return 0;
+}
+
+int main(int argc, char **argv)
+{
+	int count = 5;
+	while (count-- > 0)
+		if (load_and_test())
+			return EXIT_FAILURE;
+	return EXIT_SUCCESS;
+}
diff --git a/ap/build/uClibc/test/dlopen/dltest.c b/ap/build/uClibc/test/dlopen/dltest.c
new file mode 100644
index 0000000..b5fa1cd
--- /dev/null
+++ b/ap/build/uClibc/test/dlopen/dltest.c
@@ -0,0 +1,41 @@
+#include <fcntl.h>
+#include <stdlib.h>
+#include <stdio.h>
+#include <dlfcn.h>
+#include <stdint.h>
+
+int main(int argc, char **argv)
+{
+	int ret = EXIT_SUCCESS;
+	void *handle;
+	void (*mydltest)(void *value1, void *value2);
+	char *error;
+	uint32_t *value1, *value2;
+
+	handle = dlopen (LIBNAME, RTLD_LAZY);
+	if (!handle) {
+		fprintf(stderr, "Could not open ./%s: %s\n", LIBNAME, dlerror());
+		exit(1);
+	}
+
+	mydltest = dlsym(handle, "dltest");
+	if ((error = dlerror()) != NULL)  {
+		fprintf(stderr, "Could not locate symbol 'dltest': %s\n", error);
+		exit(1);
+	}
+
+	mydltest(&value1, &value2);
+	printf("dltest: pthread_once=%p\n", value1);
+	printf("dltest: pthread_self=%p\n", value2);
+	if (value1 == value2) {
+	    ret = EXIT_FAILURE;
+	    printf("dltest: values should NOT be equal  Weak values resolved incorrectly!\n");
+	} else {
+	    printf("dltest: weak symbols resoved correctly.\n");
+	}
+
+	dlclose(handle);
+
+	return ret;
+}
+
diff --git a/ap/build/uClibc/test/dlopen/dltest2.c b/ap/build/uClibc/test/dlopen/dltest2.c
new file mode 100644
index 0000000..127b3b5
--- /dev/null
+++ b/ap/build/uClibc/test/dlopen/dltest2.c
@@ -0,0 +1 @@
+#include "dltest.c"
diff --git a/ap/build/uClibc/test/dlopen/dlundef.c b/ap/build/uClibc/test/dlopen/dlundef.c
new file mode 100644
index 0000000..cefd933
--- /dev/null
+++ b/ap/build/uClibc/test/dlopen/dlundef.c
@@ -0,0 +1,29 @@
+#include <fcntl.h>
+#include <stdlib.h>
+#include <stdio.h>
+#include <dlfcn.h>
+#include <stdint.h>
+
+#define LIBNAME "libundef.so"
+
+int main(int argc, char **argv)
+{
+	void *handle;
+	int (*myundefined)(void);
+
+	handle = dlopen(LIBNAME, RTLD_LAZY);
+	if (!handle) {
+		fprintf(stderr, "Could not open ./%s: %s\n", LIBNAME, dlerror());
+		return EXIT_FAILURE;
+	}
+
+	myundefined = dlsym(handle, "__booga_booga_you_cant_touch_this__");
+	if (myundefined != NULL) {
+		fprintf(stderr, "dlsym() found a symbol that does not exist!\n");
+		return EXIT_FAILURE;
+	}
+
+	dlclose(handle);
+
+	return EXIT_SUCCESS;
+}
diff --git a/ap/build/uClibc/test/dlopen/libafk-temp.c b/ap/build/uClibc/test/dlopen/libafk-temp.c
new file mode 100644
index 0000000..39b58df
--- /dev/null
+++ b/ap/build/uClibc/test/dlopen/libafk-temp.c
@@ -0,0 +1 @@
+/* the actual contents doesnt matter */
diff --git a/ap/build/uClibc/test/dlopen/libafk.c b/ap/build/uClibc/test/dlopen/libafk.c
new file mode 100644
index 0000000..39b58df
--- /dev/null
+++ b/ap/build/uClibc/test/dlopen/libafk.c
@@ -0,0 +1 @@
+/* the actual contents doesnt matter */
diff --git a/ap/build/uClibc/test/dlopen/libstatic.c b/ap/build/uClibc/test/dlopen/libstatic.c
new file mode 100644
index 0000000..bf44c3c
--- /dev/null
+++ b/ap/build/uClibc/test/dlopen/libstatic.c
@@ -0,0 +1,15 @@
+#include <stdio.h>
+
+static int global_static = -1;
+
+int static_test(void)
+{
+	static int local_static = -2;
+
+	if (global_static != -1)
+		printf("FAIL: global_static is not -1\n");
+	if (local_static != -2)
+		printf("FAIL: local_static is not -2\n");
+
+	return (global_static == -1 && local_static == -2);
+}
diff --git a/ap/build/uClibc/test/dlopen/libtest.c b/ap/build/uClibc/test/dlopen/libtest.c
new file mode 100644
index 0000000..3fd137f
--- /dev/null
+++ b/ap/build/uClibc/test/dlopen/libtest.c
@@ -0,0 +1,11 @@
+#include <stdio.h>
+#include <pthread.h>
+#include <stdint.h>
+
+void dltest(uint32_t **value1, uint32_t **value2);
+void dltest(uint32_t **value1, uint32_t **value2)
+{
+	*value1 = (uint32_t *) pthread_once;
+	*value2 = (uint32_t *) pthread_self;
+}
+
diff --git a/ap/build/uClibc/test/dlopen/libtest1.c b/ap/build/uClibc/test/dlopen/libtest1.c
new file mode 100644
index 0000000..a2f7dcd
--- /dev/null
+++ b/ap/build/uClibc/test/dlopen/libtest1.c
@@ -0,0 +1,40 @@
+#include <stdio.h>
+
+extern int libtest2_func(const char *s);
+
+void __attribute__((constructor)) libtest1_ctor(void);
+void libtest1_ctor(void)
+{
+    printf("libtest1: constructor!\n");
+}
+
+void __attribute__((destructor)) libtest1_dtor(void);
+void libtest1_dtor(void)
+{
+    printf("libtest1: destructor!\n");
+}
+
+void __attribute__((weak)) function1(void);
+void function1(void)
+{
+    printf("libtest1: I am weak function1!\n");
+}
+
+void function2(void);
+void function2(void)
+{
+    printf("libtest1: I am function2!\n");
+}
+
+int dltest(const char *s);
+int dltest(const char *s)
+{
+    printf( "libtest1: function1 = %p\n"
+	    "libtest1: function2 = %p\n",
+	    function1, function2);
+    function1();
+    function2();
+    return(libtest2_func(s));
+}
+
+
diff --git a/ap/build/uClibc/test/dlopen/libtest2.c b/ap/build/uClibc/test/dlopen/libtest2.c
new file mode 100644
index 0000000..5261506
--- /dev/null
+++ b/ap/build/uClibc/test/dlopen/libtest2.c
@@ -0,0 +1,38 @@
+#include <stdio.h>
+#include <pthread.h>
+
+void __attribute__((constructor)) libtest2_ctor(void);
+void libtest2_ctor(void)
+{
+    printf("libtest2: constructor!\n");
+}
+
+void __attribute__((destructor)) libtest2_dtor(void);
+void libtest2_dtor(void)
+{
+    printf("libtest2: destructor!\n");
+}
+
+void function1(void);
+void function1(void)
+{
+    printf("libtest2: I am function1!\n");
+}
+
+void __attribute__((weak)) function2(void);
+void function2(void)
+{
+    printf("libtest2: I am weak function2!\n");
+}
+
+
+int libtest2_func(const char *s);
+int libtest2_func(const char *s)
+{
+    printf( "libtest2: function1 = %p\n"
+	    "libtest2: function2 = %p\n",
+	    function1, function2);
+    function1();
+    function2();
+    return 0;
+}
diff --git a/ap/build/uClibc/test/dlopen/libtest3.c b/ap/build/uClibc/test/dlopen/libtest3.c
new file mode 100644
index 0000000..1d4bd7e
--- /dev/null
+++ b/ap/build/uClibc/test/dlopen/libtest3.c
@@ -0,0 +1 @@
+#include "libtest.c"
diff --git a/ap/build/uClibc/test/dlopen/libundef.c b/ap/build/uClibc/test/dlopen/libundef.c
new file mode 100644
index 0000000..39b58df
--- /dev/null
+++ b/ap/build/uClibc/test/dlopen/libundef.c
@@ -0,0 +1 @@
+/* the actual contents doesnt matter */
diff --git a/ap/build/uClibc/test/dlopen/test1.c b/ap/build/uClibc/test/dlopen/test1.c
new file mode 100644
index 0000000..c13eb30
--- /dev/null
+++ b/ap/build/uClibc/test/dlopen/test1.c
@@ -0,0 +1,33 @@
+#include <fcntl.h>
+#include <stdlib.h>
+#include <stdio.h>
+#include <dlfcn.h>
+
+#ifdef __UCLIBC__
+extern void _dlinfo(void);
+#endif
+
+int main(int argc, char **argv) {
+	void *handle;
+	int (*mydltest)(const char *s);
+	char *error;
+
+	handle = dlopen ("./libtest1.so", RTLD_LAZY);
+	if (!handle) {
+		fprintf(stderr, "Could not open ./libtest1.so: %s\n", dlerror());
+		exit(1);
+	}
+
+	mydltest = dlsym(handle, "dltest");
+	if ((error = dlerror()) != NULL)  {
+		fprintf(stderr, "Could not locate symbol 'dltest': %s\n", error);
+		exit(1);
+	}
+
+	mydltest("hello world!");
+
+	dlclose(handle);
+
+	return EXIT_SUCCESS;
+}
+
diff --git a/ap/build/uClibc/test/dlopen/test2.c b/ap/build/uClibc/test/dlopen/test2.c
new file mode 100644
index 0000000..d8428f7
--- /dev/null
+++ b/ap/build/uClibc/test/dlopen/test2.c
@@ -0,0 +1,39 @@
+#include <fcntl.h>
+#include <stdlib.h>
+#include <stdio.h>
+#include <dlfcn.h>
+
+#ifdef __UCLIBC__
+extern void _dlinfo(void);
+#endif
+
+int main(int argc, char **argv) {
+	void *handle;
+	int (*mydltest)(const char *s);
+	char *error;
+
+	handle = dlopen ("./libtest2.so", RTLD_LAZY);
+	if (!handle) {
+		fprintf(stderr, "Could not open ./libtest2.so: %s\n", dlerror());
+		exit(1);
+	}
+
+	handle = dlopen ("./libtest1.so", RTLD_LAZY);
+	if (!handle) {
+		fprintf(stderr, "Could not open ./libtest1.so: %s\n", dlerror());
+		exit(1);
+	}
+
+	mydltest = dlsym(handle, "dltest");
+	if ((error = dlerror()) != NULL)  {
+		fprintf(stderr, "Could not locate symbol 'dltest': %s\n", error);
+		exit(1);
+	}
+
+	mydltest("hello world!");
+
+	dlclose(handle);
+
+	return EXIT_SUCCESS;
+}
+
diff --git a/ap/build/uClibc/test/dlopen/test3.c b/ap/build/uClibc/test/dlopen/test3.c
new file mode 100644
index 0000000..2f2dfc6
--- /dev/null
+++ b/ap/build/uClibc/test/dlopen/test3.c
@@ -0,0 +1,13 @@
+#include <fcntl.h>
+#include <stdlib.h>
+#include <stdio.h>
+#include <dlfcn.h>
+
+extern int dltest(const char *s);
+
+int main(int argc, char **argv)
+{
+	dltest("hello world!");
+	return EXIT_SUCCESS;
+}
+
diff --git a/ap/build/uClibc/test/inet/Makefile b/ap/build/uClibc/test/inet/Makefile
new file mode 100644
index 0000000..9605dca
--- /dev/null
+++ b/ap/build/uClibc/test/inet/Makefile
@@ -0,0 +1,7 @@
+# uClibc inet tests
+# Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
+
+top_builddir=../../
+include ../Rules.mak
+-include Makefile.in
+include ../Test.mak
diff --git a/ap/build/uClibc/test/inet/Makefile.in b/ap/build/uClibc/test/inet/Makefile.in
new file mode 100644
index 0000000..0710d3d
--- /dev/null
+++ b/ap/build/uClibc/test/inet/Makefile.in
@@ -0,0 +1,11 @@
+# uClibc inet tests
+# Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
+#
+ifeq ($(UCLIBC_HAS_IPV4)$(UCLIBC_HAS_IPV6),)
+TESTS_DISABLED := bug-if1 gethost_r-align gethostid if_nameindex tst-aton \
+	tst-network tst-ntoa
+endif
+
+ifeq ($(UCLIBC_HAS_SOCKET)$(UCLIBC_HAS_IPV4)$(UCLIBC_HAS_IPV6),)
+TESTS_DISABLED := tst-ether_aton tst-ethers tst-ethers-line
+endif
diff --git a/ap/build/uClibc/test/inet/bug-if1.c b/ap/build/uClibc/test/inet/bug-if1.c
new file mode 100644
index 0000000..6bcd175
--- /dev/null
+++ b/ap/build/uClibc/test/inet/bug-if1.c
@@ -0,0 +1,54 @@
+/* Copyright (C) 2004 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+   Contributed by Ulrich Drepper <drepper@redhat.com>, 2004.
+
+   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 <errno.h>
+#include <limits.h>
+#include <stdio.h>
+#include <string.h>
+#include <net/if.h>
+
+
+static int
+do_test (void)
+{
+  char buf[IF_NAMESIZE];
+  /* Index 0 is always invalid (see RFC 3493).  */
+  char *cp = if_indextoname (0, buf);
+  if (cp != NULL)
+    {
+      printf ("invalid index returned result \"%s\"\n", cp);
+      return 1;
+    }
+  else if (errno != ENXIO)
+    {
+      int err = errno;
+      char errbuf1[256];
+      char errbuf2[256];
+
+      printf ("errno = %d (%s), expected %d (%s)\n",
+	      err, strerror_r (err, errbuf1, sizeof (errbuf1)),
+	      ENXIO, strerror_r (ENXIO, errbuf2, sizeof (errbuf2)));
+      return 1;
+    }
+
+  return 0;
+}
+
+#define TEST_FUNCTION do_test ()
+#include "../test-skeleton.c"
diff --git a/ap/build/uClibc/test/inet/gethost_r-align.c b/ap/build/uClibc/test/inet/gethost_r-align.c
new file mode 100644
index 0000000..53ce93a
--- /dev/null
+++ b/ap/build/uClibc/test/inet/gethost_r-align.c
@@ -0,0 +1,50 @@
+/* Since the reentrant gethost functions take a char * buffer,
+ * we have to make sure they internally do not assume alignment.
+ * The actual return values are not relevant.  If the test fails,
+ * it'll be due to an alignment exception which means the test
+ * app is killed by the kernel.
+ */
+
+#include <errno.h>
+#include <netdb.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <arpa/inet.h>
+#include <sys/socket.h>
+
+int main(int argc, char *argv[])
+{
+	size_t i;
+	char buf[1024];
+	in_addr_t addr;
+
+	addr = inet_addr("127.0.0.1");
+
+	for (i = 0; i < sizeof(size_t) * 2; ++i) {
+		struct hostent hent, *hentres;
+		int ret, herr;
+
+		printf("Testing misalignment of %2zi bytes: ", i);
+
+		memset(&hent, 0x00, sizeof(hent));
+		ret = gethostent_r(&hent, buf + i, sizeof(buf) - i, &hentres, &herr);
+		printf("%sgethostent_r() ", (ret ? "!!!" : ""));
+
+		memset(&hent, 0x00, sizeof(hent));
+		ret = gethostbyname_r("localhost", &hent, buf + i, sizeof(buf) - i, &hentres, &herr);
+		printf("%sgethostbyname_r() ", (ret ? "!!!" : ""));
+
+		memset(&hent, 0x00, sizeof(hent));
+		ret = gethostbyname2_r("localhost", AF_INET, &hent, buf + i, sizeof(buf) - i, &hentres, &herr);
+		printf("%sgethostbyname2_r() ", (ret ? "!!!" : ""));
+
+		memset(&hent, 0x00, sizeof(hent));
+		ret = gethostbyaddr_r(&addr, sizeof(addr), AF_INET, &hent, buf + i, sizeof(buf) - i, &hentres, &herr);
+		printf("%sgethostbyaddr_r() ", (ret ? "!!!" : ""));
+
+		puts("OK!");
+	}
+
+	return 0;
+}
diff --git a/ap/build/uClibc/test/inet/gethostid.c b/ap/build/uClibc/test/inet/gethostid.c
new file mode 100644
index 0000000..2951665
--- /dev/null
+++ b/ap/build/uClibc/test/inet/gethostid.c
@@ -0,0 +1,6 @@
+#include <unistd.h>
+#include <stdio.h>
+int main(void) {
+	printf("hostid=%d\n", gethostid());
+	return 0;
+}
diff --git a/ap/build/uClibc/test/inet/getnetent.c b/ap/build/uClibc/test/inet/getnetent.c
new file mode 100644
index 0000000..6607cea
--- /dev/null
+++ b/ap/build/uClibc/test/inet/getnetent.c
@@ -0,0 +1,17 @@
+#include <stdio.h>
+#include <netdb.h>
+int main(void)
+{
+	struct netent *net;
+	setnetent(0);
+	while ((net = getnetent())) {
+		while (net->n_net && !((net->n_net >> 24) & 0xff)) {
+			net->n_net <<= 8;
+		}
+		printf("%lu.%lu.%lu.%lu\n",
+			   (net->n_net >> 24) & 0xff, (net->n_net >> 16) & 0xff,
+			   (net->n_net >> 8) & 0xff, net->n_net & 0xff);
+	}
+	endnetent();
+	return 0;
+}
diff --git a/ap/build/uClibc/test/inet/if_nameindex.c b/ap/build/uClibc/test/inet/if_nameindex.c
new file mode 100644
index 0000000..126c5ba
--- /dev/null
+++ b/ap/build/uClibc/test/inet/if_nameindex.c
@@ -0,0 +1,61 @@
+/* if_nameindex.c: test the if_nameindex() function
+ *
+ * Copyright (C) 2006 Erik Andersen <andersen@uclibc.org>
+ *
+ * Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
+ */
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <net/if.h>
+
+static char ifname[IF_NAMESIZE];
+
+static void test_if_nameindex(void)
+{
+	size_t i;
+	struct if_nameindex *ret;
+
+	ret = if_nameindex();
+
+	if (ret == NULL) {
+		perror("if_nameindex()");
+		exit(1);
+	}
+
+	printf("--- if_nameindex()\n");
+	for (i=0; ret[i].if_name; ++i)
+		printf("%i: %s\n", ret[i].if_index, ret[i].if_name);
+
+	if_freenameindex(ret);
+}
+
+static void test_if_indextoname(void)
+{
+	if (if_indextoname(1, ifname) == NULL) {
+		perror("if_nameindex()");
+		exit(1);
+	}
+
+	printf("if_indextoname(1) = %s\n", ifname);
+}
+
+static void test_if_nametoindex(void)
+{
+	int ifindex = if_nametoindex(ifname);
+
+	if (ifindex == 0) {
+		perror("if_nametoindex()");
+		exit(1);
+	}
+
+	printf("if_nametoindex(%s) = %i\n", ifname, ifindex);
+}
+
+int main(void)
+{
+	test_if_nameindex();
+	test_if_indextoname();
+	test_if_nametoindex();
+	return 0;
+}
diff --git a/ap/build/uClibc/test/inet/tst-aton.c b/ap/build/uClibc/test/inet/tst-aton.c
new file mode 100644
index 0000000..3e945f1
--- /dev/null
+++ b/ap/build/uClibc/test/inet/tst-aton.c
@@ -0,0 +1,80 @@
+#include <stdio.h>
+#include <sys/socket.h>
+#include <netinet/in.h>
+#include <arpa/inet.h>
+
+/* Note: uClibc only supports the standard notation 'a.b.c.d' */
+
+static struct tests
+{
+  const char *input;
+  int valid;
+  uint32_t result;
+} tests[] =
+{
+  { "", 0, 0 },
+  { "-1", 0, 0 },
+/*
+  { "256", 1, 0x00000100 },
+*/
+  { "256.", 0, 0 },
+  { "256a", 0, 0 },
+/*
+  { "0x100", 1, 0x00000100 },
+  { "0200.0x123456", 1, 0x80123456 },
+  { "0300.0x89123456.", 0 ,0 },
+  { "0100.-0xffff0000", 0, 0 },
+  { "0.0xffffff", 1, 0x00ffffff },
+  { "0.0x1000000", 0, 0 },
+  { "0377.16777215", 1, 0xffffffff },
+  { "0377.16777216", 0, 0 },
+  { "0x87.077777777", 1, 0x87ffffff },
+  { "0x87.0100000000", 0, 0 },
+  { "0.1.3", 1, 0x00010003 },
+*/
+  { "0.256.3", 0, 0 },
+  { "256.1.3", 0, 0 },
+/*
+  { "0.1.0x10000", 0, 0 },
+  { "0.1.0xffff", 1, 0x0001ffff },
+*/
+  { "0.1a.3", 0, 0 },
+  { "0.1.a3", 0, 0 },
+  { "1.2.3.4", 1, 0x01020304 },
+  { "0400.2.3.4", 0, 0 },
+  { "1.0x100.3.4", 0, 0 },
+  { "1.2.256.4", 0, 0 },
+  { "1.2.3.0x100", 0, 0 },
+  { "323543357756889", 0, 0 },
+  { "10.1.2.3.4", 0, 0},
+};
+
+
+int
+main (int argc, char *argv[])
+{
+  int result = 0;
+  size_t cnt;
+
+  for (cnt = 0; cnt < sizeof (tests) / sizeof (tests[0]); ++cnt)
+    {
+      struct in_addr addr;
+
+      if ((int) inet_aton (tests[cnt].input, &addr) != tests[cnt].valid)
+	{
+	  if (tests[cnt].valid)
+	    printf ("\"%s\" not seen as valid IP address\n", tests[cnt].input);
+	  else
+	    printf ("\"%s\" seen as valid IP address\n", tests[cnt].input);
+	  result = 1;
+	}
+      else if (tests[cnt].valid && addr.s_addr != ntohl (tests[cnt].result))
+	{
+	  printf ("\"%s\" not converted correctly: is %08x, should be %08x\n",
+		  tests[cnt].input, addr.s_addr, tests[cnt].result);
+	  result = 1;
+	}
+    }
+
+  return result;
+}
diff --git a/ap/build/uClibc/test/inet/tst-ether_aton.c b/ap/build/uClibc/test/inet/tst-ether_aton.c
new file mode 100644
index 0000000..67cb435
--- /dev/null
+++ b/ap/build/uClibc/test/inet/tst-ether_aton.c
@@ -0,0 +1,46 @@
+#include <stdio.h>
+#include <stdint.h>
+#include <string.h>
+#include <netinet/ether.h>
+
+static struct tests
+{
+  const char *input;
+  int valid;
+  uint8_t result[6];
+} tests[] =
+{
+  { "", 0, {0, 0, 0, 0, 0, 0} },
+  { "AB:CD:EF:01:23:45", 1, {171, 205, 239, 1, 35, 69} },
+  { "\022B:BB:BB:BB:BB:BB", 0, {0, 0, 0, 0, 0, 0} }
+};
+
+
+int
+main (int argc, char *argv[])
+{
+  int result = 0;
+  size_t cnt;
+
+  for (cnt = 0; cnt < sizeof (tests) / sizeof (tests[0]); ++cnt)
+    {
+      struct ether_addr *addr;
+
+      if (!!(addr = ether_aton (tests[cnt].input)) != tests[cnt].valid)
+      {
+        if (tests[cnt].valid)
+          printf ("\"%s\" not seen as valid MAC address\n", tests[cnt].input);
+        else
+          printf ("\"%s\" seen as valid MAC address\n", tests[cnt].input);
+        result = 1;
+      }
+      else if (tests[cnt].valid
+               && memcmp(addr, &tests[cnt].result, sizeof(struct ether_addr)))
+      {
+        printf ("\"%s\" not converted correctly\n", tests[cnt].input);
+        result = 1;
+      }
+    }
+
+  return result;
+}
diff --git a/ap/build/uClibc/test/inet/tst-ethers-line.c b/ap/build/uClibc/test/inet/tst-ethers-line.c
new file mode 100644
index 0000000..19cf2fb
--- /dev/null
+++ b/ap/build/uClibc/test/inet/tst-ethers-line.c
@@ -0,0 +1,54 @@
+#include <netinet/ether.h>
+#include <stdio.h>
+#include <sys/mman.h>
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <fcntl.h>
+#include <stdlib.h>
+
+/* glibc 2.4 has no ETHER_FILE_NAME, host compile fails without this */
+#ifndef ETHER_FILE_NAME
+#define ETHER_FILE_NAME "/etc/ethers"
+#endif
+
+#define ETHER_LINE_LEN 256
+
+/* This test requires /etc/ethers to exist
+ * and to have nonzero length
+ */
+
+int main(void)
+{
+	struct ether_addr addr;
+	char hostname[ETHER_LINE_LEN];
+	int fd, i;
+	const char *ethers;
+	struct stat statb;
+
+	if ((fd = open(ETHER_FILE_NAME, O_RDONLY)) == -1) {
+		perror ("Cannot open file");
+		exit(1);
+	}
+
+	if (fstat(fd, &statb)) {
+		perror("Stat failed");
+		exit(1);
+	}
+	ethers = mmap(NULL, statb.st_size, PROT_READ, MAP_SHARED, fd, 0);
+
+	if (ethers == MAP_FAILED) {
+		perror("File mapping failed");
+		exit(1);
+	}
+
+	ether_line(ethers, &addr, hostname);
+
+	for (i = 0; i < 6; i++) {
+		printf("%02x", addr.ether_addr_octet[i]);
+		if (i < 5)
+			printf(":");
+	}
+	printf(" %s\n", hostname);
+
+	return 0;
+}
diff --git a/ap/build/uClibc/test/inet/tst-ethers.c b/ap/build/uClibc/test/inet/tst-ethers.c
new file mode 100644
index 0000000..6b6e10c
--- /dev/null
+++ b/ap/build/uClibc/test/inet/tst-ethers.c
@@ -0,0 +1,33 @@
+#include <netinet/ether.h>
+#include <stdio.h>
+
+#define ETHER_LINE_LEN 256
+
+/* This test requires /etc/ethers to exist
+ * and to have host "teeth". For example:
+ * 00:11:22:33:44:55 teeth
+ */
+
+int main(void)
+{
+	struct ether_addr addr;
+	char host[ETHER_LINE_LEN];
+	int i;
+	int res = ether_hostton("teeth", &addr);
+
+	if (res)
+		return 1;
+
+	for (i = 0; i < 6; i++) {
+		printf("%02x", addr.ether_addr_octet[i]);
+		if (i < 5)
+			printf(":");
+	}
+
+	res = ether_ntohost(host, &addr);
+	if (res)
+		return 1;
+	printf(" %s\n", host);
+
+	return 0;
+}
diff --git a/ap/build/uClibc/test/inet/tst-network.c b/ap/build/uClibc/test/inet/tst-network.c
new file mode 100644
index 0000000..2598637
--- /dev/null
+++ b/ap/build/uClibc/test/inet/tst-network.c
@@ -0,0 +1,105 @@
+/* Test for inet_network.
+   Copyright (C) 2000, 2002 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+   Contributed by Andreas Jaeger <aj@suse.de>, 2000.
+
+   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 <stdio.h>
+#include <sys/socket.h>
+#include <netinet/in.h>
+#include <arpa/inet.h>
+
+struct
+{
+  const char *network;
+  uint32_t number;
+} tests [] =
+{
+  {"1.0.0.0", 0x1000000},
+  {"1.0.0", 0x10000},
+  {"1.0", 0x100},
+  {"1", 0x1},
+  {"192.168.0.0", 0xC0A80000},
+  /* Now some invalid addresses.  */
+  {"141.30.225.2800", INADDR_NONE},
+  {"141.76.1.1.1", INADDR_NONE},
+  {"141.76.1.11.", INADDR_NONE},
+  {"1410", INADDR_NONE},
+  {"1.1410", INADDR_NONE},
+  {"1.1410.", INADDR_NONE},
+  {"1.1410", INADDR_NONE},
+  {"141.76.1111", INADDR_NONE},
+  {"141.76.1111.", INADDR_NONE},
+  {"1.1.1.257", INADDR_NONE},
+  /* Now some from BSD */
+  {"0x12", 0x00000012},
+  {"127.1", 0x00007f01},
+  {"127.1.2.3", 0x7f010203},
+  {"0x123456", INADDR_NONE},
+  {"0x12.0x34", 0x00001234},
+  {"0x12.0x345", INADDR_NONE},
+  {"1.2.3.4.5", INADDR_NONE},
+  {"1..3.4", INADDR_NONE},
+  {".", INADDR_NONE},
+  {"1.", INADDR_NONE},
+  {".1", INADDR_NONE},
+  {"x", INADDR_NONE},
+  {"0x", INADDR_NONE},
+  {"0", 0x00000000},
+  {"0x0", 0x00000000},
+  {"01.02.07.077", 0x0102073f},
+  {"0x1.23.045.0", 0x01172500},
+  {"", INADDR_NONE},
+  {" ", INADDR_NONE},
+  {"bar", INADDR_NONE},
+  {"1.2bar", INADDR_NONE},
+  {"1.", INADDR_NONE},
+  {"ÊÃÕËÅÎ", INADDR_NONE},
+  {"255.255.255.255", INADDR_NONE},
+  {"x", INADDR_NONE},
+  {"0X12", 0x00000012},
+  {"078", INADDR_NONE},
+  {"1 bar", INADDR_NONE},
+  {"127.0xfff", INADDR_NONE},
+};
+
+
+int
+main (void)
+{
+  int errors = 0;
+  size_t i;
+  uint32_t res;
+
+  for (i = 0; i < sizeof (tests) / sizeof (tests[0]); ++i)
+    {
+      printf ("Testing: %s\n", tests[i].network);
+      res = inet_network (tests[i].network);
+
+      if (res != tests[i].number)
+	{
+	  ++errors;
+	  printf ("Test failed for inet_network (\"%s\"):\n",
+		  tests[i].network);
+	  printf ("Expected return value %u (0x%x) but got %u (0x%x).\n",
+		  tests[i].number, tests[i].number, res, res);
+	}
+
+    }
+
+  return errors != 0;
+}
diff --git a/ap/build/uClibc/test/inet/tst-ntoa.c b/ap/build/uClibc/test/inet/tst-ntoa.c
new file mode 100644
index 0000000..9be91eb
--- /dev/null
+++ b/ap/build/uClibc/test/inet/tst-ntoa.c
@@ -0,0 +1,36 @@
+#include <stdio.h>
+#include <string.h>
+#include <arpa/inet.h>
+#include <netinet/in.h>
+
+
+static int
+test (unsigned int inaddr, const char *expected)
+{
+  struct in_addr addr;
+  char *res;
+  int fail;
+
+  addr.s_addr = htonl (inaddr);
+  res = inet_ntoa (addr);
+  fail = strcmp (res, expected);
+
+  printf ("%#010x -> \"%s\" -> %s%s\n", inaddr, res,
+	  fail ? "fail, expected" : "ok", fail ? expected : "");
+
+  return fail;
+}
+
+
+int
+main (void)
+{
+  int result = 0;
+
+  result |= test (INADDR_LOOPBACK, "127.0.0.1");
+  result |= test (INADDR_BROADCAST, "255.255.255.255");
+  result |= test (INADDR_ANY, "0.0.0.0");
+  result |= test (0xc0060746, "192.6.7.70");
+
+  return result;
+}
diff --git a/ap/build/uClibc/test/librt/Makefile b/ap/build/uClibc/test/librt/Makefile
new file mode 100644
index 0000000..354c681
--- /dev/null
+++ b/ap/build/uClibc/test/librt/Makefile
@@ -0,0 +1,7 @@
+# uClibc shm tests
+# Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
+
+top_builddir=../../
+include ../Rules.mak
+-include Makefile.in
+include ../Test.mak
diff --git a/ap/build/uClibc/test/librt/Makefile.in b/ap/build/uClibc/test/librt/Makefile.in
new file mode 100644
index 0000000..15ecbae
--- /dev/null
+++ b/ap/build/uClibc/test/librt/Makefile.in
@@ -0,0 +1,4 @@
+# uClibc shm tests
+# Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
+
+LDFLAGS_shmtest := -lrt
diff --git a/ap/build/uClibc/test/librt/shmtest.c b/ap/build/uClibc/test/librt/shmtest.c
new file mode 100644
index 0000000..a14302d
--- /dev/null
+++ b/ap/build/uClibc/test/librt/shmtest.c
@@ -0,0 +1,104 @@
+/* Copyright (C) 2009 Mikael Lund Jepsen <mlj@iccc.dk>
+ *
+ * Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
+ */
+
+#include <errno.h>
+#include <fcntl.h>
+#include <string.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <unistd.h>
+#include <sys/types.h>
+#include <sys/mman.h>
+#include <sys/stat.h>
+#include <sys/wait.h>
+
+#define ARRAY_SIZE(arr) (sizeof(arr) / sizeof((arr)[0]))
+
+char shared_name[] = "/sharetest";
+int test_data[11] = {0,1,2,3,4,5,6,7,8,9,10};
+
+int main(void) {
+	int pfds[2];
+	pid_t pid;
+	int fd;
+	int test_data_fails = 0;
+	char *ptest_data;
+	unsigned int i;
+	char buf[30];
+	int rv;
+
+	pipe(pfds);
+
+	switch(pid = fork()) {
+	case -1:
+		perror("fork");
+		exit(1);	/* parent exits */
+
+	case 0:
+		/* Child */
+
+		/* wait for parent */
+		read(pfds[0], buf, 5);
+
+		fd =  shm_open(shared_name, O_RDWR, DEFFILEMODE);
+		if (fd == -1) {
+			perror("CHILD - shm_open(existing):");
+			exit(1);
+		} else {
+			ptest_data = mmap(0, sizeof(test_data), PROT_READ + PROT_WRITE, MAP_SHARED, fd, 0);
+			if (ptest_data != MAP_FAILED) {
+				for (i=0; i < ARRAY_SIZE(test_data); i++) {
+					if (ptest_data[i] != test_data[i]) {
+						printf("%-40s: Offset %d, local %d, shm %d\n", "Compare memory error", i, test_data[i], ptest_data[i]);
+						test_data_fails++;
+					}
+				}
+				if (test_data_fails == 0)
+					printf("%-40s: %s\n", "Compare memory", "Success");
+
+				munmap(ptest_data, sizeof(test_data));
+			}
+		}
+		exit(0);
+
+	default:
+		/* Parent */
+		fd = shm_open(shared_name, O_RDWR+O_CREAT+O_EXCL, DEFFILEMODE );
+		if (fd == -1) {
+			perror("PARENT - shm_open(create):");
+		} else {
+			if ((ftruncate(fd, sizeof(test_data))) == -1)
+			{
+				printf("%-40s: %s", "ftruncate", strerror(errno));
+				shm_unlink(shared_name);
+				return 0;
+			}
+
+			ptest_data = mmap(0, sizeof(test_data), PROT_READ + PROT_WRITE, MAP_SHARED, fd, 0);
+			if (ptest_data == MAP_FAILED)
+			{
+				perror("PARENT - mmap:");
+				if (shm_unlink(shared_name) == -1) {
+					perror("PARENT - shm_unlink:");
+				}
+				return 0;
+			}
+			for (i=0; i < ARRAY_SIZE(test_data); i++)
+				ptest_data[i] = test_data[i];
+
+			/* signal child */
+			write(pfds[1], "rdy", 5);
+			/* wait for child */
+			wait(&rv);
+
+			/* Cleanup */
+			munmap(ptest_data, sizeof(test_data));
+			if (shm_unlink(shared_name) == -1) {
+				perror("PARENT - shm_unlink:");
+			}
+		}
+	}
+	return 0;
+}
diff --git a/ap/build/uClibc/test/locale-mbwc/Makefile b/ap/build/uClibc/test/locale-mbwc/Makefile
new file mode 100644
index 0000000..771c3d1
--- /dev/null
+++ b/ap/build/uClibc/test/locale-mbwc/Makefile
@@ -0,0 +1,7 @@
+# uClibc locale tests
+# Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
+
+top_builddir=../../
+include ../Rules.mak
+-include Makefile.in
+include ../Test.mak
diff --git a/ap/build/uClibc/test/locale-mbwc/Makefile.in b/ap/build/uClibc/test/locale-mbwc/Makefile.in
new file mode 100644
index 0000000..7c0e9d5
--- /dev/null
+++ b/ap/build/uClibc/test/locale-mbwc/Makefile.in
@@ -0,0 +1,27 @@
+# uClibc locale tests
+# Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
+#	 tst_mbtowc tst_strcoll tst_strfmon tst_strxfrm    \
+
+TESTS := tst_iswalnum tst_iswalpha tst_iswcntrl          \
+	 tst_iswctype tst_iswdigit tst_iswgraph          \
+	 tst_iswlower tst_iswprint tst_iswpunct          \
+	 tst_iswspace tst_iswupper tst_iswxdigit         \
+	 tst_mblen tst_mbrlen tst_mbrtowc tst_mbsrtowcs  \
+	 tst_mbstowcs tst_mbtowc tst_strcoll tst_strxfrm \
+	 tst_swscanf tst_towctrans tst_towlower          \
+	 tst_towupper tst_wcrtomb tst_wcscat tst_wcschr  \
+	 tst_wcscmp tst_wcscoll tst_wcscpy tst_wcscspn   \
+	 tst_wcslen tst_wcsncat tst_wcsncmp tst_wcsncpy  \
+	 tst_wcspbrk tst_wcsrtombs tst_wcsspn tst_wcsstr \
+	 tst_wcstod tst_wcstok tst_wcstombs tst_wcswidth \
+	 tst_wcsxfrm tst_wctob tst_wctomb tst_wctrans    \
+	 tst_wctype tst_wcwidth tst_strfmon \
+	 tst2_mbrtowc
+
+# NOTE: For now disabled tst_strfmon to avoid build failure.
+TESTS_DISABLED := tst_strfmon
+
+DODIFF_rint     := 1
+
+EXTRA_CFLAGS    := -D__USE_GNU -fno-builtin
+
diff --git a/ap/build/uClibc/test/locale-mbwc/dat_isw-funcs.h b/ap/build/uClibc/test/locale-mbwc/dat_isw-funcs.h
new file mode 100644
index 0000000..70aecb0
--- /dev/null
+++ b/ap/build/uClibc/test/locale-mbwc/dat_isw-funcs.h
@@ -0,0 +1,37 @@
+/*
+ *  TEST SUITE FOR MB/WC FUNCTIONS IN C LIBRARY
+ *
+ *	 FILE:	dat_isw-funcs.h
+ *
+ *	 ISW*:	int isw* (wint_t wc);
+ */
+
+#include <errno.h>
+#include <stdlib.h>
+#include <wctype.h>
+#include "tst_types.h"
+#include "tgn_locdef.h"
+
+#define TST_ISW_LOC(FUNC, func) \
+	TST_ISW## FUNC	  tst_isw## func ##_loc []
+
+#define TST_ISW_REC(locale, func) \
+	{  Tisw## func,	   TST_LOC_## locale  },
+
+/*
+ *  NOTE:
+ *    Set ret_flg = 1, when a return value is expected to be 0 (FALSE).
+ *    Set ret_flg = 0, when a return value is expected to be non-zero (TRUE).
+ *
+ *    Since the functions return *non*-zero value for TRUE, can't
+ *    compare an actual return value with an expected return value.
+ *    Set the ret_flg=0 for TRUE cases and the tst_isw*() will check
+ *    the non-zero value.
+ *
+ *    { { WEOF }, { 0,1,0 } },
+ *		      | |
+ *		      | ret_val: an expected return value
+ *		      ret_flg: if 1, compare an actual return value with the
+ *			       ret_val; if 0, the test program
+ *			       checks the actual return value.
+ */
diff --git a/ap/build/uClibc/test/locale-mbwc/dat_iswalnum.c b/ap/build/uClibc/test/locale-mbwc/dat_iswalnum.c
new file mode 100644
index 0000000..5093703
--- /dev/null
+++ b/ap/build/uClibc/test/locale-mbwc/dat_iswalnum.c
@@ -0,0 +1,196 @@
+/*
+ *  TEST SUITE FOR MB/WC FUNCTIONS IN C LIBRARY
+ *
+ *	 FILE:	dat_iswalnum.c
+ *
+ *	 ISW*:	int iswalnum (wint_t wc);
+ */
+
+
+#include "dat_isw-funcs.h"
+
+
+TST_ISW_LOC (ALNUM, alnum) = {
+
+    {	TST_ISW_REC (de, alnum)
+	{
+	  {  { 0x0080 }, { 0,1,0 }  },  /* CTRL     */
+	  {  { 0x009F }, { 0,1,0 }  },  /* CTRL     */
+	  {  { 0x00A0 }, { 0,1,0 }  },  /* NB SPACE */
+	  {  { 0x00A1 }, { 0,1,0 }  },  /* UD !     */
+	  {  { 0x00B0 }, { 0,1,0 }  },  /* Degree   */
+	  {  { 0x00B1 }, { 0,1,0 }  },  /* +- sign  */
+	  {  { 0x00B2 }, { 0,1,0 }  },  /* SUP 2    */
+	  {  { 0x00B3 }, { 0,1,0 }  },  /* SUP 3    */
+	  {  { 0x00B4 }, { 0,1,0 }  },  /* ACUTE    */
+	  {  { 0x00B8 }, { 0,1,0 }  },  /* CEDILLA  */
+	  {  { 0x00B9 }, { 0,1,0 }  },  /* SUP 1    */
+	  {  { 0x00BB }, { 0,1,0 }  },  /* >>	      */
+	  {  { 0x00BC }, { 0,1,0 }  },  /* 1/4      */
+	  {  { 0x00BD }, { 0,1,0 }  },  /* 1/2      */
+	  {  { 0x00BE }, { 0,1,0 }  },  /* 3/4      */
+	  {  { 0x00BF }, { 0,1,0 }  },  /* UD ?     */
+	  {  { 0x00C0 }, { 0,0,0 }  },  /* A Grave  */
+	  {  { 0x00D6 }, { 0,0,0 }  },  /* O dia    */
+	  {  { 0x00D7 }, { 0,1,0 }  },  /* multipl. */
+	  {  { 0x00D8 }, { 0,0,0 }  },  /* O stroke */
+	  {  { 0x00DF }, { 0,0,0 }  },  /* small Sh */
+	  {  { 0x00E0 }, { 0,0,0 }  },  /* a grave  */
+	  {  { 0x00F6 }, { 0,0,0 }  },  /* o dia    */
+	  {  { 0x00F7 }, { 0,1,0 }  },  /* division */
+	  {  { 0x00F8 }, { 0,0,0 }  },  /* o stroke */
+	  {  { 0x00FF }, { 0,0,0 }  },  /* y dia    */
+	  {  .is_last = 1 }		  /* last element    */
+	}
+    },
+    {	TST_ISW_REC (de_UTF8, alnum)
+	{
+	  {  { 0x0080 }, { 0,1,0 }  },  /* CTRL     */
+	  {  { 0x009F }, { 0,1,0 }  },  /* CTRL     */
+	  {  { 0x00A0 }, { 0,1,0 }  },  /* NB SPACE */
+	  {  { 0x00A1 }, { 0,1,0 }  },  /* UD !     */
+	  {  { 0x00B0 }, { 0,1,0 }  },  /* Degree   */
+	  {  { 0x00B1 }, { 0,1,0 }  },  /* +- sign  */
+	  {  { 0x00B2 }, { 0,1,0 }  },  /* SUP 2    */
+	  {  { 0x00B3 }, { 0,1,0 }  },  /* SUP 3    */
+	  {  { 0x00B4 }, { 0,1,0 }  },  /* ACUTE    */
+	  {  { 0x00B8 }, { 0,1,0 }  },  /* CEDILLA  */
+	  {  { 0x00B9 }, { 0,1,0 }  },  /* SUP 1    */
+	  {  { 0x00BB }, { 0,1,0 }  },  /* >>	      */
+	  {  { 0x00BC }, { 0,1,0 }  },  /* 1/4      */
+	  {  { 0x00BD }, { 0,1,0 }  },  /* 1/2      */
+	  {  { 0x00BE }, { 0,1,0 }  },  /* 3/4      */
+	  {  { 0x00BF }, { 0,1,0 }  },  /* UD ?     */
+	  {  { 0x00C0 }, { 0,0,0 }  },  /* A Grave  */
+	  {  { 0x00D6 }, { 0,0,0 }  },  /* O dia    */
+	  {  { 0x00D7 }, { 0,1,0 }  },  /* multipl. */
+	  {  { 0x00D8 }, { 0,0,0 }  },  /* O stroke */
+	  {  { 0x00DF }, { 0,0,0 }  },  /* small Sh */
+	  {  { 0x00E0 }, { 0,0,0 }  },  /* a grave  */
+	  {  { 0x00F6 }, { 0,0,0 }  },  /* o dia    */
+	  {  { 0x00F7 }, { 0,1,0 }  },  /* division */
+	  {  { 0x00F8 }, { 0,0,0 }  },  /* o stroke */
+	  {  { 0x00FF }, { 0,0,0 }  },  /* y dia    */
+	  {  .is_last = 1 }		  /* last element    */
+	}
+    },
+    {	TST_ISW_REC (enUS, alnum)
+	{
+	  {  { WEOF   }, { 0,1,0 }  },
+	  {  { 0x0000 }, { 0,1,0 }  },
+	  {  { 0x001F }, { 0,1,0 }  },
+	  {  { 0x0020 }, { 0,1,0 }  },
+	  {  { 0x0021 }, { 0,1,0 }  },
+	  {  { 0x002F }, { 0,1,0 }  },
+	  {  { 0x0030 }, { 0,0,0 }  },
+	  {  { 0x0039 }, { 0,0,0 }  },
+	  {  { 0x003A }, { 0,1,0 }  },
+	  {  { 0x0040 }, { 0,1,0 }  },
+	  {  { 0x0041 }, { 0,0,0 }  },
+	  {  { 0x005A }, { 0,0,0 }  },
+	  {  { 0x005B }, { 0,1,0 }  },
+	  {  { 0x0060 }, { 0,1,0 }  },
+	  {  { 0x0061 }, { 0,0,0 }  },
+	  {  { 0x007A }, { 0,0,0 }  },
+	  {  { 0x007B }, { 0,1,0 }  },
+	  {  { 0x007E }, { 0,1,0 }  },
+	  {  { 0x007F }, { 0,1,0 }  },
+	  {  { 0x0080 }, { 0,1,0 }  },
+	  {  .is_last = 1 }		  /* last element    */
+	}
+    },
+#if 0
+    {	TST_ISW_REC (eucJP, alnum)
+#else
+    {	TST_ISW_REC (ja_UTF8, alnum)
+#endif
+	{
+	  {  { 0x3000 }, { 0,1,0 }  },  /* IDEO. SPACE	*/
+	  {  { 0x3020 }, { 0,1,0 }  },  /* POSTAL MARK FACE	*/
+#ifdef SHOJI_IS_RIGHT
+	  {  { 0x3029 }, { 0,1,0 }  },  /* Hangzhou NUM9	*/
+#else
+	  {  { 0x3029 }, { 0,0,0 }  },  /* Hangzhou NUM9	*/
+#endif
+	  {  { 0x302F }, { 0,1,0 }  },  /* Diacritics(Hangul) */
+	  {  { 0x3037 }, { 0,1,0 }  },  /* Separator Symbol	*/
+	  {  { 0x303F }, { 0,1,0 }  },  /* IDEO. HALF SPACE	*/
+#ifdef SHOJI_IS_RIGHT
+	  {  { 0x3041 }, { 0,1,0 }  },  /* HIRAGANA a		*/
+	  {  { 0x3094 }, { 0,1,0 }  },  /* HIRAGANA u"		*/
+#else
+	  {  { 0x3041 }, { 0,0,0 }  },  /* HIRAGANA a		*/
+	  {  { 0x3094 }, { 0,0,0 }  },  /* HIRAGANA u"		*/
+#endif
+	  {  { 0x3099 }, { 0,1,0 }  },  /* SOUND MARK		*/
+#ifdef SHOJI_IS_RIGHT
+	  {  { 0x309E }, { 0,1,0 }  },  /* ITERATION MARK	*/
+	  {  { 0x30A1 }, { 0,1,0 }  },  /* KATAKANA a		*/
+	  {  { 0x30FA }, { 0,1,0 }  },  /* KATAKANA wo"	*/
+#else
+	  {  { 0x309E }, { 0,0,0 }  },  /* ITERATION MARK	*/
+	  {  { 0x30A1 }, { 0,0,0 }  },  /* KATAKANA a		*/
+	  {  { 0x30FA }, { 0,0,0 }  },  /* KATAKANA wo"	*/
+#endif
+	  {  { 0x30FB }, { 0,1,0 }  },  /* KATAKANA MID.DOT	*/
+#ifdef SHOJI_IS_RIGHT
+	  {  { 0x30FE }, { 0,1,0 }  },  /* KATAKANA ITERATION	*/
+#else
+	  {  { 0x30FE }, { 0,0,0 }  },  /* KATAKANA ITERATION	*/
+#endif
+	  {  { 0x3191 }, { 0,1,0 }  },  /* KANBUN REV.MARK	*/
+	  {  { 0x3243 }, { 0,1,0 }  },  /* IDEO. MARK (reach) */
+	  {  { 0x32CB }, { 0,1,0 }  },  /* IDEO.TEL.SYM.DEC12 */
+	  {  { 0x32FE }, { 0,1,0 }  },  /* MARU KATAKANA wo	*/
+	  {  { 0x33FE }, { 0,1,0 }  },  /* CJK IDEO.TEL.31th	*/
+#ifdef SHOJI_IS_RIGHT
+	  {  { 0x4E00 }, { 0,1,0 }  },  /* CJK UNI.IDEO.	*/
+	  {  { 0x4E05 }, { 0,1,0 }  },  /* CJK UNI.IDEO.	*/
+	  {  { 0x4E06 }, { 0,1,0 }  },  /* CJK UNI.IDEO.NON-J	*/
+	  {  { 0x4E07 }, { 0,1,0 }  },  /* CJK UNI.IDEO.	*/
+	  {  { 0x4FFF }, { 0,1,0 }  },  /* CJK UNI.IDEO.	*/
+	  {  { 0x9000 }, { 0,1,0 }  },  /* CJK UNI.IDEO.	*/
+	  {  { 0x9006 }, { 0,1,0 }  },  /* CJK UNI.IDEO.	*/
+	  {  { 0x9007 }, { 0,1,0 }  },  /* CJK UNI.IDEO.NON-J	*/
+	  {  { 0x9FA4 }, { 0,1,0 }  },  /* CJK UNI.IDEO.NON-J	*/
+	  {  { 0x9FA5 }, { 0,1,0 }  },  /* CJK UNI.IDEO.	*/
+#else
+	  {  { 0x4E00 }, { 0,0,0 }  },  /* CJK UNI.IDEO.	*/
+	  {  { 0x4E05 }, { 0,0,0 }  },  /* CJK UNI.IDEO.	*/
+	  {  { 0x4E06 }, { 0,0,0 }  },  /* CJK UNI.IDEO.NON-J	*/
+	  {  { 0x4E07 }, { 0,0,0 }  },  /* CJK UNI.IDEO.	*/
+	  {  { 0x4FFF }, { 0,0,0 }  },  /* CJK UNI.IDEO.	*/
+	  {  { 0x9000 }, { 0,0,0 }  },  /* CJK UNI.IDEO.	*/
+	  {  { 0x9006 }, { 0,0,0 }  },  /* CJK UNI.IDEO.	*/
+	  {  { 0x9007 }, { 0,0,0 }  },  /* CJK UNI.IDEO.NON-J	*/
+	  {  { 0x9FA4 }, { 0,0,0 }  },  /* CJK UNI.IDEO.NON-J	*/
+	  {  { 0x9FA5 }, { 0,0,0 }  },  /* CJK UNI.IDEO.	*/
+#endif
+	  {  { 0xFE4F }, { 0,1,0 }  },  /* CJK UNI.IDEO.	*/
+	  {  { 0xFF0F }, { 0,1,0 }  },  /* FULL SLASH		*/
+	  {  { 0xFF19 }, { 0,0,0 }  },  /* FULL 9		*/
+	  {  { 0xFF20 }, { 0,1,0 }  },  /* FULL @		*/
+	  {  { 0xFF3A }, { 0,0,0 }  },  /* FULL Z		*/
+	  {  { 0xFF40 }, { 0,1,0 }  },  /* FULL GRAVE ACC.	*/
+	  {  { 0xFF5A }, { 0,0,0 }  },  /* FULL z		*/
+	  {  { 0xFF5E }, { 0,1,0 }  },  /* FULL ~ (tilde)	*/
+	  {  { 0xFF61 }, { 0,1,0 }  },  /* HALF IDEO.STOP. .	*/
+	  {  { 0xFF65 }, { 0,1,0 }  },  /* HALF KATA MID.DOT	*/
+#ifdef SHOJI_IS_RIGHT
+	  {  { 0xFF66 }, { 0,1,0 }  },  /* HALF KATA WO		*/
+	  {  { 0xFF6F }, { 0,1,0 }  },  /* HALF KATA tu		*/
+	  {  { 0xFF70 }, { 0,1,0 }  },  /* HALF KATA PL -	*/
+	  {  { 0xFF71 }, { 0,1,0 }  },  /* HALF KATA A		*/
+	  {  { 0xFF9E }, { 0,1,0 }  },  /* HALF KATA MI		*/
+#else
+	  {  { 0xFF66 }, { 0,0,0 }  },  /* HALF KATA WO		*/
+	  {  { 0xFF6F }, { 0,0,0 }  },  /* HALF KATA tu		*/
+	  {  { 0xFF70 }, { 0,0,0 }  },  /* HALF KATA PL -	*/
+	  {  { 0xFF71 }, { 0,0,0 }  },  /* HALF KATA A		*/
+	  {  { 0xFF9E }, { 0,0,0 }  },  /* HALF KATA MI		*/
+#endif
+	  {  .is_last = 1 }		  /* last element    */
+	}
+    },
+    {	TST_ISW_REC (end, alnum) }
+};
diff --git a/ap/build/uClibc/test/locale-mbwc/dat_iswalpha.c b/ap/build/uClibc/test/locale-mbwc/dat_iswalpha.c
new file mode 100644
index 0000000..c2b59fb
--- /dev/null
+++ b/ap/build/uClibc/test/locale-mbwc/dat_iswalpha.c
@@ -0,0 +1,169 @@
+/*
+ *  TEST SUITE FOR MB/WC FUNCTIONS IN C LIBRARY
+ *
+ *	 FILE:	dat_iswalpha.c
+ *
+ *	 ISW*:	int iswalpha (wint_t wc);
+ */
+
+
+#include "dat_isw-funcs.h"
+
+
+TST_ISW_LOC (ALPHA, alpha)  = {
+
+    {	TST_ISW_REC (de, alpha)
+	{
+	  {  { 0x0080 }, { 0,1,0 }  },  /* CTRL     */
+	  {  { 0x009F }, { 0,1,0 }  },  /* CTRL     */
+	  {  { 0x00A0 }, { 0,1,0 }  },  /* NB SPACE */
+	  {  { 0x00A1 }, { 0,1,0 }  },  /* UD !     */
+	  {  { 0x00B0 }, { 0,1,0 }  },  /* Degree   */
+	  {  { 0x00B1 }, { 0,1,0 }  },  /* +- sign  */
+	  {  { 0x00B2 }, { 0,1,0 }  },  /* SUP 2    */
+	  {  { 0x00B3 }, { 0,1,0 }  },  /* SUP 3    */
+	  {  { 0x00B4 }, { 0,1,0 }  },  /* ACUTE    */
+	  {  { 0x00B8 }, { 0,1,0 }  },  /* CEDILLA  */
+	  {  { 0x00B9 }, { 0,1,0 }  },  /* SUP 1    */
+	  {  { 0x00BB }, { 0,1,0 }  },  /* >>	      */
+	  {  { 0x00BC }, { 0,1,0 }  },  /* 1/4      */
+	  {  { 0x00BD }, { 0,1,0 }  },  /* 1/2      */
+	  {  { 0x00BE }, { 0,1,0 }  },  /* 3/4      */
+	  {  { 0x00BF }, { 0,1,0 }  },  /* UD ?     */
+	  {  { 0x00C0 }, { 0,0,0 }  },  /* A Grave  */
+	  {  { 0x00D6 }, { 0,0,0 }  },  /* O dia    */
+	  {  { 0x00D7 }, { 0,1,0 }  },  /* multipl. */
+	  {  { 0x00D8 }, { 0,0,0 }  },  /* O stroke */
+	  {  { 0x00DF }, { 0,0,0 }  },  /* small Sh */
+	  {  { 0x00E0 }, { 0,0,0 }  },  /* a grave  */
+	  {  { 0x00F6 }, { 0,0,0 }  },  /* o dia    */
+	  {  { 0x00F7 }, { 0,1,0 }  },  /* division */
+	  {  { 0x00F8 }, { 0,0,0 }  },  /* o stroke */
+	  {  { 0x00FF }, { 0,0,0 }  },  /* y dia    */
+	  {  .is_last = 1 }		  /* last element    */
+	}
+    },
+    {	TST_ISW_REC (enUS, alpha)
+	{
+	  {  { WEOF   }, { 0,1,0 }  },
+	  {  { 0x0000 }, { 0,1,0 }  },
+	  {  { 0x001F }, { 0,1,0 }  },
+	  {  { 0x0020 }, { 0,1,0 }  },
+	  {  { 0x0021 }, { 0,1,0 }  },
+	  {  { 0x002F }, { 0,1,0 }  },
+	  {  { 0x0030 }, { 0,1,0 }  },
+	  {  { 0x0039 }, { 0,1,0 }  },
+	  {  { 0x003A }, { 0,1,0 }  },
+	  {  { 0x0040 }, { 0,1,0 }  },
+	  {  { 0x0041 }, { 0,0,0 }  },
+	  {  { 0x005A }, { 0,0,0 }  },
+	  {  { 0x005B }, { 0,1,0 }  },
+	  {  { 0x0060 }, { 0,1,0 }  },
+	  {  { 0x0061 }, { 0,0,0 }  },
+	  {  { 0x007A }, { 0,0,0 }  },
+	  {  { 0x007B }, { 0,1,0 }  },
+	  {  { 0x007E }, { 0,1,0 }  },
+	  {  { 0x007F }, { 0,1,0 }  },
+	  {  { 0x0080 }, { 0,1,0 }  },  /* 20 */
+	  {  .is_last = 1 }		  /* last element    */
+	}
+    },
+#if 0
+    {	TST_ISW_REC (eucJP, alpha)
+#else
+    {	TST_ISW_REC (ja_UTF8, alpha)
+#endif
+	{
+	  {  { 0x3000 }, { 0,1,0 }  },  /* IDEO. SPACE	*/
+	  {  { 0x3020 }, { 0,1,0 }  },  /* POSTAL MARK FACE	*/
+#ifdef SHOJI_IS_RIGHT
+	  {  { 0x3029 }, { 0,1,0 }  },  /* Hangzhou NUM9	*/
+#else
+	  {  { 0x3029 }, { 0,0,0 }  },  /* Hangzhou NUM9	*/
+#endif
+	  {  { 0x302F }, { 0,1,0 }  },  /* Diacritics(Hangul) */
+	  {  { 0x3037 }, { 0,1,0 }  },  /* Separator Symbol	*/
+	  {  { 0x303F }, { 0,1,0 }  },  /* IDEO. HALF SPACE	*/
+#ifdef SHOJI_IS_RIGHT
+	  {  { 0x3041 }, { 0,1,0 }  },  /* HIRAGANA a		*/
+	  {  { 0x3094 }, { 0,1,0 }  },  /* HIRAGANA u"		*/
+#else
+	  {  { 0x3041 }, { 0,0,0 }  },  /* HIRAGANA a		*/
+	  {  { 0x3094 }, { 0,0,0 }  },  /* HIRAGANA u"		*/
+#endif
+	  {  { 0x3099 }, { 0,1,0 }  },  /* SOUND MARK		*/
+#ifdef SHOJI_IS_RIGHT
+	  {  { 0x309E }, { 0,1,0 }  },  /* ITERATION MARK	*/
+	  {  { 0x30A1 }, { 0,1,0 }  },  /* KATAKANA a		*/
+	  {  { 0x30FA }, { 0,1,0 }  },  /* KATAKANA wo"		*/
+#else
+	  {  { 0x309E }, { 0,0,0 }  },  /* ITERATION MARK	*/
+	  {  { 0x30A1 }, { 0,0,0 }  },  /* KATAKANA a		*/
+	  {  { 0x30FA }, { 0,0,0 }  },  /* KATAKANA wo"		*/
+#endif
+	  {  { 0x30FB }, { 0,1,0 }  },  /* KATAKANA MID.DOT	*/
+#ifdef SHOJI_IS_RIGHT
+	  {  { 0x30FE }, { 0,1,0 }  },  /* KATAKANA ITERATION	*/
+#else
+	  {  { 0x30FE }, { 0,0,0 }  },  /* KATAKANA ITERATION	*/
+#endif
+	  {  { 0x3191 }, { 0,1,0 }  },  /* KANBUN REV.MARK	*/
+	  {  { 0x3243 }, { 0,1,0 }  },  /* IDEO. MARK (reach) */
+	  {  { 0x32CB }, { 0,1,0 }  },  /* IDEO.TEL.SYM.DEC12 */
+	  {  { 0x32FE }, { 0,1,0 }  },  /* MARU KATAKANA wo	*/
+	  {  { 0x33FE }, { 0,1,0 }  },  /* CJK IDEO.TEL.31th	*/
+#ifdef SHOJI_IS_RIGHT
+	  {  { 0x4E00 }, { 0,1,0 }  },  /* CJK UNI.IDEO.	*/
+	  {  { 0x4E05 }, { 0,1,0 }  },  /* CJK UNI.IDEO.	*/
+	  {  { 0x4E06 }, { 0,1,0 }  },  /* CJK UNI.IDEO.NON-J	*/
+	  {  { 0x4E07 }, { 0,1,0 }  },  /* CJK UNI.IDEO.	*/
+	  {  { 0x4FFF }, { 0,1,0 }  },  /* CJK UNI.IDEO.	*/
+	  {  { 0x9000 }, { 0,1,0 }  },  /* CJK UNI.IDEO.	*/
+	  {  { 0x9006 }, { 0,1,0 }  },  /* CJK UNI.IDEO.	*/
+	  {  { 0x9007 }, { 0,1,0 }  },  /* CJK UNI.IDEO.NON-J	*/
+	  {  { 0x9FA4 }, { 0,1,0 }  },  /* CJK UNI.IDEO.NON-J	*/
+	  {  { 0x9FA5 }, { 0,1,0 }  },  /* CJK UNI.IDEO.	*/
+#else
+	  {  { 0x4E00 }, { 0,0,0 }  },  /* CJK UNI.IDEO.	*/
+	  {  { 0x4E05 }, { 0,0,0 }  },  /* CJK UNI.IDEO.	*/
+	  {  { 0x4E06 }, { 0,0,0 }  },  /* CJK UNI.IDEO.NON-J	*/
+	  {  { 0x4E07 }, { 0,0,0 }  },  /* CJK UNI.IDEO.	*/
+	  {  { 0x4FFF }, { 0,0,0 }  },  /* CJK UNI.IDEO.	*/
+	  {  { 0x9000 }, { 0,0,0 }  },  /* CJK UNI.IDEO.	*/
+	  {  { 0x9006 }, { 0,0,0 }  },  /* CJK UNI.IDEO.	*/
+	  {  { 0x9007 }, { 0,0,0 }  },  /* CJK UNI.IDEO.NON-J	*/
+	  {  { 0x9FA4 }, { 0,0,0 }  },  /* CJK UNI.IDEO.NON-J	*/
+	  {  { 0x9FA5 }, { 0,0,0 }  },  /* CJK UNI.IDEO.	*/
+#endif
+	  {  { 0xFE4F }, { 0,1,0 }  },  /* CJK UNI.IDEO.	*/
+	  {  { 0xFF0F }, { 0,1,0 }  },  /* FULL SLASH		*/
+#ifdef SHOJI_IS_RIGHT
+	  {  { 0xFF19 }, { 0,1,0 }  },  /* FULL 9		*/
+#else
+	  {  { 0xFF19 }, { 0,0,0 }  },  /* FULL 9		*/
+#endif
+	  {  { 0xFF20 }, { 0,1,0 }  },  /* FULL @		*/
+	  {  { 0xFF3A }, { 0,0,0 }  },  /* FULL Z		*/
+	  {  { 0xFF40 }, { 0,1,0 }  },  /* FULL GRAVE ACC.	*/
+	  {  { 0xFF5A }, { 0,0,0 }  },  /* FULL z		*/
+	  {  { 0xFF5E }, { 0,1,0 }  },  /* FULL ~ (tilde)	*/
+	  {  { 0xFF61 }, { 0,1,0 }  },  /* HALF IDEO.STOP. .	*/
+	  {  { 0xFF65 }, { 0,1,0 }  },  /* HALF KATA MID.DOT	*/
+#ifdef SHOJI_IS_RIGHT
+	  {  { 0xFF66 }, { 0,1,0 }  },  /* HALF KATA WO		*/
+	  {  { 0xFF6F }, { 0,1,0 }  },  /* HALF KATA tu		*/
+	  {  { 0xFF70 }, { 0,1,0 }  },  /* HALF KATA PL -	*/
+	  {  { 0xFF71 }, { 0,1,0 }  },  /* HALF KATA A		*/
+	  {  { 0xFF9E }, { 0,1,0 }  },  /* HALF KATA MI		*/
+#else
+	  {  { 0xFF66 }, { 0,0,0 }  },  /* HALF KATA WO		*/
+	  {  { 0xFF6F }, { 0,0,0 }  },  /* HALF KATA tu		*/
+	  {  { 0xFF70 }, { 0,0,0 }  },  /* HALF KATA PL -	*/
+	  {  { 0xFF71 }, { 0,0,0 }  },  /* HALF KATA A		*/
+	  {  { 0xFF9E }, { 0,0,0 }  },  /* HALF KATA MI		*/
+#endif
+	  {  .is_last = 1 }		  /* last element    */
+	}
+    },
+    {	TST_ISW_REC (end, alpha) }
+};
diff --git a/ap/build/uClibc/test/locale-mbwc/dat_iswcntrl.c b/ap/build/uClibc/test/locale-mbwc/dat_iswcntrl.c
new file mode 100644
index 0000000..e6ec685
--- /dev/null
+++ b/ap/build/uClibc/test/locale-mbwc/dat_iswcntrl.c
@@ -0,0 +1,125 @@
+/*
+ *  TEST SUITE FOR MB/WC FUNCTIONS IN C LIBRARY
+ *
+ *	 FILE:	dat_iswcntrl.c
+ *
+ *	 ISW*:	int iswcntrl (wint_t wc);
+ */
+
+
+#include "dat_isw-funcs.h"
+
+
+TST_ISW_LOC (CNTRL, cntrl) = {
+
+    {	TST_ISW_REC (de, cntrl)
+	{
+	  {  { 0x0080 }, { 0,0,0 }  },  /* CTRL     */
+	  {  { 0x009F }, { 0,0,0 }  },  /* CTRL     */
+	  {  { 0x00A0 }, { 0,1,0 }  },  /* NB SPACE */
+	  {  { 0x00A1 }, { 0,1,0 }  },  /* UD !     */
+	  {  { 0x00B0 }, { 0,1,0 }  },  /* Degree   */
+	  {  { 0x00B1 }, { 0,1,0 }  },  /* +- sign  */
+	  {  { 0x00B2 }, { 0,1,0 }  },  /* SUP 2    */
+	  {  { 0x00B3 }, { 0,1,0 }  },  /* SUP 3    */
+	  {  { 0x00B4 }, { 0,1,0 }  },  /* ACUTE    */
+	  {  { 0x00B8 }, { 0,1,0 }  },  /* CEDILLA  */
+	  {  { 0x00B9 }, { 0,1,0 }  },  /* SUP 1    */
+	  {  { 0x00BB }, { 0,1,0 }  },  /* >>	      */
+	  {  { 0x00BC }, { 0,1,0 }  },  /* 1/4      */
+	  {  { 0x00BD }, { 0,1,0 }  },  /* 1/2      */
+	  {  { 0x00BE }, { 0,1,0 }  },  /* 3/4      */
+	  {  { 0x00BF }, { 0,1,0 }  },  /* UD ?     */
+	  {  { 0x00C0 }, { 0,1,0 }  },  /* A Grave  */
+	  {  { 0x00D6 }, { 0,1,0 }  },  /* O dia    */
+	  {  { 0x00D7 }, { 0,1,0 }  },  /* multipl. */
+	  {  { 0x00D8 }, { 0,1,0 }  },  /* O stroke */
+	  {  { 0x00DF }, { 0,1,0 }  },  /* small Sh */
+	  {  { 0x00E0 }, { 0,1,0 }  },  /* a grave  */
+	  {  { 0x00F6 }, { 0,1,0 }  },  /* o dia    */
+	  {  { 0x00F7 }, { 0,1,0 }  },  /* division */
+	  {  { 0x00F8 }, { 0,1,0 }  },  /* o stroke */
+	  {  { 0x00FF }, { 0,1,0 }  },  /* y dia    */
+	  { .is_last = 1 }		  /* Last element.  */
+	}
+    },
+    {	TST_ISW_REC (enUS, cntrl)
+	{
+	  {  { WEOF   }, { 0,1,0 }  },
+	  {  { 0x0000 }, { 0,0,0 }  },
+	  {  { 0x001F }, { 0,0,0 }  },
+	  {  { 0x0020 }, { 0,1,0 }  },
+	  {  { 0x0021 }, { 0,1,0 }  },
+	  {  { 0x002F }, { 0,1,0 }  },
+	  {  { 0x0030 }, { 0,1,0 }  },
+	  {  { 0x0039 }, { 0,1,0 }  },
+	  {  { 0x003A }, { 0,1,0 }  },
+	  {  { 0x0040 }, { 0,1,0 }  },
+	  {  { 0x0041 }, { 0,1,0 }  },
+	  {  { 0x005A }, { 0,1,0 }  },
+	  {  { 0x005B }, { 0,1,0 }  },
+	  {  { 0x0060 }, { 0,1,0 }  },
+	  {  { 0x0061 }, { 0,1,0 }  },
+	  {  { 0x007A }, { 0,1,0 }  },
+	  {  { 0x007B }, { 0,1,0 }  },
+	  {  { 0x007E }, { 0,1,0 }  },
+	  {  { 0x007F }, { 0,0,0 }  },
+	  {  { 0x0080 }, { 0,1,0 }  },
+	  { .is_last = 1 }		  /* Last element.  */
+	}
+    },
+#if 0
+    {	TST_ISW_REC (eucJP, cntrl)
+#else
+    {	TST_ISW_REC (ja_UTF8, cntrl)
+#endif
+	{
+	  {  { 0x3000 }, { 0,1,0 }  },  /* IDEO. SPACE	*/
+	  {  { 0x3020 }, { 0,1,0 }  },  /* POSTAL MARK FACE	*/
+	  {  { 0x3029 }, { 0,1,0 }  },  /* Hangzhou NUM9	*/
+	  {  { 0x302F }, { 0,1,0 }  },  /* Diacritics(Hangul) */
+	  {  { 0x3037 }, { 0,1,0 }  },  /* Separator Symbol	*/
+	  {  { 0x303F }, { 0,1,0 }  },  /* IDEO. HALF SPACE	*/
+	  {  { 0x3041 }, { 0,1,0 }  },  /* HIRAGANA a		*/
+	  {  { 0x3094 }, { 0,1,0 }  },  /* HIRAGANA u"	*/
+	  {  { 0x3099 }, { 0,1,0 }  },  /* SOUND MARK		*/
+	  {  { 0x309E }, { 0,1,0 }  },  /* ITERATION MARK	*/
+	  {  { 0x30A1 }, { 0,1,0 }  },  /* KATAKANA a		*/
+	  {  { 0x30FA }, { 0,1,0 }  },  /* KATAKANA wo"	*/
+	  {  { 0x30FB }, { 0,1,0 }  },  /* KATAKANA MID.DOT	*/
+	  {  { 0x30FE }, { 0,1,0 }  },  /* KATAKANA ITERATION */
+	  {  { 0x3191 }, { 0,1,0 }  },  /* KANBUN REV.MARK	*/
+	  {  { 0x3243 }, { 0,1,0 }  },  /* IDEO. MARK (reach) */
+	  {  { 0x32CB }, { 0,1,0 }  },  /* IDEO.TEL.SYM.DEC12 */
+	  {  { 0x32FE }, { 0,1,0 }  },  /* MARU KATAKANA wo	*/
+	  {  { 0x33FE }, { 0,1,0 }  },  /* CJK IDEO.TEL.31th	*/
+	  {  { 0x4E00 }, { 0,1,0 }  },  /* CJK UNI.IDEO.	*/
+	  {  { 0x4E05 }, { 0,1,0 }  },  /* CJK UNI.IDEO.	*/
+	  {  { 0x4E06 }, { 0,1,0 }  },  /* CJK UNI.IDEO.NON-J */
+	  {  { 0x4E07 }, { 0,1,0 }  },  /* CJK UNI.IDEO.	*/
+	  {  { 0x4FFF }, { 0,1,0 }  },  /* CJK UNI.IDEO.	*/
+	  {  { 0x9000 }, { 0,1,0 }  },  /* CJK UNI.IDEO.	*/
+	  {  { 0x9006 }, { 0,1,0 }  },  /* CJK UNI.IDEO.	*/
+	  {  { 0x9007 }, { 0,1,0 }  },  /* CJK UNI.IDEO.NON-J */
+	  {  { 0x9FA4 }, { 0,1,0 }  },  /* CJK UNI.IDEO.NON-J */
+	  {  { 0x9FA5 }, { 0,1,0 }  },  /* CJK UNI.IDEO.	*/
+	  {  { 0xFE4F }, { 0,1,0 }  },  /* CJK UNI.IDEO.	*/
+	  {  { 0xFF0F }, { 0,1,0 }  },  /* FULL SLASH		*/
+	  {  { 0xFF19 }, { 0,1,0 }  },  /* FULL 9		*/
+	  {  { 0xFF20 }, { 0,1,0 }  },  /* FULL @		*/
+	  {  { 0xFF3A }, { 0,1,0 }  },  /* FULL Z		*/
+	  {  { 0xFF40 }, { 0,1,0 }  },  /* FULL GRAVE ACC.	*/
+	  {  { 0xFF5A }, { 0,1,0 }  },  /* FULL z		*/
+	  {  { 0xFF5E }, { 0,1,0 }  },  /* FULL ~ (tilde)	*/
+	  {  { 0xFF61 }, { 0,1,0 }  },  /* HALF IDEO.STOP. .	*/
+	  {  { 0xFF65 }, { 0,1,0 }  },  /* HALF KATA MID.DOT	*/
+	  {  { 0xFF66 }, { 0,1,0 }  },  /* HALF KATA WO	*/
+	  {  { 0xFF6F }, { 0,1,0 }  },  /* HALF KATA tu	*/
+	  {  { 0xFF70 }, { 0,1,0 }  },  /* HALF KATA PL -	*/
+	  {  { 0xFF71 }, { 0,1,0 }  },  /* HALF KATA A	*/
+	  {  { 0xFF9E }, { 0,1,0 }  },  /* HALF KATA MI	*/
+	  { .is_last = 1 }		  /* Last element.  */
+	}
+    },
+    {	TST_ISW_REC(end, cntrl) }
+};
diff --git a/ap/build/uClibc/test/locale-mbwc/dat_iswctype.c b/ap/build/uClibc/test/locale-mbwc/dat_iswctype.c
new file mode 100644
index 0000000..0dcf182
--- /dev/null
+++ b/ap/build/uClibc/test/locale-mbwc/dat_iswctype.c
@@ -0,0 +1,667 @@
+/*
+ *  TEST SUITE FOR MB/WC FUNCTIONS IN C LIBRARY
+ *
+ *	 FILE:	dat_iswctype.c
+ *
+ *	 ISWCTYPE:  int iswctype( wint_t wc, wctype_t charclass );
+ */
+
+#include <errno.h>
+#include <stdlib.h>
+#include <wctype.h>
+#include "tst_types.h"
+#include "tgn_locdef.h"
+
+/*
+ *  NOTE:
+ *   Set ret_flg = 1, when a return value is expected to be 0 (FALSE).
+ *   Set ret_flg = 0, when a return value is expected to be non-zero (TRUE).
+ *
+ *   Since the functions return *non*-zero value for TRUE, can't
+ *   compare an actual return value with an expected return value.
+ *   Set the ret_flg=0 for TRUE cases and the tst_isw*() will check
+ *   the non-zero value.
+ *
+ * { { WEOF }, { 0,1,0 } },
+ *		   | |
+ *		   | ret_val: an expected return value
+ *		   ret_flg: if 1, compare an actual return value with the
+ *			    ret_val; if 0, the test program checks
+ *			    the actual return value.
+ */
+
+TST_ISWCTYPE tst_iswctype_loc [] = {
+  {
+    { Tiswctype, TST_LOC_de },
+    {
+      {	 { 0x009F, "alnum"  }, { 0,1,0 }  },	   /* CTRL     */
+      {	 { 0x00A0, "alnum"  }, { 0,1,0 }  },	   /* NB SPACE */
+      {	 { 0x00A1, "alnum"  }, { 0,1,0 }  },	   /* UD !     */
+      {	 { 0x00B1, "alnum"  }, { 0,1,0 }  },	   /* +- sign  */
+      {	 { 0x00B3, "alnum"  }, { 0,1,0 }  },	   /* SUP 3    */
+      {	 { 0x00B4, "alnum"  }, { 0,1,0 }  },	   /* ACUTE    */
+      {	 { 0x00BB, "alnum"  }, { 0,1,0 }  },	   /* >>       */
+      {	 { 0x00BE, "alnum"  }, { 0,1,0 }  },	   /* 3/4      */
+      {	 { 0x00BF, "alnum"  }, { 0,1,0 }  },	   /* UD ?     */
+      {	 { 0x00C0, "alnum"  }, { 0,0,0 }  },	   /* A Grave  */
+      {	 { 0x00D6, "alnum"  }, { 0,0,0 }  },	   /* O dia    */
+      {	 { 0x00D7, "alnum"  }, { 0,1,0 }  },	   /* multipl. */
+      {	 { 0x00D8, "alnum"  }, { 0,0,0 }  },	   /* O stroke */
+      {	 { 0x00DF, "alnum"  }, { 0,0,0 }  },	   /* small Sh */
+      {	 { 0x00E0, "alnum"  }, { 0,0,0 }  },	   /* a grave  */
+      {	 { 0x00F6, "alnum"  }, { 0,0,0 }  },	   /* o dia    */
+      {	 { 0x00F7, "alnum"  }, { 0,1,0 }  },	   /* division */
+      {	 { 0x00F8, "alnum"  }, { 0,0,0 }  },	   /* o stroke */
+      {	 { 0x00FF, "alnum"  }, { 0,0,0 }  },	   /* y dia    */
+      {	 { 0x0080, "alpha"  }, { 0,1,0 }  },	   /* CTRL     */
+      {	 { 0x00A0, "alpha"  }, { 0,1,0 }  },	   /* NB SPACE */
+      {	 { 0x00A1, "alpha"  }, { 0,1,0 }  },	   /* UD !     */
+      {	 { 0x00B1, "alpha"  }, { 0,1,0 }  },	   /* +- sign  */
+      {	 { 0x00B4, "alpha"  }, { 0,1,0 }  },	   /* ACUTE    */
+      {	 { 0x00B8, "alpha"  }, { 0,1,0 }  },	   /* CEDILLA  */
+      {	 { 0x00B9, "alpha"  }, { 0,1,0 }  },	   /* SUP 1    */
+      {	 { 0x00BB, "alpha"  }, { 0,1,0 }  },	   /* >>       */
+      {	 { 0x00BE, "alpha"  }, { 0,1,0 }  },	   /* 3/4      */
+      {	 { 0x00BF, "alpha"  }, { 0,1,0 }  },	   /* UD ?     */
+      {	 { 0x00C0, "alpha"  }, { 0,0,0 }  },	   /* A Grave  */
+      {	 { 0x00D6, "alpha"  }, { 0,0,0 }  },	   /* O dia    */
+      {	 { 0x00D7, "alpha"  }, { 0,1,0 }  },	   /* multipl. */
+      {	 { 0x00D8, "alpha"  }, { 0,0,0 }  },	   /* O stroke */
+      {	 { 0x00DF, "alpha"  }, { 0,0,0 }  },	   /* small Sh */
+      {	 { 0x00E0, "alpha"  }, { 0,0,0 }  },	   /* a grave  */
+      {	 { 0x00F6, "alpha"  }, { 0,0,0 }  },	   /* o dia    */
+      {	 { 0x00F7, "alpha"  }, { 0,1,0 }  },	   /* division */
+      {	 { 0x00F8, "alpha"  }, { 0,0,0 }  },	   /* o stroke */
+      {	 { 0x00FF, "alpha"  }, { 0,0,0 }  },	   /* y dia    */
+      {	 { 0x0080, "cntrl"  }, { 0,0,0 }  },	   /* CTRL     */
+      {	 { 0x009F, "cntrl"  }, { 0,0,0 }  },	   /* CTRL     */
+      {	 { 0x00A0, "cntrl"  }, { 0,1,0 }  },	   /* NB SPACE */
+      {	 { 0x00F6, "cntrl"  }, { 0,1,0 }  },	   /* o dia    */
+      {	 { 0x00FF, "cntrl"  }, { 0,1,0 }  },	   /* y dia    */
+      {	 { 0x00B9, "digit"  }, { 0,1,0 }  },	   /* SUP 1    */
+      {	 { 0x00BE, "digit"  }, { 0,1,0 }  },	   /* 3/4      */
+      {	 { 0x009F, "graph"  }, { 0,1,0 }  },	   /* CTRL     */
+#ifdef SHOJI_IS_RIGHT
+      {	 { 0x00A0, "graph"  }, { 0,1,0 }  },	   /* NB SPACE */
+#else
+      {	 { 0x00A0, "graph"  }, { 0,0,0 }  },	   /* NB SPACE */
+#endif
+      {	 { 0x00A1, "graph"  }, { 0,0,0 }  },	   /* UD !     */
+      {	 { 0x00B1, "graph"  }, { 0,0,0 }  },	   /* +- sign  */
+      {	 { 0x00B3, "graph"  }, { 0,0,0 }  },	   /* SUP 3    */
+      {	 { 0x00B4, "graph"  }, { 0,0,0 }  },	   /* ACUTE    */
+      {	 { 0x00BB, "graph"  }, { 0,0,0 }  },	   /* >>       */
+      {	 { 0x00BE, "graph"  }, { 0,0,0 }  },	   /* 3/4      */
+      {	 { 0x00C0, "graph"  }, { 0,0,0 }  },	   /* A Grave  */
+      {	 { 0x00D6, "graph"  }, { 0,0,0 }  },	   /* O dia    */
+      {	 { 0x00D7, "graph"  }, { 0,0,0 }  },	   /* multipl. */
+      {	 { 0x00D8, "graph"  }, { 0,0,0 }  },	   /* O stroke */
+      {	 { 0x00DF, "graph"  }, { 0,0,0 }  },	   /* small Sh */
+      {	 { 0x00F7, "graph"  }, { 0,0,0 }  },	   /* division */
+      {	 { 0x00F8, "graph"  }, { 0,0,0 }  },	   /* o stroke */
+      {	 { 0x00FF, "graph"  }, { 0,0,0 }  },	   /* y dia    */
+      {	 { 0x009F, "print"  }, { 0,1,0 }  },	   /* CTRL     */
+#ifdef SHOJI_IS_RIGHT
+      {	 { 0x00A0, "print"  }, { 0,1,0 }  },	   /* NB SPACE */
+#else
+      {	 { 0x00A0, "print"  }, { 0,0,0 }  },	   /* NB SPACE */
+#endif
+      {	 { 0x00A1, "print"  }, { 0,0,0 }  },	   /* UD !     */
+      {	 { 0x00B1, "print"  }, { 0,0,0 }  },	   /* +- sign  */
+      {	 { 0x00B4, "print"  }, { 0,0,0 }  },	   /* ACUTE    */
+      {	 { 0x00B8, "print"  }, { 0,0,0 }  },	   /* CEDILLA  */
+      {	 { 0x00B9, "print"  }, { 0,0,0 }  },	   /* SUP 1    */
+      {	 { 0x00BB, "print"  }, { 0,0,0 }  },	   /* >>       */
+      {	 { 0x00BE, "print"  }, { 0,0,0 }  },	   /* 3/4      */
+      {	 { 0x00C0, "print"  }, { 0,0,0 }  },	   /* A Grave  */
+      {	 { 0x00DF, "print"  }, { 0,0,0 }  },	   /* small Sh */
+      {	 { 0x00F6, "print"  }, { 0,0,0 }  },	   /* o dia    */
+      {	 { 0x00F7, "print"  }, { 0,0,0 }  },	   /* division */
+      {	 { 0x00F8, "print"  }, { 0,0,0 }  },	   /* o stroke */
+      {	 { 0x00FF, "print"  }, { 0,0,0 }  },	   /* y dia    */
+      {	 { 0x009F, "punct"  }, { 0,1,0 }  },	   /* CTRL     */
+#ifdef SHOJI_IS_RIGHT
+      {	 { 0x00A0, "punct"  }, { 0,1,0 }  },	   /* NB SPACE */
+#else
+      {	 { 0x00A0, "punct"  }, { 0,0,0 }  },	   /* NB SPACE */
+#endif
+      {	 { 0x00A1, "punct"  }, { 0,0,0 }  },	   /* UD !     */
+      {	 { 0x00B0, "punct"  }, { 0,0,0 }  },	   /* Degree   */
+      {	 { 0x00B1, "punct"  }, { 0,0,0 }  },	   /* +- sign  */
+      {	 { 0x00B2, "punct"  }, { 0,0,0 }  },	   /* SUP 2    */
+      {	 { 0x00B3, "punct"  }, { 0,0,0 }  },	   /* SUP 3    */
+      {	 { 0x00B4, "punct"  }, { 0,0,0 }  },	   /* ACUTE    */
+      {	 { 0x00B8, "punct"  }, { 0,0,0 }  },	   /* CEDILLA  */
+      {	 { 0x00B9, "punct"  }, { 0,0,0 }  },	   /* SUP 1    */
+      {	 { 0x00BB, "punct"  }, { 0,0,0 }  },	   /* >>       */
+      {	 { 0x00BC, "punct"  }, { 0,0,0 }  },	   /* 1/4      */
+      {	 { 0x00BD, "punct"  }, { 0,0,0 }  },	   /* 1/2      */
+      {	 { 0x00BE, "punct"  }, { 0,0,0 }  },	   /* 3/4      */
+      {	 { 0x00BF, "punct"  }, { 0,0,0 }  },	   /* UD ?     */
+      {	 { 0x00C0, "punct"  }, { 0,1,0 }  },	   /* A Grave  */
+      {	 { 0x00D7, "punct"  }, { 0,0,0 }  },	   /* multipl. */
+      {	 { 0x00DF, "punct"  }, { 0,1,0 }  },	   /* small Sh */
+      {	 { 0x00F6, "punct"  }, { 0,1,0 }  },	   /* o dia    */
+      {	 { 0x00F7, "punct"  }, { 0,0,0 }  },	   /* division */
+      {	 { 0x00FF, "punct"  }, { 0,1,0 }  },	   /* y dia    */
+      {	 { 0x009F, "space"  }, { 0,1,0 }  },	   /* CTRL     */
+      {	 { 0x00A0, "space"  }, { 0,1,0 }  },	   /* NB SPACE */
+      {	 { 0x00A1, "space"  }, { 0,1,0 }  },	   /* UD !     */
+      {	 { 0x00B1, "space"  }, { 0,1,0 }  },	   /* +- sign  */
+      {	 { 0x00F8, "space"  }, { 0,1,0 }  },	   /* o stroke */
+      {	 { 0x00B3, "lower"  }, { 0,1,0 }  },	   /* SUP 3    */
+      {	 { 0x00B8, "lower"  }, { 0,1,0 }  },	   /* CEDILLA  */
+      {	 { 0x00BE, "lower"  }, { 0,1,0 }  },	   /* 3/4      */
+      {	 { 0x00C0, "lower"  }, { 0,1,0 }  },	   /* A Grave  */
+      {	 { 0x00D6, "lower"  }, { 0,1,0 }  },	   /* O dia    */
+      {	 { 0x00D8, "lower"  }, { 0,1,0 }  },	   /* O stroke */
+      {	 { 0x00DF, "lower"  }, { 0,0,0 }  },	   /* small Sh */
+      {	 { 0x00E0, "lower"  }, { 0,0,0 }  },	   /* a grave  */
+      {	 { 0x00F6, "lower"  }, { 0,0,0 }  },	   /* o dia    */
+      {	 { 0x00F7, "lower"  }, { 0,1,0 }  },	   /* division */
+      {	 { 0x00F8, "lower"  }, { 0,0,0 }  },	   /* o stroke */
+      {	 { 0x00FF, "lower"  }, { 0,0,0 }  },	   /* y dia    */
+      {	 { 0x00B4, "upper"  }, { 0,1,0 }  },	   /* ACUTE    */
+      {	 { 0x00B8, "upper"  }, { 0,1,0 }  },	   /* CEDILLA  */
+      {	 { 0x00B9, "upper"  }, { 0,1,0 }  },	   /* SUP 1    */
+      {	 { 0x00BE, "upper"  }, { 0,1,0 }  },	   /* 3/4      */
+      {	 { 0x00BF, "upper"  }, { 0,1,0 }  },	   /* UD ?     */
+      {	 { 0x00C0, "upper"  }, { 0,0,0 }  },	   /* A Grave  */
+      {	 { 0x00D6, "upper"  }, { 0,0,0 }  },	   /* O dia    */
+      {	 { 0x00D7, "upper"  }, { 0,1,0 }  },	   /* multipl. */
+      {	 { 0x00D8, "upper"  }, { 0,0,0 }  },	   /* O stroke */
+      {	 { 0x00DF, "upper"  }, { 0,1,0 }  },	   /* small Sh */
+      {	 { 0x00FF, "upper"  }, { 0,1,0 }  },	   /* y dia    */
+      {	 { 0x00B9, "xdigit" }, { 0,1,0 }  },	   /* SUP 1    */
+      {	 { 0x00BC, "xdigit" }, { 0,1,0 }  },	   /* 1/4      */
+      { .is_last = 1 }
+    }
+  },
+  {
+    { Tiswctype, TST_LOC_enUS },
+    {
+      {	 { WEOF,   "alnum"  }, { 0,1,0 }  },
+      {	 { 0x0000, "alnum"  }, { 0,1,0 }  },
+      {	 { 0x001F, "alnum"  }, { 0,1,0 }  },
+      {	 { 0x0020, "alnum"  }, { 0,1,0 }  },
+      {	 { 0x0021, "alnum"  }, { 0,1,0 }  },
+      {	 { 0x002F, "alnum"  }, { 0,1,0 }  },
+      {	 { 0x0030, "alnum"  }, { 0,0,0 }  },
+      {	 { 0x0039, "alnum"  }, { 0,0,0 }  },
+      {	 { 0x003A, "alnum"  }, { 0,1,0 }  },
+      {	 { 0x0040, "alnum"  }, { 0,1,0 }  },
+      {	 { 0x0041, "alnum"  }, { 0,0,0 }  },
+      {	 { 0x005A, "alnum"  }, { 0,0,0 }  },
+      {	 { 0x005B, "alnum"  }, { 0,1,0 }  },
+      {	 { 0x0060, "alnum"  }, { 0,1,0 }  },
+      {	 { 0x0061, "alnum"  }, { 0,0,0 }  },
+      {	 { 0x007A, "alnum"  }, { 0,0,0 }  },
+      {	 { 0x007B, "alnum"  }, { 0,1,0 }  },
+      {	 { 0x007E, "alnum"  }, { 0,1,0 }  },
+      {	 { 0x007F, "alnum"  }, { 0,1,0 }  },
+      {	 { 0x0080, "alnum"  }, { 0,1,0 }  },
+      {	 { 0x0000, "alpha"  }, { 0,1,0 }  },
+      {	 { 0x001F, "alpha"  }, { 0,1,0 }  },
+      {	 { 0x0020, "alpha"  }, { 0,1,0 }  },
+      {	 { 0x0021, "alpha"  }, { 0,1,0 }  },
+      {	 { 0x002F, "alpha"  }, { 0,1,0 }  },
+      {	 { 0x0030, "alpha"  }, { 0,1,0 }  },
+      {	 { 0x0039, "alpha"  }, { 0,1,0 }  },
+      {	 { 0x003A, "alpha"  }, { 0,1,0 }  },
+      {	 { 0x0040, "alpha"  }, { 0,1,0 }  },
+      {	 { 0x0041, "alpha"  }, { 0,0,0 }  },
+      {	 { 0x005A, "alpha"  }, { 0,0,0 }  },
+      {	 { 0x005B, "alpha"  }, { 0,1,0 }  },
+      {	 { 0x0060, "alpha"  }, { 0,1,0 }  },
+      {	 { 0x0061, "alpha"  }, { 0,0,0 }  },
+      {	 { 0x007A, "alpha"  }, { 0,0,0 }  },
+      {	 { 0x007B, "alpha"  }, { 0,1,0 }  },
+      {	 { 0x007E, "alpha"  }, { 0,1,0 }  },
+      {	 { 0x007F, "alpha"  }, { 0,1,0 }  },
+      {	 { 0x0080, "alpha"  }, { 0,1,0 }  },
+      {	 { 0x0009, "blank"  }, { 0,0,0 }  },
+      {	 { 0x000B, "blank"  }, { 0,1,0 }  },
+      {	 { 0x0020, "blank"  }, { 0,0,0 }  },
+      {	 { 0x0000, "cntrl"  }, { 0,0,0 }  },
+      {	 { 0x001F, "cntrl"  }, { 0,0,0 }  },
+      {	 { 0x0020, "cntrl"  }, { 0,1,0 }  },
+      {	 { 0x0021, "cntrl"  }, { 0,1,0 }  },
+      {	 { 0x002F, "cntrl"  }, { 0,1,0 }  },
+      {	 { 0x0030, "cntrl"  }, { 0,1,0 }  },
+      {	 { 0x0039, "cntrl"  }, { 0,1,0 }  },
+      {	 { 0x003A, "cntrl"  }, { 0,1,0 }  },
+      {	 { 0x0040, "cntrl"  }, { 0,1,0 }  },
+      {	 { 0x0041, "cntrl"  }, { 0,1,0 }  },
+      {	 { 0x005A, "cntrl"  }, { 0,1,0 }  },
+      {	 { 0x005B, "cntrl"  }, { 0,1,0 }  },
+      {	 { 0x0060, "cntrl"  }, { 0,1,0 }  },
+      {	 { 0x0061, "cntrl"  }, { 0,1,0 }  },
+      {	 { 0x007A, "cntrl"  }, { 0,1,0 }  },
+      {	 { 0x007B, "cntrl"  }, { 0,1,0 }  },
+      {	 { 0x007E, "cntrl"  }, { 0,1,0 }  },
+      {	 { 0x007F, "cntrl"  }, { 0,0,0 }  },
+      {	 { 0x0080, "cntrl"  }, { 0,1,0 }  },
+      {	 { 0x0000, "digit"  }, { 0,1,0 }  },
+      {	 { 0x001F, "digit"  }, { 0,1,0 }  },
+      {	 { 0x0020, "digit"  }, { 0,1,0 }  },
+      {	 { 0x0021, "digit"  }, { 0,1,0 }  },
+      {	 { 0x002F, "digit"  }, { 0,1,0 }  },
+      {	 { 0x0030, "digit"  }, { 0,0,0 }  },
+      {	 { 0x0039, "digit"  }, { 0,0,0 }  },
+      {	 { 0x003A, "digit"  }, { 0,1,0 }  },
+      {	 { 0x0040, "digit"  }, { 0,1,0 }  },
+      {	 { 0x0041, "digit"  }, { 0,1,0 }  },
+      {	 { 0x005A, "digit"  }, { 0,1,0 }  },
+      {	 { 0x005B, "digit"  }, { 0,1,0 }  },
+      {	 { 0x0060, "digit"  }, { 0,1,0 }  },
+      {	 { 0x0061, "digit"  }, { 0,1,0 }  },
+      {	 { 0x007A, "digit"  }, { 0,1,0 }  },
+      {	 { 0x007B, "digit"  }, { 0,1,0 }  },
+      {	 { 0x007E, "digit"  }, { 0,1,0 }  },
+      {	 { 0x007F, "digit"  }, { 0,1,0 }  },
+      {	 { 0x0080, "digit"  }, { 0,1,0 }  },
+      {	 { 0x0000, "graph"  }, { 0,1,0 }  },
+      {	 { 0x001F, "graph"  }, { 0,1,0 }  },
+      {	 { 0x0020, "graph"  }, { 0,1,0 }  },
+      {	 { 0x0021, "graph"  }, { 0,0,0 }  },
+      {	 { 0x002F, "graph"  }, { 0,0,0 }  },
+      {	 { 0x0030, "graph"  }, { 0,0,0 }  },
+      {	 { 0x0039, "graph"  }, { 0,0,0 }  },
+      {	 { 0x003A, "graph"  }, { 0,0,0 }  },
+      {	 { 0x0040, "graph"  }, { 0,0,0 }  },
+      {	 { 0x0041, "graph"  }, { 0,0,0 }  },
+      {	 { 0x005A, "graph"  }, { 0,0,0 }  },
+      {	 { 0x005B, "graph"  }, { 0,0,0 }  },
+      {	 { 0x0060, "graph"  }, { 0,0,0 }  },
+      {	 { 0x0061, "graph"  }, { 0,0,0 }  },
+      {	 { 0x007A, "graph"  }, { 0,0,0 }  },
+      {	 { 0x007B, "graph"  }, { 0,0,0 }  },
+      {	 { 0x007E, "graph"  }, { 0,0,0 }  },
+      {	 { 0x007F, "graph"  }, { 0,1,0 }  },
+      {	 { 0x0080, "graph"  }, { 0,1,0 }  },
+      {	 { 0x0000, "print"  }, { 0,1,0 }  },
+      {	 { 0x001F, "print"  }, { 0,1,0 }  },
+      {	 { 0x0020, "print"  }, { 0,0,0 }  },
+      {	 { 0x0021, "print"  }, { 0,0,0 }  },
+      {	 { 0x002F, "print"  }, { 0,0,0 }  },
+      {	 { 0x0030, "print"  }, { 0,0,0 }  },
+      {	 { 0x0039, "print"  }, { 0,0,0 }  },
+      {	 { 0x003A, "print"  }, { 0,0,0 }  },
+      {	 { 0x0040, "print"  }, { 0,0,0 }  },
+      {	 { 0x0041, "print"  }, { 0,0,0 }  },
+      {	 { 0x005A, "print"  }, { 0,0,0 }  },
+      {	 { 0x005B, "print"  }, { 0,0,0 }  },
+      {	 { 0x0060, "print"  }, { 0,0,0 }  },
+      {	 { 0x0061, "print"  }, { 0,0,0 }  },
+      {	 { 0x007A, "print"  }, { 0,0,0 }  },
+      {	 { 0x007B, "print"  }, { 0,0,0 }  },
+      {	 { 0x007E, "print"  }, { 0,0,0 }  },
+      {	 { 0x007F, "print"  }, { 0,1,0 }  },
+      {	 { 0x0080, "print"  }, { 0,1,0 }  },
+      {	 { 0x0000, "punct"  }, { 0,1,0 }  },
+      {	 { 0x001F, "punct"  }, { 0,1,0 }  },
+      {	 { 0x0020, "punct"  }, { 0,1,0 }  },
+      {	 { 0x0021, "punct"  }, { 0,0,0 }  },
+      {	 { 0x002F, "punct"  }, { 0,0,0 }  },
+      {	 { 0x0030, "punct"  }, { 0,1,0 }  },
+      {	 { 0x0039, "punct"  }, { 0,1,0 }  },
+      {	 { 0x003A, "punct"  }, { 0,0,0 }  },
+      {	 { 0x0040, "punct"  }, { 0,0,0 }  },
+      {	 { 0x0041, "punct"  }, { 0,1,0 }  },
+      {	 { 0x005A, "punct"  }, { 0,1,0 }  },
+      {	 { 0x005B, "punct"  }, { 0,0,0 }  },
+      {	 { 0x0060, "punct"  }, { 0,0,0 }  },
+      {	 { 0x0061, "punct"  }, { 0,1,0 }  },
+      {	 { 0x007A, "punct"  }, { 0,1,0 }  },
+      {	 { 0x007B, "punct"  }, { 0,0,0 }  },
+      {	 { 0x007E, "punct"  }, { 0,0,0 }  },
+      {	 { 0x007F, "punct"  }, { 0,1,0 }  },
+      {	 { 0x0080, "punct"  }, { 0,1,0 }  },
+      {	 { 0x0000, "space"  }, { 0,1,0 }  },
+      {	 { 0x001F, "space"  }, { 0,1,0 }  },
+      {	 { 0x0020, "space"  }, { 0,0,0 }  },
+      {	 { 0x0021, "space"  }, { 0,1,0 }  },
+      {	 { 0x002F, "space"  }, { 0,1,0 }  },
+      {	 { 0x007E, "space"  }, { 0,1,0 }  },
+      {	 { 0x007F, "space"  }, { 0,1,0 }  },
+      {	 { 0x0080, "space"  }, { 0,1,0 }  },
+      {	 { 0x0000, "lower"  }, { 0,1,0 }  },
+      {	 { 0x001F, "lower"  }, { 0,1,0 }  },
+      {	 { 0x0020, "lower"  }, { 0,1,0 }  },
+      {	 { 0x0021, "lower"  }, { 0,1,0 }  },
+      {	 { 0x002F, "lower"  }, { 0,1,0 }  },
+      {	 { 0x0030, "lower"  }, { 0,1,0 }  },
+      {	 { 0x0039, "lower"  }, { 0,1,0 }  },
+      {	 { 0x003A, "lower"  }, { 0,1,0 }  },
+      {	 { 0x0040, "lower"  }, { 0,1,0 }  },
+      {	 { 0x0041, "lower"  }, { 0,1,0 }  },
+      {	 { 0x005A, "lower"  }, { 0,1,0 }  },
+      {	 { 0x005B, "lower"  }, { 0,1,0 }  },
+      {	 { 0x0060, "lower"  }, { 0,1,0 }  },
+      {	 { 0x0061, "lower"  }, { 0,0,0 }  },
+      {	 { 0x007A, "lower"  }, { 0,0,0 }  },
+      {	 { 0x007B, "lower"  }, { 0,1,0 }  },
+      {	 { 0x007E, "lower"  }, { 0,1,0 }  },
+      {	 { 0x007F, "lower"  }, { 0,1,0 }  },
+      {	 { 0x0080, "lower"  }, { 0,1,0 }  },
+      {	 { 0x0000, "upper"  }, { 0,1,0 }  },
+      {	 { 0x001F, "upper"  }, { 0,1,0 }  },
+      {	 { 0x0020, "upper"  }, { 0,1,0 }  },
+      {	 { 0x0021, "upper"  }, { 0,1,0 }  },
+      {	 { 0x002F, "upper"  }, { 0,1,0 }  },
+      {	 { 0x0030, "upper"  }, { 0,1,0 }  },
+      {	 { 0x0039, "upper"  }, { 0,1,0 }  },
+      {	 { 0x003A, "upper"  }, { 0,1,0 }  },
+      {	 { 0x0040, "upper"  }, { 0,1,0 }  },
+      {	 { 0x0041, "upper"  }, { 0,0,0 }  },
+      {	 { 0x005A, "upper"  }, { 0,0,0 }  },
+      {	 { 0x005B, "upper"  }, { 0,1,0 }  },
+      {	 { 0x0060, "upper"  }, { 0,1,0 }  },
+      {	 { 0x0061, "upper"  }, { 0,1,0 }  },
+      {	 { 0x007A, "upper"  }, { 0,1,0 }  },
+      {	 { 0x007B, "upper"  }, { 0,1,0 }  },
+      {	 { 0x007E, "upper"  }, { 0,1,0 }  },
+      {	 { 0x007F, "upper"  }, { 0,1,0 }  },
+      {	 { 0x0080, "upper"  }, { 0,1,0 }  },
+      {	 { 0x0000, "xdigit" }, { 0,1,0 }  },
+      {	 { 0x001F, "xdigit" }, { 0,1,0 }  },
+      {	 { 0x0020, "xdigit" }, { 0,1,0 }  },
+      {	 { 0x0021, "xdigit" }, { 0,1,0 }  },
+      {	 { 0x002F, "xdigit" }, { 0,1,0 }  },
+      {	 { 0x0030, "xdigit" }, { 0,0,0 }  },
+      {	 { 0x0039, "xdigit" }, { 0,0,0 }  },
+      {	 { 0x003A, "xdigit" }, { 0,1,0 }  },
+      {	 { 0x0040, "xdigit" }, { 0,1,0 }  },
+      {	 { 0x0041, "xdigit" }, { 0,0,0 }  },
+      {	 { 0x005A, "xdigit" }, { 0,1,0 }  },
+      {	 { 0x005B, "xdigit" }, { 0,1,0 }  },
+      {	 { 0x0060, "xdigit" }, { 0,1,0 }  },
+      {	 { 0x0061, "xdigit" }, { 0,0,0 }  },
+      {	 { 0x007A, "xdigit" }, { 0,1,0 }  },
+      {	 { 0x007B, "xdigit" }, { 0,1,0 }  },
+      {	 { 0x007E, "xdigit" }, { 0,1,0 }  },
+      {	 { 0x007F, "xdigit" }, { 0,1,0 }  },
+      {	 { 0x0080, "xdigit" }, { 0,1,0 }  },
+      {	 { 0x0061, "xxxxxx" }, { 0,1,0 }  },
+      { .is_last = 1 }
+    }
+  },
+  {
+#if 0
+    { Tiswctype, TST_LOC_eucJP },
+#else
+    { Tiswctype, TST_LOC_ja_UTF8 },
+#endif
+    {
+#ifdef SHOJI_IS_RIGHT
+      {	 { 0x3029, "alnum"  }, { 0,1,0 }  },	   /* Hangzhou NUM9	 */
+#else
+      {	 { 0x3029, "alnum"  }, { 0,0,0 }  },	   /* Hangzhou NUM9	 */
+#endif
+      {	 { 0xFE4F, "alnum"  }, { 0,1,0 }  },	   /* CJK UNI.IDEO.	 */
+      {	 { 0xFF19, "alnum"  }, { 0,0,0 }  },	   /* FULL 9		 */
+      {	 { 0xFF20, "alnum"  }, { 0,1,0 }  },	   /* FULL @		 */
+      {	 { 0xFF3A, "alnum"  }, { 0,0,0 }  },	   /* FULL Z		 */
+      {	 { 0xFF40, "alnum"  }, { 0,1,0 }  },	   /* FULL GRAVE ACC.	 */
+      {	 { 0xFF5A, "alnum"  }, { 0,0,0 }  },	   /* FULL z		 */
+#ifdef SHOJI_IS_RIGHT
+      {	 { 0xFF71, "alnum"  }, { 0,1,0 }  },	   /* HALF KATA A	 */
+#else
+      {	 { 0xFF71, "alnum"  }, { 0,0,0 }  },	   /* HALF KATA A	 */
+#endif
+#ifdef SHOJI_IS_RIGHT
+      {	 { 0x3029, "alpha"  }, { 0,1,0 }  },	   /* Hangzhou NUM9	 */
+#else
+      {	 { 0x3029, "alpha"  }, { 0,0,0 }  },	   /* Hangzhou NUM9	 */
+#endif
+      {	 { 0xFE4F, "alpha"  }, { 0,1,0 }  },	   /* CJK UNI.IDEO.	 */
+#ifdef SHOJI_IS_RIGHT
+      {	 { 0xFF19, "alpha"  }, { 0,1,0 }  },	   /* FULL 9		 */
+#else
+      {	 { 0xFF19, "alpha"  }, { 0,0,0 }  },	   /* FULL 9		 */
+#endif
+      {	 { 0xFF20, "alpha"  }, { 0,1,0 }  },	   /* FULL @		 */
+      {	 { 0xFF3A, "alpha"  }, { 0,0,0 }  },	   /* FULL Z		 */
+      {	 { 0xFF40, "alpha"  }, { 0,1,0 }  },	   /* FULL GRAVE ACC.	 */
+      {	 { 0xFF5A, "alpha"  }, { 0,0,0 }  },	   /* FULL z		 */
+#ifdef SHOJI_IS_RIGHT
+      {	 { 0xFF71, "alpha"  }, { 0,1,0 }  },	   /* HALF KATA A	 */
+#else
+      {	 { 0xFF71, "alpha"  }, { 0,0,0 }  },	   /* HALF KATA A	 */
+#endif
+      {	 { 0x0080, "cntrl"  }, { 0,0,0 }  },	   /* CNTRL		 */
+      {	 { 0x3000, "cntrl"  }, { 0,1,0 }  },	   /* IDEO. SPACE	 */
+      {	 { 0x3029, "digit"  }, { 0,1,0 }  },	   /* Hangzhou NUM9	 */
+      {	 { 0x32CB, "digit"  }, { 0,1,0 }  },	   /* IDEO.TEL.SYM.DEC12 */
+      /* 21: */
+      {	 { 0x33FE, "digit"  }, { 0,1,0 }  },	   /* CJK IDEO.TEL.31th	 */
+      {	 { 0xFF19, "digit"  }, { 0,1,0 }  },	   /* FULL 9		 */
+      {	 { 0x3000, "graph"  }, { 0,1,0 }  },	   /* IDEO. SPACE	 */
+#ifdef SHOJI_IS_RIGHT
+      {	 { 0x3020, "graph"  }, { 0,1,0 }  },	   /* POSTAL MARK FACE	 */
+      {	 { 0x3029, "graph"  }, { 0,1,0 }  },	   /* Hangzhou NUM9	 */
+      {	 { 0x302F, "graph"  }, { 0,1,0 }  },	   /* Diacritics(Hangul) */
+      {	 { 0x3037, "graph"  }, { 0,1,0 }  },	   /* Separator Symbol	 */
+      {	 { 0x303F, "graph"  }, { 0,1,0 }  },	   /* IDEO. HALF SPACE	 */
+#else
+      {	 { 0x3020, "graph"  }, { 0,0,0 }  },	   /* POSTAL MARK FACE	 */
+      {	 { 0x3029, "graph"  }, { 0,0,0 }  },	   /* Hangzhou NUM9	 */
+      {	 { 0x302F, "graph"  }, { 0,0,0 }  },	   /* Diacritics(Hangul) */
+      {	 { 0x3037, "graph"  }, { 0,0,0 }  },	   /* Separator Symbol	 */
+      {	 { 0x303F, "graph"  }, { 0,0,0 }  },	   /* IDEO. HALF SPACE	 */
+#endif
+      /* 29: */
+      {	 { 0x3041, "graph"  }, { 0,0,0 }  },	   /* HIRAGANA a	 */
+      /* Non jis: */
+#ifdef SHOJI_IS_RIGHT
+      {	 { 0x3094, "graph"  }, { 0,1,0 }  },	   /* HIRAGANA u"	 */
+#else
+      {	 { 0x3094, "graph"  }, { 0,0,0 }  },	   /* HIRAGANA u"	 */
+#endif
+      /* Non jis: */
+#ifdef SHOJI_IS_RIGHT
+      {	 { 0x3099, "graph"  }, { 0,1,0 }  },	   /* SOUND MARK	 */
+#else
+      {	 { 0x3099, "graph"  }, { 0,0,0 }  },	   /* SOUND MARK	 */
+#endif
+      {	 { 0x309E, "graph"  }, { 0,0,0 }  },	   /* ITERATION MARK	 */
+      /* 33: */
+      {	 { 0x30A1, "graph"  }, { 0,0,0 }  },	   /* KATAKANA a	 */
+      /* Non jis: */
+#ifdef SHOJI_IS_RIGHT
+      {	 { 0x30FA, "graph"  }, { 0,1,0 }  },	   /* KATAKANA wo"	 */
+#else
+      {	 { 0x30FA, "graph"  }, { 0,0,0 }  },	   /* KATAKANA wo"	 */
+#endif
+      {	 { 0x30FB, "graph"  }, { 0,0,0 }  },	   /* KATAKANA MID.DOT	 */
+      {	 { 0x30FE, "graph"  }, { 0,0,0 }  },	   /* KATAKANA ITERATION */
+#ifdef SHOJI_IS_RIGHT
+      {	 { 0x3191, "graph"  }, { 0,1,0 }  },	   /* KANBUN REV.MARK	 */
+      {	 { 0x3243, "graph"  }, { 0,1,0 }  },	   /* IDEO. MARK (reach) */
+      {	 { 0x32CB, "graph"  }, { 0,1,0 }  },	   /* IDEO.TEL.SYM.DEC12 */
+      {	 { 0x32FE, "graph"  }, { 0,1,0 }  },	   /* MARU KATAKANA wo	 */
+      {	 { 0x33FE, "graph"  }, { 0,1,0 }  },	   /* CJK IDEO.TEL.31th	 */
+#else
+      {	 { 0x3191, "graph"  }, { 0,0,0 }  },	   /* KANBUN REV.MARK	 */
+      {	 { 0x3243, "graph"  }, { 0,0,0 }  },	   /* IDEO. MARK (reach) */
+      {	 { 0x32CB, "graph"  }, { 0,0,0 }  },	   /* IDEO.TEL.SYM.DEC12 */
+      {	 { 0x32FE, "graph"  }, { 0,0,0 }  },	   /* MARU KATAKANA wo	 */
+      {	 { 0x33FE, "graph"  }, { 0,0,0 }  },	   /* CJK IDEO.TEL.31th	 */
+#endif
+      {	 { 0x4E00, "graph"  }, { 0,0,0 }  },	   /* CJK UNI.IDEO.	 */
+      {	 { 0x4E05, "graph"  }, { 0,0,0 }  },	   /* CJK UNI.IDEO.	 */
+#ifdef SHOJI_IS_RIGHT
+      {	 { 0x4E06, "graph"  }, { 0,1,0 }  },	   /* CJK UNI.IDEO.NON-J */
+#else
+      {	 { 0x4E06, "graph"  }, { 0,0,0 }  },	   /* CJK UNI.IDEO.NON-J */
+#endif
+      {	 { 0x4E07, "graph"  }, { 0,0,0 }  },	   /* CJK UNI.IDEO.	 */
+      {	 { 0x4FFF, "graph"  }, { 0,0,0 }  },	   /* CJK UNI.IDEO.	 */
+      {	 { 0x9000, "graph"  }, { 0,0,0 }  },	   /* CJK UNI.IDEO.	 */
+      {	 { 0x9006, "graph"  }, { 0,0,0 }  },	   /* CJK UNI.IDEO.	 */
+#ifdef SHOJI_IS_RIGHT
+      {	 { 0x9007, "graph"  }, { 0,1,0 }  },	   /* CJK UNI.IDEO.NON-J */
+      {	 { 0x9FA4, "graph"  }, { 0,1,0 }  },	   /* CJK UNI.IDEO.NON-J */
+#else
+      {	 { 0x9007, "graph"  }, { 0,0,0 }  },	   /* CJK UNI.IDEO.NON-J */
+      {	 { 0x9FA4, "graph"  }, { 0,0,0 }  },	   /* CJK UNI.IDEO.NON-J */
+#endif
+      /* 51 */
+      {	 { 0x9FA5, "graph"  }, { 0,0,0 }  },	   /* CJK UNI.IDEO.	 */
+      /* Non jis: */
+#ifdef SHOJI_IS_RIGHT
+      {	 { 0xFE4F, "graph"  }, { 0,1,0 }  },	   /* CJK UNI.IDEO.	 */
+#else
+      {	 { 0xFE4F, "graph"  }, { 0,0,0 }  },	   /* CJK UNI.IDEO.	 */
+#endif
+      {	 { 0xFF0F, "graph"  }, { 0,0,0 }  },	   /* FULL SLASH	 */
+      {	 { 0xFF19, "graph"  }, { 0,0,0 }  },	   /* FULL 9		 */
+      {	 { 0xFF20, "graph"  }, { 0,0,0 }  },	   /* FULL @		 */
+      {	 { 0xFF3A, "graph"  }, { 0,0,0 }  },	   /* FULL Z		 */
+      {	 { 0xFF40, "graph"  }, { 0,0,0 }  },	   /* FULL GRAVE ACC.	 */
+      {	 { 0xFF5A, "graph"  }, { 0,0,0 }  },	   /* FULL z		 */
+      {	 { 0xFF5E, "graph"  }, { 0,0,0 }  },	   /* FULL ~ (tilde)	 */
+      {	 { 0xFF61, "graph"  }, { 0,0,0 }  },	   /* HALF IDEO.STOP. .	 */
+      {	 { 0xFF65, "graph"  }, { 0,0,0 }  },	   /* HALF KATA MID.DOT	 */
+      {	 { 0xFF66, "graph"  }, { 0,0,0 }  },	   /* HALF KATA WO	 */
+      {	 { 0xFF6F, "graph"  }, { 0,0,0 }  },	   /* HALF KATA tu	 */
+      {	 { 0xFF70, "graph"  }, { 0,0,0 }  },	   /* HALF KATA PL -	 */
+      {	 { 0xFF71, "graph"  }, { 0,0,0 }  },	   /* HALF KATA A	 */
+      {	 { 0xFF9E, "graph"  }, { 0,0,0 }  },	   /* HALF KATA MI	 */
+      {	 { 0x3000, "print"  }, { 0,0,0 }  },	   /* IDEO. SPACE	 */
+#ifdef SHOJI_IS_RIGHT
+      {	 { 0x3020, "print"  }, { 0,1,0 }  },	   /* POSTAL MARK FACE	 */
+      {	 { 0x3029, "print"  }, { 0,1,0 }  },	   /* Hangzhou NUM9	 */
+      {	 { 0x302F, "print"  }, { 0,1,0 }  },	   /* Diacritics(Hangul) */
+      {	 { 0x3037, "print"  }, { 0,1,0 }  },	   /* Separator Symbol	 */
+#else
+      {	 { 0x3020, "print"  }, { 0,0,0 }  },	   /* POSTAL MARK FACE	 */
+      {	 { 0x3029, "print"  }, { 0,0,0 }  },	   /* Hangzhou NUM9	 */
+      {	 { 0x302F, "print"  }, { 0,0,0 }  },	   /* Diacritics(Hangul) */
+      {	 { 0x3037, "print"  }, { 0,0,0 }  },	   /* Separator Symbol	 */
+#endif
+      {	 { 0x4E00, "print"  }, { 0,0,0 }  },	   /* CJK UNI.IDEO.	 */
+      {	 { 0x4E05, "print"  }, { 0,0,0 }  },	   /* CJK UNI.IDEO.	 */
+#ifdef SHOJI_IS_RIGHT
+      {	 { 0x4E06, "print"  }, { 0,1,0 }  },	   /* CJK UNI.IDEO.NON-J */
+#else
+      {	 { 0x4E06, "print"  }, { 0,0,0 }  },	   /* CJK UNI.IDEO.NON-J */
+#endif
+      {	 { 0x4E07, "print"  }, { 0,0,0 }  },	   /* CJK UNI.IDEO.	 */
+      {	 { 0x4FFF, "print"  }, { 0,0,0 }  },	   /* CJK UNI.IDEO.	 */
+      {	 { 0x9000, "print"  }, { 0,0,0 }  },	   /* CJK UNI.IDEO.	 */
+      {	 { 0x9006, "print"  }, { 0,0,0 }  },	   /* CJK UNI.IDEO.	 */
+#ifdef SHOJI_IS_RIGHT
+      {	 { 0x9007, "print"  }, { 0,1,0 }  },	   /* CJK UNI.IDEO.NON-J */
+      {	 { 0x9FA4, "print"  }, { 0,1,0 }  },	   /* CJK UNI.IDEO.NON-J */
+#else
+      {	 { 0x9007, "print"  }, { 0,0,0 }  },	   /* CJK UNI.IDEO.NON-J */
+      {	 { 0x9FA4, "print"  }, { 0,0,0 }  },	   /* CJK UNI.IDEO.NON-J */
+#endif
+      /* 81: */
+      {	 { 0x9FA5, "print"  }, { 0,0,0 }  },	   /* CJK UNI.IDEO.	 */
+      /* Non jis: */
+#ifdef SHOJI_IS_RIGHT
+      {	 { 0xFE4F, "print"  }, { 0,1,0 }  },	   /* CJK UNI.IDEO.	 */
+#else
+      {	 { 0xFE4F, "print"  }, { 0,0,0 }  },	   /* CJK UNI.IDEO.	 */
+#endif
+      {	 { 0x3000, "punct"  }, { 0,1,0 }  },	   /* IDEO. SPACE	 */
+#ifdef SHOJI_IS_RIGHT
+      {	 { 0x3020, "punct"  }, { 0,1,0 }  },	   /* POSTAL MARK FACE	 */
+      {	 { 0x302F, "punct"  }, { 0,1,0 }  },	   /* Diacritics(Hangul) */
+      {	 { 0x3037, "punct"  }, { 0,1,0 }  },	   /* FEED Separator	 */
+      {	 { 0x303F, "punct"  }, { 0,1,0 }  },	   /* IDEO. HALF SPACE	 */
+#else
+      {	 { 0x3020, "punct"  }, { 0,0,0 }  },	   /* POSTAL MARK FACE	 */
+      {	 { 0x302F, "punct"  }, { 0,0,0 }  },	   /* Diacritics(Hangul) */
+      {	 { 0x3037, "punct"  }, { 0,0,0 }  },	   /* FEED Separator	 */
+      {	 { 0x303F, "punct"  }, { 0,0,0 }  },	   /* IDEO. HALF SPACE	 */
+#endif
+      {	 { 0x3041, "punct"  }, { 0,1,0 }  },	   /* HIRAGANA a	 */
+      {	 { 0x3094, "punct"  }, { 0,1,0 }  },	   /* HIRAGANA u"	 */
+      /* 90: */
+#ifdef SHOJI_IS_RIGHT
+      {	 { 0x3099, "punct"  }, { 0,1,0 }  },	   /* SOUND MARK	 */
+#else
+      {	 { 0x3099, "punct"  }, { 0,0,0 }  },	   /* SOUND MARK	 */
+#endif
+      {	 { 0x309E, "punct"  }, { 0,1,0 }  },	   /* ITERATION MARK	 */
+      {	 { 0x30A1, "punct"  }, { 0,1,0 }  },	   /* KATAKANA a	 */
+      {	 { 0x30FA, "punct"  }, { 0,1,0 }  },	   /* KATAKANA wo"	 */
+      {	 { 0x30FB, "punct"  }, { 0,0,0 }  },	   /* KATAKANA MID.DOT	 */
+      /* 95: */
+      {	 { 0x30FE, "punct"  }, { 0,1,0 }  },	   /* KATAKANA ITERATION */
+#ifdef SHOJI_IS_RIGHT
+      {	 { 0x3191, "punct"  }, { 0,1,0 }  },	   /* KANBUN REV.MARK	 */
+      {	 { 0x3243, "punct"  }, { 0,1,0 }  },	   /* IDEO. MARK (reach) */
+      {	 { 0x32CB, "punct"  }, { 0,1,0 }  },	   /* IDEO.TEL.SYM.DEC12 */
+      {	 { 0x32FE, "punct"  }, { 0,1,0 }  },	   /* MARU KATAKANA wo	 */
+      {	 { 0x33FE, "punct"  }, { 0,1,0 }  },	   /* CJK IDEO.TEL.31th	 */
+#else
+      {	 { 0x3191, "punct"  }, { 0,0,0 }  },	   /* KANBUN REV.MARK	 */
+      {	 { 0x3243, "punct"  }, { 0,0,0 }  },	   /* IDEO. MARK (reach) */
+      {	 { 0x32CB, "punct"  }, { 0,0,0 }  },	   /* IDEO.TEL.SYM.DEC12 */
+      {	 { 0x32FE, "punct"  }, { 0,0,0 }  },	   /* MARU KATAKANA wo	 */
+      {	 { 0x33FE, "punct"  }, { 0,0,0 }  },	   /* CJK IDEO.TEL.31th	 */
+#endif
+      {	 { 0x9007, "punct"  }, { 0,1,0 }  },	   /* CJK UNI.IDEO.NON-J */
+      {	 { 0x9FA4, "punct"  }, { 0,1,0 }  },	   /* CJK UNI.IDEO.NON-J */
+      {	 { 0x9FA5, "punct"  }, { 0,1,0 }  },	   /* CJK UNI.IDEO.	 */
+      {	 { 0xFF0F, "punct"  }, { 0,0,0 }  },	   /* FULL SLASH	 */
+      /* 105: */
+      {	 { 0xFF19, "punct"  }, { 0,1,0 }  },	   /* FULL 9		 */
+      {	 { 0xFF20, "punct"  }, { 0,0,0 }  },	   /* FULL @		 */
+      {	 { 0xFF3A, "punct"  }, { 0,1,0 }  },	   /* FULL Z		 */
+      {	 { 0xFF40, "punct"  }, { 0,0,0 }  },	   /* FULL GRAVE ACC.	 */
+      {	 { 0xFF5A, "punct"  }, { 0,1,0 }  },	   /* FULL z		 */
+      {	 { 0xFF5E, "punct"  }, { 0,0,0 }  },	   /* FULL ~ (tilde)	 */
+      {	 { 0xFF61, "punct"  }, { 0,0,0 }  },	   /* HALF IDEO.STOP. .	 */
+      {	 { 0xFF65, "punct"  }, { 0,0,0 }  },	   /* HALF KATA MID.DOT	 */
+      {	 { 0xFF70, "punct"  }, { 0,1,0 }  },	   /* HALF KATA PL -	 */
+      {	 { 0xFF9E, "punct"  }, { 0,1,0 }  },	   /* HALF KATA MI	 */
+      /* 115: */
+      {	 { 0x3000, "space"  }, { 0,0,0 }  },	   /* IDEO. SPACE	 */
+      {	 { 0x303F, "space"  }, { 0,1,0 }  },	   /* IDEO. HALF SPACE	 */
+      {	 { 0x3041, "lower"  }, { 0,1,0 }  },	   /* HIRAGANA a	 */
+      {	 { 0x3094, "lower"  }, { 0,1,0 }  },	   /* HIRAGANA u"	 */
+      {	 { 0x30A1, "lower"  }, { 0,1,0 }  },	   /* KATAKANA a	 */
+      {	 { 0x30FA, "lower"  }, { 0,1,0 }  },	   /* KATAKANA wo"	 */
+      {	 { 0xFF66, "lower"  }, { 0,1,0 }  },	   /* HALF KATA WO	 */
+      {	 { 0xFF6F, "lower"  }, { 0,1,0 }  },	   /* HALF KATA tu	 */
+      {	 { 0xFF70, "lower"  }, { 0,1,0 }  },	   /* HALF KATA PL -	 */
+      /* 124: */
+      {	 { 0xFF71, "lower"  }, { 0,1,0 }  },	   /* HALF KATA A	 */
+      {	 { 0xFF9E, "lower"  }, { 0,1,0 }  },	   /* HALF KATA MI	 */
+      {	 { 0xFF71, "upper"  }, { 0,1,0 }  },	   /* HALF KATA A	 */
+      {	 { 0xFF19, "xdigit" }, { 0,1,0 }  },	   /* FULL 9		 */
+      {	 { 0x3000, "jspace" }, { 0,0,0 }  },	   /* IDEO. SPACE	 */
+      /* Non jis? */
+      {	 { 0x303F, "jspace" }, { 0,1,0 }  },	   /* IDEO.HALF SPACE	 */
+      {	 { 0xFF19, "jdigit" }, { 0,0,0 }  },	   /* FULL 9		 */
+      {	 { 0x3041, "jhira"  }, { 0,0,0 }  },	   /* HIRAGANA a	 */
+      {	 { 0x3094, "jhira"  }, { 0,1,0 }  },	   /* HIRAGANA u"	 */
+      {	 { 0x30A1, "jkata"  }, { 0,0,0 }  },	   /* KATAKANA a	 */
+      /* Non jis: */
+      {	 { 0x30FA, "jkata"  }, { 0,1,0 }  },	   /* KATAKANA wo"	 */
+      {	 { 0xFF66, "jkata"  }, { 0,0,0 }  },	   /* HALF KATA WO	 */
+      {	 { 0xFF6F, "jkata"  }, { 0,0,0 }  },	   /* HALF KATA tu	 */
+      {	 { 0x4E05, "jkanji" }, { 0,0,0 }  },	   /* CJK UNI.IDEO.	 */
+#ifdef SHOJI_IS_RIGHT
+      /* <NO_WAIVER>: */
+      {	 { 0x4E06, "jkanji" }, { 0,1,1 }  },	   /* CJK UNI.IDEO.NON-J */
+#else
+      /* XXX This character does not exist in EUC-JP.  */
+      {	 { 0x4E06, "jkanji" }, { 0,1,0 }  },	   /* CJK UNI.IDEO.NON-J */
+#endif
+      {	 { 0x4E07, "jkanji" }, { 0,0,0 }  },	   /* CJK UNI.IDEO.	 */
+      { .is_last = 1 }
+    }
+  },
+  {
+    { Tiswctype, TST_LOC_end }
+  }
+};
+
+
+/* dat_isw-funcs.c */
diff --git a/ap/build/uClibc/test/locale-mbwc/dat_iswdigit.c b/ap/build/uClibc/test/locale-mbwc/dat_iswdigit.c
new file mode 100644
index 0000000..70ca544
--- /dev/null
+++ b/ap/build/uClibc/test/locale-mbwc/dat_iswdigit.c
@@ -0,0 +1,125 @@
+/*
+ *  TEST SUITE FOR MB/WC FUNCTIONS IN C LIBRARY
+ *
+ *	 FILE:	dat_iswdigit.c
+ *
+ *	 ISW*:	int iswdigit (wint_t wc);
+ */
+
+
+#include "dat_isw-funcs.h"
+
+
+TST_ISW_LOC (DIGIT, digit) = {
+
+  {   TST_ISW_REC (de, digit)
+      {
+	{  { 0x0080 }, { 0,1,0 }  },	/* CTRL	    */
+	{  { 0x009F }, { 0,1,0 }  },	/* CTRL	    */
+	{  { 0x00A0 }, { 0,1,0 }  },	/* NB SPACE */
+	{  { 0x00A1 }, { 0,1,0 }  },	/* UD !	    */
+	{  { 0x00B0 }, { 0,1,0 }  },	/* Degree   */
+	{  { 0x00B1 }, { 0,1,0 }  },	/* +- sign  */
+	{  { 0x00B2 }, { 0,1,0 }  },	/* SUP 2    */
+	{  { 0x00B3 }, { 0,1,0 }  },	/* SUP 3    */
+	{  { 0x00B4 }, { 0,1,0 }  },	/* ACUTE    */
+	{  { 0x00B8 }, { 0,1,0 }  },	/* CEDILLA  */
+	{  { 0x00B9 }, { 0,1,0 }  },	/* SUP 1    */
+	{  { 0x00BB }, { 0,1,0 }  },	/* >>	    */
+	{  { 0x00BC }, { 0,1,0 }  },	/* 1/4	    */
+	{  { 0x00BD }, { 0,1,0 }  },	/* 1/2	    */
+	{  { 0x00BE }, { 0,1,0 }  },	/* 3/4	    */
+	{  { 0x00BF }, { 0,1,0 }  },	/* UD ?	    */
+	{  { 0x00C0 }, { 0,1,0 }  },	/* A Grave  */
+	{  { 0x00D6 }, { 0,1,0 }  },	/* O dia    */
+	{  { 0x00D7 }, { 0,1,0 }  },	/* multipl. */
+	{  { 0x00D8 }, { 0,1,0 }  },	/* O stroke */
+	{  { 0x00DF }, { 0,1,0 }  },	/* small Sh */
+	{  { 0x00E0 }, { 0,1,0 }  },	/* a grave  */
+	{  { 0x00F6 }, { 0,1,0 }  },	/* o dia    */
+	{  { 0x00F7 }, { 0,1,0 }  },	/* division */
+	{  { 0x00F8 }, { 0,1,0 }  },	/* o stroke */
+	{  { 0x00FF }, { 0,1,0 }  },	/* y dia    */
+	{ .is_last = 1 }		/* Last element.  */
+      }
+  },
+  {   TST_ISW_REC (enUS, digit)
+      {
+	{  { WEOF   }, { 0,1,0 }  },
+	{  { 0x0000 }, { 0,1,0 }  },
+	{  { 0x001F }, { 0,1,0 }  },
+	{  { 0x0020 }, { 0,1,0 }  },
+	{  { 0x0021 }, { 0,1,0 }  },
+	{  { 0x002F }, { 0,1,0 }  },
+	{  { 0x0030 }, { 0,0,0 }  },
+	{  { 0x0039 }, { 0,0,0 }  },
+	{  { 0x003A }, { 0,1,0 }  },
+	{  { 0x0040 }, { 0,1,0 }  },
+	{  { 0x0041 }, { 0,1,0 }  },
+	{  { 0x005A }, { 0,1,0 }  },
+	{  { 0x005B }, { 0,1,0 }  },
+	{  { 0x0060 }, { 0,1,0 }  },
+	{  { 0x0061 }, { 0,1,0 }  },
+	{  { 0x007A }, { 0,1,0 }  },
+	{  { 0x007B }, { 0,1,0 }  },
+	{  { 0x007E }, { 0,1,0 }  },
+	{  { 0x007F }, { 0,1,0 }  },
+	{  { 0x0080 }, { 0,1,0 }  },
+	{ .is_last = 1 }		/* Last element.  */
+      }
+  },
+#if 0
+  {   TST_ISW_REC (eucJP, digit)
+#else
+  {   TST_ISW_REC (ja_UTF8, digit)
+#endif
+      {
+	{  { 0x3000 }, { 0,1,0 }  },	/* IDEO. SPACE	      */
+	{  { 0x3020 }, { 0,1,0 }  },	/* POSTAL MARK FACE   */
+	{  { 0x3029 }, { 0,1,0 }  },	/* Hangzhou NUM9      */
+	{  { 0x302F }, { 0,1,0 }  },	/* Diacritics(Hangul) */
+	{  { 0x3037 }, { 0,1,0 }  },	/* Separator Symbol   */
+	{  { 0x303F }, { 0,1,0 }  },	/* IDEO. HALF SPACE   */
+	{  { 0x3041 }, { 0,1,0 }  },	/* HIRAGANA a	      */
+	{  { 0x3094 }, { 0,1,0 }  },	/* HIRAGANA u"	      */
+	{  { 0x3099 }, { 0,1,0 }  },	/* SOUND MARK	      */
+	{  { 0x309E }, { 0,1,0 }  },	/* ITERATION MARK     */
+	{  { 0x30A1 }, { 0,1,0 }  },	/* KATAKANA a	      */
+	{  { 0x30FA }, { 0,1,0 }  },	/* KATAKANA wo"	      */
+	{  { 0x30FB }, { 0,1,0 }  },	/* KATAKANA MID.DOT   */
+	{  { 0x30FE }, { 0,1,0 }  },	/* KATAKANA ITERATION */
+	{  { 0x3191 }, { 0,1,0 }  },	/* KANBUN REV.MARK    */
+	{  { 0x3243 }, { 0,1,0 }  },	/* IDEO. MARK (reach) */
+	{  { 0x32CB }, { 0,1,0 }  },	/* IDEO.TEL.SYM.DEC12 */
+	{  { 0x32FE }, { 0,1,0 }  },	/* MARU KATAKANA wo   */
+	{  { 0x33FE }, { 0,1,0 }  },	/* CJK IDEO.TEL.31th  */
+	{  { 0x4E00 }, { 0,1,0 }  },	/* CJK UNI.IDEO.      */
+	{  { 0x4E05 }, { 0,1,0 }  },	/* CJK UNI.IDEO.      */
+	{  { 0x4E06 }, { 0,1,0 }  },	/* CJK UNI.IDEO.NON-J */
+	{  { 0x4E07 }, { 0,1,0 }  },	/* CJK UNI.IDEO.      */
+	{  { 0x4FFF }, { 0,1,0 }  },	/* CJK UNI.IDEO.      */
+	{  { 0x9000 }, { 0,1,0 }  },	/* CJK UNI.IDEO.      */
+	{  { 0x9006 }, { 0,1,0 }  },	/* CJK UNI.IDEO.      */
+	{  { 0x9007 }, { 0,1,0 }  },	/* CJK UNI.IDEO.NON-J */
+	{  { 0x9FA4 }, { 0,1,0 }  },	/* CJK UNI.IDEO.NON-J */
+	{  { 0x9FA5 }, { 0,1,0 }  },	/* CJK UNI.IDEO.      */
+	{  { 0xFE4F }, { 0,1,0 }  },	/* CJK UNI.IDEO.      */
+	{  { 0xFF0F }, { 0,1,0 }  },	/* FULL SLASH	      */
+	{  { 0xFF19 }, { 0,1,0 }  },	/* FULL 9	      */
+	{  { 0xFF20 }, { 0,1,0 }  },	/* FULL @	      */
+	{  { 0xFF3A }, { 0,1,0 }  },	/* FULL Z	      */
+	{  { 0xFF40 }, { 0,1,0 }  },	/* FULL GRAVE ACC.    */
+	{  { 0xFF5A }, { 0,1,0 }  },	/* FULL z	      */
+	{  { 0xFF5E }, { 0,1,0 }  },	/* FULL ~ (tilde)     */
+	{  { 0xFF61 }, { 0,1,0 }  },	/* HALF IDEO.STOP. .  */
+	{  { 0xFF65 }, { 0,1,0 }  },	/* HALF KATA MID.DOT  */
+	{  { 0xFF66 }, { 0,1,0 }  },	/* HALF KATA WO	      */
+	{  { 0xFF6F }, { 0,1,0 }  },	/* HALF KATA tu	      */
+	{  { 0xFF70 }, { 0,1,0 }  },	/* HALF KATA PL -     */
+	{  { 0xFF71 }, { 0,1,0 }  },	/* HALF KATA A	      */
+	{  { 0xFF9E }, { 0,1,0 }  },	/* HALF KATA MI	      */
+	{ .is_last = 1 }		/* Last element.  */
+      }
+  },
+  {   TST_ISW_REC (end, digit) }
+};
diff --git a/ap/build/uClibc/test/locale-mbwc/dat_iswgraph.c b/ap/build/uClibc/test/locale-mbwc/dat_iswgraph.c
new file mode 100644
index 0000000..80cacb2
--- /dev/null
+++ b/ap/build/uClibc/test/locale-mbwc/dat_iswgraph.c
@@ -0,0 +1,167 @@
+/*
+ *  TEST SUITE FOR MB/WC FUNCTIONS IN C LIBRARY
+ *
+ *	 FILE:	dat_iswgraph.c
+ *
+ *	 ISW*:	int iswgraph (wint_t wc);
+ */
+
+
+#include "dat_isw-funcs.h"
+
+
+TST_ISW_LOC (GRAPH, graph) = {
+
+  {   TST_ISW_REC (de, graph)
+      {
+	{  { 0x0080 }, { 0,1,0 }  },	/* CTRL	    */
+	{  { 0x009F }, { 0,1,0 }  },	/* CTRL	    */
+#ifdef SHOJI_IS_RIGHT
+	{  { 0x00A0 }, { 0,1,0 }  },	/* NB SPACE */
+#else
+	{  { 0x00A0 }, { 0,0,0 }  },	/* NB SPACE */
+#endif
+	{  { 0x00A1 }, { 0,0,0 }  },	/* UD !	    */
+	{  { 0x00B0 }, { 0,0,0 }  },	/* Degree   */
+	{  { 0x00B1 }, { 0,0,0 }  },	/* +- sign  */
+	{  { 0x00B2 }, { 0,0,0 }  },	/* SUP 2    */
+	{  { 0x00B3 }, { 0,0,0 }  },	/* SUP 3    */
+	{  { 0x00B4 }, { 0,0,0 }  },	/* ACUTE    */
+	{  { 0x00B8 }, { 0,0,0 }  },	/* CEDILLA  */
+	{  { 0x00B9 }, { 0,0,0 }  },	/* SUP 1    */
+	{  { 0x00BB }, { 0,0,0 }  },	/* >>	    */
+	{  { 0x00BC }, { 0,0,0 }  },	/* 1/4	    */
+	{  { 0x00BD }, { 0,0,0 }  },	/* 1/2	    */
+	{  { 0x00BE }, { 0,0,0 }  },	/* 3/4	    */
+	{  { 0x00BF }, { 0,0,0 }  },	/* UD ?	    */
+	{  { 0x00C0 }, { 0,0,0 }  },	/* A Grave  */
+	{  { 0x00D6 }, { 0,0,0 }  },	/* O dia    */
+	{  { 0x00D7 }, { 0,0,0 }  },	/* multipl. */
+	{  { 0x00D8 }, { 0,0,0 }  },	/* O stroke */
+	{  { 0x00DF }, { 0,0,0 }  },	/* small Sh */
+	{  { 0x00E0 }, { 0,0,0 }  },	/* a grave  */
+	{  { 0x00F6 }, { 0,0,0 }  },	/* o dia    */
+	{  { 0x00F7 }, { 0,0,0 }  },	/* division */
+	{  { 0x00F8 }, { 0,0,0 }  },	/* o stroke */
+	{  { 0x00FF }, { 0,0,0 }  },	/* y dia    */
+	{ .is_last = 1 }		/* Last element.  */
+      }
+  },
+  {   TST_ISW_REC (enUS, graph)
+      {
+	{  { WEOF   }, { 0,1,0 }  },
+	{  { 0x0000 }, { 0,1,0 }  },
+	{  { 0x001F }, { 0,1,0 }  },
+	{  { 0x0020 }, { 0,1,0 }  },
+	{  { 0x0021 }, { 0,0,0 }  },
+	{  { 0x002F }, { 0,0,0 }  },
+	{  { 0x0030 }, { 0,0,0 }  },
+	{  { 0x0039 }, { 0,0,0 }  },
+	{  { 0x003A }, { 0,0,0 }  },
+	{  { 0x0040 }, { 0,0,0 }  },
+	{  { 0x0041 }, { 0,0,0 }  },
+	{  { 0x005A }, { 0,0,0 }  },
+	{  { 0x005B }, { 0,0,0 }  },
+	{  { 0x0060 }, { 0,0,0 }  },
+	{  { 0x0061 }, { 0,0,0 }  },
+	{  { 0x007A }, { 0,0,0 }  },
+	{  { 0x007B }, { 0,0,0 }  },
+	{  { 0x007E }, { 0,0,0 }  },
+	{  { 0x007F }, { 0,1,0 }  },
+	{  { 0x0080 }, { 0,1,0 }  }, /* 20 */
+	{ .is_last = 1 }		/* Last element.  */
+      }
+  },
+#if 0
+  {   TST_ISW_REC( eucJP, graph )
+#else
+  {   TST_ISW_REC( ja_UTF8, graph )
+#endif
+      {
+	{  { 0x3000 }, { 0,1,0 }  },	/* IDEO. SPACE	      */
+#ifdef SHOJI_IS_RIGHT
+	{  { 0x3020 }, { 0,1,0 }  },	/* POSTAL MARK FACE   */
+	{  { 0x3029 }, { 0,1,0 }  },	/* Hangzhou NUM9      */
+	{  { 0x302F }, { 0,1,0 }  },	/* Diacritics(Hangul) */
+	{  { 0x3037 }, { 0,1,0 }  },	/* Separator Symbol   */
+	{  { 0x303F }, { 0,1,0 }  },	/* IDEO. HALF SPACE   */
+#else
+	{  { 0x3020 }, { 0,0,0 }  },	/* POSTAL MARK FACE   */
+	{  { 0x3029 }, { 0,0,0 }  },	/* Hangzhou NUM9      */
+	{  { 0x302F }, { 0,0,0 }  },	/* Diacritics(Hangul) */
+	{  { 0x3037 }, { 0,0,0 }  },	/* Separator Symbol   */
+	{  { 0x303F }, { 0,0,0 }  },	/* IDEO. HALF SPACE   */
+#endif
+	{  { 0x3041 }, { 0,0,0 }  },	/* HIRAGANA a	      */
+#ifdef SHOJI_IS_RIGHT
+	{  { 0x3094 }, { 0,1,0 }  },	/* HIRAGANA u"	      */  /* non jis */
+	{  { 0x3099 }, { 0,1,0 }  },	/* SOUND MARK	      */
+#else
+	{  { 0x3094 }, { 0,0,0 }  },	/* HIRAGANA u"	      */  /* non jis */
+	{  { 0x3099 }, { 0,0,0 }  },	/* SOUND MARK	      */
+#endif
+	{  { 0x309E }, { 0,0,0 }  },	/* ITERATION MARK     */  /* 10 */
+	{  { 0x30A1 }, { 0,0,0 }  },	/* KATAKANA a	      */
+#ifdef SHOJI_IS_RIGHT
+	{  { 0x30FA }, { 0,1,0 }  },	/* KATAKANA wo"	      */  /* non jis */
+#else
+	{  { 0x30FA }, { 0,0,0 }  },	/* KATAKANA wo"	      */  /* non jis */
+#endif
+	{  { 0x30FB }, { 0,0,0 }  },	/* KATAKANA MID.DOT   */
+	{  { 0x30FE }, { 0,0,0 }  },	/* KATAKANA ITERATION */
+#ifdef SHOJI_IS_RIGHT
+	{  { 0x3191 }, { 0,1,0 }  },	/* KANBUN REV.MARK    */
+	{  { 0x3243 }, { 0,1,0 }  },	/* IDEO. MARK (reach) */
+	{  { 0x32CB }, { 0,1,0 }  },	/* IDEO.TEL.SYM.DEC12 */
+	{  { 0x32FE }, { 0,1,0 }  },	/* MARU KATAKANA wo   */
+	{  { 0x33FE }, { 0,1,0 }  },	/* CJK IDEO.TEL.31th  */
+#else
+	{  { 0x3191 }, { 0,0,0 }  },	/* KANBUN REV.MARK    */
+	{  { 0x3243 }, { 0,0,0 }  },	/* IDEO. MARK (reach) */
+	{  { 0x32CB }, { 0,0,0 }  },	/* IDEO.TEL.SYM.DEC12 */
+	{  { 0x32FE }, { 0,0,0 }  },	/* MARU KATAKANA wo   */
+	{  { 0x33FE }, { 0,0,0 }  },	/* CJK IDEO.TEL.31th  */
+#endif
+	{  { 0x4E00 }, { 0,0,0 }  },	/* CJK UNI.IDEO.      */  /* 20 */
+	{  { 0x4E05 }, { 0,0,0 }  },	/* CJK UNI.IDEO.      */
+#ifdef SHOJI_IS_RIGHT
+	{  { 0x4E06 }, { 0,1,0 }  },	/* CJK UNI.IDEO.NON-J */
+#else
+	{  { 0x4E06 }, { 0,0,0 }  },	/* CJK UNI.IDEO.NON-J */
+#endif
+	{  { 0x4E07 }, { 0,0,0 }  },	/* CJK UNI.IDEO.      */
+	{  { 0x4FFF }, { 0,0,0 }  },	/* CJK UNI.IDEO.      */
+	{  { 0x9000 }, { 0,0,0 }  },	/* CJK UNI.IDEO.      */
+	{  { 0x9006 }, { 0,0,0 }  },	/* CJK UNI.IDEO.      */
+#ifdef SHOJI_IS_RIGHT
+	{  { 0x9007 }, { 0,1,0 }  },	/* CJK UNI.IDEO.NON-J */
+	{  { 0x9FA4 }, { 0,1,0 }  },	/* CJK UNI.IDEO.NON-J */
+#else
+	{  { 0x9007 }, { 0,0,0 }  },	/* CJK UNI.IDEO.NON-J */
+	{  { 0x9FA4 }, { 0,0,0 }  },	/* CJK UNI.IDEO.NON-J */
+#endif
+	{  { 0x9FA5 }, { 0,0,0 }  },	/* CJK UNI.IDEO.      */
+#ifdef SHOJI_IS_RIGHT
+	{  { 0xFE4F }, { 0,1,0 }  },	/* CJK Wave Low Line  */  /* 30 */
+#else
+	{  { 0xFE4F }, { 0,0,0 }  },	/* CJK Wave Low Line  */  /* 30 */
+#endif
+	{  { 0xFF0F }, { 0,0,0 }  },	/* FULL SLASH	      */
+	{  { 0xFF19 }, { 0,0,0 }  },	/* FULL 9	      */
+	{  { 0xFF20 }, { 0,0,0 }  },	/* FULL @	      */
+	{  { 0xFF3A }, { 0,0,0 }  },	/* FULL Z	      */
+	{  { 0xFF40 }, { 0,0,0 }  },	/* FULL GRAVE ACC.    */
+	{  { 0xFF5A }, { 0,0,0 }  },	/* FULL z	      */
+	{  { 0xFF5E }, { 0,0,0 }  },	/* FULL ~ (tilde)     */
+	{  { 0xFF61 }, { 0,0,0 }  },	/* HALF IDEO.STOP. .  */
+	{  { 0xFF65 }, { 0,0,0 }  },	/* HALF KATA MID.DOT  */
+	{  { 0xFF66 }, { 0,0,0 }  },	/* HALF KATA WO	      */
+	{  { 0xFF6F }, { 0,0,0 }  },	/* HALF KATA tu	      */
+	{  { 0xFF70 }, { 0,0,0 }  },	/* HALF KATA PL -     */
+	{  { 0xFF71 }, { 0,0,0 }  },	/* HALF KATA A	      */
+	{  { 0xFF9E }, { 0,0,0 }  },	/* HALF KATA MI	      */
+	{ .is_last = 1 }		/* Last element.  */
+      }
+  },
+  {   TST_ISW_REC (end, graph) }
+};
diff --git a/ap/build/uClibc/test/locale-mbwc/dat_iswlower.c b/ap/build/uClibc/test/locale-mbwc/dat_iswlower.c
new file mode 100644
index 0000000..58ec08e
--- /dev/null
+++ b/ap/build/uClibc/test/locale-mbwc/dat_iswlower.c
@@ -0,0 +1,96 @@
+/*
+ *  TEST SUITE FOR MB/WC FUNCTIONS IN C LIBRARY
+ *
+ *	 FILE:	dat_iswlower.c
+ *
+ *	 ISW*:	int iswlower (wint_t wc);
+ */
+
+
+#include "dat_isw-funcs.h"
+
+
+TST_ISW_LOC (LOWER, lower) = {
+
+  {   TST_ISW_REC (de, lower)
+      {
+	{  { 0x0080 }, { 0,1,0 }  },	/* CTRL	    */
+	{  { 0x009F }, { 0,1,0 }  },	/* CTRL	    */
+	{  { 0x00A0 }, { 0,1,0 }  },	/* NB SPACE */
+	{  { 0x00A1 }, { 0,1,0 }  },	/* UD !	    */
+	{  { 0x00B0 }, { 0,1,0 }  },	/* Degree   */
+	{  { 0x00B1 }, { 0,1,0 }  },	/* +- sign  */
+	{  { 0x00B2 }, { 0,1,0 }  },	/* SUP 2    */
+	{  { 0x00B3 }, { 0,1,0 }  },	/* SUP 3    */
+	{  { 0x00B4 }, { 0,1,0 }  },	/* ACUTE    */
+	{  { 0x00B8 }, { 0,1,0 }  },	/* CEDILLA  */
+	{  { 0x00B9 }, { 0,1,0 }  },	/* SUP 1    */
+	{  { 0x00BB }, { 0,1,0 }  },	/* >>	    */
+	{  { 0x00BC }, { 0,1,0 }  },	/* 1/4	    */
+	{  { 0x00BD }, { 0,1,0 }  },	/* 1/2	    */
+	{  { 0x00BE }, { 0,1,0 }  },	/* 3/4	    */
+	{  { 0x00BF }, { 0,1,0 }  },	/* UD ?	    */
+	{  { 0x00C0 }, { 0,1,0 }  },	/* A Grave  */
+	{  { 0x00D6 }, { 0,1,0 }  },	/* O dia    */
+	{  { 0x00D7 }, { 0,1,0 }  },	/* multipl. */
+	{  { 0x00D8 }, { 0,1,0 }  },	/* O stroke */
+	{  { 0x00DF }, { 0,0,0 }  },	/* small Sh */
+	{  { 0x00E0 }, { 0,0,0 }  },	/* a grave  */
+	{  { 0x00F6 }, { 0,0,0 }  },	/* o dia    */
+	{  { 0x00F7 }, { 0,1,0 }  },	/* division */
+	{  { 0x00F8 }, { 0,0,0 }  },	/* o stroke */
+	{  { 0x00FF }, { 0,0,0 }  },	/* y dia    */
+	{ .is_last = 1 }		/* Last element.  */
+      }
+  },
+  {   TST_ISW_REC (enUS, lower)
+      {
+	{  { WEOF   }, { 0,1,0 }  },
+	{  { 0x0000 }, { 0,1,0 }  },
+	{  { 0x001F }, { 0,1,0 }  },
+	{  { 0x0020 }, { 0,1,0 }  },
+	{  { 0x0021 }, { 0,1,0 }  },
+	{  { 0x002F }, { 0,1,0 }  },
+	{  { 0x0030 }, { 0,1,0 }  },
+	{  { 0x0039 }, { 0,1,0 }  },
+	{  { 0x003A }, { 0,1,0 }  },
+	{  { 0x0040 }, { 0,1,0 }  },
+	{  { 0x0041 }, { 0,1,0 }  },
+	{  { 0x005A }, { 0,1,0 }  },
+	{  { 0x005B }, { 0,1,0 }  },
+	{  { 0x0060 }, { 0,1,0 }  },
+	{  { 0x0061 }, { 0,0,0 }  },
+	{  { 0x007A }, { 0,0,0 }  },
+	{  { 0x007B }, { 0,1,0 }  },
+	{  { 0x007E }, { 0,1,0 }  },
+	{  { 0x007F }, { 0,1,0 }  },
+	{  { 0x0080 }, { 0,1,0 }  },
+	{ .is_last = 1 }		/* Last element.  */
+      }
+  },
+#if 0
+  {   TST_ISW_REC (eucJP, lower)
+#else
+  {   TST_ISW_REC (ja_UTF8, lower)
+#endif
+      {
+	{  { 0x3000 }, { 0,1,0 }  },	/* IDEO. SPACE	      */
+	{  { 0x303F }, { 0,1,0 }  },	/* IDEO. HALF SPACE   */
+	{  { 0x3041 }, { 0,1,0 }  },	/* HIRAGANA a	      */
+	{  { 0x3094 }, { 0,1,0 }  },	/* HIRAGANA u"	      */
+	{  { 0x3099 }, { 0,1,0 }  },	/* SOUND MARK	      */
+	{  { 0x309E }, { 0,1,0 }  },	/* ITERATION MARK     */
+	{  { 0x30A1 }, { 0,1,0 }  },	/* KATAKANA a	      */
+	{  { 0x30FA }, { 0,1,0 }  },	/* KATAKANA wo"	      */
+	{  { 0xFF3A }, { 0,1,0 }  },	/* FULL Z	      */
+	{  { 0xFF40 }, { 0,1,0 }  },	/* FULL GRAVE ACC.    */
+	{  { 0xFF5A }, { 0,0,0 }  },	/* FULL z	      */
+	{  { 0xFF6F }, { 0,1,0 }  },	/* HALF KATA tu	      */
+	{  { 0xFF71 }, { 0,1,0 }  },	/* HALF KATA A	      */
+	{  { 0xFF9E }, { 0,1,0 }  },	/* HALF KATA MI	      */
+	{ .is_last = 1 }		/* Last element.  */
+      }
+  },
+  {   TST_ISW_REC (end, lower) }
+
+};
diff --git a/ap/build/uClibc/test/locale-mbwc/dat_iswprint.c b/ap/build/uClibc/test/locale-mbwc/dat_iswprint.c
new file mode 100644
index 0000000..bcd96d0
--- /dev/null
+++ b/ap/build/uClibc/test/locale-mbwc/dat_iswprint.c
@@ -0,0 +1,170 @@
+/*
+ *  TEST SUITE FOR MB/WC FUNCTIONS IN C LIBRARY
+ *
+ *       FILE:  dat_iswprint.c
+ *
+ *       ISW*:  int iswprint (wint_t wc);
+ */
+
+
+#include "dat_isw-funcs.h"
+
+
+TST_ISW_LOC (PRINT, print) = {
+
+  {   TST_ISW_REC (de, print)
+      {
+	{  { 0x0080 }, { 0,1,0 }  },  /* CTRL     */
+	{  { 0x009F }, { 0,1,0 }  },  /* CTRL     */
+#ifdef SHOJI_IS_RIGHT
+	{  { 0x00A0 }, { 0,1,0 }  },  /* NB SPACE */
+#else
+	{  { 0x00A0 }, { 0,0,0 }  },  /* NB SPACE */
+#endif
+	{  { 0x00A1 }, { 0,0,0 }  },  /* UD !     */
+	{  { 0x00B0 }, { 0,0,0 }  },  /* Degree   */
+	{  { 0x00B1 }, { 0,0,0 }  },  /* +- sign  */
+	{  { 0x00B2 }, { 0,0,0 }  },  /* SUP 2    */
+	{  { 0x00B3 }, { 0,0,0 }  },  /* SUP 3    */
+	{  { 0x00B4 }, { 0,0,0 }  },  /* ACUTE    */
+	{  { 0x00B8 }, { 0,0,0 }  },  /* CEDILLA  */
+	{  { 0x00B9 }, { 0,0,0 }  },  /* SUP 1    */
+	{  { 0x00BB }, { 0,0,0 }  },  /* >>       */
+	{  { 0x00BC }, { 0,0,0 }  },  /* 1/4      */
+	{  { 0x00BD }, { 0,0,0 }  },  /* 1/2      */
+	{  { 0x00BE }, { 0,0,0 }  },  /* 3/4      */
+	{  { 0x00BF }, { 0,0,0 }  },  /* UD ?     */
+	{  { 0x00C0 }, { 0,0,0 }  },  /* A Grave  */
+	{  { 0x00D6 }, { 0,0,0 }  },  /* O dia    */
+	{  { 0x00D7 }, { 0,0,0 }  },  /* multipl. */
+	{  { 0x00D8 }, { 0,0,0 }  },  /* O stroke */
+	{  { 0x00DF }, { 0,0,0 }  },  /* small Sh */
+	{  { 0x00E0 }, { 0,0,0 }  },  /* a grave  */
+	{  { 0x00F6 }, { 0,0,0 }  },  /* o dia    */
+	{  { 0x00F7 }, { 0,0,0 }  },  /* division */
+	{  { 0x00F8 }, { 0,0,0 }  },  /* o stroke */
+	{  { 0x00FF }, { 0,0,0 }  },  /* y dia    */
+	{ .is_last = 1 }		/* Last element.  */
+      }
+  },
+  {   TST_ISW_REC (enUS, print)
+      {
+	{  { WEOF   }, { 0,1,0 }  }, /* 01 */
+	{  { 0x0000 }, { 0,1,0 }  },
+	{  { 0x001F }, { 0,1,0 }  },
+	{  { 0x0020 }, { 0,0,0 }  },
+	{  { 0x0021 }, { 0,0,0 }  },
+	{  { 0x002F }, { 0,0,0 }  },
+	{  { 0x0030 }, { 0,0,0 }  },
+	{  { 0x0039 }, { 0,0,0 }  },
+	{  { 0x003A }, { 0,0,0 }  },
+	{  { 0x0040 }, { 0,0,0 }  },
+	{  { 0x0041 }, { 0,0,0 }  },
+	{  { 0x005A }, { 0,0,0 }  },
+	{  { 0x005B }, { 0,0,0 }  },
+	{  { 0x0060 }, { 0,0,0 }  },
+	{  { 0x0061 }, { 0,0,0 }  },
+	{  { 0x007A }, { 0,0,0 }  },
+	{  { 0x007B }, { 0,0,0 }  },
+	{  { 0x007E }, { 0,0,0 }  },
+	{  { 0x007F }, { 0,1,0 }  },
+	{  { 0x0080 }, { 0,1,0 }  }, /* 20 */
+#ifdef NO_WAIVER
+	{  { 0x3042 }, { 0,1,0 }  }, /* <WAIVER> */
+#endif
+	{ .is_last = 1 }		/* Last element.  */
+      }
+  },
+#if 0
+  {   TST_ISW_REC (eucJP, print)
+#else
+  {   TST_ISW_REC (ja_UTF8, print)
+#endif
+      {
+	{  { 0x3000 }, { 0,0,0 }  },  /* IDEO. SPACE        */
+#ifdef SHOJI_IS_RIGHT
+	{  { 0x3020 }, { 0,1,0 }  },  /* POSTAL MARK FACE   */
+	{  { 0x3029 }, { 0,1,0 }  },  /* Hangzhou NUM9      */
+	{  { 0x302F }, { 0,1,0 }  },  /* Diacritics(Hangul) */
+	{  { 0x3037 }, { 0,1,0 }  },  /* Separator Symbol   */
+	{  { 0x303F }, { 0,1,0 }  },  /* IDEO. HALF SPACE   */
+#else
+	{  { 0x3020 }, { 0,0,0 }  },  /* POSTAL MARK FACE   */
+	{  { 0x3029 }, { 0,0,0 }  },  /* Hangzhou NUM9      */
+	{  { 0x302F }, { 0,0,0 }  },  /* Diacritics(Hangul) */
+	{  { 0x3037 }, { 0,0,0 }  },  /* Separator Symbol   */
+	{  { 0x303F }, { 0,0,0 }  },  /* IDEO. HALF SPACE   */
+#endif
+	{  { 0x3041 }, { 0,0,0 }  },  /* HIRAGANA a         */
+#ifdef SHOJI_IS_RIGHT
+	{  { 0x3094 }, { 0,1,0 }  },  /* HIRAGANA u"        */  /* non jis */
+	{  { 0x3099 }, { 0,1,0 }  },  /* SOUND MARK         */
+#else
+	{  { 0x3094 }, { 0,0,0 }  },  /* HIRAGANA u"        */  /* non jis */
+	{  { 0x3099 }, { 0,0,0 }  },  /* SOUND MARK         */
+#endif
+	{  { 0x309E }, { 0,0,0 }  },  /* ITERATION MARK     */  /* 10 */
+	{  { 0x30A1 }, { 0,0,0 }  },  /* KATAKANA a         */
+#ifdef SHOJI_IS_RIGHT
+	{  { 0x30FA }, { 0,1,0 }  },  /* KATAKANA wo"       */  /* non jis */
+#else
+	{  { 0x30FA }, { 0,0,0 }  },  /* KATAKANA wo"       */  /* non jis */
+#endif
+	{  { 0x30FB }, { 0,0,0 }  },  /* KATAKANA MID.DOT   */
+	{  { 0x30FE }, { 0,0,0 }  },  /* KATAKANA ITERATION */
+#ifdef SHOJI_IS_RIGHT
+	{  { 0x3191 }, { 0,1,0 }  },  /* KANBUN REV.MARK    */
+	{  { 0x3243 }, { 0,1,0 }  },  /* IDEO. MARK (reach) */
+	{  { 0x32CB }, { 0,1,0 }  },  /* IDEO.TEL.SYM.DEC12 */
+	{  { 0x32FE }, { 0,1,0 }  },  /* MARU KATAKANA wo   */
+	{  { 0x33FE }, { 0,1,0 }  },  /* CJK IDEO.TEL.31th  */
+#else
+	{  { 0x3191 }, { 0,0,0 }  },  /* KANBUN REV.MARK    */
+	{  { 0x3243 }, { 0,0,0 }  },  /* IDEO. MARK (reach) */
+	{  { 0x32CB }, { 0,0,0 }  },  /* IDEO.TEL.SYM.DEC12 */
+	{  { 0x32FE }, { 0,0,0 }  },  /* MARU KATAKANA wo   */
+	{  { 0x33FE }, { 0,0,0 }  },  /* CJK IDEO.TEL.31th  */
+#endif
+	{  { 0x4E00 }, { 0,0,0 }  },  /* CJK UNI.IDEO.      */  /* 20 */
+	{  { 0x4E05 }, { 0,0,0 }  },  /* CJK UNI.IDEO.      */
+#ifdef SHOJI_IS_RIGHT
+	{  { 0x4E06 }, { 0,1,0 }  },  /* CJK UNI.IDEO.NON-J */
+#else
+	{  { 0x4E06 }, { 0,0,0 }  },  /* CJK UNI.IDEO.NON-J */
+#endif
+	{  { 0x4E07 }, { 0,0,0 }  },  /* CJK UNI.IDEO.      */
+	{  { 0x4FFF }, { 0,0,0 }  },  /* CJK UNI.IDEO.      */
+	{  { 0x9000 }, { 0,0,0 }  },  /* CJK UNI.IDEO.      */
+	{  { 0x9006 }, { 0,0,0 }  },  /* CJK UNI.IDEO.      */
+#ifdef SHOJI_IS_RIGHT
+	{  { 0x9007 }, { 0,1,0 }  },  /* CJK UNI.IDEO.NON-J */
+	{  { 0x9FA4 }, { 0,1,0 }  },  /* CJK UNI.IDEO.NON-J */
+#else
+	{  { 0x9007 }, { 0,0,0 }  },  /* CJK UNI.IDEO.NON-J */
+	{  { 0x9FA4 }, { 0,0,0 }  },  /* CJK UNI.IDEO.NON-J */
+#endif
+	{  { 0x9FA5 }, { 0,0,0 }  },  /* CJK UNI.IDEO.      */
+#ifdef SHOJI_IS_RIGHT
+	{  { 0xFE4F }, { 0,1,0 }  },  /* WAVE LOW LINE      */  /* 30 */
+#else
+	{  { 0xFE4F }, { 0,0,0 }  },  /* WAVE LOW LINE      */  /* 30 */
+#endif
+	{  { 0xFF0F }, { 0,0,0 }  },  /* FULL SLASH         */
+	{  { 0xFF19 }, { 0,0,0 }  },  /* FULL 9             */
+	{  { 0xFF20 }, { 0,0,0 }  },  /* FULL @             */
+	{  { 0xFF3A }, { 0,0,0 }  },  /* FULL Z             */
+	{  { 0xFF40 }, { 0,0,0 }  },  /* FULL GRAVE ACC.    */
+	{  { 0xFF5A }, { 0,0,0 }  },  /* FULL z             */
+	{  { 0xFF5E }, { 0,0,0 }  },  /* FULL ~ (tilde)     */
+	{  { 0xFF61 }, { 0,0,0 }  },  /* HALF IDEO.STOP. .  */
+	{  { 0xFF65 }, { 0,0,0 }  },  /* HALF KATA MID.DOT  */
+	{  { 0xFF66 }, { 0,0,0 }  },  /* HALF KATA WO       */  /* 40 */
+	{  { 0xFF6F }, { 0,0,0 }  },  /* HALF KATA tu       */
+	{  { 0xFF70 }, { 0,0,0 }  },  /* HALF KATA PL -     */
+	{  { 0xFF71 }, { 0,0,0 }  },  /* HALF KATA A        */
+	{  { 0xFF9E }, { 0,0,0 }  },  /* HALF KATA MI       */
+	{ .is_last = 1 }		/* Last element.  */
+      }
+  },
+  {   TST_ISW_REC (end, print) }
+};
diff --git a/ap/build/uClibc/test/locale-mbwc/dat_iswpunct.c b/ap/build/uClibc/test/locale-mbwc/dat_iswpunct.c
new file mode 100644
index 0000000..2b3612f
--- /dev/null
+++ b/ap/build/uClibc/test/locale-mbwc/dat_iswpunct.c
@@ -0,0 +1,155 @@
+/*
+ *  TEST SUITE FOR MB/WC FUNCTIONS IN C LIBRARY
+ *
+ *	 FILE:	dat_iswpunct.c
+ *
+ *	 ISW*:	int iswpunct (wint_t wc);
+ */
+
+
+#include "dat_isw-funcs.h"
+
+
+TST_ISW_LOC (PUNCT, punct) = {
+
+  {   TST_ISW_REC (de, punct)
+      {
+	{  { 0x0080 }, { 0,1,0 }  },	/* CTRL	    */
+	{  { 0x009F }, { 0,1,0 }  },	/* CTRL	    */
+#ifdef SHOJI_IS_RIGHT
+	{  { 0x00A0 }, { 0,1,0 }  },	/* NB SPACE */
+#else
+	{  { 0x00A0 }, { 0,0,0 }  },	/* NB SPACE */
+#endif
+	{  { 0x00A1 }, { 0,0,0 }  },	/* UD !	    */
+	{  { 0x00B0 }, { 0,0,0 }  },	/* Degree   */
+	{  { 0x00B1 }, { 0,0,0 }  },	/* +- sign  */
+	{  { 0x00B2 }, { 0,0,0 }  },	/* SUP 2    */
+	{  { 0x00B3 }, { 0,0,0 }  },	/* SUP 3    */
+	{  { 0x00B4 }, { 0,0,0 }  },	/* ACUTE    */
+	{  { 0x00B8 }, { 0,0,0 }  },	/* CEDILLA  */
+	{  { 0x00B9 }, { 0,0,0 }  },	/* SUP 1    */
+	{  { 0x00BB }, { 0,0,0 }  },	/* >>	    */
+	{  { 0x00BC }, { 0,0,0 }  },	/* 1/4	    */
+	{  { 0x00BD }, { 0,0,0 }  },	/* 1/2	    */
+	{  { 0x00BE }, { 0,0,0 }  },	/* 3/4	    */
+	{  { 0x00BF }, { 0,0,0 }  },	/* UD ?	    */
+	{  { 0x00C0 }, { 0,1,0 }  },	/* A Grave  */
+	{  { 0x00D6 }, { 0,1,0 }  },	/* O dia    */
+	{  { 0x00D7 }, { 0,0,0 }  },	/* multipl. */
+	{  { 0x00D8 }, { 0,1,0 }  },	/* O stroke */
+	{  { 0x00DF }, { 0,1,0 }  },	/* small Sh */
+	{  { 0x00E0 }, { 0,1,0 }  },	/* a grave  */
+	{  { 0x00F6 }, { 0,1,0 }  },	/* o dia    */
+	{  { 0x00F7 }, { 0,0,0 }  },	/* division */
+	{  { 0x00F8 }, { 0,1,0 }  },	/* o stroke */
+	{  { 0x00FF }, { 0,1,0 }  },	/* y dia    */
+	{ .is_last = 1 }		/* Last element.  */
+      }
+  },
+  {   TST_ISW_REC (enUS, punct)
+      {
+	{  { WEOF   }, { 0,1,0 }  }, /* 01 */
+	{  { 0x0000 }, { 0,1,0 }  },
+	{  { 0x001F }, { 0,1,0 }  },
+	{  { 0x0020 }, { 0,1,0 }  },
+	{  { 0x0021 }, { 0,0,0 }  },
+	{  { 0x002F }, { 0,0,0 }  },
+	{  { 0x0030 }, { 0,1,0 }  },
+	{  { 0x0039 }, { 0,1,0 }  },
+	{  { 0x003A }, { 0,0,0 }  },
+	{  { 0x0040 }, { 0,0,0 }  },
+	{  { 0x0041 }, { 0,1,0 }  },
+	{  { 0x005A }, { 0,1,0 }  },
+	{  { 0x005B }, { 0,0,0 }  },
+	{  { 0x0060 }, { 0,0,0 }  },
+	{  { 0x0061 }, { 0,1,0 }  },
+	{  { 0x007A }, { 0,1,0 }  },
+	{  { 0x007B }, { 0,0,0 }  },
+	{  { 0x007E }, { 0,0,0 }  },
+	{  { 0x007F }, { 0,1,0 }  },
+	{  { 0x0080 }, { 0,1,0 }  }, /* 20 */
+	{ .is_last = 1 }		/* Last element.  */
+      }
+  },
+#if 0
+  {   TST_ISW_REC (eucJP, punct)
+#else
+  {   TST_ISW_REC (ja_UTF8, punct)
+#endif
+      {
+	{  { 0x3000 }, { 0,1,0 }  },	/* IDEO. SPACE	      */
+#ifdef SHOJI_IS_RIGHT
+	{  { 0x3020 }, { 0,1,0 }  },	/* POSTAL MARK FACE   */
+#else
+	{  { 0x3020 }, { 0,0,0 }  },	/* POSTAL MARK FACE   */
+#endif
+	{  { 0x3029 }, { 0,1,0 }  },	/* Hangzhou NUM9      */
+#ifdef SHOJI_IS_RIGHT
+	{  { 0x302F }, { 0,1,0 }  },	/* Diacritics(Hangul) */
+	{  { 0x3037 }, { 0,1,0 }  },	/* Separator Symbol   */
+	{  { 0x303F }, { 0,1,0 }  },	/* IDEO. HALF SPACE   */
+#else
+	{  { 0x302F }, { 0,0,0 }  },	/* Diacritics(Hangul) */
+	{  { 0x3037 }, { 0,0,0 }  },	/* Separator Symbol   */
+	{  { 0x303F }, { 0,0,0 }  },	/* IDEO. HALF SPACE   */
+#endif
+	{  { 0x3041 }, { 0,1,0 }  },	/* HIRAGANA a	      */
+	{  { 0x3094 }, { 0,1,0 }  },	/* HIRAGANA u"	      */
+#ifdef SHOJI_IS_RIGHT
+	{  { 0x3099 }, { 0,1,0 }  },	/* SOUND MARK	      */
+#else
+	{  { 0x3099 }, { 0,0,0 }  },	/* SOUND MARK	      */
+#endif
+	{  { 0x309E }, { 0,1,0 }  },	/* ITERATION MARK     */  /* 10 */
+	{  { 0x30A1 }, { 0,1,0 }  },	/* KATAKANA a	      */
+	{  { 0x30FA }, { 0,1,0 }  },	/* KATAKANA wo"	      */
+	{  { 0x30FB }, { 0,0,0 }  },	/* KATAKANA MID.DOT   */
+	{  { 0x30FE }, { 0,1,0 }  },	/* KATAKANA ITERATION */
+#ifdef SHOJI_IS_RIGHT
+	{  { 0x3191 }, { 0,1,0 }  },	/* KANBUN REV.MARK    */
+	{  { 0x3243 }, { 0,1,0 }  },	/* IDEO. MARK (reach) */
+	{  { 0x32CB }, { 0,1,0 }  },	/* IDEO.TEL.SYM.DEC12 */
+	{  { 0x32FE }, { 0,1,0 }  },	/* MARU KATAKANA wo   */
+	{  { 0x33FE }, { 0,1,0 }  },	/* CJK IDEO.TEL.31th  */
+#else
+	{  { 0x3191 }, { 0,0,0 }  },	/* KANBUN REV.MARK    */
+	{  { 0x3243 }, { 0,0,0 }  },	/* IDEO. MARK (reach) */
+	{  { 0x32CB }, { 0,0,0 }  },	/* IDEO.TEL.SYM.DEC12 */
+	{  { 0x32FE }, { 0,0,0 }  },	/* MARU KATAKANA wo   */
+	{  { 0x33FE }, { 0,0,0 }  },	/* CJK IDEO.TEL.31th  */
+#endif
+	{  { 0x4E00 }, { 0,1,0 }  },	/* CJK UNI.IDEO.      */  /* 20 */
+	{  { 0x4E05 }, { 0,1,0 }  },	/* CJK UNI.IDEO.      */
+	{  { 0x4E06 }, { 0,1,0 }  },	/* CJK UNI.IDEO.NON-J */
+	{  { 0x4E07 }, { 0,1,0 }  },	/* CJK UNI.IDEO.      */
+	{  { 0x4FFF }, { 0,1,0 }  },	/* CJK UNI.IDEO.      */
+	{  { 0x9000 }, { 0,1,0 }  },	/* CJK UNI.IDEO.      */
+	{  { 0x9006 }, { 0,1,0 }  },	/* CJK UNI.IDEO.      */
+	{  { 0x9007 }, { 0,1,0 }  },	/* CJK UNI.IDEO.NON-J */
+	{  { 0x9FA4 }, { 0,1,0 }  },	/* CJK UNI.IDEO.NON-J */
+	{  { 0x9FA5 }, { 0,1,0 }  },	/* CJK UNI.IDEO.      */
+#ifdef SHOJI_IS_RIGHT
+	{  { 0xFE4F }, { 0,1,0 }  },	/* CJK UNI.IDEO.      */  /* 30 */
+#else
+	{  { 0xFE4F }, { 0,0,0 }  },	/* CJK UNI.IDEO.      */  /* 30 */
+#endif
+	{  { 0xFF0F }, { 0,0,0 }  },	/* FULL SLASH	      */
+	{  { 0xFF19 }, { 0,1,0 }  },	/* FULL 9	      */
+	{  { 0xFF20 }, { 0,0,0 }  },	/* FULL @	      */
+	{  { 0xFF3A }, { 0,1,0 }  },	/* FULL Z	      */
+	{  { 0xFF40 }, { 0,0,0 }  },	/* FULL GRAVE ACC.    */
+	{  { 0xFF5A }, { 0,1,0 }  },	/* FULL z	      */
+	{  { 0xFF5E }, { 0,0,0 }  },	/* FULL ~ (tilde)     */
+	{  { 0xFF61 }, { 0,0,0 }  },	/* HALF IDEO.STOP. .  */
+	{  { 0xFF65 }, { 0,0,0 }  },	/* HALF KATA MID.DOT  */
+	{  { 0xFF66 }, { 0,1,0 }  },	/* HALF KATA WO	      */  /* 40 */
+	{  { 0xFF6F }, { 0,1,0 }  },	/* HALF KATA tu	      */
+	{  { 0xFF70 }, { 0,1,0 }  },	/* HALF KATA PL -     */
+	{  { 0xFF71 }, { 0,1,0 }  },	/* HALF KATA A	      */
+	{  { 0xFF9E }, { 0,1,0 }  },	/* HALF KATA MI	      */
+	{ .is_last = 1 }		/* Last element.  */
+      }
+  },
+  {   TST_ISW_REC (end, punct) }
+};
diff --git a/ap/build/uClibc/test/locale-mbwc/dat_iswspace.c b/ap/build/uClibc/test/locale-mbwc/dat_iswspace.c
new file mode 100644
index 0000000..2131b87
--- /dev/null
+++ b/ap/build/uClibc/test/locale-mbwc/dat_iswspace.c
@@ -0,0 +1,129 @@
+/*
+ *  TEST SUITE FOR MB/WC FUNCTIONS IN C LIBRARY
+ *
+ *	 FILE:	dat_iswspace.c
+ *
+ *	 ISW*:	int iswspace (wint_t wc);
+ */
+
+
+#include "dat_isw-funcs.h"
+
+
+TST_ISW_LOC (SPACE, space) = {
+
+  {   TST_ISW_REC (de, space)
+      {
+	{  { 0x0080 }, { 0,1,0 }  },	/* CTRL	    */
+	{  { 0x009F }, { 0,1,0 }  },	/* CTRL	    */
+	{  { 0x00A0 }, { 0,1,0 }  },	/* NB SPACE */
+	{  { 0x00A1 }, { 0,1,0 }  },	/* UD !	    */
+	{  { 0x00B0 }, { 0,1,0 }  },	/* Degree   */
+	{  { 0x00B1 }, { 0,1,0 }  },	/* +- sign  */
+	{  { 0x00B2 }, { 0,1,0 }  },	/* SUP 2    */
+	{  { 0x00B3 }, { 0,1,0 }  },	/* SUP 3    */
+	{  { 0x00B4 }, { 0,1,0 }  },	/* ACUTE    */
+	{  { 0x00B8 }, { 0,1,0 }  },	/* CEDILLA  */
+	{  { 0x00B9 }, { 0,1,0 }  },	/* SUP 1    */
+	{  { 0x00BB }, { 0,1,0 }  },	/* >>	    */
+	{  { 0x00BC }, { 0,1,0 }  },	/* 1/4	    */
+	{  { 0x00BD }, { 0,1,0 }  },	/* 1/2	    */
+	{  { 0x00BE }, { 0,1,0 }  },	/* 3/4	    */
+	{  { 0x00BF }, { 0,1,0 }  },	/* UD ?	    */
+	{  { 0x00C0 }, { 0,1,0 }  },	/* A Grave  */
+	{  { 0x00D6 }, { 0,1,0 }  },	/* O dia    */
+	{  { 0x00D7 }, { 0,1,0 }  },	/* multipl. */
+	{  { 0x00D8 }, { 0,1,0 }  },	/* O stroke */
+	{  { 0x00DF }, { 0,1,0 }  },	/* small Sh */
+	{  { 0x00E0 }, { 0,1,0 }  },	/* a grave  */
+	{  { 0x00F6 }, { 0,1,0 }  },	/* o dia    */
+	{  { 0x00F7 }, { 0,1,0 }  },	/* division */
+	{  { 0x00F8 }, { 0,1,0 }  },	/* o stroke */
+	{  { 0x00FF }, { 0,1,0 }  },	/* y dia    */
+	{ .is_last = 1 }		/* Last element.  */
+      }
+  },
+  {   TST_ISW_REC (enUS, space)
+      {
+	{  { WEOF   }, { 0,1,0 }  },
+	{  { 0x0000 }, { 0,1,0 }  },
+	{  { 0x0008 }, { 0,1,0 }  },
+	{  { 0x0009 }, { 0,0,0 }  },
+	{  { 0x000D }, { 0,0,0 }  },
+	{  { 0x000E }, { 0,1,0 }  },
+	{  { 0x001F }, { 0,1,0 }  },
+	{  { 0x0020 }, { 0,0,0 }  },
+	{  { 0x0021 }, { 0,1,0 }  },
+	{  { 0x002F }, { 0,1,0 }  },
+	{  { 0x0030 }, { 0,1,0 }  },
+	{  { 0x0039 }, { 0,1,0 }  },
+	{  { 0x003A }, { 0,1,0 }  },
+	{  { 0x0040 }, { 0,1,0 }  },
+	{  { 0x0041 }, { 0,1,0 }  },
+	{  { 0x005A }, { 0,1,0 }  },
+	{  { 0x005B }, { 0,1,0 }  },
+	{  { 0x0060 }, { 0,1,0 }  },
+	{  { 0x0061 }, { 0,1,0 }  },
+	{  { 0x007A }, { 0,1,0 }  }, /* 20 */
+	{  { 0x007B }, { 0,1,0 }  },
+	{  { 0x007E }, { 0,1,0 }  },
+	{  { 0x007F }, { 0,1,0 }  },
+	{  { 0x0080 }, { 0,1,0 }  },
+	{ .is_last = 1 }		/* Last element.  */
+      }
+  },
+#if 0
+  {   TST_ISW_REC (eucJP, space)
+#else
+  {   TST_ISW_REC (ja_UTF8, space)
+#endif
+      {
+	{  { 0x3000 }, { 0,0,0 }  },	/* IDEO. SPACE	      */
+	{  { 0x3020 }, { 0,1,0 }  },	/* POSTAL MARK FACE   */
+	{  { 0x3029 }, { 0,1,0 }  },	/* Hangzhou NUM9      */
+	{  { 0x302F }, { 0,1,0 }  },	/* Diacritics(Hangul) */
+	{  { 0x3037 }, { 0,1,0 }  },	/* Separator Symbol   */
+	{  { 0x303F }, { 0,1,0 }  },	/* IDEO. HALF SPACE   */  /* No JIS */
+	{  { 0x3041 }, { 0,1,0 }  },	/* HIRAGANA a	      */
+	{  { 0x3094 }, { 0,1,0 }  },	/* HIRAGANA u"	      */
+	{  { 0x3099 }, { 0,1,0 }  },	/* SOUND MARK	      */
+	{  { 0x309E }, { 0,1,0 }  },	/* ITERATION MARK     */
+	{  { 0x30A1 }, { 0,1,0 }  },	/* KATAKANA a	      */
+	{  { 0x30FA }, { 0,1,0 }  },	/* KATAKANA wo"	      */
+	{  { 0x30FB }, { 0,1,0 }  },	/* KATAKANA MID.DOT   */
+	{  { 0x30FE }, { 0,1,0 }  },	/* KATAKANA ITERATION */
+	{  { 0x3191 }, { 0,1,0 }  },	/* KANBUN REV.MARK    */
+	{  { 0x3243 }, { 0,1,0 }  },	/* IDEO. MARK (reach) */
+	{  { 0x32CB }, { 0,1,0 }  },	/* IDEO.TEL.SYM.DEC12 */
+	{  { 0x32FE }, { 0,1,0 }  },	/* MARU KATAKANA wo   */
+	{  { 0x33FE }, { 0,1,0 }  },	/* CJK IDEO.TEL.31th  */
+	{  { 0x4E00 }, { 0,1,0 }  },	/* CJK UNI.IDEO.      */
+	{  { 0x4E05 }, { 0,1,0 }  },	/* CJK UNI.IDEO.      */
+	{  { 0x4E06 }, { 0,1,0 }  },	/* CJK UNI.IDEO.NON-J */
+	{  { 0x4E07 }, { 0,1,0 }  },	/* CJK UNI.IDEO.      */
+	{  { 0x4FFF }, { 0,1,0 }  },	/* CJK UNI.IDEO.      */
+	{  { 0x9000 }, { 0,1,0 }  },	/* CJK UNI.IDEO.      */
+	{  { 0x9006 }, { 0,1,0 }  },	/* CJK UNI.IDEO.      */
+	{  { 0x9007 }, { 0,1,0 }  },	/* CJK UNI.IDEO.NON-J */
+	{  { 0x9FA4 }, { 0,1,0 }  },	/* CJK UNI.IDEO.NON-J */
+	{  { 0x9FA5 }, { 0,1,0 }  },	/* CJK UNI.IDEO.      */
+	{  { 0xFE4F }, { 0,1,0 }  },	/* CJK UNI.IDEO.      */
+	{  { 0xFF0F }, { 0,1,0 }  },	/* FULL SLASH	      */
+	{  { 0xFF19 }, { 0,1,0 }  },	/* FULL 9	      */
+	{  { 0xFF20 }, { 0,1,0 }  },	/* FULL @	      */
+	{  { 0xFF3A }, { 0,1,0 }  },	/* FULL Z	      */
+	{  { 0xFF40 }, { 0,1,0 }  },	/* FULL GRAVE ACC.    */
+	{  { 0xFF5A }, { 0,1,0 }  },	/* FULL z	      */
+	{  { 0xFF5E }, { 0,1,0 }  },	/* FULL ~ (tilde)     */
+	{  { 0xFF61 }, { 0,1,0 }  },	/* HALF IDEO.STOP. .  */
+	{  { 0xFF65 }, { 0,1,0 }  },	/* HALF KATA MID.DOT  */
+	{  { 0xFF66 }, { 0,1,0 }  },	/* HALF KATA WO	      */
+	{  { 0xFF6F }, { 0,1,0 }  },	/* HALF KATA tu	      */
+	{  { 0xFF70 }, { 0,1,0 }  },	/* HALF KATA PL -     */
+	{  { 0xFF71 }, { 0,1,0 }  },	/* HALF KATA A	      */
+	{  { 0xFF9E }, { 0,1,0 }  },	/* HALF KATA MI	      */
+	{ .is_last = 1 }		/* Last element.  */
+      }
+  },
+  {   TST_ISW_REC (end, space) }
+};
diff --git a/ap/build/uClibc/test/locale-mbwc/dat_iswupper.c b/ap/build/uClibc/test/locale-mbwc/dat_iswupper.c
new file mode 100644
index 0000000..865f42f
--- /dev/null
+++ b/ap/build/uClibc/test/locale-mbwc/dat_iswupper.c
@@ -0,0 +1,94 @@
+/*
+ *  TEST SUITE FOR MB/WC FUNCTIONS IN C LIBRARY
+ *
+ *	 FILE:	dat_iswupper.c
+ *
+ *	 ISW*:	int iswupper (wint_t wc);
+ */
+
+
+#include "dat_isw-funcs.h"
+
+
+TST_ISW_LOC (UPPER, upper) = {
+
+  {   TST_ISW_REC (de, upper)
+      {
+	{  { 0x0080 }, { 0,1,0 }  },	/* CTRL	    */
+	{  { 0x009F }, { 0,1,0 }  },	/* CTRL	    */
+	{  { 0x00A0 }, { 0,1,0 }  },	/* NB SPACE */
+	{  { 0x00A1 }, { 0,1,0 }  },	/* UD !	    */
+	{  { 0x00B0 }, { 0,1,0 }  },	/* Degree   */
+	{  { 0x00B1 }, { 0,1,0 }  },	/* +- sign  */
+	{  { 0x00B2 }, { 0,1,0 }  },	/* SUP 2    */
+	{  { 0x00B3 }, { 0,1,0 }  },	/* SUP 3    */
+	{  { 0x00B4 }, { 0,1,0 }  },	/* ACUTE    */
+	{  { 0x00B8 }, { 0,1,0 }  },	/* CEDILLA  */
+	{  { 0x00B9 }, { 0,1,0 }  },	/* SUP 1    */
+	{  { 0x00BB }, { 0,1,0 }  },	/* >>	    */
+	{  { 0x00BC }, { 0,1,0 }  },	/* 1/4	    */
+	{  { 0x00BD }, { 0,1,0 }  },	/* 1/2	    */
+	{  { 0x00BE }, { 0,1,0 }  },	/* 3/4	    */
+	{  { 0x00BF }, { 0,1,0 }  },	/* UD ?	    */
+	{  { 0x00C0 }, { 0,0,0 }  },	/* A Grave  */
+	{  { 0x00D6 }, { 0,0,0 }  },	/* O dia    */
+	{  { 0x00D7 }, { 0,1,0 }  },	/* multipl. */
+	{  { 0x00D8 }, { 0,0,0 }  },	/* O stroke */
+	{  { 0x00DF }, { 0,1,0 }  },	/* small Sh */
+	{  { 0x00E0 }, { 0,1,0 }  },	/* a grave  */
+	{  { 0x00F6 }, { 0,1,0 }  },	/* o dia    */
+	{  { 0x00F7 }, { 0,1,0 }  },	/* division */
+	{  { 0x00F8 }, { 0,1,0 }  },	/* o stroke */
+	{  { 0x00FF }, { 0,1,0 }  },	/* y dia    */
+	{ .is_last = 1 }		/* Last entry.	*/
+      }
+  },
+  {   TST_ISW_REC (enUS, upper)
+      {
+	{  { WEOF   }, { 0,1,0 }  },
+	{  { 0x0000 }, { 0,1,0 }  },
+	{  { 0x001F }, { 0,1,0 }  },
+	{  { 0x0020 }, { 0,1,0 }  },
+	{  { 0x0021 }, { 0,1,0 }  },
+	{  { 0x002F }, { 0,1,0 }  },
+	{  { 0x0030 }, { 0,1,0 }  },
+	{  { 0x0039 }, { 0,1,0 }  },
+	{  { 0x003A }, { 0,1,0 }  },
+	{  { 0x0040 }, { 0,1,0 }  },
+	{  { 0x0041 }, { 0,0,0 }  },
+	{  { 0x005A }, { 0,0,0 }  },
+	{  { 0x005B }, { 0,1,0 }  },
+	{  { 0x0060 }, { 0,1,0 }  },
+	{  { 0x0061 }, { 0,1,0 }  },
+	{  { 0x007A }, { 0,1,0 }  },
+	{  { 0x007B }, { 0,1,0 }  },
+	{  { 0x007E }, { 0,1,0 }  },
+	{  { 0x007F }, { 0,1,0 }  },
+	{  { 0x0080 }, { 0,1,0 }  },
+	{ .is_last = 1 }		/* Last entry.  */
+      }
+  },
+#if 0
+  {   TST_ISW_REC (eucJP, upper)
+#else
+  {   TST_ISW_REC (ja_UTF8, upper)
+#endif
+      {
+	{  { 0x3041 }, { 0,1,0 }  },	/* HIRAGANA a	      */
+	{  { 0x3094 }, { 0,1,0 }  },	/* HIRAGANA u"	      */
+	{  { 0x30A1 }, { 0,1,0 }  },	/* KATAKANA a	      */
+	{  { 0x30FA }, { 0,1,0 }  },	/* KATAKANA wo"	      */
+	{  { 0xFF19 }, { 0,1,0 }  },	/* FULL 9	      */
+	{  { 0xFF20 }, { 0,1,0 }  },	/* FULL @	      */
+	{  { 0xFF3A }, { 0,0,0 }  },	/* FULL Z	      */
+	{  { 0xFF40 }, { 0,1,0 }  },	/* FULL GRAVE ACC.    */
+	{  { 0xFF5A }, { 0,1,0 }  },	/* FULL z	      */
+	{  { 0xFF66 }, { 0,1,0 }  },	/* HALF KATA WO	      */
+	{  { 0xFF6F }, { 0,1,0 }  },	/* HALF KATA tu	      */
+	{  { 0xFF71 }, { 0,1,0 }  },	/* HALF KATA A	      */
+	{  { 0xFF9E }, { 0,1,0 }  },	/* HALF KATA MI	      */
+	{ .is_last = 1 }		/* Last entry.	*/
+      }
+  },
+  {   TST_ISW_REC (end, upper) }
+};
diff --git a/ap/build/uClibc/test/locale-mbwc/dat_iswxdigit.c b/ap/build/uClibc/test/locale-mbwc/dat_iswxdigit.c
new file mode 100644
index 0000000..5d6c652
--- /dev/null
+++ b/ap/build/uClibc/test/locale-mbwc/dat_iswxdigit.c
@@ -0,0 +1,125 @@
+/*
+ *  TEST SUITE FOR MB/WC FUNCTIONS IN C LIBRARY
+ *
+ *	 FILE:	dat_iswxdigit.c
+ *
+ *	 ISW*:	int iswxdigit (wint_t wc);
+ */
+
+
+#include "dat_isw-funcs.h"
+
+
+TST_ISW_LOC (XDIGIT, xdigit) = {
+
+  {   TST_ISW_REC (de, xdigit)
+      {
+	{  { 0x0080 }, { 0,1,0 }  },	/* CTRL	    */
+	{  { 0x009F }, { 0,1,0 }  },	/* CTRL	    */
+	{  { 0x00A0 }, { 0,1,0 }  },	/* NB SPACE */
+	{  { 0x00A1 }, { 0,1,0 }  },	/* UD !	    */
+	{  { 0x00B0 }, { 0,1,0 }  },	/* Degree   */
+	{  { 0x00B1 }, { 0,1,0 }  },	/* +- sign  */
+	{  { 0x00B2 }, { 0,1,0 }  },	/* SUP 2    */
+	{  { 0x00B3 }, { 0,1,0 }  },	/* SUP 3    */
+	{  { 0x00B4 }, { 0,1,0 }  },	/* ACUTE    */
+	{  { 0x00B8 }, { 0,1,0 }  },	/* CEDILLA  */
+	{  { 0x00B9 }, { 0,1,0 }  },	/* SUP 1    */
+	{  { 0x00BB }, { 0,1,0 }  },	/* >>	    */
+	{  { 0x00BC }, { 0,1,0 }  },	/* 1/4	    */
+	{  { 0x00BD }, { 0,1,0 }  },	/* 1/2	    */
+	{  { 0x00BE }, { 0,1,0 }  },	/* 3/4	    */
+	{  { 0x00BF }, { 0,1,0 }  },	/* UD ?	    */
+	{  { 0x00C0 }, { 0,1,0 }  },	/* A Grave  */
+	{  { 0x00D6 }, { 0,1,0 }  },	/* O dia    */
+	{  { 0x00D7 }, { 0,1,0 }  },	/* multipl. */
+	{  { 0x00D8 }, { 0,1,0 }  },	/* O stroke */
+	{  { 0x00DF }, { 0,1,0 }  },	/* small Sh */
+	{  { 0x00E0 }, { 0,1,0 }  },	/* a grave  */
+	{  { 0x00F6 }, { 0,1,0 }  },	/* o dia    */
+	{  { 0x00F7 }, { 0,1,0 }  },	/* division */
+	{  { 0x00F8 }, { 0,1,0 }  },	/* o stroke */
+	{  { 0x00FF }, { 0,1,0 }  },	/* y dia    */
+	{ .is_last = 1 }		/* Last element.  */
+      }
+  },
+  {   TST_ISW_REC( enUS, xdigit )
+      {
+	{  { WEOF   }, { 0,1,0 }  },
+	{  { 0x0000 }, { 0,1,0 }  },
+	{  { 0x001F }, { 0,1,0 }  },
+	{  { 0x0020 }, { 0,1,0 }  },
+	{  { 0x0021 }, { 0,1,0 }  },
+	{  { 0x002F }, { 0,1,0 }  },
+	{  { 0x0030 }, { 0,0,0 }  },
+	{  { 0x0039 }, { 0,0,0 }  },
+	{  { 0x003A }, { 0,1,0 }  },
+	{  { 0x0040 }, { 0,1,0 }  },
+	{  { 0x0041 }, { 0,0,0 }  },
+	{  { 0x005A }, { 0,1,0 }  },
+	{  { 0x005B }, { 0,1,0 }  },
+	{  { 0x0060 }, { 0,1,0 }  },
+	{  { 0x0061 }, { 0,0,0 }  },
+	{  { 0x007A }, { 0,1,0 }  },
+	{  { 0x007B }, { 0,1,0 }  },
+	{  { 0x007E }, { 0,1,0 }  },
+	{  { 0x007F }, { 0,1,0 }  },
+	{  { 0x0080 }, { 0,1,0 }  },
+	{ .is_last = 1 }		/* Last element.  */
+      }
+  },
+#if 0
+  {   TST_ISW_REC( eucJP, xdigit )
+#else
+  {   TST_ISW_REC( ja_UTF8, xdigit )
+#endif
+      {
+	{  { 0x3000 }, { 0,1,0 }  },	/* IDEO. SPACE	      */
+	{  { 0x3020 }, { 0,1,0 }  },	/* POSTAL MARK FACE   */
+	{  { 0x3029 }, { 0,1,0 }  },	/* Hangzhou NUM9      */
+	{  { 0x302F }, { 0,1,0 }  },	/* Diacritics(Hangul) */
+	{  { 0x3037 }, { 0,1,0 }  },	/* Separator Symbol   */
+	{  { 0x303F }, { 0,1,0 }  },	/* IDEO. HALF SPACE   */
+	{  { 0x3041 }, { 0,1,0 }  },	/* HIRAGANA a	      */
+	{  { 0x3094 }, { 0,1,0 }  },	/* HIRAGANA u"	      */
+	{  { 0x3099 }, { 0,1,0 }  },	/* SOUND MARK	      */
+	{  { 0x309E }, { 0,1,0 }  },	/* ITERATION MARK     */
+	{  { 0x30A1 }, { 0,1,0 }  },	/* KATAKANA a	      */
+	{  { 0x30FA }, { 0,1,0 }  },	/* KATAKANA wo"	      */
+	{  { 0x30FB }, { 0,1,0 }  },	/* KATAKANA MID.DOT   */
+	{  { 0x30FE }, { 0,1,0 }  },	/* KATAKANA ITERATION */
+	{  { 0x3191 }, { 0,1,0 }  },	/* KANBUN REV.MARK    */
+	{  { 0x3243 }, { 0,1,0 }  },	/* IDEO. MARK (reach) */
+	{  { 0x32CB }, { 0,1,0 }  },	/* IDEO.TEL.SYM.DEC12 */
+	{  { 0x32FE }, { 0,1,0 }  },	/* MARU KATAKANA wo   */
+	{  { 0x33FE }, { 0,1,0 }  },	/* CJK IDEO.TEL.31th  */
+	{  { 0x4E00 }, { 0,1,0 }  },	/* CJK UNI.IDEO.      */
+	{  { 0x4E05 }, { 0,1,0 }  },	/* CJK UNI.IDEO.      */
+	{  { 0x4E06 }, { 0,1,0 }  },	/* CJK UNI.IDEO.NON-J */
+	{  { 0x4E07 }, { 0,1,0 }  },	/* CJK UNI.IDEO.      */
+	{  { 0x4FFF }, { 0,1,0 }  },	/* CJK UNI.IDEO.      */
+	{  { 0x9000 }, { 0,1,0 }  },	/* CJK UNI.IDEO.      */
+	{  { 0x9006 }, { 0,1,0 }  },	/* CJK UNI.IDEO.      */
+	{  { 0x9007 }, { 0,1,0 }  },	/* CJK UNI.IDEO.NON-J */
+	{  { 0x9FA4 }, { 0,1,0 }  },	/* CJK UNI.IDEO.NON-J */
+	{  { 0x9FA5 }, { 0,1,0 }  },	/* CJK UNI.IDEO.      */
+	{  { 0xFE4F }, { 0,1,0 }  },	/* CJK UNI.IDEO.      */
+	{  { 0xFF0F }, { 0,1,0 }  },	/* FULL SLASH	      */
+	{  { 0xFF19 }, { 0,1,0 }  },	/* FULL 9	      */
+	{  { 0xFF20 }, { 0,1,0 }  },	/* FULL @	      */
+	{  { 0xFF3A }, { 0,1,0 }  },	/* FULL Z	      */
+	{  { 0xFF40 }, { 0,1,0 }  },	/* FULL GRAVE ACC.    */
+	{  { 0xFF5A }, { 0,1,0 }  },	/* FULL z	      */
+	{  { 0xFF5E }, { 0,1,0 }  },	/* FULL ~ (tilde)     */
+	{  { 0xFF61 }, { 0,1,0 }  },	/* HALF IDEO.STOP. .  */
+	{  { 0xFF65 }, { 0,1,0 }  },	/* HALF KATA MID.DOT  */
+	{  { 0xFF66 }, { 0,1,0 }  },	/* HALF KATA WO	      */
+	{  { 0xFF6F }, { 0,1,0 }  },	/* HALF KATA tu	      */
+	{  { 0xFF70 }, { 0,1,0 }  },	/* HALF KATA PL -     */
+	{  { 0xFF71 }, { 0,1,0 }  },	/* HALF KATA A	      */
+	{  { 0xFF9E }, { 0,1,0 }  },	/* HALF KATA MI	      */
+	{ .is_last = 1 }		/* Last element.  */
+      }
+  },
+  {   TST_ISW_REC (end, xdigit) }
+};
diff --git a/ap/build/uClibc/test/locale-mbwc/dat_mblen.c b/ap/build/uClibc/test/locale-mbwc/dat_mblen.c
new file mode 100644
index 0000000..8da038c
--- /dev/null
+++ b/ap/build/uClibc/test/locale-mbwc/dat_mblen.c
@@ -0,0 +1,137 @@
+/*
+ *  TEST SUITE FOR MB/WC FUNCTIONS IN C LIBRARY
+ *
+ *	 FILE:	dat_mblen.c
+ *
+ *	 MBLEN:	 int mblen (char *s, size_t n);
+ */
+
+
+/*
+ *  NOTE:
+ *	  int  mblen (char *s, size_t n);
+ *
+ *	  where	     n: a maximum number of bytes
+ *
+ *	  return - the number of bytes
+ *
+ *  CAUTION:
+ *
+ *	 o When you feed a null pointer for a string (s) to the function,
+ *	   set s_flg=0 instead of putting just a 'NULL' there.
+ *	   Even if you set a 'NULL', it doens't mean a NULL pointer.
+ *
+ *	 o When s is a null pointer, the function checks state dependency.
+ *
+ *	       state-dependent encoding	     - return  NON-zero
+ *	       state-independent encoding    - return  0
+ *
+ *	   If state-dependent encoding is expected, set
+ *
+ *	       s_flg = 0,  ret_flg = 0,	 ret_val = +1
+ *
+ *	   If state-independent encoding is expected, set
+ *
+ *	       s_flg = 0,  ret_flg = 0,	 ret_val = 0
+ *
+ *
+ *	   When you set ret_flg=1, the test program simply compares an
+ *	   actual return value with an expected value. You can check
+ *	   state-independent case (return value is 0) in that way, but
+ *	   you can not check state-dependent case. So when you check
+ *	   state- dependency in this test function: tst_mblen(), set
+ *	   ret_flg=0 always. It's a special case, and the test
+ *	   function takes care of it.
+ *
+ *	       s_flg=0		 ret_flg=0
+ *	       |		 |
+ *	     { 0, 0 },	 { 0, 0, 0,  x }
+ *		  |		     |
+ *		  not used	     ret_val: 0/+1
+ *				     (expected val) */
+
+
+TST_MBLEN tst_mblen_loc [] = {
+  {
+    { Tmblen, TST_LOC_de },
+    {
+      /* 01: a character.  */
+      {	 { 1, "\300",	   USE_MBCURMAX }, { 0,	1,  1 }	 },
+      /* 02: a character.  */
+      {	 { 1, "\309",	   USE_MBCURMAX }, { 0,	1,  1 }	 },
+      /* 03: a character + an invalid byte.  */
+      {	 { 1, "Z\204",	   USE_MBCURMAX }, { 0,	1, +1 }	 },
+      /* 04: control/invalid characters.  */
+      {	 { 1, "\177\000",  USE_MBCURMAX }, { 0,	1, +1 }	 },
+      /* 05: a null string.  */
+      {	 { 1, "",	   USE_MBCURMAX }, { 0,	1,  0 }	 },
+      /* 06: a null pointer.  */
+      {	 { 0, "",	   USE_MBCURMAX }, { 0,	0,  0 }	 },
+      /* Last element.	*/
+      {	 .is_last = 1 }
+    }
+  },
+  {
+    { Tmblen, TST_LOC_enUS },
+    {
+      /* 01: a character.  */
+      {	 { 1, "A",	   USE_MBCURMAX }, { 0,	1,  1 }	 },
+      /* 02: a character.  */
+      {	 { 1, "a",	   USE_MBCURMAX }, { 0,	1,  1 }	 },
+      /* 03: a character + an invalid byte.  */
+      {	 { 1, "Z\204",	   USE_MBCURMAX }, { 0,	1, +1 }	 },
+      /* 04: control/invalid characters.  */
+      {	 { 1, "\177\000",  USE_MBCURMAX }, { 0,	1, +1 }	 },
+      /* 05: a null string.  */
+      {	 { 1, "",	   USE_MBCURMAX }, { 0,	1,  0 }	 },
+      /* 06: a null pointer.  */
+      {	 { 0, "",	   USE_MBCURMAX }, { 0,	0,  0 }	 },
+      /* Last element.	*/
+      {	 .is_last = 1 }
+    }
+  },
+#if 0
+  {
+    { Tmblen, TST_LOC_eucJP },
+    {
+      /* 01: a character.  */
+      {	 { 1, "\264\301",	   USE_MBCURMAX }, { 0, 1,  2 }	 },
+      /* 02: a character.  */
+      {	 { 1, "\216\261",	   USE_MBCURMAX }, { 0, 1,  2 }  },
+      /* 03: a character + an invalid byte.  */
+      {	 { 1, "\260\241\200",	   USE_MBCURMAX }, { 0, 1,  2 }	 },
+      /* 04: control/invalid characters.  */
+      {	 { 1, "\377\202",  USE_MBCURMAX }, { EILSEQ, 1, -1 }	 },
+      /* 05: a null string.  */
+      {	 { 1, "",	   USE_MBCURMAX }, { 0,	1,  0 }	 },
+      /* 06: a null pointer.  */
+      {	 { 0, "",	   USE_MBCURMAX }, { 0,	0,  0 }	 },
+      /* Last element.	*/
+      {	 .is_last = 1 }
+    }
+  },
+#else
+  {
+    { Tmblen, TST_LOC_ja_UTF8 },
+    {
+      /* 01: a character.  */
+      {	 { 1, "\346\274\242",	   USE_MBCURMAX }, { 0, 1,  3 }	 },
+      /* 02: a character.  */
+      {	 { 1, "\357\275\261",	   USE_MBCURMAX }, { 0, 1,  3 }  },
+      /* 03: a character + an invalid byte.  */
+      {	 { 1, "\345\272\234\200",	   USE_MBCURMAX }, { 0, 1,  3 }	 },
+      /* 04: control/invalid characters.  */
+      {	 { 1, "\377\202",  USE_MBCURMAX }, { EILSEQ, 1, -1 }	 },
+      /* 05: a null string.  */
+      {	 { 1, "",	   USE_MBCURMAX }, { 0,	1,  0 }	 },
+      /* 06: a null pointer.  */
+      {	 { 0, "",	   USE_MBCURMAX }, { 0,	0,  0 }	 },
+      /* Last element.	*/
+      {	 .is_last = 1 }
+    }
+  },
+#endif
+  {
+    { Tmblen, TST_LOC_end}
+  }
+};
diff --git a/ap/build/uClibc/test/locale-mbwc/dat_mbrlen.c b/ap/build/uClibc/test/locale-mbwc/dat_mbrlen.c
new file mode 100644
index 0000000..63ae19f
--- /dev/null
+++ b/ap/build/uClibc/test/locale-mbwc/dat_mbrlen.c
@@ -0,0 +1,222 @@
+/*
+ *  TEST SUITE FOR MB/WC FUNCTIONS IN C LIBRARY
+ *
+ *	 FILE:	dat_mbrlen.c
+ *
+ *	 MBRLEN:  size_t mbrlen (const char *s, size_t n, mbstate_t *ps);
+ */
+
+/*
+ *  NOTE:
+ *	  (1) A mbstate object is initialized for
+ *	      every new data record by the test program.
+ *
+ *	  (2) USE_MBCURMAX is defined as a value of 99.
+ *
+ */
+
+
+TST_MBRLEN tst_mbrlen_loc [] = {
+  {
+    { Tmbrlen, TST_LOC_de },
+    {
+      { /*----------------- #01 -----------------*/
+	{
+	  {
+	    { 1, "",	   0,		   0, 0 },
+	    { 1, "",	   1,		   0, 0 },
+	    { 1, "\300",	   USE_MBCURMAX,   0, 0 },
+	  }
+	},
+	{
+	  {
+	    { 0,		1,  0,		     },
+	    { 0,		1,  0,		     },
+	    { 0,		1,  1,		     },
+	  }
+	}
+      },
+      { /*----------------- #02 -----------------*/
+	{
+	  {
+	    { 1, "\300\001",   0,		   0, 0 },
+	    { 1, "\300\001",   1,		   0, 0 },
+	    { 1, "\317\001",   USE_MBCURMAX,   0, 0 },
+	  }
+	},
+	{
+	  {
+	    { 0,		1,  0,		     },
+	    { 0,		1,  1,		     },
+	    { 0,		1,  1,		     },
+	  }
+	}
+      },
+      { .is_last = 1 }
+    }
+  },
+  {
+    { Tmbrlen, TST_LOC_enUS },
+    {
+      { /*----------------- #01 -----------------*/
+	{
+	  {
+	    { 1, "A",	   0,		   0, 0 },
+	    { 1, "A",	   1,		   0, 0 },
+	    { 1, "A",	   USE_MBCURMAX,   0, 0 },
+	  }
+	},
+	{
+	  {
+	    { 0,		1,  0,		     },
+	    { 0,		1,  1,		     },
+	    { 0,		1,  1,		     },
+	  }
+	}
+      },
+      { /*----------------- #02 -----------------*/
+	{
+	  {
+	    { 1, "\317\001",   0,		   1, 0 },
+	    { 1, "\317\001",   1,		   1, 0 },
+	    { 1, "\317\001",   USE_MBCURMAX,   1, 0 },
+	  }
+	},
+	{
+	  {
+	    { 0,		1,  0,		     },
+	    { EILSEQ,	1, -1,		     },
+	    { EILSEQ,	1, -1,		     },
+	  }
+	}
+      },
+      { .is_last = 1 }
+    }
+  },
+#if 0
+  {
+    { Tmbrlen, TST_LOC_eucJP },
+    {
+      { /*----------------- #01 -----------------*/
+	{
+	  {
+	    { 1, "\317\302",   1,		   1, 1 },
+	    { 0, "",	       0,		   1, 0 },
+	    { 1, "\317\302",   USE_MBCURMAX,	   1, 1 },
+	  }
+	},
+	{
+	  {
+	    { 0,		1, -2,		     },
+	    { 0,		1, -1,		     },
+	    { 0,		1,  2,		     },
+	  }
+	}
+      },
+      { /*----------------- #02 -----------------*/
+	{
+	  {
+	    { 1, "\317",	   1,		   1, 0 },
+	    { 1, "\302",	   1,		   1, 0 },
+	    { 1, "\317\302",   USE_MBCURMAX,   0, 0 },
+	  }
+	},
+	{
+	  {
+	    { 0,		1, -2,		     },
+#ifdef SHOJI_IS_RIGHT
+	    { 0,		1, +2,		     },
+#else
+	    /* XXX ISO C explicitly says that the return value does not
+	       XXX reflect the bytes contained in the state.  */
+	    { 0,		1, +1,		     },
+#endif
+	    { 0,		1,  2,		     },
+	  }
+	}
+      },
+      { /*----------------- #03 -----------------*/
+	{
+	  {
+	    { 1, "\216\217",   0,		   0, 0 },
+	    { 1, "\216\217",   1,		   0, 0 },
+	    { 1, "\216\217",   USE_MBCURMAX,   0, 0 },
+	  }
+	},
+	{
+	  {
+	    { 0,		1,  0,		     },
+	    { 0,		1, -2,		     },
+	    { EILSEQ,	1, -1,		     },
+	  }
+	}
+      },
+      { .is_last = 1 }
+    }
+  },
+#else
+  {
+    { Tmbrlen, TST_LOC_ja_UTF8 },
+    {
+      { /*----------------- #01 -----------------*/
+	{
+	  {
+	    { 1, "\345\222\214",   1,		   1, 1 },
+	    { 0, "",	       0,		   1, 0 },
+	    { 1, "\345\222\214",   USE_MBCURMAX,	   1, 1 },
+	  }
+	},
+	{
+	  {
+	    { 0,		1, -2,		     },
+	    { 0,		1, -1,		     },
+	    { 0,		1,  3,		     },
+	  }
+	}
+      },
+      { /*----------------- #02 -----------------*/
+	{
+	  {
+	    { 1, "\317",	   1,		   1, 0 },
+	    { 1, "\266",	   1,		   1, 0 },
+	    { 1, "\345\222\214",   USE_MBCURMAX,   0, 0 },
+	  }
+	},
+	{
+	  {
+	    { 0,		1, -2,		     },
+#ifdef SHOJI_IS_RIGHT
+	    { 0,		1, +2,		     },
+#else
+	    /* XXX ISO C explicitly says that the return value does not
+	       XXX reflect the bytes contained in the state.  */
+	    { 0,		1, +1,		     },
+#endif
+	    { 0,		1,  3,		     },
+	  }
+	}
+      },
+      { /*----------------- #03 -----------------*/
+	{
+	  {
+	    { 1, "\302\303",   0,		   0, 0 },
+	    { 1, "\302\303",   1,		   0, 0 },
+	    { 1, "\302\303",   USE_MBCURMAX,   0, 0 },
+	  }
+	},
+	{
+	  {
+	    { 0,		1,  0,		     },
+	    { 0,		1, -2,		     },
+	    { EILSEQ,	1, -1,		     },
+	  }
+	}
+      },
+      { .is_last = 1 }
+    }
+  },
+#endif
+  {
+    { Tmbrlen, TST_LOC_end }
+  }
+};
diff --git a/ap/build/uClibc/test/locale-mbwc/dat_mbrtowc.c b/ap/build/uClibc/test/locale-mbwc/dat_mbrtowc.c
new file mode 100644
index 0000000..b8eb3dd
--- /dev/null
+++ b/ap/build/uClibc/test/locale-mbwc/dat_mbrtowc.c
@@ -0,0 +1,140 @@
+/*
+ *  TEST SUITE FOR MB/WC FUNCTIONS IN C LIBRARY
+ *
+ *	 FILE:	dat_mbrtowc.c
+ *
+ *	 MBTOWC:  size_t mbrtowc (wchar_t *pwc, char *s, size_t n,
+ *				  mbstate_t *ps);
+ */
+
+#include <limits.h>
+
+/* Note:
+	assumes	 en_US = en_US.ascii
+*/
+
+
+
+
+TST_MBRTOWC tst_mbrtowc_loc [] = {
+  {
+    { Tmbrtowc, TST_LOC_de },
+    {
+      { /*----------------- #01 -----------------*/
+	{
+	  {
+	    { 1, 1, "ÄÖÜ",	   1,		 0, 0 },
+	    { 1, 1, "ÄÖÜ",	   2,		 0, 0 },
+	    { 1, 1, "ÄÖÜ",	   USE_MBCURMAX, 0, 0 },
+	  }
+	},
+	{
+	  {
+	    { 0,  1,  1,   0x00C4 },
+	    { 0,  1,  1,   0x00C4 },
+	    { 0,  1,  1,   0x00C4 },
+	  }
+	}
+      },
+      { /*----------------- #02 -----------------*/
+	{
+	  {
+	    { 1, 1, "ÄÖÜ",	    1,		  0, 0 },
+	    { 1, 1, "ÄÖÜ",	    2,		  0, 0 },
+	    { 1, 1, "ÄÖÜ",	    USE_MBCURMAX, 0, 0 },
+	  }
+	},
+	{
+	  {
+	    { 0,  1,  1,   0x00C4 },
+	    { 0,  1,  1,   0x00C4 },
+	    { 0,  1,  1,   0x00C4 },
+	  }
+	}
+      },
+      { .is_last = 1 }
+    }
+  },
+#if 0
+  /* XXX: These tests don't make sense to me.  */
+  {
+    { Tmbrtowc, TST_LOC_enUS },
+    {
+      { /*----------------- #01 -----------------*/
+	{
+	  {
+	    { 1, 1, "ÄÖÜ",	    1,		  0, 0 },
+	    { 1, 1, "ÄÖÜ",	    2,		  0, 0 },
+	    { 1, 1, "ÄÖÜ",	    USE_MBCURMAX, 0, 0 },
+	  }
+	},
+	{
+	  {
+	    { 0,  1,  1,   0x00C4 },
+	    { 0,  1,  1,   0x00C4 },
+	    { 0,  1,  1,   0x00C4 },
+	  }
+	}
+      },
+      { /*----------------- #02 -----------------*/
+	{
+	  {
+	    { 1, 1, "ÄÖÜ",	    1,		  0, 0 },
+	    { 1, 1, "ÄÖÜ",	    2,		  0, 0 },
+	    { 1, 1, "ÄÖÜ",	    USE_MBCURMAX, 0, 0 },
+	  }
+	},
+	{
+	  {
+	    { 0,  1,  1,   0x00C4 },
+	    { 0,  1,  1,   0x00C4 },
+	    { 0,  1,  1,   0x00C4 },
+	  }
+	}
+      },
+      { .is_last = 1 }
+    }
+  },
+  {
+    { Tmbrtowc, TST_LOC_eucJP },
+    {
+      { /*----------------- #01 -----------------*/
+	{
+	  {
+	    { 1, 1, "ÄÖÜ",	    1,		  0, 0 },
+	    { 1, 1, "ÄÖÜ",	    2,		  0, 0 },
+	    { 1, 1, "ÄÖÜ",	    USE_MBCURMAX, 0, 0 },
+	  }
+	},
+	{
+	  {
+	    { 0,  1,  1,   0x00C4 },
+	    { 0,  1,  1,   0x00C4 },
+	    { 0,  1,  1,   0x00C4 },
+	  }
+	}
+      },
+      { /*----------------- #02 -----------------*/
+	{
+	  {
+	    { 1, 1, "ÄÖÜ",	    1,		  0, 0 },
+	    { 1, 1, "ÄÖÜ",	    2,		  0, 0 },
+	    { 1, 1, "ÄÖÜ",	    USE_MBCURMAX, 0, 0 },
+	  }
+	},
+	{
+	  {
+	    { 0,  1,  1,   0x00C4 },
+	    { 0,  1,  1,   0x00C4 },
+	    { 0,  1,  1,   0x00C4 },
+	  }
+	}
+      },
+      { .is_last = 1 }
+    }
+  },
+#endif
+  {
+    { Tmbrtowc, TST_LOC_end }
+  }
+};
diff --git a/ap/build/uClibc/test/locale-mbwc/dat_mbsrtowcs.c b/ap/build/uClibc/test/locale-mbwc/dat_mbsrtowcs.c
new file mode 100644
index 0000000..30a0a6c
--- /dev/null
+++ b/ap/build/uClibc/test/locale-mbwc/dat_mbsrtowcs.c
@@ -0,0 +1,180 @@
+/*
+ *  TEST SUITE FOR MB/WC FUNCTIONS IN C LIBRARY
+ *
+ *	 FILE:	dat_mbsrtowcs.c
+ *
+ *	 MBSRTOWCS:  size_t mbsrtowcs (wchar_t *ws, char **s, size_t n,
+ *				       mbstate_t *ps);
+ */
+
+
+TST_MBSRTOWCS tst_mbsrtowcs_loc [] = {
+  {
+    { Tmbsrtowcs, TST_LOC_de },
+    {
+      { /*----------------- #01 -----------------*/
+	{
+	  {
+	    { 1,  "üäö",	    4,			 0,0 },
+	    { 1,  "üäö",	    3,			 0,0 },
+	    { 1,  "üäö",	    2,			 0,0 },
+	  }
+	},
+	{
+	  {
+	    { 0,1,3, { 0x00FC,0x00E4,0x00F6,0x0000 }	     },
+	    { 0,1,3, { 0x00FC,0x00E4,0x00F6,0x0000 }	     },
+	    { 0,1,2, { 0x00FC,0x00E4,0x00F6,0x0000 }	     },
+	  }
+	}
+      },
+      { /*----------------- #02 -----------------*/
+	{
+	  {
+	    { 1,  "üäö",	    4,			 0,0 },
+	    { 1,  "",		    1,			 0,0 },
+	    { 0,  "üäö",	    4,			 0,0 },
+	  }
+	},
+	{
+	  {
+	    { 0,1,3, { 0x00FC,0x00E4,0x00F6,0x0000 }	     },
+	    { 0,1,0, { 0x0000 }			     },
+	    { 0,1,3, { 0x0000 }			     },
+	  }
+	}
+      },
+      { /*----------------- END -----------------*/
+	.is_last = 1
+      }
+    }
+  },
+
+  {
+    { Tmbsrtowcs, TST_LOC_enUS },
+    {
+      { /*----------------- #01 -----------------*/
+	{
+	  {
+	    { 1,  "ABC",	    4,			 0,0 },
+	    { 1,  "ABC",	    3,			 0,0 },
+	    { 1,  "ABC",	    2,			 0,0 },
+	  }
+	},
+	{
+	  {
+	    { 0,1,3, { 0x0041,0x0042,0x0043,0x0000 }	     },
+	    { 0,1,3, { 0x0041,0x0042,0x0043,0x0000 }	     },
+	    { 0,1,2, { 0x0041,0x0042,0x0043,0x0000 }	     },
+	  }
+	}
+      },
+      { /*----------------- #02 -----------------*/
+	{
+	  {
+	    { 1,  "ABC",	    4,			 0,0 },
+	    { 1,  "",		    1,			 0,0 },
+	    { 0,  "ABC",	    4,			 0,0 },
+	  }
+	},
+	{
+	  {
+	    { 0,1,3, { 0x0041,0x0042,0x0043,0x0000 }	     },
+	    { 0,1,0, { 0x0000 }			     },
+	    { 0,1,3, { 0x0000 }			     },
+	  }
+	}
+      },
+      { /*----------------- END -----------------*/
+	.is_last = 1
+      }
+    }
+  },
+
+#if 0
+  {
+    { Tmbsrtowcs, TST_LOC_eucJP },
+    {
+      { /*----------------- #01 -----------------*/
+	{
+	  {
+	    { 1,  "\244\242\244\244\244\246ABC",      7, 0,0 },
+	    { 1,  "\244\242\244\244\244\246ABC",      6, 0,0 },
+	    { 1,  "\244\242\244\244\244\246ABC",      4, 0,0 },
+	  }
+	},
+	{
+	  {
+	    { 0,1,6, { 0x3042,0x3044,0x3046,0x0041,0x0042,0x0043,0x0000 }},
+	    { 0,1,6, { 0x3042,0x3044,0x3046,0x0041,0x0042,0x0043,0x0000 }},
+	    { 0,1,4, { 0x3042,0x3044,0x3046,0x0041,0x0000 }		   },
+	  }
+	}
+      },
+      { /*----------------- #02 -----------------*/
+	{
+	  {
+	    { 1,  "\244\242\244\244\244\246ABC",      7, 0,0 },
+	    { 1,  "",		      1, 0,0 },
+	    { 0,  "\244\242\244\244\244\246ABC",      7, 0,0 },
+	  }
+	},
+	{
+	  {
+	    { 0,1,6, { 0x3042,0x3044,0x3046,0x0041,0x0042,0x0043,0x0000 }},
+	    { 0,1,0, { 0x0000 }					   },
+	    { 0,1,6, { 0x0000 }					   },
+	  }
+	}
+      },
+      { /*----------------- END -----------------*/
+	.is_last = 1
+      }
+    }
+  },
+#else
+  {
+    { Tmbsrtowcs, TST_LOC_ja_UTF8 },
+    {
+      { /*----------------- #01 -----------------*/
+	{
+	  {
+	    { 1,  "\343\201\202\343\201\204\343\201\206ABC",      7, 0,0 },
+	    { 1,  "\343\201\202\343\201\204\343\201\206ABC",      6, 0,0 },
+	    { 1,  "\343\201\202\343\201\204\343\201\206ABC",      4, 0,0 },
+	  }
+	},
+	{
+	  {
+	    { 0,1,6, { 0x3042,0x3044,0x3046,0x0041,0x0042,0x0043,0x0000 }},
+	    { 0,1,6, { 0x3042,0x3044,0x3046,0x0041,0x0042,0x0043,0x0000 }},
+	    { 0,1,4, { 0x3042,0x3044,0x3046,0x0041,0x0000 }		   },
+	  }
+	}
+      },
+      { /*----------------- #02 -----------------*/
+	{
+	  {
+	    { 1,  "\343\201\202\343\201\204\343\201\206ABC",      7, 0,0 },
+	    { 1,  "",		      1, 0,0 },
+	    { 0,  "\343\201\202\343\201\204\343\201\206ABC",      7, 0,0 },
+	  }
+	},
+	{
+	  {
+	    { 0,1,6, { 0x3042,0x3044,0x3046,0x0041,0x0042,0x0043,0x0000 }},
+	    { 0,1,0, { 0x0000 }					   },
+	    { 0,1,6, { 0x0000 }					   },
+	  }
+	}
+      },
+      { /*----------------- END -----------------*/
+	.is_last = 1
+      }
+    }
+  },
+#endif
+  {
+    { Tmbsrtowcs, TST_LOC_end }
+  }
+};
diff --git a/ap/build/uClibc/test/locale-mbwc/dat_mbstowcs.c b/ap/build/uClibc/test/locale-mbwc/dat_mbstowcs.c
new file mode 100644
index 0000000..3b8ce65
--- /dev/null
+++ b/ap/build/uClibc/test/locale-mbwc/dat_mbstowcs.c
@@ -0,0 +1,190 @@
+/*
+ *  TEST SUITE FOR MB/WC FUNCTIONS IN C LIBRARY
+ *
+ *	 FILE:	dat_mbstowcs.c
+ *
+ *	 MBSTOWCS:  size_t  mbstowcs (wchar_t *ws, char *s, size_t n);
+ */
+
+#include <limits.h>
+
+TST_MBSTOWCS tst_mbstowcs_loc [] = {
+  {
+    { Tmbstowcs, TST_LOC_de },
+    {
+      { /*----------------- #01 -----------------*/
+	{
+	  {
+	    { 1,  1, "ABC",		   4			 },
+	    { 1,  1, "ABC",		   3			 },
+	    { 1,  1, "ABC",		   2			 },
+	  }
+	},
+	{
+	  {
+	    { 0,1,3, { 0x0041,0x0042,0x0043,0x0000 }	 },
+	    { 0,1,3, { 0x0041,0x0042,0x0043,0x0000 }	 },
+	    { 0,1,2, { 0x0041,0x0042,0x0043,0x0000 }	 },
+	  }
+	}
+      },
+      { /*----------------- #02 -----------------*/
+	{
+	  {
+	    { 1,  1, "ABC",		   4			 },
+	    { 1,  1, "",		   1			 },
+	    { 0,  1, "ABC",		   4			 },
+	  }
+	},
+	{
+	  {
+	    { 0,1,3, { 0x0041,0x0042,0x0043,0x0000 }	 },
+	    { 0,1,0, { 0x0000 }				 },
+	    { 0,1,3, { 0x0000 }				 },
+	  }
+	}
+      },
+      { .is_last = 1 }
+    }
+  },
+  {
+    { Tmbstowcs, TST_LOC_enUS },
+    {
+      { /*----------------- #01 -----------------*/
+	{
+	  {
+	    { 1,  1, "ABC",		   4			 },
+	    { 1,  1, "ABC",		   3			 },
+	    { 1,  1, "ABC",		   2			 },
+	  }
+	},
+	{
+	  {
+	    { 0,1,3, { 0x0041,0x0042,0x0043,0x0000 }	 },
+	    { 0,1,3, { 0x0041,0x0042,0x0043,0x0000 }	 },
+	    { 0,1,2, { 0x0041,0x0042,0x0043,0x0000 }	 },
+	  }
+	}
+      },
+      { /*----------------- #02 -----------------*/
+	{
+	  {
+	    { 1,  1, "ABC",		   4			 },
+	    { 1,  1, "",		   1			 },
+	    { 0,  1, "ABC",		   4			 },
+	  }
+	},
+	{
+	  {
+	    { 0,1,3, { 0x0041,0x0042,0x0043,0x0000 }	 },
+	    { 0,1,0, { 0x0000 }				 },
+	    { 0,1,3, { 0x0000 }				 },
+	  }
+	}
+      },
+      { .is_last = 1 }
+    }
+  },
+#if 0
+  {
+    { Tmbstowcs, TST_LOC_eucJP },
+    {
+      { /*----------------- #01 -----------------*/
+	{
+	  {
+	    { 1,  1, "\244\242\244\244\244\246ABC",      7 },
+	    { 1,  1, "\244\242\244\244\244\246ABC",      6 },
+	    { 1,  1, "\244\242\244\244\244\246ABC",      4 },
+	  }
+	},
+	{
+	  {
+	    { 0,1,6, { 0x3042,0x3044,0x3046,0x0041,0x0042,0x0043,0x0000 }},
+	    { 0,1,6, { 0x3042,0x3044,0x3046,0x0041,0x0042,0x0043,0x0000 }},
+	    { 0,1,4, { 0x3042,0x3044,0x3046,0x0041,0x0000 }		 },
+	  }
+	}
+      },
+      { /*----------------- #02 -----------------*/
+	{
+	  {
+#ifdef SHOJI_IS_RIGHT
+	    /* XXX I really don't understand the first and third line.
+	       the result of the first line is the same as the first
+	       in the last test (i.e., returns 6).  Also, the third
+	       test will simply convert everything.  */
+	    { 1,  1, "\244\242\244\244\244\246ABC",      7 },
+	    { 1,  1, "",                                 1 },
+	    { 0,  1, "\244\242\244\244\244\246ABC",      7 },
+#else
+	    { 1,  1, "\244\242\244\244\244\246ABC",      4 },
+	    { 1,  1, "",                                 1 },
+	    { 0,  1, "\244\242\244\244\244\246ABC",      0 },
+#endif
+	  }
+	},
+	{
+	  {
+	    { 0,1,4, { 0x3042,0x3044,0x3046,0x0041,0x0000 }		 },
+	    { 0,1,0, { 0x0000 }					 },
+	    { 0,1,6, { 0x0000 }					 },
+	  }
+	}
+      },
+      { .is_last = 1 }
+    }
+  },
+#else
+  {
+    { Tmbstowcs, TST_LOC_ja_UTF8 },
+    {
+      { /*----------------- #01 -----------------*/
+	{
+	  {
+	    { 1,  1, "\343\201\202\343\201\204\343\201\206ABC",      7 },
+	    { 1,  1, "\343\201\202\343\201\204\343\201\206ABC",      6 },
+	    { 1,  1, "\343\201\202\343\201\204\343\201\206ABC",      4 },
+	  }
+	},
+	{
+	  {
+	    { 0,1,6, { 0x3042,0x3044,0x3046,0x0041,0x0042,0x0043,0x0000 }},
+	    { 0,1,6, { 0x3042,0x3044,0x3046,0x0041,0x0042,0x0043,0x0000 }},
+	    { 0,1,4, { 0x3042,0x3044,0x3046,0x0041,0x0000 }		 },
+	  }
+	}
+      },
+      { /*----------------- #02 -----------------*/
+	{
+	  {
+#ifdef SHOJI_IS_RIGHT
+	    /* XXX I really don't understand the first and third line.
+	       the result of the first line is the same as the first
+	       in the last test (i.e., returns 6).  Also, the third
+	       test will simply convert everything.  */
+	    { 1,  1, "\244\242\244\244\244\246ABC",      7 },
+	    { 1,  1, "",                                 1 },
+	    { 0,  1, "\244\242\244\244\244\246ABC",      7 },
+#else
+	    { 1,  1, "\343\201\202\343\201\204\343\201\206ABC",      4 },
+	    { 1,  1, "",                                 1 },
+	    { 0,  1, "\343\201\202\343\201\204\343\201\206ABC",      7 },
+#endif
+	  }
+	},
+	{
+	  {
+	    { 0,1,4, { 0x3042,0x3044,0x3046,0x0041,0x0000 }		 },
+	    { 0,1,0, { 0x0000 }					 },
+	    { 0,1,6, { 0x0000 }					 },
+	  }
+	}
+      },
+      { .is_last = 1 }
+    }
+  },
+#endif
+  {
+    { Tmbstowcs, TST_LOC_end }
+  }
+};
diff --git a/ap/build/uClibc/test/locale-mbwc/dat_mbtowc.c b/ap/build/uClibc/test/locale-mbwc/dat_mbtowc.c
new file mode 100644
index 0000000..6527dfc
--- /dev/null
+++ b/ap/build/uClibc/test/locale-mbwc/dat_mbtowc.c
@@ -0,0 +1,444 @@
+/*
+ *  TEST SUITE FOR MB/WC FUNCTIONS IN C LIBRARY
+ *
+ *	 FILE:	dat_mbtowc.c
+ *
+ *	 MBTOWC:  int  mbtowc (wchar_t *wp, char *s, size_t n);
+ */
+
+/*  NOTE:
+ *
+ *	 int  mbtowc (wchar_t *wp, char *s, size_t n);
+ *
+ *	 where	     n: a maximum number of bytes
+ *		return: the number of bytes
+ *
+ *
+ *	  o When you feed a null pointer for a string (s) to the function,
+ *	    set s_flg=0 instead of putting just a 'NULL' there.
+ *	    Even if you put a 'NULL', it means a null string as well as "".
+ *
+ *	  o When s is a null pointer, the function checks state dependency.
+ *
+ *		state-dependent encoding      - return	NON-zero
+ *		state-independent encoding    - return	0
+ *
+ *	    If state-dependent encoding is expected, set
+ *
+ *		s_flg = 0,  ret_flg = 0,  ret_val = +1
+ *
+ *	    If state-independent encoding is expected, set
+ *
+ *		s_flg = 0,  ret_flg = 0,  ret_val = 0
+ *
+ *
+ *	    When you set ret_flg=1, the test program simply compares
+ *	    an actual return value with an expected value. You can
+ *	    check state-independent case (return value is 0) in that
+ *	    way, but you can not check state-dependent case. So when
+ *	    you check state- dependency in this test function:
+ *	    tst_mbtowc(), set ret_flg=0 always. It's a special case
+ *	    and the test function takes care of it.
+ *
+ *			  w_flg
+ *			  |	s: (a null string; can't be (char *)NULL)
+ *			  |	|
+ *	       input.	{ 1, 0, (char)NULL, MB_LEN_MAX	},
+ *			     |
+ *			     s_flg=0: makes _s_ a null pointer.
+ *
+ *	       expect	{ 0,0,0,x,     0x0000	  },
+ *			      | |
+ *			      | ret_val: 0/+1
+ *			      ret_flg=0
+ *
+ *
+ *    Test data for State dependent encodings:
+ *
+ *	  mbtowc( NULL, NULL, 0 );	 ... first  data
+ *	  mbtowc( &wc,	s1,  n1 );	 ... second data
+ *	  mbtowc( &wc,	s2,  n2 );	 ... third  data
+ * */
+
+#include <limits.h>
+
+TST_MBTOWC tst_mbtowc_loc [] = {
+  {
+    { Tmbtowc, TST_LOC_de },
+    {
+      { /*----------------- #01 -----------------*/
+	{
+	  {
+	    { 1, 1, "\xfc\xe4\xf6",	    1	       },
+	    { 1, 1, "\xfc\xe4\xf6",	    2	       },
+	    { 1, 1, "\xfc\xe4\xf6",	    MB_LEN_MAX },
+	  }
+	},
+	{
+	  {
+	    { 0,  1,  1,   0x00FC },
+	    { 0,  1,  1,   0x00FC },
+	    { 0,  1,  1,   0x00FC },
+	  }
+	}
+      },
+      { /*----------------- #02 -----------------*/
+	{
+	  {
+	    { 1, 1, "\177",	    MB_LEN_MAX },
+	    { 1, 1, "\200",	    MB_LEN_MAX },
+	    { 1, 1, "\201",	    MB_LEN_MAX },
+	  }
+	},
+	{
+	  {
+	    { 0,  1,  1,   0x007F },
+	    { 0,  1,  1,   0x0080 },
+	    { 0,  1,  1,   0x0081 },
+	  }
+	}
+      },
+      { /*----------------- #03 -----------------*/
+	{
+	  {
+	    { 1, 1, "",			    MB_LEN_MAX },
+	    { 0, 1, "\xfc\xe4\xf6",	    1	       },
+	    { 0, 1, "\xfc\xe4\xf6",	    2	       },
+	  }
+	},
+	{
+	  {
+	    { 0,  1,  0,   0x0000 },
+	    { 0,  1,  1,   0x0000 },
+	    { 0,  1,  1,   0x0000 },
+	  }
+	}
+      },
+      { /*----------------- #04 -----------------*/
+	{
+	  {
+	    { 0, 1, "\xfc\xe4\xf6",	    MB_LEN_MAX },
+	    { 0, 1, "\177",		    MB_LEN_MAX },
+	    { 0, 1, "",	 		   MB_LEN_MAX },
+	  }
+	},
+	{
+	  {
+	    { 0,  1,  1,   0x0000 },
+	    { 0,  1,  1,   0x0000 },
+	    { 0,  1,  0,   0x0000 },
+	  }
+	}
+      },
+      { /*----------------- #05 -----------------*/
+	{
+	  {
+	    { 0, 1, "\xfc\xe4\xf6",	MB_LEN_MAX },
+	    { 0, 1, "\177",	   	MB_LEN_MAX },
+	    { 0, 0, (char)NULL, 	MB_LEN_MAX },
+	  }
+	},
+	{
+	  {
+	    { 0,  1,  1,   0x0000 },
+	    { 0,  1,  1,   0x0000 },
+	    { 0,  0,  0,   0x0000 },
+	  }
+	}
+      },
+      { .is_last = 1 }
+    }
+  },
+  {
+    { Tmbtowc, TST_LOC_enUS },
+    {
+      { /*----------------- #01 -----------------*/
+	{
+	  {
+	    { 1, 1, "ABC",	    1	       },
+	    { 1, 1, "ABC",	    2	       },
+	    { 1, 1, "ABC",	    MB_LEN_MAX },
+	  }
+	},
+	{
+	  {
+	    { 0,  1,  1,   0x0041 },
+	    { 0,  1,  1,   0x0041 },
+	    { 0,  1,  1,   0x0041 },
+	  }
+	}
+      },
+      { /*----------------- #02 -----------------*/
+	{
+	  {
+	    { 1, 1, "\177",	    MB_LEN_MAX },
+	    { 1, 1, "\200",	    MB_LEN_MAX },
+	    { 1, 1, "\201",	    MB_LEN_MAX },
+	  }
+	},
+	{
+	  {
+	    { 0,  1,  1,   0x007F },
+	    { EILSEQ,  1, -1,   0x0000 },
+	    { EILSEQ,  1, -1,   0x0000 },
+	  }
+	}
+      },
+      { /*----------------- #03 -----------------*/
+	{
+	  {
+	    { 1, 1, "",	    MB_LEN_MAX },
+	    { 0, 1, "ABC",	    1	       },
+	    { 0, 1, "ABC",	    2	       },
+	  }
+	},
+	{
+	  {
+	    { 0,  1,  0,   0x0000 },
+	    { 0,  1,  1,   0x0000 },
+	    { 0,  1,  1,   0x0000 },
+	  }
+	}
+      },
+      { /*----------------- #04 -----------------*/
+	{
+	  {
+	    { 0, 1, "ABC",	    MB_LEN_MAX },
+	    { 0, 1, "\177",	    MB_LEN_MAX },
+	    { 0, 1, "",	    MB_LEN_MAX },
+	  }
+	},
+	{
+	  {
+	    { 0,  1,  1,   0x0000 },
+	    { 0,  1,  1,   0x0000 },
+	    { 0,  1,  0,   0x0000 },
+	  }
+	}
+      },
+      { /*----------------- #05 -----------------*/
+	{
+	  {
+	    { 0, 1, "ABC",	    MB_LEN_MAX },
+	    { 0, 1, "\177",	    MB_LEN_MAX },
+	    { 0, 0, (char)NULL, MB_LEN_MAX },
+	  }
+	},
+	{
+	  {
+	    { 0,  1,  1,   0x0000 },
+	    { 0,  1,  1,   0x0000 },
+	    { 0,  0,  0,   0x0000 },
+	  }
+	}
+      },
+      { .is_last = 1 }
+    }
+  },
+#if 0
+  {
+    { Tmbtowc, TST_LOC_eucJP },
+    {
+      { /*----------------- #01 -----------------*/
+	{
+	  {
+	    { 1, 1, "\244\242A",      1          },
+	    { 1, 1, "\244\242A",      2          },
+	    { 1, 1, "\244\242A",      MB_LEN_MAX },
+	  }
+	},
+	{
+	  {
+#ifdef SHOJI_IS_RIGHT
+	    { EILSEQ,  1, -1,   0x0000 },
+#else
+	    /* XXX EILSEQ was introduced in ISO C99.  */
+	    { 0,	  1, -1,   0x0000 },
+#endif
+	    { 0,       1,  2,   0x3042 },
+	    { 0,       1,  2,   0x3042 },
+	  }
+	}
+      },
+      { /*----------------- #02 -----------------*/
+	{
+	  {
+	    { 1, 1, "\177\244\242",   MB_LEN_MAX },
+	    { 1, 1, "\377\244\242",   MB_LEN_MAX },
+	    { 1, 1, "\201\244\242",   MB_LEN_MAX },
+	  }
+	},
+	{
+	  {
+	    { 0,  1, +1,   0x007F },
+#ifdef SHOJI_IS_RIGHT
+	    { EILSEQ,  1, -1,   0x0000 },
+#else
+	    { 0,  1, -1,   0x0000 },
+#endif
+	    { 0,  1, +1,   0x0081 },
+	  }
+	}
+      },
+      { /*----------------- #03 -----------------*/
+	{
+	  {
+	    { 1, 1, "",         MB_LEN_MAX },
+	    { 0, 1, "\244\242A",      1          },
+	    { 0, 1, "\244\242A",      2          },
+	  }
+	},
+	{
+	  {
+	    { 0,  1,  0,   0x0000 },
+#ifdef SHOJI_IS_RIGHT
+	    { EILSEQ,  1, -1,   0x0000 },
+#else
+	    /* XXX EILSEQ was introduced in ISO C99.  */
+	    { 0,       1, -1,   0x0000 },
+#endif
+	    { 0,  1,  2,   0x0000 },
+	  }
+	}
+      },
+      { /*----------------- #04 -----------------*/
+	{
+	  {
+	    { 0, 1, "\244\242A",      MB_LEN_MAX },
+	    { 0, 1, "\177\244\242",   MB_LEN_MAX },
+	    { 0, 1, "",         MB_LEN_MAX },
+	  }
+	},
+	{
+	  {
+	    { 0,  1,  2,   0x0000 },
+	    { 0,  1, +1,   0x0000 },
+	    { 0,  1,  0,   0x0000 },
+	  }
+	}
+      },
+      { /*----------------- #05 -----------------*/
+	{
+	  {
+	    { 0, 1, "\244\242A",      MB_LEN_MAX },
+	    { 0, 1, "\177\244\242",   MB_LEN_MAX },
+	    { 0, 0, (char)NULL, MB_LEN_MAX },
+	  }
+	},
+	{
+	  {
+	    { 0,  1,  2,   0x0000 },
+	    { 0,  1, +1,   0x0000 },
+	    { 0,  0,  0,   0x0000 },
+	  }
+	}
+      },
+      { .is_last = 1 }
+    }
+  },
+#else
+  {
+    { Tmbtowc, TST_LOC_ja_UTF8 },
+    {
+      { /*----------------- #01 -----------------*/
+	{
+	  {
+	    { 1, 1, "\343\201\202A",      1          },
+	    { 1, 1, "\343\201\202A",      3          },
+	    { 1, 1, "\343\201\202A",      MB_LEN_MAX },
+	  }
+	},
+	{
+	  {
+#ifdef SHOJI_IS_RIGHT
+	    { EILSEQ,  1, -1,   0x0000 },
+#else
+	    /* XXX EILSEQ was introduced in ISO C99.  */
+	    { 0,	  1, -1,   0x0000 },
+#endif
+	    { 0,       1,  3,   0x3042 },
+	    { 0,       1,  3,   0x3042 },
+	  }
+	}
+      },
+      { /*----------------- #02 -----------------*/
+	{
+	  {
+	    { 1, 1, "\177\343\201\202",   MB_LEN_MAX },
+	    { 1, 1, "\377\343\201\202",   MB_LEN_MAX },
+	    { 1, 1, "\302\201\343\201\202",   MB_LEN_MAX },
+	  }
+	},
+	{
+	  {
+	    { 0,  1, +1,   0x007F },
+#ifdef SHOJI_IS_RIGHT
+	    { EILSEQ,  1, -1,   0x0000 },
+#else
+	    { 0,  1, -1,   0x0000 },
+#endif
+	    { 0,  1, +2,   0x0081 },
+	  }
+	}
+      },
+      { /*----------------- #03 -----------------*/
+	{
+	  {
+	    { 1, 1, "",         MB_LEN_MAX },
+	    { 0, 1, "\343\201\202A",      1          },
+	    { 0, 1, "\343\201\202A",      3          },
+	  }
+	},
+	{
+	  {
+	    { 0,  1,  0,   0x0000 },
+#ifdef SHOJI_IS_RIGHT
+	    { EILSEQ,  1, -1,   0x0000 },
+#else
+	    /* XXX EILSEQ was introduced in ISO C99.  */
+	    { 0,       1, -1,   0x0000 },
+#endif
+	    { 0,  1,  3,   0x0000 },
+	  }
+	}
+      },
+      { /*----------------- #04 -----------------*/
+	{
+	  {
+	    { 0, 1, "\343\201\202A",      MB_LEN_MAX },
+	    { 0, 1, "\177\343\201\202",   MB_LEN_MAX },
+	    { 0, 1, "",         MB_LEN_MAX },
+	  }
+	},
+	{
+	  {
+	    { 0,  1,  3,   0x0000 },
+	    { 0,  1, +1,   0x0000 },
+	    { 0,  1,  0,   0x0000 },
+	  }
+	}
+      },
+      { /*----------------- #05 -----------------*/
+	{
+	  {
+	    { 0, 1, "\343\201\202A",      MB_LEN_MAX },
+	    { 0, 1, "\177\343\201\202",   MB_LEN_MAX },
+	    { 0, 0, (char)NULL, MB_LEN_MAX },
+	  }
+	},
+	{
+	  {
+	    { 0,  1,  3,   0x0000 },
+	    { 0,  1, +1,   0x0000 },
+	    { 0,  0,  0,   0x0000 },
+	  }
+	}
+      },
+      { .is_last = 1 }
+    }
+  },
+#endif
+  {
+    { Tmbtowc, TST_LOC_end }
+  }
+};
diff --git a/ap/build/uClibc/test/locale-mbwc/dat_strcoll.c b/ap/build/uClibc/test/locale-mbwc/dat_strcoll.c
new file mode 100644
index 0000000..e12037c
--- /dev/null
+++ b/ap/build/uClibc/test/locale-mbwc/dat_strcoll.c
@@ -0,0 +1,209 @@
+/*
+ *  TEST SUITE FOR MB/WC FUNCTIONS IN C LIBRARY
+ *
+ *	 FILE: dat_strcoll.c
+ *
+ *	 STRCOLL:  int strcoll (const char *s1, const char *s2);
+ */
+
+/*
+   NOTE:
+
+   If a return value is expected to be 0, set ret_flg=1 and the
+   expected value = 0.	If a return value is expected to be a
+   positive/negative value, set ret_flg=0, and set the expected value
+   = +1/-1.
+   There is inconsistensy between tst_strcoll() and tst_wcscoll()(it
+   has cmp_flg) for input data. I'll fix it.
+
+   Assuming en_US to be en_US.ascii. (maybe, should be iso8859-1).
+
+
+
+   ASCII CODE  : A,B,C, ...  , a, b, c, ...	 B,a:-1	  a,B:+1
+   DICTIONARY : A,a,B,b,C,c,....  a,B:-1 B,a:+1 */
+
+TST_STRCOLL tst_strcoll_loc [] = {
+  {
+    { Tstrcoll, TST_LOC_de },
+    {
+      { /*input.*/ { "ÄBCDEFG", "ÄBCDEFG"	      },  /* #1 */
+	/*expect*/ { 0,1,0,			      },
+      },
+      { /*input.*/ { "XX Ä XX", "XX B XX"	      },  /* #2 */
+	/*expect*/ { 0,0,-1,			      },
+      },
+      { /*input.*/ { "XX B XX", "XX Ä XX"	      },  /* #3 */
+	/*expect*/ { 0,0,+1,			      },
+      },
+      { /*input.*/ { "B",	"a"		      },  /* #4 */
+	/*expect*/ { 0,0,+1,			      },
+      },
+      { /*input.*/ { "a",	"B"		      },  /* #5 */
+	/*expect*/ { 0,0,-1,			      },
+      },
+      { /*input.*/ { "b",	"A"		      },  /* #6 */
+	/*expect*/ { 0,0,+1,			      },
+      },
+      { /*input.*/ { "A",	"b"		      },  /* #7 */
+	/*expect*/ { 0,0,-1,			      },
+      },
+      { /*input.*/ { "ä",	"B"		      },  /* #8 */
+	/*expect*/ { 0,0,-1,			      },
+      },
+      { /*input.*/ { "B",	"ä"		      },  /* #9 */
+	/*expect*/ { 0,0,+1,			      },
+      },
+      { .is_last = 1 } /* Last element.  */
+    }
+  },
+  {
+    { Tstrcoll, TST_LOC_en },
+    {
+      { /*input.*/ { "ABCDEFG", "ABCDEFG"	      },  /* #1 */
+	/*expect*/ { 0,1,0,			      },
+      },
+      { /*input.*/ { "XX a XX", "XX B XX"	      },  /* #2 */
+	/*expect*/ { 0,0,-1,			      },
+      },
+      { /*input.*/ { "XX B XX", "XX a XX"	      },  /* #3 */
+	/*expect*/ { 0,0,+1,			      },
+      },
+      {
+	/* <WAIVER> */
+	/*input.*/ { "B",	"a"		      },  /* #4 */
+#ifdef SHOJI_IS_RIGHT
+	/*expect*/ { 0,0,-1,			      },
+#else
+		   /* XXX We are not testing the C locale.  */
+	/*expect*/ { 0,0,+1,			      },
+#endif
+      },
+      {
+	/* <WAIVER> */
+	/*input.*/ { "a",	"B"		      },  /* #5 */
+#ifdef SHOJI_IS_RIGHT
+	/*expect*/ { 0,0,+1,			      },
+#else
+		   /* XXX We are not testing the C locale.  */
+	/*expect*/ { 0,0,-1,			      },
+#endif
+      },
+      { /*input.*/ { "b",	"A"		      },  /* #6 */
+	/*expect*/ { 0,0,+1,			      },
+      },
+      { /*input.*/ { "A",	"b"		      },  /* #7 */
+	/*expect*/ { 0,0,-1,			      },
+      },
+#ifdef NO_WAIVER
+      /* XXX I do not yet know whether strcoll really should reject
+	 characters outside the multibyte character range.  */
+      {
+	/* #8 */  /* <WAIVER> */
+	/*input.*/ { "\244\242\244\244\244\246\244\250\244\252", "ABCDEFG" },
+	/*expect*/ { EINVAL,0,0,		      },
+      },
+      {
+	/* #9 */  /* <WAIVER> */
+	/*input.*/ { "ABCZEFG", "\244\242\244\244\244\246\244\250\244\252" },
+	/*expect*/ { EINVAL,0,0,		      },
+      },
+#endif
+      { .is_last = 1 } /* Last element.  */
+    }
+  },
+#if 0
+  {
+    { Tstrcoll, TST_LOC_eucJP },
+    {
+      { /*input.*/ { "\244\242\244\244\244\246\244\250\244\252",
+		     "\244\242\244\244\244\246\244\250\244\252" },  /* #1 */
+	/*expect*/ { 0,1,0,			      },
+      },
+      { /*input.*/ { "\244\242\244\244\244\246\244\250\244\252",
+		     "\244\242\244\244\244\363\244\250\244\252" },  /* #2 */
+	/*expect*/ { 0,0,-1,			      },
+      },
+      { /*input.*/ { "\244\242\244\244\244\363\244\250\244\252",
+		     "\244\242\244\244\244\246\244\250\244\252" },  /* #3 */
+	/*expect*/ { 0,0,+1,			      },
+      },
+      { /*input.*/ { "B",	"a"		      },  /* #4 */
+	/*expect*/ { 0,0,-1,			      },
+      },
+      { /*input.*/ { "a",	"B"		      },  /* #5 */
+	/*expect*/ { 0,0,+1,			      },
+      },
+      { /*input.*/ { "b",	"A"		      },  /* #6 */
+	/*expect*/ { 0,0,+1,			      },
+      },
+      { /*input.*/ { "A",	"b"		      },  /* #7 */
+	/*expect*/ { 0,0,-1,			      },
+      },
+#ifdef NO_WAIVER
+      /* XXX I do not yet know whether strcoll really should reject
+	 characters outside the multibyte character range.  */
+      {
+	/* <WAIVER> */
+	/*input.*/ { "\200\216\217", "ABCDEFG"	      },  /* #8 */
+	/*expect*/ { EINVAL,0,0,		      },
+      },
+      {
+	/* <WAIVER> */
+	/*input.*/ { "ABCZEFG", "\200\216\217"	      },  /* #9 */
+	/*expect*/ { EINVAL,0,0,		      },
+      },
+#endif
+      { .is_last = 1 } /* Last element.  */
+    }
+  },
+#else
+  {
+    { Tstrcoll, TST_LOC_ja_UTF8 },
+    {
+      { /*input.*/ { "\343\201\202\343\201\204\343\201\206\343\201\210\343\201\212",
+		     "\343\201\202\343\201\204\343\201\206\343\201\210\343\201\212" },  /* #1 */
+	/*expect*/ { 0,1,0,			      },
+      },
+      { /*input.*/ { "\343\201\202\343\201\204\343\201\206\343\201\210\343\201\212",
+		     "\343\201\202\343\201\204\343\202\223\343\201\210\343\201\212" },  /* #2 */
+	/*expect*/ { 0,0,-1,			      },
+      },
+      { /*input.*/ { "\343\201\202\343\201\204\343\202\223\343\201\210\343\201\212",
+		     "\343\201\202\343\201\204\343\201\206\343\201\210\343\201\212" },  /* #3 */
+	/*expect*/ { 0,0,+1,			      },
+      },
+      { /*input.*/ { "B",	"a"		      },  /* #4 */
+	/*expect*/ { 0,0,-1,			      },
+      },
+      { /*input.*/ { "a",	"B"		      },  /* #5 */
+	/*expect*/ { 0,0,+1,			      },
+      },
+      { /*input.*/ { "b",	"A"		      },  /* #6 */
+	/*expect*/ { 0,0,+1,			      },
+      },
+      { /*input.*/ { "A",	"b"		      },  /* #7 */
+	/*expect*/ { 0,0,-1,			      },
+      },
+#ifdef NO_WAIVER
+      /* XXX I do not yet know whether strcoll really should reject
+	 characters outside the multibyte character range.  */
+      {
+	/* <WAIVER> */
+	/*input.*/ { "\200\216\217", "ABCDEFG"	      },  /* #8 */
+	/*expect*/ { EINVAL,0,0,		      },
+      },
+      {
+	/* <WAIVER> */
+	/*input.*/ { "ABCZEFG", "\200\216\217"	      },  /* #9 */
+	/*expect*/ { EINVAL,0,0,		      },
+      },
+#endif
+      { .is_last = 1 } /* Last element.  */
+    }
+  },
+#endif
+  {
+    { Tstrcoll, TST_LOC_end }
+  }
+};
diff --git a/ap/build/uClibc/test/locale-mbwc/dat_strfmon.c b/ap/build/uClibc/test/locale-mbwc/dat_strfmon.c
new file mode 100644
index 0000000..8c28bba
--- /dev/null
+++ b/ap/build/uClibc/test/locale-mbwc/dat_strfmon.c
@@ -0,0 +1,268 @@
+/*
+ *  TEST SUITE FOR MB/WC FUNCTIONS IN CLIBRARY
+ *
+ *	 FILE:	dat_strfmon.c
+ *
+ *	 STRFMON:  size_t strfmon (char *buf, size_t nbyte, char *fmt, ... );
+ */
+
+/*
+ *  NOTE:
+ *
+ *  The buffer size should be enough to contain a string including a
+ *  null char.
+ *  Returns the number of bytes of the string (NOT including a null char).
+ */
+
+TST_STRFMON tst_strfmon_loc [] = {
+  {
+    { Tstrfmon, TST_LOC_de },
+    {
+      {
+	/* #01 */
+	/*inp*/ { 24, "%n %% %i",	     123.00			},
+	/*exp*/ { 0,1,23,		     "123,00 EUR % 123,00 EUR"	},
+      },
+      {
+	/* #02 */
+	/*inp*/ { 24, "%n %% %i",	     123.00			},
+	/*exp*/ { 0,1,23,		     "123,00 EUR % 123,00 EUR"	},
+      },
+      {
+	/* #03 */
+	/*inp*/ { 23, "%n %% %i",	     123.00			},
+	/*exp*/ { E2BIG,1,-1,	     ""					},
+      },
+      {
+	/* #04 */
+	/*inp*/ { 31, "%n|%i",	     1234.561				},
+	/*exp*/ { 0,1,25,		     "1.234,56 EUR|1.234,56 EUR"},
+      },
+      {
+	/* #05 */
+	/*inp*/ { 33, "%n|%i",	    -1234.561				},
+	/*exp*/ { 0,1,27,		     "-1.234,56 EUR|-1.234,56 EUR"},
+      },
+      {
+	/* #06 */
+	/*inp*/ { 33, "%13n|%12i",	     1234.561			},
+	/*exp*/ { 0,1,26,		     " 1.234,56 EUR|1.234,56 EUR"},
+      },
+      {
+	/* #07 */
+	/*inp*/ { 33, "%12n|%12i",	    -1234.561			},
+	/*exp*/ { 0,1,27,		     "-1.234,56 EUR|-1.234,56 EUR"},
+      },
+      {
+	/* #08 */
+	/*inp*/ { 33, "%#5n|%#5i",	     1234.561			},
+	/*exp*/ { 0,1,29,		     "  1.234,56 EUR|  1.234,56 EUR"},
+      },
+      {
+	/* #09 */
+	/*inp*/ { 33, "%#5n|%#5i",	    -1234.561			},
+	/*exp*/ { 0,1,29,		     "- 1.234,56 EUR|- 1.234,56 EUR"},
+      },
+      {
+	/* #10 */
+	/*inp*/ { 33, "%=*#5n|%=*#5i",	 1234.561			},
+	/*exp*/ { 0,1,29,		     " *1.234,56 EUR| *1.234,56 EUR"},
+      },
+      {
+	/* #11 */
+	/*inp*/ { 33, "%=0#5n|%=0#5i",	-1234.561			},
+	/*exp*/ { 0,1,29,		     "-01.234,56 EUR|-01.234,56 EUR"},
+      },
+      {
+	/* #12 */
+	/*inp*/ { 33, "%^#5n|%^#5i",	-1234.561			},
+	/*exp*/ { 0,1,27,		     "- 1234,56 EUR|- 1234,56 EUR"},
+      },
+      {
+	/* #13 */
+	/*inp*/ { 33, "%#5.0n|%#5.0i",	 1234.444			},
+	/*exp*/ { 0,1,23,		     "  1.234 EUR|  1.234 EUR"	},
+      },
+      {
+	/* #14 */
+	/*inp*/ { 33, "%#5.0n|%#5.4i",	-1234.555			},
+	/*exp*/ { 0,1,28,		     "- 1.235 EUR|- 1.234,5550 EUR"},
+      },
+      {
+	/* #15 */
+	/*inp*/ { 33, "%(#5n|%!(#5i",	-1234.561			},
+	/*exp*/ { 0,1,27,		     "( 1.234,56 EUR)|( 1.234,56)"},
+      },
+      { .is_last = 1 }
+    }
+  },
+  {
+    { Tstrfmon, TST_LOC_enUS },
+    {
+      {
+	/* #01 */
+	/*inp*/ { 22, "%n %% %i",	     123.00			},
+	/*exp*/ { 0,1,20,		     "$123.00 % USD 123.00"	},
+      },
+      {
+	/* #02 */
+	/*inp*/ { 21, "%n %% %i",	     123.00			},
+	/*exp*/ { 0,1,20,		     "$123.00 % USD 123.00"	},
+      },
+      {
+	/* #03 */
+	/*inp*/ { 20, "%n %% %i",	     123.00			},
+	/*exp*/ { E2BIG,1,-1,	     ""					},
+      },
+      {
+	/* #04 */
+	/*inp*/ { 30, "%n|%i",	     1234.561				},
+	/*exp*/ { 0,1,22,		     "$1,234.56|USD 1,234.56"	},
+      },
+      {
+	/* #05 */
+	/*inp*/ { 32, "%n|%i",	    -1234.561				},
+	/*exp*/ { 0,1,24,		     "-$1,234.56|-USD 1,234.56"	},
+      },
+      {
+	/* #06 */
+	/*inp*/ { 30, "%12n|%12i",	     1234.561			},
+	/*exp*/ { 0,1,25,		     "   $1,234.56|USD 1,234.56"},
+      },
+      {
+	/* #07 */
+	/*inp*/ { 32, "%12n|%12i",	    -1234.561			},
+	/*exp*/ { 0,1,26,		     "  -$1,234.56|-USD 1,234.56"},
+      },
+      {
+	/* #08 */
+	/*inp*/ { 32, "%#5n|%#5i",	     1234.561			},
+	/*exp*/ { 0,1,26,		     " $ 1,234.56| USD  1,234.56"},
+      },
+      {
+	/* #09 */
+	/*inp*/ { 32, "%#5n|%#5i",	    -1234.561			},
+	/*exp*/ { 0,1,26,		     "-$ 1,234.56|-USD  1,234.56"},
+      },
+      {
+	/* #10 */
+	/*inp*/ { 32, "%=*#5n|%=*#5i",	 1234.561			},
+	/*exp*/ { 0,1,26,		     " $*1,234.56| USD *1,234.56"},
+      },
+      {
+	/* #11 */
+	/*inp*/ { 32, "%=0#5n|%=0#5i",	-1234.561			},
+	/*exp*/ { 0,1,26,		     "-$01,234.56|-USD 01,234.56"},
+      },
+      {
+	/* #12 */
+	/*inp*/ { 32, "%^#5n|%^#5i",	-1234.561			},
+	/*exp*/ { 0,1,24,		     "-$ 1234.56|-USD  1234.56"	},
+      },
+      {
+	/* #13 */
+	/*inp*/ { 32, "%#5.0n|%#5.0i",	 1234.444			},
+	/*exp*/ { 0,1,20,		     " $ 1,234| USD  1,234"	},
+      },
+      {
+	/* #14 */
+	/*inp*/ { 32, "%#5.0n|%#5.4i",	-1234.555			},
+	/*exp*/ { 0,1,25,		     "-$ 1,235|-USD  1,234.5550"},
+      },
+      {
+	/* #15 */
+	/*inp*/ { 32, "%(#5n|%!(#5i",	-1234.561			},
+	/*exp*/ { 0,1,24,		     "($ 1,234.56)|( 1,234.56)"	},
+      },
+      { .is_last = 1 }
+    }
+  },
+  {
+#if 0
+    { Tstrfmon, TST_LOC_eucJP },
+#else
+    { Tstrfmon, TST_LOC_ja_UTF8 },
+#endif
+    {
+      {
+	/* #01 */
+	/*inp*/ { 17, "%n %% %i",	 123.00				   },
+	/*exp*/ { 0,1,15,		 "\241\357123 % JPY 123"	   },
+      },
+      {
+	/* #02 */
+	/*inp*/ { 16, "%n %% %i",	 123.00				   },
+	/*exp*/ { 0,1,15,		 "\241\357123 % JPY 123"	   },
+      },
+      {
+	/* #03 */
+	/*inp*/ { 15, "%n %% %i",	 123.00				   },
+	/*exp*/ { E2BIG,1,-1,		 ""				   },
+      },
+      {
+	/* #04 */
+	/*inp*/ { 30, "%n|%i",		 1234.561			   },
+	/*exp*/ { 0,1,17,		 "\241\3571,235|JPY 1,235"	   },
+      },
+      {
+	/* #05 */
+	/*inp*/ { 32, "%n|%i",		-1234.561			   },
+	/*exp*/ { 0,1,19,		 "\241\357-1,235|JPY -1,235"	   },
+      },
+      {
+	/* #06 */
+	/*inp*/ { 32, "%12n|%12i",	 1234.561			   },
+	/*exp*/ { 0,1,25,		 "     \241\3571,235|   JPY 1,235" },
+      },
+      {
+	/* #07 */
+	/*inp*/ { 32, "%12n|%12i",	-1234.561			   },
+	/*exp*/ { 0,1,25,		 "    \241\357-1,235|  JPY -1,235" },
+      },
+      {
+	/* #08 */
+	/*inp*/ { 32, "%#5n|%#5i",	 1234.561			   },
+	/*exp*/ { 0,1,21,		 " \241\357 1,235| JPY  1,235"	   },
+      },
+      {
+	/* #09 */
+	/*inp*/ { 32, "%#5n|%#5i",	-1234.561			   },
+	/*exp*/ { 0,1,21,		 "\241\357- 1,235|JPY - 1,235"	   },
+      },
+      {
+	/* #10 */
+	/*inp*/ { 32, "%=*#5n|%=*#5i",	 1234.561			   },
+	/*exp*/ { 0,1,21,		 " \241\357*1,235| JPY *1,235"	   },
+      },
+      {
+	/* #11 */
+	/*inp*/ { 32, "%=0#5n|%=0#5i",	-1234.561			   },
+	/*exp*/ { 0,1,21,		 "\241\357-01,235|JPY -01,235"	   },
+      },
+      {
+	/* #12 */
+	/*inp*/ { 32, "%^#5n|%^#5i",	-1234.561			   },
+	/*exp*/ { 0,1,19,		 "\241\357- 1235|JPY - 1235"	   },
+      },
+      {
+	/* #13 */
+	/*inp*/ { 32, "%#5.0n|%#5.0i",	 1234.444			   },
+	/*exp*/ { 0,1,21,		 " \241\357 1,234| JPY  1,234"	   },
+      },
+      {
+	/* #14 */
+	/*inp*/ { 32, "%#5.0n|%#5.4i",	-1234.555			   },
+	/*exp*/ { 0,1,26,		 "\241\357- 1,235|JPY - 1,234.5550"},
+      },
+      {
+	/* #15 */
+	/*inp*/ { 32, "%(#5n|%!(#5i",	-1234.561			   },
+	/*exp*/ { 0,1,19,		 "(\241\357 1,235)|( 1,235)"	   },
+      },
+      { .is_last = 1 }
+    }
+  },
+  {
+    { Tstrfmon, TST_LOC_end }
+  }
+};
diff --git a/ap/build/uClibc/test/locale-mbwc/dat_strxfrm.c b/ap/build/uClibc/test/locale-mbwc/dat_strxfrm.c
new file mode 100644
index 0000000..0c672d3
--- /dev/null
+++ b/ap/build/uClibc/test/locale-mbwc/dat_strxfrm.c
@@ -0,0 +1,147 @@
+/*
+ *  TEST SUITE FOR MB/WC FUNCTIONS IN CLIBRARY
+ *
+ *	 FILE:	dat_strxfrm.c
+ *
+ *	 STRXFRM:  size_t strxfrm (char *s1, const char s2, size_t n);
+ */
+
+
+/*
+ *  NOTE:
+ *
+ *  Return value and errno value are checked only for 2nd string:
+ *  org2[]; n1 and n2 don't mean bytes to be translated.
+ *  It means a buffer size including a null character.
+ *  Results of this test depens on results of strcoll().
+ *  If you got errors, check both test results.
+ *
+ *  The buffer size should be enough to contain a string including a
+ *  null char.	Returns the number of bytes of the string (NOT
+ *  including a null char).
+ */
+
+
+
+TST_STRXFRM tst_strxfrm_loc [] = {
+  {
+    { Tstrxfrm, TST_LOC_de },
+    {
+      { /*inp*/ { "\xf6\xc4\xe4\xfc", "\xf6\xc4\xe4\xfc", 17, 17 },  /* #01 */
+	/*exp*/ { 0,0,0,			   },
+      },
+      { /*inp*/ { "aA", "Aa",	    10, 10 },  /* #02 */
+	/*exp*/ { 0,0,0 ,			   },
+      },
+      { /*inp*/ { "Aa", "aA",	    10, 10 },  /* #03 */
+	/*exp*/ { 0,0,0,			   },
+      },
+      { /*inp*/ { "abc", "",	    13, 13 },  /* #04 */
+	/*exp*/ { 0,0,0,			   },
+      },
+      { /*inp*/ { "a", "B",		     7,	 7 },  /* #05 */
+	/*exp*/ { 0,0,0,			   },
+      },
+      { /*inp*/ { "B", "a",		     7,	 7 },  /* #06 */
+	/*exp*/ { 0,0,0,			   },
+      },
+      {
+	/* hiragana == latin1 */
+	/*inp*/ { "abc", "\244\241\244\242",  13,  9 },	 /* #07 */
+	/*exp*/ { 0,0,0,		       },
+      },
+      { .is_last = 1 }
+    }
+  },
+  {
+    { Tstrxfrm, TST_LOC_enUS },
+    {
+      { /*inp*/ { "abcd", "abcd",	    17, 17 },  /* #01 */
+	/*exp*/ { 0,0,0,			   },
+      },
+      { /*inp*/ { "aA", "Aa",	    10, 10 },  /* #02 */
+	/*exp*/ { 0,0,0 ,			   },
+      },
+      { /*inp*/ { "Aa", "aA",	    10, 10 },  /* #03 */
+	/*exp*/ { 0,0,0,			   },
+      },
+      { /*inp*/ { "abc", "",	    13, 13 },  /* #04 */
+	/*exp*/ { 0,0,0,			   },
+      },
+      { /*inp*/ { "a", "B",		     7,	 7 },  /* #05 */
+	/*exp*/ { 0,0,0,			   },
+      },
+      { /*inp*/ { "B", "a",		     7,	 7 },  /* #06 */
+	/*exp*/ { 0,0,0,			   },
+      },
+#ifdef NO_WAIVER
+      {
+	/* <WAIVER> */
+	/*inp*/ { "abc", "\244\241\244\242",  13,  9 },	 /* #07 */
+	/*exp*/ { EINVAL,0,0,		       },
+      },
+#endif
+      { .is_last = 1 }
+    }
+  },
+#if 0
+  {
+    { Tstrxfrm, TST_LOC_eucJP },	 /* ??? */
+    {
+      {
+	/* #01 */
+	/*inp*/ { "\244\242\244\241",  "\244\241\244\242",   5,	 5 },
+	/*exp*/ { 0,0,0,		       },
+      },
+      {
+	/* #02 */
+	/*inp*/ { "\244\241\244\242",  "\244\242\244\241",   5,	 5 },
+	/*exp*/ { 0,0,0,		       },
+      },
+      {
+	/* #03 */
+	/*inp*/ { "\244\242\216\261",  "\216\261\244\242",   5,	 5 },
+	/*exp*/ { 0,0,0,		       },
+      },
+#ifdef NO_WAIVER
+      {
+	/*inp*/ { "AAA", "\216\217",	 5,  5 },  /* #04 */ /* <WAIVER> */
+	/*exp*/ { EINVAL,0,0,		       },
+      },
+#endif
+      { .is_last = 1 }
+    }
+  },
+#else
+  {
+    { Tstrxfrm, TST_LOC_ja_UTF8 },	 /* ??? */
+    {
+      {
+	/* #01 */
+	/*inp*/ { "\343\201\202\343\201\201",  "\343\201\201\343\201\202",   7,	 7 },
+	/*exp*/ { 0,0,0,		       },
+      },
+      {
+	/* #02 */
+	/*inp*/ { "\343\201\201\343\201\202",  "\343\201\202\343\201\201",   7,	 7 },
+	/*exp*/ { 0,0,0,		       },
+      },
+      {
+	/* #03 */
+	/*inp*/ { "\343\201\202\357\275\261",  "\357\275\261343\201\202",   7,	 7 },
+	/*exp*/ { 0,0,0,		       },
+      },
+#ifdef NO_WAIVER
+      {
+	/*inp*/ { "AAA", "\340\277\220",	 5,  5 },  /* #04 */ /* <WAIVER> */
+	/*exp*/ { EINVAL,0,0,		       },
+      },
+#endif
+      { .is_last = 1 }
+    }
+  },
+#endif
+  {
+    { Tstrxfrm, TST_LOC_end }
+  }
+};
diff --git a/ap/build/uClibc/test/locale-mbwc/dat_swscanf.c b/ap/build/uClibc/test/locale-mbwc/dat_swscanf.c
new file mode 100644
index 0000000..088f165
--- /dev/null
+++ b/ap/build/uClibc/test/locale-mbwc/dat_swscanf.c
@@ -0,0 +1,185 @@
+/*
+ *  TEST SUITE FOR MB/WC FUNCTIONS IN CLIBRARY
+ *
+ *	 FILE:	dat_swscanf.c
+ *
+ *	 SWSCANF:  int	swscanf (const wchar_t *s, const wchar_t *fmt, ...);
+ */
+
+
+#include <errno.h>
+#include <stdlib.h>
+#include "tst_types.h"
+#include "tgn_locdef.h"
+
+
+TST_SWSCANF tst_swscanf_loc [] =
+{
+  {
+    { Tswscanf, TST_LOC_de },
+    {
+      /*------------------------ 01 -----------------------*/
+      { { {
+	0x002D, 0x0031,		0x003A,	   /* %d: -1   */
+	0x0032,			0x003A,	   /* %u:  2   */
+	0x0033, 0x002C, 0x0033, 0x003A,	   /* %f:  3.3 */
+	0x00E4,			0x003A,	   /* %c: 'ä'  */
+	0x00C4, 0x00DC, 0x0000, 0x0000,	   /* %s: "ÄÜ" */
+      },
+	  L"%d:%u:%f:%c:%s", 0
+      },
+	{ /* The fields are: err_val, ret_flag, ret_val,
+	     val_int, val_uns, val_flt, val_c, val_s, val_S.  */
+	  0,1,5,
+	  -1, 2, 3.3, 'ä', "ÄÜ", { 0x0000, },
+	},
+      },
+      /*------------------------ 02 -----------------------*/
+      { { {
+	0x00E4, 0x00C4, 0x0000		       /* "äÄ" */
+      },
+	  L"%lc", 'C'
+      },
+	{ 0,1,1,
+	  0,0,0,0,"", { 0x00E4, 0x0000 },
+	},
+      },
+      /*------------------------ 03 -----------------------*/
+      { { {
+	0x00E4, 0x00C4, 0x0000		       /* "äÄ" */
+      },
+	  L"%ls", 'S'
+      },
+	{ 0,1,1,
+	  0,0,0,0,"", { 0x00E4, 0x00C4, 0x0000 },
+	},
+      },
+      /*------------------------ 04 -----------------------*/
+      /* <NO_WAIVER> x 2 */
+      { { {
+	0x00E4, 0x00C4, 0x0000		       /* "äÄ" */
+      },
+	  L"1%d:2%d:3%d:4%d:5%d:6%d:7%d:8%d:9%d", 0
+      },
+#ifdef SHOJI_IS_RIGHT
+	{ 1,EINVAL,1,WEOF,
+	  0,0,0,0,"", { 0x0000 },
+#else
+	{ 0,1,0,
+	  0,0,0,0,"", { 0x0000 },
+#endif
+	},
+      },
+      /*---------------------------------------------------*/
+      { .is_last = 1}	/* Last element.  */
+    }
+  },
+  {
+    { Tswscanf, TST_LOC_enUS },
+    {
+      /*------------------------ 01 -----------------------*/
+      { { { 0x002D, 0x0031,					    0x003A,
+	    0x0032,						    0x003A,
+	    0x0035, 0x0034, 0x002E, 0x0033, 0x0045, 0x002D, 0x0031, 0x003A,
+	    0x0041,						    0x003A,
+	    0x0061, 0x0062, 0x0000,				    0x0000,
+      },
+	  L"%d:%u:%f:%c:%s", 0
+      },
+	{ 0,1,5,
+	  -1, 2, 5.43, 'A', "ab", { 0x0000 },
+	},
+      },
+      /*------------------------ 02 -----------------------*/
+      /* <NO_WAIVER> x 2 */
+      { { {
+	0x0063, 0x0064, 0x0000
+      },
+	  L"%C", 'C'
+      },
+	{ 0,1,1,
+	  0,0,0,0,"", { 0x0063, 0x0000 },
+	},
+      },
+      /*------------------------ 03 -----------------------*/
+      { { {
+	0x0063, 0x0064, 0x0000
+      },
+	  L"%S", 'S'
+      },
+	{ 0,1,1,
+	  0,0,0,0,"", { 0x0063, 0x0064, 0x0000 },
+	},
+      },
+      /*---------------------------------------------------*/
+      { .is_last = 1}	/* Last element.  */
+    }
+  },
+  {
+#if 0
+    { Tswscanf, TST_LOC_eucJP },
+#else
+    { Tswscanf, TST_LOC_ja_UTF8 },
+#endif
+    {
+      /*------------------------ 01 -----------------------*/
+      { { { 0x002D, 0x0031,	    0x003A,
+	    0x0032,		    0x003A,
+	    0x0033, 0x002E, 0x0033, 0x003A,
+	    0x0062,		    0x003A,
+	    0x0061, 0x0062, 0x0000, 0x0000,
+      },
+	  L"%d:%u:%f:%c:%s", 0
+      },
+	{ 0,1,5,
+	  -1, 2, 3.3, 'b', "ab", { 0x0000 }
+	},
+      },
+      /*------------------------ 02 -----------------------*/
+      { { {
+	0x30A2, 0x30A4, 0x0000
+      },
+	  L"%ls", 'S'
+      },
+	{ 0,1,1,
+	  0,0,0,0,"", { 0x30A2, 0x30A4, 0x0000 }
+	},
+      },
+      /*------------------------ 03 -----------------------*/
+      { { {
+	0x0031,			0x003A,
+	0x0030,			0x003A,
+	0x0033, 0x002E, 0x0039, 0x003A,
+	0x0061,			0x003A,
+	0x0063, 0x0064, 0x0000, 0x0000,
+      },
+	  L"%2$d:%1$u:%3$f:%4$c:%5$s", 0
+      },
+	{ 0,1,5,
+	  0, 1, 3.9, 'a', "cd", { 0x0000 }
+	},
+      },
+#ifdef SHOJI_IS_RIGHT
+      /* XXX This test does not make sense.  The format string is
+	 L"\x1\x2\x25\x53" and it is supposed to match the words
+	 0x30A2, 0x30A4, 0x0001.  */
+      /*------------------------ 04 -----------------------*/
+      /* <NO_WAIVER> x 2 */
+      { { {
+	0x30A2, 0x30A4, 0x0001, 0x0000
+      },
+	  { 0x0001,0x0002,0x0025,0x0053,0x0000 }, 'S'
+      },
+	{ EILSEQ,1,EOF,
+	  0,0,0,0,"", { 0x0000 }
+	},
+      },
+#endif
+      /*---------------------------------------------------*/
+      { .is_last = 1}	/* Last element.  */
+    }
+  },
+  {
+    { Tswscanf, TST_LOC_end }
+  }
+};
diff --git a/ap/build/uClibc/test/locale-mbwc/dat_tow-funcs.h b/ap/build/uClibc/test/locale-mbwc/dat_tow-funcs.h
new file mode 100644
index 0000000..4456437
--- /dev/null
+++ b/ap/build/uClibc/test/locale-mbwc/dat_tow-funcs.h
@@ -0,0 +1,24 @@
+/*
+ *  TEST SUITE FOR MB/WC FUNCTIONS IN C LIBRARY
+ *
+ *       FILE:  dat_tow-funcs.h
+ *
+ *       ISW*:  int tow*( wint_t wc );
+ */
+
+#include <errno.h>
+#include <stdlib.h>
+#include <wctype.h>
+#include "tst_types.h"
+#include "tgn_locdef.h"
+
+#define TST_TOW_LOC(FUNC, func) \
+        TST_TOW## FUNC    tst_tow## func ##_loc[]
+
+#define TST_TOW_REC(locale, func) \
+        {  Ttow## func,    TST_LOC_## locale },
+
+/*
+ *  NOTE:
+ *        need more test data!
+ */
diff --git a/ap/build/uClibc/test/locale-mbwc/dat_towctrans.c b/ap/build/uClibc/test/locale-mbwc/dat_towctrans.c
new file mode 100644
index 0000000..cf3712a
--- /dev/null
+++ b/ap/build/uClibc/test/locale-mbwc/dat_towctrans.c
@@ -0,0 +1,97 @@
+/*
+ *  TEST SUITE FOR MB/WC FUNCTIONS IN C LIBRARY
+ *
+ *	 FILE:	dat_towctrans.c
+ *
+ *	 TOWCTRANS:  wint_t towctrans (wint_t wc, wctrans_t charclass);
+ */
+
+#include <errno.h>
+#include <stdlib.h>
+#include <wctype.h>
+#include "tst_types.h"
+#include "tgn_locdef.h"
+
+/*
+ *  NOTE:
+ *    Set ret_flg = 1, when a return value is expected to be 0 (FALSE).
+ *    Set ret_flg = 0, when a return value is expected to be non-zero (TRUE).
+ *
+ *    Since the functions return *non*-zero value for TRUE, can't
+ *    compare an actual return value with an expected return value.
+ *    Set the ret_flg=0 for TRUE cases and the tst_isw*() will check
+ *    the non-zero value.
+ *
+ *  { { WEOF }, { 0,0,1,0 } },
+ *		      | |
+ *		      | ret_val: an expected return value
+ *		      ret_flg: if 1, compare an actual return value with the
+ *			       ret_val; if 0, the test program checks
+ *			       the actual return value.
+ *
+ *    CAUTION: if a charclass is invalid, the test function gives
+ *    towctrans() an invalid wctrans object instead of a return value
+ *    from wctrans() which is supposed to be 0.
+ */
+
+TST_TOWCTRANS tst_towctrans_loc [] = {
+  {
+    { Ttowctrans, TST_LOC_C },
+    {
+#ifdef SHOJI_IS_RIGHT
+      {	 { 0x0010, "xxxxxxx" }, { EINVAL,1,0x0010 }  },
+#else
+      {	 { 0x0010, "xxxxxxx" }, { 0,     1,0x0010 }  },
+#endif
+      {	 { 0x007F, "tolower" }, { 0,	   1,0x007F }  },
+      {	 { 0x0061, "toupper" }, { 0,	   1,0x0041 }  },
+      {	 { 0x0041, "tolower" }, { 0,	   1,0x0061 }  },
+      { .is_last = 1 }
+    }
+  },
+  {
+    { Ttowctrans, TST_LOC_de },
+    {
+#ifdef SHOJI_IS_RIGHT
+      {	 { 0x0010, "tojkata" }, { EINVAL,1,0x0010 }  },
+#else
+      {	 { 0x0010, "tojkata" }, { 0,     1,0x0010 }  },
+#endif
+      {	 { 0x0080, "tolower" }, { 0,	   1,0x0080 }  },
+      {	 { 0x00EC, "toupper" }, { 0,	   1,0x00CC }  },
+      {	 { 0x00CC, "tolower" }, { 0,	   1,0x00EC }  },
+      { .is_last = 1 }
+    }
+  },
+  {
+    { Ttowctrans, TST_LOC_enUS },
+    {
+#ifdef SHOJI_IS_RIGHT
+      {	 { 0x0010, "xxxxxxx" }, { EINVAL,1,0x0010 }  },
+#else
+      {	 { 0x0010, "xxxxxxx" }, { 0,     1,0x0010 }  },
+#endif
+      {	 { 0x007F, "tolower" }, { 0,	   1,0x007F }  },
+      {	 { 0x0061, "toupper" }, { 0,	   1,0x0041 }  },
+      {	 { 0x0041, "tolower" }, { 0,	   1,0x0061 }  },
+      { .is_last = 1 }
+    }
+  },
+  {
+#if 0
+    { Ttowctrans, TST_LOC_eucJP },
+#else
+    { Ttowctrans, TST_LOC_ja_UTF8 },
+#endif
+    {
+      {	 { 0xFF21, "tolower" }, { 0,	   1,0xFF41 }  },
+      {	 { 0xFF41, "toupper" }, { 0,	   1,0xFF21 }  },
+      {	 { 0x30A1, "tojhira" }, { 0,	   1,0x3041 }  },
+      {	 { 0x3041, "tojkata" }, { 0,	   1,0x30A1 }  },
+      { .is_last = 1 }
+    }
+  },
+  {
+    { Ttowctrans, TST_LOC_end }
+  }
+};
diff --git a/ap/build/uClibc/test/locale-mbwc/dat_towlower.c b/ap/build/uClibc/test/locale-mbwc/dat_towlower.c
new file mode 100644
index 0000000..b6dd275
--- /dev/null
+++ b/ap/build/uClibc/test/locale-mbwc/dat_towlower.c
@@ -0,0 +1,47 @@
+/*
+ *  TEST SUITE FOR MB/WC FUNCTIONS IN C LIBRARY
+ *
+ *	 FILE:	dat_towlower.c
+ *
+ *	 ISW*:	int towlower (wint_t wc);
+ */
+
+
+#include "dat_tow-funcs.h"
+
+
+TST_TOW_LOC (LOWER, lower) = {
+
+  {   TST_TOW_REC (de, lower)
+      {
+	{  { WEOF   }, { 0,  1, (wint_t)-1 }	},
+	{  { 0x0080 }, { 0,  1, 0x0080     }	},
+	{  { 0x00CC }, { 0,  1, 0x00EC     }	},
+	{  { 0x00EC }, { 0,  1, 0x00EC     }	},
+	{ .is_last = 1 } /* Last element.	 */
+      }
+  },
+  {   TST_TOW_REC (enUS, lower)
+      {
+	{  { WEOF   }, { 0,  1, (wint_t)-1 }	},
+	{  { 0x007F }, { 0,  1, 0x007F     }	},
+	{  { 0x0041 }, { 0,  1, 0x0061     }	},
+	{  { 0x0061 }, { 0,  1, 0x0061     }	},
+	{ .is_last = 1 } /* Last element.	 */
+      }
+  },
+#if 0
+  {   TST_TOW_REC (eucJP, lower)
+#else
+  {   TST_TOW_REC (ja_UTF8, lower)
+#endif
+      {
+	{  { 0x007F }, { 0,  1, 0x007F     }	},
+	{  { 0x0080 }, { 0,  1, 0x0080     }	},
+	{  { 0xFF21 }, { 0,  1, 0xFF41     }	},
+	{  { 0xFF41 }, { 0,  1, 0xFF41     }	},
+	{ .is_last = 1 } /* Last element.	 */
+      }
+  },
+  {   TST_TOW_REC (end, lower) }
+};
diff --git a/ap/build/uClibc/test/locale-mbwc/dat_towupper.c b/ap/build/uClibc/test/locale-mbwc/dat_towupper.c
new file mode 100644
index 0000000..704ad44
--- /dev/null
+++ b/ap/build/uClibc/test/locale-mbwc/dat_towupper.c
@@ -0,0 +1,47 @@
+/*
+ *  TEST SUITE FOR MB/WC FUNCTIONS IN C LIBRARY
+ *
+ *	 FILE:	dat_towupper.c
+ *
+ *	 ISW*:	int towupper (wint_t wc);
+ */
+
+
+#include "dat_tow-funcs.h"
+
+
+TST_TOW_LOC (UPPER, upper) = {
+
+  {   TST_TOW_REC (de, upper)
+      {
+	{  { WEOF   }, { 0,  1, (wint_t)-1 }	},
+	{  { 0x0080 }, { 0,  1, 0x0080     }	},
+	{  { 0x00EC }, { 0,  1, 0x00CC     }	},
+	{  { 0x00CC }, { 0,  1, 0x00CC     }	},
+	{ .is_last = 1 } /* Last element.	 */
+      }
+  },
+  {   TST_TOW_REC (enUS, upper)
+      {
+	{  { WEOF   }, { 0,  1, (wint_t)-1 }	},
+	{  { 0x0080 }, { 0,  1, 0x0080     }	},
+	{  { 0x0041 }, { 0,  1, 0x0041     }	},
+	{  { 0x0061 }, { 0,  1, 0x0041     }	},
+	{ .is_last = 1 } /* Last element.	 */
+      }
+  },
+#if 0
+  {   TST_TOW_REC (eucJP, upper)
+#else
+  {   TST_TOW_REC (ja_UTF8, upper)
+#endif
+      {
+	{  { WEOF   }, { 0,  1, (wint_t)-1 }	},
+	{  { 0x007F }, { 0,  1, 0x007F     }	},
+	{  { 0xFF41 }, { 0,  1, 0xFF21     }	},
+	{  { 0xFF21 }, { 0,  1, 0xFF21     }	},
+	{ .is_last = 1 } /* Last element.	 */
+      }
+  },
+  {   TST_TOW_REC (end, upper) }
+};
diff --git a/ap/build/uClibc/test/locale-mbwc/dat_wcrtomb.c b/ap/build/uClibc/test/locale-mbwc/dat_wcrtomb.c
new file mode 100644
index 0000000..055f7b0
--- /dev/null
+++ b/ap/build/uClibc/test/locale-mbwc/dat_wcrtomb.c
@@ -0,0 +1,122 @@
+/*
+ *  TEST SUITE FOR MB/WC FUNCTIONS IN C LIBRARY
+ *
+ *	 FILE:	dat_wcrtomb.c
+ *
+ *	 WCRTOMB:  intwcrtomb (char *s, wchar_t wc, mbstate_t *ps);
+ *
+ */
+
+TST_WCRTOMB tst_wcrtomb_loc [] = {
+  {
+    { Twcrtomb, TST_LOC_de },
+    {
+      /* #01 : normal case			       */
+      { /*input.*/ { 1,		 0x00FC,   0,0 },
+	/*expect*/ { 0,	   1,1,	 "ü"	       },
+      },
+      /* #02 : normal case			       */
+      { /*input.*/ { 1,		 0x00D6,   0,0 },
+	/*expect*/ { 0,	   1,1,	 "Ö"	       },
+      },
+      /* #03 : error case			       */
+      { /*input.*/ { 1,		 0xFFA1,   0,0 },
+	/*expect*/ {  EILSEQ,1,-1, ""	       },
+      },
+      /* #04 :				       */
+      { /*input.*/ { 0,		 0x0041,   0,0 },
+	/*expect*/ { 0,	   1,1,	 ""	       },
+      },
+      /* #05 :				       */
+      { /*input.*/ { 0,		 0x0092,   0,0 },
+	/*expect*/ { 0,	   1,1,	 ""	       },
+      },
+      { .is_last = 1 }
+    }
+  },
+  {
+    { Twcrtomb, TST_LOC_enUS },
+    {
+      /* #01 : normal case			       */
+      { /*input.*/ { 1,		 0x0041,   0,0 },
+	/*expect*/ { 0,	   1,1,	 "A"	       },
+      },
+      /* #02 : normal case			       */
+      { /*input.*/ { 1,		 0x0042,   0,0 },
+	/*expect*/ { 0,	   1,1,	 "B"	       },
+      },
+      /* #03 : error case			       */
+      /* <WAIVER> x 2 */
+      { /*input.*/ { 1,		 0x0092,   0,0 },  /* assume ascii */
+	/*expect*/ {  EILSEQ,1,-1, ""	       },
+      },
+      /* #04 :				       */
+      { /*input.*/ { 0,		 0x0041,   0,0 },
+	/*expect*/ { 0,	   1,1,	 ""	       },
+      },
+      /* #05 :				       */
+      { /*input.*/ { 0,		 0x0092,   0,0 },
+	/*expect*/ { 0,	   1,1,	 ""	       },
+      },
+      { .is_last = 1 }
+    }
+  },
+#if 0
+  {
+    { Twcrtomb, TST_LOC_eucJP },
+    {
+      /* #01 : normal case			       */
+      { /*input.*/ { 1,		 0x3042,   0,0 },
+	/*expect*/ { 0,      1,2,  "\244\242"	   },
+      },
+      /* #02 : normal case			       */
+      { /*input.*/ { 1,		 0x3044,   0,0 },
+	/*expect*/ { 0,      1,2,  "\244\244"	   },
+      },
+      /* #03 : normal case			       */
+      { /*input.*/ { 1,		 0x008E,   0,0 },
+	/*expect*/ { EILSEQ, 1,-1, ""	       },
+      },
+      /* #04 :				       */
+      { /*input.*/ { 0,		 0x3042,   0,0 },
+	/*expect*/ { 0,	   0,0,	 ""	       },
+      },
+      /* #05 :				       */
+      { /*input.*/ { 0,		 0x008E,   0,0 },
+	/*expect*/ { 0,	   0,0,	 ""	       },
+      },
+      { .is_last = 1 }
+    }
+  },
+#else
+  {
+    { Twcrtomb, TST_LOC_ja_UTF8 },
+    {
+      /* #01 : normal case			       */
+      { /*input.*/ { 1,		 0x3042,   0,0 },
+	/*expect*/ { 0,      1,3,  "\343\201\202"	   },
+      },
+      /* #02 : normal case			       */
+      { /*input.*/ { 1,		 0x3044,   0,0 },
+	/*expect*/ { 0,      1,3,  "\343\201\204"	   },
+      },
+      /* #03 : normal case			       */
+      { /*input.*/ { 1,		 0x008E,   0,0 },
+	/*expect*/ { EILSEQ, 1,-1, ""	       },
+      },
+      /* #04 :				       */
+      { /*input.*/ { 0,		 0x3042,   0,0 },
+	/*expect*/ { 0,	   0,0,	 ""	       },
+      },
+      /* #05 :				       */
+      { /*input.*/ { 0,		 0x008E,   0,0 },
+	/*expect*/ { 0,	   0,0,	 ""	       },
+      },
+      { .is_last = 1 }
+    }
+  },
+#endif
+  {
+    { Twcrtomb, TST_LOC_end }
+  }
+};
diff --git a/ap/build/uClibc/test/locale-mbwc/dat_wcscat.c b/ap/build/uClibc/test/locale-mbwc/dat_wcscat.c
new file mode 100644
index 0000000..f54e72d
--- /dev/null
+++ b/ap/build/uClibc/test/locale-mbwc/dat_wcscat.c
@@ -0,0 +1,116 @@
+/*
+ *  TEST SUITE FOR MB/WC FUNCTIONS IN C LIBRARY
+ *
+ *	 FILE:	dat_wcscat.c
+ *
+ *	 WCSCAT:  wchar_t *wcscat (wchar_t *ws1, wchar_t *ws2)
+ */
+
+/* NOTE:
+   Since this is not a locale sensitive function,
+   it doesn't make sense to test the function on some
+   locales. Better make different test cases for each locale ...
+   (Also some wc* functions are not locale sensitive.)
+*/
+
+
+TST_WCSCAT tst_wcscat_loc [] = {
+
+  {
+    {Twcscat, TST_LOC_de},
+    {
+      /* 1 */
+      {{{ 0x00C1,0x00C2,0x0000	},
+	{			0x00C3,0x00C4,0x0000 }, },
+       {   0,	0,    0,
+	   { 0x00C1,0x00C2,0x00C3,0x00C4,0x0000 }	},
+      },
+      /* 2 */
+      {{{ 0x0001,0x0002,0x0000	},
+	{			0x0003,0x0004,0x0000 }, },
+       {   0,	0,    0,
+	   { 0x0001,0x0002,0x0003,0x0004,0x0000 }	},
+      },
+      /* 3 */
+      {{{ 0x0000		  },
+	{			0x00C3,0x00C4,0x0000 }, },
+       {   0,	0,    0,
+	   {		0x00C3,0x00C4,0x0000 }	},
+      },
+      /* 4 */
+      {{{ 0x0001,0xFFFF,0x0000	},
+	{			0x0080,0x0090,0x0000 }, },
+       {   0,	0,    0,
+	   { 0x0001,0xFFFF,0x0080,0x0090,0x0000 }	},
+      },
+      {.is_last = 1}
+    }
+  },
+  {
+    {Twcscat, TST_LOC_enUS},
+    {
+      /* 1 */
+      {{{ 0x0041,0x0042,0x0000	},
+	{		  0x0043,0x0044,0x0000 }, },
+       {   0,	  0,	0,
+	   { 0x0041,0x0042,0x0043,0x0044,0x0000 }  },
+      },
+      /* 2 */
+      {{{ 0x0001,0x0002,0x0000	},
+	{		  0x0003,0x0004,0x0000 }, },
+       {   0,	  0,	0,
+	   { 0x0001,0x0002,0x0003,0x0004,0x0000 }  },
+      },
+      /* 3 */
+      {{{ 0x0000		    },
+	{		  0x0043,0x0044,0x0000 }, },
+       {   0,	  0,	0,
+	   {		  0x0043,0x0044,0x0000 }  },
+      },
+      /* 4 */
+      {{{ 0x0001,0xFFFF,0x0000	},
+	{		  0x0080,0x0090,0x0000 }, },
+       {   0,	  0,	0,
+	   { 0x0001,0xFFFF,0x0080,0x0090,0x0000 }  },
+      },
+      {.is_last = 1}
+    }
+  },
+  {
+#if 0
+    {Twcscat, TST_LOC_eucJP},
+#else
+    {Twcscat, TST_LOC_ja_UTF8},
+#endif
+    {
+      /* 1 */
+      {{{ 0x30A2,0x74E0,0x0000	},
+	{			0xFF71,0x0041,0x0000 }, },
+       {   0,	0,    0,
+	   { 0x30A2,0x74E0,0xFF71,0x0041,0x0000 }	},
+      },
+      /* 2 */
+      {{{ 0x0001,0x0002,0x0000	},
+	{			0x0003,0x0004,0x0000 }, },
+       {   0,	0,    0,
+	   { 0x0001,0x0002,0x0003,0x0004,0x0000 }	},
+      },
+      /* 3 */
+      {{{ 0x30A2,0xFF71,0x0000	},
+	{			0x0000		     }, },
+       {   0,	0,    0,
+	   { 0x30A2,0xFF71,0x0000		     }	},
+      },
+      /* 4 */
+      {{{ 0x0001,0xFFFF,0x0000	},
+	{			0x0080,0x0090,0x0000 }, },
+       {   0,	0,    0,
+	   { 0x0001,0xFFFF,0x0080,0x0090,0x0000 }	},
+      },
+      {.is_last = 1}
+    }
+  },
+  {
+    {Twcscat, TST_LOC_end}
+  }
+};
diff --git a/ap/build/uClibc/test/locale-mbwc/dat_wcschr.c b/ap/build/uClibc/test/locale-mbwc/dat_wcschr.c
new file mode 100644
index 0000000..aa355e9
--- /dev/null
+++ b/ap/build/uClibc/test/locale-mbwc/dat_wcschr.c
@@ -0,0 +1,94 @@
+/*
+ *  TEST SUITE FOR MB/WC FUNCTIONS IN C LIBRARY
+ *
+ *	 FILE:	dat_wcschr.c
+ *
+ *	 WCSCHR:  wchar_t  *wcschr (const wchar_t *ws, wchar_t wc);
+ */
+
+TST_WCSCHR tst_wcschr_loc [] = {
+
+    {	{ Twcschr, TST_LOC_de },
+	{
+	  { /*input.*/ { { 0x00C1,0x00C2,0x00C3,0x0000 }, 0x00C0 },  /* #1 */
+	    /*expect*/ { 0,1,(wchar_t *)NULL },
+	  },
+	  { /*input.*/ { { 0x00C1,0x00C2,0x00C3,0x0000 }, 0x00C1 },  /* #2 */
+	    /*expect*/ { 0,0,0 },
+	  },
+	  { /*input.*/ { { 0x00C1,0x00C2,0x00C3,0x0000 }, 0x00C2 },  /* #3 */
+	    /*expect*/ { 0,0,0 },
+	  },
+	  { /*input.*/ { { 0x00C1,0x00C2,0x00C3,0x0000 }, 0x00C3 },  /* #4 */
+	    /*expect*/ { 0,0,0 },
+	  },
+	  { /*input.*/ { { 0x00C1,0x00C2,0x00C3,0x0000 }, 0x0000 },  /* #5 */
+	    /*expect*/ { 0,0,0 },
+	  },
+	  { /*input.*/ { { 0x0000,0x00C2,0x00C3,0x0000 }, 0x00C1 },  /* #6 */
+	    /*expect*/ { 0,1,(wchar_t *)NULL },
+	  },
+	  { /*input.*/ { { 0x0000,0x00C2,0x00C3,0x0000 }, 0x0000 },  /* #7 */
+	    /*expect*/ { 0,0,0 },
+	  },
+	  { .is_last = 1 }
+	}
+    },
+    {	{ Twcschr, TST_LOC_enUS },
+	{
+	  { /*input.*/ { { 0x0041,0x0042,0x0043,0x0000 }, 0x0040 },  /* #1 */
+	    /*expect*/ { 0,1,(wchar_t *)NULL },
+	  },
+	  { /*input.*/ { { 0x0041,0x0042,0x0043,0x0000 }, 0x0041 },  /* #2 */
+	    /*expect*/ { 0,0,0 },
+	  },
+	  { /*input.*/ { { 0x0041,0x0042,0x0043,0x0000 }, 0x0042 },  /* #3 */
+	    /*expect*/ { 0,0,0 },
+	  },
+	  { /*input.*/ { { 0x0041,0x0042,0x0043,0x0000 }, 0x0043 },  /* #4 */
+	    /*expect*/ { 0,0,0 },
+	  },
+	  { /*input.*/ { { 0x0041,0x0042,0x0043,0x0000 }, 0x0000 },  /* #5 */
+	    /*expect*/ { 0,0,0 },
+	  },
+	  { /*input.*/ { { 0x0000,0x0042,0x0043,0x0000 }, 0x0041 },  /* #6 */
+	    /*expect*/ { 0,1,(wchar_t *)NULL },
+	  },
+	  { /*input.*/ { { 0x0000,0x0042,0x0043,0x0000 }, 0x0000 },  /* #7 */
+	    /*expect*/ { 0,0,0 },
+	  },
+	  { .is_last = 1 }
+	}
+    },
+#if 0
+    {	{ Twcschr, TST_LOC_eucJP },
+#else
+    {	{ Twcschr, TST_LOC_ja_UTF8 },
+#endif
+	{
+	  { /*input.*/ { { 0x3041,0x3042,0x3043,0x0000 }, 0x3040 },  /* #1 */
+	    /*expect*/ { 0,1,(wchar_t *)NULL },
+	  },
+	  { /*input.*/ { { 0x3041,0x3042,0x3043,0x0000 }, 0x3041 },  /* #2 */
+	    /*expect*/ { 0,0,0 },
+	  },
+	  { /*input.*/ { { 0x3041,0x3042,0x3043,0x0000 }, 0x3042 },  /* #3 */
+	    /*expect*/ { 0,0,0 },
+	  },
+	  { /*input.*/ { { 0x3041,0x3042,0x3043,0x0000 }, 0x3043 },  /* #4 */
+	    /*expect*/ { 0,0,0 },
+	  },
+	  { /*input.*/ { { 0x3041,0x3042,0x3043,0x0000 }, 0x0000 },  /* #5 */
+	    /*expect*/ { 0,0,0 },
+	  },
+	  { /*input.*/ { { 0x0000,0x3042,0x3043,0x0000 }, 0x3041 },  /* #6 */
+	    /*expect*/ { 0,1,(wchar_t *)NULL },
+	  },
+	  { /*input.*/ { { 0x0000,0x3042,0x3043,0x0000 }, 0x0000 },  /* #7 */
+	    /*expect*/ { 0,0,0 },
+	  },
+	  { .is_last = 1 }
+	}
+    },
+    {	{ Twcschr, TST_LOC_end } }
+};
diff --git a/ap/build/uClibc/test/locale-mbwc/dat_wcscmp.c b/ap/build/uClibc/test/locale-mbwc/dat_wcscmp.c
new file mode 100644
index 0000000..a2da551
--- /dev/null
+++ b/ap/build/uClibc/test/locale-mbwc/dat_wcscmp.c
@@ -0,0 +1,137 @@
+/*
+ *  TEST SUITE FOR MB/WC FUNCTIONS IN C LIBRARY
+ *
+ *	 FILE: dat_wcscmp.c
+ *
+ *	 WCSCMP:  int  wcscmp (const wchar_t *ws1, const wchar_t *ws2);
+ */
+
+/* NOTE:
+	This is not a locale sensitive function and
+	it may not make sence testing it for each locale ...
+*/
+
+
+TST_WCSCMP tst_wcscmp_loc [] = {
+  {
+    { Twcscmp, TST_LOC_de },
+    {
+      { /*input.*/ { { 0x00D1,0x00D2,0x00D3,0x0000 },
+		     { 0x00D1,0x00D2,0x00D3,0x0000 }, },  /* #1 */
+	/*expect*/ { 0,1,0,			  },
+      },
+      { /*input.*/ { { 0x0000,0x00D1,0x00D3,0x0000 },
+		     { 0x0000,0x00D2,0x00D3,0x0000 }, },  /* #2 */
+	/*expect*/ { 0,1,0,			  },
+      },
+      { /*input.*/ { { 0x00D1,0x00D1,0x00D3,0x0000 },
+		     { 0x0000,0x00D2,0x00D3,0x0000 }, },  /* #3 */
+	/*expect*/ { 0,1,1,			  },
+      },
+      { /*input.*/ { { 0x0000,0x00D2,0x00D3,0x0000 },
+		     { 0x00D1,0x00D1,0x00D3,0x0000 }, },  /* #4 */
+	/*expect*/ { 0,1,-1,			  },
+      },
+      { /*input.*/ { { 0x00D1,0x00D5,0x00D3,0x0000 },
+		     { 0x00D1,0x00D2,0x00D3,0x0000 }, },  /* #5 */
+	/*expect*/ { 0,1,1,			  },
+      },
+      { /*input.*/ { { 0x00D1,0x00D2,0x00D3,0x0000 },
+		     { 0x00D1,0x00D2,0x00D9,0x0000 }, },  /* #6 */
+	/*expect*/ { 0,1,-1,			  },
+      },
+      { /*input.*/ { { 0x00D1,0x00D2,0x0000	       },
+		     { 0x00D1,0x00D2,0x00D9,0x0000 }, },  /* #7 */
+	/*expect*/ { 0,1,-1,			  },
+      },
+      { /*input.*/ { { 0x00D1,0x00D2,0x00D9,0x0000 },
+		     { 0x00D1,0x00D2,0x0000	       }, },  /* #8 */
+	/*expect*/ { 0,1,1,			  },
+      },
+      { .is_last = 1 }
+    }
+  },
+  {
+    { Twcscmp, TST_LOC_enUS },
+    {
+      { /*input.*/ { { 0x0041,0x0042,0x0043,0x0000 },
+		     { 0x0041,0x0042,0x0043,0x0000 }, },  /* #1 */
+	/*expect*/ { 0,1,0,			  },
+      },
+      { /*input.*/ { { 0x0000,0x0041,0x0043,0x0000 },
+		     { 0x0000,0x0042,0x0043,0x0000 }, },  /* #2 */
+	/*expect*/ { 0,1,0,			  },
+      },
+      { /*input.*/ { { 0x0041,0x0041,0x0043,0x0000 },
+		     { 0x0000,0x0042,0x0043,0x0000 }, },  /* #3 */
+	/*expect*/ { 0,1,1,			  },
+      },
+      { /*input.*/ { { 0x0000,0x0042,0x0043,0x0000 },
+		     { 0x0041,0x0041,0x0043,0x0000 }, },  /* #4 */
+	/*expect*/ { 0,1,-1,			  },
+      },
+      { /*input.*/ { { 0x0041,0x0045,0x0043,0x0000 },
+		     { 0x0041,0x0042,0x0043,0x0000 }, },  /* #5 */
+	/*expect*/ { 0,1,1,			  },
+      },
+      { /*input.*/ { { 0x0041,0x0042,0x0043,0x0000 },
+		     { 0x0041,0x0042,0x0049,0x0000 }, },  /* #6 */
+	/*expect*/ { 0,1,-1,			  },
+      },
+      { /*input.*/ { { 0x0041,0x0042,0x0000	       },
+		     { 0x0041,0x0042,0x0049,0x0000 }, },  /* #7 */
+	/*expect*/ { 0,1,-1,			  },
+      },
+      { /*input.*/ { { 0x0041,0x0042,0x0049,0x0000 },
+		     { 0x0041,0x0042,0x0000	       }, },  /* #8 */
+	/*expect*/ { 0,1,1,			  },
+      },
+      { .is_last = 1 }
+    }
+  },
+  {
+#if 0
+    { Twcscmp, TST_LOC_eucJP},
+#else
+    { Twcscmp, TST_LOC_ja_UTF8},
+#endif
+    {
+      { /*input.*/ { { 0x3041,0x3042,0x3043,0x0000 },
+		     { 0x3041,0x3042,0x3043,0x0000 }, },  /* #1 */
+	/*expect*/ { 0,1,0,			  },
+      },
+      { /*input.*/ { { 0x0000,0x3041,0x3043,0x0000 },
+		     { 0x0000,0x3042,0x3043,0x0000 }, },  /* #2 */
+	/*expect*/ { 0,1,0,			  },
+      },
+      { /*input.*/ { { 0x3041,0x3041,0x3043,0x0000 },
+		     { 0x0000,0x3042,0x3043,0x0000 }, },  /* #3 */
+	/*expect*/ { 0,1,1,			  },
+      },
+      { /*input.*/ { { 0x0000,0x3042,0x3043,0x0000 },
+		     { 0x3041,0x3041,0x3043,0x0000 }, },  /* #4 */
+	/*expect*/ { 0,1,-1,			  },
+      },
+      { /*input.*/ { { 0x3041,0x3045,0x3043,0x0000 },
+		     { 0x3041,0x3042,0x3043,0x0000 }, },  /* #5 */
+	/*expect*/ { 0,1,1,			  },
+      },
+      { /*input.*/ { { 0x3041,0x3042,0x3043,0x0000 },
+		     { 0x3041,0x3042,0x3049,0x0000 }, },  /* #6 */
+	/*expect*/ { 0,1,-1,			  },
+      },
+      { /*input.*/ { { 0x3041,0x3042,0x0000	       },
+		     { 0x3041,0x3042,0x3049,0x0000 }, },  /* #7 */
+	/*expect*/ { 0,1,-1,			  },
+      },
+      { /*input.*/ { { 0x3041,0x3042,0x3049,0x0000 },
+		     { 0x3041,0x3042,0x0000	       }, },  /* #8 */
+	/*expect*/ { 0,1,1,			  },
+      },
+      { .is_last = 1 }
+    }
+  },
+  {
+    { Twcschr, TST_LOC_end}
+  }
+};
diff --git a/ap/build/uClibc/test/locale-mbwc/dat_wcscoll.c b/ap/build/uClibc/test/locale-mbwc/dat_wcscoll.c
new file mode 100644
index 0000000..a9733ad
--- /dev/null
+++ b/ap/build/uClibc/test/locale-mbwc/dat_wcscoll.c
@@ -0,0 +1,210 @@
+/*
+ *  TEST SUITE FOR MB/WC FUNCTIONS IN C LIBRARY
+ *
+ *	 FILE: dat_wcscoll.c
+ *
+ *	 WCSCOLL:  int	wcscoll (const wchar_t *ws1, const wchar_t *ws2);
+ */
+
+/*
+ *  CAUTION:
+ *	     When LC_COLLATE (or LC_ALL) is set for ja_JP.EUC,
+ *	     wcscoll() core-dumps for big values such as 0x3041
+ *	     (0x0041 is okay) in glibc 2.1.2.
+ *
+ *  NOTE:
+ *    a) When 0 is expected as a return value, set ret_flg=1.
+ *	 - the return value is compared with an expected value: ret_val.
+ *    b) When a positive value is expected as a return value,
+ *	 set ret_flg=0 and set cmp_flg=+1.
+ *	 - the return value is not compared with the expected value
+ *	   (can not be compared); instead, the test program checks
+ *	   if the return value is positive when cmp_flg=+1.
+ *    c) When a negative value is expected as a return value,
+ *	 ......
+ *    d) When data contains invalid values, set err_val to the expected errno.
+ *	 Set ret_flg=0 and cmp_flg=0 so that it doesn't compare
+ *	 the return value with an expected value or doesn't check
+ *	 the sign of the return value.
+ *
+ *
+ *	     -------------------------------------------
+ *	     CASE  err_val   ret_flg  ret_val	 cmp_flg
+ *	     -------------------------------------------
+ *	      a)      0	 1	  0	    0
+ *	      b)      0	 0	  0	   +1
+ *	      c)      0	 0	  0	   -1
+ *	      d)    EINVAL	 0	  0	    0
+ *	     -------------------------------------------
+ */
+
+
+TST_WCSCOLL tst_wcscoll_loc [] = {
+
+    {	{ Twcscoll, TST_LOC_de },
+	{
+	  { /*input.*/ { { 0x00E1,0x00E2,0x00E3,0x0000 },
+			 { 0x00E1,0x00E2,0x00E3,0x0000 }, },  /* #1 */
+	    /*expect*/ { 0,1,0, 0,			  },
+	  },
+	  { /*input.*/ { { 0x0000,0x00E1,0x00E3,0x0000 },
+			 { 0x0000,0x00E2,0x00E3,0x0000 }, },  /* #2 */
+	    /*expect*/ { 0,1,0, 0,			  },
+	  },
+	  { /*input.*/ { { 0x00E1,0x00E1,0x00E3,0x0000 },
+			 { 0x0000,0x00E2,0x00E3,0x0000 }, },  /* #3 */
+	    /*expect*/ { 0,0,0, +1,			  },
+	  },
+	  { /*input.*/ { { 0x0000,0x00E2,0x00E3,0x0000 },
+			 { 0x00E1,0x00E1,0x00E3,0x0000 }, },  /* #4 */
+	    /*expect*/ { 0,0,0, -1,			  },
+	  },
+	  { /*input.*/ { { 0x00E1,0x0042,0x00E3,0x0000 },
+			 { 0x00E1,0x0061,0x00E3,0x0000 }, },  /* #5 */
+	    /*expect*/ { 0,0,0, +1,			  },
+	  },
+	  { /*input.*/ { { 0x00E1,0x0061,0x00E3,0x0000 },
+			 { 0x00E1,0x0042,0x00E3,0x0000 }, },  /* #6 */
+	    /*expect*/ { 0,0,0, -1,			  },
+	  },
+	  { /*input.*/ { { 0x00E1,0x00E2,0x0000	       },
+			 { 0x00E1,0x00E2,0x00E9,0x0000 }, },  /* #7 */
+	    /*expect*/ { 0,0,0, -1,			  },
+	  },
+	  { /*input.*/ { { 0x00E1,0x00E2,0x00E9,0x0000 },
+			 { 0x00E1,0x00E2,0x0000	       }, },  /* #8 */
+	    /*expect*/ { 0,0,0, +1,			  },
+	  },
+	  { /*input.*/ { { 0x00E1,0x0092,0x00E9,0x0000 },
+			 { 0x00E1,0x008E,0x00E9,0x0000 }, },  /* #9 */
+	    /*expect*/ { 0,0,0, +1,		       },
+	  },
+	  { /*input.*/ { { 0x00E1,0x008E,0x00E9,0x0000 },
+			 { 0x00E1,0x0092,0x00E9,0x0000 }, },  /* #10 */
+	    /*expect*/ { 0,0,0, -1,		       },
+	  },
+	  { .is_last = 1 }
+	}
+    },
+    {	{ Twcscoll, TST_LOC_en },
+	{
+	  { /*input.*/ { { 0x0041,0x0042,0x0043,0x0000 },
+			 { 0x0041,0x0042,0x0043,0x0000 }, },  /* #1 */
+	    /*expect*/ { 0,1,0, 0,			  },
+	  },
+	  { /*input.*/ { { 0x0000,0x0041,0x0043,0x0000 },
+			 { 0x0000,0x0042,0x0043,0x0000 }, },  /* #2 */
+	    /*expect*/ { 0,1,0, 0,			  },
+	  },
+	  { /*input.*/ { { 0x0041,0x0041,0x0043,0x0000 },
+			 { 0x0000,0x0042,0x0043,0x0000 }, },  /* #3 */
+	    /*expect*/ { 0,0,0, +1,			  },
+	  },
+	  { /*input.*/ { { 0x0000,0x0042,0x0043,0x0000 },
+			 { 0x0041,0x0041,0x0043,0x0000 }, },  /* #4 */
+	    /*expect*/ { 0,0,0, -1,			  },
+	  },
+#ifdef SHOJI_IS_RIGHT
+	  /* <WAIVER> */ /* assume ascii */
+	  { /*input.*/ { { 0x0041,0x0042,0x0043,0x0000 },
+			 { 0x0041,0x0061,0x0043,0x0000 }, },  /* #5 */
+	    /*expect*/ { 0,0,0, -1,			  },
+	  },
+	  /* <WAIVER> */ /* assume ascii */
+	  { /*input.*/ { { 0x0041,0x0061,0x0043,0x0000 },
+			 { 0x0041,0x0042,0x0043,0x0000 }, },  /* #6 */
+	    /*expect*/ { 0,0,0, +1,			  },
+	  },
+#else
+	  /* XXX Correct order is lowercase before uppercase.  */
+	  { /*input.*/ { { 0x0041,0x0042,0x0043,0x0000 },
+			 { 0x0041,0x0061,0x0043,0x0000 }, },  /* #5 */
+	    /*expect*/ { 0,0,0, +1,			  },
+	  },
+	  { /*input.*/ { { 0x0041,0x0061,0x0043,0x0000 },
+			 { 0x0041,0x0042,0x0043,0x0000 }, },  /* #6 */
+	    /*expect*/ { 0,0,0, -1,			  },
+	  },
+#endif
+	  { /*input.*/ { { 0x0041,0x0042,0x0000	       },
+			 { 0x0041,0x0042,0x0049,0x0000 }, },  /* #7 */
+	    /*expect*/ { 0,0,0, -1,			  },
+	  },
+	  { /*input.*/ { { 0x0041,0x0042,0x0049,0x0000 },
+			 { 0x0041,0x0042,0x0000	       }, },  /* #8 */
+	    /*expect*/ { 0,0,0, +1,			  },
+	  },
+#ifdef SHOJI_IS_RIGHT
+	  { /*input.*/ { { 0x0041,0x0092,0x0049,0x0000 },
+			 { 0x0041,0x008E,0x0049,0x0000 }, },  /* #9 */
+	    /*expect*/ { 0,0,0, +1,		       },
+	  },
+	  { /*input.*/ { { 0x0041,0x008E,0x0049,0x0000 },
+			 { 0x0041,0x0092,0x0049,0x0000 }, },  /* #10 */
+	    /*expect*/ { 0,0,0, -1,		       },
+	  },
+#else
+	  /* Do not assume position of character out of range.  */
+	  { /*input.*/ { { 0x0041,0x0092,0x0049,0x0000 },
+			 { 0x0041,0x008E,0x0049,0x0000 }, },  /* #9 */
+	    /*expect*/ { 0,0,0, 0,		       },
+	  },
+	  { /*input.*/ { { 0x0041,0x008E,0x0049,0x0000 },
+			 { 0x0041,0x0092,0x0049,0x0000 }, },  /* #10 */
+	    /*expect*/ { 0,0,0, 0,		       },
+	  },
+#endif
+	  { .is_last = 1 }
+	}
+    },
+#if 0
+    {	{ Twcscoll, TST_LOC_eucJP },
+#else
+    {	{ Twcscoll, TST_LOC_ja_UTF8 },
+#endif
+	{
+	  { /*input.*/ { { 0x3041,0x3042,0x3043,0x0000 },
+			 { 0x3041,0x3042,0x3043,0x0000 }, },  /* #1 */
+	    /*expect*/ { 0,1,0, 0,			  },
+	  },
+	  { /*input.*/ { { 0x0000,0x3041,0x3043,0x0000 },
+			 { 0x0000,0x3042,0x3043,0x0000 }, },  /* #2 */
+	    /*expect*/ { 0,1,0, 0,			  },
+	  },
+	  { /*input.*/ { { 0x3041,0x3041,0x3043,0x0000 },
+			 { 0x0000,0x3042,0x3043,0x0000 }, },  /* #3 */
+	    /*expect*/ { 0,0,0, +1,			  },
+	  },
+	  { /*input.*/ { { 0x0000,0x3042,0x3043,0x0000 },
+			 { 0x3041,0x3041,0x3043,0x0000 }, },  /* #4 */
+	    /*expect*/ { 0,0,0, -1,			  },
+	  },
+	  { /*input.*/ { { 0x3041,0x0042,0x3043,0x0000 },
+			 { 0x3041,0x0061,0x3043,0x0000 }, },  /* #5 */
+	    /*expect*/ { 0,0,0, -1,			  },
+	  },
+	  { /*input.*/ { { 0x3041,0x0061,0x3043,0x0000 },
+			 { 0x3041,0x0042,0x3043,0x0000 }, },  /* #6 */
+	    /*expect*/ { 0,0,0, +1,			  },
+	  },
+	  { /*input.*/ { { 0x3041,0x3042,0xFF71,0x0000 },
+			 { 0x3041,0x3042,0x30A2,0x0000 }, },  /* #7 */
+	    /*expect*/ { 0,0,0, -1,			  },
+	  },
+	  { /*input.*/ { { 0x3041,0x3042,0x30A2,0x0000 },
+			 { 0x3041,0x3042,0xFF71,0x0000 }, },  /* #8 */
+	    /*expect*/ { 0,0,0, +1,			  },
+	  },
+	  { /*input.*/ { { 0x30FF,0x3092,0x3049,0x0000 },
+			 { 0x3041,0x308E,0x3049,0x0000 }, },  /* #9 */
+	    /*expect*/ { 0,0,0, -1,		       },
+	  },
+	  { /*input.*/ { { 0x3041,0x308E,0x3049,0x0000 },
+			 { 0x30FF,0x3092,0x3049,0x0000 }, },  /* #10 */
+	    /*expect*/ { 0,0,0, +1,		       },
+	  },
+	  { .is_last = 1 }
+	}
+    },
+    {	{ Twcscoll, TST_LOC_end } }
+};
diff --git a/ap/build/uClibc/test/locale-mbwc/dat_wcscpy.c b/ap/build/uClibc/test/locale-mbwc/dat_wcscpy.c
new file mode 100644
index 0000000..b376bfc
--- /dev/null
+++ b/ap/build/uClibc/test/locale-mbwc/dat_wcscpy.c
@@ -0,0 +1,44 @@
+/*
+ *  TEST SUITE FOR MB/WC FUNCTIONS IN C LIBRARY
+ *
+ *	 FILE:	dat_wcscpy.c
+ *
+ *	 WCSCPY:  wchar_t *wcscpy (wchar_t *ws1, const wchar_t *ws2);
+ */
+
+TST_WCSCPY tst_wcscpy_loc [] = {
+
+    {	{ Twcscpy, TST_LOC_de },
+	{
+	    { {		  { 0x00F1,0x00F2,0x00F3,0x0000	 }, },	   /* 1 */
+	      {	 0,0,0,   { 0x00F1,0x00F2,0x00F3,0x0000, }  }, },
+	    { {		  { 0x0000,0x00F2,0x00F3,0x0000	 }, },	   /* 2 */
+	      {	 0,0,0,   { 0x0000,			 }  }, },
+	    { .is_last = 1 }
+	}
+    },
+    {	{ Twcscpy, TST_LOC_enUS },
+	{
+	    { {		  { 0x0041,0x0082,0x0043,0x0000	 }, },	   /* 1 */
+	      {	 0,0,0,   { 0x0041,0x0082,0x0043,0x0000, }  }, },
+	    { {		  { 0x0000,0x0082,0x0043,0x0000	 }, },	   /* 2 */
+	      {	 0,0,0,   { 0x0000,			 }  }, },
+	    { .is_last = 1 }
+	}
+    },
+#if 0
+    {	{ Twcscpy, TST_LOC_eucJP },
+#else
+    {	{ Twcscpy, TST_LOC_ja_UTF8 },
+#endif
+	{
+	    { {		  { 0x3041,0x0092,0x3043,0x0000	 }, },	   /* 1 */
+	      {	 0,0,0,   { 0x3041,0x0092,0x3043,0x0000, }  }, },
+	    { {		  { 0x0000,0x0092,0x3043,0x0000	 }, },	   /* 2 */
+	      {	 0,0,0,   { 0x0000,			 }  }, },
+	    { .is_last = 1 }
+	}
+    },
+    {	{ Twcscpy, TST_LOC_end }}
+
+};
diff --git a/ap/build/uClibc/test/locale-mbwc/dat_wcscspn.c b/ap/build/uClibc/test/locale-mbwc/dat_wcscspn.c
new file mode 100644
index 0000000..f6eb0c3
--- /dev/null
+++ b/ap/build/uClibc/test/locale-mbwc/dat_wcscspn.c
@@ -0,0 +1,164 @@
+/*
+ *  TEST SUITE FOR MB/WC FUNCTIONS IN C LIBRARY
+ *
+ *	 FILE:	dat_wcscspn.c
+ *
+ *	 WCSCSPN:  size_t wcscspn (const wchar_t *ws1, const wchar_t *ws2);
+ */
+
+
+TST_WCSCSPN tst_wcscspn_loc [] = {
+
+    {	{ Twcscspn, TST_LOC_de },
+	{
+	  { /*input.*/ { { 0x00D1,0x00D2,0x00D3,0x0000 },
+			 { 0x00D1,0x0000	       }, },  /* #1 */
+	    /*expect*/ { 0,1,0,			  },
+	  },
+	  { /*input.*/ { { 0x00D1,0x00D2,0x00D3,0x0000 },
+			 {	  0x00D2,0x0000	       }, },  /* #2 */
+	    /*expect*/ { 0,1,1,			  },
+	  },
+	  { /*input.*/ { { 0x00D1,0x00D2,0x00D3,0x0000 },
+			 {		 0x00D3,0x0000 }, },  /* #3 */
+	    /*expect*/ { 0,1,2,			  },
+	  },
+	  { /*input.*/ { { 0x00D1,0x00D2,0x00D3,0x0000 },
+			 {	  0x00D2,0x00D3,0x0000 }, },  /* #4 */
+	    /*expect*/ { 0,1,1,			  },
+	  },
+	  { /*input.*/ { { 0x00D1,0x00D2,0x00D3,0x0000 },
+			 { 0x00D2,0x00D3,0x00D4,0x0000 }, },  /* #5 */
+	    /*expect*/ { 0,1,1,			  },
+	  },
+	  { /*input.*/ { { 0x00D1,0x00D2,0x00D3,0x0000 },
+			 { 0x00D3,0x00D4,0x00D5,0x0000 }, },  /* #6 */
+	    /*expect*/ { 0,1,2,			  },
+	  },
+	  { /*input.*/ { { 0x00D1,0x00D2,0x00D3,0x0000 },
+			 { 0x00D1,0x00D2,0x00D3,0x0000 }, },  /* #7 */
+	    /*expect*/ { 0,1,0,			  },
+	  },
+	  { /*input.*/ { { 0x0000,0x00D2,0x00D3,0x0000 },
+			 { 0x00D2,0x000		       }, },  /* #8 */
+	    /*expect*/ { 0,1,0,			  },
+	  },
+	  { /*input.*/ { { 0x00D1,0x00D2,0x00D3,0x0000 },
+			 { 0x0000,0x00D2,0x00D3,0x0000 }, },  /* #9 */
+	    /*expect*/ { 0,1,3,			  },
+	  },
+	  { /*input.*/ { { 0x00D1,0x00D2,0x0000	       },
+			 { 0x00D1,0x00D2,0x00D3,0x0000 }, },  /* #10 */
+	    /*expect*/ { 0,1,0,			  },
+	  },
+	  { /*input.*/ { { 0x00D1,0x00D2,0x0000	       },
+			 { 0x00D1,0x00D3,0x00D4,0x0000 }, },  /* #11 */
+	    /*expect*/ { 0,1,0,			  },
+	  },
+	  { .is_last = 1 }
+	}
+    },
+    {	{ Twcscspn, TST_LOC_enUS },
+	{
+	  { /*input.*/ { { 0x0041,0x0042,0x0043,0x0000 },
+			 { 0x0041,0x0000	       }, },  /* #1 */
+	    /*expect*/ { 0,1,0,			  },
+	  },
+	  { /*input.*/ { { 0x0041,0x0042,0x0043,0x0000 },
+			 {	  0x0042,0x0000	       }, },  /* #2 */
+	    /*expect*/ { 0,1,1,			  },
+	  },
+	  { /*input.*/ { { 0x0041,0x0042,0x0043,0x0000 },
+			 {		 0x0043,0x0000 }, },  /* #3 */
+	    /*expect*/ { 0,1,2,			  },
+	  },
+	  { /*input.*/ { { 0x0041,0x0042,0x0043,0x0000 },
+			 {	  0x0042,0x0043,0x0000 }, },  /* #4 */
+	    /*expect*/ { 0,1,1,			  },
+	  },
+	  { /*input.*/ { { 0x0041,0x0042,0x0043,0x0000 },
+			 { 0x0042,0x0043,0x0044,0x0000 }, },  /* #5 */
+	    /*expect*/ { 0,1,1,			  },
+	  },
+	  { /*input.*/ { { 0x0041,0x0042,0x0043,0x0000 },
+			 { 0x0043,0x0044,0x0045,0x0000 }, },  /* #6 */
+	    /*expect*/ { 0,1,2,			  },
+	  },
+	  { /*input.*/ { { 0x0041,0x0042,0x0043,0x0000 },
+			 { 0x0041,0x0042,0x0043,0x0000 }, },  /* #7 */
+	    /*expect*/ { 0,1,0,			  },
+	  },
+	  { /*input.*/ { { 0x0000,0x0042,0x0043,0x0000 },
+			 { 0x0042,0x000		       }, },  /* #8 */
+	    /*expect*/ { 0,1,0,			  },
+	  },
+	  { /*input.*/ { { 0x0041,0x0042,0x0043,0x0000 },
+			 { 0x0000,0x0042,0x0043,0x0000 }, },  /* #9 */
+	    /*expect*/ { 0,1,3,			  },
+	  },
+	  { /*input.*/ { { 0x0041,0x0042,0x0000	       },
+			 { 0x0041,0x0042,0x0043,0x0000 }, },  /* #10 */
+	    /*expect*/ { 0,1,0,			  },
+	  },
+	  { /*input.*/ { { 0x0041,0x0042,0x0000	       },
+			 { 0x0041,0x0043,0x0044,0x0000 }, },  /* #11 */
+	    /*expect*/ { 0,1,0,			  },
+	  },
+	  { .is_last = 1 }
+	}
+    },
+#if 0
+    {	{ Twcscspn, TST_LOC_eucJP },
+#else
+    {	{ Twcscspn, TST_LOC_ja_UTF8 },
+#endif
+	{
+	  { /*input.*/ { { 0x3041,0x3042,0x0043,0x0000 },
+			 { 0x3041,0x0000	       }, },  /* #1 */
+	    /*expect*/ { 0,1,0,			  },
+	  },
+	  { /*input.*/ { { 0x3041,0x3042,0x0043,0x0000 },
+			 {	  0x3042,0x0000	       }, },  /* #2 */
+	    /*expect*/ { 0,1,1,			  },
+	  },
+	  { /*input.*/ { { 0x3041,0x3042,0x3043,0x0000 },
+			 {		 0x3043,0x0000 }, },  /* #3 */
+	    /*expect*/ { 0,1,2,			  },
+	  },
+	  { /*input.*/ { { 0x3041,0x3042,0x3043,0x0000 },
+			 {	  0x3042,0x3043,0x0000 }, },  /* #4 */
+	    /*expect*/ { 0,1,1,			  },
+	  },
+	  { /*input.*/ { { 0x3041,0x3042,0x3043,0x0000 },
+			 { 0x3042,0x3043,0x3044,0x0000 }, },  /* #5 */
+	    /*expect*/ { 0,1,1,			  },
+	  },
+	  { /*input.*/ { { 0x3041,0x3042,0x3043,0x0000 },
+			 { 0x3043,0x3044,0x3045,0x0000 }, },  /* #6 */
+	    /*expect*/ { 0,1,2,			  },
+	  },
+	  { /*input.*/ { { 0x3041,0x3042,0x3043,0x0000 },
+			 { 0x3041,0x3042,0x3043,0x0000 }, },  /* #7 */
+	    /*expect*/ { 0,1,0,			  },
+	  },
+	  { /*input.*/ { { 0x0000,0x3042,0x3043,0x0000 },
+			 { 0x3042,0x0000	       }, },  /* #8 */
+	    /*expect*/ { 0,1,0,			  },
+	  },
+	  { /*input.*/ { { 0x3041,0x3042,0x3043,0x0000 },
+			 { 0x0000,0x3042,0x3043,0x0000 }, },  /* #9 */
+	    /*expect*/ { 0,1,3,			  },
+	  },
+	  { /*input.*/ { { 0x3041,0x3042,0x0000	       },
+			 { 0x3041,0x3042,0x3043,0x0000 }, },  /* #10 */
+	    /*expect*/ { 0,1,0,			  },
+	  },
+	  { /*input.*/ { { 0x3041,0x3042,0x0000	       },
+			 { 0x3041,0x3043,0x3044,0x0000 }, },  /* #11 */
+	    /*expect*/ { 0,1,0,			  },
+	  },
+	  { .is_last = 1 }
+	}
+    },
+    {	{ Twcscspn, TST_LOC_end }}
+};
diff --git a/ap/build/uClibc/test/locale-mbwc/dat_wcslen.c b/ap/build/uClibc/test/locale-mbwc/dat_wcslen.c
new file mode 100644
index 0000000..7bb2c89
--- /dev/null
+++ b/ap/build/uClibc/test/locale-mbwc/dat_wcslen.c
@@ -0,0 +1,62 @@
+/*
+ *  TEST SUITE FOR MB/WC FUNCTIONS IN CLIBRARY
+ *
+ *       FILE:  dat_wcslen.c
+ *
+ *       WCSLEN:  size_t wcslen (const wchar_t *ws);
+ */
+
+
+/*
+ *  NOTE:
+ *
+ *      a header in each expected data:
+ *
+ *         int  err_val;  ... expected value for errno
+ *        <typ> ret_flg; ... set ret_flg=1 to compare an expected
+ *                           value with an actual value
+ *        <typ> ret_val; ... expected value for return
+ */
+
+
+TST_WCSLEN tst_wcslen_loc [] = {
+
+  {   { Twcslen, TST_LOC_de },
+      {
+	{ /*input.*/ { { 0x00D1,0x00D2,0x00D3,0x0000 } },  /* #01 */
+	  /*expect*/ { 0,1,3,                        },
+	},
+	{ /*input.*/ { { 0x0000 }                      },  /* #02 */
+	  /*expect*/ { 0,1,0,                        },
+	},
+	{ .is_last = 1 }
+      }
+  },
+  {   { Twcslen, TST_LOC_enUS },
+      {
+	{ /*input.*/ { { 0x0041,0x0042,0x0043,0x0000 } },  /* #01 */
+	  /*expect*/ { 0,1,3,                        },
+	},
+	{ /*input.*/ { { 0x0000 }                      },  /* #02 */
+	  /*expect*/ { 0,1,0,                        },
+	},
+	{ .is_last = 1 }
+      }
+  },
+#if 0
+  {   { Twcslen, TST_LOC_eucJP },
+#else
+  {   { Twcslen, TST_LOC_ja_UTF8 },
+#endif
+      {
+	{ /*input.*/ { { 0x3041,0x3042,0x3043,0x0000 } },  /* #01 */
+	  /*expect*/ { 0,1,3,                        },
+	},
+	{ /*input.*/ { { 0x0000 }                      },  /* #02 */
+	  /*expect*/ { 0,1,0,                        },
+	},
+	{ .is_last = 1 }
+      }
+  },
+  {   { Twcslen, TST_LOC_end }}
+};
diff --git a/ap/build/uClibc/test/locale-mbwc/dat_wcsncat.c b/ap/build/uClibc/test/locale-mbwc/dat_wcsncat.c
new file mode 100644
index 0000000..9d1e46b
--- /dev/null
+++ b/ap/build/uClibc/test/locale-mbwc/dat_wcsncat.c
@@ -0,0 +1,158 @@
+/*
+ *  TEST SUITE FOR MB/WC FUNCTIONS IN C LIBRARY
+ *
+ *	 FILE:	dat_wcsncat.c
+ *
+ *	 WCSNCAT:  wchar_t *wcsncat (wchar_t *ws1, wchar_t *ws2, size_t n);
+ */
+
+
+/*
+ *  Note:
+ *	  A terminating null wide chararacter is always appended to
+ *	  the result: ws1.
+ *
+ */
+
+
+TST_WCSNCAT tst_wcsncat_loc [] = {
+  {
+    {Twcsncat, TST_LOC_de},
+    {
+      /* 1 */
+      {
+	/* Input: */
+	{{ 0x00D1,0x00D2,0x0000	 },
+	 {		    0x00D3,0x00D4,0x0000 }, 3 },
+	/* Expect: */
+	{   0,	0,    0,
+	    { 0x00D1,0x00D2,0x00D3,0x00D4,0x0000 }    },
+      },
+      /* 2 */
+      {{{ 0x00D1,0x00D2,0x0000	},
+	{		   0x00D3,0x00D4,0x0000 }, 2 },
+       {   0,    0,    0,
+	   { 0x00D1,0x00D2,0x00D3,0x00D4,0x0000 }    },
+      },
+      /* 3 */
+      {{{ 0x00E1,0x00E2,0x0000	},
+	{		   0x00E3,0x00E4,0x0000 }, 1 },
+       {   0,    0,    0,
+	   { 0x00E1,0x00E2,0x00E3,0x0000	}    },
+      },
+      /* 4 */
+      {{{ 0x00E1,0x00E2,0x0000	},
+	{		   0x00E3,0x00E4,0x0000 }, 0 },
+       {   0,    0,    0,
+	   { 0x00E1,0x00E2,0x0000		}    },
+      },
+      /* 5 */
+      {{{ 0x0000		},
+	{		   0x00D3,0x00D4,0x0000 }, 3 },
+       {   0,    0,    0,
+	   {		   0x00D3,0x00D4,0x0000 }    },
+      },
+      /* 6 */
+      {{{ 0x00E1,0x00E2,0x0000	},
+	{		   0x0000		}, 3 },
+       {   0,    0,    0,
+	   { 0x00E1,0x00E2,0x0000		}    },
+      },
+      {.is_last = 1}
+    }
+  },
+  {
+    {Twcsncat, TST_LOC_enUS},
+    {
+      /* 1 */
+      {
+	/* Input:  */
+	{{ 0x0041,0x0042,0x0000	 },
+	 {		    0x0043,0x0044,0x0000 }, 3 },
+	/* Expect:  */
+	{   0,	0,    0,
+	    { 0x0041,0x0042,0x0043,0x0044,0x0000 }    },
+      },
+      /* 2 */
+      {{{ 0x0041,0x0042,0x0000	},
+	{		   0x0043,0x0044,0x0000 }, 2 },
+       {   0,    0,    0,
+	   { 0x0041,0x0042,0x0043,0x0044,0x0000 }    },
+      },
+      /* 3 */
+      {{{ 0x0051,0x0052,0x0000	},
+	{		   0x0053,0x0054,0x0000 }, 1 },
+       {   0,    0,    0,
+	   { 0x0051,0x0052,0x0053,0x0000	}    },
+      },
+      /* 4 */
+      {{{ 0x0051,0x0052,0x0000	},
+	{		   0x0053,0x0054,0x0000 }, 0 },
+       {   0,    0,    0,
+	   { 0x0051,0x0052,0x0000		}    },
+      },
+      /* 5 */
+      {{{ 0x0000		},
+	{		   0x0043,0x0044,0x0000 }, 3 },
+       {   0,    0,    0,
+	   {		   0x0043,0x0044,0x0000 }    },
+      },
+      /* 6 */
+      {{{ 0x0051,0x0052,0x0000	},
+	{		   0x0000		}, 3 },
+       {   0,    0,    0,
+	   { 0x0051,0x0052,0x0000		}    },
+      },
+      {.is_last = 1}
+    }
+  },
+  {
+#if 0
+    {Twcsncat, TST_LOC_eucJP},
+#else
+    {Twcsncat, TST_LOC_ja_UTF8},
+#endif
+    {
+      /* 1 */
+      {{{ 0x3041,0x3042,0x0000	},
+	{		   0x3043,0x3044,0x0000 }, 3 },
+       {   0,    0,    0,
+	   { 0x3041,0x3042,0x3043,0x3044,0x0000 }    },
+      },
+      /* 2 */
+      {{{ 0x30A2,0x30A3,0x0000	},
+	{		   0xFF71,0xFF72,0x0000 }, 2 },
+       {   0,    0,    0,
+	   { 0x30A2,0x30A3,0xFF71,0xFF72,0x0000 }    },
+      },
+      /* 3 */
+      {{{ 0x3051,0x3052,0x0000	},
+	{		   0x3053,0x3054,0x0000 }, 1 },
+       {   0,    0,    0,
+	   { 0x3051,0x3052,0x3053,0x0000	}    },
+      },
+      /* 4 */
+      {{{ 0x3051,0x3052,0x0000	},
+	{		   0x3053,0x3054,0x0000 }, 0 },
+       {   0,    0,    0,
+	   { 0x3051,0x3052,0x0000		}    },
+      },
+      /* 5 */
+      {{{ 0x0000		},
+	{		   0x3043,0x3044,0x0000 }, 3 },
+       {   0,    0,    0,
+	   {		   0x3043,0x3044,0x0000 }    },
+      },
+      /* 6 */
+      {{{ 0x3051,0x3052,0x0000	},
+	{		   0x0000		}, 3 },
+       {   0,    0,    0,
+	   { 0x3051,0x3052,0x0000		}    },
+      },
+      {.is_last = 1}
+    }
+  },
+  {
+    {Twcsncat, TST_LOC_end}
+  }
+};
diff --git a/ap/build/uClibc/test/locale-mbwc/dat_wcsncmp.c b/ap/build/uClibc/test/locale-mbwc/dat_wcsncmp.c
new file mode 100644
index 0000000..5c59631
--- /dev/null
+++ b/ap/build/uClibc/test/locale-mbwc/dat_wcsncmp.c
@@ -0,0 +1,144 @@
+/*
+ *  TEST SUITE FOR MB/WC FUNCTIONS IN C LIBRARY
+ *
+ *	 FILE:	dat_wcsncmp.c
+ *
+ *	 WCSNCMP:  int wcsncmp (const wchar_t *ws1, const wchar_t *ws2,
+ *				size_t n);
+ */
+
+TST_WCSNCMP tst_wcsncmp_loc [] = {
+  {
+    { Twcsncmp, TST_LOC_de },
+    {
+      { /*input.*/ { { 0x00D1,0x00D2,0x00D3,0x0000 },
+		     { 0x00D1,0x00D2,0x00D3,0x0000 }, 4 },  /* #01 */
+	/*expect*/ { 0,1,0,				},
+      },
+      { /*input.*/ { { 0x00D1,0x00D2,0x00D3,0x0000 },
+		     { 0x00D1,0x00D2,0x00D3,0x0000 }, 3 },  /* #02 */
+	/*expect*/ { 0,1,0,				},
+      },
+      { /*input.*/ { { 0x00D1,0x00D2,0x00D1,0x0000 },
+		     { 0x00D1,0x00D2,0x00D3,0x0000 }, 2 },  /* #03 */
+	/*expect*/ { 0,1,0,				},
+      },
+      { /*input.*/ { { 0x00D1,0x00D2,0x00D3,0x0000 },
+		     { 0x00D0,0x00D2,0x00D3,0x0000 }, 0 },  /* #04 */
+	/*expect*/ { 0,1,0,				},
+      },
+      { /*input.*/ { { 0x0000,0x00D2,0x00D3,0x0000 },
+		     { 0x0000,0x00D2,0x00D1,0x0000 }, 3 },  /* #05 */
+	/*expect*/ { 0,1,0,				},
+      },
+      { /*input.*/ { { 0x00D1,0x00D2,0x00D3,0x0000 },
+		     { 0x0000,0x00D2,0x00D3,0x0000 }, 3 },  /* #06 */
+	/*expect*/ { 0,1,0x00D1,			},
+      },
+      { /*input.*/ { { 0x00D1,0x00D2,0x00D3,0x0000 },
+		     { 0x00D1,0x00D2,0x00D9,0x0000 }, 2 },  /* #07 */
+	/*expect*/ { 0,1,0,				},
+      },
+      { /*input.*/ { { 0x00D1,0x00D2,0x00D3,0x0000 },
+		     { 0x00D1,0x00D2,0x00D9,0x0000 }, 3 },  /* #08 */
+	/*expect*/ { 0,1,-0x0006,			},
+      },
+      { /*input.*/ { { 0x00D1,0x00D2,0x00D3,0x0000 },
+		     { 0x00D1,0x00D2,0x0000	   }, 4 },  /* #09 */
+	/*expect*/ { 0,1,0x00D3,			},
+      },
+      { .is_last = 1 }
+    }
+  },
+  {
+    { Twcsncmp, TST_LOC_enUS },
+    {
+      { /*input.*/ { { 0x0041,0x0042,0x0043,0x0000 },
+		     { 0x0041,0x0042,0x0043,0x0000 }, 4 },  /* #01 */
+	/*expect*/ { 0,1,0,				},
+      },
+      { /*input.*/ { { 0x0041,0x0042,0x0043,0x0000 },
+		     { 0x0041,0x0042,0x0043,0x0000 }, 3 },  /* #02 */
+	/*expect*/ { 0,1,0,				},
+      },
+      { /*input.*/ { { 0x0041,0x0042,0x0041,0x0000 },
+		     { 0x0041,0x0042,0x0043,0x0000 }, 2 },  /* #03 */
+	/*expect*/ { 0,1,0,				},
+      },
+      { /*input.*/ { { 0x0041,0x0042,0x0043,0x0000 },
+		     { 0x0040,0x0042,0x0043,0x0000 }, 0 },  /* #04 */
+	/*expect*/ { 0,1,0,				},
+      },
+      { /*input.*/ { { 0x0000,0x0042,0x0043,0x0000 },
+		     { 0x0000,0x0042,0x0041,0x0000 }, 3 },  /* #05 */
+	/*expect*/ { 0,1,0,				},
+      },
+      { /*input.*/ { { 0x0041,0x0042,0x0043,0x0000 },
+		     { 0x0000,0x0042,0x0043,0x0000 }, 3 },  /* #06 */
+	/*expect*/ { 0,1,0x0041,			},
+      },
+      { /*input.*/ { { 0x0041,0x0042,0x0043,0x0000 },
+		     { 0x0041,0x0042,0x0049,0x0000 }, 2 },  /* #07 */
+	/*expect*/ { 0,1,0,				},
+      },
+      { /*input.*/ { { 0x0041,0x0042,0x0043,0x0000 },
+		     { 0x0041,0x0042,0x0049,0x0000 }, 3 },  /* #08 */
+	/*expect*/ { 0,1,-0x0006,			},
+      },
+      { /*input.*/ { { 0x0041,0x0042,0x0043,0x0000 },
+		     { 0x0041,0x0042,0x0000	   }, 4 },  /* #09 */
+	/*expect*/ { 0,1,0x0043,			},
+      },
+      { .is_last = 1 }
+    }
+  },
+  {
+#if 0
+    { Twcsncmp, TST_LOC_eucJP },
+#else
+    { Twcsncmp, TST_LOC_ja_UTF8 },
+#endif
+    {
+      { /*input.*/ { { 0x3041,0x3042,0x3043,0x0000 },
+		     { 0x3041,0x3042,0x3043,0x0000 }, 4 },  /* #01 */
+	/*expect*/ { 0,1,0,				},
+      },
+      { /*input.*/ { { 0x3041,0x3042,0x3043,0x0000 },
+		     { 0x3041,0x3042,0x3043,0x0000 }, 3 },  /* #02 */
+	/*expect*/ { 0,1,0,				},
+      },
+      { /*input.*/ { { 0x3041,0x3042,0x3041,0x0000 },
+		     { 0x3041,0x3042,0x3043,0x0000 }, 2 },  /* #03 */
+	/*expect*/ { 0,1,0,				},
+      },
+      { /*input.*/ { { 0x3041,0x3042,0x3043,0x0000 },
+		     { 0x3040,0x3042,0x3043,0x0000 }, 0 },  /* #04 */
+	/*expect*/ { 0,1,0,				},
+      },
+      { /*input.*/ { { 0x0000,0x3042,0x3043,0x0000 },
+		     { 0x0000,0x3042,0x3041,0x0000 }, 3 },  /* #05 */
+	/*expect*/ { 0,1,0,				},
+      },
+      { /*input.*/ { { 0x3041,0x3042,0x3043,0x0000 },
+		     { 0x0000,0x3042,0x3043,0x0000 }, 3 },  /* #06 */
+	/*expect*/ { 0,1,0x3041,			},
+      },
+      { /*input.*/ { { 0x3041,0x3042,0x3043,0x0000 },
+		     { 0x3041,0x3042,0x3049,0x0000 }, 2 },  /* #07 */
+	/*expect*/ { 0,1,0,				},
+      },
+      { /*input.*/ { { 0x3041,0x3042,0x3043,0x0000 },
+		     { 0x3041,0x3042,0x3049,0x0000 }, 3 },  /* #08 */
+	/*expect*/ { 0,1,-0x0006,			},
+      },
+      { /*input.*/ { { 0x3041,0x3042,0x3043,0x0000 },
+		     { 0x3041,0x3042,0x0000	   }, 4 },  /* #09 */
+	/*expect*/ { 0,1,0x3043,			},
+      },
+      { .is_last = 1 }
+    }
+  },
+  {
+    { Twcsncmp, TST_LOC_end }
+  }
+};
diff --git a/ap/build/uClibc/test/locale-mbwc/dat_wcsncpy.c b/ap/build/uClibc/test/locale-mbwc/dat_wcsncpy.c
new file mode 100644
index 0000000..7a65783
--- /dev/null
+++ b/ap/build/uClibc/test/locale-mbwc/dat_wcsncpy.c
@@ -0,0 +1,119 @@
+/*
+ *  TEST SUITE FOR MB/WC FUNCTIONS IN C LIBRARY
+ *
+ *       FILE:  dat_wcsncpy.c
+ *
+ *       WCSNCPY:  wchar_t *wcsncpy (wchar_t *ws1, const wchar_t *ws2,
+ *                                   size_t n);
+ */
+
+
+/* Note:
+ *
+ *       An initial value of ws1 in the test program is defined as:
+ *
+ *       #define WCSNUM_NCPY 7
+ *       wchar_t ws1 [WCSSIZE] = { 0x9999, 0x9999, 0x9999, 0x9999,
+ *                                 0x9999, 0x9999, 0x0000 };
+ * */
+
+
+TST_WCSNCPY tst_wcsncpy_loc [] = {
+  {
+    {Twcsncpy, TST_LOC_de},
+    {
+      /* 1 */
+      {{           { 0x00D1,0x00D2,0x00D3,0x0000                      }, 6 },
+       {    0,0,0, { 0x00D1,0x00D2,0x00D3,0x0000,0x0000,0x0000,0x0000 }    },
+      },
+      /* 2 */
+      {{           { 0x00D1,0x00D2,0x00D3,0x0000                      }, 5 },
+       {    0,0,0, { 0x00D1,0x00D2,0x00D3,0x0000,0x0000,0x9999,0x0000 }    },
+      },
+      /* 3 */
+      {{           { 0x00D1,0x00D2,0x00D3,0x0000                      }, 3 },
+       {    0,0,0, { 0x00D1,0x00D2,0x00D3,0x9999,0x9999,0x9999,0x0000 }    },
+      },
+      /* 4 */
+      {{           { 0x00D1,0x00D2,0x00D3,0x0000                      }, 2 },
+       {    0,0,0, { 0x00D1,0x00D2,0x9999,0x9999,0x9999,0x9999,0x0000 }    },
+      },
+      /* 5 */
+      {{           { 0x00D1,0x00D2,0x00D3,0x0000                      }, 0 },
+       {    0,0,0, { 0x9999,0x9999,0x9999,0x9999,0x9999,0x9999,0x0000 }    },
+      },
+      /* 6 */
+      {{           { 0x0000,0x00D2,0x00D3,0x0000                      }, 3 },
+       {    0,0,0, { 0x0000,0x0000,0x0000,0x9999,0x9999,0x9999,0x0000 }    },
+      },
+      {.is_last = 1}
+    }
+  },
+  {
+    {Twcsncpy, TST_LOC_enUS},
+    {
+      /* 1 */
+      {{           { 0x0041,0x0042,0x0043,0x0000                      }, 6 },
+       {    0,0,0, { 0x0041,0x0042,0x0043,0x0000,0x0000,0x0000,0x0000 }    },
+      },
+      /* 2 */
+      {{           { 0x0041,0x0042,0x0043,0x0000                      }, 5 },
+       {    0,0,0, { 0x0041,0x0042,0x0043,0x0000,0x0000,0x9999,0x0000 }    },
+      },
+      /* 3 */
+      {{           { 0x0041,0x0042,0x0043,0x0000                      }, 3 },
+       {    0,0,0, { 0x0041,0x0042,0x0043,0x9999,0x9999,0x9999,0x0000 }    },
+      },
+      /* 4 */
+      {{           { 0x0041,0x0042,0x0043,0x0000                      }, 2 },
+       {    0,0,0, { 0x0041,0x0042,0x9999,0x9999,0x9999,0x9999,0x0000 }    },
+      },
+      /* 5 */
+      {{           { 0x0041,0x0042,0x0043,0x0000                      }, 0 },
+       {    0,0,0, { 0x9999,0x9999,0x9999,0x9999,0x9999,0x9999,0x0000 }    },
+      },
+      /* 6 */
+      {{           { 0x0000,0x0042,0x0043,0x0000                      }, 3 },
+       {    0,0,0, { 0x0000,0x0000,0x0000,0x9999,0x9999,0x9999,0x0000 }    },
+      },
+      {.is_last = 1}
+    }
+  },
+  {
+#if 0
+    {Twcsncpy, TST_LOC_eucJP},
+#else
+    {Twcsncpy, TST_LOC_ja_UTF8},
+#endif
+    {
+      /* 1 */
+      {{           { 0x3041,0x3042,0x3043,0x0000                      }, 6 },
+       {    0,0,0, { 0x3041,0x3042,0x3043,0x0000,0x0000,0x0000,0x0000 }    },
+      },
+      /* 2 */
+      {{           { 0x3041,0x3042,0x3043,0x0000                      }, 5 },
+       {    0,0,0, { 0x3041,0x3042,0x3043,0x0000,0x0000,0x9999,0x0000 }    },
+      },
+      /* 3 */
+      {{           { 0x3041,0x3042,0x3043,0x0000                      }, 3 },
+       {    0,0,0, { 0x3041,0x3042,0x3043,0x9999,0x9999,0x9999,0x0000 }    },
+      },
+      /* 4 */
+      {{           { 0x3041,0x3042,0x3043,0x0000                      }, 2 },
+       {    0,0,0, { 0x3041,0x3042,0x9999,0x9999,0x9999,0x9999,0x0000 }    },
+      },
+      /* 5 */
+      {{           { 0x3041,0x3042,0x3043,0x0000                      }, 0 },
+       {    0,0,0, { 0x9999,0x9999,0x9999,0x9999,0x9999,0x9999,0x0000 }    },
+      },
+      /* 6 */
+      {{           { 0x0000,0x3042,0x3043,0x0000                      }, 3 },
+       {    0,0,0, { 0x0000,0x0000,0x0000,0x9999,0x9999,0x9999,0x0000 }    },
+      },
+      {.is_last = 1}
+    }
+  },
+  {
+    {Twcsncpy, TST_LOC_end}
+  }
+};
diff --git a/ap/build/uClibc/test/locale-mbwc/dat_wcspbrk.c b/ap/build/uClibc/test/locale-mbwc/dat_wcspbrk.c
new file mode 100644
index 0000000..471515e
--- /dev/null
+++ b/ap/build/uClibc/test/locale-mbwc/dat_wcspbrk.c
@@ -0,0 +1,176 @@
+/*
+ *  TEST SUITE FOR MB/WC FUNCTIONS IN C LIBRARY
+ *
+ *	 FILE:	dat_wcspbrk.c
+ *
+ *	 WCSSTR:  wchar_t *wcspbrk (const wchar_t *ws1, const wchar_t *ws2);
+ */
+
+
+/*
+ * NOTE:
+ *	 This is not a locale sensitive function.
+ *	 So those data in each locale doesn't make sense
+ *	 ... (redundant test cases)
+ */
+
+
+TST_WCSPBRK tst_wcspbrk_loc [] = {
+  {
+    { Twcspbrk, TST_LOC_de },
+    {
+      { /*input.*/ { { 0x00D1,0x00D2,0x00D3,0x0000 },
+		     { 0x00D1,0x0000		   }, },  /* #01 */
+	/*expect*/ { 0,0,0,		    0x00D1    },
+      },
+      { /*input.*/ { { 0x00D1,0x00D2,0x00D3,0x0000 },
+		     {	      0x00D2,0x0000	   }, },  /* #02 */
+	/*expect*/ { 0,0,0,		    0x00D2    },
+      },
+      { /*input.*/ { { 0x00D1,0x00D2,0x00D3,0x0000 },
+		     {		     0x00D3,0x0000 }, },  /* #03 */
+	/*expect*/ { 0,0,0,		    0x00D3    },
+      },
+      { /*input.*/ { { 0x00D1,0x00D2,0x00D3,0x0000 },
+		     { 0x00D1,0x00D2,0x0000	   }, },  /* #04 */
+	/*expect*/ { 0,0,0,		    0x00D1    },
+      },
+      { /*input.*/ { { 0x00D1,0x00D2,0x00D3,0x0000 },
+		     {	      0x00D2,0x00D3,0x0000 }, },  /* #05 */
+	/*expect*/ { 0,0,0,		    0x00D2    },
+      },
+      { /*input.*/ { { 0x00D1,0x00D2,0x00D3,0x0000 },
+		     { 0x00D1,0x00D2,0x00D3,0x0000 }, },  /* #06 */
+	/*expect*/ { 0,0,0,		    0x00D1    },
+      },
+      { /*input.*/ { { 0x00D1,0x00D2,0x00D3,0x0000 },
+		     { 0x00D0,0x00D4,0x00D5,0x0000 }, },  /* #07 */
+	/*expect*/ { 0,1,(wchar_t *)NULL, 0x0000    },
+      },
+      { /*input.*/ { { 0x00D1,0x00D2,0x00D3,0x0000 },
+		     { 0x00D5,0x00D0,0x00D4,0x0000 }, },  /* #08 */
+	/*expect*/ { 0,1,(wchar_t *)NULL, 0x0000    },
+      },
+      { /*input.*/ { { 0x00D1,0x00D2,0x00D3,0x0000 },
+		     { 0x0000			   }, },  /* #09 */
+	/*expect*/ { 0,1,(wchar_t *)NULL, 0x0000    },
+      },
+      { /*input.*/ { { 0x0000,0x00D2,0x00D3,0x0000 },
+		     { 0x00D1,0x0000		   }, },  /* #10 */
+	/*expect*/ { 0,1,(wchar_t *)NULL, 0x0000    },
+      },
+      { /*input.*/ { { 0x0000,0x00D2,0x00D3,0x0000 },
+		     { 0x0000			   }, },  /* #11 */
+	/*expect*/ { 0,1,(wchar_t *)NULL, 0x0000    },
+      },
+      { .is_last = 1 }
+    }
+  },
+  {
+    { Twcspbrk, TST_LOC_enUS },
+    {
+      { /*input.*/ { { 0x0041,0x0042,0x0043,0x0000 },
+		     { 0x0041,0x0000		   }, },  /* #01 */
+	/*expect*/ { 0,0,0,		    0x0041    },
+      },
+      { /*input.*/ { { 0x0041,0x0042,0x0043,0x0000 },
+		     {	      0x0042,0x0000	   }, },  /* #02 */
+	/*expect*/ { 0,0,0,		    0x0042    },
+      },
+      { /*input.*/ { { 0x0041,0x0042,0x0043,0x0000 },
+		     {		     0x0043,0x0000 }, },  /* #03 */
+	/*expect*/ { 0,0,0,		    0x0043    },
+      },
+      { /*input.*/ { { 0x0041,0x0042,0x0043,0x0000 },
+		     { 0x0041,0x0042,0x0000	   }, },  /* #04 */
+	/*expect*/ { 0,0,0,		    0x0041    },
+      },
+      { /*input.*/ { { 0x0041,0x0042,0x0043,0x0000 },
+		     {	      0x0042,0x0043,0x0000 }, },  /* #05 */
+	/*expect*/ { 0,0,0,		    0x0042    },
+      },
+      { /*input.*/ { { 0x0041,0x0042,0x0043,0x0000 },
+		     { 0x0041,0x0042,0x0043,0x0000 }, },  /* #06 */
+	/*expect*/ { 0,0,0,		    0x0041    },
+      },
+      { /*input.*/ { { 0x0041,0x0042,0x0043,0x0000 },
+		     { 0x0040,0x0044,0x0045,0x0000 }, },  /* #07 */
+	/*expect*/ { 0,1,(wchar_t *)NULL, 0x0000    },
+      },
+      { /*input.*/ { { 0x0041,0x0042,0x0043,0x0000 },
+		     { 0x0045,0x0040,0x0044,0x0000 }, },  /* #08 */
+	/*expect*/ { 0,1,(wchar_t *)NULL, 0x0000    },
+      },
+      { /*input.*/ { { 0x0041,0x0042,0x0043,0x0000 },
+		     { 0x0000			   }, },  /* #09 */
+	/*expect*/ { 0,1,(wchar_t *)NULL, 0x0000    },
+      },
+      { /*input.*/ { { 0x0000,0x0042,0x0043,0x0000 },
+		     { 0x0041,0x0000		   }, },  /* #10 */
+	/*expect*/ { 0,1,(wchar_t *)NULL, 0x0000    },
+      },
+      { /*input.*/ { { 0x0000,0x0042,0x0043,0x0000 },
+		     { 0x0000			   }, },  /* #11 */
+	/*expect*/ { 0,1,(wchar_t *)NULL, 0x0000    },
+      },
+      { .is_last = 1 }
+    }
+  },
+  {
+#if 0
+    { Twcspbrk, TST_LOC_eucJP },
+#else
+    { Twcspbrk, TST_LOC_ja_UTF8 },
+#endif
+    {
+      { /*input.*/ { { 0x3041,0x3042,0x3043,0x0000 },
+		     { 0x3041,0x0000		   }, },  /* #01 */
+	/*expect*/ { 0,0,0,		    0x3041    },
+      },
+      { /*input.*/ { { 0x3041,0x3042,0x3043,0x0000 },
+		     {	      0x3042,0x0000	   }, },  /* #02 */
+	/*expect*/ { 0,0,0,		    0x3042    },
+      },
+      { /*input.*/ { { 0x3041,0x3042,0x3043,0x0000 },
+		     {		     0x3043,0x0000 }, },  /* #03 */
+	/*expect*/ { 0,0,0,		    0x3043    },
+      },
+      { /*input.*/ { { 0x3041,0x3042,0x3043,0x0000 },
+		     { 0x3041,0x3042,0x0000	   }, },  /* #04 */
+	/*expect*/ { 0,0,0,		    0x3041    },
+      },
+      { /*input.*/ { { 0x3041,0x3042,0x3043,0x0000 },
+		     {	      0x3042,0x3043,0x0000 }, },  /* #05 */
+	/*expect*/ { 0,0,0,		    0x3042    },
+      },
+      { /*input.*/ { { 0x3041,0x3042,0x3043,0x0000 },
+		     { 0x3041,0x3042,0x3043,0x0000 }, },  /* #06 */
+	/*expect*/ { 0,0,0,		    0x3041    },
+      },
+      { /*input.*/ { { 0x3041,0x3042,0x3043,0x0000 },
+		     { 0x3042,0x3043,0x3044,0x0000 }, },  /* #07 */
+	/*expect*/ { 0,0,0, 0x3042		      },
+      },
+      { /*input.*/ { { 0x3041,0x3042,0x3043,0x0000 },
+		     { 0x3040,0x3041,0x3042,0x0000 }, },  /* #08 */
+	/*expect*/ { 0,0,0, 0x3041		      },
+      },
+      { /*input.*/ { { 0x3041,0x3042,0x3043,0x0000 },
+		     { 0x0000			   }, },  /* #09 */
+	/*expect*/ { 0,1,(wchar_t *)NULL, 0x0000    },
+      },
+      { /*input.*/ { { 0x0000,0x3042,0x3043,0x0000 },
+		     { 0x3041,0x0000		   }, },  /* #10 */
+	/*expect*/ { 0,1,(wchar_t *)NULL, 0x0000    },
+      },
+      { /*input.*/ { { 0x0000,0x3042,0x3043,0x0000 },
+		     { 0x0000			   }, },  /* #11 */
+	/*expect*/ { 0,1,(wchar_t *)NULL, 0x0000    },
+      },
+      { .is_last = 1 }
+    }
+  },
+  {
+    { Twcspbrk, TST_LOC_end }
+  }
+};
diff --git a/ap/build/uClibc/test/locale-mbwc/dat_wcsrtombs.c b/ap/build/uClibc/test/locale-mbwc/dat_wcsrtombs.c
new file mode 100644
index 0000000..f8adc6c
--- /dev/null
+++ b/ap/build/uClibc/test/locale-mbwc/dat_wcsrtombs.c
@@ -0,0 +1,272 @@
+/*
+ *  TEST SUITE FOR MB/WC FUNCTIONS IN C LIBRARY
+ *
+ *	 FILE:	dat_wcsrtombs.c
+ *
+ *	 WCSTOMBS:  size_t wcsrtombs (char *s, const wchar_t **ws,
+ *				      size_t n, mbstate *ps)
+ */
+
+
+/*
+ *  CAUTION:
+ *	     Do not use a value 0x01 for string data. The test program
+ *	     uses it.
+ *
+ */
+
+
+TST_WCSRTOMBS tst_wcsrtombs_loc [] = {
+  {
+    { Twcsrtombs, TST_LOC_de },
+    {
+      /* #01 : Any chars including a null char should not be stored in s.  */
+      { /*input.*/ { 1,1,	{ 0x00C4,0x00D6,0x00DC,0x0000 }, 0, 0, 0},
+	/*expect*/ { 0,1,0,	 ""					},
+      },
+      /* #02 : Only one chars should be stored in s. No null termination.  */
+      { /*input.*/ { 1,1,	{ 0x00C4,0x00D6,0x00DC,0x0000 }, 1, 0, 0 },
+	/*expect*/ { 0,1,1,	 "Ä"					 },
+      },
+      /* #03 : Only two chars should be stored in s. No null termination.  */
+      { /*input.*/ { 1,1,	{ 0x00C4,0x00D6,0x00DC,0x0000 }, 2, 0, 0 },
+	/*expect*/ { 0,1,2,	 "ÄÖ"					 },
+      },
+      /* #04 : Only three chars should be stored in s. No null
+	       termination.  */
+      { /*input.*/ { 1,1,	{ 0x00C4,0x00D6,0x00DC,0x0000 }, 3, 0, 0 },
+	/*expect*/ { 0,1,3,	 "ÄÖÜ"					 },
+      },
+      /* #05 : Only three chars should be stored in s with a null
+	       termination. */
+      { /*input.*/ { 1,1,	{ 0x00C4,0x00D6,0x00DC,0x0000 }, 4, 0, 0 },
+	/*expect*/ { 0,1,3,	 "ÄÖÜ"					 },
+      },
+      /* #06 : Only three chars should be stored in s with a null
+	       termination. */
+      { /*input.*/ { 1,1,	{ 0x00C4,0x00D6,0x00DC,0x0000 }, 5, 0, 0 },
+	/*expect*/ { 0,1,3,	 "ÄÖÜ"					 },
+      },
+      /* #07 : Invalid mb sequence. No chars should be stored in s.  */
+      { /*input.*/ { 1,1,	{ 0x0201,0x0221,0x0000,0x0000 }, 2, 0, 0 },
+	/*expect*/ { EILSEQ,1,(size_t)-1,	 ""			 },
+      },
+      /* #08 : s is a null pointer, no chars should be stored in s.  */
+      { /*input.*/ { 0,1,	{ 0x00C4,0x00D6,0x00DC,0x0000 }, 0, 0, 0 },
+	/*expect*/ { 0,1,3,	 ""					 },
+      },
+      /* #09 : s is a null pointer, no chars should be stored in s.  */
+      { /*input.*/ { 0,1,	{ 0x00C4,0x00D6,0x00DC,0x0000 }, 1, 0, 0 },
+	/*expect*/ { 0,1,3,	 ""					 },
+      },
+      /* #10 : s is a null pointer, no chars should be stored in s.  */
+      { /*input.*/ { 0,1,	{ 0x00C4,0x00D6,0x00DC,0x0000 }, 5, 0, 0 },
+	/*expect*/ { 0,1,3,	 ""					 },
+      },
+      /* #11 : s is a null pointer. No chars should be stored in s.  */
+      { /*input.*/ { 0,1,	{ 0x0201,0x0221,0x0000,0x0000 }, 5, 0, 0 },
+	/*expect*/ { EILSEQ,1,(size_t)-1,	 ""			 },
+      },
+      /* #12 : ws is a null wc string, no chars should be stored in s.  */
+      { /*input.*/ { 1,1,	{ 0x0000 },			 5, 0, 0 },
+	/*expect*/ { 0,1,0,	 ""					 },
+      },
+      /* #13 : s is a null pointer, no chars should be stored in s.  */
+      { /*input.*/ { 0,1,	{ 0x0000 },			 5, 0, 0 },
+	/*expect*/ { 0,1,0,	 ""					 },
+      },
+      { .is_last = 1 }
+    }
+  },
+  {
+    { Twcsrtombs, TST_LOC_enUS },
+    {
+      /* #01 : Any chars including a null char should not be stored in s.  */
+      { /*input.*/ { 1,1,	{ 0x0041,0x0042,0x0043,0x0000 }, 0, 0, 0 },
+	/*expect*/ { 0,1,0,	 ""					 },
+      },
+      /* #02 : Only one chars should be stored in s. No null termination.  */
+      { /*input.*/ { 1,1,	{ 0x0041,0x0042,0x0043,0x0000 }, 1, 0, 0 },
+	/*expect*/ { 0,1,1,	 "A"					 },
+      },
+      /* #03 : Only two chars should be stored in s. No null termination. */
+      { /*input.*/ { 1,1,	{ 0x0041,0x0042,0x0043,0x0000 }, 2, 0, 0 },
+	/*expect*/ { 0,1,2,	 "AB"					 },
+      },
+      /* #04 : Only three chars should be stored in s. No null
+	       termination.  */
+      { /*input.*/ { 1,1,	{ 0x0041,0x0042,0x0043,0x0000 }, 3, 0, 0 },
+	/*expect*/ { 0,1,3,	 "ABC"					 },
+      },
+      /* #05 : Only three chars should be stored in s with a null
+	       termination. */
+      { /*input.*/ { 1,1,	{ 0x0041,0x0042,0x0043,0x0000 }, 4, 0, 0 },
+	/*expect*/ { 0,1,3,	 "ABC"					 },
+      },
+      /* #06 : Only three chars should be stored in s with a null
+	       termination. */
+      { /*input.*/ { 1,1,	{ 0x0041,0x0042,0x0043,0x0000 }, 5, 0, 0 },
+	/*expect*/ { 0,1,3,	 "ABC"					 },
+      },
+      /* #07 : Invalid mb sequence. No chars should be stored in s.  */
+      { /*input.*/ { 1,1,	{ 0x0201,0x0221,0x0000,0x0000 }, 2, 0, 0 },
+	/*expect*/ { EILSEQ,1,(size_t)-1,	 ""					},
+      },
+      /* #08 : s is a null pointer, no chars should be stored in s.  */
+      { /*input.*/ { 0,1,	{ 0x0041,0x0042,0x0043,0x0000 }, 0, 0, 0 },
+	/*expect*/ { 0,1,3,	 ""					 },
+      },
+      /* #09 : s is a null pointer, no chars should be stored in s.  */
+      { /*input.*/ { 0,1,	{ 0x0041,0x0042,0x0043,0x0000 }, 1, 0, 0 },
+	/*expect*/ { 0,1,3,	 ""					 },
+      },
+      /* #10 : s is a null pointer, no chars should be stored in s.  */
+      { /*input.*/ { 0,1,	{ 0x0041,0x0042,0x0043,0x0000 }, 5, 0, 0 },
+	/*expect*/ { 0,1,3,	 ""					 },
+      },
+      /* #11 : s is a null pointer. No chars should be stored in s.  */
+      { /*input.*/ { 0,1,	{ 0x0201,0x0221,0x0000,0x0000 }, 5, 0, 0 },
+	/*expect*/ { EILSEQ,1,(size_t)-1,	 ""			 },
+      },
+      /* #12 : ws is a null wc string, no chars should be stored in s.  */
+      { /*input.*/ { 1,1,	{ 0x0000 },			 5, 0, 0 },
+	/*expect*/ { 0,1,0,	 ""					 },
+      },
+      /* #13 : s is a null pointer, no chars should be stored in s.  */
+      { /*input.*/ { 0,1,	{ 0x0000 },			 5, 0, 0 },
+	/*expect*/ { 0,1,0,	 ""					 },
+      },
+      { .is_last = 1 }
+    }
+  },
+#if 0
+  {
+    { Twcsrtombs, TST_LOC_eucJP },
+    {
+
+      /* #01 : Any chars including a null char should not be stored in s.  */
+      { /*input.*/ { 1,1,	{ 0x3042,0x3044,0xFF73,0x0000 }, 0, 0, 0 },
+	/*expect*/ { 0,1,0,	 ""					 },
+      },
+      /* #02 : Only one chars should be stored in s. No null termination.  */
+      { /*input.*/ { 1,1,	{ 0x3042,0x3044,0xFF73,0x0000 }, 2, 0, 0 },
+	/*expect*/ { 0,1,2,	    "\244\242"				 },
+      },
+      /* #03 : Only two chars should be stored in s. No null termination.  */
+      { /*input.*/ { 1,1,	{ 0x3042,0x3044,0xFF73,0x0000 }, 4, 0, 0 },
+	/*expect*/ { 0,1,4,	    "\244\242\244\244"			 },
+      },
+      /* #04 : Only three chars should be stored in s. No null
+	       termination.  */
+      { /*input.*/ { 1,1,	{ 0x3042,0x3044,0xFF73,0x0000 }, 6, 0, 0 },
+	/*expect*/ { 0,1,6,	    "\244\242\244\244\216\263"		 },
+      },
+      /* #05 : Only three chars should be stored in s with a null
+	       termination. */
+      { /*input.*/ { 1,1,	{ 0x3042,0x3044,0xFF73,0x0000 }, 7, 0, 0 },
+	/*expect*/ { 0,1,6,	    "\244\242\244\244\216\263"		 },
+      },
+      /* #06 : Only three chars should be stored in s with a null
+	       termination. */
+      { /*input.*/ { 1,1,	{ 0x3042,0x3044,0xFF73,0x0000 }, 8, 0, 0 },
+	/*expect*/ { 0,1,6,	    "\244\242\244\244\216\263"		 },
+      },
+      /* #07 : Invalid mb sequence. No chars should be stored in s.  */
+      { /*input.*/ { 1,1,	{ 0x0201,0x0221,0x0000,0x0000 }, 2, 0, 0 },
+	/*expect*/ { EILSEQ,1,-1, ""					 },
+      },
+      /* #08 : s is a null pointer, no chars should be stored in s.  */
+      { /*input.*/ { 0,1,	{ 0x3042,0x3044,0xFF73,0x0000 }, 0, 0, 0 },
+	/*expect*/ { 0,1,6,	 ""					 },
+      },
+      /* #09 : s is a null pointer, no chars should be stored in s.  */
+      { /*input.*/ { 0,1,	{ 0x3042,0x3044,0xFF73,0x0000 }, 1, 0, 0 },
+	/*expect*/ { 0,1,6,	 ""					 },
+      },
+      /* #10 : s is a null pointer, no chars should be stored in s.  */
+      { /*input.*/ { 0,1,	{ 0x3042,0x3044,0xFF73,0x0000 }, 8, 0, 0 },
+	/*expect*/ { 0,1,6,	 ""					 },
+      },
+      /* #11 : s is a null pointer. No chars should be stored in s.  */
+      { /*input.*/ { 0,1,	{ 0x0201,0x0221,0x0000,0x0000 }, 5, 0, 0 },
+	/*expect*/ { EILSEQ,1,(size_t)-1,	 ""			 },
+      },
+      /* #12 : ws is a null wc string, no chars should be stored in s.  */
+      { /*input.*/ { 1,1,	{ 0x0000 },			 5, 0, 0 },
+	/*expect*/ { 0,1,0,	 ""					 },
+      },
+      /* #13 : s is a null pointer, no chars should be stored in s.  */
+      { /*input.*/ { 0,1,	{ 0x0000 },			 5, 0, 0 },
+	/*expect*/ { 0,1,0,	 ""					 },
+      },
+      { .is_last = 1 }
+    }
+  },
+#else
+  {
+    { Twcsrtombs, TST_LOC_ja_UTF8 },
+    {
+
+      /* #01 : Any chars including a null char should not be stored in s.  */
+      { /*input.*/ { 1,1,	{ 0x3042,0x3044,0xFF73,0x0000 }, 0, 0, 0 },
+	/*expect*/ { 0,1,0,	 ""					 },
+      },
+      /* #02 : Only one chars should be stored in s. No null termination.  */
+      { /*input.*/ { 1,1,	{ 0x3042,0x3044,0xFF73,0x0000 }, 3, 0, 0 },
+	/*expect*/ { 0,1,3,	    "\343\201\202"			 },
+      },
+      /* #03 : Only two chars should be stored in s. No null termination.  */
+      { /*input.*/ { 1,1,	{ 0x3042,0x3044,0xFF73,0x0000 }, 6, 0, 0 },
+	/*expect*/ { 0,1,6,	    "\343\201\202\343\201\204"		 },
+      },
+      /* #04 : Only three chars should be stored in s. No null
+	       termination.  */
+      { /*input.*/ { 1,1,	{ 0x3042,0x3044,0xFF73,0x0000 }, 9, 0, 0 },
+	/*expect*/ { 0,1,9,    "\343\201\202\343\201\204\357\275\263"	 },
+      },
+      /* #05 : Only three chars should be stored in s with a null
+	       termination. */
+      { /*input.*/ { 1,1,	{ 0x3042,0x3044,0xFF73,0x0000 }, 10, 0, 0 },
+	/*expect*/ { 0,1,9,	"\343\201\202\343\201\204\357\275\263"	 },
+      },
+      /* #06 : Only three chars should be stored in s with a null
+	       termination. */
+      { /*input.*/ { 1,1,	{ 0x3042,0x3044,0xFF73,0x0000 }, 11, 0, 0 },
+	/*expect*/ { 0,1,9,	"\343\201\202\343\201\204\357\275\263"	  },
+      },
+      /* #07 : Invalid mb sequence. No chars should be stored in s.  */
+      { /*input.*/ { 1,1,	{ 0x0201,0x0221,0x0000,0x0000 }, 2, 0, 0 },
+	/*expect*/ { EILSEQ,1,-1, ""					 },
+      },
+      /* #08 : s is a null pointer, no chars should be stored in s.  */
+      { /*input.*/ { 0,1,	{ 0x3042,0x3044,0xFF73,0x0000 }, 0, 0, 0 },
+	/*expect*/ { 0,1,9,	 ""					 },
+      },
+      /* #09 : s is a null pointer, no chars should be stored in s.  */
+      { /*input.*/ { 0,1,	{ 0x3042,0x3044,0xFF73,0x0000 }, 1, 0, 0 },
+	/*expect*/ { 0,1,9,	 ""					 },
+      },
+      /* #10 : s is a null pointer, no chars should be stored in s.  */
+      { /*input.*/ { 0,1,	{ 0x3042,0x3044,0xFF73,0x0000 }, 8, 0, 0 },
+	/*expect*/ { 0,1,9,	 ""					 },
+      },
+      /* #11 : s is a null pointer. No chars should be stored in s.  */
+      { /*input.*/ { 0,1,	{ 0x0201,0x0221,0x0000,0x0000 }, 5, 0, 0 },
+	/*expect*/ { EILSEQ,1,(size_t)-1,	 ""			 },
+      },
+      /* #12 : ws is a null wc string, no chars should be stored in s.  */
+      { /*input.*/ { 1,1,	{ 0x0000 },			 5, 0, 0 },
+	/*expect*/ { 0,1,0,	 ""					 },
+      },
+      /* #13 : s is a null pointer, no chars should be stored in s.  */
+      { /*input.*/ { 0,1,	{ 0x0000 },			 5, 0, 0 },
+	/*expect*/ { 0,1,0,	 ""					 },
+      },
+      { .is_last = 1 }
+    }
+  },
+#endif
+  {
+    { Twcsrtombs, TST_LOC_end }
+  }
+};
diff --git a/ap/build/uClibc/test/locale-mbwc/dat_wcsspn.c b/ap/build/uClibc/test/locale-mbwc/dat_wcsspn.c
new file mode 100644
index 0000000..06af2d6
--- /dev/null
+++ b/ap/build/uClibc/test/locale-mbwc/dat_wcsspn.c
@@ -0,0 +1,179 @@
+/*
+ *  TEST SUITE FOR MB/WC FUNCTIONS IN C LIBRARY
+ *
+ *	 FILE:	dat_wcsspn.c
+ *
+ *	 WCSSPN:  size_t wcsspn (const wchar_t *ws1, const wchar_t *ws2);
+ */
+
+TST_WCSSPN tst_wcsspn_loc [] = {
+    {
+      { Twcsspn, TST_LOC_de },
+      {
+	{ /*input.*/ { { 0x00D1,0x00D2,0x00D3,0x0000 },
+		       { 0x00D1,0x0000		     }, },  /* #01 */
+	  /*expect*/ { 0,1,1,				},
+	},
+	{ /*input.*/ { { 0x00D1,0x00D2,0x00D3,0x0000 },
+		       {	0x00D2,0x0000	     }, },  /* #02 */
+	  /*expect*/ { 0,1,0,				},
+	},
+	{ /*input.*/ { { 0x00D1,0x00D2,0x00D3,0x0000 },
+		       {	       0x00D3,0x0000 }, },  /* #03 */
+	  /*expect*/ { 0,1,0,				},
+	},
+	{ /*input.*/ { { 0x00D1,0x00D2,0x00D3,0x0000 },
+		       {	       0x00D4,0x0000 }, },  /* #04 */
+	  /*expect*/ { 0,1,0,				},
+	},
+	{ /*input.*/ { { 0x00D1,0x00D2,0x00D3,0x0000 },
+		       {	0x00D2,0x00D3,0x0000 }, },  /* #05 */
+	  /*expect*/ { 0,1,0,				},
+	},
+	{ /*input.*/ { { 0x00D1,0x00D2,0x00D3,0x0000 },
+		       {	0x00D3,0x00D4,0x0000 }, },  /* #06 */
+	  /*expect*/ { 0,1,0,				},
+	},
+	{ /*input.*/ { { 0x00D1,0x00D2,0x00D3,0x0000 },
+		       { 0x00D1,0x00D2,0x00D3,0x0000 }, },  /* #07 */
+	  /*expect*/ { 0,1,3,				},
+	},
+	{ /*input.*/ { { 0x00D1,0x00D2,0x0000	     },
+		       { 0x00D1,0x00D2,0x00D3,0x0000 }, },  /* #08 */
+	  /*expect*/ { 0,1,2,				},
+	},
+	{ /*input.*/ { { 0x0000,0x00D2,0x00D3,0x0000 },
+		       { 0x00D2,0x0000		     }, },  /* #09 */
+	  /*expect*/ { 0,1,0,				},
+	},
+	{ /*input.*/ { { 0x00D1,0x00D2,0x00D3,0x0000 },
+		       { 0x0000,0x00D2,0x0000	     }, },  /* #10 */
+	  /*expect*/ { 0,1,0,				},
+	},
+	{ /*input.*/ { { 0x0000,0x00D2,0x00D3,0x0000 },
+		       { 0x0000,0x00D2,0x0000	     }, },  /* #11 */
+	  /*expect*/ { 0,1,0,				},
+	},
+	{ /*input.*/ { { 0x00D1,0x00D2,0x00D3,0x0000 },
+		       { 0x00D2,0x00D1,0x0000	     }, },  /* #12 */
+	  /*expect*/ { 0,1,2,				},
+	},
+	{ .is_last = 1 }
+      }
+    },
+    {
+      { Twcsspn, TST_LOC_enUS },
+      {
+	{ /*input.*/ { { 0x0041,0x0042,0x0043,0x0000 },
+		       { 0x0041,0x0000		     }, },  /* #01 */
+	  /*expect*/ { 0,1,1,				},
+	},
+	{ /*input.*/ { { 0x0041,0x0042,0x0043,0x0000 },
+		       {	0x0042,0x0000	     }, },  /* #02 */
+	  /*expect*/ { 0,1,0,				},
+	},
+	{ /*input.*/ { { 0x0041,0x0042,0x0043,0x0000 },
+		       {	       0x0043,0x0000 }, },  /* #03 */
+	  /*expect*/ { 0,1,0,				},
+	},
+	{ /*input.*/ { { 0x0041,0x0042,0x0043,0x0000 },
+		       {	       0x0044,0x0000 }, },  /* #04 */
+	  /*expect*/ { 0,1,0,				},
+	},
+	{ /*input.*/ { { 0x0041,0x0042,0x0043,0x0000 },
+		       {	0x0042,0x0043,0x0000 }, },  /* #05 */
+	  /*expect*/ { 0,1,0,				},
+	},
+	{ /*input.*/ { { 0x0041,0x0042,0x0043,0x0000 },
+		       {	0x0043,0x0044,0x0000 }, },  /* #06 */
+	  /*expect*/ { 0,1,0,				},
+	},
+	{ /*input.*/ { { 0x0041,0x0042,0x0043,0x0000 },
+		       { 0x0041,0x0042,0x0043,0x0000 }, },  /* #07 */
+	  /*expect*/ { 0,1,3,				},
+	},
+	{ /*input.*/ { { 0x0041,0x0042,0x0000	     },
+		       { 0x0041,0x0042,0x0043,0x0000 }, },  /* #08 */
+	  /*expect*/ { 0,1,2,				},
+	},
+	{ /*input.*/ { { 0x0000,0x0042,0x0043,0x0000 },
+		       { 0x0042,0x0000		     }, },  /* #09 */
+	  /*expect*/ { 0,1,0,				},
+	},
+	{ /*input.*/ { { 0x0041,0x0042,0x0043,0x0000 },
+		       { 0x0000,0x0042,0x0000	     }, },  /* #10 */
+	  /*expect*/ { 0,1,0,				},
+	},
+	{ /*input.*/ { { 0x0000,0x0042,0x0043,0x0000 },
+		       { 0x0000,0x0042,0x0000	     }, },  /* #11 */
+	  /*expect*/ { 0,1,0,				},
+	},
+	{ /*input.*/ { { 0x0041,0x0042,0x0043,0x0000 },
+		       { 0x0042,0x0041,0x0000	     }, },  /* #12 */
+	  /*expect*/ { 0,1,2,				},
+	},
+	{ .is_last = 1 }
+      }
+    },
+    {
+#if 0
+      { Twcsspn, TST_LOC_eucJP },
+#else
+      { Twcsspn, TST_LOC_ja_UTF8 },
+#endif
+      {
+	{ /*input.*/ { { 0x3041,0x3042,0x3043,0x0000 },
+		       { 0x3041,0x0000		     }, },  /* #1 */
+	  /*expect*/ { 0,1,1,				},
+	},
+	{ /*input.*/ { { 0x3041,0x3042,0x3043,0x0000 },
+		       {	0x3042,0x0000	     }, },  /* #2 */
+	  /*expect*/ { 0,1,0,				},
+	},
+	{ /*input.*/ { { 0x3041,0x3042,0x3043,0x0000 },
+		       {	       0x3043,0x0000 }, },  /* #3 */
+	  /*expect*/ { 0,1,0,				},
+	},
+	{ /*input.*/ { { 0x3041,0x3042,0x3043,0x0000 },
+		       {	       0x3044,0x0000 }, },  /* #4 */
+	  /*expect*/ { 0,1,0,				},
+	},
+	{ /*input.*/ { { 0x3041,0x3042,0x3043,0x0000 },
+		       {	0x3042,0x3043,0x0000 }, },  /* #5 */
+	  /*expect*/ { 0,1,0,				},
+	},
+	{ /*input.*/ { { 0x3041,0x3042,0x3043,0x0000 },
+		       {	0x3043,0x3044,0x0000 }, },  /* #6 */
+	  /*expect*/ { 0,1,0,				},
+	},
+	{ /*input.*/ { { 0x3041,0x3042,0x3043,0x0000 },
+		       { 0x3041,0x3042,0x3043,0x0000 }, },  /* #7 */
+	  /*expect*/ { 0,1,3,				},
+	},
+	{ /*input.*/ { { 0x3041,0x3042,0x0000	     },
+		       { 0x3041,0x3042,0x3043,0x0000 }, },  /* #8 */
+	  /*expect*/ { 0,1,2,				},
+	},
+	{ /*input.*/ { { 0x0000,0x3042,0x3043,0x0000 },
+		       { 0x3042,0x0000		     }, },  /* #9 */
+	  /*expect*/ { 0,1,0,				},
+	},
+	{ /*input.*/ { { 0x3041,0x3042,0x3043,0x0000 },
+		       { 0x0000,0x3042,0x0000	     }, },  /* #10 */
+	  /*expect*/ { 0,1,0,				},
+	},
+	{ /*input.*/ { { 0x0000,0x3042,0x3043,0x0000 },
+		       { 0x0000,0x3042,0x0000	     }, },  /* #11 */
+	  /*expect*/ { 0,1,0,				},
+	},
+	{ /*input.*/ { { 0x3041,0x3042,0x3043,0x0000 },
+		       { 0x3042,0x3041,0x0000	     }, },  /* #12 */
+	  /*expect*/ { 0,1,2,				},
+	},
+	{ .is_last = 1 }
+      }
+    },
+    {
+      { Twcsspn, TST_LOC_end }
+    }
+};
diff --git a/ap/build/uClibc/test/locale-mbwc/dat_wcsstr.c b/ap/build/uClibc/test/locale-mbwc/dat_wcsstr.c
new file mode 100644
index 0000000..f999dc5
--- /dev/null
+++ b/ap/build/uClibc/test/locale-mbwc/dat_wcsstr.c
@@ -0,0 +1,175 @@
+/*
+ *  TEST SUITE FOR MB/WC FUNCTIONS IN C LIBRARY
+ *
+ *	 FILE:	dat_wcsstr.c
+ *
+ *	 WCSSTR:  wchar_t *wcsstr (const wchar_t *ws1, const wchar_t *ws2);
+ */
+
+/*
+ * NOTE:
+ *	 This is not a locale sensitive function.
+ *	 So those data in each locale doesn't make sense ...
+ *	 (redundant test cases)
+ */
+
+
+TST_WCSSTR tst_wcsstr_loc [] = {
+  {
+    { Twcsstr, TST_LOC_de },
+    {
+      { /*input.*/ { { 0x00D1,0x00D2,0x00D3,0x0000 },
+		     { 0x00D1,0x0000		   }, },  /* #01 */
+	/*expect*/ { 0,0,0,			      },
+      },
+      { /*input.*/ { { 0x00D1,0x00D2,0x00D3,0x0000 },
+		     {	      0x00D2,0x0000	   }, },  /* #02 */
+	/*expect*/ { 0,0,0,			      },
+      },
+      { /*input.*/ { { 0x00D1,0x00D2,0x00D3,0x0000 },
+		     {		     0x00D3,0x0000 }, },  /* #03 */
+	/*expect*/ { 0,0,0,			      },
+      },
+      { /*input.*/ { { 0x00D1,0x00D2,0x00D3,0x0000 },
+		     { 0x00D1,0x00D2,0x0000	   }, },  /* #04 */
+	/*expect*/ { 0,0,0,			      },
+      },
+      { /*input.*/ { { 0x00D1,0x00D2,0x00D3,0x0000 },
+		     {	      0x00D2,0x00D3,0x0000 }, },  /* #05 */
+	/*expect*/ { 0,0,0,			      },
+      },
+      { /*input.*/ { { 0x00D1,0x00D2,0x00D3,0x0000 },
+		     { 0x00D1,0x00D2,0x00D3,0x0000 }, },  /* #06 */
+	/*expect*/ { 0,0,0,			      },
+      },
+      { /*input.*/ { { 0x00D1,0x00D2,0x00D3,0x0000 },
+		     { 0x00D2,0x00D3,0x00D4,0x0000 }, },  /* #07 */
+	/*expect*/ { 0,1,(wchar_t *)NULL,	      },
+      },
+      { /*input.*/ { { 0x00D1,0x00D2,0x00D3,0x0000 },
+		     { 0x00D0,0x00D1,0x00D2,0x0000 }, },  /* #08 */
+	/*expect*/ { 0,1,(wchar_t *)NULL,	      },
+      },
+      { /*input.*/ { { 0x00D1,0x00D2,0x00D3,0x0000 },
+		     { 0x0000			   }, },  /* #09 */
+	/*expect*/ { 0,0,0,			      },
+      },
+      { /*input.*/ { { 0x0000,0x00D2,0x00D3,0x0000 },
+		     { 0x00D1,0x0000		   }, },  /* #10 */
+	/*expect*/ { 0,1,(wchar_t *)NULL,	      },
+      },
+      { /*input.*/ { { 0x0000,0x00D2,0x00D3,0x0000 },
+		     { 0x0000			   }, },  /* #11 */
+	/*expect*/ { 0,0,0,			      },
+      },
+      { .is_last = 1 }
+    }
+  },
+  {
+    { Twcsstr, TST_LOC_enUS },
+    {
+      { /*input.*/ { { 0x0041,0x0042,0x0043,0x0000 },
+		     { 0x0041,0x0000		   }, },  /* #01 */
+	/*expect*/ { 0,0,0,			      },
+      },
+      { /*input.*/ { { 0x0041,0x0042,0x0043,0x0000 },
+		     {	      0x0042,0x0000	   }, },  /* #02 */
+	/*expect*/ { 0,0,0,			      },
+      },
+      { /*input.*/ { { 0x0041,0x0042,0x0043,0x0000 },
+		     {		     0x0043,0x0000 }, },  /* #03 */
+	/*expect*/ { 0,0,0,			      },
+      },
+      { /*input.*/ { { 0x0041,0x0042,0x0043,0x0000 },
+		     { 0x0041,0x0042,0x0000	   }, },  /* #04 */
+	/*expect*/ { 0,0,0,			      },
+      },
+      { /*input.*/ { { 0x0041,0x0042,0x0043,0x0000 },
+		     {	      0x0042,0x0043,0x0000 }, },  /* #05 */
+	/*expect*/ { 0,0,0,			      },
+      },
+      { /*input.*/ { { 0x0041,0x0042,0x0043,0x0000 },
+		     { 0x0041,0x0042,0x0043,0x0000 }, },  /* #06 */
+	/*expect*/ { 0,0,0,			      },
+      },
+      { /*input.*/ { { 0x0041,0x0042,0x0043,0x0000 },
+		     { 0x0042,0x0043,0x0044,0x0000 }, },  /* #07 */
+	/*expect*/ { 0,1,(wchar_t *)NULL,	      },
+      },
+      { /*input.*/ { { 0x0041,0x0042,0x0043,0x0000 },
+		     { 0x0040,0x0041,0x0042,0x0000 }, },  /* #08 */
+	/*expect*/ { 0,1,(wchar_t *)NULL,	      },
+      },
+      { /*input.*/ { { 0x0041,0x0042,0x0043,0x0000 },
+		     { 0x0000			   }, },  /* #09 */
+	/*expect*/ { 0,0,0,			      },
+      },
+      { /*input.*/ { { 0x0000,0x0042,0x0043,0x0000 },
+		     { 0x0041,0x0000		   }, },  /* #10 */
+	/*expect*/ { 0,1,(wchar_t *)NULL,	      },
+      },
+      { /*input.*/ { { 0x0000,0x0042,0x0043,0x0000 },
+		     { 0x0000			   }, },  /* #11 */
+	/*expect*/ { 0,0,0,			      },
+      },
+      { .is_last = 1 }
+    }
+  },
+  {
+#if 0
+    { Twcsstr, TST_LOC_eucJP },
+#else
+    { Twcsstr, TST_LOC_ja_UTF8 },
+#endif
+    {
+      { /*input.*/ { { 0x3041,0x3042,0x3043,0x0000 },
+		     { 0x3041,0x0000		   }, },  /* #01 */
+	/*expect*/ { 0,0,0,			      },
+      },
+      { /*input.*/ { { 0x3041,0x3042,0x3043,0x0000 },
+		     {	      0x3042,0x0000	   }, },  /* #02 */
+	/*expect*/ { 0,0,0,			      },
+      },
+      { /*input.*/ { { 0x3041,0x3042,0x3043,0x0000 },
+		     {		     0x3043,0x0000 }, },  /* #03 */
+	/*expect*/ { 0,0,0,			      },
+      },
+      { /*input.*/ { { 0x3041,0x3042,0x3043,0x0000 },
+		     { 0x3041,0x3042,0x0000	   }, },  /* #04 */
+	/*expect*/ { 0,0,0,			      },
+      },
+      { /*input.*/ { { 0x3041,0x3042,0x3043,0x0000 },
+		     {	      0x3042,0x3043,0x0000 }, },  /* #05 */
+	/*expect*/ { 0,0,0,			      },
+      },
+      { /*input.*/ { { 0x3041,0x3042,0x3043,0x0000 },
+		     { 0x3041,0x3042,0x3043,0x0000 }, },  /* #06 */
+	/*expect*/ { 0,0,0,			      },
+      },
+      { /*input.*/ { { 0x3041,0x3042,0x3043,0x0000 },
+		     { 0x3042,0x3043,0x3044,0x0000 }, },  /* #07 */
+	/*expect*/ { 0,1,(wchar_t *)NULL,	      },
+      },
+      { /*input.*/ { { 0x3041,0x3042,0x3043,0x0000 },
+		     { 0x3040,0x3041,0x3042,0x0000 }, },  /* #08 */
+	/*expect*/ { 0,1,(wchar_t *)NULL,	      },
+      },
+      { /*input.*/ { { 0x3041,0x3042,0x3043,0x0000 },
+		     { 0x0000			   }, },  /* #09 */
+	/*expect*/ { 0,0,0,			      },
+      },
+      { /*input.*/ { { 0x0000,0x3042,0x3043,0x0000 },
+		     { 0x3041,0x0000		   }, },  /* #10 */
+	/*expect*/ { 0,1,(wchar_t *)NULL,	      },
+      },
+      { /*input.*/ { { 0x0000,0x3042,0x3043,0x0000 },
+		     { 0x0000			   }, },  /* #11 */
+	/*expect*/ { 0,0,0,			      },
+      },
+      { .is_last = 1 }
+    }
+  },
+  {
+    { Twcsstr, TST_LOC_end }
+  }
+};
diff --git a/ap/build/uClibc/test/locale-mbwc/dat_wcstod.c b/ap/build/uClibc/test/locale-mbwc/dat_wcstod.c
new file mode 100644
index 0000000..c7b4018
--- /dev/null
+++ b/ap/build/uClibc/test/locale-mbwc/dat_wcstod.c
@@ -0,0 +1,78 @@
+/*
+ *  TEST SUITE FOR MB/WC FUNCTIONS IN CLIBRARY
+ *
+ *	 FILE:	dat_wcstod.c
+ *
+ *	 WCSTOD:  double wcstod (const wchar_t *np, wchar_t **endp);
+ */
+
+
+/*
+ *  NOTE:
+ *	  need more test data!
+ *
+ */
+
+
+TST_WCSTOD tst_wcstod_loc [] = {
+  {
+    { Twcstod, TST_LOC_de },
+    {
+      {
+	/*01*/
+	/*I*/
+	{{ 0x0030,0x0030,0x0030,0x002C,0x0030,0x0030,0x0030,0x0030,0x0000 }},
+	/*E*/
+	{ 0,1,0.0,	       0.0,				  0x0000   }
+      },
+      {
+	/*02*/
+	/*I*/
+	{{ 0x0031,0x0032,0x0033,0x002C,0x0034,0x0035,0x0036,0x0040,0x0000 }},
+	/*E*/
+	{ 0,1,123.456,	       123.456,			   0x0040  }
+      },
+      { .is_last = 1 }
+    }
+  },
+  {
+    { Twcstod, TST_LOC_enUS },
+    {
+      {
+	/*01*/
+	/*I*/
+	{{ 0x0030,0x0030,0x0030,0x002E,0x0030,0x0030,0x0030,0x0030,0x0000 }},
+	/*E*/
+	{ 0,1,0.0,	       0.0,				  0x0000   }
+      },
+      {
+	/*02*/
+	/*I*/
+	{{ 0x0031,0x0032,0x0033,0x002E,0x0034,0x0035,0x0036,0x0040,0x0000 }},
+	/*E*/
+	{ 0,1,123.456,	       123.456,			   0x0040  }
+      },
+      { .is_last = 1 }
+    }
+  },
+  {
+#if 0
+    { Twcstod, TST_LOC_eucJP },
+#else
+    { Twcstod, TST_LOC_ja_UTF8 },
+#endif
+    {
+      {
+	/*01*/
+	/*I*/
+	{{ 0x0031,0x0032,0x0033,0x002E,0x0034,0x0035,0x0036,0x0040,0x0000 }},
+	/*E*/
+	{ 0,1,123.456,	       123.456,			   0x0040  }
+      },
+      { .is_last = 1 }
+    }
+  },
+  {
+    { Twcstod, TST_LOC_end }
+  }
+};
diff --git a/ap/build/uClibc/test/locale-mbwc/dat_wcstok.c b/ap/build/uClibc/test/locale-mbwc/dat_wcstok.c
new file mode 100644
index 0000000..559b401
--- /dev/null
+++ b/ap/build/uClibc/test/locale-mbwc/dat_wcstok.c
@@ -0,0 +1,138 @@
+/*
+ *  TEST SUITE FOR MB/WC FUNCTIONS IN CLIBRARY
+ *
+ *	 FILE:	dat_wcstok.c
+ *
+ *	 WCSTOK: wchar_t *wcstok (wchar_t *ws, const wchar_t *dlm,
+ *				  wchar_t **pt);
+ */
+
+/*
+ *  NOTE:
+ *	  need more test data!
+ *	  locale insensitive function...
+ */
+
+
+
+
+TST_WCSTOK tst_wcstok_loc [] = {
+  {
+    { Twcstok, TST_LOC_de },
+    {
+      {
+	{
+	  {
+	    { 1, { 0x00D1,0x00D2,0x00D3,0x00D4,0x00D5,0x00D6,0x00D7,0x00D8,
+		   0x00D9,0x0000 },
+	      {	       0x00D3,0x00D2,	    0x00D5 }
+	    },
+	    { 0, { 0x00D1,0x00D2,0x00D3,0x00D4,0x00D5,0x00D6,0x00D7,0x00D8,
+		   0x00D9,0x0000 },
+	      {	       0x00D3,0x00D2,	    0x00D5 }
+	    },
+	    { 0, { 0x00D1,0x00D2,0x00D3,0x00D4,0x00D5,0x00D6,0x00D7,0x00D8,
+		   0x00D9,0x0000 },
+	      {	       0x00D3,0x00D2,	    0x00D5 }
+	    },
+	  }
+	},
+	{
+	  {
+	    { 0, 0,0,
+	      { 0x00D1,0x0000 }
+	    },
+	    { 0, 0,0,
+	      {			     0x00D4,0x0000 }
+	    },
+	    { 0, 0,0,
+	      { 0x00D6,0x00D7,0x00D8,0x00D9,0x0000 }
+	    },
+	  }
+	}
+      },
+      { .is_last = 1 }
+    }
+  },
+  {
+    { Twcstok, TST_LOC_enUS },
+    {
+      {
+	{
+	  {
+	    { 1, { 0x0041,0x0042,0x0043,0x0044,0x0045,0x0046,0x0047,0x0048,
+		   0x0049,0x0000 },
+	      {	       0x0043,0x0042,	    0x0045 }
+	    },
+	    { 0, { 0x0041,0x0042,0x0043,0x0044,0x0045,0x0046,0x0047,0x0048,
+		   0x0049,0x0000 },
+	      {	       0x0043,0x0042,	    0x0045 }
+	    },
+	    { 0, { 0x0041,0x0042,0x0043,0x0044,0x0045,0x0046,0x0047,0x0048,
+		   0x0049,0x0000 },
+	      {	       0x0043,0x0042,	    0x0045 }
+	    },
+	  }
+	},
+	{
+	  {
+	    { 0, 0,0,
+	      { 0x0041,0x0000 }
+	    },
+	    { 0, 0,0,
+	      {			     0x0044,0x0000 }
+	    },
+	    { 0, 0,0,
+	      { 0x0046,0x0047,0x0048,0x0049,0x0000 }
+	    },
+	  }
+	}
+      },
+      { .is_last = 1 }
+    }
+  },
+  {
+#if 0
+    { Twcstok, TST_LOC_eucJP },
+#else
+    { Twcstok, TST_LOC_ja_UTF8 },
+#endif
+    {
+      {
+	{
+	  {
+	    { 1, { 0x0041,0x0042,0x0043,0x0044,0x0045,0x0046,0x0047,0x0048,
+		   0x0049,0x0000 },
+	      {	       0x0043,0x0042,	    0x0045 }
+	    },
+	    { 0, { 0x0041,0x0042,0x0043,0x0044,0x0045,0x0046,0x0047,0x0048,
+		   0x0049,0x0000 },
+	      {	       0x0043,0x0042,	    0x0045 }
+	    },
+	    { 0, { 0x0041,0x0042,0x0043,0x0044,0x0045,0x0046,0x0047,0x0048,
+		   0x0049,0x0000 },
+	      {	       0x0043,0x0042,	    0x0045 }
+	    },
+	  }
+	},
+	{
+	  {
+	    { 0, 0,0,
+	      { 0x0041,0x0000 }
+	    },
+	    { 0, 0,0,
+	      {			     0x0044,0x0000 }
+	    },
+	    { 0, 0,0,
+	      { 0x0046,0x0047,0x0048,0x0049,0x0000 }
+	    },
+	  }
+	}
+      },
+      { .is_last = 1 }
+    }
+  },
+  {
+    { Twcstok, TST_LOC_end }
+  }
+};
diff --git a/ap/build/uClibc/test/locale-mbwc/dat_wcstombs.c b/ap/build/uClibc/test/locale-mbwc/dat_wcstombs.c
new file mode 100644
index 0000000..ffeb0ef
--- /dev/null
+++ b/ap/build/uClibc/test/locale-mbwc/dat_wcstombs.c
@@ -0,0 +1,271 @@
+/*
+ *  TEST SUITE FOR MB/WC FUNCTIONS IN C LIBRARY
+ *
+ *	 FILE:	dat_wcstombs.c
+ *
+ *	 WCSTOMBS:  size_t wcstombs (char *s, const wchar_t *ws, size_t n)
+ */
+
+
+/*
+ *  CAUTION:
+ *	     Do not use a value 0x01 for string data. The test program
+ *	     uses it.
+ *
+ */
+
+
+TST_WCSTOMBS tst_wcstombs_loc [] = {
+  {
+    { Twcstombs, TST_LOC_de },
+    {
+      /* #01 : Any chars including a null char should not be stored in s.  */
+      { /*input.*/ { 1,1,	       { 0x00C4,0x00D6,0x00DC,0x0000 }, 0 },
+	/*expect*/ { 0,1,0,	 ""					  },
+      },
+      /* #02 : Only one chars should be stored in s. No null termination.  */
+      { /*input.*/ { 1,1,	       { 0x00C4,0x00D6,0x00DC,0x0000 },	1 },
+	/*expect*/ { 0,1,1,	 "Ä"					  },
+      },
+      /* #03 : Only two chars should be stored in s. No null termination.  */
+      { /*input.*/ { 1,1,	       { 0x00C4,0x00D6,0x00DC,0x0000 },	2 },
+	/*expect*/ { 0,1,2,	 "ÄÖ"					  },
+      },
+      /* #04 : Only three chars should be stored in s. No null
+	       termination.  */
+      { /*input.*/ { 1,1,	       { 0x00C4,0x00D6,0x00DC,0x0000 },	3 },
+	/*expect*/ { 0,1,3,	 "ÄÖÜ"					  },
+      },
+      /* #05 : Only three chars should be stored in s with a null
+	       termination.  */
+      { /*input.*/ { 1,1,	       { 0x00C4,0x00D6,0x00DC,0x0000 },	4 },
+	/*expect*/ { 0,1,3,	 "ÄÖÜ"					  },
+      },
+      /* #06 : Only three chars should be stored in s with a null
+	       termination.  */
+      { /*input.*/ { 1,1,	       { 0x00C4,0x00D6,0x00DC,0x0000 },	5 },
+	/*expect*/ { 0,1,3,	 "ÄÖÜ"					  },
+      },
+      /* #07 : Invalid mb sequence. No chars should be stored in s. */
+      { /*input.*/ { 1,1,	       { 0x0201,0x0221,0x0000,0x0000 },	2 },
+	/*expect*/ { EILSEQ,1,(size_t)-1,	 ""			  },
+      },
+      /* #08 : s is a null pointer, no chars should be stored in s.  */
+      { /*input.*/ { 0,1,	       { 0x00C4,0x00D6,0x00DC,0x0000 }, 0 },
+	/*expect*/ { 0,1,3,	 ""					  },
+      },
+      /* #09 : s is a null pointer, no chars should be stored in s.  */
+      { /*input.*/ { 0,1,	       { 0x00C4,0x00D6,0x00DC,0x0000 }, 1 },
+	/*expect*/ { 0,1,3,	 ""					  },
+      },
+      /* #10 : s is a null pointer, no chars should be stored in s.  */
+      { /*input.*/ { 0,1,	       { 0x00C4,0x00D6,0x00DC,0x0000 }, 5 },
+	/*expect*/ { 0,1,3,	 ""					  },
+      },
+      /* #11 : s is a null pointer. No chars should be stored in s.  */
+      { /*input.*/ { 0,1,	       { 0x0201,0x0221,0x0000,0x0000 }, 5 },
+	/*expect*/ { EILSEQ,1,(size_t)-1,	 ""			  },
+      },
+      /* #12 : ws is a null wc string, no chars should be stored in s.  */
+      { /*input.*/ { 1,1,	       { 0x0000 },			5 },
+	/*expect*/ { 0,1,0,	 ""					  },
+      },
+      /* #13 : s is a null pointer, no chars should be stored in s.  */
+      { /*input.*/ { 0,1,	       { 0x0000 },			5 },
+	/*expect*/ { 0,1,0,	 ""					  },
+      },
+      { .is_last = 1 }
+    }
+  },
+  {
+    { Twcstombs, TST_LOC_enUS },
+    {
+      /* #01 : Any chars including a null char should not be stored in s.  */
+      { /*input.*/ { 1,1,	       { 0x00C4,0x0042,0x0043,0x0000 },	0  },
+	/*expect*/ { 0,1,0,	 ""					   },
+      },
+      /* #02 : Only one chars should be stored in s. No null termination.  */
+      { /*input.*/ { 1,1,	       { 0x0041,0x0042,0x0043,0x0000 }, 1  },
+	/*expect*/ { 0,1,1,	 "A"					   },
+      },
+      /* #03 : Only two chars should be stored in s. No null termination.  */
+      { /*input.*/ { 1,1,	       { 0x0041,0x0042,0x0043,0x0000 }, 2  },
+	/*expect*/ { 0,1,2,	 "AB"					   },
+      },
+      /* #04 : Only three chars should be stored in s. No null
+	       termination.  */
+      { /*input.*/ { 1,1,	       { 0x0041,0x0042,0x0043,0x0000 }, 3  },
+	/*expect*/ { 0,1,3,	 "ABC"					   },
+      },
+      /* #05 : Only three chars should be stored in s with a null
+	       termination.  */
+      { /*input.*/ { 1,1,	       { 0x0041,0x0042,0x0043,0x0000 }, 4  },
+	/*expect*/ { 0,1,3,	 "ABC"					   },
+      },
+      /* #06 : Only three chars should be stored in s with a null
+	       termination.  */
+      { /*input.*/ { 1,1,	       { 0x0041,0x0042,0x0043,0x0000 }, 5  },
+	/*expect*/ { 0,1,3,	 "ABC"					   },
+      },
+      /* #07 : Invalid mb sequence. No chars should be stored in s.  */
+      { /*input.*/ { 1,1,	       { 0x0201,0x0221,0x0000,0x0000 }, 2  },
+	/*expect*/ { EILSEQ,1,(size_t)-1,	 ""			   },
+      },
+      /* #08 : s is a null pointer, no chars should be stored in s.  */
+      { /*input.*/ { 0,1,	       { 0x0041,0x0042,0x0043,0x0000 }, 0  },
+	/*expect*/ { 0,1,3,	 ""					   },
+      },
+      /* #09 : s is a null pointer, no chars should be stored in s.  */
+      { /*input.*/ { 0,1,	       { 0x0041,0x0042,0x0043,0x0000 }, 1  },
+	/*expect*/ { 0,1,3,	 ""					   },
+      },
+      /* #10 : s is a null pointer, no chars should be stored in s.  */
+      { /*input.*/ { 0,1,	       { 0x0041,0x0042,0x0043,0x0000 }, 5  },
+	/*expect*/ { 0,1,3,	 ""					   },
+      },
+      /* #11 : s is a null pointer. No chars should be stored in s.  */
+      { /*input.*/ { 0,1,	       { 0x0201,0x0221,0x0000,0x0000 }, 5  },
+	/*expect*/ { EILSEQ,1,(size_t)-1,	 ""			   },
+      },
+      /* #12 : ws is a null wc string, no chars should be stored in s.  */
+      { /*input.*/ { 1,1,	       { 0x0000 },			5, },
+	/*expect*/ { 0,1,0,	 ""			                   },
+      },
+      /* #13 : s is a null pointer, no chars should be stored in s.  */
+      { /*input.*/ { 0,1,	       { 0x0000 },			5  },
+	/*expect*/ { 0,1,0,	 ""					   },
+      },
+      { .is_last = 1 }
+    }
+  },
+#if 0
+  {
+    { Twcstombs, TST_LOC_eucJP },
+    {
+
+      /* #01 : Any chars including a null char should not be stored in s.  */
+      { /*input.*/ { 1,1,	       { 0x3042,0x3044,0xFF73,0x0000 }, 0  },
+	/*expect*/ { 0,1,0,	 ""					   },
+      },
+      /* #02 : Only one chars should be stored in s. No null termination.  */
+      { /*input.*/ { 1,1,	       { 0x3042,0x3044,0xFF73,0x0000 }, 2  },
+	/*expect*/ { 0,1,2,	     "\244\242"				   },
+      },
+      /* #03 : Only two chars should be stored in s. No null termination.  */
+      { /*input.*/ { 1,1,	       { 0x3042,0x3044,0xFF73,0x0000 }, 4  },
+	/*expect*/ { 0,1,4,	     "\244\242\244\244"			   },
+      },
+      /* #04 : Only three chars should be stored in s. No null
+	       termination.  */
+      { /*input.*/ { 1,1,	       { 0x3042,0x3044,0xFF73,0x0000 }, 6  },
+	/*expect*/ { 0,1,6,	     "\244\242\244\244\216\263"		   },
+      },
+      /* #05 : Only three chars should be stored in s with a null
+	       termination.  */
+      { /*input.*/ { 1,1,	       { 0x3042,0x3044,0xFF73,0x0000 }, 7  },
+	/*expect*/ { 0,1,6,	     "\244\242\244\244\216\263"		   },
+      },
+      /* #06 : Only three chars should be stored in s with a null
+	       termination.  */
+      { /*input.*/ { 1,1,	       { 0x3042,0x3044,0xFF73,0x0000 }, 8  },
+	/*expect*/ { 0,1,6,	     "\244\242\244\244\216\263"		   },
+      },
+      /* #07 : Invalid mb sequence. No chars should be stored in s.  */
+      { /*input.*/ { 1,1,	       { 0x0201,0x0221,0x0000,0x0000 }, 2  },
+	/*expect*/ { EILSEQ,1,-1,	 ""				   },
+      },
+      /* #08 : s is a null pointer, no chars should be stored in s.  */
+      { /*input.*/ { 0,1,	       { 0x3042,0x3044,0xFF73,0x0000 }, 0  },
+	/*expect*/ { 0,1,6,	 ""					   },
+      },
+      /* #09 : s is a null pointer, no chars should be stored in s.  */
+      { /*input.*/ { 0,1,	       { 0x3042,0x3044,0xFF73,0x0000 }, 1  },
+	/*expect*/ { 0,1,6,	 ""					   },
+      },
+      /* #10 : s is a null pointer, no chars should be stored in s.  */
+      { /*input.*/ { 0,1,	       { 0x3042,0x3044,0xFF73,0x0000 }, 8  },
+	/*expect*/ { 0,1,6,	 ""					   },
+      },
+      /* #11 : s is a null pointer. No chars should be stored in s.  */
+      { /*input.*/ { 0,1,	       { 0x0201,0x0221,0x0000,0x0000 }, 5  },
+	/*expect*/ { EILSEQ,1,(size_t)-1,	 ""			   },
+      },
+      /* #12 : ws is a null wc string, no chars should be stored in s.  */
+      { /*input.*/ { 1,1,	       { 0x0000 },			5  },
+	/*expect*/ { 0,1,0,	 ""					   },
+      },
+      /* #13 : s is a null pointer, no chars should be stored in s.  */
+      { /*input.*/ { 0,1,	       { 0x0000 },			5  },
+	/*expect*/ { 0,1,0,	 ""					   },
+      },
+      { .is_last = 1 }
+    }
+  },
+#else
+  {
+    { Twcstombs, TST_LOC_ja_UTF8 },
+    {
+
+      /* #01 : Any chars including a null char should not be stored in s.  */
+      { /*input.*/ { 1,1,	       { 0x3042,0x3044,0xFF73,0x0000 }, 0  },
+	/*expect*/ { 0,1,0,	 ""					   },
+      },
+      /* #02 : Only one chars should be stored in s. No null termination.  */
+      { /*input.*/ { 1,1,	       { 0x3042,0x3044,0xFF73,0x0000 }, 3  },
+	/*expect*/ { 0,1,3,	     "\343\201\202"			   },
+      },
+      /* #03 : Only two chars should be stored in s. No null termination.  */
+      { /*input.*/ { 1,1,	       { 0x3042,0x3044,0xFF73,0x0000 }, 6  },
+	/*expect*/ { 0,1,6,	     "\343\201\202\343\201\204"		   },
+      },
+      /* #04 : Only three chars should be stored in s. No null
+	       termination.  */
+      { /*input.*/ { 1,1,	       { 0x3042,0x3044,0xFF73,0x0000 }, 9  },
+	/*expect*/ { 0,1,9,	"\343\201\202\343\201\204\357\275\263"	   },
+      },
+      /* #05 : Only three chars should be stored in s with a null
+	       termination.  */
+      { /*input.*/ { 1,1,	       { 0x3042,0x3044,0xFF73,0x0000 }, 10 },
+	/*expect*/ { 0,1,9,	"\343\201\202\343\201\204\357\275\263"	   },
+      },
+      /* #06 : Only three chars should be stored in s with a null
+	       termination.  */
+      { /*input.*/ { 1,1,	       { 0x3042,0x3044,0xFF73,0x0000 }, 11 },
+	/*expect*/ { 0,1,9,	"\343\201\202\343\201\204\357\275\263"	   },
+      },
+      /* #07 : Invalid mb sequence. No chars should be stored in s.  */
+      { /*input.*/ { 1,1,	       { 0x0201,0x0221,0x0000,0x0000 }, 2  },
+	/*expect*/ { EILSEQ,1,-1,	 ""				   },
+      },
+      /* #08 : s is a null pointer, no chars should be stored in s.  */
+      { /*input.*/ { 0,1,	       { 0x3042,0x3044,0xFF73,0x0000 }, 0  },
+	/*expect*/ { 0,1,9,	 ""					   },
+      },
+      /* #09 : s is a null pointer, no chars should be stored in s.  */
+      { /*input.*/ { 0,1,	       { 0x3042,0x3044,0xFF73,0x0000 }, 1  },
+	/*expect*/ { 0,1,9,	 ""					   },
+      },
+      /* #10 : s is a null pointer, no chars should be stored in s.  */
+      { /*input.*/ { 0,1,	       { 0x3042,0x3044,0xFF73,0x0000 }, 8  },
+	/*expect*/ { 0,1,9,	 ""					   },
+      },
+      /* #11 : s is a null pointer. No chars should be stored in s.  */
+      { /*input.*/ { 0,1,	       { 0x0201,0x0221,0x0000,0x0000 }, 5  },
+	/*expect*/ { EILSEQ,1,(size_t)-1,	 ""			   },
+      },
+      /* #12 : ws is a null wc string, no chars should be stored in s.  */
+      { /*input.*/ { 1,1,	       { 0x0000 },			5  },
+	/*expect*/ { 0,1,0,	 ""					   },
+      },
+      /* #13 : s is a null pointer, no chars should be stored in s.  */
+      { /*input.*/ { 0,1,	       { 0x0000 },			5  },
+	/*expect*/ { 0,1,0,	 ""					   },
+      },
+      { .is_last = 1 }
+    }
+  },
+#endif
+  {
+    { Twcstombs, TST_LOC_end }
+  }
+};
diff --git a/ap/build/uClibc/test/locale-mbwc/dat_wcswidth.c b/ap/build/uClibc/test/locale-mbwc/dat_wcswidth.c
new file mode 100644
index 0000000..6d2f98e
--- /dev/null
+++ b/ap/build/uClibc/test/locale-mbwc/dat_wcswidth.c
@@ -0,0 +1,263 @@
+/*
+ *  TEST SUITE FOR MB/WC FUNCTIONS IN C LIBRARY
+ *
+ *	 FILE:	dat_wcswidth.c
+ *
+ *	 WCSWIDTH:  int	 wcswidth (const wchar_t *ws, size_t n);
+ */
+
+TST_WCSWIDTH tst_wcswidth_loc [] = {
+  {
+    { Twcswidth, TST_LOC_de },
+    {
+      { /*input.*/ { { 0x00C1,0x00C2,0x00C3,0x0000 },	 0 },  /* 01 */
+	/*expect*/ { 0,1,0				   },
+      },
+      { /*input.*/ { { 0x00C1,0x00C2,0x00C3,0x0000 },	 1 },  /* 02 */
+	/*expect*/ { 0,1,1				   },
+      },
+      { /*input.*/ { { 0x00C1,0x00C2,0x00C3,0x0000 },	 2 },  /* 03 */
+	/*expect*/ { 0,1,2				   },
+      },
+      { /*input.*/ { { 0x00C1,0x00C2,0x00C3,0x0000 },	 3 },  /* 04 */
+	/*expect*/ { 0,1,3				   },
+      },
+      { /*input.*/ { { 0x00C1,0x00C2,0x00C3,0x0000 },	 4 },  /* 05 */
+	/*expect*/ { 0,1,3				   },
+      },
+      { /*input.*/ { { 0x0000 },			 1 },  /* 06 */
+	/*expect*/ { 0,1,0				   },
+      },
+      { /*input.*/ { { 0x00C1,0x0001,0x0000 },		 2 },  /* 07 */
+	/*expect*/ { 0,1,-1				   },
+      },
+      { /*input.*/ { { 0x00C1,0x0001,0x0000 },		 1 },  /* 08 */
+	/*expect*/ { 0,1,1				   },
+      },
+      { /*input.*/ { { 0x00C1,0x0001,0x0000 },		 2 },  /* 09 */
+	/*expect*/ { 0,1,-1				   },
+      },
+      { /*input.*/ { { 0x00C1,0x0092,0x0000 },		 2 },  /* 10 */
+	/*expect*/ { 0,1,-1				   },
+      },
+      { /*input.*/ { { 0x00C1,0x0020,0x0000 },		 2 },  /* 11 */
+	/*expect*/ { 0,1,2				   },
+      },
+      { /*input.*/ { { 0x00C1,0x0021,0x0000 },		 2 },  /* 12 */
+	/*expect*/ { 0,1,2				   },
+      },
+      { /*input.*/ { { 0x00C1,0x007E,0x0000 },		 2 },  /* 13 */
+	/*expect*/ { 0,1,2				   },
+      },
+      { /*input.*/ { { 0x00C1,0x007F,0x0000 },		 2 },  /* 14 */
+	/*expect*/ { 0,1,-1				   },
+      },
+      { /*input.*/ { { 0x00C1,0x0080,0x0000 },		 2 },  /* 15 */
+	/*expect*/ { 0,1,-1				   },
+      },
+      { /*input.*/ { { 0x00C1,0x00A0,0x0000 },		 2 },  /* 16 */
+#ifdef SHOJI_IS_RIGHT
+	/*expect*/ { 0,1,-1				   },
+#else
+	/*expect*/ { 0,1,2				   },
+#endif
+      },
+      { /*input.*/ { { 0x00C1,0x00A1,0x0000 },		 2 },  /* 17 */
+	/*expect*/ { 0,1,2				   },
+      },
+      { /*input.*/ { { 0x00C1,0x00FF,0x0000 },		 2 },  /* 18 */
+	/*expect*/ { 0,1,2				   },
+      },
+      { /*input.*/ { { 0x00C1,0x3042,0x0000 },		 2 },  /* 19 */
+	/*expect*/ { 0,1,-1				   },
+      },
+      { /*input.*/ { { 0x00C1,0x3044,0x0000 },		 2 },  /* 20 */
+	/*expect*/ { 0,1,-1				   },
+      },
+      { .is_last = 1 }
+    }
+  },
+  {
+    { Twcswidth, TST_LOC_enUS },
+    {
+      { /*input.*/ { { 0x0041,0x0042,0x00C3,0x0000 },	 0 },  /* 01 */
+	/*expect*/ { 0,1,0				   },
+      },
+      { /*input.*/ { { 0x0041,0x0042,0x00C3,0x0000 },	 1 },  /* 02 */
+	/*expect*/ { 0,1,1				   },
+      },
+      { /*input.*/ { { 0x0041,0x0042,0x00C3,0x0000 },	 2 },  /* 03 */
+	/*expect*/ { 0,1,2				   },
+      },
+#ifdef SHOJI_IS_RIGHT
+      { /*input.*/ { { 0x0041,0x0042,0x00C3,0x0000 },	 3 },  /* 04 */
+	/*expect*/ { 0,1,3				   },
+      },
+      { /*input.*/ { { 0x0041,0x0042,0x00C3,0x0000 },	 4 },  /* 05 */
+	/*expect*/ { 0,1,3				   },
+      },
+#else
+      { /*input.*/ { { 0x0041,0x0042,0x00C3,0x0000 },	 3 },  /* 04 */
+	/*expect*/ { 0,1,-1				   },
+      },
+      { /*input.*/ { { 0x0041,0x0042,0x0043,0x0000 },	 4 },  /* 05 */
+	/*expect*/ { 0,1,3				   },
+      },
+#endif
+      { /*input.*/ { { 0x0000 },			 1 },  /* 06 */
+	/*expect*/ { 0,1,0				   },
+      },
+      { /*input.*/ { { 0x0041,0x0001,0x0000 },		 2 },  /* 07 */
+	/*expect*/ { 0,1,-1				   },
+      },
+      { /*input.*/ { { 0x0041,0x0001,0x0000 },		 1 },  /* 08 */
+	/*expect*/ { 0,1,1				   },
+      },
+      { /*input.*/ { { 0x0041,0x0001,0x0000 },		 2 },  /* 09 */
+	/*expect*/ { 0,1,-1				   },
+      },
+      { /*input.*/ { { 0x0041,0x0092,0x0000 },		 2 },  /* 10 */
+	/*expect*/ { 0,1,-1				   },
+      },
+      { /*input.*/ { { 0x0041,0x0020,0x0000 },		 2 },  /* 11 */
+	/*expect*/ { 0,1,2				   },
+      },
+      { /*input.*/ { { 0x0041,0x0021,0x0000 },		 2 },  /* 12 */
+	/*expect*/ { 0,1,2				   },
+      },
+      { /*input.*/ { { 0x0041,0x007E,0x0000 },		 2 },  /* 13 */
+	/*expect*/ { 0,1,2				   },
+      },
+      { /*input.*/ { { 0x0041,0x007F,0x0000 },		 2 },  /* 14 */
+	/*expect*/ { 0,1,-1				   },
+      },
+      { /*input.*/ { { 0x0041,0x0080,0x0000 },		 2 },  /* 15 */
+	/*expect*/ { 0,1,-1				   },
+      },
+      { /*input.*/ { { 0x0041,0x00A0,0x0000 },		 2 },  /* 16 */
+	/*expect*/ { 0,1,-1				   },
+      },
+#ifdef SHOJI_IS_RIGHT
+      { /*input.*/ { { 0x0041,0x00A1,0x0000 },		 2 },  /* 17 */
+	/*expect*/ { 0,1,2				   },
+      },
+      { /*input.*/ { { 0x0041,0x00FF,0x0000 },		 2 },  /* 18 */
+	/*expect*/ { 0,1,2				   },
+      },
+#else
+      { /*input.*/ { { 0x0041,0x007E,0x0000 },		 2 },  /* 17 */
+	/*expect*/ { 0,1,2				   },
+      },
+      { /*input.*/ { { 0x0041,0x0020,0x0000 },		 2 },  /* 18 */
+	/*expect*/ { 0,1,2				   },
+      },
+#endif
+      { /*input.*/ { { 0x0041,0x3042,0x0000 },		 2 },  /* 19 */
+	/*expect*/ { 0,1,-1				   },
+      },
+      { /*input.*/ { { 0x0041,0x3044,0x0000 },		 2 },  /* 20 */
+	/*expect*/ { 0,1,-1				   },
+      },
+      { .is_last = 1 }
+    }
+  },
+  {
+#if 0
+    { Twcswidth, TST_LOC_eucJP },
+#else
+    { Twcswidth, TST_LOC_ja_UTF8 },
+#endif
+    {
+      { /*input.*/ { { 0x3041,0x3042,0x3043,0x0000 },	 0 },  /* 01 */
+	/*expect*/ { 0,1,0				   },
+      },
+      { /*input.*/ { { 0x3041,0x3042,0x3043,0x0000 },	 1 },  /* 02 */
+	/*expect*/ { 0,1,2				   },
+      },
+      { /*input.*/ { { 0x3041,0x3042,0x3043,0x0000 },	 2 },  /* 03 */
+	/*expect*/ { 0,1,4				   },
+      },
+      { /*input.*/ { { 0x3041,0x3042,0x3043,0x0000 },	 3 },  /* 04 */
+	/*expect*/ { 0,1,6				   },
+      },
+      { /*input.*/ { { 0x3041,0x3042,0x3043,0x0000 },	 4 },  /* 05 */
+	/*expect*/ { 0,1,6				   },
+      },
+      { /*input.*/ { { 0x0000 },			 1 },  /* 06 */
+	/*expect*/ { 0,1,0				   },
+      },
+      { /*input.*/ { { 0x008E,0x0001,0x0000 },		 2 },  /* 07 */
+	/*expect*/ { 0,1,-1				   },
+      },
+      { /*input.*/ { { 0x3041,0x008E,0x0000 },		 1 },  /* 08 */
+	/*expect*/ { 0,1,2				   },
+      },
+      { /*input.*/ { { 0x3041,0x008E,0x0000 },		 2 },  /* 09 */
+	/*expect*/ { 0,1,-1				   },
+      },
+      { /*input.*/ { { 0x3041,0x0001,0x0000 },		 2 },  /* 10 */
+	/*expect*/ { 0,1,-1				   },
+      },
+      { /*input.*/ { { 0x3041,0x3000,0x0000 },		 2 },  /* 11 */
+	/*expect*/ { 0,1,4				   },
+      },
+      { /*input.*/ { { 0x0041,0x0021,0x0000 },		 2 },  /* 12 */
+	/*expect*/ { 0,1,2				   },
+      },
+      { /*input.*/ { { 0x0041,0x007E,0x0000 },		 2 },  /* 13 */
+	/*expect*/ { 0,1,2				   },
+      },
+      { /*input.*/ { { 0x0041,0x007F,0x0000 },		 2 },  /* 14 */
+	/*expect*/ { 0,1,-1				   },
+      },
+      { /*input.*/ { { 0x0041,0x0080,0x0000 },		 2 },  /* 15 */
+	/*expect*/ { 0,1,-1				   },
+      },
+#if 0
+      { /*input.*/ { { 0x0041,0x00A0,0x0000 },		 2 },  /* 16 */
+	/*expect*/ { 0,1,-1				   },
+      },
+#ifdef NO_WAIVER
+      /* <NO_WAIVER> */	 /* returns 3 */
+      { /*input.*/ { { 0x0041,0x00A1,0x0000 },		 2 },  /* 17 */
+	/*expect*/ { 0,1,-1				   },
+      },
+#else
+      /* XXX U00A1 is valid -> /x8f/xa2/xc4 in JIS X 0212 */
+      { /*input.*/ { { 0x0041,0x00A1,0x0000 },		 2 },  /* 17 */
+	/*expect*/ { 0,1,3				   },
+      },
+#endif
+#else
+      /* XXX U00A0 i UTF8 is valid -> /xc2/xa0 */
+      { /*input.*/ { { 0x0041,0x00A0,0x0000 },		 2 },  /* 16 */
+	/*expect*/ { 0,1,2				   },
+      },
+#ifdef NO_WAIVER
+      /* <NO_WAIVER> */	 /* returns 3 */
+      { /*input.*/ { { 0x0041,0x00A1,0x0000 },		 2 },  /* 17 */
+	/*expect*/ { 0,1,-1				   },
+      },
+#else
+      /* XXX U00A1 in UTF-8 is valid -> /xc2/xa1 */
+      { /*input.*/ { { 0x0041,0x00A1,0x0000 },		 2 },  /* 17 */
+	/*expect*/ { 0,1,2				   },
+      },
+#endif
+#endif
+      { /*input.*/ { { 0x0041,0xFF71,0x0000 },		 2 },  /* 18 */
+	/*expect*/ { 0,1,2				   },
+      },
+      { /*input.*/ { { 0x0041,0x3042,0x0000 },		 2 },  /* 19 */
+	/*expect*/ { 0,1,3				   },
+      },
+      { /*input.*/ { { 0x0041,0x3044,0x0000 },		 2 },  /* 20 */
+	/*expect*/ { 0,1,3				   },
+      },
+      { .is_last = 1 }
+    }
+  },
+  {
+    { Twcswidth, TST_LOC_end }
+  }
+};
diff --git a/ap/build/uClibc/test/locale-mbwc/dat_wcsxfrm.c b/ap/build/uClibc/test/locale-mbwc/dat_wcsxfrm.c
new file mode 100644
index 0000000..acb6727
--- /dev/null
+++ b/ap/build/uClibc/test/locale-mbwc/dat_wcsxfrm.c
@@ -0,0 +1,102 @@
+/*
+ *  TEST SUITE FOR MB/WC FUNCTIONS IN CLIBRARY
+ *
+ *	 FILE:	dat_wcsxfrm.c
+ *
+ *	 WCSXFRM:  size_t  wcsxfrm (char *s1, const char s2, size_t n);
+ */
+
+/*
+ *  NOTE:
+ *
+ *  Return value and errno value are checked only for 2nd string:
+ *  org2[]; n1 and n2 don't mean bytes to be translated.
+ *  It means a buffer size including a null character.
+ *  Results of this test depens on results of wcscoll().
+ *  If you got errors, check both test results.
+ */
+
+
+TST_WCSXFRM tst_wcsxfrm_loc [] = {
+
+  {
+    { Twcsxfrm, TST_LOC_de },
+    {
+      { /*inp*/ { { 0x00C1,0x0000 }, { 0x00C1,0x0000 }, 7, 7 },	 /* #01 */
+	/*exp*/ {   0,	       0,0,		     },
+      },
+      { /*inp*/ { { 0x0042,0x0000 }, { 0x0061,0x0000 }, 7, 7 },	 /* #02 */
+	/*exp*/ {   0,	       0,0,		     },
+      },
+      { /*inp*/ { { 0x0061,0x0000 }, { 0x0042,0x0000 }, 7, 7 },	 /* #03 */
+	/*exp*/ {   0,	       0,0,		     },
+      },
+      { /*inp*/ { { 0x00E4,0x0000 }, { 0x00DC,0x0000 }, 7, 7 },	 /* #04 */
+	/*exp*/ {   0,	       0,0,		     },
+      },
+      { /*inp*/ { { 0x00DC,0x0000 }, { 0x00E4,0x0000 }, 7, 7 },	 /* #05 */
+	/*exp*/ {   0,	       0,0,		     },
+      },
+      { .is_last = 1 }
+    }
+  },
+  {
+    { Twcsxfrm, TST_LOC_enUS },
+    {
+      { /*inp*/ { { 0x0041,0x0000 }, { 0x0041,0x0000 }, 7, 7 },	 /* #01 */
+	/*exp*/ {   0,	       0,0,		     },
+      },
+      { /*inp*/ { { 0x0042,0x0000 }, { 0x0061,0x0000 }, 7, 7 },	 /* #02 */
+	/*exp*/ {   0,	       0,0,		     },
+      },
+      { /*inp*/ { { 0x0061,0x0000 }, { 0x0042,0x0000 }, 7, 7 },	 /* #03 */
+	/*exp*/ {   0,	       0,0,		     },
+      },
+      { /*inp*/ { { 0x0000,0x0000 }, { 0x0000,0x0000 }, 7, 7 },	 /* #04 */
+	/*exp*/ {   0,	       0,0,		     },
+      },
+#ifdef NO_WAIVER
+      { /* <WAIVER> x 2 */
+	/*inp*/ { { 0x3061,0x0000 }, { 0xFF42,0x0000 }, 7, 7 },	 /* #05 */
+	/* <WAIVER>	*/
+	/*exp*/ {   EINVAL,	       1,(size_t)-1,	     },
+      },
+#endif
+      { .is_last = 1 }
+    }
+  },
+  {
+#if 0
+    { Twcsxfrm, TST_LOC_eucJP },	     /* need more test data ! */
+#else
+    { Twcsxfrm, TST_LOC_ja_UTF8 },	     /* need more test data ! */
+#endif
+    {
+      { /*inp*/ { { 0x3041,0x0000 }, { 0x3041,0x0000 }, 7, 7 },	 /* #01 */
+	/*exp*/ {   0,	       0,0,		     },
+      },
+      { /*inp*/ { { 0x0042,0x0000 }, { 0x0061,0x0000 }, 7, 7 },	 /* #02 */
+	/*exp*/ {   0,	       0,0,		     },
+      },
+      { /*inp*/ { { 0x0061,0x0000 }, { 0x0042,0x0000 }, 7, 7 },	 /* #03 */
+	/*exp*/ {   0,	       0,0,		     },
+      },
+      { /*inp*/ { { 0x30A2,0x0000 }, { 0xFF71,0x0000 }, 7, 7 },	 /* #04 */
+	/*exp*/ {   0,	       0,0,		     },
+      },
+      { /*inp*/ { { 0xFF71,0x0000 }, { 0x30A2,0x0000 }, 7, 7 },	 /* #05 */
+	/*exp*/ {   0,	       0,0,		     },
+      },
+#ifdef NO_WAIVER
+      /* <WAIVER> x 2 */
+      { /*inp*/ { { 0x008E,0x0000 }, { 0x008F,0x0000 }, 7, 7 },	 /* #06 */
+	/*exp*/ {   EINVAL,	       1,(size_t)-1,	     },
+      },
+#endif
+      { .is_last = 1 }
+    }
+  },
+  {
+    { Twcsxfrm, TST_LOC_end }
+  }
+};
diff --git a/ap/build/uClibc/test/locale-mbwc/dat_wctob.c b/ap/build/uClibc/test/locale-mbwc/dat_wctob.c
new file mode 100644
index 0000000..dfd344e
--- /dev/null
+++ b/ap/build/uClibc/test/locale-mbwc/dat_wctob.c
@@ -0,0 +1,61 @@
+/*
+ *  TEST SUITE FOR MB/WC FUNCTIONS IN C LIBRARY
+ *
+ *	 FILE:	dat_wctob.c
+ *
+ *	 ISW*:	int wctob( wint_t wc );
+ */
+
+
+TST_WCTOB tst_wctob_loc [] = {
+
+    {	{ Twctob, TST_LOC_de },
+	{
+	  {  { WEOF   }, { 0,	 1, EOF	       }  },
+	  {  { 0x0020 }, { 0,	 1, 0x20       }  },
+	  {  { 0x0061 }, { 0,	 1, 0x61       }  },
+	  {  { 0x0080 }, { 0,	 1, 0x80       }  },
+	  {  { 0x00C4 }, { 0,	 1, 0xC4       }  },
+	  {  { 0x30C4 }, { 0,	 1, EOF	       }  },
+	  {  .is_last = 1 } /* Last element.  */
+	}
+    },
+    {	{ Twctob, TST_LOC_enUS },
+	{
+	  {  { WEOF   }, { 0,	 1, EOF	       }  },
+	  {  { 0x0020 }, { 0,	 1, 0x20       }  },
+	  {  { 0x0061 }, { 0,	 1, 0x61       }  },
+#ifdef SHOJI_IS_RIGHT
+	  {  { 0x0080 }, { 0,	 1, 0x80       }  },
+	  {  { 0x00C4 }, { 0,	 1, 0xC4       }  },
+#else
+	  /* XXX These are no valid characters.  */
+	  {  { 0x0080 }, { 0,	 1, EOF        }  },
+	  {  { 0x00C4 }, { 0,	 1, EOF        }  },
+#endif
+	  {  { 0x30C4 }, { 0,	 1, EOF	       }  },
+	  {  .is_last = 1 } /* Last element.  */
+	}
+    },
+#if 0
+    {	{ Twctob, TST_LOC_eucJP },
+#else
+    {	{ Twctob, TST_LOC_ja_UTF8 },
+#endif
+	{
+	  {  { WEOF   }, { 0,	 1, EOF	       }  },
+	  {  { 0x0020 }, { 0,	 1, 0x20       }  },
+	  {  { 0x0061 }, { 0,	 1, 0x61       }  },
+#if 0
+	  {  { 0x0080 }, { 0,	 1, 0x80       }  },
+#else
+	  {  { 0x0080 }, { 0,	 1, EOF       }  },
+#endif
+	  {  { 0x00FF }, { 0,	 1, EOF        }  },
+	  {  { 0x00C4 }, { 0,	 1, EOF	       }  },
+	  {  { 0x30C4 }, { 0,	 1, EOF	       }  },
+	  {  .is_last = 1 } /* Last element.  */
+	}
+    },
+    {	{ Twctob, TST_LOC_end } }
+};
diff --git a/ap/build/uClibc/test/locale-mbwc/dat_wctomb.c b/ap/build/uClibc/test/locale-mbwc/dat_wctomb.c
new file mode 100644
index 0000000..0ec3a9c
--- /dev/null
+++ b/ap/build/uClibc/test/locale-mbwc/dat_wctomb.c
@@ -0,0 +1,168 @@
+/*
+ *  TEST SUITE FOR MB/WC FUNCTIONS IN C LIBRARY
+ *
+ *	 FILE:	dat_wctomb.c
+ *
+ *	 WCTOMB:  int wctomb (char *s, wchar_t wc)
+ */
+
+
+/*
+ *  FUNCTION:
+ *
+ *	  int  wctomb (char *s, wchar_t wc);
+ *
+ *	       return: the number of bytes
+ *
+ *  NOTE:
+ *
+ *	 o When you feed a null pointer for a string (s) to the function,
+ *	   set s_flg=0 instead of putting just a 'NULL' there.
+ *	   Even if you put a 'NULL', it means a null string as well as "".
+ *
+ *	 o When s is a null pointer, the function checks state dependency.
+ *
+ *	       state-dependent encoding	     - return  NON-zero
+ *	       state-independent encoding    - return  0
+ *
+ *	   If state-dependent encoding is expected, set
+ *
+ *	       s_flg = 0,  ret_flg = 0,	 ret_val = +1
+ *
+ *	   If state-independent encoding is expected, set
+ *
+ *	       s_flg = 0,  ret_flg = 0,	 ret_val = 0
+ *
+ *
+ *	   When you set ret_flg=1, the test program simply compares an
+ *	   actual return value with an expected value. You can check
+ *	   state-independent case (return value is 0) in that way, but
+ *	   you can not check state-dependent case. So when you check
+ *	   state- dependency in this test function: tst_wctomb(), set
+ *	   ret_flg=0 always. It's a special case, and the test
+ *	   function takes care of it.
+ *
+ *	      Input	  Expect
+ *
+ *		s_flg=0		  ret_flg=0
+ *		|		  |
+ *	      { 0, 0 },	  { 0, 0, 0,  x,  "" }
+ *		   |		      |
+ *		   not used	      ret_val: 0/+1
+ * (expected val)
+ */
+
+
+TST_WCTOMB tst_wctomb_loc [] = {
+  {
+    { Twctomb, TST_LOC_de },
+    {
+      /* #01 : normal case		   */
+      { /*input.*/ { 1,	   0x00C4  },
+	/*expect*/ { 0,1,1,  "Ä"	   },
+      },
+      /* #02 : normal case		   */
+      { /*input.*/ { 1,	   0x00DC  },
+	/*expect*/ { 0,1,1,  "Ü"	   },
+      },
+      /* #03 : normal case		   */
+      { /*input.*/ { 1,	   0x0092  },
+	/*expect*/ { 0,1,1,  "\222"  },
+      },
+      /* #04 : error case		   */
+      { /*input.*/ { 1,	   0x3041  },
+	/*expect*/ { 0,1,-1, ""	   },
+      },
+      /* #05 : state dependency	   */
+      { /*input.*/ { 0,	   0x0000  },
+	/*expect*/ { 0,0,0,  ""	   },
+      },
+      { .is_last = 1 }
+    }
+  },
+  {
+    { Twctomb, TST_LOC_enUS },
+    {
+      /* #01 : normal case		   */
+      { /*input.*/ { 1,	   0x0041  },
+	/*expect*/ { 0,1,1,  "A"	   },
+      },
+      /* #02 : normal case		   */
+      { /*input.*/ { 1,	   0x0042  },
+	/*expect*/ { 0,1,1,  "B"	   },
+      },
+      /* #03 : error case		   */
+      /* <WAIVER> */
+      { /*input.*/ { 1,	   0x00C4  },
+	/*expect*/ { 0,1,-1, ""	   },
+      },
+      /* #04 : error case		   */
+      { /*input.*/ { 1,	   0x30A4  },
+	/*expect*/ { 0,1,-1, ""	   },
+      },
+      /* #05 : state dependency	   */
+      { /*input.*/ { 0,	   0x0000  },
+	/*expect*/ { 0,0,0,  ""	   },
+      },
+      { .is_last = 1 }
+    }
+  },
+#if 0
+  {
+    { Twctomb, TST_LOC_eucJP },
+    {
+      /* #01 : normal case		   */
+      { /*input.*/ { 1,	   0x3042  },
+	/*expect*/ { 0,1,2,  "\244\242"   },
+      },
+      /* #02 : normal case		   */
+      { /*input.*/ { 1,	   0x3044  },
+	/*expect*/ { 0,1,2,  "\244\244"   },
+      },
+      /* #03 : normal case		   */
+      { /*input.*/ { 1,	   0x008E  },
+	/*expect*/ { 0,1,-1, ""	   },
+      },
+      /* #04 : jisX0212		   */
+      { /*input.*/ { 1,	   0x00C4	  },
+	/*expect*/ { 0,1,3,  "\217\252\243" }, /* jisx0210  returns 3 */
+      },
+      /* #05 : state dependency	   */
+      { /*input.*/ { 0,	   0x008E  },
+	/*expect*/ { 0,0,0,  ""	   },
+      },
+      { .is_last = 1 }
+    }
+  },
+#else
+  {
+    { Twctomb, TST_LOC_ja_UTF8 },
+    {
+      /* #01 : normal case		   */
+      { /*input.*/ { 1,	   0x3042  },
+	/*expect*/ { 0,1,3,  "\343\201\202"   },
+      },
+      /* #02 : normal case		   */
+      { /*input.*/ { 1,	   0x3044  },
+	/*expect*/ { 0,1,3,  "\343\201\204"   },
+      },
+      /* #03 : normal case		   */
+      { /*input.*/ { 1,	   0x008E  },
+	/*expect*/ { 0,1,2, "\302\216"	   },
+      },
+      /* #04 : jisX0212		   */
+      { /*input.*/ { 1,	   0x00C4	  },
+	/*expect*/ { 0,1,2,  "\303\204" }, /* jisx0210  returns 3 */
+      },
+      /* #05 : state dependency	   */
+      { /*input.*/ { 0,	   0x008E  },
+	/*expect*/ { 0,0,0,  ""	   },
+      },
+      { .is_last = 1 }
+    }
+  },
+#endif
+  {
+    { Twctomb, TST_LOC_end }
+  }
+};
diff --git a/ap/build/uClibc/test/locale-mbwc/dat_wctrans.c b/ap/build/uClibc/test/locale-mbwc/dat_wctrans.c
new file mode 100644
index 0000000..df4d3ad
--- /dev/null
+++ b/ap/build/uClibc/test/locale-mbwc/dat_wctrans.c
@@ -0,0 +1,99 @@
+/*
+ *  TEST SUITE FOR MB/WC FUNCTIONS IN CLIBRARY
+ *
+ *       FILE:  dat_wctrans.c
+ *
+ *       WCTRANS:  wctrans_t  wctrans( const char *charclass );
+ */
+
+/*
+ *  NOTE:
+ *        When a return value is expected to be 0 (false),
+ *        set ret_flg=1 and set ret_val=0.
+ *        Otherwise just set ret_flg=0.
+ */
+
+
+TST_WCTRANS tst_wctrans_loc [] = {
+
+    {   { Twctrans, TST_LOC_de },
+        {
+          { /*inp*/ { ""               },  /* #1 */
+            /*exp*/ { 0,1,0,         },
+          },
+          { /*inp*/ { "upper"          },  /* #2 */
+            /*exp*/ { 0,1,0,         },
+          },
+          { /*inp*/ { "lower"          },  /* #3 */
+            /*exp*/ { 0,1,0,         },
+          },
+          { /*inp*/ { "toupper"        },  /* #4 */
+            /*exp*/ { 0,0,0,         },
+          },
+          { /*inp*/ { "tolower"        },  /* #5 */
+            /*exp*/ { 0,0,0,         },
+          },
+          { /*inp*/ { "xxxxx"          },  /* #6 */
+            /*exp*/ { 0,1,0,         },
+          },
+	  { .is_last = 1 }
+        }
+    },
+    {   { Twctrans, TST_LOC_enUS },
+        {
+          { /*inp*/ { ""               },  /* #1 */
+            /*exp*/ { 0,1,0,         },
+          },
+          { /*inp*/ { "upper"          },  /* #2 */
+            /*exp*/ { 0,1,0,         },
+          },
+          { /*inp*/ { "lower"          },  /* #3 */
+            /*exp*/ { 0,1,0,         },
+          },
+          { /*inp*/ { "toupper"        },  /* #4 */
+            /*exp*/ { 0,0,0,         },
+          },
+          { /*inp*/ { "tolower"        },  /* #5 */
+            /*exp*/ { 0,0,0,         },
+          },
+          { /*inp*/ { "xxxxx"          },  /* #6 */
+            /*exp*/ { 0,1,0,         },
+          },
+	  { .is_last = 1 }
+        }
+    },
+#if 0
+    {   { Twctrans, TST_LOC_eucJP },
+#else
+    {   { Twctrans, TST_LOC_ja_UTF8 },
+#endif
+        {
+          { /*inp*/ { ""               },  /* #1 */
+            /*exp*/ { 0,1,0,         },
+          },
+          { /*inp*/ { "upper"          },  /* #2 */
+            /*exp*/ { 0,1,0,         },
+          },
+          { /*inp*/ { "lower"          },  /* #3 */
+            /*exp*/ { 0,1,0,         },
+          },
+          { /*inp*/ { "toupper"        },  /* #4 */
+            /*exp*/ { 0,0,0,         },
+          },
+          { /*inp*/ { "tolower"        },  /* #5 */
+            /*exp*/ { 0,0,0,         },
+          },
+          { /*inp*/ { "xxxxx"          },  /* #6 */
+            /*exp*/ { 0,1,0,         },
+          },
+          { /*inp*/ { "tojhira"        },  /* #7 */
+            /*exp*/ { 0,0,0,         },
+          },
+          { /*inp*/ { "tojkata"        },  /* #8 */
+            /*exp*/ { 0,0,0,         },
+          },
+	  { .is_last = 1 }
+        }
+    },
+    {   { Twctrans, TST_LOC_end }}
+};
diff --git a/ap/build/uClibc/test/locale-mbwc/dat_wctype.c b/ap/build/uClibc/test/locale-mbwc/dat_wctype.c
new file mode 100644
index 0000000..db3bf33
--- /dev/null
+++ b/ap/build/uClibc/test/locale-mbwc/dat_wctype.c
@@ -0,0 +1,189 @@
+/*
+ *  TEST SUITE FOR MB/WC FUNCTIONS IN CLIBRARY
+ *
+ *	 FILE:	dat_wctype.c
+ *
+ *	 WCTYPE:  wctype_t  wctype( const char *class );
+ */
+
+/*
+ *  NOTE:
+ *	  When a return value is expected to be 0 (false),
+ *	  set ret_flg=1 and set ret_val=0.
+ *	  Otherwise just set ret_flg=0.
+ */
+
+
+TST_WCTYPE tst_wctype_loc [] = {
+
+    {	{ Twctype, TST_LOC_de },
+	{
+	  { /*inp*/ { "alnum"	       },  /* #01 */
+	    /*exp*/ { 0,0,0,	       },
+	  },
+	  { /*inp*/ { "alpha"	       },  /* #02 */
+	    /*exp*/ { 0,0,0,	       },
+	  },
+	  { /*inp*/ { "cntrl"	       },  /* #03 */
+	    /*exp*/ { 0,0,0,	       },
+	  },
+	  { /*inp*/ { "digit"	       },  /* #04 */
+	    /*exp*/ { 0,0,0,	       },
+	  },
+	  { /*inp*/ { "graph"	       },  /* #05 */
+	    /*exp*/ { 0,0,0,	       },
+	  },
+	  { /*inp*/ { "lower"	       },  /* #06 */
+	    /*exp*/ { 0,0,0,	       },
+	  },
+	  { /*inp*/ { "print"	       },  /* #07 */
+	    /*exp*/ { 0,0,0,	       },
+	  },
+	  { /*inp*/ { "punct"	       },  /* #08 */
+	    /*exp*/ { 0,0,0,	       },
+	  },
+	  { /*inp*/ { "space"	       },  /* #09 */
+	    /*exp*/ { 0,0,0,	       },
+	  },
+	  { /*inp*/ { "upper"	       },  /* #10 */
+	    /*exp*/ { 0,0,0,	       },
+	  },
+	  { /*inp*/ { "xdigit"	       },  /* #11 */
+	    /*exp*/ { 0,0,0,	       },
+	  },
+	  { /*inp*/ { ""	       },  /* #12 */
+	    /*exp*/ { 0,1,0,	       },
+	  },
+	  { /*inp*/ { "ideograph"      },  /* #13 */
+	    /*exp*/ { 0,1,0,	       },
+	  },
+	  { /*inp*/ { "english"	       },  /* #14 */
+	    /*exp*/ { 0,1,0,	       },
+	  },
+	  { /*inp*/ { "ascii"	       },  /* #15 */
+	    /*exp*/ { 0,1,0,	       },
+	  },
+	  { /*inp*/ { "special"	       },  /* #16 */
+	    /*exp*/ { 0,1,0,	       },
+	  },
+	  { .is_last = 1 }
+	}
+    },
+    {	{ Twctype, TST_LOC_enUS },
+	{
+	  { /*inp*/ { "alnum"	       },  /* #01 */
+	    /*exp*/ { 0,0,0,	       },
+	  },
+	  { /*inp*/ { "alpha"	       },  /* #02 */
+	    /*exp*/ { 0,0,0,	       },
+	  },
+	  { /*inp*/ { "cntrl"	       },  /* #03 */
+	    /*exp*/ { 0,0,0,	       },
+	  },
+	  { /*inp*/ { "digit"	       },  /* #04 */
+	    /*exp*/ { 0,0,0,	       },
+	  },
+	  { /*inp*/ { "graph"	       },  /* #05 */
+	    /*exp*/ { 0,0,0,	       },
+	  },
+	  { /*inp*/ { "lower"	       },  /* #06 */
+	    /*exp*/ { 0,0,0,	       },
+	  },
+	  { /*inp*/ { "print"	       },  /* #07 */
+	    /*exp*/ { 0,0,0,	       },
+	  },
+	  { /*inp*/ { "punct"	       },  /* #08 */
+	    /*exp*/ { 0,0,0,	       },
+	  },
+	  { /*inp*/ { "space"	       },  /* #09 */
+	    /*exp*/ { 0,0,0,	       },
+	  },
+	  { /*inp*/ { "upper"	       },  /* #10 */
+	    /*exp*/ { 0,0,0,	       },
+	  },
+	  { /*inp*/ { "xdigit"	       },  /* #11 */
+	    /*exp*/ { 0,0,0,	       },
+	  },
+	  { /*inp*/ { ""	       },  /* #12 */
+	    /*exp*/ { 0,1,0,	       },
+	  },
+	  { /*inp*/ { "ideograph"      },  /* #13 */
+	    /*exp*/ { 0,1,0,	       },
+	  },
+	  { /*inp*/ { "english"	       },  /* #14 */
+	    /*exp*/ { 0,1,0,	       },
+	  },
+	  { /*inp*/ { "ascii"	       },  /* #15 */
+	    /*exp*/ { 0,1,0,	       },
+	  },
+	  { /*inp*/ { "special"	       },  /* #16 */
+	    /*exp*/ { 0,1,0,	       },
+	  },
+	  { .is_last = 1 }
+	}
+    },
+#if 0
+    {	{ Twctype, TST_LOC_eucJP },
+#else
+    {	{ Twctype, TST_LOC_ja_UTF8 },
+#endif
+	{
+	  { /*inp*/ { "alnum"	       },  /* #01 */
+	    /*exp*/ { 0,0,0,	       },
+	  },
+	  { /*inp*/ { "alpha"	       },  /* #02 */
+	    /*exp*/ { 0,0,0,	       },
+	  },
+	  { /*inp*/ { "cntrl"	       },  /* #03 */
+	    /*exp*/ { 0,0,0,	       },
+	  },
+	  { /*inp*/ { "digit"	       },  /* #04 */
+	    /*exp*/ { 0,0,0,	       },
+	  },
+	  { /*inp*/ { "graph"	       },  /* #05 */
+	    /*exp*/ { 0,0,0,	       },
+	  },
+	  { /*inp*/ { "lower"	       },  /* #06 */
+	    /*exp*/ { 0,0,0,	       },
+	  },
+	  { /*inp*/ { "print"	       },  /* #07 */
+	    /*exp*/ { 0,0,0,	       },
+	  },
+	  { /*inp*/ { "punct"	       },  /* #08 */
+	    /*exp*/ { 0,0,0,	       },
+	  },
+	  { /*inp*/ { "space"	       },  /* #09 */
+	    /*exp*/ { 0,0,0,	       },
+	  },
+	  { /*inp*/ { "upper"	       },  /* #10 */
+	    /*exp*/ { 0,0,0,	       },
+	  },
+	  { /*inp*/ { "xdigit"	       },  /* #11 */
+	    /*exp*/ { 0,0,0,	       },
+	  },
+	  { /*inp*/ { "ideogram"       },  /* #12 */
+	    /*exp*/ { 0,1,0,	       },
+	  },
+	  { /*inp*/ { "phonogram"      },  /* #13 */
+	    /*exp*/ { 0,1,0,	       },
+	  },
+	  { /*inp*/ { "jspace"	       },  /* #14 */
+	    /*exp*/ { 0,0,0,	       },
+	  },
+	  { /*inp*/ { "jhira"	       },  /* #15 */
+	    /*exp*/ { 0,0,0,	       },
+	  },
+	  { /*inp*/ { "jkata"	       },  /* #16 */
+	    /*exp*/ { 0,0,0,	       },
+	  },
+	  { /*inp*/ { "jkanji"	       },  /* #17 */
+	    /*exp*/ { 0,0,0,	       },
+	  },
+	  { /*inp*/ { "jdigit"	       },  /* #18 */
+	    /*exp*/ { 0,0,0,	       },
+	  },
+	  { .is_last = 1 }
+	}
+    },
+    {	{ Twctype, TST_LOC_end }}
+};
diff --git a/ap/build/uClibc/test/locale-mbwc/dat_wcwidth.c b/ap/build/uClibc/test/locale-mbwc/dat_wcwidth.c
new file mode 100644
index 0000000..b6b7c29
--- /dev/null
+++ b/ap/build/uClibc/test/locale-mbwc/dat_wcwidth.c
@@ -0,0 +1,149 @@
+/*
+ *  TEST SUITE FOR MB/WC FUNCTIONS IN C LIBRARY
+ *
+ *	 FILE:	dat_wcwidth.c
+ *
+ *	 WCWIDTH:  int wcwidth (wchar_t wc);
+ */
+
+TST_WCWIDTH tst_wcwidth_loc [] = {
+    {
+      { Twcwidth, TST_LOC_de },
+      {
+	{ /*inp*/ { 0x0000		     },	 /* #01 */
+	  /*exp*/ { 0,	1,0,	     },
+	},
+	{ /*inp*/ { 0x0020		     },	 /* #02 */
+	  /*exp*/ { 0,	1,1,	     },
+	},
+	{ /*inp*/ { 0x007F		     },	 /* #03 */
+	  /*exp*/ { 0,	1,-1,	     },
+	},
+	{ /*inp*/ { 0x0080		     },	 /* #04 */
+	  /*exp*/ { 0,	1,-1,	     },
+	},
+	{ /*inp*/ { 0x00A1		     },	 /* #05 */
+	  /*exp*/ { 0,	1,1,	     },
+	},
+	{ /*inp*/ { 0x00C1		     },	 /* #06 */
+	  /*exp*/ { 0,	1,1,	     },
+	},
+#ifdef SHOJI_IS_RIGHT
+	/* <WAIVER> */	/* CHECK : wint_t */
+	{ /*inp*/ { 0x3041		     },	 /* #07 */
+	  /*exp*/ { 0,	1,0,	     },
+	},
+#else
+	{ /*inp*/ { 0x3041		     },	 /* #07 */
+	  /*exp*/ { 0,	1,EOF,	     },
+	},
+#endif
+	{ .is_last = 1 }
+      }
+    },
+    {
+      { Twcwidth, TST_LOC_enUS },
+      {
+	{ /*inp*/ { 0x0000		     },	 /* #01 */
+	  /*exp*/ { 0,	1,0,	     },
+	},
+	{ /*inp*/ { 0x0020		     },	 /* #02 */
+	  /*exp*/ { 0,	1,1,	     },
+	},
+	{ /*inp*/ { 0x007F		     },	 /* #03 */
+	  /*exp*/ { 0,	1,-1,	     },
+	},
+	{ /*inp*/ { 0x0080		     },	 /* #04 */
+	  /*exp*/ { 0,	1,-1,	     },
+	},
+	{ /*inp*/ { 0x00A1		     },	 /* #05 */
+	  /*exp*/ { 0,	1,-1,	     },
+	},
+	{ /*inp*/ { 0x00C1		     },	 /* #06 */
+	  /*exp*/ { 0,	1,-1,	     },
+	},
+	{ /*inp*/ { 0x3041		     },	 /* #07 */
+	  /*exp*/ { 0,	1,-1,	     },
+	},
+	{ .is_last = 1 }
+      }
+    },
+#if 0
+    {
+      { Twcwidth, TST_LOC_eucJP },
+      {
+	{ /*inp*/ { 0x0000		     },	 /* #01 */
+	  /*exp*/ { 0,	1,0,	     },
+	},
+	{ /*inp*/ { 0x0020		     },	 /* #02 */
+	  /*exp*/ { 0,	1,1,	     },
+	},
+	{ /*inp*/ { 0x007F		     },	 /* #03 */
+	  /*exp*/ { 0,	1,-1,	     },
+	},
+	{ /*inp*/ { 0x0080		     },	 /* #04 */
+	  /*exp*/ { 0,	1,-1,	     },
+	},
+#ifdef SHOJI_IS_RIGHT
+	/* <NO_WAIVER> */
+	{ /*inp*/ { 0x00A1		     },	 /* #05 */
+	  /*exp*/ { 0,	1,0,	     },
+	},
+#else
+	/* XXX U00A1 is a valid character in EUC-JP.  */
+	{ /*inp*/ { 0x00A1		     },	 /* #05 */
+	  /*exp*/ { 0,	1,2,	     },
+	},
+#endif
+	/* jisx0212 */
+	{ /*inp*/ { 0x00C1		     },	 /* #06 */
+	  /*exp*/ { 0,	1,2,	     },
+	},
+	{ /*inp*/ { 0x3041		     },	 /* #07 */
+	  /*exp*/ { 0,	1,2,	     },
+	},
+	{ .is_last = 1 }
+      }
+    },
+#else
+    {
+      { Twcwidth, TST_LOC_ja_UTF8 },
+      {
+	{ /*inp*/ { 0x0000		     },	 /* #01 */
+	  /*exp*/ { 0,	1,0,	     },
+	},
+	{ /*inp*/ { 0x0020		     },	 /* #02 */
+	  /*exp*/ { 0,	1,1,	     },
+	},
+	{ /*inp*/ { 0x007F		     },	 /* #03 */
+	  /*exp*/ { 0,	1,-1,	     },
+	},
+	{ /*inp*/ { 0x0080		     },	 /* #04 */
+	  /*exp*/ { 0,	1,-1,	     },
+	},
+#ifdef SHOJI_IS_RIGHT
+	/* <NO_WAIVER> */
+	{ /*inp*/ { 0x00A1		     },	 /* #05 */
+	  /*exp*/ { 0,	1,0,	     },
+	},
+#else
+	/* XXX U00A1 is a valid character in EUC-JP.UTF-8.  */
+	{ /*inp*/ { 0x00A1		     },	 /* #05 */
+	  /*exp*/ { 0,	1,1,	     },
+	},
+#endif
+	/* jisx0212 */
+	{ /*inp*/ { 0x00C1		     },	 /* #06 */
+	  /*exp*/ { 0,	1,1,	     },
+	},
+	{ /*inp*/ { 0x3041		     },	 /* #07 */
+	  /*exp*/ { 0,	1,2,	     },
+	},
+	{ .is_last = 1 }
+      }
+    },
+#endif
+    {
+      { Twcwidth, TST_LOC_end }
+    }
+};
diff --git a/ap/build/uClibc/test/locale-mbwc/tgn_funcdef.h b/ap/build/uClibc/test/locale-mbwc/tgn_funcdef.h
new file mode 100644
index 0000000..ec24792
--- /dev/null
+++ b/ap/build/uClibc/test/locale-mbwc/tgn_funcdef.h
@@ -0,0 +1,160 @@
+#ifndef TGN_FUNCDEF_H
+#define TGN_FUNCDEF_H
+
+/* Unique number for each test.  */
+#define	 Tiswalnum		1
+#define	 Tiswalpha		2
+#define	 Tiswcntrl		3
+#define	 Tiswctype		4
+#define	 Tiswdigit		5
+#define	 Tiswgraph		6
+#define	 Tiswlower		7
+#define	 Tiswprint		8
+#define	 Tiswpunct		9
+#define	 Tiswspace		10
+#define	 Tiswupper		11
+#define	 Tiswxdigit		12
+#define	 Tmblen			13
+#define	 Tmbrlen		14
+#define	 Tmbrtowc		15
+#define	 Tmbsrtowcs		16
+#define	 Tmbstowcs		17
+#define	 Tmbtowc		18
+#define	 Tstrcoll		19
+#define	 Tstrfmon		20
+#define	 Tstrxfrm		21
+#define	 Tswscanf		22
+#define	 Ttowctrans		23
+#define	 Ttowlower		24
+#define	 Ttowupper		25
+#define	 Twcrtomb		26
+#define	 Twcscat		27
+#define	 Twcschr		28
+#define	 Twcscmp		29
+#define	 Twcscoll		30
+#define	 Twcscpy		31
+#define	 Twcscspn		32
+#define	 Twcslen		33
+#define	 Twcsncat		34
+#define	 Twcsncmp		35
+#define	 Twcsncpy		36
+#define	 Twcspbrk		37
+#define	 Twcsrtombs		38
+#define	 Twcsspn		39
+#define	 Twcsstr		40
+#define	 Twcstod		41
+#define	 Twcstok		42
+#define	 Twcstombs		43
+#define	 Twcswidth		44
+#define	 Twcsxfrm		45
+#define	 Twctob			46
+#define	 Twctomb		47
+#define	 Twctrans		48
+#define	 Twctype		49
+#define	 Twcwidth		50
+
+/* Name of each test.  */
+#define	 S_ISWALNUM	"iswalnum"
+#define	 S_ISWALPHA	"iswalpha"
+#define	 S_ISWCNTRL	"iswcntrl"
+#define	 S_ISWCTYPE	"iswctype"
+#define	 S_ISWDIGIT	"iswdigit"
+#define	 S_ISWGRAPH	"iswgraph"
+#define	 S_ISWLOWER	"iswlower"
+#define	 S_ISWPRINT	"iswprint"
+#define	 S_ISWPUNCT	"iswpunct"
+#define	 S_ISWSPACE	"iswspace"
+#define	 S_ISWUPPER	"iswupper"
+#define	 S_ISWXDIGIT	"iswxdigit"
+#define	 S_MBLEN	"mblen"
+#define	 S_MBRLEN	"mbrlen"
+#define	 S_MBRTOWC	"mbrtowc"
+#define	 S_MBSRTOWCS	"mbsrtowcs"
+#define	 S_MBSTOWCS	"mbstowcs"
+#define	 S_MBTOWC	"mbtowc"
+#define	 S_STRCOLL	"strcoll"
+#define	 S_STRFMON	"strfmon"
+#define	 S_STRXFRM	"strxfrm"
+#define	 S_SWSCANF	"swscanf"
+#define	 S_TOWCTRANS	"towctrans"
+#define	 S_TOWLOWER	"towlower"
+#define	 S_TOWUPPER	"towupper"
+#define	 S_WCRTOMB	"wcrtomb"
+#define	 S_WCSCAT	"wcscat"
+#define	 S_WCSCHR	"wcschr"
+#define	 S_WCSCMP	"wcscmp"
+#define	 S_WCSCOLL	"wcscoll"
+#define	 S_WCSCPY	"wcscpy"
+#define	 S_WCSCSPN	"wcscspn"
+#define	 S_WCSLEN	"wcslen"
+#define	 S_WCSNCAT	"wcsncat"
+#define	 S_WCSNCMP	"wcsncmp"
+#define	 S_WCSNCPY	"wcsncpy"
+#define	 S_WCSPBRK	"wcspbrk"
+#define	 S_WCSRTOMBS	"wcsrtombs"
+#define	 S_WCSSPN	"wcsspn"
+#define	 S_WCSSTR	"wcsstr"
+#define	 S_WCSTOD	"wcstod"
+#define	 S_WCSTOK	"wcstok"
+#define	 S_WCSTOMBS	"wcstombs"
+#define	 S_WCSWIDTH	"wcswidth"
+#define	 S_WCSXFRM	"wcsxfrm"
+#define	 S_WCTOB	"wctob"
+#define	 S_WCTOMB	"wctomb"
+#define	 S_WCTRANS	"wctrans"
+#define	 S_WCTYPE	"wctype"
+#define	 S_WCWIDTH	"wcwidth"
+
+/* Prototypes for test functions.  */
+extern int tst_iswalnum (FILE *, int);
+extern int tst_iswalpha (FILE *, int);
+extern int tst_iswcntrl (FILE *, int);
+extern int tst_iswctype (FILE *, int);
+extern int tst_iswdigit (FILE *, int);
+extern int tst_iswgraph (FILE *, int);
+extern int tst_iswlower (FILE *, int);
+extern int tst_iswprint (FILE *, int);
+extern int tst_iswpunct (FILE *, int);
+extern int tst_iswspace (FILE *, int);
+extern int tst_iswupper (FILE *, int);
+extern int tst_iswxdigit (FILE *, int);
+extern int tst_mblen (FILE *, int);
+extern int tst_mbrlen (FILE *, int);
+extern int tst_mbrtowc (FILE *, int);
+extern int tst_mbsrtowcs (FILE *, int);
+extern int tst_mbstowcs (FILE *, int);
+extern int tst_mbtowc (FILE *, int);
+extern int tst_strcoll (FILE *, int);
+extern int tst_strfmon (FILE *, int);
+extern int tst_strxfrm (FILE *, int);
+extern int tst_swscanf (FILE *, int);
+extern int tst_towctrans (FILE *, int);
+extern int tst_towlower (FILE *, int);
+extern int tst_towupper (FILE *, int);
+extern int tst_wcrtomb (FILE *, int);
+extern int tst_wcscat (FILE *, int);
+extern int tst_wcschr (FILE *, int);
+extern int tst_wcscmp (FILE *, int);
+extern int tst_wcscoll (FILE *, int);
+extern int tst_wcscpy (FILE *, int);
+extern int tst_wcscspn (FILE *, int);
+extern int tst_wcslen (FILE *, int);
+extern int tst_wcsncat (FILE *, int);
+extern int tst_wcsncmp (FILE *, int);
+extern int tst_wcsncpy (FILE *, int);
+extern int tst_wcspbrk (FILE *, int);
+extern int tst_wcsrtombs (FILE *, int);
+extern int tst_wcsspn (FILE *, int);
+extern int tst_wcsstr (FILE *, int);
+extern int tst_wcstod (FILE *, int);
+extern int tst_wcstok (FILE *, int);
+extern int tst_wcstombs (FILE *, int);
+extern int tst_wcswidth (FILE *, int);
+extern int tst_wcsxfrm (FILE *, int);
+extern int tst_wctob (FILE *, int);
+extern int tst_wctomb (FILE *, int);
+extern int tst_wctrans (FILE *, int);
+extern int tst_wctype (FILE *, int);
+extern int tst_wcwidth (FILE *, int);
+
+#endif /* TGN_FUNCDEF_H */
diff --git a/ap/build/uClibc/test/locale-mbwc/tgn_locdef.h b/ap/build/uClibc/test/locale-mbwc/tgn_locdef.h
new file mode 100644
index 0000000..89146a7
--- /dev/null
+++ b/ap/build/uClibc/test/locale-mbwc/tgn_locdef.h
@@ -0,0 +1,32 @@
+#ifndef TGN_LOCDEF_H
+#define TGN_LOCDEF_H
+
+/* Defines for all locales used in the suite.  */
+
+/* POSIX C locale.  */
+#define TST_LOC_C	"C"
+
+/* German locale with ISO-8859-1.  */
+#define TST_LOC_de	"de_DE.ISO-8859-1"
+
+/* For US we use ANSI_X3.4-1968 (ASCII). Changed in en_US.ISO-8859-1  */
+#define TST_LOC_en	"en_US.ISO-8859-1"
+#define TST_LOC_enUS	TST_LOC_C
+
+/* NOTE: ja_JP.EUC-JP locale isn't supported into the uClibc!
+         UTF-8 is the only multibyte codeset supported. */
+/* Japanese locale with EUC-JP. */
+#if 0
+#define TST_LOC_eucJP	"ja_JP.EUC-JP"
+#endif
+
+/* Japanese locale with UTF-8. */
+#define TST_LOC_ja_UTF8	"ja_JP.UTF-8"
+
+/* German locale with UTF-8.  */
+#define TST_LOC_de_UTF8	"de_DE.UTF-8"
+
+/* End marker - must appear in each table as last entry.  */
+#define	TST_LOC_end	"lastEntry"
+
+#endif /* TGN_LOCDEF_H */
diff --git a/ap/build/uClibc/test/locale-mbwc/tsp_common.c b/ap/build/uClibc/test/locale-mbwc/tsp_common.c
new file mode 100644
index 0000000..cd88274
--- /dev/null
+++ b/ap/build/uClibc/test/locale-mbwc/tsp_common.c
@@ -0,0 +1,64 @@
+/*
+ *  TEST SUITE FOR MB/WC FUNCTIONS IN C LIBRARY
+ *  Main driver
+ */
+
+
+#define TST_FUNCTION_CALL(func) _TST_FUNCTION_CALL(func)
+#define _TST_FUNCTION_CALL(func) tst ##_## func
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <locale.h>
+#include <errno.h>
+#include <signal.h>
+
+#include "tst_types.h"
+#include "tgn_locdef.h"
+
+
+int
+main (int argc, char *argv[])
+{
+  int ret;
+  int debug;
+
+  debug = argc > 1 ? atoi (argv[1]) : 0;
+
+  if (debug)
+    {
+      fprintf (stdout, "\nTST_MBWC ===> %s ...\n", argv[0]);
+    }
+  ret = TST_FUNCTION_CALL (TST_FUNCTION) (stdout, debug);
+
+  return (ret != 0);
+}
+
+#define	 MAX_RESULT_REC	 132
+char result_rec[MAX_RESULT_REC];
+
+
+int
+result (FILE * fp, char res, const char *func, const char *loc, int rec_no,
+	int seq_no, int case_no, const char *msg)
+{
+  if (fp == NULL
+      || strlen (func) + strlen (loc) + strlen (msg) + 32 > MAX_RESULT_REC)
+    {
+      fprintf (stderr,
+	       "Warning: result(): can't write the result: %s:%s:%d:%d:%s\n",
+	       func, loc, rec_no, case_no, msg);
+      return 0;
+    }
+
+  sprintf (result_rec, "%s:%s:%d:%d:%d:%c:%s\n", func, loc, rec_no, seq_no,
+	   case_no, res, msg);
+
+  if (fputs (result_rec, fp) == EOF)
+    {
+      return 0;
+    }
+
+  return 1;
+}
diff --git a/ap/build/uClibc/test/locale-mbwc/tst2_mbrtowc.c b/ap/build/uClibc/test/locale-mbwc/tst2_mbrtowc.c
new file mode 100644
index 0000000..92e1283
--- /dev/null
+++ b/ap/build/uClibc/test/locale-mbwc/tst2_mbrtowc.c
@@ -0,0 +1,21 @@
+#include <wchar.h>
+#include <assert.h>
+#include <stdlib.h>
+
+/* bugs.uclibc.org/1471 : make sure output is 0  */
+static int
+do_test(void)
+{
+  wchar_t output;
+  int result;
+
+  output = L'A';		/* anything other than 0 will do... */
+  result = mbrtowc (&output, "", 1, 0);
+
+  assert (result == 0);
+  assert (output == 0);
+
+  return EXIT_SUCCESS;
+}
+#define TEST_FUNCTION do_test ()
+#include "../test-skeleton.c"
diff --git a/ap/build/uClibc/test/locale-mbwc/tst_funcs.h b/ap/build/uClibc/test/locale-mbwc/tst_funcs.h
new file mode 100644
index 0000000..4bd0fb1
--- /dev/null
+++ b/ap/build/uClibc/test/locale-mbwc/tst_funcs.h
@@ -0,0 +1,296 @@
+/*
+ *  TEST SUITE FOR MB/WC FUNCTIONS IN C LIBRARY
+ *
+ *	 FILE:	tst_funcs.h
+ *
+ *	 Definitions of macros
+ */
+
+
+#ifndef TST_FUNCS_H
+#define TST_FUNCS_H
+
+#define C_SUCCESS	   'S'	/* test case test passed		 */
+#define C_FAILURE	   'F'	/* test case failed			 */
+#define C_IGNORED	   'I'	/* test case/result ignored (not tested) */
+#define C_INVALID	   'D'	/* test data may be wrong		 */
+#define C_LOCALES	   'L'	/* can't set locale (skip)		 */
+
+
+extern int result (FILE * fp, char res, const char *func, const char *loc,
+		   int rec_no, int seq_num, int case_no, const char *msg);
+
+#define Result(C, S, E, M) \
+  result (fp, (C), (S), locale, rec+1, seq_num+1, (E), (M))
+
+#define CASE_0	  0
+#define CASE_1	  1
+#define CASE_2	  2
+#define CASE_3	  3
+#define CASE_4	  4
+#define CASE_5	  5
+#define CASE_6	  6
+#define CASE_7	  7
+#define CASE_8	  8
+#define CASE_9	  9
+
+#define MS_PASSED "PASSED"
+#define MS_SPACE  "	 "
+#define MS_FAILED "	 "
+#define MS_NOTEST "NOTEST"
+#define MS_ABORTU "ABEND0"
+#define MS_ABORT  "ABEND1"
+
+#define MK_PASSED 0x00
+#define MK_SPACE  0x01
+#define MK_NOTEST 0x02
+#define MK_ABORTU 0x04
+#define MK_ABORT  0x08
+
+
+
+/* ------------------ COMMON MACROS ------------------ */
+
+#define TST_ABS(x)  (((x) > 0) ? (x) : -(x))
+
+#define TMD_ERRET(_type_)   int	  err_val; \
+			    int	  ret_flg; \
+			    _type_ ret_val
+
+#define TMD_RECHEAD(_FUNC_)				      \
+									 \
+			      typedef struct {				 \
+				  TIN_##_FUNC_##_REC  input;		 \
+				  TEX_##_FUNC_##_REC  expect;		 \
+				  int is_last;				 \
+			      }	  TST_##_FUNC_##_REC;			 \
+			      typedef struct {				 \
+				  TST_HEAD	      hd;		 \
+				  TST_##_FUNC_##_REC  rec[ MAX_LOC_TEST ]; \
+			      }	  TST_##_FUNC_
+
+#define TST_FTYP(func)		tst_##func##_loc
+#define TST_HEAD(func)		tst_##func##_loc[ loc ].hd
+#define TST_INPUT(func)		tst_##func##_loc[ loc ].rec[ rec ].input
+#define TST_EXPECT(func)	tst_##func##_loc[ loc ].rec[ rec ].expect
+#define TST_INPUT_SEQ(func) \
+	tst_##func##_loc[ loc ].rec[ rec ].input.seq[ seq_num ]
+#define TST_EXPECT_SEQ(func) \
+	tst_##func##_loc[ loc ].rec[ rec ].expect.seq[ seq_num ]
+#define TST_IS_LAST(func) \
+	tst_##func##_loc[ loc ].rec[ rec ].is_last
+
+
+#define TST_DECL_VARS(_type_)				\
+	int   loc, rec, err_count = 0;			\
+	int   warn_count __attribute__ ((unused));	\
+	int   func_id, seq_num = 0;			\
+	const char *locale;				\
+	int   err_exp, ret_flg;				\
+	int errno_save = 0;				\
+	_type_ ret_exp;					\
+	_type_ ret
+
+#define TST_DO_TEST(o_func) \
+	for (loc = 0; strcmp (TST_HEAD (o_func).locale, TST_LOC_end); ++loc)
+
+
+#ifdef __UCLIBC_HAS_LOCALE__
+#define TST_HEAD_LOCALE(ofunc, s_func) \
+  func_id = TST_HEAD (ofunc).func_id;					      \
+  locale  = TST_HEAD (ofunc).locale;					      \
+  if (setlocale (LC_ALL, locale) == NULL)				      \
+    {									      \
+      fprintf (stderr, "Warning : can't set locale: %s\nskipping ...\n",      \
+	       locale);							      \
+      result (fp, C_LOCALES, s_func, locale, 0, 0, 0, "can't set locale");    \
+      ++err_count;							      \
+      continue;								      \
+    }
+#else
+#define TST_HEAD_LOCALE(ofunc, s_func)					\
+  func_id = TST_HEAD (ofunc).func_id;					\
+  locale  = TST_HEAD (ofunc).locale;					\
+  if (strcmp(locale, "C") == 0)					\
+	{								\
+	if (setlocale (LC_ALL, locale) == NULL)						\
+		{									\
+		fprintf (stderr, "Warning : can't set locale: %s\nskipping ...\n",	\
+			locale);							\
+		result (fp, C_LOCALES, s_func, locale, 0, 0, 0, "can't set locale");	\
+		++err_count;						\
+		continue;						\
+		}							\
+	}								\
+  else									\
+  	{								\
+		fprintf (stderr, "Warning : locale %s unsupported\n\n",		\
+			locale);						\
+		result (fp, C_LOCALES, s_func, locale, 0, 0, 0, "unsupported");	\
+		continue;						      	\
+	}
+#endif
+
+#define TST_DO_REC(ofunc) \
+	for (rec=0; !TST_IS_LAST (ofunc); ++rec)
+
+#define TST_DO_SEQ(_count_) \
+	for (seq_num=0; seq_num < _count_; seq_num++)
+
+#define TST_GET_ERRET(_ofunc_)			\
+	err_exp = TST_EXPECT (_ofunc_).err_val; \
+	ret_flg = TST_EXPECT (_ofunc_).ret_flg; \
+	ret_exp = TST_EXPECT (_ofunc_).ret_val
+
+#define TST_GET_ERRET_SEQ(_ofunc_)		    \
+	err_exp = TST_EXPECT_SEQ (_ofunc_).err_val; \
+	ret_flg = TST_EXPECT_SEQ (_ofunc_).ret_flg; \
+	ret_exp = TST_EXPECT_SEQ (_ofunc_).ret_val
+
+#define TST_CLEAR_ERRNO \
+	errno = 0
+
+#define TST_SAVE_ERRNO \
+	errno_save = errno
+
+/* Test value of ret and of errno if it should have a value.  */
+#define TST_IF_RETURN(_s_func_) \
+  if (err_exp != 0)							      \
+    {									      \
+      if (errno_save == err_exp)					      \
+	{								      \
+	  result (fp, C_SUCCESS, _s_func_, locale, rec+1, seq_num+1, 1,	      \
+		  MS_PASSED);						      \
+	}								      \
+      else								      \
+	{								      \
+	  err_count++;							      \
+	  result (fp, C_FAILURE, _s_func_, locale, rec+1, seq_num+1, 1,	      \
+		  "the value of errno is different from an expected value");  \
+	}								      \
+    }									      \
+									      \
+  if (ret_flg == 1)							      \
+    {									      \
+      if (ret == ret_exp)						      \
+	{								      \
+	  result (fp, C_SUCCESS, _s_func_, locale, rec+1, seq_num+1, 2,	      \
+		  MS_PASSED);						      \
+	}								      \
+      else								      \
+	{								      \
+	  err_count++;							      \
+	  result (fp, C_FAILURE, _s_func_, locale, rec+1, seq_num+1, 2,	      \
+		  "the return value is different from an expected value");    \
+	}								      \
+    }									      \
+  else
+
+#define TEX_ERRET_REC(_type_)			\
+	struct {				\
+	    TMD_ERRET (_type_);			\
+	}
+
+#define TEX_ERRET_REC_SEQ(_type_, _count_)	\
+	struct {				\
+	    struct {				\
+		TMD_ERRET (_type_);		\
+	    } seq[ _count_ ];			\
+	}
+
+
+
+/* ------------------ FUNCTION: ISW*() ------------------- */
+
+#define TST_ISW_STRUCT(_FUNC_, _func_)			\
+	typedef						\
+	struct {					\
+	    wint_t   wc;				\
+	} TIN_ISW##_FUNC_##_REC;			\
+	typedef						\
+	TEX_ERRET_REC (int)   TEX_ISW##_FUNC_##_REC;	\
+	TMD_RECHEAD (ISW##_FUNC_)
+
+#define TST_FUNC_ISW(_FUNC_, _func_) \
+int									      \
+tst_isw##_func_ (FILE *fp, int debug_flg)				      \
+{									      \
+  TST_DECL_VARS(int);							      \
+  wint_t wc;								      \
+  TST_DO_TEST (isw##_func_)						      \
+    {									      \
+      TST_HEAD_LOCALE (isw##_func_, S_ISW##_FUNC_);			      \
+      TST_DO_REC(isw##_func_)						      \
+	{								      \
+	  TST_GET_ERRET (isw##_func_);					      \
+	  wc = TST_INPUT (isw##_func_).wc;				      \
+	  ret = isw##_func_ (wc);					      \
+	  if (debug_flg)						      \
+	    {								      \
+	      fprintf (stdout, "isw*() [ %s : %d ] ret = %d\n", locale,	      \
+		       rec+1, ret);					      \
+	    }								      \
+									      \
+	  TST_IF_RETURN (S_ISW##_FUNC_)					      \
+	    {								      \
+	      if (ret != 0)						      \
+		{							      \
+		  result (fp, C_SUCCESS, S_ISW##_FUNC_, locale, rec+1,	      \
+			  seq_num+1, 3, MS_PASSED);			      \
+		}							      \
+	      else							      \
+		{							      \
+		  err_count++;						      \
+		  result (fp, C_FAILURE, S_ISW##_FUNC_, locale, rec+1,	      \
+			  seq_num+1, 3,					      \
+			  "the function returned 0, but should be non-zero"); \
+		}							      \
+	    }								      \
+	}								      \
+    }									      \
+									      \
+  return err_count;							      \
+}
+
+
+
+/* ------------------ FUNCTION: TOW*() ------------------ */
+
+#define TST_TOW_STRUCT(_FUNC_, _func_)			\
+	typedef						\
+	struct {					\
+	    wint_t   wc;				\
+	} TIN_TOW##_FUNC_##_REC;			\
+	typedef						\
+	TEX_ERRET_REC (wint_t)	TEX_TOW##_FUNC_##_REC;	\
+	TMD_RECHEAD (TOW##_FUNC_)
+
+#define TST_FUNC_TOW(_FUNC_, _func_)					\
+int									\
+tst_tow##_func_ (FILE *fp, int debug_flg)				\
+{									\
+  TST_DECL_VARS (wint_t);						\
+  wint_t wc;								\
+  TST_DO_TEST (tow##_func_)						\
+    {									\
+      TST_HEAD_LOCALE (tow##_func_, S_TOW##_FUNC_);			\
+      TST_DO_REC (tow##_func_)						\
+	{								\
+	  TST_GET_ERRET (tow##_func_);					\
+	  wc = TST_INPUT (tow##_func_).wc;				\
+	  ret = tow##_func_ (wc);					\
+	  if (debug_flg)						\
+	    {								\
+	      fprintf (stdout, "tow*() [ %s : %d ] ret = 0x%x\n",	\
+		       locale, rec+1, ret);				\
+	    }								\
+									\
+	  TST_IF_RETURN (S_TOW##_FUNC_) { };				\
+	}								\
+    }									\
+									\
+  return err_count;							\
+}
+
+
+#endif /* TST_FUNCS_H */
diff --git a/ap/build/uClibc/test/locale-mbwc/tst_iswalnum.c b/ap/build/uClibc/test/locale-mbwc/tst_iswalnum.c
new file mode 100644
index 0000000..95ba863
--- /dev/null
+++ b/ap/build/uClibc/test/locale-mbwc/tst_iswalnum.c
@@ -0,0 +1,10 @@
+/*
+  ISWALNUM: int iswalnum (wint_t wc)
+*/
+
+#define TST_FUNCTION iswalnum
+
+#include "tsp_common.c"
+#include "dat_iswalnum.c"
+
+TST_FUNC_ISW (ALNUM, alnum);
diff --git a/ap/build/uClibc/test/locale-mbwc/tst_iswalpha.c b/ap/build/uClibc/test/locale-mbwc/tst_iswalpha.c
new file mode 100644
index 0000000..8eff2cc
--- /dev/null
+++ b/ap/build/uClibc/test/locale-mbwc/tst_iswalpha.c
@@ -0,0 +1,10 @@
+/*
+  ISWALPHA: int iswalpha (wint_t wc);
+*/
+
+#define TST_FUNCTION iswalpha
+
+#include "tsp_common.c"
+#include "dat_iswalpha.c"
+
+TST_FUNC_ISW (ALPHA, alpha);
diff --git a/ap/build/uClibc/test/locale-mbwc/tst_iswcntrl.c b/ap/build/uClibc/test/locale-mbwc/tst_iswcntrl.c
new file mode 100644
index 0000000..4e1baa8
--- /dev/null
+++ b/ap/build/uClibc/test/locale-mbwc/tst_iswcntrl.c
@@ -0,0 +1,10 @@
+/*
+  ISWCNTRL: int iswcntrl (wint_t wc);
+*/
+
+#define TST_FUNCTION iswcntrl
+
+#include "tsp_common.c"
+#include "dat_iswcntrl.c"
+
+TST_FUNC_ISW (CNTRL, cntrl);
diff --git a/ap/build/uClibc/test/locale-mbwc/tst_iswctype.c b/ap/build/uClibc/test/locale-mbwc/tst_iswctype.c
new file mode 100644
index 0000000..3e79e09
--- /dev/null
+++ b/ap/build/uClibc/test/locale-mbwc/tst_iswctype.c
@@ -0,0 +1,53 @@
+/*
+  ISWCTYPE: int iswctype (wint_t wc, wctype_t desc);
+*/
+
+#define TST_FUNCTION iswctype
+
+#include "tsp_common.c"
+#include "dat_iswctype.c"
+
+
+int
+tst_iswctype (FILE *fp, int debug_flg)
+{
+  TST_DECL_VARS (int);
+  wint_t wc;
+  const char *ts;
+
+  TST_DO_TEST (iswctype)
+    {
+      TST_HEAD_LOCALE (iswctype, S_ISWCTYPE);
+      TST_DO_REC (iswctype)
+	{
+	  TST_GET_ERRET (iswctype);
+	  wc = TST_INPUT (iswctype).wc;
+	  ts = TST_INPUT (iswctype).ts;
+	  ret = iswctype (wc, wctype (ts));
+	  TST_SAVE_ERRNO;
+	  if (debug_flg)
+	    {
+	      fprintf (stdout, "iswctype() [ %s : %d ] ret = %d\n",
+		       locale, rec+1, ret);
+	    }
+
+	  TST_IF_RETURN (S_ISWCTYPE)
+	    {
+	      if (ret != 0)
+		{
+		  result (fp, C_SUCCESS, S_ISWCTYPE, locale, rec+1,
+			  seq_num+1, 3, MS_PASSED);
+		}
+	      else
+		{
+		  err_count++;
+		  result (fp, C_FAILURE, S_ISWCTYPE, locale, rec+1,
+			  seq_num+1, 3,
+			  "the function returned 0, but should be non-zero");
+		}
+	    }
+	}
+    }
+
+  return err_count;
+}
diff --git a/ap/build/uClibc/test/locale-mbwc/tst_iswdigit.c b/ap/build/uClibc/test/locale-mbwc/tst_iswdigit.c
new file mode 100644
index 0000000..5429ed0
--- /dev/null
+++ b/ap/build/uClibc/test/locale-mbwc/tst_iswdigit.c
@@ -0,0 +1,11 @@
+/*
+  ISWDIGIT: int iswdigit (wint_t wc);
+*/
+
+
+#define TST_FUNCTION iswdigit
+
+#include "tsp_common.c"
+#include "dat_iswdigit.c"
+
+TST_FUNC_ISW (DIGIT, digit);
diff --git a/ap/build/uClibc/test/locale-mbwc/tst_iswgraph.c b/ap/build/uClibc/test/locale-mbwc/tst_iswgraph.c
new file mode 100644
index 0000000..91a70e2
--- /dev/null
+++ b/ap/build/uClibc/test/locale-mbwc/tst_iswgraph.c
@@ -0,0 +1,10 @@
+/*
+  ISWGRAPH: int iswgraph (wint_t wc);
+*/
+
+#define TST_FUNCTION iswgraph
+
+#include "tsp_common.c"
+#include "dat_iswgraph.c"
+
+TST_FUNC_ISW (GRAPH, graph);
diff --git a/ap/build/uClibc/test/locale-mbwc/tst_iswlower.c b/ap/build/uClibc/test/locale-mbwc/tst_iswlower.c
new file mode 100644
index 0000000..e091100
--- /dev/null
+++ b/ap/build/uClibc/test/locale-mbwc/tst_iswlower.c
@@ -0,0 +1,10 @@
+/*
+  ISWLOWER: int iswlower (wint_t wc);
+*/
+
+#define TST_FUNCTION iswlower
+
+#include "tsp_common.c"
+#include "dat_iswlower.c"
+
+TST_FUNC_ISW (LOWER, lower);
diff --git a/ap/build/uClibc/test/locale-mbwc/tst_iswprint.c b/ap/build/uClibc/test/locale-mbwc/tst_iswprint.c
new file mode 100644
index 0000000..8d5bde5
--- /dev/null
+++ b/ap/build/uClibc/test/locale-mbwc/tst_iswprint.c
@@ -0,0 +1,10 @@
+/*
+  ISWPRINT: int iswprint (wint_t wc);
+*/
+
+#define TST_FUNCTION iswprint
+
+#include "tsp_common.c"
+#include "dat_iswprint.c"
+
+TST_FUNC_ISW (PRINT, print);
diff --git a/ap/build/uClibc/test/locale-mbwc/tst_iswpunct.c b/ap/build/uClibc/test/locale-mbwc/tst_iswpunct.c
new file mode 100644
index 0000000..4749d61
--- /dev/null
+++ b/ap/build/uClibc/test/locale-mbwc/tst_iswpunct.c
@@ -0,0 +1,10 @@
+/*
+  ISWPUNCT: int iswpunct (wint_t wc);
+*/
+
+#define TST_FUNCTION iswpunct
+
+#include "tsp_common.c"
+#include "dat_iswpunct.c"
+
+TST_FUNC_ISW (PUNCT, punct);
diff --git a/ap/build/uClibc/test/locale-mbwc/tst_iswspace.c b/ap/build/uClibc/test/locale-mbwc/tst_iswspace.c
new file mode 100644
index 0000000..6c26d5f
--- /dev/null
+++ b/ap/build/uClibc/test/locale-mbwc/tst_iswspace.c
@@ -0,0 +1,10 @@
+/*
+  ISWSPACE: int iswspace (wint_t wc);
+*/
+
+#define TST_FUNCTION iswspace
+
+#include "tsp_common.c"
+#include "dat_iswspace.c"
+
+TST_FUNC_ISW (SPACE, space);
diff --git a/ap/build/uClibc/test/locale-mbwc/tst_iswupper.c b/ap/build/uClibc/test/locale-mbwc/tst_iswupper.c
new file mode 100644
index 0000000..dfe5a5b
--- /dev/null
+++ b/ap/build/uClibc/test/locale-mbwc/tst_iswupper.c
@@ -0,0 +1,10 @@
+/*
+  ISWUPPER: int iswupper (wint_t wc);
+*/
+
+#define TST_FUNCTION iswupper
+
+#include "tsp_common.c"
+#include "dat_iswupper.c"
+
+TST_FUNC_ISW (UPPER, upper);
diff --git a/ap/build/uClibc/test/locale-mbwc/tst_iswxdigit.c b/ap/build/uClibc/test/locale-mbwc/tst_iswxdigit.c
new file mode 100644
index 0000000..5f9c0c5
--- /dev/null
+++ b/ap/build/uClibc/test/locale-mbwc/tst_iswxdigit.c
@@ -0,0 +1,10 @@
+/*
+  ISWXDIGIT: int iswxdigit (wint_t wc);
+*/
+
+#define TST_FUNCTION iswxdigit
+
+#include "tsp_common.c"
+#include "dat_iswxdigit.c"
+
+TST_FUNC_ISW (XDIGIT, xdigit);
diff --git a/ap/build/uClibc/test/locale-mbwc/tst_mblen.c b/ap/build/uClibc/test/locale-mbwc/tst_mblen.c
new file mode 100644
index 0000000..35ccf6c
--- /dev/null
+++ b/ap/build/uClibc/test/locale-mbwc/tst_mblen.c
@@ -0,0 +1,85 @@
+/*
+  MBLEN: int mblen (char *s, size_t n)
+*/
+
+#define TST_FUNCTION mblen
+
+#include "tsp_common.c"
+#include "dat_mblen.c"
+
+int
+tst_mblen (FILE * fp, int debug_flg)
+{
+  TST_DECL_VARS (int);
+  char s_flg;
+  const char *s_in;
+  size_t n;
+
+  TST_DO_TEST (mblen)
+  {
+    TST_HEAD_LOCALE (mblen, S_MBLEN);
+    TST_DO_REC (mblen)
+    {
+      TST_GET_ERRET (mblen);
+      s_flg = TST_INPUT (mblen).s_flg;
+      s_in = TST_INPUT (mblen).s;
+      n = TST_INPUT (mblen).n;
+
+      if (s_flg == 0)
+	{
+	  s_in = NULL;
+	}
+
+      if (n == USE_MBCURMAX)
+	{
+	  n = MB_CUR_MAX;
+	}
+
+      TST_CLEAR_ERRNO;
+      ret = mblen (s_in, n);
+      TST_SAVE_ERRNO;
+
+      TST_IF_RETURN (S_MBLEN)
+      {
+	if (s_in == NULL)
+	  {			/* state dependency */
+	    if (ret_exp == +1)
+	      {			/* state-dependent  */
+		if (ret != 0)
+		  {
+		    /* non-zero: state-dependent encoding */
+		    Result (C_SUCCESS, S_MBLEN, CASE_3, MS_PASSED);
+		  }
+		else
+		  {
+		    err_count++;
+		    Result (C_FAILURE, S_MBLEN, CASE_3,
+			    "should be state-dependent encoding, "
+			    "but the return value shows it is"
+			    " state-independent");
+		  }
+	      }
+
+	    if (ret_exp == 0)
+	      {			/* state-independent */
+		if (ret == 0)
+		  {
+		    /* non-zero: state-dependent encoding */
+		    Result (C_SUCCESS, S_MBLEN, CASE_3, MS_PASSED);
+		  }
+		else
+		  {
+		    err_count++;
+		    Result (C_FAILURE, S_MBLEN, CASE_3,
+			    "should be state-independent encoding, "
+			    "but the return value shows it is"
+			    " state-dependent");
+		  }
+	      }
+	  }
+      }
+    }
+  }
+
+  return err_count;
+}
diff --git a/ap/build/uClibc/test/locale-mbwc/tst_mbrlen.c b/ap/build/uClibc/test/locale-mbwc/tst_mbrlen.c
new file mode 100644
index 0000000..b8681b7
--- /dev/null
+++ b/ap/build/uClibc/test/locale-mbwc/tst_mbrlen.c
@@ -0,0 +1,82 @@
+/*
+  MBRLEN: size_t mbrlen (char *s, size_t n, mbstate_t *ps)
+*/
+
+#define TST_FUNCTION mbrlen
+
+#include "tsp_common.c"
+#include "dat_mbrlen.c"
+
+
+int
+tst_mbrlen (FILE * fp, int debug_flg)
+{
+  TST_DECL_VARS (size_t);
+  char s_flg;
+  const char *s_in;
+  size_t n;
+  char t_flg;
+  char t_ini;
+  static mbstate_t s = { 0 };
+  mbstate_t *ps;
+
+  TST_DO_TEST (mbrlen)
+  {
+    TST_HEAD_LOCALE (mbrlen, S_MBRLEN);
+    TST_DO_REC (mbrlen)
+    {
+      if (mbrlen (NULL, 0, &s) != 0)
+	{
+	  err_count++;
+	  Result (C_FAILURE, S_MBRLEN, CASE_3,
+		  "Initialization (external mbstate object) failed "
+		  "- skipped this test case.");
+	  continue;
+	}
+
+      TST_DO_SEQ (MBRLEN_SEQNUM)
+      {
+	TST_GET_ERRET_SEQ (mbrlen);
+	s_flg = TST_INPUT_SEQ (mbrlen).s_flg;
+	s_in = TST_INPUT_SEQ (mbrlen).s;
+	n = TST_INPUT_SEQ (mbrlen).n;
+	t_flg = TST_INPUT_SEQ (mbrlen).t_flg;
+	t_ini = TST_INPUT_SEQ (mbrlen).t_init;
+	if (s_flg == 0)
+	  {
+	    s_in = NULL;
+	  }
+
+	if (n == USE_MBCURMAX)	/* rewrite tst_mblen() like this */
+	  {
+	    n = MB_CUR_MAX;
+	  }
+
+	ps = (t_flg == 0) ? NULL : &s;
+
+	if (t_ini != 0)
+	  {
+	    memset (&s, 0, sizeof (s));
+	    mbrlen (NULL, 0, NULL);
+	  }
+
+	TST_CLEAR_ERRNO;
+	ret = mbrlen (s_in, n, ps);
+	TST_SAVE_ERRNO;
+
+	if (debug_flg)
+	  {
+	    fprintf (stdout, "mbrlen() [ %s : %d : %d ] ret = %zd\n",
+		     locale, rec + 1, seq_num + 1, ret);
+	    fprintf (stdout, "			   errno = %d\n", errno_save);
+	  }
+
+	TST_IF_RETURN (S_MBRLEN)
+	{
+	};
+      }
+    }
+  }
+
+  return err_count;
+}
diff --git a/ap/build/uClibc/test/locale-mbwc/tst_mbrtowc.c b/ap/build/uClibc/test/locale-mbwc/tst_mbrtowc.c
new file mode 100644
index 0000000..3a6070a
--- /dev/null
+++ b/ap/build/uClibc/test/locale-mbwc/tst_mbrtowc.c
@@ -0,0 +1,103 @@
+/*
+  MBRTOWC: size_t mbrtowc (wchar_t *pwc, const char *s, size_t n,
+			   mbstate_t *ps)
+*/
+
+#define TST_FUNCTION mbrtowc
+
+#include "tsp_common.c"
+#include "dat_mbrtowc.c"
+
+
+int
+tst_mbrtowc (FILE * fp, int debug_flg)
+{
+  TST_DECL_VARS (size_t);
+  char w_flg, s_flg;
+  char *s;
+  size_t n;
+  char t_flg, t_ini;
+  static mbstate_t t = { 0 };
+  mbstate_t *pt;
+  wchar_t wc, *pwc, wc_ex;
+
+  TST_DO_TEST (mbrtowc)
+  {
+    TST_HEAD_LOCALE (mbrtowc, S_MBRTOWC);
+    TST_DO_REC (mbrtowc)
+    {
+      if (mbrtowc (NULL, "", 0, &t) != 0)
+	{
+	  err_count++;
+	  Result (C_FAILURE, S_MBRTOWC, CASE_3,
+		  "Initialization failed - skipping this test case.");
+	  continue;
+	}
+
+      TST_DO_SEQ (MBRTOWC_SEQNUM)
+      {
+	TST_GET_ERRET_SEQ (mbrtowc);
+	w_flg = TST_INPUT_SEQ (mbrtowc).w_flg;
+	s_flg = TST_INPUT_SEQ (mbrtowc).s_flg;
+	s = TST_INPUT_SEQ (mbrtowc).s;
+	n = TST_INPUT_SEQ (mbrtowc).n;
+	t_flg = TST_INPUT_SEQ (mbrtowc).t_flg;
+	t_ini = TST_INPUT_SEQ (mbrtowc).t_init;
+	pwc = (w_flg == 0) ? NULL : &wc;
+
+	if (s_flg == 0)
+	  {
+	    s = NULL;
+	  }
+
+	if (n == USE_MBCURMAX)
+	  {
+	    n = MB_CUR_MAX;
+	  }
+
+	pt = (t_flg == 0) ? NULL : &t;
+#if 0
+	if (t_ini != 0)
+	  {
+	    memset (&t, 0, sizeof (t));
+	  }
+#endif
+	TST_CLEAR_ERRNO;
+	ret = mbrtowc (pwc, s, n, pt);
+	TST_SAVE_ERRNO;
+
+	if (debug_flg)
+	  {
+	    fprintf (stdout, "mbrtowc() [ %s : %d : %d ] ret = %zd\n",
+		     locale, rec + 1, seq_num + 1, ret);
+	    fprintf (stdout, "			    errno = %hd\n",
+		     errno_save);
+	  }
+
+	TST_IF_RETURN (S_MBRTOWC)
+	{
+	};
+
+	if (pwc == NULL || s == NULL || ret == (size_t) - 1
+	    || ret == (size_t) - 2)
+	  {
+	    continue;
+	  }
+
+	wc_ex = TST_EXPECT_SEQ (mbrtowc).wc;
+	if (wc_ex == wc)
+	  {
+	    Result (C_SUCCESS, S_MBRTOWC, CASE_4, MS_PASSED);
+	  }
+	else
+	  {
+	    err_count++;
+	    Result (C_FAILURE, S_MBRTOWC, CASE_4,
+		    "converted wc is different from an expected wc");
+	  }
+      }
+    }
+  }
+
+  return err_count;
+}
diff --git a/ap/build/uClibc/test/locale-mbwc/tst_mbsrtowcs.c b/ap/build/uClibc/test/locale-mbwc/tst_mbsrtowcs.c
new file mode 100644
index 0000000..3f3ea71
--- /dev/null
+++ b/ap/build/uClibc/test/locale-mbwc/tst_mbsrtowcs.c
@@ -0,0 +1,109 @@
+/*
+  MBSRTOWCS: size_t mbsrtowcs (wchar_t *ws, const char **s, size_t n,
+			       mbstate_t *ps)
+*/
+
+#define TST_FUNCTION mbsrtowcs
+
+#include "tsp_common.c"
+#include "dat_mbsrtowcs.c"
+
+int
+tst_mbsrtowcs (FILE * fp, int debug_flg)
+{
+  TST_DECL_VARS (size_t);
+  char w_flg;
+  const char *s, *p;
+  size_t n;
+  char t_flg, t_ini;
+  static mbstate_t t = { 0 };
+  mbstate_t *pt;
+  wchar_t ws[WCSSIZE], *ws_ex, *wp;
+  int err, i;
+
+  TST_DO_TEST (mbsrtowcs)
+  {
+    TST_HEAD_LOCALE (mbsrtowcs, S_MBSRTOWCS);
+    TST_DO_REC (mbsrtowcs)
+    {
+      s = "";
+      if (mbsrtowcs (NULL, &s, 0, &t) != 0)
+	{
+	  err_count++;
+	  Result (C_FAILURE, S_MBSRTOWCS, CASE_3,
+		  "Initialization failed - skipping this test case.");
+	  continue;
+	}
+
+      TST_DO_SEQ (MBSRTOWCS_SEQNUM)
+      {
+	TST_GET_ERRET_SEQ (mbsrtowcs);
+	w_flg = TST_INPUT_SEQ (mbsrtowcs).w_flg;
+	p = s = TST_INPUT_SEQ (mbsrtowcs).s;
+	n = TST_INPUT_SEQ (mbsrtowcs).n;
+	t_flg = TST_INPUT_SEQ (mbsrtowcs).t_flg;
+	t_ini = TST_INPUT_SEQ (mbsrtowcs).t_init;
+	wp = (w_flg == 0) ? NULL : ws;
+
+	if (n == USE_MBCURMAX)
+	  {
+	    n = MB_CUR_MAX;
+	  }
+
+	pt = (t_flg == 0) ? NULL : &t;
+
+	if (t_ini != 0)
+	  {
+	    memset (&t, 0, sizeof (t));
+	  }
+
+	TST_CLEAR_ERRNO;
+	ret = mbsrtowcs (wp, &p, n, pt);
+	TST_SAVE_ERRNO;
+
+	if (debug_flg)
+	  {
+	    fprintf (stderr, "mbsrtowcs: [ %d ] : ret = %zd\n", rec + 1, ret);
+	  }
+
+	TST_IF_RETURN (S_MBSRTOWCS)
+	{
+	};
+
+	if (wp == NULL || ret == (size_t) - 1 || ret == (size_t) - 2)
+	  {
+	    continue;
+	  }
+
+	ws_ex = TST_EXPECT_SEQ (mbsrtowcs).ws;
+	for (err = 0, i = 0; i < ret; i++)
+	  {
+	    if (debug_flg)
+	      {
+		fprintf (stderr,
+			 "mbsrtowcs: ws[%d] => 0x%lx : 0x%lx <= ws_ex[%d]\n",
+			 i, (unsigned long int) ws[i],
+			 (unsigned long int) ws_ex[i], i);
+	      }
+
+	    if (ws[i] != ws_ex[i])
+	      {
+		err++;
+		err_count++;
+		Result (C_FAILURE, S_MBSRTOWCS, CASE_4,
+			"the converted wc string has "
+			"different value from an expected string");
+		break;
+	      }
+	  }
+
+	if (!err)
+	  {
+	    Result (C_SUCCESS, S_MBSRTOWCS, CASE_4, MS_PASSED);
+	  }
+      }
+    }
+  }
+
+  return err_count;
+}
diff --git a/ap/build/uClibc/test/locale-mbwc/tst_mbstowcs.c b/ap/build/uClibc/test/locale-mbwc/tst_mbstowcs.c
new file mode 100644
index 0000000..878df6a
--- /dev/null
+++ b/ap/build/uClibc/test/locale-mbwc/tst_mbstowcs.c
@@ -0,0 +1,98 @@
+/*
+  MBSTOWCS: size_t mbstowcs (wchar_t *ws, char *s, size_t n)
+*/
+
+#define TST_FUNCTION mbstowcs
+
+#include "tsp_common.c"
+#include "dat_mbstowcs.c"
+
+int
+tst_mbstowcs (FILE * fp, int debug_flg)
+{
+  TST_DECL_VARS (size_t);
+  char w_flg, s_flg;
+  const char *s;
+  size_t n;
+  wchar_t ws[WCSSIZE], *ws_ex, *wp;
+  int err, i;
+
+  TST_DO_TEST (mbstowcs)
+  {
+    TST_HEAD_LOCALE (mbstowcs, S_MBSTOWCS);
+    TST_DO_REC (mbstowcs)
+    {
+      if (mbstowcs (NULL, "", 0) != 0)
+	{
+	  err_count++;
+	  Result (C_FAILURE, S_MBSTOWCS, CASE_3,
+		  "Initialization failed - skipping this test case.");
+	  continue;
+	}
+
+      TST_DO_SEQ (MBSTOWCS_SEQNUM)
+      {
+	TST_GET_ERRET_SEQ (mbstowcs);
+	w_flg = TST_INPUT_SEQ (mbstowcs).w_flg;
+	s_flg = TST_INPUT_SEQ (mbstowcs).s_flg;
+	n = TST_INPUT_SEQ (mbstowcs).n;
+
+	if (s_flg == 0)
+	  s = NULL;
+	else
+	  s = TST_INPUT_SEQ (mbstowcs).s;
+
+
+	wp = (wchar_t *) ((w_flg == 0) ? NULL : ws);
+
+	TST_CLEAR_ERRNO;
+	ret = mbstowcs (wp, s, n);
+	TST_SAVE_ERRNO;
+
+	if (debug_flg)
+	  {
+	    fprintf (stderr, "mbstowcs: ret = %zd\n", ret);
+	  }
+
+	TST_IF_RETURN (S_MBSTOWCS)
+	{
+	};
+
+	if (s == NULL || wp == NULL || ret == (size_t) - 1)
+	  {
+	    continue;
+	  }
+
+	ws_ex = TST_EXPECT_SEQ (mbstowcs).ws;
+
+	for (err = 0, i = 0; i < ret; i++)
+	  {
+	    if (debug_flg)
+	      {
+		fprintf (stderr,
+			 "mbstowcs: ws[%d] => 0x%lx : 0x%lx <= ws_ex[%d]\n",
+			 i, (unsigned long int) ws[i],
+			 (unsigned long int) ws_ex[i], i);
+	      }
+
+	    if (ws[i] != ws_ex[i])
+	      {
+		err++;
+		err_count++;
+		Result (C_FAILURE, S_MBSTOWCS, CASE_4,
+			"the converted wc string has "
+			"different value from an expected string");
+		break;
+	      }
+	  }
+
+	if (!err)
+	  {
+	    Result (C_SUCCESS, S_MBSTOWCS, CASE_4, MS_PASSED);
+	  }
+      }
+    }
+  }
+
+  return err_count;
+}
diff --git a/ap/build/uClibc/test/locale-mbwc/tst_mbtowc.c b/ap/build/uClibc/test/locale-mbwc/tst_mbtowc.c
new file mode 100644
index 0000000..7c274f6
--- /dev/null
+++ b/ap/build/uClibc/test/locale-mbwc/tst_mbtowc.c
@@ -0,0 +1,130 @@
+/*
+  MBTOWC: int mbtowc (wchar_t *wc, char *s, size_t n)
+*/
+
+#define TST_FUNCTION mbtowc
+
+#include "tsp_common.c"
+#include "dat_mbtowc.c"
+
+
+int
+tst_mbtowc (FILE * fp, int debug_flg)
+{
+  TST_DECL_VARS (int);
+  char w_flg, s_flg;
+  const char *s_in;
+  size_t n;
+  wchar_t wc, wc_ex, *wp;
+
+  TST_DO_TEST (mbtowc)
+  {
+    TST_HEAD_LOCALE (mbtowc, S_MBTOWC);
+    TST_DO_REC (mbtowc)
+    {
+      if (mbstowcs (NULL, "", 0) != 0)
+	{
+	  err_count++;
+	  Result (C_FAILURE, S_MBSTOWCS, CASE_3,
+		  "Initialization failed - skipping this test case.");
+	  continue;
+	}
+
+      TST_DO_SEQ (MBTOWC_SEQNUM)
+      {
+	TST_GET_ERRET_SEQ (mbtowc);
+	w_flg = TST_INPUT_SEQ (mbtowc).w_flg;
+	s_flg = TST_INPUT_SEQ (mbtowc).s_flg;
+	n = TST_INPUT_SEQ (mbtowc).n;
+
+	if (n == USE_MBCURMAX)
+	  {
+	    n = MB_CUR_MAX;
+	  }
+
+	if (s_flg == 0)
+	  s_in = NULL;
+	else
+	  s_in = TST_INPUT_SEQ (mbtowc).s;
+
+	wp = (wchar_t *) ((w_flg == 0) ? NULL : &wc);
+
+	/* XXX Clear the internal state.  We should probably have
+	   a flag for this.  */
+	mbtowc (NULL, NULL, 0);
+
+	TST_CLEAR_ERRNO;
+	ret = mbtowc (wp, s_in, n);
+	TST_SAVE_ERRNO;
+
+	if (debug_flg)
+	  {
+	    fprintf (stdout, "mbtowc() [ %s : %d ] ret = %d\n", locale,
+		     rec + 1, ret);
+	    fprintf (stdout, "			   errno      = %d\n",
+		     errno_save);
+	  }
+
+	TST_IF_RETURN (S_MBTOWC)
+	{
+	  if (s_in == NULL)
+	    {			/* state dependency */
+	      if (ret_exp == +1)
+		{		/* state-dependent  */
+		  if (ret != 0)
+		    {
+		      /* Non-zero: state-dependent encoding.  */
+		      Result (C_SUCCESS, S_MBTOWC, CASE_3, MS_PASSED);
+		    }
+		  else
+		    {
+		      err_count++;
+		      Result (C_FAILURE, S_MBTOWC, CASE_3,
+			      "should be state-dependent encoding, "
+			      "but a return value shows it is "
+			      "state-independent");
+		    }
+		}
+
+	      if (ret_exp == 0)
+		{		/* state-independent */
+		  if (ret == 0)
+		    {
+		      /* Non-zero: state-dependent encoding.  */
+		      Result (C_SUCCESS, S_MBTOWC, CASE_3, MS_PASSED);
+		    }
+		  else
+		    {
+		      err_count++;
+		      Result (C_FAILURE, S_MBTOWC, CASE_3,
+			      "should be state-independent encoding, "
+			      "but a return value shows it is "
+			      "state-dependent");
+		    }
+		}
+	    }
+	}
+
+	if ((wp == NULL || s_in == NULL || s_in[0] == 0) || ret <= 0)
+	  {
+	    continue;
+	  }
+
+	wc_ex = TST_EXPECT_SEQ (mbtowc).wc;
+
+	if (wc_ex == wc)
+	  {
+	    Result (C_SUCCESS, S_MBTOWC, CASE_4, MS_PASSED);
+	  }
+	else
+	  {
+	    err_count++;
+	    Result (C_FAILURE, S_MBTOWC, CASE_4,
+		    "converted wc is different from an expected wc");
+	  }
+      }
+    }
+  }
+
+  return err_count;
+}
diff --git a/ap/build/uClibc/test/locale-mbwc/tst_strcoll.c b/ap/build/uClibc/test/locale-mbwc/tst_strcoll.c
new file mode 100644
index 0000000..4c5a84f
--- /dev/null
+++ b/ap/build/uClibc/test/locale-mbwc/tst_strcoll.c
@@ -0,0 +1,87 @@
+/*
+  STRCOLL: int strcoll (const char *s1, const char *s2)
+*/
+
+#define TST_FUNCTION strcoll
+
+#include "tsp_common.c"
+#include "dat_strcoll.c"
+
+int
+tst_strcoll (FILE * fp, int debug_flg)
+{
+  TST_DECL_VARS (int);
+  const char *s1, *s2;
+
+  TST_DO_TEST (strcoll)
+  {
+    TST_HEAD_LOCALE (strcoll, S_STRCOLL);
+    TST_DO_REC (strcoll)
+    {
+      TST_GET_ERRET (strcoll);
+      s1 = TST_INPUT (strcoll).s1;
+      s2 = TST_INPUT (strcoll).s2;
+
+      TST_CLEAR_ERRNO;
+      ret = strcoll (s1, s2);
+      TST_SAVE_ERRNO;
+
+      if (debug_flg)
+	{
+	  fprintf (stdout, "strcoll() [ %s : %d ] ret = %d\n", locale,
+		   rec + 1, ret);
+	  fprintf (stdout, "			    errno = %d\n",
+		   errno_save);
+	  fprintf (stdout, "			    LC_COLLATE = %s\n",
+		   (setlocale (LC_COLLATE, NULL)) ? setlocale (LC_COLLATE,
+							       NULL) : "");
+	}
+
+      TST_IF_RETURN (S_STRCOLL)
+      {
+	if (ret_exp == +1)
+	  {
+	    if (ret > 0)
+	      {
+		Result (C_SUCCESS, S_STRCOLL, CASE_3, MS_PASSED);
+	      }
+	    else
+	      {
+		err_count++;
+		Result (C_FAILURE, S_STRCOLL, CASE_3,
+			"the return value should be greater than 0,"
+			" but is not ...");
+	      }
+	  }
+	else if (ret_exp == -1)
+	  {
+	    if (ret < 0)
+	      {
+		Result (C_SUCCESS, S_STRCOLL, CASE_3, MS_PASSED);
+	      }
+	    else
+	      {
+		err_count++;
+		Result (C_FAILURE, S_STRCOLL, CASE_3,
+			"the return value should less than 0, but not ...");
+	      }
+	  }
+	else if (ret_exp != 0)
+	  {
+	    if (debug_flg)
+	      {
+		fprintf (stderr, "*** Warning *** : tst_strcoll : "
+			 "(check the test data); should set ret_flg=1"
+			 " to check a return value");
+	      }
+
+	    warn_count++;
+	    Result (C_INVALID, S_WCSCHR, CASE_3, "(check the test data); "
+		    "should set ret_flg=1 to check a return value");
+	  }
+      }
+    }
+  }
+
+  return err_count;
+}
diff --git a/ap/build/uClibc/test/locale-mbwc/tst_strfmon.c b/ap/build/uClibc/test/locale-mbwc/tst_strfmon.c
new file mode 100644
index 0000000..88e9316
--- /dev/null
+++ b/ap/build/uClibc/test/locale-mbwc/tst_strfmon.c
@@ -0,0 +1,74 @@
+/*
+  STRFMON: size_t strfmon (char *buf, size_t nbyte, const char *fmt, ...)
+*/
+
+#define TST_FUNCTION strfmon
+
+#include "tsp_common.c"
+#include "dat_strfmon.c"
+#include <monetary.h>
+
+int
+tst_strfmon (FILE * fp, int debug_flg)
+{
+  TST_DECL_VARS (size_t);
+  char buf[MONSIZE], *mon;
+  size_t nbt;
+  char *fmt;
+  double val;
+
+  TST_DO_TEST (strfmon)
+  {
+    TST_HEAD_LOCALE (strfmon, S_STRFMON);
+    TST_DO_REC (strfmon)
+    {
+      TST_GET_ERRET (strfmon);
+      nbt = TST_INPUT (strfmon).nbytes;
+      fmt = TST_INPUT (strfmon).fmt;
+      val = TST_INPUT (strfmon).val;
+      memset (buf, 0, MONSIZE);
+      if (nbt > MONSIZE)
+	{
+	  err_count++;
+	  Result (C_FAILURE, S_STRFMON, CASE_3, "buffer too small in test");
+	  continue;
+	}
+
+      TST_CLEAR_ERRNO;
+      ret = strfmon (buf, nbt, fmt, val, val, val);
+      TST_SAVE_ERRNO;
+
+      if (debug_flg)		/* seems fprintf doesn't update the errno */
+	{
+	  fprintf (stdout, "strfmon() [ %s : %d ]\n", locale, rec + 1);
+	  fprintf (stdout, "	  : err = %d | %s\n", errno_save,
+		   strerror (errno));
+	  fprintf (stdout, "	  : ret = %zd; \t fmt = |%s|\n", ret, fmt);
+	  fprintf (stdout, "	  : buf = |%s|\n\n", buf);
+	}
+
+      TST_IF_RETURN (S_STRFMON)
+      {
+      };
+      if (errno != 0 || ret == -1)
+	{
+	  continue;
+	}
+
+      mon = TST_EXPECT (strfmon).mon;
+
+      if (!strcmp (buf, mon))
+	{
+	  Result (C_SUCCESS, S_STRFMON, CASE_3, MS_PASSED);
+	}
+      else
+	{
+	  err_count++;
+	  Result (C_FAILURE, S_STRFMON, CASE_3, "the formatted string is "
+		  "different from an expected result");
+	}
+    }
+  }
+
+  return err_count;
+}
diff --git a/ap/build/uClibc/test/locale-mbwc/tst_strxfrm.c b/ap/build/uClibc/test/locale-mbwc/tst_strxfrm.c
new file mode 100644
index 0000000..fdfeffc
--- /dev/null
+++ b/ap/build/uClibc/test/locale-mbwc/tst_strxfrm.c
@@ -0,0 +1,136 @@
+/*
+  STRXFRM: size_t strxfrm (char *s1, const char *s2, size_t n)
+*/
+
+#define TST_FUNCTION strxfrm
+
+#include "tsp_common.c"
+#include "dat_strxfrm.c"
+
+
+int
+tst_strxfrm (FILE * fp, int debug_flg)
+{
+  TST_DECL_VARS (size_t);
+  const char *org1, *org2;
+  char frm1[MBSSIZE], frm2[MBSSIZE];
+  size_t n1, n2;
+  int ret_coll, ret_cmp;
+
+  TST_DO_TEST (strxfrm)
+  {
+    TST_HEAD_LOCALE (strxfrm, S_STRXFRM);
+    TST_DO_REC (strxfrm)
+    {
+      TST_GET_ERRET (strxfrm);
+      org1 = TST_INPUT (strxfrm).org1;
+      org2 = TST_INPUT (strxfrm).org2;
+      n1 = TST_INPUT (strxfrm).n1;
+      n2 = TST_INPUT (strxfrm).n2;
+
+      if (n1 < 0 || sizeof (frm1) < n1 || sizeof (frm2) < n2)
+	{
+	  warn_count++;
+	  Result (C_IGNORED, S_STRXFRM, CASE_9,
+		  "input data n1 or n2 is invalid");
+	  continue;
+	}
+
+      /* An errno and a return value are checked
+	 only for 2nd strxfrm() call.
+	 A result of 1st call is used for comparing
+	 those 2 values by using strcmp().
+      */
+
+      /*-- First call --*/
+
+      TST_CLEAR_ERRNO;
+      ret = strxfrm (frm1, org1, n1);
+      TST_SAVE_ERRNO;
+
+      if (debug_flg)
+	{
+	  fprintf (stdout, "strxfrm() [ %s : %d ] ( 1st call )\n", locale,
+		   rec + 1);
+	  fprintf (stdout, "	  : err = %d | %s\n", errno_save,
+		   strerror (errno));
+	  fprintf (stdout, "	  : ret = %zu\n", ret);
+	  fprintf (stdout, "	  : org = %s\n", org1);
+	}
+
+      if (ret >= n1 || errno != 0)
+	{
+	  warn_count++;
+	  Result (C_INVALID, S_STRXFRM, CASE_8,
+		  "got an error in fist strxfrm() call");
+	  continue;
+	}
+
+      /*-- Second call --*/
+
+      TST_CLEAR_ERRNO;
+      ret = strxfrm (((n2 == 0) ? NULL : frm2), org2, n2);
+      TST_SAVE_ERRNO;
+
+      if (debug_flg)
+	{
+	  fprintf (stderr, "	  ..............( 2nd call )\n");
+	  fprintf (stdout, "	  : err = %d | %s\n", errno,
+		   strerror (errno));
+	  fprintf (stdout, "	  : ret = %zu\n", ret);
+	  fprintf (stdout, "	  : org = %s\n", org2);
+	}
+
+      TST_IF_RETURN (S_STRXFRM)
+      {
+      };
+
+      if (n2 == 0 || ret >= n2 || errno != 0)
+	{
+#if 0
+	  warn_count++;
+	  Result (C_IGNORED, S_STRXFRM, CASE_7, "did not get a result");
+#endif
+	  continue;
+	}
+
+      /*-- strcoll & strcmp --*/
+
+      TST_CLEAR_ERRNO;
+      /* Depends on strcoll() ... not good though ... */
+      ret_coll = strcoll (org1, org2);
+
+      if (errno != 0)
+	{
+	  /* bug * bug may get correct results ...	  */
+	  warn_count++;
+	  Result (C_INVALID, S_STRXFRM, CASE_6,
+		  "got an error in strcoll() call");
+	  continue;
+	}
+
+      ret_cmp = strcmp (frm1, frm2);
+
+      if ((ret_coll == 0 && ret_cmp == 0)
+	  || (ret_coll < 0 && ret_cmp < 0) || (ret_coll > 0 && ret_cmp > 0))
+	{
+	  Result (C_SUCCESS, S_STRXFRM, CASE_3,
+		  MS_PASSED "(depends on strcoll & strcmp)");
+	}
+      else
+	{
+	  err_count++;
+	  Result (C_FAILURE, S_STRXFRM, CASE_3,
+		  "results from strcoll & strcmp() do not match");
+	}
+
+      if (debug_flg)
+	{
+	  fprintf (stdout, ".......... strcoll = %d <-> %d = strcmp\n",
+		   ret_coll, ret_cmp);
+	}
+    }
+  }
+
+  return err_count;
+}
diff --git a/ap/build/uClibc/test/locale-mbwc/tst_swscanf.c b/ap/build/uClibc/test/locale-mbwc/tst_swscanf.c
new file mode 100644
index 0000000..76445d7
--- /dev/null
+++ b/ap/build/uClibc/test/locale-mbwc/tst_swscanf.c
@@ -0,0 +1,137 @@
+/*
+  SWSCANF: int swscanf (const wchar_t *ws, const wchar_t *fmt, ...);
+*/
+
+#define TST_FUNCTION swscanf
+
+#include "tsp_common.c"
+#include "dat_swscanf.c"
+
+int
+tst_swscanf (FILE * fp, int debug_flg)
+{
+  TST_DECL_VARS (int);
+  wchar_t *ws;
+  wchar_t *fmt;
+  int val_int1;
+  unsigned val_int2;
+  float val_flt;
+  char val_c;
+  char val_s[MBSSIZE * 3];
+  wchar_t val_S[WCSSIZE * 3], *exp_S;
+  int i;
+
+  TST_DO_TEST (swscanf)
+  {
+    TST_HEAD_LOCALE (swscanf, S_SWSCANF);
+    TST_DO_REC (swscanf)
+    {
+      TST_GET_ERRET (swscanf);
+      ws = TST_INPUT (swscanf).ws;
+      fmt = TST_INPUT (swscanf).fmt;
+      val_int1 = val_int2 = val_flt = val_c = 0;
+      memset (val_s, 0, sizeof (val_s));
+      memset (val_S, 0, sizeof (val_S));
+
+      TST_CLEAR_ERRNO;
+
+      if (TST_INPUT (swscanf).wch)
+	{
+	  ret = swscanf (ws, fmt, val_S);
+	}
+      else
+	{
+	  ret =
+	    swscanf (ws, fmt, &val_int1, &val_int2, &val_flt, &val_c, val_s);
+	}
+
+      TST_SAVE_ERRNO;
+
+      if (debug_flg)
+	{			/* seems fprintf doesn't update errno */
+	  fprintf (stdout, "swscanf() [ %s : %d ] ret = %d\n", locale,
+		   rec + 1, ret);
+	  fprintf (stdout, "			    errno   = %d\n",
+		   errno_save);
+	  fprintf (stdout, "			    collate = %s\n",
+		   (setlocale (LC_COLLATE, NULL)) ? setlocale (LC_COLLATE,
+							       NULL) : "");
+
+	  if (TST_INPUT (swscanf).wch)
+	    {
+	      fprintf (stdout, "			val_S[ 0 ] = 0x%lx\n",
+		       (unsigned long int) val_S[0]);
+	    }
+	  else
+	    {
+	      fprintf (stdout, "			val_int1   = %d\n",
+		       val_int1);
+	      fprintf (stdout, "			val_int2   = %d\n",
+		       val_int2);
+	      fprintf (stdout, "			val_flt	   = %f\n",
+		       val_flt);
+	      fprintf (stdout, "			val_c	   = %c\n",
+		       val_c);
+	      fprintf (stdout, "			val_s	   = %s\n",
+		       val_s);
+	    }
+	}
+
+      TST_IF_RETURN (S_SWSCANF)
+      {
+      };
+
+      if (errno == 0 && TST_INPUT (swscanf).wch)
+	{
+	  for (exp_S = TST_EXPECT (swscanf).val_S, i = 0; i < WCSSIZE * 3;
+	       i++)
+	    {
+	      if (val_S[i] == L'\0' || exp_S[i] == L'\0')
+		{
+		  if (val_S[i] != exp_S[i] && TST_INPUT (swscanf).wch == 'C')
+		    {
+		      err_count++;
+		      Result (C_FAILURE, S_SWSCANF, CASE_4,
+			      "the converted wide-char string is different"
+			      " from an expected value.");
+		    }
+		  break;
+		}
+
+	      if (val_S[i] != exp_S[i])
+		{
+		  err_count++;
+		  Result (C_FAILURE, S_SWSCANF, CASE_4,
+			  "the converted wide-char string is different from"
+			  " an expected value.");
+		  break;
+		}
+	      else
+		{
+		  Result (C_SUCCESS, S_SWSCANF, CASE_4, MS_PASSED);
+		}
+	    }
+	}
+
+      if (errno == 0 && !TST_INPUT (swscanf).wch)
+	{
+	  if (val_int1 != TST_EXPECT (swscanf).val_int ||
+	      val_int2 != TST_EXPECT (swscanf).val_uns ||
+	      val_flt != TST_EXPECT (swscanf).val_flt ||
+	      val_c != TST_EXPECT (swscanf).val_c ||
+	      strcmp (val_s, TST_EXPECT (swscanf).val_s))
+	    {
+	      err_count++;
+	      Result (C_FAILURE, S_SWSCANF, CASE_3,
+		      "the converted values are different from expected values.");
+	    }
+	  else
+	    {
+	      Result (C_SUCCESS, S_SWSCANF, CASE_3, MS_PASSED);
+	    }
+	}
+    }
+  }
+
+  return err_count;
+}
diff --git a/ap/build/uClibc/test/locale-mbwc/tst_towctrans.c b/ap/build/uClibc/test/locale-mbwc/tst_towctrans.c
new file mode 100644
index 0000000..1d874dc
--- /dev/null
+++ b/ap/build/uClibc/test/locale-mbwc/tst_towctrans.c
@@ -0,0 +1,82 @@
+/*
+  TOWCTRANS: wint_t towctrans (wint_t wc, wctrans_t desc);
+*/
+
+#define TST_FUNCTION towctrans
+
+#include "tsp_common.c"
+#include "dat_towctrans.c"
+
+
+int
+tst_towctrans (FILE *fp, int debug_flg)
+{
+  TST_DECL_VARS (wint_t);
+  wint_t wc;
+  const char *ts;
+#if SHOJI_IS_RIGHT
+  int dummy=0;
+#endif
+  wctrans_t wto;
+
+  TST_DO_TEST (towctrans)
+    {
+      TST_HEAD_LOCALE (towctrans, S_TOWCTRANS);
+      TST_DO_REC (towctrans)
+	{
+	  TST_GET_ERRET (towctrans);
+	  wc = TST_INPUT (towctrans).wc;
+	  ts = TST_INPUT (towctrans).ts;
+
+#if SHOJI_IS_RIGHT
+	  if ((wto = wctrans (ts)) == (wctrans_t) 0)
+	    {
+#if 0
+	      result (fp, C_IGNORED, S_TOWCTRANS, locale, rec+1, seq_num+1, 3,
+		      "Skip this data because the wctrans object is not invalid.");
+	      warn_count++;
+	      continue;
+#else
+	      wto = &dummy;	/* not good ... */
+#endif
+	      if (debug_flg)
+		{
+		  fprintf (stdout, "towctrans() ------ wctrans() returnd 0.\n");
+		}
+	    }
+#else
+	  wto = wctrans (ts);
+#endif
+
+	  TST_CLEAR_ERRNO;
+	  ret = towctrans (wc, wto);
+	  TST_SAVE_ERRNO;
+
+	  if (debug_flg)
+	    {
+	      fprintf (stdout, "towctrans() [ %s : %d ] ret = 0x%x\n",
+		       locale, rec+1, ret);
+	      fprintf (stdout, "		      errno = %d\n",
+		       errno_save);
+	    }
+
+	  TST_IF_RETURN (S_TOWCTRANS)
+	    {
+	      if (ret != 0)
+		{
+		  result (fp, C_SUCCESS, S_TOWCTRANS, locale, rec+1,
+			  seq_num+1, 3, MS_PASSED);
+		}
+	      else
+		{
+		  err_count++;
+		  result (fp, C_FAILURE, S_TOWCTRANS, locale, rec+1,
+			  seq_num+1, 3,
+			  "the function returned 0, but should be non-zero");
+		}
+	    }
+	}
+    }
+
+  return err_count;
+}
diff --git a/ap/build/uClibc/test/locale-mbwc/tst_towlower.c b/ap/build/uClibc/test/locale-mbwc/tst_towlower.c
new file mode 100644
index 0000000..7719b0d
--- /dev/null
+++ b/ap/build/uClibc/test/locale-mbwc/tst_towlower.c
@@ -0,0 +1,11 @@
+/*
+  TOWLOWER: int towlower (wint_t wc);
+*/
+
+#define TST_FUNCTION towlower
+
+#include "tsp_common.c"
+#include "dat_towlower.c"
+
+
+TST_FUNC_TOW (LOWER, lower);
diff --git a/ap/build/uClibc/test/locale-mbwc/tst_towupper.c b/ap/build/uClibc/test/locale-mbwc/tst_towupper.c
new file mode 100644
index 0000000..a077d27
--- /dev/null
+++ b/ap/build/uClibc/test/locale-mbwc/tst_towupper.c
@@ -0,0 +1,10 @@
+/*
+  TOWUPPER: int towupper (wint_t wc);
+*/
+
+#define TST_FUNCTION towupper
+
+#include "tsp_common.c"
+#include "dat_towupper.c"
+
+TST_FUNC_TOW (UPPER, upper);
diff --git a/ap/build/uClibc/test/locale-mbwc/tst_types.h b/ap/build/uClibc/test/locale-mbwc/tst_types.h
new file mode 100644
index 0000000..3d18279
--- /dev/null
+++ b/ap/build/uClibc/test/locale-mbwc/tst_types.h
@@ -0,0 +1,729 @@
+/*
+ *  TEST SUITE FOR MB/WC FUNCTIONS IN C LIBRARY
+ *
+ *	 FILE:	tst_types.h
+ *
+ *	 Definitions of data types for each test function
+ */
+
+
+#ifndef TST_TYPES_H
+#define TST_TYPES_H
+
+#include <stdio.h>
+#include <wchar.h>
+#include <wctype.h>
+#include "tst_funcs.h"
+#include "tgn_funcdef.h"
+
+#define MBSSIZE		   24
+#define WCSSIZE		   12
+#define MONFMTSIZE	   16
+#define MONSIZE		   64
+#define USE_MBCURMAX	   99	/* well, but ... */
+#define TST_DBL_EPS	   2.22153e-16
+#define WCSTOK_SEQNUM	   3
+#define MBLEN_SEQNUM	   3
+#define MBTOWC_SEQNUM	   3
+#define MBSTOWCS_SEQNUM	   3
+#define WCTOMB_SEQNUM	   3
+#define WCSTOMBS_SEQNUM	   3
+#define MBRLEN_SEQNUM	   3
+#define MBRTOWC_SEQNUM	   3
+#define MBSRTOWCS_SEQNUM   3
+#define WCRTOMB_SEQNUM	   3
+#define WCSRTOMBS_SEQNUM   3
+
+/* Maximum numbers of test in one of the _loc arrays.  */
+#define MAX_LOC_TEST		300
+
+
+/*----------------------------------------------------------------------*/
+/*  FUNCTION								*/
+/*----------------------------------------------------------------------*/
+
+typedef struct
+{
+  char *func_str;
+  int func_id;
+}
+TST_FID;
+
+typedef struct
+{
+  int func_id;
+  const char *locale;
+}
+TST_HEAD;
+
+typedef struct
+{
+  TST_HEAD *head;
+}
+TST_FUNCS;
+
+
+/*----------------------------------------------------------------------*/
+/*  ISW*: int isw* (wchar_t wc)						*/
+/*----------------------------------------------------------------------*/
+
+TST_ISW_STRUCT (ALNUM, alnum);
+TST_ISW_STRUCT (ALPHA, alpha);
+TST_ISW_STRUCT (CNTRL, cntrl);
+TST_ISW_STRUCT (DIGIT, digit);
+TST_ISW_STRUCT (GRAPH, graph);
+TST_ISW_STRUCT (LOWER, lower);
+TST_ISW_STRUCT (PRINT, print);
+TST_ISW_STRUCT (PUNCT, punct);
+TST_ISW_STRUCT (SPACE, space);
+TST_ISW_STRUCT (UPPER, upper);
+TST_ISW_STRUCT (XDIGIT, xdigit);
+
+typedef struct
+{
+  wint_t wc;
+  const char *ts;
+}
+TIN_ISWCTYPE_REC;
+
+typedef
+TEX_ERRET_REC (int)
+  TEX_ISWCTYPE_REC;
+TMD_RECHEAD (ISWCTYPE);
+
+
+/*----------------------------------------------------------------------*/
+/*  MBLEN: int mblen (const char *s, size_t n)				*/
+/*----------------------------------------------------------------------*/
+
+typedef struct
+{
+  char s_flg;
+  char s[MBSSIZE];
+  size_t n;
+}
+TIN_MBLEN_REC;
+
+typedef TEX_ERRET_REC (int) TEX_MBLEN_REC;
+TMD_RECHEAD (MBLEN);
+
+
+/*----------------------------------------------------------------------*/
+/*  MBRLEN: size_t mbrlen (const char *s, size_t n, mbstate_t *ps)	*/
+/*----------------------------------------------------------------------*/
+
+typedef struct
+{
+  struct
+  {
+    int s_flg;
+    char s[MBSSIZE];
+    size_t n;
+    int t_flg;
+    int t_init;
+  }
+  seq[WCSTOK_SEQNUM];
+}
+TIN_MBRLEN_REC;
+
+typedef TEX_ERRET_REC_SEQ (size_t, MBRLEN_SEQNUM) TEX_MBRLEN_REC;
+TMD_RECHEAD (MBRLEN);
+
+
+/*----------------------------------------------------------------------*/
+/*  MBRTOWC: size_t mbrtowc (wchar_t *pwc, const char *s, size_t n,	*/
+/*			     mbstate_t *ps)				*/
+/*----------------------------------------------------------------------*/
+
+typedef struct
+{
+  struct
+  {
+    int w_flg;
+    int s_flg;
+    char s[MBSSIZE];
+    size_t n;
+    int t_flg;
+    int t_init;
+  }
+  seq[MBRTOWC_SEQNUM];
+}
+TIN_MBRTOWC_REC;
+
+typedef struct
+{
+  struct
+  {
+    TMD_ERRET (size_t);
+    wchar_t wc;
+  }
+  seq[MBRTOWC_SEQNUM];
+}
+TEX_MBRTOWC_REC;
+
+TMD_RECHEAD (MBRTOWC);
+
+
+/*----------------------------------------------------------------------*/
+/*  MBSRTOWCS: size_t mbsrtowcs (wchar_t *ws, const char **s, size_t n, */
+/*				 mbstate_t *ps )			*/
+/*----------------------------------------------------------------------*/
+
+typedef struct
+{
+  struct
+  {
+    int w_flg;
+    char s[MBSSIZE];
+    size_t n;
+    int t_flg;
+    int t_init;
+  }
+  seq[MBSRTOWCS_SEQNUM];
+}
+TIN_MBSRTOWCS_REC;
+
+typedef struct
+{
+  struct
+  {
+    TMD_ERRET (size_t);
+    wchar_t ws[WCSSIZE];
+  }
+  seq[MBSRTOWCS_SEQNUM];
+}
+TEX_MBSRTOWCS_REC;
+
+TMD_RECHEAD (MBSRTOWCS);
+
+
+/*----------------------------------------------------------------------*/
+/*  MBSTOWCS: size_t mbstowcs (wchar_t *ws, const char *s, size_t n)	*/
+/*----------------------------------------------------------------------*/
+
+typedef struct
+{
+  struct
+  {
+    int w_flg;
+    int s_flg;
+    const char *s;
+    size_t n;
+  }
+  seq[MBSTOWCS_SEQNUM];
+}
+TIN_MBSTOWCS_REC;
+
+typedef TEX_MBSRTOWCS_REC TEX_MBSTOWCS_REC;
+/* MBSRTOWCS_SEQNUM == MBSTOWCS_SEQNUM */
+TMD_RECHEAD (MBSTOWCS);
+
+
+/*----------------------------------------------------------------------*/
+/*  MBTOWC: int mbtowc (wchar_t *wc, const char *s, size_t n)		*/
+/*----------------------------------------------------------------------*/
+
+typedef TIN_MBSTOWCS_REC TIN_MBTOWC_REC;
+/* MBTOWC_SEQNUM == MBSTOWCS_SEQNUM */
+
+typedef struct
+{
+  struct
+  {
+    TMD_ERRET (int);
+    wchar_t wc;
+  }
+  seq[MBTOWC_SEQNUM];
+}
+TEX_MBTOWC_REC;
+
+TMD_RECHEAD (MBTOWC);
+
+
+/*----------------------------------------------------------------------*/
+/*  STRCOLL: int strcoll (const char *s1, const char *s2)		*/
+/*----------------------------------------------------------------------*/
+
+typedef struct
+{
+  char s1[MBSSIZE];
+  char s2[MBSSIZE];
+}
+TIN_STRCOLL_REC;
+
+typedef TEX_ERRET_REC (int) TEX_STRCOLL_REC;
+TMD_RECHEAD (STRCOLL);
+
+
+/*----------------------------------------------------------------------*/
+/*  STRFMON: size_t strfmon (char *buf, size_t nbytes,			*/
+/*			     const char *fmt, ... )			*/
+/*----------------------------------------------------------------------*/
+
+typedef struct
+{
+  int nbytes;
+  char fmt[MONFMTSIZE];
+  double val;
+}
+TIN_STRFMON_REC;
+
+typedef struct
+{
+  TMD_ERRET (size_t);
+  char mon[MONSIZE];
+}
+TEX_STRFMON_REC;
+
+TMD_RECHEAD (STRFMON);
+
+
+/*----------------------------------------------------------------------*/
+/*  STRXFRM: size_t strxfrm (char *s1, const char *s2, size_t n)	*/
+/*----------------------------------------------------------------------*/
+
+typedef struct
+{
+  char org1[MBSSIZE];
+  char org2[MBSSIZE];
+  size_t n1, n2;
+}
+TIN_STRXFRM_REC;
+
+typedef TEX_ERRET_REC (size_t) TEX_STRXFRM_REC;	/* only for org2[] */
+TMD_RECHEAD (STRXFRM);
+
+
+/*----------------------------------------------------------------------*/
+/*  SWSCANF: int swscanf (const wchar_t *ws, const wchar_t *fmt, ...)	*/
+/*----------------------------------------------------------------------*/
+
+typedef struct
+{
+  wchar_t ws[WCSSIZE * 3];
+  wchar_t fmt[WCSSIZE * 3];
+  int wch;
+}
+TIN_SWSCANF_REC;
+
+typedef struct
+{
+  TMD_ERRET (int);
+  int val_int;		/* %d */
+  unsigned val_uns;	/* %u */
+  float val_flt;		/* %f */
+  int val_c;		/* %c */
+  char val_s[MBSSIZE * 2];	/* %s */
+  wchar_t val_S[WCSSIZE * 2];	/* %lc, %ls, %C, %S */
+}
+TEX_SWSCANF_REC;
+
+TMD_RECHEAD (SWSCANF);
+
+
+/*----------------------------------------------------------------------*/
+/*  TOWCTRANS: wint_t towctrans (wint_t wc, wctrans_t desc)		*/
+/*----------------------------------------------------------------------*/
+
+typedef TIN_ISWCTYPE_REC TIN_TOWCTRANS_REC;
+typedef TEX_ERRET_REC (wint_t) TEX_TOWCTRANS_REC;
+TMD_RECHEAD (TOWCTRANS);
+
+
+/*----------------------------------------------------------------------*/
+/*  TOW*ER: wint_t tow*er (wint_t wc)					*/
+/*----------------------------------------------------------------------*/
+
+TST_TOW_STRUCT (LOWER, lower);
+TST_TOW_STRUCT (UPPER, upper);
+
+
+/*----------------------------------------------------------------------*/
+/*  WCRTOMB: wchar_t wcrtomb (char *s, wchar_t wc, mbstate_t *ps)	*/
+/*----------------------------------------------------------------------*/
+
+typedef struct
+{
+  int s_flg;
+  wchar_t wc;
+  int t_flg;
+  int t_init;
+}
+TIN_WCRTOMB_REC;
+
+typedef struct
+{
+  TMD_ERRET (wchar_t);
+  char s[MBSSIZE];
+}
+TEX_WCRTOMB_REC;
+
+TMD_RECHEAD (WCRTOMB);
+
+
+/*----------------------------------------------------------------------*/
+/*  WCSCAT: wchar_t *wcscat (wchar_t *ws1, wchar_t *ws2)		*/
+/*----------------------------------------------------------------------*/
+
+typedef struct
+{
+  wchar_t ws1[WCSSIZE];
+  wchar_t ws2[WCSSIZE];
+}
+TIN_WCSCAT_REC;
+
+typedef struct
+{
+  TMD_ERRET (wchar_t *);
+  wchar_t ws[WCSSIZE];
+}
+TEX_WCSCAT_REC;
+
+TMD_RECHEAD (WCSCAT);
+
+
+/*----------------------------------------------------------------------*/
+/*  WCSCHR: wchar_t *wcschr (wchar_t *ws, wchar_t wc);			*/
+/*----------------------------------------------------------------------*/
+
+typedef struct
+{
+  wchar_t ws[WCSSIZE];
+  wchar_t wc;
+}
+TIN_WCSCHR_REC;
+
+typedef TEX_ERRET_REC (wchar_t *) TEX_WCSCHR_REC;
+TMD_RECHEAD (WCSCHR);
+
+
+/*----------------------------------------------------------------------*/
+/*  WCSCMP: int wcscmp (const wchar_t *ws1, const wchar_t *ws2)		*/
+/*----------------------------------------------------------------------*/
+
+typedef TIN_WCSCAT_REC TIN_WCSCMP_REC;
+typedef TEX_ERRET_REC (int) TEX_WCSCMP_REC;
+TMD_RECHEAD (WCSCMP);
+
+
+/*----------------------------------------------------------------------*/
+/*  WCSCOLL: int wcscoll (const wchar_t *ws1, const wchar_t *ws2)	*/
+/*----------------------------------------------------------------------*/
+
+typedef TIN_WCSCMP_REC TIN_WCSCOLL_REC;
+typedef struct
+{
+  TMD_ERRET (int);
+  int cmp_flg;
+}
+TEX_WCSCOLL_REC;
+TMD_RECHEAD (WCSCOLL);
+
+
+/*----------------------------------------------------------------------*/
+/*  WCSCPY: wchar_t *wcscpy (wchar_t *ws1, const wchar_t *ws2)		*/
+/*----------------------------------------------------------------------*/
+
+typedef struct
+{
+  wchar_t ws[WCSSIZE];	/* ws2: original string */
+}
+TIN_WCSCPY_REC;
+
+typedef TEX_WCSCAT_REC TEX_WCSCPY_REC;
+TMD_RECHEAD (WCSCPY);
+
+
+/*----------------------------------------------------------------------*/
+/*  WCSCSPN: size_t wcscspn (const wchar_t *ws1, const wchar_t *ws2)	*/
+/*----------------------------------------------------------------------*/
+
+typedef TIN_WCSCAT_REC TIN_WCSCSPN_REC;
+typedef TEX_ERRET_REC (size_t) TEX_WCSCSPN_REC;
+TMD_RECHEAD (WCSCSPN);
+
+
+/*----------------------------------------------------------------------*/
+/*  WCSLEN: size_t wcslen (const wchar_t *ws)				*/
+/*----------------------------------------------------------------------*/
+
+typedef TIN_WCSCPY_REC TIN_WCSLEN_REC;
+typedef TEX_ERRET_REC (size_t) TEX_WCSLEN_REC;
+TMD_RECHEAD (WCSLEN);
+
+
+/*----------------------------------------------------------------------*/
+/*  WCSNCAT: wchar_t *wcsncat (wchar_t *ws1, const wchar_t *ws2,	*/
+/*			       size_t n)				*/
+/*----------------------------------------------------------------------*/
+
+typedef struct
+{
+  wchar_t ws1[WCSSIZE];
+  wchar_t ws2[WCSSIZE];
+  size_t n;
+}
+TIN_WCSNCAT_REC;
+
+typedef TEX_WCSCAT_REC TEX_WCSNCAT_REC;
+TMD_RECHEAD (WCSNCAT);
+
+
+/*----------------------------------------------------------------------*/
+/*  WCSNCMP: int *wcsncmp (const wchar_t *ws1, const wchar_t *ws2,	*/
+/*			   size_t n)					*/
+/*----------------------------------------------------------------------*/
+
+typedef TIN_WCSNCAT_REC TIN_WCSNCMP_REC;
+typedef TEX_ERRET_REC (int) TEX_WCSNCMP_REC;
+TMD_RECHEAD (WCSNCMP);
+
+
+/*----------------------------------------------------------------------*/
+/*  WCSNCPY: wchar_t *wcsncpy (wchar_t *ws1, const wchar_t *ws2,	*/
+/*			       size_t n)				*/
+/*----------------------------------------------------------------------*/
+
+typedef struct
+{
+  wchar_t ws[WCSSIZE];	/* ws2: original string */
+  size_t n;
+}
+TIN_WCSNCPY_REC;
+
+typedef TEX_WCSCPY_REC TEX_WCSNCPY_REC;
+TMD_RECHEAD (WCSNCPY);
+
+
+/*----------------------------------------------------------------------*/
+/*  WCSPBRK: wchar_t *wcspbrk (const wchar_t *ws1, const wchar_t *ws2)	*/
+/*----------------------------------------------------------------------*/
+
+typedef TIN_WCSCSPN_REC TIN_WCSPBRK_REC;
+
+typedef struct
+{
+  TMD_ERRET (wchar_t *);
+  wchar_t wc;
+}
+TEX_WCSPBRK_REC;
+
+TMD_RECHEAD (WCSPBRK);
+
+
+/*----------------------------------------------------------------------*/
+/*  WCSRTOMBS: size_t wcsrtombs (char *s, const wchar_t **ws, size_t n, */
+/*				 mbstate_t *ps)				*/
+/*----------------------------------------------------------------------*/
+
+typedef struct
+{
+  int s_flg;
+  int w_flg;		/* don't need this */
+  wchar_t ws[WCSSIZE];
+  size_t n;
+  int t_flg;
+  int t_init;
+}
+TIN_WCSRTOMBS_REC;
+
+typedef struct
+{
+  TMD_ERRET (size_t);
+  char s[MBSSIZE];
+}
+TEX_WCSRTOMBS_REC;
+
+TMD_RECHEAD (WCSRTOMBS);
+
+
+/*----------------------------------------------------------------------*/
+/*  WCSSPN: size_t wcsspn (const wchar_t *ws1, const wchar_t *ws2)	*/
+/*----------------------------------------------------------------------*/
+
+typedef TIN_WCSCSPN_REC TIN_WCSSPN_REC;
+typedef TEX_WCSCSPN_REC TEX_WCSSPN_REC;
+TMD_RECHEAD (WCSSPN);
+
+
+/*----------------------------------------------------------------------*/
+/*  WCSSTR: wchar_t *wcsstr (const wchar_t *ws1, const wchar_t *ws2)	*/
+/*----------------------------------------------------------------------*/
+
+typedef TIN_WCSCSPN_REC TIN_WCSSTR_REC;
+typedef TEX_ERRET_REC (wchar_t *) TEX_WCSSTR_REC;
+TMD_RECHEAD (WCSSTR);
+
+
+/*----------------------------------------------------------------------*/
+/*  WCSTOD: double wcstod (const wchar_t *np, wchar_t **endp)		*/
+/*----------------------------------------------------------------------*/
+
+typedef struct
+{
+  wchar_t np[WCSSIZE];
+}
+TIN_WCSTOD_REC;
+
+typedef struct
+{
+  TMD_ERRET (double);
+  double val;
+  wchar_t fwc;
+}
+TEX_WCSTOD_REC;
+
+TMD_RECHEAD (WCSTOD);
+
+
+/*----------------------------------------------------------------------*/
+/*  WCSTOK: wchar_t *wcstok (wchar_t *ws, const wchar_t *dlm,		*/
+/*			     wchar_t **pt)				*/
+/*----------------------------------------------------------------------*/
+
+typedef struct
+{
+  struct
+  {
+    int w_flg;
+    wchar_t ws[WCSSIZE];
+    wchar_t dt[WCSSIZE];	/* delimiter */
+  }
+  seq[WCSTOK_SEQNUM];
+}
+TIN_WCSTOK_REC;
+
+typedef struct
+{
+  struct
+  {
+    TMD_ERRET (wchar_t *);
+    wchar_t ws[WCSSIZE];
+  }
+  seq[WCSTOK_SEQNUM];
+}
+TEX_WCSTOK_REC;
+
+TMD_RECHEAD (WCSTOK);
+
+
+/*----------------------------------------------------------------------*/
+/*  WCSTOMBS: size_t wcstombs (char s, const wchar_t *ws, size_t n)	*/
+/*----------------------------------------------------------------------*/
+
+typedef struct
+{
+  int s_flg;
+  int w_flg;		/* currently we don't need it. */
+  wchar_t ws[WCSSIZE];
+  size_t n;
+}
+TIN_WCSTOMBS_REC;
+
+typedef struct
+{
+  TMD_ERRET (size_t);
+  char s[MBSSIZE];
+}
+TEX_WCSTOMBS_REC;
+
+TMD_RECHEAD (WCSTOMBS);
+
+
+/*----------------------------------------------------------------------*/
+/*  WCSWIDTH: int wcswidth (const wchar_t *ws, size_t n)		*/
+/*----------------------------------------------------------------------*/
+
+typedef TIN_WCSNCPY_REC TIN_WCSWIDTH_REC;
+typedef TEX_ERRET_REC (int) TEX_WCSWIDTH_REC;
+TMD_RECHEAD (WCSWIDTH);
+
+
+/*----------------------------------------------------------------------*/
+/*  WCSXFRM: size_t wcsxfrm (wchar_t *ws1, const wchar_t *ws2, size_t n)*/
+/*----------------------------------------------------------------------*/
+
+typedef struct
+{
+  wchar_t org1[WCSSIZE];
+  wchar_t org2[WCSSIZE];
+  int n1, n2;
+}
+TIN_WCSXFRM_REC;
+
+typedef TEX_ERRET_REC (size_t) TEX_WCSXFRM_REC;	/* only for org2[] */
+TMD_RECHEAD (WCSXFRM);
+
+
+/*----------------------------------------------------------------------*/
+/*  WCTOB: int wctob (wint_t wc)					*/
+/*----------------------------------------------------------------------*/
+
+typedef struct
+{
+  wint_t wc;
+}
+TIN_WCTOB_REC;
+
+typedef TEX_ERRET_REC (int) TEX_WCTOB_REC;
+TMD_RECHEAD (WCTOB);
+
+
+/*----------------------------------------------------------------------*/
+/*  WCTOMB: int wctomb (char *s, wchar_t wc)				*/
+/*----------------------------------------------------------------------*/
+
+typedef struct
+{
+  int s_flg;
+  wchar_t wc;
+}
+TIN_WCTOMB_REC;
+
+typedef struct
+{
+  TMD_ERRET (int);
+  char s[MBSSIZE];
+}
+TEX_WCTOMB_REC;
+
+TMD_RECHEAD (WCTOMB);
+
+
+/*----------------------------------------------------------------------*/
+/*  WCTRANS: wctrans_t wctrans (const char *charclass)			*/
+/*----------------------------------------------------------------------*/
+
+typedef struct
+{
+  char class[MBSSIZE];
+}
+TIN_WCTRANS_REC;
+
+typedef TEX_ERRET_REC (wctrans_t) TEX_WCTRANS_REC;
+TMD_RECHEAD (WCTRANS);
+
+
+/*----------------------------------------------------------------------*/
+/*  WCTYPE: wctype_t wctype (const char *class)				*/
+/*----------------------------------------------------------------------*/
+
+typedef TIN_WCTRANS_REC TIN_WCTYPE_REC;
+typedef TEX_ERRET_REC (wctype_t) TEX_WCTYPE_REC;
+TMD_RECHEAD (WCTYPE);
+
+
+/*----------------------------------------------------------------------*/
+/*  WCWIDTH: int wcwidth (wchar_t wc)					*/
+/*----------------------------------------------------------------------*/
+
+typedef struct
+{
+  wchar_t wc;
+}
+TIN_WCWIDTH_REC;
+
+typedef TEX_ERRET_REC (int) TEX_WCWIDTH_REC;
+TMD_RECHEAD (WCWIDTH);
+
+#endif /* TST_TYPES_H */
diff --git a/ap/build/uClibc/test/locale-mbwc/tst_wcrtomb.c b/ap/build/uClibc/test/locale-mbwc/tst_wcrtomb.c
new file mode 100644
index 0000000..0029a49
--- /dev/null
+++ b/ap/build/uClibc/test/locale-mbwc/tst_wcrtomb.c
@@ -0,0 +1,79 @@
+/*
+  WCRTOMB: wchar_t wcrtomb (char *s, wchar_t wc, mbstate_t *ps)
+*/
+
+#define TST_FUNCTION wcrtomb
+
+#include "tsp_common.c"
+#include "dat_wcrtomb.c"
+
+
+int
+tst_wcrtomb (FILE * fp, int debug_flg)
+{
+  TST_DECL_VARS (wchar_t);
+  wchar_t wc;
+  char s[MBSSIZE], *s_in, *s_ex;
+  char t_flg, t_ini;
+  static mbstate_t t = { 0 };
+  mbstate_t *pt;
+  int err, i;
+
+  TST_DO_TEST (wcrtomb)
+  {
+    TST_HEAD_LOCALE (wcrtomb, S_WCRTOMB);
+    TST_DO_REC (wcrtomb)
+    {
+      TST_GET_ERRET (wcrtomb);
+      s_in = ((TST_INPUT (wcrtomb).s_flg) == 0) ? (char *) NULL : s;
+      wc = TST_INPUT (wcrtomb).wc;
+      t_flg = TST_INPUT (wcrtomb).t_flg;
+      t_ini = TST_INPUT (wcrtomb).t_init;
+      pt = (t_flg == 0) ? NULL : &t;
+
+      if (t_ini != 0)
+	{
+	  memset (&t, 0, sizeof (t));
+	}
+
+      TST_CLEAR_ERRNO;
+      ret = wcrtomb (s_in, wc, pt);
+      TST_SAVE_ERRNO;
+
+      if (debug_flg)
+	{
+	  fprintf (stdout, "wcrtomb() [ %s : %d ] ret = %lu\n", locale,
+		   rec + 1, (unsigned long int) ret);
+	  fprintf (stdout, "			errno = %d\n", errno_save);
+	}
+
+      TST_IF_RETURN (S_WCRTOMB)
+      {
+      };
+
+      s_ex = TST_EXPECT (wcrtomb).s;
+
+      if (s_in)
+	{
+	  for (i = 0, err = 0; *(s_ex + i) != 0 && i < MBSSIZE; i++)
+	    {
+	      if (s_in[i] != s_ex[i])
+		{
+		  err++;
+		  err_count++;
+		  Result (C_FAILURE, S_WCRTOMB, CASE_4,
+			  "copied string is different from an "
+			  "expected string");
+		  break;
+		}
+	    }
+	  if (!err)
+	    {
+	      Result (C_SUCCESS, S_WCRTOMB, CASE_4, MS_PASSED);
+	    }
+	}
+    }
+  }
+
+  return err_count;
+}
diff --git a/ap/build/uClibc/test/locale-mbwc/tst_wcscat.c b/ap/build/uClibc/test/locale-mbwc/tst_wcscat.c
new file mode 100644
index 0000000..3dc9809
--- /dev/null
+++ b/ap/build/uClibc/test/locale-mbwc/tst_wcscat.c
@@ -0,0 +1,78 @@
+/*
+  WCSCAT: wchar_t *wcscat (wchar_t *ws1, const wchar_t *ws2);
+*/
+
+#define TST_FUNCTION wcscat
+
+#include "tsp_common.c"
+#include "dat_wcscat.c"
+
+int
+tst_wcscat (FILE * fp, int debug_flg)
+{
+  TST_DECL_VARS (wchar_t *);
+  wchar_t *ws1, *ws2, *ws_ex;
+  int i, err;
+
+  TST_DO_TEST (wcscat)
+  {
+    TST_HEAD_LOCALE (wcscat, S_WCSCAT);
+    TST_DO_REC (wcscat)
+    {
+      TST_GET_ERRET (wcscat);
+      ws1 = TST_INPUT (wcscat).ws1;	/* external value: size WCSSIZE */
+      ws2 = TST_INPUT (wcscat).ws2;
+
+      TST_CLEAR_ERRNO;
+      ret = wcscat (ws1, ws2);
+      TST_SAVE_ERRNO;
+
+      TST_IF_RETURN (S_WCSCAT)
+      {
+	if (ret == ws1)
+	  {
+	    Result (C_SUCCESS, S_WCSCAT, CASE_3, MS_PASSED);
+	  }
+	else
+	  {
+	    err_count++;
+	    Result (C_FAILURE, S_WCSCAT, CASE_3,
+		    "the return address may not be correct");
+	  }
+      }
+
+      /* function specific test cases here */
+
+      if (ret == ws1)
+	{
+	  ws_ex = TST_EXPECT (wcscat).ws;
+	  for (err = 0, i = 0;
+	       (ws1[i] != 0L || ws_ex[i] != 0L) && i < WCSSIZE; i++)
+	    {
+	      if (debug_flg)
+		{
+		  fprintf (stdout, "tst_wcscat() : ws1[%d] = 0x%lx\n", i,
+			   (unsigned long int) ws1[i]);
+		}
+
+	      if (ws1[i] != ws_ex[i])
+		{
+		  err++;
+		  err_count++;
+		  Result (C_FAILURE, S_WCSCAT, CASE_4,
+			  "concatinated string is different from an "
+			  "expected string");
+		  break;
+		}
+	    }
+
+	  if (!err)
+	    {
+	      Result (C_SUCCESS, S_WCSCAT, CASE_4, MS_PASSED);
+	    }
+	}
+    }
+  }
+
+  return err_count;
+}
diff --git a/ap/build/uClibc/test/locale-mbwc/tst_wcschr.c b/ap/build/uClibc/test/locale-mbwc/tst_wcschr.c
new file mode 100644
index 0000000..b57a05a
--- /dev/null
+++ b/ap/build/uClibc/test/locale-mbwc/tst_wcschr.c
@@ -0,0 +1,70 @@
+/*
+  WCSCHR: wchar_t *wcschr (wchar_t *ws, wchar_t wc);
+*/
+
+#define TST_FUNCTION wcschr
+
+#include "tsp_common.c"
+#include "dat_wcschr.c"
+
+int
+tst_wcschr (FILE * fp, int debug_flg)
+{
+  TST_DECL_VARS (wchar_t *);
+  wchar_t *ws, wc;
+
+  TST_DO_TEST (wcschr)
+  {
+    TST_HEAD_LOCALE (wcschr, S_WCSCHR);
+    TST_DO_REC (wcschr)
+    {
+      TST_GET_ERRET (wcschr);
+      ws = TST_INPUT (wcschr).ws;	/* external value: size WCSSIZE */
+      wc = TST_INPUT (wcschr).wc;
+      ret = wcschr (ws, wc);
+
+      if (debug_flg)
+	{
+	  if (ret)
+	    {
+	      fprintf (stderr, "wcschr: ret = 0x%lx\n",
+		       (unsigned long int) *ret);
+	    }
+	  else
+	    {
+	      fprintf (stderr, "wcschr: ret = NULL pointer\n");
+	    }
+	}
+
+      TST_IF_RETURN (S_WCSCHR)
+      {
+	if (ret == NULL)
+	  {
+	    if (debug_flg)
+	      {
+		fprintf (stderr, "*** Warning *** tst_wcschr: "
+			 "set ret_flg=1 to check NULL return value\n");
+	      }
+
+	    warn_count++;
+	    Result (C_INVALID, S_WCSCHR, CASE_3, "(check the test data) "
+		    "set ret_flg=1 to check NULL return value");
+	    continue;
+	  }
+
+	if (*ret == wc)
+	  {
+	    Result (C_SUCCESS, S_WCSCHR, CASE_3, MS_PASSED);
+	  }
+	else
+	  {
+	    err_count++;
+	    Result (C_FAILURE, S_WCSCHR, CASE_3,
+		    "the returned address of the string seems to be wrong");
+	  }
+      }
+    }
+  }
+
+  return err_count;
+}
diff --git a/ap/build/uClibc/test/locale-mbwc/tst_wcscmp.c b/ap/build/uClibc/test/locale-mbwc/tst_wcscmp.c
new file mode 100644
index 0000000..594682c
--- /dev/null
+++ b/ap/build/uClibc/test/locale-mbwc/tst_wcscmp.c
@@ -0,0 +1,40 @@
+/*
+  WCSCMP: int wcscmp (const wchar_t *ws1, const wchar_t *ws2);
+*/
+
+#define TST_FUNCTION wcscmp
+
+#include "tsp_common.c"
+#include "dat_wcscmp.c"
+
+
+int
+tst_wcscmp (FILE * fp, int debug_flg)
+{
+  TST_DECL_VARS (int);
+  wchar_t *ws1, *ws2;
+
+  TST_DO_TEST (wcscmp)
+  {
+    TST_HEAD_LOCALE (wcscmp, S_WCSCMP);
+    TST_DO_REC (wcscmp)
+    {
+      TST_GET_ERRET (wcscmp);
+      ws1 = TST_INPUT (wcscmp).ws1;
+      ws2 = TST_INPUT (wcscmp).ws2;
+      ret = wcscmp (ws1, ws2);
+      ret = (ret > 0 ? 1 : ret < 0 ? -1 : 0);
+
+      if (debug_flg)
+	{
+	  fprintf (stderr, "tst_wcscmp: ret = %d\n", ret);
+	}
+
+      TST_IF_RETURN (S_WCSCMP)
+      {
+      };
+    }
+  }
+
+  return err_count;
+}
diff --git a/ap/build/uClibc/test/locale-mbwc/tst_wcscoll.c b/ap/build/uClibc/test/locale-mbwc/tst_wcscoll.c
new file mode 100644
index 0000000..929f80d
--- /dev/null
+++ b/ap/build/uClibc/test/locale-mbwc/tst_wcscoll.c
@@ -0,0 +1,76 @@
+/*
+  WCSCOLL: int wcscoll (const wchar_t *ws1, const wchar_t *ws2);
+*/
+
+#define TST_FUNCTION wcscoll
+
+#include "tsp_common.c"
+#include "dat_wcscoll.c"
+
+int
+tst_wcscoll (FILE * fp, int debug_flg)
+{
+  TST_DECL_VARS (int);
+  wchar_t *ws1, *ws2;
+  int cmp;
+
+  TST_DO_TEST (wcscoll)
+  {
+    TST_HEAD_LOCALE (wcscoll, S_WCSCOLL);
+    TST_DO_REC (wcscoll)
+    {
+      TST_GET_ERRET (wcscoll);
+      ws1 = TST_INPUT (wcscoll).ws1;	/* external value: size WCSSIZE */
+      ws2 = TST_INPUT (wcscoll).ws2;
+
+      TST_CLEAR_ERRNO;
+      ret = wcscoll (ws1, ws2);
+      TST_SAVE_ERRNO;
+
+      if (debug_flg)
+	{
+	  fprintf (stderr, "tst_wcscoll: ret = %d\n", ret);
+	}
+
+      cmp = TST_EXPECT (wcscoll).cmp_flg;
+      TST_IF_RETURN (S_WCSCOLL)
+      {
+	if (cmp != 0)
+	  {
+	    if ((cmp == 1 && ret > 0) || (cmp == -1 && ret < 0))
+	      {
+		Result (C_SUCCESS, S_WCSCOLL, CASE_3, MS_PASSED);
+	      }
+	    else
+	      {
+		err_count++;
+		if (cmp == 1)
+		  {
+		    if (ret == 0)
+		      Result (C_FAILURE, S_WCSCOLL, CASE_3,
+			      "the return value should be positive"
+			      " but it's zero.");
+		    else
+		      Result (C_FAILURE, S_WCSCOLL, CASE_3,
+			      "the return value should be positive"
+			      " but it's negative.");
+		  }
+		else
+		  {
+		    if (ret == 0)
+		      Result (C_FAILURE, S_WCSCOLL, CASE_3,
+			      "the return value should be negative"
+			      " but it's zero.");
+		    else
+		      Result (C_FAILURE, S_WCSCOLL, CASE_3,
+			      "the return value should be negative"
+			      " but it's positive.");
+		  }
+	      }
+	  }
+      }
+    }
+  }
+
+  return err_count;
+}
diff --git a/ap/build/uClibc/test/locale-mbwc/tst_wcscpy.c b/ap/build/uClibc/test/locale-mbwc/tst_wcscpy.c
new file mode 100644
index 0000000..d5705a5
--- /dev/null
+++ b/ap/build/uClibc/test/locale-mbwc/tst_wcscpy.c
@@ -0,0 +1,85 @@
+/*-------------------------------------------------------------------------------------*/
+/* WCSCPY: wchar_t *wcscpy( wchar_t *ws1, const wchar_t *ws2 )			       */
+/*-------------------------------------------------------------------------------------*/
+#define TST_FUNCTION wcscpy
+
+#include "tsp_common.c"
+#include "dat_wcscpy.c"
+
+int
+tst_wcscpy (FILE * fp, int debug_flg)
+{
+  TST_DECL_VARS (wchar_t *);
+  wchar_t ws1[WCSSIZE], *ws2, *ws_ex;
+  int err, i;
+
+  TST_DO_TEST (wcscpy)
+  {
+    TST_HEAD_LOCALE (wcscpy, S_WCSCPY);
+    TST_DO_REC (wcscpy)
+    {
+      TST_GET_ERRET (wcscpy);
+      ws2 = TST_INPUT (wcscpy).ws;	/* external value: size WCSSIZE */
+      ret = wcscpy (ws1, ws2);
+
+      TST_IF_RETURN (S_WCSCPY)
+      {
+	if (ret == ws1)
+	  {
+	    Result (C_SUCCESS, S_WCSCPY, CASE_3, MS_PASSED);
+	  }
+	else
+	  {
+	    err_count++;
+	    Result (C_FAILURE, S_WCSCPY, CASE_3,
+		    "the return address may not be correct");
+	  }
+      }
+
+      if (ret == ws1)
+	{
+	  ws_ex = TST_EXPECT (wcscpy).ws;
+
+	  for (err = 0, i = 0;
+	       (ws1[i] != 0L || ws_ex[i] != 0L) && i < WCSSIZE; i++)
+	    {
+	      if (debug_flg)
+		{
+		  fprintf (stderr,
+			   "ws1[ %d ] = 0x%lx <-> wx_ex[ %d ] = 0x%lx\n", i,
+			   (unsigned long int) ws1[i], i,
+			   (unsigned long int) ws_ex[i]);
+		}
+
+	      if (ws1[i] != ws_ex[i])
+		{
+		  err++;
+		  err_count++;
+		  Result (C_FAILURE, S_WCSCPY, CASE_4,
+			  "copied string is different from an"
+			  " expected string");
+		  break;
+		}
+	    }
+
+	  if (!err)
+	    {
+	      Result (C_SUCCESS, S_WCSCPY, CASE_4, MS_PASSED);
+	    }
+
+	  if (ws1[i] == 0L)
+	    {
+	      Result (C_SUCCESS, S_WCSCPY, CASE_5, MS_PASSED);
+	    }
+	  else
+	    {
+	      err_count++;
+	      Result (C_FAILURE, S_WCSCPY, CASE_5,
+		      "copied string is not null-terminated");
+	    }
+	}
+    }
+  }
+
+  return err_count;
+}
diff --git a/ap/build/uClibc/test/locale-mbwc/tst_wcscspn.c b/ap/build/uClibc/test/locale-mbwc/tst_wcscspn.c
new file mode 100644
index 0000000..e1c8892
--- /dev/null
+++ b/ap/build/uClibc/test/locale-mbwc/tst_wcscspn.c
@@ -0,0 +1,38 @@
+/*
+  WCSCSPN: size_t wcscspn (const wchar_t *ws1, const wchar_t *ws2);
+*/
+
+#define TST_FUNCTION wcscspn
+
+#include "tsp_common.c"
+#include "dat_wcscspn.c"
+
+int
+tst_wcscspn (FILE * fp, int debug_flg)
+{
+  TST_DECL_VARS (size_t);
+  wchar_t *ws1, *ws2;
+
+  TST_DO_TEST (wcscspn)
+  {
+    TST_HEAD_LOCALE (wcscspn, S_WCSCSPN);
+    TST_DO_REC (wcscspn)
+    {
+      TST_GET_ERRET (wcscspn);
+      ws1 = TST_INPUT (wcscspn).ws1;
+      ws2 = TST_INPUT (wcscspn).ws2;	/* external value: size WCSSIZE */
+      ret = wcscspn (ws1, ws2);
+
+      if (debug_flg)
+	{
+	  fprintf (stderr, "wcscspn: ret = %zu\n", ret);
+	}
+
+      TST_IF_RETURN (S_WCSCSPN)
+      {
+      };
+    }
+  }
+
+  return err_count;
+}
diff --git a/ap/build/uClibc/test/locale-mbwc/tst_wcslen.c b/ap/build/uClibc/test/locale-mbwc/tst_wcslen.c
new file mode 100644
index 0000000..d0ffa5a
--- /dev/null
+++ b/ap/build/uClibc/test/locale-mbwc/tst_wcslen.c
@@ -0,0 +1,31 @@
+/*
+  WCSLEN: size_t wcslen (const wchar_t *ws);
+*/
+
+#define TST_FUNCTION wcslen
+
+#include "tsp_common.c"
+#include "dat_wcslen.c"
+
+int
+tst_wcslen (FILE * fp, int debug_flg)
+{
+  TST_DECL_VARS (size_t);
+  wchar_t *ws;
+
+  TST_DO_TEST (wcslen)
+  {
+    TST_HEAD_LOCALE (wcslen, S_WCSLEN);
+    TST_DO_REC (wcslen)
+    {
+      TST_GET_ERRET (wcslen);
+      ws = TST_INPUT (wcslen).ws;
+      ret = wcslen (ws);
+      TST_IF_RETURN (S_WCSLEN)
+      {
+      };
+    }
+  }
+
+  return err_count;
+}
diff --git a/ap/build/uClibc/test/locale-mbwc/tst_wcsncat.c b/ap/build/uClibc/test/locale-mbwc/tst_wcsncat.c
new file mode 100644
index 0000000..a2f6ba0
--- /dev/null
+++ b/ap/build/uClibc/test/locale-mbwc/tst_wcsncat.c
@@ -0,0 +1,75 @@
+/*
+  WCSNCAT: wchar_t *wcsncat (wchar_t *ws1, const wchar_t *ws2, size_t n);
+*/
+
+#define TST_FUNCTION wcsncat
+
+#include "tsp_common.c"
+#include "dat_wcsncat.c"
+
+int
+tst_wcsncat (FILE * fp, int debug_flg)
+{
+  TST_DECL_VARS (wchar_t *);
+  wchar_t *ws1, *ws2, *ws_ex;
+  int n, i, err;
+
+  TST_DO_TEST (wcsncat)
+  {
+    TST_HEAD_LOCALE (wcsncat, S_WCSNCAT);
+    TST_DO_REC (wcsncat)
+    {
+      TST_GET_ERRET (wcsncat);
+      ws1 = TST_INPUT (wcsncat).ws1;	/* external value: size WCSSIZE */
+      ws2 = TST_INPUT (wcsncat).ws2;
+      n = TST_INPUT (wcsncat).n;
+      ret = wcsncat (ws1, ws2, n);
+
+      TST_IF_RETURN (S_WCSNCAT)
+      {
+	if (ret == ws1)
+	  {
+	    Result (C_SUCCESS, S_WCSNCAT, CASE_3, MS_PASSED);
+	  }
+	else
+	  {
+	    err_count++;
+	    Result (C_FAILURE, S_WCSNCAT, CASE_3,
+		    "the return address may not be correct");
+	  }
+      }
+
+      if (ret == ws1)
+	{
+	  ws_ex = TST_EXPECT (wcsncat).ws;
+
+	  for (err = 0, i = 0;
+	       (ws1[i] != 0L || ws_ex[i] != 0L) && i < WCSSIZE; i++)
+	    {
+	      if (debug_flg)
+		{
+		  fprintf (stderr, "ws1[%d] = 0x%lx\n", i,
+			   (unsigned long int) ws1[i]);
+		}
+
+	      if (ws1[i] != ws_ex[i])
+		{
+		  err++;
+		  err_count++;
+		  Result (C_FAILURE, S_WCSNCAT, CASE_4,
+			  "the concatinated string has "
+			  "different value from an expected string");
+		  break;
+		}
+	    }
+
+	  if (!err)
+	    {
+	      Result (C_SUCCESS, S_WCSNCAT, CASE_4, MS_PASSED);
+	    }
+	}
+    }
+  }
+
+  return err_count;
+}
diff --git a/ap/build/uClibc/test/locale-mbwc/tst_wcsncmp.c b/ap/build/uClibc/test/locale-mbwc/tst_wcsncmp.c
new file mode 100644
index 0000000..d046ecd
--- /dev/null
+++ b/ap/build/uClibc/test/locale-mbwc/tst_wcsncmp.c
@@ -0,0 +1,40 @@
+/*-------------------------------------------------------------------------------------*/
+/* WCSNCMP: int wcsncmp( const wchar_t *ws1, const wchar_t *ws2, size_t n )	       */
+/*-------------------------------------------------------------------------------------*/
+
+#define TST_FUNCTION wcsncmp
+
+#include "tsp_common.c"
+#include "dat_wcsncmp.c"
+
+int
+tst_wcsncmp (FILE * fp, int debug_flg)
+{
+  TST_DECL_VARS (int);
+  wchar_t *ws1, *ws2;
+  size_t n;
+
+  TST_DO_TEST (wcsncmp)
+  {
+    TST_HEAD_LOCALE (wcsncmp, S_WCSNCMP);
+    TST_DO_REC (wcsncmp)
+    {
+      TST_GET_ERRET (wcsncmp);
+      ws1 = TST_INPUT (wcsncmp).ws1;	/* external value: size WCSSIZE */
+      ws2 = TST_INPUT (wcsncmp).ws2;
+      n = TST_INPUT (wcsncmp).n;
+      ret = wcsncmp (ws1, ws2, n);
+
+      if (debug_flg)
+	{
+	  fprintf (stderr, "tst_wcsncmp: ret = %d, 0x%x\n", ret, ret);
+	}
+
+      TST_IF_RETURN (S_WCSNCMP)
+      {
+      };
+    }
+  }
+
+  return err_count;
+}
diff --git a/ap/build/uClibc/test/locale-mbwc/tst_wcsncpy.c b/ap/build/uClibc/test/locale-mbwc/tst_wcsncpy.c
new file mode 100644
index 0000000..814bbc0
--- /dev/null
+++ b/ap/build/uClibc/test/locale-mbwc/tst_wcsncpy.c
@@ -0,0 +1,93 @@
+/*
+  WCSNCPY: wchar_t *wcsncpy (wchar_t *ws1, const wchar_t *ws2, size_t n);
+*/
+
+#define TST_FUNCTION wcsncpy
+
+#include "tsp_common.c"
+#include "dat_wcsncpy.c"
+
+#define WCSNUM_NCPY 7
+
+int
+tst_wcsncpy (FILE *fp, int debug_flg)
+{
+  TST_DECL_VARS (wchar_t *);
+  wchar_t ws1[WCSSIZE] =
+    { 0x9999, 0x9999, 0x9999, 0x9999, 0x9999, 0x9999, 0x0000 };
+  wchar_t *ws2, *ws_ex;
+  int err, i;
+  size_t n;
+
+  TST_DO_TEST (wcsncpy)
+  {
+    TST_HEAD_LOCALE (wcsncpy, S_WCSNCPY);
+    TST_DO_REC (wcsncpy)
+    {
+      TST_GET_ERRET (wcsncpy);
+
+      for (n = 0; n < WCSNUM_NCPY - 1; ++n)
+	{
+	  ws1[n] = 0x9999;
+	}
+
+      ws1[n] = 0;
+      ws2 = TST_INPUT (wcsncpy).ws;	/* external value: size WCSSIZE */
+      n = TST_INPUT (wcsncpy).n;
+      ret = wcsncpy (ws1, ws2, n);
+
+      TST_IF_RETURN (S_WCSNCPY)
+      {
+	if (ret == ws1)
+	  {
+	    Result (C_SUCCESS, S_WCSNCPY, CASE_3, MS_PASSED);
+	  }
+	else
+	  {
+	    err_count++;
+	    Result (C_FAILURE, S_WCSNCPY, CASE_3,
+		    "the return address may not be correct");
+	  }
+      }
+
+      if (ret == ws1)
+	{
+	  if (debug_flg)
+	    {
+	      fprintf (stderr, "\nwcsncpy: n = %zu\n\n", n);
+	    }
+
+	  ws_ex = TST_EXPECT (wcsncpy).ws;
+
+	  for (err = 0, i = 0; i < WCSNUM_NCPY && i < WCSSIZE; i++)
+	    {
+	      if (debug_flg)
+		fprintf (stderr,
+			 "wcsncpy: ws1[ %d ] = 0x%lx <-> wx_ex[ %d ] = 0x%lx\n",
+			 i, (unsigned long int) ws1[i], i,
+			 (unsigned long int) ws_ex[i]);
+
+	      if (ws1[i] != ws_ex[i])
+		{
+		  err++;
+		  err_count++;
+		  Result (C_FAILURE, S_WCSNCPY, CASE_4,
+			  "copied string is different from an "
+			  "expected string");
+		  break;
+		}
+	    }
+
+	  if (!err)
+	    {
+	      Result (C_SUCCESS, S_WCSNCPY, CASE_4, MS_PASSED);
+	    }
+
+	  /* A null terminate character is not supposed to be copied
+	     unless (num chars of ws2)<n. */
+	}
+    }
+  }
+
+  return err_count;
+}
diff --git a/ap/build/uClibc/test/locale-mbwc/tst_wcspbrk.c b/ap/build/uClibc/test/locale-mbwc/tst_wcspbrk.c
new file mode 100644
index 0000000..95c1c0f
--- /dev/null
+++ b/ap/build/uClibc/test/locale-mbwc/tst_wcspbrk.c
@@ -0,0 +1,80 @@
+/*
+  WCSPBRK: wchar_t *wcspbrk (const wchar_t *ws1, const wchar_t *ws2);
+*/
+
+#define TST_FUNCTION wcspbrk
+
+#include "tsp_common.c"
+#include "dat_wcspbrk.c"
+
+int
+tst_wcspbrk (FILE * fp, int debug_flg)
+{
+  TST_DECL_VARS (wchar_t *);
+  wchar_t *ws1, *ws2;
+  int err;
+  wchar_t wc_ex;
+
+  TST_DO_TEST (wcspbrk)
+  {
+    TST_HEAD_LOCALE (wcspbrk, S_WCSPBRK);
+    TST_DO_REC (wcspbrk)
+    {
+      TST_GET_ERRET (wcspbrk);
+      ws1 = TST_INPUT (wcspbrk).ws1;
+      ws2 = TST_INPUT (wcspbrk).ws2;
+
+      ret = wcspbrk (ws1, ws2);
+
+      if (debug_flg)
+	{
+	  fprintf (stdout, "wcspbrk() [ %s : %d ] ret = %s\n", locale,
+		   rec + 1, (ret == NULL) ? "null" : "not null");
+	  if (ret)
+	    fprintf (stderr,
+		     "			      ret[0] = 0x%lx : 0x%lx = ws2[0]\n",
+		     (unsigned long int) ret[0], (unsigned long int) ws2[0]);
+	}
+
+      TST_IF_RETURN (S_WCSPBRK)
+      {
+	if (ws2[0] == 0)
+	  {
+	    if (ret == ws1)
+	      {
+		Result (C_SUCCESS, S_WCSPBRK, CASE_3, MS_PASSED);
+	      }
+	    else
+	      {
+		err_count++;
+		Result (C_FAILURE, S_WCSPBRK, CASE_3,
+			"return address is not same address as ws1");
+	      }
+
+	    continue;
+	  }
+
+	wc_ex = TST_EXPECT (wcspbrk).wc;
+
+	if (debug_flg)
+	  fprintf (stdout,
+		   "			    *ret = 0x%lx <-> 0x%lx = wc_ex\n",
+		   (unsigned long int) *ret, (unsigned long int) wc_ex);
+
+	if (*ret != wc_ex)
+	  {
+	    err++;
+	    err_count++;
+	    Result (C_FAILURE, S_WCSPBRK, CASE_4, "the pointed wc is "
+		    "different from an expected wc");
+	  }
+	else
+	  {
+	    Result (C_SUCCESS, S_WCSPBRK, CASE_4, MS_PASSED);
+	  }
+      }
+    }
+  }
+
+  return err_count;
+}
diff --git a/ap/build/uClibc/test/locale-mbwc/tst_wcsrtombs.c b/ap/build/uClibc/test/locale-mbwc/tst_wcsrtombs.c
new file mode 100644
index 0000000..3a8edcc
--- /dev/null
+++ b/ap/build/uClibc/test/locale-mbwc/tst_wcsrtombs.c
@@ -0,0 +1,127 @@
+/*
+  WCSRTOMBS: size_t wcsrtombs (char *s, const wchar_t **ws, size_t n,
+			       mbstate_t *ps)
+*/
+
+#define TST_FUNCTION wcsrtombs
+
+#include "tsp_common.c"
+#include "dat_wcsrtombs.c"
+
+#define MARK_VAL 0x01
+
+int
+tst_wcsrtombs (FILE * fp, int debug_flg)
+{
+  TST_DECL_VARS (size_t);
+  char s_flg, n;
+  const wchar_t *ws, *wp;
+  char s[MBSSIZE], *s_in;
+  char t_flg, t_ini;
+  static mbstate_t t = { 0 };
+  mbstate_t *pt;
+  int err, i;
+  char *s_ex;
+
+  TST_DO_TEST (wcsrtombs)
+  {
+    TST_HEAD_LOCALE (wcsrtombs, S_WCSRTOMBS);
+    TST_DO_REC (wcsrtombs)
+    {
+      TST_GET_ERRET (wcsrtombs);
+      memset (s, MARK_VAL, MBSSIZE);
+
+      s_flg = TST_INPUT (wcsrtombs).s_flg;
+      s_in = (s_flg == 1) ? s : (char *) NULL;
+      wp = ws = TST_INPUT (wcsrtombs).ws;
+      n = TST_INPUT (wcsrtombs).n;
+      t_flg = TST_INPUT (wcsrtombs).t_flg;
+      t_ini = TST_INPUT (wcsrtombs).t_init;
+      pt = (t_flg == 0) ? NULL : &t;
+
+      if (t_ini != 0)
+	{
+	  memset (&t, 0, sizeof (t));
+	}
+
+      TST_CLEAR_ERRNO;
+      ret = wcsrtombs (s_in, &wp, n, pt);
+      TST_SAVE_ERRNO;
+
+      if (debug_flg)
+	{
+	  fprintf (stderr, "wcsrtombs: ret	= %zu\n", ret);
+	}
+
+      TST_IF_RETURN (S_WCSRTOMBS)
+      {
+      };
+
+      if (s_in != NULL && ret != (size_t) - 1)
+	{
+	  /* No definition for s, when error occurs.  */
+	  s_ex = TST_EXPECT (wcsrtombs).s;
+
+	  for (err = 0, i = 0; i <= ret && i < MBSSIZE; i++)
+	    {
+	      if (debug_flg)
+		{
+		  fprintf (stderr,
+			   "	: s[%d] = 0x%hx <-> 0x%hx = s_ex[%d]\n", i,
+			   s[i], s_ex[i], i);
+		}
+
+	      if (i == ret && ret == n)	/* no null termination */
+		{
+		  if (s[i] == MARK_VAL)
+		    {
+		      Result (C_SUCCESS, S_WCSRTOMBS, CASE_4, MS_PASSED);
+		    }
+		  else
+		    {
+		      err_count++;
+		      Result (C_FAILURE, S_WCSRTOMBS, CASE_4,
+			      "should not be null terminated "
+			      "(it may be a null char), but it is");
+		    }
+
+		  break;
+		}
+
+	      if (i == ret && ret < n)	/* null termination */
+		{
+		  if (s[i] == 0)
+		    {
+		      Result (C_SUCCESS, S_WCSRTOMBS, CASE_5, MS_PASSED);
+		    }
+		  else
+		    {
+		      err_count++;
+		      Result (C_FAILURE, S_WCSRTOMBS, CASE_5,
+			      "should be null terminated, but it is not");
+		    }
+
+		  break;
+		}
+
+	      if (s[i] != s_ex[i])
+		{
+		  err++;
+		  err_count++;
+		  Result (C_FAILURE, S_WCSRTOMBS, CASE_6,
+			  "converted string is different from an"
+			  " expected string");
+		  break;
+		}
+	    }
+
+	  if (!err)
+	    {
+	      Result (C_SUCCESS, S_WCSRTOMBS, CASE_6, MS_PASSED);
+	    }
+	}
+    }
+  }
+
+  return err_count;
+}
diff --git a/ap/build/uClibc/test/locale-mbwc/tst_wcsspn.c b/ap/build/uClibc/test/locale-mbwc/tst_wcsspn.c
new file mode 100644
index 0000000..02157ee
--- /dev/null
+++ b/ap/build/uClibc/test/locale-mbwc/tst_wcsspn.c
@@ -0,0 +1,38 @@
+/*
+  WCSSPN: size_t wcsspn (const wchar_t *ws1, const wchar_t *ws2);
+*/
+
+#define TST_FUNCTION wcsspn
+
+#include "tsp_common.c"
+#include "dat_wcsspn.c"
+
+int
+tst_wcsspn (FILE *fp, int debug_flg)
+{
+  TST_DECL_VARS (size_t);
+  wchar_t *ws1, *ws2;
+
+  TST_DO_TEST (wcsspn)
+  {
+    TST_HEAD_LOCALE (wcsspn, S_WCSSPN);
+    TST_DO_REC (wcsspn)
+    {
+      TST_GET_ERRET (wcsspn);
+      ws1 = TST_INPUT (wcsspn).ws1;
+      ws2 = TST_INPUT (wcsspn).ws2;	/* external value: size WCSSIZE */
+      ret = wcsspn (ws1, ws2);
+
+      if (debug_flg)
+	{
+	  fprintf (stderr, "wcsspn: ret = %zu\n", ret);
+	}
+
+      TST_IF_RETURN (S_WCSSPN)
+      {
+      };
+    }
+  }
+
+  return err_count;
+}
diff --git a/ap/build/uClibc/test/locale-mbwc/tst_wcsstr.c b/ap/build/uClibc/test/locale-mbwc/tst_wcsstr.c
new file mode 100644
index 0000000..f8b00c4
--- /dev/null
+++ b/ap/build/uClibc/test/locale-mbwc/tst_wcsstr.c
@@ -0,0 +1,86 @@
+/*
+  WCSSTR: wchar_t *wcsstr (const wchar_t *ws1, const wchar_t *ws2);
+*/
+
+#define TST_FUNCTION wcsstr
+
+#include "tsp_common.c"
+#include "dat_wcsstr.c"
+
+int
+tst_wcsstr (FILE * fp, int debug_flg)
+{
+  TST_DECL_VARS (wchar_t *);
+  wchar_t *ws1, *ws2;
+  int err, i;
+
+  TST_DO_TEST (wcsstr)
+  {
+    TST_HEAD_LOCALE (wcsstr, S_WCSSTR);
+    TST_DO_REC (wcsstr)
+    {
+      TST_GET_ERRET (wcsstr);
+      ws1 = TST_INPUT (wcsstr).ws1;
+      ws2 = TST_INPUT (wcsstr).ws2;	/* external value: size WCSSIZE */
+      ret = wcsstr (ws1, ws2);
+
+      if (debug_flg)
+	{
+	  fprintf (stderr, "wcsstr: %d : ret = %s\n", rec + 1,
+		   (ret == NULL) ? "null" : "not null");
+	  if (ret)
+	    {
+	      fprintf (stderr,
+		       "	ret[ 0 ] = 0x%lx <-> 0x%lx = ws2[ 0 ]\n",
+		       (unsigned long int) ret[0], (unsigned long int) ws2[0]);
+	    }
+	}
+
+      TST_IF_RETURN (S_WCSSTR)
+      {
+	if (ws2[0] == 0)
+	  {
+	    if (ret == ws1)
+	      {
+		Result (C_SUCCESS, S_WCSSTR, CASE_3, MS_PASSED);
+	      }
+	    else
+	      {
+		err_count++;
+		Result (C_FAILURE, S_WCSSTR, CASE_3,
+			"return address is not same address as ws1");
+	      }
+
+	    continue;
+	  }
+
+	for (i = 0, err = 0; *(ws2 + i) != 0 && i < WCSSIZE; i++)
+	  {
+	    if (debug_flg)
+	      {
+		fprintf (stderr,
+			 "	: ret[ %d ] = 0x%lx <-> 0x%lx = ws2[ %d ]\n",
+			 i, (unsigned long int) ret[i],
+			 (unsigned long int) ws2[i], i);
+	      }
+
+	    if (ret[i] != ws2[i])
+	      {
+		err++;
+		err_count++;
+		Result (C_FAILURE, S_WCSSTR, CASE_4, "pointed sub-string is "
+			"different from an expected sub-string");
+		break;
+	      }
+	  }
+
+	if (!err)
+	  {
+	    Result (C_SUCCESS, S_WCSSTR, CASE_4, MS_PASSED);
+	  }
+      }
+    }
+  }
+
+  return err_count;
+}
diff --git a/ap/build/uClibc/test/locale-mbwc/tst_wcstod.c b/ap/build/uClibc/test/locale-mbwc/tst_wcstod.c
new file mode 100644
index 0000000..1648d35
--- /dev/null
+++ b/ap/build/uClibc/test/locale-mbwc/tst_wcstod.c
@@ -0,0 +1,69 @@
+/*
+  WCSTOD: double wcstod (wchar_t *np, const wchar_t **endp);
+*/
+
+#define TST_FUNCTION wcstod
+
+#include "tsp_common.c"
+#include "dat_wcstod.c"
+
+int
+tst_wcstod (FILE * fp, int debug_flg)
+{
+  TST_DECL_VARS (double);
+  wchar_t *np, *endp, fwc;
+  double val;
+
+  TST_DO_TEST (wcstod)
+  {
+    TST_HEAD_LOCALE (wcstod, S_WCSTOD);
+    TST_DO_REC (wcstod)
+    {
+      TST_GET_ERRET (wcstod);
+      np = TST_INPUT (wcstod).np;
+
+      TST_CLEAR_ERRNO;
+      ret = wcstod (np, &endp);
+      TST_SAVE_ERRNO;
+
+      if (debug_flg)
+	{
+	  fprintf (stdout, "wcstod() [ %s : %d ] ret  = %f\n", locale,
+		   rec + 1, ret);
+	  fprintf (stdout, "			  *endp = 0x%lx\n",
+		   (unsigned long int) *endp);
+	}
+
+      TST_IF_RETURN (S_WCSTOD)
+      {
+	if (ret != 0)
+	  {
+	    val = ret - TST_EXPECT (wcstod).val;
+	    if (TST_ABS (val) < TST_DBL_EPS)
+	      {
+		Result (C_SUCCESS, S_WCSTOD, CASE_3, MS_PASSED);
+	      }
+	    else
+	      {
+		err_count++;
+		Result (C_FAILURE, S_WCSTOD, CASE_3, "return value is wrong");
+	      }
+	  }
+      }
+
+      fwc = TST_EXPECT (wcstod).fwc;
+
+      if (fwc == *endp)
+	{
+	  Result (C_SUCCESS, S_WCSTOD, CASE_4, MS_PASSED);
+	}
+      else
+	{
+	  err_count++;
+	  Result (C_FAILURE, S_WCSTOD, CASE_4, "a final wc is wrong.");
+	}
+    }
+  }
+
+  return err_count;
+}
diff --git a/ap/build/uClibc/test/locale-mbwc/tst_wcstok.c b/ap/build/uClibc/test/locale-mbwc/tst_wcstok.c
new file mode 100644
index 0000000..1222b97
--- /dev/null
+++ b/ap/build/uClibc/test/locale-mbwc/tst_wcstok.c
@@ -0,0 +1,96 @@
+/*
+  WCSTOK: wchar_t *wcstok (wchar_t *ws, const wchar_t *dlm, wchar_t **pt);
+*/
+
+
+#define TST_FUNCTION wcstok
+
+#include "tsp_common.c"
+#include "dat_wcstok.c"
+
+int
+tst_wcstok (FILE * fp, int debug_flg)
+{
+  TST_DECL_VARS (wchar_t *);
+  char w_flg;
+  wchar_t *ws;
+  wchar_t *dt, *pt;
+  wchar_t *ws_ex;
+  int err, i;
+
+  TST_DO_TEST (wcstok)
+  {
+    TST_HEAD_LOCALE (wcstok, S_WCSTOK);
+    TST_DO_REC (wcstok)
+    {
+      TST_DO_SEQ (WCSTOK_SEQNUM)
+      {
+	TST_GET_ERRET_SEQ (wcstok);
+	w_flg = TST_INPUT_SEQ (wcstok).w_flg;
+	ws = (w_flg) ? TST_INPUT_SEQ (wcstok).ws : NULL;
+	dt = TST_INPUT_SEQ (wcstok).dt;
+
+	ret = wcstok (ws, dt, &pt);
+
+	if (debug_flg)
+	  {
+	    fprintf (stdout, "wcstok() [ %s : %d : %d ] *ret  = 0x%lx\n",
+		     locale, rec + 1, seq_num + 1, (unsigned long int) *ret);
+	    if (pt && *pt)
+	      {
+		fprintf (stdout, "			 *pt   = 0x%lx\n",
+			 (unsigned long int) *pt);
+	      }
+	  }
+
+	TST_IF_RETURN (S_WCSTOK)
+	{
+	};
+
+	if (ret != NULL)
+	  {
+	    ws_ex = TST_EXPECT_SEQ (wcstok).ws;
+
+	    /* XXX: REVISIT : insufficient conditions */
+	    for (err = 0, i = 0; i < WCSSIZE; i++)
+	      {
+		if (ret[i] == L'\0' && ws_ex[i] == L'\0')
+		  {
+		    break;
+		  }
+
+		if (debug_flg)
+		  {
+		    fprintf (stderr,
+			     "			      ret[%d] = 0x%lx <-> "
+			     "0x%lx = ws_ex[%d]\n",
+			     i, (unsigned long int) ret[i],
+			     (unsigned long int) ws_ex[i], i);
+		  }
+
+		if (ret[i] != ws_ex[i])
+		  {
+		    err++;
+		    err_count++;
+		    Result (C_FAILURE, S_WCSTOK, CASE_3,
+			    "the token is different from an expected string");
+		    break;
+		  }
+
+		if (ret[i] == L'\0' || ws_ex[i] == L'\0')
+		  {
+		    break;
+		  }
+	      }
+
+	    if (!err)
+	      {
+		Result (C_SUCCESS, S_WCSTOK, CASE_3, MS_PASSED);
+	      }
+	  }
+      }
+    }
+  }
+
+  return err_count;
+}
diff --git a/ap/build/uClibc/test/locale-mbwc/tst_wcstombs.c b/ap/build/uClibc/test/locale-mbwc/tst_wcstombs.c
new file mode 100644
index 0000000..c0851a4
--- /dev/null
+++ b/ap/build/uClibc/test/locale-mbwc/tst_wcstombs.c
@@ -0,0 +1,115 @@
+/*
+  WCSTOMBS: size_t wcstombs (char *s, const wchar_t *ws, size_t n)
+*/
+
+#define TST_FUNCTION wcstombs
+
+#include "tsp_common.c"
+#include "dat_wcstombs.c"
+
+#define MARK_VAL 0x01
+
+int
+tst_wcstombs (FILE * fp, int debug_flg)
+{
+  TST_DECL_VARS (size_t);
+  char s_flg, n;
+  wchar_t *ws;
+  char s[MBSSIZE], *s_in;
+  int err, i;
+  char *s_ex;
+
+  TST_DO_TEST (wcstombs)
+  {
+    TST_HEAD_LOCALE (wcstombs, S_WCSTOMBS);
+    TST_DO_REC (wcstombs)
+    {
+      TST_GET_ERRET (wcstombs);
+      memset (s, MARK_VAL, MBSSIZE);
+
+      s_flg = TST_INPUT (wcstombs).s_flg;
+      s_in = (s_flg == 1) ? s : (char *) NULL;
+      ws = TST_INPUT (wcstombs).ws;
+      n = TST_INPUT (wcstombs).n;
+
+      TST_CLEAR_ERRNO;
+      ret = wcstombs (s_in, ws, n);
+      TST_SAVE_ERRNO;
+
+      if (debug_flg)
+	{
+	  fprintf (stdout, "wcstombs: ret  = %zu\n", ret);
+	}
+
+      TST_IF_RETURN (S_WCSTOMBS)
+      {
+      };
+
+      if (s_in != NULL && ret != (size_t) - 1)
+	{
+	  /* No definition for s, when error occurs.  */
+	  s_ex = TST_EXPECT (wcstombs).s;
+
+	  for (err = 0, i = 0; i <= ret && i < MBSSIZE; i++)
+	    {
+	      if (debug_flg)
+		{
+		  fprintf (stdout,
+			   "	: s[%d] = 0x%hx <-> 0x%hx = s_ex[%d]\n", i,
+			   s[i], s_ex[i], i);
+		}
+
+	      if (i == ret && ret == n)	/* no null termination */
+		{
+		  if (s[i] == MARK_VAL)
+		    {
+		      Result (C_SUCCESS, S_WCSTOMBS, CASE_4, MS_PASSED);
+		    }
+		  else
+		    {
+		      err_count++;
+		      Result (C_FAILURE, S_WCSTOMBS, CASE_4,
+			      "should not be null terminated "
+			      "(it may be a null char), but it is");
+		    }
+
+		  break;
+		}
+
+	      if (i == ret && ret < n)	/* null termination */
+		{
+		  if (s[i] == 0)
+		    {
+		      Result (C_SUCCESS, S_WCSTOMBS, CASE_5, MS_PASSED);
+		    }
+		  else
+		    {
+		      err_count++;
+		      Result (C_FAILURE, S_WCSTOMBS, CASE_5,
+			      "should be null terminated, but it is not");
+		    }
+
+		  break;
+		}
+
+	      if (s[i] != s_ex[i])
+		{
+		  err++;
+		  err_count++;
+		  Result (C_FAILURE, S_WCSTOMBS, CASE_6,
+			  "converted string is different from an "
+			  "expected string");
+		  break;
+		}
+	    }
+
+	  if (!err)
+	    {
+	      Result (C_SUCCESS, S_WCSTOMBS, CASE_6, MS_PASSED);
+	    }
+	}
+    }
+  }
+
+  return err_count;
+}
diff --git a/ap/build/uClibc/test/locale-mbwc/tst_wcswidth.c b/ap/build/uClibc/test/locale-mbwc/tst_wcswidth.c
new file mode 100644
index 0000000..c836975
--- /dev/null
+++ b/ap/build/uClibc/test/locale-mbwc/tst_wcswidth.c
@@ -0,0 +1,39 @@
+/*
+  WCSWIDTH: int wcswidth (const wchar_t *ws, size_t n);
+*/
+
+#define TST_FUNCTION wcswidth
+
+#include "tsp_common.c"
+#include "dat_wcswidth.c"
+
+int
+tst_wcswidth (FILE *fp, int debug_flg)
+{
+  TST_DECL_VARS (int);
+  wchar_t *ws;
+  int n;
+
+  TST_DO_TEST (wcswidth)
+  {
+    TST_HEAD_LOCALE (wcswidth, S_WCSWIDTH);
+    TST_DO_REC (wcswidth)
+    {
+      TST_GET_ERRET (wcswidth);
+      ws = TST_INPUT (wcswidth).ws;
+      n = TST_INPUT (wcswidth).n;
+      ret = wcswidth (ws, n);
+
+      if (debug_flg)
+	{
+	  fprintf (stderr, "wcswidth: [ %d ] : ret = %d\n", rec + 1, ret);
+	}
+
+      TST_IF_RETURN (S_WCSWIDTH)
+      {
+      };
+    }
+  }
+
+  return err_count;
+}
diff --git a/ap/build/uClibc/test/locale-mbwc/tst_wcsxfrm.c b/ap/build/uClibc/test/locale-mbwc/tst_wcsxfrm.c
new file mode 100644
index 0000000..6fb8a1c
--- /dev/null
+++ b/ap/build/uClibc/test/locale-mbwc/tst_wcsxfrm.c
@@ -0,0 +1,122 @@
+/*
+  WCSXFRM: size_t wcsxfrm (wchar_t *ws1, const wchar_t *ws2, size_t n);
+*/
+
+#define TST_FUNCTION wcsxfrm
+
+#include "tsp_common.c"
+#include "dat_wcsxfrm.c"
+
+int
+tst_wcsxfrm (FILE * fp, int debug_flg)
+{
+  TST_DECL_VARS (size_t);
+  wchar_t *org1, *org2;
+  wchar_t frm1[MBSSIZE], frm2[MBSSIZE];
+  size_t n1, n2;
+  int ret_coll, ret_cmp;
+
+  TST_DO_TEST (wcsxfrm)
+  {
+    TST_HEAD_LOCALE (wcsxfrm, S_WCSXFRM);
+    TST_DO_REC (wcsxfrm)
+    {
+      TST_GET_ERRET (wcsxfrm);
+      org1 = TST_INPUT (wcsxfrm).org1;
+      org2 = TST_INPUT (wcsxfrm).org2;
+      n1 = TST_INPUT (wcsxfrm).n1;
+      n2 = TST_INPUT (wcsxfrm).n2;
+      if (n1 < 0 || sizeof (frm1) < n1 || sizeof (frm2) < n2)
+	{
+	  warn_count++;
+	  Result (C_IGNORED, S_WCSXFRM, CASE_9,
+		  "input data n1 or n2 is invalid");
+	  continue;
+	}
+
+      /* an errno and a return value are checked
+	 only for 2nd wcsxfrm() call.
+	 A result of 1st call is used to compare
+	 those 2 values by using wcscmp().
+       */
+
+      TST_CLEAR_ERRNO;
+      ret = wcsxfrm (frm1, org1, n1);	/* First call */
+      TST_SAVE_ERRNO;
+
+      if (debug_flg)
+	{
+	  fprintf (stdout, "tst_wcsxfrm() : REC = %d\n", rec + 1);
+	  fprintf (stdout, "tst_wcsxfrm() : 1st ret = %zu\n", ret);
+	}
+
+      if (ret == -1 || ret >= n1 || errno_save != 0)
+	{
+	  warn_count++;
+	  Result (C_INVALID, S_WCSXFRM, CASE_8,
+		  "got an error in fist wcsxfrm() call");
+	  continue;
+	}
+
+      TST_CLEAR_ERRNO;
+      /* Second call */
+      ret = wcsxfrm (((n2 == 0) ? NULL : frm2), org2, n2);
+      TST_SAVE_ERRNO;
+
+      TST_IF_RETURN (S_WCSXFRM)
+      {
+      };
+
+      if (n2 == 0 || ret >= n2 || errno != 0)
+	{
+#if 0
+	  warn_count++;
+	  Result (C_IGNORED, S_WCSXFRM, CASE_7, "did not get a result");
+#endif
+	  continue;
+	}
+
+      if (debug_flg)
+	{
+	  fprintf (stdout, "tst_wcsxfrm() : 2nd ret = %zu\n", ret);
+	}
+
+      /* wcscoll() */
+      TST_CLEAR_ERRNO;
+      /* depends on wcscoll() ... not good though ... */
+      ret_coll = wcscoll (org1, org2);
+      TST_SAVE_ERRNO;
+
+      if (errno != 0)		/* bugs * bugs may got correct results ... */
+	{
+	  warn_count++;
+	  Result (C_INVALID, S_WCSXFRM, CASE_6,
+		  "got an error in wcscoll() call");
+	  continue;
+	}
+      /* wcscmp() */
+      ret_cmp = wcscmp (frm1, frm2);
+
+      if ((ret_coll == ret_cmp) || (ret_coll > 0 && ret_cmp > 0)
+	  || (ret_coll < 0 && ret_cmp < 0))
+	{
+	  Result (C_SUCCESS, S_WCSXFRM, CASE_3,
+		  MS_PASSED " (depends on wcscoll & wcscmp)");
+	}
+      else
+	{
+	  err_count++;
+	  Result (C_FAILURE, S_WCSXFRM, CASE_3,
+		  "results from wcscoll & wcscmp() do not match");
+	}
+
+      if (debug_flg)
+	{
+	  fprintf (stdout, "tst_wcsxfrm() : coll = %d <-> %d = cmp\n",
+		   ret_coll, ret_cmp);
+	}
+    }
+  }
+
+  return err_count;
+}
diff --git a/ap/build/uClibc/test/locale-mbwc/tst_wctob.c b/ap/build/uClibc/test/locale-mbwc/tst_wctob.c
new file mode 100644
index 0000000..2377daf
--- /dev/null
+++ b/ap/build/uClibc/test/locale-mbwc/tst_wctob.c
@@ -0,0 +1,37 @@
+/*-------------------------------------------------------------------------------------*/
+/* WCTOB: int wctob( wint_t wc )						       */
+/*-------------------------------------------------------------------------------------*/
+
+#define TST_FUNCTION wctob
+
+#include "tsp_common.c"
+#include "dat_wctob.c"
+
+int
+tst_wctob (FILE * fp, int debug_flg)
+{
+  TST_DECL_VARS (int);
+  wchar_t wc;
+
+  TST_DO_TEST (wctob)
+  {
+    TST_HEAD_LOCALE (wctob, S_WCTOB);
+    TST_DO_REC (wctob)
+    {
+      TST_GET_ERRET (wctob);
+      wc = TST_INPUT (wctob).wc;
+      ret = wctob (wc);
+
+      if (debug_flg)
+	{
+	  fprintf (stderr, "tst_wctob : [ %d ] ret = %d\n", rec + 1, ret);
+	}
+
+      TST_IF_RETURN (S_WCTOB)
+      {
+      };
+    }
+  }
+
+  return err_count;
+}
diff --git a/ap/build/uClibc/test/locale-mbwc/tst_wctomb.c b/ap/build/uClibc/test/locale-mbwc/tst_wctomb.c
new file mode 100644
index 0000000..aea89fe
--- /dev/null
+++ b/ap/build/uClibc/test/locale-mbwc/tst_wctomb.c
@@ -0,0 +1,99 @@
+/*
+  WCTOMB: int wctomb (char *s, wchar_t wc)
+*/
+
+#define TST_FUNCTION wctomb
+
+#include "tsp_common.c"
+#include "dat_wctomb.c"
+
+int
+tst_wctomb (FILE * fp, int debug_flg)
+{
+  TST_DECL_VARS (int);
+  wchar_t wc;
+  char s[MBSSIZE], *s_in, *s_ex;
+  int err, i;
+
+  TST_DO_TEST (wctomb)
+  {
+    TST_HEAD_LOCALE (wctomb, S_WCTOMB);
+    TST_DO_REC (wctomb)
+    {
+      TST_GET_ERRET (wctomb);
+      wc = TST_INPUT (wctomb).wc;
+      s_in = ((TST_INPUT (wctomb).s_flg) == 0) ? (char *) NULL : s;
+      ret = wctomb (s_in, wc);
+
+      if (debug_flg)
+	{
+	  fprintf (stdout, "wctomb() [ %s : %d ] ret  = %d\n", locale,
+		   rec + 1, ret);
+	}
+
+      TST_IF_RETURN (S_WCTOMB)
+      {
+	if (s_in == NULL)	/* state dependency */
+	  {
+	    if (ret_exp == +1)	/* state-dependent  */
+	      {
+		if (ret != 0)
+		  {
+		    /* Non-zero means state-dependent encoding.	 */
+		    Result (C_SUCCESS, S_WCTOMB, CASE_3, MS_PASSED);
+		  }
+		else
+		  {
+		    err_count++;
+		    Result (C_FAILURE, S_WCTOMB, CASE_3,
+			    "should be state-dependent encoding, "
+			    "but a return value shows it is "
+			    "state-independent");
+		  }
+	      }
+
+	    if (ret_exp == 0)	/* state-independent */
+	      {
+		if (ret == 0)
+		  {
+		    /* Non-zero means state-dependent encoding.	 */
+		    Result (C_SUCCESS, S_WCTOMB, CASE_3, MS_PASSED);
+		  }
+		else
+		  {
+		    err_count++;
+		    Result (C_FAILURE, S_WCTOMB, CASE_3,
+			    "should be state-independent encoding, "
+			    "but a return value shows it is state-dependent");
+		  }
+	      }
+	  }
+      }
+
+      s_ex = TST_EXPECT (wctomb).s;
+
+      if (s_in)
+	{
+	  for (i = 0, err = 0; *(s_ex + i) != 0 && i < MBSSIZE; i++)
+	    {
+	      if (s_in[i] != s_ex[i])
+		{
+		  err++;
+		  err_count++;
+		  Result (C_FAILURE, S_WCTOMB, CASE_4,
+			  "copied string is different from an"
+			  " expected string");
+		  break;
+		}
+	    }
+
+	  if (!err)
+	    {
+	      Result (C_SUCCESS, S_WCTOMB, CASE_4, MS_PASSED);
+	    }
+	}
+    }
+  }
+
+  return err_count;
+}
diff --git a/ap/build/uClibc/test/locale-mbwc/tst_wctrans.c b/ap/build/uClibc/test/locale-mbwc/tst_wctrans.c
new file mode 100644
index 0000000..b422d6f
--- /dev/null
+++ b/ap/build/uClibc/test/locale-mbwc/tst_wctrans.c
@@ -0,0 +1,52 @@
+/*
+  WCTRANS: wctrans_t wctrans (const char *charclass);
+*/
+
+#define TST_FUNCTION wctrans
+
+#include "tsp_common.c"
+#include "dat_wctrans.c"
+
+int
+tst_wctrans (FILE * fp, int debug_flg)
+{
+  TST_DECL_VARS (wctrans_t);
+  char *class;
+
+  TST_DO_TEST (wctrans)
+  {
+    TST_HEAD_LOCALE (wctrans, S_WCTRANS);
+    TST_DO_REC (wctrans)
+    {
+      TST_GET_ERRET (wctrans);
+      class = TST_INPUT (wctrans).class;
+
+      TST_CLEAR_ERRNO;
+      ret = wctrans (class);
+      TST_SAVE_ERRNO;
+
+      if (debug_flg)
+	{
+	  fprintf (stderr, "tst_wctrans : [ %d ] ret = %ld\n", rec + 1,
+		   (long int) ret);
+	  fprintf (stderr, "		       errno = %d\n", errno_save);
+	}
+
+      TST_IF_RETURN (S_WCTRANS)
+      {
+	if (ret != 0)
+	  {
+	    Result (C_SUCCESS, S_WCTYPE, CASE_3, MS_PASSED);
+	  }
+	else
+	  {
+	    err_count++;
+	    Result (C_FAILURE, S_WCTYPE, CASE_3,
+		    "should return non-0, but returned 0");
+	  }
+      }
+    }
+  }
+
+  return err_count;
+}
diff --git a/ap/build/uClibc/test/locale-mbwc/tst_wctype.c b/ap/build/uClibc/test/locale-mbwc/tst_wctype.c
new file mode 100644
index 0000000..a203e49
--- /dev/null
+++ b/ap/build/uClibc/test/locale-mbwc/tst_wctype.c
@@ -0,0 +1,48 @@
+/*
+  WCTYPE: wctype_t wctype (const char *class);
+*/
+
+
+#define TST_FUNCTION wctype
+
+#include "tsp_common.c"
+#include "dat_wctype.c"
+
+int
+tst_wctype (FILE * fp, int debug_flg)
+{
+  TST_DECL_VARS (wctype_t);
+  char *class;
+
+  TST_DO_TEST (wctype)
+  {
+    TST_HEAD_LOCALE (wctype, S_WCTYPE);
+    TST_DO_REC (wctype)
+    {
+      TST_GET_ERRET (wctype);
+      class = TST_INPUT (wctype).class;
+      ret = wctype (class);
+
+      if (debug_flg)
+	{
+	  fprintf (stderr, "tst_wctype : [ %d ] ret = %ld\n", rec + 1, ret);
+	}
+
+      TST_IF_RETURN (S_WCTYPE)
+      {
+	if (ret != 0)
+	  {
+	    Result (C_SUCCESS, S_WCTYPE, CASE_3, MS_PASSED);
+	  }
+	else
+	  {
+	    err_count++;
+	    Result (C_FAILURE, S_WCTYPE, CASE_3,
+		    "should return non-0, but returned 0");
+	  }
+      }
+    }
+  }
+
+  return err_count;
+}
diff --git a/ap/build/uClibc/test/locale-mbwc/tst_wcwidth.c b/ap/build/uClibc/test/locale-mbwc/tst_wcwidth.c
new file mode 100644
index 0000000..6a5af6f
--- /dev/null
+++ b/ap/build/uClibc/test/locale-mbwc/tst_wcwidth.c
@@ -0,0 +1,38 @@
+/*
+  WCWIDTH: int wcwidth (wchar_t wc);
+*/
+
+#define TST_FUNCTION wcwidth
+
+#include "tsp_common.c"
+#include "dat_wcwidth.c"
+
+int
+tst_wcwidth (FILE * fp, int debug_flg)
+{
+  TST_DECL_VARS (int);
+  wchar_t wc;
+
+  TST_DO_TEST (wcwidth)
+  {
+    TST_HEAD_LOCALE (wcwidth, S_WCWIDTH);
+    TST_DO_REC (wcwidth)
+    {
+      TST_GET_ERRET (wcwidth);
+      wc = TST_INPUT (wcwidth).wc;
+      ret = wcwidth (wc);
+
+      if (debug_flg)
+	{
+	  fprintf (stdout, "wcwidth() [ %s : %d ] ret  = %d\n", locale,
+		   rec + 1, ret);
+	}
+
+      TST_IF_RETURN (S_WCWIDTH)
+      {
+      }
+    }
+  }
+
+  return err_count;
+}
diff --git a/ap/build/uClibc/test/locale/Makefile b/ap/build/uClibc/test/locale/Makefile
new file mode 100644
index 0000000..771c3d1
--- /dev/null
+++ b/ap/build/uClibc/test/locale/Makefile
@@ -0,0 +1,7 @@
+# uClibc locale tests
+# Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
+
+top_builddir=../../
+include ../Rules.mak
+-include Makefile.in
+include ../Test.mak
diff --git a/ap/build/uClibc/test/locale/Makefile.in b/ap/build/uClibc/test/locale/Makefile.in
new file mode 100644
index 0000000..5a57ca5
--- /dev/null
+++ b/ap/build/uClibc/test/locale/Makefile.in
@@ -0,0 +1,29 @@
+# uClibc locale tests
+# Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
+#	 tst_mbtowc tst_strcoll tst_strfmon tst_strxfrm    \
+
+TESTS := bug-iconv-trans bug-usesetlocale collate-test dump-ctype \
+	 gen-unicode-ctype show-ucs-data tst-ctype \
+	 tst-digits tst-fmon tst-langinfo tst-leaks tst-mbswcs1 \
+	 tst-mbswcs2 tst-mbswcs3 tst-mbswcs4 tst-mbswcs5 tst-mbswcs6 \
+	 tst_nl_langinfo tst-numeric tst-rpmatch tst-setlocale \
+	 tst-sscanf tst-strfmon1 tst-trans tst-wctype tst-xlocale1 \
+	 tst-xlocale2 xfrm-test
+
+
+# NOTE: For now disabled some tests that are known not build
+TESTS_DISABLED := tst-ctype tst-fmon tst-leaks tst-rpmatch tst-strfmon1
+
+ifneq ($(UCLIBC_HAS_XLOCALE),y)
+TESTS_DISABLED += bug-usesetlocale tst-xlocale1 tst-xlocale2 xfrm-test tst-C-locale
+endif
+
+DODIFF_rint     := 1
+
+EXTRA_CFLAGS    := -D__USE_GNU -fno-builtin
+
+OPTS_dump-ctype = C
+OPTS_tst-ctype = < tst-ctype-de_DE.ISO-8859-1.in
+OPTS_tst-langinfo = < tst-langinfo.input
+
+EXTRA_DIRS := C
diff --git a/ap/build/uClibc/test/locale/bug-iconv-trans.c b/ap/build/uClibc/test/locale/bug-iconv-trans.c
new file mode 100644
index 0000000..3886247
--- /dev/null
+++ b/ap/build/uClibc/test/locale/bug-iconv-trans.c
@@ -0,0 +1,68 @@
+#include <iconv.h>
+#include <locale.h>
+#include <stdio.h>
+#include <string.h>
+
+int
+main (void)
+{
+  iconv_t cd;
+  const char str[] = "ÄäÖöÜüß";
+  const char expected[] = "AEaeOEoeUEuess";
+  char *inptr = (char *) str;
+  size_t inlen = strlen (str) + 1;
+  char outbuf[500];
+  char *outptr = outbuf;
+  size_t outlen = sizeof (outbuf);
+  int result = 0;
+  size_t n;
+
+  if (setlocale (LC_ALL, "de_DE.UTF-8") == NULL)
+    {
+      puts ("setlocale failed");
+      return 1;
+    }
+
+  cd = iconv_open ("ANSI_X3.4-1968//TRANSLIT", "ISO-8859-1");
+  if (cd == (iconv_t) -1)
+    {
+      puts ("iconv_open failed");
+      return 1;
+    }
+
+  n = iconv (cd, &inptr, &inlen, &outptr, &outlen);
+  if (n != 7)
+    {
+      if (n == (size_t) -1)
+	printf ("iconv() returned error: %m\n");
+      else
+	printf ("iconv() returned %Zd, expected 7\n", n);
+      result = 1;
+    }
+  if (inlen != 0)
+    {
+      puts ("not all input consumed");
+      result = 1;
+    }
+  else if (inptr - str != strlen (str) + 1)
+    {
+      printf ("inptr wrong, advanced by %td\n", inptr - str);
+      result = 1;
+    }
+  if (memcmp (outbuf, expected, sizeof (expected)) != 0)
+    {
+      printf ("result wrong: \"%.*s\", expected: \"%s\"\n",
+	      (int) (sizeof (outbuf) - outlen), outbuf, expected);
+      result = 1;
+    }
+  else if (outlen != sizeof (outbuf) - sizeof (expected))
+    {
+      printf ("outlen wrong: %Zd, expected %Zd\n", outlen,
+	      sizeof (outbuf) - 15);
+      result = 1;
+    }
+  else
+    printf ("output is \"%s\" which is OK\n", outbuf);
+
+  return result;
+}
diff --git a/ap/build/uClibc/test/locale/bug-usesetlocale.c b/ap/build/uClibc/test/locale/bug-usesetlocale.c
new file mode 100644
index 0000000..0637067
--- /dev/null
+++ b/ap/build/uClibc/test/locale/bug-usesetlocale.c
@@ -0,0 +1,38 @@
+/* Test case for setlocale vs uselocale (LC_GLOBAL_LOCALE) bug.  */
+
+#define _GNU_SOURCE 1
+#include <locale.h>
+#include <stdio.h>
+#include <ctype.h>
+
+static int
+do_test (void)
+{
+  __locale_t loc_new, loc_old;
+
+  int first = !!isalpha(0xE4);
+
+  setlocale (LC_ALL, "de_DE");
+
+  int global_de = !!isalpha(0xE4);
+
+  loc_new = newlocale (1 << LC_ALL, "C", 0);
+  loc_old = uselocale (loc_new);
+
+  int used_c = !!isalpha(0xE4);
+
+  uselocale (loc_old);
+
+  int used_global = !!isalpha(0xE4);
+
+  printf ("started %d, after setlocale %d\n", first, global_de);
+  printf ("after uselocale %d, after LC_GLOBAL_LOCALE %d\n",
+	  used_c, used_global);
+
+  freelocale (loc_new);
+  return !(used_c == first && used_global == global_de);
+}
+
+
+#define TEST_FUNCTION do_test ()
+#include "test-skeleton.c"
diff --git a/ap/build/uClibc/test/locale/collate-test.c b/ap/build/uClibc/test/locale/collate-test.c
new file mode 100644
index 0000000..e8f4321
--- /dev/null
+++ b/ap/build/uClibc/test/locale/collate-test.c
@@ -0,0 +1,133 @@
+/* Test collation function using real data.
+   Copyright (C) 1997, 1999, 2000, 2003 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+   Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997.
+
+   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 <ctype.h>
+#include <error.h>
+#include <locale.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+
+
+struct lines
+{
+  char *key;
+  char *line;
+};
+
+static int xstrcoll (const void *, const void *);
+
+int
+main (int argc, char *argv[])
+{
+  int result = 0;
+  size_t nstrings, nstrings_max;
+  struct lines *strings;
+  char *line = NULL;
+  size_t len = 0;
+  size_t n;
+
+  if (argc < 2)
+    error (1, 0, "usage: %s <random seed>", argv[0]);
+
+  setlocale (LC_ALL, "");
+
+  nstrings_max = 100;
+  nstrings = 0;
+  strings = (struct lines *) malloc (nstrings_max * sizeof (struct lines));
+  if (strings == NULL)
+    {
+      perror (argv[0]);
+      exit (1);
+    }
+
+  while (1)
+    {
+      int l;
+      if (getline (&line, &len, stdin) < 0)
+	break;
+
+      if (nstrings == nstrings_max)
+	{
+	  strings = (struct lines *) realloc (strings,
+					      (nstrings_max *= 2)
+					       * sizeof (*strings));
+	  if (strings == NULL)
+	    {
+	      perror (argv[0]);
+	      exit (1);
+	    }
+	}
+      strings[nstrings].line = strdup (line);
+      l = strcspn (line, ":(;");
+      while (l > 0 && isspace (line[l - 1]))
+	--l;
+      strings[nstrings].key = strndup (line, l);
+      ++nstrings;
+    }
+  free (line);
+
+  /* First shuffle.  */
+  srandom (atoi (argv[1]));
+  for (n = 0; n < 10 * nstrings; ++n)
+    {
+      int r1, r2, r;
+      size_t idx1 = random () % nstrings;
+      size_t idx2 = random () % nstrings;
+      struct lines tmp = strings[idx1];
+      strings[idx1] = strings[idx2];
+      strings[idx2] = tmp;
+
+      /* While we are at it a first little test.  */
+      r1 = strcoll (strings[idx1].key, strings[idx2].key);
+      r2 = strcoll (strings[idx2].key, strings[idx1].key);
+      r = r1 * r2;
+
+      if (r > 0 || (r == 0 && r1 != 0) || (r == 0 && r2 != 0))
+	printf ("`%s' and `%s' collate wrong: %d vs. %d\n",
+		strings[idx1].key, strings[idx2].key, r1, r2);
+    }
+
+  /* Now sort.  */
+  qsort (strings, nstrings, sizeof (struct lines), xstrcoll);
+
+  /* Print the result.  */
+  for (n = 0; n < nstrings; ++n)
+    {
+      fputs (strings[n].line, stdout);
+      free (strings[n].line);
+      free (strings[n].key);
+    }
+  free (strings);
+
+  return result;
+}
+
+
+static int
+xstrcoll (ptr1, ptr2)
+     const void *ptr1;
+     const void *ptr2;
+{
+  const struct lines *l1 = (const struct lines *) ptr1;
+  const struct lines *l2 = (const struct lines *) ptr2;
+
+  return strcoll (l1->key, l2->key);
+}
diff --git a/ap/build/uClibc/test/locale/dump-ctype.c b/ap/build/uClibc/test/locale/dump-ctype.c
new file mode 100644
index 0000000..a1f24c6
--- /dev/null
+++ b/ap/build/uClibc/test/locale/dump-ctype.c
@@ -0,0 +1,164 @@
+/* Dump the character classes and character maps of a locale to a bunch
+   of individual files which can be processed with diff, sed etc.
+   Copyright (C) 2000 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+   Contributed by Bruno Haible <haible@clisp.cons.org>, 2000.
+
+   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.  */
+
+/* Usage example:
+     $ dump-ctype de_DE.UTF-8
+ */
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <wctype.h>
+#include <locale.h>
+#include <sys/stat.h>
+#include <unistd.h>
+#include <errno.h>
+
+static const char *program_name = "dump-ctype";
+static const char *locale;
+
+static const char *class_names[] =
+  {
+    "alnum", "alpha", "blank", "cntrl", "digit", "graph", "lower",
+    "print", "punct", "space", "upper", "xdigit"
+  };
+
+static const char *map_names[] =
+  {
+    "tolower", "toupper", "totitle"
+  };
+
+static void dump_class (const char *class_name)
+{
+  wctype_t class;
+  FILE *f;
+  unsigned int ch;
+
+  class = wctype (class_name);
+  if (class == (wctype_t) 0)
+    {
+      fprintf (stderr, "%s %s: noexistent class %s\n", program_name,
+	       locale, class_name);
+      return;
+    }
+
+  f = fopen (class_name, "w");
+  if (f == NULL)
+    {
+      fprintf (stderr, "%s %s: cannot open file %s/%s\n", program_name,
+	       locale, locale, class_name);
+      exit (1);
+    }
+
+  for (ch = 0; ch < 0x10000; ch++)
+    if (iswctype (ch, class))
+      fprintf (f, "0x%04X\n", ch);
+
+  if (ferror (f) || fclose (f))
+    {
+      fprintf (stderr, "%s %s: I/O error on file %s/%s\n", program_name,
+	       locale, locale, class_name);
+      exit (1);
+    }
+}
+
+static void dump_map (const char *map_name)
+{
+  wctrans_t map;
+  FILE *f;
+  unsigned int ch;
+
+  map = wctrans (map_name);
+  if (map == (wctrans_t) 0)
+    {
+      fprintf (stderr, "%s %s: noexistent map %s\n", program_name,
+	       locale, map_name);
+      return;
+    }
+
+  f = fopen (map_name, "w");
+  if (f == NULL)
+    {
+      fprintf (stderr, "%s %s: cannot open file %s/%s\n", program_name,
+	       locale, locale, map_name);
+      exit (1);
+    }
+
+  for (ch = 0; ch < 0x10000; ch++)
+    if (towctrans (ch, map) != ch)
+      fprintf (f, "0x%04X\t0x%04X\n", ch, towctrans (ch, map));
+
+  if (ferror (f) || fclose (f))
+    {
+      fprintf (stderr, "%s %s: I/O error on file %s/%s\n", program_name,
+	       locale, locale, map_name);
+      exit (1);
+    }
+}
+
+int
+main (int argc, char *argv[])
+{
+  size_t i;
+
+  if (argc != 2)
+    {
+      fprintf (stderr, "Usage: dump-ctype locale\n");
+      exit (1);
+    }
+  locale = argv[1];
+
+  if (setlocale (LC_ALL, locale) == NULL)
+    {
+      fprintf (stderr, "%s: setlocale cannot switch to locale %s\n",
+	       program_name, locale);
+      exit (1);
+    }
+
+  if (mkdir (locale, 0777) < 0)
+    {
+      char buf[100];
+      int save_errno = errno;
+
+      sprintf (buf, "%s: cannot create directory %s", program_name, locale);
+      errno = save_errno;
+      perror (buf);
+      exit (1);
+    }
+
+  if (chdir (locale) < 0)
+    {
+      char buf[100];
+      int save_errno = errno;
+
+      sprintf (buf, "%s: cannot chdir to %s", program_name, locale);
+      errno = save_errno;
+      perror (buf);
+      exit (1);
+    }
+
+  for (i = 0; i < sizeof (class_names) / sizeof (class_names[0]); i++)
+    dump_class (class_names[i]);
+
+  for (i = 0; i < sizeof (map_names) / sizeof (map_names[0]); i++)
+    dump_map (map_names[i]);
+
+  return 0;
+}
diff --git a/ap/build/uClibc/test/locale/gen-unicode-ctype.c b/ap/build/uClibc/test/locale/gen-unicode-ctype.c
new file mode 100644
index 0000000..849f272
--- /dev/null
+++ b/ap/build/uClibc/test/locale/gen-unicode-ctype.c
@@ -0,0 +1,785 @@
+/* Generate a Unicode conforming LC_CTYPE category from a UnicodeData file.
+   Copyright (C) 2000-2001 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+   Contributed by Bruno Haible <haible@clisp.cons.org>, 2000.
+
+   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.  */
+
+/* Usage example:
+     $ gen-unicode /usr/local/share/Unidata/UnicodeData.txt 3.1
+ */
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <stdbool.h>
+#include <string.h>
+#include <time.h>
+
+/* This structure represents one line in the UnicodeData.txt file.  */
+struct unicode_attribute
+{
+  const char *name;           /* Character name */
+  const char *category;       /* General category */
+  const char *combining;      /* Canonical combining classes */
+  const char *bidi;           /* Bidirectional category */
+  const char *decomposition;  /* Character decomposition mapping */
+  const char *decdigit;       /* Decimal digit value */
+  const char *digit;          /* Digit value */
+  const char *numeric;        /* Numeric value */
+  int mirrored;               /* mirrored */
+  const char *oldname;        /* Old Unicode 1.0 name */
+  const char *comment;        /* Comment */
+  unsigned int upper;         /* Uppercase mapping */
+  unsigned int lower;         /* Lowercase mapping */
+  unsigned int title;         /* Titlecase mapping */
+};
+
+/* Missing fields are represented with "" for strings, and NONE for
+   characters.  */
+#define NONE (~(unsigned int)0)
+
+/* The entire contents of the UnicodeData.txt file.  */
+struct unicode_attribute unicode_attributes [0x110000];
+
+/* Stores in unicode_attributes[i] the values from the given fields.  */
+static void
+fill_attribute (unsigned int i,
+		const char *field1, const char *field2,
+		const char *field3, const char *field4,
+		const char *field5, const char *field6,
+		const char *field7, const char *field8,
+		const char *field9, const char *field10,
+		const char *field11, const char *field12,
+		const char *field13, const char *field14)
+{
+  struct unicode_attribute * uni;
+
+  if (i >= 0x110000)
+    {
+      fprintf (stderr, "index too large\n");
+      exit (1);
+    }
+  if (strcmp (field2, "Cs") == 0)
+    /* Surrogates are UTF-16 artefacts, not real characters. Ignore them.  */
+    return;
+  uni = &unicode_attributes[i];
+  /* Copy the strings.  */
+  uni->name          = strdup (field1);
+  uni->category      = (field2[0] == '\0' ? "" : strdup (field2));
+  uni->combining     = (field3[0] == '\0' ? "" : strdup (field3));
+  uni->bidi          = (field4[0] == '\0' ? "" : strdup (field4));
+  uni->decomposition = (field5[0] == '\0' ? "" : strdup (field5));
+  uni->decdigit      = (field6[0] == '\0' ? "" : strdup (field6));
+  uni->digit         = (field7[0] == '\0' ? "" : strdup (field7));
+  uni->numeric       = (field8[0] == '\0' ? "" : strdup (field8));
+  uni->mirrored      = (field9[0] == 'Y');
+  uni->oldname       = (field10[0] == '\0' ? "" : strdup (field10));
+  uni->comment       = (field11[0] == '\0' ? "" : strdup (field11));
+  uni->upper = (field12[0] =='\0' ? NONE : strtoul (field12, NULL, 16));
+  uni->lower = (field13[0] =='\0' ? NONE : strtoul (field13, NULL, 16));
+  uni->title = (field14[0] =='\0' ? NONE : strtoul (field14, NULL, 16));
+}
+
+/* Maximum length of a field in the UnicodeData.txt file.  */
+#define FIELDLEN 120
+
+/* Reads the next field from STREAM.  The buffer BUFFER has size FIELDLEN.
+   Reads up to (but excluding) DELIM.
+   Returns 1 when a field was successfully read, otherwise 0.  */
+static int
+getfield (FILE *stream, char *buffer, int delim)
+{
+  int count = 0;
+  int c;
+
+  for (; (c = getc (stream)), (c != EOF && c != delim); )
+    {
+      /* The original unicode.org UnicodeData.txt file happens to have
+	 CR/LF line terminators.  Silently convert to LF.  */
+      if (c == '\r')
+	continue;
+
+      /* Put c into the buffer.  */
+      if (++count >= FIELDLEN - 1)
+	{
+	  fprintf (stderr, "field too long\n");
+	  exit (1);
+	}
+      *buffer++ = c;
+    }
+
+  if (c == EOF)
+    return 0;
+
+  *buffer = '\0';
+  return 1;
+}
+
+/* Stores in unicode_attributes[] the entire contents of the UnicodeData.txt
+   file.  */
+static void
+fill_attributes (const char *unicodedata_filename)
+{
+  unsigned int i, j;
+  FILE *stream;
+  char field0[FIELDLEN];
+  char field1[FIELDLEN];
+  char field2[FIELDLEN];
+  char field3[FIELDLEN];
+  char field4[FIELDLEN];
+  char field5[FIELDLEN];
+  char field6[FIELDLEN];
+  char field7[FIELDLEN];
+  char field8[FIELDLEN];
+  char field9[FIELDLEN];
+  char field10[FIELDLEN];
+  char field11[FIELDLEN];
+  char field12[FIELDLEN];
+  char field13[FIELDLEN];
+  char field14[FIELDLEN];
+  int lineno = 0;
+
+  for (i = 0; i < 0x110000; i++)
+    unicode_attributes[i].name = NULL;
+
+  stream = fopen (unicodedata_filename, "r");
+  if (stream == NULL)
+    {
+      fprintf (stderr, "error during fopen of '%s'\n", unicodedata_filename);
+      exit (1);
+    }
+
+  for (;;)
+    {
+      int n;
+
+      lineno++;
+      n = getfield (stream, field0, ';');
+      n += getfield (stream, field1, ';');
+      n += getfield (stream, field2, ';');
+      n += getfield (stream, field3, ';');
+      n += getfield (stream, field4, ';');
+      n += getfield (stream, field5, ';');
+      n += getfield (stream, field6, ';');
+      n += getfield (stream, field7, ';');
+      n += getfield (stream, field8, ';');
+      n += getfield (stream, field9, ';');
+      n += getfield (stream, field10, ';');
+      n += getfield (stream, field11, ';');
+      n += getfield (stream, field12, ';');
+      n += getfield (stream, field13, ';');
+      n += getfield (stream, field14, '\n');
+      if (n == 0)
+	break;
+      if (n != 15)
+	{
+	  fprintf (stderr, "short line in'%s':%d\n",
+		   unicodedata_filename, lineno);
+	  exit (1);
+	}
+      i = strtoul (field0, NULL, 16);
+      if (field1[0] == '<'
+	  && strlen (field1) >= 9
+	  && !strcmp (field1 + strlen(field1) - 8, ", First>"))
+	{
+	  /* Deal with a range. */
+	  lineno++;
+	  n = getfield (stream, field0, ';');
+	  n += getfield (stream, field1, ';');
+	  n += getfield (stream, field2, ';');
+	  n += getfield (stream, field3, ';');
+	  n += getfield (stream, field4, ';');
+	  n += getfield (stream, field5, ';');
+	  n += getfield (stream, field6, ';');
+	  n += getfield (stream, field7, ';');
+	  n += getfield (stream, field8, ';');
+	  n += getfield (stream, field9, ';');
+	  n += getfield (stream, field10, ';');
+	  n += getfield (stream, field11, ';');
+	  n += getfield (stream, field12, ';');
+	  n += getfield (stream, field13, ';');
+	  n += getfield (stream, field14, '\n');
+	  if (n != 15)
+	    {
+	      fprintf (stderr, "missing end range in '%s':%d\n",
+		       unicodedata_filename, lineno);
+	      exit (1);
+	    }
+	  if (!(field1[0] == '<'
+		&& strlen (field1) >= 8
+		&& !strcmp (field1 + strlen (field1) - 7, ", Last>")))
+	    {
+	      fprintf (stderr, "missing end range in '%s':%d\n",
+		       unicodedata_filename, lineno);
+	      exit (1);
+	    }
+	  field1[strlen (field1) - 7] = '\0';
+	  j = strtoul (field0, NULL, 16);
+	  for (; i <= j; i++)
+	    fill_attribute (i, field1+1, field2, field3, field4, field5,
+			       field6, field7, field8, field9, field10,
+			       field11, field12, field13, field14);
+	}
+      else
+	{
+	  /* Single character line */
+	  fill_attribute (i, field1, field2, field3, field4, field5,
+			     field6, field7, field8, field9, field10,
+			     field11, field12, field13, field14);
+	}
+    }
+  if (ferror (stream) || fclose (stream))
+    {
+      fprintf (stderr, "error reading from '%s'\n", unicodedata_filename);
+      exit (1);
+    }
+}
+
+/* Character mappings.  */
+
+static unsigned int
+to_upper (unsigned int ch)
+{
+  if (unicode_attributes[ch].name != NULL
+      && unicode_attributes[ch].upper != NONE)
+    return unicode_attributes[ch].upper;
+  else
+    return ch;
+}
+
+static unsigned int
+to_lower (unsigned int ch)
+{
+  if (unicode_attributes[ch].name != NULL
+      && unicode_attributes[ch].lower != NONE)
+    return unicode_attributes[ch].lower;
+  else
+    return ch;
+}
+
+static unsigned int
+to_title (unsigned int ch)
+{
+  if (unicode_attributes[ch].name != NULL
+      && unicode_attributes[ch].title != NONE)
+    return unicode_attributes[ch].title;
+  else
+    return ch;
+}
+
+/* Character class properties.  */
+
+static bool
+is_upper (unsigned int ch)
+{
+  return (to_lower (ch) != ch);
+}
+
+static bool
+is_lower (unsigned int ch)
+{
+  return (to_upper (ch) != ch)
+	 /* <U00DF> is lowercase, but without simple to_upper mapping.  */
+	 || (ch == 0x00DF);
+}
+
+static bool
+is_alpha (unsigned int ch)
+{
+  return (unicode_attributes[ch].name != NULL
+	  && ((unicode_attributes[ch].category[0] == 'L'
+	       /* Theppitak Karoonboonyanan <thep@links.nectec.or.th> says
+		  <U0E2F>, <U0E46> should belong to is_punct.  */
+	       && (ch != 0x0E2F) && (ch != 0x0E46))
+	      /* Theppitak Karoonboonyanan <thep@links.nectec.or.th> says
+		 <U0E31>, <U0E34>..<U0E3A>, <U0E47>..<U0E4E> are is_alpha.  */
+	      || (ch == 0x0E31)
+	      || (ch >= 0x0E34 && ch <= 0x0E3A)
+	      || (ch >= 0x0E47 && ch <= 0x0E4E)
+	      /* Avoid warning for <U0345>.  */
+	      || (ch == 0x0345)
+	      /* Avoid warnings for <U2160>..<U217F>.  */
+	      || (unicode_attributes[ch].category[0] == 'N'
+		  && unicode_attributes[ch].category[1] == 'l')
+	      /* Avoid warnings for <U24B6>..<U24E9>.  */
+	      || (unicode_attributes[ch].category[0] == 'S'
+		  && unicode_attributes[ch].category[1] == 'o'
+		  && strstr (unicode_attributes[ch].name, " LETTER ")
+		     != NULL)
+	      /* Consider all the non-ASCII digits as alphabetic.
+		 ISO C 99 forbids us to have them in category "digit",
+		 but we want iswalnum to return true on them.  */
+	      || (unicode_attributes[ch].category[0] == 'N'
+		  && unicode_attributes[ch].category[1] == 'd'
+		  && !(ch >= 0x0030 && ch <= 0x0039))));
+}
+
+static bool
+is_digit (unsigned int ch)
+{
+#if 0
+  return (unicode_attributes[ch].name != NULL
+	  && unicode_attributes[ch].category[0] == 'N'
+	  && unicode_attributes[ch].category[1] == 'd');
+  /* Note: U+0BE7..U+0BEF and U+1369..U+1371 are digit systems without
+     a zero.  Must add <0> in front of them by hand.  */
+#else
+  /* SUSV2 gives us some freedom for the "digit" category, but ISO C 99
+     takes it away:
+     7.25.2.1.5:
+        The iswdigit function tests for any wide character that corresponds
+        to a decimal-digit character (as defined in 5.2.1).
+     5.2.1:
+        the 10 decimal digits 0 1 2 3 4 5 6 7 8 9
+   */
+  return (ch >= 0x0030 && ch <= 0x0039);
+#endif
+}
+
+static bool
+is_outdigit (unsigned int ch)
+{
+  return (ch >= 0x0030 && ch <= 0x0039);
+}
+
+static bool
+is_blank (unsigned int ch)
+{
+  return (ch == 0x0009 /* '\t' */
+	  /* Category Zs without mention of "<noBreak>" */
+	  || (unicode_attributes[ch].name != NULL
+	      && unicode_attributes[ch].category[0] == 'Z'
+	      && unicode_attributes[ch].category[1] == 's'
+	      && !strstr (unicode_attributes[ch].decomposition, "<noBreak>")));
+}
+
+static bool
+is_space (unsigned int ch)
+{
+  /* Don't make U+00A0 a space. Non-breaking space means that all programs
+     should treat it like a punctuation character, not like a space. */
+  return (ch == 0x0020 /* ' ' */
+	  || ch == 0x000C /* '\f' */
+	  || ch == 0x000A /* '\n' */
+	  || ch == 0x000D /* '\r' */
+	  || ch == 0x0009 /* '\t' */
+	  || ch == 0x000B /* '\v' */
+	  /* Categories Zl, Zp, and Zs without mention of "<noBreak>" */
+	  || (unicode_attributes[ch].name != NULL
+	      && unicode_attributes[ch].category[0] == 'Z'
+	      && (unicode_attributes[ch].category[1] == 'l'
+		  || unicode_attributes[ch].category[1] == 'p'
+		  || (unicode_attributes[ch].category[1] == 's'
+		      && !strstr (unicode_attributes[ch].decomposition,
+				  "<noBreak>")))));
+}
+
+static bool
+is_cntrl (unsigned int ch)
+{
+  return (unicode_attributes[ch].name != NULL
+	  && (!strcmp (unicode_attributes[ch].name, "<control>")
+	      /* Categories Zl and Zp */
+	      || (unicode_attributes[ch].category[0] == 'Z'
+		  && (unicode_attributes[ch].category[1] == 'l'
+		      || unicode_attributes[ch].category[1] == 'p'))));
+}
+
+static bool
+is_xdigit (unsigned int ch)
+{
+#if 0
+  return is_digit (ch)
+	 || (ch >= 0x0041 && ch <= 0x0046)
+	 || (ch >= 0x0061 && ch <= 0x0066);
+#else
+  /* SUSV2 gives us some freedom for the "xdigit" category, but ISO C 99
+     takes it away:
+     7.25.2.1.12:
+        The iswxdigit function tests for any wide character that corresponds
+        to a hexadecimal-digit character (as defined in 6.4.4.1).
+     6.4.4.1:
+        hexadecimal-digit: one of 0 1 2 3 4 5 6 7 8 9 a b c d e f A B C D E F
+   */
+  return (ch >= 0x0030 && ch <= 0x0039)
+	 || (ch >= 0x0041 && ch <= 0x0046)
+	 || (ch >= 0x0061 && ch <= 0x0066);
+#endif
+}
+
+static bool
+is_graph (unsigned int ch)
+{
+  return (unicode_attributes[ch].name != NULL
+	  && strcmp (unicode_attributes[ch].name, "<control>")
+	  && !is_space (ch));
+}
+
+static bool
+is_print (unsigned int ch)
+{
+  return (unicode_attributes[ch].name != NULL
+	  && strcmp (unicode_attributes[ch].name, "<control>")
+	  /* Categories Zl and Zp */
+	  && !(unicode_attributes[ch].name != NULL
+	       && unicode_attributes[ch].category[0] == 'Z'
+	       && (unicode_attributes[ch].category[1] == 'l'
+		   || unicode_attributes[ch].category[1] == 'p')));
+}
+
+static bool
+is_punct (unsigned int ch)
+{
+#if 0
+  return (unicode_attributes[ch].name != NULL
+	  && unicode_attributes[ch].category[0] == 'P');
+#else
+  /* The traditional POSIX definition of punctuation is every graphic,
+     non-alphanumeric character.  */
+  return (is_graph (ch) && !is_alpha (ch) && !is_digit (ch));
+#endif
+}
+
+static bool
+is_combining (unsigned int ch)
+{
+  /* Up to Unicode 3.0.1 we took the Combining property from the PropList.txt
+     file. In 3.0.1 it was identical to the union of the general categories
+     "Mn", "Mc", "Me". In Unicode 3.1 this property has been dropped from the
+     PropList.txt file, so we take the latter definition.  */
+  return (unicode_attributes[ch].name != NULL
+	  && unicode_attributes[ch].category[0] == 'M'
+	  && (unicode_attributes[ch].category[1] == 'n'
+	      || unicode_attributes[ch].category[1] == 'c'
+	      || unicode_attributes[ch].category[1] == 'e'));
+}
+
+static bool
+is_combining_level3 (unsigned int ch)
+{
+  return is_combining (ch)
+	 && !(unicode_attributes[ch].combining[0] != '\0'
+	      && unicode_attributes[ch].combining[0] != '0'
+	      && strtoul (unicode_attributes[ch].combining, NULL, 10) >= 200);
+}
+
+/* Return the UCS symbol string for a Unicode character.  */
+static const char *
+ucs_symbol (unsigned int i)
+{
+  static char buf[11+1];
+
+  sprintf (buf, (i < 0x10000 ? "<U%04X>" : "<U%08X>"), i);
+  return buf;
+}
+
+/* Return the UCS symbol range string for a Unicode characters interval.  */
+static const char *
+ucs_symbol_range (unsigned int low, unsigned int high)
+{
+  static char buf[24+1];
+
+  strcpy (buf, ucs_symbol (low));
+  strcat (buf, "..");
+  strcat (buf, ucs_symbol (high));
+  return buf;
+}
+
+/* Output a character class (= property) table.  */
+
+static void
+output_charclass (FILE *stream, const char *classname,
+		  bool (*func) (unsigned int))
+{
+  char table[0x110000];
+  unsigned int i;
+  bool need_semicolon;
+  const int max_column = 75;
+  int column;
+
+  for (i = 0; i < 0x110000; i++)
+    table[i] = (int) func (i);
+
+  fprintf (stream, "%s ", classname);
+  need_semicolon = false;
+  column = 1000;
+  for (i = 0; i < 0x110000; )
+    {
+      if (!table[i])
+	i++;
+      else
+	{
+	  unsigned int low, high;
+	  char buf[25];
+
+	  low = i;
+	  do
+	    i++;
+	  while (i < 0x110000 && table[i]);
+	  high = i - 1;
+
+	  if (low == high)
+	    strcpy (buf, ucs_symbol (low));
+	  else
+	    strcpy (buf, ucs_symbol_range (low, high));
+
+	  if (need_semicolon)
+	    {
+	      fprintf (stream, ";");
+	      column++;
+	    }
+
+	  if (column + strlen (buf) > max_column)
+	    {
+	      fprintf (stream, "/\n   ");
+	      column = 3;
+	    }
+
+	  fprintf (stream, "%s", buf);
+	  column += strlen (buf);
+	  need_semicolon = true;
+	}
+    }
+  fprintf (stream, "\n");
+}
+
+/* Output a character mapping table.  */
+
+static void
+output_charmap (FILE *stream, const char *mapname,
+		unsigned int (*func) (unsigned int))
+{
+  char table[0x110000];
+  unsigned int i;
+  bool need_semicolon;
+  const int max_column = 75;
+  int column;
+
+  for (i = 0; i < 0x110000; i++)
+    table[i] = (func (i) != i);
+
+  fprintf (stream, "%s ", mapname);
+  need_semicolon = false;
+  column = 1000;
+  for (i = 0; i < 0x110000; i++)
+    if (table[i])
+      {
+	char buf[25+1];
+
+	strcpy (buf, "(");
+	strcat (buf, ucs_symbol (i));
+	strcat (buf, ",");
+	strcat (buf, ucs_symbol (func (i)));
+	strcat (buf, ")");
+
+	if (need_semicolon)
+	  {
+	    fprintf (stream, ";");
+	    column++;
+	  }
+
+	if (column + strlen (buf) > max_column)
+	  {
+	    fprintf (stream, "/\n   ");
+	    column = 3;
+	  }
+
+	fprintf (stream, "%s", buf);
+	column += strlen (buf);
+	need_semicolon = true;
+      }
+  fprintf (stream, "\n");
+}
+
+/* Output the width table.  */
+
+static void
+output_widthmap (FILE *stream)
+{
+}
+
+/* Output the tables to the given file.  */
+
+static void
+output_tables (const char *filename, const char *version)
+{
+  FILE *stream;
+  unsigned int ch;
+
+  stream = fopen (filename, "w");
+  if (stream == NULL)
+    {
+      fprintf (stderr, "cannot open '%s' for writing\n", filename);
+      exit (1);
+    }
+
+  fprintf (stream, "escape_char /\n");
+  fprintf (stream, "comment_char %%\n");
+  fprintf (stream, "\n");
+  fprintf (stream, "%% Generated automatically by gen-unicode-ctype for Unicode %s.\n",
+	   version);
+  fprintf (stream, "\n");
+
+  fprintf (stream, "LC_IDENTIFICATION\n");
+  fprintf (stream, "title     \"Unicode %s FDCC-set\"\n", version);
+  fprintf (stream, "source    \"UnicodeData.txt, PropList.txt\"\n");
+  fprintf (stream, "address   \"\"\n");
+  fprintf (stream, "contact   \"\"\n");
+  fprintf (stream, "email     \"bug-glibc-locales@gnu.org\"\n");
+  fprintf (stream, "tel       \"\"\n");
+  fprintf (stream, "fax       \"\"\n");
+  fprintf (stream, "language  \"\"\n");
+  fprintf (stream, "territory \"Earth\"\n");
+  fprintf (stream, "revision  \"%s\"\n", version);
+  {
+    time_t now;
+    char date[11];
+    now = time (NULL);
+    strftime (date, sizeof (date), "%Y-%m-%d", gmtime (&now));
+    fprintf (stream, "date      \"%s\"\n", date);
+  }
+  fprintf (stream, "category  \"unicode:2001\";LC_CTYPE\n");
+  fprintf (stream, "END LC_IDENTIFICATION\n");
+  fprintf (stream, "\n");
+
+  /* Verifications. */
+  for (ch = 0; ch < 0x110000; ch++)
+    {
+      /* toupper restriction: "Only characters specified for the keywords
+	 lower and upper shall be specified.  */
+      if (to_upper (ch) != ch && !(is_lower (ch) || is_upper (ch)))
+	fprintf (stderr,
+		 "%s is not upper|lower but toupper(0x%04X) = 0x%04X\n",
+		 ucs_symbol (ch), ch, to_upper (ch));
+
+      /* tolower restriction: "Only characters specified for the keywords
+	 lower and upper shall be specified.  */
+      if (to_lower (ch) != ch && !(is_lower (ch) || is_upper (ch)))
+	fprintf (stderr,
+		 "%s is not upper|lower but tolower(0x%04X) = 0x%04X\n",
+		 ucs_symbol (ch), ch, to_lower (ch));
+
+      /* alpha restriction: "Characters classified as either upper or lower
+	 shall automatically belong to this class.  */
+      if ((is_lower (ch) || is_upper (ch)) && !is_alpha (ch))
+	fprintf (stderr, "%s is upper|lower but not alpha\n", ucs_symbol (ch));
+
+      /* alpha restriction: "No character specified for the keywords cntrl,
+	 digit, punct or space shall be specified."  */
+      if (is_alpha (ch) && is_cntrl (ch))
+	fprintf (stderr, "%s is alpha and cntrl\n", ucs_symbol (ch));
+      if (is_alpha (ch) && is_digit (ch))
+	fprintf (stderr, "%s is alpha and digit\n", ucs_symbol (ch));
+      if (is_alpha (ch) && is_punct (ch))
+	fprintf (stderr, "%s is alpha and punct\n", ucs_symbol (ch));
+      if (is_alpha (ch) && is_space (ch))
+	fprintf (stderr, "%s is alpha and space\n", ucs_symbol (ch));
+
+      /* space restriction: "No character specified for the keywords upper,
+	 lower, alpha, digit, graph or xdigit shall be specified."
+	 upper, lower, alpha already checked above.  */
+      if (is_space (ch) && is_digit (ch))
+	fprintf (stderr, "%s is space and digit\n", ucs_symbol (ch));
+      if (is_space (ch) && is_graph (ch))
+	fprintf (stderr, "%s is space and graph\n", ucs_symbol (ch));
+      if (is_space (ch) && is_xdigit (ch))
+	fprintf (stderr, "%s is space and xdigit\n", ucs_symbol (ch));
+
+      /* cntrl restriction: "No character specified for the keywords upper,
+	 lower, alpha, digit, punct, graph, print or xdigit shall be
+	 specified."  upper, lower, alpha already checked above.  */
+      if (is_cntrl (ch) && is_digit (ch))
+	fprintf (stderr, "%s is cntrl and digit\n", ucs_symbol (ch));
+      if (is_cntrl (ch) && is_punct (ch))
+	fprintf (stderr, "%s is cntrl and punct\n", ucs_symbol (ch));
+      if (is_cntrl (ch) && is_graph (ch))
+	fprintf (stderr, "%s is cntrl and graph\n", ucs_symbol (ch));
+      if (is_cntrl (ch) && is_print (ch))
+	fprintf (stderr, "%s is cntrl and print\n", ucs_symbol (ch));
+      if (is_cntrl (ch) && is_xdigit (ch))
+	fprintf (stderr, "%s is cntrl and xdigit\n", ucs_symbol (ch));
+
+      /* punct restriction: "No character specified for the keywords upper,
+	 lower, alpha, digit, cntrl, xdigit or as the <space> character shall
+	 be specified."  upper, lower, alpha, cntrl already checked above.  */
+      if (is_punct (ch) && is_digit (ch))
+	fprintf (stderr, "%s is punct and digit\n", ucs_symbol (ch));
+      if (is_punct (ch) && is_xdigit (ch))
+	fprintf (stderr, "%s is punct and xdigit\n", ucs_symbol (ch));
+      if (is_punct (ch) && (ch == 0x0020))
+	fprintf (stderr, "%s is punct\n", ucs_symbol (ch));
+
+      /* graph restriction: "No character specified for the keyword cntrl
+	 shall be specified."  Already checked above.  */
+
+      /* print restriction: "No character specified for the keyword cntrl
+	 shall be specified."  Already checked above.  */
+
+      /* graph - print relation: differ only in the <space> character.
+	 How is this possible if there are more than one space character?!
+	 I think susv2/xbd/locale.html should speak of "space characters",
+	 not "space character".  */
+      if (is_print (ch) && !(is_graph (ch) || /* ch == 0x0020 */ is_space (ch)))
+	fprintf (stderr,
+		 "%s is print but not graph|<space>\n", ucs_symbol (ch));
+      if (!is_print (ch) && (is_graph (ch) || ch == 0x0020))
+	fprintf (stderr,
+		 "%s is graph|<space> but not print\n", ucs_symbol (ch));
+    }
+
+  fprintf (stream, "LC_CTYPE\n");
+  output_charclass (stream, "upper", is_upper);
+  output_charclass (stream, "lower", is_lower);
+  output_charclass (stream, "alpha", is_alpha);
+  output_charclass (stream, "digit", is_digit);
+  output_charclass (stream, "outdigit", is_outdigit);
+  output_charclass (stream, "blank", is_blank);
+  output_charclass (stream, "space", is_space);
+  output_charclass (stream, "cntrl", is_cntrl);
+  output_charclass (stream, "punct", is_punct);
+  output_charclass (stream, "xdigit", is_xdigit);
+  output_charclass (stream, "graph", is_graph);
+  output_charclass (stream, "print", is_print);
+  output_charclass (stream, "class \"combining\";", is_combining);
+  output_charclass (stream, "class \"combining_level3\";", is_combining_level3);
+  output_charmap (stream, "toupper", to_upper);
+  output_charmap (stream, "tolower", to_lower);
+  output_charmap (stream, "map \"totitle\";", to_title);
+  output_widthmap (stream);
+  fprintf (stream, "END LC_CTYPE\n");
+
+  if (ferror (stream) || fclose (stream))
+    {
+      fprintf (stderr, "error writing to '%s'\n", filename);
+      exit (1);
+    }
+}
+
+int
+main (int argc, char * argv[])
+{
+  if (argc != 3)
+    {
+      fprintf (stderr, "Usage: %s UnicodeData.txt version\n", argv[0]);
+      exit (1);
+    }
+
+  fill_attributes (argv[1]);
+
+  output_tables ("unicode", argv[2]);
+
+  return 0;
+}
diff --git a/ap/build/uClibc/test/locale/show-ucs-data.c b/ap/build/uClibc/test/locale/show-ucs-data.c
new file mode 100644
index 0000000..9992ece
--- /dev/null
+++ b/ap/build/uClibc/test/locale/show-ucs-data.c
@@ -0,0 +1,62 @@
+#include <ctype.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <sys/types.h>
+
+int
+main (int argc, char *argv[])
+{
+  int n;
+  char *line = NULL;
+  size_t len = 0;
+
+  for (n = 1; n < argc; ++n)
+    {
+      FILE *fp = fopen (argv[n], "r");
+      if (fp == NULL)
+	continue;
+
+      while (! feof (fp))
+	{
+	  ssize_t cnt = getline (&line, &len, fp);
+	  char *runp;
+	  if (cnt <= 0)
+	    break;
+
+	  runp = line;
+	  do
+	    {
+	      if (runp[0] == '<' && runp[1] == 'U' && isxdigit (runp[2])
+		  && isxdigit (runp[3]) && isxdigit (runp[4])
+		  && isxdigit (runp[5]) && runp[6] == '>')
+		{
+		  unsigned int val = strtoul (runp + 2, NULL, 16);
+
+		  //putchar ('<');
+		  if (val < 128)
+		    putchar (val);
+		  else if (val < 0x800)
+		    {
+		      putchar (0xc0 | (val >> 6));
+		      putchar (0x80 | (val & 0x3f));
+		    }
+		  else
+		    {
+		      putchar (0xe0 | (val >> 12));
+		      putchar (0x80 | ((val >> 6) & 0x3f));
+		      putchar (0x80 | (val & 0x3f));
+		    }
+		  //putchar ('>');
+		  runp += 7;
+		}
+	      else
+		putchar (*runp++);
+	    }
+	  while (runp < &line[cnt]);
+	}
+
+      fclose (fp);
+    }
+
+  return 0;
+}
diff --git a/ap/build/uClibc/test/locale/tst-C-locale.c b/ap/build/uClibc/test/locale/tst-C-locale.c
new file mode 100644
index 0000000..c568cf4
--- /dev/null
+++ b/ap/build/uClibc/test/locale/tst-C-locale.c
@@ -0,0 +1,498 @@
+/* Tests of C and POSIX locale contents.
+   Copyright (C) 2000, 2001, 2002, 2003, 2004 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+   Contributed by Ulrich Drepper <drepper@redhat.com>, 2000.
+
+   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 <ctype.h>
+#include <langinfo.h>
+#include <limits.h>
+#include <locale.h>
+#include <stdio.h>
+#include <string.h>
+#include <wchar.h>
+#include <wctype.h>
+
+
+static int
+run_test (const char *locname)
+{
+  struct lconv *lc;
+  const char *str;
+  const wchar_t *wstr;
+  int result = 0;
+  locale_t loc;
+
+  /* ISO C stuff.  */
+  lc = localeconv ();
+  if (lc == NULL)
+    {
+      printf ("localeconv failed for locale %s\n", locname);
+      result = 1;
+    }
+  else
+    {
+#define STRTEST(name, exp) \
+      do								      \
+	if (strcmp (lc->name, exp) != 0)				      \
+	  {								      \
+	    printf (#name " in locale %s wrong (is \"%s\", should be \"%s\")\n",\
+		    locname, lc->name, exp);				      \
+	    result = 1;							      \
+	  }								      \
+      while (0)
+      STRTEST (decimal_point, ".");
+      STRTEST (thousands_sep, "");
+      STRTEST (grouping, "");
+      STRTEST (mon_decimal_point, "");
+      STRTEST (mon_thousands_sep, "");
+      STRTEST (mon_grouping, "");
+      STRTEST (positive_sign, "");
+      STRTEST (negative_sign, "");
+      STRTEST (currency_symbol, "");
+      STRTEST (int_curr_symbol, "");
+
+#define CHARTEST(name, exp) \
+      do								      \
+	if (lc->name != exp)						      \
+	  {								      \
+	    printf (#name " in locale %s wrong (is %d, should be %d)\n",      \
+		    locname, lc->name, CHAR_MAX);			      \
+	    result = 1;							      \
+	  }								      \
+      while (0)
+      CHARTEST (frac_digits, CHAR_MAX);
+      CHARTEST (p_cs_precedes, CHAR_MAX);
+      CHARTEST (n_cs_precedes, CHAR_MAX);
+      CHARTEST (p_sep_by_space, CHAR_MAX);
+      CHARTEST (n_sep_by_space, CHAR_MAX);
+      CHARTEST (p_sign_posn, CHAR_MAX);
+      CHARTEST (n_sign_posn, CHAR_MAX);
+      CHARTEST (int_frac_digits, CHAR_MAX);
+      CHARTEST (int_p_cs_precedes, CHAR_MAX);
+      CHARTEST (int_n_cs_precedes, CHAR_MAX);
+      CHARTEST (int_p_sep_by_space, CHAR_MAX);
+      CHARTEST (int_n_sep_by_space, CHAR_MAX);
+      CHARTEST (int_p_sign_posn, CHAR_MAX);
+      CHARTEST (int_n_sign_posn, CHAR_MAX);
+    }
+
+#undef STRTEST
+#define STRTEST(name, exp) \
+  str = nl_langinfo (name);						      \
+  if (strcmp (str, exp) != 0)						      \
+    {									      \
+      printf ("nl_langinfo(" #name ") in locale %s wrong "		      \
+	      "(is \"%s\", should be \"%s\")\n", locname, str, exp);	      \
+      result = 1;							      \
+    }
+#define WSTRTEST(name, exp) \
+  wstr = (wchar_t *) nl_langinfo (name);				      \
+  if (wcscmp (wstr, exp) != 0)						      \
+    {									      \
+      printf ("nl_langinfo(" #name ") in locale %s wrong "		      \
+	      "(is \"%S\", should be \"%S\")\n", locname, wstr, exp);	      \
+      result = 1;							      \
+    }
+
+  /* Unix stuff.  */
+  STRTEST (ABDAY_1, "Sun");
+  STRTEST (ABDAY_2, "Mon");
+  STRTEST (ABDAY_3, "Tue");
+  STRTEST (ABDAY_4, "Wed");
+  STRTEST (ABDAY_5, "Thu");
+  STRTEST (ABDAY_6, "Fri");
+  STRTEST (ABDAY_7, "Sat");
+  STRTEST (DAY_1, "Sunday");
+  STRTEST (DAY_2, "Monday");
+  STRTEST (DAY_3, "Tuesday");
+  STRTEST (DAY_4, "Wednesday");
+  STRTEST (DAY_5, "Thursday");
+  STRTEST (DAY_6, "Friday");
+  STRTEST (DAY_7, "Saturday");
+  STRTEST (ABMON_1, "Jan");
+  STRTEST (ABMON_2, "Feb");
+  STRTEST (ABMON_3, "Mar");
+  STRTEST (ABMON_4, "Apr");
+  STRTEST (ABMON_5, "May");
+  STRTEST (ABMON_6, "Jun");
+  STRTEST (ABMON_7, "Jul");
+  STRTEST (ABMON_8, "Aug");
+  STRTEST (ABMON_9, "Sep");
+  STRTEST (ABMON_10, "Oct");
+  STRTEST (ABMON_11, "Nov");
+  STRTEST (ABMON_12, "Dec");
+  STRTEST (MON_1, "January");
+  STRTEST (MON_2, "February");
+  STRTEST (MON_3, "March");
+  STRTEST (MON_4, "April");
+  STRTEST (MON_5, "May");
+  STRTEST (MON_6, "June");
+  STRTEST (MON_7, "July");
+  STRTEST (MON_8, "August");
+  STRTEST (MON_9, "September");
+  STRTEST (MON_10, "October");
+  STRTEST (MON_11, "November");
+  STRTEST (MON_12, "December");
+  STRTEST (AM_STR, "AM");
+  STRTEST (PM_STR, "PM");
+  STRTEST (D_T_FMT, "%a %b %e %H:%M:%S %Y");
+  STRTEST (D_FMT, "%m/%d/%y");
+  STRTEST (T_FMT, "%H:%M:%S");
+  STRTEST (T_FMT_AMPM, "%I:%M:%S %p");
+  STRTEST (ERA, "");
+  STRTEST (ERA_D_FMT, "");
+  STRTEST (ERA_T_FMT, "");
+  STRTEST (ERA_D_T_FMT, "");
+  STRTEST (ALT_DIGITS, "");
+
+  STRTEST (RADIXCHAR, ".");
+  STRTEST (THOUSEP, "");
+
+  STRTEST (YESEXPR, "^[yY]");
+  STRTEST (NOEXPR, "^[nN]");
+
+  /* Extensions.  */
+  WSTRTEST (_NL_WABDAY_1, L"Sun");
+  WSTRTEST (_NL_WABDAY_2, L"Mon");
+  WSTRTEST (_NL_WABDAY_3, L"Tue");
+  WSTRTEST (_NL_WABDAY_4, L"Wed");
+  WSTRTEST (_NL_WABDAY_5, L"Thu");
+  WSTRTEST (_NL_WABDAY_6, L"Fri");
+  WSTRTEST (_NL_WABDAY_7, L"Sat");
+  WSTRTEST (_NL_WDAY_1, L"Sunday");
+  WSTRTEST (_NL_WDAY_2, L"Monday");
+  WSTRTEST (_NL_WDAY_3, L"Tuesday");
+  WSTRTEST (_NL_WDAY_4, L"Wednesday");
+  WSTRTEST (_NL_WDAY_5, L"Thursday");
+  WSTRTEST (_NL_WDAY_6, L"Friday");
+  WSTRTEST (_NL_WDAY_7, L"Saturday");
+  WSTRTEST (_NL_WABMON_1, L"Jan");
+  WSTRTEST (_NL_WABMON_2, L"Feb");
+  WSTRTEST (_NL_WABMON_3, L"Mar");
+  WSTRTEST (_NL_WABMON_4, L"Apr");
+  WSTRTEST (_NL_WABMON_5, L"May");
+  WSTRTEST (_NL_WABMON_6, L"Jun");
+  WSTRTEST (_NL_WABMON_7, L"Jul");
+  WSTRTEST (_NL_WABMON_8, L"Aug");
+  WSTRTEST (_NL_WABMON_9, L"Sep");
+  WSTRTEST (_NL_WABMON_10, L"Oct");
+  WSTRTEST (_NL_WABMON_11, L"Nov");
+  WSTRTEST (_NL_WABMON_12, L"Dec");
+  WSTRTEST (_NL_WMON_1, L"January");
+  WSTRTEST (_NL_WMON_2, L"February");
+  WSTRTEST (_NL_WMON_3, L"March");
+  WSTRTEST (_NL_WMON_4, L"April");
+  WSTRTEST (_NL_WMON_5, L"May");
+  WSTRTEST (_NL_WMON_6, L"June");
+  WSTRTEST (_NL_WMON_7, L"July");
+  WSTRTEST (_NL_WMON_8, L"August");
+  WSTRTEST (_NL_WMON_9, L"September");
+  WSTRTEST (_NL_WMON_10, L"October");
+  WSTRTEST (_NL_WMON_11, L"November");
+  WSTRTEST (_NL_WMON_12, L"December");
+  WSTRTEST (_NL_WAM_STR, L"AM");
+  WSTRTEST (_NL_WPM_STR, L"PM");
+  WSTRTEST (_NL_WD_T_FMT, L"%a %b %e %H:%M:%S %Y");
+  WSTRTEST (_NL_WD_FMT, L"%m/%d/%y");
+  WSTRTEST (_NL_WT_FMT, L"%H:%M:%S");
+  WSTRTEST (_NL_WT_FMT_AMPM, L"%I:%M:%S %p");
+  WSTRTEST (_NL_WERA_D_FMT, L"");
+  WSTRTEST (_NL_WERA_T_FMT, L"");
+  WSTRTEST (_NL_WERA_D_T_FMT, L"");
+  WSTRTEST (_NL_WALT_DIGITS, L"");
+
+  STRTEST (_DATE_FMT, "%a %b %e %H:%M:%S %Z %Y");
+  WSTRTEST (_NL_W_DATE_FMT, L"%a %b %e %H:%M:%S %Z %Y");
+
+  STRTEST (INT_CURR_SYMBOL, "");
+  STRTEST (CURRENCY_SYMBOL, "");
+  STRTEST (MON_DECIMAL_POINT, "");
+  STRTEST (MON_THOUSANDS_SEP, "");
+  STRTEST (MON_GROUPING, "");
+  STRTEST (POSITIVE_SIGN, "");
+  STRTEST (NEGATIVE_SIGN, "");
+  STRTEST (GROUPING, "");
+
+  STRTEST (YESSTR, "");
+  STRTEST (NOSTR, "");
+
+  /* Test the new locale mechanisms.  */
+  loc = newlocale (LC_ALL_MASK, locname, NULL);
+  if (loc == NULL)
+    {
+      printf ("cannot create locale object for locale %s\n", locname);
+      result = 1;
+    }
+  else
+    {
+      int c;
+
+#undef STRTEST
+#define STRTEST(name, exp) \
+      str = nl_langinfo_l (name, loc);				      \
+      if (strcmp (str, exp) != 0)					      \
+	{								      \
+	  printf ("nl_langinfo_l(" #name ") in locale %s wrong "	      \
+		  "(is \"%s\", should be \"%s\")\n", locname, str, exp);      \
+	  result = 1;							      \
+	}
+#undef WSTRTEST
+#define WSTRTEST(name, exp) \
+      wstr = (wchar_t *) nl_langinfo_l (name, loc);			      \
+      if (wcscmp (wstr, exp) != 0)					      \
+	{								      \
+	  printf ("nl_langinfo_l(" #name ") in locale %s wrong "	      \
+		  "(is \"%S\", should be \"%S\")\n", locname, wstr, exp);     \
+	  result = 1;							      \
+	}
+
+      /* Unix stuff.  */
+      STRTEST (ABDAY_1, "Sun");
+      STRTEST (ABDAY_2, "Mon");
+      STRTEST (ABDAY_3, "Tue");
+      STRTEST (ABDAY_4, "Wed");
+      STRTEST (ABDAY_5, "Thu");
+      STRTEST (ABDAY_6, "Fri");
+      STRTEST (ABDAY_7, "Sat");
+      STRTEST (DAY_1, "Sunday");
+      STRTEST (DAY_2, "Monday");
+      STRTEST (DAY_3, "Tuesday");
+      STRTEST (DAY_4, "Wednesday");
+      STRTEST (DAY_5, "Thursday");
+      STRTEST (DAY_6, "Friday");
+      STRTEST (DAY_7, "Saturday");
+      STRTEST (ABMON_1, "Jan");
+      STRTEST (ABMON_2, "Feb");
+      STRTEST (ABMON_3, "Mar");
+      STRTEST (ABMON_4, "Apr");
+      STRTEST (ABMON_5, "May");
+      STRTEST (ABMON_6, "Jun");
+      STRTEST (ABMON_7, "Jul");
+      STRTEST (ABMON_8, "Aug");
+      STRTEST (ABMON_9, "Sep");
+      STRTEST (ABMON_10, "Oct");
+      STRTEST (ABMON_11, "Nov");
+      STRTEST (ABMON_12, "Dec");
+      STRTEST (MON_1, "January");
+      STRTEST (MON_2, "February");
+      STRTEST (MON_3, "March");
+      STRTEST (MON_4, "April");
+      STRTEST (MON_5, "May");
+      STRTEST (MON_6, "June");
+      STRTEST (MON_7, "July");
+      STRTEST (MON_8, "August");
+      STRTEST (MON_9, "September");
+      STRTEST (MON_10, "October");
+      STRTEST (MON_11, "November");
+      STRTEST (MON_12, "December");
+      STRTEST (AM_STR, "AM");
+      STRTEST (PM_STR, "PM");
+      STRTEST (D_T_FMT, "%a %b %e %H:%M:%S %Y");
+      STRTEST (D_FMT, "%m/%d/%y");
+      STRTEST (T_FMT, "%H:%M:%S");
+      STRTEST (T_FMT_AMPM, "%I:%M:%S %p");
+      STRTEST (ERA, "");
+      STRTEST (ERA_D_FMT, "");
+      STRTEST (ERA_T_FMT, "");
+      STRTEST (ERA_D_T_FMT, "");
+      STRTEST (ALT_DIGITS, "");
+
+      STRTEST (RADIXCHAR, ".");
+      STRTEST (THOUSEP, "");
+
+      STRTEST (YESEXPR, "^[yY]");
+      STRTEST (NOEXPR, "^[nN]");
+
+      /* Extensions.  */
+      WSTRTEST (_NL_WABDAY_1, L"Sun");
+      WSTRTEST (_NL_WABDAY_2, L"Mon");
+      WSTRTEST (_NL_WABDAY_3, L"Tue");
+      WSTRTEST (_NL_WABDAY_4, L"Wed");
+      WSTRTEST (_NL_WABDAY_5, L"Thu");
+      WSTRTEST (_NL_WABDAY_6, L"Fri");
+      WSTRTEST (_NL_WABDAY_7, L"Sat");
+      WSTRTEST (_NL_WDAY_1, L"Sunday");
+      WSTRTEST (_NL_WDAY_2, L"Monday");
+      WSTRTEST (_NL_WDAY_3, L"Tuesday");
+      WSTRTEST (_NL_WDAY_4, L"Wednesday");
+      WSTRTEST (_NL_WDAY_5, L"Thursday");
+      WSTRTEST (_NL_WDAY_6, L"Friday");
+      WSTRTEST (_NL_WDAY_7, L"Saturday");
+      WSTRTEST (_NL_WABMON_1, L"Jan");
+      WSTRTEST (_NL_WABMON_2, L"Feb");
+      WSTRTEST (_NL_WABMON_3, L"Mar");
+      WSTRTEST (_NL_WABMON_4, L"Apr");
+      WSTRTEST (_NL_WABMON_5, L"May");
+      WSTRTEST (_NL_WABMON_6, L"Jun");
+      WSTRTEST (_NL_WABMON_7, L"Jul");
+      WSTRTEST (_NL_WABMON_8, L"Aug");
+      WSTRTEST (_NL_WABMON_9, L"Sep");
+      WSTRTEST (_NL_WABMON_10, L"Oct");
+      WSTRTEST (_NL_WABMON_11, L"Nov");
+      WSTRTEST (_NL_WABMON_12, L"Dec");
+      WSTRTEST (_NL_WMON_1, L"January");
+      WSTRTEST (_NL_WMON_2, L"February");
+      WSTRTEST (_NL_WMON_3, L"March");
+      WSTRTEST (_NL_WMON_4, L"April");
+      WSTRTEST (_NL_WMON_5, L"May");
+      WSTRTEST (_NL_WMON_6, L"June");
+      WSTRTEST (_NL_WMON_7, L"July");
+      WSTRTEST (_NL_WMON_8, L"August");
+      WSTRTEST (_NL_WMON_9, L"September");
+      WSTRTEST (_NL_WMON_10, L"October");
+      WSTRTEST (_NL_WMON_11, L"November");
+      WSTRTEST (_NL_WMON_12, L"December");
+      WSTRTEST (_NL_WAM_STR, L"AM");
+      WSTRTEST (_NL_WPM_STR, L"PM");
+      WSTRTEST (_NL_WD_T_FMT, L"%a %b %e %H:%M:%S %Y");
+      WSTRTEST (_NL_WD_FMT, L"%m/%d/%y");
+      WSTRTEST (_NL_WT_FMT, L"%H:%M:%S");
+      WSTRTEST (_NL_WT_FMT_AMPM, L"%I:%M:%S %p");
+      WSTRTEST (_NL_WERA_D_FMT, L"");
+      WSTRTEST (_NL_WERA_T_FMT, L"");
+      WSTRTEST (_NL_WERA_D_T_FMT, L"");
+      WSTRTEST (_NL_WALT_DIGITS, L"");
+
+      STRTEST (_DATE_FMT, "%a %b %e %H:%M:%S %Z %Y");
+      WSTRTEST (_NL_W_DATE_FMT, L"%a %b %e %H:%M:%S %Z %Y");
+
+      STRTEST (INT_CURR_SYMBOL, "");
+      STRTEST (CURRENCY_SYMBOL, "");
+      STRTEST (MON_DECIMAL_POINT, "");
+      STRTEST (MON_THOUSANDS_SEP, "");
+      STRTEST (MON_GROUPING, "");
+      STRTEST (POSITIVE_SIGN, "");
+      STRTEST (NEGATIVE_SIGN, "");
+      STRTEST (GROUPING, "");
+
+      STRTEST (YESSTR, "");
+      STRTEST (NOSTR, "");
+
+      /* Character class tests.  */
+      for (c = 0; c < 128; ++c)
+	{
+#define CLASSTEST(name) \
+	  if (is##name (c) != is##name##_l (c, loc))			      \
+	    {								      \
+	      printf ("is%s('\\%o') != is%s_l('\\%o')\n",		      \
+		      #name, c, #name, c);				      \
+	      result = 1;						      \
+	    }
+	  CLASSTEST (alnum);
+	  CLASSTEST (alpha);
+	  CLASSTEST (blank);
+	  CLASSTEST (cntrl);
+	  CLASSTEST (digit);
+	  CLASSTEST (lower);
+	  CLASSTEST (graph);
+	  CLASSTEST (print);
+	  CLASSTEST (punct);
+	  CLASSTEST (space);
+	  CLASSTEST (upper);
+	  CLASSTEST (xdigit);
+
+	  /* Character mapping tests.  */
+#define MAPTEST(name) \
+	  if (to##name (c) != to##name##_l (c, loc))			      \
+	    {								      \
+	      printf ("to%s('\\%o') != to%s_l('\\%o'): '\\%o' vs '\\%o'\n", \
+		      #name, c, #name, c,				      \
+		      to##name (c), to##name##_l (c, loc));		      \
+	      result = 1;						      \
+	    }
+	  MAPTEST (lower);
+	  MAPTEST (upper);
+	}
+
+      /* Character class tests, this time for wide characters.  Note that
+	 this only works because we know that the internal encoding is
+	 UCS4.  */
+      for (c = 0; c < 128; ++c)
+	{
+#undef CLASSTEST
+#define CLASSTEST(name) \
+	  if (isw##name (c) != isw##name##_l (c, loc))		      \
+	    {								      \
+	      printf ("isw%s('\\%o') != isw%s_l('\\%o')\n",		      \
+		      #name, c, #name, c);				      \
+	      result = 1;						      \
+	    }
+	  CLASSTEST (alnum);
+	  CLASSTEST (alpha);
+	  CLASSTEST (blank);
+	  CLASSTEST (cntrl);
+	  CLASSTEST (digit);
+	  CLASSTEST (lower);
+	  CLASSTEST (graph);
+	  CLASSTEST (print);
+	  CLASSTEST (punct);
+	  CLASSTEST (space);
+	  CLASSTEST (upper);
+	  CLASSTEST (xdigit);
+
+	  /* Character mapping tests.  Note that
+	     this only works because we know that the internal encoding is
+	     UCS4.  */
+#undef MAPTEST
+#define MAPTEST(name) \
+	  if (tow##name (c) != tow##name##_l (c, loc))		      \
+	    {								      \
+	      printf ("tow%s('\\%o') != tow%s_l('\\%o'): '\\%o' vs '\\%o'\n",\
+		      #name, c, #name, c,				      \
+		      tow##name (c), tow##name##_l (c, loc));		      \
+	      result = 1;						      \
+	    }
+	  MAPTEST (lower);
+	  MAPTEST (upper);
+	}
+
+      freelocale (loc);
+    }
+
+  return result;
+}
+
+
+static int
+do_test (void)
+{
+  int result;
+
+  /* First use the name "C".  */
+  if (setlocale (LC_ALL, "C") == NULL)
+    {
+      puts ("cannot set C locale");
+      result = 1;
+    }
+  else
+    result = run_test ("C");
+
+  /* Then the name "POSIX".  */
+  if (setlocale (LC_ALL, "POSIX") == NULL)
+    {
+      puts ("cannot set POSIX locale");
+      result = 1;
+    }
+  else
+    result |= run_test ("POSIX");
+
+  return result;
+}
+
+#define TEST_FUNCTION do_test ()
+#include "../test-skeleton.c"
diff --git a/ap/build/uClibc/test/locale/tst-ctype-de_DE.ISO-8859-1.in b/ap/build/uClibc/test/locale/tst-ctype-de_DE.ISO-8859-1.in
new file mode 100644
index 0000000..f71d76c
--- /dev/null
+++ b/ap/build/uClibc/test/locale/tst-ctype-de_DE.ISO-8859-1.in
@@ -0,0 +1,56 @@
+lower    ¡¢£¤¥¦§¨©ª«¬­®¯°±²³´µ¶·¸¹º»¼½¾¿ÀÁÂÃÄÅÆÇÈÉÊËÌÍÎÏ
+        000000000000000000000100000000000000000000000000
+lower   ÐÑÒÓÔÕÖרÙÚÛÜÝÞßàáâãäåæçèéêëìíîïðñòóôõö÷øùúûüýþÿ
+        000000000000000111111111111111111111111011111111
+upper    ¡¢£¤¥¦§¨©ª«¬­®¯°±²³´µ¶·¸¹º»¼½¾¿ÀÁÂÃÄÅÆÇÈÉÊËÌÍÎÏ
+        000000000000000000000000000000001111111111111111
+upper   ÐÑÒÓÔÕÖרÙÚÛÜÝÞßàáâãäåæçèéêëìíîïðñòóôõö÷øùúûüýþÿ
+        111111101111111000000000000000000000000000000000
+alpha    ¡¢£¤¥¦§¨©ª«¬­®¯°±²³´µ¶·¸¹º»¼½¾¿ÀÁÂÃÄÅÆÇÈÉÊËÌÍÎÏ
+        000000000010000000000100001000001111111111111111
+alpha   ÐÑÒÓÔÕÖרÙÚÛÜÝÞßàáâãäåæçèéêëìíîïðñòóôõö÷øùúûüýþÿ
+        111111101111111111111111111111111111111011111111
+digit    ¡¢£¤¥¦§¨©ª«¬­®¯°±²³´µ¶·¸¹º»¼½¾¿ÀÁÂÃÄÅÆÇÈÉÊËÌÍÎÏ
+        000000000000000000000000000000000000000000000000
+digit   ÐÑÒÓÔÕÖרÙÚÛÜÝÞßàáâãäåæçèéêëìíîïðñòóôõö÷øùúûüýþÿ
+        000000000000000000000000000000000000000000000000
+xdigit   ¡¢£¤¥¦§¨©ª«¬­®¯°±²³´µ¶·¸¹º»¼½¾¿ÀÁÂÃÄÅÆÇÈÉÊËÌÍÎÏ
+        000000000000000000000000000000000000000000000000
+xdigit  ÐÑÒÓÔÕÖרÙÚÛÜÝÞßàáâãäåæçèéêëìíîïðñòóôõö÷øùúûüýþÿ
+        000000000000000000000000000000000000000000000000
+space    ¡¢£¤¥¦§¨©ª«¬­®¯°±²³´µ¶·¸¹º»¼½¾¿ÀÁÂÃÄÅÆÇÈÉÊËÌÍÎÏ
+        000000000000000000000000000000000000000000000000
+space   ÐÑÒÓÔÕÖרÙÚÛÜÝÞßàáâãäåæçèéêëìíîïðñòóôõö÷øùúûüýþÿ
+        000000000000000000000000000000000000000000000000
+print    ¡¢£¤¥¦§¨©ª«¬­®¯°±²³´µ¶·¸¹º»¼½¾¿ÀÁÂÃÄÅÆÇÈÉÊËÌÍÎÏ
+        111111111111111111111111111111111111111111111111
+print   ÐÑÒÓÔÕÖרÙÚÛÜÝÞßàáâãäåæçèéêëìíîïðñòóôõö÷øùúûüýþÿ
+        111111111111111111111111111111111111111111111111
+graph    ¡¢£¤¥¦§¨©ª«¬­®¯°±²³´µ¶·¸¹º»¼½¾¿ÀÁÂÃÄÅÆÇÈÉÊËÌÍÎÏ
+        111111111111111111111111111111111111111111111111
+graph   ÐÑÒÓÔÕÖרÙÚÛÜÝÞßàáâãäåæçèéêëìíîïðñòóôõö÷øùúûüýþÿ
+        111111111111111111111111111111111111111111111111
+blank    ¡¢£¤¥¦§¨©ª«¬­®¯°±²³´µ¶·¸¹º»¼½¾¿ÀÁÂÃÄÅÆÇÈÉÊËÌÍÎÏ
+        000000000000000000000000000000000000000000000000
+blank   ÐÑÒÓÔÕÖרÙÚÛÜÝÞßàáâãäåæçèéêëìíîïðñòóôõö÷øùúûüýþÿ
+        000000000000000000000000000000000000000000000000
+cntrl    ¡¢£¤¥¦§¨©ª«¬­®¯°±²³´µ¶·¸¹º»¼½¾¿ÀÁÂÃÄÅÆÇÈÉÊËÌÍÎÏ
+        000000000000000000000000000000000000000000000000
+cntrl   ÐÑÒÓÔÕÖרÙÚÛÜÝÞßàáâãäåæçèéêëìíîïðñòóôõö÷øùúûüýþÿ
+        000000000000000000000000000000000000000000000000
+punct    ¡¢£¤¥¦§¨©ª«¬­®¯°±²³´µ¶·¸¹º»¼½¾¿ÀÁÂÃÄÅÆÇÈÉÊËÌÍÎÏ
+        111111111101111111111011110111110000000000000000
+punct   ÐÑÒÓÔÕÖרÙÚÛÜÝÞßàáâãäåæçèéêëìíîïðñòóôõö÷øùúûüýþÿ
+        000000010000000000000000000000000000000100000000
+alnum    ¡¢£¤¥¦§¨©ª«¬­®¯°±²³´µ¶·¸¹º»¼½¾¿ÀÁÂÃÄÅÆÇÈÉÊËÌÍÎÏ
+        000000000010000000000100001000001111111111111111
+alnum   ÐÑÒÓÔÕÖרÙÚÛÜÝÞßàáâãäåæçèéêëìíîïðñòóôõö÷øùúûüýþÿ
+        111111101111111111111111111111111111111011111111
+tolower  ¡¢£¤¥¦§¨©ª«¬­®¯°±²³´µ¶·¸¹º»¼½¾¿ÀÁÂÃÄÅÆÇÈÉÊËÌÍÎÏ
+         ¡¢£¤¥¦§¨©ª«¬­®¯°±²³´µ¶·¸¹º»¼½¾¿àáâãäåæçèéêëìíîï
+tolower ÐÑÒÓÔÕÖרÙÚÛÜÝÞßàáâãäåæçèéêëìíîïðñòóôõö÷øùúûüýþÿ
+        ðñòóôõö×øùúûüýþßàáâãäåæçèéêëìíîïðñòóôõö÷øùúûüýþÿ
+toupper  ¡¢£¤¥¦§¨©ª«¬­®¯°±²³´µ¶·¸¹º»¼½¾¿ÀÁÂÃÄÅÆÇÈÉÊËÌÍÎÏ
+         ¡¢£¤¥¦§¨©ª«¬­®¯°±²³´µ¶·¸¹º»¼½¾¿ÀÁÂÃÄÅÆÇÈÉÊËÌÍÎÏ
+toupper ÐÑÒÓÔÕÖרÙÚÛÜÝÞßàáâãäåæçèéêëìíîïðñòóôõö÷øùúûüýþÿ
+        ÐÑÒÓÔÕÖרÙÚÛÜÝÞßÀÁÂÃÄÅÆÇÈÉÊËÌÍÎÏÐÑÒÓÔÕÖ÷ØÙÚÛÜÝÞÿ
diff --git a/ap/build/uClibc/test/locale/tst-ctype.c b/ap/build/uClibc/test/locale/tst-ctype.c
new file mode 100644
index 0000000..c03c2da
--- /dev/null
+++ b/ap/build/uClibc/test/locale/tst-ctype.c
@@ -0,0 +1,447 @@
+/* Copyright (C) 2000,02, 05 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+   Contributed by Ulrich Drepper <drepper@gnu.org>, 2000.
+
+   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 <ctype.h>
+#include <locale.h>
+#include <langinfo.h>
+#include <stdio.h>
+#include <string.h>
+
+
+static const char lower[] = "abcdefghijklmnopqrstuvwxyz";
+static const char upper[] = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";
+static const char digits[] = "0123456789";
+static const char cntrl[] = "\
+\x01\x02\x03\x04\x05\x06\x07\x08\x09\x0a\x0b\x0c\x0d\x0e\x0f\
+\x11\x12\x13\x14\x15\x16\x17\x18\x19\x1a\x1b\x1c\x1d\x1e\x1f ";
+
+
+static struct classes
+{
+  const char *name;
+  int mask;
+} classes[] =
+{
+#define ENTRY(name) { #name, _IS##name }
+  ENTRY (upper),
+  ENTRY (lower),
+  ENTRY (alpha),
+  ENTRY (digit),
+  ENTRY (xdigit),
+  ENTRY (space),
+  ENTRY (print),
+  ENTRY (graph),
+  ENTRY (blank),
+  ENTRY (cntrl),
+  ENTRY (punct),
+  ENTRY (alnum)
+};
+#define nclasses (sizeof (classes) / sizeof (classes[0]))
+
+
+#define FAIL(str, args...) \
+  {									      \
+    printf ("      " str "\n", ##args);					      \
+    ++errors;								      \
+  }
+
+
+int
+main (void)
+{
+  const char *cp;
+  const char *cp2;
+  int errors = 0;
+  char *inpline = NULL;
+  size_t inplinelen = 0;
+  char *resline = NULL;
+  size_t reslinelen = 0;
+  size_t n;
+
+  setlocale (LC_ALL, "");
+
+  printf ("Testing the ctype data of the `%s' locale\n",
+	  setlocale (LC_CTYPE, NULL));
+
+#if 0
+  /* Just for debugging.  */
+
+  /* Contents of the class array.  */
+  printf ("\
+upper = %04x  lower = %04x  alpha = %04x  digit = %04x  xdigit = %04x\n\
+space = %04x  print = %04x  graph = %04x  blank = %04x  cntrl  = %04x\n\
+punct = %04x  alnum = %04x\n",
+	  _ISupper, _ISlower, _ISalpha, _ISdigit, _ISxdigit,
+	  _ISspace, _ISprint, _ISgraph, _ISblank, _IScntrl,
+	  _ISpunct, _ISalnum);
+
+  while (n < 256)
+    {
+      if (n % 8 == 0)
+	printf ("%02x: ", n);
+      printf ("%04x%s", __ctype_b[n], (n + 1) % 8 == 0 ? "\n" : " ");
+      ++n;
+    }
+#endif
+
+  puts ("  Test of ASCII character range\n    special NUL byte handling");
+  if (isupper ('\0'))
+    FAIL ("isupper ('\\0') is true");
+  if (islower ('\0'))
+    FAIL ("islower ('\\0') is true");
+  if (isalpha ('\0'))
+    FAIL ("isalpha ('\\0') is true");
+  if (isdigit ('\0'))
+    FAIL ("isdigit ('\\0') is true");
+  if (isxdigit ('\0'))
+    FAIL ("isxdigit ('\\0') is true");
+  if (isspace ('\0'))
+    FAIL ("isspace ('\\0') is true");
+  if (isprint ('\0'))
+    FAIL ("isprint ('\\0') is true");
+  if (isgraph ('\0'))
+    FAIL ("isgraph ('\\0') is true");
+  if (isblank ('\0'))
+    FAIL ("isblank ('\\0') is true");
+  if (! iscntrl ('\0'))
+    FAIL ("iscntrl ('\\0') not true");
+  if (ispunct ('\0'))
+    FAIL ("ispunct ('\\0') is true");
+  if (isalnum ('\0'))
+    FAIL ("isalnum ('\\0') is true");
+
+  puts ("    islower()");
+  for (cp = lower; *cp != '\0'; ++cp)
+    if (! islower (*cp))
+      FAIL ("islower ('%c') not true", *cp);
+  for (cp = upper; *cp != '\0'; ++cp)
+    if (islower (*cp))
+      FAIL ("islower ('%c') is true", *cp);
+  for (cp = digits; *cp != '\0'; ++cp)
+    if (islower (*cp))
+      FAIL ("islower ('%c') is true", *cp);
+  for (cp = cntrl; *cp != '\0'; ++cp)
+    if (islower (*cp))
+      FAIL ("islower ('\\x%02x') is true", *cp);
+
+  puts ("    isupper()");
+  for (cp = lower; *cp != '\0'; ++cp)
+    if (isupper (*cp))
+      FAIL ("isupper ('%c') is true", *cp);
+  for (cp = upper; *cp != '\0'; ++cp)
+    if (! isupper (*cp))
+      FAIL ("isupper ('%c') not true", *cp);
+  for (cp = digits; *cp != '\0'; ++cp)
+    if (isupper (*cp))
+      FAIL ("isupper ('%c') is true", *cp);
+  for (cp = cntrl; *cp != '\0'; ++cp)
+    if (isupper (*cp))
+      FAIL ("isupper ('\\x%02x') is true", *cp);
+
+  puts ("    isalpha()");
+  for (cp = lower; *cp != '\0'; ++cp)
+    if (! isalpha (*cp))
+      FAIL ("isalpha ('%c') not true", *cp);
+  for (cp = upper; *cp != '\0'; ++cp)
+    if (! isalpha (*cp))
+      FAIL ("isalpha ('%c') not true", *cp);
+  for (cp = digits; *cp != '\0'; ++cp)
+    if (isalpha (*cp))
+      FAIL ("isalpha ('%c') is true", *cp);
+  for (cp = cntrl; *cp != '\0'; ++cp)
+    if (isalpha (*cp))
+      FAIL ("isalpha ('\\x%02x') is true", *cp);
+
+  puts ("    isdigit()");
+  for (cp = lower; *cp != '\0'; ++cp)
+    if (isdigit (*cp))
+      FAIL ("isdigit ('%c') is true", *cp);
+  for (cp = upper; *cp != '\0'; ++cp)
+    if (isdigit (*cp))
+      FAIL ("isdigit ('%c') is true", *cp);
+  for (cp = digits; *cp != '\0'; ++cp)
+    if (! isdigit (*cp))
+      FAIL ("isdigit ('%c') not true", *cp);
+  for (cp = cntrl; *cp != '\0'; ++cp)
+    if (isdigit (*cp))
+      FAIL ("isdigit ('\\x%02x') is true", *cp);
+
+  puts ("    isxdigit()");
+  for (cp = lower; *cp != '\0'; ++cp)
+    if ((! isxdigit (*cp) && cp - lower < 6)
+	|| (isxdigit (*cp) && cp - lower >= 6))
+      FAIL ("isxdigit ('%c') %s true", *cp, cp - upper < 6 ? "not" : "is");
+  for (cp = upper; *cp != '\0'; ++cp)
+    if ((! isxdigit (*cp) && cp - upper < 6)
+	|| (isxdigit (*cp) && cp - upper >= 6))
+      FAIL ("isxdigit ('%c') %s true", *cp, cp - upper < 6 ? "not" : "is");
+  for (cp = digits; *cp != '\0'; ++cp)
+    if (! isxdigit (*cp))
+      FAIL ("isxdigit ('%c') not true", *cp);
+  for (cp = cntrl; *cp != '\0'; ++cp)
+    if (isxdigit (*cp))
+      FAIL ("isxdigit ('\\x%02x') is true", *cp);
+
+  puts ("    isspace()");
+  for (cp = lower; *cp != '\0'; ++cp)
+    if (isspace (*cp))
+      FAIL ("isspace ('%c') is true", *cp);
+  for (cp = upper; *cp != '\0'; ++cp)
+    if (isspace (*cp))
+      FAIL ("isspace ('%c') is true", *cp);
+  for (cp = digits; *cp != '\0'; ++cp)
+    if (isspace (*cp))
+      FAIL ("isspace ('%c') is true", *cp);
+  for (cp = cntrl; *cp != '\0'; ++cp)
+    if ((isspace (*cp) && ((*cp < '\x09' || *cp > '\x0d') && *cp != ' '))
+	|| (! isspace (*cp)
+	    && ((*cp >= '\x09' && *cp <= '\x0d') || *cp == ' ')))
+      FAIL ("isspace ('\\x%02x') %s true", *cp,
+	    (*cp < '\x09' || *cp > '\x0d') ? "is" : "not");
+
+  puts ("    isprint()");
+  for (cp = lower; *cp != '\0'; ++cp)
+    if (! isprint (*cp))
+      FAIL ("isprint ('%c') not true", *cp);
+  for (cp = upper; *cp != '\0'; ++cp)
+    if (! isprint (*cp))
+      FAIL ("isprint ('%c') not true", *cp);
+  for (cp = digits; *cp != '\0'; ++cp)
+    if (! isprint (*cp))
+      FAIL ("isprint ('%c') not true", *cp);
+  for (cp = cntrl; *cp != '\0'; ++cp)
+    if ((isprint (*cp) && *cp != ' ')
+	|| (! isprint (*cp) && *cp == ' '))
+      FAIL ("isprint ('\\x%02x') is true", *cp);
+
+  puts ("    isgraph()");
+  for (cp = lower; *cp != '\0'; ++cp)
+    if (! isgraph (*cp))
+      FAIL ("isgraph ('%c') not true", *cp);
+  for (cp = upper; *cp != '\0'; ++cp)
+    if (! isgraph (*cp))
+      FAIL ("isgraph ('%c') not true", *cp);
+  for (cp = digits; *cp != '\0'; ++cp)
+    if (! isgraph (*cp))
+      FAIL ("isgraph ('%c') not true", *cp);
+  for (cp = cntrl; *cp != '\0'; ++cp)
+    if (isgraph (*cp))
+      FAIL ("isgraph ('\\x%02x') is true", *cp);
+
+  puts ("    isblank()");
+  for (cp = lower; *cp != '\0'; ++cp)
+    if (isblank (*cp))
+      FAIL ("isblank ('%c') is true", *cp);
+  for (cp = upper; *cp != '\0'; ++cp)
+    if (isblank (*cp))
+      FAIL ("isblank ('%c') is true", *cp);
+  for (cp = digits; *cp != '\0'; ++cp)
+    if (isblank (*cp))
+      FAIL ("isblank ('%c') is true", *cp);
+  for (cp = cntrl; *cp != '\0'; ++cp)
+    if ((isblank (*cp) && *cp != '\x09' && *cp != ' ')
+	|| (! isblank (*cp) && (*cp == '\x09' || *cp == ' ')))
+      FAIL ("isblank ('\\x%02x') %s true", *cp, *cp != '\x09' ? "is" : "not");
+
+  puts ("    iscntrl()");
+  for (cp = lower; *cp != '\0'; ++cp)
+    if (iscntrl (*cp))
+      FAIL ("iscntrl ('%c') is true", *cp);
+  for (cp = upper; *cp != '\0'; ++cp)
+    if (iscntrl (*cp))
+      FAIL ("iscntrl ('%c') is true", *cp);
+  for (cp = digits; *cp != '\0'; ++cp)
+    if (iscntrl (*cp))
+      FAIL ("iscntrl ('%c') is true", *cp);
+  for (cp = cntrl; *cp != '\0'; ++cp)
+    if ((iscntrl (*cp) && *cp == ' ')
+	|| (! iscntrl (*cp) && *cp != ' '))
+      FAIL ("iscntrl ('\\x%02x') not true", *cp);
+
+  puts ("    ispunct()");
+  for (cp = lower; *cp != '\0'; ++cp)
+    if (ispunct (*cp))
+      FAIL ("ispunct ('%c') is true", *cp);
+  for (cp = upper; *cp != '\0'; ++cp)
+    if (ispunct (*cp))
+      FAIL ("ispunct ('%c') is true", *cp);
+  for (cp = digits; *cp != '\0'; ++cp)
+    if (ispunct (*cp))
+      FAIL ("ispunct ('%c') is true", *cp);
+  for (cp = cntrl; *cp != '\0'; ++cp)
+    if (ispunct (*cp))
+      FAIL ("ispunct ('\\x%02x') is true", *cp);
+
+  puts ("    isalnum()");
+  for (cp = lower; *cp != '\0'; ++cp)
+    if (! isalnum (*cp))
+      FAIL ("isalnum ('%c') not true", *cp);
+  for (cp = upper; *cp != '\0'; ++cp)
+    if (! isalnum (*cp))
+      FAIL ("isalnum ('%c') not true", *cp);
+  for (cp = digits; *cp != '\0'; ++cp)
+    if (! isalnum (*cp))
+      FAIL ("isalnum ('%c') not true", *cp);
+  for (cp = cntrl; *cp != '\0'; ++cp)
+    if (isalnum (*cp))
+      FAIL ("isalnum ('\\x%02x') is true", *cp);
+
+
+  puts ("    tolower()");
+  for (cp = lower; *cp != '\0'; ++cp)
+    if (tolower (*cp) != *cp)
+      FAIL ("tolower ('%c') != '%c'", *cp, *cp);
+  for (cp = upper, cp2 = lower; *cp != '\0'; ++cp, ++cp2)
+    if (tolower (*cp) != *cp2)
+      FAIL ("tolower ('%c') != '%c'", *cp, *cp2);
+  for (cp = digits; *cp != '\0'; ++cp)
+    if (tolower (*cp) != *cp)
+      FAIL ("tolower ('%c') != '%c'", *cp, *cp);
+  for (cp = cntrl; *cp != '\0'; ++cp)
+    if (tolower (*cp) != *cp)
+      FAIL ("tolower ('\\x%02x') != '\\x%02x'", *cp, *cp);
+
+  puts ("    toupper()");
+  for (cp = lower, cp2 = upper; *cp != '\0'; ++cp, ++cp2)
+    if (toupper (*cp) != *cp2)
+      FAIL ("toupper ('%c') != '%c'", *cp, *cp2);
+  for (cp = upper; *cp != '\0'; ++cp)
+    if (toupper (*cp) != *cp)
+      FAIL ("toupper ('%c') != '%c'", *cp, *cp);
+  for (cp = digits; *cp != '\0'; ++cp)
+    if (toupper (*cp) != *cp)
+      FAIL ("toupper ('%c') != '%c'", *cp, *cp);
+  for (cp = cntrl; *cp != '\0'; ++cp)
+    if (toupper (*cp) != *cp)
+      FAIL ("toupper ('\\x%02x') != '\\x%02x'", *cp, *cp);
+
+
+  /* Now some locale specific tests.  */
+  while (! feof (stdin))
+    {
+      unsigned char *inp;
+      unsigned char *resp;
+
+      if (getline (&inpline, &inplinelen, stdin) <= 0
+	  || getline (&resline, &reslinelen, stdin) <= 0)
+	break;
+
+      inp = (unsigned char *) strchr (inpline, '\n');
+      if (inp != NULL)
+	*inp = '\0';
+      resp = (unsigned char *) strchr (resline, '\n');
+      if (resp != NULL)
+	*resp = '\0';
+
+      inp = (unsigned char *) inpline;
+      while (*inp != ' ' && *inp != '\t' && *inp && *inp != '\n'
+	     && *inp != '\0')
+	++inp;
+
+      if (*inp == '\0')
+	{
+	  printf ("line \"%s\" is without content\n", inpline);
+	  continue;
+	}
+      *inp++ = '\0';
+      while (*inp == ' ' || *inp == '\t')
+	++inp;
+
+      /* Try all classes.  */
+      for (n = 0; n < nclasses; ++n)
+	if (strcmp (inpline, classes[n].name) == 0)
+	  break;
+
+      resp = (unsigned char *) resline;
+      while (*resp == ' ' || *resp == '\t')
+	++resp;
+
+      if (strlen ((char *) inp) != strlen ((char *) resp))
+	{
+	  printf ("lines \"%.20s\"... and \"%.20s\" have not the same length\n",
+		  inp, resp);
+	  continue;
+	}
+
+      if (n < nclasses)
+	{
+	  if (strspn ((char *) resp, "01") != strlen ((char *) resp))
+	    {
+	      printf ("result string \"%s\" malformed\n", resp);
+	      continue;
+	    }
+
+	  printf ("  Locale-specific tests for `%s'\n", inpline);
+
+	  while (*inp != '\0' && *inp != '\n')
+	    {
+	      if (((__ctype_b[(unsigned int) *inp] & classes[n].mask) != 0)
+		  != (*resp != '0'))
+		{
+		  printf ("    is%s('%c' = '\\x%02x') %s true\n", inpline,
+			  *inp, *inp, *resp == '1' ? "not" : "is");
+		  ++errors;
+		}
+	      ++inp;
+	      ++resp;
+	    }
+	}
+      else if (strcmp (inpline, "tolower") == 0)
+	{
+	  while (*inp != '\0')
+	    {
+	      if (tolower (*inp) != *resp)
+		{
+		  printf ("    tolower('%c' = '\\x%02x') != '%c'\n",
+			  *inp, *inp, *resp);
+		  ++errors;
+		}
+	      ++inp;
+	      ++resp;
+	    }
+	}
+      else if (strcmp (inpline, "toupper") == 0)
+	{
+	  while (*inp != '\0')
+	    {
+	      if (toupper (*inp) != *resp)
+		{
+		  printf ("    toupper('%c' = '\\x%02x') != '%c'\n",
+			  *inp, *inp, *resp);
+		  ++errors;
+		}
+	      ++inp;
+	      ++resp;
+	    }
+	}
+      else
+	printf ("\"%s\": unknown class or map\n", inpline);
+    }
+
+
+  if (errors != 0)
+    {
+      printf ("  %d error%s for `%s' locale\n\n\n", errors,
+	      errors == 1 ? "" : "s", setlocale (LC_ALL, NULL));
+      return 1;
+    }
+
+  printf ("  No errors for `%s' locale\n\n\n", setlocale (LC_ALL, NULL));
+  return 0;
+}
diff --git a/ap/build/uClibc/test/locale/tst-digits.c b/ap/build/uClibc/test/locale/tst-digits.c
new file mode 100644
index 0000000..8414a4b
--- /dev/null
+++ b/ap/build/uClibc/test/locale/tst-digits.c
@@ -0,0 +1,249 @@
+/* Copyright (C) 2000 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+   Contributed by Ulrich Drepper <drepper@gnu.org>, 2000.
+
+   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 <ctype.h>
+#include <langinfo.h>
+#include <locale.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <unistd.h>
+#include <wchar.h>
+#include <wctype.h>
+#include <sys/types.h>
+
+
+#define ZERO  "\xe2\x82\x80"
+#define ONE   "\xe2\x82\x81"
+#define TWO   "\xe2\x82\x82"
+#define THREE "\xe2\x82\x83"
+#define FOUR  "\xe2\x82\x84"
+#define FIVE  "\xe2\x82\x85"
+#define SIX   "\xe2\x82\x86"
+#define SEVEN "\xe2\x82\x87"
+#define EIGHT "\xe2\x82\x88"
+#define NINE  "\xe2\x82\x89"
+
+static struct printf_int_test
+{
+  int n;
+  const char *format;
+  const char *expected;
+} printf_int_tests[] =
+{
+  {       0, "%I'10d", "       " ZERO },
+  {       1, "%I'10d", "       " ONE },
+  {       2, "%I'10d", "       " TWO },
+  {       3, "%I'10d", "       " THREE },
+  {       4, "%I'10d", "       " FOUR },
+  {       5, "%I'10d", "       " FIVE },
+  {       6, "%I'10d", "       " SIX },
+  {       7, "%I'10d", "       " SEVEN },
+  {       8, "%I'10d", "       " EIGHT },
+  {       9, "%I'10d", "       " NINE },
+  {      11, "%I'10d", "    " ONE ONE },
+  {      12, "%I'10d", "    " ONE TWO },
+  {     123, "%I10d",  " " ONE TWO THREE },
+  {     123, "%I'10d", " " ONE TWO THREE },
+  {    1234, "%I10d",  ONE TWO THREE FOUR },
+  {    1234, "%I'10d", ONE "," TWO THREE FOUR },
+  {   12345, "%I'10d", ONE TWO "," THREE FOUR FIVE },
+  {  123456, "%I'10d", ONE TWO THREE "," FOUR FIVE SIX },
+  { 1234567, "%I'10d", ONE "," TWO THREE FOUR "," FIVE SIX SEVEN }
+};
+#define nprintf_int_tests \
+  (sizeof (printf_int_tests) / sizeof (printf_int_tests[0]))
+
+#define WZERO  L"\x2080"
+#define WONE   L"\x2081"
+#define WTWO   L"\x2082"
+#define WTHREE L"\x2083"
+#define WFOUR  L"\x2084"
+#define WFIVE  L"\x2085"
+#define WSIX   L"\x2086"
+#define WSEVEN L"\x2087"
+#define WEIGHT L"\x2088"
+#define WNINE  L"\x2089"
+
+static struct wprintf_int_test
+{
+  int n;
+  const wchar_t *format;
+  const wchar_t *expected;
+} wprintf_int_tests[] =
+{
+  {       0, L"%I'10d", L"         " WZERO },
+  {       1, L"%I'10d", L"         " WONE },
+  {       2, L"%I'10d", L"         " WTWO },
+  {       3, L"%I'10d", L"         " WTHREE },
+  {       4, L"%I'10d", L"         " WFOUR },
+  {       5, L"%I'10d", L"         " WFIVE },
+  {       6, L"%I'10d", L"         " WSIX },
+  {       7, L"%I'10d", L"         " WSEVEN },
+  {       8, L"%I'10d", L"         " WEIGHT },
+  {       9, L"%I'10d", L"         " WNINE },
+  {      11, L"%I'10d", L"        " WONE WONE },
+  {      12, L"%I'10d", L"        " WONE WTWO },
+  {     123, L"%I10d",  L"       " WONE WTWO WTHREE },
+  {     123, L"%I'10d", L"       " WONE WTWO WTHREE },
+  {    1234, L"%I10d",  L"      " WONE WTWO WTHREE WFOUR },
+  {    1234, L"%I'10d", L"     " WONE L"," WTWO WTHREE WFOUR },
+  {   12345, L"%I'10d", L"    " WONE WTWO L"," WTHREE WFOUR WFIVE },
+  {  123456, L"%I'10d", L"   " WONE WTWO WTHREE L"," WFOUR WFIVE WSIX },
+  { 1234567, L"%I'10d", L" " WONE L"," WTWO WTHREE WFOUR L"," WFIVE WSIX WSEVEN }
+};
+#define nwprintf_int_tests \
+  (sizeof (wprintf_int_tests) / sizeof (wprintf_int_tests[0]))
+
+
+int
+main (void)
+{
+  int cnt;
+  int failures;
+  int status;
+
+  if (setlocale (LC_ALL, "test7") == NULL)
+    {
+      puts ("cannot set locale `test7'");
+      exit (1);
+    }
+  printf ("CODESET = \"%s\"\n", nl_langinfo (CODESET));
+
+  /* First: printf tests.  */
+  failures = 0;
+  for (cnt = 0; cnt < (int) nprintf_int_tests; ++cnt)
+    {
+      char buf[100];
+      ssize_t n;
+
+      n = snprintf (buf, sizeof buf, printf_int_tests[cnt].format,
+		    printf_int_tests[cnt].n);
+
+      printf ("%3d: got \"%s\", expected \"%s\"",
+	      cnt, buf, printf_int_tests[cnt].expected);
+
+      if (n != (ssize_t) strlen (printf_int_tests[cnt].expected)
+	  || strcmp (buf, printf_int_tests[cnt].expected) != 0)
+	{
+	  puts ("  -> FAILED");
+	  ++failures;
+	}
+      else
+	puts ("  -> OK");
+    }
+
+  printf ("%d failures in printf tests\n", failures);
+  status = failures != 0;
+
+  /* wprintf tests.  */
+  failures = 0;
+  for (cnt = 0; cnt < (int) nwprintf_int_tests; ++cnt)
+    {
+      wchar_t buf[100];
+      ssize_t n;
+
+      n = swprintf (buf, sizeof buf / sizeof (buf[0]),
+		    wprintf_int_tests[cnt].format,
+		    wprintf_int_tests[cnt].n);
+
+      printf ("%3d: got \"%ls\", expected \"%ls\"",
+	      cnt, buf, wprintf_int_tests[cnt].expected);
+
+      if (n != (ssize_t) wcslen (wprintf_int_tests[cnt].expected)
+	  || wcscmp (buf, wprintf_int_tests[cnt].expected) != 0)
+	{
+	  puts ("  -> FAILED");
+	  ++failures;
+	}
+      else
+	puts ("  -> OK");
+    }
+
+  printf ("%d failures in wprintf tests\n", failures);
+  status = failures != 0;
+
+  /* ctype tests.  This makes sure that the multibyte chracter digit
+     representations are not handle in this table.  */
+  failures = 0;
+  for (cnt = 0; cnt < 256; ++cnt)
+    if (cnt >= '0' && cnt <= '9')
+      {
+	if (! isdigit (cnt))
+	  {
+	    printf ("isdigit ('%c') == 0\n", cnt);
+	    ++failures;
+	  }
+      }
+    else
+      {
+	if (isdigit (cnt))
+	  {
+	    printf ("isdigit (%d) != 0\n", cnt);
+	    ++failures;
+	  }
+      }
+
+  printf ("%d failures in ctype tests\n", failures);
+  status = failures != 0;
+
+  /* wctype tests.  This makes sure the second set of digits is also
+     recorded.  */
+  failures = 0;
+  for (cnt = 0; cnt < 256; ++cnt)
+    if (cnt >= '0' && cnt <= '9')
+      {
+	if (! iswdigit (cnt))
+	  {
+	    printf ("iswdigit (L'%c') == 0\n", cnt);
+	    ++failures;
+	  }
+      }
+    else
+      {
+	if (iswdigit (cnt))
+	  {
+	    printf ("iswdigit (%d) != 0\n", cnt);
+	    ++failures;
+	  }
+      }
+
+  for (cnt = 0x2070; cnt < 0x2090; ++cnt)
+    if (cnt >= 0x2080 && cnt <= 0x2089)
+      {
+	if (! iswdigit (cnt))
+	  {
+	    printf ("iswdigit (U%04X) == 0\n", cnt);
+	    ++failures;
+	  }
+      }
+    else
+      {
+	if (iswdigit (cnt))
+	  {
+	    printf ("iswdigit (U%04X) != 0\n", cnt);
+	    ++failures;
+	  }
+      }
+
+  printf ("%d failures in wctype tests\n", failures);
+  status = failures != 0;
+
+  return status;
+}
diff --git a/ap/build/uClibc/test/locale/tst-fmon.c b/ap/build/uClibc/test/locale/tst-fmon.c
new file mode 100644
index 0000000..11093ce
--- /dev/null
+++ b/ap/build/uClibc/test/locale/tst-fmon.c
@@ -0,0 +1,68 @@
+/* Testing the implementation of strfmon(3).
+   Copyright (C) 1996, 1997, 2000, 2003, 2004 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+   Contributed by Jochen Hein <jochen.hein@delphi.central.de>, 1997.
+
+   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 <stdio.h>
+#include <locale.h>
+#include <monetary.h>
+#include <string.h>
+#include <stdlib.h>
+
+/*
+  test-strfmon gets called with three parameters:
+   - the locale
+   - the format-string to be used
+   - the actual number to be formatted
+   - the expected string
+   If the test passes, test-strfmon terminates with returncode 0,
+   otherwise with 1
+*/
+#define EXIT_SUCCESS 0
+#define EXIT_FAILURE 1
+#define EXIT_SETLOCALE 2
+#define EXIT_STRFMON 3
+
+int
+main (int argc, char *argv[])
+{
+  char *s = malloc (201);
+
+  if (setlocale (LC_MONETARY, argv[1]) == NULL)
+    {
+      fprintf (stderr, "setlocale(LC_MONETARY, \"%s\"): %m\n", argv[1]);
+      exit (EXIT_SETLOCALE);
+    }
+
+  if (strfmon (s, 200, argv[2], (double) atof (argv[3])) == -1)
+    {
+      perror ("strfmon");
+      exit (EXIT_STRFMON);
+    }
+
+  if (strcmp (s, argv[4]) != 0)
+    {
+      printf ("\
+Locale: \"%s\" Format: \"%s\" Value: \"%s\" Received: \"%s\" Expected: \"%s\" => %s\n",
+	      argv[1], argv[2], argv[3], s, argv[4],
+	      strcmp (s, argv[4]) != 0 ? "false" : "correct");
+      exit (EXIT_FAILURE);
+    }
+
+  return EXIT_SUCCESS;
+}
diff --git a/ap/build/uClibc/test/locale/tst-langinfo.c b/ap/build/uClibc/test/locale/tst-langinfo.c
new file mode 100644
index 0000000..e95f0da
--- /dev/null
+++ b/ap/build/uClibc/test/locale/tst-langinfo.c
@@ -0,0 +1,284 @@
+/* Test program for nl_langinfo() function.
+   Copyright (C) 2000 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+   Contributed by Ulrich Drepper <drepper@cygnus.com>.
+
+   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 <langinfo.h>
+#include <locale.h>
+#include <stdio.h>
+#include <string.h>
+
+
+struct map
+{
+  const char *str;
+  int val;
+} map[] =
+{
+#define VAL(name) { #name, name }
+  VAL (ABDAY_1),
+  VAL (ABDAY_2),
+  VAL (ABDAY_3),
+  VAL (ABDAY_4),
+  VAL (ABDAY_5),
+  VAL (ABDAY_6),
+  VAL (ABDAY_7),
+  VAL (ABMON_1),
+  VAL (ABMON_10),
+  VAL (ABMON_11),
+  VAL (ABMON_12),
+  VAL (ABMON_2),
+  VAL (ABMON_3),
+  VAL (ABMON_4),
+  VAL (ABMON_5),
+  VAL (ABMON_6),
+  VAL (ABMON_7),
+  VAL (ABMON_8),
+  VAL (ABMON_9),
+  VAL (ALT_DIGITS),
+  VAL (AM_STR),
+  VAL (CRNCYSTR),
+  VAL (CURRENCY_SYMBOL),
+  VAL (DAY_1),
+  VAL (DAY_2),
+  VAL (DAY_3),
+  VAL (DAY_4),
+  VAL (DAY_5),
+  VAL (DAY_6),
+  VAL (DAY_7),
+  VAL (DECIMAL_POINT),
+  VAL (D_FMT),
+  VAL (D_T_FMT),
+  VAL (ERA),
+  VAL (ERA_D_FMT),
+  VAL (ERA_D_T_FMT),
+  VAL (ERA_T_FMT),
+  VAL (ERA_YEAR),
+  VAL (FRAC_DIGITS),
+  VAL (GROUPING),
+  VAL (INT_CURR_SYMBOL),
+  VAL (INT_FRAC_DIGITS),
+  VAL (MON_1),
+  VAL (MON_10),
+  VAL (MON_11),
+  VAL (MON_12),
+  VAL (MON_2),
+  VAL (MON_3),
+  VAL (MON_4),
+  VAL (MON_5),
+  VAL (MON_6),
+  VAL (MON_7),
+  VAL (MON_8),
+  VAL (MON_9),
+  VAL (MON_DECIMAL_POINT),
+  VAL (MON_GROUPING),
+  VAL (MON_THOUSANDS_SEP),
+  VAL (NEGATIVE_SIGN),
+  VAL (NOEXPR),
+  VAL (NOSTR),
+  VAL (N_CS_PRECEDES),
+  VAL (N_SEP_BY_SPACE),
+  VAL (N_SIGN_POSN),
+  VAL (PM_STR),
+  VAL (POSITIVE_SIGN),
+  VAL (P_CS_PRECEDES),
+  VAL (P_SEP_BY_SPACE),
+  VAL (P_SIGN_POSN),
+  VAL (RADIXCHAR),
+  VAL (THOUSANDS_SEP),
+  VAL (THOUSEP),
+  VAL (T_FMT),
+  VAL (T_FMT_AMPM),
+  VAL (YESEXPR),
+  VAL (YESSTR)
+};
+
+
+static int
+map_paramstr (const char *str)
+{
+  int low = 0;
+  int high = sizeof (map) / sizeof (map[0]);
+
+  while (low < high)
+    {
+      int med = (low + high) / 2;
+      int cmpres;
+
+      cmpres = strcmp (str, map[med].str);
+      if (cmpres == 0)
+	return map[med].val;
+      else if (cmpres > 0)
+	low = med + 1;
+      else
+	high = med;
+    }
+
+  return -1;
+}
+
+
+#ifdef DEBUG
+# define REASON(str) printf ("\"%s\" ignored: %s\n", buf, str)
+#else
+# define REASON(str)
+#endif
+
+int
+main (void)
+{
+  int result = 0;
+
+  while (! feof (stdin))
+    {
+      char buf[1000];
+      char *rp;
+      char *locale;
+      char *paramstr;
+      char *expected;
+      char *actual;
+      int param;
+
+      if (fgets (buf, sizeof (buf), stdin) == NULL)
+	break;
+
+      /* Split the fields.   There are three is them:
+	 1. locale
+	 2. langinfo() parameter
+	 3. expected result; this can be a string with white space etc.
+      */
+      rp = buf;
+      while (*rp == ' ' || *rp == '\t')
+	++rp;
+
+      if  (*rp == '#')
+	{
+	  /* It's a comment line.  Ignore it.  */
+	  REASON ("comment");
+	  continue;
+	}
+      locale = rp;
+
+      while (*rp != '\0' && *rp != ' ' && *rp != '\t' && *rp != '\n')
+	++rp;
+      if (*rp == '\0' || *rp == '\n')
+	{
+	  /* Incomplete line.  */
+	  REASON ("incomplete line");
+	  continue;
+	}
+      *rp++ = '\0';
+
+      while (*rp == ' ' || *rp == '\t')
+	++rp;
+      paramstr = rp;
+
+      while (*rp != '\0' && *rp != ' ' && *rp != '\t' && *rp != '\n')
+	++rp;
+      if (*rp == '\0' || *rp == '\n')
+	{
+	  /* Incomplete line.  */
+	  REASON ("incomplete line");
+	  continue;
+	}
+      *rp++ = '\0';
+
+      while (*rp == ' ' || *rp == '\t')
+	++rp;
+
+      if (*rp == '"')
+	{
+	  char *wp;
+
+	  expected = wp = ++rp;
+	  while (*rp != '"' && *rp != '\n' && *rp != '\0')
+	    {
+	      if (*rp == '\\')
+		{
+		  ++rp;
+		  if (*rp == '\0')
+		    break;
+		  if (*rp >= '0' && *rp <= '9')
+		    {
+		      int val = *rp - '0';
+		      if (rp[1] >= '0' && rp[1] <= '9')
+			{
+			  ++rp;
+			  val *= 10;
+			  val += *rp - '0';
+			  if (rp[1] >= '0' && rp[1] <= '9')
+			    {
+			      ++rp;
+			      val *= 10;
+			      val += *rp - '0';
+			    }
+			}
+		      *rp = val;
+		    }
+		}
+	      *wp++ = *rp++;
+	    }
+
+	  if (*rp != '"')
+	    {
+	      REASON ("missing '\"'");
+	      continue;
+	    }
+
+	  *wp = '\0';
+	}
+      else
+	{
+	  expected = rp;
+	  while (*rp != '\0' && *rp != '\n')
+	    ++rp;
+	  *rp = '\0';
+	}
+
+      param = map_paramstr (paramstr);
+      if (param == -1)
+	{
+	  /* Invalid parameter.  */
+	  REASON ("invalid parameter");
+	  continue;
+	}
+
+      /* Set the locale and check whether it worked.  */
+      printf ("LC_ALL=%s nl_langinfo(%s)", locale, paramstr);
+      setlocale (LC_ALL, locale);
+      if (strcmp (locale, setlocale (LC_ALL, NULL)) != 0)
+	{
+	  puts (": failed to set locale");
+	  result = 1;
+	  continue;
+	}
+
+      actual = nl_langinfo (param);
+      printf (" = \"%s\", ", actual);
+
+      if (strcmp (actual, expected) == 0)
+	puts ("OK");
+      else
+	{
+	  printf ("FAILED (expected: %s)\n", expected);
+	  result = 1;
+	}
+    }
+
+  return result;
+}
diff --git a/ap/build/uClibc/test/locale/tst-langinfo.input b/ap/build/uClibc/test/locale/tst-langinfo.input
new file mode 100644
index 0000000..0a05ab8
--- /dev/null
+++ b/ap/build/uClibc/test/locale/tst-langinfo.input
@@ -0,0 +1,303 @@
+#! /bin/sh
+# Input file for tst-langinfo.
+# Copyright (C) 2000, 2001, 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.
+
+
+# Run the test program.
+# Only decimal numerical escape sequences allowed in strings.
+C                    ABDAY_1     Sun
+C                    ABDAY_2     Mon
+C                    ABDAY_3     Tue
+C                    ABDAY_4     Wed
+C                    ABDAY_5     Thu
+C                    ABDAY_6     Fri
+C                    ABDAY_7     Sat
+C                    DAY_1       Sunday
+C                    DAY_2       Monday
+C                    DAY_3       Tuesday
+C                    DAY_4       Wednesday
+C                    DAY_5       Thursday
+C                    DAY_6       Friday
+C                    DAY_7       Saturday
+C                    ABMON_1     Jan
+C                    ABMON_2     Feb
+C                    ABMON_3     Mar
+C                    ABMON_4     Apr
+C                    ABMON_5     May
+C                    ABMON_6     Jun
+C                    ABMON_7     Jul
+C                    ABMON_8     Aug
+C                    ABMON_9     Sep
+C                    ABMON_10    Oct
+C                    ABMON_11    Nov
+C                    ABMON_12    Dec
+C                    MON_1       January
+C                    MON_2       February
+C                    MON_3       March
+C                    MON_4       April
+C                    MON_5       May
+C                    MON_6       June
+C                    MON_7       July
+C                    MON_8       August
+C                    MON_9       September
+C                    MON_10      October
+C                    MON_11      November
+C                    MON_12      December
+C                    AM_STR      AM
+C                    PM_STR      PM
+C                    D_T_FMT     "%a %b %e %H:%M:%S %Y"
+C                    D_FMT       "%m/%d/%y"
+C                    T_FMT       "%H:%M:%S"
+C                    T_FMT_AMPM  "%I:%M:%S %p"
+C                    ABDAY_1     Sun
+C                    ABDAY_2     Mon
+C                    ABDAY_3     Tue
+C                    ABDAY_4     Wed
+C                    ABDAY_5     Thu
+C                    ABDAY_6     Fri
+C                    ABDAY_7     Sat
+C                    DAY_1       Sunday
+C                    DAY_2       Monday
+C                    DAY_3       Tuesday
+C                    DAY_4       Wednesday
+C                    DAY_5       Thursday
+C                    DAY_6       Friday
+C                    DAY_7       Saturday
+C                    RADIXCHAR   .
+C                    THOUSEP     ""
+C                    YESEXPR     ^[yY]
+C                    NOEXPR      ^[nN]
+en_US.ISO-8859-1     ABMON_1     Jan
+en_US.ISO-8859-1     ABMON_2     Feb
+en_US.ISO-8859-1     ABMON_3     Mar
+en_US.ISO-8859-1     ABMON_4     Apr
+en_US.ISO-8859-1     ABMON_5     May
+en_US.ISO-8859-1     ABMON_6     Jun
+en_US.ISO-8859-1     ABMON_7     Jul
+en_US.ISO-8859-1     ABMON_8     Aug
+en_US.ISO-8859-1     ABMON_9     Sep
+en_US.ISO-8859-1     ABMON_10    Oct
+en_US.ISO-8859-1     ABMON_11    Nov
+en_US.ISO-8859-1     ABMON_12    Dec
+en_US.ISO-8859-1     MON_1       January
+en_US.ISO-8859-1     MON_2       February
+en_US.ISO-8859-1     MON_3       March
+en_US.ISO-8859-1     MON_4       April
+en_US.ISO-8859-1     MON_5       May
+en_US.ISO-8859-1     MON_6       June
+en_US.ISO-8859-1     MON_7       July
+en_US.ISO-8859-1     MON_8       August
+en_US.ISO-8859-1     MON_9       September
+en_US.ISO-8859-1     MON_10      October
+en_US.ISO-8859-1     MON_11      November
+en_US.ISO-8859-1     MON_12      December
+en_US.ISO-8859-1     AM_STR      AM
+en_US.ISO-8859-1     PM_STR      PM
+en_US.ISO-8859-1     D_T_FMT     "%a %d %b %Y %r %Z"
+en_US.ISO-8859-1     D_FMT       "%m/%d/%Y"
+en_US.ISO-8859-1     T_FMT       "%r"
+en_US.ISO-8859-1     T_FMT_AMPM  "%I:%M:%S %p"
+en_US.ISO-8859-1     RADIXCHAR   .
+en_US.ISO-8859-1     THOUSEP     ,
+en_US.ISO-8859-1     YESEXPR     ^[yY].*
+en_US.ISO-8859-1     NOEXPR      ^[nN].*
+de_DE.ISO-8859-1     ABDAY_1     So
+de_DE.ISO-8859-1     ABDAY_2     Mo
+de_DE.ISO-8859-1     ABDAY_3     Di
+de_DE.ISO-8859-1     ABDAY_4     Mi
+de_DE.ISO-8859-1     ABDAY_5     Do
+de_DE.ISO-8859-1     ABDAY_6     Fr
+de_DE.ISO-8859-1     ABDAY_7     Sa
+de_DE.ISO-8859-1     DAY_1       Sonntag
+de_DE.ISO-8859-1     DAY_2       Montag
+de_DE.ISO-8859-1     DAY_3       Dienstag
+de_DE.ISO-8859-1     DAY_4       Mittwoch
+de_DE.ISO-8859-1     DAY_5       Donnerstag
+de_DE.ISO-8859-1     DAY_6       Freitag
+de_DE.ISO-8859-1     DAY_7       Samstag
+de_DE.ISO-8859-1     ABMON_1     Jan
+de_DE.ISO-8859-1     ABMON_2     Feb
+de_DE.ISO-8859-1     ABMON_3     Mär
+de_DE.ISO-8859-1     ABMON_4     Apr
+de_DE.ISO-8859-1     ABMON_5     Mai
+de_DE.ISO-8859-1     ABMON_6     Jun
+de_DE.ISO-8859-1     ABMON_7     Jul
+de_DE.ISO-8859-1     ABMON_8     Aug
+de_DE.ISO-8859-1     ABMON_9     Sep
+de_DE.ISO-8859-1     ABMON_10    Okt
+de_DE.ISO-8859-1     ABMON_11    Nov
+de_DE.ISO-8859-1     ABMON_12    Dez
+de_DE.ISO-8859-1     MON_1       Januar
+de_DE.ISO-8859-1     MON_2       Februar
+de_DE.ISO-8859-1     MON_3       März
+de_DE.ISO-8859-1     MON_4       April
+de_DE.ISO-8859-1     MON_5       Mai
+de_DE.ISO-8859-1     MON_6       Juni
+de_DE.ISO-8859-1     MON_7       Juli
+de_DE.ISO-8859-1     MON_8       August
+de_DE.ISO-8859-1     MON_9       September
+de_DE.ISO-8859-1     MON_10      Oktober
+de_DE.ISO-8859-1     MON_11      November
+de_DE.ISO-8859-1     MON_12      Dezember
+de_DE.ISO-8859-1     D_T_FMT     "%a %d %b %Y %T %Z"
+de_DE.ISO-8859-1     D_FMT       "%d.%m.%Y"
+de_DE.ISO-8859-1     T_FMT       "%T"
+de_DE.ISO-8859-1     RADIXCHAR   ,
+de_DE.ISO-8859-1     THOUSEP     .
+de_DE.ISO-8859-1     YESEXPR     ^[jJyY].*
+de_DE.ISO-8859-1     NOEXPR      ^[nN].*
+de_DE.UTF-8          ABDAY_1     So
+de_DE.UTF-8          ABDAY_2     Mo
+de_DE.UTF-8          ABDAY_3     Di
+de_DE.UTF-8          ABDAY_4     Mi
+de_DE.UTF-8          ABDAY_5     Do
+de_DE.UTF-8          ABDAY_6     Fr
+de_DE.UTF-8          ABDAY_7     Sa
+de_DE.UTF-8          DAY_1       Sonntag
+de_DE.UTF-8          DAY_2       Montag
+de_DE.UTF-8          DAY_3       Dienstag
+de_DE.UTF-8          DAY_4       Mittwoch
+de_DE.UTF-8          DAY_5       Donnerstag
+de_DE.UTF-8          DAY_6       Freitag
+de_DE.UTF-8          DAY_7       Samstag
+de_DE.UTF-8          ABMON_1     Jan
+de_DE.UTF-8          ABMON_2     Feb
+de_DE.UTF-8          ABMON_3     Mär
+de_DE.UTF-8          ABMON_4     Apr
+de_DE.UTF-8          ABMON_5     Mai
+de_DE.UTF-8          ABMON_6     Jun
+de_DE.UTF-8          ABMON_7     Jul
+de_DE.UTF-8          ABMON_8     Aug
+de_DE.UTF-8          ABMON_9     Sep
+de_DE.UTF-8          ABMON_10    Okt
+de_DE.UTF-8          ABMON_11    Nov
+de_DE.UTF-8          ABMON_12    Dez
+de_DE.UTF-8          MON_1       Januar
+de_DE.UTF-8          MON_2       Februar
+de_DE.UTF-8          MON_3       März
+de_DE.UTF-8          MON_4       April
+de_DE.UTF-8          MON_5       Mai
+de_DE.UTF-8          MON_6       Juni
+de_DE.UTF-8          MON_7       Juli
+de_DE.UTF-8          MON_8       August
+de_DE.UTF-8          MON_9       September
+de_DE.UTF-8          MON_10      Oktober
+de_DE.UTF-8          MON_11      November
+de_DE.UTF-8          MON_12      Dezember
+de_DE.UTF-8          D_T_FMT     "%a %d %b %Y %T %Z"
+de_DE.UTF-8          D_FMT       "%d.%m.%Y"
+de_DE.UTF-8          T_FMT       "%T"
+de_DE.UTF-8          RADIXCHAR   ,
+de_DE.UTF-8          THOUSEP     .
+de_DE.UTF-8          YESEXPR     ^[jJyY].*
+de_DE.UTF-8          NOEXPR      ^[nN].*
+fr_FR.ISO-8859-1     ABDAY_1     dim
+fr_FR.ISO-8859-1     ABDAY_2     lun
+fr_FR.ISO-8859-1     ABDAY_3     mar
+fr_FR.ISO-8859-1     ABDAY_4     mer
+fr_FR.ISO-8859-1     ABDAY_5     jeu
+fr_FR.ISO-8859-1     ABDAY_6     ven
+fr_FR.ISO-8859-1     ABDAY_7     sam
+fr_FR.ISO-8859-1     DAY_1       dimanche
+fr_FR.ISO-8859-1     DAY_2       lundi
+fr_FR.ISO-8859-1     DAY_3       mardi
+fr_FR.ISO-8859-1     DAY_4       mercredi
+fr_FR.ISO-8859-1     DAY_5       jeudi
+fr_FR.ISO-8859-1     DAY_6       vendredi
+fr_FR.ISO-8859-1     DAY_7       samedi
+fr_FR.ISO-8859-1     ABMON_1     jan
+fr_FR.ISO-8859-1     ABMON_2     fév
+fr_FR.ISO-8859-1     ABMON_3     mar
+fr_FR.ISO-8859-1     ABMON_4     avr
+fr_FR.ISO-8859-1     ABMON_5     mai
+fr_FR.ISO-8859-1     ABMON_6     jun
+fr_FR.ISO-8859-1     ABMON_7     jui
+fr_FR.ISO-8859-1     ABMON_8     aoû
+fr_FR.ISO-8859-1     ABMON_9     sep
+fr_FR.ISO-8859-1     ABMON_10    oct
+fr_FR.ISO-8859-1     ABMON_11    nov
+fr_FR.ISO-8859-1     ABMON_12    déc
+fr_FR.ISO-8859-1     MON_1       janvier
+fr_FR.ISO-8859-1     MON_2       février
+fr_FR.ISO-8859-1     MON_3       mars
+fr_FR.ISO-8859-1     MON_4       avril
+fr_FR.ISO-8859-1     MON_5       mai
+fr_FR.ISO-8859-1     MON_6       juin
+fr_FR.ISO-8859-1     MON_7       juillet
+fr_FR.ISO-8859-1     MON_8       août
+fr_FR.ISO-8859-1     MON_9       septembre
+fr_FR.ISO-8859-1     MON_10      octobre
+fr_FR.ISO-8859-1     MON_11      novembre
+fr_FR.ISO-8859-1     MON_12      décembre
+fr_FR.ISO-8859-1     D_T_FMT     "%a %d %b %Y %T %Z"
+fr_FR.ISO-8859-1     D_FMT       "%d.%m.%Y"
+fr_FR.ISO-8859-1     T_FMT       "%T"
+fr_FR.ISO-8859-1     RADIXCHAR   ,
+fr_FR.ISO-8859-1     THOUSEP     ""
+fr_FR.ISO-8859-1     YESEXPR     ^[oOyY].*
+fr_FR.ISO-8859-1     NOEXPR      ^[nN].*
+ja_JP.EUC-JP         ABDAY_1     Æü
+ja_JP.EUC-JP         ABDAY_2     ·î
+ja_JP.EUC-JP         ABDAY_3     ²Ð
+ja_JP.EUC-JP         ABDAY_4     ¿å
+ja_JP.EUC-JP         ABDAY_5     ÌÚ
+ja_JP.EUC-JP         ABDAY_6     ¶â
+ja_JP.EUC-JP         ABDAY_7     ÅÚ
+ja_JP.EUC-JP         DAY_1       ÆüÍËÆü
+ja_JP.EUC-JP         DAY_2       ·îÍËÆü
+ja_JP.EUC-JP         DAY_3       ²ÐÍËÆü
+ja_JP.EUC-JP         DAY_4       ¿åÍËÆü
+ja_JP.EUC-JP         DAY_5       ÌÚÍËÆü
+ja_JP.EUC-JP         DAY_6       ¶âÍËÆü
+ja_JP.EUC-JP         DAY_7       ÅÚÍËÆü
+ja_JP.EUC-JP         ABMON_1     " 1·î"
+ja_JP.EUC-JP         ABMON_2     " 2·î"
+ja_JP.EUC-JP         ABMON_3     " 3·î"
+ja_JP.EUC-JP         ABMON_4     " 4·î"
+ja_JP.EUC-JP         ABMON_5     " 5·î"
+ja_JP.EUC-JP         ABMON_6     " 6·î"
+ja_JP.EUC-JP         ABMON_7     " 7·î"
+ja_JP.EUC-JP         ABMON_8     " 8·î"
+ja_JP.EUC-JP         ABMON_9     " 9·î"
+ja_JP.EUC-JP         ABMON_10    "10·î"
+ja_JP.EUC-JP         ABMON_11    "11·î"
+ja_JP.EUC-JP         ABMON_12    "12·î"
+ja_JP.EUC-JP         MON_1       "1·î"
+ja_JP.EUC-JP         MON_2       "2·î"
+ja_JP.EUC-JP         MON_3       "3·î"
+ja_JP.EUC-JP         MON_4       "4·î"
+ja_JP.EUC-JP         MON_5       "5·î"
+ja_JP.EUC-JP         MON_6       "6·î"
+ja_JP.EUC-JP         MON_7       "7·î"
+ja_JP.EUC-JP         MON_8       "8·î"
+ja_JP.EUC-JP         MON_9       "9·î"
+ja_JP.EUC-JP         MON_10      "10·î"
+ja_JP.EUC-JP         MON_11      "11·î"
+ja_JP.EUC-JP         MON_12      "12·î"
+ja_JP.EUC-JP         T_FMT_AMPM  "%p%I»þ%Mʬ%SÉÃ"
+ja_JP.EUC-JP         ERA_D_FMT   "%EY%m·î%dÆü"
+ja_JP.EUC-JP         ERA_D_T_FMT "%EY%m·î%dÆü %H»þ%Mʬ%SÉÃ"
+ja_JP.EUC-JP         RADIXCHAR   .
+ja_JP.EUC-JP         THOUSEP     ,
+ja_JP.EUC-JP         YESEXPR     ^([yY£ù£Ù]|¤Ï¤¤|¥Ï¥¤)
+ja_JP.EUC-JP         NOEXPR      ^([nN£î£Î]|¤¤¤¤¤¨|¥¤¥¤¥¨)
+# Is CRNCYSTR supposed to be the national or international sign?
+# ja_JP.EUC-JP         CRNCYSTR    JPY
+ja_JP.EUC-JP         CODESET     EUC-JP
diff --git a/ap/build/uClibc/test/locale/tst-leaks.c b/ap/build/uClibc/test/locale/tst-leaks.c
new file mode 100644
index 0000000..7a4b557
--- /dev/null
+++ b/ap/build/uClibc/test/locale/tst-leaks.c
@@ -0,0 +1,18 @@
+#include <locale.h>
+#include <mcheck.h>
+
+int
+main (void)
+{
+  int cnt;
+
+  mtrace ();
+
+  for (cnt = 0; cnt < 100; ++cnt)
+    {
+      setlocale (LC_ALL, "de_DE.ISO-8859-1");
+      setlocale (LC_ALL, "de_DE.UTF-8");
+    }
+
+  return 0;
+}
diff --git a/ap/build/uClibc/test/locale/tst-mbswcs1.c b/ap/build/uClibc/test/locale/tst-mbswcs1.c
new file mode 100644
index 0000000..fb2ea84
--- /dev/null
+++ b/ap/build/uClibc/test/locale/tst-mbswcs1.c
@@ -0,0 +1,63 @@
+/* Test restarting behaviour of mbrtowc.
+   Copyright (C) 2000, 2005 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+   Contributed by Bruno Haible <haible@ilog.fr>.
+
+   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 <stdio.h>
+#include <string.h>
+#include <wchar.h>
+#include <locale.h>
+
+#define show(expr, nexp, wcexp) \
+  n = expr;								  \
+  printf (#expr " -> %Zd", n);						  \
+  printf (", wc = %lu", (unsigned long int) wc);			  \
+  if (n != (size_t) nexp || wc != wcexp)				  \
+    {									  \
+      printf (", expected %Zd and %lu", nexp, (unsigned long int) wcexp); \
+      result = 1;							  \
+    }									  \
+  putc ('\n', stdout)
+
+int
+main (void)
+{
+  const unsigned char buf[6] = { 0x25,  0xe2, 0x82, 0xac,  0xce, 0xbb };
+  mbstate_t state;
+  wchar_t wc = 42;
+  size_t n;
+  int result = 0;
+  const char *used_locale;
+
+  setlocale (LC_CTYPE, "de_DE.UTF-8");
+  /* Double check.  */
+  used_locale = setlocale (LC_CTYPE, NULL);
+  printf ("used locale: \"%s\"\n", used_locale);
+  result = strcmp (used_locale, "de_DE.UTF-8");
+
+  memset (&state, '\0', sizeof (state));
+
+  show (mbrtowc (&wc, (const char *) buf + 0, 1, &state), 1, 37);
+  show (mbrtowc (&wc, (const char *) buf + 1, 1, &state), -2, 37);
+  show (mbrtowc (&wc, (const char *) buf + 2, 3, &state), 2, 8364);
+  show (mbrtowc (&wc, (const char *) buf + 4, 1, &state), -2, 8364);
+  show (mbrtowc (&wc, (const char *) buf + 5, 1, &state), 1, 955);
+  show (mbrtowc (&wc, (const char *) buf + 5, 1, &state), -1, 955);
+
+  return result;
+}
diff --git a/ap/build/uClibc/test/locale/tst-mbswcs2.c b/ap/build/uClibc/test/locale/tst-mbswcs2.c
new file mode 100644
index 0000000..49f13cc
--- /dev/null
+++ b/ap/build/uClibc/test/locale/tst-mbswcs2.c
@@ -0,0 +1,65 @@
+/* Test restarting behaviour of mbsnrtowcs.
+   Copyright (C) 2000 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+   Contributed by Bruno Haible <haible@ilog.fr>.
+
+   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 <stdio.h>
+#include <string.h>
+#include <wchar.h>
+#include <locale.h>
+
+#define show(expr, nexp, wcexp, end) \
+  n = expr;								\
+  printf (#expr " -> %Zd", n);						\
+  printf (", wc = %lu, src = buf+%d", (unsigned long int) wc,		\
+	  src - (const char *) buf);					\
+  if (n != (size_t) nexp || wc != wcexp || src != (const char *) (end))	\
+    {									\
+      printf (", expected %Zd and %lu and buf+%d", nexp,		\
+	      (unsigned long int) wcexp, (end) - buf);			\
+      result = 1;							\
+    }									\
+  putc ('\n', stdout)
+
+int
+main (void)
+{
+  unsigned char buf[6] = { 0x25,  0xe2, 0x82, 0xac,  0xce, 0xbb };
+  mbstate_t state;
+  const char *src;
+  wchar_t wc = 42;
+  size_t n;
+  int result = 0;
+  const char *used_locale;
+
+  setlocale (LC_CTYPE,"de_DE.UTF-8");
+  /* Double check.  */
+  used_locale = setlocale (LC_CTYPE, NULL);
+  printf ("used locale: \"%s\"\n", used_locale);
+  result = strcmp (used_locale, "de_DE.UTF-8");
+
+  memset (&state, '\0', sizeof (state));
+
+  src = (const char *) buf;
+  show (mbsnrtowcs (&wc, &src, 1, 1, &state), 1, 37, buf + 1);
+  show (mbsnrtowcs (&wc, &src, 3, 1, &state), 1, 8364, buf + 4);
+  show (mbsnrtowcs (&wc, &src, 1, 1, &state), 0, 8364, buf + 5);
+  show (mbsnrtowcs (&wc, &src, 1, 1, &state), 1, 955, buf + 6);
+
+  return result;
+}
diff --git a/ap/build/uClibc/test/locale/tst-mbswcs3.c b/ap/build/uClibc/test/locale/tst-mbswcs3.c
new file mode 100644
index 0000000..0c4af4c
--- /dev/null
+++ b/ap/build/uClibc/test/locale/tst-mbswcs3.c
@@ -0,0 +1,76 @@
+/* Test restarting behaviour of wcsrtombs.
+   Copyright (C) 2000 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+   Contributed by Bruno Haible <haible@ilog.fr>.
+
+   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 <stdio.h>
+#include <string.h>
+#include <wchar.h>
+#include <locale.h>
+
+#define show(expr, nexp, srcexp, bufexp) \
+  {									\
+    size_t res = expr;							\
+    printf (#expr " -> %Zd", res);					\
+    dst += res;								\
+    printf (", src = srcbuf+%td, dst = buf+%td",			\
+	    src - srcbuf, dst - (char *) buf);				\
+    if (res != nexp || src != (srcexp) || dst != (char *) (bufexp))	\
+      {									\
+	printf (", expected %Zd and srcbuf+%td and buf+%td", nexp,	\
+		(srcexp) - srcbuf, (bufexp) - (unsigned char *) buf);	\
+	result = 1;							\
+      }									\
+    putc ('\n', stdout);						\
+  }
+
+int
+main (void)
+{
+  unsigned char buf[6] = { 0xff, 0xff, 0xff, 0xff, 0xff, 0xff };
+  const unsigned char bufcheck[6] = { 0x25, 0xe2, 0x82, 0xac, 0xce, 0xbb };
+  const wchar_t srcbuf[4] = { 0x25, 0x20ac, 0x03bb, 0 };
+  mbstate_t state;
+  const wchar_t *src;
+  char *dst;
+  int result = 0;
+  const char *used_locale;
+
+  setlocale (LC_CTYPE, "de_DE.UTF-8");
+  /* Double check.  */
+  used_locale = setlocale (LC_CTYPE, NULL);
+  printf ("used locale: \"%s\"\n", used_locale);
+  result = strcmp (used_locale, "de_DE.UTF-8");
+
+  memset (&state, '\0', sizeof (state));
+
+  src = srcbuf;
+  dst = (char *) buf;
+  show (wcsrtombs (dst, &src, 1, &state), 1, srcbuf + 1, buf + 1);
+  show (wcsrtombs (dst, &src, 1, &state), 0, srcbuf + 1, buf + 1);
+  show (wcsrtombs (dst, &src, 4, &state), 3, srcbuf + 2, buf + 4);
+  show (wcsrtombs (dst, &src, 2, &state), 2, srcbuf + 3, buf + 6);
+
+  if (memcmp (buf, bufcheck, 6))
+    {
+      puts ("wrong results");
+      result = 1;
+    }
+
+  return result;
+}
diff --git a/ap/build/uClibc/test/locale/tst-mbswcs4.c b/ap/build/uClibc/test/locale/tst-mbswcs4.c
new file mode 100644
index 0000000..e02b675
--- /dev/null
+++ b/ap/build/uClibc/test/locale/tst-mbswcs4.c
@@ -0,0 +1,63 @@
+/* Test restarting behaviour of mbsrtowcs.
+   Copyright (C) 2000 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 <stdio.h>
+#include <string.h>
+#include <wchar.h>
+#include <locale.h>
+
+#define show(expr, nexp, wcexp, end) \
+  n = expr;								\
+  printf (#expr " -> %Zd", n);						\
+  printf (", wc = %lu, src = buf+%d", (unsigned long int) wc,		\
+	  src - (const char *) buf);					\
+  if (n != (size_t) nexp || wc != wcexp || src != (const char *) (end))	\
+    {									\
+      printf (", expected %Zd and %lu and buf+%d", nexp,		\
+	      (unsigned long int) wcexp, (end) - buf);			\
+      result = 1;							\
+    }									\
+  putc ('\n', stdout)
+
+int
+main (void)
+{
+  unsigned char buf[6] = { 0x25,  0xe2, 0x82, 0xac,  0xce, 0xbb };
+  mbstate_t state;
+  const char *src;
+  wchar_t wc = 42;
+  size_t n;
+  int result = 0;
+  const char *used_locale;
+
+  setlocale (LC_CTYPE,"de_DE.UTF-8");
+  /* Double check.  */
+  used_locale = setlocale (LC_CTYPE, NULL);
+  printf ("used locale: \"%s\"\n", used_locale);
+  result = strcmp (used_locale, "de_DE.UTF-8");
+
+  memset (&state, '\0', sizeof (state));
+
+  src = (const char *) buf;
+  show (mbsrtowcs (&wc, &src, 1, &state), 1, 37, buf + 1);
+  show (mbsrtowcs (&wc, &src, 1, &state), 1, 8364, buf + 4);
+  show (mbsrtowcs (&wc, &src, 1, &state), 1, 955, buf + 6);
+
+  return result;
+}
diff --git a/ap/build/uClibc/test/locale/tst-mbswcs5.c b/ap/build/uClibc/test/locale/tst-mbswcs5.c
new file mode 100644
index 0000000..7cab97e
--- /dev/null
+++ b/ap/build/uClibc/test/locale/tst-mbswcs5.c
@@ -0,0 +1,75 @@
+/* Test restarting behaviour of wcrtomb.
+   Copyright (C) 2000 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+   Contributed by Bruno Haible <haible@ilog.fr>.
+
+   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 <stdio.h>
+#include <string.h>
+#include <wchar.h>
+#include <locale.h>
+
+#define show(expr, nexp, bufexp) \
+  {									\
+    size_t res = expr;							\
+    printf (#expr " -> %Zd", res);					\
+    dst += res;								\
+    printf (", dst = buf+%td", dst - (char *) buf);			\
+    if (res != nexp || dst != (char *) (bufexp))			\
+      {									\
+	printf (", expected %Zd and buf+%td", nexp,			\
+		(bufexp) - (unsigned char *) buf);			\
+	result = 1;							\
+      }									\
+    putc ('\n', stdout);						\
+  }
+
+int
+main (void)
+{
+  unsigned char buf[7] = { 0xff, 0xff, 0xff, 0xff, 0xff, 0xff };
+  const unsigned char bufcheck[7] = { 0x25, 0xe2, 0x82, 0xac, 0xce, 0xbb, 0 };
+  const wchar_t srcbuf[4] = { 0x25, 0x20ac, 0x03bb, 0 };
+  mbstate_t state;
+  const wchar_t *src;
+  char *dst;
+  int result = 0;
+  const char *used_locale;
+
+  setlocale (LC_CTYPE, "de_DE.UTF-8");
+  /* Double check.  */
+  used_locale = setlocale (LC_CTYPE, NULL);
+  printf ("used locale: \"%s\"\n", used_locale);
+  result = strcmp (used_locale, "de_DE.UTF-8");
+
+  memset (&state, '\0', sizeof (state));
+
+  src = srcbuf;
+  dst = (char *) buf;
+  show (wcrtomb (dst, *src++, &state), 1, buf + 1);
+  show (wcrtomb (dst, *src++, &state), 3, buf + 4);
+  show (wcrtomb (dst, *src++, &state), 2, buf + 6);
+  show (wcrtomb (dst, *src, &state), 1, buf + 7);
+
+  if (memcmp (buf, bufcheck, 7))
+    {
+      puts ("wrong results");
+      result = 1;
+    }
+
+  return result;
+}
diff --git a/ap/build/uClibc/test/locale/tst-mbswcs6.c b/ap/build/uClibc/test/locale/tst-mbswcs6.c
new file mode 100644
index 0000000..eb383ac
--- /dev/null
+++ b/ap/build/uClibc/test/locale/tst-mbswcs6.c
@@ -0,0 +1,74 @@
+/* Test for invalid input to wcrtomb.
+   Copyright (C) 2001 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+   Contributed by Ulrich Drepper <drepper@redhat.com>, 2001.
+
+   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 <errno.h>
+#include <locale.h>
+#include <stdio.h>
+#include <string.h>
+#include <wchar.h>
+
+
+static int
+do_test (const char *loc)
+{
+  char buf[100];
+  size_t n;
+  mbstate_t state;
+  const char *nloc;
+  int res;
+
+  nloc = setlocale (LC_ALL, loc);
+  if (nloc == NULL)
+    {
+      printf ("could not set locale \"%s\"\n", loc);
+      return 1;
+    }
+  printf ("new locale: %s\n", nloc);
+
+  memset (&state, '\0', sizeof (state));
+  errno = 0;
+  n = wcrtomb (buf, (wchar_t) -15l, &state);
+
+  printf ("n = %zd, errno = %d (%s)\n", n, errno, strerror (errno));
+
+  res = n != (size_t) -1 || errno != EILSEQ;
+  if (res)
+    puts ("*** FAIL");
+  putchar ('\n');
+
+  return res;
+}
+
+
+int
+main (void)
+{
+  int res;
+
+  res = do_test ("C");
+  res |= do_test ("de_DE.ISO-8859-1");
+  res |= do_test ("de_DE.UTF-8");
+  res |= do_test ("en_US.ISO-8859-1");
+  res |= do_test ("ja_JP.UTF-8");
+  res |= do_test ("hr_HR.ISO-8859-2");
+  //res |= do_test ("ru_RU.KOI8-R");
+
+  return res;
+}
diff --git a/ap/build/uClibc/test/locale/tst-numeric.c b/ap/build/uClibc/test/locale/tst-numeric.c
new file mode 100644
index 0000000..9d3c91d
--- /dev/null
+++ b/ap/build/uClibc/test/locale/tst-numeric.c
@@ -0,0 +1,74 @@
+/* Testing the implementation of LC_NUMERIC and snprintf().
+   Copyright (C) 2003 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+   Contributed by Petter Reinholdtsen <pere@hungry.com>, 2003
+
+   Based on tst-fmon.c by Jochen Hein <jochen.hein@delphi.central.de>, 1997.
+
+   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 <stdio.h>
+#include <locale.h>
+#include <string.h>
+#include <stdlib.h>
+
+/*
+  test-numeric gets called with three parameters:
+   - the locale
+   - the format-string to be used
+   - the actual number to be formatted
+   - the expected string
+   If the test passes, test-numeric terminates with returncode 0,
+   otherwise with 1
+*/
+#define EXIT_SUCCESS 0
+#define EXIT_FAILURE 1
+#define EXIT_SETLOCALE 2
+#define EXIT_SNPRINTF 3
+
+int
+main (int argc, char *argv[])
+{
+  char *s = malloc (201);
+  double val;
+
+  /* Make sure to read the value before setting of the locale, as
+     strtod() is locale-dependent. */
+  val = strtod (argv[3], NULL);
+
+  if (setlocale (LC_ALL, argv[1]) == NULL)
+    {
+      fprintf (stderr, "setlocale(LC_ALL, \"%s\"): %m\n", argv[1]);
+      exit (EXIT_SETLOCALE);
+    }
+
+  if (snprintf (s, 200, argv[2], val) == -1)
+    {
+      perror ("snprintf");
+      exit (EXIT_SNPRINTF);
+    }
+
+  if (strcmp (s, argv[4]) != 0)
+    {
+      printf ("\
+locale: \"%s\", format: \"%s\", expected: \"%s\", got: \"%s\" => %s\n",
+	      argv[1], argv[2], argv[4], s,
+	      strcmp (s, argv[4]) != 0 ? "false" : "correct");
+      exit (EXIT_FAILURE);
+    }
+
+  return EXIT_SUCCESS;
+}
diff --git a/ap/build/uClibc/test/locale/tst-rpmatch.c b/ap/build/uClibc/test/locale/tst-rpmatch.c
new file mode 100644
index 0000000..d751a43
--- /dev/null
+++ b/ap/build/uClibc/test/locale/tst-rpmatch.c
@@ -0,0 +1,37 @@
+/* Test program for rpmatch function.
+   Copyright (C) 1998, 2000 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+   Contributed by Jochen Hein <jochen.hein@delphi.central.de>.
+
+   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 <locale.h>
+#include <stdio.h>
+#include <stdlib.h>
+
+int
+main (int argc, char* argv[])
+{
+  setlocale (LC_ALL, argv[1]);
+
+  if (rpmatch (argv[2]) != atol (argv[3]))
+    {
+      fprintf (stderr,"Failed: Locale %s, String %s, Exp: %s, got %d\n",
+	       argv[1], argv[2], argv[3], rpmatch (argv[2]));
+      exit (EXIT_FAILURE);
+    }
+  return EXIT_SUCCESS;
+}
diff --git a/ap/build/uClibc/test/locale/tst-setlocale.c b/ap/build/uClibc/test/locale/tst-setlocale.c
new file mode 100644
index 0000000..1f8e68d
--- /dev/null
+++ b/ap/build/uClibc/test/locale/tst-setlocale.c
@@ -0,0 +1,25 @@
+/* Test case by Jakub Jelinek <jakub@redhat.com>.  */
+#include <locale.h>
+#include <stdio.h>
+#include <string.h>
+
+int
+main (void)
+{
+  char q[30];
+  char *s;
+
+  setlocale (LC_ALL, "");
+  printf ("after setlocale (LC_ALL, \"\"): %s\n", setlocale(LC_NUMERIC, NULL));
+
+  strcpy (q, "de_DE.UTF-8");
+  setlocale (LC_NUMERIC, q);
+  printf ("after setlocale (LC_NUMERIC, \"%s\"): %s\n",
+	  q, setlocale(LC_NUMERIC, NULL));
+
+  strcpy (q, "de_DE.ISO-8859-1");
+  s = setlocale (LC_NUMERIC, NULL);
+  printf ("after overwriting string: %s\n", s);
+
+  return strcmp (s, "de_DE.UTF-8") != 0;
+}
diff --git a/ap/build/uClibc/test/locale/tst-sscanf.c b/ap/build/uClibc/test/locale/tst-sscanf.c
new file mode 100644
index 0000000..32c1328
--- /dev/null
+++ b/ap/build/uClibc/test/locale/tst-sscanf.c
@@ -0,0 +1,56 @@
+#include <stdio.h>
+#include <locale.h>
+#include <assert.h>
+
+#define P0 "\xDB\xB0"
+#define P1 "\xDB\xB1"
+#define P2 "\xDB\xB2"
+#define P3 "\xDB\xB3"
+#define P4 "\xDB\xB4"
+#define P5 "\xDB\xB5"
+#define P6 "\xDB\xB6"
+#define P7 "\xDB\xB7"
+#define P8 "\xDB\xB8"
+#define P9 "\xDB\xB9"
+#define PD "\xd9\xab"
+#define PT "\xd9\xac"
+
+static int
+check_sscanf (const char *s, const char *format, const float n)
+{
+  float f;
+
+  if (sscanf (s, format, &f) != 1)
+    {
+      printf ("nothing found for \"%s\"\n", s);
+      return 1;
+    }
+  if (f != n)
+    {
+      printf ("got %f expected %f from \"%s\"\n", f, n, s);
+      return 1;
+    }
+  return 0;
+}
+
+static int
+do_test (void)
+{
+  if (setlocale (LC_ALL, "fa_IR.UTF-8") == NULL)
+    {
+      puts ("cannot set fa_IR locale");
+      return 1;
+    }
+
+  int r = check_sscanf (P3 PD P1 P4, "%I8f", 3.14);
+  r |= check_sscanf (P3 PT P1 P4 P5, "%I'f", 3145);
+  r |= check_sscanf (P3 PD P1 P4 P1 P5 P9, "%If", 3.14159);
+  r |= check_sscanf ("-" P3 PD P1 P4 P1 P5, "%If", -3.1415);
+  r |= check_sscanf ("+" PD P1 P4 P1 P5, "%If", +.1415);
+  r |= check_sscanf (P3 PD P1 P4 P1 P5 "e+" P2, "%Ie", 3.1415e+2);
+
+  return r;
+}
+
+#define TEST_FUNCTION do_test ()
+#include "../test-skeleton.c"
diff --git a/ap/build/uClibc/test/locale/tst-strfmon1.c b/ap/build/uClibc/test/locale/tst-strfmon1.c
new file mode 100644
index 0000000..e30aa1b
--- /dev/null
+++ b/ap/build/uClibc/test/locale/tst-strfmon1.c
@@ -0,0 +1,42 @@
+#include <monetary.h>
+#include <locale.h>
+#include <stdio.h>
+#include <string.h>
+
+static const struct
+{
+  const char *locale;
+  const char *expected;
+} tests[] =
+  {
+    { "de_DE.ISO-8859-1", "|-12,34 EUR|-12,34|" },
+    { "da_DK.ISO-8859-1", "|kr -12,34|-12,34|" },
+    { "zh_TW.EUC-TW", "|-NT$12.34|-12.34|" },
+    { "sv_SE.ISO-8859-1", "|-12,34 kr|-12,34|" }
+  };
+#define ntests (sizeof (tests) / sizeof (tests[0]))
+
+
+static int
+do_test (void)
+{
+  int res = 0;
+  for (int i = 0; i < ntests; ++i)
+    {
+      char buf[500];
+      if (setlocale (LC_ALL, tests[i].locale) == NULL)
+	{
+	  printf ("failed to set locale %s\n", tests[i].locale);
+	  res = 1;
+	  continue;
+	}
+      strfmon (buf, sizeof (buf), "|%n|%!n|", -12.34, -12.34);
+      int fail = strcmp (buf, tests[i].expected) != 0;
+      printf ("%s%s\n", buf, fail ? " *** FAIL ***" : "");
+      res |= fail;
+    }
+  return res;
+}
+
+#define TEST_FUNCTION do_test ()
+#include "../test-skeleton.c"
diff --git a/ap/build/uClibc/test/locale/tst-trans.c b/ap/build/uClibc/test/locale/tst-trans.c
new file mode 100644
index 0000000..034a362
--- /dev/null
+++ b/ap/build/uClibc/test/locale/tst-trans.c
@@ -0,0 +1,71 @@
+/* Test program for user-defined character maps.
+   Copyright (C) 1999, 2000 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+   Contributed by Ulrich Drepper <drepper@cygnus.com>.
+
+   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 <locale.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <wchar.h>
+#include <wctype.h>
+
+int
+main (void)
+{
+  char buf[30];
+  wchar_t wbuf[30];
+  wctrans_t t;
+  wint_t wch;
+  int errors = 0;
+  int len;
+
+  setlocale (LC_ALL, "");
+
+  t = wctrans ("test");
+  if (t == (wctrans_t) 0)
+    {
+      puts ("locale data files probably not loaded");
+      exit (1);
+    }
+
+  wch = towctrans (L'A', t);
+  printf ("towctrans (L'A', t) = %c\n", wch);
+  if (wch != L'B')
+    errors = 1;
+
+  wch = towctrans (L'B', t);
+  printf ("towctrans (L'B', t) = %c\n", wch);
+  if (wch != L'C')
+    errors = 1;
+
+  /* Test the output digit handling.  */
+  swprintf (wbuf, sizeof (wbuf) / sizeof (wbuf[0]), L"%Id", 0x499602D2);
+  errors |= wcscmp (wbuf, L"bcdefghija") != 0;
+  len = wcslen (wbuf);
+  errors |= len != 10;
+  printf ("len = %d, wbuf = L\"%ls\"\n", len, wbuf);
+
+  snprintf (buf, sizeof buf, "%Id", 0x499602D2);
+  errors |= strcmp (buf, "bcdefghija") != 0;
+  len = strlen (buf);
+  errors |= len != 10;
+  printf ("len = %d, buf = \"%s\"\n", len, buf);
+
+  return errors;
+}
diff --git a/ap/build/uClibc/test/locale/tst-wctype.c b/ap/build/uClibc/test/locale/tst-wctype.c
new file mode 100644
index 0000000..8fd8ce5
--- /dev/null
+++ b/ap/build/uClibc/test/locale/tst-wctype.c
@@ -0,0 +1,144 @@
+/* Test program for iswctype() function in ja_JP locale.
+   Copyright (C) 2000 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+   Contributed by Ulrich Drepper <drepper@cygnus.com>.
+
+   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 <error.h>
+#include <locale.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <wchar.h>
+#include <wctype.h>
+
+int
+main (void)
+{
+  wctype_t wct;
+  wchar_t buf[1000];
+  int result = 1;
+
+  setlocale (LC_ALL, "");
+  wprintf (L"locale = %s\n", setlocale (LC_CTYPE, NULL));
+
+  wct = wctype ("jhira");
+  if (wct == 0)
+    error (EXIT_FAILURE, 0, "jhira: no such character class");
+
+  if (fgetws (buf, sizeof (buf) / sizeof (buf[0]), stdin) != NULL)
+    {
+      int n;
+
+      wprintf (L"buf[] = \"%ls\"\n", buf);
+
+      result = 0;
+
+      for (n = 0; buf[n] != L'\0'; ++n)
+	{
+	  wprintf (L"jhira(U%04lx = %lc) = %d\n", (long) buf[n], buf[n],
+		   iswctype (buf[n], wct));
+	  result |= ((buf[n] < 0xff && iswctype (buf[n], wct))
+		     || (buf[n] > 0xff && !iswctype (buf[n], wct)));
+	}
+    }
+
+  wct = wctype ("jkata");
+  if (wct == 0)
+    error (EXIT_FAILURE, 0, "jkata: no such character class");
+
+  if (fgetws (buf, sizeof (buf) / sizeof (buf[0]), stdin) != NULL)
+    {
+      int n;
+
+      wprintf (L"buf[] = \"%ls\"\n", buf);
+
+      result = 0;
+
+      for (n = 0; buf[n] != L'\0'; ++n)
+	{
+	  wprintf (L"jkata(U%04lx = %lc) = %d\n", (long) buf[n], buf[n],
+		   iswctype (buf[n], wct));
+	  result |= ((buf[n] < 0xff && iswctype (buf[n], wct))
+		     || (buf[n] > 0xff && !iswctype (buf[n], wct)));
+	}
+    }
+
+  wct = wctype ("jdigit");
+  if (wct == 0)
+    error (EXIT_FAILURE, 0, "jdigit: no such character class");
+
+  if (fgetws (buf, sizeof (buf) / sizeof (buf[0]), stdin) != NULL)
+    {
+      int n;
+
+      wprintf (L"buf[] = \"%ls\"\n", buf);
+
+      result = 0;
+
+      for (n = 0; buf[n] != L'\0'; ++n)
+	{
+	  wprintf (L"jdigit(U%04lx = %lc) = %d\n", (long) buf[n], buf[n],
+		   iswctype (buf[n], wct));
+	  result |= ((buf[n] < 0xff && iswctype (buf[n], wct))
+		     || (buf[n] > 0xff && !iswctype (buf[n], wct)));
+	}
+    }
+
+  wct = wctype ("jspace");
+  if (wct == 0)
+    error (EXIT_FAILURE, 0, "jspace: no such character class");
+
+  if (fgetws (buf, sizeof (buf) / sizeof (buf[0]), stdin) != NULL)
+    {
+      int n;
+
+      wprintf (L"buf[] = \"%ls\"\n", buf);
+
+      result = 0;
+
+      for (n = 0; buf[n] != L'\0'; ++n)
+	{
+	  wprintf (L"jspace(U%04lx = %lc) = %d\n", (long) buf[n], buf[n],
+		   iswctype (buf[n], wct));
+	  result |= ((buf[n] < 0xff && iswctype (buf[n], wct))
+		     || (buf[n] > 0xff && !iswctype (buf[n], wct)));
+	}
+    }
+
+  wct = wctype ("jkanji");
+  if (wct == 0)
+    error (EXIT_FAILURE, 0, "jkanji: no such character class");
+
+  if (fgetws (buf, sizeof (buf) / sizeof (buf[0]), stdin) != NULL)
+    {
+      int n;
+
+      wprintf (L"buf[] = \"%ls\"\n", buf);
+
+      result = 0;
+
+      for (n = 0; buf[n] != L'\0'; ++n)
+	{
+	  wprintf (L"jkanji(U%04lx = %lc) = %d\n", (long) buf[n], buf[n],
+		   iswctype (buf[n], wct));
+	  result |= ((buf[n] < 0xff && iswctype (buf[n], wct))
+		     || (buf[n] > 0xff && !iswctype (buf[n], wct)));
+	}
+    }
+
+  return result;
+}
diff --git a/ap/build/uClibc/test/locale/tst-xlocale1.c b/ap/build/uClibc/test/locale/tst-xlocale1.c
new file mode 100644
index 0000000..297c9ad
--- /dev/null
+++ b/ap/build/uClibc/test/locale/tst-xlocale1.c
@@ -0,0 +1,75 @@
+#include <locale.h>
+#include <stdio.h>
+#include <string.h>
+
+
+static struct
+{
+  const char *locale;
+  const char *str1;
+  const char *str2;
+  int result;
+} tests[] =
+  {
+    { "C", "TRANSLIT", "translit", 0 },
+    { "de_DE.ISO-8859-1", "TRANSLIT", "translit", 0 },
+    { "de_DE.ISO-8859-1", "TRANSLIT", "trÄnslit", -1 },
+    { "de_DE.UTF-8", "TRANSLIT", "translit", 0 },
+    { "de_DE.ISO-8859-1", "ä", "Ä", 1 }
+  };
+#define ntests (sizeof (tests) / sizeof (tests[0]))
+
+
+int
+main (void)
+{
+  size_t cnt;
+  int result = 0;
+  locale_t loc = newlocale (1 << LC_ALL, "C", NULL);
+
+  for (cnt = 0; cnt < ntests; ++cnt)
+    {
+      int r;
+
+      if (setlocale (LC_ALL, tests[cnt].locale) == NULL)
+	{
+	  printf ("cannot set locale \"%s\": %m\n", tests[cnt].locale);
+	  result = 1;
+	  continue;
+	}
+
+      printf ("\nstrcasecmp_l (\"%s\", \"%s\", loc)\n",
+	      tests[cnt].str1, tests[cnt].str2);
+
+      r = strcasecmp_l (tests[cnt].str1, tests[cnt].str2, loc);
+      if (tests[cnt].result == 0)
+	{
+	  if (r != 0)
+	    {
+	      printf ("\"%s\" and \"%s\" expected to be the same, result %d\n",
+		      tests[cnt].str1, tests[cnt].str2, r);
+	      result = 1;
+	    }
+	}
+      else if (tests[cnt].result < 0)
+	{
+	  if (r >= 0)
+	    {
+	      printf ("\"%s\" expected to be smaller than \"%s\", result %d\n",
+		      tests[cnt].str1, tests[cnt].str2, r);
+	      result = 1;
+	    }
+	}
+      else
+	{
+	  if (r <= 0)
+	    {
+	      printf ("\"%s\" expected to be larger than \"%s\", result %d\n",
+		      tests[cnt].str1, tests[cnt].str2, r);
+	      result = 1;
+	    }
+	}
+    }
+
+  return result;
+}
diff --git a/ap/build/uClibc/test/locale/tst-xlocale2.c b/ap/build/uClibc/test/locale/tst-xlocale2.c
new file mode 100644
index 0000000..30d87de
--- /dev/null
+++ b/ap/build/uClibc/test/locale/tst-xlocale2.c
@@ -0,0 +1,64 @@
+#include <ctype.h>
+#include <locale.h>
+#include <stdio.h>
+#include <stdlib.h>
+
+
+static int do_test (__locale_t l);
+
+int
+main (void)
+{
+  locale_t l;
+  locale_t l2;
+  int result;
+
+  l = newlocale (1 << LC_ALL, "de_DE.ISO-8859-1", NULL);
+  if (l == NULL)
+    {
+      printf ("newlocale failed: %m\n");
+      exit (EXIT_FAILURE);
+    }
+  puts ("Running tests of created locale");
+  result = do_test (l);
+
+  l2 = duplocale (l);
+  if (l2 == NULL)
+    {
+      printf ("duplocale failed: %m\n");
+      exit (EXIT_FAILURE);
+    }
+  freelocale (l);
+  puts ("Running tests of duplicated locale");
+  result |= do_test (l2);
+
+  return result;
+}
+
+
+static const char str[] = "0123456789abcdef ABCDEF ghijklmnopqrstuvwxyzäÄöÖüÜ";
+static const char exd[] = "11111111110000000000000000000000000000000000000000";
+static const char exa[] = "00000000001111110111111011111111111111111111111111";
+static const char exx[] = "11111111111111110111111000000000000000000000000000";
+
+
+static int
+do_test (locale_t l)
+{
+  int result = 0;
+size_t n;
+
+#define DO_TEST(TEST, RES) \
+  for (n = 0; n < sizeof (str) - 1; ++n)				      \
+    if ('0' + (TEST (str[n], l) != 0) != RES[n])			      \
+      {									      \
+	printf ("%s(%c) failed\n", #TEST, str[n]);			      \
+	result = 1;							      \
+      }
+
+  DO_TEST (isdigit_l, exd);
+  DO_TEST (isalpha_l, exa);
+  DO_TEST (isxdigit_l, exx);
+
+  return result;
+}
diff --git a/ap/build/uClibc/test/locale/tst_nl_langinfo.c b/ap/build/uClibc/test/locale/tst_nl_langinfo.c
new file mode 100644
index 0000000..fcf2fe2
--- /dev/null
+++ b/ap/build/uClibc/test/locale/tst_nl_langinfo.c
@@ -0,0 +1,296 @@
+#include <locale.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <langinfo.h>
+#include <nl_types.h>
+
+#if !defined(__UCLIBC__) && 0
+#define DO_EXTRA
+#endif
+
+int main(int argc, char **argv)
+{
+	char *l;
+	const unsigned char *x;
+/*  	const unsigned char *y; */
+	const unsigned char *p;
+
+	if (argc > 2) {
+		printf("invalid args\n");
+		return EXIT_FAILURE;
+	}
+	if (argc == 1) {
+		l = "";
+	} else {
+		l = *++argv;
+	}
+
+	if (!(x = setlocale(LC_ALL,l))) {
+		printf("couldn't set locale %s\n", l);
+		return EXIT_FAILURE;
+	}
+
+/*  	printf("\nsetlocale returned:\n  "); */
+/*  	do { */
+/*  		printf("\\x%02x", *x); */
+/*  	} while (*x++); */
+/*  	printf("\n"); */
+
+#ifndef __BCC__
+#define STR(X) #X
+#else
+#define STR(X) __STR(X)
+#endif
+#define __PASTE2(A,B) A.B
+
+#define DO_NL_I(X) \
+	printf( STR(X) " = %d\n", (int) nl_langinfo(X) );
+#define DO_NL_S(X) \
+	printf( STR(X) " = \"%s\"\n", nl_langinfo(X) );
+#define DO_NL_C(X) \
+	printf( STR(X) " = \"\\x%02x\"\n", *((unsigned char *) nl_langinfo(X)) );
+
+	printf("ctype\n");
+
+		DO_NL_S(CODESET);
+#ifdef DO_EXTRA
+		DO_NL_I(_NL_CTYPE_INDIGITS_MB_LEN);
+		DO_NL_S(_NL_CTYPE_INDIGITS0_MB);
+		DO_NL_S(_NL_CTYPE_INDIGITS1_MB);
+		DO_NL_S(_NL_CTYPE_INDIGITS2_MB);
+		DO_NL_S(_NL_CTYPE_INDIGITS3_MB);
+		DO_NL_S(_NL_CTYPE_INDIGITS4_MB);
+		DO_NL_S(_NL_CTYPE_INDIGITS5_MB);
+		DO_NL_S(_NL_CTYPE_INDIGITS6_MB);
+		DO_NL_S(_NL_CTYPE_INDIGITS7_MB);
+		DO_NL_S(_NL_CTYPE_INDIGITS8_MB);
+		DO_NL_S(_NL_CTYPE_INDIGITS9_MB);
+#endif
+		DO_NL_S(_NL_CTYPE_OUTDIGIT0_MB);
+		DO_NL_S(_NL_CTYPE_OUTDIGIT1_MB);
+		DO_NL_S(_NL_CTYPE_OUTDIGIT2_MB);
+		DO_NL_S(_NL_CTYPE_OUTDIGIT3_MB);
+		DO_NL_S(_NL_CTYPE_OUTDIGIT4_MB);
+		DO_NL_S(_NL_CTYPE_OUTDIGIT5_MB);
+		DO_NL_S(_NL_CTYPE_OUTDIGIT6_MB);
+		DO_NL_S(_NL_CTYPE_OUTDIGIT7_MB);
+		DO_NL_S(_NL_CTYPE_OUTDIGIT8_MB);
+		DO_NL_S(_NL_CTYPE_OUTDIGIT9_MB);
+
+
+	printf("numeric\n");
+
+		DO_NL_S(RADIXCHAR);		/* DECIMAL_POINT */
+		DO_NL_S(THOUSEP);		/* THOUSANDS_SEP */
+/*  		DO_NL_S(GROUPING); */
+
+	printf("GROUPING = \"");
+	for (p = (unsigned char *) nl_langinfo(GROUPING) ; *p ; p++) {
+		printf("\\x%02x", *p);
+	}
+	printf("\"\n\n");
+
+	printf("monetary\n");
+
+		DO_NL_S(INT_CURR_SYMBOL);
+		DO_NL_S(CURRENCY_SYMBOL);
+		DO_NL_S(MON_DECIMAL_POINT);
+		DO_NL_S(MON_THOUSANDS_SEP);
+/*  		DO_NL_S(MON_GROUPING); */
+
+	printf("MON_GROUPING = \"");
+	for (p = (unsigned char *) nl_langinfo(MON_GROUPING) ; *p ; p++) {
+		printf("\\x%02x", *p);
+	}
+	printf("\"\n\n");
+
+		DO_NL_S(POSITIVE_SIGN);
+		DO_NL_S(NEGATIVE_SIGN);
+		DO_NL_C(INT_FRAC_DIGITS);
+		DO_NL_C(FRAC_DIGITS);
+		DO_NL_C(P_CS_PRECEDES);
+		DO_NL_C(P_SEP_BY_SPACE);
+		DO_NL_C(N_CS_PRECEDES);
+		DO_NL_C(N_SEP_BY_SPACE);
+		DO_NL_C(P_SIGN_POSN);
+		DO_NL_C(N_SIGN_POSN);
+		DO_NL_C(INT_P_CS_PRECEDES);
+		DO_NL_C(INT_P_SEP_BY_SPACE);
+		DO_NL_C(INT_N_CS_PRECEDES);
+		DO_NL_C(INT_N_SEP_BY_SPACE);
+		DO_NL_C(INT_P_SIGN_POSN);
+		DO_NL_C(INT_N_SIGN_POSN);
+
+		DO_NL_S(CRNCYSTR);		/* CURRENCY_SYMBOL */
+
+
+	printf("time\n");
+
+		DO_NL_S(ABDAY_1);
+		DO_NL_S(ABDAY_2);
+		DO_NL_S(ABDAY_3);
+		DO_NL_S(ABDAY_4);
+		DO_NL_S(ABDAY_5);
+		DO_NL_S(ABDAY_6);
+		DO_NL_S(ABDAY_7);
+
+		DO_NL_S(DAY_1);
+		DO_NL_S(DAY_2);
+		DO_NL_S(DAY_3);
+		DO_NL_S(DAY_4);
+		DO_NL_S(DAY_5);
+		DO_NL_S(DAY_6);
+		DO_NL_S(DAY_7);
+
+		DO_NL_S(ABMON_1);
+		DO_NL_S(ABMON_2);
+		DO_NL_S(ABMON_3);
+		DO_NL_S(ABMON_4);
+		DO_NL_S(ABMON_5);
+		DO_NL_S(ABMON_6);
+		DO_NL_S(ABMON_7);
+		DO_NL_S(ABMON_8);
+		DO_NL_S(ABMON_9);
+		DO_NL_S(ABMON_10);
+		DO_NL_S(ABMON_11);
+		DO_NL_S(ABMON_12);
+
+		DO_NL_S(MON_1);
+		DO_NL_S(MON_2);
+		DO_NL_S(MON_3);
+		DO_NL_S(MON_4);
+		DO_NL_S(MON_5);
+		DO_NL_S(MON_6);
+		DO_NL_S(MON_7);
+		DO_NL_S(MON_8);
+		DO_NL_S(MON_9);
+		DO_NL_S(MON_10);
+		DO_NL_S(MON_11);
+		DO_NL_S(MON_12);
+
+		DO_NL_S(AM_STR);
+		DO_NL_S(PM_STR);
+
+		DO_NL_S(D_T_FMT);
+		DO_NL_S(D_FMT);
+		DO_NL_S(T_FMT);
+		DO_NL_S(T_FMT_AMPM);
+/* 		DO_NL_S(ERA); */
+		{
+		    const char *p = nl_langinfo(ERA);
+		    if (!p || !*p) {
+			printf("ERA = (none)\n");
+		    } else {
+			int i;
+			printf("ERA:\n");
+			for (i=0 ; i < 100 ; i++) {
+			    printf("  %3d: \"%s\"\n", i, p);
+			    while (*p) ++p;
+			    ++p;
+			    if (!*p) break;
+			}
+		    }
+		}
+
+		DO_NL_S(ERA_YEAR);		/* non SuSv3 */
+		DO_NL_S(ERA_D_FMT);
+/* 		DO_NL_S(ALT_DIGITS); */
+		{
+		    const char *p = nl_langinfo(ALT_DIGITS);
+		    if (!p || !*p) {
+			printf("ALT_DIGITS = (none)\n");
+		    } else {
+			int i;
+			printf("ALT_DIGITS:\n");
+			for (i=0 ; i < 100 ; i++) {
+			    printf("  %3d: \"%s\"\n", i, p);
+			    while (*p) ++p;
+			    ++p;
+			}
+		    }
+		}
+		DO_NL_S(ERA_D_T_FMT);
+		DO_NL_S(ERA_T_FMT);
+
+#ifdef DO_EXTRA
+		DO_NL_C(_NL_TIME_WEEK_NDAYS);
+		DO_NL_I(_NL_TIME_WEEK_1STDAY); /* grr... this won't work with 16bit ptrs */
+		DO_NL_C(_NL_TIME_WEEK_1STWEEK);
+		DO_NL_C(_NL_TIME_FIRST_WEEKDAY);
+		DO_NL_C(_NL_TIME_FIRST_WORKDAY);
+		DO_NL_C(_NL_TIME_CAL_DIRECTION);
+		DO_NL_S(_NL_TIME_TIMEZONE);
+		DO_NL_S(_DATE_FMT);
+#endif
+
+	printf("messages\n");
+
+		DO_NL_S(YESEXPR);
+		DO_NL_S(NOEXPR);
+		DO_NL_S(YESSTR);
+		DO_NL_S(NOSTR);
+
+#ifdef DO_EXTRA
+
+	printf("paper\n");
+
+		DO_NL_I(_NL_PAPER_HEIGHT);
+		DO_NL_I(_NL_PAPER_WIDTH);
+
+	printf("name\n");
+
+		DO_NL_S(_NL_NAME_NAME_FMT);
+		DO_NL_S(_NL_NAME_NAME_GEN);
+		DO_NL_S(_NL_NAME_NAME_MR);
+		DO_NL_S(_NL_NAME_NAME_MRS);
+		DO_NL_S(_NL_NAME_NAME_MISS);
+		DO_NL_S(_NL_NAME_NAME_MS);
+
+	printf("address\n");
+
+		DO_NL_S(_NL_ADDRESS_POSTAL_FMT);
+		DO_NL_S(_NL_ADDRESS_COUNTRY_NAME);
+		DO_NL_S(_NL_ADDRESS_COUNTRY_POST);
+		DO_NL_S(_NL_ADDRESS_COUNTRY_AB2);
+		DO_NL_S(_NL_ADDRESS_COUNTRY_AB3);
+		DO_NL_S(_NL_ADDRESS_COUNTRY_CAR);
+		DO_NL_I(_NL_ADDRESS_COUNTRY_NUM);
+		DO_NL_S(_NL_ADDRESS_COUNTRY_ISBN);
+		DO_NL_S(_NL_ADDRESS_LANG_NAME);
+		DO_NL_S(_NL_ADDRESS_LANG_AB);
+		DO_NL_S(_NL_ADDRESS_LANG_TERM);
+		DO_NL_S(_NL_ADDRESS_LANG_LIB);
+
+	printf("telephone\n");
+
+		DO_NL_S(_NL_TELEPHONE_TEL_INT_FMT);
+		DO_NL_S(_NL_TELEPHONE_TEL_DOM_FMT);
+		DO_NL_S(_NL_TELEPHONE_INT_SELECT);
+		DO_NL_S(_NL_TELEPHONE_INT_PREFIX);
+
+	printf("measurement\n");
+
+		DO_NL_C(_NL_MEASUREMENT_MEASUREMENT); /* 1 is metric, 2 is US */
+
+	printf("identification\n");
+
+		DO_NL_S(_NL_IDENTIFICATION_TITLE);
+		DO_NL_S(_NL_IDENTIFICATION_SOURCE);
+		DO_NL_S(_NL_IDENTIFICATION_ADDRESS);
+		DO_NL_S(_NL_IDENTIFICATION_CONTACT);
+		DO_NL_S(_NL_IDENTIFICATION_EMAIL);
+		DO_NL_S(_NL_IDENTIFICATION_TEL);
+		DO_NL_S(_NL_IDENTIFICATION_FAX);
+		DO_NL_S(_NL_IDENTIFICATION_LANGUAGE);
+		DO_NL_S(_NL_IDENTIFICATION_TERRITORY);
+		DO_NL_S(_NL_IDENTIFICATION_AUDIENCE);
+		DO_NL_S(_NL_IDENTIFICATION_APPLICATION);
+		DO_NL_S(_NL_IDENTIFICATION_ABBREVIATION);
+		DO_NL_S(_NL_IDENTIFICATION_REVISION);
+		DO_NL_S(_NL_IDENTIFICATION_DATE);
+		DO_NL_S(_NL_IDENTIFICATION_CATEGORY);
+
+#endif
+
+	return EXIT_SUCCESS;
+}
diff --git a/ap/build/uClibc/test/locale/xfrm-test.c b/ap/build/uClibc/test/locale/xfrm-test.c
new file mode 100644
index 0000000..199bb6b
--- /dev/null
+++ b/ap/build/uClibc/test/locale/xfrm-test.c
@@ -0,0 +1,144 @@
+/* Test collation function via transformation using real data.
+   Copyright (C) 1997, 1998, 2000, 2003 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+   Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997.
+
+   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 <ctype.h>
+#include <error.h>
+#include <locale.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+
+
+struct lines
+{
+  char *xfrm;
+  char *line;
+};
+
+static int xstrcmp (const void *, const void *);
+
+int
+main (int argc, char *argv[])
+{
+  int result = 0;
+  size_t nstrings, nstrings_max;
+  struct lines *strings;
+  char *line = NULL;
+  size_t len = 0;
+  size_t n;
+
+  if (argc < 2)
+    error (1, 0, "usage: %s <random seed>", argv[0]);
+
+  setlocale (LC_ALL, "");
+
+  nstrings_max = 100;
+  nstrings = 0;
+  strings = (struct lines *) malloc (nstrings_max * sizeof (struct lines));
+  if (strings == NULL)
+    {
+      perror (argv[0]);
+      exit (1);
+    }
+
+  while (1)
+    {
+      char saved, *newp;
+      int needed;
+      int l;
+      if (getline (&line, &len, stdin) < 0)
+	break;
+
+      if (nstrings == nstrings_max)
+	{
+	  strings = (struct lines *) realloc (strings,
+					      (nstrings_max *= 2)
+					       * sizeof (*strings));
+	  if (strings == NULL)
+	    {
+	      perror (argv[0]);
+	      exit (1);
+	    }
+	}
+      strings[nstrings].line = strdup (line);
+      l = strcspn (line, ":(;");
+      while (l > 0 && isspace (line[l - 1]))
+	--l;
+
+      saved = line[l];
+      line[l] = '\0';
+      needed = strxfrm (NULL, line, 0);
+      newp = malloc (needed + 1);
+      strxfrm (newp, line, needed + 1);
+      strings[nstrings].xfrm = newp;
+      line[l] = saved;
+      ++nstrings;
+    }
+  free (line);
+
+  /* First shuffle.  */
+  srandom (atoi (argv[1]));
+  for (n = 0; n < 10 * nstrings; ++n)
+    {
+      int r1, r2, r;
+      size_t idx1 = random () % nstrings;
+      size_t idx2 = random () % nstrings;
+      struct lines tmp = strings[idx1];
+      strings[idx1] = strings[idx2];
+      strings[idx2] = tmp;
+
+      /* While we are at it a first little test.  */
+      r1 = strcmp (strings[idx1].xfrm, strings[idx2].xfrm);
+      r2 = strcmp (strings[idx2].xfrm, strings[idx1].xfrm);
+      r = -(r1 ^ r2);
+      if (r)
+	r /= abs (r1 ^ r2);
+
+      if (r < 0 || (r == 0 && (r1 != 0 || r2 != 0))
+	  || (r > 0 && (r1 ^ r2) >= 0))
+	printf ("collate wrong: %d vs. %d\n", r1, r2);
+    }
+
+  /* Now sort.  */
+  qsort (strings, nstrings, sizeof (struct lines), xstrcmp);
+
+  /* Print the result.  */
+  for (n = 0; n < nstrings; ++n)
+    {
+      fputs (strings[n].line, stdout);
+      free (strings[n].line);
+      free (strings[n].xfrm);
+    }
+  free (strings);
+
+  return result;
+}
+
+
+static int
+xstrcmp (ptr1, ptr2)
+     const void *ptr1;
+     const void *ptr2;
+{
+  const struct lines *l1 = (const struct lines *) ptr1;
+  const struct lines *l2 = (const struct lines *) ptr2;
+
+  return strcmp (l1->xfrm, l2->xfrm);
+}
diff --git a/ap/build/uClibc/test/malloc/Makefile b/ap/build/uClibc/test/malloc/Makefile
new file mode 100644
index 0000000..d76f07b
--- /dev/null
+++ b/ap/build/uClibc/test/malloc/Makefile
@@ -0,0 +1,7 @@
+# uClibc malloc tests
+# Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
+
+top_builddir=../../
+include ../Rules.mak
+-include Makefile.in
+include ../Test.mak
diff --git a/ap/build/uClibc/test/malloc/Makefile.in b/ap/build/uClibc/test/malloc/Makefile.in
new file mode 100644
index 0000000..7b8c0fa
--- /dev/null
+++ b/ap/build/uClibc/test/malloc/Makefile.in
@@ -0,0 +1,4 @@
+# uClibc malloc tests
+# Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
+
+TESTS_DISABLED := time_malloc
diff --git a/ap/build/uClibc/test/malloc/malloc-standard-alignment.c b/ap/build/uClibc/test/malloc/malloc-standard-alignment.c
new file mode 100644
index 0000000..71e5023
--- /dev/null
+++ b/ap/build/uClibc/test/malloc/malloc-standard-alignment.c
@@ -0,0 +1,42 @@
+/* exercise a bug found in malloc-standard when alignment
+ * values are out of whack and cause a small overflow into
+ * actual user data.
+ */
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <sys/types.h>
+
+#define ok(p) ((void*)p > (void*)0x1000)
+#define x \
+	do { \
+		printf("%i: phead = %p, phead->link @ %p = %p %s\n", \
+			__LINE__, phead, \
+			ok(phead) ? &phead->link : 0, \
+			ok(phead) ? phead->link : 0, \
+			ok(phead) ? phead->link == 0 ? "" : "!!!!!!!!!!!" : ""); \
+		if (phead->link != NULL) exit(1); \
+	} while (0);
+
+struct llist_s {
+	void *data;
+	struct llist_s *link;
+} *phead;
+
+int main(int argc, char *argv[])
+{
+	char *line, *reg;
+
+	setbuf(stdout, NULL);
+	setbuf(stderr, NULL);
+
+	phead = malloc(sizeof(*phead));
+	phead->link = NULL;
+
+x	line = malloc(80);
+x	line = realloc(line, 2);
+x	reg = malloc(32);
+x	free(line);
+
+x	return 0;
+}
diff --git a/ap/build/uClibc/test/malloc/malloc.c b/ap/build/uClibc/test/malloc/malloc.c
new file mode 100644
index 0000000..ca7c5f9
--- /dev/null
+++ b/ap/build/uClibc/test/malloc/malloc.c
@@ -0,0 +1,81 @@
+
+#include <unistd.h>
+#include <stdlib.h>
+#include <string.h>
+#include <stdio.h>
+
+#define N_PTRS 1000
+#define N_ALLOCS 10000
+#define MAX_SIZE 0x10000
+
+#define random_size()	(random()%MAX_SIZE)
+#define random_ptr()	(random()%N_PTRS)
+
+int test1(void);
+int test2(void);
+
+int main(int argc, char *argv[])
+{
+	return test1() + test2();
+}
+
+int test1(void)
+{
+	void **ptrs;
+	int i,j;
+	int size;
+	int ret = 0;
+
+	srandom(0x19730929);
+
+	ptrs = malloc(N_PTRS*sizeof(void *));
+
+	for(i=0; i<N_PTRS; i++){
+		if ((ptrs[i] = malloc(random_size())) == NULL) {
+			printf("malloc random failed! %i\n", i);
+			++ret;
+		}
+	}
+	for(i=0; i<N_ALLOCS; i++){
+		j = random_ptr();
+		free(ptrs[j]);
+
+		size = random_size();
+		ptrs[j] = malloc(size);
+		if (!ptrs[j]) {
+			printf("malloc failed! %d\n", i);
+			++ret;
+		}
+		memset(ptrs[j],0,size);
+	}
+	for(i=0; i<N_PTRS; i++){
+		free(ptrs[i]);
+	}
+
+	return ret;
+}
+
+int test2(void)
+{
+	void *ptr = NULL;
+	int ret = 0;
+
+	ptr = realloc(ptr,100);
+	if (!ptr) {
+		printf("couldn't realloc() a NULL pointer\n");
+		++ret;
+	} else {
+		free(ptr);
+	}
+
+	ptr = malloc(100);
+	ptr = realloc(ptr, 0);
+	if (ptr) {
+		printf("realloc(,0) failed\n");
+		++ret;
+		free(ptr);
+	}
+
+	return ret;
+}
+
diff --git a/ap/build/uClibc/test/malloc/mallocbug.c b/ap/build/uClibc/test/malloc/mallocbug.c
new file mode 100644
index 0000000..84a6387
--- /dev/null
+++ b/ap/build/uClibc/test/malloc/mallocbug.c
@@ -0,0 +1,67 @@
+/* Reproduce a GNU malloc bug.  */
+#include <malloc.h>
+#include <stdio.h>
+#include <string.h>
+
+#define size_t unsigned int
+
+int
+main (int argc, char *argv[])
+{
+  char *dummy0;
+  char *dummy1;
+  char *fill_info_table1;
+  char *over_top;
+  size_t over_top_size = 0x3000;
+  char *over_top_dup;
+  size_t over_top_dup_size = 0x7000;
+  char *x;
+  size_t i;
+
+  /* Here's what memory is supposed to look like (hex):
+        size  contents
+        3000  original_info_table, later fill_info_table1
+      3fa000  dummy0
+      3fa000  dummy1
+        6000  info_table_2
+	3000  over_top
+
+	*/
+  /* mem: original_info_table */
+  dummy0 = malloc (0x3fa000);
+  /* mem: original_info_table, dummy0 */
+  dummy1 = malloc (0x3fa000);
+  /* mem: free, dummy0, dummy1, info_table_2 */
+  fill_info_table1 = malloc (0x3000);
+  /* mem: fill_info_table1, dummy0, dummy1, info_table_2 */
+
+  x = malloc (0x1000);
+  free (x);
+  /* mem: fill_info_table1, dummy0, dummy1, info_table_2, freexx */
+
+  /* This is what loses; info_table_2 and freexx get combined unbeknownst
+     to mmalloc, and mmalloc puts over_top in a section of memory which
+     is on the free list as part of another block (where info_table_2 had
+     been).  */
+  over_top = malloc (over_top_size);
+  over_top_dup = malloc (over_top_dup_size);
+  memset (over_top, 0, over_top_size);
+  memset (over_top_dup, 1, over_top_dup_size);
+
+  for (i = 0; i < over_top_size; ++i)
+    if (over_top[i] != 0)
+      {
+	printf ("FAIL: malloc expands info table\n");
+	return 0;
+      }
+
+  for (i = 0; i < over_top_dup_size; ++i)
+    if (over_top_dup[i] != 1)
+      {
+	printf ("FAIL: malloc expands info table\n");
+	return 0;
+      }
+
+  printf ("PASS: malloc expands info table\n");
+  return 0;
+}
diff --git a/ap/build/uClibc/test/malloc/realloc-can-shrink.c b/ap/build/uClibc/test/malloc/realloc-can-shrink.c
new file mode 100644
index 0000000..33249db
--- /dev/null
+++ b/ap/build/uClibc/test/malloc/realloc-can-shrink.c
@@ -0,0 +1,17 @@
+/* make sure that realloc() can properly shrink buffers */
+
+#include <stdlib.h>
+
+#define LARGE_BUFFER (1 << 20) /* idea is to span a lot of pages */
+
+int main(int argc, char *argv[])
+{
+	int count = 20;
+	char *ptr = NULL;
+	while (count--) {
+		ptr = realloc(ptr, LARGE_BUFFER);
+		ptr = realloc(ptr, 1);
+	}
+	free(ptr);
+	return 0;
+}
diff --git a/ap/build/uClibc/test/malloc/realloc0.c b/ap/build/uClibc/test/malloc/realloc0.c
new file mode 100644
index 0000000..62ae39d
--- /dev/null
+++ b/ap/build/uClibc/test/malloc/realloc0.c
@@ -0,0 +1,13 @@
+#include <stdlib.h>
+#include <stdio.h>
+
+int main(int argc, char **argv)
+{
+	void *ptr = NULL;
+	ptr = realloc(ptr, 0);
+	printf("realloc(NULL, 0)  --  pointer = %p\n", ptr);
+
+	ptr = malloc(0);
+	printf("malloc(0)  --  pointer = %p\n", ptr);
+	return 0;
+}
diff --git a/ap/build/uClibc/test/malloc/testmalloc.c b/ap/build/uClibc/test/malloc/testmalloc.c
new file mode 100644
index 0000000..42707d2
--- /dev/null
+++ b/ap/build/uClibc/test/malloc/testmalloc.c
@@ -0,0 +1,101 @@
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+
+
+struct list {
+	struct list *next;
+};
+
+int main(void)
+{
+	int z=999;
+	int *y=&z;
+	int *x=NULL;
+	struct list *save;
+	struct list *lp;
+	int i;
+
+
+	printf("pointer to x is %p\n", x);
+	printf("pointer to y is %p\n", y);
+	x=malloc(sizeof(int)*2000);
+	printf("pointer to x is %p\n", x);
+	y=malloc(sizeof(int)*100);
+	printf("pointer to y is %p\n", y);
+	free(x);
+	free(y);
+	printf("about to free(0)\n");
+	free(0);
+
+	x=malloc(13);
+	printf("x = %p\n", x);
+	memcpy(x, "Small string", 13);
+	printf("0x%p test string1: %s\n", x, (char *)x);
+	y = realloc(x, 36);
+	printf("0x%p test string1: %s\n", y, (char *)y);
+	memcpy(y, "********** Larger string **********", 36);
+	printf("0x%p test string2: %s\n", y, (char *)y);
+	free(y);
+
+
+	printf("Allocate 100 nodes 500 bytes each\n");
+	save = 0;
+	for (i=0; i<100; i++) {
+		lp = malloc(500);
+		if (lp == 0) {
+			printf("loop 1: malloc returned 0\n");
+			goto Failed;
+		}
+		lp->next = save;
+		save = lp;
+	}
+
+	printf("freeing 100 nodes\n");
+	while (save) {
+		lp = save;
+		save = save->next;
+		free(lp);
+	}
+
+	printf("try realloc 100 times \n");
+	lp = 0;
+	for (i=1; i<=100; i++) {
+		lp = realloc(lp, i*200);
+		if (lp == 0) {
+			printf("loop 3: realloc returned 0\n");
+			goto Failed;
+		}
+	}
+	{
+	void *unused_ret = realloc(lp, 0);
+	(void) unused_ret;
+	}
+
+	printf("Allocate another 100 nodes 600 bytes each\n");
+	save = 0;
+	for (i=0; i<100; i++) {
+		lp = malloc(600);
+		if (lp == 0) {
+			printf("loop 2: malloc returned 0\n");
+			goto Failed;
+		}
+		lp->next = save;
+		save = lp;
+	}
+
+	printf("freeing 100 nodes\n");
+	while (save) {
+		lp = save;
+		save = save->next;
+		free(lp);
+	}
+
+
+	printf("alloc test PASSED\n");
+	exit(0);
+
+Failed:
+	printf("!!!!!!!!!!!! alloc test FAILED. !!!!!!!!!!!!!!!\n");
+	exit(1);
+}
diff --git a/ap/build/uClibc/test/malloc/time_malloc.c b/ap/build/uClibc/test/malloc/time_malloc.c
new file mode 100644
index 0000000..0b62665
--- /dev/null
+++ b/ap/build/uClibc/test/malloc/time_malloc.c
@@ -0,0 +1,62 @@
+#include <stdlib.h>
+#define REPS (100000)
+int sizes[] = {
+    100000, 1024, 42000, 350, 100, 80, 3 ,3,3,3,3,3,3,3,3,3,3,3,3,50,
+    100000, 1024, 42000, 350, 100, 80, 3 ,3,3,3,3,3,3,3,3,3,3,3,3,50,
+    100000, 1024, 42000, 350, 100, 80, 3 ,3,3,3,3,3,3,3,3,3,3,3,3,50,
+    100000, 1024, 42000, 350, 100, 80, 3 ,3,3,3,3,3,3,3,3,3,3,3,3,50,
+    100000, 1024, 42000, 350, 100, 80, 3 ,3,3,3,3,3,3,3,3,3,3,3,3,50,
+    100000, 1024, 42000, 350, 100, 80, 3 ,3,3,3,3,3,3,3,3,3,3,3,3,50,
+    100000, 1024, 42000, 350, 100, 80, 3 ,3,3,3,3,3,3,3,3,3,3,3,3,50,
+    100000, 1024, 42000, 350, 100, 80, 3 ,3,3,3,3,3,3,3,3,3,3,3,3,50,
+    100000, 1024, 42000, 350, 100, 80, 3 ,3,3,3,3,3,3,3,3,3,3,3,3,50,
+    100000, 1024, 42000, 350, 100, 80, 3 ,3,3,3,3,3,3,3,3,3,3,3,3,50,
+    100000, 1024, 42000, 350, 100, 80, 3 ,3,3,3,3,3,3,3,3,3,3,3,3,50,
+    100000, 1024, 42000, 350, 100, 80, 3 ,3,3,3,3,3,3,3,3,3,3,3,3,50,
+    100000, 1024, 42000, 350, 100, 80, 3 ,3,3,3,3,3,3,3,3,3,3,3,3,50,
+    100000, 1024, 42000, 350, 100, 80, 3 ,3,3,3,3,3,3,3,3,3,3,3,3,50,
+    100000, 1024, 42000, 350, 100, 80, 3 ,3,3,3,3,3,3,3,3,3,3,3,3,50,
+    100000, 1024, 42000, 350, 100, 80, 3 ,3,3,3,3,3,3,3,3,3,3,3,3,50,
+    100000, 1024, 42000, 350, 100, 80, 3 ,3,3,3,3,3,3,3,3,3,3,3,3,50,
+    100000, 1024, 42000, 350, 100, 80, 3 ,3,3,3,3,3,3,3,3,3,3,3,3,50,
+    100000, 1024, 42000, 350, 100, 80, 3 ,3,3,3,3,3,3,3,3,3,3,3,3,50,
+    100000, 1024, 42000, 350, 100, 80, 3 ,3,3,3,3,3,3,3,3,3,3,3,3,50,
+    100000, 1024, 42000, 350, 100, 80, 3 ,3,3,3,3,3,3,3,3,3,3,3,3,50,
+    100000, 1024, 42000, 350, 100, 80, 3 ,3,3,3,3,3,3,3,3,3,3,3,3,50,
+    100000, 1024, 42000, 350, 100, 80, 3 ,3,3,3,3,3,3,3,3,3,3,3,3,50,
+    100000, 1024, 42000, 350, 100, 80, 3 ,3,3,3,3,3,3,3,3,3,3,3,3,50,
+    100000, 1024, 42000, 350, 100, 80, 3 ,3,3,3,3,3,3,3,3,3,3,3,3,50,
+    100000, 1024, 42000, 350, 100, 80, 3 ,3,3,3,3,3,3,3,3,3,3,3,3,50,
+    100000, 1024, 42000, 350, 100, 80, 3 ,3,3,3,3,3,3,3,3,3,3,3,3,50,
+    100000, 1024, 42000, 350, 100, 80, 3 ,3,3,3,3,3,3,3,3,3,3,3,3,50,
+    100000, 1024, 42000, 350, 100, 80, 3 ,3,3,3,3,3,3,3,3,3,3,3,3,50,
+    100000, 1024, 42000, 350, 100, 80, 3 ,3,3,3,3,3,3,3,3,3,3,3,3,50,
+    100000, 1024, 42000, 350, 100, 80, 3 ,3,3,3,3,3,3,3,3,3,3,3,3,50,
+    100000, 1024, 42000, 350, 100, 80, 3 ,3,3,3,3,3,3,3,3,3,3,3,3,50,
+    100000, 1024, 42000, 350, 100, 80, 3 ,3,3,3,3,3,3,3,3,3,3,3,3,50,
+    100000, 1024, 42000, 350, 100, 80, 3 ,3,3,3,3,3,3,3,3,3,3,3,3,50,
+    100000, 1024, 42000, 350, 100, 80, 3 ,3,3,3,3,3,3,3,3,3,3,3,3,50,
+    100000, 1024, 42000, 350, 100, 80, 3 ,3,3,3,3,3,3,3,3,3,3,3,3,50,
+    100000, 1024, 42000, 350, 100, 80, 3 ,3,3,3,3,3,3,3,3,3,3,3,3,50,
+    100000, 1024, 42000, 350, 100, 80, 3 ,3,3,3,3,3,3,3,3,3,3,3,3,50,
+    100000, 1024, 42000, 350, 100, 80, 3 ,3,3,3,3,3,3,3,3,3,3,3,3,50,
+    100000, 1024, 42000, 350, 100, 80, 3 ,3,3,3,3,3,3,3,3,3,3,3,3,50,
+    100000, 1024, 42000, 350, 100, 80, 3 ,3,3,3,3,3,3,3,3,3,3,3,3,50,
+    100000, 1024, 42000, 350, 100, 80, 3 ,3,3,3,3,3,3,3,3,3,3,3,3,50
+};
+#define NUM (sizeof sizes / sizeof sizes[0])
+int main ()
+{
+    int i, j;
+    void *allocs[NUM];
+    for (i = 0; i < REPS; i++) {
+	for (j = 0; j < NUM; j++) {
+	    allocs[j] = malloc(sizes[j]);
+	}
+	for (j = 0; j < NUM; j++) {
+	    free(allocs[j]);
+	}
+    }
+    return 0;
+}
+
diff --git a/ap/build/uClibc/test/malloc/tst-calloc.c b/ap/build/uClibc/test/malloc/tst-calloc.c
new file mode 100644
index 0000000..eb0059f
--- /dev/null
+++ b/ap/build/uClibc/test/malloc/tst-calloc.c
@@ -0,0 +1,128 @@
+/* Copyright (C) 2000, 2002 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+   Contributed by Ulrich Drepper <drepper@redhat.com>.
+
+   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 <errno.h>
+#include <limits.h>
+#include <malloc.h>
+#include <stdlib.h>
+#include <stdio.h>
+
+static int errors = 0;
+
+/* Number of samples per size.  */
+#define N 50000
+
+
+static void
+fixed_test (int size)
+{
+  char *ptrs[N];
+  int i;
+
+  for (i = 0; i < N; ++i)
+    {
+      int j;
+
+      ptrs[i] = (char *) calloc (1, size);
+
+      if (ptrs[i] == NULL)
+	break;
+
+      for (j = 0; j < size; ++j)
+	{
+	  if (ptrs[i][j] != '\0') {
+	    ++errors;
+	    printf("byte not cleared (size %d, element %d, byte %d)",
+		   size, i, j);
+	  }
+	  ptrs[i][j] = '\xff';
+	}
+    }
+
+  while (i-- > 0)
+    free (ptrs[i]);
+}
+
+
+static void
+random_test (void)
+{
+  char *ptrs[N];
+  int i;
+
+  for (i = 0; i < N; ++i)
+    {
+      int j;
+      int n = 1 + random () % 10;
+      int elem = 1 + random () % 100;
+      int size = n * elem;
+
+      ptrs[i] = (char *) calloc (n, elem);
+
+      if (ptrs[i] == NULL)
+	break;
+
+      for (j = 0; j < size; ++j)
+	{
+	  if (ptrs[i][j] != '\0') {
+	    ++errors;
+	    printf("byte not cleared (size %d, element %d, byte %d)",
+		   size, i, j);
+	  }
+	  ptrs[i][j] = '\xff';
+	}
+    }
+
+  while (i-- > 0)
+    free (ptrs[i]);
+}
+
+
+static void
+null_test (void)
+{
+  /* If the size is 0 the result is implementation defined.  Just make
+     sure the program doesn't crash.  */
+  calloc (0, 0);
+  calloc (0, UINT_MAX);
+  calloc (UINT_MAX, 0);
+  calloc (0, ~((size_t) 0));
+  calloc (~((size_t) 0), 0);
+}
+
+
+int
+main (void)
+{
+  /* We are allocating blocks with `calloc' and check whether every
+     block is completely cleared.  We first try this for some fixed
+     times and then with random size.  */
+  fixed_test (15);
+  fixed_test (5);
+  fixed_test (17);
+  fixed_test (6);
+  fixed_test (31);
+  fixed_test (96);
+
+  random_test ();
+
+  null_test ();
+
+  return errors != 0;
+}
diff --git a/ap/build/uClibc/test/malloc/tst-malloc.c b/ap/build/uClibc/test/malloc/tst-malloc.c
new file mode 100644
index 0000000..468e1d4
--- /dev/null
+++ b/ap/build/uClibc/test/malloc/tst-malloc.c
@@ -0,0 +1,73 @@
+/* Copyright (C) 1999 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+   Contributed by Andreas Jaeger <aj@arthur.rhein-neckar.de>, 1999.
+
+   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 <errno.h>
+#include <malloc.h>
+#include <stdio.h>
+#include <features.h>
+
+static int errors = 0;
+
+static void
+merror (const char *msg)
+{
+  ++errors;
+  printf ("Error: %s\n", msg);
+}
+
+int
+main (void)
+{
+  void *p;
+  int save;
+
+  errno = 0;
+
+  p = malloc (-1);
+  save = errno;
+
+  if (p != NULL)
+    merror ("malloc (-1) succeeded.");
+
+  if (p == NULL && save != ENOMEM)
+    merror ("errno is not set correctly");
+
+  p = malloc (10);
+  if (p == NULL)
+    merror ("malloc (10) failed.");
+
+  /* realloc (p, 0) == free (p).  */
+  p = realloc (p, 0);
+  if (p != NULL)
+    merror ("realloc (p, 0) failed.");
+
+  p = malloc (0);
+#if !defined(__UCLIBC__) || defined(__MALLOC_GLIBC_COMPAT__)
+  if (p == NULL)
+#else
+  if (p != NULL)
+#endif
+    merror ("malloc (0) failed.");
+
+  p = realloc (p, 0);
+  if (p != NULL)
+    merror ("realloc (p, 0) failed.");
+
+  return errors != 0;
+}
diff --git a/ap/build/uClibc/test/malloc/tst-mallocfork.c b/ap/build/uClibc/test/malloc/tst-mallocfork.c
new file mode 100644
index 0000000..5bb1d76
--- /dev/null
+++ b/ap/build/uClibc/test/malloc/tst-mallocfork.c
@@ -0,0 +1,51 @@
+/* Derived from the test case in
+   http://sourceware.org/bugzilla/show_bug.cgi?id=838.  */
+#include <assert.h>
+#include <errno.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <unistd.h>
+#include <sys/types.h>
+#include <sys/wait.h>
+
+static void
+sig_handler (int signum)
+{
+  pid_t child = vfork ();
+  if (child == 0)
+    exit (0);
+  TEMP_FAILURE_RETRY (waitpid (child, NULL, 0));
+}
+
+static int
+do_test (void)
+{
+  pid_t parent = getpid ();
+
+  struct sigaction action = { .sa_handler = sig_handler };
+  sigemptyset (&action.sa_mask);
+
+  malloc (sizeof (int));
+
+  if (sigaction (SIGALRM, &action, NULL) != 0)
+    {
+      puts ("sigaction failed");
+      return 1;
+    }
+
+  /* Create a child that sends the signal to be caught.  */
+  pid_t child = vfork ();
+  if (child == 0)
+    {
+      if (kill (parent, SIGALRM) == -1)
+	perror ("kill");
+      exit (0);
+    }
+
+  TEMP_FAILURE_RETRY (waitpid (child, NULL, 0));
+
+  return 0;
+}
+
+#define TEST_FUNCTION do_test ()
+#include "../test-skeleton.c"
diff --git a/ap/build/uClibc/test/malloc/tst-mcheck.c b/ap/build/uClibc/test/malloc/tst-mcheck.c
new file mode 100644
index 0000000..af72c04
--- /dev/null
+++ b/ap/build/uClibc/test/malloc/tst-mcheck.c
@@ -0,0 +1,96 @@
+/* Copyright (C) 2005 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+   Contributed by Jakub Jelinek <jakub@redhat.com>, 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 <errno.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <features.h>
+
+static int errors = 0;
+
+static void
+merror (const char *msg)
+{
+  ++errors;
+  printf ("Error: %s\n", msg);
+}
+
+int
+main (void)
+{
+  void *p, *q;
+
+  errno = 0;
+
+  p = malloc (-1);
+
+  if (p != NULL)
+    merror ("malloc (-1) succeeded.");
+  else if (errno != ENOMEM)
+    merror ("errno is not set correctly.");
+
+  p = malloc (10);
+  if (p == NULL)
+    merror ("malloc (10) failed.");
+
+  p = realloc (p, 0);
+  if (p != NULL)
+    merror ("realloc (p, 0) failed.");
+
+  p = malloc (0);
+#if !defined(__UCLIBC__) || defined(__MALLOC_GLIBC_COMPAT__)
+  if (p == NULL)
+#else
+  if (p != NULL)
+#endif
+    merror ("malloc (0) failed.");
+
+  p = realloc (p, 0);
+  if (p != NULL)
+    merror ("realloc (p, 0) failed.");
+
+  q = malloc (256);
+  if (q == NULL)
+    merror ("malloc (256) failed.");
+
+  p = malloc (512);
+  if (p == NULL)
+    merror ("malloc (512) failed.");
+
+  if (realloc (p, -256) != NULL)
+    merror ("realloc (p, -256) succeeded.");
+  else if (errno != ENOMEM)
+    merror ("errno is not set correctly.");
+
+  free (p);
+
+  p = malloc (512);
+  if (p == NULL)
+    merror ("malloc (512) failed.");
+
+  if (realloc (p, -1) != NULL)
+    merror ("realloc (p, -1) succeeded.");
+  else if (errno != ENOMEM)
+    merror ("errno is not set correctly.");
+
+  free (p);
+  free (q);
+
+  return errors != 0;
+}
diff --git a/ap/build/uClibc/test/malloc/tst-obstack.c b/ap/build/uClibc/test/malloc/tst-obstack.c
new file mode 100644
index 0000000..769697f
--- /dev/null
+++ b/ap/build/uClibc/test/malloc/tst-obstack.c
@@ -0,0 +1,64 @@
+/* Test case by Alexandre Duret-Lutz <duret_g@epita.fr>.  */
+#include <obstack.h>
+#include <stdint.h>
+#include <stdio.h>
+#include <stdlib.h>
+
+#define obstack_chunk_alloc verbose_malloc
+#define obstack_chunk_free verbose_free
+#define ALIGN_BOUNDARY 64
+#define ALIGN_MASK (ALIGN_BOUNDARY - 1)
+#define OBJECT_SIZE 1000
+
+static void *
+verbose_malloc (size_t size)
+{
+  void *buf = malloc (size);
+  printf ("malloc (%zu) => %p\n", size, buf);
+  return buf;
+}
+
+static void
+verbose_free (void *buf)
+{
+  free (buf);
+  printf ("free (%p)\n", buf);
+}
+
+int
+main (void)
+{
+  int result = 0;
+  int align = 2;
+
+  while (align <= 64)
+    {
+      struct obstack obs;
+      int i;
+      int align_mask = align - 1;
+
+      printf ("\n Alignment mask: %d\n", align_mask);
+
+      obstack_init (&obs);
+      obstack_alignment_mask (&obs) = align_mask;
+      /* finish an empty object to take alignment into account */
+      obstack_finish (&obs);
+
+      /* let's allocate some objects and print their addresses */
+      for (i = 15; i > 0; --i)
+	{
+	  void *obj = obstack_alloc (&obs, OBJECT_SIZE);
+
+	  printf ("obstack_alloc (%u) => %p \t%s\n", OBJECT_SIZE, obj,
+		  ((uintptr_t) obj & align_mask) ? "(not aligned)" : "");
+	  result |= ((uintptr_t) obj & align_mask) != 0;
+	}
+
+      /* clean up */
+      obstack_free (&obs, 0);
+
+      align <<= 1;
+    }
+
+  return result;
+}
diff --git a/ap/build/uClibc/test/malloc/tst-valloc.c b/ap/build/uClibc/test/malloc/tst-valloc.c
new file mode 100644
index 0000000..643a0dd
--- /dev/null
+++ b/ap/build/uClibc/test/malloc/tst-valloc.c
@@ -0,0 +1,23 @@
+/* Test case by Stephen Tweedie <sct@redhat.com>.  */
+#include <unistd.h>
+#include <stdio.h>
+#include <stdlib.h>
+
+int
+main (void)
+{
+  char *p;
+  int pagesize = getpagesize ();
+  int i;
+
+  p = valloc (pagesize);
+  i = (long int) p;
+
+  if ((i & (pagesize-1)) != 0)
+    {
+      fprintf (stderr, "Alignment problem: valloc returns %p\n", p);
+      exit (1);
+    }
+
+  return 0;
+}
diff --git a/ap/build/uClibc/test/math/Makefile b/ap/build/uClibc/test/math/Makefile
new file mode 100644
index 0000000..135aedb
--- /dev/null
+++ b/ap/build/uClibc/test/math/Makefile
@@ -0,0 +1,7 @@
+# uClibc math tests
+# Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
+
+top_builddir=../../
+include ../Rules.mak
+-include Makefile.in
+include ../Test.mak
diff --git a/ap/build/uClibc/test/math/Makefile.in b/ap/build/uClibc/test/math/Makefile.in
new file mode 100644
index 0000000..e76cbdb
--- /dev/null
+++ b/ap/build/uClibc/test/math/Makefile.in
@@ -0,0 +1,31 @@
+# uClibc math tests
+# Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
+
+TESTS := basic-test tst-definitions test-fpucw test-float test-ifloat test-double test-idouble \
+    rint signgam ilogb
+# gamma (removed from TESTS, need to add "small errors are ok" machinery there)
+ifeq ($(UCLIBC_HAS_LONG_DOUBLE_MATH),y)
+TESTS += test-ldouble test-ildoubl compile_test c99_test
+else
+CFLAGS_basic-test := -DNO_LONG_DOUBLE
+endif
+
+DODIFF_rint     := 1
+DODIFF_signgam  := 1
+
+# NOTE: For basic-test we must disable the floating point optimization.
+#       Only for sh architecture because in the other architecture are disabled.
+ifeq ($(TARGET_ARCH),sh)
+CFLAGS_basic-test += -mieee
+endif
+EXTRA_CFLAGS    := -fno-builtin
+EXTRA_LDFLAGS   := -lm
+
+PERL := /usr/bin/perl
+
+$(TESTS): libm-test.c
+
+libm-test.c: libm-test-ulps-$(TARGET_ARCH) libm-test.inc gen-libm-test.pl
+	$(Q)$(PERL) ./gen-libm-test.pl -u libm-test-ulps-$(TARGET_ARCH) ./libm-test.inc -o "." 2>&1 > /dev/null
+
+EXTRA_CLEAN := libm-test.c libm-test-ulps.h
diff --git a/ap/build/uClibc/test/math/basic-test.c b/ap/build/uClibc/test/math/basic-test.c
new file mode 100644
index 0000000..04ec6ea
--- /dev/null
+++ b/ap/build/uClibc/test/math/basic-test.c
@@ -0,0 +1,125 @@
+/* Copyright (C) 1999 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+   Contributed by Andreas Jaeger <aj@suse.de>, 1999.
+
+   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.  */
+
+#define _ISOC99_SOURCE
+
+#include <math.h>
+#include <float.h>
+#include <stdio.h>
+
+static int errors = 0;
+
+
+static void
+check (const char *testname, int result)
+{
+  if (!result) {
+    printf ("Failure: %s\n", testname);
+    errors++;
+  }
+}
+
+#define TEST_FUNC(NAME, FLOAT, NANFUNC, EPSILON, HUGEVAL) \
+static void								      \
+NAME (void)								      \
+{									      \
+  /* Variables are declared volatile to forbid some compiler		      \
+     optimizations.  */							      \
+  volatile FLOAT Inf_var, NaN_var, zero_var, one_var;			      \
+  FLOAT x1, x2;								      \
+									      \
+  zero_var = 0.0;							      \
+  one_var = 1.0;							      \
+  NaN_var = zero_var/zero_var;						      \
+  Inf_var = one_var / zero_var;						      \
+									      \
+  (void) &zero_var;							      \
+  (void) &one_var;							      \
+  (void) &NaN_var;							      \
+  (void) &Inf_var;							      \
+									      \
+									      \
+  check (#FLOAT " isinf (inf) == 1", isinf (Inf_var) == 1);		      \
+  check (#FLOAT " isinf (-inf) == -1", isinf (-Inf_var) == -1);		      \
+  check (#FLOAT " !isinf (1)", !(isinf (one_var)));			      \
+  check (#FLOAT " !isinf (NaN)", !(isinf (NaN_var)));			      \
+									      \
+  check (#FLOAT " isnan (NaN)", isnan (NaN_var));			      \
+  check (#FLOAT " isnan (-NaN)", isnan (-NaN_var));			      \
+  check (#FLOAT " !isnan (1)", !(isnan (one_var)));			      \
+  check (#FLOAT " !isnan (inf)", !(isnan (Inf_var)));			      \
+									      \
+  check (#FLOAT " inf == inf", Inf_var == Inf_var);			      \
+  check (#FLOAT " -inf == -inf", -Inf_var == -Inf_var);			      \
+  check (#FLOAT " inf != -inf", Inf_var != -Inf_var);			      \
+  check (#FLOAT " NaN != NaN", NaN_var != NaN_var);			      \
+									      \
+  /*									      \
+     the same tests but this time with NAN from <bits/nan.h>		      \
+     NAN is a double const						      \
+   */									      \
+  check (#FLOAT " isnan (NAN)", isnan (NAN));				      \
+  check (#FLOAT " isnan (-NAN)", isnan (-NAN));				      \
+  check (#FLOAT " !isinf (NAN)", !(isinf (NAN)));			      \
+  check (#FLOAT " !isinf (-NAN)", !(isinf (-NAN)));			      \
+  check (#FLOAT " NAN != NAN", NAN != NAN);				      \
+									      \
+  /*									      \
+     And again with the value returned by the `nan' function.		      \
+   */									      \
+  check (#FLOAT " isnan (NAN)", isnan (NANFUNC ("")));			      \
+  check (#FLOAT " isnan (-NAN)", isnan (-NANFUNC ("")));		      \
+  check (#FLOAT " !isinf (NAN)", !(isinf (NANFUNC (""))));		      \
+  check (#FLOAT " !isinf (-NAN)", !(isinf (-NANFUNC (""))));		      \
+  check (#FLOAT " NAN != NAN", NANFUNC ("") != NANFUNC (""));		      \
+									      \
+  /* test if EPSILON is ok */						      \
+  x1 = 1.0;								      \
+  x2 = x1 + EPSILON;							      \
+  check (#FLOAT " 1 != 1+EPSILON", x1 != x2);				      \
+									      \
+  x1 = 1.0;								      \
+  x2 = x1 - EPSILON;							      \
+  check (#FLOAT " 1 != 1-EPSILON", x1 != x2);				      \
+									      \
+  /* test if HUGE_VALx is ok */						      \
+  x1 = HUGEVAL;								      \
+  check (#FLOAT " isinf (HUGE_VALx) == +1", isinf (x1) == +1);		      \
+  x1 = - HUGEVAL;							      \
+  check (#FLOAT " isinf (-HUGE_VALx) == -1", isinf (x1) == -1);		      \
+}
+
+TEST_FUNC (float_test, float, nanf, FLT_EPSILON, HUGE_VALF)
+TEST_FUNC (double_test, double, nan, DBL_EPSILON, HUGE_VAL)
+#ifndef NO_LONG_DOUBLE
+TEST_FUNC (ldouble_test, long double, nanl, LDBL_EPSILON, HUGE_VALL)
+#endif
+
+int
+main (void)
+{
+  float_test ();
+  double_test ();
+
+#ifndef NO_LONG_DOUBLE
+  ldouble_test ();
+#endif
+
+  return errors != 0;
+}
diff --git a/ap/build/uClibc/test/math/c99_test.c b/ap/build/uClibc/test/math/c99_test.c
new file mode 100644
index 0000000..73382e4
--- /dev/null
+++ b/ap/build/uClibc/test/math/c99_test.c
@@ -0,0 +1,116 @@
+#include <math.h>
+#include <float.h>
+#include <stdlib.h>
+#include <stdint.h>
+#include <limits.h>
+#include <stdio.h>
+
+#define check_d1(func, param, expected) \
+do { \
+	int err; hex_union ur; hex_union up; \
+	double result = func(param); up.f = param; ur.f = result; \
+	errors += (err = (result != (expected))); \
+	err \
+	? printf("FAIL: %s(%g/"HEXFMT")=%g/"HEXFMT" (expected %g)\n", \
+		#func, (double)(param), (long long)up.hex, result, (long long)ur.hex, (double)(expected)) \
+	: printf("PASS: %s(%g)=%g\n", #func, (double)(param), result); \
+} while (0)
+
+#define check_i1(func, param, expected) \
+do { \
+	int err; hex_union up; \
+	long long result = func(param); up.f = param; \
+	errors += (err = (result != (expected))); \
+	err \
+	? printf("FAIL: %s(%g/"HEXFMT")=%lld/%llu (expected %llu)\n", \
+		#func, (double)(param), (long long)up.hex, result, result, (long long)(expected)) \
+	: printf("PASS: %s(%g)=%lld/%llu\n", #func, (double)(param), result, result); \
+} while (0)
+
+#define HEXFMT "%08llx"
+typedef union {
+	double f;
+	uint64_t hex;
+} hex_union;
+
+double zero = 0.0;
+double minus_zero = 0.0;
+double nan_value = 0.0;
+int errors = 0;
+
+int main(void)
+{
+	nan_value /= nan_value;
+	minus_zero = copysign(zero, -1.0);
+
+	check_i1(isfinite, 1.0, 1);
+	check_i1(isfinite, 2.0, 1);
+	check_i1(isfinite, 3.0, 1);
+	check_i1(isfinite, DBL_MAX, 1);
+	check_i1(isfinite, FLT_MAX, 1);
+	check_i1(isfinite, HUGE_VAL, 0);
+	check_i1(isfinite, HUGE_VALF, 0);
+	check_i1(isfinite, HUGE_VALL, 0);
+	check_i1(isfinite, nan_value, 0);
+	check_i1(isfinite, nan_value, 0);
+	check_i1(isfinite, nan_value, 0);
+
+	check_i1(isnan, 1.0, 0);
+	check_i1(isnan, 2.0, 0);
+	check_i1(isnan, 3.0, 0);
+	check_i1(isnan, DBL_MAX, 0);
+	check_i1(isnan, FLT_MAX, 0);
+	check_i1(isnan, HUGE_VAL, 0);
+	check_i1(isnan, HUGE_VALF, 0);
+	check_i1(isnan, HUGE_VALL, 0);
+	check_i1(isnan, (float)HUGE_VALL, 0);
+	check_i1(isnan, nan_value, 1);
+	check_i1(isnan, nan_value, 1);
+	check_i1(isnan, nan_value, 1);
+
+	check_i1(isinf, 1.0, 0);
+	check_i1(isinf, 2.0, 0);
+	check_i1(isinf, 3.0, 0);
+	check_i1(isinf, DBL_MAX, 0);
+	check_i1(isinf, FLT_MAX, 0);
+	check_i1(isinf, (float)DBL_MAX, 1);
+	check_i1(isinf, HUGE_VAL, 1);
+	check_i1(isinf, HUGE_VALF, 1);
+	check_i1(isinf, HUGE_VALL, 1);
+	check_i1(isinf, (float)HUGE_VALL, 1);
+	check_i1(isinf, nan_value, 0);
+	check_i1(isinf, nan_value, 0);
+	check_i1(isinf, nan_value, 0);
+
+	check_i1(fpclassify, minus_zero, FP_ZERO);
+	check_i1(fpclassify, 0.0, FP_ZERO);
+	check_i1(fpclassify, 1.0, FP_NORMAL);
+	check_i1(fpclassify, 2.0, FP_NORMAL);
+	check_i1(fpclassify, 3.0, FP_NORMAL);
+	check_i1(fpclassify, DBL_MIN/1.01, FP_SUBNORMAL);
+	check_i1(fpclassify, DBL_MIN, FP_NORMAL);
+	check_i1(fpclassify, DBL_MAX, FP_NORMAL);
+	check_i1(fpclassify, FLT_MAX, FP_NORMAL);
+	check_i1(fpclassify, DBL_MAX, FP_NORMAL);
+	check_i1(fpclassify, DBL_MAX*1.01, FP_INFINITE);
+	check_i1(fpclassify, HUGE_VAL, FP_INFINITE);
+	check_i1(fpclassify, HUGE_VALF, FP_INFINITE);
+	check_i1(fpclassify, HUGE_VALL, FP_INFINITE);
+	check_i1(fpclassify, (float)HUGE_VALL, FP_INFINITE);
+	check_i1(fpclassify, nan_value, FP_NAN);
+	check_i1(fpclassify, nan_value, FP_NAN);
+	check_i1(fpclassify, nan_value, FP_NAN);
+
+	check_i1(!!signbit, -1.0, 1);
+	check_i1(!!signbit, minus_zero, 1);
+	check_i1(!!signbit, 0.0, 0);
+	check_i1(!!signbit, HUGE_VAL, 0);
+	check_i1(!!signbit, HUGE_VALF, 0);
+	check_i1(!!signbit, HUGE_VALL, 0);
+	check_i1(!!signbit, -HUGE_VAL, 1);
+	check_i1(!!signbit, -HUGE_VALF, 1);
+	check_i1(!!signbit, -HUGE_VALL, 1);
+
+	printf("Errors: %d\n", errors);
+	return errors;
+}
diff --git a/ap/build/uClibc/test/math/compile_test.c b/ap/build/uClibc/test/math/compile_test.c
new file mode 100644
index 0000000..ab8c40c
--- /dev/null
+++ b/ap/build/uClibc/test/math/compile_test.c
@@ -0,0 +1,141 @@
+#include <math.h>
+
+static int testf(float float_x, long double long_double_x, /*float complex float_complex_x,*/ int int_x, long long_x)
+{
+int r = 0;
+r += acosf(float_x);
+r += acoshf(float_x);
+r += asinf(float_x);
+r += asinhf(float_x);
+r += atan2f(float_x, float_x);
+r += atanf(float_x);
+r += atanhf(float_x);
+/*r += cargf(float_complex_x); - will fight with complex numbers later */
+r += cbrtf(float_x);
+r += ceilf(float_x);
+r += copysignf(float_x, float_x);
+r += cosf(float_x);
+r += coshf(float_x);
+r += erfcf(float_x);
+r += erff(float_x);
+r += exp2f(float_x);
+r += expf(float_x);
+r += expm1f(float_x);
+r += fabsf(float_x);
+/*r += fdimf(float_x, float_x); - uclibc does not have it (yet?) */
+r += floorf(float_x);
+/*r += fmaf(float_x, float_x, float_x); - uclibc does not have it (yet?) */
+/*r += fmaxf(float_x, float_x); - uclibc does not have it (yet?) */
+/*r += fminf(float_x, float_x); - uclibc does not have it (yet?) */
+r += fmodf(float_x, float_x);
+r += frexpf(float_x, &int_x);
+r += gammaf(float_x);
+r += hypotf(float_x, float_x);
+r += ilogbf(float_x);
+r += ldexpf(float_x, int_x);
+r += lgammaf(float_x);
+r += llrintf(float_x);
+r += llroundf(float_x);
+r += log10f(float_x);
+r += log1pf(float_x);
+r += log2f(float_x);
+r += logbf(float_x);
+r += logf(float_x);
+r += lrintf(float_x);
+r += lroundf(float_x);
+r += modff(float_x, &float_x);
+/*r += nearbyintf(float_x); - uclibc does not have it (yet?) */
+/*r += nexttowardf(float_x, long_double_x); - uclibc does not have it (yet?) */
+r += powf(float_x, float_x);
+r += remainderf(float_x, float_x);
+/*r += remquof(float_x, float_x, &int_x); - uclibc does not have it (yet?) */
+r += rintf(float_x);
+r += roundf(float_x);
+#ifdef __UCLIBC_SUSV3_LEGACY__
+r += scalbf(float_x, float_x);
+#endif
+/*r += scalblnf(float_x, long_x); - uclibc does not have it (yet?) */
+r += scalbnf(float_x, int_x);
+r += significandf(float_x);
+r += sinf(float_x);
+r += sinhf(float_x);
+r += sqrtf(float_x);
+r += tanf(float_x);
+r += tanhf(float_x);
+/*r += tgammaf(float_x); - uclibc does not have it (yet?) */
+r += truncf(float_x);
+return r;
+}
+
+static int testl(long double long_double_x, int int_x, long long_x)
+{
+int r = 0;
+r += __finitel(long_double_x);
+r += __fpclassifyl(long_double_x);
+r += __isinfl(long_double_x);
+r += __isnanl(long_double_x);
+r += __signbitl(long_double_x);
+r += acoshl(long_double_x);
+r += acosl(long_double_x);
+r += asinhl(long_double_x);
+r += asinl(long_double_x);
+r += atan2l(long_double_x, long_double_x);
+r += atanhl(long_double_x);
+r += atanl(long_double_x);
+r += cbrtl(long_double_x);
+r += ceill(long_double_x);
+r += copysignl(long_double_x, long_double_x);
+r += coshl(long_double_x);
+r += cosl(long_double_x);
+r += erfcl(long_double_x);
+r += erfl(long_double_x);
+r += exp2l(long_double_x);
+r += expl(long_double_x);
+r += expm1l(long_double_x);
+r += fabsl(long_double_x);
+r += fdiml(long_double_x, long_double_x);
+r += floorl(long_double_x);
+r += fmal(long_double_x, long_double_x, long_double_x);
+r += fmaxl(long_double_x, long_double_x);
+r += fminl(long_double_x, long_double_x);
+r += fmodl(long_double_x, long_double_x);
+r += frexpl(long_double_x, &int_x);
+r += hypotl(long_double_x, long_double_x);
+r += ilogbl(long_double_x);
+r += ldexpl(long_double_x, int_x);
+r += lgammal(long_double_x);
+r += llrintl(long_double_x);
+r += llroundl(long_double_x);
+r += log10l(long_double_x);
+r += log1pl(long_double_x);
+r += log2l(long_double_x);
+r += logbl(long_double_x);
+r += logl(long_double_x);
+r += lrintl(long_double_x);
+r += lroundl(long_double_x);
+r += modfl(long_double_x, &long_double_x);
+r += nearbyintl(long_double_x);
+r += nextafterl(long_double_x, long_double_x);
+/* r += nexttowardl(long_double_x, long_double_x); - uclibc doesn't provide this [yet?] */
+r += powl(long_double_x, long_double_x);
+r += remainderl(long_double_x, long_double_x);
+r += remquol(long_double_x, long_double_x, &int_x);
+r += rintl(long_double_x);
+r += roundl(long_double_x);
+r += scalblnl(long_double_x, long_x);
+r += scalbnl(long_double_x, int_x);
+r += sinhl(long_double_x);
+r += sinl(long_double_x);
+r += sqrtl(long_double_x);
+r += tanhl(long_double_x);
+r += tanl(long_double_x);
+r += tgammal(long_double_x);
+r += truncl(long_double_x);
+return r;
+}
+
+int main(int argc, char **argv)
+{
+        /* Always 0 but gcc hopefully won't be able to notice */
+        return 5 & ((long)&testf) & ((long)&testl) & 2;
+}
diff --git a/ap/build/uClibc/test/math/fenv.h b/ap/build/uClibc/test/math/fenv.h
new file mode 100644
index 0000000..0025a62
--- /dev/null
+++ b/ap/build/uClibc/test/math/fenv.h
@@ -0,0 +1,3 @@
+/* until we support fenv ... */
+#define feclearexcept(X)
+#define fetestexcept(X) (0)
diff --git a/ap/build/uClibc/test/math/gamma.c b/ap/build/uClibc/test/math/gamma.c
new file mode 100644
index 0000000..69c10af
--- /dev/null
+++ b/ap/build/uClibc/test/math/gamma.c
@@ -0,0 +1,73 @@
+#include <math.h>
+#include <float.h>
+#include <stdlib.h>
+#include <stdint.h>
+#include <stdio.h>
+
+#define check_d1(func, param, expected) \
+do { \
+	int err; hex_union ur; hex_union up; \
+	double result = func(param); up.f = param; ur.f = result; \
+	errors += (err = (result != (expected))); \
+	err \
+	? printf("FAIL: %s(%g/"HEXFMT")=%g/"HEXFMT" (expected %g)\n", \
+		#func, (double)(param), (long long)up.hex, result, (long long)ur.hex, (double)(expected)) \
+	: printf("PASS: %s(%g)=%g\n", #func, (double)(param), result); \
+} while (0)
+
+#define HEXFMT "%08llx"
+typedef union {
+	double f;
+	uint64_t hex;
+} hex_union;
+double result;
+
+#define M_2_SQRT_PIl   3.5449077018110320545963349666822903L   /* 2 sqrt (M_PIl)  */
+#define M_SQRT_PIl     1.7724538509055160272981674833411451L   /* sqrt (M_PIl)  */
+
+double zero = 0.0;
+double minus_zero = 0.0;
+double nan_value = 0.0;
+int errors = 0;
+
+int main(void)
+{
+        nan_value /= nan_value;
+        minus_zero = copysign(zero, -1.0);
+
+	//check_d1(tgamma, HUGE_VAL, NAN);
+	//check_d1(tgamma, negative_integer, NAN);
+	check_d1(tgamma, 0.0, HUGE_VAL); /* pole */
+	check_d1(tgamma, minus_zero, -HUGE_VAL); /* pole */
+	check_d1(tgamma, DBL_MAX/2, HUGE_VAL); /* overflow to inf */
+	check_d1(tgamma, DBL_MAX, HUGE_VAL); /* overflow to inf */
+	check_d1(tgamma, HUGE_VAL, HUGE_VAL); /* overflow to inf */
+	check_d1(tgamma, 7, 2*3*4*5*6); /* normal value */
+	check_d1(tgamma, -0.5, -M_2_SQRT_PIl); /* normal value (testing negative points) */
+
+	check_d1(lgamma, -HUGE_VAL, HUGE_VAL);
+	//check_d1(lgamma, HUGE_VAL, NAN);
+	check_d1(lgamma, 0.0, HUGE_VAL); /* pole */
+	check_d1(lgamma, minus_zero, HUGE_VAL); /* pole */
+	check_d1(lgamma, 1.0, 0.0);
+	check_d1(lgamma, 2.0, 0.0);
+	check_d1(lgamma, DBL_MAX/2, HUGE_VAL); /* overflow to inf */
+	check_d1(lgamma, DBL_MAX, HUGE_VAL); /* overflow to inf */
+	check_d1(lgamma, HUGE_VAL, HUGE_VAL); /* overflow to inf */
+	check_d1(lgamma, 7, log(2*3*4*5*6)); /* normal value */
+
+	/* In glibc, gamma == lgamma. (In BSD, it's == tgamma */
+	check_d1(gamma, -HUGE_VAL, HUGE_VAL);
+	//check_d1(gamma, HUGE_VAL, NAN);
+	check_d1(gamma, 0.0, HUGE_VAL); /* pole */
+	check_d1(gamma, minus_zero, HUGE_VAL); /* pole */
+	check_d1(gamma, 1.0, 0.0);
+	check_d1(gamma, 2.0, 0.0);
+	check_d1(gamma, DBL_MAX/2, HUGE_VAL); /* overflow to inf */
+	check_d1(gamma, DBL_MAX, HUGE_VAL); /* overflow to inf */
+	check_d1(gamma, HUGE_VAL, HUGE_VAL); /* overflow to inf */
+	check_d1(gamma, 7, log(2*3*4*5*6)); /* normal value */
+
+	printf("Errors: %d\n", errors);
+	return errors;
+}
diff --git a/ap/build/uClibc/test/math/gen-libm-test.pl b/ap/build/uClibc/test/math/gen-libm-test.pl
new file mode 100755
index 0000000..26f819a
--- /dev/null
+++ b/ap/build/uClibc/test/math/gen-libm-test.pl
@@ -0,0 +1,738 @@
+#!/usr/bin/perl -w
+# Copyright (C) 1999 Free Software Foundation, Inc.
+# This file is part of the GNU C Library.
+# Contributed by Andreas Jaeger <aj@suse.de>, 1999.
+
+# 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.
+
+# This file needs to be tidied up
+# Note that functions and tests share the same namespace.
+
+# Information about tests are stored in: %results
+# $results{$test}{"kind"} is either "fct" or "test" and flags whether this
+# is a maximal error of a function or a single test.
+# $results{$test}{"type"} is the result type, e.g. normal or complex.
+# $results{$test}{"has_ulps"} is set if deltas exist.
+# $results{$test}{"has_fails"} is set if exptected failures exist.
+# In the following description $type and $float are:
+# - $type is either "normal", "real" (for the real part of a complex number)
+#   or "imag" (for the imaginary part # of a complex number).
+# - $float is either of float, ifloat, double, idouble, ldouble, ildouble;
+#   It represents the underlying floating point type (float, double or long
+#   double) and if inline functions (the leading i stands for inline)
+#   are used.
+# $results{$test}{$type}{"fail"}{$float} is defined and has a 1 if
+# the test is expected to fail
+# $results{$test}{$type}{"ulp"}{$float} is defined and has a delta as value
+
+
+use Getopt::Std;
+
+use strict;
+
+use vars qw ($input $output);
+use vars qw (%results);
+use vars qw (@tests @functions);
+use vars qw ($count);
+use vars qw (%beautify @all_floats);
+use vars qw ($output_dir $ulps_file);
+
+# all_floats is sorted and contains all recognised float types
+@all_floats = ('double', 'float', 'idouble',
+	       'ifloat', 'ildouble', 'ldouble');
+
+%beautify =
+  ( "minus_zero" => "-0",
+    "plus_zero" => "+0",
+    "minus_infty" => "-inf",
+    "plus_infty" => "inf",
+    "nan_value" => "NaN",
+    "M_El" => "e",
+    "M_E2l" => "e^2",
+    "M_E3l" => "e^3",
+    "M_LOG10El", "log10(e)",
+    "M_PIl" => "pi",
+    "M_PI_34l" => "3/4 pi",
+    "M_PI_2l" => "pi/2",
+    "M_PI_4l" => "pi/4",
+    "M_PI_6l" => "pi/6",
+    "M_PI_34_LOG10El" => "3/4 pi*log10(e)",
+    "M_PI_LOG10El" => "pi*log10(e)",
+    "M_PI2_LOG10El" => "pi/2*log10(e)",
+    "M_PI4_LOG10El" => "pi/4*log10(e)",
+    "M_LOG_SQRT_PIl" => "log(sqrt(pi))",
+    "M_LOG_2_SQRT_PIl" => "log(2*sqrt(pi))",
+    "M_2_SQRT_PIl" => "2 sqrt (pi)",
+    "M_SQRT_PIl" => "sqrt (pi)",
+    "INVALID_EXCEPTION" => "invalid exception",
+    "DIVIDE_BY_ZERO_EXCEPTION" => "division by zero exception",
+    "INVALID_EXCEPTION_OK" => "invalid exception allowed",
+    "DIVIDE_BY_ZERO_EXCEPTION_OK" => "division by zero exception allowed",
+    "EXCEPTIONS_OK" => "exceptions allowed",
+    "IGNORE_ZERO_INF_SIGN" => "sign of zero/inf not specified",
+"INVALID_EXCEPTION|IGNORE_ZERO_INF_SIGN" => "invalid exception and sign of zero/inf not specified"
+  );
+
+
+# get Options
+# Options:
+# u: ulps-file
+# h: help
+# o: output-directory
+# n: generate new ulps file
+use vars qw($opt_u $opt_h $opt_o $opt_n);
+getopts('u:o:nh');
+
+$ulps_file = 'libm-test-ulps';
+$output_dir = '';
+
+if ($opt_h) {
+  print "Usage: gen-libm-test.pl [OPTIONS]\n";
+  print " -h         print this help, then exit\n";
+  print " -o DIR     directory where generated files will be placed\n";
+  print " -n         only generate sorted file NewUlps from libm-test-ulps\n";
+  print " -u FILE    input file with ulps\n";
+  exit 0;
+}
+
+$ulps_file = $opt_u if ($opt_u);
+$output_dir = $opt_o if ($opt_o);
+
+$input = "libm-test.inc";
+$output = "${output_dir}libm-test.c";
+
+$count = 0;
+
+&parse_ulps ($ulps_file);
+&generate_testfile ($input, $output) unless ($opt_n);
+&output_ulps ("${output_dir}libm-test-ulps.h", $ulps_file) unless ($opt_n);
+&print_ulps_file ("${output_dir}NewUlps") if ($opt_n);
+
+# Return a nicer representation
+sub beautify {
+  my ($arg) = @_;
+  my ($tmp);
+
+  if (exists $beautify{$arg}) {
+    return $beautify{$arg};
+  }
+  if ($arg =~ /^-/) {
+    $tmp = $arg;
+    $tmp =~ s/^-//;
+    if (exists $beautify{$tmp}) {
+      return '-' . $beautify{$tmp};
+    }
+  }
+  if ($arg =~ /[0-9]L$/) {
+    $arg =~ s/L$//;
+  }
+  return $arg;
+}
+
+# Return a nicer representation of a complex number
+sub build_complex_beautify {
+  my ($r, $i) = @_;
+  my ($str1, $str2);
+
+  $str1 = &beautify ($r);
+  $str2 = &beautify ($i);
+  if ($str2 =~ /^-/) {
+    $str2 =~ s/^-//;
+    $str1 .= ' - ' . $str2;
+  } else {
+    $str1 .= ' + ' . $str2;
+  }
+  $str1 .= ' i';
+  return $str1;
+}
+
+# Return name of a variable
+sub get_variable {
+  my ($number) = @_;
+
+  return "x" if ($number == 1);
+  return "y" if ($number == 2);
+  return "z" if ($number == 3);
+  # return x1,x2,...
+  $number =-3;
+  return "x$number";
+}
+
+# Add a new test to internal data structures and fill in the
+# ulps, failures and exception information for the C line.
+sub new_test {
+  my ($test, $exception) = @_;
+  my $rest;
+
+  # Add ulp, xfail
+  if (exists $results{$test}{'has_ulps'}) {
+    $rest = ", DELTA$count";
+  } else {
+    $rest = ', 0';
+  }
+  if (exists $results{$test}{'has_fails'}) {
+    $rest .= ", FAIL$count";
+  } else {
+    $rest .= ', 0';
+  }
+  if (defined $exception) {
+    $rest .= ", $exception";
+  } else {
+    $rest .= ', 0';
+  }
+  $rest .= ");\n";
+  # We must increment here to keep @tests and count in sync
+  push @tests, $test;
+  ++$count;
+  return $rest;
+}
+
+# Treat some functions especially.
+# Currently only sincos needs extra treatment.
+sub special_functions {
+  my ($file, $args) = @_;
+  my (@args, $str, $test, $cline);
+
+  @args = split /,\s*/, $args;
+
+  unless ($args[0] =~ /sincos/) {
+    die ("Don't know how to handle $args[0] extra.");
+  }
+  print $file "  FUNC (sincos) ($args[1], &sin_res, &cos_res);\n";
+
+  $str = 'sincos (' . &beautify ($args[1]) . ', &sin_res, &cos_res)';
+  # handle sin
+  $test = $str . ' puts ' . &beautify ($args[2]) . ' in sin_res';
+  if ($#args == 4) {
+    $test .= " plus " . &beautify ($args[4]);
+  }
+
+  $cline = "  check_float (\"$test\", sin_res, $args[2]";
+  $cline .= &new_test ($test, $args[4]);
+  print $file $cline;
+
+  # handle cos
+  $test = $str . ' puts ' . &beautify ($args[3]) . ' in cos_res';
+  $cline = "  check_float (\"$test\", cos_res, $args[3]";
+  # only tests once for exception
+  $cline .= &new_test ($test, undef);
+  print $file $cline;
+}
+
+# Parse the arguments to TEST_x_y
+sub parse_args {
+  my ($file, $descr, $args) = @_;
+  my (@args, $str, $descr_args, $descr_res, @descr);
+  my ($current_arg, $cline, $i);
+  my ($pre, $post, @special);
+  my ($extra_var, $call, $c_call);
+
+  if ($descr eq 'extra') {
+    &special_functions ($file, $args);
+    return;
+  }
+  ($descr_args, $descr_res) = split /_/,$descr, 2;
+
+  @args = split /,\s*/, $args;
+
+  $call = "$args[0] (";
+
+  # Generate first the string that's shown to the user
+  $current_arg = 1;
+  $extra_var = 0;
+  @descr = split //,$descr_args;
+  for ($i = 0; $i <= $#descr; $i++) {
+    if ($i >= 1) {
+      $call .= ', ';
+    }
+    # FLOAT, int, long int, long long int
+    if ($descr[$i] =~ /f|i|l|L/) {
+      $call .= &beautify ($args[$current_arg]);
+      ++$current_arg;
+      next;
+    }
+    # &FLOAT, &int - argument is added here
+    if ($descr[$i] =~ /F|I/) {
+      ++$extra_var;
+      $call .= '&' . &get_variable ($extra_var);
+      next;
+    }
+    # complex
+    if ($descr[$i] eq 'c') {
+      $call .= &build_complex_beautify ($args[$current_arg], $args[$current_arg+1]);
+      $current_arg += 2;
+      next;
+    }
+
+    die ("$descr[$i] is unknown");
+  }
+  $call .= ')';
+  $str = "$call == ";
+
+  # Result
+  @descr = split //,$descr_res;
+  foreach (@descr) {
+    if ($_ =~ /f|i|l|L/) {
+      $str .= &beautify ($args[$current_arg]);
+      ++$current_arg;
+    } elsif ($_ eq 'c') {
+      $str .= &build_complex_beautify ($args[$current_arg], $args[$current_arg+1]);
+      $current_arg += 2;
+    } elsif ($_ eq 'b') {
+      # boolean
+      $str .= ($args[$current_arg] == 0) ? "false" : "true";
+      ++$current_arg;
+    } elsif ($_ eq '1') {
+      ++$current_arg;
+    } else {
+      die ("$_ is unknown");
+    }
+  }
+  # consistency check
+  if ($current_arg == $#args) {
+    die ("wrong number of arguments")
+      unless ($args[$current_arg] =~ /EXCEPTION|IGNORE_ZERO_INF_SIGN/);
+  } elsif ($current_arg < $#args) {
+    die ("wrong number of arguments");
+  } elsif ($current_arg > ($#args+1)) {
+    die ("wrong number of arguments");
+  }
+
+
+  # check for exceptions
+  if ($current_arg <= $#args) {
+    $str .= " plus " . &beautify ($args[$current_arg]);
+  }
+
+  # Put the C program line together
+  # Reset some variables to start again
+  $current_arg = 1;
+  $extra_var = 0;
+  if (substr($descr_res,0,1) eq 'f') {
+    $cline = 'check_float'
+  } elsif (substr($descr_res,0,1) eq 'b') {
+    $cline = 'check_bool';
+  } elsif (substr($descr_res,0,1) eq 'c') {
+    $cline = 'check_complex';
+  } elsif (substr($descr_res,0,1) eq 'i') {
+    $cline = 'check_int';
+  } elsif (substr($descr_res,0,1) eq 'l') {
+    $cline = 'check_long';
+  } elsif (substr($descr_res,0,1) eq 'L') {
+    $cline = 'check_longlong';
+  }
+  # Special handling for some macros:
+  $cline .= " (\"$str\", ";
+  if ($args[0] =~ /fpclassify|isnormal|isfinite|signbit/) {
+    $c_call = "$args[0] (";
+  } else {
+    $c_call = " FUNC($args[0]) (";
+  }
+  @descr = split //,$descr_args;
+  for ($i=0; $i <= $#descr; $i++) {
+    if ($i >= 1) {
+      $c_call .= ', ';
+    }
+    # FLOAT, int, long int, long long int
+    if ($descr[$i] =~ /f|i|l|L/) {
+      $c_call .= $args[$current_arg];
+      $current_arg++;
+      next;
+    }
+    # &FLOAT, &int
+    if ($descr[$i] =~ /F|I/) {
+      ++$extra_var;
+      $c_call .= '&' . &get_variable ($extra_var);
+      next;
+    }
+    # complex
+    if ($descr[$i] eq 'c') {
+      $c_call .= "BUILD_COMPLEX ($args[$current_arg], $args[$current_arg+1])";
+      $current_arg += 2;
+      next;
+    }
+  }
+  $c_call .= ')';
+  $cline .= "$c_call, ";
+
+  @descr = split //,$descr_res;
+  foreach (@descr) {
+    if ($_ =~ /b|f|i|l|L/ ) {
+      $cline .= $args[$current_arg];
+      $current_arg++;
+    } elsif ($_ eq 'c') {
+      $cline .= "BUILD_COMPLEX ($args[$current_arg], $args[$current_arg+1])";
+      $current_arg += 2;
+    } elsif ($_ eq '1') {
+      push @special, $args[$current_arg];
+      ++$current_arg;
+    }
+  }
+  # Add ulp, xfail
+  $cline .= &new_test ($str, ($current_arg <= $#args) ? $args[$current_arg] : undef);
+
+  # special treatment for some functions
+  if ($args[0] eq 'frexp') {
+    if (defined $special[0] && $special[0] ne "IGNORE") {
+      my ($str) = "$call sets x to $special[0]";
+      $post = "  check_int (\"$str\", x, $special[0]";
+      $post .= &new_test ($str, undef);
+    }
+  } elsif ($args[0] eq 'gamma' || $args[0] eq 'lgamma') {
+    $pre = "  signgam = 0;\n";
+    if (defined $special[0] && $special[0] ne "IGNORE") {
+      my ($str) = "$call sets signgam to $special[0]";
+      $post = "  check_int (\"$str\", signgam, $special[0]";
+      $post .= &new_test ($str, undef);
+    }
+  } elsif ($args[0] eq 'modf') {
+    if (defined $special[0] && $special[0] ne "IGNORE") {
+      my ($str) = "$call sets x to $special[0]";
+      $post = "  check_float (\"$str\", x, $special[0]";
+      $post .= &new_test ($str, undef);
+    }
+  } elsif ($args[0] eq 'remquo') {
+    if (defined $special[0] && $special[0] ne "IGNORE") {
+      my ($str) = "$call sets x to $special[0]";
+      $post = "  check_int (\"$str\", x, $special[0]";
+      $post .= &new_test ($str, undef);
+    }
+  }
+
+  print $file $pre if (defined $pre);
+
+  print $file "  $cline";
+
+  print $file $post if (defined $post);
+}
+
+# Generate libm-test.c
+sub generate_testfile {
+  my ($input, $output) = @_;
+  my ($lasttext);
+  my (@args, $i, $str);
+
+  open INPUT, $input or die ("Can't open $input: $!");
+  open OUTPUT, ">$output" or die ("Can't open $output: $!");
+
+  # Replace the special macros
+  while (<INPUT>) {
+
+    # TEST_...
+    if (/^\s*TEST_/) {
+      my ($descr, $args);
+      chop;
+      ($descr, $args) = ($_ =~ /TEST_(\w+)\s*\((.*)\)/);
+      &parse_args (\*OUTPUT, $descr, $args);
+      next;
+    }
+    # START (function)
+    if (/START/) {
+      print OUTPUT "  init_max_error ();\n";
+      next;
+    }
+    # END (function)
+    if (/END/) {
+      my ($fct, $line, $type);
+      if (/complex/) {
+	s/,\s*complex\s*//;
+	$type = 'complex';
+      } else {
+	$type = 'normal';
+      }
+      ($fct) = ($_ =~ /END\s*\((.*)\)/);
+      if ($type eq 'complex') {
+	$line = "  print_complex_max_error (\"$fct\", ";
+      } else {
+	$line = "  print_max_error (\"$fct\", ";
+      }
+      if (exists $results{$fct}{'has_ulps'}) {
+	$line .= "DELTA$fct";
+      } else {
+	$line .= '0';
+      }
+      if (exists $results{$fct}{'has_fails'}) {
+	$line .= ", FAIL$fct";
+      } else {
+	$line .= ', 0';
+      }
+      $line .= ");\n";
+      print OUTPUT $line;
+      push @functions, $fct;
+      next;
+    }
+    print OUTPUT;
+  }
+  close INPUT;
+  close OUTPUT;
+}
+
+
+
+# Parse ulps file
+sub parse_ulps {
+  my ($file) = @_;
+  my ($test, $type, $float, $eps, $kind);
+
+  # $type has the following values:
+  # "normal": No complex variable
+  # "real": Real part of complex result
+  # "imag": Imaginary part of complex result
+  open ULP, $file  or die ("Can't open $file: $!");
+  while (<ULP>) {
+    chop;
+    # ignore comments and empty lines
+    next if /^#/;
+    next if /^\s*$/;
+    if (/^Test/) {
+      if (/Real part of:/) {
+	s/Real part of: //;
+	$type = 'real';
+      } elsif (/Imaginary part of:/) {
+	s/Imaginary part of: //;
+	$type = 'imag';
+      } else {
+	$type = 'normal';
+      }
+      s/^.+\"(.*)\".*$/$1/;
+      $test = $_;
+      $kind = 'test';
+      next;
+    }
+    if (/^Function: /) {
+      if (/Real part of/) {
+	s/Real part of //;
+	$type = 'real';
+      } elsif (/Imaginary part of/) {
+	s/Imaginary part of //;
+	$type = 'imag';
+      } else {
+	$type = 'normal';
+      }
+      ($test) = ($_ =~ /^Function:\s*\"([a-zA-Z0-9_]+)\"/);
+      $kind = 'fct';
+      next;
+    }
+    if (/^i?(float|double|ldouble):/) {
+      ($float, $eps) = split /\s*:\s*/,$_,2;
+
+      if ($eps eq 'fail') {
+	$results{$test}{$type}{'fail'}{$float} = 1;
+	$results{$test}{'has_fails'} = 1;
+      } elsif ($eps eq "0") {
+	# ignore
+	next;
+      } else {
+	$results{$test}{$type}{'ulp'}{$float} = $eps;
+	$results{$test}{'has_ulps'} = 1;
+      }
+      if ($type =~ /^real|imag$/) {
+	$results{$test}{'type'} = 'complex';
+      } elsif ($type eq 'normal') {
+	$results{$test}{'type'} = 'normal';
+      }
+      $results{$test}{'kind'} = $kind;
+      next;
+    }
+    print "Skipping unknown entry: `$_'\n";
+  }
+  close ULP;
+}
+
+
+# Clean up a floating point number
+sub clean_up_number {
+  my ($number) = @_;
+
+  # Remove trailing zeros
+  $number =~ s/0+$//;
+  $number =~ s/\.$//;
+  return $number;
+}
+
+# Output a file which can be read in as ulps file.
+sub print_ulps_file {
+  my ($file) = @_;
+  my ($test, $type, $float, $eps, $fct, $last_fct);
+
+  $last_fct = '';
+  open NEWULP, ">$file" or die ("Can't open $file: $!");
+  print NEWULP "# Begin of automatic generation\n";
+  # first the function calls
+  foreach $test (sort keys %results) {
+    next if ($results{$test}{'kind'} ne 'test');
+    foreach $type ('real', 'imag', 'normal') {
+      if (exists $results{$test}{$type}) {
+	if (defined $results{$test}) {
+	  ($fct) = ($test =~ /^(\w+)\s/);
+	  if ($fct ne $last_fct) {
+	    $last_fct = $fct;
+	    print NEWULP "\n# $fct\n";
+	  }
+	}
+	if ($type eq 'normal') {
+	  print NEWULP "Test \"$test\":\n";
+	} elsif ($type eq 'real') {
+	  print NEWULP "Test \"Real part of: $test\":\n";
+	} elsif ($type eq 'imag') {
+	  print NEWULP "Test \"Imaginary part of: $test\":\n";
+	}
+	foreach $float (@all_floats) {
+	  if (exists $results{$test}{$type}{'ulp'}{$float}) {
+	    print NEWULP "$float: ",
+	    &clean_up_number ($results{$test}{$type}{'ulp'}{$float}),
+	    "\n";
+	  }
+	  if (exists $results{$test}{$type}{'fail'}{$float}) {
+	    print NEWULP "$float: fail\n";
+	  }
+	}
+      }
+    }
+  }
+  print NEWULP "\n# Maximal error of functions:\n";
+
+  foreach $fct (sort keys %results) {
+    next if ($results{$fct}{'kind'} ne 'fct');
+    foreach $type ('real', 'imag', 'normal') {
+      if (exists $results{$fct}{$type}) {
+	if ($type eq 'normal') {
+	  print NEWULP "Function: \"$fct\":\n";
+	} elsif ($type eq 'real') {
+	  print NEWULP "Function: Real part of \"$fct\":\n";
+	} elsif ($type eq 'imag') {
+	  print NEWULP "Function: Imaginary part of \"$fct\":\n";
+	}
+	foreach $float (@all_floats) {
+	  if (exists $results{$fct}{$type}{'ulp'}{$float}) {
+	    print NEWULP "$float: ",
+	    &clean_up_number ($results{$fct}{$type}{'ulp'}{$float}),
+	    "\n";
+	  }
+	  if (exists $results{$fct}{$type}{'fail'}{$float}) {
+	    print NEWULP "$float: fail\n";
+	  }
+	}
+	print NEWULP "\n";
+      }
+    }
+  }
+  print NEWULP "# end of automatic generation\n";
+  close NEWULP;
+}
+
+sub get_ulps {
+  my ($test, $type, $float) = @_;
+
+  if ($type eq 'complex') {
+    my ($res);
+    # Return 0 instead of BUILD_COMPLEX (0,0)
+    if (!exists $results{$test}{'real'}{'ulp'}{$float} &&
+	!exists $results{$test}{'imag'}{'ulp'}{$float}) {
+      return "0";
+    }
+    $res = 'BUILD_COMPLEX (';
+    $res .= (exists $results{$test}{'real'}{'ulp'}{$float}
+	     ? $results{$test}{'real'}{'ulp'}{$float} : "0");
+    $res .= ', ';
+    $res .= (exists $results{$test}{'imag'}{'ulp'}{$float}
+	     ? $results{$test}{'imag'}{'ulp'}{$float} : "0");
+    $res .= ')';
+    return $res;
+  }
+  return (exists $results{$test}{'normal'}{'ulp'}{$float}
+	  ? $results{$test}{'normal'}{'ulp'}{$float} : "0");
+}
+
+sub get_failure {
+  my ($test, $type, $float) = @_;
+  if ($type eq 'complex') {
+    # return x,y
+    my ($res);
+    # Return 0 instead of BUILD_COMPLEX_INT (0,0)
+    if (!exists $results{$test}{'real'}{'ulp'}{$float} &&
+	!exists $results{$test}{'imag'}{'ulp'}{$float}) {
+      return "0";
+    }
+    $res = 'BUILD_COMPLEX_INT (';
+    $res .= (exists $results{$test}{'real'}{'fail'}{$float}
+	     ? $results{$test}{'real'}{'fail'}{$float} : "0");
+    $res .= ', ';
+    $res .= (exists $results{$test}{'imag'}{'fail'}{$float}
+	     ? $results{$test}{'imag'}{'fail'}{$float} : "0");
+    $res .= ')';
+    return $res;
+  }
+  return (exists $results{$test}{'normal'}{'fail'}{$float}
+	  ? $results{$test}{'normal'}{'fail'}{$float} : "0");
+
+}
+
+# Output the defines for a single test
+sub output_test {
+  my ($file, $test, $name) = @_;
+  my ($ldouble, $double, $float, $ildouble, $idouble, $ifloat);
+  my ($type);
+
+  # Do we have ulps/failures?
+  if (!exists $results{$test}{'type'}) {
+    return;
+  }
+  $type = $results{$test}{'type'};
+  if (exists $results{$test}{'has_ulps'}) {
+    # XXX use all_floats (change order!)
+    $ldouble = &get_ulps ($test, $type, "ldouble");
+    $double = &get_ulps ($test, $type, "double");
+    $float = &get_ulps ($test, $type, "float");
+    $ildouble = &get_ulps ($test, $type, "ildouble");
+    $idouble = &get_ulps ($test, $type, "idouble");
+    $ifloat = &get_ulps ($test, $type, "ifloat");
+    print $file "#define DELTA$name CHOOSE($ldouble, $double, $float, $ildouble, $idouble, $ifloat)\t/* $test  */\n";
+  }
+
+  if (exists $results{$test}{'has_fails'}) {
+    $ldouble = &get_failure ($test, "ldouble");
+    $double = &get_failure ($test, "double");
+    $float = &get_failure ($test, "float");
+    $ildouble = &get_failure ($test, "ildouble");
+    $idouble = &get_failure ($test, "idouble");
+    $ifloat = &get_failure ($test, "ifloat");
+    print $file "#define FAIL$name CHOOSE($ldouble, $double, $float $ildouble, $idouble, $ifloat)\t/* $test  */\n";
+  }
+}
+
+# Print include file
+sub output_ulps {
+  my ($file, $ulps_filename) = @_;
+  my ($i, $fct);
+
+  open ULP, ">$file" or die ("Can't open $file: $!");
+
+  print ULP "/* This file is automatically generated\n";
+  print ULP "   from $ulps_filename with gen-libm-test.pl.\n";
+  print ULP "   Don't change it - change instead the master files.  */\n\n";
+
+  print ULP "\n/* Maximal error of functions.  */\n";
+  foreach $fct (@functions) {
+    output_test (\*ULP, $fct, $fct);
+  }
+
+  print ULP "\n/* Error of single function calls.  */\n";
+  for ($i = 0; $i < $count; $i++) {
+    output_test (\*ULP, $tests[$i], $i);
+  }
+  close ULP;
+}
diff --git a/ap/build/uClibc/test/math/ilogb.c b/ap/build/uClibc/test/math/ilogb.c
new file mode 100644
index 0000000..041e66b
--- /dev/null
+++ b/ap/build/uClibc/test/math/ilogb.c
@@ -0,0 +1,52 @@
+#include <math.h>
+#include <float.h>
+#include <stdlib.h>
+#include <stdint.h>
+#include <limits.h>
+#include <stdio.h>
+
+#define check_d1(func, param, expected) \
+do { \
+	int err; hex_union ur; hex_union up; \
+	double result = func(param); up.f = param; ur.f = result; \
+	errors += (err = (result != (expected))); \
+	err \
+	? printf("FAIL: %s(%g/"HEXFMT")=%g/"HEXFMT" (expected %g)\n", \
+		#func, (double)(param), (long long)up.hex, result, (long long)ur.hex, (double)(expected)) \
+	: printf("PASS: %s(%g)=%g\n", #func, (double)(param), result); \
+} while (0)
+
+#define check_i1(func, param, expected) \
+do { \
+	int err; hex_union up; \
+	long long result = func(param); up.f = param; \
+	errors += (err = (result != (expected))); \
+	err \
+	? printf("FAIL: %s(%g/"HEXFMT")=%lld/%llu (expected %llu)\n", \
+		#func, (double)(param), (long long)up.hex, result, result, (long long)(expected)) \
+	: printf("PASS: %s(%g)=%lld/%llu\n", #func, (double)(param), result, result); \
+} while (0)
+
+#define HEXFMT "%08llx"
+typedef union {
+	double f;
+	uint64_t hex;
+} hex_union;
+
+double nan_value = 0.0;
+int errors = 0;
+
+int main(void)
+{
+	nan_value /= nan_value;
+
+	check_i1(ilogb, 0.0, FP_ILOGB0);
+	check_i1(ilogb, HUGE_VAL, INT_MAX);
+	check_i1(ilogb, nan_value, FP_ILOGBNAN);
+	check_i1(ilogbf, 0.0, FP_ILOGB0);
+	check_i1(ilogbf, HUGE_VALF, INT_MAX);
+	check_i1(ilogbf, nan_value, FP_ILOGBNAN);
+
+	printf("Errors: %d\n", errors);
+	return errors;
+}
diff --git a/ap/build/uClibc/test/math/libm-test-ulps-generic b/ap/build/uClibc/test/math/libm-test-ulps-generic
new file mode 100644
index 0000000..7cfa1f8
--- /dev/null
+++ b/ap/build/uClibc/test/math/libm-test-ulps-generic
@@ -0,0 +1,5 @@
+# File with deltas for math/libm-test
+# This file is the fallback and contains
+# no data
+# You can create a new file with e.g. `test-double -u'
+# followed by `gen-libm-test.pl -u ULPs -n'.
diff --git a/ap/build/uClibc/test/math/libm-test-ulps-i386 b/ap/build/uClibc/test/math/libm-test-ulps-i386
new file mode 100644
index 0000000..a6fd6ac
--- /dev/null
+++ b/ap/build/uClibc/test/math/libm-test-ulps-i386
@@ -0,0 +1,1261 @@
+# Begin of automatic generation
+
+# acos
+Test "acos (0.75) == 0.722734247813415611178377352641333362":
+ildouble: 1
+ldouble: 1
+
+# asin
+Test "asin (-0.5) == -pi/6":
+ildouble: 1
+ldouble: 1
+Test "asin (-1.0) == -pi/2":
+ildouble: 1
+ldouble: 1
+Test "asin (0.5) == pi/6":
+ildouble: 1
+ldouble: 1
+Test "asin (0.75) == 0.848062078981481008052944338998418080":
+ildouble: 1
+ldouble: 1
+Test "asin (1.0) == pi/2":
+ildouble: 1
+ldouble: 1
+
+# atanh
+Test "atanh (0.75) == 0.972955074527656652552676371721589865":
+ildouble: 2
+ldouble: 1
+
+# cacos
+Test "Imaginary part of: cacos (0.75 + 1.25 i) == 1.11752014915610270578240049553777969 - 1.13239363160530819522266333696834467 i":
+float: 1
+ifloat: 1
+ildouble: 2
+ldouble: 2
+
+# cacosh
+Test "Real part of: cacosh (-2 - 3 i) == 1.9833870299165354323470769028940395 - 2.1414491111159960199416055713254211 i":
+double: 1
+float: 9
+idouble: 1
+ifloat: 9
+ildouble: 6
+ldouble: 6
+Test "Imaginary part of: cacosh (-2 - 3 i) == 1.9833870299165354323470769028940395 - 2.1414491111159960199416055713254211 i":
+double: 1
+float: 4
+idouble: 1
+ifloat: 4
+ildouble: 1
+ldouble: 1
+Test "Real part of: cacosh (0.75 + 1.25 i) == 1.13239363160530819522266333696834467 + 1.11752014915610270578240049553777969 i":
+ildouble: 1
+ldouble: 1
+
+# casin
+Test "Real part of: casin (0.75 + 1.25 i) == 0.453276177638793913448921196101971749 + 1.13239363160530819522266333696834467 i":
+double: 1
+float: 1
+idouble: 1
+ifloat: 1
+ildouble: 2
+ldouble: 2
+Test "Imaginary part of: casin (0.75 + 1.25 i) == 0.453276177638793913448921196101971749 + 1.13239363160530819522266333696834467 i":
+float: 1
+ifloat: 1
+ildouble: 2
+ldouble: 2
+
+# casinh
+Test "Real part of: casinh (-2 - 3 i) == -1.9686379257930962917886650952454982 - 0.96465850440760279204541105949953237 i":
+double: 5
+float: 1
+idouble: 5
+ifloat: 1
+ildouble: 5
+ldouble: 5
+Test "Imaginary part of: casinh (-2 - 3 i) == -1.9686379257930962917886650952454982 - 0.96465850440760279204541105949953237 i":
+double: 3
+float: 6
+idouble: 3
+ifloat: 6
+ildouble: 5
+ldouble: 5
+Test "Real part of: casinh (0.75 + 1.25 i) == 1.03171853444778027336364058631006594 + 0.911738290968487636358489564316731207 i":
+float: 1
+ifloat: 1
+Test "Imaginary part of: casinh (0.75 + 1.25 i) == 1.03171853444778027336364058631006594 + 0.911738290968487636358489564316731207 i":
+double: 1
+float: 1
+idouble: 1
+ifloat: 1
+ildouble: 1
+ldouble: 1
+
+# catan
+Test "Imaginary part of: catan (-2 - 3 i) == -1.4099210495965755225306193844604208 - 0.22907268296853876629588180294200276 i":
+double: 1
+float: 1
+idouble: 1
+ifloat: 1
+
+# catanh
+Test "Real part of: catanh (-2 - 3 i) == -0.14694666622552975204743278515471595 - 1.3389725222944935611241935759091443 i":
+double: 2
+float: 1
+idouble: 2
+ifloat: 1
+ildouble: 1
+ldouble: 1
+Test "Real part of: catanh (0.75 + 1.25 i) == 0.261492138795671927078652057366532140 + 0.996825126463918666098902241310446708 i":
+double: 1
+idouble: 1
+
+# cbrt
+Test "cbrt (-27.0) == -3.0":
+ildouble: 1
+ldouble: 1
+Test "cbrt (0.75) == 0.908560296416069829445605878163630251":
+ildouble: 1
+ldouble: 1
+
+# ccos
+Test "Imaginary part of: ccos (-2 - 3 i) == -4.18962569096880723013255501961597373 - 9.10922789375533659797919726277886212 i":
+float: 1
+ifloat: 1
+ildouble: 1
+ldouble: 1
+Test "Real part of: ccos (0.75 + 1.25 i) == 1.38173873063425888530729933139078645 - 1.09193013555397466170919531722024128 i":
+double: 1
+idouble: 1
+ildouble: 1
+ldouble: 1
+Test "Imaginary part of: ccos (0.75 + 1.25 i) == 1.38173873063425888530729933139078645 - 1.09193013555397466170919531722024128 i":
+ildouble: 1
+ldouble: 1
+
+# ccosh
+Test "Imaginary part of: ccosh (-2 - 3 i) == -3.72454550491532256547397070325597253 + 0.511822569987384608834463849801875634 i":
+double: 1
+float: 1
+idouble: 1
+ifloat: 1
+ildouble: 1
+ldouble: 1
+Test "Real part of: ccosh (0.75 + 1.25 i) == 0.408242591877968807788852146397499084 + 0.780365930845853240391326216300863152 i":
+double: 1
+float: 1
+idouble: 1
+ifloat: 1
+Test "Imaginary part of: ccosh (0.75 + 1.25 i) == 0.408242591877968807788852146397499084 + 0.780365930845853240391326216300863152 i":
+double: 1
+float: 1
+idouble: 1
+ifloat: 1
+
+# cexp
+Test "Real part of: cexp (-2.0 - 3.0 i) == -0.13398091492954261346140525546115575 - 0.019098516261135196432576240858800925 i":
+ildouble: 1
+ldouble: 1
+Test "Imaginary part of: cexp (-2.0 - 3.0 i) == -0.13398091492954261346140525546115575 - 0.019098516261135196432576240858800925 i":
+ildouble: 1
+ldouble: 1
+Test "Real part of: cexp (0.75 + 1.25 i) == 0.667537446429131586942201977015932112 + 2.00900045494094876258347228145863909 i":
+ildouble: 1
+ldouble: 1
+
+# clog
+Test "Real part of: clog (0.75 + 1.25 i) == 0.376885901188190075998919126749298416 + 1.03037682652431246378774332703115153 i":
+float: 1
+ifloat: 1
+ildouble: 1
+ldouble: 1
+
+# clog10
+Test "Imaginary part of: clog10 (-0 + inf i) == inf + pi/2*log10(e) i":
+double: 1
+float: 1
+idouble: 1
+ifloat: 1
+Test "Imaginary part of: clog10 (-0 - inf i) == inf - pi/2*log10(e) i":
+double: 1
+float: 1
+idouble: 1
+ifloat: 1
+Test "Imaginary part of: clog10 (-2 - 3 i) == 0.556971676153418384603252578971164214 - 0.937554462986374708541507952140189646 i":
+double: 1
+idouble: 1
+ildouble: 1
+ldouble: 1
+Test "Imaginary part of: clog10 (-3 + inf i) == inf + pi/2*log10(e) i":
+double: 1
+float: 1
+idouble: 1
+ifloat: 1
+Test "Imaginary part of: clog10 (-3 - inf i) == inf - pi/2*log10(e) i":
+double: 1
+float: 1
+idouble: 1
+ifloat: 1
+Test "Imaginary part of: clog10 (-inf + 0 i) == inf + pi*log10(e) i":
+double: 1
+float: 1
+idouble: 1
+ifloat: 1
+Test "Imaginary part of: clog10 (-inf + 1 i) == inf + pi*log10(e) i":
+double: 1
+float: 1
+idouble: 1
+ifloat: 1
+Test "Imaginary part of: clog10 (-inf + inf i) == inf + 3/4 pi*log10(e) i":
+double: 1
+idouble: 1
+Test "Imaginary part of: clog10 (-inf - 0 i) == inf - pi*log10(e) i":
+double: 1
+float: 1
+idouble: 1
+ifloat: 1
+Test "Imaginary part of: clog10 (-inf - 1 i) == inf - pi*log10(e) i":
+double: 1
+float: 1
+idouble: 1
+ifloat: 1
+Test "Imaginary part of: clog10 (0 + inf i) == inf + pi/2*log10(e) i":
+double: 1
+float: 1
+idouble: 1
+ifloat: 1
+Test "Imaginary part of: clog10 (0 - inf i) == inf - pi/2*log10(e) i":
+double: 1
+float: 1
+idouble: 1
+ifloat: 1
+Test "Real part of: clog10 (0.75 + 1.25 i) == 0.163679467193165171449476605077428975 + 0.447486970040493067069984724340855636 i":
+double: 1
+float: 1
+idouble: 1
+ifloat: 1
+ildouble: 1
+ldouble: 1
+Test "Imaginary part of: clog10 (3 + inf i) == inf + pi/2*log10(e) i":
+double: 1
+float: 1
+idouble: 1
+ifloat: 1
+Test "Imaginary part of: clog10 (3 - inf i) == inf - pi/2*log10(e) i":
+double: 1
+float: 1
+idouble: 1
+ifloat: 1
+Test "Imaginary part of: clog10 (inf + inf i) == inf + pi/4*log10(e) i":
+double: 1
+float: 1
+idouble: 1
+ifloat: 1
+Test "Imaginary part of: clog10 (inf - inf i) == inf - pi/4*log10(e) i":
+double: 1
+float: 1
+idouble: 1
+ifloat: 1
+
+# cos
+Test "cos (M_PI_6l * 2.0) == 0.5":
+double: 1
+float: 1
+idouble: 1
+ifloat: 1
+Test "cos (M_PI_6l * 4.0) == -0.5":
+double: 2
+float: 1
+idouble: 2
+ifloat: 1
+ildouble: 1
+ldouble: 1
+Test "cos (pi/2) == 0":
+double: 1
+float: 1
+idouble: 1
+ifloat: 1
+ildouble: 1
+ldouble: 1
+
+# cosh
+Test "cosh (0.75) == 1.29468328467684468784170818539018176":
+ildouble: 1
+
+# cpow
+Test "Real part of: cpow (0.75 + 1.25 i, 0.0 + 1.0 i) == 0.331825439177608832276067945276730566 + 0.131338600281188544930936345230903032 i":
+float: 1
+ifloat: 1
+ildouble: 1
+ldouble: 1
+Test "Imaginary part of: cpow (0.75 + 1.25 i, 0.0 + 1.0 i) == 0.331825439177608832276067945276730566 + 0.131338600281188544930936345230903032 i":
+ildouble: 1
+ldouble: 1
+Test "Real part of: cpow (0.75 + 1.25 i, 0.75 + 1.25 i) == 0.117506293914473555420279832210420483 + 0.346552747708338676483025352060418001 i":
+float: 3
+ifloat: 3
+ildouble: 6
+ldouble: 6
+Test "Imaginary part of: cpow (0.75 + 1.25 i, 0.75 + 1.25 i) == 0.117506293914473555420279832210420483 + 0.346552747708338676483025352060418001 i":
+float: 1
+ifloat: 1
+ildouble: 1
+ldouble: 1
+Test "Real part of: cpow (0.75 + 1.25 i, 1.0 + 0.0 i) == 0.75 + 1.25 i":
+ildouble: 1
+ldouble: 1
+Test "Imaginary part of: cpow (0.75 + 1.25 i, 1.0 + 0.0 i) == 0.75 + 1.25 i":
+float: 1
+ifloat: 1
+Test "Real part of: cpow (0.75 + 1.25 i, 1.0 + 1.0 i) == 0.0846958290317209430433805274189191353 + 0.513285749182902449043287190519090481 i":
+double: 1
+float: 3
+idouble: 1
+ifloat: 3
+ildouble: 3
+ldouble: 3
+Test "Real part of: cpow (2 + 3 i, 4 + 0 i) == -119.0 - 120.0 i":
+double: 1
+float: 4
+idouble: 1
+ifloat: 4
+Test "Imaginary part of: cpow (2 + 3 i, 4 + 0 i) == -119.0 - 120.0 i":
+float: 1
+ifloat: 1
+ildouble: 2
+ldouble: 2
+Test "Imaginary part of: cpow (e + 0 i, 0 + 2 * M_PIl i) == 1.0 + 0.0 i":
+double: 2
+float: 3
+idouble: 2
+ifloat: 3
+ildouble: 1
+ldouble: 1
+
+# csin
+Test "Real part of: csin (0.75 + 1.25 i) == 1.28722291002649188575873510790565441 + 1.17210635989270256101081285116138863 i":
+float: 1
+ifloat: 1
+ildouble: 1
+ldouble: 1
+Test "Imaginary part of: csin (0.75 + 1.25 i) == 1.28722291002649188575873510790565441 + 1.17210635989270256101081285116138863 i":
+float: 1
+ifloat: 1
+
+# csinh
+Test "Real part of: csinh (-2 - 3 i) == 3.59056458998577995201256544779481679 - 0.530921086248519805267040090660676560 i":
+double: 1
+idouble: 1
+Test "Imaginary part of: csinh (-2 - 3 i) == 3.59056458998577995201256544779481679 - 0.530921086248519805267040090660676560 i":
+double: 1
+float: 1
+idouble: 1
+ifloat: 1
+ildouble: 2
+ldouble: 2
+Test "Real part of: csinh (0.75 + 1.25 i) == 0.259294854551162779153349830618433028 + 1.22863452409509552219214606515777594 i":
+double: 1
+float: 1
+idouble: 1
+ifloat: 1
+ildouble: 1
+ldouble: 1
+Test "Imaginary part of: csinh (0.75 + 1.25 i) == 0.259294854551162779153349830618433028 + 1.22863452409509552219214606515777594 i":
+float: 1
+ifloat: 1
+
+# ctan
+Test "Real part of: ctan (-2 - 3 i) == 0.376402564150424829275122113032269084e-2 - 1.00323862735360980144635859782192726 i":
+double: 1
+idouble: 1
+ildouble: 439
+ldouble: 439
+Test "Imaginary part of: ctan (-2 - 3 i) == 0.376402564150424829275122113032269084e-2 - 1.00323862735360980144635859782192726 i":
+float: 1
+ifloat: 1
+ildouble: 2
+ldouble: 2
+Test "Real part of: ctan (0.75 + 1.25 i) == 0.160807785916206426725166058173438663 + 0.975363285031235646193581759755216379 i":
+ildouble: 1
+ldouble: 1
+Test "Imaginary part of: ctan (0.75 + 1.25 i) == 0.160807785916206426725166058173438663 + 0.975363285031235646193581759755216379 i":
+double: 1
+float: 1
+idouble: 1
+ifloat: 1
+ildouble: 3
+ldouble: 3
+
+# ctanh
+Test "Real part of: ctanh (-2 - 3 i) == -0.965385879022133124278480269394560686 + 0.988437503832249372031403430350121098e-2 i":
+ildouble: 5
+ldouble: 5
+Test "Imaginary part of: ctanh (-2 - 3 i) == -0.965385879022133124278480269394560686 + 0.988437503832249372031403430350121098e-2 i":
+float: 1
+ifloat: 1
+ildouble: 25
+ldouble: 25
+Test "Imaginary part of: ctanh (0 + pi/4 i) == 0.0 + 1.0 i":
+float: 1
+ifloat: 1
+Test "Real part of: ctanh (0.75 + 1.25 i) == 1.37260757053378320258048606571226857 + 0.385795952609750664177596760720790220 i":
+double: 1
+float: 1
+idouble: 1
+ifloat: 1
+Test "Imaginary part of: ctanh (0.75 + 1.25 i) == 1.37260757053378320258048606571226857 + 0.385795952609750664177596760720790220 i":
+double: 1
+float: 1
+idouble: 1
+ifloat: 1
+ildouble: 1
+ldouble: 1
+
+# erf
+Test "erf (1.25) == 0.922900128256458230136523481197281140":
+double: 1
+idouble: 1
+
+# erfc
+Test "erfc (0.75) == 0.288844366346484868401062165408589223":
+float: 1
+ifloat: 1
+Test "erfc (1.25) == 0.0770998717435417698634765188027188596":
+ildouble: 1
+ldouble: 1
+Test "erfc (2.0) == 0.00467773498104726583793074363274707139":
+double: 1
+idouble: 1
+Test "erfc (4.125) == 0.542340079956506600531223408575531062e-8":
+double: 1
+idouble: 1
+ildouble: 1
+ldouble: 1
+
+# exp
+Test "exp (0.75) == 2.11700001661267466854536981983709561":
+ildouble: 1
+Test "exp (1000.0) == 0.197007111401704699388887935224332313e435":
+ildouble: 754
+Test "exp (50.0) == 5184705528587072464087.45332293348538":
+ildouble: 16
+
+# exp10
+Test "exp10 (-1) == 0.1":
+ildouble: 1
+ldouble: 1
+Test "exp10 (0.75) == 5.62341325190349080394951039776481231":
+ildouble: 2
+ldouble: 2
+Test "exp10 (3) == 1000":
+ildouble: 8
+ldouble: 8
+
+# expm1
+Test "expm1 (1) == M_El - 1.0":
+ildouble: 1
+
+# gamma
+Test "gamma (-0.5) == log(2*sqrt(pi))":
+double: 1
+idouble: 1
+ildouble: 1
+ldouble: 1
+
+# hypot
+Test "hypot (-0.7, -12.4) == 12.419742348374220601176836866763271":
+float: 1
+ifloat: 1
+Test "hypot (-0.7, 12.4) == 12.419742348374220601176836866763271":
+float: 1
+ifloat: 1
+Test "hypot (-12.4, -0.7) == 12.419742348374220601176836866763271":
+float: 1
+ifloat: 1
+Test "hypot (-12.4, 0.7) == 12.419742348374220601176836866763271":
+float: 1
+ifloat: 1
+Test "hypot (0.7, -12.4) == 12.419742348374220601176836866763271":
+float: 1
+ifloat: 1
+Test "hypot (0.7, 12.4) == 12.419742348374220601176836866763271":
+float: 1
+ifloat: 1
+Test "hypot (12.4, -0.7) == 12.419742348374220601176836866763271":
+float: 1
+ifloat: 1
+Test "hypot (12.4, 0.7) == 12.419742348374220601176836866763271":
+float: 1
+ifloat: 1
+
+# j0
+Test "j0 (-4.0) == -3.9714980986384737228659076845169804197562E-1":
+double: 1
+float: 2
+idouble: 1
+ifloat: 2
+ildouble: 1
+ldouble: 1
+Test "j0 (10.0) == -0.245935764451348335197760862485328754":
+double: 3
+float: 1
+idouble: 3
+ifloat: 1
+Test "j0 (2.0) == 0.223890779141235668051827454649948626":
+double: 1
+float: 1
+idouble: 1
+ifloat: 1
+Test "j0 (4.0) == -3.9714980986384737228659076845169804197562E-1":
+double: 1
+float: 2
+idouble: 1
+ifloat: 2
+ildouble: 1
+ldouble: 1
+Test "j0 (8.0) == 0.171650807137553906090869407851972001":
+float: 1
+ifloat: 1
+
+# j1
+Test "j1 (0.75) == 0.349243602174862192523281016426251335":
+double: 1
+idouble: 1
+Test "j1 (10.0) == 0.0434727461688614366697487680258592883":
+double: 1
+float: 1
+idouble: 1
+ifloat: 1
+ildouble: 1
+ldouble: 1
+Test "j1 (2.0) == 0.576724807756873387202448242269137087":
+double: 1
+idouble: 1
+Test "j1 (8.0) == 0.234636346853914624381276651590454612":
+double: 1
+float: 1
+idouble: 1
+ifloat: 1
+ildouble: 1
+ldouble: 1
+
+# jn
+Test "jn (0, -4.0) == -3.9714980986384737228659076845169804197562E-1":
+double: 1
+float: 2
+idouble: 1
+ifloat: 2
+ildouble: 1
+ldouble: 1
+Test "jn (0, 10.0) == -0.245935764451348335197760862485328754":
+double: 3
+float: 1
+idouble: 3
+ifloat: 1
+Test "jn (0, 2.0) == 0.223890779141235668051827454649948626":
+double: 1
+float: 1
+idouble: 1
+ifloat: 1
+Test "jn (0, 4.0) == -3.9714980986384737228659076845169804197562E-1":
+double: 1
+float: 2
+idouble: 1
+ifloat: 2
+ildouble: 1
+ldouble: 1
+Test "jn (0, 8.0) == 0.171650807137553906090869407851972001":
+float: 1
+ifloat: 1
+Test "jn (1, 0.75) == 0.349243602174862192523281016426251335":
+double: 1
+idouble: 1
+Test "jn (1, 10.0) == 0.0434727461688614366697487680258592883":
+double: 1
+float: 1
+idouble: 1
+ifloat: 1
+ildouble: 1
+ldouble: 1
+Test "jn (1, 2.0) == 0.576724807756873387202448242269137087":
+double: 1
+idouble: 1
+Test "jn (1, 8.0) == 0.234636346853914624381276651590454612":
+double: 1
+float: 1
+idouble: 1
+ifloat: 1
+ildouble: 1
+ldouble: 1
+Test "jn (10, -1.0) == 0.263061512368745320699785368779050294e-9":
+double: 1
+float: 1
+idouble: 1
+ifloat: 1
+ildouble: 1
+ldouble: 1
+Test "jn (10, 0.125) == 0.250543369809369890173993791865771547e-18":
+double: 1
+float: 1
+idouble: 1
+ifloat: 1
+Test "jn (10, 0.75) == 0.149621713117596814698712483621682835e-10":
+float: 1
+ifloat: 1
+ildouble: 2
+ldouble: 2
+Test "jn (10, 1.0) == 0.263061512368745320699785368779050294e-9":
+double: 1
+float: 1
+idouble: 1
+ifloat: 1
+ildouble: 1
+ldouble: 1
+Test "jn (10, 10.0) == 0.207486106633358857697278723518753428":
+double: 5
+float: 2
+idouble: 5
+ifloat: 2
+ildouble: 2
+ldouble: 2
+Test "jn (10, 2.0) == 0.251538628271673670963516093751820639e-6":
+double: 2
+idouble: 2
+ildouble: 1
+ldouble: 1
+Test "jn (3, -1.0) == -0.0195633539826684059189053216217515083":
+ildouble: 1
+ldouble: 1
+Test "jn (3, 0.75) == 0.848438342327410884392755236884386804e-2":
+double: 1
+float: 1
+idouble: 1
+ifloat: 1
+Test "jn (3, 1.0) == 0.0195633539826684059189053216217515083":
+ildouble: 1
+ldouble: 1
+Test "jn (3, 10.0) == 0.0583793793051868123429354784103409563":
+double: 5
+float: 2
+idouble: 5
+ifloat: 2
+ildouble: 1
+ldouble: 1
+Test "jn (3, 2.0) == 0.128943249474402051098793332969239835":
+double: 1
+idouble: 1
+ildouble: 1
+ldouble: 1
+
+# lgamma
+Test "lgamma (-0.5) == log(2*sqrt(pi))":
+double: 1
+idouble: 1
+ildouble: 1
+ldouble: 1
+Test "lgamma (0.7) == 0.260867246531666514385732417016759578":
+double: 1
+float: 1
+idouble: 1
+ifloat: 1
+Test "lgamma (1.2) == -0.853740900033158497197028392998854470e-1":
+double: 1
+float: 2
+idouble: 1
+ifloat: 2
+ildouble: 1
+ldouble: 1
+
+# log
+Test "log (e) == 1":
+float: 1
+ifloat: 1
+
+# log10
+Test "log10 (0.75) == -0.124938736608299953132449886193870744":
+ildouble: 1
+ldouble: 1
+Test "log10 (e) == log10(e)":
+float: 1
+ifloat: 1
+ildouble: 1
+ldouble: 1
+
+# sincos
+Test "sincos (M_PI_6l*2.0, &sin_res, &cos_res) puts 0.5 in cos_res":
+double: 1
+float: 1
+idouble: 1
+ifloat: 1
+Test "sincos (M_PI_6l*2.0, &sin_res, &cos_res) puts 0.86602540378443864676372317075293616 in sin_res":
+double: 1
+float: 1
+idouble: 1
+ifloat: 1
+ildouble: 1
+ldouble: 1
+Test "sincos (pi/2, &sin_res, &cos_res) puts 0 in cos_res":
+double: 1
+float: 1
+idouble: 1
+ifloat: 1
+ildouble: 1
+ldouble: 1
+
+# sin
+Test "sin (0.80190127184058835) == 0.71867942238767868":
+double: 1
+idouble: 1
+
+# sinh
+Test "sinh (0.75) == 0.822316731935829980703661634446913849":
+double: 1
+ildouble: 1
+
+# tan
+Test "tan (pi/4) == 1":
+double: 1
+idouble: 1
+
+# tgamma
+Test "tgamma (-0.5) == -2 sqrt (pi)":
+double: 2
+float: 1
+idouble: 2
+ifloat: 1
+ildouble: 1
+ldouble: 1
+Test "tgamma (0.5) == sqrt (pi)":
+float: 1
+ifloat: 1
+Test "tgamma (0.7) == 1.29805533264755778568117117915281162":
+double: 1
+float: 1
+idouble: 1
+ifloat: 1
+Test "tgamma (4) == 6":
+ildouble: 1
+ldouble: 1
+
+# y0
+Test "y0 (0.125) == -1.38968062514384052915582277745018693":
+ildouble: 1
+ldouble: 1
+Test "y0 (0.75) == -0.137172769385772397522814379396581855":
+double: 1
+float: 1
+idouble: 1
+ifloat: 1
+Test "y0 (1.0) == 0.0882569642156769579829267660235151628":
+double: 2
+float: 1
+idouble: 2
+ifloat: 1
+ildouble: 1
+ldouble: 1
+Test "y0 (1.5) == 0.382448923797758843955068554978089862":
+double: 1
+float: 1
+idouble: 1
+ifloat: 1
+Test "y0 (10.0) == 0.0556711672835993914244598774101900481":
+double: 1
+float: 1
+idouble: 1
+ifloat: 1
+ildouble: 1
+ldouble: 1
+Test "y0 (8.0) == 0.223521489387566220527323400498620359":
+double: 1
+float: 1
+idouble: 1
+ifloat: 1
+ildouble: 1
+ldouble: 1
+
+# y1
+Test "y1 (0.125) == -5.19993611253477499595928744876579921":
+ildouble: 1
+ldouble: 1
+Test "y1 (1.0) == -0.781212821300288716547150000047964821":
+double: 1
+idouble: 1
+Test "y1 (10.0) == 0.249015424206953883923283474663222803":
+double: 2
+float: 2
+idouble: 2
+ifloat: 2
+Test "y1 (2.0) == -0.107032431540937546888370772277476637":
+double: 1
+float: 2
+idouble: 1
+ifloat: 2
+ildouble: 1
+ldouble: 1
+Test "y1 (8.0) == -0.158060461731247494255555266187483550":
+double: 1
+float: 2
+idouble: 1
+ifloat: 2
+ildouble: 1
+ldouble: 1
+
+# yn
+Test "yn (0, 0.125) == -1.38968062514384052915582277745018693":
+ildouble: 1
+ldouble: 1
+Test "yn (0, 0.75) == -0.137172769385772397522814379396581855":
+double: 1
+float: 1
+idouble: 1
+ifloat: 1
+Test "yn (0, 1.0) == 0.0882569642156769579829267660235151628":
+double: 2
+float: 1
+idouble: 2
+ifloat: 1
+ildouble: 1
+ldouble: 1
+Test "yn (0, 1.5) == 0.382448923797758843955068554978089862":
+double: 1
+float: 1
+idouble: 1
+ifloat: 1
+Test "yn (0, 10.0) == 0.0556711672835993914244598774101900481":
+double: 1
+float: 1
+idouble: 1
+ifloat: 1
+ildouble: 1
+ldouble: 1
+Test "yn (0, 8.0) == 0.223521489387566220527323400498620359":
+double: 1
+float: 1
+idouble: 1
+ifloat: 1
+ildouble: 1
+ldouble: 1
+Test "yn (1, 0.125) == -5.19993611253477499595928744876579921":
+ildouble: 1
+ldouble: 1
+Test "yn (1, 1.0) == -0.781212821300288716547150000047964821":
+double: 1
+idouble: 1
+Test "yn (1, 10.0) == 0.249015424206953883923283474663222803":
+double: 2
+float: 2
+idouble: 2
+ifloat: 2
+Test "yn (1, 2.0) == -0.107032431540937546888370772277476637":
+double: 1
+float: 2
+idouble: 1
+ifloat: 2
+ildouble: 1
+ldouble: 1
+Test "yn (1, 8.0) == -0.158060461731247494255555266187483550":
+double: 1
+float: 2
+idouble: 1
+ifloat: 2
+ildouble: 1
+ldouble: 1
+Test "yn (10, 0.125) == -127057845771019398.252538486899753195":
+double: 1
+float: 1
+idouble: 1
+ifloat: 1
+ildouble: 2
+ldouble: 2
+Test "yn (10, 0.75) == -2133501638.90573424452445412893839236":
+float: 1
+ifloat: 1
+ildouble: 4
+ldouble: 4
+Test "yn (10, 1.0) == -121618014.278689189288130426667971145":
+double: 1
+float: 2
+idouble: 1
+ifloat: 2
+Test "yn (10, 10.0) == -0.359814152183402722051986577343560609":
+double: 1
+float: 3
+idouble: 1
+ifloat: 3
+Test "yn (10, 2.0) == -129184.542208039282635913145923304214":
+double: 2
+float: 3
+idouble: 2
+ifloat: 3
+Test "yn (3, 0.125) == -2612.69757350066712600220955744091741":
+ildouble: 1
+ldouble: 1
+Test "yn (3, 0.75) == -12.9877176234475433186319774484809207":
+double: 1
+float: 1
+idouble: 1
+ifloat: 1
+ildouble: 2
+ldouble: 2
+Test "yn (3, 10.0) == -0.251362657183837329779204747654240998":
+double: 1
+float: 1
+idouble: 1
+ifloat: 1
+Test "yn (3, 2.0) == -1.12778377684042778608158395773179238":
+double: 1
+float: 1
+idouble: 1
+ifloat: 1
+
+# Maximal error of functions:
+Function: "acos":
+ildouble: 622
+ldouble: 622
+
+Function: "asin":
+ildouble: 1
+ldouble: 1
+
+Function: "atanh":
+ildouble: 2
+ldouble: 1
+
+Function: Imaginary part of "cacos":
+float: 1
+ifloat: 1
+ildouble: 2
+ldouble: 2
+
+Function: Real part of "cacosh":
+double: 1
+float: 9
+idouble: 1
+ifloat: 9
+ildouble: 6
+ldouble: 6
+
+Function: Imaginary part of "cacosh":
+double: 1
+float: 4
+idouble: 1
+ifloat: 4
+ildouble: 1
+ldouble: 1
+
+Function: Real part of "casin":
+double: 1
+float: 1
+idouble: 1
+ifloat: 1
+ildouble: 2
+ldouble: 2
+
+Function: Imaginary part of "casin":
+float: 1
+ifloat: 1
+ildouble: 2
+ldouble: 2
+
+Function: Real part of "casinh":
+double: 5
+float: 1
+idouble: 5
+ifloat: 1
+ildouble: 5
+ldouble: 5
+
+Function: Imaginary part of "casinh":
+double: 3
+float: 6
+idouble: 3
+ifloat: 6
+ildouble: 5
+ldouble: 5
+
+Function: Imaginary part of "catan":
+double: 1
+float: 1
+idouble: 1
+ifloat: 1
+
+Function: Real part of "catanh":
+double: 2
+float: 1
+idouble: 2
+ifloat: 1
+ildouble: 1
+ldouble: 1
+
+Function: "cbrt":
+ildouble: 1
+ldouble: 1
+
+Function: Real part of "ccos":
+double: 1
+idouble: 1
+ildouble: 1
+ldouble: 1
+
+Function: Imaginary part of "ccos":
+float: 1
+ifloat: 1
+ildouble: 1
+ldouble: 1
+
+Function: Real part of "ccosh":
+double: 1
+float: 1
+idouble: 1
+ifloat: 1
+
+Function: Imaginary part of "ccosh":
+double: 1
+float: 1
+idouble: 1
+ifloat: 1
+ildouble: 1
+ldouble: 1
+
+Function: Real part of "cexp":
+ildouble: 1
+ldouble: 1
+
+Function: Imaginary part of "cexp":
+ildouble: 1
+ldouble: 1
+
+Function: Real part of "clog":
+float: 1
+ifloat: 1
+ildouble: 1
+ldouble: 1
+
+Function: Real part of "clog10":
+double: 1
+float: 1
+idouble: 1
+ifloat: 1
+ildouble: 1
+ldouble: 1
+
+Function: Imaginary part of "clog10":
+double: 1
+float: 1
+idouble: 1
+ifloat: 1
+ildouble: 1
+ldouble: 1
+
+Function: "cos":
+double: 2
+float: 1
+idouble: 2
+ifloat: 1
+ildouble: 1
+ldouble: 1
+
+Function: "cosh":
+ildouble: 1
+
+Function: Real part of "cpow":
+double: 1
+float: 4
+idouble: 1
+ifloat: 4
+ildouble: 763
+ldouble: 763
+
+Function: Imaginary part of "cpow":
+double: 2
+float: 3
+idouble: 2
+ifloat: 3
+ildouble: 2
+ldouble: 2
+
+Function: Real part of "csin":
+float: 1
+ifloat: 1
+ildouble: 1
+ldouble: 1
+
+Function: Imaginary part of "csin":
+float: 1
+ifloat: 1
+
+Function: Real part of "csinh":
+double: 1
+float: 1
+idouble: 1
+ifloat: 1
+ildouble: 1
+ldouble: 1
+
+Function: Imaginary part of "csinh":
+double: 1
+float: 1
+idouble: 1
+ifloat: 1
+ildouble: 2
+ldouble: 2
+
+Function: Real part of "ctan":
+double: 1
+idouble: 1
+ildouble: 439
+ldouble: 439
+
+Function: Imaginary part of "ctan":
+double: 1
+float: 1
+idouble: 1
+ifloat: 1
+ildouble: 3
+ldouble: 3
+
+Function: Real part of "ctanh":
+double: 1
+float: 1
+idouble: 1
+ifloat: 1
+ildouble: 5
+ldouble: 5
+
+Function: Imaginary part of "ctanh":
+double: 1
+float: 1
+idouble: 1
+ifloat: 1
+ildouble: 25
+ldouble: 25
+
+Function: "erf":
+double: 1
+idouble: 1
+
+Function: "erfc":
+double: 1
+float: 1
+idouble: 1
+ifloat: 1
+ildouble: 1
+ldouble: 1
+
+Function: "exp":
+ildouble: 754
+
+Function: "exp10":
+ildouble: 8
+ldouble: 8
+
+Function: "expm1":
+ildouble: 1
+
+Function: "gamma":
+double: 1
+idouble: 1
+ildouble: 1
+ldouble: 1
+
+Function: "hypot":
+float: 1
+ifloat: 1
+
+Function: "j0":
+double: 3
+float: 2
+idouble: 3
+ifloat: 2
+ildouble: 1
+ldouble: 1
+
+Function: "j1":
+double: 1
+float: 1
+idouble: 1
+ifloat: 1
+ildouble: 1
+ldouble: 1
+
+Function: "jn":
+double: 5
+float: 2
+idouble: 5
+ifloat: 2
+ildouble: 2
+ldouble: 2
+
+Function: "lgamma":
+double: 1
+float: 2
+idouble: 1
+ifloat: 2
+ildouble: 1
+ldouble: 1
+
+Function: "log":
+float: 1
+ifloat: 1
+
+Function: "log10":
+float: 1
+ifloat: 1
+ildouble: 1
+ldouble: 1
+
+Function: "sincos":
+double: 1
+float: 1
+idouble: 1
+ifloat: 1
+ildouble: 1
+ldouble: 1
+
+Function: "sin":
+double: 1
+idouble: 1
+
+Function: "sinh":
+double: 1
+ildouble: 1
+
+Function: "tan":
+double: 1
+idouble: 1
+
+Function: "tgamma":
+double: 2
+float: 1
+idouble: 2
+ifloat: 1
+ildouble: 1
+ldouble: 1
+
+Function: "y0":
+double: 2
+float: 1
+idouble: 2
+ifloat: 1
+ildouble: 1
+ldouble: 1
+
+Function: "y1":
+double: 2
+float: 2
+idouble: 2
+ifloat: 2
+ildouble: 1
+ldouble: 1
+
+Function: "yn":
+double: 2
+float: 3
+idouble: 2
+ifloat: 3
+ildouble: 4
+ldouble: 4
+
+# end of automatic generation
diff --git a/ap/build/uClibc/test/math/libm-test-ulps-ia64 b/ap/build/uClibc/test/math/libm-test-ulps-ia64
new file mode 100644
index 0000000..c5a2a08
--- /dev/null
+++ b/ap/build/uClibc/test/math/libm-test-ulps-ia64
@@ -0,0 +1,1146 @@
+# Begin of automatic generation
+
+# cacos
+Test "Imaginary part of: cacos (0.75 + 1.25 i) == 1.11752014915610270578240049553777969 - 1.13239363160530819522266333696834467 i":
+float: 1
+ifloat: 1
+ildouble: 2
+ldouble: 2
+
+# cacosh
+Test "Real part of: cacosh (-2 - 3 i) == 1.9833870299165354323470769028940395 - 2.1414491111159960199416055713254211 i":
+double: 1
+float: 7
+idouble: 1
+ifloat: 7
+ildouble: 7
+ldouble: 7
+Test "Imaginary part of: cacosh (-2 - 3 i) == 1.9833870299165354323470769028940395 - 2.1414491111159960199416055713254211 i":
+double: 1
+idouble: 1
+ildouble: 1
+ldouble: 1
+
+# casin
+Test "Real part of: casin (0.75 + 1.25 i) == 0.453276177638793913448921196101971749 + 1.13239363160530819522266333696834467 i":
+double: 1
+float: 1
+idouble: 1
+ifloat: 1
+ildouble: 2
+ldouble: 2
+Test "Imaginary part of: casin (0.75 + 1.25 i) == 0.453276177638793913448921196101971749 + 1.13239363160530819522266333696834467 i":
+float: 1
+ifloat: 1
+ildouble: 2
+ldouble: 2
+
+# casinh
+Test "Real part of: casinh (-2 - 3 i) == -1.9686379257930962917886650952454982 - 0.96465850440760279204541105949953237 i":
+double: 5
+float: 1
+idouble: 5
+ifloat: 1
+ildouble: 5
+ldouble: 5
+Test "Imaginary part of: casinh (-2 - 3 i) == -1.9686379257930962917886650952454982 - 0.96465850440760279204541105949953237 i":
+double: 3
+float: 6
+idouble: 3
+ifloat: 6
+ildouble: 5
+ldouble: 5
+Test "Real part of: casinh (0.75 + 1.25 i) == 1.03171853444778027336364058631006594 + 0.911738290968487636358489564316731207 i":
+float: 1
+ifloat: 1
+ildouble: 1
+ldouble: 1
+Test "Imaginary part of: casinh (0.75 + 1.25 i) == 1.03171853444778027336364058631006594 + 0.911738290968487636358489564316731207 i":
+double: 1
+float: 1
+idouble: 1
+ifloat: 1
+
+# catan
+Test "Imaginary part of: catan (-2 - 3 i) == -1.4099210495965755225306193844604208 - 0.22907268296853876629588180294200276 i":
+double: 1
+float: 1
+idouble: 1
+ifloat: 1
+
+# catanh
+Test "Real part of: catanh (-2 - 3 i) == -0.14694666622552975204743278515471595 - 1.3389725222944935611241935759091443 i":
+double: 4
+idouble: 4
+ildouble: 1
+ldouble: 1
+Test "Real part of: catanh (0.75 + 1.25 i) == 0.261492138795671927078652057366532140 + 0.996825126463918666098902241310446708 i":
+double: 1
+idouble: 1
+
+# ccos
+Test "Imaginary part of: ccos (-2 - 3 i) == -4.18962569096880723013255501961597373 - 9.10922789375533659797919726277886212 i":
+float: 1
+ifloat: 1
+ildouble: 1
+ldouble: 1
+Test "Real part of: ccos (0.75 + 1.25 i) == 1.38173873063425888530729933139078645 - 1.09193013555397466170919531722024128 i":
+double: 1
+idouble: 1
+ildouble: 1
+ldouble: 1
+Test "Imaginary part of: ccos (0.75 + 1.25 i) == 1.38173873063425888530729933139078645 - 1.09193013555397466170919531722024128 i":
+ildouble: 1
+ldouble: 1
+
+# ccosh
+Test "Imaginary part of: ccosh (-2 - 3 i) == -3.72454550491532256547397070325597253 + 0.511822569987384608834463849801875634 i":
+double: 1
+float: 1
+idouble: 1
+ifloat: 1
+ildouble: 1
+ldouble: 1
+Test "Real part of: ccosh (0.75 + 1.25 i) == 0.408242591877968807788852146397499084 + 0.780365930845853240391326216300863152 i":
+double: 1
+float: 1
+idouble: 1
+ifloat: 1
+Test "Imaginary part of: ccosh (0.75 + 1.25 i) == 0.408242591877968807788852146397499084 + 0.780365930845853240391326216300863152 i":
+float: 1
+ifloat: 1
+
+# cexp
+Test "Imaginary part of: cexp (-2.0 - 3.0 i) == -0.13398091492954261346140525546115575 - 0.019098516261135196432576240858800925 i":
+float: 1
+ifloat: 1
+Test "Real part of: cexp (0.75 + 1.25 i) == 0.667537446429131586942201977015932112 + 2.00900045494094876258347228145863909 i":
+float: 1
+ifloat: 1
+Test "Imaginary part of: cexp (0.75 + 1.25 i) == 0.667537446429131586942201977015932112 + 2.00900045494094876258347228145863909 i":
+ildouble: 1
+ldouble: 1
+
+# clog
+Test "Real part of: clog (0.75 + 1.25 i) == 0.376885901188190075998919126749298416 + 1.03037682652431246378774332703115153 i":
+float: 1
+ifloat: 1
+ildouble: 1
+ldouble: 1
+
+# clog10
+Test "Imaginary part of: clog10 (-0 + inf i) == inf + pi/2*log10(e) i":
+double: 1
+float: 1
+idouble: 1
+ifloat: 1
+Test "Imaginary part of: clog10 (-0 - inf i) == inf - pi/2*log10(e) i":
+double: 1
+float: 1
+idouble: 1
+ifloat: 1
+Test "Imaginary part of: clog10 (-2 - 3 i) == 0.556971676153418384603252578971164214 - 0.937554462986374708541507952140189646 i":
+double: 1
+idouble: 1
+ildouble: 1
+ldouble: 1
+Test "Imaginary part of: clog10 (-3 + inf i) == inf + pi/2*log10(e) i":
+double: 1
+float: 1
+idouble: 1
+ifloat: 1
+Test "Imaginary part of: clog10 (-3 - inf i) == inf - pi/2*log10(e) i":
+double: 1
+float: 1
+idouble: 1
+ifloat: 1
+Test "Imaginary part of: clog10 (-inf + 0 i) == inf + pi*log10(e) i":
+double: 1
+float: 1
+idouble: 1
+ifloat: 1
+Test "Imaginary part of: clog10 (-inf + 1 i) == inf + pi*log10(e) i":
+double: 1
+float: 1
+idouble: 1
+ifloat: 1
+Test "Imaginary part of: clog10 (-inf + inf i) == inf + 3/4 pi*log10(e) i":
+double: 1
+idouble: 1
+Test "Imaginary part of: clog10 (-inf - 0 i) == inf - pi*log10(e) i":
+double: 1
+float: 1
+idouble: 1
+ifloat: 1
+Test "Imaginary part of: clog10 (-inf - 1 i) == inf - pi*log10(e) i":
+double: 1
+float: 1
+idouble: 1
+ifloat: 1
+Test "Imaginary part of: clog10 (0 + inf i) == inf + pi/2*log10(e) i":
+double: 1
+float: 1
+idouble: 1
+ifloat: 1
+Test "Imaginary part of: clog10 (0 - inf i) == inf - pi/2*log10(e) i":
+double: 1
+float: 1
+idouble: 1
+ifloat: 1
+Test "Real part of: clog10 (0.75 + 1.25 i) == 0.163679467193165171449476605077428975 + 0.447486970040493067069984724340855636 i":
+double: 1
+float: 1
+idouble: 1
+ifloat: 1
+ildouble: 1
+ldouble: 1
+Test "Imaginary part of: clog10 (3 + inf i) == inf + pi/2*log10(e) i":
+double: 1
+float: 1
+idouble: 1
+ifloat: 1
+Test "Imaginary part of: clog10 (3 - inf i) == inf - pi/2*log10(e) i":
+double: 1
+float: 1
+idouble: 1
+ifloat: 1
+Test "Imaginary part of: clog10 (inf + inf i) == inf + pi/4*log10(e) i":
+double: 1
+float: 1
+idouble: 1
+ifloat: 1
+Test "Imaginary part of: clog10 (inf - inf i) == inf - pi/4*log10(e) i":
+double: 1
+float: 1
+idouble: 1
+ifloat: 1
+
+# cos
+Test "cos (0.80190127184058835) == 0.69534156199418473":
+double: 1
+idouble: 1
+Test "cos (M_PI_6l * 2.0) == 0.5":
+double: 1
+float: 1
+idouble: 1
+ifloat: 1
+Test "cos (M_PI_6l * 4.0) == -0.5":
+double: 2
+float: 1
+idouble: 2
+ifloat: 1
+ildouble: 1
+ldouble: 1
+Test "cos (pi/2) == 0":
+double: 1
+float: 1
+idouble: 1
+ifloat: 1
+ildouble: 1
+ldouble: 1
+
+# cpow
+Test "Real part of: cpow (0.75 + 1.25 i, 0.0 + 1.0 i) == 0.331825439177608832276067945276730566 + 0.131338600281188544930936345230903032 i":
+float: 1
+ifloat: 1
+Test "Imaginary part of: cpow (0.75 + 1.25 i, 0.0 + 1.0 i) == 0.331825439177608832276067945276730566 + 0.131338600281188544930936345230903032 i":
+float: 1
+ifloat: 1
+ildouble: 1
+ldouble: 1
+Test "Real part of: cpow (0.75 + 1.25 i, 0.75 + 1.25 i) == 0.117506293914473555420279832210420483 + 0.346552747708338676483025352060418001 i":
+double: 1
+float: 4
+idouble: 1
+ifloat: 4
+ildouble: 6
+ldouble: 6
+Test "Imaginary part of: cpow (0.75 + 1.25 i, 0.75 + 1.25 i) == 0.117506293914473555420279832210420483 + 0.346552747708338676483025352060418001 i":
+ildouble: 1
+ldouble: 1
+Test "Real part of: cpow (0.75 + 1.25 i, 1.0 + 0.0 i) == 0.75 + 1.25 i":
+ildouble: 1
+ldouble: 1
+Test "Real part of: cpow (0.75 + 1.25 i, 1.0 + 1.0 i) == 0.0846958290317209430433805274189191353 + 0.513285749182902449043287190519090481 i":
+double: 2
+float: 3
+idouble: 2
+ifloat: 3
+ildouble: 3
+ldouble: 3
+Test "Real part of: cpow (2 + 0 i, 10 + 0 i) == 1024.0 + 0.0 i":
+ildouble: 1
+ldouble: 1
+Test "Real part of: cpow (2 + 3 i, 4 + 0 i) == -119.0 - 120.0 i":
+double: 1
+float: 5
+idouble: 1
+ifloat: 5
+ildouble: 1
+ldouble: 1
+Test "Imaginary part of: cpow (2 + 3 i, 4 + 0 i) == -119.0 - 120.0 i":
+float: 2
+ifloat: 2
+ildouble: 4
+ldouble: 4
+Test "Imaginary part of: cpow (e + 0 i, 0 + 2 * M_PIl i) == 1.0 + 0.0 i":
+double: 2
+float: 3
+idouble: 2
+ifloat: 3
+ildouble: 1
+ldouble: 1
+
+# csin
+Test "Real part of: csin (0.75 + 1.25 i) == 1.28722291002649188575873510790565441 + 1.17210635989270256101081285116138863 i":
+float: 1
+ifloat: 1
+ildouble: 1
+ldouble: 1
+Test "Imaginary part of: csin (0.75 + 1.25 i) == 1.28722291002649188575873510790565441 + 1.17210635989270256101081285116138863 i":
+float: 1
+ifloat: 1
+
+# csinh
+Test "Real part of: csinh (-2 - 3 i) == 3.59056458998577995201256544779481679 - 0.530921086248519805267040090660676560 i":
+double: 1
+idouble: 1
+Test "Imaginary part of: csinh (-2 - 3 i) == 3.59056458998577995201256544779481679 - 0.530921086248519805267040090660676560 i":
+double: 1
+float: 1
+idouble: 1
+ifloat: 1
+ildouble: 2
+ldouble: 2
+Test "Real part of: csinh (0.75 + 1.25 i) == 0.259294854551162779153349830618433028 + 1.22863452409509552219214606515777594 i":
+float: 1
+ifloat: 1
+ildouble: 1
+ldouble: 1
+Test "Imaginary part of: csinh (0.75 + 1.25 i) == 0.259294854551162779153349830618433028 + 1.22863452409509552219214606515777594 i":
+float: 1
+ifloat: 1
+
+# csqrt
+Test "Real part of: csqrt (-2 + 3 i) == 0.89597747612983812471573375529004348 + 1.6741492280355400404480393008490519 i":
+float: 1
+ifloat: 1
+Test "Real part of: csqrt (-2 - 3 i) == 0.89597747612983812471573375529004348 - 1.6741492280355400404480393008490519 i":
+float: 1
+ifloat: 1
+
+# ctan
+Test "Real part of: ctan (-2 - 3 i) == 0.376402564150424829275122113032269084e-2 - 1.00323862735360980144635859782192726 i":
+double: 1
+idouble: 1
+ildouble: 2
+ldouble: 2
+Test "Imaginary part of: ctan (-2 - 3 i) == 0.376402564150424829275122113032269084e-2 - 1.00323862735360980144635859782192726 i":
+float: 1
+ifloat: 1
+ildouble: 1
+ldouble: 1
+Test "Real part of: ctan (0.75 + 1.25 i) == 0.160807785916206426725166058173438663 + 0.975363285031235646193581759755216379 i":
+ildouble: 1
+ldouble: 1
+Test "Imaginary part of: ctan (0.75 + 1.25 i) == 0.160807785916206426725166058173438663 + 0.975363285031235646193581759755216379 i":
+double: 1
+float: 1
+idouble: 1
+ifloat: 1
+
+# ctanh
+Test "Real part of: ctanh (-2 - 3 i) == -0.965385879022133124278480269394560686 + 0.988437503832249372031403430350121098e-2 i":
+ildouble: 1
+ldouble: 1
+Test "Imaginary part of: ctanh (-2 - 3 i) == -0.965385879022133124278480269394560686 + 0.988437503832249372031403430350121098e-2 i":
+float: 1
+ifloat: 1
+ildouble: 24
+ldouble: 24
+Test "Imaginary part of: ctanh (0 + pi/4 i) == 0.0 + 1.0 i":
+float: 1
+ifloat: 1
+Test "Real part of: ctanh (0.75 + 1.25 i) == 1.37260757053378320258048606571226857 + 0.385795952609750664177596760720790220 i":
+double: 1
+idouble: 1
+Test "Imaginary part of: ctanh (0.75 + 1.25 i) == 1.37260757053378320258048606571226857 + 0.385795952609750664177596760720790220 i":
+double: 1
+idouble: 1
+ildouble: 1
+ldouble: 1
+
+# erf
+Test "erf (1.25) == 0.922900128256458230136523481197281140":
+double: 1
+idouble: 1
+
+# erfc
+Test "erfc (0.75) == 0.288844366346484868401062165408589223":
+float: 1
+ifloat: 1
+Test "erfc (1.25) == 0.0770998717435417698634765188027188596":
+ildouble: 1
+ldouble: 1
+Test "erfc (2.0) == 0.00467773498104726583793074363274707139":
+double: 1
+idouble: 1
+Test "erfc (4.125) == 0.542340079956506600531223408575531062e-8":
+double: 1
+idouble: 1
+ildouble: 1
+ldouble: 1
+
+# exp10
+Test "exp10 (-1) == 0.1":
+double: 2
+float: 1
+idouble: 2
+ifloat: 1
+Test "exp10 (0.75) == 5.62341325190349080394951039776481231":
+double: 1
+float: 1
+idouble: 1
+ifloat: 1
+ildouble: 1
+ldouble: 1
+Test "exp10 (3) == 1000":
+double: 6
+float: 2
+idouble: 6
+ifloat: 2
+ildouble: 3
+ldouble: 3
+
+# expm1
+Test "expm1 (1) == M_El - 1.0":
+ildouble: 1
+ldouble: 1
+
+# gamma
+Test "gamma (-0.5) == log(2*sqrt(pi))":
+ildouble: 1
+ldouble: 1
+
+# hypot
+Test "hypot (-0.7, -12.4) == 12.419742348374220601176836866763271":
+float: 1
+ifloat: 1
+Test "hypot (-0.7, 12.4) == 12.419742348374220601176836866763271":
+float: 1
+ifloat: 1
+Test "hypot (-12.4, -0.7) == 12.419742348374220601176836866763271":
+float: 1
+ifloat: 1
+Test "hypot (-12.4, 0.7) == 12.419742348374220601176836866763271":
+float: 1
+ifloat: 1
+Test "hypot (0.7, -12.4) == 12.419742348374220601176836866763271":
+float: 1
+ifloat: 1
+Test "hypot (0.7, 12.4) == 12.419742348374220601176836866763271":
+float: 1
+ifloat: 1
+Test "hypot (12.4, -0.7) == 12.419742348374220601176836866763271":
+float: 1
+ifloat: 1
+Test "hypot (12.4, 0.7) == 12.419742348374220601176836866763271":
+float: 1
+ifloat: 1
+
+# j0
+Test "j0 (-4.0) == -3.9714980986384737228659076845169804197562E-1":
+double: 1
+float: 2
+idouble: 1
+ifloat: 2
+ildouble: 2
+ldouble: 2
+Test "j0 (10.0) == -0.245935764451348335197760862485328754":
+double: 3
+float: 1
+idouble: 3
+ifloat: 1
+ildouble: 1
+ldouble: 1
+Test "j0 (2.0) == 0.223890779141235668051827454649948626":
+float: 2
+ifloat: 2
+Test "j0 (4.0) == -3.9714980986384737228659076845169804197562E-1":
+double: 1
+float: 2
+idouble: 1
+ifloat: 2
+ildouble: 2
+ldouble: 2
+Test "j0 (8.0) == 0.171650807137553906090869407851972001":
+float: 1
+ifloat: 1
+
+# j1
+Test "j1 (10.0) == 0.0434727461688614366697487680258592883":
+float: 2
+ifloat: 2
+ildouble: 1
+ldouble: 1
+Test "j1 (2.0) == 0.576724807756873387202448242269137087":
+double: 1
+idouble: 1
+Test "j1 (8.0) == 0.234636346853914624381276651590454612":
+double: 1
+idouble: 1
+
+# jn
+Test "jn (0, -4.0) == -3.9714980986384737228659076845169804197562E-1":
+double: 1
+float: 2
+idouble: 1
+ifloat: 2
+ildouble: 2
+ldouble: 2
+Test "jn (0, 10.0) == -0.245935764451348335197760862485328754":
+double: 3
+float: 1
+idouble: 3
+ifloat: 1
+ildouble: 1
+ldouble: 1
+Test "jn (0, 2.0) == 0.223890779141235668051827454649948626":
+float: 2
+ifloat: 2
+Test "jn (0, 4.0) == -3.9714980986384737228659076845169804197562E-1":
+double: 1
+float: 2
+idouble: 1
+ifloat: 2
+ildouble: 2
+ldouble: 2
+Test "jn (0, 8.0) == 0.171650807137553906090869407851972001":
+float: 1
+ifloat: 1
+Test "jn (1, 10.0) == 0.0434727461688614366697487680258592883":
+float: 2
+ifloat: 2
+ildouble: 1
+ldouble: 1
+Test "jn (1, 2.0) == 0.576724807756873387202448242269137087":
+double: 1
+idouble: 1
+Test "jn (1, 8.0) == 0.234636346853914624381276651590454612":
+double: 1
+idouble: 1
+Test "jn (10, -1.0) == 0.263061512368745320699785368779050294e-9":
+ildouble: 1
+ldouble: 1
+Test "jn (10, 0.125) == 0.250543369809369890173993791865771547e-18":
+double: 1
+float: 1
+idouble: 1
+ifloat: 1
+Test "jn (10, 0.75) == 0.149621713117596814698712483621682835e-10":
+double: 1
+float: 1
+idouble: 1
+ifloat: 1
+ildouble: 2
+ldouble: 2
+Test "jn (10, 1.0) == 0.263061512368745320699785368779050294e-9":
+ildouble: 1
+ldouble: 1
+Test "jn (10, 10.0) == 0.207486106633358857697278723518753428":
+float: 1
+ifloat: 1
+ildouble: 2
+ldouble: 2
+Test "jn (10, 2.0) == 0.251538628271673670963516093751820639e-6":
+float: 4
+ifloat: 4
+ildouble: 1
+ldouble: 1
+Test "jn (3, -1.0) == -0.0195633539826684059189053216217515083":
+ildouble: 1
+ldouble: 1
+Test "jn (3, 0.125) == 0.406503832554912875023029337653442868e-4":
+double: 1
+float: 1
+idouble: 1
+ifloat: 1
+Test "jn (3, 0.75) == 0.848438342327410884392755236884386804e-2":
+double: 1
+idouble: 1
+Test "jn (3, 1.0) == 0.0195633539826684059189053216217515083":
+ildouble: 1
+ldouble: 1
+Test "jn (3, 10.0) == 0.0583793793051868123429354784103409563":
+double: 3
+float: 2
+idouble: 3
+ifloat: 2
+ildouble: 1
+ldouble: 1
+Test "jn (3, 2.0) == 0.128943249474402051098793332969239835":
+double: 1
+float: 2
+idouble: 1
+ifloat: 2
+ildouble: 1
+ldouble: 1
+
+# lgamma
+Test "lgamma (-0.5) == log(2*sqrt(pi))":
+ildouble: 1
+ldouble: 1
+Test "lgamma (0.7) == 0.260867246531666514385732417016759578":
+double: 1
+float: 1
+idouble: 1
+ifloat: 1
+Test "lgamma (1.2) == -0.853740900033158497197028392998854470e-1":
+double: 1
+float: 2
+idouble: 1
+ifloat: 2
+ildouble: 1
+ldouble: 1
+
+# log
+Test "log (e) == 1":
+float: 1
+ifloat: 1
+
+# log10
+Test "log10 (e) == log10(e)":
+float: 1
+ifloat: 1
+ildouble: 1
+ldouble: 1
+
+# sincos
+Test "sincos (0.80190127184058835, &sin_res, &cos_res) puts 0.69534156199418473 in cos_res":
+double: 1
+idouble: 1
+Test "sincos (M_PI_6l*2.0, &sin_res, &cos_res) puts 0.5 in cos_res":
+double: 1
+float: 1
+idouble: 1
+ifloat: 1
+Test "sincos (M_PI_6l*2.0, &sin_res, &cos_res) puts 0.86602540378443864676372317075293616 in sin_res":
+double: 1
+float: 1
+idouble: 1
+ifloat: 1
+ildouble: 1
+ldouble: 1
+Test "sincos (pi/2, &sin_res, &cos_res) puts 0 in cos_res":
+double: 1
+float: 1
+idouble: 1
+ifloat: 1
+ildouble: 1
+ldouble: 1
+
+# tan
+Test "tan (pi/4) == 1":
+double: 1
+idouble: 1
+
+# tgamma
+Test "tgamma (-0.5) == -2 sqrt (pi)":
+double: 1
+float: 1
+idouble: 1
+ifloat: 1
+ildouble: 1
+ldouble: 1
+Test "tgamma (0.5) == sqrt (pi)":
+float: 1
+ifloat: 1
+Test "tgamma (0.7) == 1.29805533264755778568117117915281162":
+double: 1
+float: 1
+idouble: 1
+ifloat: 1
+
+# y0
+Test "y0 (0.125) == -1.38968062514384052915582277745018693":
+ildouble: 1
+ldouble: 1
+Test "y0 (1.0) == 0.0882569642156769579829267660235151628":
+double: 2
+float: 1
+idouble: 2
+ifloat: 1
+ildouble: 1
+ldouble: 1
+Test "y0 (1.5) == 0.382448923797758843955068554978089862":
+double: 2
+float: 1
+idouble: 2
+ifloat: 1
+Test "y0 (10.0) == 0.0556711672835993914244598774101900481":
+double: 1
+float: 1
+idouble: 1
+ifloat: 1
+Test "y0 (2.0) == 0.510375672649745119596606592727157873":
+double: 1
+idouble: 1
+Test "y0 (8.0) == 0.223521489387566220527323400498620359":
+double: 1
+float: 1
+idouble: 1
+ifloat: 1
+ildouble: 1
+ldouble: 1
+
+# y1
+Test "y1 (0.125) == -5.19993611253477499595928744876579921":
+double: 1
+idouble: 1
+ildouble: 1
+ldouble: 1
+Test "y1 (10.0) == 0.249015424206953883923283474663222803":
+double: 3
+float: 1
+idouble: 3
+ifloat: 1
+Test "y1 (1.5) == -0.412308626973911295952829820633445323";
+float: 1
+ifloat: 1
+ildouble: 1
+ldouble: 1
+Test "y1 (2.0) == -0.107032431540937546888370772277476637":
+double: 1
+float: 1
+idouble: 1
+ifloat: 1
+ildouble: 1
+ldouble: 1
+Test "y1 (8.0) == -0.158060461731247494255555266187483550":
+double: 1
+float: 2
+idouble: 1
+ifloat: 2
+
+# yn
+Test "yn (0, 0.125) == -1.38968062514384052915582277745018693":
+ildouble: 1
+ldouble: 1
+Test "yn (0, 1.0) == 0.0882569642156769579829267660235151628":
+double: 2
+float: 1
+idouble: 2
+ifloat: 1
+ildouble: 1
+ldouble: 1
+Test "yn (0, 1.5) == 0.382448923797758843955068554978089862":
+double: 2
+float: 1
+idouble: 2
+ifloat: 1
+Test "yn (0, 10.0) == 0.0556711672835993914244598774101900481":
+double: 1
+float: 1
+idouble: 1
+ifloat: 1
+Test "yn (0, 2.0) == 0.510375672649745119596606592727157873":
+double: 1
+idouble: 1
+Test "yn (0, 8.0) == 0.223521489387566220527323400498620359":
+double: 1
+float: 1
+idouble: 1
+ifloat: 1
+ildouble: 1
+ldouble: 1
+Test "yn (1, 0.125) == -5.19993611253477499595928744876579921":
+double: 1
+idouble: 1
+ildouble: 1
+ldouble: 1
+Test "yn (1, 10.0) == 0.249015424206953883923283474663222803":
+double: 3
+float: 1
+idouble: 3
+ifloat: 1
+Test "yn (1, 1.5) == -0.412308626973911295952829820633445323";
+float: 1
+ifloat: 1
+ldouble: 1
+ildouble: 1
+Test "yn (1, 2.0) == -0.107032431540937546888370772277476637":
+double: 1
+float: 1
+idouble: 1
+ifloat: 1
+ildouble: 1
+ldouble: 1
+Test "yn (1, 8.0) == -0.158060461731247494255555266187483550":
+double: 1
+float: 2
+idouble: 1
+ifloat: 2
+Test "yn (10, 0.125) == -127057845771019398.252538486899753195":
+double: 1
+idouble: 1
+ildouble: 2
+ldouble: 2
+Test "yn (10, 0.75) == -2133501638.90573424452445412893839236":
+double: 1
+float: 2
+idouble: 1
+ifloat: 2
+Test "yn (10, 1.0) == -121618014.278689189288130426667971145":
+float: 2
+ifloat: 2
+Test "yn (10, 10.0) == -0.359814152183402722051986577343560609":
+double: 2
+float: 2
+idouble: 2
+ifloat: 2
+Test "yn (10, 2.0) == -129184.542208039282635913145923304214":
+double: 3
+float: 1
+idouble: 3
+ifloat: 1
+Test "yn (3, 0.125) == -2612.69757350066712600220955744091741":
+double: 1
+idouble: 1
+ildouble: 1
+ldouble: 1
+Test "yn (3, 0.75) == -12.9877176234475433186319774484809207":
+float: 1
+ifloat: 1
+ildouble: 1
+ldouble: 1
+Test "yn (3, 10.0) == -0.251362657183837329779204747654240998":
+double: 1
+float: 1
+idouble: 1
+ifloat: 1
+Test "yn (3, 2.0) == -1.12778377684042778608158395773179238":
+double: 1
+idouble: 1
+
+# Maximal error of functions:
+Function: Imaginary part of "cacos":
+float: 1
+ifloat: 1
+ildouble: 2
+ldouble: 2
+
+Function: Real part of "cacosh":
+double: 1
+float: 7
+idouble: 1
+ifloat: 7
+ildouble: 7
+ldouble: 7
+
+Function: Imaginary part of "cacosh":
+double: 1
+idouble: 1
+ildouble: 1
+ldouble: 1
+
+Function: Real part of "casin":
+double: 1
+float: 1
+idouble: 1
+ifloat: 1
+ildouble: 2
+ldouble: 2
+
+Function: Imaginary part of "casin":
+float: 1
+ifloat: 1
+ildouble: 2
+ldouble: 2
+
+Function: Real part of "casinh":
+double: 5
+float: 1
+idouble: 5
+ifloat: 1
+ildouble: 5
+ldouble: 5
+
+Function: Imaginary part of "casinh":
+double: 3
+float: 6
+idouble: 3
+ifloat: 6
+ildouble: 5
+ldouble: 5
+
+Function: Imaginary part of "catan":
+double: 1
+float: 1
+idouble: 1
+ifloat: 1
+
+Function: Real part of "catanh":
+double: 4
+idouble: 4
+ildouble: 1
+ldouble: 1
+
+Function: Real part of "ccos":
+double: 1
+idouble: 1
+ildouble: 1
+ldouble: 1
+
+Function: Imaginary part of "ccos":
+float: 1
+ifloat: 1
+ildouble: 1
+ldouble: 1
+
+Function: Real part of "ccosh":
+double: 1
+float: 1
+idouble: 1
+ifloat: 1
+
+Function: Imaginary part of "ccosh":
+double: 1
+float: 1
+idouble: 1
+ifloat: 1
+ildouble: 1
+ldouble: 1
+
+Function: Real part of "cexp":
+float: 1
+ifloat: 1
+
+Function: Imaginary part of "cexp":
+float: 1
+ifloat: 1
+ildouble: 1
+ldouble: 1
+
+Function: Real part of "clog":
+float: 1
+ifloat: 1
+ildouble: 1
+ldouble: 1
+
+Function: Real part of "clog10":
+double: 1
+float: 1
+idouble: 1
+ifloat: 1
+ildouble: 1
+ldouble: 1
+
+Function: Imaginary part of "clog10":
+double: 1
+float: 1
+idouble: 1
+ifloat: 1
+ildouble: 1
+ldouble: 1
+
+Function: "cos":
+double: 2
+float: 1
+idouble: 2
+ifloat: 1
+ildouble: 1
+ldouble: 1
+
+Function: Real part of "cpow":
+double: 2
+float: 5
+idouble: 2
+ifloat: 5
+ildouble: 6
+ldouble: 6
+
+Function: Imaginary part of "cpow":
+double: 2
+float: 3
+idouble: 2
+ifloat: 3
+ildouble: 4
+ldouble: 4
+
+Function: Real part of "csin":
+float: 1
+ifloat: 1
+ildouble: 1
+ldouble: 1
+
+Function: Imaginary part of "csin":
+float: 1
+ifloat: 1
+
+Function: Real part of "csinh":
+double: 1
+float: 1
+idouble: 1
+ifloat: 1
+ildouble: 1
+ldouble: 1
+
+Function: Imaginary part of "csinh":
+double: 1
+float: 1
+idouble: 1
+ifloat: 1
+ildouble: 2
+ldouble: 2
+
+Function: Real part of "csqrt":
+float: 1
+ifloat: 1
+
+Function: Real part of "ctan":
+double: 1
+idouble: 1
+ildouble: 2
+ldouble: 2
+
+Function: Imaginary part of "ctan":
+double: 1
+float: 1
+idouble: 1
+ifloat: 1
+ildouble: 1
+ldouble: 1
+
+Function: Real part of "ctanh":
+double: 1
+idouble: 1
+ildouble: 1
+ldouble: 1
+
+Function: Imaginary part of "ctanh":
+double: 1
+float: 1
+idouble: 1
+ifloat: 1
+ildouble: 24
+ldouble: 24
+
+Function: "erf":
+double: 1
+idouble: 1
+
+Function: "erfc":
+double: 1
+float: 1
+idouble: 1
+ifloat: 1
+ildouble: 1
+ldouble: 1
+
+Function: "exp10":
+double: 6
+float: 2
+idouble: 6
+ifloat: 2
+ildouble: 3
+ldouble: 3
+
+Function: "expm1":
+ildouble: 1
+ldouble: 1
+
+Function: "gamma":
+ildouble: 1
+ldouble: 1
+
+Function: "hypot":
+float: 1
+ifloat: 1
+
+Function: "j0":
+double: 3
+float: 2
+idouble: 3
+ifloat: 2
+ildouble: 2
+ldouble: 2
+
+Function: "j1":
+double: 1
+float: 2
+idouble: 1
+ifloat: 2
+ildouble: 1
+ldouble: 1
+
+Function: "jn":
+double: 3
+float: 4
+idouble: 3
+ifloat: 4
+ildouble: 2
+ldouble: 2
+
+Function: "lgamma":
+double: 1
+float: 2
+idouble: 1
+ifloat: 2
+ildouble: 1
+ldouble: 1
+
+Function: "log":
+float: 1
+ifloat: 1
+
+Function: "log10":
+float: 1
+ifloat: 1
+ildouble: 1
+ldouble: 1
+
+Function: "sincos":
+double: 1
+float: 1
+idouble: 1
+ifloat: 1
+ildouble: 1
+ldouble: 1
+
+Function: "tan":
+double: 1
+idouble: 1
+
+Function: "tgamma":
+double: 1
+float: 1
+idouble: 1
+ifloat: 1
+ildouble: 1
+ldouble: 1
+
+Function: "y0":
+double: 2
+float: 1
+idouble: 2
+ifloat: 1
+ildouble: 1
+ldouble: 1
+
+Function: "y1":
+double: 3
+float: 2
+idouble: 3
+ifloat: 2
+ildouble: 1
+ldouble: 1
+
+Function: "yn":
+double: 3
+float: 2
+idouble: 3
+ifloat: 2
+ildouble: 2
+ldouble: 2
+
+# end of automatic generation
diff --git a/ap/build/uClibc/test/math/libm-test-ulps-powerpc b/ap/build/uClibc/test/math/libm-test-ulps-powerpc
new file mode 100644
index 0000000..8516e91
--- /dev/null
+++ b/ap/build/uClibc/test/math/libm-test-ulps-powerpc
@@ -0,0 +1,1336 @@
+# Begin of automatic generation
+
+# acos
+Test "acos (2e-17) == 1.57079632679489659923132169163975144":
+ildouble: 1
+ldouble: 1
+
+# asin
+Test "asin (0.75) == 0.848062078981481008052944338998418080":
+ildouble: 2
+ldouble: 2
+
+# atan2
+Test "atan2 (-0.00756827042671106339, -.001792735857538728036) == -1.80338464113663849327153994379639112":
+ildouble: 1
+ldouble: 1
+Test "atan2 (-0.75, -1.0) == -2.49809154479650885165983415456218025":
+float: 1
+ifloat: 1
+Test "atan2 (0.75, -1.0) == 2.49809154479650885165983415456218025":
+float: 1
+ifloat: 1
+Test "atan2 (1.390625, 0.9296875) == 0.981498387184244311516296577615519772":
+float: 1
+ifloat: 1
+ildouble: 1
+ldouble: 1
+
+# atanh
+Test "atanh (0.75) == 0.972955074527656652552676371721589865":
+float: 1
+ifloat: 1
+
+# cabs
+Test "cabs (0.75 + 1.25 i) == 1.45773797371132511771853821938639577":
+ildouble: 1
+ldouble: 1
+
+# cacosh
+Test "Real part of: cacosh (-2 - 3 i) == 1.9833870299165354323470769028940395 - 2.1414491111159960199416055713254211 i":
+double: 1
+float: 7
+idouble: 1
+ifloat: 7
+Test "Imaginary part of: cacosh (-2 - 3 i) == 1.9833870299165354323470769028940395 - 2.1414491111159960199416055713254211 i":
+double: 1
+float: 3
+idouble: 1
+ifloat: 3
+
+# casin
+Test "Real part of: casin (-2 - 3 i) == -0.57065278432109940071028387968566963 - 1.9833870299165354323470769028940395 i":
+ildouble: 1
+ldouble: 1
+Test "Real part of: casin (0.75 + 1.25 i) == 0.453276177638793913448921196101971749 + 1.13239363160530819522266333696834467 i":
+double: 1
+float: 1
+idouble: 1
+ifloat: 1
+
+# casinh
+Test "Real part of: casinh (-2 - 3 i) == -1.9686379257930962917886650952454982 - 0.96465850440760279204541105949953237 i":
+double: 5
+float: 1
+idouble: 5
+ifloat: 1
+ildouble: 4
+ldouble: 4
+Test "Imaginary part of: casinh (-2 - 3 i) == -1.9686379257930962917886650952454982 - 0.96465850440760279204541105949953237 i":
+double: 3
+float: 6
+idouble: 3
+ifloat: 6
+ildouble: 1
+ldouble: 1
+Test "Real part of: casinh (0.75 + 1.25 i) == 1.03171853444778027336364058631006594 + 0.911738290968487636358489564316731207 i":
+float: 1
+ifloat: 1
+Test "Imaginary part of: casinh (0.75 + 1.25 i) == 1.03171853444778027336364058631006594 + 0.911738290968487636358489564316731207 i":
+double: 1
+float: 1
+idouble: 1
+ifloat: 1
+
+# catan
+Test "Real part of: catan (-2 - 3 i) == -1.4099210495965755225306193844604208 - 0.22907268296853876629588180294200276 i":
+float: 3
+ifloat: 3
+ildouble: 1
+ldouble: 1
+Test "Imaginary part of: catan (-2 - 3 i) == -1.4099210495965755225306193844604208 - 0.22907268296853876629588180294200276 i":
+double: 1
+float: 1
+idouble: 1
+ifloat: 1
+Test "Real part of: catan (0.75 + 1.25 i) == 1.10714871779409050301706546017853704 + 0.549306144334054845697622618461262852 i":
+float: 4
+ifloat: 4
+
+# catanh
+Test "Real part of: catanh (-2 - 3 i) == -0.14694666622552975204743278515471595 - 1.3389725222944935611241935759091443 i":
+double: 4
+idouble: 4
+Test "Imaginary part of: catanh (-2 - 3 i) == -0.14694666622552975204743278515471595 - 1.3389725222944935611241935759091443 i":
+float: 4
+ifloat: 4
+Test "Real part of: catanh (0.75 + 1.25 i) == 0.261492138795671927078652057366532140 + 0.996825126463918666098902241310446708 i":
+double: 1
+idouble: 1
+Test "Imaginary part of: catanh (0.75 + 1.25 i) == 0.261492138795671927078652057366532140 + 0.996825126463918666098902241310446708 i":
+float: 6
+ifloat: 6
+
+# cbrt
+Test "cbrt (-27.0) == -3.0":
+double: 1
+idouble: 1
+Test "cbrt (0.9921875) == 0.997389022060725270579075195353955217":
+double: 1
+idouble: 1
+
+# ccos
+Test "Imaginary part of: ccos (-2 - 3 i) == -4.18962569096880723013255501961597373 - 9.10922789375533659797919726277886212 i":
+float: 1
+ifloat: 1
+Test "Real part of: ccos (0.75 + 1.25 i) == 1.38173873063425888530729933139078645 - 1.09193013555397466170919531722024128 i":
+double: 1
+float: 1
+idouble: 1
+ifloat: 1
+Test "Imaginary part of: ccos (0.75 + 1.25 i) == 1.38173873063425888530729933139078645 - 1.09193013555397466170919531722024128 i":
+float: 1
+ifloat: 1
+
+# ccosh
+Test "Real part of: ccosh (-2 - 3 i) == -3.72454550491532256547397070325597253 + 0.511822569987384608834463849801875634 i":
+float: 1
+ifloat: 1
+Test "Imaginary part of: ccosh (-2 - 3 i) == -3.72454550491532256547397070325597253 + 0.511822569987384608834463849801875634 i":
+float: 1
+ifloat: 1
+Test "Real part of: ccosh (0.75 + 1.25 i) == 0.408242591877968807788852146397499084 + 0.780365930845853240391326216300863152 i":
+double: 1
+float: 1
+idouble: 1
+ifloat: 1
+ildouble: 1
+ldouble: 1
+Test "Imaginary part of: ccosh (0.75 + 1.25 i) == 0.408242591877968807788852146397499084 + 0.780365930845853240391326216300863152 i":
+float: 1
+ifloat: 1
+ildouble: 2
+ldouble: 2
+
+# cexp
+Test "Imaginary part of: cexp (-2.0 - 3.0 i) == -0.13398091492954261346140525546115575 - 0.019098516261135196432576240858800925 i":
+float: 1
+ifloat: 1
+Test "Real part of: cexp (0.75 + 1.25 i) == 0.667537446429131586942201977015932112 + 2.00900045494094876258347228145863909 i":
+float: 1
+ifloat: 1
+ildouble: 2
+ldouble: 2
+Test "Imaginary part of: cexp (0.75 + 1.25 i) == 0.667537446429131586942201977015932112 + 2.00900045494094876258347228145863909 i":
+ildouble: 1
+ldouble: 1
+
+# clog
+Test "Imaginary part of: clog (-2 - 3 i) == 1.2824746787307683680267437207826593 - 2.1587989303424641704769327722648368 i":
+float: 3
+ifloat: 3
+ildouble: 1
+ldouble: 1
+Test "Real part of: clog (0.75 + 1.25 i) == 0.376885901188190075998919126749298416 + 1.03037682652431246378774332703115153 i":
+float: 1
+ifloat: 1
+ildouble: 2
+ldouble: 2
+Test "Imaginary part of: clog (0.75 + 1.25 i) == 0.376885901188190075998919126749298416 + 1.03037682652431246378774332703115153 i":
+ildouble: 1
+ldouble: 1
+
+# clog10
+Test "Imaginary part of: clog10 (-0 + inf i) == inf + pi/2*log10(e) i":
+double: 1
+float: 1
+idouble: 1
+ifloat: 1
+ildouble: 1
+ldouble: 1
+Test "Imaginary part of: clog10 (-0 - inf i) == inf - pi/2*log10(e) i":
+double: 1
+float: 1
+idouble: 1
+ifloat: 1
+ildouble: 1
+ldouble: 1
+Test "Imaginary part of: clog10 (-2 - 3 i) == 0.556971676153418384603252578971164214 - 0.937554462986374708541507952140189646 i":
+double: 1
+float: 5
+idouble: 1
+ifloat: 5
+ildouble: 1
+ldouble: 1
+Test "Imaginary part of: clog10 (-3 + inf i) == inf + pi/2*log10(e) i":
+double: 1
+float: 1
+idouble: 1
+ifloat: 1
+ildouble: 1
+ldouble: 1
+Test "Imaginary part of: clog10 (-3 - inf i) == inf - pi/2*log10(e) i":
+double: 1
+float: 1
+idouble: 1
+ifloat: 1
+ildouble: 1
+ldouble: 1
+Test "Imaginary part of: clog10 (-inf + 0 i) == inf + pi*log10(e) i":
+double: 1
+float: 1
+idouble: 1
+ifloat: 1
+ildouble: 1
+ldouble: 1
+Test "Imaginary part of: clog10 (-inf + 1 i) == inf + pi*log10(e) i":
+double: 1
+float: 1
+idouble: 1
+ifloat: 1
+ildouble: 1
+ldouble: 1
+Test "Imaginary part of: clog10 (-inf + inf i) == inf + 3/4 pi*log10(e) i":
+double: 1
+idouble: 1
+Test "Imaginary part of: clog10 (-inf - 0 i) == inf - pi*log10(e) i":
+double: 1
+float: 1
+idouble: 1
+ifloat: 1
+ildouble: 1
+ldouble: 1
+Test "Imaginary part of: clog10 (-inf - 1 i) == inf - pi*log10(e) i":
+double: 1
+float: 1
+idouble: 1
+ifloat: 1
+ildouble: 1
+ldouble: 1
+Test "Imaginary part of: clog10 (0 + inf i) == inf + pi/2*log10(e) i":
+double: 1
+float: 1
+idouble: 1
+ifloat: 1
+ildouble: 1
+ldouble: 1
+Test "Imaginary part of: clog10 (0 - inf i) == inf - pi/2*log10(e) i":
+double: 1
+float: 1
+idouble: 1
+ifloat: 1
+ildouble: 1
+ldouble: 1
+Test "Real part of: clog10 (0.75 + 1.25 i) == 0.163679467193165171449476605077428975 + 0.447486970040493067069984724340855636 i":
+float: 1
+ifloat: 1
+ildouble: 3
+ldouble: 3
+Test "Imaginary part of: clog10 (3 + inf i) == inf + pi/2*log10(e) i":
+double: 1
+float: 1
+idouble: 1
+ifloat: 1
+ildouble: 1
+ldouble: 1
+Test "Imaginary part of: clog10 (3 - inf i) == inf - pi/2*log10(e) i":
+double: 1
+float: 1
+idouble: 1
+ifloat: 1
+ildouble: 1
+ldouble: 1
+Test "Imaginary part of: clog10 (inf + inf i) == inf + pi/4*log10(e) i":
+double: 1
+float: 1
+idouble: 1
+ifloat: 1
+ildouble: 1
+ldouble: 1
+Test "Imaginary part of: clog10 (inf - inf i) == inf - pi/4*log10(e) i":
+double: 1
+float: 1
+idouble: 1
+ifloat: 1
+ildouble: 1
+ldouble: 1
+
+# cos
+Test "cos (M_PI_6l * 2.0) == 0.5":
+double: 1
+float: 1
+idouble: 1
+ifloat: 1
+Test "cos (M_PI_6l * 4.0) == -0.5":
+double: 2
+float: 1
+idouble: 2
+ifloat: 1
+Test "cos (pi/2) == 0":
+double: 1
+float: 1
+idouble: 1
+ifloat: 1
+Test "cos (16.0) == -0.9576594803233846418996372326511034717803"
+ildouble: 2
+ldouble: 2
+
+# cpow
+Test "Real part of: cpow (0.75 + 1.25 i, 0.0 + 1.0 i) == 0.331825439177608832276067945276730566 + 0.131338600281188544930936345230903032 i":
+float: 1
+ifloat: 1
+ildouble: 1
+ldouble: 1
+Test "Imaginary part of: cpow (0.75 + 1.25 i, 0.0 + 1.0 i) == 0.331825439177608832276067945276730566 + 0.131338600281188544930936345230903032 i":
+float: 1
+ifloat: 1
+ildouble: 1
+ldouble: 1
+Test "Real part of: cpow (0.75 + 1.25 i, 0.75 + 1.25 i) == 0.117506293914473555420279832210420483 + 0.346552747708338676483025352060418001 i":
+double: 1
+float: 4
+idouble: 1
+ifloat: 4
+Test "Real part of: cpow (0.75 + 1.25 i, 1.0 + 0.0 i) == 0.75 + 1.25 i":
+ildouble: 2
+ldouble: 2
+Test "Real part of: cpow (0.75 + 1.25 i, 1.0 + 1.0 i) == 0.0846958290317209430433805274189191353 + 0.513285749182902449043287190519090481 i":
+double: 2
+float: 3
+idouble: 2
+ifloat: 3
+Test "Real part of: cpow (2 + 0 i, 10 + 0 i) == 1024.0 + 0.0 i":
+ildouble: 1
+ldouble: 1
+Test "Real part of: cpow (2 + 3 i, 4 + 0 i) == -119.0 - 120.0 i":
+double: 1
+float: 5
+idouble: 1
+ifloat: 5
+Test "Imaginary part of: cpow (2 + 3 i, 4 + 0 i) == -119.0 - 120.0 i":
+float: 2
+ifloat: 2
+ildouble: 2
+ldouble: 2
+Test "Imaginary part of: cpow (e + 0 i, 0 + 2 * M_PIl i) == 1.0 + 0.0 i":
+double: 2
+float: 2
+idouble: 2
+ifloat: 2
+ildouble: 2
+ldouble: 2
+
+# csinh
+Test "Imaginary part of: csinh (-2 - 3 i) == 3.59056458998577995201256544779481679 - 0.530921086248519805267040090660676560 i":
+double: 1
+idouble: 1
+ildouble: 1
+ldouble: 1
+Test "Real part of: csinh (0.75 + 1.25 i) == 0.259294854551162779153349830618433028 + 1.22863452409509552219214606515777594 i":
+float: 1
+ifloat: 1
+ildouble: 1
+ldouble: 1
+Test "Imaginary part of: csinh (0.75 + 1.25 i) == 0.259294854551162779153349830618433028 + 1.22863452409509552219214606515777594 i":
+float: 1
+ifloat: 1
+ildouble: 1
+ldouble: 1
+
+# csqrt
+Test "Real part of: csqrt (-2 + 3 i) == 0.89597747612983812471573375529004348 + 1.6741492280355400404480393008490519 i":
+float: 1
+ifloat: 1
+Test "Real part of: csqrt (-2 - 3 i) == 0.89597747612983812471573375529004348 - 1.6741492280355400404480393008490519 i":
+float: 1
+ifloat: 1
+
+# ctan
+Test "Real part of: ctan (-2 - 3 i) == 0.376402564150424829275122113032269084e-2 - 1.00323862735360980144635859782192726 i":
+double: 1
+idouble: 1
+Test "Imaginary part of: ctan (-2 - 3 i) == 0.376402564150424829275122113032269084e-2 - 1.00323862735360980144635859782192726 i":
+ildouble: 1
+ldouble: 1
+Test "Imaginary part of: ctan (0.75 + 1.25 i) == 0.160807785916206426725166058173438663 + 0.975363285031235646193581759755216379 i":
+double: 1
+idouble: 1
+
+# ctanh
+Test "Real part of: ctanh (-2 - 3 i) == -0.965385879022133124278480269394560686 + 0.988437503832249372031403430350121098e-2 i":
+double: 1
+float: 2
+idouble: 1
+ifloat: 2
+Test "Imaginary part of: ctanh (0 + pi/4 i) == 0.0 + 1.0 i":
+float: 1
+ifloat: 1
+Test "Real part of: ctanh (0.75 + 1.25 i) == 1.37260757053378320258048606571226857 + 0.385795952609750664177596760720790220 i":
+double: 1
+idouble: 1
+ildouble: 1
+ldouble: 1
+
+# erf
+Test "erf (1.25) == 0.922900128256458230136523481197281140":
+double: 1
+idouble: 1
+
+# erfc
+Test "erfc (0.75) == 0.288844366346484868401062165408589223":
+float: 1
+ifloat: 1
+Test "erfc (2.0) == 0.00467773498104726583793074363274707139":
+double: 1
+idouble: 1
+Test "erfc (4.125) == 0.542340079956506600531223408575531062e-8":
+double: 1
+idouble: 1
+
+# exp
+Test "exp (0.75) == 2.11700001661267466854536981983709561":
+ildouble: 1
+ldouble: 1
+Test "exp (50.0) == 5184705528587072464087.45332293348538":
+ildouble: 1
+ldouble: 1
+
+# exp10
+Test "exp10 (-1) == 0.1":
+double: 2
+float: 1
+idouble: 2
+ifloat: 1
+ildouble: 1
+ldouble: 1
+Test "exp10 (0.75) == 5.62341325190349080394951039776481231":
+double: 1
+float: 1
+idouble: 1
+ifloat: 1
+ildouble: 1
+ldouble: 1
+Test "exp10 (3) == 1000":
+double: 6
+float: 2
+idouble: 6
+ifloat: 2
+ildouble: 8
+ldouble: 8
+
+# exp2
+Test "exp2 (10) == 1024":
+ildouble: 2
+ldouble: 2
+
+# expm1
+Test "expm1 (0.75) == 1.11700001661267466854536981983709561":
+double: 1
+idouble: 1
+Test "expm1 (1) == M_El - 1.0":
+double: 1
+float: 1
+idouble: 1
+ifloat: 1
+
+# hypot
+Test "hypot (-0.7, -12.4) == 12.419742348374220601176836866763271":
+float: 1
+ifloat: 1
+Test "hypot (-0.7, 12.4) == 12.419742348374220601176836866763271":
+float: 1
+ifloat: 1
+Test "hypot (-12.4, -0.7) == 12.419742348374220601176836866763271":
+float: 1
+ifloat: 1
+Test "hypot (-12.4, 0.7) == 12.419742348374220601176836866763271":
+float: 1
+ifloat: 1
+Test "hypot (0.7, -12.4) == 12.419742348374220601176836866763271":
+float: 1
+ifloat: 1
+Test "hypot (0.7, 12.4) == 12.419742348374220601176836866763271":
+float: 1
+ifloat: 1
+Test "hypot (0.75, 1.25) == 1.45773797371132511771853821938639577":
+ildouble: 1
+ldouble: 1
+Test "hypot (12.4, -0.7) == 12.419742348374220601176836866763271":
+float: 1
+ifloat: 1
+Test "hypot (12.4, 0.7) == 12.419742348374220601176836866763271":
+float: 1
+ifloat: 1
+
+# j0
+Test "j0 (-4.0) == -3.9714980986384737228659076845169804197562E-1":
+double: 1
+float: 2
+idouble: 1
+ifloat: 2
+ildouble: 1
+ldouble: 1
+Test "j0 (10.0) == -0.245935764451348335197760862485328754":
+double: 3
+float: 1
+idouble: 3
+ifloat: 1
+ildouble: 1
+ldouble: 1
+Test "j0 (2.0) == 0.223890779141235668051827454649948626":
+float: 2
+ifloat: 2
+Test "j0 (4.0) == -3.9714980986384737228659076845169804197562E-1":
+double: 1
+float: 2
+idouble: 1
+ifloat: 2
+ildouble: 1
+ldouble: 1
+Test "j0 (8.0) == 0.171650807137553906090869407851972001":
+float: 1
+ifloat: 1
+ildouble: 1
+ldouble: 1
+
+# j1
+Test "j1 (10.0) == 0.0434727461688614366697487680258592883":
+float: 2
+ifloat: 2
+ildouble: 1
+ldouble: 1
+Test "j1 (2.0) == 0.576724807756873387202448242269137087":
+double: 1
+idouble: 1
+Test "j1 (8.0) == 0.234636346853914624381276651590454612":
+double: 1
+idouble: 1
+ildouble: 1
+ldouble: 1
+
+# jn
+Test "jn (0, -4.0) == -3.9714980986384737228659076845169804197562E-1":
+double: 1
+float: 2
+idouble: 1
+ifloat: 2
+ildouble: 1
+ldouble: 1
+Test "jn (0, 10.0) == -0.245935764451348335197760862485328754":
+double: 3
+float: 1
+idouble: 3
+ifloat: 1
+ildouble: 1
+ldouble: 1
+Test "jn (0, 2.0) == 0.223890779141235668051827454649948626":
+float: 2
+ifloat: 2
+Test "jn (0, 4.0) == -3.9714980986384737228659076845169804197562E-1":
+double: 1
+float: 2
+idouble: 1
+ifloat: 2
+ildouble: 1
+ldouble: 1
+Test "jn (0, 8.0) == 0.171650807137553906090869407851972001":
+float: 1
+ifloat: 1
+ildouble: 1
+ldouble: 1
+Test "jn (1, 10.0) == 0.0434727461688614366697487680258592883":
+float: 2
+ifloat: 2
+ildouble: 1
+ldouble: 1
+Test "jn (1, 2.0) == 0.576724807756873387202448242269137087":
+double: 1
+idouble: 1
+Test "jn (1, 8.0) == 0.234636346853914624381276651590454612":
+double: 1
+idouble: 1
+ildouble: 1
+ldouble: 1
+Test "jn (10, -1.0) == 0.263061512368745320699785368779050294e-9":
+ildouble: 1
+ldouble: 1
+Test "jn (10, 0.125) == 0.250543369809369890173993791865771547e-18":
+double: 1
+float: 1
+idouble: 1
+ifloat: 1
+ildouble: 1
+ldouble: 1
+Test "jn (10, 0.75) == 0.149621713117596814698712483621682835e-10":
+double: 1
+float: 1
+idouble: 1
+ifloat: 1
+Test "jn (10, 1.0) == 0.263061512368745320699785368779050294e-9":
+ildouble: 1
+ldouble: 1
+Test "jn (10, 10.0) == 0.207486106633358857697278723518753428":
+float: 1
+ifloat: 1
+ildouble: 4
+ldouble: 4
+Test "jn (10, 2.0) == 0.251538628271673670963516093751820639e-6":
+float: 4
+ifloat: 4
+Test "jn (3, -1.0) == -0.0195633539826684059189053216217515083":
+ildouble: 1
+ldouble: 1
+Test "jn (3, 0.125) == 0.406503832554912875023029337653442868e-4":
+double: 1
+float: 1
+idouble: 1
+ifloat: 1
+Test "jn (3, 0.75) == 0.848438342327410884392755236884386804e-2":
+double: 1
+idouble: 1
+Test "jn (3, 1.0) == 0.0195633539826684059189053216217515083":
+ildouble: 1
+ldouble: 1
+Test "jn (3, 10.0) == 0.0583793793051868123429354784103409563":
+double: 3
+float: 2
+idouble: 3
+ifloat: 2
+ildouble: 2
+ldouble: 2
+Test "jn (3, 2.0) == 0.128943249474402051098793332969239835":
+double: 1
+float: 2
+idouble: 1
+ifloat: 2
+ildouble: 2
+ldouble: 2
+
+# lgamma
+Test "lgamma (0.7) == 0.260867246531666514385732417016759578":
+double: 1
+float: 1
+idouble: 1
+ifloat: 1
+Test "lgamma (1.2) == -0.853740900033158497197028392998854470e-1":
+double: 1
+float: 2
+idouble: 1
+ifloat: 2
+ildouble: 3
+ldouble: 3
+
+# log10
+Test "log10 (0.75) == -0.124938736608299953132449886193870744":
+double: 1
+float: 2
+idouble: 1
+ifloat: 2
+Test "log10 (e) == log10(e)":
+float: 1
+ifloat: 1
+
+# log1p
+Test "log1p (-0.25) == -0.287682072451780927439219005993827432":
+float: 1
+ifloat: 1
+
+# log2
+Test "log2 (e) == M_LOG2El":
+ildouble: 1
+ldouble: 1
+
+# sin
+Test "sin (16.0) == -0.2879033166650652947844562482186175296207"
+ildouble: 2
+ldouble: 2
+
+# sincos
+Test "sincos (M_PI_6l*2.0, &sin_res, &cos_res) puts 0.5 in cos_res":
+double: 1
+float: 1
+idouble: 1
+ifloat: 1
+Test "sincos (M_PI_6l*2.0, &sin_res, &cos_res) puts 0.86602540378443864676372317075293616 in sin_res":
+double: 1
+float: 1
+idouble: 1
+ifloat: 1
+Test "sincos (pi/2, &sin_res, &cos_res) puts 0 in cos_res":
+double: 1
+float: 1
+idouble: 1
+ifloat: 1
+Test "sincos (pi/6, &sin_res, &cos_res) puts 0.86602540378443864676372317075293616 in cos_res":
+float: 1
+ifloat: 1
+
+# sinh
+Test "sinh (0.75) == 0.822316731935829980703661634446913849":
+ildouble: 1
+ldouble: 1
+
+# tan
+Test "tan (pi/4) == 1":
+double: 1
+idouble: 1
+ildouble: 1
+ldouble: 1
+
+# tanh
+Test "tanh (-0.75) == -0.635148952387287319214434357312496495":
+ildouble: 1
+ldouble: 1
+Test "tanh (0.75) == 0.635148952387287319214434357312496495":
+ildouble: 1
+ldouble: 1
+
+# tgamma
+Test "tgamma (-0.5) == -2 sqrt (pi)":
+double: 1
+float: 1
+idouble: 1
+ifloat: 1
+Test "tgamma (0.5) == sqrt (pi)":
+float: 1
+ifloat: 1
+Test "tgamma (0.7) == 1.29805533264755778568117117915281162":
+double: 1
+float: 1
+idouble: 1
+ifloat: 1
+
+# y0
+Test "y0 (0.125) == -1.38968062514384052915582277745018693":
+ildouble: 1
+ldouble: 1
+Test "y0 (0.75) == -0.137172769385772397522814379396581855":
+ildouble: 1
+ldouble: 1
+Test "y0 (1.0) == 0.0882569642156769579829267660235151628":
+double: 2
+float: 1
+idouble: 2
+ifloat: 1
+ildouble: 1
+ldouble: 1
+Test "y0 (1.5) == 0.382448923797758843955068554978089862":
+double: 2
+float: 1
+idouble: 2
+ifloat: 1
+Test "y0 (10.0) == 0.0556711672835993914244598774101900481":
+double: 1
+float: 1
+idouble: 1
+ifloat: 1
+ildouble: 1
+ldouble: 1
+Test "y0 (2.0) == 0.510375672649745119596606592727157873":
+double: 1
+idouble: 1
+Test "y0 (8.0) == 0.223521489387566220527323400498620359":
+double: 1
+float: 1
+idouble: 1
+ifloat: 1
+ildouble: 1
+ldouble: 1
+
+# y1
+Test "y1 (0.125) == -5.19993611253477499595928744876579921":
+double: 1
+idouble: 1
+Test "y1 (1.5) == -0.412308626973911295952829820633445323":
+float: 1
+ifloat: 1
+Test "y1 (10.0) == 0.249015424206953883923283474663222803":
+double: 3
+float: 1
+idouble: 3
+ifloat: 1
+ildouble: 2
+ldouble: 2
+Test "y1 (2.0) == -0.107032431540937546888370772277476637":
+double: 1
+float: 1
+idouble: 2
+ifloat: 2
+Test "y1 (8.0) == -0.158060461731247494255555266187483550":
+double: 1
+float: 2
+idouble: 1
+ifloat: 2
+ildouble: 2
+ldouble: 2
+
+# yn
+Test "yn (0, 0.125) == -1.38968062514384052915582277745018693":
+ildouble: 1
+ldouble: 1
+Test "yn (0, 0.75) == -0.137172769385772397522814379396581855":
+ildouble: 1
+ldouble: 1
+Test "yn (0, 1.0) == 0.0882569642156769579829267660235151628":
+double: 2
+float: 1
+idouble: 2
+ifloat: 1
+ildouble: 2
+ldouble: 2
+Test "yn (0, 1.5) == 0.382448923797758843955068554978089862":
+double: 2
+float: 1
+idouble: 2
+ifloat: 1
+Test "yn (0, 10.0) == 0.0556711672835993914244598774101900481":
+double: 1
+float: 1
+idouble: 1
+ifloat: 1
+ildouble: 2
+ldouble: 2
+Test "yn (0, 2.0) == 0.510375672649745119596606592727157873":
+double: 1
+idouble: 1
+Test "yn (0, 8.0) == 0.223521489387566220527323400498620359":
+double: 1
+float: 1
+idouble: 1
+ifloat: 1
+ildouble: 2
+ldouble: 2
+Test "yn (1, 0.125) == -5.19993611253477499595928744876579921":
+double: 1
+idouble: 1
+Test "yn (1, 1.5) == -0.412308626973911295952829820633445323":
+float: 2
+ifloat: 2
+Test "yn (1, 10.0) == 0.249015424206953883923283474663222803":
+double: 3
+float: 1
+idouble: 3
+ifloat: 1
+ildouble: 2
+ldouble: 2
+Test "yn (1, 2.0) == -0.107032431540937546888370772277476637":
+double: 1
+float: 1
+idouble: 1
+ifloat: 1
+Test "yn (1, 8.0) == -0.158060461731247494255555266187483550":
+double: 1
+float: 2
+idouble: 1
+ifloat: 2
+ildouble: 2
+ldouble: 2
+Test "yn (3, 0.125) == -2612.69757350066712600220955744091741":
+double: 1
+idouble: 1
+Test "yn (10, 0.125) == -127057845771019398.252538486899753195":
+double: 1
+idouble: 1
+Test "yn (10, 0.75) == -2133501638.90573424452445412893839236":
+double: 1
+float: 2
+idouble: 1
+ifloat: 2
+Test "yn (10, 1.0) == -121618014.278689189288130426667971145":
+float: 2
+ifloat: 2
+Test "yn (10, 10.0) == -0.359814152183402722051986577343560609":
+double: 2
+float: 2
+idouble: 2
+ifloat: 2
+ildouble: 2
+ldouble: 2
+Test "yn (10, 2.0) == -129184.542208039282635913145923304214":
+double: 3
+float: 1
+idouble: 3
+ifloat: 1
+ildouble: 2
+ldouble: 2
+Test "yn (3, 0.125) == -2612.69757350066712600220955744091741":
+double: 1
+idouble: 1
+Test "yn (3, 0.75) == -12.9877176234475433186319774484809207":
+float: 1
+ifloat: 1
+Test "yn (3, 10.0) == -0.251362657183837329779204747654240998":
+double: 1
+float: 1
+idouble: 1
+ifloat: 1
+ildouble: 2
+ldouble: 2
+Test "yn (3, 2.0) == -1.12778377684042778608158395773179238":
+double: 1
+idouble: 1
+
+# Maximal error of functions:
+Function: "acos":
+ildouble: 1
+ldouble: 1
+
+Function: "acosh":
+ildouble: 1
+ldouble: 1
+
+Function: "asin":
+ildouble: 2
+ldouble: 2
+
+Function: "asinh":
+ildouble: 1
+ldouble: 1
+
+Function: "atan2":
+float: 1
+ifloat: 1
+ildouble: 1
+ldouble: 1
+
+Function: "atanh":
+float: 1
+ifloat: 1
+
+Function: "cabs":
+ildouble: 1
+ldouble: 1
+
+Function: Real part of "cacos":
+ildouble: 1
+ldouble: 1
+
+Function: Imaginary part of "cacos":
+ildouble: 1
+ldouble: 1
+
+Function: Real part of "cacosh":
+double: 1
+float: 7
+idouble: 1
+ifloat: 7
+ildouble: 1
+ldouble: 1
+
+Function: Imaginary part of "cacosh":
+double: 1
+float: 3
+idouble: 1
+ifloat: 3
+
+Function: Real part of "casin":
+double: 1
+float: 1
+idouble: 1
+ifloat: 1
+ildouble: 1
+ldouble: 1
+
+Function: Imaginary part of "casin":
+ildouble: 1
+ldouble: 1
+
+Function: Real part of "casinh":
+double: 5
+float: 1
+idouble: 5
+ifloat: 1
+ildouble: 4
+ldouble: 4
+
+Function: Imaginary part of "casinh":
+double: 3
+float: 6
+idouble: 3
+ifloat: 6
+ildouble: 1
+ldouble: 1
+
+Function: Real part of "catan":
+float: 4
+ifloat: 4
+ildouble: 1
+ldouble: 1
+
+Function: Imaginary part of "catan":
+double: 1
+float: 1
+idouble: 1
+ifloat: 1
+ildouble: 1
+ldouble: 1
+
+Function: Real part of "catanh":
+double: 4
+idouble: 4
+
+Function: Imaginary part of "catanh":
+float: 6
+ifloat: 6
+
+Function: "cbrt":
+double: 1
+idouble: 1
+ildouble: 1
+ldouble: 1
+
+Function: Real part of "ccos":
+double: 1
+float: 1
+idouble: 1
+ifloat: 1
+ildouble: 1
+ldouble: 1
+
+Function: Imaginary part of "ccos":
+float: 1
+ifloat: 1
+ildouble: 1
+ldouble: 1
+
+Function: Real part of "ccosh":
+double: 1
+float: 1
+idouble: 1
+ifloat: 1
+ildouble: 1
+ldouble: 1
+
+Function: Imaginary part of "ccosh":
+float: 1
+ifloat: 1
+ildouble: 2
+ldouble: 2
+
+Function: Real part of "cexp":
+float: 1
+ifloat: 1
+ildouble: 2
+ldouble: 2
+
+Function: Imaginary part of "cexp":
+float: 1
+ifloat: 1
+ildouble: 1
+ldouble: 1
+
+Function: Real part of "clog":
+float: 1
+ifloat: 1
+ildouble: 2
+ldouble: 2
+
+Function: Imaginary part of "clog":
+float: 3
+ifloat: 3
+ildouble: 1
+ldouble: 1
+
+Function: Real part of "clog10":
+float: 1
+ifloat: 1
+ildouble: 3
+ldouble: 3
+
+Function: Imaginary part of "clog10":
+double: 1
+float: 5
+idouble: 1
+ifloat: 5
+ildouble: 1
+ldouble: 1
+
+Function: "cos":
+double: 2
+float: 1
+idouble: 2
+ifloat: 1
+ildouble: 1
+ldouble: 1
+
+Function: "cosh":
+ildouble: 1
+ldouble: 1
+
+Function: Real part of "cpow":
+double: 2
+float: 5
+idouble: 2
+ifloat: 5
+ildouble: 2
+ldouble: 2
+
+Function: Imaginary part of "cpow":
+double: 2
+float: 2
+idouble: 2
+ifloat: 2
+ildouble: 2
+ldouble: 2
+
+Function: Imaginary part of "cproj":
+ildouble: 1
+ldouble: 1
+
+Function: Real part of "csin":
+ildouble: 1
+ldouble: 1
+
+Function: Real part of "csinh":
+float: 1
+ifloat: 1
+ildouble: 1
+ldouble: 1
+
+Function: Imaginary part of "csinh":
+double: 1
+float: 1
+idouble: 1
+ifloat: 1
+ildouble: 1
+ldouble: 1
+
+Function: Real part of "csqrt":
+float: 1
+ifloat: 1
+ildouble: 1
+ldouble: 1
+
+Function: Imaginary part of "csqrt":
+ildouble: 1
+ldouble: 1
+
+Function: Real part of "ctan":
+double: 1
+idouble: 1
+ildouble: 1
+ldouble: 1
+
+Function: Imaginary part of "ctan":
+double: 1
+idouble: 1
+ildouble: 1
+ldouble: 1
+
+Function: Real part of "ctanh":
+double: 1
+float: 2
+idouble: 1
+ifloat: 2
+ildouble: 1
+ldouble: 1
+
+Function: Imaginary part of "ctanh":
+float: 1
+ifloat: 1
+ildouble: 1
+ldouble: 1
+
+Function: "erf":
+double: 1
+idouble: 1
+ildouble: 1
+ldouble: 1
+
+Function: "erfc":
+double: 1
+float: 1
+idouble: 1
+ifloat: 1
+ildouble: 1
+ldouble: 1
+
+Function: "exp":
+ildouble: 1
+ldouble: 1
+
+Function: "exp10":
+double: 6
+float: 2
+idouble: 6
+ifloat: 2
+ildouble: 8
+ldouble: 8
+
+Function: "exp2":
+ildouble: 2
+ldouble: 2
+
+Function: "expm1":
+double: 1
+float: 1
+idouble: 1
+ifloat: 1
+
+Function: "gamma":
+ildouble: 1
+ldouble: 1
+
+Function: "hypot":
+float: 1
+ifloat: 1
+ildouble: 1
+ldouble: 1
+
+Function: "j0":
+double: 3
+float: 2
+idouble: 3
+ifloat: 2
+ildouble: 1
+ldouble: 1
+
+Function: "j1":
+double: 1
+float: 2
+idouble: 1
+ifloat: 2
+ildouble: 1
+ldouble: 1
+
+Function: "jn":
+double: 3
+float: 4
+idouble: 3
+ifloat: 4
+ildouble: 4
+ldouble: 4
+
+Function: "lgamma":
+double: 1
+float: 2
+idouble: 1
+ifloat: 2
+ildouble: 3
+ldouble: 3
+
+Function: "log":
+ildouble: 1
+ldouble: 1
+
+Function: "log10":
+double: 1
+float: 2
+idouble: 1
+ifloat: 2
+ildouble: 1
+ldouble: 1
+
+Function: "log1p":
+float: 1
+ifloat: 1
+ildouble: 1
+ldouble: 1
+
+Function: "log2":
+ildouble: 1
+ldouble: 1
+
+Function: "pow":
+ildouble: 1
+ldouble: 1
+
+Function: "sin":
+ildouble: 1
+ldouble: 1
+
+Function: "sincos":
+double: 1
+float: 1
+idouble: 1
+ifloat: 1
+ildouble: 1
+ldouble: 1
+
+Function: "sinh":
+ildouble: 1
+ldouble: 1
+
+Function: "tan":
+double: 1
+idouble: 1
+ildouble: 1
+ldouble: 1
+
+Function: "tanh":
+ildouble: 1
+ldouble: 1
+
+Function: "tgamma":
+double: 1
+float: 1
+idouble: 1
+ifloat: 1
+ildouble: 1
+ldouble: 1
+
+Function: "y0":
+double: 2
+float: 1
+idouble: 2
+ifloat: 1
+ildouble: 1
+ldouble: 1
+
+Function: "y1":
+double: 3
+float: 2
+idouble: 3
+ifloat: 2
+ildouble: 2
+ldouble: 2
+
+Function: "yn":
+double: 3
+float: 2
+idouble: 3
+ifloat: 2
+ildouble: 2
+ldouble: 2
+
+# end of automatic generation
diff --git a/ap/build/uClibc/test/math/libm-test-ulps-s390 b/ap/build/uClibc/test/math/libm-test-ulps-s390
new file mode 100644
index 0000000..989722e
--- /dev/null
+++ b/ap/build/uClibc/test/math/libm-test-ulps-s390
@@ -0,0 +1,1332 @@
+# Begin of automatic generation
+
+# atan2
+Test "atan2 (-0.00756827042671106339, -.001792735857538728036) == -1.80338464113663849327153994379639112":
+ildouble: 1
+ldouble: 1
+Test "atan2 (-0.75, -1.0) == -2.49809154479650885165983415456218025":
+float: 1
+ifloat: 1
+ildouble: 1
+ldouble: 1
+Test "atan2 (0.75, -1.0) == 2.49809154479650885165983415456218025":
+float: 1
+ifloat: 1
+ildouble: 1
+ldouble: 1
+Test "atan2 (1.390625, 0.9296875) == 0.981498387184244311516296577615519772":
+float: 1
+ifloat: 1
+ildouble: 1
+ldouble: 1
+
+# atanh
+Test "atanh (0.75) == 0.972955074527656652552676371721589865":
+float: 1
+ifloat: 1
+
+# cacos
+Test "Imaginary part of: cacos (0.75 + 1.25 i) == 1.11752014915610270578240049553777969 - 1.13239363160530819522266333696834467 i":
+ildouble: 1
+ldouble: 1
+
+# cacosh
+Test "Real part of: cacosh (-2 - 3 i) == 1.9833870299165354323470769028940395 - 2.1414491111159960199416055713254211 i":
+double: 1
+float: 7
+idouble: 1
+ifloat: 7
+Test "Imaginary part of: cacosh (-2 - 3 i) == 1.9833870299165354323470769028940395 - 2.1414491111159960199416055713254211 i":
+double: 1
+float: 3
+idouble: 1
+ifloat: 3
+ildouble: 1
+ldouble: 1
+
+# casin
+Test "Real part of: casin (0.75 + 1.25 i) == 0.453276177638793913448921196101971749 + 1.13239363160530819522266333696834467 i":
+double: 1
+float: 1
+idouble: 1
+ifloat: 1
+Test "Imaginary part of: casin (0.75 + 1.25 i) == 0.453276177638793913448921196101971749 + 1.13239363160530819522266333696834467 i":
+ildouble: 1
+ldouble: 1
+
+# casinh
+Test "Real part of: casinh (-2 - 3 i) == -1.9686379257930962917886650952454982 - 0.96465850440760279204541105949953237 i":
+double: 5
+float: 1
+idouble: 5
+ifloat: 1
+ildouble: 4
+ldouble: 4
+Test "Imaginary part of: casinh (-2 - 3 i) == -1.9686379257930962917886650952454982 - 0.96465850440760279204541105949953237 i":
+double: 3
+float: 6
+idouble: 3
+ifloat: 6
+ildouble: 2
+ldouble: 2
+Test "Real part of: casinh (0.75 + 1.25 i) == 1.03171853444778027336364058631006594 + 0.911738290968487636358489564316731207 i":
+float: 1
+ifloat: 1
+ildouble: 1
+ldouble: 1
+Test "Imaginary part of: casinh (0.75 + 1.25 i) == 1.03171853444778027336364058631006594 + 0.911738290968487636358489564316731207 i":
+double: 1
+float: 1
+idouble: 1
+ifloat: 1
+ildouble: 1
+ldouble: 1
+
+# catan
+Test "Real part of: catan (-2 - 3 i) == -1.4099210495965755225306193844604208 - 0.22907268296853876629588180294200276 i":
+float: 3
+ifloat: 3
+Test "Imaginary part of: catan (-2 - 3 i) == -1.4099210495965755225306193844604208 - 0.22907268296853876629588180294200276 i":
+double: 1
+float: 1
+idouble: 1
+ifloat: 1
+Test "Real part of: catan (0.75 + 1.25 i) == 1.10714871779409050301706546017853704 + 0.549306144334054845697622618461262852 i":
+float: 4
+ifloat: 4
+Test "Imaginary part of: catan (0.75 + 1.25 i) == 1.10714871779409050301706546017853704 + 0.549306144334054845697622618461262852 i":
+ildouble: 1
+ldouble: 1
+
+# catanh
+Test "Real part of: catanh (-2 - 3 i) == -0.14694666622552975204743278515471595 - 1.3389725222944935611241935759091443 i":
+double: 4
+idouble: 4
+Test "Imaginary part of: catanh (-2 - 3 i) == -0.14694666622552975204743278515471595 - 1.3389725222944935611241935759091443 i":
+float: 4
+ifloat: 4
+Test "Real part of: catanh (0.75 + 1.25 i) == 0.261492138795671927078652057366532140 + 0.996825126463918666098902241310446708 i":
+double: 1
+idouble: 1
+ildouble: 1
+ldouble: 1
+Test "Imaginary part of: catanh (0.75 + 1.25 i) == 0.261492138795671927078652057366532140 + 0.996825126463918666098902241310446708 i":
+float: 6
+ifloat: 6
+ildouble: 1
+ldouble: 1
+
+# cbrt
+Test "cbrt (-0.001) == -0.1":
+ildouble: 1
+ldouble: 1
+Test "cbrt (-27.0) == -3.0":
+double: 1
+idouble: 1
+Test "cbrt (0.75) == 0.908560296416069829445605878163630251":
+double: 1
+idouble: 1
+Test "cbrt (0.9921875) == 0.997389022060725270579075195353955217":
+double: 1
+idouble: 1
+
+# ccos
+Test "Real part of: ccos (-2 - 3 i) == -4.18962569096880723013255501961597373 - 9.10922789375533659797919726277886212 i":
+ildouble: 1
+ldouble: 1
+Test "Imaginary part of: ccos (-2 - 3 i) == -4.18962569096880723013255501961597373 - 9.10922789375533659797919726277886212 i":
+float: 1
+ifloat: 1
+ildouble: 1
+ldouble: 1
+Test "Real part of: ccos (0.75 + 1.25 i) == 1.38173873063425888530729933139078645 - 1.09193013555397466170919531722024128 i":
+double: 1
+float: 1
+idouble: 1
+ifloat: 1
+Test "Imaginary part of: ccos (0.75 + 1.25 i) == 1.38173873063425888530729933139078645 - 1.09193013555397466170919531722024128 i":
+float: 1
+ifloat: 1
+
+# ccosh
+Test "Real part of: ccosh (-2 - 3 i) == -3.72454550491532256547397070325597253 + 0.511822569987384608834463849801875634 i":
+float: 1
+ifloat: 1
+ildouble: 1
+ldouble: 1
+Test "Imaginary part of: ccosh (-2 - 3 i) == -3.72454550491532256547397070325597253 + 0.511822569987384608834463849801875634 i":
+float: 1
+ifloat: 1
+ildouble: 1
+ldouble: 1
+Test "Real part of: ccosh (0.75 + 1.25 i) == 0.408242591877968807788852146397499084 + 0.780365930845853240391326216300863152 i":
+double: 1
+float: 1
+idouble: 1
+ifloat: 1
+Test "Imaginary part of: ccosh (0.75 + 1.25 i) == 0.408242591877968807788852146397499084 + 0.780365930845853240391326216300863152 i":
+float: 1
+ifloat: 1
+
+# cexp
+Test "Real part of: cexp (-2.0 - 3.0 i) == -0.13398091492954261346140525546115575 - 0.019098516261135196432576240858800925 i":
+ildouble: 1
+ldouble: 1
+Test "Imaginary part of: cexp (-2.0 - 3.0 i) == -0.13398091492954261346140525546115575 - 0.019098516261135196432576240858800925 i":
+float: 1
+ifloat: 1
+ildouble: 1
+ldouble: 1
+Test "Real part of: cexp (0.75 + 1.25 i) == 0.667537446429131586942201977015932112 + 2.00900045494094876258347228145863909 i":
+float: 1
+ifloat: 1
+Test "Imaginary part of: cexp (0.75 + 1.25 i) == 0.667537446429131586942201977015932112 + 2.00900045494094876258347228145863909 i":
+ildouble: 1
+ldouble: 1
+
+# clog
+Test "Imaginary part of: clog (-2 - 3 i) == 1.2824746787307683680267437207826593 - 2.1587989303424641704769327722648368 i":
+float: 3
+ifloat: 3
+Test "Real part of: clog (0.75 + 1.25 i) == 0.376885901188190075998919126749298416 + 1.03037682652431246378774332703115153 i":
+float: 1
+ifloat: 1
+ildouble: 1
+ldouble: 1
+
+# clog10
+Test "Imaginary part of: clog10 (-0 + inf i) == inf + pi/2*log10(e) i":
+double: 1
+float: 1
+idouble: 1
+ifloat: 1
+Test "Imaginary part of: clog10 (-0 - inf i) == inf - pi/2*log10(e) i":
+double: 1
+float: 1
+idouble: 1
+ifloat: 1
+Test "Real part of: clog10 (-2 - 3 i) == 0.556971676153418384603252578971164214 - 0.937554462986374708541507952140189646 i":
+ildouble: 1
+ldouble: 1
+Test "Imaginary part of: clog10 (-2 - 3 i) == 0.556971676153418384603252578971164214 - 0.937554462986374708541507952140189646 i":
+double: 1
+float: 5
+idouble: 1
+ifloat: 5
+ildouble: 1
+ldouble: 1
+Test "Imaginary part of: clog10 (-3 + inf i) == inf + pi/2*log10(e) i":
+double: 1
+float: 1
+idouble: 1
+ifloat: 1
+Test "Imaginary part of: clog10 (-3 - inf i) == inf - pi/2*log10(e) i":
+double: 1
+float: 1
+idouble: 1
+ifloat: 1
+Test "Imaginary part of: clog10 (-inf + 0 i) == inf + pi*log10(e) i":
+double: 1
+float: 1
+idouble: 1
+ifloat: 1
+Test "Imaginary part of: clog10 (-inf + 1 i) == inf + pi*log10(e) i":
+double: 1
+float: 1
+idouble: 1
+ifloat: 1
+Test "Imaginary part of: clog10 (-inf + inf i) == inf + 3/4 pi*log10(e) i":
+double: 1
+idouble: 1
+Test "Imaginary part of: clog10 (-inf - 0 i) == inf - pi*log10(e) i":
+double: 1
+float: 1
+idouble: 1
+ifloat: 1
+Test "Imaginary part of: clog10 (-inf - 1 i) == inf - pi*log10(e) i":
+double: 1
+float: 1
+idouble: 1
+ifloat: 1
+Test "Imaginary part of: clog10 (0 + inf i) == inf + pi/2*log10(e) i":
+double: 1
+float: 1
+idouble: 1
+ifloat: 1
+Test "Imaginary part of: clog10 (0 - inf i) == inf - pi/2*log10(e) i":
+double: 1
+float: 1
+idouble: 1
+ifloat: 1
+Test "Real part of: clog10 (0.75 + 1.25 i) == 0.163679467193165171449476605077428975 + 0.447486970040493067069984724340855636 i":
+float: 1
+ifloat: 1
+Test "Imaginary part of: clog10 (0.75 + 1.25 i) == 0.163679467193165171449476605077428975 + 0.447486970040493067069984724340855636 i":
+ildouble: 1
+ldouble: 1
+Test "Imaginary part of: clog10 (3 + inf i) == inf + pi/2*log10(e) i":
+double: 1
+float: 1
+idouble: 1
+ifloat: 1
+Test "Imaginary part of: clog10 (3 - inf i) == inf - pi/2*log10(e) i":
+double: 1
+float: 1
+idouble: 1
+ifloat: 1
+Test "Imaginary part of: clog10 (inf + inf i) == inf + pi/4*log10(e) i":
+double: 1
+float: 1
+idouble: 1
+ifloat: 1
+Test "Imaginary part of: clog10 (inf - inf i) == inf - pi/4*log10(e) i":
+double: 1
+float: 1
+idouble: 1
+ifloat: 1
+
+# cos
+Test "cos (M_PI_6l * 2.0) == 0.5":
+double: 1
+float: 1
+idouble: 1
+ifloat: 1
+ildouble: 1
+ldouble: 1
+Test "cos (M_PI_6l * 4.0) == -0.5":
+double: 2
+float: 1
+idouble: 2
+ifloat: 1
+ildouble: 1
+ldouble: 1
+Test "cos (pi/2) == 0":
+double: 1
+float: 1
+idouble: 1
+ifloat: 1
+
+# cpow
+Test "Real part of: cpow (0.75 + 1.25 i, 0.0 + 1.0 i) == 0.331825439177608832276067945276730566 + 0.131338600281188544930936345230903032 i":
+float: 1
+ifloat: 1
+Test "Imaginary part of: cpow (0.75 + 1.25 i, 0.0 + 1.0 i) == 0.331825439177608832276067945276730566 + 0.131338600281188544930936345230903032 i":
+float: 1
+ifloat: 1
+Test "Real part of: cpow (0.75 + 1.25 i, 0.75 + 1.25 i) == 0.117506293914473555420279832210420483 + 0.346552747708338676483025352060418001 i":
+double: 1
+float: 4
+idouble: 1
+ifloat: 4
+ildouble: 4
+ldouble: 4
+Test "Real part of: cpow (0.75 + 1.25 i, 1.0 + 0.0 i) == 0.75 + 1.25 i":
+ildouble: 2
+ldouble: 2
+Test "Imaginary part of: cpow (0.75 + 1.25 i, 1.0 + 0.0 i) == 0.75 + 1.25 i":
+ildouble: 1
+ldouble: 1
+Test "Real part of: cpow (0.75 + 1.25 i, 1.0 + 1.0 i) == 0.0846958290317209430433805274189191353 + 0.513285749182902449043287190519090481 i":
+double: 2
+float: 3
+idouble: 2
+ifloat: 3
+ildouble: 10
+ldouble: 10
+Test "Real part of: cpow (2 + 0 i, 10 + 0 i) == 1024.0 + 0.0 i":
+ildouble: 2
+ldouble: 2
+Test "Real part of: cpow (2 + 3 i, 4 + 0 i) == -119.0 - 120.0 i":
+double: 1
+float: 4
+idouble: 1
+ifloat: 4
+ildouble: 3
+ldouble: 3
+Test "Imaginary part of: cpow (2 + 3 i, 4 + 0 i) == -119.0 - 120.0 i":
+float: 2
+ifloat: 2
+Test "Imaginary part of: cpow (e + 0 i, 0 + 2 * M_PIl i) == 1.0 + 0.0 i":
+double: 2
+float: 2
+idouble: 2
+ifloat: 2
+ildouble: 1
+ldouble: 1
+
+# csin
+Test "Imaginary part of: csin (-2 - 3 i) == -9.15449914691142957346729954460983256 + 4.16890695996656435075481305885375484 i":
+ildouble: 1
+ldouble: 1
+Test "Real part of: csin (0.75 + 1.25 i) == 1.28722291002649188575873510790565441 + 1.17210635989270256101081285116138863 i":
+ildouble: 1
+ldouble: 1
+
+# csinh
+Test "Real part of: csinh (-2 - 3 i) == 3.59056458998577995201256544779481679 - 0.530921086248519805267040090660676560 i":
+ildouble: 1
+ldouble: 1
+Test "Imaginary part of: csinh (-2 - 3 i) == 3.59056458998577995201256544779481679 - 0.530921086248519805267040090660676560 i":
+double: 1
+idouble: 1
+Test "Real part of: csinh (0.75 + 1.25 i) == 0.259294854551162779153349830618433028 + 1.22863452409509552219214606515777594 i":
+float: 1
+ifloat: 1
+Test "Imaginary part of: csinh (0.75 + 1.25 i) == 0.259294854551162779153349830618433028 + 1.22863452409509552219214606515777594 i":
+float: 1
+ifloat: 1
+
+# csqrt
+Test "Real part of: csqrt (-2 + 3 i) == 0.89597747612983812471573375529004348 + 1.6741492280355400404480393008490519 i":
+float: 1
+ifloat: 1
+ildouble: 1
+ldouble: 1
+Test "Real part of: csqrt (-2 - 3 i) == 0.89597747612983812471573375529004348 - 1.6741492280355400404480393008490519 i":
+float: 1
+ifloat: 1
+ildouble: 1
+ldouble: 1
+Test "Imaginary part of: csqrt (0.75 + 1.25 i) == 1.05065169626078392338656675760808326 + 0.594868882070379067881984030639932657 i":
+ildouble: 1
+ldouble: 1
+
+# ctan
+Test "Real part of: ctan (-2 - 3 i) == 0.376402564150424829275122113032269084e-2 - 1.00323862735360980144635859782192726 i":
+double: 1
+idouble: 1
+ildouble: 1
+ldouble: 1
+Test "Imaginary part of: ctan (-2 - 3 i) == 0.376402564150424829275122113032269084e-2 - 1.00323862735360980144635859782192726 i":
+ildouble: 1
+ldouble: 1
+Test "Imaginary part of: ctan (0.75 + 1.25 i) == 0.160807785916206426725166058173438663 + 0.975363285031235646193581759755216379 i":
+double: 1
+idouble: 1
+ildouble: 2
+ldouble: 2
+
+# ctanh
+Test "Real part of: ctanh (-2 - 3 i) == -0.965385879022133124278480269394560686 + 0.988437503832249372031403430350121098e-2 i":
+double: 1
+float: 2
+idouble: 1
+ifloat: 2
+ildouble: 1
+ldouble: 1
+Test "Imaginary part of: ctanh (-2 - 3 i) == -0.965385879022133124278480269394560686 + 0.988437503832249372031403430350121098e-2 i":
+ildouble: 1
+ldouble: 1
+Test "Imaginary part of: ctanh (0 + pi/4 i) == 0.0 + 1.0 i":
+float: 1
+ifloat: 1
+Test "Real part of: ctanh (0.75 + 1.25 i) == 1.37260757053378320258048606571226857 + 0.385795952609750664177596760720790220 i":
+double: 1
+idouble: 1
+
+# erf
+Test "erf (1.25) == 0.922900128256458230136523481197281140":
+double: 1
+idouble: 1
+
+# erfc
+Test "erfc (0.75) == 0.288844366346484868401062165408589223":
+float: 1
+ifloat: 1
+Test "erfc (2.0) == 0.00467773498104726583793074363274707139":
+double: 1
+idouble: 1
+Test "erfc (27.0) == 0.523704892378925568501606768284954709e-318":
+ildouble: 1
+ldouble: 1
+Test "erfc (4.125) == 0.542340079956506600531223408575531062e-8":
+double: 1
+idouble: 1
+
+# exp10
+Test "exp10 (-1) == 0.1":
+double: 2
+float: 1
+idouble: 2
+ifloat: 1
+Test "exp10 (0.75) == 5.62341325190349080394951039776481231":
+double: 1
+float: 1
+idouble: 1
+ifloat: 1
+Test "exp10 (3) == 1000":
+double: 6
+float: 2
+idouble: 6
+ifloat: 2
+ildouble: 1
+ldouble: 1
+
+# exp2
+Test "exp2 (10) == 1024":
+ildouble: 2
+ldouble: 2
+
+# expm1
+Test "expm1 (0.75) == 1.11700001661267466854536981983709561":
+double: 1
+idouble: 1
+Test "expm1 (1) == M_El - 1.0":
+double: 1
+float: 1
+idouble: 1
+ifloat: 1
+ildouble: 1
+ldouble: 1
+
+# gamma
+Test "gamma (-0.5) == log(2*sqrt(pi))":
+ildouble: 1
+ldouble: 1
+
+# hypot
+Test "hypot (-0.7, -12.4) == 12.419742348374220601176836866763271":
+float: 1
+ifloat: 1
+Test "hypot (-0.7, 12.4) == 12.419742348374220601176836866763271":
+float: 1
+ifloat: 1
+Test "hypot (-12.4, -0.7) == 12.419742348374220601176836866763271":
+float: 1
+ifloat: 1
+Test "hypot (-12.4, 0.7) == 12.419742348374220601176836866763271":
+float: 1
+ifloat: 1
+Test "hypot (0.7, -12.4) == 12.419742348374220601176836866763271":
+float: 1
+ifloat: 1
+Test "hypot (0.7, 12.4) == 12.419742348374220601176836866763271":
+float: 1
+ifloat: 1
+Test "hypot (12.4, -0.7) == 12.419742348374220601176836866763271":
+float: 1
+ifloat: 1
+Test "hypot (12.4, 0.7) == 12.419742348374220601176836866763271":
+float: 1
+ifloat: 1
+
+# j0
+Test "j0 (-4.0) == -3.9714980986384737228659076845169804197562E-1":
+double: 1
+float: 2
+idouble: 1
+ifloat: 2
+Test "j0 (0.75) == 0.864242275166648623555731103820923211":
+float: 1
+ifloat: 1
+Test "j0 (10.0) == -0.245935764451348335197760862485328754":
+double: 3
+float: 1
+idouble: 3
+ifloat: 1
+ildouble: 2
+ldouble: 2
+Test "j0 (2.0) == 0.223890779141235668051827454649948626":
+float: 2
+ifloat: 2
+ildouble: 2
+ldouble: 2
+Test "j0 (4.0) == -3.9714980986384737228659076845169804197562E-1":
+double: 1
+float: 2
+idouble: 1
+ifloat: 2
+Test "j0 (8.0) == 0.171650807137553906090869407851972001":
+float: 1
+ifloat: 1
+ildouble: 1
+ldouble: 1
+
+# j1
+Test "j1 (-1.0) == -0.440050585744933515959682203718914913":
+ildouble: 1
+ldouble: 1
+Test "j1 (0.75) == 0.349243602174862192523281016426251335":
+ildouble: 1
+ldouble: 1
+Test "j1 (1.0) == 0.440050585744933515959682203718914913":
+ildouble: 1
+ldouble: 1
+Test "j1 (10.0) == 0.0434727461688614366697487680258592883":
+float: 2
+ifloat: 2
+ildouble: 2
+ldouble: 2
+Test "j1 (2.0) == 0.576724807756873387202448242269137087":
+double: 1
+idouble: 1
+Test "j1 (8.0) == 0.234636346853914624381276651590454612":
+double: 1
+idouble: 1
+ildouble: 4
+ldouble: 4
+
+# jn
+Test "jn (0, -4.0) == -3.9714980986384737228659076845169804197562E-1":
+double: 1
+float: 2
+idouble: 1
+ifloat: 2
+Test "jn (0, 0.75) == 0.864242275166648623555731103820923211":
+float: 1
+ifloat: 1
+Test "jn (0, 10.0) == -0.245935764451348335197760862485328754":
+double: 3
+float: 1
+idouble: 3
+ifloat: 1
+ildouble: 2
+ldouble: 2
+Test "jn (0, 2.0) == 0.223890779141235668051827454649948626":
+float: 2
+ifloat: 2
+ildouble: 2
+ldouble: 2
+Test "jn (0, 4.0) == -3.9714980986384737228659076845169804197562E-1":
+double: 1
+float: 2
+idouble: 1
+ifloat: 2
+Test "jn (0, 8.0) == 0.171650807137553906090869407851972001":
+float: 1
+ifloat: 1
+ildouble: 1
+ldouble: 1
+Test "jn (1, -1.0) == -0.440050585744933515959682203718914913":
+ildouble: 1
+ldouble: 1
+Test "jn (1, 0.75) == 0.349243602174862192523281016426251335":
+ildouble: 1
+ldouble: 1
+Test "jn (1, 1.0) == 0.440050585744933515959682203718914913":
+ildouble: 1
+ldouble: 1
+Test "jn (1, 10.0) == 0.0434727461688614366697487680258592883":
+float: 2
+ifloat: 2
+ildouble: 2
+ldouble: 2
+Test "jn (1, 2.0) == 0.576724807756873387202448242269137087":
+double: 1
+idouble: 1
+Test "jn (1, 8.0) == 0.234636346853914624381276651590454612":
+double: 1
+idouble: 1
+ildouble: 4
+ldouble: 4
+Test "jn (10, -1.0) == 0.263061512368745320699785368779050294e-9":
+ildouble: 1
+ldouble: 1
+Test "jn (10, 0.125) == 0.250543369809369890173993791865771547e-18":
+double: 1
+float: 1
+idouble: 1
+ifloat: 1
+ildouble: 1
+ldouble: 1
+Test "jn (10, 0.75) == 0.149621713117596814698712483621682835e-10":
+double: 1
+float: 1
+idouble: 1
+ifloat: 1
+ildouble: 1
+ldouble: 1
+Test "jn (10, 1.0) == 0.263061512368745320699785368779050294e-9":
+ildouble: 1
+ldouble: 1
+Test "jn (10, 10.0) == 0.207486106633358857697278723518753428":
+double: 4
+float: 3
+idouble: 4
+ifloat: 3
+ildouble: 2
+ldouble: 2
+Test "jn (10, 2.0) == 0.251538628271673670963516093751820639e-6":
+float: 4
+ifloat: 4
+Test "jn (3, 0.125) == 0.406503832554912875023029337653442868e-4":
+double: 1
+float: 1
+idouble: 1
+ifloat: 1
+Test "jn (3, 0.75) == 0.848438342327410884392755236884386804e-2":
+double: 1
+float: 1
+idouble: 1
+ifloat: 1
+Test "jn (3, 10.0) == 0.0583793793051868123429354784103409563":
+double: 3
+float: 2
+idouble: 3
+ifloat: 2
+ildouble: 2
+ldouble: 2
+Test "jn (3, 2.0) == 0.128943249474402051098793332969239835":
+double: 1
+float: 2
+idouble: 1
+ifloat: 2
+
+# lgamma
+Test "lgamma (-0.5) == log(2*sqrt(pi))":
+ildouble: 1
+ldouble: 1
+Test "lgamma (0.7) == 0.260867246531666514385732417016759578":
+double: 1
+float: 1
+idouble: 1
+ifloat: 1
+ildouble: 1
+ldouble: 1
+Test "lgamma (1.2) == -0.853740900033158497197028392998854470e-1":
+double: 1
+float: 2
+idouble: 1
+ifloat: 2
+ildouble: 1
+ldouble: 1
+
+# log10
+Test "log10 (0.75) == -0.124938736608299953132449886193870744":
+double: 1
+float: 2
+idouble: 1
+ifloat: 2
+Test "log10 (e) == log10(e)":
+float: 1
+ifloat: 1
+ildouble: 1
+ldouble: 1
+
+# log1p
+Test "log1p (-0.25) == -0.287682072451780927439219005993827432":
+float: 1
+ifloat: 1
+
+# log2
+Test "log2 (0.75) == -.415037499278843818546261056052183492":
+ildouble: 1
+ldouble: 1
+
+# sincos
+Test "sincos (M_PI_6l*2.0, &sin_res, &cos_res) puts 0.5 in cos_res":
+double: 1
+float: 1
+idouble: 1
+ifloat: 1
+ildouble: 1
+ldouble: 1
+Test "sincos (M_PI_6l*2.0, &sin_res, &cos_res) puts 0.86602540378443864676372317075293616 in sin_res":
+double: 1
+float: 1
+idouble: 1
+ifloat: 1
+ildouble: 1
+ldouble: 1
+Test "sincos (pi/2, &sin_res, &cos_res) puts 0 in cos_res":
+double: 1
+float: 1
+idouble: 1
+ifloat: 1
+Test "sincos (pi/6, &sin_res, &cos_res) puts 0.86602540378443864676372317075293616 in cos_res":
+float: 1
+ifloat: 1
+
+# sqrt
+Test "sqrt (2) == M_SQRT2l":
+ildouble: 1
+ldouble: 1
+
+# tan
+Test "tan (pi/4) == 1":
+double: 1
+idouble: 1
+
+# tanh
+Test "tanh (-0.75) == -0.635148952387287319214434357312496495":
+ildouble: 1
+ldouble: 1
+Test "tanh (-1.0) == -0.7615941559557648881194582826047935904":
+ildouble: 1
+ldouble: 1
+Test "tanh (0.75) == 0.635148952387287319214434357312496495":
+ildouble: 1
+ldouble: 1
+Test "tanh (1.0) == 0.7615941559557648881194582826047935904":
+ildouble: 1
+ldouble: 1
+
+# tgamma
+Test "tgamma (-0.5) == -2 sqrt (pi)":
+double: 1
+float: 1
+idouble: 1
+ifloat: 1
+ildouble: 1
+ldouble: 1
+Test "tgamma (0.5) == sqrt (pi)":
+float: 1
+ifloat: 1
+Test "tgamma (0.7) == 1.29805533264755778568117117915281162":
+double: 1
+float: 1
+idouble: 1
+ifloat: 1
+Test "tgamma (4) == 6":
+ildouble: 1
+ldouble: 1
+
+# y0
+Test "y0 (1.0) == 0.0882569642156769579829267660235151628":
+double: 2
+float: 1
+idouble: 2
+ifloat: 1
+Test "y0 (1.5) == 0.382448923797758843955068554978089862":
+double: 2
+float: 1
+idouble: 2
+ifloat: 1
+Test "y0 (10.0) == 0.0556711672835993914244598774101900481":
+double: 1
+float: 1
+idouble: 1
+ifloat: 1
+ildouble: 3
+ldouble: 3
+Test "y0 (2.0) == 0.510375672649745119596606592727157873":
+double: 1
+idouble: 1
+Test "y0 (8.0) == 0.223521489387566220527323400498620359":
+double: 1
+float: 1
+idouble: 1
+ifloat: 1
+ildouble: 3
+ldouble: 3
+
+# y1
+Test "y1 (0.125) == -5.19993611253477499595928744876579921":
+double: 1
+idouble: 1
+Test "y1 (0.75) == -1.03759455076928541973767132140642198":
+ildouble: 1
+ldouble: 1
+Test "y1 (1.5) == -0.412308626973911295952829820633445323":
+double: 1
+float: 1
+idouble: 1
+ifloat: 1
+ildouble: 1
+ldouble: 1
+Test "y1 (10.0) == 0.249015424206953883923283474663222803":
+double: 3
+float: 1
+idouble: 3
+ifloat: 1
+Test "y1 (2.0) == -0.107032431540937546888370772277476637":
+double: 1
+float: 1
+idouble: 1
+ifloat: 1
+ildouble: 1
+ldouble: 1
+Test "y1 (8.0) == -0.158060461731247494255555266187483550":
+double: 1
+float: 2
+idouble: 1
+ifloat: 2
+ildouble: 1
+ldouble: 1
+
+# yn
+Test "yn (0, 1.0) == 0.0882569642156769579829267660235151628":
+double: 2
+float: 1
+idouble: 2
+ifloat: 1
+Test "yn (0, 1.5) == 0.382448923797758843955068554978089862":
+double: 2
+float: 1
+idouble: 2
+ifloat: 1
+Test "yn (0, 10.0) == 0.0556711672835993914244598774101900481":
+double: 1
+float: 1
+idouble: 1
+ifloat: 1
+ildouble: 3
+ldouble: 3
+Test "yn (0, 2.0) == 0.510375672649745119596606592727157873":
+double: 1
+idouble: 1
+Test "yn (0, 8.0) == 0.223521489387566220527323400498620359":
+double: 1
+float: 1
+idouble: 1
+ifloat: 1
+ildouble: 3
+ldouble: 3
+Test "yn (1, 0.125) == -5.19993611253477499595928744876579921":
+double: 1
+idouble: 1
+Test "yn (1, 0.75) == -1.03759455076928541973767132140642198":
+ildouble: 1
+ldouble: 1
+Test "yn (1, 1.5) == -0.412308626973911295952829820633445323":
+double: 1
+float: 1
+idouble: 1
+ifloat: 1
+ildouble: 1
+ldouble: 1
+Test "yn (1, 10.0) == 0.249015424206953883923283474663222803":
+double: 3
+float: 1
+idouble: 3
+ifloat: 1
+Test "yn (1, 2.0) == -0.107032431540937546888370772277476637":
+double: 1
+float: 1
+idouble: 1
+ifloat: 1
+ildouble: 1
+ldouble: 1
+Test "yn (1, 8.0) == -0.158060461731247494255555266187483550":
+double: 1
+float: 2
+idouble: 1
+ifloat: 2
+ildouble: 1
+ldouble: 1
+Test "yn (10, 0.125) == -127057845771019398.252538486899753195":
+double: 1
+idouble: 1
+ildouble: 2
+ldouble: 2
+Test "yn (10, 0.75) == -2133501638.90573424452445412893839236":
+double: 1
+float: 2
+idouble: 1
+ifloat: 2
+ildouble: 5
+ldouble: 5
+Test "yn (10, 1.0) == -121618014.278689189288130426667971145":
+double: 1
+float: 2
+idouble: 1
+ifloat: 2
+ildouble: 1
+ldouble: 1
+Test "yn (10, 10.0) == -0.359814152183402722051986577343560609":
+double: 2
+float: 2
+idouble: 2
+ifloat: 2
+ildouble: 2
+ldouble: 2
+Test "yn (10, 2.0) == -129184.542208039282635913145923304214":
+double: 3
+float: 1
+idouble: 3
+ifloat: 1
+ildouble: 2
+ldouble: 2
+Test "yn (3, 0.125) == -2612.69757350066712600220955744091741":
+double: 1
+idouble: 1
+Test "yn (3, 0.75) == -12.9877176234475433186319774484809207":
+double: 1
+float: 1
+idouble: 1
+ifloat: 1
+ildouble: 2
+ldouble: 2
+Test "yn (3, 10.0) == -0.251362657183837329779204747654240998":
+double: 1
+float: 1
+idouble: 1
+ifloat: 1
+ildouble: 1
+ldouble: 1
+Test "yn (3, 2.0) == -1.12778377684042778608158395773179238":
+double: 1
+idouble: 1
+
+# Maximal error of functions:
+Function: "atan2":
+float: 1
+ifloat: 1
+ildouble: 1
+ldouble: 1
+
+Function: "atanh":
+float: 1
+ifloat: 1
+
+Function: Imaginary part of "cacos":
+ildouble: 1
+ldouble: 1
+
+Function: Real part of "cacosh":
+double: 1
+float: 7
+idouble: 1
+ifloat: 7
+
+Function: Imaginary part of "cacosh":
+double: 1
+float: 3
+idouble: 1
+ifloat: 3
+ildouble: 1
+ldouble: 1
+
+Function: Real part of "casin":
+double: 1
+float: 1
+idouble: 1
+ifloat: 1
+
+Function: Imaginary part of "casin":
+ildouble: 1
+ldouble: 1
+
+Function: Real part of "casinh":
+double: 5
+float: 1
+idouble: 5
+ifloat: 1
+ildouble: 4
+ldouble: 4
+
+Function: Imaginary part of "casinh":
+double: 3
+float: 6
+idouble: 3
+ifloat: 6
+ildouble: 2
+ldouble: 2
+
+Function: Real part of "catan":
+float: 4
+ifloat: 4
+
+Function: Imaginary part of "catan":
+double: 1
+float: 1
+idouble: 1
+ifloat: 1
+ildouble: 1
+ldouble: 1
+
+Function: Real part of "catanh":
+double: 4
+idouble: 4
+ildouble: 1
+ldouble: 1
+
+Function: Imaginary part of "catanh":
+float: 6
+ifloat: 6
+ildouble: 1
+ldouble: 1
+
+Function: "cbrt":
+double: 1
+idouble: 1
+ildouble: 1
+ldouble: 1
+
+Function: Real part of "ccos":
+double: 1
+float: 1
+idouble: 1
+ifloat: 1
+ildouble: 1
+ldouble: 1
+
+Function: Imaginary part of "ccos":
+float: 1
+ifloat: 1
+ildouble: 1
+ldouble: 1
+
+Function: Real part of "ccosh":
+double: 1
+float: 1
+idouble: 1
+ifloat: 1
+ildouble: 1
+ldouble: 1
+
+Function: Imaginary part of "ccosh":
+float: 1
+ifloat: 1
+ildouble: 1
+ldouble: 1
+
+Function: Real part of "cexp":
+float: 1
+ifloat: 1
+ildouble: 1
+ldouble: 1
+
+Function: Imaginary part of "cexp":
+float: 1
+ifloat: 1
+ildouble: 1
+ldouble: 1
+
+Function: Real part of "clog":
+float: 1
+ifloat: 1
+ildouble: 1
+ldouble: 1
+
+Function: Imaginary part of "clog":
+float: 3
+ifloat: 3
+
+Function: Real part of "clog10":
+float: 1
+ifloat: 1
+ildouble: 1
+ldouble: 1
+
+Function: Imaginary part of "clog10":
+double: 1
+float: 5
+idouble: 1
+ifloat: 5
+ildouble: 1
+ldouble: 1
+
+Function: "cos":
+double: 2
+float: 1
+idouble: 2
+ifloat: 1
+ildouble: 1
+ldouble: 1
+
+Function: Real part of "cpow":
+double: 2
+float: 4
+idouble: 2
+ifloat: 4
+ildouble: 10
+ldouble: 10
+
+Function: Imaginary part of "cpow":
+double: 2
+float: 2
+idouble: 2
+ifloat: 2
+ildouble: 1
+ldouble: 1
+
+Function: Real part of "csin":
+ildouble: 1
+ldouble: 1
+
+Function: Imaginary part of "csin":
+ildouble: 1
+ldouble: 1
+
+Function: Real part of "csinh":
+float: 1
+ifloat: 1
+ildouble: 1
+ldouble: 1
+
+Function: Imaginary part of "csinh":
+double: 1
+float: 1
+idouble: 1
+ifloat: 1
+
+Function: Real part of "csqrt":
+float: 1
+ifloat: 1
+ildouble: 1
+ldouble: 1
+
+Function: Imaginary part of "csqrt":
+ildouble: 1
+ldouble: 1
+
+Function: Real part of "ctan":
+double: 1
+idouble: 1
+ildouble: 1
+ldouble: 1
+
+Function: Imaginary part of "ctan":
+double: 1
+idouble: 1
+ildouble: 2
+ldouble: 2
+
+Function: Real part of "ctanh":
+double: 1
+float: 2
+idouble: 1
+ifloat: 2
+ildouble: 1
+ldouble: 1
+
+Function: Imaginary part of "ctanh":
+float: 1
+ifloat: 1
+ildouble: 1
+ldouble: 1
+
+Function: "erf":
+double: 1
+idouble: 1
+
+Function: "erfc":
+double: 1
+float: 1
+idouble: 1
+ifloat: 1
+ildouble: 1
+ldouble: 1
+
+Function: "exp10":
+double: 6
+float: 2
+idouble: 6
+ifloat: 2
+ildouble: 1
+ldouble: 1
+
+Function: "exp2":
+ildouble: 2
+ldouble: 2
+
+Function: "expm1":
+double: 1
+float: 1
+idouble: 1
+ifloat: 1
+ildouble: 1
+ldouble: 1
+
+Function: "gamma":
+ildouble: 1
+ldouble: 1
+
+Function: "hypot":
+float: 1
+ifloat: 1
+
+Function: "j0":
+double: 3
+float: 2
+idouble: 3
+ifloat: 2
+ildouble: 2
+ldouble: 2
+
+Function: "j1":
+double: 1
+float: 2
+idouble: 1
+ifloat: 2
+ildouble: 4
+ldouble: 4
+
+Function: "jn":
+double: 4
+float: 4
+idouble: 4
+ifloat: 4
+ildouble: 4
+ldouble: 4
+
+Function: "lgamma":
+double: 1
+float: 2
+idouble: 1
+ifloat: 2
+ildouble: 1
+ldouble: 1
+
+Function: "log10":
+double: 1
+float: 2
+idouble: 1
+ifloat: 2
+ildouble: 1
+ldouble: 1
+
+Function: "log1p":
+float: 1
+ifloat: 1
+ildouble: 1
+ldouble: 1
+
+Function: "log2":
+ildouble: 1
+ldouble: 1
+
+Function: "sincos":
+double: 1
+float: 1
+idouble: 1
+ifloat: 1
+ildouble: 1
+ldouble: 1
+
+Function: "sqrt":
+ildouble: 1
+ldouble: 1
+
+Function: "tan":
+double: 1
+idouble: 1
+
+Function: "tanh":
+ildouble: 1
+ldouble: 1
+
+Function: "tgamma":
+double: 1
+float: 1
+idouble: 1
+ifloat: 1
+ildouble: 1
+ldouble: 1
+
+Function: "y0":
+double: 2
+float: 1
+idouble: 2
+ifloat: 1
+ildouble: 3
+ldouble: 3
+
+Function: "y1":
+double: 3
+float: 2
+idouble: 3
+ifloat: 2
+ildouble: 1
+ldouble: 1
+
+Function: "yn":
+double: 3
+float: 2
+idouble: 3
+ifloat: 2
+ildouble: 5
+ldouble: 5
+
+# end of automatic generation
diff --git a/ap/build/uClibc/test/math/libm-test-ulps-sh4 b/ap/build/uClibc/test/math/libm-test-ulps-sh4
new file mode 100644
index 0000000..4831f48
--- /dev/null
+++ b/ap/build/uClibc/test/math/libm-test-ulps-sh4
@@ -0,0 +1,1094 @@
+# Begin of automatic generation
+
+# asin
+Test "asin (-0.5) == -pi/6":
+float: 2
+ifloat: 2
+Test "asin (0.5) == pi/6":
+float: 2
+ifloat: 2
+Test "asin (0.7) == 0.7753974966107530637":
+double: 1
+float: 2
+idouble: 1
+ifloat: 2
+
+# atan2
+Test "atan2 (0.7, -1.0) == 2.530866689200584621918884506789267":
+float: 3
+ifloat: 3
+Test "atan2 (-0.7, -1.0) == -2.530866689200584621918884506789267":
+float: 3
+ifloat: 3
+Test "atan2 (1.4, -0.93) == 2.1571487668237843754887415992772736":
+float: 4
+ifloat: 4
+
+# atanh
+Test "atanh (0.7) == 0.8673005276940531944":
+double: 1
+idouble: 1
+
+# cabs
+Test "cabs (-0.7 + 12.4 i) == 12.419742348374220601176836866763271":
+float: 1
+ifloat: 1
+Test "cabs (-0.7 - 12.4 i) == 12.419742348374220601176836866763271":
+float: 1
+ifloat: 1
+Test "cabs (-12.4 + 0.7 i) == 12.419742348374220601176836866763271":
+float: 1
+ifloat: 1
+Test "cabs (-12.4 - 0.7 i) == 12.419742348374220601176836866763271":
+float: 1
+ifloat: 1
+Test "cabs (0.7 + 1.2 i) == 1.3892443989449804508432547041028554":
+double: 1
+idouble: 1
+Test "cabs (0.7 + 12.4 i) == 12.419742348374220601176836866763271":
+float: 1
+ifloat: 1
+
+# cacos
+Test "Real part of: cacos (0.7 + 1.2 i) == 1.1351827477151551088992008271819053 - 1.0927647857577371459105272080819308 i":
+double: 1
+float: 1
+idouble: 1
+ifloat: 1
+Test "Imaginary part of: cacos (0.7 + 1.2 i) == 1.1351827477151551088992008271819053 - 1.0927647857577371459105272080819308 i":
+float: 1
+ifloat: 1
+
+# cacosh
+Test "Real part of: cacosh (-2 - 3 i) == 1.9833870299165354323470769028940395 - 2.1414491111159960199416055713254211 i":
+double: 1
+float: 7
+idouble: 1
+ifloat: 7
+Test "Imaginary part of: cacosh (-2 - 3 i) == 1.9833870299165354323470769028940395 - 2.1414491111159960199416055713254211 i":
+double: 1
+float: 3
+idouble: 1
+ifloat: 3
+Test "Real part of: cacosh (0.7 + 1.2 i) == 1.0927647857577371459105272080819308 + 1.1351827477151551088992008271819053 i":
+double: 1
+float: 1
+idouble: 1
+ifloat: 1
+
+# casin
+Test "Real part of: casin (0.7 + 1.2 i) == 0.4356135790797415103321208644578462 + 1.0927647857577371459105272080819308 i":
+double: 3
+float: 2
+idouble: 3
+ifloat: 2
+Test "Imaginary part of: casin (0.7 + 1.2 i) == 0.4356135790797415103321208644578462 + 1.0927647857577371459105272080819308 i":
+float: 1
+ifloat: 1
+
+# casinh
+Test "Real part of: casinh (-2 - 3 i) == -1.9686379257930962917886650952454982 - 0.96465850440760279204541105949953237 i":
+double: 5
+float: 1
+idouble: 5
+ifloat: 1
+Test "Imaginary part of: casinh (-2 - 3 i) == -1.9686379257930962917886650952454982 - 0.96465850440760279204541105949953237 i":
+double: 3
+float: 6
+idouble: 3
+ifloat: 6
+Test "Real part of: casinh (0.7 + 1.2 i) == 0.97865459559367387689317593222160964 + 0.91135418953156011567903546856170941 i":
+double: 1
+idouble: 1
+Test "Imaginary part of: casinh (0.7 + 1.2 i) == 0.97865459559367387689317593222160964 + 0.91135418953156011567903546856170941 i":
+float: 1
+ifloat: 1
+
+# catan
+Test "Real part of: catan (-2 - 3 i) == -1.4099210495965755225306193844604208 - 0.22907268296853876629588180294200276 i":
+float: 3
+ifloat: 3
+Test "Imaginary part of: catan (-2 - 3 i) == -1.4099210495965755225306193844604208 - 0.22907268296853876629588180294200276 i":
+double: 1
+float: 1
+idouble: 1
+ifloat: 1
+Test "Real part of: catan (0.7 + 1.2 i) == 1.0785743834118921877443707996386368 + 0.57705737765343067644394541889341712 i":
+float: 4
+ifloat: 4
+Test "Imaginary part of: catan (0.7 + 1.2 i) == 1.0785743834118921877443707996386368 + 0.57705737765343067644394541889341712 i":
+double: 1
+idouble: 1
+
+# catanh
+Test "Real part of: catanh (-2 - 3 i) == -0.14694666622552975204743278515471595 - 1.3389725222944935611241935759091443 i":
+double: 4
+idouble: 4
+Test "Imaginary part of: catanh (-2 - 3 i) == -0.14694666622552975204743278515471595 - 1.3389725222944935611241935759091443 i":
+float: 4
+ifloat: 4
+Test "Real part of: catanh (0.7 + 1.2 i) == 0.2600749516525135959200648705635915 + 0.97024030779509898497385130162655963 i":
+float: 1
+ifloat: 1
+Test "Imaginary part of: catanh (0.7 + 1.2 i) == 0.2600749516525135959200648705635915 + 0.97024030779509898497385130162655963 i":
+double: 1
+float: 6
+idouble: 1
+ifloat: 6
+
+# cbrt
+Test "cbrt (-27.0) == -3.0":
+double: 1
+idouble: 1
+Test "cbrt (0.970299) == 0.99":
+double: 1
+idouble: 1
+
+# ccos
+Test "Imaginary part of: ccos (-2 - 3 i) == -4.18962569096880723013255501961597373 - 9.10922789375533659797919726277886212 i":
+float: 1
+ifloat: 1
+Test "Real part of: ccos (0.7 + 1.2 i) == 1.3848657645312111080 - 0.97242170335830028619 i":
+double: 1
+idouble: 1
+Test "Imaginary part of: ccos (0.7 + 1.2 i) == 1.3848657645312111080 - 0.97242170335830028619 i":
+double: 1
+idouble: 1
+
+# ccosh
+Test "Real part of: ccosh (-2 - 3 i) == -3.72454550491532256547397070325597253 + 0.511822569987384608834463849801875634 i":
+float: 1
+ifloat: 1
+Test "Imaginary part of: ccosh (-2 - 3 i) == -3.72454550491532256547397070325597253 + 0.511822569987384608834463849801875634 i":
+float: 1
+ifloat: 1
+Test "Real part of: ccosh (0.7 + 1.2 i) == 0.4548202223691477654 + 0.7070296600921537682 i":
+double: 1
+float: 1
+idouble: 1
+ifloat: 1
+Test "Imaginary part of: ccosh (0.7 + 1.2 i) == 0.4548202223691477654 + 0.7070296600921537682 i":
+double: 1
+idouble: 1
+
+# cexp
+Test "Imaginary part of: cexp (-2.0 - 3.0 i) == -0.13398091492954261346140525546115575 - 0.019098516261135196432576240858800925 i":
+float: 1
+ifloat: 1
+Test "Real part of: cexp (0.7 + 1.2 i) == 0.7296989091503236012 + 1.8768962328348102821 i":
+double: 1
+float: 1
+idouble: 1
+ifloat: 1
+Test "Imaginary part of: cexp (0.7 + 1.2 i) == 0.7296989091503236012 + 1.8768962328348102821 i":
+float: 1
+ifloat: 1
+
+# clog
+Test "Imaginary part of: clog (-2 - 3 i) == 1.2824746787307683680267437207826593 - 2.1587989303424641704769327722648368 i":
+double: 1
+float: 3
+idouble: 1
+ifloat: 3
+
+# clog10
+Test "Imaginary part of: clog10 (-0 + inf i) == inf + pi/2*log10(e) i":
+float: 1
+ifloat: 1
+Test "Imaginary part of: clog10 (-0 - inf i) == inf - pi/2*log10(e) i":
+float: 1
+ifloat: 1
+Test "Imaginary part of: clog10 (-2 - 3 i) == 0.556971676153418384603252578971164214 - 0.937554462986374708541507952140189646 i":
+double: 1
+float: 5
+idouble: 1
+ifloat: 5
+Test "Imaginary part of: clog10 (-3 + inf i) == inf + pi/2*log10(e) i":
+float: 1
+ifloat: 1
+Test "Imaginary part of: clog10 (-3 - inf i) == inf - pi/2*log10(e) i":
+float: 1
+ifloat: 1
+Test "Imaginary part of: clog10 (-inf + 0 i) == inf + pi*log10(e) i":
+float: 1
+ifloat: 1
+Test "Imaginary part of: clog10 (-inf + 1 i) == inf + pi*log10(e) i":
+float: 1
+ifloat: 1
+Test "Imaginary part of: clog10 (-inf - 0 i) == inf - pi*log10(e) i":
+float: 1
+ifloat: 1
+Test "Imaginary part of: clog10 (-inf - 1 i) == inf - pi*log10(e) i":
+float: 1
+ifloat: 1
+Test "Imaginary part of: clog10 (0 + inf i) == inf + pi/2*log10(e) i":
+float: 1
+ifloat: 1
+Test "Imaginary part of: clog10 (0 - inf i) == inf - pi/2*log10(e) i":
+float: 1
+ifloat: 1
+Test "Real part of: clog10 (0.7 + 1.2 i) == 0.1427786545038868803 + 0.4528483579352493248 i":
+double: 1
+float: 1
+idouble: 1
+ifloat: 1
+Test "Imaginary part of: clog10 (0.7 + 1.2 i) == 0.1427786545038868803 + 0.4528483579352493248 i":
+double: 1
+idouble: 1
+Test "Imaginary part of: clog10 (3 + inf i) == inf + pi/2*log10(e) i":
+float: 1
+ifloat: 1
+Test "Imaginary part of: clog10 (3 - inf i) == inf - pi/2*log10(e) i":
+float: 1
+ifloat: 1
+Test "Imaginary part of: clog10 (inf + inf i) == inf + pi/4*log10(e) i":
+float: 1
+ifloat: 1
+Test "Imaginary part of: clog10 (inf - inf i) == inf - pi/4*log10(e) i":
+float: 1
+ifloat: 1
+
+# cos
+Test "cos (0.7) == 0.7648421872844884262":
+double: 1
+float: 1
+idouble: 1
+ifloat: 1
+Test "cos (M_PI_6l * 2.0) == 0.5":
+double: 1
+float: 0.5
+idouble: 1
+ifloat: 0.5
+Test "cos (M_PI_6l * 4.0) == -0.5":
+double: 2
+float: 1
+idouble: 2
+ifloat: 1
+Test "cos (pi/2) == 0":
+double: 0.2758
+float: 0.3667
+idouble: 0.2758
+ifloat: 0.3667
+
+# cpow
+Test "Real part of: cpow (2 + 3 i, 4 + 0 i) == -119.0 - 120.0 i":
+double: 1
+float: 4
+idouble: 1
+ifloat: 4
+Test "Imaginary part of: cpow (2 + 3 i, 4 + 0 i) == -119.0 - 120.0 i":
+float: 2
+ifloat: 2
+Test "Imaginary part of: cpow (e + 0 i, 0 + 2 * M_PIl i) == 1.0 + 0.0 i":
+double: 1.1031
+float: 1.5
+idouble: 1.1031
+ifloat: 1.5
+
+# csin
+Test "Imaginary part of: csin (0.7 + 1.2 i) == 1.1664563419657581376 + 1.1544997246948547371 i":
+float: 1
+ifloat: 1
+
+# csinh
+Test "Imaginary part of: csinh (-2 - 3 i) == 3.59056458998577995201256544779481679 - 0.530921086248519805267040090660676560 i":
+double: 1
+idouble: 1
+Test "Real part of: csinh (0.7 + 1.2 i) == 0.27487868678117583582 + 1.1698665727426565139 i":
+float: 1
+ifloat: 1
+Test "Imaginary part of: csinh (0.7 + 1.2 i) == 0.27487868678117583582 + 1.1698665727426565139 i":
+float: 1
+ifloat: 1
+
+# csqrt
+Test "Real part of: csqrt (-2 + 3 i) == 0.89597747612983812471573375529004348 + 1.6741492280355400404480393008490519 i":
+float: 1
+ifloat: 1
+Test "Real part of: csqrt (-2 - 3 i) == 0.89597747612983812471573375529004348 - 1.6741492280355400404480393008490519 i":
+float: 1
+ifloat: 1
+Test "Real part of: csqrt (0.7 + 1.2 i) == 1.022067610030026450706487883081139 + 0.58704531296356521154977678719838035 i":
+double: 1
+float: 1
+idouble: 1
+ifloat: 1
+Test "Imaginary part of: csqrt (0.7 + 1.2 i) == 1.022067610030026450706487883081139 + 0.58704531296356521154977678719838035 i":
+float: 1
+ifloat: 1
+
+# ctan
+Test "Real part of: ctan (-2 - 3 i) == 0.376402564150424829275122113032269084e-2 - 1.00323862735360980144635859782192726 i":
+double: 1
+idouble: 1
+Test "Real part of: ctan (0.7 + 1.2 i) == 0.1720734197630349001 + 0.9544807059989405538 i":
+float: 1
+ifloat: 1
+Test "Imaginary part of: ctan (0.7 + 1.2 i) == 0.1720734197630349001 + 0.9544807059989405538 i":
+double: 1
+float: 1
+idouble: 1
+ifloat: 1
+
+# ctanh
+Test "Real part of: ctanh (-2 - 3 i) == -0.965385879022133124278480269394560686 + 0.988437503832249372031403430350121098e-2 i":
+double: 1
+float: 2
+idouble: 1
+ifloat: 2
+Test "Imaginary part of: ctanh (0 + pi/4 i) == 0.0 + 1.0 i":
+float: 1
+ifloat: 1
+Test "Real part of: ctanh (0.7 + 1.2 i) == 1.3472197399061191630 + 0.4778641038326365540 i":
+double: 2
+float: 1
+idouble: 2
+ifloat: 1
+Test "Imaginary part of: ctanh (0.7 + 1.2 i) == 1.3472197399061191630 + 0.4778641038326365540 i":
+double: 2
+float: 1
+idouble: 2
+ifloat: 1
+
+# erfc
+Test "erfc (0.7) == 0.32219880616258152702":
+double: 1
+idouble: 1
+Test "erfc (1.2) == 0.089686021770364619762":
+double: 2
+float: 2
+idouble: 2
+ifloat: 2
+Test "erfc (2.0) == 0.0046777349810472658379":
+double: 1
+idouble: 1
+Test "erfc (4.1) == 0.67000276540848983727e-8":
+double: 24
+float: 12
+idouble: 24
+ifloat: 12
+
+# exp10
+Test "exp10 (-1) == 0.1":
+double: 2
+float: 1
+idouble: 2
+ifloat: 1
+Test "exp10 (0.7) == 5.0118723362727228500":
+float: 1
+ifloat: 1
+Test "exp10 (3) == 1000":
+double: 6
+float: 2
+idouble: 6
+ifloat: 2
+
+# expm1
+Test "expm1 (1) == M_El - 1.0":
+float: 1
+ifloat: 1
+
+# fmod
+Test "fmod (-6.5, -2.3) == -1.9":
+double: 2
+float: 1
+idouble: 2
+ifloat: 1
+Test "fmod (-6.5, 2.3) == -1.9":
+double: 2
+float: 1
+idouble: 2
+ifloat: 1
+Test "fmod (6.5, -2.3) == 1.9":
+double: 2
+float: 1
+idouble: 2
+ifloat: 1
+Test "fmod (6.5, 2.3) == 1.9":
+double: 2
+float: 1
+idouble: 2
+ifloat: 1
+
+# hypot
+Test "hypot (-0.7, -12.4) == 12.419742348374220601176836866763271":
+float: 1
+ifloat: 1
+Test "hypot (-0.7, 12.4) == 12.419742348374220601176836866763271":
+float: 1
+ifloat: 1
+Test "hypot (-12.4, -0.7) == 12.419742348374220601176836866763271":
+float: 1
+ifloat: 1
+Test "hypot (-12.4, 0.7) == 12.419742348374220601176836866763271":
+float: 1
+ifloat: 1
+Test "hypot (0.7, -12.4) == 12.419742348374220601176836866763271":
+float: 1
+ifloat: 1
+Test "hypot (0.7, 1.2) == 1.3892443989449804508432547041028554":
+double: 1
+idouble: 1
+Test "hypot (0.7, 12.4) == 12.419742348374220601176836866763271":
+float: 1
+ifloat: 1
+Test "hypot (12.4, -0.7) == 12.419742348374220601176836866763271":
+float: 1
+ifloat: 1
+Test "hypot (12.4, 0.7) == 12.419742348374220601176836866763271":
+float: 1
+ifloat: 1
+
+# j0
+Test "j0 (10.0) == -0.24593576445134833520":
+double: 2
+float: 1
+idouble: 2
+ifloat: 1
+Test "j0 (2.0) == 0.22389077914123566805":
+float: 2
+ifloat: 2
+Test "j0 (8.0) == 0.17165080713755390609":
+float: 1
+ifloat: 1
+
+# j1
+Test "j1 (10.0) == 0.043472746168861436670":
+float: 2
+ifloat: 2
+Test "j1 (2.0) == 0.57672480775687338720":
+double: 1
+idouble: 1
+Test "j1 (8.0) == 0.23463634685391462438":
+double: 1
+idouble: 1
+
+# jn
+Test "jn (0, 10.0) == -0.24593576445134833520":
+double: 2
+float: 1
+idouble: 2
+ifloat: 1
+Test "jn (0, 2.0) == 0.22389077914123566805":
+float: 2
+ifloat: 2
+Test "jn (0, 8.0) == 0.17165080713755390609":
+float: 1
+ifloat: 1
+Test "jn (1, 10.0) == 0.043472746168861436670":
+float: 2
+ifloat: 2
+Test "jn (1, 2.0) == 0.57672480775687338720":
+double: 1
+idouble: 1
+Test "jn (1, 8.0) == 0.23463634685391462438":
+double: 1
+idouble: 1
+Test "jn (10, 0.1) == 0.26905328954342155795e-19":
+double: 6
+float: 4
+idouble: 6
+ifloat: 4
+Test "jn (10, 0.7) == 0.75175911502153953928e-11":
+double: 3
+float: 1
+idouble: 3
+ifloat: 1
+Test "jn (10, 10.0) == 0.20748610663335885770":
+double: 4
+float: 3
+idouble: 4
+ifloat: 3
+Test "jn (10, 2.0) == 0.25153862827167367096e-6":
+float: 4
+ifloat: 4
+Test "jn (3, 0.1) == 0.000020820315754756261429":
+double: 1
+idouble: 1
+Test "jn (3, 0.7) == 0.0069296548267508408077":
+float: 1
+ifloat: 1
+Test "jn (3, 10.0) == 0.058379379305186812343":
+double: 3
+float: 1
+idouble: 3
+ifloat: 1
+Test "jn (3, 2.0) == 0.12894324947440205110":
+double: 1
+float: 2
+idouble: 1
+ifloat: 2
+
+# lgamma
+Test "lgamma (0.7) == 0.260867246531666514385732417016759578":
+double: 1
+float: 1
+idouble: 1
+ifloat: 1
+Test "lgamma (1.2) == -0.853740900033158497197028392998854470e-1":
+double: 1
+float: 2
+idouble: 1
+ifloat: 2
+
+# log
+Test "log (0.7) == -0.35667494393873237891263871124118447":
+double: 1
+float: 1
+idouble: 1
+ifloat: 1
+
+# log10
+Test "log10 (0.7) == -0.15490195998574316929":
+double: 1
+float: 1
+idouble: 1
+ifloat: 1
+Test "log10 (e) == log10(e)":
+float: 1
+ifloat: 1
+
+# log1p
+Test "log1p (-0.3) == -0.35667494393873237891263871124118447":
+double: 1
+float: 1
+idouble: 1
+ifloat: 1
+
+# log2
+Test "log2 (0.7) == -0.51457317282975824043":
+double: 1
+float: 1
+idouble: 1
+ifloat: 1
+
+# sincos
+Test "sincos (0.7, &sin_res, &cos_res) puts 0.76484218728448842626 in cos_res":
+double: 1
+float: 1
+idouble: 1
+ifloat: 1
+Test "sincos (M_PI_6l*2.0, &sin_res, &cos_res) puts 0.5 in cos_res":
+double: 1
+float: 0.5
+idouble: 1
+ifloat: 0.5
+Test "sincos (M_PI_6l*2.0, &sin_res, &cos_res) puts 0.866025403784438646764 in sin_res":
+double: 1
+float: 1
+idouble: 1
+ifloat: 1
+Test "sincos (pi/2, &sin_res, &cos_res) puts 0 in cos_res":
+double: 0.2758
+float: 0.3667
+idouble: 0.2758
+ifloat: 0.3667
+Test "sincos (pi/6, &sin_res, &cos_res) puts 0.866025403784438646764 in cos_res":
+float: 1
+ifloat: 1
+
+# sinh
+Test "sinh (0.7) == 0.75858370183953350346":
+double: 1
+float: 1
+idouble: 1
+ifloat: 1
+
+# tan
+Test "tan (pi/4) == 1":
+double: 0.5
+idouble: 0.5
+
+# tanh
+Test "tanh (0.7) == 0.60436777711716349631":
+double: 1
+float: 1
+idouble: 1
+ifloat: 1
+
+# tgamma
+Test "tgamma (-0.5) == -2 sqrt (pi)":
+double: 1
+float: 1
+idouble: 1
+ifloat: 1
+Test "tgamma (0.5) == sqrt (pi)":
+float: 1
+ifloat: 1
+Test "tgamma (0.7) == 1.29805533264755778568117117915281162":
+double: 1
+float: 1
+idouble: 1
+ifloat: 1
+
+# y0
+Test "y0 (0.7) == -0.19066492933739506743":
+double: 2
+float: 1
+idouble: 2
+ifloat: 1
+Test "y0 (1.0) == 0.088256964215676957983":
+double: 2
+float: 1
+idouble: 2
+ifloat: 1
+Test "y0 (1.5) == 0.38244892379775884396":
+double: 2
+float: 1
+idouble: 2
+ifloat: 1
+Test "y0 (10.0) == 0.055671167283599391424":
+float: 1
+ifloat: 1
+Test "y0 (8.0) == 0.22352148938756622053":
+double: 1
+float: 1
+idouble: 1
+ifloat: 1
+
+# y1
+Test "y1 (0.1) == -6.4589510947020269877":
+double: 1
+idouble: 1
+Test "y1 (0.7) == -1.1032498719076333697":
+double: 1
+float: 1
+idouble: 1
+ifloat: 1
+Test "y1 (1.5) == -0.41230862697391129595":
+float: 1
+ifloat: 1
+Test "y1 (10.0) == 0.24901542420695388392":
+double: 3
+float: 1
+idouble: 3
+ifloat: 1
+Test "y1 (2.0) == -0.10703243154093754689":
+double: 1
+float: 1
+idouble: 1
+ifloat: 1
+Test "y1 (8.0) == -0.15806046173124749426":
+double: 1
+float: 2
+idouble: 1
+ifloat: 2
+
+# yn
+Test "yn (0, 0.7) == -0.19066492933739506743":
+double: 2
+float: 1
+idouble: 2
+ifloat: 1
+Test "yn (0, 1.0) == 0.088256964215676957983":
+double: 2
+float: 1
+idouble: 2
+ifloat: 1
+Test "yn (0, 1.5) == 0.38244892379775884396":
+double: 2
+float: 1
+idouble: 2
+ifloat: 1
+Test "yn (0, 10.0) == 0.055671167283599391424":
+float: 1
+ifloat: 1
+Test "yn (0, 8.0) == 0.22352148938756622053":
+double: 1
+float: 1
+idouble: 1
+ifloat: 1
+Test "yn (1, 0.1) == -6.4589510947020269877":
+double: 1
+idouble: 1
+Test "yn (1, 0.7) == -1.1032498719076333697":
+double: 1
+float: 1
+idouble: 1
+ifloat: 1
+Test "yn (1, 1.5) == -0.41230862697391129595":
+float: 1
+ifloat: 1
+Test "yn (1, 10.0) == 0.24901542420695388392":
+double: 3
+float: 1
+idouble: 3
+ifloat: 1
+Test "yn (1, 2.0) == -0.10703243154093754689":
+double: 1
+float: 1
+idouble: 1
+ifloat: 1
+Test "yn (1, 8.0) == -0.15806046173124749426":
+double: 1
+float: 2
+idouble: 1
+ifloat: 2
+Test "yn (10, 0.1) == -0.11831335132045197885e19":
+double: 2
+float: 2
+idouble: 2
+ifloat: 2
+Test "yn (10, 0.7) == -0.42447194260703866924e10":
+double: 3
+idouble: 3
+Test "yn (10, 1.0) == -0.12161801427868918929e9":
+double: 1
+idouble: 1
+Test "yn (10, 10.0) == -0.35981415218340272205":
+double: 1
+float: 1
+idouble: 1
+ifloat: 1
+Test "yn (10, 2.0) == -129184.54220803928264":
+double: 2
+idouble: 2
+Test "yn (3, 0.1) == -5099.3323786129048894":
+double: 1
+float: 1
+idouble: 1
+ifloat: 1
+Test "yn (3, 0.7) == -15.819479052819633505":
+double: 3
+float: 1
+idouble: 3
+ifloat: 1
+Test "yn (3, 10.0) == -0.25136265718383732978":
+double: 1
+float: 1
+idouble: 1
+ifloat: 1
+Test "yn (3, 2.0) == -1.1277837768404277861":
+double: 1
+idouble: 1
+
+# Maximal error of functions:
+Function: "asin":
+double: 1
+float: 2
+idouble: 1
+ifloat: 2
+
+Function: "atan2":
+float: 4
+ifloat: 4
+
+Function: "atanh":
+double: 1
+idouble: 1
+
+Function: "cabs":
+double: 1
+float: 1
+idouble: 1
+ifloat: 1
+
+Function: Real part of "cacos":
+double: 1
+float: 1
+idouble: 1
+ifloat: 1
+
+Function: Imaginary part of "cacos":
+float: 1
+ifloat: 1
+
+Function: Real part of "cacosh":
+double: 1
+float: 7
+idouble: 1
+ifloat: 7
+
+Function: Imaginary part of "cacosh":
+double: 1
+float: 3
+idouble: 1
+ifloat: 3
+
+Function: Real part of "casin":
+double: 3
+float: 2
+idouble: 3
+ifloat: 2
+
+Function: Imaginary part of "casin":
+float: 1
+ifloat: 1
+
+Function: Real part of "casinh":
+double: 5
+float: 1
+idouble: 5
+ifloat: 1
+
+Function: Imaginary part of "casinh":
+double: 3
+float: 6
+idouble: 3
+ifloat: 6
+
+Function: Real part of "catan":
+float: 4
+ifloat: 4
+
+Function: Imaginary part of "catan":
+double: 1
+float: 1
+idouble: 1
+ifloat: 1
+
+Function: Real part of "catanh":
+double: 4
+float: 1
+idouble: 4
+ifloat: 1
+
+Function: Imaginary part of "catanh":
+double: 1
+float: 6
+idouble: 1
+ifloat: 6
+
+Function: "cbrt":
+double: 1
+idouble: 1
+
+Function: Real part of "ccos":
+double: 1
+idouble: 1
+
+Function: Imaginary part of "ccos":
+double: 1
+float: 1
+idouble: 1
+ifloat: 1
+
+Function: Real part of "ccosh":
+double: 1
+float: 1
+idouble: 1
+ifloat: 1
+
+Function: Imaginary part of "ccosh":
+double: 1
+float: 1
+idouble: 1
+ifloat: 1
+
+Function: Real part of "cexp":
+double: 1
+float: 1
+idouble: 1
+ifloat: 1
+
+Function: Imaginary part of "cexp":
+float: 1
+ifloat: 1
+
+Function: Imaginary part of "clog":
+double: 1
+float: 3
+idouble: 1
+ifloat: 3
+
+Function: Real part of "clog10":
+double: 1
+float: 1
+idouble: 1
+ifloat: 1
+
+Function: Imaginary part of "clog10":
+double: 1
+float: 5
+idouble: 1
+ifloat: 5
+
+Function: "cos":
+double: 2
+float: 1
+idouble: 2
+ifloat: 1
+
+Function: Real part of "cpow":
+double: 1
+float: 4
+idouble: 1
+ifloat: 4
+
+Function: Imaginary part of "cpow":
+double: 1.1031
+float: 2
+idouble: 1.1031
+ifloat: 2
+
+Function: Imaginary part of "csin":
+float: 1
+ifloat: 1
+
+Function: Real part of "csinh":
+float: 1
+ifloat: 1
+
+Function: Imaginary part of "csinh":
+double: 1
+float: 1
+idouble: 1
+ifloat: 1
+
+Function: Real part of "csqrt":
+double: 1
+float: 1
+idouble: 1
+ifloat: 1
+
+Function: Imaginary part of "csqrt":
+float: 1
+ifloat: 1
+
+Function: Real part of "ctan":
+double: 1
+float: 1
+idouble: 1
+ifloat: 1
+
+Function: Imaginary part of "ctan":
+double: 1
+float: 1
+idouble: 1
+ifloat: 1
+
+Function: Real part of "ctanh":
+double: 2
+float: 2
+idouble: 2
+ifloat: 2
+
+Function: Imaginary part of "ctanh":
+double: 2
+float: 1
+idouble: 2
+ifloat: 1
+
+Function: "erfc":
+double: 24
+float: 12
+idouble: 24
+ifloat: 12
+
+Function: "exp10":
+double: 6
+float: 2
+idouble: 6
+ifloat: 2
+
+Function: "expm1":
+float: 1
+ifloat: 1
+
+Function: "fmod":
+double: 2
+float: 1
+idouble: 2
+ifloat: 1
+
+Function: "hypot":
+double: 1
+float: 1
+idouble: 1
+ifloat: 1
+
+Function: "j0":
+double: 2
+float: 2
+idouble: 2
+ifloat: 2
+
+Function: "j1":
+double: 1
+float: 2
+idouble: 1
+ifloat: 2
+
+Function: "jn":
+double: 6
+float: 4
+idouble: 6
+ifloat: 4
+
+Function: "lgamma":
+double: 1
+float: 2
+idouble: 1
+ifloat: 2
+
+Function: "log":
+double: 1
+float: 1
+idouble: 1
+ifloat: 1
+
+Function: "log10":
+double: 1
+float: 1
+idouble: 1
+ifloat: 1
+
+Function: "log1p":
+double: 1
+float: 1
+idouble: 1
+ifloat: 1
+
+Function: "log2":
+double: 1
+float: 1
+idouble: 1
+ifloat: 1
+
+Function: "sincos":
+double: 1
+float: 1
+idouble: 1
+ifloat: 1
+
+Function: "sinh":
+double: 1
+float: 1
+idouble: 1
+ifloat: 1
+
+Function: "tan":
+double: 0.5
+idouble: 0.5
+
+Function: "tanh":
+double: 1
+float: 1
+idouble: 1
+ifloat: 1
+
+Function: "tgamma":
+double: 1
+float: 1
+idouble: 1
+ifloat: 1
+
+Function: "y0":
+double: 2
+float: 1
+idouble: 2
+ifloat: 1
+
+Function: "y1":
+double: 3
+float: 2
+idouble: 3
+ifloat: 2
+
+Function: "yn":
+double: 3
+float: 2
+idouble: 3
+ifloat: 2
+
+# end of automatic generation
diff --git a/ap/build/uClibc/test/math/libm-test-ulps-sparc32 b/ap/build/uClibc/test/math/libm-test-ulps-sparc32
new file mode 100644
index 0000000..ccf5378
--- /dev/null
+++ b/ap/build/uClibc/test/math/libm-test-ulps-sparc32
@@ -0,0 +1,1322 @@
+# Begin of automatic generation
+
+# atan2
+Test "atan2 (-0.75, -1.0) == -2.49809154479650885165983415456218025":
+float: 3
+ifloat: 3
+ildouble: 1
+ldouble: 1
+Test "atan2 (0.75, -1.0) == 2.49809154479650885165983415456218025":
+float: 3
+ifloat: 3
+ildouble: 1
+ldouble: 1
+Test "atan2 (1.390625, 0.9296875) == 0.981498387184244311516296577615519772":
+float: 1
+ifloat: 1
+ildouble: 1
+ldouble: 1
+Test "atan2 (-0.00756827042671106339, -.001792735857538728036) == -1.80338464113663849327153994379639112":
+float: 6
+ifloat: 6
+ildouble: 1
+ldouble: 1
+
+# atanh
+Test "atanh (0.75) == 0.972955074527656652552676371721589865":
+float: 1
+ifloat: 1
+
+# cacos
+Test "Imaginary part of: cacos (0.75 + 1.25 i) == 1.11752014915610270578240049553777969 - 1.13239363160530819522266333696834467 i":
+ildouble: 1
+ldouble: 1
+
+# cacosh
+Test "Real part of: cacosh (-2 - 3 i) == 1.9833870299165354323470769028940395 - 2.1414491111159960199416055713254211 i":
+double: 1
+float: 7
+idouble: 1
+ifloat: 7
+ildouble: 5
+ldouble: 5
+Test "Imaginary part of: cacosh (-2 - 3 i) == 1.9833870299165354323470769028940395 - 2.1414491111159960199416055713254211 i":
+double: 1
+float: 3
+idouble: 1
+ifloat: 3
+ildouble: 1
+ldouble: 1
+
+# casin
+Test "Real part of: casin (0.75 + 1.25 i) == 0.453276177638793913448921196101971749 + 1.13239363160530819522266333696834467 i":
+double: 1
+float: 1
+idouble: 1
+ifloat: 1
+Test "Imaginary part of: casin (0.75 + 1.25 i) == 0.453276177638793913448921196101971749 + 1.13239363160530819522266333696834467 i":
+ildouble: 1
+ldouble: 1
+
+# casinh
+Test "Real part of: casinh (-2 - 3 i) == -1.9686379257930962917886650952454982 - 0.96465850440760279204541105949953237 i":
+double: 5
+float: 1
+idouble: 5
+ifloat: 1
+ildouble: 4
+ldouble: 4
+Test "Imaginary part of: casinh (-2 - 3 i) == -1.9686379257930962917886650952454982 - 0.96465850440760279204541105949953237 i":
+double: 3
+float: 6
+idouble: 3
+ifloat: 6
+ildouble: 2
+ldouble: 2
+Test "Real part of: casinh (0.75 + 1.25 i) == 1.03171853444778027336364058631006594 + 0.911738290968487636358489564316731207 i":
+float: 1
+ifloat: 1
+ildouble: 1
+ldouble: 1
+Test "Imaginary part of: casinh (0.75 + 1.25 i) == 1.03171853444778027336364058631006594 + 0.911738290968487636358489564316731207 i":
+double: 1
+float: 1
+idouble: 1
+ifloat: 1
+ildouble: 1
+ldouble: 1
+
+# catan
+Test "Real part of: catan (-2 - 3 i) == -1.4099210495965755225306193844604208 - 0.22907268296853876629588180294200276 i":
+float: 3
+ifloat: 3
+Test "Imaginary part of: catan (-2 - 3 i) == -1.4099210495965755225306193844604208 - 0.22907268296853876629588180294200276 i":
+double: 1
+float: 1
+idouble: 1
+ifloat: 1
+Test "Real part of: catan (0.75 + 1.25 i) == 1.10714871779409050301706546017853704 + 0.549306144334054845697622618461262852 i":
+float: 4
+ifloat: 4
+Test "Imaginary part of: catan (0.75 + 1.25 i) == 1.10714871779409050301706546017853704 + 0.549306144334054845697622618461262852 i":
+ildouble: 1
+ldouble: 1
+
+# catanh
+Test "Real part of: catanh (-2 - 3 i) == -0.14694666622552975204743278515471595 - 1.3389725222944935611241935759091443 i":
+double: 4
+idouble: 4
+Test "Imaginary part of: catanh (-2 - 3 i) == -0.14694666622552975204743278515471595 - 1.3389725222944935611241935759091443 i":
+float: 4
+ifloat: 4
+Test "Real part of: catanh (0.75 + 1.25 i) == 0.261492138795671927078652057366532140 + 0.996825126463918666098902241310446708 i":
+double: 1
+idouble: 1
+ildouble: 1
+ldouble: 1
+Test "Imaginary part of: catanh (0.75 + 1.25 i) == 0.261492138795671927078652057366532140 + 0.996825126463918666098902241310446708 i":
+float: 6
+ifloat: 6
+ildouble: 1
+ldouble: 1
+
+# cbrt
+Test "cbrt (-0.001) == -0.1":
+ildouble: 1
+ldouble: 1
+Test "cbrt (-27.0) == -3.0":
+double: 1
+idouble: 1
+Test "cbrt (0.75) == 0.908560296416069829445605878163630251":
+double: 1
+idouble: 1
+Test "cbrt (0.9921875) == 0.997389022060725270579075195353955217":
+double: 1
+idouble: 1
+
+# ccos
+Test "Real part of: ccos (-2 - 3 i) == -4.18962569096880723013255501961597373 - 9.10922789375533659797919726277886212 i":
+ildouble: 1
+ldouble: 1
+Test "Imaginary part of: ccos (-2 - 3 i) == -4.18962569096880723013255501961597373 - 9.10922789375533659797919726277886212 i":
+float: 1
+ifloat: 1
+ildouble: 1
+ldouble: 1
+Test "Real part of: ccos (0.75 + 1.25 i) == 1.38173873063425888530729933139078645 - 1.09193013555397466170919531722024128 i":
+double: 1
+float: 1
+idouble: 1
+ifloat: 1
+Test "Imaginary part of: ccos (0.75 + 1.25 i) == 1.38173873063425888530729933139078645 - 1.09193013555397466170919531722024128 i":
+float: 1
+ifloat: 1
+
+# ccosh
+Test "Real part of: ccosh (-2 - 3 i) == -3.72454550491532256547397070325597253 + 0.511822569987384608834463849801875634 i":
+float: 1
+ifloat: 1
+ildouble: 1
+ldouble: 1
+Test "Imaginary part of: ccosh (-2 - 3 i) == -3.72454550491532256547397070325597253 + 0.511822569987384608834463849801875634 i":
+float: 1
+ifloat: 1
+ildouble: 1
+ldouble: 1
+Test "Real part of: ccosh (0.75 + 1.25 i) == 0.408242591877968807788852146397499084 + 0.780365930845853240391326216300863152 i":
+double: 1
+float: 1
+idouble: 1
+ifloat: 1
+Test "Imaginary part of: ccosh (0.75 + 1.25 i) == 0.408242591877968807788852146397499084 + 0.780365930845853240391326216300863152 i":
+float: 1
+ifloat: 1
+
+# cexp
+Test "Real part of: cexp (-2.0 - 3.0 i) == -0.13398091492954261346140525546115575 - 0.019098516261135196432576240858800925 i":
+ildouble: 1
+ldouble: 1
+Test "Imaginary part of: cexp (-2.0 - 3.0 i) == -0.13398091492954261346140525546115575 - 0.019098516261135196432576240858800925 i":
+float: 1
+ifloat: 1
+ildouble: 1
+ldouble: 1
+Test "Real part of: cexp (0.75 + 1.25 i) == 0.667537446429131586942201977015932112 + 2.00900045494094876258347228145863909 i":
+float: 1
+ifloat: 1
+Test "Imaginary part of: cexp (0.75 + 1.25 i) == 0.667537446429131586942201977015932112 + 2.00900045494094876258347228145863909 i":
+ildouble: 1
+ldouble: 1
+
+# clog
+Test "Imaginary part of: clog (-2 - 3 i) == 1.2824746787307683680267437207826593 - 2.1587989303424641704769327722648368 i":
+float: 3
+ifloat: 3
+Test "Real part of: clog (0.75 + 1.25 i) == 0.376885901188190075998919126749298416 + 1.03037682652431246378774332703115153 i":
+float: 1
+ifloat: 1
+ildouble: 1
+ldouble: 1
+
+# clog10
+Test "Imaginary part of: clog10 (-0 + inf i) == inf + pi/2*log10(e) i":
+double: 1
+float: 1
+idouble: 1
+ifloat: 1
+Test "Imaginary part of: clog10 (-0 - inf i) == inf - pi/2*log10(e) i":
+double: 1
+float: 1
+idouble: 1
+ifloat: 1
+Test "Real part of: clog10 (-2 - 3 i) == 0.556971676153418384603252578971164214 - 0.937554462986374708541507952140189646 i":
+ildouble: 1
+ldouble: 1
+Test "Imaginary part of: clog10 (-2 - 3 i) == 0.556971676153418384603252578971164214 - 0.937554462986374708541507952140189646 i":
+double: 1
+float: 5
+idouble: 1
+ifloat: 5
+ildouble: 1
+ldouble: 1
+Test "Imaginary part of: clog10 (-3 + inf i) == inf + pi/2*log10(e) i":
+double: 1
+float: 1
+idouble: 1
+ifloat: 1
+Test "Imaginary part of: clog10 (-3 - inf i) == inf - pi/2*log10(e) i":
+double: 1
+float: 1
+idouble: 1
+ifloat: 1
+Test "Imaginary part of: clog10 (-inf + 0 i) == inf + pi*log10(e) i":
+double: 1
+float: 1
+idouble: 1
+ifloat: 1
+Test "Imaginary part of: clog10 (-inf + 1 i) == inf + pi*log10(e) i":
+double: 1
+float: 1
+idouble: 1
+ifloat: 1
+Test "Imaginary part of: clog10 (-inf + inf i) == inf + 3/4 pi*log10(e) i":
+double: 1
+idouble: 1
+Test "Imaginary part of: clog10 (-inf - 0 i) == inf - pi*log10(e) i":
+double: 1
+float: 1
+idouble: 1
+ifloat: 1
+Test "Imaginary part of: clog10 (-inf - 1 i) == inf - pi*log10(e) i":
+double: 1
+float: 1
+idouble: 1
+ifloat: 1
+Test "Imaginary part of: clog10 (0 + inf i) == inf + pi/2*log10(e) i":
+double: 1
+float: 1
+idouble: 1
+ifloat: 1
+Test "Imaginary part of: clog10 (0 - inf i) == inf - pi/2*log10(e) i":
+double: 1
+float: 1
+idouble: 1
+ifloat: 1
+Test "Real part of: clog10 (0.75 + 1.25 i) == 0.163679467193165171449476605077428975 + 0.447486970040493067069984724340855636 i":
+float: 1
+ifloat: 1
+Test "Imaginary part of: clog10 (0.75 + 1.25 i) == 0.163679467193165171449476605077428975 + 0.447486970040493067069984724340855636 i":
+ildouble: 1
+ldouble: 1
+Test "Imaginary part of: clog10 (3 + inf i) == inf + pi/2*log10(e) i":
+double: 1
+float: 1
+idouble: 1
+ifloat: 1
+Test "Imaginary part of: clog10 (3 - inf i) == inf - pi/2*log10(e) i":
+double: 1
+float: 1
+idouble: 1
+ifloat: 1
+Test "Imaginary part of: clog10 (inf + inf i) == inf + pi/4*log10(e) i":
+double: 1
+float: 1
+idouble: 1
+ifloat: 1
+Test "Imaginary part of: clog10 (inf - inf i) == inf - pi/4*log10(e) i":
+double: 1
+float: 1
+idouble: 1
+ifloat: 1
+
+# cos
+Test "cos (M_PI_6l * 2.0) == 0.5":
+double: 1
+float: 1
+idouble: 1
+ifloat: 1
+ildouble: 1
+ldouble: 1
+Test "cos (M_PI_6l * 4.0) == -0.5":
+double: 2
+float: 1
+idouble: 2
+ifloat: 1
+ildouble: 1
+ldouble: 1
+Test "cos (pi/2) == 0":
+double: 1
+float: 1
+idouble: 1
+ifloat: 1
+ildouble: 1
+ldouble: 1
+
+# cpow
+Test "Real part of: cpow (0.75 + 1.25 i, 0.0 + 1.0 i) == 0.331825439177608832276067945276730566 + 0.131338600281188544930936345230903032 i":
+float: 1
+ifloat: 1
+Test "Imaginary part of: cpow (0.75 + 1.25 i, 0.0 + 1.0 i) == 0.331825439177608832276067945276730566 + 0.131338600281188544930936345230903032 i":
+float: 1
+ifloat: 1
+Test "Real part of: cpow (0.75 + 1.25 i, 0.75 + 1.25 i) == 0.117506293914473555420279832210420483 + 0.346552747708338676483025352060418001 i":
+double: 1
+float: 4
+idouble: 1
+ifloat: 4
+ildouble: 4
+ldouble: 4
+Test "Real part of: cpow (0.75 + 1.25 i, 1.0 + 0.0 i) == 0.75 + 1.25 i":
+ildouble: 2
+ldouble: 2
+Test "Imaginary part of: cpow (0.75 + 1.25 i, 1.0 + 0.0 i) == 0.75 + 1.25 i":
+ildouble: 1
+ldouble: 1
+Test "Real part of: cpow (0.75 + 1.25 i, 1.0 + 1.0 i) == 0.0846958290317209430433805274189191353 + 0.513285749182902449043287190519090481 i":
+double: 2
+float: 3
+idouble: 2
+ifloat: 3
+ildouble: 10
+ldouble: 10
+Test "Real part of: cpow (2 + 0 i, 10 + 0 i) == 1024.0 + 0.0 i":
+ildouble: 2
+ldouble: 2
+Test "Real part of: cpow (2 + 3 i, 4 + 0 i) == -119.0 - 120.0 i":
+double: 1
+float: 4
+idouble: 1
+ifloat: 4
+ildouble: 3
+ldouble: 3
+Test "Imaginary part of: cpow (2 + 3 i, 4 + 0 i) == -119.0 - 120.0 i":
+float: 2
+ifloat: 2
+Test "Imaginary part of: cpow (e + 0 i, 0 + 2 * M_PIl i) == 1.0 + 0.0 i":
+double: 2
+float: 2
+idouble: 2
+ifloat: 2
+ildouble: 1
+ldouble: 1
+
+# csin
+Test "Imaginary part of: csin (-2 - 3 i) == -9.15449914691142957346729954460983256 + 4.16890695996656435075481305885375484 i":
+ildouble: 1
+ldouble: 1
+Test "Real part of: csin (0.75 + 1.25 i) == 1.28722291002649188575873510790565441 + 1.17210635989270256101081285116138863 i":
+ildouble: 1
+ldouble: 1
+
+# csinh
+Test "Real part of: csinh (-2 - 3 i) == 3.59056458998577995201256544779481679 - 0.530921086248519805267040090660676560 i":
+ildouble: 1
+ldouble: 1
+Test "Imaginary part of: csinh (-2 - 3 i) == 3.59056458998577995201256544779481679 - 0.530921086248519805267040090660676560 i":
+double: 1
+idouble: 1
+Test "Real part of: csinh (0.75 + 1.25 i) == 0.259294854551162779153349830618433028 + 1.22863452409509552219214606515777594 i":
+float: 1
+ifloat: 1
+Test "Imaginary part of: csinh (0.75 + 1.25 i) == 0.259294854551162779153349830618433028 + 1.22863452409509552219214606515777594 i":
+float: 1
+ifloat: 1
+
+# csqrt
+Test "Real part of: csqrt (-2 + 3 i) == 0.89597747612983812471573375529004348 + 1.6741492280355400404480393008490519 i":
+float: 1
+ifloat: 1
+ildouble: 1
+ldouble: 1
+Test "Real part of: csqrt (-2 - 3 i) == 0.89597747612983812471573375529004348 - 1.6741492280355400404480393008490519 i":
+float: 1
+ifloat: 1
+ildouble: 1
+ldouble: 1
+Test "Imaginary part of: csqrt (0.75 + 1.25 i) == 1.05065169626078392338656675760808326 + 0.594868882070379067881984030639932657 i":
+ildouble: 1
+ldouble: 1
+
+# ctan
+Test "Real part of: ctan (-2 - 3 i) == 0.376402564150424829275122113032269084e-2 - 1.00323862735360980144635859782192726 i":
+double: 1
+idouble: 1
+ildouble: 1
+ldouble: 1
+Test "Imaginary part of: ctan (-2 - 3 i) == 0.376402564150424829275122113032269084e-2 - 1.00323862735360980144635859782192726 i":
+ildouble: 1
+ldouble: 1
+Test "Imaginary part of: ctan (0.75 + 1.25 i) == 0.160807785916206426725166058173438663 + 0.975363285031235646193581759755216379 i":
+double: 1
+idouble: 1
+ildouble: 2
+ldouble: 2
+
+# ctanh
+Test "Real part of: ctanh (-2 - 3 i) == -0.965385879022133124278480269394560686 + 0.988437503832249372031403430350121098e-2 i":
+double: 1
+float: 2
+idouble: 1
+ifloat: 2
+ildouble: 1
+ldouble: 1
+Test "Imaginary part of: ctanh (-2 - 3 i) == -0.965385879022133124278480269394560686 + 0.988437503832249372031403430350121098e-2 i":
+ildouble: 1
+ldouble: 1
+Test "Imaginary part of: ctanh (0 + pi/4 i) == 0.0 + 1.0 i":
+float: 1
+ifloat: 1
+Test "Real part of: ctanh (0.75 + 1.25 i) == 1.37260757053378320258048606571226857 + 0.385795952609750664177596760720790220 i":
+double: 1
+idouble: 1
+
+# erf
+Test "erf (1.25) == 0.922900128256458230136523481197281140":
+double: 1
+idouble: 1
+
+# erfc
+Test "erfc (2.0) == 0.00467773498104726583793074363274707139":
+double: 1
+idouble: 1
+Test "erfc (27.0) == 0.523704892378925568501606768284954709e-318":
+ildouble: 1
+ldouble: 1
+Test "erfc (4.125) == 0.542340079956506600531223408575531062e-8":
+double: 1
+idouble: 1
+
+# exp10
+Test "exp10 (-1) == 0.1":
+double: 2
+float: 1
+idouble: 2
+ifloat: 1
+Test "exp10 (0.75) == 5.62341325190349080394951039776481231":
+double: 1
+float: 1
+idouble: 1
+ifloat: 1
+Test "exp10 (3) == 1000":
+double: 6
+float: 2
+idouble: 6
+ifloat: 2
+ildouble: 1
+ldouble: 1
+
+# exp2
+Test "exp2 (10) == 1024":
+ildouble: 2
+ldouble: 2
+
+# expm1
+Test "expm1 (0.75) == 1.11700001661267466854536981983709561":
+double: 1
+idouble: 1
+Test "expm1 (1) == M_El - 1.0":
+double: 1
+float: 1
+idouble: 1
+ifloat: 1
+ildouble: 1
+ldouble: 1
+
+# gamma
+Test "gamma (-0.5) == log(2*sqrt(pi))":
+ildouble: 1
+ldouble: 1
+
+# hypot
+Test "hypot (-0.7, -12.4) == 12.419742348374220601176836866763271":
+float: 1
+ifloat: 1
+Test "hypot (-0.7, 12.4) == 12.419742348374220601176836866763271":
+float: 1
+ifloat: 1
+Test "hypot (-12.4, -0.7) == 12.419742348374220601176836866763271":
+float: 1
+ifloat: 1
+Test "hypot (-12.4, 0.7) == 12.419742348374220601176836866763271":
+float: 1
+ifloat: 1
+Test "hypot (0.7, -12.4) == 12.419742348374220601176836866763271":
+float: 1
+ifloat: 1
+Test "hypot (0.7, 12.4) == 12.419742348374220601176836866763271":
+float: 1
+ifloat: 1
+Test "hypot (12.4, -0.7) == 12.419742348374220601176836866763271":
+float: 1
+ifloat: 1
+Test "hypot (12.4, 0.7) == 12.419742348374220601176836866763271":
+float: 1
+ifloat: 1
+
+# j0
+Test "j0 (-4.0) == -3.9714980986384737228659076845169804197562E-1":
+double: 1
+float: 1
+idouble: 1
+ifloat: 1
+Test "j0 (0.75) == 0.864242275166648623555731103820923211":
+float: 1
+ifloat: 1
+Test "j0 (10.0) == -0.245935764451348335197760862485328754":
+double: 2
+float: 1
+idouble: 2
+ifloat: 1
+ildouble: 2
+ldouble: 2
+Test "j0 (2.0) == 0.223890779141235668051827454649948626":
+float: 2
+ifloat: 2
+ildouble: 2
+ldouble: 2
+Test "j0 (4.0) == -3.9714980986384737228659076845169804197562E-1":
+double: 1
+float: 1
+idouble: 1
+ifloat: 1
+Test "j0 (8.0) == 0.171650807137553906090869407851972001":
+float: 1
+ifloat: 1
+ildouble: 1
+ldouble: 1
+
+# j1
+Test "j1 (-1.0) == -0.440050585744933515959682203718914913":
+ildouble: 1
+ldouble: 1
+Test "j1 (0.75) == 0.349243602174862192523281016426251335":
+ildouble: 1
+ldouble: 1
+Test "j1 (1.0) == 0.440050585744933515959682203718914913":
+ildouble: 1
+ldouble: 1
+Test "j1 (10.0) == 0.0434727461688614366697487680258592883":
+float: 2
+ifloat: 2
+ildouble: 2
+ldouble: 2
+Test "j1 (2.0) == 0.576724807756873387202448242269137087":
+double: 1
+idouble: 1
+Test "j1 (8.0) == 0.234636346853914624381276651590454612":
+double: 1
+idouble: 1
+ildouble: 4
+ldouble: 4
+
+# jn
+Test "jn (0, -4.0) == -3.9714980986384737228659076845169804197562E-1":
+double: 1
+float: 1
+idouble: 1
+ifloat: 1
+Test "jn (0, 0.75) == 0.864242275166648623555731103820923211":
+float: 1
+ifloat: 1
+Test "jn (0, 10.0) == -0.245935764451348335197760862485328754":
+double: 2
+float: 1
+idouble: 2
+ifloat: 1
+ildouble: 2
+ldouble: 2
+Test "jn (0, 2.0) == 0.223890779141235668051827454649948626":
+float: 2
+ifloat: 2
+ildouble: 2
+ldouble: 2
+Test "jn (0, 4.0) == -3.9714980986384737228659076845169804197562E-1":
+double: 1
+float: 1
+idouble: 1
+ifloat: 1
+Test "jn (0, 8.0) == 0.171650807137553906090869407851972001":
+float: 1
+ifloat: 1
+ildouble: 1
+ldouble: 1
+Test "jn (1, -1.0) == -0.440050585744933515959682203718914913":
+ildouble: 1
+ldouble: 1
+Test "jn (1, 0.75) == 0.349243602174862192523281016426251335":
+ildouble: 1
+ldouble: 1
+Test "jn (1, 1.0) == 0.440050585744933515959682203718914913":
+ildouble: 1
+ldouble: 1
+Test "jn (1, 10.0) == 0.0434727461688614366697487680258592883":
+float: 2
+ifloat: 2
+ildouble: 2
+ldouble: 2
+Test "jn (1, 2.0) == 0.576724807756873387202448242269137087":
+double: 1
+idouble: 1
+Test "jn (1, 8.0) == 0.234636346853914624381276651590454612":
+double: 1
+idouble: 1
+ildouble: 4
+ldouble: 4
+Test "jn (10, -1.0) == 0.263061512368745320699785368779050294e-9":
+ildouble: 1
+ldouble: 1
+Test "jn (10, 0.125) == 0.250543369809369890173993791865771547e-18":
+double: 1
+float: 1
+idouble: 1
+ifloat: 1
+ildouble: 1
+ldouble: 1
+Test "jn (10, 0.75) == 0.149621713117596814698712483621682835e-10":
+double: 1
+float: 1
+idouble: 1
+ifloat: 1
+ildouble: 1
+ldouble: 1
+Test "jn (10, 1.0) == 0.263061512368745320699785368779050294e-9":
+ildouble: 1
+ldouble: 1
+Test "jn (10, 10.0) == 0.207486106633358857697278723518753428":
+double: 4
+float: 3
+idouble: 4
+ifloat: 3
+ildouble: 2
+ldouble: 2
+Test "jn (10, 2.0) == 0.251538628271673670963516093751820639e-6":
+float: 4
+ifloat: 4
+Test "jn (3, 0.125) == 0.406503832554912875023029337653442868e-4":
+double: 1
+float: 1
+idouble: 1
+ifloat: 1
+Test "jn (3, 0.75) == 0.848438342327410884392755236884386804e-2":
+double: 1
+float: 1
+idouble: 1
+ifloat: 1
+Test "jn (3, 10.0) == 0.0583793793051868123429354784103409563":
+double: 3
+float: 1
+idouble: 3
+ifloat: 1
+ildouble: 2
+ldouble: 2
+Test "jn (3, 2.0) == 0.128943249474402051098793332969239835":
+double: 1
+float: 2
+idouble: 1
+ifloat: 2
+
+# lgamma
+Test "lgamma (-0.5) == log(2*sqrt(pi))":
+ildouble: 1
+ldouble: 1
+Test "lgamma (0.7) == 0.260867246531666514385732417016759578":
+double: 1
+float: 1
+idouble: 1
+ifloat: 1
+ildouble: 1
+ldouble: 1
+Test "lgamma (1.2) == -0.853740900033158497197028392998854470e-1":
+double: 1
+float: 2
+idouble: 1
+ifloat: 2
+ildouble: 1
+ldouble: 1
+
+# log10
+Test "log10 (0.75) == -0.124938736608299953132449886193870744":
+double: 1
+float: 2
+idouble: 1
+ifloat: 2
+Test "log10 (e) == log10(e)":
+float: 1
+ifloat: 1
+ildouble: 1
+ldouble: 1
+
+# log1p
+Test "log1p (-0.25) == -0.287682072451780927439219005993827432":
+float: 1
+ifloat: 1
+Test "log1p (M_El - 1.0) == 1":
+ildouble: 1
+ldouble: 1
+
+# log2
+Test "log2 (0.75) == -.415037499278843818546261056052183492":
+ildouble: 1
+ldouble: 1
+
+# sincos
+Test "sincos (M_PI_6l*2.0, &sin_res, &cos_res) puts 0.5 in cos_res":
+double: 1
+float: 1
+idouble: 1
+ifloat: 1
+ildouble: 1
+ldouble: 1
+Test "sincos (M_PI_6l*2.0, &sin_res, &cos_res) puts 0.86602540378443864676372317075293616 in sin_res":
+double: 1
+float: 1
+idouble: 1
+ifloat: 1
+ildouble: 1
+ldouble: 1
+Test "sincos (pi/2, &sin_res, &cos_res) puts 0 in cos_res":
+double: 1
+float: 1
+idouble: 1
+ifloat: 1
+ildouble: 1
+ldouble: 1
+Test "sincos (pi/6, &sin_res, &cos_res) puts 0.86602540378443864676372317075293616 in cos_res":
+float: 1
+ifloat: 1
+
+# sqrt
+Test "sqrt (2) == M_SQRT2l":
+ildouble: 1
+ldouble: 1
+
+# tan
+Test "tan (pi/4) == 1":
+double: 1
+idouble: 1
+
+# tanh
+Test "tanh (-0.75) == -0.635148952387287319214434357312496495":
+ildouble: 1
+ldouble: 1
+Test "tanh (-1.0) == -0.7615941559557648881194582826047935904":
+ildouble: 1
+ldouble: 1
+Test "tanh (0.75) == 0.635148952387287319214434357312496495":
+ildouble: 1
+ldouble: 1
+Test "tanh (1.0) == 0.7615941559557648881194582826047935904":
+ildouble: 1
+ldouble: 1
+
+# tgamma
+Test "tgamma (-0.5) == -2 sqrt (pi)":
+double: 1
+float: 1
+idouble: 1
+ifloat: 1
+ildouble: 1
+ldouble: 1
+Test "tgamma (0.5) == sqrt (pi)":
+float: 1
+ifloat: 1
+Test "tgamma (0.7) == 1.29805533264755778568117117915281162":
+double: 1
+float: 1
+idouble: 1
+ifloat: 1
+Test "tgamma (4) == 6":
+ildouble: 1
+ldouble: 1
+
+# y0
+Test "y0 (1.0) == 0.0882569642156769579829267660235151628":
+double: 2
+float: 1
+idouble: 2
+ifloat: 1
+Test "y0 (1.5) == 0.382448923797758843955068554978089862":
+double: 2
+float: 1
+idouble: 2
+ifloat: 1
+Test "y0 (10.0) == 0.0556711672835993914244598774101900481":
+float: 1
+ifloat: 1
+ildouble: 3
+ldouble: 3
+Test "y0 (8.0) == 0.223521489387566220527323400498620359":
+double: 1
+float: 1
+idouble: 1
+ifloat: 1
+ildouble: 3
+ldouble: 3
+
+# y1
+Test "y1 (0.125) == -5.19993611253477499595928744876579921":
+double: 1
+idouble: 1
+Test "y1 (0.75) == -1.03759455076928541973767132140642198":
+ildouble: 1
+ldouble: 1
+Test "y1 (1.5) == -0.412308626973911295952829820633445323":
+float: 1
+ifloat: 1
+ildouble: 1
+ldouble: 1
+Test "y1 (10.0) == 0.249015424206953883923283474663222803":
+double: 3
+float: 1
+idouble: 3
+ifloat: 1
+Test "y1 (2.0) == -0.107032431540937546888370772277476637":
+double: 1
+float: 1
+idouble: 1
+ifloat: 1
+ildouble: 1
+ldouble: 1
+Test "y1 (8.0) == -0.158060461731247494255555266187483550":
+double: 1
+float: 2
+idouble: 1
+ifloat: 2
+ildouble: 1
+ldouble: 1
+
+# yn
+Test "yn (0, 1.0) == 0.0882569642156769579829267660235151628":
+double: 2
+float: 1
+idouble: 2
+ifloat: 1
+Test "yn (0, 1.5) == 0.382448923797758843955068554978089862":
+double: 2
+float: 1
+idouble: 2
+ifloat: 1
+Test "yn (0, 10.0) == 0.0556711672835993914244598774101900481":
+float: 1
+ifloat: 1
+ildouble: 3
+ldouble: 3
+Test "yn (0, 8.0) == 0.223521489387566220527323400498620359":
+double: 1
+float: 1
+idouble: 1
+ifloat: 1
+ildouble: 3
+ldouble: 3
+Test "yn (1, 0.125) == -5.19993611253477499595928744876579921":
+double: 1
+idouble: 1
+Test "yn (1, 0.75) == -1.03759455076928541973767132140642198":
+ildouble: 1
+ldouble: 1
+Test "yn (1, 1.5) == -0.412308626973911295952829820633445323":
+float: 1
+ifloat: 1
+ildouble: 1
+ldouble: 1
+Test "yn (1, 10.0) == 0.249015424206953883923283474663222803":
+double: 3
+float: 1
+idouble: 3
+ifloat: 1
+Test "yn (1, 2.0) == -0.107032431540937546888370772277476637":
+double: 1
+float: 1
+idouble: 1
+ifloat: 1
+ildouble: 1
+ldouble: 1
+Test "yn (1, 8.0) == -0.158060461731247494255555266187483550":
+double: 1
+float: 2
+idouble: 1
+ifloat: 2
+ildouble: 1
+ldouble: 1
+Test "yn (10, 0.125) == -127057845771019398.252538486899753195":
+double: 1
+idouble: 1
+ildouble: 2
+ldouble: 2
+Test "yn (10, 0.75) == -2133501638.90573424452445412893839236":
+double: 1
+float: 1
+idouble: 1
+ifloat: 1
+ildouble: 5
+ldouble: 5
+Test "yn (10, 1.0) == -121618014.278689189288130426667971145":
+double: 1
+idouble: 1
+ildouble: 1
+ldouble: 1
+Test "yn (10, 10.0) == -0.359814152183402722051986577343560609":
+double: 1
+float: 1
+idouble: 1
+ifloat: 1
+ildouble: 2
+ldouble: 2
+Test "yn (10, 2.0) == -129184.542208039282635913145923304214":
+double: 2
+idouble: 2
+ildouble: 2
+ldouble: 2
+Test "yn (3, 0.125) == -2612.69757350066712600220955744091741":
+double: 1
+idouble: 1
+Test "yn (3, 0.75) == -12.9877176234475433186319774484809207":
+double: 1
+float: 1
+idouble: 1
+ifloat: 1
+ildouble: 2
+ldouble: 2
+Test "yn (3, 10.0) == -0.251362657183837329779204747654240998":
+double: 1
+float: 1
+idouble: 1
+ifloat: 1
+ildouble: 1
+ldouble: 1
+Test "yn (3, 2.0) == -1.12778377684042778608158395773179238":
+double: 1
+idouble: 1
+
+# Maximal error of functions:
+Function: "atan2":
+float: 6
+ifloat: 6
+ildouble: 1
+ldouble: 1
+
+Function: "atanh":
+float: 1
+ifloat: 1
+
+Function: Imaginary part of "cacos":
+ildouble: 1
+ldouble: 1
+
+Function: Real part of "cacosh":
+double: 1
+float: 7
+idouble: 1
+ifloat: 7
+ildouble: 5
+ldouble: 5
+
+Function: Imaginary part of "cacosh":
+double: 1
+float: 3
+idouble: 1
+ifloat: 3
+ildouble: 1
+ldouble: 1
+
+Function: Real part of "casin":
+double: 1
+float: 1
+idouble: 1
+ifloat: 1
+
+Function: Imaginary part of "casin":
+ildouble: 1
+ldouble: 1
+
+Function: Real part of "casinh":
+double: 5
+float: 1
+idouble: 5
+ifloat: 1
+ildouble: 4
+ldouble: 4
+
+Function: Imaginary part of "casinh":
+double: 3
+float: 6
+idouble: 3
+ifloat: 6
+ildouble: 2
+ldouble: 2
+
+Function: Real part of "catan":
+float: 4
+ifloat: 4
+
+Function: Imaginary part of "catan":
+double: 1
+float: 1
+idouble: 1
+ifloat: 1
+ildouble: 1
+ldouble: 1
+
+Function: Real part of "catanh":
+double: 4
+idouble: 4
+ildouble: 1
+ldouble: 1
+
+Function: Imaginary part of "catanh":
+float: 6
+ifloat: 6
+ildouble: 1
+ldouble: 1
+
+Function: "cbrt":
+double: 1
+idouble: 1
+ildouble: 1
+ldouble: 1
+
+Function: Real part of "ccos":
+double: 1
+float: 1
+idouble: 1
+ifloat: 1
+ildouble: 1
+ldouble: 1
+
+Function: Imaginary part of "ccos":
+float: 1
+ifloat: 1
+ildouble: 1
+ldouble: 1
+
+Function: Real part of "ccosh":
+double: 1
+float: 1
+idouble: 1
+ifloat: 1
+ildouble: 1
+ldouble: 1
+
+Function: Imaginary part of "ccosh":
+float: 1
+ifloat: 1
+ildouble: 1
+ldouble: 1
+
+Function: Real part of "cexp":
+float: 1
+ifloat: 1
+ildouble: 1
+ldouble: 1
+
+Function: Imaginary part of "cexp":
+float: 1
+ifloat: 1
+ildouble: 1
+ldouble: 1
+
+Function: Real part of "clog":
+float: 1
+ifloat: 1
+ildouble: 1
+ldouble: 1
+
+Function: Imaginary part of "clog":
+float: 3
+ifloat: 3
+
+Function: Real part of "clog10":
+float: 1
+ifloat: 1
+ildouble: 1
+ldouble: 1
+
+Function: Imaginary part of "clog10":
+double: 1
+float: 5
+idouble: 1
+ifloat: 5
+ildouble: 1
+ldouble: 1
+
+Function: "cos":
+double: 2
+float: 1
+idouble: 2
+ifloat: 1
+ildouble: 1
+ldouble: 1
+
+Function: Real part of "cpow":
+double: 2
+float: 4
+idouble: 2
+ifloat: 4
+ildouble: 10
+ldouble: 10
+
+Function: Imaginary part of "cpow":
+double: 2
+float: 2
+idouble: 2
+ifloat: 2
+ildouble: 1
+ldouble: 1
+
+Function: Real part of "csin":
+ildouble: 1
+ldouble: 1
+
+Function: Imaginary part of "csin":
+ildouble: 1
+ldouble: 1
+
+Function: Real part of "csinh":
+float: 1
+ifloat: 1
+ildouble: 1
+ldouble: 1
+
+Function: Imaginary part of "csinh":
+double: 1
+float: 1
+idouble: 1
+ifloat: 1
+
+Function: Real part of "csqrt":
+float: 1
+ifloat: 1
+ildouble: 1
+ldouble: 1
+
+Function: Imaginary part of "csqrt":
+ildouble: 1
+ldouble: 1
+
+Function: Real part of "ctan":
+double: 1
+idouble: 1
+ildouble: 1
+ldouble: 1
+
+Function: Imaginary part of "ctan":
+double: 1
+idouble: 1
+ildouble: 2
+ldouble: 2
+
+Function: Real part of "ctanh":
+double: 1
+float: 2
+idouble: 1
+ifloat: 2
+ildouble: 1
+ldouble: 1
+
+Function: Imaginary part of "ctanh":
+float: 1
+ifloat: 1
+ildouble: 1
+ldouble: 1
+
+Function: "erf":
+double: 1
+idouble: 1
+
+Function: "erfc":
+double: 1
+idouble: 1
+ildouble: 1
+ldouble: 1
+
+Function: "exp10":
+double: 6
+float: 2
+idouble: 6
+ifloat: 2
+ildouble: 1
+ldouble: 1
+
+Function: "exp2":
+ildouble: 2
+ldouble: 2
+
+Function: "expm1":
+double: 1
+float: 1
+idouble: 1
+ifloat: 1
+ildouble: 1
+ldouble: 1
+
+Function: "gamma":
+ildouble: 1
+ldouble: 1
+
+Function: "hypot":
+float: 1
+ifloat: 1
+
+Function: "j0":
+double: 2
+float: 2
+idouble: 2
+ifloat: 2
+ildouble: 2
+ldouble: 2
+
+Function: "j1":
+double: 1
+float: 2
+idouble: 1
+ifloat: 2
+ildouble: 4
+ldouble: 4
+
+Function: "jn":
+double: 4
+float: 4
+idouble: 4
+ifloat: 4
+ildouble: 4
+ldouble: 4
+
+Function: "lgamma":
+double: 1
+float: 2
+idouble: 1
+ifloat: 2
+ildouble: 1
+ldouble: 1
+
+Function: "log10":
+double: 1
+float: 2
+idouble: 1
+ifloat: 2
+ildouble: 1
+ldouble: 1
+
+Function: "log1p":
+float: 1
+ifloat: 1
+ildouble: 1
+ldouble: 1
+
+Function: "log2":
+ildouble: 1
+ldouble: 1
+
+Function: "sincos":
+double: 1
+float: 1
+idouble: 1
+ifloat: 1
+ildouble: 1
+ldouble: 1
+
+Function: "sqrt":
+ildouble: 1
+ldouble: 1
+
+Function: "tan":
+double: 1
+idouble: 1
+
+Function: "tanh":
+ildouble: 1
+ldouble: 1
+
+Function: "tgamma":
+double: 1
+float: 1
+idouble: 1
+ifloat: 1
+ildouble: 1
+ldouble: 1
+
+Function: "y0":
+double: 2
+float: 1
+idouble: 2
+ifloat: 1
+ildouble: 3
+ldouble: 3
+
+Function: "y1":
+double: 3
+float: 2
+idouble: 3
+ifloat: 2
+ildouble: 1
+ldouble: 1
+
+Function: "yn":
+double: 3
+float: 2
+idouble: 3
+ifloat: 2
+ildouble: 5
+ldouble: 5
+
+# end of automatic generation
diff --git a/ap/build/uClibc/test/math/libm-test-ulps-sparc64 b/ap/build/uClibc/test/math/libm-test-ulps-sparc64
new file mode 100644
index 0000000..db5543e
--- /dev/null
+++ b/ap/build/uClibc/test/math/libm-test-ulps-sparc64
@@ -0,0 +1,1322 @@
+# Begin of automatic generation
+
+# atan2
+Test "atan2 (-0.00756827042671106339, -.001792735857538728036) == -1.80338464113663849327153994379639112":
+float: 6
+ifloat: 6
+ildouble: 1
+ldouble: 1
+Test "atan2 (-0.75, -1.0) == -2.49809154479650885165983415456218025":
+float: 3
+ifloat: 3
+ildouble: 1
+ldouble: 1
+Test "atan2 (0.75, -1.0) == 2.49809154479650885165983415456218025":
+float: 3
+ifloat: 3
+ildouble: 1
+ldouble: 1
+Test "atan2 (1.390625, 0.9296875) == 0.981498387184244311516296577615519772":
+float: 1
+ifloat: 1
+ildouble: 1
+ldouble: 1
+
+# atanh
+Test "atanh (0.75) == 0.972955074527656652552676371721589865":
+float: 1
+ifloat: 1
+
+# cacos
+Test "Imaginary part of: cacos (0.75 + 1.25 i) == 1.11752014915610270578240049553777969 - 1.13239363160530819522266333696834467 i":
+ildouble: 1
+ldouble: 1
+
+# cacosh
+Test "Real part of: cacosh (-2 - 3 i) == 1.9833870299165354323470769028940395 - 2.1414491111159960199416055713254211 i":
+double: 1
+float: 7
+idouble: 1
+ifloat: 7
+ildouble: 5
+ldouble: 5
+Test "Imaginary part of: cacosh (-2 - 3 i) == 1.9833870299165354323470769028940395 - 2.1414491111159960199416055713254211 i":
+double: 1
+float: 3
+idouble: 1
+ifloat: 3
+ildouble: 1
+ldouble: 1
+
+# casin
+Test "Real part of: casin (0.75 + 1.25 i) == 0.453276177638793913448921196101971749 + 1.13239363160530819522266333696834467 i":
+double: 1
+float: 1
+idouble: 1
+ifloat: 1
+Test "Imaginary part of: casin (0.75 + 1.25 i) == 0.453276177638793913448921196101971749 + 1.13239363160530819522266333696834467 i":
+ildouble: 1
+ldouble: 1
+
+# casinh
+Test "Real part of: casinh (-2 - 3 i) == -1.9686379257930962917886650952454982 - 0.96465850440760279204541105949953237 i":
+double: 5
+float: 1
+idouble: 5
+ifloat: 1
+ildouble: 4
+ldouble: 4
+Test "Imaginary part of: casinh (-2 - 3 i) == -1.9686379257930962917886650952454982 - 0.96465850440760279204541105949953237 i":
+double: 3
+float: 6
+idouble: 3
+ifloat: 6
+ildouble: 2
+ldouble: 2
+Test "Real part of: casinh (0.75 + 1.25 i) == 1.03171853444778027336364058631006594 + 0.911738290968487636358489564316731207 i":
+float: 1
+ifloat: 1
+ildouble: 1
+ldouble: 1
+Test "Imaginary part of: casinh (0.75 + 1.25 i) == 1.03171853444778027336364058631006594 + 0.911738290968487636358489564316731207 i":
+double: 1
+float: 1
+idouble: 1
+ifloat: 1
+ildouble: 1
+ldouble: 1
+
+# catan
+Test "Real part of: catan (-2 - 3 i) == -1.4099210495965755225306193844604208 - 0.22907268296853876629588180294200276 i":
+float: 3
+ifloat: 3
+Test "Imaginary part of: catan (-2 - 3 i) == -1.4099210495965755225306193844604208 - 0.22907268296853876629588180294200276 i":
+double: 1
+float: 1
+idouble: 1
+ifloat: 1
+Test "Real part of: catan (0.75 + 1.25 i) == 1.10714871779409050301706546017853704 + 0.549306144334054845697622618461262852 i":
+float: 4
+ifloat: 4
+Test "Imaginary part of: catan (0.75 + 1.25 i) == 1.10714871779409050301706546017853704 + 0.549306144334054845697622618461262852 i":
+ildouble: 1
+ldouble: 1
+
+# catanh
+Test "Real part of: catanh (-2 - 3 i) == -0.14694666622552975204743278515471595 - 1.3389725222944935611241935759091443 i":
+double: 4
+idouble: 4
+Test "Imaginary part of: catanh (-2 - 3 i) == -0.14694666622552975204743278515471595 - 1.3389725222944935611241935759091443 i":
+float: 4
+ifloat: 4
+Test "Real part of: catanh (0.75 + 1.25 i) == 0.261492138795671927078652057366532140 + 0.996825126463918666098902241310446708 i":
+double: 1
+idouble: 1
+ildouble: 1
+ldouble: 1
+Test "Imaginary part of: catanh (0.75 + 1.25 i) == 0.261492138795671927078652057366532140 + 0.996825126463918666098902241310446708 i":
+float: 6
+ifloat: 6
+ildouble: 1
+ldouble: 1
+
+# cbrt
+Test "cbrt (-0.001) == -0.1":
+ildouble: 1
+ldouble: 1
+Test "cbrt (-27.0) == -3.0":
+double: 1
+idouble: 1
+Test "cbrt (0.75) == 0.908560296416069829445605878163630251":
+double: 1
+idouble: 1
+Test "cbrt (0.9921875) == 0.997389022060725270579075195353955217":
+double: 1
+idouble: 1
+
+# ccos
+Test "Real part of: ccos (-2 - 3 i) == -4.18962569096880723013255501961597373 - 9.10922789375533659797919726277886212 i":
+ildouble: 1
+ldouble: 1
+Test "Imaginary part of: ccos (-2 - 3 i) == -4.18962569096880723013255501961597373 - 9.10922789375533659797919726277886212 i":
+float: 1
+ifloat: 1
+ildouble: 1
+ldouble: 1
+Test "Real part of: ccos (0.75 + 1.25 i) == 1.38173873063425888530729933139078645 - 1.09193013555397466170919531722024128 i":
+double: 1
+float: 1
+idouble: 1
+ifloat: 1
+Test "Imaginary part of: ccos (0.75 + 1.25 i) == 1.38173873063425888530729933139078645 - 1.09193013555397466170919531722024128 i":
+float: 1
+ifloat: 1
+
+# ccosh
+Test "Real part of: ccosh (-2 - 3 i) == -3.72454550491532256547397070325597253 + 0.511822569987384608834463849801875634 i":
+float: 1
+ifloat: 1
+ildouble: 1
+ldouble: 1
+Test "Imaginary part of: ccosh (-2 - 3 i) == -3.72454550491532256547397070325597253 + 0.511822569987384608834463849801875634 i":
+float: 1
+ifloat: 1
+ildouble: 1
+ldouble: 1
+Test "Real part of: ccosh (0.75 + 1.25 i) == 0.408242591877968807788852146397499084 + 0.780365930845853240391326216300863152 i":
+double: 1
+float: 1
+idouble: 1
+ifloat: 1
+Test "Imaginary part of: ccosh (0.75 + 1.25 i) == 0.408242591877968807788852146397499084 + 0.780365930845853240391326216300863152 i":
+float: 1
+ifloat: 1
+
+# cexp
+Test "Real part of: cexp (-2.0 - 3.0 i) == -0.13398091492954261346140525546115575 - 0.019098516261135196432576240858800925 i":
+ildouble: 1
+ldouble: 1
+Test "Imaginary part of: cexp (-2.0 - 3.0 i) == -0.13398091492954261346140525546115575 - 0.019098516261135196432576240858800925 i":
+float: 1
+ifloat: 1
+ildouble: 1
+ldouble: 1
+Test "Real part of: cexp (0.75 + 1.25 i) == 0.667537446429131586942201977015932112 + 2.00900045494094876258347228145863909 i":
+float: 1
+ifloat: 1
+Test "Imaginary part of: cexp (0.75 + 1.25 i) == 0.667537446429131586942201977015932112 + 2.00900045494094876258347228145863909 i":
+ildouble: 1
+ldouble: 1
+
+# clog
+Test "Imaginary part of: clog (-2 - 3 i) == 1.2824746787307683680267437207826593 - 2.1587989303424641704769327722648368 i":
+float: 3
+ifloat: 3
+Test "Real part of: clog (0.75 + 1.25 i) == 0.376885901188190075998919126749298416 + 1.03037682652431246378774332703115153 i":
+float: 1
+ifloat: 1
+ildouble: 1
+ldouble: 1
+
+# clog10
+Test "Imaginary part of: clog10 (-0 + inf i) == inf + pi/2*log10(e) i":
+double: 1
+float: 1
+idouble: 1
+ifloat: 1
+Test "Imaginary part of: clog10 (-0 - inf i) == inf - pi/2*log10(e) i":
+double: 1
+float: 1
+idouble: 1
+ifloat: 1
+Test "Real part of: clog10 (-2 - 3 i) == 0.556971676153418384603252578971164214 - 0.937554462986374708541507952140189646 i":
+ildouble: 1
+ldouble: 1
+Test "Imaginary part of: clog10 (-2 - 3 i) == 0.556971676153418384603252578971164214 - 0.937554462986374708541507952140189646 i":
+double: 1
+float: 5
+idouble: 1
+ifloat: 5
+ildouble: 1
+ldouble: 1
+Test "Imaginary part of: clog10 (-3 + inf i) == inf + pi/2*log10(e) i":
+double: 1
+float: 1
+idouble: 1
+ifloat: 1
+Test "Imaginary part of: clog10 (-3 - inf i) == inf - pi/2*log10(e) i":
+double: 1
+float: 1
+idouble: 1
+ifloat: 1
+Test "Imaginary part of: clog10 (-inf + 0 i) == inf + pi*log10(e) i":
+double: 1
+float: 1
+idouble: 1
+ifloat: 1
+Test "Imaginary part of: clog10 (-inf + 1 i) == inf + pi*log10(e) i":
+double: 1
+float: 1
+idouble: 1
+ifloat: 1
+Test "Imaginary part of: clog10 (-inf + inf i) == inf + 3/4 pi*log10(e) i":
+double: 1
+idouble: 1
+Test "Imaginary part of: clog10 (-inf - 0 i) == inf - pi*log10(e) i":
+double: 1
+float: 1
+idouble: 1
+ifloat: 1
+Test "Imaginary part of: clog10 (-inf - 1 i) == inf - pi*log10(e) i":
+double: 1
+float: 1
+idouble: 1
+ifloat: 1
+Test "Imaginary part of: clog10 (0 + inf i) == inf + pi/2*log10(e) i":
+double: 1
+float: 1
+idouble: 1
+ifloat: 1
+Test "Imaginary part of: clog10 (0 - inf i) == inf - pi/2*log10(e) i":
+double: 1
+float: 1
+idouble: 1
+ifloat: 1
+Test "Real part of: clog10 (0.75 + 1.25 i) == 0.163679467193165171449476605077428975 + 0.447486970040493067069984724340855636 i":
+float: 1
+ifloat: 1
+Test "Imaginary part of: clog10 (0.75 + 1.25 i) == 0.163679467193165171449476605077428975 + 0.447486970040493067069984724340855636 i":
+ildouble: 1
+ldouble: 1
+Test "Imaginary part of: clog10 (3 + inf i) == inf + pi/2*log10(e) i":
+double: 1
+float: 1
+idouble: 1
+ifloat: 1
+Test "Imaginary part of: clog10 (3 - inf i) == inf - pi/2*log10(e) i":
+double: 1
+float: 1
+idouble: 1
+ifloat: 1
+Test "Imaginary part of: clog10 (inf + inf i) == inf + pi/4*log10(e) i":
+double: 1
+float: 1
+idouble: 1
+ifloat: 1
+Test "Imaginary part of: clog10 (inf - inf i) == inf - pi/4*log10(e) i":
+double: 1
+float: 1
+idouble: 1
+ifloat: 1
+
+# cos
+Test "cos (M_PI_6l * 2.0) == 0.5":
+double: 1
+float: 1
+idouble: 1
+ifloat: 1
+ildouble: 1
+ldouble: 1
+Test "cos (M_PI_6l * 4.0) == -0.5":
+double: 2
+float: 1
+idouble: 2
+ifloat: 1
+ildouble: 1
+ldouble: 1
+Test "cos (pi/2) == 0":
+double: 1
+float: 1
+idouble: 1
+ifloat: 1
+ildouble: 1
+ldouble: 1
+
+# cpow
+Test "Real part of: cpow (0.75 + 1.25 i, 0.0 + 1.0 i) == 0.331825439177608832276067945276730566 + 0.131338600281188544930936345230903032 i":
+float: 1
+ifloat: 1
+Test "Imaginary part of: cpow (0.75 + 1.25 i, 0.0 + 1.0 i) == 0.331825439177608832276067945276730566 + 0.131338600281188544930936345230903032 i":
+float: 1
+ifloat: 1
+Test "Real part of: cpow (0.75 + 1.25 i, 0.75 + 1.25 i) == 0.117506293914473555420279832210420483 + 0.346552747708338676483025352060418001 i":
+double: 1
+float: 4
+idouble: 1
+ifloat: 4
+ildouble: 4
+ldouble: 4
+Test "Real part of: cpow (0.75 + 1.25 i, 1.0 + 0.0 i) == 0.75 + 1.25 i":
+ildouble: 2
+ldouble: 2
+Test "Imaginary part of: cpow (0.75 + 1.25 i, 1.0 + 0.0 i) == 0.75 + 1.25 i":
+ildouble: 1
+ldouble: 1
+Test "Real part of: cpow (0.75 + 1.25 i, 1.0 + 1.0 i) == 0.0846958290317209430433805274189191353 + 0.513285749182902449043287190519090481 i":
+double: 2
+float: 3
+idouble: 2
+ifloat: 3
+ildouble: 10
+ldouble: 10
+Test "Real part of: cpow (2 + 0 i, 10 + 0 i) == 1024.0 + 0.0 i":
+ildouble: 2
+ldouble: 2
+Test "Real part of: cpow (2 + 3 i, 4 + 0 i) == -119.0 - 120.0 i":
+double: 1
+float: 4
+idouble: 1
+ifloat: 4
+ildouble: 3
+ldouble: 3
+Test "Imaginary part of: cpow (2 + 3 i, 4 + 0 i) == -119.0 - 120.0 i":
+float: 2
+ifloat: 2
+Test "Imaginary part of: cpow (e + 0 i, 0 + 2 * M_PIl i) == 1.0 + 0.0 i":
+double: 2
+float: 2
+idouble: 2
+ifloat: 2
+ildouble: 1
+ldouble: 1
+
+# csin
+Test "Imaginary part of: csin (-2 - 3 i) == -9.15449914691142957346729954460983256 + 4.16890695996656435075481305885375484 i":
+ildouble: 1
+ldouble: 1
+Test "Real part of: csin (0.75 + 1.25 i) == 1.28722291002649188575873510790565441 + 1.17210635989270256101081285116138863 i":
+ildouble: 1
+ldouble: 1
+
+# csinh
+Test "Real part of: csinh (-2 - 3 i) == 3.59056458998577995201256544779481679 - 0.530921086248519805267040090660676560 i":
+ildouble: 1
+ldouble: 1
+Test "Imaginary part of: csinh (-2 - 3 i) == 3.59056458998577995201256544779481679 - 0.530921086248519805267040090660676560 i":
+double: 1
+idouble: 1
+Test "Real part of: csinh (0.75 + 1.25 i) == 0.259294854551162779153349830618433028 + 1.22863452409509552219214606515777594 i":
+float: 1
+ifloat: 1
+Test "Imaginary part of: csinh (0.75 + 1.25 i) == 0.259294854551162779153349830618433028 + 1.22863452409509552219214606515777594 i":
+float: 1
+ifloat: 1
+
+# csqrt
+Test "Real part of: csqrt (-2 + 3 i) == 0.89597747612983812471573375529004348 + 1.6741492280355400404480393008490519 i":
+float: 1
+ifloat: 1
+ildouble: 1
+ldouble: 1
+Test "Real part of: csqrt (-2 - 3 i) == 0.89597747612983812471573375529004348 - 1.6741492280355400404480393008490519 i":
+float: 1
+ifloat: 1
+ildouble: 1
+ldouble: 1
+Test "Imaginary part of: csqrt (0.75 + 1.25 i) == 1.05065169626078392338656675760808326 + 0.594868882070379067881984030639932657 i":
+ildouble: 1
+ldouble: 1
+
+# ctan
+Test "Real part of: ctan (-2 - 3 i) == 0.376402564150424829275122113032269084e-2 - 1.00323862735360980144635859782192726 i":
+double: 1
+idouble: 1
+ildouble: 1
+ldouble: 1
+Test "Imaginary part of: ctan (-2 - 3 i) == 0.376402564150424829275122113032269084e-2 - 1.00323862735360980144635859782192726 i":
+ildouble: 1
+ldouble: 1
+Test "Imaginary part of: ctan (0.75 + 1.25 i) == 0.160807785916206426725166058173438663 + 0.975363285031235646193581759755216379 i":
+double: 1
+idouble: 1
+ildouble: 2
+ldouble: 2
+
+# ctanh
+Test "Real part of: ctanh (-2 - 3 i) == -0.965385879022133124278480269394560686 + 0.988437503832249372031403430350121098e-2 i":
+double: 1
+float: 2
+idouble: 1
+ifloat: 2
+ildouble: 1
+ldouble: 1
+Test "Imaginary part of: ctanh (-2 - 3 i) == -0.965385879022133124278480269394560686 + 0.988437503832249372031403430350121098e-2 i":
+ildouble: 1
+ldouble: 1
+Test "Imaginary part of: ctanh (0 + pi/4 i) == 0.0 + 1.0 i":
+float: 1
+ifloat: 1
+Test "Real part of: ctanh (0.75 + 1.25 i) == 1.37260757053378320258048606571226857 + 0.385795952609750664177596760720790220 i":
+double: 1
+idouble: 1
+
+# erf
+Test "erf (1.25) == 0.922900128256458230136523481197281140":
+double: 1
+idouble: 1
+
+# erfc
+Test "erfc (2.0) == 0.00467773498104726583793074363274707139":
+double: 1
+idouble: 1
+Test "erfc (27.0) == 0.523704892378925568501606768284954709e-318":
+ildouble: 1
+ldouble: 1
+Test "erfc (4.125) == 0.542340079956506600531223408575531062e-8":
+double: 1
+idouble: 1
+
+# exp10
+Test "exp10 (-1) == 0.1":
+double: 2
+float: 1
+idouble: 2
+ifloat: 1
+Test "exp10 (0.75) == 5.62341325190349080394951039776481231":
+double: 1
+float: 1
+idouble: 1
+ifloat: 1
+Test "exp10 (3) == 1000":
+double: 6
+float: 2
+idouble: 6
+ifloat: 2
+ildouble: 1
+ldouble: 1
+
+# exp2
+Test "exp2 (10) == 1024":
+ildouble: 2
+ldouble: 2
+
+# expm1
+Test "expm1 (0.75) == 1.11700001661267466854536981983709561":
+double: 1
+idouble: 1
+Test "expm1 (1) == M_El - 1.0":
+double: 1
+float: 1
+idouble: 1
+ifloat: 1
+ildouble: 1
+ldouble: 1
+
+# gamma
+Test "gamma (-0.5) == log(2*sqrt(pi))":
+ildouble: 1
+ldouble: 1
+
+# hypot
+Test "hypot (-0.7, -12.4) == 12.419742348374220601176836866763271":
+float: 1
+ifloat: 1
+Test "hypot (-0.7, 12.4) == 12.419742348374220601176836866763271":
+float: 1
+ifloat: 1
+Test "hypot (-12.4, -0.7) == 12.419742348374220601176836866763271":
+float: 1
+ifloat: 1
+Test "hypot (-12.4, 0.7) == 12.419742348374220601176836866763271":
+float: 1
+ifloat: 1
+Test "hypot (0.7, -12.4) == 12.419742348374220601176836866763271":
+float: 1
+ifloat: 1
+Test "hypot (0.7, 12.4) == 12.419742348374220601176836866763271":
+float: 1
+ifloat: 1
+Test "hypot (12.4, -0.7) == 12.419742348374220601176836866763271":
+float: 1
+ifloat: 1
+Test "hypot (12.4, 0.7) == 12.419742348374220601176836866763271":
+float: 1
+ifloat: 1
+
+# j0
+Test "j0 (-4.0) == -3.9714980986384737228659076845169804197562E-1":
+double: 1
+float: 1
+idouble: 1
+ifloat: 1
+Test "j0 (0.75) == 0.864242275166648623555731103820923211":
+float: 1
+ifloat: 1
+Test "j0 (10.0) == -0.245935764451348335197760862485328754":
+double: 2
+float: 1
+idouble: 2
+ifloat: 1
+ildouble: 2
+ldouble: 2
+Test "j0 (2.0) == 0.223890779141235668051827454649948626":
+float: 2
+ifloat: 2
+ildouble: 2
+ldouble: 2
+Test "j0 (4.0) == -3.9714980986384737228659076845169804197562E-1":
+double: 1
+float: 1
+idouble: 1
+ifloat: 1
+Test "j0 (8.0) == 0.171650807137553906090869407851972001":
+float: 1
+ifloat: 1
+ildouble: 1
+ldouble: 1
+
+# j1
+Test "j1 (-1.0) == -0.440050585744933515959682203718914913":
+ildouble: 1
+ldouble: 1
+Test "j1 (0.75) == 0.349243602174862192523281016426251335":
+ildouble: 1
+ldouble: 1
+Test "j1 (1.0) == 0.440050585744933515959682203718914913":
+ildouble: 1
+ldouble: 1
+Test "j1 (10.0) == 0.0434727461688614366697487680258592883":
+float: 2
+ifloat: 2
+ildouble: 2
+ldouble: 2
+Test "j1 (2.0) == 0.576724807756873387202448242269137087":
+double: 1
+idouble: 1
+Test "j1 (8.0) == 0.234636346853914624381276651590454612":
+double: 1
+idouble: 1
+ildouble: 4
+ldouble: 4
+
+# jn
+Test "jn (0, -4.0) == -3.9714980986384737228659076845169804197562E-1":
+double: 1
+float: 1
+idouble: 1
+ifloat: 1
+Test "jn (0, 0.75) == 0.864242275166648623555731103820923211":
+float: 1
+ifloat: 1
+Test "jn (0, 10.0) == -0.245935764451348335197760862485328754":
+double: 2
+float: 1
+idouble: 2
+ifloat: 1
+ildouble: 2
+ldouble: 2
+Test "jn (0, 2.0) == 0.223890779141235668051827454649948626":
+float: 2
+ifloat: 2
+ildouble: 2
+ldouble: 2
+Test "jn (0, 4.0) == -3.9714980986384737228659076845169804197562E-1":
+double: 1
+float: 1
+idouble: 1
+ifloat: 1
+Test "jn (0, 8.0) == 0.171650807137553906090869407851972001":
+float: 1
+ifloat: 1
+ildouble: 1
+ldouble: 1
+Test "jn (1, -1.0) == -0.440050585744933515959682203718914913":
+ildouble: 1
+ldouble: 1
+Test "jn (1, 0.75) == 0.349243602174862192523281016426251335":
+ildouble: 1
+ldouble: 1
+Test "jn (1, 1.0) == 0.440050585744933515959682203718914913":
+ildouble: 1
+ldouble: 1
+Test "jn (1, 10.0) == 0.0434727461688614366697487680258592883":
+float: 2
+ifloat: 2
+ildouble: 2
+ldouble: 2
+Test "jn (1, 2.0) == 0.576724807756873387202448242269137087":
+double: 1
+idouble: 1
+Test "jn (1, 8.0) == 0.234636346853914624381276651590454612":
+double: 1
+idouble: 1
+ildouble: 4
+ldouble: 4
+Test "jn (10, -1.0) == 0.263061512368745320699785368779050294e-9":
+ildouble: 1
+ldouble: 1
+Test "jn (10, 0.125) == 0.250543369809369890173993791865771547e-18":
+double: 1
+float: 1
+idouble: 1
+ifloat: 1
+ildouble: 1
+ldouble: 1
+Test "jn (10, 0.75) == 0.149621713117596814698712483621682835e-10":
+double: 1
+float: 1
+idouble: 1
+ifloat: 1
+ildouble: 1
+ldouble: 1
+Test "jn (10, 1.0) == 0.263061512368745320699785368779050294e-9":
+ildouble: 1
+ldouble: 1
+Test "jn (10, 10.0) == 0.207486106633358857697278723518753428":
+double: 4
+float: 3
+idouble: 4
+ifloat: 3
+ildouble: 2
+ldouble: 2
+Test "jn (10, 2.0) == 0.251538628271673670963516093751820639e-6":
+float: 4
+ifloat: 4
+Test "jn (3, 0.125) == 0.406503832554912875023029337653442868e-4":
+double: 1
+float: 1
+idouble: 1
+ifloat: 1
+Test "jn (3, 0.75) == 0.848438342327410884392755236884386804e-2":
+double: 1
+float: 1
+idouble: 1
+ifloat: 1
+Test "jn (3, 10.0) == 0.0583793793051868123429354784103409563":
+double: 3
+float: 1
+idouble: 3
+ifloat: 1
+ildouble: 2
+ldouble: 2
+Test "jn (3, 2.0) == 0.128943249474402051098793332969239835":
+double: 1
+float: 2
+idouble: 1
+ifloat: 2
+
+# lgamma
+Test "lgamma (-0.5) == log(2*sqrt(pi))":
+ildouble: 1
+ldouble: 1
+Test "lgamma (0.7) == 0.260867246531666514385732417016759578":
+double: 1
+float: 1
+idouble: 1
+ifloat: 1
+ildouble: 1
+ldouble: 1
+Test "lgamma (1.2) == -0.853740900033158497197028392998854470e-1":
+double: 1
+float: 2
+idouble: 1
+ifloat: 2
+ildouble: 1
+ldouble: 1
+
+# log10
+Test "log10 (0.75) == -0.124938736608299953132449886193870744":
+double: 1
+float: 2
+idouble: 1
+ifloat: 2
+Test "log10 (e) == log10(e)":
+float: 1
+ifloat: 1
+ildouble: 1
+ldouble: 1
+
+# log1p
+Test "log1p (-0.25) == -0.287682072451780927439219005993827432":
+float: 1
+ifloat: 1
+Test "log1p (M_El - 1.0) == 1":
+ildouble: 1
+ldouble: 1
+
+# log2
+Test "log2 (0.75) == -.415037499278843818546261056052183492":
+ildouble: 1
+ldouble: 1
+
+# sincos
+Test "sincos (M_PI_6l*2.0, &sin_res, &cos_res) puts 0.5 in cos_res":
+double: 1
+float: 1
+idouble: 1
+ifloat: 1
+ildouble: 1
+ldouble: 1
+Test "sincos (M_PI_6l*2.0, &sin_res, &cos_res) puts 0.86602540378443864676372317075293616 in sin_res":
+double: 1
+float: 1
+idouble: 1
+ifloat: 1
+ildouble: 1
+ldouble: 1
+Test "sincos (pi/2, &sin_res, &cos_res) puts 0 in cos_res":
+double: 1
+float: 1
+idouble: 1
+ifloat: 1
+ildouble: 1
+ldouble: 1
+Test "sincos (pi/6, &sin_res, &cos_res) puts 0.86602540378443864676372317075293616 in cos_res":
+float: 1
+ifloat: 1
+
+# sqrt
+Test "sqrt (2) == M_SQRT2l":
+ildouble: 1
+ldouble: 1
+
+# tan
+Test "tan (pi/4) == 1":
+double: 1
+idouble: 1
+
+# tanh
+Test "tanh (-0.75) == -0.635148952387287319214434357312496495":
+ildouble: 1
+ldouble: 1
+Test "tanh (-1.0) == -0.7615941559557648881194582826047935904":
+ildouble: 1
+ldouble: 1
+Test "tanh (0.75) == 0.635148952387287319214434357312496495":
+ildouble: 1
+ldouble: 1
+Test "tanh (1.0) == 0.7615941559557648881194582826047935904":
+ildouble: 1
+ldouble: 1
+
+# tgamma
+Test "tgamma (-0.5) == -2 sqrt (pi)":
+double: 1
+float: 1
+idouble: 1
+ifloat: 1
+ildouble: 1
+ldouble: 1
+Test "tgamma (0.5) == sqrt (pi)":
+float: 1
+ifloat: 1
+Test "tgamma (0.7) == 1.29805533264755778568117117915281162":
+double: 1
+float: 1
+idouble: 1
+ifloat: 1
+Test "tgamma (4) == 6":
+ildouble: 1
+ldouble: 1
+
+# y0
+Test "y0 (1.0) == 0.0882569642156769579829267660235151628":
+double: 2
+float: 1
+idouble: 2
+ifloat: 1
+Test "y0 (1.5) == 0.382448923797758843955068554978089862":
+double: 2
+float: 1
+idouble: 2
+ifloat: 1
+Test "y0 (10.0) == 0.0556711672835993914244598774101900481":
+float: 1
+ifloat: 1
+ildouble: 3
+ldouble: 3
+Test "y0 (8.0) == 0.223521489387566220527323400498620359":
+double: 1
+float: 1
+idouble: 1
+ifloat: 1
+ildouble: 3
+ldouble: 3
+
+# y1
+Test "y1 (0.125) == -5.19993611253477499595928744876579921":
+double: 1
+idouble: 1
+Test "y1 (0.75) == -1.03759455076928541973767132140642198":
+ildouble: 1
+ldouble: 1
+Test "y1 (1.5) == -0.412308626973911295952829820633445323":
+float: 1
+ifloat: 1
+ildouble: 1
+ldouble: 1
+Test "y1 (10.0) == 0.249015424206953883923283474663222803":
+double: 3
+float: 1
+idouble: 3
+ifloat: 1
+Test "y1 (2.0) == -0.107032431540937546888370772277476637":
+double: 1
+float: 1
+idouble: 1
+ifloat: 1
+ildouble: 1
+ldouble: 1
+Test "y1 (8.0) == -0.158060461731247494255555266187483550":
+double: 1
+float: 2
+idouble: 1
+ifloat: 2
+ildouble: 1
+ldouble: 1
+
+# yn
+Test "yn (0, 1.0) == 0.0882569642156769579829267660235151628":
+double: 2
+float: 1
+idouble: 2
+ifloat: 1
+Test "yn (0, 1.5) == 0.382448923797758843955068554978089862":
+double: 2
+float: 1
+idouble: 2
+ifloat: 1
+Test "yn (0, 10.0) == 0.0556711672835993914244598774101900481":
+float: 1
+ifloat: 1
+ildouble: 3
+ldouble: 3
+Test "yn (0, 8.0) == 0.223521489387566220527323400498620359":
+double: 1
+float: 1
+idouble: 1
+ifloat: 1
+ildouble: 3
+ldouble: 3
+Test "yn (1, 0.125) == -5.19993611253477499595928744876579921":
+double: 1
+idouble: 1
+Test "yn (1, 0.75) == -1.03759455076928541973767132140642198":
+ildouble: 1
+ldouble: 1
+Test "yn (1, 1.5) == -0.412308626973911295952829820633445323":
+float: 1
+ifloat: 1
+ildouble: 1
+ldouble: 1
+Test "yn (1, 10.0) == 0.249015424206953883923283474663222803":
+double: 3
+float: 1
+idouble: 3
+ifloat: 1
+Test "yn (1, 2.0) == -0.107032431540937546888370772277476637":
+double: 1
+float: 1
+idouble: 1
+ifloat: 1
+ildouble: 1
+ldouble: 1
+Test "yn (1, 8.0) == -0.158060461731247494255555266187483550":
+double: 1
+float: 2
+idouble: 1
+ifloat: 2
+ildouble: 1
+ldouble: 1
+Test "yn (10, 0.125) == -127057845771019398.252538486899753195":
+double: 1
+idouble: 1
+ildouble: 2
+ldouble: 2
+Test "yn (10, 0.75) == -2133501638.90573424452445412893839236":
+double: 1
+float: 1
+idouble: 1
+ifloat: 1
+ildouble: 5
+ldouble: 5
+Test "yn (10, 1.0) == -121618014.278689189288130426667971145":
+double: 1
+idouble: 1
+ildouble: 1
+ldouble: 1
+Test "yn (10, 10.0) == -0.359814152183402722051986577343560609":
+double: 1
+float: 1
+idouble: 1
+ifloat: 1
+ildouble: 2
+ldouble: 2
+Test "yn (10, 2.0) == -129184.542208039282635913145923304214":
+double: 2
+idouble: 2
+ildouble: 2
+ldouble: 2
+Test "yn (3, 0.125) == -2612.69757350066712600220955744091741":
+double: 1
+idouble: 1
+Test "yn (3, 0.75) == -12.9877176234475433186319774484809207":
+double: 1
+float: 1
+idouble: 1
+ifloat: 1
+ildouble: 2
+ldouble: 2
+Test "yn (3, 10.0) == -0.251362657183837329779204747654240998":
+double: 1
+float: 1
+idouble: 1
+ifloat: 1
+ildouble: 1
+ldouble: 1
+Test "yn (3, 2.0) == -1.12778377684042778608158395773179238":
+double: 1
+idouble: 1
+
+# Maximal error of functions:
+Function: "atan2":
+float: 6
+ifloat: 6
+ildouble: 1
+ldouble: 1
+
+Function: "atanh":
+float: 1
+ifloat: 1
+
+Function: Imaginary part of "cacos":
+ildouble: 1
+ldouble: 1
+
+Function: Real part of "cacosh":
+double: 1
+float: 7
+idouble: 1
+ifloat: 7
+ildouble: 5
+ldouble: 5
+
+Function: Imaginary part of "cacosh":
+double: 1
+float: 3
+idouble: 1
+ifloat: 3
+ildouble: 1
+ldouble: 1
+
+Function: Real part of "casin":
+double: 1
+float: 1
+idouble: 1
+ifloat: 1
+
+Function: Imaginary part of "casin":
+ildouble: 1
+ldouble: 1
+
+Function: Real part of "casinh":
+double: 5
+float: 1
+idouble: 5
+ifloat: 1
+ildouble: 4
+ldouble: 4
+
+Function: Imaginary part of "casinh":
+double: 3
+float: 6
+idouble: 3
+ifloat: 6
+ildouble: 2
+ldouble: 2
+
+Function: Real part of "catan":
+float: 4
+ifloat: 4
+
+Function: Imaginary part of "catan":
+double: 1
+float: 1
+idouble: 1
+ifloat: 1
+ildouble: 1
+ldouble: 1
+
+Function: Real part of "catanh":
+double: 4
+idouble: 4
+ildouble: 1
+ldouble: 1
+
+Function: Imaginary part of "catanh":
+float: 6
+ifloat: 6
+ildouble: 1
+ldouble: 1
+
+Function: "cbrt":
+double: 1
+idouble: 1
+ildouble: 1
+ldouble: 1
+
+Function: Real part of "ccos":
+double: 1
+float: 1
+idouble: 1
+ifloat: 1
+ildouble: 1
+ldouble: 1
+
+Function: Imaginary part of "ccos":
+float: 1
+ifloat: 1
+ildouble: 1
+ldouble: 1
+
+Function: Real part of "ccosh":
+double: 1
+float: 1
+idouble: 1
+ifloat: 1
+ildouble: 1
+ldouble: 1
+
+Function: Imaginary part of "ccosh":
+float: 1
+ifloat: 1
+ildouble: 1
+ldouble: 1
+
+Function: Real part of "cexp":
+float: 1
+ifloat: 1
+ildouble: 1
+ldouble: 1
+
+Function: Imaginary part of "cexp":
+float: 1
+ifloat: 1
+ildouble: 1
+ldouble: 1
+
+Function: Real part of "clog":
+float: 1
+ifloat: 1
+ildouble: 1
+ldouble: 1
+
+Function: Imaginary part of "clog":
+float: 3
+ifloat: 3
+
+Function: Real part of "clog10":
+float: 1
+ifloat: 1
+ildouble: 1
+ldouble: 1
+
+Function: Imaginary part of "clog10":
+double: 1
+float: 5
+idouble: 1
+ifloat: 5
+ildouble: 1
+ldouble: 1
+
+Function: "cos":
+double: 2
+float: 1
+idouble: 2
+ifloat: 1
+ildouble: 1
+ldouble: 1
+
+Function: Real part of "cpow":
+double: 2
+float: 4
+idouble: 2
+ifloat: 4
+ildouble: 10
+ldouble: 10
+
+Function: Imaginary part of "cpow":
+double: 2
+float: 2
+idouble: 2
+ifloat: 2
+ildouble: 1
+ldouble: 1
+
+Function: Real part of "csin":
+ildouble: 1
+ldouble: 1
+
+Function: Imaginary part of "csin":
+ildouble: 1
+ldouble: 1
+
+Function: Real part of "csinh":
+float: 1
+ifloat: 1
+ildouble: 1
+ldouble: 1
+
+Function: Imaginary part of "csinh":
+double: 1
+float: 1
+idouble: 1
+ifloat: 1
+
+Function: Real part of "csqrt":
+float: 1
+ifloat: 1
+ildouble: 1
+ldouble: 1
+
+Function: Imaginary part of "csqrt":
+ildouble: 1
+ldouble: 1
+
+Function: Real part of "ctan":
+double: 1
+idouble: 1
+ildouble: 1
+ldouble: 1
+
+Function: Imaginary part of "ctan":
+double: 1
+idouble: 1
+ildouble: 2
+ldouble: 2
+
+Function: Real part of "ctanh":
+double: 1
+float: 2
+idouble: 1
+ifloat: 2
+ildouble: 1
+ldouble: 1
+
+Function: Imaginary part of "ctanh":
+float: 1
+ifloat: 1
+ildouble: 1
+ldouble: 1
+
+Function: "erf":
+double: 1
+idouble: 1
+
+Function: "erfc":
+double: 1
+idouble: 1
+ildouble: 1
+ldouble: 1
+
+Function: "exp10":
+double: 6
+float: 2
+idouble: 6
+ifloat: 2
+ildouble: 1
+ldouble: 1
+
+Function: "exp2":
+ildouble: 2
+ldouble: 2
+
+Function: "expm1":
+double: 1
+float: 1
+idouble: 1
+ifloat: 1
+ildouble: 1
+ldouble: 1
+
+Function: "gamma":
+ildouble: 1
+ldouble: 1
+
+Function: "hypot":
+float: 1
+ifloat: 1
+
+Function: "j0":
+double: 2
+float: 2
+idouble: 2
+ifloat: 2
+ildouble: 2
+ldouble: 2
+
+Function: "j1":
+double: 1
+float: 2
+idouble: 1
+ifloat: 2
+ildouble: 4
+ldouble: 4
+
+Function: "jn":
+double: 4
+float: 4
+idouble: 4
+ifloat: 4
+ildouble: 4
+ldouble: 4
+
+Function: "lgamma":
+double: 1
+float: 2
+idouble: 1
+ifloat: 2
+ildouble: 1
+ldouble: 1
+
+Function: "log10":
+double: 1
+float: 2
+idouble: 1
+ifloat: 2
+ildouble: 1
+ldouble: 1
+
+Function: "log1p":
+float: 1
+ifloat: 1
+ildouble: 1
+ldouble: 1
+
+Function: "log2":
+ildouble: 1
+ldouble: 1
+
+Function: "sincos":
+double: 1
+float: 1
+idouble: 1
+ifloat: 1
+ildouble: 1
+ldouble: 1
+
+Function: "sqrt":
+ildouble: 1
+ldouble: 1
+
+Function: "tan":
+double: 1
+idouble: 1
+
+Function: "tanh":
+ildouble: 1
+ldouble: 1
+
+Function: "tgamma":
+double: 1
+float: 1
+idouble: 1
+ifloat: 1
+ildouble: 1
+ldouble: 1
+
+Function: "y0":
+double: 2
+float: 1
+idouble: 2
+ifloat: 1
+ildouble: 3
+ldouble: 3
+
+Function: "y1":
+double: 3
+float: 2
+idouble: 3
+ifloat: 2
+ildouble: 1
+ldouble: 1
+
+Function: "yn":
+double: 3
+float: 2
+idouble: 3
+ifloat: 2
+ildouble: 5
+ldouble: 5
+
+# end of automatic generation
diff --git a/ap/build/uClibc/test/math/libm-test-ulps-x86_64 b/ap/build/uClibc/test/math/libm-test-ulps-x86_64
new file mode 100644
index 0000000..0ced4be
--- /dev/null
+++ b/ap/build/uClibc/test/math/libm-test-ulps-x86_64
@@ -0,0 +1,1308 @@
+# Begin of automatic generation
+
+# acos
+Test "acos (0.75) == 0.722734247813415611178377352641333362":
+ildouble: 1
+ldouble: 1
+
+# asin
+Test "asin (-0.5) == -pi/6":
+ildouble: 1
+ldouble: 1
+Test "asin (-1.0) == -pi/2":
+ildouble: 1
+ldouble: 1
+Test "asin (0.5) == pi/6":
+ildouble: 1
+ldouble: 1
+Test "asin (0.75) == 0.848062078981481008052944338998418080":
+ildouble: 1
+ldouble: 1
+Test "asin (1.0) == pi/2":
+ildouble: 1
+ldouble: 1
+
+# atan2
+Test "atan2 (-0.75, -1.0) == -2.49809154479650885165983415456218025":
+float: 1
+ifloat: 1
+Test "atan2 (0.75, -1.0) == 2.49809154479650885165983415456218025":
+float: 1
+ifloat: 1
+Test "atan2 (1.390625, 0.9296875) == 0.981498387184244311516296577615519772":
+float: 1
+ifloat: 1
+
+# atanh
+Test "atanh (0.75) == 0.972955074527656652552676371721589865":
+float: 1
+ifloat: 1
+ildouble: 1
+ldouble: 1
+
+# cacos
+Test "Imaginary part of: cacos (0.75 + 1.25 i) == 1.11752014915610270578240049553777969 - 1.13239363160530819522266333696834467 i":
+float: 1
+ifloat: 1
+ildouble: 2
+ldouble: 2
+
+# cacosh
+Test "Real part of: cacosh (-2 - 3 i) == 1.9833870299165354323470769028940395 - 2.1414491111159960199416055713254211 i":
+double: 1
+float: 7
+idouble: 1
+ifloat: 7
+ildouble: 6
+ldouble: 6
+Test "Imaginary part of: cacosh (-2 - 3 i) == 1.9833870299165354323470769028940395 - 2.1414491111159960199416055713254211 i":
+double: 1
+float: 3
+idouble: 1
+ifloat: 3
+ildouble: 1
+ldouble: 1
+Test "Real part of: cacosh (0.75 + 1.25 i) == 1.13239363160530819522266333696834467 + 1.11752014915610270578240049553777969 i":
+ildouble: 1
+ldouble: 1
+
+# casin
+Test "Real part of: casin (0.75 + 1.25 i) == 0.453276177638793913448921196101971749 + 1.13239363160530819522266333696834467 i":
+double: 1
+float: 1
+idouble: 1
+ifloat: 1
+ildouble: 2
+ldouble: 2
+Test "Imaginary part of: casin (0.75 + 1.25 i) == 0.453276177638793913448921196101971749 + 1.13239363160530819522266333696834467 i":
+float: 1
+ifloat: 1
+ildouble: 2
+ldouble: 2
+
+# casinh
+Test "Real part of: casinh (-2 - 3 i) == -1.9686379257930962917886650952454982 - 0.96465850440760279204541105949953237 i":
+double: 5
+float: 1
+idouble: 5
+ifloat: 1
+ildouble: 5
+ldouble: 5
+Test "Imaginary part of: casinh (-2 - 3 i) == -1.9686379257930962917886650952454982 - 0.96465850440760279204541105949953237 i":
+double: 3
+float: 6
+idouble: 3
+ifloat: 6
+ildouble: 5
+ldouble: 5
+Test "Real part of: casinh (0.75 + 1.25 i) == 1.03171853444778027336364058631006594 + 0.911738290968487636358489564316731207 i":
+float: 1
+ifloat: 1
+Test "Imaginary part of: casinh (0.75 + 1.25 i) == 1.03171853444778027336364058631006594 + 0.911738290968487636358489564316731207 i":
+double: 1
+float: 1
+idouble: 1
+ifloat: 1
+ldouble: 1
+ildouble: 1
+
+# catan
+Test "Real part of: catan (-2 - 3 i) == -1.4099210495965755225306193844604208 - 0.22907268296853876629588180294200276 i":
+float: 3
+ifloat: 3
+Test "Imaginary part of: catan (-2 - 3 i) == -1.4099210495965755225306193844604208 - 0.22907268296853876629588180294200276 i":
+double: 1
+float: 1
+idouble: 1
+ifloat: 1
+Test "Real part of: catan (0.75 + 1.25 i) == 1.10714871779409050301706546017853704 + 0.549306144334054845697622618461262852 i":
+float: 4
+ifloat: 4
+
+# catanh
+Test "Real part of: catanh (-2 - 3 i) == -0.14694666622552975204743278515471595 - 1.3389725222944935611241935759091443 i":
+double: 4
+idouble: 4
+ildouble: 1
+ldouble: 1
+Test "Imaginary part of: catanh (-2 - 3 i) == -0.14694666622552975204743278515471595 - 1.3389725222944935611241935759091443 i":
+float: 4
+ifloat: 4
+Test "Real part of: catanh (0.75 + 1.25 i) == 0.261492138795671927078652057366532140 + 0.996825126463918666098902241310446708 i":
+double: 1
+idouble: 1
+Test "Imaginary part of: catanh (0.75 + 1.25 i) == 0.261492138795671927078652057366532140 + 0.996825126463918666098902241310446708 i":
+float: 6
+ifloat: 6
+
+# cbrt
+Test "cbrt (-0.001) == -0.1":
+ildouble: 1
+ldouble: 1
+Test "cbrt (-27.0) == -3.0":
+double: 1
+idouble: 1
+Test "cbrt (0.75) == 0.908560296416069829445605878163630251":
+double: 1
+idouble: 1
+Test "cbrt (0.9921875) == 0.997389022060725270579075195353955217":
+double: 1
+idouble: 1
+ildouble: 1
+ldouble: 1
+
+# ccos
+Test "Real part of: ccos (-2 - 3 i) == -4.18962569096880723013255501961597373 - 9.10922789375533659797919726277886212 i":
+double: 1
+idouble: 1
+Test "Imaginary part of: ccos (-2 - 3 i) == -4.18962569096880723013255501961597373 - 9.10922789375533659797919726277886212 i":
+float: 1
+ifloat: 1
+ildouble: 1
+ldouble: 1
+Test "Real part of: ccos (0.75 + 1.25 i) == 1.38173873063425888530729933139078645 - 1.09193013555397466170919531722024128 i":
+double: 1
+float: 1
+idouble: 1
+ifloat: 1
+ildouble: 1
+ldouble: 1
+Test "Imaginary part of: ccos (0.75 + 1.25 i) == 1.38173873063425888530729933139078645 - 1.09193013555397466170919531722024128 i":
+ildouble: 1
+ldouble: 1
+float: 1
+ifloat: 1
+
+# ccosh
+Test "Real part of: ccosh (-2 - 3 i) == -3.72454550491532256547397070325597253 + 0.511822569987384608834463849801875634 i":
+float: 1
+ifloat: 1
+Test "Imaginary part of: ccosh (-2 - 3 i) == -3.72454550491532256547397070325597253 + 0.511822569987384608834463849801875634 i":
+double: 1
+float: 1
+idouble: 1
+ifloat: 1
+ildouble: 1
+ldouble: 1
+Test "Real part of: ccosh (0.75 + 1.25 i) == 0.408242591877968807788852146397499084 + 0.780365930845853240391326216300863152 i":
+double: 1
+float: 1
+idouble: 1
+ifloat: 1
+Test "Imaginary part of: ccosh (0.75 + 1.25 i) == 0.408242591877968807788852146397499084 + 0.780365930845853240391326216300863152 i":
+float: 1
+ifloat: 1
+
+# cexp
+Test "Imaginary part of: cexp (-2.0 - 3.0 i) == -0.13398091492954261346140525546115575 - 0.019098516261135196432576240858800925 i":
+float: 1
+ifloat: 1
+Test "Real part of: cexp (0.75 + 1.25 i) == 0.667537446429131586942201977015932112 + 2.00900045494094876258347228145863909 i":
+float: 1
+ifloat: 1
+Test "Imaginary part of: cexp (0.75 + 1.25 i) == 0.667537446429131586942201977015932112 + 2.00900045494094876258347228145863909 i":
+ildouble: 1
+ldouble: 1
+
+# clog
+Test "Imaginary part of: clog (-2 - 3 i) == 1.2824746787307683680267437207826593 - 2.1587989303424641704769327722648368 i":
+float: 3
+ifloat: 3
+Test "Real part of: clog (0.75 + 1.25 i) == 0.376885901188190075998919126749298416 + 1.03037682652431246378774332703115153 i":
+float: 1
+ifloat: 1
+ildouble: 1
+ldouble: 1
+
+# clog10
+Test "Imaginary part of: clog10 (-0 + inf i) == inf + pi/2*log10(e) i":
+double: 1
+float: 1
+idouble: 1
+ifloat: 1
+Test "Imaginary part of: clog10 (-0 - inf i) == inf - pi/2*log10(e) i":
+double: 1
+float: 1
+idouble: 1
+ifloat: 1
+Test "Imaginary part of: clog10 (-2 - 3 i) == 0.556971676153418384603252578971164214 - 0.937554462986374708541507952140189646 i":
+double: 1
+float: 5
+idouble: 1
+ifloat: 5
+ildouble: 1
+ldouble: 1
+Test "Imaginary part of: clog10 (-3 + inf i) == inf + pi/2*log10(e) i":
+double: 1
+float: 1
+idouble: 1
+ifloat: 1
+Test "Imaginary part of: clog10 (-3 - inf i) == inf - pi/2*log10(e) i":
+double: 1
+float: 1
+idouble: 1
+ifloat: 1
+Test "Imaginary part of: clog10 (-inf + 0 i) == inf + pi*log10(e) i":
+double: 1
+float: 1
+idouble: 1
+ifloat: 1
+Test "Imaginary part of: clog10 (-inf + 1 i) == inf + pi*log10(e) i":
+double: 1
+float: 1
+idouble: 1
+ifloat: 1
+Test "Imaginary part of: clog10 (-inf + inf i) == inf + 3/4 pi*log10(e) i":
+double: 1
+idouble: 1
+Test "Imaginary part of: clog10 (-inf - 0 i) == inf - pi*log10(e) i":
+double: 1
+float: 1
+idouble: 1
+ifloat: 1
+Test "Imaginary part of: clog10 (-inf - 1 i) == inf - pi*log10(e) i":
+double: 1
+float: 1
+idouble: 1
+ifloat: 1
+Test "Imaginary part of: clog10 (0 + inf i) == inf + pi/2*log10(e) i":
+double: 1
+float: 1
+idouble: 1
+ifloat: 1
+Test "Imaginary part of: clog10 (0 - inf i) == inf - pi/2*log10(e) i":
+double: 1
+float: 1
+idouble: 1
+ifloat: 1
+Test "Real part of: clog10 (0.75 + 1.25 i) == 0.163679467193165171449476605077428975 + 0.447486970040493067069984724340855636 i":
+double: 1
+float: 1
+idouble: 1
+ifloat: 1
+ildouble: 1
+ldouble: 1
+Test "Imaginary part of: clog10 (3 + inf i) == inf + pi/2*log10(e) i":
+double: 1
+float: 1
+idouble: 1
+ifloat: 1
+Test "Imaginary part of: clog10 (3 - inf i) == inf - pi/2*log10(e) i":
+double: 1
+float: 1
+idouble: 1
+ifloat: 1
+Test "Imaginary part of: clog10 (inf + inf i) == inf + pi/4*log10(e) i":
+double: 1
+float: 1
+idouble: 1
+ifloat: 1
+Test "Imaginary part of: clog10 (inf - inf i) == inf - pi/4*log10(e) i":
+double: 1
+float: 1
+idouble: 1
+ifloat: 1
+
+# cos
+Test "cos (M_PI_6l * 2.0) == 0.5":
+double: 1
+float: 1
+idouble: 1
+ifloat: 1
+Test "cos (M_PI_6l * 4.0) == -0.5":
+double: 2
+float: 1
+idouble: 2
+ifloat: 1
+ildouble: 1
+ldouble: 1
+Test "cos (pi/2) == 0":
+double: 1
+float: 1
+idouble: 1
+ifloat: 1
+ildouble: 1
+ldouble: 1
+Test "cos (0.80190127184058835) == 0.69534156199418473":
+double: 1
+idouble: 1
+
+# cpow
+Test "Real part of: cpow (0.75 + 1.25 i, 0.0 + 1.0 i) == 0.331825439177608832276067945276730566 + 0.131338600281188544930936345230903032 i":
+float: 1
+ifloat: 1
+ldouble: 1
+ildouble: 1
+Test "Imaginary part of: cpow (0.75 + 1.25 i, 0.0 + 1.0 i) == 0.331825439177608832276067945276730566 + 0.131338600281188544930936345230903032 i":
+float: 1
+ifloat: 1
+ildouble: 1
+ldouble: 1
+Test "Real part of: cpow (0.75 + 1.25 i, 0.75 + 1.25 i) == 0.117506293914473555420279832210420483 + 0.346552747708338676483025352060418001 i":
+double: 1
+float: 4
+idouble: 1
+ifloat: 4
+ildouble: 5
+ldouble: 5
+Test "Imaginary part of: cpow (0.75 + 1.25 i, 0.75 + 1.25 i) == 0.117506293914473555420279832210420483 + 0.346552747708338676483025352060418001 i":
+ildouble: 2
+ldouble: 2
+Test "Real part of: cpow (0.75 + 1.25 i, 1.0 + 0.0 i) == 0.75 + 1.25 i":
+ildouble: 1
+ldouble: 1
+Test "Real part of: cpow (0.75 + 1.25 i, 1.0 + 1.0 i) == 0.0846958290317209430433805274189191353 + 0.513285749182902449043287190519090481 i":
+double: 2
+float: 3
+idouble: 2
+ifloat: 3
+ildouble: 3
+ldouble: 3
+Test "Real part of: cpow (2 + 0 i, 10 + 0 i) == 1024.0 + 0.0 i":
+ildouble: 1
+ldouble: 1
+Test "Real part of: cpow (2 + 3 i, 4 + 0 i) == -119.0 - 120.0 i":
+double: 1
+float: 5
+idouble: 1
+ifloat: 5
+Test "Imaginary part of: cpow (2 + 3 i, 4 + 0 i) == -119.0 - 120.0 i":
+float: 2
+ifloat: 2
+ildouble: 2
+ldouble: 2
+Test "Imaginary part of: cpow (e + 0 i, 0 + 2 * M_PIl i) == 1.0 + 0.0 i":
+double: 2
+float: 2
+idouble: 2
+ifloat: 2
+ildouble: 1
+ldouble: 1
+
+# csin
+Test "Real part of: csin (0.75 + 1.25 i) == 1.28722291002649188575873510790565441 + 1.17210635989270256101081285116138863 i":
+ildouble: 1
+ldouble: 1
+Test "Imaginary part of: csin (0.75 + 1.25 i) == 1.28722291002649188575873510790565441 + 1.17210635989270256101081285116138863 i":
+float: 1
+ifloat: 1
+Test "Imaginary part of: csin (-2 - 3 i) == -9.15449914691142957346729954460983256 + 4.16890695996656435075481305885375484 i":
+double: 1
+idouble: 1
+
+# csinh
+Test "Real part of: csinh (-2 - 3 i) == 3.59056458998577995201256544779481679 - 0.530921086248519805267040090660676560 i":
+double: 1
+idouble: 1
+Test "Imaginary part of: csinh (-2 - 3 i) == 3.59056458998577995201256544779481679 - 0.530921086248519805267040090660676560 i":
+double: 1
+idouble: 1
+ildouble: 2
+ldouble: 2
+Test "Real part of: csinh (0.75 + 1.25 i) == 0.259294854551162779153349830618433028 + 1.22863452409509552219214606515777594 i":
+float: 1
+ifloat: 1
+ildouble: 1
+ldouble: 1
+Test "Imaginary part of: csinh (0.75 + 1.25 i) == 0.259294854551162779153349830618433028 + 1.22863452409509552219214606515777594 i":
+float: 1
+ifloat: 1
+
+# csqrt
+Test "Real part of: csqrt (-2 + 3 i) == 0.89597747612983812471573375529004348 + 1.6741492280355400404480393008490519 i":
+float: 1
+ifloat: 1
+Test "Real part of: csqrt (-2 - 3 i) == 0.89597747612983812471573375529004348 - 1.6741492280355400404480393008490519 i":
+float: 1
+ifloat: 1
+
+# ctan
+Test "Real part of: ctan (-2 - 3 i) == 0.376402564150424829275122113032269084e-2 - 1.00323862735360980144635859782192726 i":
+double: 1
+idouble: 1
+ildouble: 439
+ldouble: 439
+Test "Imaginary part of: ctan (-2 - 3 i) == 0.376402564150424829275122113032269084e-2 - 1.00323862735360980144635859782192726 i":
+float: 1
+ifloat: 1
+ildouble: 2
+ldouble: 2
+Test "Real part of: ctan (0.75 + 1.25 i) == 0.160807785916206426725166058173438663 + 0.975363285031235646193581759755216379 i":
+ildouble: 1
+ldouble: 1
+Test "Imaginary part of: ctan (0.75 + 1.25 i) == 0.160807785916206426725166058173438663 + 0.975363285031235646193581759755216379 i":
+double: 1
+float: 1
+idouble: 1
+ifloat: 1
+ildouble: 3
+ldouble: 3
+
+# ctanh
+Test "Real part of: ctanh (-2 - 3 i) == -0.965385879022133124278480269394560686 + 0.988437503832249372031403430350121098e-2 i":
+float: 2
+ifloat: 2
+ildouble: 5
+ldouble: 5
+double: 1
+idouble: 1
+Test "Imaginary part of: ctanh (-2 - 3 i) == -0.965385879022133124278480269394560686 + 0.988437503832249372031403430350121098e-2 i":
+ildouble: 25
+ldouble: 25
+Test "Imaginary part of: ctanh (0 + pi/4 i) == 0.0 + 1.0 i":
+float: 1
+ifloat: 1
+Test "Real part of: ctanh (0.75 + 1.25 i) == 1.37260757053378320258048606571226857 + 0.385795952609750664177596760720790220 i":
+double: 1
+idouble: 1
+Test "Imaginary part of: ctanh (0.75 + 1.25 i) == 1.37260757053378320258048606571226857 + 0.385795952609750664177596760720790220 i":
+ildouble: 1
+ldouble: 1
+double: 1
+idouble: 1
+
+# erf
+Test "erf (1.25) == 0.922900128256458230136523481197281140":
+double: 1
+idouble: 1
+
+# erfc
+Test "erfc (1.25) == 0.0770998717435417698634765188027188596":
+ildouble: 1
+ldouble: 1
+Test "erfc (2.0) == 0.00467773498104726583793074363274707139":
+double: 1
+idouble: 1
+Test "erfc (4.125) == 0.542340079956506600531223408575531062e-8":
+double: 1
+idouble: 1
+ildouble: 1
+ldouble: 1
+
+# exp10
+Test "exp10 (-1) == 0.1":
+ildouble: 1
+ldouble: 1
+float: 1
+ifloat: 1
+double: 2
+idouble: 2
+Test "exp10 (0.75) == 5.62341325190349080394951039776481231":
+ildouble: 2
+ldouble: 2
+float: 1
+ifloat: 1
+double: 1
+idouble: 1
+Test "exp10 (3) == 1000":
+ildouble: 8
+ldouble: 8
+float: 2
+ifloat: 2
+double: 6
+idouble: 6
+
+# expm1
+Test "expm1 (0.75) == 1.11700001661267466854536981983709561":
+double: 1
+idouble: 1
+Test "expm1 (1) == M_El - 1.0":
+double: 1
+float: 1
+idouble: 1
+ifloat: 1
+
+# gamma
+Test "gamma (-0.5) == log(2*sqrt(pi))":
+ildouble: 1
+ldouble: 1
+
+# hypot
+Test "hypot (-0.7, -12.4) == 12.419742348374220601176836866763271":
+float: 1
+ifloat: 1
+Test "hypot (-0.7, 12.4) == 12.419742348374220601176836866763271":
+float: 1
+ifloat: 1
+Test "hypot (-12.4, -0.7) == 12.419742348374220601176836866763271":
+float: 1
+ifloat: 1
+Test "hypot (-12.4, 0.7) == 12.419742348374220601176836866763271":
+float: 1
+ifloat: 1
+Test "hypot (0.7, -12.4) == 12.419742348374220601176836866763271":
+float: 1
+ifloat: 1
+Test "hypot (0.7, 12.4) == 12.419742348374220601176836866763271":
+float: 1
+ifloat: 1
+Test "hypot (12.4, -0.7) == 12.419742348374220601176836866763271":
+float: 1
+ifloat: 1
+Test "hypot (12.4, 0.7) == 12.419742348374220601176836866763271":
+float: 1
+ifloat: 1
+
+# j0
+Test "j0 (-4.0) == -3.9714980986384737228659076845169804197562E-1":
+double: 1
+float: 1
+idouble: 1
+ifloat: 1
+ildouble: 1
+ldouble: 1
+Test "j0 (0.75) == 0.864242275166648623555731103820923211":
+float: 1
+ifloat: 1
+Test "j0 (10.0) == -0.245935764451348335197760862485328754":
+double: 2
+float: 1
+idouble: 2
+ifloat: 1
+Test "j0 (2.0) == 0.223890779141235668051827454649948626":
+float: 2
+ifloat: 2
+Test "j0 (4.0) == -3.9714980986384737228659076845169804197562E-1":
+double: 1
+float: 1
+idouble: 1
+ifloat: 1
+ildouble: 1
+ldouble: 1
+Test "j0 (8.0) == 0.171650807137553906090869407851972001":
+double: 2
+float: 1
+idouble: 2
+ifloat: 1
+
+# j1
+Test "j1 (10.0) == 0.0434727461688614366697487680258592883":
+float: 2
+ifloat: 2
+ildouble: 1
+ldouble: 1
+Test "j1 (2.0) == 0.576724807756873387202448242269137087":
+double: 1
+idouble: 1
+Test "j1 (8.0) == 0.234636346853914624381276651590454612":
+double: 1
+idouble: 1
+ildouble: 1
+ldouble: 1
+
+# jn
+Test "jn (0, -4.0) == -3.9714980986384737228659076845169804197562E-1":
+double: 1
+float: 1
+idouble: 1
+ifloat: 1
+ildouble: 1
+ldouble: 1
+Test "jn (0, 0.75) == 0.864242275166648623555731103820923211":
+float: 1
+ifloat: 1
+Test "jn (0, 10.0) == -0.245935764451348335197760862485328754":
+double: 2
+float: 1
+idouble: 2
+ifloat: 1
+Test "jn (0, 2.0) == 0.223890779141235668051827454649948626":
+float: 2
+ifloat: 2
+Test "jn (0, 4.0) == -3.9714980986384737228659076845169804197562E-1":
+double: 1
+float: 1
+idouble: 1
+ifloat: 1
+ildouble: 1
+ldouble: 1
+Test "jn (0, 8.0) == 0.171650807137553906090869407851972001":
+double: 2
+float: 1
+idouble: 2
+ifloat: 1
+Test "jn (1, 10.0) == 0.0434727461688614366697487680258592883":
+float: 2
+ifloat: 2
+ildouble: 1
+ldouble: 1
+Test "jn (1, 2.0) == 0.576724807756873387202448242269137087":
+double: 1
+idouble: 1
+Test "jn (1, 8.0) == 0.234636346853914624381276651590454612":
+double: 1
+idouble: 1
+ildouble: 1
+ldouble: 1
+Test "jn (10, -1.0) == 0.263061512368745320699785368779050294e-9":
+ildouble: 1
+ldouble: 1
+Test "jn (10, 0.125) == 0.250543369809369890173993791865771547e-18":
+double: 1
+float: 1
+idouble: 1
+ifloat: 1
+Test "jn (10, 0.75) == 0.149621713117596814698712483621682835e-10":
+double: 1
+float: 1
+idouble: 1
+ifloat: 1
+ildouble: 2
+ldouble: 2
+Test "jn (10, 1.0) == 0.263061512368745320699785368779050294e-9":
+ildouble: 1
+ldouble: 1
+Test "jn (10, 10.0) == 0.207486106633358857697278723518753428":
+double: 4
+float: 3
+idouble: 4
+ifloat: 3
+ildouble: 2
+ldouble: 2
+Test "jn (10, 2.0) == 0.251538628271673670963516093751820639e-6":
+float: 4
+ifloat: 4
+ildouble: 1
+ldouble: 1
+Test "jn (3, -1.0) == -0.0195633539826684059189053216217515083":
+ildouble: 1
+ldouble: 1
+Test "jn (3, 0.125) == 0.406503832554912875023029337653442868e-4":
+double: 1
+float: 1
+idouble: 1
+ifloat: 1
+Test "jn (3, 0.75) == 0.848438342327410884392755236884386804e-2":
+double: 1
+float: 1
+idouble: 1
+ifloat: 1
+Test "jn (3, 1.0) == 0.0195633539826684059189053216217515083":
+ildouble: 1
+ldouble: 1
+Test "jn (3, 10.0) == 0.0583793793051868123429354784103409563":
+double: 3
+float: 1
+idouble: 3
+ifloat: 1
+ildouble: 1
+ldouble: 1
+Test "jn (3, 2.0) == 0.128943249474402051098793332969239835":
+double: 1
+float: 2
+idouble: 1
+ifloat: 2
+ildouble: 1
+ldouble: 1
+
+# lgamma
+Test "lgamma (-0.5) == log(2*sqrt(pi))":
+ildouble: 1
+ldouble: 1
+Test "lgamma (0.7) == 0.260867246531666514385732417016759578":
+double: 1
+float: 1
+idouble: 1
+ifloat: 1
+Test "lgamma (1.2) == -0.853740900033158497197028392998854470e-1":
+double: 1
+float: 2
+idouble: 1
+ifloat: 2
+ildouble: 1
+ldouble: 1
+
+# log10
+Test "log10 (0.75) == -0.124938736608299953132449886193870744":
+ildouble: 1
+ldouble: 1
+float: 2
+ifloat: 2
+double: 1
+idouble: 1
+Test "log10 (e) == log10(e)":
+float: 1
+ifloat: 1
+ildouble: 1
+ldouble: 1
+
+# log1p
+Test "log1p (-0.25) == -0.287682072451780927439219005993827432":
+float: 1
+ifloat: 1
+
+# sincos
+Test "sincos (M_PI_6l*2.0, &sin_res, &cos_res) puts 0.5 in cos_res":
+double: 1
+float: 1
+idouble: 1
+ifloat: 1
+Test "sincos (M_PI_6l*2.0, &sin_res, &cos_res) puts 0.86602540378443864676372317075293616 in sin_res":
+double: 1
+float: 1
+idouble: 1
+ifloat: 1
+ildouble: 1
+ldouble: 1
+Test "sincos (pi/2, &sin_res, &cos_res) puts 0 in cos_res":
+double: 1
+float: 1
+idouble: 1
+ifloat: 1
+ildouble: 1
+ldouble: 1
+Test "sincos (pi/6, &sin_res, &cos_res) puts 0.86602540378443864676372317075293616 in cos_res":
+float: 1
+ifloat: 1
+Test "sincos (0.80190127184058835, &sin_res, &cos_res) puts 0.69534156199418473 in cos_res":
+double: 1
+idouble: 1
+
+# tan
+Test "tan (pi/4) == 1":
+double: 1
+idouble: 1
+
+# tgamma
+Test "tgamma (-0.5) == -2 sqrt (pi)":
+double: 1
+float: 1
+idouble: 1
+ifloat: 1
+ildouble: 1
+ldouble: 1
+Test "tgamma (0.5) == sqrt (pi)":
+float: 1
+ifloat: 1
+Test "tgamma (0.7) == 1.29805533264755778568117117915281162":
+double: 1
+float: 1
+idouble: 1
+ifloat: 1
+Test "tgamma (4) == 6":
+ildouble: 1
+ldouble: 1
+
+# y0
+Test "y0 (0.125) == -1.38968062514384052915582277745018693":
+ildouble: 1
+ldouble: 1
+Test "y0 (1.0) == 0.0882569642156769579829267660235151628":
+double: 2
+float: 1
+idouble: 2
+ifloat: 1
+ildouble: 1
+ldouble: 1
+Test "y0 (1.5) == 0.382448923797758843955068554978089862":
+double: 2
+float: 1
+idouble: 2
+ifloat: 1
+Test "y0 (10.0) == 0.0556711672835993914244598774101900481":
+float: 1
+ifloat: 1
+ildouble: 1
+ldouble: 1
+Test "y0 (8.0) == 0.223521489387566220527323400498620359":
+double: 1
+float: 1
+idouble: 1
+ifloat: 1
+ildouble: 1
+ldouble: 1
+
+# y1
+Test "y1 (0.125) == -5.19993611253477499595928744876579921":
+double: 1
+idouble: 1
+ildouble: 1
+ldouble: 1
+Test "y1 (1.5) == -0.412308626973911295952829820633445323":
+float: 1
+ifloat: 1
+Test "y1 (10.0) == 0.249015424206953883923283474663222803":
+double: 3
+float: 1
+idouble: 3
+ifloat: 1
+Test "y1 (2.0) == -0.107032431540937546888370772277476637":
+double: 1
+float: 1
+idouble: 1
+ifloat: 1
+ildouble: 1
+ldouble: 1
+Test "y1 (8.0) == -0.158060461731247494255555266187483550":
+double: 1
+float: 2
+idouble: 1
+ifloat: 2
+ildouble: 1
+ldouble: 1
+
+# yn
+Test "yn (0, 0.125) == -1.38968062514384052915582277745018693":
+ildouble: 1
+ldouble: 1
+Test "yn (0, 1.0) == 0.0882569642156769579829267660235151628":
+double: 2
+float: 1
+idouble: 2
+ifloat: 1
+ildouble: 1
+ldouble: 1
+Test "yn (0, 1.5) == 0.382448923797758843955068554978089862":
+double: 2
+float: 1
+idouble: 2
+ifloat: 1
+Test "yn (0, 10.0) == 0.0556711672835993914244598774101900481":
+float: 1
+ifloat: 1
+ildouble: 1
+ldouble: 1
+Test "yn (0, 8.0) == 0.223521489387566220527323400498620359":
+double: 1
+float: 1
+idouble: 1
+ifloat: 1
+ildouble: 1
+ldouble: 1
+Test "yn (1, 0.125) == -5.19993611253477499595928744876579921":
+double: 1
+idouble: 1
+ildouble: 1
+ldouble: 1
+Test "yn (1, 1.5) == -0.412308626973911295952829820633445323":
+float: 1
+ifloat: 1
+Test "yn (1, 10.0) == 0.249015424206953883923283474663222803":
+double: 3
+float: 1
+idouble: 3
+ifloat: 1
+Test "yn (1, 2.0) == -0.107032431540937546888370772277476637":
+double: 1
+float: 1
+idouble: 1
+ifloat: 1
+ildouble: 1
+ldouble: 1
+Test "yn (1, 8.0) == -0.158060461731247494255555266187483550":
+double: 1
+float: 2
+idouble: 1
+ifloat: 2
+ildouble: 1
+ldouble: 1
+Test "yn (10, 0.125) == -127057845771019398.252538486899753195":
+double: 1
+idouble: 1
+ildouble: 2
+ldouble: 2
+Test "yn (10, 0.75) == -2133501638.90573424452445412893839236":
+double: 1
+float: 1
+idouble: 1
+ifloat: 1
+ildouble: 4
+ldouble: 4
+Test "yn (10, 1.0) == -121618014.278689189288130426667971145":
+double: 1
+idouble: 1
+Test "yn (10, 10.0) == -0.359814152183402722051986577343560609":
+double: 1
+float: 1
+idouble: 1
+ifloat: 1
+Test "yn (10, 2.0) == -129184.542208039282635913145923304214":
+double: 2
+idouble: 2
+Test "yn (3, 0.125) == -2612.69757350066712600220955744091741":
+double: 1
+idouble: 1
+ildouble: 1
+ldouble: 1
+Test "yn (3, 0.75) == -12.9877176234475433186319774484809207":
+double: 1
+float: 1
+idouble: 1
+ifloat: 1
+ildouble: 2
+ldouble: 2
+Test "yn (3, 10.0) == -0.251362657183837329779204747654240998":
+double: 1
+float: 1
+idouble: 1
+ifloat: 1
+Test "yn (3, 2.0) == -1.12778377684042778608158395773179238":
+double: 1
+idouble: 1
+
+# Maximal error of functions:
+Function: "acos":
+ildouble: 1
+ldouble: 1
+
+Function: "asin":
+ildouble: 1
+ldouble: 1
+
+Function: "atan2":
+float: 1
+ifloat: 1
+
+Function: "atanh":
+float: 1
+ifloat: 1
+ildouble: 1
+ldouble: 1
+
+Function: Imaginary part of "cacos":
+float: 1
+ifloat: 1
+ildouble: 2
+ldouble: 2
+
+Function: Real part of "cacosh":
+double: 1
+float: 7
+idouble: 1
+ifloat: 7
+ildouble: 6
+ldouble: 6
+
+Function: Imaginary part of "cacosh":
+double: 1
+float: 3
+idouble: 1
+ifloat: 3
+ildouble: 1
+ldouble: 1
+
+Function: Real part of "casin":
+double: 1
+float: 1
+idouble: 1
+ifloat: 1
+ildouble: 2
+ldouble: 2
+
+Function: Imaginary part of "casin":
+float: 1
+ifloat: 1
+ildouble: 2
+ldouble: 2
+
+Function: Real part of "casinh":
+double: 5
+float: 1
+idouble: 5
+ifloat: 1
+ildouble: 5
+ldouble: 5
+
+Function: Imaginary part of "casinh":
+double: 3
+float: 6
+idouble: 3
+ifloat: 6
+ildouble: 5
+ldouble: 5
+
+Function: Real part of "catan":
+float: 4
+ifloat: 4
+
+Function: Imaginary part of "catan":
+double: 1
+float: 1
+idouble: 1
+ifloat: 1
+
+Function: Real part of "catanh":
+double: 4
+idouble: 4
+ildouble: 1
+ldouble: 1
+
+Function: Imaginary part of "catanh":
+float: 6
+ifloat: 6
+
+Function: "cbrt":
+double: 1
+idouble: 1
+ildouble: 1
+ldouble: 1
+
+Function: Real part of "ccos":
+double: 1
+float: 1
+idouble: 1
+ifloat: 1
+ildouble: 1
+ldouble: 1
+
+Function: Imaginary part of "ccos":
+float: 1
+ifloat: 1
+ildouble: 1
+ldouble: 1
+
+Function: Real part of "ccosh":
+double: 1
+float: 1
+idouble: 1
+ifloat: 1
+
+Function: Imaginary part of "ccosh":
+double: 1
+float: 1
+idouble: 1
+ifloat: 1
+ildouble: 1
+ldouble: 1
+
+Function: Real part of "cexp":
+float: 1
+ifloat: 1
+
+Function: Imaginary part of "cexp":
+float: 1
+ifloat: 1
+ildouble: 1
+ldouble: 1
+
+Function: Real part of "clog":
+float: 1
+ifloat: 1
+ildouble: 1
+ldouble: 1
+
+Function: Imaginary part of "clog":
+float: 3
+ifloat: 3
+
+Function: Real part of "clog10":
+double: 1
+float: 1
+idouble: 1
+ifloat: 1
+ildouble: 1
+ldouble: 1
+
+Function: Imaginary part of "clog10":
+double: 1
+float: 5
+idouble: 1
+ifloat: 5
+ildouble: 1
+ldouble: 1
+
+Function: "cos":
+double: 2
+float: 1
+idouble: 2
+ifloat: 1
+ildouble: 1
+ldouble: 1
+
+Function: Real part of "cpow":
+double: 2
+float: 5
+idouble: 2
+ifloat: 5
+ildouble: 5
+ldouble: 5
+
+Function: Imaginary part of "cpow":
+double: 2
+float: 2
+idouble: 2
+ifloat: 2
+ildouble: 2
+ldouble: 2
+
+Function: Real part of "csin":
+ildouble: 1
+ldouble: 1
+
+Function: Imaginary part of "csin":
+double: 1
+float: 1
+idouble: 1
+ifloat: 1
+
+Function: Real part of "csinh":
+double: 1
+float: 1
+idouble: 1
+ifloat: 1
+ildouble: 1
+ldouble: 1
+
+Function: Imaginary part of "csinh":
+double: 1
+float: 1
+idouble: 1
+ifloat: 1
+ildouble: 2
+ldouble: 2
+
+Function: Real part of "csqrt":
+float: 1
+ifloat: 1
+
+Function: Real part of "ctan":
+double: 1
+idouble: 1
+ildouble: 439
+ldouble: 439
+
+Function: Imaginary part of "ctan":
+double: 1
+float: 1
+idouble: 1
+ifloat: 1
+ildouble: 3
+ldouble: 3
+
+Function: Real part of "ctanh":
+double: 1
+float: 2
+idouble: 1
+ifloat: 2
+ildouble: 5
+ldouble: 5
+
+Function: Imaginary part of "ctanh":
+float: 1
+ifloat: 1
+ildouble: 25
+ldouble: 25
+double: 1
+idouble: 1
+
+Function: "erf":
+double: 1
+idouble: 1
+
+Function: "erfc":
+double: 1
+idouble: 1
+ildouble: 1
+ldouble: 1
+
+Function: "exp10":
+ildouble: 8
+ldouble: 8
+float: 2
+ifloat: 2
+double: 6
+idouble: 6
+
+Function: "expm1":
+double: 1
+float: 1
+idouble: 1
+ifloat: 1
+
+Function: "gamma":
+ildouble: 1
+ldouble: 1
+
+Function: "hypot":
+float: 1
+ifloat: 1
+
+Function: "j0":
+double: 2
+float: 2
+idouble: 2
+ifloat: 2
+ildouble: 1
+ldouble: 1
+
+Function: "j1":
+double: 1
+float: 2
+idouble: 1
+ifloat: 2
+ildouble: 1
+ldouble: 1
+
+Function: "jn":
+double: 4
+float: 4
+idouble: 4
+ifloat: 4
+ildouble: 2
+ldouble: 2
+
+Function: "lgamma":
+double: 1
+float: 2
+idouble: 1
+ifloat: 2
+ildouble: 1
+ldouble: 1
+
+Function: "log10":
+float: 2
+ifloat: 2
+ildouble: 1
+ldouble: 1
+double: 1
+idouble: 1
+
+Function: "log1p":
+float: 1
+ifloat: 1
+
+Function: "sincos":
+double: 1
+float: 1
+idouble: 1
+ifloat: 1
+ildouble: 1
+ldouble: 1
+
+Function: "tan":
+double: 1
+idouble: 1
+
+Function: "tgamma":
+double: 1
+float: 1
+idouble: 1
+ifloat: 1
+ildouble: 1
+ldouble: 1
+
+Function: "y0":
+double: 2
+float: 1
+idouble: 2
+ifloat: 1
+ildouble: 1
+ldouble: 1
+
+Function: "y1":
+double: 3
+float: 2
+idouble: 3
+ifloat: 2
+ildouble: 1
+ldouble: 1
+
+Function: "yn":
+double: 3
+float: 2
+idouble: 3
+ifloat: 2
+ildouble: 4
+ldouble: 4
+
+# end of automatic generation
diff --git a/ap/build/uClibc/test/math/libm-test.inc b/ap/build/uClibc/test/math/libm-test.inc
new file mode 100644
index 0000000..5955566
--- /dev/null
+++ b/ap/build/uClibc/test/math/libm-test.inc
@@ -0,0 +1,5109 @@
+/* Copyright (C) 1997-2002, 2003, 2004, 2005, 2006 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+   Contributed by Andreas Jaeger <aj@suse.de>, 1997.
+
+   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.  */
+
+/* Part of testsuite for libm.
+
+   This file is processed by a perl script.  The resulting file has to
+   be included by a master file that defines:
+
+   Macros:
+   FUNC(function): converts general function name (like cos) to
+   name with correct suffix (e.g. cosl or cosf)
+   MATHCONST(x):   like FUNC but for constants (e.g convert 0.0 to 0.0L)
+   FLOAT:          floating point type to test
+   - TEST_MSG:     informal message to be displayed
+   CHOOSE(Clongdouble,Cdouble,Cfloat,Cinlinelongdouble,Cinlinedouble,Cinlinefloat):
+   chooses one of the parameters as delta for testing
+   equality
+   PRINTF_EXPR     Floating point conversion specification to print a variable
+   of type FLOAT with printf.  PRINTF_EXPR just contains
+   the specifier, not the percent and width arguments,
+   e.g. "f".
+   PRINTF_XEXPR	   Like PRINTF_EXPR, but print in hexadecimal format.
+   PRINTF_NEXPR    Like PRINTF_EXPR, but print nice.  */
+
+/* This testsuite has currently tests for:
+   acos, acosh, asin, asinh, atan, atan2, atanh,
+   cbrt, ceil, copysign, cos, cosh, erf, erfc, exp, exp10, exp2, expm1,
+   fabs, fdim, floor, fma, fmax, fmin, fmod, fpclassify,
+   frexp, gamma, hypot,
+   ilogb, isfinite, isinf, isnan, isnormal,
+   isless, islessequal, isgreater, isgreaterequal, islessgreater, isunordered,
+   j0, j1, jn,
+   ldexp, lgamma, log, log10, log1p, log2, logb,
+   modf, nearbyint, nextafter,
+   pow, remainder, remquo, rint, lrint, llrint,
+   round, lround, llround,
+   scalb, scalbn, scalbln, signbit, sin, sincos, sinh, sqrt, tan, tanh, tgamma, trunc,
+   y0, y1, yn, significand
+
+   and for the following complex math functions:
+   cabs, cacos, cacosh, carg, casin, casinh, catan, catanh,
+   ccos, ccosh, cexp, clog, cpow, cproj, csin, csinh, csqrt, ctan, ctanh.
+
+   At the moment the following functions aren't tested:
+   drem, nan
+
+   Parameter handling is primitive in the moment:
+   --verbose=[0..3] for different levels of output:
+   0: only error count
+   1: basic report on failed tests (default)
+   2: full report on all tests
+   -v for full output (equals --verbose=3)
+   -u for generation of an ULPs file
+ */
+
+/* "Philosophy":
+
+   This suite tests some aspects of the correct implementation of
+   mathematical functions in libm.  Some simple, specific parameters
+   are tested for correctness but there's no exhaustive
+   testing.  Handling of specific inputs (e.g. infinity, not-a-number)
+   is also tested.  Correct handling of exceptions is checked
+   against.  These implemented tests should check all cases that are
+   specified in ISO C99.
+
+   Exception testing: At the moment only divide-by-zero and invalid
+   exceptions are tested.  Overflow/underflow and inexact exceptions
+   aren't checked at the moment.
+
+   NaN values: There exist signalling and quiet NaNs.  This implementation
+   only uses quiet NaN as parameter but does not differenciate
+   between the two kinds of NaNs as result.
+
+   Inline functions: Inlining functions should give an improvement in
+   speed - but not in precission.  The inlined functions return
+   reasonable values for a reasonable range of input values.  The
+   result is not necessarily correct for all values and exceptions are
+   not correctly raised in all cases.  Problematic input and return
+   values are infinity, not-a-number and minus zero.  This suite
+   therefore does not check these specific inputs and the exception
+   handling for inlined mathematical functions - just the "reasonable"
+   values are checked.
+
+   Beware: The tests might fail for any of the following reasons:
+   - Tests are wrong
+   - Functions are wrong
+   - Floating Point Unit not working properly
+   - Compiler has errors
+
+   With e.g. gcc 2.7.2.2 the test for cexp fails because of a compiler error.
+
+
+   To Do: All parameter should be numbers that can be represented as
+   exact floating point values.  Currently some values cannot be
+   represented exactly and therefore the result is not the expected
+   result.  For this we will use 36 digits so that numbers can be
+   represented exactly.  */
+
+#ifndef _GNU_SOURCE
+# define _GNU_SOURCE
+#endif
+
+#include "libm-test-ulps.h"
+#include <complex.h>
+#include <math.h>
+#include <float.h>
+#include "fenv.h"
+#include <limits.h>
+
+#include <errno.h>
+#include <stdlib.h>
+#include <stdio.h>
+#include <string.h>
+#include <getopt.h>
+
+/* Possible exceptions */
+#define NO_EXCEPTION			0x0
+#define INVALID_EXCEPTION		0x1
+#define DIVIDE_BY_ZERO_EXCEPTION	0x2
+/* The next flags signals that those exceptions are allowed but not required.   */
+#define INVALID_EXCEPTION_OK		0x4
+#define DIVIDE_BY_ZERO_EXCEPTION_OK	0x8
+#define EXCEPTIONS_OK INVALID_EXCEPTION_OK+DIVIDE_BY_ZERO_EXCEPTION_OK
+/* Some special test flags, passed togther with exceptions.  */
+#define IGNORE_ZERO_INF_SIGN		0x10
+
+/* Various constants (we must supply them precalculated for accuracy).  */
+#define M_PI_6l			.52359877559829887307710723054658383L
+#define M_E2l			7.389056098930650227230427460575008L
+#define M_E3l			20.085536923187667740928529654581719L
+#define M_2_SQRT_PIl		3.5449077018110320545963349666822903L	/* 2 sqrt (M_PIl)  */
+#define M_SQRT_PIl		1.7724538509055160272981674833411451L	/* sqrt (M_PIl)  */
+#define M_LOG_SQRT_PIl		0.57236494292470008707171367567652933L	/* log(sqrt(M_PIl))  */
+#define M_LOG_2_SQRT_PIl	1.265512123484645396488945797134706L	/* log(2*sqrt(M_PIl))  */
+#define M_PI_34l		(M_PIl - M_PI_4l)		/* 3*pi/4 */
+#define M_PI_34_LOG10El		(M_PIl - M_PI_4l) * M_LOG10El
+#define M_PI2_LOG10El		M_PI_2l * M_LOG10El
+#define M_PI4_LOG10El		M_PI_4l * M_LOG10El
+#define M_PI_LOG10El		M_PIl * M_LOG10El
+#define M_SQRT_2_2		0.70710678118654752440084436210484903L /* sqrt (2) / 2 */
+
+static FILE *ulps_file;	/* File to document difference.  */
+static int output_ulps;	/* Should ulps printed?  */
+
+static int noErrors;	/* number of errors */
+static int noTests;	/* number of tests (without testing exceptions) */
+static int noExcTests;	/* number of tests for exception flags */
+static int noXFails;	/* number of expected failures.  */
+static int noXPasses;	/* number of unexpected passes.  */
+
+static int verbose;
+static int output_max_error;	/* Should the maximal errors printed?  */
+static int output_points;	/* Should the single function results printed?  */
+static int ignore_max_ulp;	/* Should we ignore max_ulp?  */
+
+static FLOAT minus_zero, plus_zero;
+static FLOAT plus_infty, minus_infty, nan_value, max_value, min_value;
+
+static FLOAT max_error, real_max_error, imag_max_error;
+
+
+#define BUILD_COMPLEX(real, imag) \
+  ({ __complex__ FLOAT __retval;					      \
+     __real__ __retval = (real);					      \
+     __imag__ __retval = (imag);					      \
+     __retval; })
+
+#define BUILD_COMPLEX_INT(real, imag) \
+  ({ __complex__ int __retval;						      \
+     __real__ __retval = (real);					      \
+     __imag__ __retval = (imag);					      \
+     __retval; })
+
+
+#define MANT_DIG CHOOSE ((LDBL_MANT_DIG-1), (DBL_MANT_DIG-1), (FLT_MANT_DIG-1),  \
+                         (LDBL_MANT_DIG-1), (DBL_MANT_DIG-1), (FLT_MANT_DIG-1))
+
+static void
+init_max_error (void)
+{
+  max_error = 0;
+  real_max_error = 0;
+  imag_max_error = 0;
+  feclearexcept (FE_ALL_EXCEPT);
+}
+
+static void
+set_max_error (FLOAT current, FLOAT *curr_max_error)
+{
+  if (current > *curr_max_error)
+    *curr_max_error = current;
+}
+
+
+/* Should the message print to screen?  This depends on the verbose flag,
+   and the test status.  */
+static int
+print_screen (int ok, int xfail)
+{
+  if (output_points
+      && (verbose > 1
+	  || (verbose == 1 && ok == xfail)))
+    return 1;
+  return 0;
+}
+
+
+/* Should the message print to screen?  This depends on the verbose flag,
+   and the test status.  */
+static int
+print_screen_max_error (int ok, int xfail)
+{
+  if (output_max_error
+      && (verbose > 1
+	  || ((verbose == 1) && (ok == xfail))))
+    return 1;
+  return 0;
+}
+
+/* Update statistic counters.  */
+static void
+update_stats (int ok, int xfail)
+{
+  ++noTests;
+  if (ok && xfail)
+    ++noXPasses;
+  else if (!ok && xfail)
+    ++noXFails;
+  else if (!ok && !xfail)
+    ++noErrors;
+}
+
+static void
+print_ulps (const char *test_name, FLOAT ulp)
+{
+  if (output_ulps)
+    {
+      fprintf (ulps_file, "Test \"%s\":\n", test_name);
+      fprintf (ulps_file, "%s: %.0" PRINTF_NEXPR "\n",
+	       CHOOSE("ldouble", "double", "float",
+		      "ildouble", "idouble", "ifloat"),
+	       FUNC(ceil) (ulp));
+    }
+}
+
+static void
+print_function_ulps (const char *function_name, FLOAT ulp)
+{
+  if (output_ulps)
+    {
+      fprintf (ulps_file, "Function: \"%s\":\n", function_name);
+      fprintf (ulps_file, "%s: %.0" PRINTF_NEXPR "\n",
+	       CHOOSE("ldouble", "double", "float",
+		      "ildouble", "idouble", "ifloat"),
+	       FUNC(ceil) (ulp));
+    }
+}
+
+
+static void
+print_complex_function_ulps (const char *function_name, FLOAT real_ulp,
+			     FLOAT imag_ulp)
+{
+  if (output_ulps)
+    {
+      if (real_ulp != 0.0)
+	{
+	  fprintf (ulps_file, "Function: Real part of \"%s\":\n", function_name);
+	  fprintf (ulps_file, "%s: %.0" PRINTF_NEXPR "\n",
+		   CHOOSE("ldouble", "double", "float",
+			  "ildouble", "idouble", "ifloat"),
+		   FUNC(ceil) (real_ulp));
+	}
+      if (imag_ulp != 0.0)
+	{
+	  fprintf (ulps_file, "Function: Imaginary part of \"%s\":\n", function_name);
+	  fprintf (ulps_file, "%s: %.0" PRINTF_NEXPR "\n",
+		   CHOOSE("ldouble", "double", "float",
+			  "ildouble", "idouble", "ifloat"),
+		   FUNC(ceil) (imag_ulp));
+	}
+
+
+    }
+}
+
+
+
+/* Test if Floating-Point stack hasn't changed */
+static void
+fpstack_test (const char *test_name)
+{
+#ifdef i386
+  static int old_stack;
+  int sw;
+
+  __asm__ ("fnstsw" : "=a" (sw));
+  sw >>= 11;
+  sw &= 7;
+
+  if (sw != old_stack)
+    {
+      printf ("FP-Stack wrong after test %s (%d, should be %d)\n",
+	      test_name, sw, old_stack);
+      ++noErrors;
+      old_stack = sw;
+    }
+#endif
+}
+
+
+static void
+print_max_error (const char *func_name, FLOAT allowed, int xfail)
+{
+  int ok = 0;
+
+  if (max_error == 0.0 || (max_error <= allowed && !ignore_max_ulp))
+    {
+      ok = 1;
+    }
+
+  if (!ok)
+    print_function_ulps (func_name, max_error);
+
+
+  if (print_screen_max_error (ok, xfail))
+    {
+      printf ("Maximal error of `%s'\n", func_name);
+      printf (" is      : %.0" PRINTF_NEXPR " ulp\n", FUNC(ceil) (max_error));
+      printf (" accepted: %.0" PRINTF_NEXPR " ulp\n", FUNC(ceil) (allowed));
+    }
+
+  update_stats (ok, xfail);
+}
+
+
+static void
+print_complex_max_error (const char *func_name, __complex__ FLOAT allowed,
+			 __complex__ int xfail)
+{
+  int ok = 0;
+
+  if ((real_max_error == 0 && imag_max_error == 0)
+      || (real_max_error <= __real__ allowed
+	  && imag_max_error <= __imag__ allowed
+	  && !ignore_max_ulp))
+    {
+      ok = 1;
+    }
+
+  if (!ok)
+    print_complex_function_ulps (func_name, real_max_error, imag_max_error);
+
+
+  if (print_screen_max_error (ok, xfail))
+    {
+      printf ("Maximal error of real part of: %s\n", func_name);
+      printf (" is      : %.0" PRINTF_NEXPR " ulp\n",
+	      FUNC(ceil) (real_max_error));
+      printf (" accepted: %.0" PRINTF_NEXPR " ulp\n",
+	      FUNC(ceil) (__real__ allowed));
+      printf ("Maximal error of imaginary part of: %s\n", func_name);
+      printf (" is      : %.0" PRINTF_NEXPR " ulp\n",
+	      FUNC(ceil) (imag_max_error));
+      printf (" accepted: %.0" PRINTF_NEXPR " ulp\n",
+	      FUNC(ceil) (__imag__ allowed));
+    }
+
+  update_stats (ok, xfail);
+}
+
+
+/* Test whether a given exception was raised.  */
+static void
+test_single_exception (const char *test_name,
+		       int exception,
+		       int exc_flag,
+		       int fe_flag,
+		       const char *flag_name)
+{
+#ifndef TEST_INLINE
+  int ok = 1;
+  if (exception & exc_flag)
+    {
+      if (fetestexcept (fe_flag))
+	{
+	  if (print_screen (1, 0))
+	    printf ("Pass: %s: Exception \"%s\" set\n", test_name, flag_name);
+	}
+      else
+	{
+	  ok = 0;
+	  if (print_screen (0, 0))
+	    printf ("Failure: %s: Exception \"%s\" not set\n",
+		    test_name, flag_name);
+	}
+    }
+  else
+    {
+      if (fetestexcept (fe_flag))
+	{
+	  ok = 0;
+	  if (print_screen (0, 0))
+	    printf ("Failure: %s: Exception \"%s\" set\n",
+		    test_name, flag_name);
+	}
+      else
+	{
+	  if (print_screen (1, 0))
+	    printf ("%s: Exception \"%s\" not set\n", test_name,
+		    flag_name);
+	}
+    }
+  if (!ok)
+    ++noErrors;
+
+#endif
+}
+
+
+/* Test whether exceptions given by EXCEPTION are raised.  Ignore thereby
+   allowed but not required exceptions.
+*/
+static void
+test_exceptions (const char *test_name, int exception)
+{
+  ++noExcTests;
+#ifdef FE_DIVBYZERO
+  if ((exception & DIVIDE_BY_ZERO_EXCEPTION_OK) == 0)
+    test_single_exception (test_name, exception,
+			   DIVIDE_BY_ZERO_EXCEPTION, FE_DIVBYZERO,
+			   "Divide by zero");
+#endif
+#ifdef FE_INVALID
+  if ((exception & INVALID_EXCEPTION_OK) == 0)
+    test_single_exception (test_name, exception, INVALID_EXCEPTION, FE_INVALID,
+			 "Invalid operation");
+#endif
+  feclearexcept (FE_ALL_EXCEPT);
+}
+
+
+static void
+check_float_internal (const char *test_name, FLOAT computed, FLOAT expected,
+		      FLOAT max_ulp, int xfail, int exceptions,
+		      FLOAT *curr_max_error)
+{
+  int ok = 0;
+  int print_diff = 0;
+  FLOAT diff = 0;
+  FLOAT ulp = 0;
+
+  test_exceptions (test_name, exceptions);
+  if (isnan (computed) && isnan (expected))
+    ok = 1;
+  else if (isinf (computed) && isinf (expected))
+    {
+      /* Test for sign of infinities.  */
+      if ((exceptions & IGNORE_ZERO_INF_SIGN) == 0
+	  && signbit (computed) != signbit (expected))
+	{
+	  ok = 0;
+	  printf ("infinity has wrong sign.\n");
+	}
+      else
+	ok = 1;
+    }
+  /* Don't calc ulp for NaNs or infinities.  */
+  else if (isinf (computed) || isnan (computed) || isinf (expected) || isnan (expected))
+    ok = 0;
+  else
+    {
+      diff = FUNC(fabs) (computed - expected);
+      /* ilogb (0) isn't allowed.  */
+      if (expected == 0.0)
+	ulp = diff / FUNC(ldexp) (1.0, - MANT_DIG);
+      else
+	ulp = diff / FUNC(ldexp) (1.0, FUNC(ilogb) (expected) - MANT_DIG);
+      set_max_error (ulp, curr_max_error);
+      print_diff = 1;
+      if ((exceptions & IGNORE_ZERO_INF_SIGN) == 0
+	  && computed == 0.0 && expected == 0.0
+	  && signbit(computed) != signbit (expected))
+	ok = 0;
+      else if (ulp <= 0.5 || (ulp <= max_ulp && !ignore_max_ulp))
+	ok = 1;
+      else
+	{
+	  ok = 0;
+	  print_ulps (test_name, ulp);
+	}
+
+    }
+  if (print_screen (ok, xfail))
+    {
+      if (!ok)
+	printf ("Failure: ");
+      printf ("Test: %s\n", test_name);
+      printf ("Result:\n");
+      printf (" is:         % .20" PRINTF_EXPR "  % .20" PRINTF_XEXPR "\n",
+	      computed, computed);
+      printf (" should be:  % .20" PRINTF_EXPR "  % .20" PRINTF_XEXPR "\n",
+	      expected, expected);
+      if (print_diff)
+	{
+	  printf (" difference: % .20" PRINTF_EXPR "  % .20" PRINTF_XEXPR
+		  "\n", diff, diff);
+	  printf (" ulp       : % .4" PRINTF_NEXPR "\n", ulp);
+	  printf (" max.ulp   : % .4" PRINTF_NEXPR "\n", max_ulp);
+	}
+    }
+  update_stats (ok, xfail);
+
+  fpstack_test (test_name);
+}
+
+
+static void
+check_float (const char *test_name, FLOAT computed, FLOAT expected,
+	     FLOAT max_ulp, int xfail, int exceptions)
+{
+  check_float_internal (test_name, computed, expected, max_ulp, xfail,
+			exceptions, &max_error);
+}
+
+
+static void
+check_complex (const char *test_name, __complex__ FLOAT computed,
+	       __complex__ FLOAT expected,
+	       __complex__ FLOAT max_ulp, __complex__ int xfail,
+	       int exception)
+{
+  FLOAT part_comp, part_exp, part_max_ulp;
+  int part_xfail;
+  char str[200];
+
+  sprintf (str, "Real part of: %s", test_name);
+  part_comp = __real__ computed;
+  part_exp = __real__ expected;
+  part_max_ulp = __real__ max_ulp;
+  part_xfail = __real__ xfail;
+
+  check_float_internal (str, part_comp, part_exp, part_max_ulp, part_xfail,
+			exception, &real_max_error);
+
+  sprintf (str, "Imaginary part of: %s", test_name);
+  part_comp = __imag__ computed;
+  part_exp = __imag__ expected;
+  part_max_ulp = __imag__ max_ulp;
+  part_xfail = __imag__ xfail;
+
+  /* Don't check again for exceptions, just pass through the
+     zero/inf sign test.  */
+  check_float_internal (str, part_comp, part_exp, part_max_ulp, part_xfail,
+			exception & IGNORE_ZERO_INF_SIGN,
+			&imag_max_error);
+}
+
+
+/* Check that computed and expected values are equal (int values).  */
+static void
+check_int (const char *test_name, int computed, int expected, int max_ulp,
+	   int xfail, int exceptions)
+{
+  int diff = computed - expected;
+  int ok = 0;
+
+  test_exceptions (test_name, exceptions);
+  noTests++;
+  if (abs (diff) <= max_ulp)
+    ok = 1;
+
+  if (!ok)
+    print_ulps (test_name, diff);
+
+  if (print_screen (ok, xfail))
+    {
+      if (!ok)
+	printf ("Failure: ");
+      printf ("Test: %s\n", test_name);
+      printf ("Result:\n");
+      printf (" is:         %d\n", computed);
+      printf (" should be:  %d\n", expected);
+    }
+
+  update_stats (ok, xfail);
+  fpstack_test (test_name);
+}
+
+
+/* Check that computed and expected values are equal (long int values).  */
+static void
+check_long (const char *test_name, long int computed, long int expected,
+	    long int max_ulp, int xfail, int exceptions)
+{
+  long int diff = computed - expected;
+  int ok = 0;
+
+  test_exceptions (test_name, exceptions);
+  noTests++;
+  if (labs (diff) <= max_ulp)
+    ok = 1;
+
+  if (!ok)
+    print_ulps (test_name, diff);
+
+  if (print_screen (ok, xfail))
+    {
+      if (!ok)
+	printf ("Failure: ");
+      printf ("Test: %s\n", test_name);
+      printf ("Result:\n");
+      printf (" is:         %ld\n", computed);
+      printf (" should be:  %ld\n", expected);
+    }
+
+  update_stats (ok, xfail);
+  fpstack_test (test_name);
+}
+
+
+/* Check that computed value is true/false.  */
+static void
+check_bool (const char *test_name, int computed, int expected,
+	    long int max_ulp, int xfail, int exceptions)
+{
+  int ok = 0;
+
+  test_exceptions (test_name, exceptions);
+  noTests++;
+  if ((computed == 0) == (expected == 0))
+    ok = 1;
+
+  if (print_screen (ok, xfail))
+    {
+      if (!ok)
+	printf ("Failure: ");
+      printf ("Test: %s\n", test_name);
+      printf ("Result:\n");
+      printf (" is:         %d\n", computed);
+      printf (" should be:  %d\n", expected);
+    }
+
+  update_stats (ok, xfail);
+  fpstack_test (test_name);
+}
+
+
+/* check that computed and expected values are equal (long int values) */
+static void
+check_longlong (const char *test_name, long long int computed,
+		long long int expected,
+		long long int max_ulp, int xfail,
+		int exceptions)
+{
+  long long int diff = computed - expected;
+  int ok = 0;
+
+  test_exceptions (test_name, exceptions);
+  noTests++;
+  if (llabs (diff) <= max_ulp)
+    ok = 1;
+
+  if (!ok)
+    print_ulps (test_name, diff);
+
+  if (print_screen (ok, xfail))
+    {
+      if (!ok)
+	printf ("Failure:");
+      printf ("Test: %s\n", test_name);
+      printf ("Result:\n");
+      printf (" is:         %lld\n", computed);
+      printf (" should be:  %lld\n", expected);
+    }
+
+  update_stats (ok, xfail);
+  fpstack_test (test_name);
+}
+
+
+
+/* This is to prevent messages from the SVID libm emulation.  */
+int
+matherr (struct exception *x __attribute__ ((unused)))
+{
+  return 1;
+}
+
+
+/****************************************************************************
+  Tests for single functions of libm.
+  Please keep them alphabetically sorted!
+****************************************************************************/
+
+static void
+acos_test (void)
+{
+  errno = 0;
+  FUNC(acos) (0);
+  if (errno == ENOSYS)
+    /* Function not implemented.  */
+    return;
+
+  START (acos);
+
+  TEST_f_f (acos, plus_infty, nan_value, INVALID_EXCEPTION);
+  TEST_f_f (acos, minus_infty, nan_value, INVALID_EXCEPTION);
+  TEST_f_f (acos, nan_value, nan_value);
+
+  /* |x| > 1: */
+  TEST_f_f (acos, 1.125L, nan_value, INVALID_EXCEPTION);
+  TEST_f_f (acos, -1.125L, nan_value, INVALID_EXCEPTION);
+
+  TEST_f_f (acos, 0, M_PI_2l);
+  TEST_f_f (acos, minus_zero, M_PI_2l);
+  TEST_f_f (acos, 1, 0);
+  TEST_f_f (acos, -1, M_PIl);
+  TEST_f_f (acos, 0.5, M_PI_6l*2.0);
+  TEST_f_f (acos, -0.5, M_PI_6l*4.0);
+  TEST_f_f (acos, 0.75L, 0.722734247813415611178377352641333362L);
+  TEST_f_f (acos, 2e-17L, 1.57079632679489659923132169163975144L);
+  TEST_f_f (acos, 0.0625L, 1.50825556499840522843072005474337068L);
+  END (acos);
+}
+
+static void
+acosh_test (void)
+{
+  errno = 0;
+  FUNC(acosh) (7);
+  if (errno == ENOSYS)
+    /* Function not implemented.  */
+    return;
+
+  START (acosh);
+
+  TEST_f_f (acosh, plus_infty, plus_infty);
+  TEST_f_f (acosh, minus_infty, nan_value, INVALID_EXCEPTION);
+
+  /* x < 1:  */
+  TEST_f_f (acosh, -1.125L, nan_value, INVALID_EXCEPTION);
+
+  TEST_f_f (acosh, 1, 0);
+  TEST_f_f (acosh, 7, 2.63391579384963341725009269461593689L);
+
+  END (acosh);
+}
+
+static void
+asin_test (void)
+{
+  errno = 0;
+  FUNC(asin) (0);
+  if (errno == ENOSYS)
+    /* Function not implemented.  */
+    return;
+
+  START (asin);
+
+  TEST_f_f (asin, plus_infty, nan_value, INVALID_EXCEPTION);
+  TEST_f_f (asin, minus_infty, nan_value, INVALID_EXCEPTION);
+  TEST_f_f (asin, nan_value, nan_value);
+
+  /* asin x == NaN plus invalid exception for |x| > 1.  */
+  TEST_f_f (asin, 1.125L, nan_value, INVALID_EXCEPTION);
+  TEST_f_f (asin, -1.125L, nan_value, INVALID_EXCEPTION);
+
+  TEST_f_f (asin, 0, 0);
+  TEST_f_f (asin, minus_zero, minus_zero);
+  TEST_f_f (asin, 0.5, M_PI_6l);
+  TEST_f_f (asin, -0.5, -M_PI_6l);
+  TEST_f_f (asin, 1.0, M_PI_2l);
+  TEST_f_f (asin, -1.0, -M_PI_2l);
+  TEST_f_f (asin, 0.75L, 0.848062078981481008052944338998418080L);
+
+  END (asin);
+}
+
+static void
+asinh_test (void)
+{
+  errno = 0;
+  FUNC(asinh) (0.7L);
+  if (errno == ENOSYS)
+    /* Function not implemented.  */
+    return;
+
+  START (asinh);
+
+  TEST_f_f (asinh, 0, 0);
+  TEST_f_f (asinh, minus_zero, minus_zero);
+#ifndef TEST_INLINE
+  TEST_f_f (asinh, plus_infty, plus_infty);
+  TEST_f_f (asinh, minus_infty, minus_infty);
+#endif
+  TEST_f_f (asinh, nan_value, nan_value);
+  TEST_f_f (asinh, 0.75L, 0.693147180559945309417232121458176568L);
+
+  END (asinh);
+}
+
+static void
+atan_test (void)
+{
+  errno = 0;
+  FUNC(atan) (0);
+  if (errno == ENOSYS)
+    /* Function not implemented.  */
+    return;
+
+  START (atan);
+
+  TEST_f_f (atan, 0, 0);
+  TEST_f_f (atan, minus_zero, minus_zero);
+
+  TEST_f_f (atan, plus_infty, M_PI_2l);
+  TEST_f_f (atan, minus_infty, -M_PI_2l);
+  TEST_f_f (atan, nan_value, nan_value);
+
+  TEST_f_f (atan, 1, M_PI_4l);
+  TEST_f_f (atan, -1, -M_PI_4l);
+
+  TEST_f_f (atan, 0.75L, 0.643501108793284386802809228717322638L);
+
+  END (atan);
+}
+
+
+
+static void
+atanh_test (void)
+{
+  errno = 0;
+  FUNC(atanh) (0.7L);
+  if (errno == ENOSYS)
+    /* Function not implemented.  */
+    return;
+
+  START (atanh);
+
+
+  TEST_f_f (atanh, 0, 0);
+  TEST_f_f (atanh, minus_zero, minus_zero);
+
+  TEST_f_f (atanh, 1, plus_infty, DIVIDE_BY_ZERO_EXCEPTION);
+  TEST_f_f (atanh, -1, minus_infty, DIVIDE_BY_ZERO_EXCEPTION);
+  TEST_f_f (atanh, nan_value, nan_value);
+
+  /* atanh (x) == NaN plus invalid exception if |x| > 1.  */
+  TEST_f_f (atanh, 1.125L, nan_value, INVALID_EXCEPTION);
+  TEST_f_f (atanh, -1.125L, nan_value, INVALID_EXCEPTION);
+
+  TEST_f_f (atanh, 0.75L, 0.972955074527656652552676371721589865L);
+
+  END (atanh);
+}
+
+static void
+atan2_test (void)
+{
+  errno = 0;
+  FUNC(atan2) (-0, 1);
+  if (errno == ENOSYS)
+    /* Function not implemented.  */
+    return;
+
+  START (atan2);
+
+  /* atan2 (0,x) == 0 for x > 0.  */
+  TEST_ff_f (atan2, 0, 1, 0);
+
+  /* atan2 (-0,x) == -0 for x > 0.  */
+  TEST_ff_f (atan2, minus_zero, 1, minus_zero);
+
+  TEST_ff_f (atan2, 0, 0, 0);
+  TEST_ff_f (atan2, minus_zero, 0, minus_zero);
+
+  /* atan2 (+0,x) == +pi for x < 0.  */
+  TEST_ff_f (atan2, 0, -1, M_PIl);
+
+  /* atan2 (-0,x) == -pi for x < 0.  */
+  TEST_ff_f (atan2, minus_zero, -1, -M_PIl);
+
+  TEST_ff_f (atan2, 0, minus_zero, M_PIl);
+  TEST_ff_f (atan2, minus_zero, minus_zero, -M_PIl);
+
+  /* atan2 (y,+0) == pi/2 for y > 0.  */
+  TEST_ff_f (atan2, 1, 0, M_PI_2l);
+
+  /* atan2 (y,-0) == pi/2 for y > 0.  */
+  TEST_ff_f (atan2, 1, minus_zero, M_PI_2l);
+
+  /* atan2 (y,+0) == -pi/2 for y < 0.  */
+  TEST_ff_f (atan2, -1, 0, -M_PI_2l);
+
+  /* atan2 (y,-0) == -pi/2 for y < 0.  */
+  TEST_ff_f (atan2, -1, minus_zero, -M_PI_2l);
+
+  /* atan2 (y,inf) == +0 for finite y > 0.  */
+  TEST_ff_f (atan2, 1, plus_infty, 0);
+
+  /* atan2 (y,inf) == -0 for finite y < 0.  */
+  TEST_ff_f (atan2, -1, plus_infty, minus_zero);
+
+  /* atan2(+inf, x) == pi/2 for finite x.  */
+  TEST_ff_f (atan2, plus_infty, -1, M_PI_2l);
+
+  /* atan2(-inf, x) == -pi/2 for finite x.  */
+  TEST_ff_f (atan2, minus_infty, 1, -M_PI_2l);
+
+  /* atan2 (y,-inf) == +pi for finite y > 0.  */
+  TEST_ff_f (atan2, 1, minus_infty, M_PIl);
+
+  /* atan2 (y,-inf) == -pi for finite y < 0.  */
+  TEST_ff_f (atan2, -1, minus_infty, -M_PIl);
+
+  TEST_ff_f (atan2, plus_infty, plus_infty, M_PI_4l);
+  TEST_ff_f (atan2, minus_infty, plus_infty, -M_PI_4l);
+  TEST_ff_f (atan2, plus_infty, minus_infty, M_PI_34l);
+  TEST_ff_f (atan2, minus_infty, minus_infty, -M_PI_34l);
+  TEST_ff_f (atan2, nan_value, nan_value, nan_value);
+
+  TEST_ff_f (atan2, 0.75L, 1, 0.643501108793284386802809228717322638L);
+  TEST_ff_f (atan2, -0.75L, 1.0L, -0.643501108793284386802809228717322638L);
+  TEST_ff_f (atan2, 0.75L, -1.0L, 2.49809154479650885165983415456218025L);
+  TEST_ff_f (atan2, -0.75L, -1.0L, -2.49809154479650885165983415456218025L);
+  TEST_ff_f (atan2, 0.390625L, .00029L, 1.57005392693128974780151246612928941L);
+  TEST_ff_f (atan2, 1.390625L, 0.9296875L, 0.981498387184244311516296577615519772L);
+
+  TEST_ff_f (atan2, -0.00756827042671106339L, -.001792735857538728036L, -1.80338464113663849327153994379639112L);
+
+  END (atan2);
+}
+
+static void
+cabs_test (void)
+{
+  errno = 0;
+  FUNC(cabs) (BUILD_COMPLEX (0.7L, 12.4L));
+  if (errno == ENOSYS)
+    /* Function not implemented.  */
+    return;
+
+  START (cabs);
+
+  /* cabs (x + iy) is specified as hypot (x,y) */
+
+  /* cabs (+inf + i x) == +inf.  */
+  TEST_c_f (cabs, plus_infty, 1.0, plus_infty);
+  /* cabs (-inf + i x) == +inf.  */
+  TEST_c_f (cabs, minus_infty, 1.0, plus_infty);
+
+  TEST_c_f (cabs, minus_infty, nan_value, plus_infty);
+  TEST_c_f (cabs, minus_infty, nan_value, plus_infty);
+
+  TEST_c_f (cabs, nan_value, nan_value, nan_value);
+
+  /* cabs (x,y) == cabs (y,x).  */
+  TEST_c_f (cabs, 0.75L, 12.390625L, 12.4133028598606664302388810868156657L);
+  /* cabs (x,y) == cabs (-x,y).  */
+  TEST_c_f (cabs, -12.390625L, 0.75L, 12.4133028598606664302388810868156657L);
+  /* cabs (x,y) == cabs (-y,x).  */
+  TEST_c_f (cabs, -0.75L, 12.390625L, 12.4133028598606664302388810868156657L);
+  /* cabs (x,y) == cabs (-x,-y).  */
+  TEST_c_f (cabs, -12.390625L, -0.75L, 12.4133028598606664302388810868156657L);
+  /* cabs (x,y) == cabs (-y,-x).  */
+  TEST_c_f (cabs, -0.75L, -12.390625L, 12.4133028598606664302388810868156657L);
+  /* cabs (x,0) == fabs (x).  */
+  TEST_c_f (cabs, -0.75L, 0, 0.75L);
+  TEST_c_f (cabs, 0.75L, 0, 0.75L);
+  TEST_c_f (cabs, -1.0L, 0, 1.0L);
+  TEST_c_f (cabs, 1.0L, 0, 1.0L);
+  TEST_c_f (cabs, -5.7e7L, 0, 5.7e7L);
+  TEST_c_f (cabs, 5.7e7L, 0, 5.7e7L);
+
+  TEST_c_f (cabs, 0.75L, 1.25L, 1.45773797371132511771853821938639577L);
+
+  END (cabs);
+}
+
+
+#if 0
+static void
+cacos_test (void)
+{
+  errno = 0;
+  FUNC(cacos) (BUILD_COMPLEX (0.7L, 1.2L));
+  if (errno == ENOSYS)
+    /* Function not implemented.  */
+    return;
+
+  START (cacos);
+
+
+  TEST_c_c (cacos, 0, 0, M_PI_2l, minus_zero);
+  TEST_c_c (cacos, minus_zero, 0, M_PI_2l, minus_zero);
+  TEST_c_c (cacos, minus_zero, minus_zero, M_PI_2l, 0.0);
+  TEST_c_c (cacos, 0, minus_zero, M_PI_2l, 0.0);
+
+  TEST_c_c (cacos, minus_infty, plus_infty, M_PI_34l, minus_infty);
+  TEST_c_c (cacos, minus_infty, minus_infty, M_PI_34l, plus_infty);
+
+  TEST_c_c (cacos, plus_infty, plus_infty, M_PI_4l, minus_infty);
+  TEST_c_c (cacos, plus_infty, minus_infty, M_PI_4l, plus_infty);
+
+  TEST_c_c (cacos, -10.0, plus_infty, M_PI_2l, minus_infty);
+  TEST_c_c (cacos, -10.0, minus_infty, M_PI_2l, plus_infty);
+  TEST_c_c (cacos, 0, plus_infty, M_PI_2l, minus_infty);
+  TEST_c_c (cacos, 0, minus_infty, M_PI_2l, plus_infty);
+  TEST_c_c (cacos, 0.1L, plus_infty, M_PI_2l, minus_infty);
+  TEST_c_c (cacos, 0.1L, minus_infty, M_PI_2l, plus_infty);
+
+  TEST_c_c (cacos, minus_infty, 0, M_PIl, minus_infty);
+  TEST_c_c (cacos, minus_infty, minus_zero, M_PIl, plus_infty);
+  TEST_c_c (cacos, minus_infty, 100, M_PIl, minus_infty);
+  TEST_c_c (cacos, minus_infty, -100, M_PIl, plus_infty);
+
+  TEST_c_c (cacos, plus_infty, 0, 0.0, minus_infty);
+  TEST_c_c (cacos, plus_infty, minus_zero, 0.0, plus_infty);
+  TEST_c_c (cacos, plus_infty, 0.5, 0.0, minus_infty);
+  TEST_c_c (cacos, plus_infty, -0.5, 0.0, plus_infty);
+
+  TEST_c_c (cacos, plus_infty, nan_value, nan_value, plus_infty, IGNORE_ZERO_INF_SIGN);
+  TEST_c_c (cacos, minus_infty, nan_value, nan_value, plus_infty, IGNORE_ZERO_INF_SIGN);
+
+  TEST_c_c (cacos, 0, nan_value, M_PI_2l, nan_value);
+  TEST_c_c (cacos, minus_zero, nan_value, M_PI_2l, nan_value);
+
+  TEST_c_c (cacos, nan_value, plus_infty, nan_value, minus_infty);
+  TEST_c_c (cacos, nan_value, minus_infty, nan_value, plus_infty);
+
+  TEST_c_c (cacos, 10.5, nan_value, nan_value, nan_value, INVALID_EXCEPTION_OK);
+  TEST_c_c (cacos, -10.5, nan_value, nan_value, nan_value, INVALID_EXCEPTION_OK);
+
+  TEST_c_c (cacos, nan_value, 0.75, nan_value, nan_value, INVALID_EXCEPTION_OK);
+  TEST_c_c (cacos, nan_value, -0.75, nan_value, nan_value, INVALID_EXCEPTION_OK);
+
+  TEST_c_c (cacos, nan_value, nan_value, nan_value, nan_value);
+
+  TEST_c_c (cacos, 0.75L, 1.25L, 1.11752014915610270578240049553777969L, -1.13239363160530819522266333696834467L);
+  TEST_c_c (cacos, -2, -3, 2.1414491111159960199416055713254211L, 1.9833870299165354323470769028940395L);
+
+  END (cacos, complex);
+}
+
+static void
+cacosh_test (void)
+{
+  errno = 0;
+  FUNC(cacosh) (BUILD_COMPLEX (0.7L, 1.2L));
+  if (errno == ENOSYS)
+    /* Function not implemented.  */
+    return;
+
+  START (cacosh);
+
+
+  TEST_c_c (cacosh, 0, 0, 0.0, M_PI_2l);
+  TEST_c_c (cacosh, minus_zero, 0, 0.0, M_PI_2l);
+  TEST_c_c (cacosh, 0, minus_zero, 0.0, -M_PI_2l);
+  TEST_c_c (cacosh, minus_zero, minus_zero, 0.0, -M_PI_2l);
+  TEST_c_c (cacosh, minus_infty, plus_infty, plus_infty, M_PI_34l);
+  TEST_c_c (cacosh, minus_infty, minus_infty, plus_infty, -M_PI_34l);
+
+  TEST_c_c (cacosh, plus_infty, plus_infty, plus_infty, M_PI_4l);
+  TEST_c_c (cacosh, plus_infty, minus_infty, plus_infty, -M_PI_4l);
+
+  TEST_c_c (cacosh, -10.0, plus_infty, plus_infty, M_PI_2l);
+  TEST_c_c (cacosh, -10.0, minus_infty, plus_infty, -M_PI_2l);
+  TEST_c_c (cacosh, 0, plus_infty, plus_infty, M_PI_2l);
+  TEST_c_c (cacosh, 0, minus_infty, plus_infty, -M_PI_2l);
+  TEST_c_c (cacosh, 0.1L, plus_infty, plus_infty, M_PI_2l);
+  TEST_c_c (cacosh, 0.1L, minus_infty, plus_infty, -M_PI_2l);
+
+  TEST_c_c (cacosh, minus_infty, 0, plus_infty, M_PIl);
+  TEST_c_c (cacosh, minus_infty, minus_zero, plus_infty, -M_PIl);
+  TEST_c_c (cacosh, minus_infty, 100, plus_infty, M_PIl);
+  TEST_c_c (cacosh, minus_infty, -100, plus_infty, -M_PIl);
+
+  TEST_c_c (cacosh, plus_infty, 0, plus_infty, 0.0);
+  TEST_c_c (cacosh, plus_infty, minus_zero, plus_infty, minus_zero);
+  TEST_c_c (cacosh, plus_infty, 0.5, plus_infty, 0.0);
+  TEST_c_c (cacosh, plus_infty, -0.5, plus_infty, minus_zero);
+
+  TEST_c_c (cacosh, plus_infty, nan_value, plus_infty, nan_value);
+  TEST_c_c (cacosh, minus_infty, nan_value, plus_infty, nan_value);
+
+  TEST_c_c (cacosh, 0, nan_value, nan_value, nan_value);
+  TEST_c_c (cacosh, minus_zero, nan_value, nan_value, nan_value);
+
+  TEST_c_c (cacosh, nan_value, plus_infty, plus_infty, nan_value);
+  TEST_c_c (cacosh, nan_value, minus_infty, plus_infty, nan_value);
+
+  TEST_c_c (cacosh, 10.5, nan_value, nan_value, nan_value, INVALID_EXCEPTION_OK);
+  TEST_c_c (cacosh, -10.5, nan_value, nan_value, nan_value, INVALID_EXCEPTION_OK);
+
+  TEST_c_c (cacosh, nan_value, 0.75, nan_value, nan_value, INVALID_EXCEPTION_OK);
+  TEST_c_c (cacosh, nan_value, -0.75, nan_value, nan_value, INVALID_EXCEPTION_OK);
+
+  TEST_c_c (cacosh, nan_value, nan_value, nan_value, nan_value);
+
+  TEST_c_c (cacosh, 0.75L, 1.25L, 1.13239363160530819522266333696834467L, 1.11752014915610270578240049553777969L);
+  TEST_c_c (cacosh, -2, -3, 1.9833870299165354323470769028940395L, -2.1414491111159960199416055713254211L);
+
+  END (cacosh, complex);
+}
+
+
+static void
+carg_test (void)
+{
+  START (carg);
+
+  /* carg (x + iy) is specified as atan2 (y, x) */
+
+  /* carg (x + i 0) == 0 for x > 0.  */
+  TEST_c_f (carg, 2.0, 0, 0);
+  /* carg (x - i 0) == -0 for x > 0.  */
+  TEST_c_f (carg, 2.0, minus_zero, minus_zero);
+
+  TEST_c_f (carg, 0, 0, 0);
+  TEST_c_f (carg, 0, minus_zero, minus_zero);
+
+  /* carg (x + i 0) == +pi for x < 0.  */
+  TEST_c_f (carg, -2.0, 0, M_PIl);
+
+  /* carg (x - i 0) == -pi for x < 0.  */
+  TEST_c_f (carg, -2.0, minus_zero, -M_PIl);
+
+  TEST_c_f (carg, minus_zero, 0, M_PIl);
+  TEST_c_f (carg, minus_zero, minus_zero, -M_PIl);
+
+  /* carg (+0 + i y) == pi/2 for y > 0.  */
+  TEST_c_f (carg, 0, 2.0, M_PI_2l);
+
+  /* carg (-0 + i y) == pi/2 for y > 0.  */
+  TEST_c_f (carg, minus_zero, 2.0, M_PI_2l);
+
+  /* carg (+0 + i y) == -pi/2 for y < 0.  */
+  TEST_c_f (carg, 0, -2.0, -M_PI_2l);
+
+  /* carg (-0 + i y) == -pi/2 for y < 0.  */
+  TEST_c_f (carg, minus_zero, -2.0, -M_PI_2l);
+
+  /* carg (inf + i y) == +0 for finite y > 0.  */
+  TEST_c_f (carg, plus_infty, 2.0, 0);
+
+  /* carg (inf + i y) == -0 for finite y < 0.  */
+  TEST_c_f (carg, plus_infty, -2.0, minus_zero);
+
+  /* carg(x + i inf) == pi/2 for finite x.  */
+  TEST_c_f (carg, 10.0, plus_infty, M_PI_2l);
+
+  /* carg(x - i inf) == -pi/2 for finite x.  */
+  TEST_c_f (carg, 10.0, minus_infty, -M_PI_2l);
+
+  /* carg (-inf + i y) == +pi for finite y > 0.  */
+  TEST_c_f (carg, minus_infty, 10.0, M_PIl);
+
+  /* carg (-inf + i y) == -pi for finite y < 0.  */
+  TEST_c_f (carg, minus_infty, -10.0, -M_PIl);
+
+  TEST_c_f (carg, plus_infty, plus_infty, M_PI_4l);
+
+  TEST_c_f (carg, plus_infty, minus_infty, -M_PI_4l);
+
+  TEST_c_f (carg, minus_infty, plus_infty, 3 * M_PI_4l);
+
+  TEST_c_f (carg, minus_infty, minus_infty, -3 * M_PI_4l);
+
+  TEST_c_f (carg, nan_value, nan_value, nan_value);
+
+  END (carg);
+}
+
+static void
+casin_test (void)
+{
+  errno = 0;
+  FUNC(casin) (BUILD_COMPLEX (0.7L, 1.2L));
+  if (errno == ENOSYS)
+    /* Function not implemented.  */
+    return;
+
+  START (casin);
+
+  TEST_c_c (casin, 0, 0, 0.0, 0.0);
+  TEST_c_c (casin, minus_zero, 0, minus_zero, 0.0);
+  TEST_c_c (casin, 0, minus_zero, 0.0, minus_zero);
+  TEST_c_c (casin, minus_zero, minus_zero, minus_zero, minus_zero);
+
+  TEST_c_c (casin, plus_infty, plus_infty, M_PI_4l, plus_infty);
+  TEST_c_c (casin, plus_infty, minus_infty, M_PI_4l, minus_infty);
+  TEST_c_c (casin, minus_infty, plus_infty, -M_PI_4l, plus_infty);
+  TEST_c_c (casin, minus_infty, minus_infty, -M_PI_4l, minus_infty);
+
+  TEST_c_c (casin, -10.0, plus_infty, minus_zero, plus_infty);
+  TEST_c_c (casin, -10.0, minus_infty, minus_zero, minus_infty);
+  TEST_c_c (casin, 0, plus_infty, 0.0, plus_infty);
+  TEST_c_c (casin, 0, minus_infty, 0.0, minus_infty);
+  TEST_c_c (casin, minus_zero, plus_infty, minus_zero, plus_infty);
+  TEST_c_c (casin, minus_zero, minus_infty, minus_zero, minus_infty);
+  TEST_c_c (casin, 0.1L, plus_infty, 0.0, plus_infty);
+  TEST_c_c (casin, 0.1L, minus_infty, 0.0, minus_infty);
+
+  TEST_c_c (casin, minus_infty, 0, -M_PI_2l, plus_infty);
+  TEST_c_c (casin, minus_infty, minus_zero, -M_PI_2l, minus_infty);
+  TEST_c_c (casin, minus_infty, 100, -M_PI_2l, plus_infty);
+  TEST_c_c (casin, minus_infty, -100, -M_PI_2l, minus_infty);
+
+  TEST_c_c (casin, plus_infty, 0, M_PI_2l, plus_infty);
+  TEST_c_c (casin, plus_infty, minus_zero, M_PI_2l, minus_infty);
+  TEST_c_c (casin, plus_infty, 0.5, M_PI_2l, plus_infty);
+  TEST_c_c (casin, plus_infty, -0.5, M_PI_2l, minus_infty);
+
+  TEST_c_c (casin, nan_value, plus_infty, nan_value, plus_infty);
+  TEST_c_c (casin, nan_value, minus_infty, nan_value, minus_infty);
+
+  TEST_c_c (casin, 0.0, nan_value, 0.0, nan_value);
+  TEST_c_c (casin, minus_zero, nan_value, minus_zero, nan_value);
+
+  TEST_c_c (casin, plus_infty, nan_value, nan_value, plus_infty, IGNORE_ZERO_INF_SIGN);
+  TEST_c_c (casin, minus_infty, nan_value, nan_value, plus_infty, IGNORE_ZERO_INF_SIGN);
+
+  TEST_c_c (casin, nan_value, 10.5, nan_value, nan_value, INVALID_EXCEPTION_OK);
+  TEST_c_c (casin, nan_value, -10.5, nan_value, nan_value, INVALID_EXCEPTION_OK);
+
+  TEST_c_c (casin, 0.75, nan_value, nan_value, nan_value, INVALID_EXCEPTION_OK);
+  TEST_c_c (casin, -0.75, nan_value, nan_value, nan_value, INVALID_EXCEPTION_OK);
+
+  TEST_c_c (casin, nan_value, nan_value, nan_value, nan_value);
+
+  TEST_c_c (casin, 0.75L, 1.25L, 0.453276177638793913448921196101971749L, 1.13239363160530819522266333696834467L);
+  TEST_c_c (casin, -2, -3, -0.57065278432109940071028387968566963L, -1.9833870299165354323470769028940395L);
+
+  END (casin, complex);
+}
+
+
+static void
+casinh_test (void)
+{
+  errno = 0;
+  FUNC(casinh) (BUILD_COMPLEX (0.7L, 1.2L));
+  if (errno == ENOSYS)
+    /* Function not implemented.  */
+    return;
+
+  START (casinh);
+
+  TEST_c_c (casinh, 0, 0, 0.0, 0.0);
+  TEST_c_c (casinh, minus_zero, 0, minus_zero, 0);
+  TEST_c_c (casinh, 0, minus_zero, 0.0, minus_zero);
+  TEST_c_c (casinh, minus_zero, minus_zero, minus_zero, minus_zero);
+
+  TEST_c_c (casinh, plus_infty, plus_infty, plus_infty, M_PI_4l);
+  TEST_c_c (casinh, plus_infty, minus_infty, plus_infty, -M_PI_4l);
+  TEST_c_c (casinh, minus_infty, plus_infty, minus_infty, M_PI_4l);
+  TEST_c_c (casinh, minus_infty, minus_infty, minus_infty, -M_PI_4l);
+
+  TEST_c_c (casinh, -10.0, plus_infty, minus_infty, M_PI_2l);
+  TEST_c_c (casinh, -10.0, minus_infty, minus_infty, -M_PI_2l);
+  TEST_c_c (casinh, 0, plus_infty, plus_infty, M_PI_2l);
+  TEST_c_c (casinh, 0, minus_infty, plus_infty, -M_PI_2l);
+  TEST_c_c (casinh, minus_zero, plus_infty, minus_infty, M_PI_2l);
+  TEST_c_c (casinh, minus_zero, minus_infty, minus_infty, -M_PI_2l);
+  TEST_c_c (casinh, 0.1L, plus_infty, plus_infty, M_PI_2l);
+  TEST_c_c (casinh, 0.1L, minus_infty, plus_infty, -M_PI_2l);
+
+  TEST_c_c (casinh, minus_infty, 0, minus_infty, 0.0);
+  TEST_c_c (casinh, minus_infty, minus_zero, minus_infty, minus_zero);
+  TEST_c_c (casinh, minus_infty, 100, minus_infty, 0.0);
+  TEST_c_c (casinh, minus_infty, -100, minus_infty, minus_zero);
+
+  TEST_c_c (casinh, plus_infty, 0, plus_infty, 0.0);
+  TEST_c_c (casinh, plus_infty, minus_zero, plus_infty, minus_zero);
+  TEST_c_c (casinh, plus_infty, 0.5, plus_infty, 0.0);
+  TEST_c_c (casinh, plus_infty, -0.5, plus_infty, minus_zero);
+
+  TEST_c_c (casinh, plus_infty, nan_value, plus_infty, nan_value);
+  TEST_c_c (casinh, minus_infty, nan_value, minus_infty, nan_value);
+
+  TEST_c_c (casinh, nan_value, 0, nan_value, 0.0);
+  TEST_c_c (casinh, nan_value, minus_zero, nan_value, minus_zero);
+
+  TEST_c_c (casinh, nan_value, plus_infty, plus_infty, nan_value, IGNORE_ZERO_INF_SIGN);
+  TEST_c_c (casinh, nan_value, minus_infty, plus_infty, nan_value, IGNORE_ZERO_INF_SIGN);
+
+  TEST_c_c (casinh, 10.5, nan_value, nan_value, nan_value, INVALID_EXCEPTION_OK);
+  TEST_c_c (casinh, -10.5, nan_value, nan_value, nan_value, INVALID_EXCEPTION_OK);
+
+  TEST_c_c (casinh, nan_value, 0.75, nan_value, nan_value, INVALID_EXCEPTION_OK);
+  TEST_c_c (casinh, -0.75, nan_value, nan_value, nan_value, INVALID_EXCEPTION_OK);
+
+  TEST_c_c (casinh, nan_value, nan_value, nan_value, nan_value);
+
+  TEST_c_c (casinh, 0.75L, 1.25L, 1.03171853444778027336364058631006594L, 0.911738290968487636358489564316731207L);
+  TEST_c_c (casinh, -2, -3, -1.9686379257930962917886650952454982L, -0.96465850440760279204541105949953237L);
+
+  END (casinh, complex);
+}
+
+
+static void
+catan_test (void)
+{
+  errno = 0;
+  FUNC(catan) (BUILD_COMPLEX (0.7L, 1.2L));
+  if (errno == ENOSYS)
+    /* Function not implemented.  */
+    return;
+
+  START (catan);
+
+  TEST_c_c (catan, 0, 0, 0, 0);
+  TEST_c_c (catan, minus_zero, 0, minus_zero, 0);
+  TEST_c_c (catan, 0, minus_zero, 0, minus_zero);
+  TEST_c_c (catan, minus_zero, minus_zero, minus_zero, minus_zero);
+
+  TEST_c_c (catan, plus_infty, plus_infty, M_PI_2l, 0);
+  TEST_c_c (catan, plus_infty, minus_infty, M_PI_2l, minus_zero);
+  TEST_c_c (catan, minus_infty, plus_infty, -M_PI_2l, 0);
+  TEST_c_c (catan, minus_infty, minus_infty, -M_PI_2l, minus_zero);
+
+
+  TEST_c_c (catan, plus_infty, -10.0, M_PI_2l, minus_zero);
+  TEST_c_c (catan, minus_infty, -10.0, -M_PI_2l, minus_zero);
+  TEST_c_c (catan, plus_infty, minus_zero, M_PI_2l, minus_zero);
+  TEST_c_c (catan, minus_infty, minus_zero, -M_PI_2l, minus_zero);
+  TEST_c_c (catan, plus_infty, 0.0, M_PI_2l, 0);
+  TEST_c_c (catan, minus_infty, 0.0, -M_PI_2l, 0);
+  TEST_c_c (catan, plus_infty, 0.1L, M_PI_2l, 0);
+  TEST_c_c (catan, minus_infty, 0.1L, -M_PI_2l, 0);
+
+  TEST_c_c (catan, 0.0, minus_infty, M_PI_2l, minus_zero);
+  TEST_c_c (catan, minus_zero, minus_infty, -M_PI_2l, minus_zero);
+  TEST_c_c (catan, 100.0, minus_infty, M_PI_2l, minus_zero);
+  TEST_c_c (catan, -100.0, minus_infty, -M_PI_2l, minus_zero);
+
+  TEST_c_c (catan, 0.0, plus_infty, M_PI_2l, 0);
+  TEST_c_c (catan, minus_zero, plus_infty, -M_PI_2l, 0);
+  TEST_c_c (catan, 0.5, plus_infty, M_PI_2l, 0);
+  TEST_c_c (catan, -0.5, plus_infty, -M_PI_2l, 0);
+
+  TEST_c_c (catan, nan_value, 0.0, nan_value, 0);
+  TEST_c_c (catan, nan_value, minus_zero, nan_value, minus_zero);
+
+  TEST_c_c (catan, nan_value, plus_infty, nan_value, 0);
+  TEST_c_c (catan, nan_value, minus_infty, nan_value, minus_zero);
+
+  TEST_c_c (catan, 0.0, nan_value, nan_value, nan_value);
+  TEST_c_c (catan, minus_zero, nan_value, nan_value, nan_value);
+
+  TEST_c_c (catan, plus_infty, nan_value, M_PI_2l, 0, IGNORE_ZERO_INF_SIGN);
+  TEST_c_c (catan, minus_infty, nan_value, -M_PI_2l, 0, IGNORE_ZERO_INF_SIGN);
+
+  TEST_c_c (catan, nan_value, 10.5, nan_value, nan_value, INVALID_EXCEPTION_OK);
+  TEST_c_c (catan, nan_value, -10.5, nan_value, nan_value, INVALID_EXCEPTION_OK);
+
+  TEST_c_c (catan, 0.75, nan_value, nan_value, nan_value, INVALID_EXCEPTION_OK);
+  TEST_c_c (catan, -0.75, nan_value, nan_value, nan_value, INVALID_EXCEPTION_OK);
+
+  TEST_c_c (catan, nan_value, nan_value, nan_value, nan_value);
+
+  TEST_c_c (catan, 0.75L, 1.25L, 1.10714871779409050301706546017853704L, 0.549306144334054845697622618461262852L);
+  TEST_c_c (catan, -2, -3, -1.4099210495965755225306193844604208L, -0.22907268296853876629588180294200276L);
+
+  END (catan, complex);
+}
+
+static void
+catanh_test (void)
+{
+  errno = 0;
+  FUNC(catanh) (BUILD_COMPLEX (0.7L, 1.2L));
+  if (errno == ENOSYS)
+    /* Function not implemented.  */
+    return;
+
+  START (catanh);
+
+  TEST_c_c (catanh, 0, 0, 0.0, 0.0);
+  TEST_c_c (catanh, minus_zero, 0, minus_zero, 0.0);
+  TEST_c_c (catanh, 0, minus_zero, 0.0, minus_zero);
+  TEST_c_c (catanh, minus_zero, minus_zero, minus_zero, minus_zero);
+
+  TEST_c_c (catanh, plus_infty, plus_infty, 0.0, M_PI_2l);
+  TEST_c_c (catanh, plus_infty, minus_infty, 0.0, -M_PI_2l);
+  TEST_c_c (catanh, minus_infty, plus_infty, minus_zero, M_PI_2l);
+  TEST_c_c (catanh, minus_infty, minus_infty, minus_zero, -M_PI_2l);
+
+  TEST_c_c (catanh, -10.0, plus_infty, minus_zero, M_PI_2l);
+  TEST_c_c (catanh, -10.0, minus_infty, minus_zero, -M_PI_2l);
+  TEST_c_c (catanh, minus_zero, plus_infty, minus_zero, M_PI_2l);
+  TEST_c_c (catanh, minus_zero, minus_infty, minus_zero, -M_PI_2l);
+  TEST_c_c (catanh, 0, plus_infty, 0.0, M_PI_2l);
+  TEST_c_c (catanh, 0, minus_infty, 0.0, -M_PI_2l);
+  TEST_c_c (catanh, 0.1L, plus_infty, 0.0, M_PI_2l);
+  TEST_c_c (catanh, 0.1L, minus_infty, 0.0, -M_PI_2l);
+
+  TEST_c_c (catanh, minus_infty, 0, minus_zero, M_PI_2l);
+  TEST_c_c (catanh, minus_infty, minus_zero, minus_zero, -M_PI_2l);
+  TEST_c_c (catanh, minus_infty, 100, minus_zero, M_PI_2l);
+  TEST_c_c (catanh, minus_infty, -100, minus_zero, -M_PI_2l);
+
+  TEST_c_c (catanh, plus_infty, 0, 0.0, M_PI_2l);
+  TEST_c_c (catanh, plus_infty, minus_zero, 0.0, -M_PI_2l);
+  TEST_c_c (catanh, plus_infty, 0.5, 0.0, M_PI_2l);
+  TEST_c_c (catanh, plus_infty, -0.5, 0.0, -M_PI_2l);
+
+  TEST_c_c (catanh, 0, nan_value, 0.0, nan_value);
+  TEST_c_c (catanh, minus_zero, nan_value, minus_zero, nan_value);
+
+  TEST_c_c (catanh, plus_infty, nan_value, 0.0, nan_value);
+  TEST_c_c (catanh, minus_infty, nan_value, minus_zero, nan_value);
+
+  TEST_c_c (catanh, nan_value, 0, nan_value, nan_value);
+  TEST_c_c (catanh, nan_value, minus_zero, nan_value, nan_value);
+
+  TEST_c_c (catanh, nan_value, plus_infty, 0.0, M_PI_2l, IGNORE_ZERO_INF_SIGN);
+  TEST_c_c (catanh, nan_value, minus_infty, 0.0, -M_PI_2l, IGNORE_ZERO_INF_SIGN);
+
+  TEST_c_c (catanh, 10.5, nan_value, nan_value, nan_value, INVALID_EXCEPTION_OK);
+  TEST_c_c (catanh, -10.5, nan_value, nan_value, nan_value, INVALID_EXCEPTION_OK);
+
+  TEST_c_c (catanh, nan_value, 0.75, nan_value, nan_value, INVALID_EXCEPTION_OK);
+  TEST_c_c (catanh, nan_value, -0.75, nan_value, nan_value, INVALID_EXCEPTION_OK);
+
+  TEST_c_c (catanh, nan_value, nan_value, nan_value, nan_value);
+
+  TEST_c_c (catanh, 0.75L, 1.25L, 0.261492138795671927078652057366532140L, 0.996825126463918666098902241310446708L);
+  TEST_c_c (catanh, -2, -3, -0.14694666622552975204743278515471595L, -1.3389725222944935611241935759091443L);
+
+  END (catanh, complex);
+}
+#endif
+
+static void
+cbrt_test (void)
+{
+  errno = 0;
+  FUNC(cbrt) (8);
+  if (errno == ENOSYS)
+    /* Function not implemented.  */
+    return;
+
+  START (cbrt);
+
+  TEST_f_f (cbrt, 0.0, 0.0);
+  TEST_f_f (cbrt, minus_zero, minus_zero);
+
+  TEST_f_f (cbrt, plus_infty, plus_infty);
+  TEST_f_f (cbrt, minus_infty, minus_infty);
+  TEST_f_f (cbrt, nan_value, nan_value);
+
+  TEST_f_f (cbrt, -0.001L, -0.1L);
+  TEST_f_f (cbrt, 8, 2);
+  TEST_f_f (cbrt, -27.0, -3.0);
+  TEST_f_f (cbrt, 0.9921875L, 0.997389022060725270579075195353955217L);
+  TEST_f_f (cbrt, 0.75L, 0.908560296416069829445605878163630251L);
+
+  END (cbrt);
+}
+
+
+#if 0
+static void
+ccos_test (void)
+{
+  errno = 0;
+  FUNC(ccos) (BUILD_COMPLEX (0, 0));
+  if (errno == ENOSYS)
+    /* Function not implemented.  */
+    return;
+
+  START (ccos);
+
+  TEST_c_c (ccos, 0.0, 0.0, 1.0, minus_zero);
+  TEST_c_c (ccos, minus_zero, 0.0, 1.0, 0.0);
+  TEST_c_c (ccos, 0.0, minus_zero, 1.0, 0.0);
+  TEST_c_c (ccos, minus_zero, minus_zero, 1.0, minus_zero);
+
+  TEST_c_c (ccos, plus_infty, 0.0, nan_value, 0.0, INVALID_EXCEPTION|IGNORE_ZERO_INF_SIGN);
+  TEST_c_c (ccos, plus_infty, minus_zero, nan_value, 0.0, INVALID_EXCEPTION|IGNORE_ZERO_INF_SIGN);
+  TEST_c_c (ccos, minus_infty, 0.0, nan_value, 0.0, INVALID_EXCEPTION|IGNORE_ZERO_INF_SIGN);
+  TEST_c_c (ccos, minus_infty, minus_zero, nan_value, 0.0, INVALID_EXCEPTION|IGNORE_ZERO_INF_SIGN);
+
+  TEST_c_c (ccos, 0.0, plus_infty, plus_infty, minus_zero);
+  TEST_c_c (ccos, 0.0, minus_infty, plus_infty, 0.0);
+  TEST_c_c (ccos, minus_zero, plus_infty, plus_infty, 0.0);
+  TEST_c_c (ccos, minus_zero, minus_infty, plus_infty, minus_zero);
+
+  TEST_c_c (ccos, plus_infty, plus_infty, plus_infty, nan_value, INVALID_EXCEPTION);
+  TEST_c_c (ccos, minus_infty, plus_infty, plus_infty, nan_value, INVALID_EXCEPTION);
+  TEST_c_c (ccos, plus_infty, minus_infty, plus_infty, nan_value, INVALID_EXCEPTION);
+  TEST_c_c (ccos, minus_infty, minus_infty, plus_infty, nan_value, INVALID_EXCEPTION);
+
+  TEST_c_c (ccos, 4.625, plus_infty, minus_infty, plus_infty);
+  TEST_c_c (ccos, 4.625, minus_infty, minus_infty, minus_infty);
+  TEST_c_c (ccos, -4.625, plus_infty, minus_infty, minus_infty);
+  TEST_c_c (ccos, -4.625, minus_infty, minus_infty, plus_infty);
+
+  TEST_c_c (ccos, plus_infty, 6.75, nan_value, nan_value, INVALID_EXCEPTION);
+  TEST_c_c (ccos, plus_infty, -6.75, nan_value, nan_value, INVALID_EXCEPTION);
+  TEST_c_c (ccos, minus_infty, 6.75, nan_value, nan_value, INVALID_EXCEPTION);
+  TEST_c_c (ccos, minus_infty, -6.75, nan_value, nan_value, INVALID_EXCEPTION);
+
+  TEST_c_c (ccos, nan_value, 0.0, nan_value, 0.0, IGNORE_ZERO_INF_SIGN);
+  TEST_c_c (ccos, nan_value, minus_zero, nan_value, 0.0, IGNORE_ZERO_INF_SIGN);
+
+  TEST_c_c (ccos, nan_value, plus_infty, plus_infty, nan_value);
+  TEST_c_c (ccos, nan_value, minus_infty, plus_infty, nan_value);
+
+  TEST_c_c (ccos, nan_value, 9.0, nan_value, nan_value, INVALID_EXCEPTION_OK);
+  TEST_c_c (ccos, nan_value, -9.0, nan_value, nan_value, INVALID_EXCEPTION_OK);
+
+  TEST_c_c (ccos, 0.0, nan_value, nan_value, 0.0, IGNORE_ZERO_INF_SIGN);
+  TEST_c_c (ccos, minus_zero, nan_value, nan_value, 0.0, IGNORE_ZERO_INF_SIGN);
+
+  TEST_c_c (ccos, 10.0, nan_value, nan_value, nan_value, INVALID_EXCEPTION_OK);
+  TEST_c_c (ccos, -10.0, nan_value, nan_value, nan_value, INVALID_EXCEPTION_OK);
+
+  TEST_c_c (ccos, plus_infty, nan_value, nan_value, nan_value, INVALID_EXCEPTION_OK);
+  TEST_c_c (ccos, minus_infty, nan_value, nan_value, nan_value, INVALID_EXCEPTION_OK);
+
+  TEST_c_c (ccos, nan_value, nan_value, nan_value, nan_value);
+
+  TEST_c_c (ccos, 0.75L, 1.25L, 1.38173873063425888530729933139078645L, -1.09193013555397466170919531722024128L);
+  TEST_c_c (ccos, -2, -3, -4.18962569096880723013255501961597373L, -9.10922789375533659797919726277886212L);
+
+  END (ccos, complex);
+}
+
+
+static void
+ccosh_test (void)
+{
+  errno = 0;
+  FUNC(ccosh) (BUILD_COMPLEX (0.7L, 1.2L));
+  if (errno == ENOSYS)
+    /* Function not implemented.  */
+    return;
+
+  START (ccosh);
+
+  TEST_c_c (ccosh, 0.0, 0.0, 1.0, 0.0);
+  TEST_c_c (ccosh, minus_zero, 0.0, 1.0, minus_zero);
+  TEST_c_c (ccosh, 0.0, minus_zero, 1.0, minus_zero);
+  TEST_c_c (ccosh, minus_zero, minus_zero, 1.0, 0.0);
+
+  TEST_c_c (ccosh, 0.0, plus_infty, nan_value, 0.0, INVALID_EXCEPTION|IGNORE_ZERO_INF_SIGN);
+  TEST_c_c (ccosh, minus_zero, plus_infty, nan_value, 0.0, INVALID_EXCEPTION|IGNORE_ZERO_INF_SIGN);
+  TEST_c_c (ccosh, 0.0, minus_infty, nan_value, 0.0, INVALID_EXCEPTION|IGNORE_ZERO_INF_SIGN);
+  TEST_c_c (ccosh, minus_zero, minus_infty, nan_value, 0.0, INVALID_EXCEPTION|IGNORE_ZERO_INF_SIGN);
+
+  TEST_c_c (ccosh, plus_infty, 0.0, plus_infty, 0.0);
+  TEST_c_c (ccosh, minus_infty, 0.0, plus_infty, minus_zero);
+  TEST_c_c (ccosh, plus_infty, minus_zero, plus_infty, minus_zero);
+  TEST_c_c (ccosh, minus_infty, minus_zero, plus_infty, 0.0);
+
+  TEST_c_c (ccosh, plus_infty, plus_infty, plus_infty, nan_value, INVALID_EXCEPTION);
+  TEST_c_c (ccosh, minus_infty, plus_infty, plus_infty, nan_value, INVALID_EXCEPTION);
+  TEST_c_c (ccosh, plus_infty, minus_infty, plus_infty, nan_value, INVALID_EXCEPTION);
+  TEST_c_c (ccosh, minus_infty, minus_infty, plus_infty, nan_value, INVALID_EXCEPTION);
+
+  TEST_c_c (ccosh, plus_infty, 4.625, minus_infty, minus_infty);
+  TEST_c_c (ccosh, minus_infty, 4.625, minus_infty, plus_infty);
+  TEST_c_c (ccosh, plus_infty, -4.625, minus_infty, plus_infty);
+  TEST_c_c (ccosh, minus_infty, -4.625, minus_infty, minus_infty);
+
+  TEST_c_c (ccosh, 6.75, plus_infty, nan_value, nan_value, INVALID_EXCEPTION);
+  TEST_c_c (ccosh, -6.75, plus_infty, nan_value, nan_value, INVALID_EXCEPTION);
+  TEST_c_c (ccosh, 6.75, minus_infty, nan_value, nan_value, INVALID_EXCEPTION);
+  TEST_c_c (ccosh, -6.75, minus_infty, nan_value, nan_value, INVALID_EXCEPTION);
+
+  TEST_c_c (ccosh, 0.0, nan_value, nan_value, 0.0, IGNORE_ZERO_INF_SIGN);
+  TEST_c_c (ccosh, minus_zero, nan_value, nan_value, 0.0, IGNORE_ZERO_INF_SIGN);
+
+  TEST_c_c (ccosh, plus_infty, nan_value, plus_infty, nan_value);
+  TEST_c_c (ccosh, minus_infty, nan_value, plus_infty, nan_value);
+
+  TEST_c_c (ccosh, 9.0, nan_value, nan_value, nan_value, INVALID_EXCEPTION_OK);
+  TEST_c_c (ccosh, -9.0, nan_value, nan_value, nan_value, INVALID_EXCEPTION_OK);
+
+  TEST_c_c (ccosh, nan_value, 0.0, nan_value, 0.0, IGNORE_ZERO_INF_SIGN);
+  TEST_c_c (ccosh, nan_value, minus_zero, nan_value, 0.0, IGNORE_ZERO_INF_SIGN);
+
+  TEST_c_c (ccosh, nan_value, 10.0, nan_value, nan_value, INVALID_EXCEPTION_OK);
+  TEST_c_c (ccosh, nan_value, -10.0, nan_value, nan_value, INVALID_EXCEPTION_OK);
+
+  TEST_c_c (ccosh, nan_value, plus_infty, nan_value, nan_value, INVALID_EXCEPTION_OK);
+  TEST_c_c (ccosh, nan_value, minus_infty, nan_value, nan_value, INVALID_EXCEPTION_OK);
+
+  TEST_c_c (ccosh, nan_value, nan_value, nan_value, nan_value);
+
+  TEST_c_c (ccosh, 0.75L, 1.25L, 0.408242591877968807788852146397499084L, 0.780365930845853240391326216300863152L);
+
+  TEST_c_c (ccosh, -2, -3, -3.72454550491532256547397070325597253L, 0.511822569987384608834463849801875634L);
+
+  END (ccosh, complex);
+}
+#endif
+
+
+static void
+ceil_test (void)
+{
+  START (ceil);
+
+  TEST_f_f (ceil, 0.0, 0.0);
+  TEST_f_f (ceil, minus_zero, minus_zero);
+  TEST_f_f (ceil, plus_infty, plus_infty);
+  TEST_f_f (ceil, minus_infty, minus_infty);
+  TEST_f_f (ceil, nan_value, nan_value);
+
+  TEST_f_f (ceil, M_PIl, 4.0);
+  TEST_f_f (ceil, -M_PIl, -3.0);
+  TEST_f_f (ceil, 0.25, 1.0);
+  TEST_f_f (ceil, -0.25, minus_zero);
+
+#ifdef TEST_LDOUBLE
+  /* The result can only be represented in long double.  */
+  TEST_f_f (ceil, 4503599627370495.5L, 4503599627370496.0L);
+  TEST_f_f (ceil, 4503599627370496.25L, 4503599627370497.0L);
+  TEST_f_f (ceil, 4503599627370496.5L, 4503599627370497.0L);
+  TEST_f_f (ceil, 4503599627370496.75L, 4503599627370497.0L);
+  TEST_f_f (ceil, 4503599627370497.5L, 4503599627370498.0L);
+
+  TEST_f_f (ceil, -4503599627370495.5L, -4503599627370495.0L);
+  TEST_f_f (ceil, -4503599627370496.25L, -4503599627370496.0L);
+  TEST_f_f (ceil, -4503599627370496.5L, -4503599627370496.0L);
+  TEST_f_f (ceil, -4503599627370496.75L, -4503599627370496.0L);
+  TEST_f_f (ceil, -4503599627370497.5L, -4503599627370497.0L);
+
+  TEST_f_f (ceil, 9007199254740991.5L, 9007199254740992.0L);
+  TEST_f_f (ceil, 9007199254740992.25L, 9007199254740993.0L);
+  TEST_f_f (ceil, 9007199254740992.5L, 9007199254740993.0L);
+  TEST_f_f (ceil, 9007199254740992.75L, 9007199254740993.0L);
+  TEST_f_f (ceil, 9007199254740993.5L, 9007199254740994.0L);
+
+  TEST_f_f (ceil, -9007199254740991.5L, -9007199254740991.0L);
+  TEST_f_f (ceil, -9007199254740992.25L, -9007199254740992.0L);
+  TEST_f_f (ceil, -9007199254740992.5L, -9007199254740992.0L);
+  TEST_f_f (ceil, -9007199254740992.75L, -9007199254740992.0L);
+  TEST_f_f (ceil, -9007199254740993.5L, -9007199254740993.0L);
+
+  TEST_f_f (ceil, 72057594037927935.5L, 72057594037927936.0L);
+  TEST_f_f (ceil, 72057594037927936.25L, 72057594037927937.0L);
+  TEST_f_f (ceil, 72057594037927936.5L, 72057594037927937.0L);
+  TEST_f_f (ceil, 72057594037927936.75L, 72057594037927937.0L);
+  TEST_f_f (ceil, 72057594037927937.5L, 72057594037927938.0L);
+
+  TEST_f_f (ceil, -72057594037927935.5L, -72057594037927935.0L);
+  TEST_f_f (ceil, -72057594037927936.25L, -72057594037927936.0L);
+  TEST_f_f (ceil, -72057594037927936.5L, -72057594037927936.0L);
+  TEST_f_f (ceil, -72057594037927936.75L, -72057594037927936.0L);
+  TEST_f_f (ceil, -72057594037927937.5L, -72057594037927937.0L);
+
+  TEST_f_f (ceil, 10141204801825835211973625643007.5L, 10141204801825835211973625643008.0L);
+  TEST_f_f (ceil, 10141204801825835211973625643008.25L, 10141204801825835211973625643009.0L);
+  TEST_f_f (ceil, 10141204801825835211973625643008.5L, 10141204801825835211973625643009.0L);
+  TEST_f_f (ceil, 10141204801825835211973625643008.75L, 10141204801825835211973625643009.0L);
+  TEST_f_f (ceil, 10141204801825835211973625643009.5L, 10141204801825835211973625643010.0L);
+#endif
+
+  END (ceil);
+}
+
+
+#if 0
+static void
+cexp_test (void)
+{
+  errno = 0;
+  FUNC(cexp) (BUILD_COMPLEX (0, 0));
+  if (errno == ENOSYS)
+    /* Function not implemented.  */
+    return;
+
+  START (cexp);
+
+  TEST_c_c (cexp, plus_zero, plus_zero, 1, 0.0);
+  TEST_c_c (cexp, minus_zero, plus_zero, 1, 0.0);
+  TEST_c_c (cexp, plus_zero, minus_zero, 1, minus_zero);
+  TEST_c_c (cexp, minus_zero, minus_zero, 1, minus_zero);
+
+  TEST_c_c (cexp, plus_infty, plus_zero, plus_infty, 0.0);
+  TEST_c_c (cexp, plus_infty, minus_zero, plus_infty, minus_zero);
+
+  TEST_c_c (cexp, minus_infty, plus_zero, 0.0, 0.0);
+  TEST_c_c (cexp, minus_infty, minus_zero, 0.0, minus_zero);
+
+  TEST_c_c (cexp, 0.0, plus_infty, nan_value, nan_value, INVALID_EXCEPTION);
+  TEST_c_c (cexp, minus_zero, plus_infty, nan_value, nan_value, INVALID_EXCEPTION);
+
+  TEST_c_c (cexp, 0.0, minus_infty, nan_value, nan_value, INVALID_EXCEPTION);
+  TEST_c_c (cexp, minus_zero, minus_infty, nan_value, nan_value, INVALID_EXCEPTION);
+
+  TEST_c_c (cexp, 100.0, plus_infty, nan_value, nan_value, INVALID_EXCEPTION);
+  TEST_c_c (cexp, -100.0, plus_infty, nan_value, nan_value, INVALID_EXCEPTION);
+
+  TEST_c_c (cexp, 100.0, minus_infty, nan_value, nan_value, INVALID_EXCEPTION);
+  TEST_c_c (cexp, -100.0, minus_infty, nan_value, nan_value, INVALID_EXCEPTION);
+
+  TEST_c_c (cexp, minus_infty, 2.0, minus_zero, 0.0);
+  TEST_c_c (cexp, minus_infty, 4.0, minus_zero, minus_zero);
+  TEST_c_c (cexp, plus_infty, 2.0, minus_infty, plus_infty);
+  TEST_c_c (cexp, plus_infty, 4.0, minus_infty, minus_infty);
+
+  TEST_c_c (cexp, plus_infty, plus_infty, plus_infty, nan_value, INVALID_EXCEPTION|IGNORE_ZERO_INF_SIGN);
+  TEST_c_c (cexp, plus_infty, minus_infty, plus_infty, nan_value, INVALID_EXCEPTION|IGNORE_ZERO_INF_SIGN);
+
+  TEST_c_c (cexp, minus_infty, plus_infty, 0.0, 0.0, IGNORE_ZERO_INF_SIGN);
+  TEST_c_c (cexp, minus_infty, minus_infty, 0.0, minus_zero, IGNORE_ZERO_INF_SIGN);
+
+  TEST_c_c (cexp, minus_infty, nan_value, 0, 0, IGNORE_ZERO_INF_SIGN);
+
+  TEST_c_c (cexp, plus_infty, nan_value, plus_infty, nan_value);
+
+  TEST_c_c (cexp, nan_value, 0.0, nan_value, nan_value, INVALID_EXCEPTION_OK);
+  TEST_c_c (cexp, nan_value, 1.0, nan_value, nan_value, INVALID_EXCEPTION_OK);
+
+  TEST_c_c (cexp, nan_value, plus_infty, nan_value, nan_value, INVALID_EXCEPTION_OK);
+  TEST_c_c (cexp, 0, nan_value, nan_value, nan_value, INVALID_EXCEPTION_OK);
+  TEST_c_c (cexp, 1, nan_value, nan_value, nan_value, INVALID_EXCEPTION_OK);
+  TEST_c_c (cexp, nan_value, nan_value, nan_value, nan_value);
+
+  TEST_c_c (cexp, 0.75L, 1.25L, 0.667537446429131586942201977015932112L, 2.00900045494094876258347228145863909L);
+  TEST_c_c (cexp, -2.0, -3.0, -0.13398091492954261346140525546115575L, -0.019098516261135196432576240858800925L);
+
+  END (cexp, complex);
+}
+
+
+static void
+cimag_test (void)
+{
+  START (cimag);
+  TEST_c_f (cimag, 1.0, 0.0, 0.0);
+  TEST_c_f (cimag, 1.0, minus_zero, minus_zero);
+  TEST_c_f (cimag, 1.0, nan_value, nan_value);
+  TEST_c_f (cimag, nan_value, nan_value, nan_value);
+  TEST_c_f (cimag, 1.0, plus_infty, plus_infty);
+  TEST_c_f (cimag, 1.0, minus_infty, minus_infty);
+  TEST_c_f (cimag, 2.0, 3.0, 3.0);
+
+  END (cimag);
+}
+
+static void
+clog_test (void)
+{
+  errno = 0;
+  FUNC(clog) (BUILD_COMPLEX (-2, -3));
+  if (errno == ENOSYS)
+    /* Function not implemented.  */
+    return;
+
+  START (clog);
+
+  TEST_c_c (clog, minus_zero, 0, minus_infty, M_PIl, DIVIDE_BY_ZERO_EXCEPTION);
+  TEST_c_c (clog, minus_zero, minus_zero, minus_infty, -M_PIl, DIVIDE_BY_ZERO_EXCEPTION);
+
+  TEST_c_c (clog, 0, 0, minus_infty, 0.0, DIVIDE_BY_ZERO_EXCEPTION);
+  TEST_c_c (clog, 0, minus_zero, minus_infty, minus_zero, DIVIDE_BY_ZERO_EXCEPTION);
+
+  TEST_c_c (clog, minus_infty, plus_infty, plus_infty, M_PI_34l);
+  TEST_c_c (clog, minus_infty, minus_infty, plus_infty, -M_PI_34l);
+
+  TEST_c_c (clog, plus_infty, plus_infty, plus_infty, M_PI_4l);
+  TEST_c_c (clog, plus_infty, minus_infty, plus_infty, -M_PI_4l);
+
+  TEST_c_c (clog, 0, plus_infty, plus_infty, M_PI_2l);
+  TEST_c_c (clog, 3, plus_infty, plus_infty, M_PI_2l);
+  TEST_c_c (clog, minus_zero, plus_infty, plus_infty, M_PI_2l);
+  TEST_c_c (clog, -3, plus_infty, plus_infty, M_PI_2l);
+  TEST_c_c (clog, 0, minus_infty, plus_infty, -M_PI_2l);
+  TEST_c_c (clog, 3, minus_infty, plus_infty, -M_PI_2l);
+  TEST_c_c (clog, minus_zero, minus_infty, plus_infty, -M_PI_2l);
+  TEST_c_c (clog, -3, minus_infty, plus_infty, -M_PI_2l);
+
+  TEST_c_c (clog, minus_infty, 0, plus_infty, M_PIl);
+  TEST_c_c (clog, minus_infty, 1, plus_infty, M_PIl);
+  TEST_c_c (clog, minus_infty, minus_zero, plus_infty, -M_PIl);
+  TEST_c_c (clog, minus_infty, -1, plus_infty, -M_PIl);
+
+  TEST_c_c (clog, plus_infty, 0, plus_infty, 0.0);
+  TEST_c_c (clog, plus_infty, 1, plus_infty, 0.0);
+  TEST_c_c (clog, plus_infty, minus_zero, plus_infty, minus_zero);
+  TEST_c_c (clog, plus_infty, -1, plus_infty, minus_zero);
+
+  TEST_c_c (clog, plus_infty, nan_value, plus_infty, nan_value);
+  TEST_c_c (clog, minus_infty, nan_value, plus_infty, nan_value);
+
+  TEST_c_c (clog, nan_value, plus_infty, plus_infty, nan_value);
+  TEST_c_c (clog, nan_value, minus_infty, plus_infty, nan_value);
+
+  TEST_c_c (clog, 0, nan_value, nan_value, nan_value, INVALID_EXCEPTION_OK);
+  TEST_c_c (clog, 3, nan_value, nan_value, nan_value, INVALID_EXCEPTION_OK);
+  TEST_c_c (clog, minus_zero, nan_value, nan_value, nan_value, INVALID_EXCEPTION_OK);
+  TEST_c_c (clog, -3, nan_value, nan_value, nan_value, INVALID_EXCEPTION_OK);
+
+  TEST_c_c (clog, nan_value, 0, nan_value, nan_value, INVALID_EXCEPTION_OK);
+  TEST_c_c (clog, nan_value, 5, nan_value, nan_value, INVALID_EXCEPTION_OK);
+  TEST_c_c (clog, nan_value, minus_zero, nan_value, nan_value, INVALID_EXCEPTION_OK);
+  TEST_c_c (clog, nan_value, -5, nan_value, nan_value, INVALID_EXCEPTION_OK);
+
+  TEST_c_c (clog, nan_value, nan_value, nan_value, nan_value);
+
+  TEST_c_c (clog, 0.75L, 1.25L, 0.376885901188190075998919126749298416L, 1.03037682652431246378774332703115153L);
+  TEST_c_c (clog, -2, -3, 1.2824746787307683680267437207826593L, -2.1587989303424641704769327722648368L);
+
+  END (clog, complex);
+}
+
+
+static void
+clog10_test (void)
+{
+  errno = 0;
+  FUNC(clog10) (BUILD_COMPLEX (0.7L, 1.2L));
+  if (errno == ENOSYS)
+    /* Function not implemented.  */
+    return;
+
+  START (clog10);
+
+  TEST_c_c (clog10, minus_zero, 0, minus_infty, M_PIl, DIVIDE_BY_ZERO_EXCEPTION);
+  TEST_c_c (clog10, minus_zero, minus_zero, minus_infty, -M_PIl, DIVIDE_BY_ZERO_EXCEPTION);
+
+  TEST_c_c (clog10, 0, 0, minus_infty, 0.0, DIVIDE_BY_ZERO_EXCEPTION);
+  TEST_c_c (clog10, 0, minus_zero, minus_infty, minus_zero, DIVIDE_BY_ZERO_EXCEPTION);
+
+  TEST_c_c (clog10, minus_infty, plus_infty, plus_infty, M_PI_34_LOG10El);
+
+  TEST_c_c (clog10, plus_infty, plus_infty, plus_infty, M_PI4_LOG10El);
+  TEST_c_c (clog10, plus_infty, minus_infty, plus_infty, -M_PI4_LOG10El);
+
+  TEST_c_c (clog10, 0, plus_infty, plus_infty, M_PI2_LOG10El);
+  TEST_c_c (clog10, 3, plus_infty, plus_infty, M_PI2_LOG10El);
+  TEST_c_c (clog10, minus_zero, plus_infty, plus_infty, M_PI2_LOG10El);
+  TEST_c_c (clog10, -3, plus_infty, plus_infty, M_PI2_LOG10El);
+  TEST_c_c (clog10, 0, minus_infty, plus_infty, -M_PI2_LOG10El);
+  TEST_c_c (clog10, 3, minus_infty, plus_infty, -M_PI2_LOG10El);
+  TEST_c_c (clog10, minus_zero, minus_infty, plus_infty, -M_PI2_LOG10El);
+  TEST_c_c (clog10, -3, minus_infty, plus_infty, -M_PI2_LOG10El);
+
+  TEST_c_c (clog10, minus_infty, 0, plus_infty, M_PI_LOG10El);
+  TEST_c_c (clog10, minus_infty, 1, plus_infty, M_PI_LOG10El);
+  TEST_c_c (clog10, minus_infty, minus_zero, plus_infty, -M_PI_LOG10El);
+  TEST_c_c (clog10, minus_infty, -1, plus_infty, -M_PI_LOG10El);
+
+  TEST_c_c (clog10, plus_infty, 0, plus_infty, 0.0);
+  TEST_c_c (clog10, plus_infty, 1, plus_infty, 0.0);
+  TEST_c_c (clog10, plus_infty, minus_zero, plus_infty, minus_zero);
+  TEST_c_c (clog10, plus_infty, -1, plus_infty, minus_zero);
+
+  TEST_c_c (clog10, plus_infty, nan_value, plus_infty, nan_value);
+  TEST_c_c (clog10, minus_infty, nan_value, plus_infty, nan_value);
+
+  TEST_c_c (clog10, nan_value, plus_infty, plus_infty, nan_value);
+  TEST_c_c (clog10, nan_value, minus_infty, plus_infty, nan_value);
+
+  TEST_c_c (clog10, 0, nan_value, nan_value, nan_value, INVALID_EXCEPTION_OK);
+  TEST_c_c (clog10, 3, nan_value, nan_value, nan_value, INVALID_EXCEPTION_OK);
+  TEST_c_c (clog10, minus_zero, nan_value, nan_value, nan_value, INVALID_EXCEPTION_OK);
+  TEST_c_c (clog10, -3, nan_value, nan_value, nan_value, INVALID_EXCEPTION_OK);
+
+  TEST_c_c (clog10, nan_value, 0, nan_value, nan_value, INVALID_EXCEPTION_OK);
+  TEST_c_c (clog10, nan_value, 5, nan_value, nan_value, INVALID_EXCEPTION_OK);
+  TEST_c_c (clog10, nan_value, minus_zero, nan_value, nan_value, INVALID_EXCEPTION_OK);
+  TEST_c_c (clog10, nan_value, -5, nan_value, nan_value, INVALID_EXCEPTION_OK);
+
+  TEST_c_c (clog10, nan_value, nan_value, nan_value, nan_value);
+
+  TEST_c_c (clog10, 0.75L, 1.25L, 0.163679467193165171449476605077428975L, 0.447486970040493067069984724340855636L);
+  TEST_c_c (clog10, -2, -3, 0.556971676153418384603252578971164214L, -0.937554462986374708541507952140189646L);
+
+  END (clog10, complex);
+}
+#endif
+
+
+#if 0
+static void
+conj_test (void)
+{
+  START (conj);
+  TEST_c_c (conj, 0.0, 0.0, 0.0, minus_zero);
+  TEST_c_c (conj, 0.0, minus_zero, 0.0, 0.0);
+  TEST_c_c (conj, nan_value, nan_value, nan_value, nan_value);
+  TEST_c_c (conj, plus_infty, minus_infty, plus_infty, plus_infty);
+  TEST_c_c (conj, plus_infty, plus_infty, plus_infty, minus_infty);
+  TEST_c_c (conj, 1.0, 2.0, 1.0, -2.0);
+  TEST_c_c (conj, 3.0, -4.0, 3.0, 4.0);
+
+  END (conj, complex);
+}
+#endif
+
+
+static void
+copysign_test (void)
+{
+  START (copysign);
+
+  TEST_ff_f (copysign, 0, 4, 0);
+  TEST_ff_f (copysign, 0, -4, minus_zero);
+  TEST_ff_f (copysign, minus_zero, 4, 0);
+  TEST_ff_f (copysign, minus_zero, -4, minus_zero);
+
+  TEST_ff_f (copysign, plus_infty, 0, plus_infty);
+  TEST_ff_f (copysign, plus_infty, minus_zero, minus_infty);
+  TEST_ff_f (copysign, minus_infty, 0, plus_infty);
+  TEST_ff_f (copysign, minus_infty, minus_zero, minus_infty);
+
+  TEST_ff_f (copysign, 0, plus_infty, 0);
+  TEST_ff_f (copysign, 0, minus_zero, minus_zero);
+  TEST_ff_f (copysign, minus_zero, plus_infty, 0);
+  TEST_ff_f (copysign, minus_zero, minus_zero, minus_zero);
+
+  /* XXX More correctly we would have to check the sign of the NaN.  */
+  TEST_ff_f (copysign, nan_value, 0, nan_value);
+  TEST_ff_f (copysign, nan_value, minus_zero, nan_value);
+  TEST_ff_f (copysign, -nan_value, 0, nan_value);
+  TEST_ff_f (copysign, -nan_value, minus_zero, nan_value);
+
+  END (copysign);
+}
+
+
+static void
+cos_test (void)
+{
+  errno = 0;
+  FUNC(cos) (0);
+  if (errno == ENOSYS)
+    /* Function not implemented.  */
+    return;
+
+  START (cos);
+
+  TEST_f_f (cos, 0, 1);
+  TEST_f_f (cos, minus_zero, 1);
+  TEST_f_f (cos, plus_infty, nan_value, INVALID_EXCEPTION);
+  TEST_f_f (cos, minus_infty, nan_value, INVALID_EXCEPTION);
+  TEST_f_f (cos, nan_value, nan_value);
+
+  TEST_f_f (cos, M_PI_6l * 2.0, 0.5);
+  TEST_f_f (cos, M_PI_6l * 4.0, -0.5);
+  TEST_f_f (cos, M_PI_2l, 0);
+
+  TEST_f_f (cos, 0.75L, 0.731688868873820886311838753000084544L);
+
+#ifdef TEST_DOUBLE
+  TEST_f_f (cos, 0.80190127184058835, 0.69534156199418473);
+#endif
+
+  END (cos);
+}
+
+
+static void
+cosh_test (void)
+{
+  errno = 0;
+  FUNC(cosh) (0.7L);
+  if (errno == ENOSYS)
+    /* Function not implemented.  */
+    return;
+
+  START (cosh);
+  TEST_f_f (cosh, 0, 1);
+  TEST_f_f (cosh, minus_zero, 1);
+
+#ifndef TEST_INLINE
+  TEST_f_f (cosh, plus_infty, plus_infty);
+  TEST_f_f (cosh, minus_infty, plus_infty);
+#endif
+  TEST_f_f (cosh, nan_value, nan_value);
+
+  TEST_f_f (cosh, 0.75L, 1.29468328467684468784170818539018176L);
+
+  END (cosh);
+}
+
+
+#if 0
+static void
+cpow_test (void)
+{
+  errno = 0;
+  FUNC(cpow) (BUILD_COMPLEX (1, 0), BUILD_COMPLEX (0, 0));
+  if (errno == ENOSYS)
+    /* Function not implemented.  */
+    return;
+
+  START (cpow);
+
+  TEST_cc_c (cpow, 1, 0, 0, 0, 1.0, 0.0);
+  TEST_cc_c (cpow, 2, 0, 10, 0, 1024.0, 0.0);
+
+  TEST_cc_c (cpow, M_El, 0, 0, 2 * M_PIl, 1.0, 0.0);
+  TEST_cc_c (cpow, 2, 3, 4, 0, -119.0, -120.0);
+
+  TEST_cc_c (cpow, nan_value, nan_value, nan_value, nan_value, nan_value, nan_value);
+
+  TEST_cc_c (cpow, 0.75L, 1.25L, 0.75L, 1.25L, 0.117506293914473555420279832210420483L, 0.346552747708338676483025352060418001L);
+  TEST_cc_c (cpow, 0.75L, 1.25L, 1.0L, 1.0L, 0.0846958290317209430433805274189191353L, 0.513285749182902449043287190519090481L);
+  TEST_cc_c (cpow, 0.75L, 1.25L, 1.0L, 0.0L, 0.75L, 1.25L);
+  TEST_cc_c (cpow, 0.75L, 1.25L, 0.0L, 1.0L, 0.331825439177608832276067945276730566L, 0.131338600281188544930936345230903032L);
+
+  END (cpow, complex);
+}
+
+
+static void
+cproj_test (void)
+{
+  START (cproj);
+  TEST_c_c (cproj, 0.0, 0.0, 0.0, 0.0);
+  TEST_c_c (cproj, minus_zero, minus_zero, minus_zero, minus_zero);
+  TEST_c_c (cproj, 0.0, minus_zero, 0.0, minus_zero);
+  TEST_c_c (cproj, minus_zero, 0.0, minus_zero, 0.0);
+
+  TEST_c_c (cproj, nan_value, nan_value, nan_value, nan_value);
+
+  TEST_c_c (cproj, plus_infty, plus_infty, plus_infty, 0.0);
+  TEST_c_c (cproj, plus_infty, minus_infty, plus_infty, minus_zero);
+  TEST_c_c (cproj, minus_infty, plus_infty, plus_infty, 0.0);
+  TEST_c_c (cproj, minus_infty, minus_infty, plus_infty, minus_zero);
+
+  TEST_c_c (cproj, 1.0, 0.0, 1.0, 0.0);
+  TEST_c_c (cproj, 2.0, 3.0, 0.2857142857142857142857142857142857L, 0.42857142857142857142857142857142855L);
+
+  END (cproj, complex);
+}
+
+
+static void
+creal_test (void)
+{
+  START (creal);
+  TEST_c_f (creal, 0.0, 1.0, 0.0);
+  TEST_c_f (creal, minus_zero, 1.0, minus_zero);
+  TEST_c_f (creal, nan_value, 1.0, nan_value);
+  TEST_c_f (creal, nan_value, nan_value, nan_value);
+  TEST_c_f (creal, plus_infty, 1.0, plus_infty);
+  TEST_c_f (creal, minus_infty, 1.0, minus_infty);
+  TEST_c_f (creal, 2.0, 3.0, 2.0);
+
+  END (creal);
+}
+
+static void
+csin_test (void)
+{
+  errno = 0;
+  FUNC(csin) (BUILD_COMPLEX (0.7L, 1.2L));
+  if (errno == ENOSYS)
+    /* Function not implemented.  */
+    return;
+
+  START (csin);
+
+  TEST_c_c (csin, 0.0, 0.0, 0.0, 0.0);
+  TEST_c_c (csin, minus_zero, 0.0, minus_zero, 0.0);
+  TEST_c_c (csin, 0.0, minus_zero, 0, minus_zero);
+  TEST_c_c (csin, minus_zero, minus_zero, minus_zero, minus_zero);
+
+  TEST_c_c (csin, 0.0, plus_infty, 0.0, plus_infty);
+  TEST_c_c (csin, minus_zero, plus_infty, minus_zero, plus_infty);
+  TEST_c_c (csin, 0.0, minus_infty, 0.0, minus_infty);
+  TEST_c_c (csin, minus_zero, minus_infty, minus_zero, minus_infty);
+
+  TEST_c_c (csin, plus_infty, 0.0, nan_value, 0.0, INVALID_EXCEPTION|IGNORE_ZERO_INF_SIGN);
+  TEST_c_c (csin, minus_infty, 0.0, nan_value, 0.0, INVALID_EXCEPTION|IGNORE_ZERO_INF_SIGN);
+  TEST_c_c (csin, plus_infty, minus_zero, nan_value, 0.0, INVALID_EXCEPTION|IGNORE_ZERO_INF_SIGN);
+  TEST_c_c (csin, minus_infty, minus_zero, nan_value, 0.0, INVALID_EXCEPTION|IGNORE_ZERO_INF_SIGN);
+
+  TEST_c_c (csin, plus_infty, plus_infty, nan_value, plus_infty, INVALID_EXCEPTION|IGNORE_ZERO_INF_SIGN);
+  TEST_c_c (csin, minus_infty, plus_infty, nan_value, plus_infty, INVALID_EXCEPTION|IGNORE_ZERO_INF_SIGN);
+  TEST_c_c (csin, plus_infty, minus_infty, nan_value, plus_infty, INVALID_EXCEPTION|IGNORE_ZERO_INF_SIGN);
+  TEST_c_c (csin, minus_infty, minus_infty, nan_value, plus_infty, INVALID_EXCEPTION|IGNORE_ZERO_INF_SIGN);
+
+  TEST_c_c (csin, plus_infty, 6.75, nan_value, nan_value, INVALID_EXCEPTION);
+  TEST_c_c (csin, plus_infty, -6.75, nan_value, nan_value, INVALID_EXCEPTION);
+  TEST_c_c (csin, minus_infty, 6.75, nan_value, nan_value, INVALID_EXCEPTION);
+  TEST_c_c (csin, minus_infty, -6.75,  nan_value, nan_value, INVALID_EXCEPTION);
+
+  TEST_c_c (csin, 4.625, plus_infty, minus_infty, minus_infty);
+  TEST_c_c (csin, 4.625, minus_infty, minus_infty, plus_infty);
+  TEST_c_c (csin, -4.625, plus_infty, plus_infty, minus_infty);
+  TEST_c_c (csin, -4.625, minus_infty, plus_infty, plus_infty);
+
+  TEST_c_c (csin, nan_value, 0.0, nan_value, 0.0, IGNORE_ZERO_INF_SIGN);
+  TEST_c_c (csin, nan_value, minus_zero, nan_value, 0.0, IGNORE_ZERO_INF_SIGN);
+
+  TEST_c_c (csin, nan_value, plus_infty, nan_value, plus_infty, IGNORE_ZERO_INF_SIGN);
+  TEST_c_c (csin, nan_value, minus_infty, nan_value, plus_infty, IGNORE_ZERO_INF_SIGN);
+
+  TEST_c_c (csin, nan_value, 9.0, nan_value, nan_value, INVALID_EXCEPTION_OK);
+  TEST_c_c (csin, nan_value, -9.0, nan_value, nan_value, INVALID_EXCEPTION_OK);
+
+  TEST_c_c (csin, 0.0, nan_value, 0.0, nan_value);
+  TEST_c_c (csin, minus_zero, nan_value, minus_zero, nan_value);
+
+  TEST_c_c (csin, 10.0, nan_value, nan_value, nan_value, INVALID_EXCEPTION_OK);
+  TEST_c_c (csin, nan_value, -10.0, nan_value, nan_value, INVALID_EXCEPTION_OK);
+
+  TEST_c_c (csin, plus_infty, nan_value, nan_value, nan_value, INVALID_EXCEPTION_OK);
+  TEST_c_c (csin, minus_infty, nan_value, nan_value, nan_value, INVALID_EXCEPTION_OK);
+
+  TEST_c_c (csin, nan_value, nan_value, nan_value, nan_value);
+
+  TEST_c_c (csin, 0.75L, 1.25L, 1.28722291002649188575873510790565441L, 1.17210635989270256101081285116138863L);
+  TEST_c_c (csin, -2, -3, -9.15449914691142957346729954460983256L, 4.16890695996656435075481305885375484L);
+
+  END (csin, complex);
+}
+
+
+static void
+csinh_test (void)
+{
+  errno = 0;
+  FUNC(csinh) (BUILD_COMPLEX (0.7L, 1.2L));
+  if (errno == ENOSYS)
+    /* Function not implemented.  */
+    return;
+
+  START (csinh);
+
+  TEST_c_c (csinh, 0.0, 0.0, 0.0, 0.0);
+  TEST_c_c (csinh, minus_zero, 0.0, minus_zero, 0.0);
+  TEST_c_c (csinh, 0.0, minus_zero, 0.0, minus_zero);
+  TEST_c_c (csinh, minus_zero, minus_zero, minus_zero, minus_zero);
+
+  TEST_c_c (csinh, 0.0, plus_infty, 0.0, nan_value, INVALID_EXCEPTION|IGNORE_ZERO_INF_SIGN);
+  TEST_c_c (csinh, minus_zero, plus_infty, 0.0, nan_value, INVALID_EXCEPTION|IGNORE_ZERO_INF_SIGN);
+  TEST_c_c (csinh, 0.0, minus_infty, 0.0, nan_value, INVALID_EXCEPTION|IGNORE_ZERO_INF_SIGN);
+  TEST_c_c (csinh, minus_zero, minus_infty, 0.0, nan_value, INVALID_EXCEPTION|IGNORE_ZERO_INF_SIGN);
+
+  TEST_c_c (csinh, plus_infty, 0.0, plus_infty, 0.0);
+  TEST_c_c (csinh, minus_infty, 0.0, minus_infty, 0.0);
+  TEST_c_c (csinh, plus_infty, minus_zero, plus_infty, minus_zero);
+  TEST_c_c (csinh, minus_infty, minus_zero, minus_infty, minus_zero);
+
+  TEST_c_c (csinh, plus_infty, plus_infty, plus_infty, nan_value, INVALID_EXCEPTION|IGNORE_ZERO_INF_SIGN);
+  TEST_c_c (csinh, minus_infty, plus_infty, plus_infty, nan_value, INVALID_EXCEPTION|IGNORE_ZERO_INF_SIGN);
+  TEST_c_c (csinh, plus_infty, minus_infty, plus_infty, nan_value, INVALID_EXCEPTION|IGNORE_ZERO_INF_SIGN);
+  TEST_c_c (csinh, minus_infty, minus_infty, plus_infty, nan_value, INVALID_EXCEPTION|IGNORE_ZERO_INF_SIGN);
+
+  TEST_c_c (csinh, plus_infty, 4.625, minus_infty, minus_infty);
+  TEST_c_c (csinh, minus_infty, 4.625, plus_infty, minus_infty);
+  TEST_c_c (csinh, plus_infty, -4.625, minus_infty, plus_infty);
+  TEST_c_c (csinh, minus_infty, -4.625, plus_infty, plus_infty);
+
+  TEST_c_c (csinh, 6.75, plus_infty, nan_value, nan_value, INVALID_EXCEPTION);
+  TEST_c_c (csinh, -6.75, plus_infty, nan_value, nan_value, INVALID_EXCEPTION);
+  TEST_c_c (csinh, 6.75, minus_infty, nan_value, nan_value, INVALID_EXCEPTION);
+  TEST_c_c (csinh, -6.75, minus_infty, nan_value, nan_value, INVALID_EXCEPTION);
+
+  TEST_c_c (csinh, 0.0, nan_value, 0.0, nan_value, IGNORE_ZERO_INF_SIGN);
+  TEST_c_c (csinh, minus_zero, nan_value, 0.0, nan_value, IGNORE_ZERO_INF_SIGN);
+
+  TEST_c_c (csinh, plus_infty, nan_value, plus_infty, nan_value, IGNORE_ZERO_INF_SIGN);
+  TEST_c_c (csinh, minus_infty, nan_value, plus_infty, nan_value, IGNORE_ZERO_INF_SIGN);
+
+  TEST_c_c (csinh, 9.0, nan_value, nan_value, nan_value, INVALID_EXCEPTION_OK);
+  TEST_c_c (csinh, -9.0, nan_value, nan_value, nan_value, INVALID_EXCEPTION_OK);
+
+  TEST_c_c (csinh, nan_value, 0.0, nan_value, 0.0);
+  TEST_c_c (csinh, nan_value, minus_zero, nan_value, minus_zero);
+
+  TEST_c_c (csinh, nan_value, 10.0, nan_value, nan_value, INVALID_EXCEPTION_OK);
+  TEST_c_c (csinh, nan_value, -10.0, nan_value, nan_value, INVALID_EXCEPTION_OK);
+
+  TEST_c_c (csinh, nan_value, plus_infty, nan_value, nan_value, INVALID_EXCEPTION_OK);
+  TEST_c_c (csinh, nan_value, minus_infty, nan_value, nan_value, INVALID_EXCEPTION_OK);
+
+  TEST_c_c (csinh, nan_value, nan_value, nan_value, nan_value);
+
+  TEST_c_c (csinh, 0.75L, 1.25L, 0.259294854551162779153349830618433028L, 1.22863452409509552219214606515777594L);
+  TEST_c_c (csinh, -2, -3, 3.59056458998577995201256544779481679L, -0.530921086248519805267040090660676560L);
+
+  END (csinh, complex);
+}
+
+
+static void
+csqrt_test (void)
+{
+  errno = 0;
+  FUNC(csqrt) (BUILD_COMPLEX (-1, 0));
+  if (errno == ENOSYS)
+    /* Function not implemented.  */
+    return;
+
+  START (csqrt);
+
+  TEST_c_c (csqrt, 0, 0, 0.0, 0.0);
+  TEST_c_c (csqrt, 0, minus_zero, 0, minus_zero);
+  TEST_c_c (csqrt, minus_zero, 0, 0.0, 0.0);
+  TEST_c_c (csqrt, minus_zero, minus_zero, 0.0, minus_zero);
+
+  TEST_c_c (csqrt, minus_infty, 0, 0.0, plus_infty);
+  TEST_c_c (csqrt, minus_infty, 6, 0.0, plus_infty);
+  TEST_c_c (csqrt, minus_infty, minus_zero, 0.0, minus_infty);
+  TEST_c_c (csqrt, minus_infty, -6, 0.0, minus_infty);
+
+  TEST_c_c (csqrt, plus_infty, 0, plus_infty, 0.0);
+  TEST_c_c (csqrt, plus_infty, 6, plus_infty, 0.0);
+  TEST_c_c (csqrt, plus_infty, minus_zero, plus_infty, minus_zero);
+  TEST_c_c (csqrt, plus_infty, -6, plus_infty, minus_zero);
+
+  TEST_c_c (csqrt, 0, plus_infty, plus_infty, plus_infty);
+  TEST_c_c (csqrt, 4, plus_infty, plus_infty, plus_infty);
+  TEST_c_c (csqrt, plus_infty, plus_infty, plus_infty, plus_infty);
+  TEST_c_c (csqrt, minus_zero, plus_infty, plus_infty, plus_infty);
+  TEST_c_c (csqrt, -4, plus_infty, plus_infty, plus_infty);
+  TEST_c_c (csqrt, minus_infty, plus_infty, plus_infty, plus_infty);
+  TEST_c_c (csqrt, 0, minus_infty, plus_infty, minus_infty);
+  TEST_c_c (csqrt, 4, minus_infty, plus_infty, minus_infty);
+  TEST_c_c (csqrt, plus_infty, minus_infty, plus_infty, minus_infty);
+  TEST_c_c (csqrt, minus_zero, minus_infty, plus_infty, minus_infty);
+  TEST_c_c (csqrt, -4, minus_infty, plus_infty, minus_infty);
+  TEST_c_c (csqrt, minus_infty, minus_infty, plus_infty, minus_infty);
+
+  TEST_c_c (csqrt, minus_infty, nan_value, nan_value, plus_infty, IGNORE_ZERO_INF_SIGN);
+
+  TEST_c_c (csqrt, plus_infty, nan_value, plus_infty, nan_value);
+
+  TEST_c_c (csqrt, 0, nan_value, nan_value, nan_value, INVALID_EXCEPTION_OK);
+  TEST_c_c (csqrt, 1, nan_value, nan_value, nan_value, INVALID_EXCEPTION_OK);
+  TEST_c_c (csqrt, minus_zero, nan_value, nan_value, nan_value, INVALID_EXCEPTION_OK);
+  TEST_c_c (csqrt, -1, nan_value, nan_value, nan_value, INVALID_EXCEPTION_OK);
+
+  TEST_c_c (csqrt, nan_value, 0, nan_value, nan_value, INVALID_EXCEPTION_OK);
+  TEST_c_c (csqrt, nan_value, 8, nan_value, nan_value, INVALID_EXCEPTION_OK);
+  TEST_c_c (csqrt, nan_value, minus_zero, nan_value, nan_value, INVALID_EXCEPTION_OK);
+  TEST_c_c (csqrt, nan_value, -8, nan_value, nan_value, INVALID_EXCEPTION_OK);
+
+  TEST_c_c (csqrt, nan_value, nan_value, nan_value, nan_value);
+
+  TEST_c_c (csqrt, 16.0, -30.0, 5.0, -3.0);
+  TEST_c_c (csqrt, -1, 0, 0.0, 1.0);
+  TEST_c_c (csqrt, 0, 2, 1.0, 1.0);
+  TEST_c_c (csqrt, 119, 120, 12.0, 5.0);
+  TEST_c_c (csqrt, 0.75L, 1.25L, 1.05065169626078392338656675760808326L, 0.594868882070379067881984030639932657L);
+  TEST_c_c (csqrt, -2, -3, 0.89597747612983812471573375529004348L, -1.6741492280355400404480393008490519L);
+  TEST_c_c (csqrt, -2, 3, 0.89597747612983812471573375529004348L, 1.6741492280355400404480393008490519L);
+  /* Principal square root should be returned (i.e., non-negative real
+     part).  */
+  TEST_c_c (csqrt, 0, -1, M_SQRT_2_2, -M_SQRT_2_2);
+
+  END (csqrt, complex);
+}
+
+static void
+ctan_test (void)
+{
+  errno = 0;
+  FUNC(ctan) (BUILD_COMPLEX (0.7L, 1.2L));
+  if (errno == ENOSYS)
+    /* Function not implemented.  */
+    return;
+
+  START (ctan);
+
+  TEST_c_c (ctan, 0, 0, 0.0, 0.0);
+  TEST_c_c (ctan, 0, minus_zero, 0.0, minus_zero);
+  TEST_c_c (ctan, minus_zero, 0, minus_zero, 0.0);
+  TEST_c_c (ctan, minus_zero, minus_zero, minus_zero, minus_zero);
+
+  TEST_c_c (ctan, 0, plus_infty, 0.0, 1.0);
+  TEST_c_c (ctan, 1, plus_infty, 0.0, 1.0);
+  TEST_c_c (ctan, minus_zero, plus_infty, minus_zero, 1.0);
+  TEST_c_c (ctan, -1, plus_infty, minus_zero, 1.0);
+
+  TEST_c_c (ctan, 0, minus_infty, 0.0, -1.0);
+  TEST_c_c (ctan, 1, minus_infty, 0.0, -1.0);
+  TEST_c_c (ctan, minus_zero, minus_infty, minus_zero, -1.0);
+  TEST_c_c (ctan, -1, minus_infty, minus_zero, -1.0);
+
+  TEST_c_c (ctan, plus_infty, 0, nan_value, nan_value, INVALID_EXCEPTION);
+  TEST_c_c (ctan, plus_infty, 2, nan_value, nan_value, INVALID_EXCEPTION);
+  TEST_c_c (ctan, minus_infty, 0, nan_value, nan_value, INVALID_EXCEPTION);
+  TEST_c_c (ctan, minus_infty, 2, nan_value, nan_value, INVALID_EXCEPTION);
+  TEST_c_c (ctan, plus_infty, minus_zero, nan_value, nan_value, INVALID_EXCEPTION);
+  TEST_c_c (ctan, plus_infty, -2, nan_value, nan_value, INVALID_EXCEPTION);
+  TEST_c_c (ctan, minus_infty, minus_zero, nan_value, nan_value, INVALID_EXCEPTION);
+  TEST_c_c (ctan, minus_infty, -2, nan_value, nan_value, INVALID_EXCEPTION);
+
+  TEST_c_c (ctan, nan_value, plus_infty, 0.0, 1.0, IGNORE_ZERO_INF_SIGN);
+  TEST_c_c (ctan, nan_value, minus_infty, 0.0, -1.0, IGNORE_ZERO_INF_SIGN);
+
+  TEST_c_c (ctan, 0, nan_value, 0.0, nan_value);
+  TEST_c_c (ctan, minus_zero, nan_value, minus_zero, nan_value);
+
+  TEST_c_c (ctan, 0.5, nan_value, nan_value, nan_value, INVALID_EXCEPTION_OK);
+  TEST_c_c (ctan, -4.5, nan_value, nan_value, nan_value, INVALID_EXCEPTION_OK);
+
+  TEST_c_c (ctan, nan_value, 0, nan_value, nan_value, INVALID_EXCEPTION_OK);
+  TEST_c_c (ctan, nan_value, 5, nan_value, nan_value, INVALID_EXCEPTION_OK);
+  TEST_c_c (ctan, nan_value, minus_zero, nan_value, nan_value, INVALID_EXCEPTION_OK);
+  TEST_c_c (ctan, nan_value, -0.25, nan_value, nan_value, INVALID_EXCEPTION_OK);
+
+  TEST_c_c (ctan, nan_value, nan_value, nan_value, nan_value);
+
+  TEST_c_c (ctan, 0.75L, 1.25L, 0.160807785916206426725166058173438663L, 0.975363285031235646193581759755216379L);
+  TEST_c_c (ctan, -2, -3, 0.376402564150424829275122113032269084e-2L, -1.00323862735360980144635859782192726L);
+
+  END (ctan, complex);
+}
+
+
+static void
+ctanh_test (void)
+{
+  errno = 0;
+  FUNC(ctanh) (BUILD_COMPLEX (0, 0));
+  if (errno == ENOSYS)
+    /* Function not implemented.  */
+    return;
+
+  START (ctanh);
+
+  TEST_c_c (ctanh, 0, 0, 0.0, 0.0);
+  TEST_c_c (ctanh, 0, minus_zero, 0.0, minus_zero);
+  TEST_c_c (ctanh, minus_zero, 0, minus_zero, 0.0);
+  TEST_c_c (ctanh, minus_zero, minus_zero, minus_zero, minus_zero);
+
+  TEST_c_c (ctanh, plus_infty, 0, 1.0, 0.0);
+  TEST_c_c (ctanh, plus_infty, 1, 1.0, 0.0);
+  TEST_c_c (ctanh, plus_infty, minus_zero, 1.0, minus_zero);
+  TEST_c_c (ctanh, plus_infty, -1, 1.0, minus_zero);
+  TEST_c_c (ctanh, minus_infty, 0, -1.0, 0.0);
+  TEST_c_c (ctanh, minus_infty, 1, -1.0, 0.0);
+  TEST_c_c (ctanh, minus_infty, minus_zero, -1.0, minus_zero);
+  TEST_c_c (ctanh, minus_infty, -1, -1.0, minus_zero);
+
+  TEST_c_c (ctanh, 0, plus_infty, nan_value, nan_value, INVALID_EXCEPTION);
+  TEST_c_c (ctanh, 2, plus_infty, nan_value, nan_value, INVALID_EXCEPTION);
+  TEST_c_c (ctanh, 0, minus_infty, nan_value, nan_value, INVALID_EXCEPTION);
+  TEST_c_c (ctanh, 2, minus_infty, nan_value, nan_value, INVALID_EXCEPTION);
+  TEST_c_c (ctanh, minus_zero, plus_infty, nan_value, nan_value, INVALID_EXCEPTION);
+  TEST_c_c (ctanh, -2, plus_infty, nan_value, nan_value, INVALID_EXCEPTION);
+  TEST_c_c (ctanh, minus_zero, minus_infty, nan_value, nan_value, INVALID_EXCEPTION);
+  TEST_c_c (ctanh, -2, minus_infty, nan_value, nan_value, INVALID_EXCEPTION);
+
+  TEST_c_c (ctanh, plus_infty, nan_value, 1.0, 0.0, IGNORE_ZERO_INF_SIGN);
+  TEST_c_c (ctanh, minus_infty, nan_value, -1.0, 0.0, IGNORE_ZERO_INF_SIGN);
+
+  TEST_c_c (ctanh, nan_value, 0, nan_value, 0.0);
+  TEST_c_c (ctanh, nan_value, minus_zero, nan_value, minus_zero);
+
+  TEST_c_c (ctanh, nan_value, 0.5, nan_value, nan_value, INVALID_EXCEPTION_OK);
+  TEST_c_c (ctanh, nan_value, -4.5, nan_value, nan_value, INVALID_EXCEPTION_OK);
+
+  TEST_c_c (ctanh, 0, nan_value, nan_value, nan_value, INVALID_EXCEPTION_OK);
+  TEST_c_c (ctanh, 5, nan_value, nan_value, nan_value, INVALID_EXCEPTION_OK);
+  TEST_c_c (ctanh, minus_zero, nan_value, nan_value, nan_value, INVALID_EXCEPTION_OK);
+  TEST_c_c (ctanh, -0.25, nan_value, nan_value, nan_value, INVALID_EXCEPTION_OK);
+
+  TEST_c_c (ctanh, nan_value, nan_value, nan_value, nan_value);
+
+  TEST_c_c (ctanh, 0, M_PI_4l, 0.0, 1.0);
+
+  TEST_c_c (ctanh, 0.75L, 1.25L, 1.37260757053378320258048606571226857L, 0.385795952609750664177596760720790220L);
+  TEST_c_c (ctanh, -2, -3, -0.965385879022133124278480269394560686L, 0.988437503832249372031403430350121098e-2L);
+
+  END (ctanh, complex);
+}
+#endif
+
+
+static void
+erf_test (void)
+{
+  errno = 0;
+  FUNC(erf) (0);
+  if (errno == ENOSYS)
+    /* Function not implemented.  */
+    return;
+
+  START (erf);
+
+  TEST_f_f (erf, 0, 0);
+  TEST_f_f (erf, minus_zero, minus_zero);
+  TEST_f_f (erf, plus_infty, 1);
+  TEST_f_f (erf, minus_infty, -1);
+  TEST_f_f (erf, nan_value, nan_value);
+
+  TEST_f_f (erf, 0.125L, 0.140316204801333817393029446521623398L);
+  TEST_f_f (erf, 0.75L, 0.711155633653515131598937834591410777L);
+  TEST_f_f (erf, 1.25L, 0.922900128256458230136523481197281140L);
+  TEST_f_f (erf, 2.0L, 0.995322265018952734162069256367252929L);
+  TEST_f_f (erf, 4.125L, 0.999999994576599200434933994687765914L);
+  TEST_f_f (erf, 27.0L, 1.0L);
+
+  END (erf);
+}
+
+
+static void
+erfc_test (void)
+{
+  errno = 0;
+  FUNC(erfc) (0);
+  if (errno == ENOSYS)
+    /* Function not implemented.  */
+    return;
+
+  START (erfc);
+
+  TEST_f_f (erfc, plus_infty, 0.0);
+  TEST_f_f (erfc, minus_infty, 2.0);
+  TEST_f_f (erfc, 0.0, 1.0);
+  TEST_f_f (erfc, minus_zero, 1.0);
+  TEST_f_f (erfc, nan_value, nan_value);
+
+  TEST_f_f (erfc, 0.125L, 0.859683795198666182606970553478376602L);
+  TEST_f_f (erfc, 0.75L, 0.288844366346484868401062165408589223L);
+  TEST_f_f (erfc, 1.25L, 0.0770998717435417698634765188027188596L);
+  TEST_f_f (erfc, 2.0L, 0.00467773498104726583793074363274707139L);
+  TEST_f_f (erfc, 4.125L, 0.542340079956506600531223408575531062e-8L);
+#ifdef TEST_LDOUBLE
+  /* The result can only be represented in long double.  */
+# if LDBL_MIN_10_EXP < -319
+  TEST_f_f (erfc, 27.0L, 0.523704892378925568501606768284954709e-318L);
+# endif
+#endif
+
+  END (erfc);
+}
+
+
+static void
+exp_test (void)
+{
+  errno = 0;
+  FUNC(exp) (0);
+  if (errno == ENOSYS)
+    /* Function not implemented.  */
+    return;
+
+  START (exp);
+
+  TEST_f_f (exp, 0, 1);
+  TEST_f_f (exp, minus_zero, 1);
+
+#ifndef TEST_INLINE
+  TEST_f_f (exp, plus_infty, plus_infty);
+  TEST_f_f (exp, minus_infty, 0);
+#endif
+  TEST_f_f (exp, nan_value, nan_value);
+  TEST_f_f (exp, 1, M_El);
+
+  TEST_f_f (exp, 2, M_E2l);
+  TEST_f_f (exp, 3, M_E3l);
+  TEST_f_f (exp, 0.75L, 2.11700001661267466854536981983709561L);
+  TEST_f_f (exp, 50.0L, 5184705528587072464087.45332293348538L);
+#ifdef TEST_LDOUBLE
+  /* The result can only be represented in long double.  */
+  TEST_f_f (exp, 1000.0L, 0.197007111401704699388887935224332313e435L);
+#endif
+
+  END (exp);
+}
+
+
+#if 0
+static void
+exp10_test (void)
+{
+  errno = 0;
+  FUNC(exp10) (0);
+  if (errno == ENOSYS)
+    /* Function not implemented.  */
+    return;
+
+  START (exp10);
+
+  TEST_f_f (exp10, 0, 1);
+  TEST_f_f (exp10, minus_zero, 1);
+
+  TEST_f_f (exp10, plus_infty, plus_infty);
+  TEST_f_f (exp10, minus_infty, 0);
+  TEST_f_f (exp10, nan_value, nan_value);
+  TEST_f_f (exp10, 3, 1000);
+  TEST_f_f (exp10, -1, 0.1L);
+  TEST_f_f (exp10, 1e6, plus_infty);
+  TEST_f_f (exp10, -1e6, 0);
+  TEST_f_f (exp10, 0.75L, 5.62341325190349080394951039776481231L);
+
+  END (exp10);
+}
+
+
+static void
+exp2_test (void)
+{
+  errno = 0;
+  FUNC(exp2) (0);
+  if (errno == ENOSYS)
+    /* Function not implemented.  */
+    return;
+
+  START (exp2);
+
+  TEST_f_f (exp2, 0, 1);
+  TEST_f_f (exp2, minus_zero, 1);
+  TEST_f_f (exp2, plus_infty, plus_infty);
+  TEST_f_f (exp2, minus_infty, 0);
+  TEST_f_f (exp2, nan_value, nan_value);
+
+  TEST_f_f (exp2, 10, 1024);
+  TEST_f_f (exp2, -1, 0.5);
+  TEST_f_f (exp2, 1e6, plus_infty);
+  TEST_f_f (exp2, -1e6, 0);
+  TEST_f_f (exp2, 0.75L, 1.68179283050742908606225095246642979L);
+
+  END (exp2);
+}
+#endif
+
+
+static void
+expm1_test (void)
+{
+  errno = 0;
+  FUNC(expm1) (0);
+  if (errno == ENOSYS)
+    /* Function not implemented.  */
+    return;
+
+  START (expm1);
+
+  TEST_f_f (expm1, 0, 0);
+  TEST_f_f (expm1, minus_zero, minus_zero);
+
+#ifndef TEST_INLINE
+  TEST_f_f (expm1, plus_infty, plus_infty);
+  TEST_f_f (expm1, minus_infty, -1);
+#endif
+  TEST_f_f (expm1, nan_value, nan_value);
+
+  TEST_f_f (expm1, 1, M_El - 1.0);
+  TEST_f_f (expm1, 0.75L, 1.11700001661267466854536981983709561L);
+
+  END (expm1);
+}
+
+
+static void
+fabs_test (void)
+{
+  START (fabs);
+
+  TEST_f_f (fabs, 0, 0);
+  TEST_f_f (fabs, minus_zero, 0);
+
+  TEST_f_f (fabs, plus_infty, plus_infty);
+  TEST_f_f (fabs, minus_infty, plus_infty);
+  TEST_f_f (fabs, nan_value, nan_value);
+
+  TEST_f_f (fabs, 38.0, 38.0);
+  TEST_f_f (fabs, -M_El, M_El);
+
+  END (fabs);
+}
+
+
+#if 0
+static void
+fdim_test (void)
+{
+  START (fdim);
+
+  TEST_ff_f (fdim, 0, 0, 0);
+  TEST_ff_f (fdim, 9, 0, 9);
+  TEST_ff_f (fdim, 0, 9, 0);
+  TEST_ff_f (fdim, -9, 0, 0);
+  TEST_ff_f (fdim, 0, -9, 9);
+
+  TEST_ff_f (fdim, plus_infty, 9, plus_infty);
+  TEST_ff_f (fdim, plus_infty, -9, plus_infty);
+  TEST_ff_f (fdim, minus_infty, 9, 0);
+  TEST_ff_f (fdim, minus_infty, -9, 0);
+  TEST_ff_f (fdim, 9, minus_infty, plus_infty);
+  TEST_ff_f (fdim, -9, minus_infty, plus_infty);
+  TEST_ff_f (fdim, 9, plus_infty, 0);
+  TEST_ff_f (fdim, -9, plus_infty, 0);
+
+  TEST_ff_f (fdim, 0, nan_value, nan_value);
+  TEST_ff_f (fdim, 9, nan_value, nan_value);
+  TEST_ff_f (fdim, -9, nan_value, nan_value);
+  TEST_ff_f (fdim, nan_value, 9, nan_value);
+  TEST_ff_f (fdim, nan_value, -9, nan_value);
+  TEST_ff_f (fdim, plus_infty, nan_value, nan_value);
+  TEST_ff_f (fdim, minus_infty, nan_value, nan_value);
+  TEST_ff_f (fdim, nan_value, plus_infty, nan_value);
+  TEST_ff_f (fdim, nan_value, minus_infty, nan_value);
+  TEST_ff_f (fdim, nan_value, nan_value, nan_value);
+
+  TEST_ff_f (fdim, plus_infty, plus_infty, 0);
+
+  END (fdim);
+}
+#endif
+
+
+static void
+floor_test (void)
+{
+  START (floor);
+
+  TEST_f_f (floor, 0.0, 0.0);
+  TEST_f_f (floor, minus_zero, minus_zero);
+  TEST_f_f (floor, plus_infty, plus_infty);
+  TEST_f_f (floor, minus_infty, minus_infty);
+  TEST_f_f (floor, nan_value, nan_value);
+
+  TEST_f_f (floor, M_PIl, 3.0);
+  TEST_f_f (floor, -M_PIl, -4.0);
+
+  TEST_f_f (floor, 0.25, 0.0);
+  TEST_f_f (floor, -0.25, -1.0);
+
+
+#ifdef TEST_LDOUBLE
+  /* The result can only be represented in long double.  */
+  TEST_f_f (floor, 4503599627370495.5L, 4503599627370495.0L);
+  TEST_f_f (floor, 4503599627370496.25L, 4503599627370496.0L);
+  TEST_f_f (floor, 4503599627370496.5L, 4503599627370496.0L);
+  TEST_f_f (floor, 4503599627370496.75L, 4503599627370496.0L);
+  TEST_f_f (floor, 4503599627370497.5L, 4503599627370497.0L);
+
+  TEST_f_f (floor, -4503599627370495.5L, -4503599627370496.0L);
+  TEST_f_f (floor, -4503599627370496.25L, -4503599627370497.0L);
+  TEST_f_f (floor, -4503599627370496.5L, -4503599627370497.0L);
+  TEST_f_f (floor, -4503599627370496.75L, -4503599627370497.0L);
+  TEST_f_f (floor, -4503599627370497.5L, -4503599627370498.0L);
+
+  TEST_f_f (floor, 9007199254740991.5L, 9007199254740991.0L);
+  TEST_f_f (floor, 9007199254740992.25L, 9007199254740992.0L);
+  TEST_f_f (floor, 9007199254740992.5L, 9007199254740992.0L);
+  TEST_f_f (floor, 9007199254740992.75L, 9007199254740992.0L);
+  TEST_f_f (floor, 9007199254740993.5L, 9007199254740993.0L);
+
+  TEST_f_f (floor, -9007199254740991.5L, -9007199254740992.0L);
+  TEST_f_f (floor, -9007199254740992.25L, -9007199254740993.0L);
+  TEST_f_f (floor, -9007199254740992.5L, -9007199254740993.0L);
+  TEST_f_f (floor, -9007199254740992.75L, -9007199254740993.0L);
+  TEST_f_f (floor, -9007199254740993.5L, -9007199254740994.0L);
+
+  TEST_f_f (floor, 72057594037927935.5L, 72057594037927935.0L);
+  TEST_f_f (floor, 72057594037927936.25L, 72057594037927936.0L);
+  TEST_f_f (floor, 72057594037927936.5L, 72057594037927936.0L);
+  TEST_f_f (floor, 72057594037927936.75L, 72057594037927936.0L);
+  TEST_f_f (floor, 72057594037927937.5L, 72057594037927937.0L);
+
+  TEST_f_f (floor, -72057594037927935.5L, -72057594037927936.0L);
+  TEST_f_f (floor, -72057594037927936.25L, -72057594037927937.0L);
+  TEST_f_f (floor, -72057594037927936.5L, -72057594037927937.0L);
+  TEST_f_f (floor, -72057594037927936.75L, -72057594037927937.0L);
+  TEST_f_f (floor, -72057594037927937.5L, -72057594037927938.0L);
+
+  TEST_f_f (floor, 10141204801825835211973625643007.5L, 10141204801825835211973625643007.0L);
+  TEST_f_f (floor, 10141204801825835211973625643008.25L, 10141204801825835211973625643008.0L);
+  TEST_f_f (floor, 10141204801825835211973625643008.5L, 10141204801825835211973625643008.0L);
+  TEST_f_f (floor, 10141204801825835211973625643008.75L, 10141204801825835211973625643008.0L);
+  TEST_f_f (floor, 10141204801825835211973625643009.5L, 10141204801825835211973625643009.0L);
+#endif
+
+  END (floor);
+}
+
+
+#if 0
+static void
+fma_test (void)
+{
+  START (fma);
+
+  TEST_fff_f (fma, 1.0, 2.0, 3.0, 5.0);
+  TEST_fff_f (fma, nan_value, 2.0, 3.0, nan_value);
+  TEST_fff_f (fma, 1.0, nan_value, 3.0, nan_value);
+  TEST_fff_f (fma, 1.0, 2.0, nan_value, nan_value, INVALID_EXCEPTION_OK);
+  TEST_fff_f (fma, plus_infty, 0.0, nan_value, nan_value, INVALID_EXCEPTION_OK);
+  TEST_fff_f (fma, minus_infty, 0.0, nan_value, nan_value, INVALID_EXCEPTION_OK);
+  TEST_fff_f (fma, 0.0, plus_infty, nan_value, nan_value, INVALID_EXCEPTION_OK);
+  TEST_fff_f (fma, 0.0, minus_infty, nan_value, nan_value, INVALID_EXCEPTION_OK);
+  TEST_fff_f (fma, plus_infty, 0.0, 1.0, nan_value, INVALID_EXCEPTION);
+  TEST_fff_f (fma, minus_infty, 0.0, 1.0, nan_value, INVALID_EXCEPTION);
+  TEST_fff_f (fma, 0.0, plus_infty, 1.0, nan_value, INVALID_EXCEPTION);
+  TEST_fff_f (fma, 0.0, minus_infty, 1.0, nan_value, INVALID_EXCEPTION);
+
+  TEST_fff_f (fma, plus_infty, plus_infty, minus_infty, nan_value, INVALID_EXCEPTION);
+  TEST_fff_f (fma, minus_infty, plus_infty, plus_infty, nan_value, INVALID_EXCEPTION);
+  TEST_fff_f (fma, plus_infty, minus_infty, plus_infty, nan_value, INVALID_EXCEPTION);
+  TEST_fff_f (fma, minus_infty, minus_infty, minus_infty, nan_value, INVALID_EXCEPTION);
+
+  TEST_fff_f (fma, 1.25L, 0.75L, 0.0625L, 1.0L);
+
+  END (fma);
+}
+
+
+static void
+fmax_test (void)
+{
+  START (fmax);
+
+  TEST_ff_f (fmax, 0, 0, 0);
+  TEST_ff_f (fmax, minus_zero, minus_zero, minus_zero);
+  TEST_ff_f (fmax, 9, 0, 9);
+  TEST_ff_f (fmax, 0, 9, 9);
+  TEST_ff_f (fmax, -9, 0, 0);
+  TEST_ff_f (fmax, 0, -9, 0);
+
+  TEST_ff_f (fmax, plus_infty, 9, plus_infty);
+  TEST_ff_f (fmax, 0, plus_infty, plus_infty);
+  TEST_ff_f (fmax, -9, plus_infty, plus_infty);
+  TEST_ff_f (fmax, plus_infty, -9, plus_infty);
+
+  TEST_ff_f (fmax, minus_infty, 9, 9);
+  TEST_ff_f (fmax, minus_infty, -9, -9);
+  TEST_ff_f (fmax, 9, minus_infty, 9);
+  TEST_ff_f (fmax, -9, minus_infty, -9);
+
+  TEST_ff_f (fmax, 0, nan_value, 0);
+  TEST_ff_f (fmax, 9, nan_value, 9);
+  TEST_ff_f (fmax, -9, nan_value, -9);
+  TEST_ff_f (fmax, nan_value, 0, 0);
+  TEST_ff_f (fmax, nan_value, 9, 9);
+  TEST_ff_f (fmax, nan_value, -9, -9);
+  TEST_ff_f (fmax, plus_infty, nan_value, plus_infty);
+  TEST_ff_f (fmax, minus_infty, nan_value, minus_infty);
+  TEST_ff_f (fmax, nan_value, plus_infty, plus_infty);
+  TEST_ff_f (fmax, nan_value, minus_infty, minus_infty);
+  TEST_ff_f (fmax, nan_value, nan_value, nan_value);
+
+  END (fmax);
+}
+
+
+static void
+fmin_test (void)
+{
+  START (fmin);
+
+  TEST_ff_f (fmin, 0, 0, 0);
+  TEST_ff_f (fmin, minus_zero, minus_zero, minus_zero);
+  TEST_ff_f (fmin, 9, 0, 0);
+  TEST_ff_f (fmin, 0, 9, 0);
+  TEST_ff_f (fmin, -9, 0, -9);
+  TEST_ff_f (fmin, 0, -9, -9);
+
+  TEST_ff_f (fmin, plus_infty, 9, 9);
+  TEST_ff_f (fmin, 9, plus_infty, 9);
+  TEST_ff_f (fmin, plus_infty, -9, -9);
+  TEST_ff_f (fmin, -9, plus_infty, -9);
+  TEST_ff_f (fmin, minus_infty, 9, minus_infty);
+  TEST_ff_f (fmin, minus_infty, -9, minus_infty);
+  TEST_ff_f (fmin, 9, minus_infty, minus_infty);
+  TEST_ff_f (fmin, -9, minus_infty, minus_infty);
+
+  TEST_ff_f (fmin, 0, nan_value, 0);
+  TEST_ff_f (fmin, 9, nan_value, 9);
+  TEST_ff_f (fmin, -9, nan_value, -9);
+  TEST_ff_f (fmin, nan_value, 0, 0);
+  TEST_ff_f (fmin, nan_value, 9, 9);
+  TEST_ff_f (fmin, nan_value, -9, -9);
+  TEST_ff_f (fmin, plus_infty, nan_value, plus_infty);
+  TEST_ff_f (fmin, minus_infty, nan_value, minus_infty);
+  TEST_ff_f (fmin, nan_value, plus_infty, plus_infty);
+  TEST_ff_f (fmin, nan_value, minus_infty, minus_infty);
+  TEST_ff_f (fmin, nan_value, nan_value, nan_value);
+
+  END (fmin);
+}
+#endif
+
+
+static void
+fmod_test (void)
+{
+  errno = 0;
+  FUNC(fmod) (6.5, 2.3L);
+  if (errno == ENOSYS)
+    /* Function not implemented.  */
+    return;
+
+  START (fmod);
+
+  /* fmod (+0, y) == +0 for y != 0.  */
+  TEST_ff_f (fmod, 0, 3, 0);
+
+  /* fmod (-0, y) == -0 for y != 0.  */
+  TEST_ff_f (fmod, minus_zero, 3, minus_zero);
+
+  /* fmod (+inf, y) == NaN plus invalid exception.  */
+  TEST_ff_f (fmod, plus_infty, 3, nan_value, INVALID_EXCEPTION);
+  /* fmod (-inf, y) == NaN plus invalid exception.  */
+  TEST_ff_f (fmod, minus_infty, 3, nan_value, INVALID_EXCEPTION);
+  /* fmod (x, +0) == NaN plus invalid exception.  */
+  TEST_ff_f (fmod, 3, 0, nan_value, INVALID_EXCEPTION);
+  /* fmod (x, -0) == NaN plus invalid exception.  */
+  TEST_ff_f (fmod, 3, minus_zero, nan_value, INVALID_EXCEPTION);
+
+  /* fmod (x, +inf) == x for x not infinite.  */
+  TEST_ff_f (fmod, 3.0, plus_infty, 3.0);
+  /* fmod (x, -inf) == x for x not infinite.  */
+  TEST_ff_f (fmod, 3.0, minus_infty, 3.0);
+
+  TEST_ff_f (fmod, nan_value, nan_value, nan_value);
+
+  TEST_ff_f (fmod, 6.5, 2.25L, 2.0L);
+  TEST_ff_f (fmod, -6.5, 2.25L, -2.0L);
+  TEST_ff_f (fmod, 6.5, -2.25L, 2.0L);
+  TEST_ff_f (fmod, -6.5, -2.25L, -2.0L);
+
+  END (fmod);
+}
+
+
+static void
+fpclassify_test (void)
+{
+  START (fpclassify);
+
+  TEST_f_i (fpclassify, nan_value, FP_NAN);
+  TEST_f_i (fpclassify, plus_infty, FP_INFINITE);
+  TEST_f_i (fpclassify, minus_infty, FP_INFINITE);
+  TEST_f_i (fpclassify, plus_zero, FP_ZERO);
+  TEST_f_i (fpclassify, minus_zero, FP_ZERO);
+  TEST_f_i (fpclassify, 1000, FP_NORMAL);
+
+  END (fpclassify);
+}
+
+
+static void
+frexp_test (void)
+{
+  int x;
+
+  START (frexp);
+
+  TEST_fI_f1 (frexp, plus_infty, plus_infty, IGNORE);
+  TEST_fI_f1 (frexp, minus_infty, minus_infty, IGNORE);
+  TEST_fI_f1 (frexp, nan_value, nan_value, IGNORE);
+
+  TEST_fI_f1 (frexp, 0.0, 0.0, 0.0);
+  TEST_fI_f1 (frexp, minus_zero, minus_zero, 0.0);
+
+  TEST_fI_f1 (frexp, 12.8L, 0.8L, 4);
+  TEST_fI_f1 (frexp, -27.34L, -0.854375L, 5);
+
+  END (frexp);
+}
+
+
+static void
+gamma_test (void)
+{
+  errno = 0;
+  FUNC(gamma) (1);
+
+  if (errno == ENOSYS)
+    /* Function not implemented.  */
+    return;
+  feclearexcept (FE_ALL_EXCEPT);
+
+  START (gamma);
+
+  TEST_f_f (gamma, plus_infty, plus_infty);
+  TEST_f_f (gamma, 0, plus_infty, DIVIDE_BY_ZERO_EXCEPTION);
+  TEST_f_f (gamma, -3, plus_infty, DIVIDE_BY_ZERO_EXCEPTION);
+  TEST_f_f (gamma, minus_infty, plus_infty);
+  TEST_f_f (gamma, nan_value, nan_value);
+
+  TEST_f_f1 (gamma, 1, 0, 1);
+  TEST_f_f1 (gamma, 3, M_LN2l, 1);
+
+  TEST_f_f1 (gamma, 0.5, M_LOG_SQRT_PIl, 1);
+  TEST_f_f1 (gamma, -0.5, M_LOG_2_SQRT_PIl, -1);
+
+  END (gamma);
+}
+
+static void
+hypot_test (void)
+{
+  errno = 0;
+  FUNC(hypot) (0.7L, 12.4L);
+  if (errno == ENOSYS)
+    /* Function not implemented.  */
+    return;
+
+  START (hypot);
+
+  TEST_ff_f (hypot, plus_infty, 1, plus_infty, IGNORE_ZERO_INF_SIGN);
+  TEST_ff_f (hypot, minus_infty, 1, plus_infty, IGNORE_ZERO_INF_SIGN);
+
+#ifndef TEST_INLINE
+  TEST_ff_f (hypot, plus_infty, nan_value, plus_infty);
+  TEST_ff_f (hypot, minus_infty, nan_value, plus_infty);
+  TEST_ff_f (hypot, nan_value, plus_infty, plus_infty);
+  TEST_ff_f (hypot, nan_value, minus_infty, plus_infty);
+#endif
+
+  TEST_ff_f (hypot, nan_value, nan_value, nan_value);
+
+  /* hypot (x,y) == hypot (+-x, +-y)  */
+  TEST_ff_f (hypot, 0.7L, 12.4L, 12.419742348374220601176836866763271L);
+  TEST_ff_f (hypot, -0.7L, 12.4L, 12.419742348374220601176836866763271L);
+  TEST_ff_f (hypot, 0.7L, -12.4L, 12.419742348374220601176836866763271L);
+  TEST_ff_f (hypot, -0.7L, -12.4L, 12.419742348374220601176836866763271L);
+  TEST_ff_f (hypot, 12.4L, 0.7L, 12.419742348374220601176836866763271L);
+  TEST_ff_f (hypot, -12.4L, 0.7L, 12.419742348374220601176836866763271L);
+  TEST_ff_f (hypot, 12.4L, -0.7L, 12.419742348374220601176836866763271L);
+  TEST_ff_f (hypot, -12.4L, -0.7L, 12.419742348374220601176836866763271L);
+
+  /*  hypot (x,0) == fabs (x)  */
+  TEST_ff_f (hypot, 0.75L, 0, 0.75L);
+  TEST_ff_f (hypot, -0.75L, 0, 0.75L);
+  TEST_ff_f (hypot, -5.7e7, 0, 5.7e7L);
+
+  TEST_ff_f (hypot, 0.75L, 1.25L, 1.45773797371132511771853821938639577L);
+
+  END (hypot);
+}
+
+
+static void
+ilogb_test (void)
+{
+  START (ilogb);
+
+  TEST_f_i (ilogb, 1, 0);
+  TEST_f_i (ilogb, M_El, 1);
+  TEST_f_i (ilogb, 1024, 10);
+  TEST_f_i (ilogb, -2000, 10);
+
+  /* XXX We have a problem here: the standard does not tell us whether
+     exceptions are allowed/required.  ignore them for now.  */
+
+  TEST_f_i (ilogb, 0.0, FP_ILOGB0, EXCEPTIONS_OK);
+  TEST_f_i (ilogb, nan_value, FP_ILOGBNAN, EXCEPTIONS_OK);
+  TEST_f_i (ilogb, plus_infty, INT_MAX, EXCEPTIONS_OK);
+  TEST_f_i (ilogb, minus_infty, INT_MAX, EXCEPTIONS_OK);
+
+  END (ilogb);
+}
+
+static void
+isfinite_test (void)
+{
+  START (isfinite);
+
+  TEST_f_b (isfinite, 0, 1);
+  TEST_f_b (isfinite, minus_zero, 1);
+  TEST_f_b (isfinite, 10, 1);
+  TEST_f_b (isfinite, plus_infty, 0);
+  TEST_f_b (isfinite, minus_infty, 0);
+  TEST_f_b (isfinite, nan_value, 0);
+
+  END (isfinite);
+}
+
+static void
+isnormal_test (void)
+{
+  START (isnormal);
+
+  TEST_f_b (isnormal, 0, 0);
+  TEST_f_b (isnormal, minus_zero, 0);
+  TEST_f_b (isnormal, 10, 1);
+  TEST_f_b (isnormal, plus_infty, 0);
+  TEST_f_b (isnormal, minus_infty, 0);
+  TEST_f_b (isnormal, nan_value, 0);
+
+  END (isnormal);
+}
+
+#if defined __DO_XSI_MATH__
+static void
+j0_test (void)
+{
+  errno = 0;
+#if 0
+  FLOAT s, c;
+  FUNC (sincos) (0, &s, &c);
+  if (errno == ENOSYS)
+    /* Required function not implemented.  */
+    return;
+#endif
+  FUNC(j0) (0);
+  if (errno == ENOSYS)
+    /* Function not implemented.  */
+    return;
+
+  START (j0);
+
+  /* j0 is the Bessel function of the first kind of order 0 */
+  TEST_f_f (j0, nan_value, nan_value);
+  TEST_f_f (j0, plus_infty, 0);
+  TEST_f_f (j0, -1.0, 0.765197686557966551449717526102663221L);
+  TEST_f_f (j0, 0.0, 1.0);
+  TEST_f_f (j0, 0.125L, 0.996097563041985204620768999453174712L);
+  TEST_f_f (j0, 0.75L, 0.864242275166648623555731103820923211L);
+  TEST_f_f (j0, 1.0, 0.765197686557966551449717526102663221L);
+  TEST_f_f (j0, 1.5, 0.511827671735918128749051744283411720L);
+  TEST_f_f (j0, 2.0, 0.223890779141235668051827454649948626L);
+  TEST_f_f (j0, 8.0, 0.171650807137553906090869407851972001L);
+  TEST_f_f (j0, 10.0, -0.245935764451348335197760862485328754L);
+  TEST_f_f (j0, 4.0, -3.9714980986384737228659076845169804197562E-1L);
+  TEST_f_f (j0, -4.0, -3.9714980986384737228659076845169804197562E-1L);
+
+  END (j0);
+}
+
+
+static void
+j1_test (void)
+{
+  errno = 0;
+#if 0
+  FLOAT s, c;
+  FUNC (sincos) (0, &s, &c);
+  if (errno == ENOSYS)
+    /* Required function not implemented.  */
+    return;
+#endif
+  FUNC(j1) (0);
+  if (errno == ENOSYS)
+    /* Function not implemented.  */
+    return;
+
+  /* j1 is the Bessel function of the first kind of order 1 */
+
+  START (j1);
+
+  TEST_f_f (j1, nan_value, nan_value);
+  TEST_f_f (j1, plus_infty, 0);
+
+  TEST_f_f (j1, -1.0, -0.440050585744933515959682203718914913L);
+  TEST_f_f (j1, 0.0, 0.0);
+  TEST_f_f (j1, 0.125L, 0.0623780091344946810942311355879361177L);
+  TEST_f_f (j1, 0.75L, 0.349243602174862192523281016426251335L);
+  TEST_f_f (j1, 1.0, 0.440050585744933515959682203718914913L);
+  TEST_f_f (j1, 1.5, 0.557936507910099641990121213156089400L);
+  TEST_f_f (j1, 2.0, 0.576724807756873387202448242269137087L);
+  TEST_f_f (j1, 8.0, 0.234636346853914624381276651590454612L);
+  TEST_f_f (j1, 10.0, 0.0434727461688614366697487680258592883L);
+
+  END (j1);
+}
+
+static void
+jn_test (void)
+{
+  errno = 0;
+#if 0
+  FLOAT s, c;
+  FUNC (sincos) (0, &s, &c);
+  if (errno == ENOSYS)
+    /* Required function not implemented.  */
+    return;
+#endif
+  FUNC(jn) (1, 1);
+  if (errno == ENOSYS)
+    /* Function not implemented.  */
+    return;
+
+  /* jn is the Bessel function of the first kind of order n.  */
+  START (jn);
+
+  /* jn (0, x) == j0 (x)  */
+  TEST_ff_f (jn, 0, nan_value, nan_value);
+  TEST_ff_f (jn, 0, plus_infty, 0);
+  TEST_ff_f (jn, 0, -1.0, 0.765197686557966551449717526102663221L);
+  TEST_ff_f (jn, 0, 0.0, 1.0);
+  TEST_ff_f (jn, 0, 0.125L, 0.996097563041985204620768999453174712L);
+  TEST_ff_f (jn, 0, 0.75L, 0.864242275166648623555731103820923211L);
+  TEST_ff_f (jn, 0, 1.0, 0.765197686557966551449717526102663221L);
+  TEST_ff_f (jn, 0, 1.5, 0.511827671735918128749051744283411720L);
+  TEST_ff_f (jn, 0, 2.0, 0.223890779141235668051827454649948626L);
+  TEST_ff_f (jn, 0, 8.0, 0.171650807137553906090869407851972001L);
+  TEST_ff_f (jn, 0, 10.0, -0.245935764451348335197760862485328754L);
+  TEST_ff_f (jn, 0, 4.0, -3.9714980986384737228659076845169804197562E-1L);
+  TEST_ff_f (jn, 0, -4.0, -3.9714980986384737228659076845169804197562E-1L);
+
+  /* jn (1, x) == j1 (x)  */
+  TEST_ff_f (jn, 1, nan_value, nan_value);
+  TEST_ff_f (jn, 1, plus_infty, 0);
+  TEST_ff_f (jn, 1, -1.0, -0.440050585744933515959682203718914913L);
+  TEST_ff_f (jn, 1, 0.0, 0.0);
+  TEST_ff_f (jn, 1, 0.125L, 0.0623780091344946810942311355879361177L);
+  TEST_ff_f (jn, 1, 0.75L, 0.349243602174862192523281016426251335L);
+  TEST_ff_f (jn, 1, 1.0, 0.440050585744933515959682203718914913L);
+  TEST_ff_f (jn, 1, 1.5, 0.557936507910099641990121213156089400L);
+  TEST_ff_f (jn, 1, 2.0, 0.576724807756873387202448242269137087L);
+  TEST_ff_f (jn, 1, 8.0, 0.234636346853914624381276651590454612L);
+  TEST_ff_f (jn, 1, 10.0, 0.0434727461688614366697487680258592883L);
+
+  /* jn (3, x)  */
+  TEST_ff_f (jn, 3, nan_value, nan_value);
+  TEST_ff_f (jn, 3, plus_infty, 0);
+
+  TEST_ff_f (jn, 3, -1.0, -0.0195633539826684059189053216217515083L);
+  TEST_ff_f (jn, 3, 0.0, 0.0);
+  TEST_ff_f (jn, 3, 0.125L, 0.406503832554912875023029337653442868e-4L);
+  TEST_ff_f (jn, 3, 0.75L, 0.848438342327410884392755236884386804e-2L);
+  TEST_ff_f (jn, 3, 1.0, 0.0195633539826684059189053216217515083L);
+  TEST_ff_f (jn, 3, 2.0, 0.128943249474402051098793332969239835L);
+  TEST_ff_f (jn, 3, 10.0, 0.0583793793051868123429354784103409563L);
+
+  /*  jn (10, x)  */
+  TEST_ff_f (jn, 10, nan_value, nan_value);
+  TEST_ff_f (jn, 10, plus_infty, 0);
+
+  TEST_ff_f (jn, 10, -1.0, 0.263061512368745320699785368779050294e-9L);
+  TEST_ff_f (jn, 10, 0.0, 0.0);
+  TEST_ff_f (jn, 10, 0.125L, 0.250543369809369890173993791865771547e-18L);
+  TEST_ff_f (jn, 10, 0.75L, 0.149621713117596814698712483621682835e-10L);
+  TEST_ff_f (jn, 10, 1.0, 0.263061512368745320699785368779050294e-9L);
+  TEST_ff_f (jn, 10, 2.0, 0.251538628271673670963516093751820639e-6L);
+  TEST_ff_f (jn, 10, 10.0, 0.207486106633358857697278723518753428L);
+
+  END (jn);
+}
+#endif /* __DO_XSI_MATH__ */
+
+
+static void
+ldexp_test (void)
+{
+  TEST_ff_f (ldexp, 0, 0, 0);
+  TEST_ff_f (ldexp, minus_zero, 0, minus_zero);
+
+  TEST_ff_f (ldexp, plus_infty, 1, plus_infty);
+  TEST_ff_f (ldexp, minus_infty, 1, minus_infty);
+  TEST_ff_f (ldexp, nan_value, 1, nan_value);
+
+  TEST_ff_f (ldexp, 0.8L, 4, 12.8L);
+  TEST_ff_f (ldexp, -0.854375L, 5, -27.34L);
+
+  /* ldexp (x, 0) == x.  */
+  TEST_ff_f (ldexp, 1.0L, 0L, 1.0L);
+}
+
+
+static void
+lgamma_test (void)
+{
+  errno = 0;
+  FUNC(lgamma) (0);
+  if (errno == ENOSYS)
+    /* Function not implemented.  */
+    return;
+  feclearexcept (FE_ALL_EXCEPT);
+
+  START (lgamma);
+
+  TEST_f_f (lgamma, plus_infty, plus_infty);
+  TEST_f_f (lgamma, 0, plus_infty, DIVIDE_BY_ZERO_EXCEPTION);
+  TEST_f_f (lgamma, nan_value, nan_value);
+
+  /* lgamma (x) == +inf plus divide by zero exception for integer x <= 0.  */
+  TEST_f_f (lgamma, -3, plus_infty, DIVIDE_BY_ZERO_EXCEPTION);
+  TEST_f_f (lgamma, minus_infty, plus_infty);
+
+  TEST_f_f1 (lgamma, 1, 0, 1);
+
+  TEST_f_f1 (lgamma, 3, M_LN2l, 1);
+
+  TEST_f_f1 (lgamma, 0.5, M_LOG_SQRT_PIl, 1);
+  TEST_f_f1 (lgamma, -0.5, M_LOG_2_SQRT_PIl, -1);
+  TEST_f_f1 (lgamma, 0.7L, 0.260867246531666514385732417016759578L, 1);
+  TEST_f_f1 (lgamma, 1.2L, -0.853740900033158497197028392998854470e-1L, 1);
+
+  END (lgamma);
+}
+
+
+#if 0
+static void
+lrint_test (void)
+{
+  /* XXX this test is incomplete.  We need to have a way to specifiy
+     the rounding method and test the critical cases.  So far, only
+     unproblematic numbers are tested.  */
+
+  START (lrint);
+
+  TEST_f_l (lrint, 0.0, 0);
+  TEST_f_l (lrint, minus_zero, 0);
+  TEST_f_l (lrint, 0.2L, 0);
+  TEST_f_l (lrint, -0.2L, 0);
+
+  TEST_f_l (lrint, 1.4L, 1);
+  TEST_f_l (lrint, -1.4L, -1);
+
+  TEST_f_l (lrint, 8388600.3L, 8388600);
+  TEST_f_l (lrint, -8388600.3L, -8388600);
+
+  TEST_f_l (lrint, 1071930.0008, 1071930);
+#ifndef TEST_FLOAT
+  TEST_f_l (lrint, 1073741824.01, 1073741824);
+# if LONG_MAX > 281474976710656
+  TEST_f_l (lrint, 281474976710656.025, 281474976710656);
+# endif
+#endif
+
+  END (lrint);
+}
+
+
+static void
+llrint_test (void)
+{
+  /* XXX this test is incomplete.  We need to have a way to specifiy
+     the rounding method and test the critical cases.  So far, only
+     unproblematic numbers are tested.  */
+
+  START (llrint);
+
+  TEST_f_L (llrint, 0.0, 0);
+  TEST_f_L (llrint, minus_zero, 0);
+  TEST_f_L (llrint, 0.2L, 0);
+  TEST_f_L (llrint, -0.2L, 0);
+
+  TEST_f_L (llrint, 1.4L, 1);
+  TEST_f_L (llrint, -1.4L, -1);
+
+  TEST_f_L (llrint, 8388600.3L, 8388600);
+  TEST_f_L (llrint, -8388600.3L, -8388600);
+
+  TEST_f_l (llrint, 1071930.0008, 1071930);
+
+  /* Test boundary conditions.  */
+  /* 0x1FFFFF */
+  TEST_f_L (llrint, 2097151.0,2097151LL);
+  /* 0x800000 */
+  TEST_f_L (llrint, 8388608.0, 8388608LL);
+  /* 0x1000000 */
+  TEST_f_L (llrint, 16777216.0, 16777216LL);
+  /* 0x20000000000 */
+  TEST_f_L (llrint, 2199023255552.0, 2199023255552LL);
+  /* 0x40000000000 */
+  TEST_f_L (llrint, 4398046511104.0, 4398046511104LL);
+  /* 0x1000000000000 */
+  TEST_f_L (llrint, 281474976710656.0, 281474976710656LL);
+  /* 0x10000000000000 */
+  TEST_f_L (llrint, 4503599627370496.0, 4503599627370496LL);
+  /* 0x10000080000000 */
+  TEST_f_L (llrint, 4503601774854144.0, 4503601774854144LL);
+  /* 0x20000000000000 */
+  TEST_f_L (llrint, 9007199254740992.0, 9007199254740992LL);
+  /* 0x80000000000000 */
+  TEST_f_L (llrint, 36028797018963968.0, 36028797018963968LL);
+  /* 0x100000000000000 */
+  TEST_f_L (llrint, 72057594037927936.0, 72057594037927936LL);
+#ifdef TEST_LDOUBLE
+  /* The input can only be represented in long double.  */
+  TEST_f_L (llrint, 4503599627370495.5L, 4503599627370496LL);
+  TEST_f_L (llrint, 4503599627370496.25L, 4503599627370496LL);
+  TEST_f_L (llrint, 4503599627370496.5L, 4503599627370496LL);
+  TEST_f_L (llrint, 4503599627370496.75L, 4503599627370497LL);
+  TEST_f_L (llrint, 4503599627370497.5L, 4503599627370498LL);
+
+  TEST_f_L (llrint, -4503599627370495.5L, -4503599627370496LL);
+  TEST_f_L (llrint, -4503599627370496.25L, -4503599627370496LL);
+  TEST_f_L (llrint, -4503599627370496.5L, -4503599627370496LL);
+  TEST_f_L (llrint, -4503599627370496.75L, -4503599627370497LL);
+  TEST_f_L (llrint, -4503599627370497.5L, -4503599627370498LL);
+
+  TEST_f_L (llrint, 9007199254740991.5L, 9007199254740992LL);
+  TEST_f_L (llrint, 9007199254740992.25L, 9007199254740992LL);
+  TEST_f_L (llrint, 9007199254740992.5L, 9007199254740992LL);
+  TEST_f_L (llrint, 9007199254740992.75L, 9007199254740993LL);
+  TEST_f_L (llrint, 9007199254740993.5L, 9007199254740994LL);
+
+  TEST_f_L (llrint, -9007199254740991.5L, -9007199254740992LL);
+  TEST_f_L (llrint, -9007199254740992.25L, -9007199254740992LL);
+  TEST_f_L (llrint, -9007199254740992.5L, -9007199254740992LL);
+  TEST_f_L (llrint, -9007199254740992.75L, -9007199254740993LL);
+  TEST_f_L (llrint, -9007199254740993.5L, -9007199254740994LL);
+
+  TEST_f_L (llrint, 72057594037927935.5L, 72057594037927936LL);
+  TEST_f_L (llrint, 72057594037927936.25L, 72057594037927936LL);
+  TEST_f_L (llrint, 72057594037927936.5L, 72057594037927936LL);
+  TEST_f_L (llrint, 72057594037927936.75L, 72057594037927937LL);
+  TEST_f_L (llrint, 72057594037927937.5L, 72057594037927938LL);
+
+  TEST_f_L (llrint, -72057594037927935.5L, -72057594037927936LL);
+  TEST_f_L (llrint, -72057594037927936.25L, -72057594037927936LL);
+  TEST_f_L (llrint, -72057594037927936.5L, -72057594037927936LL);
+  TEST_f_L (llrint, -72057594037927936.75L, -72057594037927937LL);
+  TEST_f_L (llrint, -72057594037927937.5L, -72057594037927938LL);
+#endif
+
+  END (llrint);
+}
+#endif
+
+
+static void
+log_test (void)
+{
+  errno = 0;
+  FUNC(log) (1);
+  if (errno == ENOSYS)
+    /* Function not implemented.  */
+    return;
+  START (log);
+
+  TEST_f_f (log, 0, minus_infty, DIVIDE_BY_ZERO_EXCEPTION);
+  TEST_f_f (log, minus_zero, minus_infty, DIVIDE_BY_ZERO_EXCEPTION);
+
+  TEST_f_f (log, 1, 0);
+
+  TEST_f_f (log, -1, nan_value, INVALID_EXCEPTION);
+  TEST_f_f (log, plus_infty, plus_infty);
+
+  TEST_f_f (log, M_El, 1);
+  TEST_f_f (log, 1.0 / M_El, -1);
+  TEST_f_f (log, 2, M_LN2l);
+  TEST_f_f (log, 10, M_LN10l);
+  TEST_f_f (log, 0.75L, -0.287682072451780927439219005993827432L);
+
+  END (log);
+}
+
+
+static void
+log10_test (void)
+{
+  errno = 0;
+  FUNC(log10) (1);
+  if (errno == ENOSYS)
+    /* Function not implemented.  */
+    return;
+
+  START (log10);
+
+  TEST_f_f (log10, 0, minus_infty, DIVIDE_BY_ZERO_EXCEPTION);
+  TEST_f_f (log10, minus_zero, minus_infty, DIVIDE_BY_ZERO_EXCEPTION);
+
+  TEST_f_f (log10, 1, 0);
+
+  /* log10 (x) == NaN plus invalid exception if x < 0.  */
+  TEST_f_f (log10, -1, nan_value, INVALID_EXCEPTION);
+
+  TEST_f_f (log10, plus_infty, plus_infty);
+  TEST_f_f (log10, nan_value, nan_value);
+
+  TEST_f_f (log10, 0.1L, -1);
+  TEST_f_f (log10, 10.0, 1);
+  TEST_f_f (log10, 100.0, 2);
+  TEST_f_f (log10, 10000.0, 4);
+  TEST_f_f (log10, M_El, M_LOG10El);
+  TEST_f_f (log10, 0.75L, -0.124938736608299953132449886193870744L);
+
+  END (log10);
+}
+
+
+static void
+log1p_test (void)
+{
+  errno = 0;
+  FUNC(log1p) (0);
+  if (errno == ENOSYS)
+    /* Function not implemented.  */
+    return;
+
+  START (log1p);
+
+  TEST_f_f (log1p, 0, 0);
+  TEST_f_f (log1p, minus_zero, minus_zero);
+
+  TEST_f_f (log1p, -1, minus_infty, DIVIDE_BY_ZERO_EXCEPTION);
+  TEST_f_f (log1p, -2, nan_value, INVALID_EXCEPTION);
+
+  TEST_f_f (log1p, plus_infty, plus_infty);
+  TEST_f_f (log1p, nan_value, nan_value);
+
+  TEST_f_f (log1p, M_El - 1.0, 1);
+
+  TEST_f_f (log1p, -0.25L, -0.287682072451780927439219005993827432L);
+  TEST_f_f (log1p, -0.875, -2.07944154167983592825169636437452970L);
+
+  END (log1p);
+}
+
+
+#if 0
+static void
+log2_test (void)
+{
+  errno = 0;
+  FUNC(log2) (1);
+  if (errno == ENOSYS)
+    /* Function not implemented.  */
+    return;
+
+  START (log2);
+
+  TEST_f_f (log2, 0, minus_infty, DIVIDE_BY_ZERO_EXCEPTION);
+  TEST_f_f (log2, minus_zero, minus_infty, DIVIDE_BY_ZERO_EXCEPTION);
+
+  TEST_f_f (log2, 1, 0);
+
+  TEST_f_f (log2, -1, nan_value, INVALID_EXCEPTION);
+
+  TEST_f_f (log2, plus_infty, plus_infty);
+  TEST_f_f (log2, nan_value, nan_value);
+
+  TEST_f_f (log2, M_El, M_LOG2El);
+  TEST_f_f (log2, 2.0, 1);
+  TEST_f_f (log2, 16.0, 4);
+  TEST_f_f (log2, 256.0, 8);
+  TEST_f_f (log2, 0.75L, -.415037499278843818546261056052183492L);
+
+  END (log2);
+}
+#endif
+
+
+static void
+logb_test (void)
+{
+  START (logb);
+
+  TEST_f_f (logb, plus_infty, plus_infty);
+  TEST_f_f (logb, minus_infty, plus_infty);
+
+  TEST_f_f (logb, 0, minus_infty, DIVIDE_BY_ZERO_EXCEPTION);
+
+  TEST_f_f (logb, minus_zero, minus_infty, DIVIDE_BY_ZERO_EXCEPTION);
+  TEST_f_f (logb, nan_value, nan_value);
+
+  TEST_f_f (logb, 1, 0);
+  TEST_f_f (logb, M_El, 1);
+  TEST_f_f (logb, 1024, 10);
+  TEST_f_f (logb, -2000, 10);
+
+  END (logb);
+}
+
+
+#if 0
+static void
+lround_test (void)
+{
+  START (lround);
+
+  TEST_f_l (lround, 0, 0);
+  TEST_f_l (lround, minus_zero, 0);
+  TEST_f_l (lround, 0.2L, 0.0);
+  TEST_f_l (lround, -0.2L, 0);
+  TEST_f_l (lround, 0.5, 1);
+  TEST_f_l (lround, -0.5, -1);
+  TEST_f_l (lround, 0.8L, 1);
+  TEST_f_l (lround, -0.8L, -1);
+  TEST_f_l (lround, 1.5, 2);
+  TEST_f_l (lround, -1.5, -2);
+  TEST_f_l (lround, 22514.5, 22515);
+  TEST_f_l (lround, -22514.5, -22515);
+  TEST_f_l (lround, 1071930.0008, 1071930);
+#ifndef TEST_FLOAT
+  TEST_f_l (lround, 1073741824.01, 1073741824);
+# if LONG_MAX > 281474976710656
+  TEST_f_l (lround, 281474976710656.025, 281474976710656);
+# endif
+  TEST_f_l (lround, 2097152.5, 2097153);
+  TEST_f_l (lround, -2097152.5, -2097153);
+#endif
+  END (lround);
+}
+
+
+static void
+llround_test (void)
+{
+  START (llround);
+
+  TEST_f_L (llround, 0, 0);
+  TEST_f_L (llround, minus_zero, 0);
+  TEST_f_L (llround, 0.2L, 0.0);
+  TEST_f_L (llround, -0.2L, 0);
+  TEST_f_L (llround, 0.5, 1);
+  TEST_f_L (llround, -0.5, -1);
+  TEST_f_L (llround, 0.8L, 1);
+  TEST_f_L (llround, -0.8L, -1);
+  TEST_f_L (llround, 1.5, 2);
+  TEST_f_L (llround, -1.5, -2);
+  TEST_f_L (llround, 22514.5, 22515);
+  TEST_f_L (llround, -22514.5, -22515);
+  TEST_f_l (llround, 1071930.0008, 1071930);
+#ifndef TEST_FLOAT
+  TEST_f_L (llround, 2097152.5, 2097153);
+  TEST_f_L (llround, -2097152.5, -2097153);
+  TEST_f_L (llround, 34359738368.5, 34359738369ll);
+  TEST_f_L (llround, -34359738368.5, -34359738369ll);
+#endif
+
+  /* Test boundary conditions.  */
+  /* 0x1FFFFF */
+  TEST_f_L (llround, 2097151.0, 2097151LL);
+  /* 0x800000 */
+  TEST_f_L (llround, 8388608.0, 8388608LL);
+  /* 0x1000000 */
+  TEST_f_L (llround, 16777216.0, 16777216LL);
+  /* 0x20000000000 */
+  TEST_f_L (llround, 2199023255552.0, 2199023255552LL);
+  /* 0x40000000000 */
+  TEST_f_L (llround, 4398046511104.0, 4398046511104LL);
+  /* 0x1000000000000 */
+  TEST_f_L (llround, 281474976710656.0, 281474976710656LL);
+  /* 0x10000000000000 */
+  TEST_f_L (llround, 4503599627370496.0, 4503599627370496LL);
+  /* 0x10000080000000 */
+  TEST_f_L (llround, 4503601774854144.0, 4503601774854144LL);
+  /* 0x20000000000000 */
+  TEST_f_L (llround, 9007199254740992.0, 9007199254740992LL);
+  /* 0x80000000000000 */
+  TEST_f_L (llround, 36028797018963968.0, 36028797018963968LL);
+  /* 0x100000000000000 */
+  TEST_f_L (llround, 72057594037927936.0, 72057594037927936LL);
+
+#ifndef TEST_FLOAT
+  /* 0x100000000 */
+  TEST_f_L (llround, 4294967295.5, 4294967296LL);
+  /* 0x200000000 */
+  TEST_f_L (llround, 8589934591.5, 8589934592LL);
+#endif
+
+#ifdef TEST_LDOUBLE
+  /* The input can only be represented in long double.  */
+  TEST_f_L (llround, 4503599627370495.5L, 4503599627370496LL);
+  TEST_f_L (llround, 4503599627370496.25L, 4503599627370496LL);
+  TEST_f_L (llround, 4503599627370496.5L, 4503599627370497LL);
+  TEST_f_L (llround, 4503599627370496.75L, 4503599627370497LL);
+  TEST_f_L (llround, 4503599627370497.5L, 4503599627370498LL);
+
+  TEST_f_L (llround, -4503599627370495.5L, -4503599627370496LL);
+  TEST_f_L (llround, -4503599627370496.25L, -4503599627370496LL);
+  TEST_f_L (llround, -4503599627370496.5L, -4503599627370497LL);
+  TEST_f_L (llround, -4503599627370496.75L, -4503599627370497LL);
+  TEST_f_L (llround, -4503599627370497.5L, -4503599627370498LL);
+
+  TEST_f_L (llround, 9007199254740991.5L, 9007199254740992LL);
+  TEST_f_L (llround, 9007199254740992.25L, 9007199254740992LL);
+  TEST_f_L (llround, 9007199254740992.5L, 9007199254740993LL);
+  TEST_f_L (llround, 9007199254740992.75L, 9007199254740993LL);
+  TEST_f_L (llround, 9007199254740993.5L, 9007199254740994LL);
+
+  TEST_f_L (llround, -9007199254740991.5L, -9007199254740992LL);
+  TEST_f_L (llround, -9007199254740992.25L, -9007199254740992LL);
+  TEST_f_L (llround, -9007199254740992.5L, -9007199254740993LL);
+  TEST_f_L (llround, -9007199254740992.75L, -9007199254740993LL);
+  TEST_f_L (llround, -9007199254740993.5L, -9007199254740994LL);
+
+  TEST_f_L (llround, 72057594037927935.5L, 72057594037927936LL);
+  TEST_f_L (llround, 72057594037927936.25L, 72057594037927936LL);
+  TEST_f_L (llround, 72057594037927936.5L, 72057594037927937LL);
+  TEST_f_L (llround, 72057594037927936.75L, 72057594037927937LL);
+  TEST_f_L (llround, 72057594037927937.5L, 72057594037927938LL);
+
+  TEST_f_L (llround, -72057594037927935.5L, -72057594037927936LL);
+  TEST_f_L (llround, -72057594037927936.25L, -72057594037927936LL);
+  TEST_f_L (llround, -72057594037927936.5L, -72057594037927937LL);
+  TEST_f_L (llround, -72057594037927936.75L, -72057594037927937LL);
+  TEST_f_L (llround, -72057594037927937.5L, -72057594037927938LL);
+
+  TEST_f_L (llround, 9223372036854775806.25L, 9223372036854775806LL);
+  TEST_f_L (llround, -9223372036854775806.25L, -9223372036854775806LL);
+  TEST_f_L (llround, 9223372036854775806.5L, 9223372036854775807LL);
+  TEST_f_L (llround, -9223372036854775806.5L, -9223372036854775807LL);
+  TEST_f_L (llround, 9223372036854775807.0L, 9223372036854775807LL);
+  TEST_f_L (llround, -9223372036854775807.0L, -9223372036854775807LL);
+#endif
+
+  END (llround);
+}
+#endif
+
+static void
+modf_test (void)
+{
+  FLOAT x;
+
+  START (modf);
+
+  TEST_fF_f1 (modf, plus_infty, 0, plus_infty);
+  TEST_fF_f1 (modf, minus_infty, minus_zero, minus_infty);
+  TEST_fF_f1 (modf, nan_value, nan_value, nan_value);
+  TEST_fF_f1 (modf, 0, 0, 0);
+  TEST_fF_f1 (modf, 1.5, 0.5, 1);
+  TEST_fF_f1 (modf, 2.5, 0.5, 2);
+  TEST_fF_f1 (modf, -2.5, -0.5, -2);
+  TEST_fF_f1 (modf, 20, 0, 20);
+  TEST_fF_f1 (modf, 21, 0, 21);
+  TEST_fF_f1 (modf, 89.5, 0.5, 89);
+
+  END (modf);
+}
+
+
+#if 0
+static void
+nearbyint_test (void)
+{
+  START (nearbyint);
+
+  TEST_f_f (nearbyint, 0.0, 0.0);
+  TEST_f_f (nearbyint, minus_zero, minus_zero);
+  TEST_f_f (nearbyint, plus_infty, plus_infty);
+  TEST_f_f (nearbyint, minus_infty, minus_infty);
+  TEST_f_f (nearbyint, nan_value, nan_value);
+
+  /* Default rounding mode is round to nearest.  */
+  TEST_f_f (nearbyint, 0.5, 0.0);
+  TEST_f_f (nearbyint, 1.5, 2.0);
+  TEST_f_f (nearbyint, -0.5, minus_zero);
+  TEST_f_f (nearbyint, -1.5, -2.0);
+
+  END (nearbyint);
+}
+
+static void
+nextafter_test (void)
+{
+
+  START (nextafter);
+
+  TEST_ff_f (nextafter, 0, 0, 0);
+  TEST_ff_f (nextafter, minus_zero, 0, 0);
+  TEST_ff_f (nextafter, 0, minus_zero, minus_zero);
+  TEST_ff_f (nextafter, minus_zero, minus_zero, minus_zero);
+
+  TEST_ff_f (nextafter, 9, 9, 9);
+  TEST_ff_f (nextafter, -9, -9, -9);
+  TEST_ff_f (nextafter, plus_infty, plus_infty, plus_infty);
+  TEST_ff_f (nextafter, minus_infty, minus_infty, minus_infty);
+
+  TEST_ff_f (nextafter, nan_value, 1.1L, nan_value);
+  TEST_ff_f (nextafter, 1.1L, nan_value, nan_value);
+  TEST_ff_f (nextafter, nan_value, nan_value, nan_value);
+
+  FLOAT fltmax = CHOOSE (LDBL_MAX, DBL_MAX, FLT_MAX,
+			 LDBL_MAX, DBL_MAX, FLT_MAX);
+  TEST_ff_f (nextafter, fltmax, plus_infty, plus_infty);
+  TEST_ff_f (nextafter, -fltmax, minus_infty, minus_infty);
+
+#ifdef TEST_LDOUBLE
+  // XXX Enable once gcc is fixed.
+  //TEST_ff_f (nextafter, 0x0.00000040000000000000p-16385L, -0.1L, 0x0.0000003ffffffff00000p-16385L);
+#endif
+
+  /* XXX We need the hexadecimal FP number representation here for further
+     tests.  */
+
+  END (nextafter);
+}
+
+
+static void
+nexttoward_test (void)
+{
+  START (nexttoward);
+  TEST_ff_f (nexttoward, 0, 0, 0);
+  TEST_ff_f (nexttoward, minus_zero, 0, 0);
+  TEST_ff_f (nexttoward, 0, minus_zero, minus_zero);
+  TEST_ff_f (nexttoward, minus_zero, minus_zero, minus_zero);
+
+  TEST_ff_f (nexttoward, 9, 9, 9);
+  TEST_ff_f (nexttoward, -9, -9, -9);
+  TEST_ff_f (nexttoward, plus_infty, plus_infty, plus_infty);
+  TEST_ff_f (nexttoward, minus_infty, minus_infty, minus_infty);
+
+  TEST_ff_f (nexttoward, nan_value, 1.1L, nan_value);
+  TEST_ff_f (nexttoward, 1.1L, nan_value, nan_value);
+  TEST_ff_f (nexttoward, nan_value, nan_value, nan_value);
+
+  /* XXX We need the hexadecimal FP number representation here for further
+     tests.  */
+
+  END (nexttoward);
+}
+#endif
+
+
+static void
+pow_test (void)
+{
+
+  errno = 0;
+  FUNC(pow) (0, 0);
+  if (errno == ENOSYS)
+    /* Function not implemented.  */
+    return;
+
+  START (pow);
+
+  TEST_ff_f (pow, 0, 0, 1);
+  TEST_ff_f (pow, 0, minus_zero, 1);
+  TEST_ff_f (pow, minus_zero, 0, 1);
+  TEST_ff_f (pow, minus_zero, minus_zero, 1);
+
+  TEST_ff_f (pow, 10, 0, 1);
+  TEST_ff_f (pow, 10, minus_zero, 1);
+  TEST_ff_f (pow, -10, 0, 1);
+  TEST_ff_f (pow, -10, minus_zero, 1);
+
+  TEST_ff_f (pow, nan_value, 0, 1);
+  TEST_ff_f (pow, nan_value, minus_zero, 1);
+
+
+#ifndef TEST_INLINE
+  TEST_ff_f (pow, 1.1L, plus_infty, plus_infty);
+  TEST_ff_f (pow, plus_infty, plus_infty, plus_infty);
+  TEST_ff_f (pow, -1.1L, plus_infty, plus_infty);
+  TEST_ff_f (pow, minus_infty, plus_infty, plus_infty);
+
+  TEST_ff_f (pow, 0.9L, plus_infty, 0);
+  TEST_ff_f (pow, 1e-7L, plus_infty, 0);
+  TEST_ff_f (pow, -0.9L, plus_infty, 0);
+  TEST_ff_f (pow, -1e-7L, plus_infty, 0);
+
+  TEST_ff_f (pow, 1.1L, minus_infty, 0);
+  TEST_ff_f (pow, plus_infty, minus_infty, 0);
+  TEST_ff_f (pow, -1.1L, minus_infty, 0);
+  TEST_ff_f (pow, minus_infty, minus_infty, 0);
+
+  TEST_ff_f (pow, 0.9L, minus_infty, plus_infty);
+  TEST_ff_f (pow, 1e-7L, minus_infty, plus_infty);
+  TEST_ff_f (pow, -0.9L, minus_infty, plus_infty);
+  TEST_ff_f (pow, -1e-7L, minus_infty, plus_infty);
+
+  TEST_ff_f (pow, plus_infty, 1e-7L, plus_infty);
+  TEST_ff_f (pow, plus_infty, 1, plus_infty);
+  TEST_ff_f (pow, plus_infty, 1e7L, plus_infty);
+
+  TEST_ff_f (pow, plus_infty, -1e-7L, 0);
+  TEST_ff_f (pow, plus_infty, -1, 0);
+  TEST_ff_f (pow, plus_infty, -1e7L, 0);
+
+  TEST_ff_f (pow, minus_infty, 1, minus_infty);
+  TEST_ff_f (pow, minus_infty, 11, minus_infty);
+  TEST_ff_f (pow, minus_infty, 1001, minus_infty);
+
+  TEST_ff_f (pow, minus_infty, 2, plus_infty);
+  TEST_ff_f (pow, minus_infty, 12, plus_infty);
+  TEST_ff_f (pow, minus_infty, 1002, plus_infty);
+  TEST_ff_f (pow, minus_infty, 0.1L, plus_infty);
+  TEST_ff_f (pow, minus_infty, 1.1L, plus_infty);
+  TEST_ff_f (pow, minus_infty, 11.1L, plus_infty);
+  TEST_ff_f (pow, minus_infty, 1001.1L, plus_infty);
+
+  TEST_ff_f (pow, minus_infty, -1, minus_zero);
+  TEST_ff_f (pow, minus_infty, -11, minus_zero);
+  TEST_ff_f (pow, minus_infty, -1001, minus_zero);
+
+  TEST_ff_f (pow, minus_infty, -2, 0);
+  TEST_ff_f (pow, minus_infty, -12, 0);
+  TEST_ff_f (pow, minus_infty, -1002, 0);
+  TEST_ff_f (pow, minus_infty, -0.1L, 0);
+  TEST_ff_f (pow, minus_infty, -1.1L, 0);
+  TEST_ff_f (pow, minus_infty, -11.1L, 0);
+  TEST_ff_f (pow, minus_infty, -1001.1L, 0);
+#endif
+
+  TEST_ff_f (pow, nan_value, nan_value, nan_value);
+  TEST_ff_f (pow, 0, nan_value, nan_value);
+  TEST_ff_f (pow, 1, nan_value, 1);
+  TEST_ff_f (pow, -1, nan_value, nan_value);
+  TEST_ff_f (pow, nan_value, 1, nan_value);
+  TEST_ff_f (pow, nan_value, -1, nan_value);
+
+  /* pow (x, NaN) == NaN.  */
+  TEST_ff_f (pow, 3.0, nan_value, nan_value);
+
+  TEST_ff_f (pow, 1, plus_infty, 1);
+  TEST_ff_f (pow, -1, plus_infty, 1);
+  TEST_ff_f (pow, 1, minus_infty, 1);
+  TEST_ff_f (pow, -1, minus_infty, 1);
+  TEST_ff_f (pow, 1, 1, 1);
+  TEST_ff_f (pow, 1, -1, 1);
+  TEST_ff_f (pow, 1, 1.25, 1);
+  TEST_ff_f (pow, 1, -1.25, 1);
+  TEST_ff_f (pow, 1, 0x1p62L, 1);
+  TEST_ff_f (pow, 1, 0x1p63L, 1);
+  TEST_ff_f (pow, 1, 0x1p64L, 1);
+  TEST_ff_f (pow, 1, 0x1p72L, 1);
+
+  /* pow (x, +-0) == 1.  */
+  TEST_ff_f (pow, plus_infty, 0, 1);
+  TEST_ff_f (pow, plus_infty, minus_zero, 1);
+  TEST_ff_f (pow, minus_infty, 0, 1);
+  TEST_ff_f (pow, minus_infty, minus_zero, 1);
+  TEST_ff_f (pow, 32.75L, 0, 1);
+  TEST_ff_f (pow, 32.75L, minus_zero, 1);
+  TEST_ff_f (pow, -32.75L, 0, 1);
+  TEST_ff_f (pow, -32.75L, minus_zero, 1);
+  TEST_ff_f (pow, 0x1p72L, 0, 1);
+  TEST_ff_f (pow, 0x1p72L, minus_zero, 1);
+  TEST_ff_f (pow, 0x1p-72L, 0, 1);
+  TEST_ff_f (pow, 0x1p-72L, minus_zero, 1);
+
+  TEST_ff_f (pow, -0.1L, 1.1L, nan_value, INVALID_EXCEPTION);
+  TEST_ff_f (pow, -0.1L, -1.1L, nan_value, INVALID_EXCEPTION);
+  TEST_ff_f (pow, -10.1L, 1.1L, nan_value, INVALID_EXCEPTION);
+  TEST_ff_f (pow, -10.1L, -1.1L, nan_value, INVALID_EXCEPTION);
+
+  TEST_ff_f (pow, 0, -1, plus_infty, DIVIDE_BY_ZERO_EXCEPTION);
+  TEST_ff_f (pow, 0, -11, plus_infty, DIVIDE_BY_ZERO_EXCEPTION);
+  TEST_ff_f (pow, minus_zero, -1, minus_infty, DIVIDE_BY_ZERO_EXCEPTION);
+  TEST_ff_f (pow, minus_zero, -11, minus_infty, DIVIDE_BY_ZERO_EXCEPTION);
+
+  TEST_ff_f (pow, 0, -2, plus_infty, DIVIDE_BY_ZERO_EXCEPTION);
+  TEST_ff_f (pow, 0, -11.1L, plus_infty, DIVIDE_BY_ZERO_EXCEPTION);
+  TEST_ff_f (pow, minus_zero, -2, plus_infty, DIVIDE_BY_ZERO_EXCEPTION);
+  TEST_ff_f (pow, minus_zero, -11.1L, plus_infty, DIVIDE_BY_ZERO_EXCEPTION);
+
+  TEST_ff_f (pow, 0x1p72L, 0x1p72L, plus_infty);
+  TEST_ff_f (pow, 10, -0x1p72L, 0);
+  TEST_ff_f (pow, max_value, max_value, plus_infty);
+  TEST_ff_f (pow, 10, -max_value, 0);
+
+  TEST_ff_f (pow, 0, 1, 0);
+  TEST_ff_f (pow, 0, 11, 0);
+
+  TEST_ff_f (pow, minus_zero, 1, minus_zero);
+  TEST_ff_f (pow, minus_zero, 11, minus_zero);
+
+
+  TEST_ff_f (pow, 0, 2, 0);
+  TEST_ff_f (pow, 0, 11.1L, 0);
+
+
+  TEST_ff_f (pow, minus_zero, 2, 0);
+  TEST_ff_f (pow, minus_zero, 11.1L, 0);
+  TEST_ff_f (pow, 0, plus_infty, 0);
+  TEST_ff_f (pow, minus_zero, plus_infty, 0);
+
+#ifndef TEST_INLINE
+  /* pow (x, +inf) == +inf for |x| > 1.  */
+  TEST_ff_f (pow, 1.5, plus_infty, plus_infty);
+
+  /* pow (x, +inf) == +0 for |x| < 1.  */
+  TEST_ff_f (pow, 0.5, plus_infty, 0.0);
+
+  /* pow (x, -inf) == +0 for |x| > 1.  */
+  TEST_ff_f (pow, 1.5, minus_infty, 0.0);
+
+  /* pow (x, -inf) == +inf for |x| < 1.  */
+  TEST_ff_f (pow, 0.5, minus_infty, plus_infty);
+#endif
+
+  /* pow (+inf, y) == +inf for y > 0.  */
+  TEST_ff_f (pow, plus_infty, 2, plus_infty);
+
+  /* pow (+inf, y) == +0 for y < 0.  */
+  TEST_ff_f (pow, plus_infty, -1, 0.0);
+
+  /* pow (-inf, y) == -inf for y an odd integer > 0.  */
+  TEST_ff_f (pow, minus_infty, 27, minus_infty);
+
+  /* pow (-inf, y) == +inf for y > 0 and not an odd integer.  */
+  TEST_ff_f (pow, minus_infty, 28, plus_infty);
+
+  /* pow (-inf, y) == -0 for y an odd integer < 0. */
+  TEST_ff_f (pow, minus_infty, -3, minus_zero);
+  /* pow (-inf, y) == +0 for y < 0 and not an odd integer.  */
+  TEST_ff_f (pow, minus_infty, -2.0, 0.0);
+
+  /* pow (+0, y) == +0 for y an odd integer > 0.  */
+  TEST_ff_f (pow, 0.0, 27, 0.0);
+
+  /* pow (-0, y) == -0 for y an odd integer > 0.  */
+  TEST_ff_f (pow, minus_zero, 27, minus_zero);
+
+  /* pow (+0, y) == +0 for y > 0 and not an odd integer.  */
+  TEST_ff_f (pow, 0.0, 4, 0.0);
+
+  /* pow (-0, y) == +0 for y > 0 and not an odd integer.  */
+  TEST_ff_f (pow, minus_zero, 4, 0.0);
+
+  TEST_ff_f (pow, 16, 0.25L, 2);
+  TEST_ff_f (pow, 0x1p64L, 0.125L, 256);
+  TEST_ff_f (pow, 2, 4, 16);
+  TEST_ff_f (pow, 256, 8, 0x1p64L);
+
+  TEST_ff_f (pow, 0.75L, 1.25L, 0.697953644326574699205914060237425566L);
+
+#if defined TEST_DOUBLE || defined TEST_LDOUBLE
+  TEST_ff_f (pow, -7.49321e+133, -9.80818e+16, 0);
+#endif
+
+  END (pow);
+}
+
+static void
+remainder_test (void)
+{
+  errno = 0;
+  FUNC(remainder) (1.625, 1.0);
+  if (errno == ENOSYS)
+    /* Function not implemented.  */
+    return;
+
+  START (remainder);
+
+  TEST_ff_f (remainder, 1, 0, nan_value, INVALID_EXCEPTION);
+  TEST_ff_f (remainder, 1, minus_zero, nan_value, INVALID_EXCEPTION);
+  TEST_ff_f (remainder, plus_infty, 1, nan_value, INVALID_EXCEPTION);
+  TEST_ff_f (remainder, minus_infty, 1, nan_value, INVALID_EXCEPTION);
+  TEST_ff_f (remainder, nan_value, nan_value, nan_value);
+
+  TEST_ff_f (remainder, 1.625, 1.0, -0.375);
+  TEST_ff_f (remainder, -1.625, 1.0, 0.375);
+  TEST_ff_f (remainder, 1.625, -1.0, -0.375);
+  TEST_ff_f (remainder, -1.625, -1.0, 0.375);
+  TEST_ff_f (remainder, 5.0, 2.0, 1.0);
+  TEST_ff_f (remainder, 3.0, 2.0, -1.0);
+
+  END (remainder);
+}
+
+#if 0
+static void
+remquo_test (void)
+{
+  /* x is needed.  */
+  int x;
+
+  errno = 0;
+  FUNC(remquo) (1.625, 1.0, &x);
+  if (errno == ENOSYS)
+    /* Function not implemented.  */
+    return;
+
+  START (remquo);
+
+  TEST_ffI_f1 (remquo, 1, 0, nan_value, IGNORE, INVALID_EXCEPTION);
+  TEST_ffI_f1 (remquo, 1, minus_zero, nan_value, IGNORE, INVALID_EXCEPTION);
+  TEST_ffI_f1 (remquo, plus_infty, 1, nan_value, IGNORE, INVALID_EXCEPTION);
+  TEST_ffI_f1 (remquo, minus_infty, 1, nan_value, IGNORE, INVALID_EXCEPTION);
+  TEST_ffI_f1 (remquo, nan_value, nan_value, nan_value, IGNORE);
+
+  TEST_ffI_f1 (remquo, 1.625, 1.0, -0.375, 2);
+  TEST_ffI_f1 (remquo, -1.625, 1.0, 0.375, -2);
+  TEST_ffI_f1 (remquo, 1.625, -1.0, -0.375, -2);
+  TEST_ffI_f1 (remquo, -1.625, -1.0, 0.375, 2);
+
+  TEST_ffI_f1 (remquo, 5, 2, 1, 2);
+  TEST_ffI_f1 (remquo, 3, 2, -1, 2);
+
+  END (remquo);
+}
+#endif
+
+static void
+rint_test (void)
+{
+  START (rint);
+
+  TEST_f_f (rint, 0.0, 0.0);
+  TEST_f_f (rint, minus_zero, minus_zero);
+  TEST_f_f (rint, plus_infty, plus_infty);
+  TEST_f_f (rint, minus_infty, minus_infty);
+
+  /* Default rounding mode is round to even.  */
+  TEST_f_f (rint, 0.5, 0.0);
+  TEST_f_f (rint, 1.5, 2.0);
+  TEST_f_f (rint, 2.5, 2.0);
+  TEST_f_f (rint, 3.5, 4.0);
+  TEST_f_f (rint, 4.5, 4.0);
+  TEST_f_f (rint, -0.5, -0.0);
+  TEST_f_f (rint, -1.5, -2.0);
+  TEST_f_f (rint, -2.5, -2.0);
+  TEST_f_f (rint, -3.5, -4.0);
+  TEST_f_f (rint, -4.5, -4.0);
+#ifdef TEST_LDOUBLE
+  /* The result can only be represented in long double.  */
+  TEST_f_f (rint, 4503599627370495.5L, 4503599627370496.0L);
+  TEST_f_f (rint, 4503599627370496.25L, 4503599627370496.0L);
+  TEST_f_f (rint, 4503599627370496.5L, 4503599627370496.0L);
+  TEST_f_f (rint, 4503599627370496.75L, 4503599627370497.0L);
+  TEST_f_f (rint, 4503599627370497.5L, 4503599627370498.0L);
+
+  TEST_f_f (rint, -4503599627370495.5L, -4503599627370496.0L);
+  TEST_f_f (rint, -4503599627370496.25L, -4503599627370496.0L);
+  TEST_f_f (rint, -4503599627370496.5L, -4503599627370496.0L);
+  TEST_f_f (rint, -4503599627370496.75L, -4503599627370497.0L);
+  TEST_f_f (rint, -4503599627370497.5L, -4503599627370498.0L);
+
+  TEST_f_f (rint, 9007199254740991.5L, 9007199254740992.0L);
+  TEST_f_f (rint, 9007199254740992.25L, 9007199254740992.0L);
+  TEST_f_f (rint, 9007199254740992.5L, 9007199254740992.0L);
+  TEST_f_f (rint, 9007199254740992.75L, 9007199254740993.0L);
+  TEST_f_f (rint, 9007199254740993.5L, 9007199254740994.0L);
+
+  TEST_f_f (rint, -9007199254740991.5L, -9007199254740992.0L);
+  TEST_f_f (rint, -9007199254740992.25L, -9007199254740992.0L);
+  TEST_f_f (rint, -9007199254740992.5L, -9007199254740992.0L);
+  TEST_f_f (rint, -9007199254740992.75L, -9007199254740993.0L);
+  TEST_f_f (rint, -9007199254740993.5L, -9007199254740994.0L);
+
+  TEST_f_f (rint, 72057594037927935.5L, 72057594037927936.0L);
+  TEST_f_f (rint, 72057594037927936.25L, 72057594037927936.0L);
+  TEST_f_f (rint, 72057594037927936.5L, 72057594037927936.0L);
+  TEST_f_f (rint, 72057594037927936.75L, 72057594037927937.0L);
+  TEST_f_f (rint, 72057594037927937.5L, 72057594037927938.0L);
+
+  TEST_f_f (rint, -72057594037927935.5L, -72057594037927936.0L);
+  TEST_f_f (rint, -72057594037927936.25L, -72057594037927936.0L);
+  TEST_f_f (rint, -72057594037927936.5L, -72057594037927936.0L);
+  TEST_f_f (rint, -72057594037927936.75L, -72057594037927937.0L);
+  TEST_f_f (rint, -72057594037927937.5L, -72057594037927938.0L);
+
+  TEST_f_f (rint, 10141204801825835211973625643007.5L, 10141204801825835211973625643008.0L);
+  TEST_f_f (rint, 10141204801825835211973625643008.25L, 10141204801825835211973625643008.0L);
+  TEST_f_f (rint, 10141204801825835211973625643008.5L, 10141204801825835211973625643008.0L);
+  TEST_f_f (rint, 10141204801825835211973625643008.75L, 10141204801825835211973625643009.0L);
+  TEST_f_f (rint, 10141204801825835211973625643009.5L, 10141204801825835211973625643010.0L);
+#endif
+
+  END (rint);
+}
+
+#if 0
+static void
+rint_test_tonearest (void)
+{
+  int save_round_mode;
+  START (rint_tonearest);
+
+  save_round_mode = fegetround();
+
+  if (!fesetround (FE_TONEAREST))
+  {
+    TEST_f_f (rint, 2.0, 2.0);
+    TEST_f_f (rint, 1.5, 2.0);
+    TEST_f_f (rint, 1.0, 1.0);
+    TEST_f_f (rint, 0.5, 0.0);
+    TEST_f_f (rint, 0.0, 0.0);
+    TEST_f_f (rint, minus_zero, minus_zero);
+    TEST_f_f (rint, -0.5, -0.0);
+    TEST_f_f (rint, -1.0, -1.0);
+    TEST_f_f (rint, -1.5, -2.0);
+    TEST_f_f (rint, -2.0, -2.0);
+  }
+
+  fesetround(save_round_mode);
+
+  END (rint_tonearest);
+}
+
+static void
+rint_test_towardzero (void)
+{
+  int save_round_mode;
+  START (rint_towardzero);
+
+  save_round_mode = fegetround();
+
+  if (!fesetround (FE_TOWARDZERO))
+  {
+    TEST_f_f (rint, 2.0, 2.0);
+    TEST_f_f (rint, 1.5, 1.0);
+    TEST_f_f (rint, 1.0, 1.0);
+    TEST_f_f (rint, 0.5, 0.0);
+    TEST_f_f (rint, 0.0, 0.0);
+    TEST_f_f (rint, minus_zero, minus_zero);
+    TEST_f_f (rint, -0.5, -0.0);
+    TEST_f_f (rint, -1.0, -1.0);
+    TEST_f_f (rint, -1.5, -1.0);
+    TEST_f_f (rint, -2.0, -2.0);
+  }
+
+  fesetround(save_round_mode);
+
+  END (rint_towardzero);
+}
+
+static void
+rint_test_downward (void)
+{
+  int save_round_mode;
+  START (rint_downward);
+
+  save_round_mode = fegetround();
+
+  if (!fesetround (FE_DOWNWARD))
+  {
+    TEST_f_f (rint, 2.0, 2.0);
+    TEST_f_f (rint, 1.5, 1.0);
+    TEST_f_f (rint, 1.0, 1.0);
+    TEST_f_f (rint, 0.5, 0.0);
+    TEST_f_f (rint, 0.0, 0.0);
+    TEST_f_f (rint, minus_zero, minus_zero);
+    TEST_f_f (rint, -0.5, -1.0);
+    TEST_f_f (rint, -1.0, -1.0);
+    TEST_f_f (rint, -1.5, -2.0);
+    TEST_f_f (rint, -2.0, -2.0);
+  }
+
+  fesetround(save_round_mode);
+
+  END (rint_downward);
+}
+
+static void
+rint_test_upward (void)
+{
+  int save_round_mode;
+  START (rint_upward);
+
+  save_round_mode = fegetround();
+
+  if (!fesetround (FE_UPWARD))
+  {
+    TEST_f_f (rint, 2.0, 2.0);
+    TEST_f_f (rint, 1.5, 2.0);
+    TEST_f_f (rint, 1.0, 1.0);
+    TEST_f_f (rint, 0.5, 1.0);
+    TEST_f_f (rint, 0.0, 0.0);
+    TEST_f_f (rint, minus_zero, minus_zero);
+    TEST_f_f (rint, -0.5, -0.0);
+    TEST_f_f (rint, -1.0, -1.0);
+    TEST_f_f (rint, -1.5, -1.0);
+    TEST_f_f (rint, -2.0, -2.0);
+  }
+
+  fesetround(save_round_mode);
+
+  END (rint_upward);
+}
+
+static void
+round_test (void)
+{
+  START (round);
+
+  TEST_f_f (round, 0, 0);
+  TEST_f_f (round, minus_zero, minus_zero);
+  TEST_f_f (round, 0.2L, 0.0);
+  TEST_f_f (round, -0.2L, minus_zero);
+  TEST_f_f (round, 0.5, 1.0);
+  TEST_f_f (round, -0.5, -1.0);
+  TEST_f_f (round, 0.8L, 1.0);
+  TEST_f_f (round, -0.8L, -1.0);
+  TEST_f_f (round, 1.5, 2.0);
+  TEST_f_f (round, -1.5, -2.0);
+  TEST_f_f (round, 2097152.5, 2097153);
+  TEST_f_f (round, -2097152.5, -2097153);
+
+#ifdef TEST_LDOUBLE
+  /* The result can only be represented in long double.  */
+  TEST_f_f (round, 4503599627370495.5L, 4503599627370496.0L);
+  TEST_f_f (round, 4503599627370496.25L, 4503599627370496.0L);
+  TEST_f_f (round, 4503599627370496.5L, 4503599627370497.0L);
+  TEST_f_f (round, 4503599627370496.75L, 4503599627370497.0L);
+  TEST_f_f (round, 4503599627370497.5L, 4503599627370498.0L);
+
+  TEST_f_f (round, -4503599627370495.5L, -4503599627370496.0L);
+  TEST_f_f (round, -4503599627370496.25L, -4503599627370496.0L);
+  TEST_f_f (round, -4503599627370496.5L, -4503599627370497.0L);
+  TEST_f_f (round, -4503599627370496.75L, -4503599627370497.0L);
+  TEST_f_f (round, -4503599627370497.5L, -4503599627370498.0L);
+
+  TEST_f_f (round, 9007199254740991.5L, 9007199254740992.0L);
+  TEST_f_f (round, 9007199254740992.25L, 9007199254740992.0L);
+  TEST_f_f (round, 9007199254740992.5L, 9007199254740993.0L);
+  TEST_f_f (round, 9007199254740992.75L, 9007199254740993.0L);
+  TEST_f_f (round, 9007199254740993.5L, 9007199254740994.0L);
+
+  TEST_f_f (round, -9007199254740991.5L, -9007199254740992.0L);
+  TEST_f_f (round, -9007199254740992.25L, -9007199254740992.0L);
+  TEST_f_f (round, -9007199254740992.5L, -9007199254740993.0L);
+  TEST_f_f (round, -9007199254740992.75L, -9007199254740993.0L);
+  TEST_f_f (round, -9007199254740993.5L, -9007199254740994.0L);
+
+  TEST_f_f (round, 72057594037927935.5L, 72057594037927936.0L);
+  TEST_f_f (round, 72057594037927936.25L, 72057594037927936.0L);
+  TEST_f_f (round, 72057594037927936.5L, 72057594037927937.0L);
+  TEST_f_f (round, 72057594037927936.75L, 72057594037927937.0L);
+  TEST_f_f (round, 72057594037927937.5L, 72057594037927938.0L);
+
+  TEST_f_f (round, -72057594037927935.5L, -72057594037927936.0L);
+  TEST_f_f (round, -72057594037927936.25L, -72057594037927936.0L);
+  TEST_f_f (round, -72057594037927936.5L, -72057594037927937.0L);
+  TEST_f_f (round, -72057594037927936.75L, -72057594037927937.0L);
+  TEST_f_f (round, -72057594037927937.5L, -72057594037927938.0L);
+
+  TEST_f_f (round, 10141204801825835211973625643007.5L, 10141204801825835211973625643008.0L);
+  TEST_f_f (round, 10141204801825835211973625643008.25L, 10141204801825835211973625643008.0L);
+  TEST_f_f (round, 10141204801825835211973625643008.5L, 10141204801825835211973625643009.0L);
+  TEST_f_f (round, 10141204801825835211973625643008.75L, 10141204801825835211973625643009.0L);
+  TEST_f_f (round, 10141204801825835211973625643009.5L, 10141204801825835211973625643010.0L);
+#endif
+
+  END (round);
+}
+#endif
+
+
+static void
+scalb_test (void)
+{
+  START (scalb);
+#ifndef TEST_LDOUBLE /* uclibc doesn't have scalbl */
+#ifdef __UCLIBC_SUSV3_LEGACY__ /* scalbf is susv3 legacy */
+
+  TEST_ff_f (scalb, 2.0, 0.5, nan_value, INVALID_EXCEPTION);
+  TEST_ff_f (scalb, 3.0, -2.5, nan_value, INVALID_EXCEPTION);
+
+  TEST_ff_f (scalb, 0, nan_value, nan_value);
+  TEST_ff_f (scalb, 1, nan_value, nan_value);
+
+  TEST_ff_f (scalb, 1, 0, 1);
+  TEST_ff_f (scalb, -1, 0, -1);
+
+  TEST_ff_f (scalb, 0, plus_infty, nan_value, INVALID_EXCEPTION);
+  TEST_ff_f (scalb, minus_zero, plus_infty, nan_value, INVALID_EXCEPTION);
+
+  TEST_ff_f (scalb, 0, 2, 0);
+  TEST_ff_f (scalb, minus_zero, -4, minus_zero);
+  TEST_ff_f (scalb, 0, 0, 0);
+  TEST_ff_f (scalb, minus_zero, 0, minus_zero);
+  TEST_ff_f (scalb, 0, -1, 0);
+  TEST_ff_f (scalb, minus_zero, -10, minus_zero);
+  TEST_ff_f (scalb, 0, minus_infty, 0);
+  TEST_ff_f (scalb, minus_zero, minus_infty, minus_zero);
+
+  TEST_ff_f (scalb, plus_infty, -1, plus_infty);
+  TEST_ff_f (scalb, minus_infty, -10, minus_infty);
+  TEST_ff_f (scalb, plus_infty, 0, plus_infty);
+  TEST_ff_f (scalb, minus_infty, 0, minus_infty);
+  TEST_ff_f (scalb, plus_infty, 2, plus_infty);
+  TEST_ff_f (scalb, minus_infty, 100, minus_infty);
+
+  TEST_ff_f (scalb, 0.1L, minus_infty, 0.0);
+  TEST_ff_f (scalb, -0.1L, minus_infty, minus_zero);
+
+  TEST_ff_f (scalb, 1, plus_infty, plus_infty);
+  TEST_ff_f (scalb, -1, plus_infty, minus_infty);
+  TEST_ff_f (scalb, plus_infty, plus_infty, plus_infty);
+  TEST_ff_f (scalb, minus_infty, plus_infty, minus_infty);
+
+  TEST_ff_f (scalb, plus_infty, minus_infty, nan_value, INVALID_EXCEPTION);
+  TEST_ff_f (scalb, minus_infty, minus_infty, nan_value, INVALID_EXCEPTION);
+
+  TEST_ff_f (scalb, nan_value, 1, nan_value);
+  TEST_ff_f (scalb, 1, nan_value, nan_value);
+  TEST_ff_f (scalb, nan_value, 0, nan_value);
+  TEST_ff_f (scalb, 0, nan_value, nan_value);
+  TEST_ff_f (scalb, nan_value, plus_infty, nan_value);
+  TEST_ff_f (scalb, plus_infty, nan_value, nan_value);
+  TEST_ff_f (scalb, nan_value, nan_value, nan_value);
+
+  TEST_ff_f (scalb, 0.8L, 4, 12.8L);
+  TEST_ff_f (scalb, -0.854375L, 5, -27.34L);
+#endif /* __UCLIBC_SUSV3_LEGACY__ */
+#endif /* TEST_LDOUBLE */
+  END (scalb);
+}
+
+
+static void
+scalbn_test (void)
+{
+
+  START (scalbn);
+
+  TEST_fi_f (scalbn, 0, 0, 0);
+  TEST_fi_f (scalbn, minus_zero, 0, minus_zero);
+
+  TEST_fi_f (scalbn, plus_infty, 1, plus_infty);
+  TEST_fi_f (scalbn, minus_infty, 1, minus_infty);
+  TEST_fi_f (scalbn, nan_value, 1, nan_value);
+
+  TEST_fi_f (scalbn, 0.8L, 4, 12.8L);
+  TEST_fi_f (scalbn, -0.854375L, 5, -27.34L);
+
+  TEST_fi_f (scalbn, 1, 0L, 1);
+
+  END (scalbn);
+}
+
+
+#if 0
+static void
+scalbln_test (void)
+{
+
+  START (scalbln);
+
+  TEST_fl_f (scalbln, 0, 0, 0);
+  TEST_fl_f (scalbln, minus_zero, 0, minus_zero);
+
+  TEST_fl_f (scalbln, plus_infty, 1, plus_infty);
+  TEST_fl_f (scalbln, minus_infty, 1, minus_infty);
+  TEST_fl_f (scalbln, nan_value, 1, nan_value);
+
+  TEST_fl_f (scalbln, 0.8L, 4, 12.8L);
+  TEST_fl_f (scalbln, -0.854375L, 5, -27.34L);
+
+  TEST_fl_f (scalbln, 1, 0L, 1);
+
+  END (scalbn);
+}
+#endif
+
+
+static void
+signbit_test (void)
+{
+
+  START (signbit);
+
+  TEST_f_b (signbit, 0, 0);
+  TEST_f_b (signbit, minus_zero, 1);
+  TEST_f_b (signbit, plus_infty, 0);
+  TEST_f_b (signbit, minus_infty, 1);
+
+  /* signbit (x) != 0 for x < 0.  */
+  TEST_f_b (signbit, -1, 1);
+  /* signbit (x) == 0 for x >= 0.  */
+  TEST_f_b (signbit, 1, 0);
+
+  END (signbit);
+}
+
+
+static void
+sin_test (void)
+{
+  errno = 0;
+  FUNC(sin) (0);
+  if (errno == ENOSYS)
+    /* Function not implemented.  */
+    return;
+
+  START (sin);
+
+  TEST_f_f (sin, 0, 0);
+  TEST_f_f (sin, minus_zero, minus_zero);
+  TEST_f_f (sin, plus_infty, nan_value, INVALID_EXCEPTION);
+  TEST_f_f (sin, minus_infty, nan_value, INVALID_EXCEPTION);
+  TEST_f_f (sin, nan_value, nan_value);
+
+  TEST_f_f (sin, M_PI_6l, 0.5);
+  TEST_f_f (sin, -M_PI_6l, -0.5);
+  TEST_f_f (sin, M_PI_2l, 1);
+  TEST_f_f (sin, -M_PI_2l, -1);
+  TEST_f_f (sin, 0.75L, 0.681638760023334166733241952779893935L);
+
+#ifdef TEST_DOUBLE
+  TEST_f_f (sin, 0.80190127184058835, 0.71867942238767868);
+#endif
+
+  END (sin);
+
+}
+
+
+#if 0
+static void
+sincos_test (void)
+{
+  FLOAT sin_res, cos_res;
+
+  errno = 0;
+  FUNC(sincos) (0, &sin_res, &cos_res);
+  if (errno == ENOSYS)
+    /* Function not implemented.  */
+    return;
+
+  START (sincos);
+
+  /* sincos is treated differently because it returns void.  */
+  TEST_extra (sincos, 0, 0, 1);
+
+  TEST_extra (sincos, minus_zero, minus_zero, 1);
+  TEST_extra (sincos, plus_infty, nan_value, nan_value, INVALID_EXCEPTION);
+  TEST_extra (sincos, minus_infty, nan_value, nan_value, INVALID_EXCEPTION);
+  TEST_extra (sincos, nan_value, nan_value, nan_value);
+
+  TEST_extra (sincos, M_PI_2l, 1, 0);
+  TEST_extra (sincos, M_PI_6l, 0.5, 0.86602540378443864676372317075293616L);
+  TEST_extra (sincos, M_PI_6l*2.0, 0.86602540378443864676372317075293616L, 0.5);
+  TEST_extra (sincos, 0.75L, 0.681638760023334166733241952779893935L, 0.731688868873820886311838753000084544L);
+
+#ifdef TEST_DOUBLE
+  TEST_extra (sincos, 0.80190127184058835, 0.71867942238767868, 0.69534156199418473);
+#endif
+
+  END (sincos);
+}
+#endif
+
+static void
+sinh_test (void)
+{
+  errno = 0;
+  FUNC(sinh) (0.7L);
+  if (errno == ENOSYS)
+    /* Function not implemented.  */
+    return;
+
+  START (sinh);
+  TEST_f_f (sinh, 0, 0);
+  TEST_f_f (sinh, minus_zero, minus_zero);
+
+#ifndef TEST_INLINE
+  TEST_f_f (sinh, plus_infty, plus_infty);
+  TEST_f_f (sinh, minus_infty, minus_infty);
+#endif
+  TEST_f_f (sinh, nan_value, nan_value);
+
+  TEST_f_f (sinh, 0.75L, 0.822316731935829980703661634446913849L);
+  TEST_f_f (sinh, 0x8p-32L, 1.86264514923095703232705808926175479e-9L);
+
+  END (sinh);
+}
+
+static void
+sqrt_test (void)
+{
+  errno = 0;
+  FUNC(sqrt) (1);
+  if (errno == ENOSYS)
+    /* Function not implemented.  */
+    return;
+
+  START (sqrt);
+
+  TEST_f_f (sqrt, 0, 0);
+  TEST_f_f (sqrt, nan_value, nan_value);
+  TEST_f_f (sqrt, plus_infty, plus_infty);
+
+  TEST_f_f (sqrt, minus_zero, minus_zero);
+
+  /* sqrt (x) == NaN plus invalid exception for x < 0.  */
+  TEST_f_f (sqrt, -1, nan_value, INVALID_EXCEPTION);
+  TEST_f_f (sqrt, minus_infty, nan_value, INVALID_EXCEPTION);
+  TEST_f_f (sqrt, nan_value, nan_value);
+
+  TEST_f_f (sqrt, 2209, 47);
+  TEST_f_f (sqrt, 4, 2);
+  TEST_f_f (sqrt, 2, M_SQRT2l);
+  TEST_f_f (sqrt, 0.25, 0.5);
+  TEST_f_f (sqrt, 6642.25, 81.5);
+  TEST_f_f (sqrt, 15190.5625L, 123.25L);
+  TEST_f_f (sqrt, 0.75L, 0.866025403784438646763723170752936183L);
+
+  END (sqrt);
+}
+
+
+static void
+tan_test (void)
+{
+  errno = 0;
+  FUNC(tan) (0);
+  if (errno == ENOSYS)
+    /* Function not implemented.  */
+    return;
+
+  START (tan);
+
+  TEST_f_f (tan, 0, 0);
+  TEST_f_f (tan, minus_zero, minus_zero);
+  TEST_f_f (tan, plus_infty, nan_value, INVALID_EXCEPTION);
+  TEST_f_f (tan, minus_infty, nan_value, INVALID_EXCEPTION);
+  TEST_f_f (tan, nan_value, nan_value);
+
+  TEST_f_f (tan, M_PI_4l, 1);
+  TEST_f_f (tan, 0.75L, 0.931596459944072461165202756573936428L);
+
+  END (tan);
+}
+
+static void
+tanh_test (void)
+{
+  errno = 0;
+  FUNC(tanh) (0.7L);
+  if (errno == ENOSYS)
+    /* Function not implemented.  */
+    return;
+
+  START (tanh);
+
+  TEST_f_f (tanh, 0, 0);
+  /* vda: uclibc: added IGNORE_ZERO_INF_SIGN to treat -0 as ok */
+  TEST_f_f (tanh, minus_zero, minus_zero, IGNORE_ZERO_INF_SIGN);
+
+#ifndef TEST_INLINE
+  TEST_f_f (tanh, plus_infty, 1);
+  TEST_f_f (tanh, minus_infty, -1);
+#endif
+  TEST_f_f (tanh, nan_value, nan_value);
+
+  TEST_f_f (tanh, 0.75L, 0.635148952387287319214434357312496495L);
+  TEST_f_f (tanh, -0.75L, -0.635148952387287319214434357312496495L);
+
+  TEST_f_f (tanh, 1.0L, 0.7615941559557648881194582826047935904L);
+  TEST_f_f (tanh, -1.0L, -0.7615941559557648881194582826047935904L);
+
+  /* 2^-57  */
+  TEST_f_f (tanh, 0x1p-57L, 6.938893903907228377647697925567626953125e-18L);
+
+  END (tanh);
+}
+
+#if 0
+static void
+tgamma_test (void)
+{
+  errno = 0;
+  FUNC(tgamma) (1);
+  if (errno == ENOSYS)
+    /* Function not implemented.  */
+    return;
+  feclearexcept (FE_ALL_EXCEPT);
+
+  START (tgamma);
+
+  TEST_f_f (tgamma, plus_infty, plus_infty);
+  TEST_f_f (tgamma, 0, plus_infty, DIVIDE_BY_ZERO_EXCEPTION);
+  TEST_f_f (tgamma, minus_zero, minus_infty, DIVIDE_BY_ZERO_EXCEPTION);
+  /* tgamma (x) == NaN plus invalid exception for integer x <= 0.  */
+  TEST_f_f (tgamma, -2, nan_value, INVALID_EXCEPTION);
+  TEST_f_f (tgamma, minus_infty, nan_value, INVALID_EXCEPTION);
+  TEST_f_f (tgamma, nan_value, nan_value);
+
+  TEST_f_f (tgamma, 0.5, M_SQRT_PIl);
+  TEST_f_f (tgamma, -0.5, -M_2_SQRT_PIl);
+
+  TEST_f_f (tgamma, 1, 1);
+  TEST_f_f (tgamma, 4, 6);
+
+  TEST_f_f (tgamma, 0.7L, 1.29805533264755778568117117915281162L);
+  TEST_f_f (tgamma, 1.2L, 0.918168742399760610640951655185830401L);
+
+  END (tgamma);
+}
+#endif
+
+
+#if 0
+static void
+trunc_test (void)
+{
+  START (trunc);
+
+  TEST_f_f (trunc, plus_infty, plus_infty);
+  TEST_f_f (trunc, minus_infty, minus_infty);
+  TEST_f_f (trunc, nan_value, nan_value);
+
+  TEST_f_f (trunc, 0, 0);
+  TEST_f_f (trunc, minus_zero, minus_zero);
+  TEST_f_f (trunc, 0.625, 0);
+  TEST_f_f (trunc, -0.625, minus_zero);
+  TEST_f_f (trunc, 1, 1);
+  TEST_f_f (trunc, -1, -1);
+  TEST_f_f (trunc, 1.625, 1);
+  TEST_f_f (trunc, -1.625, -1);
+
+  TEST_f_f (trunc, 1048580.625L, 1048580L);
+  TEST_f_f (trunc, -1048580.625L, -1048580L);
+
+  TEST_f_f (trunc, 8388610.125L, 8388610.0L);
+  TEST_f_f (trunc, -8388610.125L, -8388610.0L);
+
+  TEST_f_f (trunc, 4294967296.625L, 4294967296.0L);
+  TEST_f_f (trunc, -4294967296.625L, -4294967296.0L);
+
+#ifdef TEST_LDOUBLE
+  /* The result can only be represented in long double.  */
+  TEST_f_f (trunc, 4503599627370495.5L, 4503599627370495.0L);
+  TEST_f_f (trunc, 4503599627370496.25L, 4503599627370496.0L);
+  TEST_f_f (trunc, 4503599627370496.5L, 4503599627370496.0L);
+  TEST_f_f (trunc, 4503599627370496.75L, 4503599627370496.0L);
+  TEST_f_f (trunc, 4503599627370497.5L, 4503599627370497.0L);
+
+  TEST_f_f (trunc, -4503599627370495.5L, -4503599627370495.0L);
+  TEST_f_f (trunc, -4503599627370496.25L, -4503599627370496.0L);
+  TEST_f_f (trunc, -4503599627370496.5L, -4503599627370496.0L);
+  TEST_f_f (trunc, -4503599627370496.75L, -4503599627370496.0L);
+  TEST_f_f (trunc, -4503599627370497.5L, -4503599627370497.0L);
+
+  TEST_f_f (trunc, 9007199254740991.5L, 9007199254740991.0L);
+  TEST_f_f (trunc, 9007199254740992.25L, 9007199254740992.0L);
+  TEST_f_f (trunc, 9007199254740992.5L, 9007199254740992.0L);
+  TEST_f_f (trunc, 9007199254740992.75L, 9007199254740992.0L);
+  TEST_f_f (trunc, 9007199254740993.5L, 9007199254740993.0L);
+
+  TEST_f_f (trunc, -9007199254740991.5L, -9007199254740991.0L);
+  TEST_f_f (trunc, -9007199254740992.25L, -9007199254740992.0L);
+  TEST_f_f (trunc, -9007199254740992.5L, -9007199254740992.0L);
+  TEST_f_f (trunc, -9007199254740992.75L, -9007199254740992.0L);
+  TEST_f_f (trunc, -9007199254740993.5L, -9007199254740993.0L);
+
+  TEST_f_f (trunc, 72057594037927935.5L, 72057594037927935.0L);
+  TEST_f_f (trunc, 72057594037927936.25L, 72057594037927936.0L);
+  TEST_f_f (trunc, 72057594037927936.5L, 72057594037927936.0L);
+  TEST_f_f (trunc, 72057594037927936.75L, 72057594037927936.0L);
+  TEST_f_f (trunc, 72057594037927937.5L, 72057594037927937.0L);
+
+  TEST_f_f (trunc, -72057594037927935.5L, -72057594037927935.0L);
+  TEST_f_f (trunc, -72057594037927936.25L, -72057594037927936.0L);
+  TEST_f_f (trunc, -72057594037927936.5L, -72057594037927936.0L);
+  TEST_f_f (trunc, -72057594037927936.75L, -72057594037927936.0L);
+  TEST_f_f (trunc, -72057594037927937.5L, -72057594037927937.0L);
+
+  TEST_f_f (trunc, 10141204801825835211973625643007.5L, 10141204801825835211973625643007.0L);
+  TEST_f_f (trunc, 10141204801825835211973625643008.25L, 10141204801825835211973625643008.0L);
+  TEST_f_f (trunc, 10141204801825835211973625643008.5L, 10141204801825835211973625643008.0L);
+  TEST_f_f (trunc, 10141204801825835211973625643008.75L, 10141204801825835211973625643008.0L);
+  TEST_f_f (trunc, 10141204801825835211973625643009.5L, 10141204801825835211973625643009.0L);
+#endif
+
+  END (trunc);
+}
+#endif
+
+#if defined __DO_XSI_MATH__
+static void
+y0_test (void)
+{
+  errno = 0;
+#if 0
+  FLOAT s, c;
+  FUNC (sincos) (0, &s, &c);
+  if (errno == ENOSYS)
+    /* Required function not implemented.  */
+    return;
+#endif
+  FUNC(y0) (1);
+  if (errno == ENOSYS)
+    /* Function not implemented.  */
+    return;
+
+  /* y0 is the Bessel function of the second kind of order 0 */
+  START (y0);
+
+  TEST_f_f (y0, -1.0, minus_infty, INVALID_EXCEPTION);
+  TEST_f_f (y0, 0.0, minus_infty);
+  TEST_f_f (y0, nan_value, nan_value);
+  TEST_f_f (y0, plus_infty, 0);
+
+  TEST_f_f (y0, 0.125L, -1.38968062514384052915582277745018693L);
+  TEST_f_f (y0, 0.75L, -0.137172769385772397522814379396581855L);
+  TEST_f_f (y0, 1.0, 0.0882569642156769579829267660235151628L);
+  TEST_f_f (y0, 1.5, 0.382448923797758843955068554978089862L);
+  TEST_f_f (y0, 2.0, 0.510375672649745119596606592727157873L);
+  TEST_f_f (y0, 8.0, 0.223521489387566220527323400498620359L);
+  TEST_f_f (y0, 10.0, 0.0556711672835993914244598774101900481L);
+
+  END (y0);
+}
+
+
+static void
+y1_test (void)
+{
+  errno = 0;
+#if 0
+  FLOAT s, c;
+  FUNC (sincos) (0, &s, &c);
+  if (errno == ENOSYS)
+    /* Required function not implemented.  */
+    return;
+#endif
+  FUNC(y1) (1);
+  if (errno == ENOSYS)
+    /* Function not implemented.  */
+    return;
+
+  /* y1 is the Bessel function of the second kind of order 1 */
+  START (y1);
+
+  TEST_f_f (y1, -1.0, minus_infty, INVALID_EXCEPTION);
+  TEST_f_f (y1, 0.0, minus_infty);
+  TEST_f_f (y1, plus_infty, 0);
+  TEST_f_f (y1, nan_value, nan_value);
+
+  TEST_f_f (y1, 0.125L, -5.19993611253477499595928744876579921L);
+  TEST_f_f (y1, 0.75L, -1.03759455076928541973767132140642198L);
+  TEST_f_f (y1, 1.0, -0.781212821300288716547150000047964821L);
+  TEST_f_f (y1, 1.5, -0.412308626973911295952829820633445323L);
+  TEST_f_f (y1, 2.0, -0.107032431540937546888370772277476637L);
+  TEST_f_f (y1, 8.0, -0.158060461731247494255555266187483550L);
+  TEST_f_f (y1, 10.0, 0.249015424206953883923283474663222803L);
+
+  END (y1);
+}
+
+
+static void
+yn_test (void)
+{
+  errno = 0;
+#if 0
+  FLOAT s, c;
+  FUNC (sincos) (0, &s, &c);
+  if (errno == ENOSYS)
+    /* Required function not implemented.  */
+    return;
+#endif
+  FUNC(yn) (1, 1);
+  if (errno == ENOSYS)
+    /* Function not implemented.  */
+    return;
+
+  /* yn is the Bessel function of the second kind of order n */
+  START (yn);
+
+  /* yn (0, x) == y0 (x)  */
+  TEST_ff_f (yn, 0, -1.0, minus_infty, INVALID_EXCEPTION);
+  TEST_ff_f (yn, 0, 0.0, minus_infty);
+  TEST_ff_f (yn, 0, nan_value, nan_value);
+  TEST_ff_f (yn, 0, plus_infty, 0);
+
+  TEST_ff_f (yn, 0, 0.125L, -1.38968062514384052915582277745018693L);
+  TEST_ff_f (yn, 0, 0.75L, -0.137172769385772397522814379396581855L);
+  TEST_ff_f (yn, 0, 1.0, 0.0882569642156769579829267660235151628L);
+  TEST_ff_f (yn, 0, 1.5, 0.382448923797758843955068554978089862L);
+  TEST_ff_f (yn, 0, 2.0, 0.510375672649745119596606592727157873L);
+  TEST_ff_f (yn, 0, 8.0, 0.223521489387566220527323400498620359L);
+  TEST_ff_f (yn, 0, 10.0, 0.0556711672835993914244598774101900481L);
+
+  /* yn (1, x) == y1 (x)  */
+  TEST_ff_f (yn, 1, -1.0, minus_infty, INVALID_EXCEPTION);
+  TEST_ff_f (yn, 1, 0.0, minus_infty);
+  TEST_ff_f (yn, 1, plus_infty, 0);
+  TEST_ff_f (yn, 1, nan_value, nan_value);
+
+  TEST_ff_f (yn, 1, 0.125L, -5.19993611253477499595928744876579921L);
+  TEST_ff_f (yn, 1, 0.75L, -1.03759455076928541973767132140642198L);
+  TEST_ff_f (yn, 1, 1.0, -0.781212821300288716547150000047964821L);
+  TEST_ff_f (yn, 1, 1.5, -0.412308626973911295952829820633445323L);
+  TEST_ff_f (yn, 1, 2.0, -0.107032431540937546888370772277476637L);
+  TEST_ff_f (yn, 1, 8.0, -0.158060461731247494255555266187483550L);
+  TEST_ff_f (yn, 1, 10.0, 0.249015424206953883923283474663222803L);
+
+  /* yn (3, x)  */
+  TEST_ff_f (yn, 3, plus_infty, 0);
+  TEST_ff_f (yn, 3, nan_value, nan_value);
+
+  TEST_ff_f (yn, 3, 0.125L, -2612.69757350066712600220955744091741L);
+  TEST_ff_f (yn, 3, 0.75L, -12.9877176234475433186319774484809207L);
+  TEST_ff_f (yn, 3, 1.0, -5.82151760596472884776175706442981440L);
+  TEST_ff_f (yn, 3, 2.0, -1.12778377684042778608158395773179238L);
+  TEST_ff_f (yn, 3, 10.0, -0.251362657183837329779204747654240998L);
+
+  /* yn (10, x)  */
+  TEST_ff_f (yn, 10, plus_infty, 0);
+  TEST_ff_f (yn, 10, nan_value, nan_value);
+
+  TEST_ff_f (yn, 10, 0.125L, -127057845771019398.252538486899753195L);
+  TEST_ff_f (yn, 10, 0.75L, -2133501638.90573424452445412893839236L);
+  TEST_ff_f (yn, 10, 1.0, -121618014.278689189288130426667971145L);
+  TEST_ff_f (yn, 10, 2.0, -129184.542208039282635913145923304214L);
+  TEST_ff_f (yn, 10, 10.0, -0.359814152183402722051986577343560609L);
+
+  END (yn);
+
+}
+#endif /* __DO_XSI_MATH__ */
+
+
+static void
+significand_test (void)
+{
+  /* significand returns the mantissa of the exponential representation.  */
+  START (significand);
+
+  TEST_f_f (significand, 4.0, 1.0);
+  TEST_f_f (significand, 6.0, 1.5);
+  TEST_f_f (significand, 8.0, 1.0);
+
+  END (significand);
+}
+
+
+static void
+initialize (void)
+{
+  fpstack_test ("start *init*");
+  plus_zero = 0.0;
+  nan_value = plus_zero / plus_zero;	/* Suppress GCC warning */
+
+  minus_zero = FUNC(copysign) (0.0, -1.0);
+  plus_infty = CHOOSE (HUGE_VALL, HUGE_VAL, HUGE_VALF,
+		       HUGE_VALL, HUGE_VAL, HUGE_VALF);
+  minus_infty = CHOOSE (-HUGE_VALL, -HUGE_VAL, -HUGE_VALF,
+			-HUGE_VALL, -HUGE_VAL, -HUGE_VALF);
+  max_value = CHOOSE (LDBL_MAX, DBL_MAX, FLT_MAX,
+		      LDBL_MAX, DBL_MAX, FLT_MAX);
+  min_value = CHOOSE (LDBL_MIN, DBL_MIN, FLT_MIN,
+		      LDBL_MIN, DBL_MIN, FLT_MIN);
+
+  (void) &plus_zero;
+  (void) &nan_value;
+  (void) &minus_zero;
+  (void) &plus_infty;
+  (void) &minus_infty;
+  (void) &max_value;
+  (void) &min_value;
+
+  /* Clear all exceptions.  From now on we must not get random exceptions.  */
+  feclearexcept (FE_ALL_EXCEPT);
+
+  /* Test to make sure we start correctly.  */
+  fpstack_test ("end *init*");
+}
+
+#if 0
+/* function to check our ulp calculation.  */
+void
+check_ulp (void)
+{
+  int i;
+
+  FLOAT u, diff, ulp;
+  /* This gives one ulp.  */
+  u = FUNC(nextafter) (10, 20);
+  check_equal (10.0, u, 1, &diff, &ulp);
+  printf ("One ulp: % .4" PRINTF_NEXPR "\n", ulp);
+
+  /* This gives one more ulp.  */
+  u = FUNC(nextafter) (u, 20);
+  check_equal (10.0, u, 2, &diff, &ulp);
+  printf ("two ulp: % .4" PRINTF_NEXPR "\n", ulp);
+
+  /* And now calculate 100 ulp.  */
+  for (i = 2; i < 100; i++)
+    u = FUNC(nextafter) (u, 20);
+  check_equal (10.0, u, 100, &diff, &ulp);
+  printf ("100 ulp: % .4" PRINTF_NEXPR "\n", ulp);
+}
+#endif
+
+int
+main (int argc, char **argv)
+{
+
+  int key;
+
+  verbose = 1;
+  output_ulps = 0;
+  output_max_error = 1;
+  output_points = 1;
+  /* XXX set to 0 for releases.  */
+  ignore_max_ulp = 0;
+
+  /* Parse and process arguments.  */
+  while ((key = getopt(argc, argv, "fi:puv")) > 0) {
+      switch (key)
+      {
+	  case 'f':
+	      output_max_error = 0;
+	      break;
+	  case 'i':
+	      if (strcmp (optarg, "yes") == 0)
+		  ignore_max_ulp = 1;
+	      else if (strcmp (optarg, "no") == 0)
+		  ignore_max_ulp = 0;
+	      break;
+	  case 'p':
+	      output_points = 0;
+	      break;
+	  case 'u':
+	      output_ulps = 1;
+	      break;
+	  case 'v':
+	      verbose = 3;
+	      break;
+	  default:
+	      fprintf (stderr, "Unknown argument: %c", key);
+	      exit (EXIT_FAILURE);
+      }
+  }
+
+  if (optind != argc)
+    {
+      fprintf (stderr, "wrong number of arguments");
+      exit (EXIT_FAILURE);
+    }
+
+  if (output_ulps)
+    {
+      ulps_file = fopen ("ULPs", "a");
+      if (ulps_file == NULL)
+	{
+	  perror ("can't open file `ULPs' for writing: ");
+	  exit (1);
+	}
+    }
+
+
+  initialize ();
+  printf (TEST_MSG);
+
+#if 0
+  check_ulp ();
+#endif
+
+  /* Keep the tests a wee bit ordered (according to ISO C99).  */
+  /* Classification macros:  */
+  fpclassify_test ();
+  isfinite_test ();
+  isnormal_test ();
+  signbit_test ();
+
+  /* Trigonometric functions:  */
+  acos_test ();
+  asin_test ();
+  atan_test ();
+  atan2_test ();
+  cos_test ();
+  sin_test ();
+#if 0
+  sincos_test ();
+#endif
+  tan_test ();
+
+  /* Hyperbolic functions:  */
+  acosh_test ();
+  asinh_test ();
+  atanh_test ();
+  cosh_test ();
+  sinh_test ();
+  tanh_test ();
+
+  /* Exponential and logarithmic functions:  */
+  exp_test ();
+#if 0
+  exp10_test ();
+  exp2_test ();
+#endif
+  expm1_test ();
+  frexp_test ();
+  ldexp_test ();
+  log_test ();
+  log10_test ();
+  log1p_test ();
+#if 0
+  log2_test ();
+#endif
+  logb_test ();
+  modf_test ();
+  ilogb_test ();
+  scalb_test ();
+  scalbn_test ();
+#if 0
+  scalbln_test ();
+#endif
+  significand_test ();
+
+  /* Power and absolute value functions:  */
+  cbrt_test ();
+  fabs_test ();
+  hypot_test ();
+  pow_test ();
+  sqrt_test ();
+
+  /* Error and gamma functions:  */
+  erf_test ();
+  erfc_test ();
+  gamma_test ();
+  lgamma_test ();
+#if 0
+  tgamma_test ();
+#endif
+
+  /* Nearest integer functions:  */
+  ceil_test ();
+  floor_test ();
+#if 0
+  nearbyint_test ();
+#endif
+  rint_test ();
+#if 0
+  rint_test_tonearest ();
+  rint_test_towardzero ();
+  rint_test_downward ();
+  rint_test_upward ();
+  lrint_test ();
+  llrint_test ();
+  round_test ();
+  lround_test ();
+  llround_test ();
+  trunc_test ();
+#endif
+
+  /* Remainder functions:  */
+  fmod_test ();
+  remainder_test ();
+#if 0
+  remquo_test ();
+#endif
+
+  /* Manipulation functions:  */
+  copysign_test ();
+#if 0
+  nextafter_test ();
+  nexttoward_test ();
+
+  /* maximum, minimum and positive difference functions */
+  fdim_test ();
+  fmax_test ();
+  fmin_test ();
+
+  /* Multiply and add:  */
+  fma_test ();
+
+  /* Complex functions:  */
+  cabs_test ();
+  cacos_test ();
+  cacosh_test ();
+  carg_test ();
+  casin_test ();
+  casinh_test ();
+  catan_test ();
+  catanh_test ();
+  ccos_test ();
+  ccosh_test ();
+  cexp_test ();
+  cimag_test ();
+  clog10_test ();
+  clog_test ();
+#if 0
+  conj_test ();
+#endif
+  cpow_test ();
+  cproj_test ();
+  creal_test ();
+  csin_test ();
+  csinh_test ();
+  csqrt_test ();
+  ctan_test ();
+  ctanh_test ();
+#endif
+
+  /* Bessel functions:  */
+#if defined __DO_XSI_MATH__
+  j0_test ();
+  j1_test ();
+  jn_test ();
+  y0_test ();
+  y1_test ();
+  yn_test ();
+#endif /* __DO_XSI_MATH__ */
+
+  if (output_ulps)
+    fclose (ulps_file);
+
+  printf ("\nTest suite completed:\n");
+  printf ("  %d test cases plus %d tests for exception flags executed.\n",
+	  noTests, noExcTests);
+  if (noXFails)
+    printf ("  %d expected failures occurred.\n", noXFails);
+  if (noXPasses)
+    printf ("  %d unexpected passes occurred.\n", noXPasses);
+  if (noErrors)
+    {
+      printf ("  %d errors occurred.\n", noErrors);
+      return 1;
+    }
+  printf ("  All tests passed successfully.\n");
+
+  return 0;
+}
+
+/*
+ * Local Variables:
+ * mode:c
+ * End:
+ */
diff --git a/ap/build/uClibc/test/math/rint.c b/ap/build/uClibc/test/math/rint.c
new file mode 100644
index 0000000..b595459
--- /dev/null
+++ b/ap/build/uClibc/test/math/rint.c
@@ -0,0 +1,33 @@
+#include <math.h>
+#include <float.h>
+#include <stdlib.h>
+#include <stdint.h>
+#include <stdio.h>
+
+#define check_d1(func, param, expected) \
+do { \
+	int err; hex_union ur; hex_union up; \
+	double result = func(param); up.f = param; ur.f = result; \
+	errors += (err = (result != (expected))); \
+	err \
+	? printf("FAIL: %s(%g/"HEXFMT")=%g/"HEXFMT" (expected %g)\n", \
+		#func, (double)(param), (long long)up.hex, result, (long long)ur.hex, (double)(expected)) \
+	: printf("PASS: %s(%g)=%g\n", #func, (double)(param), result); \
+} while (0)
+
+#define HEXFMT "%08llx"
+typedef union {
+	double f;
+	uint64_t hex;
+} hex_union;
+double result;
+
+int errors = 0;
+
+int main(void)
+{
+	check_d1(rint, 0.6, 1.0);
+
+	printf("Errors: %d\n", errors);
+	return errors;
+}
diff --git a/ap/build/uClibc/test/math/signgam.c b/ap/build/uClibc/test/math/signgam.c
new file mode 100644
index 0000000..2f1adba
--- /dev/null
+++ b/ap/build/uClibc/test/math/signgam.c
@@ -0,0 +1,28 @@
+#define _XOPEN_SOURCE 600
+#include <math.h>
+#include <float.h>
+#include <stdio.h>
+
+double zero = 0.0;
+double mzero;
+
+int main(void)
+{
+	double d;
+	int errors = 0;
+
+	mzero = copysign(zero, -1.0);
+
+	d = lgamma(zero);
+	printf("%g %d\n", d, signgam);
+	errors += !(d == HUGE_VAL);
+	errors += !(signgam == 1);
+
+	d = lgamma(mzero);
+	printf("%g %d\n", d, signgam);
+	errors += !(d == HUGE_VAL);
+	errors += !(signgam == -1);
+
+	printf("Errors: %d\n", errors);
+	return errors;
+}
diff --git a/ap/build/uClibc/test/math/test-double.c b/ap/build/uClibc/test/math/test-double.c
new file mode 100644
index 0000000..4d239a7
--- /dev/null
+++ b/ap/build/uClibc/test/math/test-double.c
@@ -0,0 +1,34 @@
+/* Copyright (C) 1997, 1999 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+   Contributed by Andreas Jaeger <aj@suse.de>, 1997.
+
+   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.  */
+
+#define FUNC(function) function
+#define FLOAT double
+#define TEST_MSG "testing double (without inline functions)\n"
+#define MATHCONST(x) x
+#define CHOOSE(Clongdouble,Cdouble,Cfloat,Cinlinelongdouble,Cinlinedouble,Cinlinefloat) Cdouble
+#define PRINTF_EXPR "e"
+#define PRINTF_XEXPR "a"
+#define PRINTF_NEXPR "f"
+#define TEST_DOUBLE 1
+
+#ifndef __NO_MATH_INLINES
+# define __NO_MATH_INLINES
+#endif
+
+#include "libm-test.c"
diff --git a/ap/build/uClibc/test/math/test-float.c b/ap/build/uClibc/test/math/test-float.c
new file mode 100644
index 0000000..26a4213
--- /dev/null
+++ b/ap/build/uClibc/test/math/test-float.c
@@ -0,0 +1,34 @@
+/* Copyright (C) 1997, 1999 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+   Contributed by Andreas Jaeger <aj@suse.de>, 1997.
+
+   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.  */
+
+#define FUNC(function) function ## f
+#define FLOAT float
+#define TEST_MSG "testing float (without inline functions)\n"
+#define MATHCONST(x) x
+#define CHOOSE(Clongdouble,Cdouble,Cfloat,Cinlinelongdouble,Cinlinedouble,Cinlinefloat) Cfloat
+#define PRINTF_EXPR "e"
+#define PRINTF_XEXPR "a"
+#define PRINTF_NEXPR "f"
+#define TEST_FLOAT 1
+
+#ifndef __NO_MATH_INLINES
+# define __NO_MATH_INLINES
+#endif
+
+#include "libm-test.c"
diff --git a/ap/build/uClibc/test/math/test-fpucw.c b/ap/build/uClibc/test/math/test-fpucw.c
new file mode 100644
index 0000000..6d638c6
--- /dev/null
+++ b/ap/build/uClibc/test/math/test-fpucw.c
@@ -0,0 +1,43 @@
+/* Copyright (C) 2000 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+   Contributed by Andreas Jaeger <aj@suse.de>, 2000.
+
+   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 <fpu_control.h>
+#include <stdio.h>
+
+int
+main (void)
+{
+#ifdef _FPU_GETCW
+/* Some architectures don't have _FPU_GETCW (e.g. Linux/Alpha).  */
+  fpu_control_t cw;
+
+  _FPU_GETCW (cw);
+
+  cw &= ~_FPU_RESERVED;
+
+  if (cw != (_FPU_DEFAULT & ~_FPU_RESERVED))
+    printf ("control word is 0x%lx but should be 0x%lx.\n",
+	    (long int) cw, (long int) (_FPU_DEFAULT & ~_FPU_RESERVED));
+
+  return cw != (_FPU_DEFAULT & ~_FPU_RESERVED);
+
+#else
+  return 0;
+#endif
+}
diff --git a/ap/build/uClibc/test/math/test-idouble.c b/ap/build/uClibc/test/math/test-idouble.c
new file mode 100644
index 0000000..7606a89
--- /dev/null
+++ b/ap/build/uClibc/test/math/test-idouble.c
@@ -0,0 +1,35 @@
+/* Copyright (C) 1997, 1999 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+   Contributed by Andreas Jaeger <aj@suse.de>, 1997.
+
+   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.  */
+
+#define FUNC(function) function
+#define FLOAT double
+#define TEST_MSG "testing double (inline functions)\n"
+#define MATHCONST(x) x
+#define CHOOSE(Clongdouble,Cdouble,Cfloat,Cinlinelongdouble,Cinlinedouble,Cinlinefloat) Cinlinedouble
+#define PRINTF_EXPR "e"
+#define PRINTF_XEXPR "a"
+#define PRINTF_NEXPR "f"
+#define TEST_DOUBLE 1
+#define TEST_INLINE
+
+#ifdef __NO_MATH_INLINES
+# undef __NO_MATH_INLINES
+#endif
+
+#include "libm-test.c"
diff --git a/ap/build/uClibc/test/math/test-ifloat.c b/ap/build/uClibc/test/math/test-ifloat.c
new file mode 100644
index 0000000..9eb9ce5
--- /dev/null
+++ b/ap/build/uClibc/test/math/test-ifloat.c
@@ -0,0 +1,35 @@
+/* Copyright (C) 1997, 1999 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+   Contributed by Andreas Jaeger <aj@suse.de>, 1997.
+
+   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.  */
+
+#define FUNC(function) function ## f
+#define FLOAT float
+#define TEST_MSG "testing float (inline functions)\n"
+#define MATHCONST(x) x
+#define CHOOSE(Clongdouble,Cdouble,Cfloat,Cinlinelongdouble,Cinlinedouble,Cinlinefloat) Cinlinefloat
+#define PRINTF_EXPR "e"
+#define PRINTF_XEXPR "a"
+#define PRINTF_NEXPR "f"
+#define TEST_FLOAT 1
+#define TEST_INLINE 1
+
+#ifdef __NO_MATH_INLINES
+# undef __NO_MATH_INLINES
+#endif
+
+#include "libm-test.c"
diff --git a/ap/build/uClibc/test/math/test-ildoubl.c b/ap/build/uClibc/test/math/test-ildoubl.c
new file mode 100644
index 0000000..597edbc
--- /dev/null
+++ b/ap/build/uClibc/test/math/test-ildoubl.c
@@ -0,0 +1,35 @@
+/* Copyright (C) 1997, 1999, 2001 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+   Contributed by Andreas Jaeger <aj@suse.de>, 1997.
+
+   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.  */
+
+#define FUNC(function) function##l
+#define FLOAT long double
+#define TEST_MSG "testing long double (inline functions)\n"
+#define MATHCONST(x) x##L
+#define CHOOSE(Clongdouble,Cdouble,Cfloat,Cinlinelongdouble,Cinlinedouble,Cinlinefloat) Cinlinelongdouble
+#define PRINTF_EXPR "Le"
+#define PRINTF_XEXPR "La"
+#define PRINTF_NEXPR "Lf"
+#define TEST_INLINE
+#define TEST_LDOUBLE 1
+
+#ifdef __NO_MATH_INLINES
+# undef __NO_MATH_INLINES
+#endif
+
+#include "libm-test.c"
diff --git a/ap/build/uClibc/test/math/test-ldouble.c b/ap/build/uClibc/test/math/test-ldouble.c
new file mode 100644
index 0000000..2721227
--- /dev/null
+++ b/ap/build/uClibc/test/math/test-ldouble.c
@@ -0,0 +1,34 @@
+/* Copyright (C) 1997, 1999, 2001 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+   Contributed by Andreas Jaeger <aj@suse.de>, 1997.
+
+   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.  */
+
+#define FUNC(function) function##l
+#define FLOAT long double
+#define TEST_MSG "testing long double (without inline functions)\n"
+#define MATHCONST(x) x##L
+#define CHOOSE(Clongdouble,Cdouble,Cfloat,Cinlinelongdouble,Cinlinedouble,Cinlinefloat) Clongdouble
+#define PRINTF_EXPR "Le"
+#define PRINTF_XEXPR "La"
+#define PRINTF_NEXPR "Lf"
+#define TEST_LDOUBLE 1
+
+#ifndef __NO_MATH_INLINES
+# define __NO_MATH_INLINES
+#endif
+
+#include "libm-test.c"
diff --git a/ap/build/uClibc/test/math/tst-definitions.c b/ap/build/uClibc/test/math/tst-definitions.c
new file mode 100644
index 0000000..7d352af
--- /dev/null
+++ b/ap/build/uClibc/test/math/tst-definitions.c
@@ -0,0 +1,47 @@
+/* Copyright (C) 2000 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+   Contributed by Ulrich Drepper <drepper@redhat.com>, 2000.
+
+   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 <limits.h>
+#include <math.h>
+#include <stdio.h>
+
+
+int
+main (void)
+{
+  int result = 0;
+
+  if (FP_ILOGB0 != INT_MIN && FP_ILOGB0 != -INT_MAX)
+    {
+      puts ("FP_ILOGB0 has no valid value");
+      result = 1;
+    }
+  else
+    puts ("FP_ILOGB0 value is OK");
+
+  if (FP_ILOGBNAN != INT_MIN && FP_ILOGBNAN != INT_MAX)
+    {
+      puts ("FP_ILOBNAN has no valid value");
+      result = 1;
+    }
+  else
+    puts ("FP_ILOGBNAN value is OK");
+
+  return result;
+}
diff --git a/ap/build/uClibc/test/misc/Makefile b/ap/build/uClibc/test/misc/Makefile
new file mode 100644
index 0000000..52f6c67
--- /dev/null
+++ b/ap/build/uClibc/test/misc/Makefile
@@ -0,0 +1,7 @@
+# uClibc misc tests
+# Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
+
+top_builddir=../../
+include ../Rules.mak
+-include Makefile.in
+include ../Test.mak
diff --git a/ap/build/uClibc/test/misc/Makefile.in b/ap/build/uClibc/test/misc/Makefile.in
new file mode 100644
index 0000000..2263211
--- /dev/null
+++ b/ap/build/uClibc/test/misc/Makefile.in
@@ -0,0 +1,14 @@
+# uClibc misc tests
+# Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
+
+TESTS_DISABLED := outb tst-fnmatch bug-glob1 tst-gnuglob
+ifeq  ($(UCLIBC_HAS_LFS),)
+TESTS_DISABLED += dirent64
+endif
+CFLAGS_dirent64 := -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64
+
+DODIFF_dirent    := 1
+DODIFF_dirent64  := 1
+
+OPTS_bug-glob1   := $(PWD)
+OPTS_tst-fnmatch := < tst-fnmatch.input
diff --git a/ap/build/uClibc/test/misc/bug-glob1.c b/ap/build/uClibc/test/misc/bug-glob1.c
new file mode 100644
index 0000000..276983a
--- /dev/null
+++ b/ap/build/uClibc/test/misc/bug-glob1.c
@@ -0,0 +1,92 @@
+/* Test case for globbing dangling symlink.  By Ulrich Drepper.  */
+#include <errno.h>
+#include <error.h>
+#include <glob.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <unistd.h>
+
+
+static void prepare (int argc, char *argv[]);
+#define PREPARE prepare
+static int do_test (void);
+#define TEST_FUNCTION do_test ()
+
+#include "../test-skeleton.c"
+
+
+static char *fname;
+
+static void
+prepare (int argc, char *argv[])
+{
+  if (argc < 2)
+    error (EXIT_FAILURE, 0, "missing argument");
+
+  size_t len = strlen (argv[1]);
+  static const char ext[] = "globXXXXXX";
+  fname = malloc (len + sizeof (ext));
+  if (fname == NULL)
+    error (EXIT_FAILURE, errno, "cannot create temp file");
+ again:
+  strcpy (stpcpy (fname, argv[1]), ext);
+
+/* fname = mktemp (fname); */
+  close(mkstemp(fname));
+  unlink(fname);
+
+  if (fname == NULL || *fname == '\0')
+    error (EXIT_FAILURE, errno, "cannot create temp file name");
+  if (symlink ("bug-glob1-does-not-exist", fname) != 0)
+    {
+      if (errno == EEXIST)
+	goto again;
+
+      error (EXIT_FAILURE, errno, "cannot create symlink");
+    }
+  add_temp_file (fname);
+}
+
+
+static int
+do_test (void)
+{
+  glob_t gl;
+  int retval = 0;
+  int e;
+
+  e = glob (fname, 0, NULL, &gl);
+  if (e == 0)
+    {
+      printf ("glob(\"%s\") succeeded when it should not have\n", fname);
+      retval = 1;
+    }
+  globfree (&gl);
+
+  size_t fnamelen = strlen (fname);
+  char buf[fnamelen + 2];
+
+  strcpy (buf, fname);
+  buf[fnamelen - 1] = '?';
+  e = glob (buf, 0, NULL, &gl);
+  if (e == 0)
+    {
+      printf ("glob(\"%s\") succeeded when it should not have\n", buf);
+      retval = 1;
+    }
+  globfree (&gl);
+
+  strcpy (buf, fname);
+  buf[fnamelen] = '*';
+  buf[fnamelen + 1] = '\0';
+  e = glob (buf, 0, NULL, &gl);
+  if (e == 0)
+    {
+      printf ("glob(\"%s\") succeeded when it should not have\n", buf);
+      retval = 1;
+    }
+  globfree (&gl);
+
+  return retval;
+}
diff --git a/ap/build/uClibc/test/misc/bug-glob2.c b/ap/build/uClibc/test/misc/bug-glob2.c
new file mode 100644
index 0000000..f8b030e
--- /dev/null
+++ b/ap/build/uClibc/test/misc/bug-glob2.c
@@ -0,0 +1,302 @@
+/* Test glob memory management.
+   for the filesystem access functions.
+   Copyright (C) 2001, 2002, 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.  */
+
+#include <errno.h>
+#include <error.h>
+#include <dirent.h>
+#include <glob.h>
+#include <stdlib.h>
+#include <stdio.h>
+#include <string.h>
+#include <sys/stat.h>
+
+// #define DEBUG
+#ifdef DEBUG
+# define PRINTF(fmt, args...) \
+  do					\
+    {					\
+      int save_errno = errno;		\
+      printf (fmt, ##args);		\
+      errno = save_errno;		\
+    } while (0)
+#else
+# define PRINTF(fmt, args...)
+#endif
+
+
+#ifdef GLOB_ALTDIRFUNC
+static struct
+{
+  const char *name;
+  int level;
+  int type;
+  mode_t mode;
+} filesystem[] =
+{
+  { ".", 1, DT_DIR, 0755 },
+  { "..", 1, DT_DIR, 0755 },
+  { "dir", 1, DT_DIR, 0755 },
+    { ".", 2, DT_DIR, 0755 },
+    { "..", 2, DT_DIR, 0755 },
+    { "readable", 2, DT_DIR, 0755 },
+      { ".", 3, DT_DIR, 0755 },
+      { "..", 3, DT_DIR, 0755 },
+      { "a", 3, DT_REG, 0644 },
+    { "unreadable", 2, DT_DIR, 0111 },
+      { ".", 3, DT_DIR, 0111 },
+      { "..", 3, DT_DIR, 0755 },
+      { "a", 3, DT_REG, 0644 },
+    { "zz-readable", 2, DT_DIR, 0755 },
+      { ".", 3, DT_DIR, 0755 },
+      { "..", 3, DT_DIR, 0755 },
+      { "a", 3, DT_REG, 0644 }
+};
+#define nfiles (sizeof (filesystem) / sizeof (filesystem[0]))
+
+
+typedef struct
+{
+  int level;
+  int idx;
+  struct dirent d;
+  char room_for_dirent[NAME_MAX];
+} my_DIR;
+
+
+static long int
+find_file (const char *s)
+{
+  int level = 1;
+  long int idx = 0;
+
+  if (strcmp (s, ".") == 0)
+    return 0;
+
+  if (s[0] == '.' && s[1] == '/')
+    s += 2;
+
+  while (*s != '\0')
+    {
+      char *endp = strchrnul (s, '/');
+
+      PRINTF ("looking for %.*s, level %d\n", (int) (endp - s), s, level);
+
+      while (idx < nfiles && filesystem[idx].level >= level)
+	{
+	  if (filesystem[idx].level == level
+	      && memcmp (s, filesystem[idx].name, endp - s) == 0
+	      && filesystem[idx].name[endp - s] == '\0')
+	    break;
+	  ++idx;
+	}
+
+      if (idx == nfiles || filesystem[idx].level < level)
+	{
+	  errno = ENOENT;
+	  return -1;
+	}
+
+      if (*endp == '\0')
+	return idx + 1;
+
+      if (filesystem[idx].type != DT_DIR
+	  && (idx + 1 >= nfiles
+	      || filesystem[idx].level >= filesystem[idx + 1].level))
+	{
+	  errno = ENOTDIR;
+	  return -1;
+	}
+
+      ++idx;
+
+      s = endp + 1;
+      ++level;
+    }
+
+  errno = ENOENT;
+  return -1;
+}
+
+
+static void *
+my_opendir (const char *s)
+{
+  long int idx = find_file (s);
+  my_DIR *dir;
+
+  if (idx == -1)
+    {
+      PRINTF ("my_opendir(\"%s\") == NULL (%m)\n", s);
+      return NULL;
+    }
+
+  if ((filesystem[idx].mode & 0400) == 0)
+    {
+      errno = EACCES;
+      PRINTF ("my_opendir(\"%s\") == NULL (%m)\n", s);
+      return NULL;
+    }
+
+  dir = (my_DIR *) malloc (sizeof (my_DIR));
+  if (dir == NULL)
+    {
+      printf ("cannot allocate directory handle: %m\n");
+      exit (EXIT_FAILURE);
+    }
+
+  dir->level = filesystem[idx].level;
+  dir->idx = idx;
+
+  PRINTF ("my_opendir(\"%s\") == { level: %d, idx: %ld }\n",
+	  s, filesystem[idx].level, idx);
+
+  return dir;
+}
+
+
+static struct dirent *
+my_readdir (void *gdir)
+{
+  my_DIR *dir = gdir;
+
+  if (dir->idx == -1)
+    {
+      PRINTF ("my_readdir ({ level: %d, idx: %ld }) = NULL\n",
+	      dir->level, (long int) dir->idx);
+      return NULL;
+    }
+
+  while (dir->idx < nfiles && filesystem[dir->idx].level > dir->level)
+    ++dir->idx;
+
+  if (dir->idx == nfiles || filesystem[dir->idx].level < dir->level)
+    {
+      dir->idx = -1;
+      PRINTF ("my_readdir ({ level: %d, idx: %ld }) = NULL\n",
+	      dir->level, (long int) dir->idx);
+      return NULL;
+    }
+
+  dir->d.d_ino = dir->idx;
+
+#ifdef _DIRENT_HAVE_D_TYPE
+  dir->d.d_type = filesystem[dir->idx].type;
+#endif
+
+  strcpy (dir->d.d_name, filesystem[dir->idx].name);
+
+#ifdef _DIRENT_HAVE_D_TYPE
+  PRINTF ("my_readdir ({ level: %d, idx: %ld }) = { d_ino: %ld, d_type: %d, d_name: \"%s\" }\n",
+	  dir->level, (long int) dir->idx, dir->d.d_ino, dir->d.d_type,
+	  dir->d.d_name);
+#else
+  PRINTF ("my_readdir ({ level: %d, idx: %ld }) = { d_ino: %ld, d_name: \"%s\" }\n",
+	  dir->level, (long int) dir->idx, dir->d.d_ino,
+	  dir->d.d_name);
+#endif
+
+  ++dir->idx;
+
+  return &dir->d;
+}
+
+
+static void
+my_closedir (void *dir)
+{
+  PRINTF ("my_closedir ()\n");
+  free (dir);
+}
+
+
+/* We use this function for lstat as well since we don't have any.  */
+static int
+my_stat (const char *name, struct stat *st)
+{
+  long int idx = find_file (name);
+
+  if (idx == -1)
+    {
+      PRINTF ("my_stat (\"%s\", ...) = -1 (%m)\n", name);
+      return -1;
+    }
+
+  memset (st, '\0', sizeof (*st));
+
+  if (filesystem[idx].type == DT_UNKNOWN)
+    st->st_mode = DTTOIF (idx + 1 < nfiles
+			  && filesystem[idx].level < filesystem[idx + 1].level
+			  ? DT_DIR : DT_REG) | filesystem[idx].mode;
+  else
+    st->st_mode = DTTOIF (filesystem[idx].type) | filesystem[idx].mode;
+
+  PRINTF ("my_stat (\"%s\", { st_mode: %o }) = 0\n", name, st->st_mode);
+
+  return 0;
+}
+
+
+static void
+init_glob_altdirfuncs (glob_t *pglob)
+{
+  pglob->gl_closedir = my_closedir;
+  pglob->gl_readdir = my_readdir;
+  pglob->gl_opendir = my_opendir;
+  pglob->gl_lstat = my_stat;
+  pglob->gl_stat = my_stat;
+}
+
+
+static int
+do_test (void)
+{
+  glob_t gl;
+  memset (&gl, 0, sizeof (gl));
+  init_glob_altdirfuncs (&gl);
+
+  if (glob ("dir/*able/*", GLOB_ERR | GLOB_ALTDIRFUNC, NULL, &gl)
+      != GLOB_ABORTED)
+    {
+      puts ("glob did not fail with GLOB_ABORTED");
+      exit (EXIT_FAILURE);
+    }
+
+  globfree (&gl);
+
+  memset (&gl, 0, sizeof (gl));
+  init_glob_altdirfuncs (&gl);
+
+  gl.gl_offs = 3;
+  if (glob ("dir2/*", GLOB_DOOFFS, NULL, &gl) != GLOB_NOMATCH)
+    {
+      puts ("glob did not fail with GLOB_NOMATCH");
+      exit (EXIT_FAILURE);
+    }
+
+  globfree (&gl);
+
+  return 0;
+}
+#else
+static int do_test (void) { return 0; }
+#endif
+
+#define TEST_FUNCTION do_test ()
+#include "../test-skeleton.c"
diff --git a/ap/build/uClibc/test/misc/bug-readdir1.c b/ap/build/uClibc/test/misc/bug-readdir1.c
new file mode 100644
index 0000000..a8594a8
--- /dev/null
+++ b/ap/build/uClibc/test/misc/bug-readdir1.c
@@ -0,0 +1,37 @@
+#include <dirent.h>
+#include <errno.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <unistd.h>
+#include <sys/types.h>
+
+
+int
+main (void)
+{
+  DIR *dirp;
+  struct dirent* ent;
+
+  /* open a dir stream */
+  dirp = opendir ("/tmp");
+  if (dirp == NULL)
+    {
+      if (errno == ENOENT)
+	exit (0);
+
+      perror ("opendir");
+      exit (1);
+    }
+
+  /* close the directory file descriptor, making it invalid */
+  if (close (dirfd (dirp)) != 0)
+    {
+      puts ("could not close directory file descriptor");
+      /* This is not an error.  It is not guaranteed this is possible.  */
+      return 0;
+    }
+
+  ent = readdir (dirp);
+
+  return ent != NULL || errno != EBADF;
+}
diff --git a/ap/build/uClibc/test/misc/dirent.c b/ap/build/uClibc/test/misc/dirent.c
new file mode 100644
index 0000000..491e3cf
--- /dev/null
+++ b/ap/build/uClibc/test/misc/dirent.c
@@ -0,0 +1,39 @@
+#include <stdio.h>
+#include <stdlib.h>
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <fcntl.h>
+#include <dirent.h>
+
+#define _DTIFY(DT) [DT] #DT
+const char * const types[] = {
+	_DTIFY(DT_UNKNOWN),
+	_DTIFY(DT_FIFO),
+	_DTIFY(DT_CHR),
+	_DTIFY(DT_DIR),
+	_DTIFY(DT_BLK),
+	_DTIFY(DT_REG),
+	_DTIFY(DT_LNK),
+	_DTIFY(DT_SOCK),
+	_DTIFY(DT_WHT)
+};
+
+int main(int argc, char *argv[])
+{
+	DIR *dirh;
+	struct dirent *de;
+	const char *mydir = (argc == 1 ? "/" : argv[1]);
+
+	if ((dirh = opendir(mydir)) == NULL) {
+		perror("opendir");
+		return 1;
+	}
+
+	printf("readdir() says:\n");
+	while ((de = readdir(dirh)) != NULL)
+		printf("\tdir entry %s: %s\n", types[de->d_type], de->d_name);
+
+	closedir(dirh);
+
+	return 0;
+}
diff --git a/ap/build/uClibc/test/misc/dirent64.c b/ap/build/uClibc/test/misc/dirent64.c
new file mode 100644
index 0000000..26455ab
--- /dev/null
+++ b/ap/build/uClibc/test/misc/dirent64.c
@@ -0,0 +1 @@
+#include "dirent.c"
diff --git a/ap/build/uClibc/test/misc/fdopen.c b/ap/build/uClibc/test/misc/fdopen.c
new file mode 100644
index 0000000..97e66de
--- /dev/null
+++ b/ap/build/uClibc/test/misc/fdopen.c
@@ -0,0 +1,52 @@
+/* Test for fdopen bugs.  */
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <unistd.h>
+#include <fcntl.h>
+
+#define assert(x) \
+  if (!(x)) \
+    { \
+      fputs ("test failed: " #x "\n", stderr); \
+      retval = 1; \
+      goto the_end; \
+    }
+
+int
+main (int argc, char *argv[])
+{
+  char name[256];
+  FILE *fp = NULL;
+  int retval = 0;
+  int fd;
+
+  /* hack to get a tempfile name w/out using tmpname()
+   * as that func causes a link time warning */
+  sprintf(name, "%s-uClibc-test.XXXXXX", __FILE__);
+  fd = mkstemp(name);
+  close(fd);
+
+  fp = fopen (name, "w");
+  assert (fp != NULL)
+  assert (fputs ("foobar and baz", fp) > 0);
+  assert (fclose (fp) == 0);
+  fp = NULL;
+
+  fd = open (name, O_RDWR|O_CREAT, 0660);
+  assert (fd != -1);
+  assert (lseek (fd, 5, SEEK_SET) == 5);
+
+  fp = fdopen (fd, "a");
+  assert (fp != NULL);
+  /* SuSv3 says that doing a fdopen() does not reset the file position,
+   * thus the '5' here is correct, not '14'. */
+  assert (ftell (fp) == 5);
+
+the_end:
+  if (fp != NULL)
+    assert (fclose (fp) == 0);
+  unlink (name);
+
+  return retval;
+}
diff --git a/ap/build/uClibc/test/misc/opendir-tst1.c b/ap/build/uClibc/test/misc/opendir-tst1.c
new file mode 100644
index 0000000..fb6ea26
--- /dev/null
+++ b/ap/build/uClibc/test/misc/opendir-tst1.c
@@ -0,0 +1,96 @@
+/* Copyright (C) 1998, 2000 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+   Contributed by Ulrich Drepper <drepper@cygnus.com>, 1998.
+
+   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 <dirent.h>
+#include <errno.h>
+#include <fcntl.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <unistd.h>
+#include <sys/stat.h>
+
+/* Name of the FIFO.  */
+char tmpname[] = "fifoXXXXXX";
+
+
+/* Do the real work.  */
+static int
+real_test (void)
+{
+  DIR *dirp;
+
+  /* This should not block for an FIFO.  */
+  dirp = opendir (tmpname);
+
+  /* Successful.  */
+  if (dirp != NULL)
+    {
+      /* Oh, oh, how can this work?  */
+      fputs ("`opendir' succeeded on a FIFO???\n", stdout);
+      closedir (dirp);
+      return 1;
+    }
+
+  if (errno != ENOTDIR)
+    {
+      fprintf (stdout, "`opendir' return error `%s' instead of `%s'\n",
+	       strerror (errno), strerror (ENOTDIR));
+      return 1;
+    }
+
+  return 0;
+}
+
+
+static int
+do_test (int argc, char *argv[])
+{
+  int retval;
+
+  retval = mkstemp(tmpname);
+  close(retval);
+  unlink(tmpname);
+
+  /* Try to generate a FIFO.  */
+  if (mknod (tmpname, 0600 | S_IFIFO, 0) < 0)
+    {
+      perror ("mknod");
+      /* We cannot make this an error.  */
+      return 0;
+    }
+
+  retval = real_test ();
+
+  remove (tmpname);
+
+  return retval;
+}
+
+
+static void
+do_cleanup (void)
+{
+  remove (tmpname);
+}
+#define CLEANUP_HANDLER do_cleanup ()
+
+
+/* Include the test skeleton.  */
+#include "../test-skeleton.c"
diff --git a/ap/build/uClibc/test/misc/outb.c b/ap/build/uClibc/test/misc/outb.c
new file mode 100644
index 0000000..bbe18ea
--- /dev/null
+++ b/ap/build/uClibc/test/misc/outb.c
@@ -0,0 +1,9 @@
+#include <sys/io.h>
+
+int main(void)
+{
+    ioperm(0x340,0x342,1);
+    outb(0x340,0x0);
+    exit(0);
+}
+
diff --git a/ap/build/uClibc/test/misc/popen.c b/ap/build/uClibc/test/misc/popen.c
new file mode 100644
index 0000000..868b70e
--- /dev/null
+++ b/ap/build/uClibc/test/misc/popen.c
@@ -0,0 +1,47 @@
+#include <unistd.h>
+#include <stdio.h>
+#include <errno.h>
+#include <string.h>
+#include <signal.h>
+
+#define TEST(r, f, x, m) ( \
+((r) = (f)) == (x) || \
+(printf(__FILE__ ":%d: %s failed (" m ")\n", __LINE__, #f, r, x), err++, 0) )
+
+#define TEST_E(f) ( (errno = 0), (f) || \
+(printf(__FILE__ ":%d: %s failed (errno = %d)\n", __LINE__, #f, errno), err++, 0) )
+
+#define TEST_S(s, x, m) ( \
+!strcmp((s),(x)) || \
+(printf(__FILE__ ":%d: [%s] != [%s] (%s)\n", __LINE__, s, x, m), err++, 0) )
+
+static sig_atomic_t got_sig;
+
+static void handler(int sig)
+{
+	got_sig = 1;
+}
+
+int main(void)
+{
+	int i;
+	char foo[6];
+	char cmd[64];
+	int err = 0;
+	FILE *f;
+
+	TEST_E(f = popen("echo hello", "r"));
+	TEST_E(fgets(foo, sizeof foo, f));
+	TEST_S(foo, "hello", "child process did not say hello");
+	TEST(i, pclose(f), 0, "exit status %04x != %04x");
+
+	signal(SIGUSR1, handler);
+	snprintf(cmd, sizeof cmd, "read a ; test \"x$a\" = xhello && kill -USR1 %d", getpid());
+	TEST_E(f = popen(cmd, "w"));
+	TEST_E(fputs("hello", f) >= 0);
+	TEST(i, pclose(f), 0, "exit status %04x != %04x");
+	signal(SIGUSR1, SIG_DFL);
+	TEST(i, got_sig, 1, "child process did not send signal (%i!=%i)");
+
+	return err;
+}
diff --git a/ap/build/uClibc/test/misc/seek.c b/ap/build/uClibc/test/misc/seek.c
new file mode 100644
index 0000000..c5edb94
--- /dev/null
+++ b/ap/build/uClibc/test/misc/seek.c
@@ -0,0 +1,82 @@
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <fcntl.h>
+#include <unistd.h>
+#include <assert.h>
+
+#define ARRAY_SIZE(arr) (sizeof(arr)/sizeof(*arr))
+
+int main(void)
+{
+	struct {
+		off_t offset;
+		int   whence;
+	} tests[] = {
+		{ 0x00, SEEK_SET },
+		{ 0x01, SEEK_SET },
+		{ 0xFF, SEEK_SET }
+	};
+	char buf[2000];
+	off_t ret;
+	int i, fd;
+	FILE *fp;
+	int tmp;
+
+	fd = open("lseek.out", O_RDWR|O_CREAT, 0600);
+	if (fd == -1) {
+		perror("open(lseek.out) failed");
+		return 1;
+	}
+	unlink("lseek.out");
+	fp = fdopen(fd, "rw");
+	if (fp == NULL) {
+		perror("fopen(lseek.out) failed");
+		return 1;
+	}
+
+	memset(buf, 0xAB, sizeof(buf));
+	ret = write(fd, buf, sizeof(buf));
+	if (ret != sizeof(buf)) {
+		fprintf(stderr, "write() failed to write %zi bytes (wrote %li): ", sizeof(buf), (long)ret);
+		perror("");
+		return 1;
+	}
+
+	tmp = fseeko(fp, 1024, SEEK_SET);
+	assert(tmp == 0);
+	tmp = fseeko(fp, (off_t)-16, SEEK_CUR);
+	assert(tmp == 0);
+	ret = ftell(fp);
+	if (ret != (1024-16)) {
+		fprintf(stderr, "ftell() failed, we wanted pos %i but got %li: ", (1024-16), (long)ret);
+		perror("");
+		return 1;
+	}
+
+	for (i = 0; i < ARRAY_SIZE(tests); ++i) {
+		ret = lseek(fd, tests[i].offset, tests[i].whence);
+		if (ret != tests[i].offset) {
+			fprintf(stderr, "lseek(%li,%i) failed (wanted %li, got %li): ", (long)tests[i].offset,
+			        tests[i].whence, (long)tests[i].offset, (long)ret);
+			perror("");
+			return 1;
+		}
+		ret = fseek(fp, tests[i].offset, tests[i].whence);
+		if (ret != 0) {
+			fprintf(stderr, "fseek(%li,%i) failed (wanted 0, got %li): ", (long)tests[i].offset,
+			        tests[i].whence, (long)ret);
+			perror("");
+			return 1;
+		}
+	}
+
+	fclose(fp);
+	close(fd);
+
+	printf("Success!\n");
+
+	return 0;
+}
diff --git a/ap/build/uClibc/test/misc/sem.c b/ap/build/uClibc/test/misc/sem.c
new file mode 100644
index 0000000..62a59b1
--- /dev/null
+++ b/ap/build/uClibc/test/misc/sem.c
@@ -0,0 +1,45 @@
+#include <stdio.h>
+#include <string.h>
+#include <errno.h>
+#include <sys/types.h>
+#include <sys/ipc.h>
+#include <sys/sem.h>
+
+int main(void)
+{
+	int k, r;
+	union semun {
+		int val;
+		struct semid_ds *buf;
+		unsigned short int *array;
+		struct seminfo *__buf;
+	} sd;
+	struct semid_ds sd_buf;
+
+	k = semget(IPC_PRIVATE, 10, IPC_CREAT | 0666 );
+	printf("semget(IPC_CREAT) = %d\n", k);
+
+	if (k < 0) {
+		fprintf(stderr, "semget failed: %s\n", strerror(errno));
+		return 1;
+	}
+
+	sd.buf = &sd_buf;
+	r = semctl(k, 0, IPC_STAT, sd);
+	printf("semctl(k) = %d\n", r);
+
+	if (r < 0) {
+		perror("semctl IPC_STAT failed");
+		return 1;
+	}
+
+	printf("sem_nsems = %lu\n", sd_buf.sem_nsems);
+	if (sd_buf.sem_nsems != 10) {
+		fprintf(stderr, "failed: incorrect sem_nsems!\n");
+		return 1;
+	}
+
+	printf("succeeded\n");
+
+	return 0;
+}
diff --git a/ap/build/uClibc/test/misc/stdarg.c b/ap/build/uClibc/test/misc/stdarg.c
new file mode 100644
index 0000000..1566e0c
--- /dev/null
+++ b/ap/build/uClibc/test/misc/stdarg.c
@@ -0,0 +1,23 @@
+/* copied from rsync */
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <sys/types.h>
+#include <stdarg.h>
+static int foo(const char *format, ...)
+{
+	va_list ap;
+	size_t len;
+	char buf[5];
+
+	va_start(ap, format);
+	len = vsnprintf(0, 0, format, ap);
+	va_end(ap);
+	if (len != 5) return(1);
+
+	if (snprintf(buf, 3, "hello") != 5 || strcmp(buf, "he") != 0) return(1);
+
+	return(0);
+}
+int main(void) { return foo("hello"); }
diff --git a/ap/build/uClibc/test/misc/tst-fnmatch.c b/ap/build/uClibc/test/misc/tst-fnmatch.c
new file mode 100644
index 0000000..bb102c5
--- /dev/null
+++ b/ap/build/uClibc/test/misc/tst-fnmatch.c
@@ -0,0 +1,444 @@
+/* Tests for fnmatch function.
+   Copyright (C) 2000, 2001 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 <errno.h>
+#include <error.h>
+#include <fnmatch.h>
+#include <locale.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <ctype.h>
+#include <sys/types.h>
+
+
+static char *next_input (char **line, int first, int last);
+static int convert_flags (const char *str);
+static char *flag_output (int flags);
+static char *escape (const char *str, size_t *reslenp, char **resbuf);
+
+
+int str_isalpha(const char *str)
+{
+	size_t i = strlen(str);
+	while (i--)
+		if (isascii(str[i]) == 0)
+			return 0;
+	return 1;
+}
+int str_has_funk(const char *str, const char x)
+{
+	size_t i, max = strlen(str);
+	for (i=0; i+1<max; ++i)
+		if (str[i] == '[' && str[i+1] == x)
+			return 1;
+	return 0;
+}
+
+
+int
+main (void)
+{
+  char *linebuf = NULL;
+  size_t linebuflen = 0;
+  int ntests = 0;
+  int nfailed = 0;
+  int nskipped = 0;
+  char *escinput = NULL;
+  size_t escinputlen = 0;
+  char *escpattern = NULL;
+  size_t escpatternlen = 0;
+  int nr = 0;
+
+  /* Read lines from stdin with the following format:
+
+       locale  input-string  match-string  flags  result
+
+     where `result' is either 0 or 1.  If the first character of a
+     string is '"' we read until the next '"' and handled escaped '"'.  */
+  while (! feof (stdin))
+    {
+      ssize_t n = getline (&linebuf, &linebuflen, stdin);
+      char *cp;
+      const char *locale;
+      const char *input;
+      const char *pattern;
+      const char *result_str;
+      int result;
+      const char *flags;
+      int flags_val;
+      int fnmres;
+      char numbuf[24];
+
+      if (n == -1)
+	break;
+
+      if (n == 0)
+	/* Maybe an empty line.  */
+	continue;
+
+      /* Skip over all leading white spaces.  */
+      cp = linebuf;
+
+      locale = next_input (&cp, 1, 0);
+      if (locale == NULL)
+	continue;
+
+      input = next_input (&cp, 0, 0);
+      if (input == NULL)
+	continue;
+
+      pattern = next_input (&cp, 0, 0);
+      if (pattern == NULL)
+	continue;
+
+      result_str = next_input (&cp, 0, 0);
+      if (result_str == NULL)
+	continue;
+
+      if (strcmp (result_str, "0") == 0)
+	result = 0;
+      else if  (strcasecmp (result_str, "NOMATCH") == 0)
+	result = FNM_NOMATCH;
+      else
+	{
+	  char *endp;
+	  result = strtol (result_str, &endp, 0);
+	  if (*endp != '\0')
+	    continue;
+	}
+
+      flags = next_input (&cp, 0, 1);
+      if (flags == NULL)
+	/* We allow the flags missing.  */
+	flags = "";
+
+      /* Convert the text describing the flags in a numeric value.  */
+      flags_val = convert_flags (flags);
+      if (flags_val == -1)
+	/* Something went wrong.  */
+	continue;
+
+      /* Now run the actual test.  */
+      ++ntests;
+
+#ifdef __UCLIBC_HAS_XLOCALE__
+      if (setlocale (LC_COLLATE, locale) == NULL
+	  || setlocale (LC_CTYPE, locale) == NULL)
+	{
+	  puts ("*** Cannot set locale");
+	  ++nfailed;
+	  continue;
+	}
+#else
+      /* skip non-ascii strings */
+      if (!str_isalpha(pattern) || !str_isalpha(input))
+	{
+	  ++nskipped;
+	  printf("%3d: fnmatch (\"%s\", \"%s\"): SKIP multibyte test (requires locale support)\n", ++nr, pattern, input);
+	  continue;
+	}
+      /* skip collating symbols */
+      if (str_has_funk(pattern, '.') || str_has_funk(input, '.'))
+	{
+	  ++nskipped;
+	  printf("%3d: fnmatch (\"%s\", \"%s\"): SKIP collating symbol test (requires locale support)\n", ++nr, pattern, input);
+	  continue;
+	}
+      /* skip equivalence class expressions */
+      if (str_has_funk(pattern, '=') || str_has_funk(input, '='))
+	{
+	  ++nskipped;
+	  printf("%3d: fnmatch (\"%s\", \"%s\"): SKIP equivalence class test (requires locale support)\n", ++nr, pattern, input);
+	  continue;
+	}
+#endif
+
+      fnmres = fnmatch (pattern, input, flags_val);
+
+      printf ("%3d: fnmatch (\"%s\", \"%s\", %s) = %s%c",
+	      ++nr,
+	      escape (pattern, &escpatternlen, &escpattern),
+	      escape (input, &escinputlen, &escinput),
+	      flag_output (flags_val),
+	      (fnmres == 0
+	       ? "0" : (fnmres == FNM_NOMATCH
+			? "FNM_NOMATCH"
+			: (sprintf (numbuf, "%d", fnmres), numbuf))),
+	      (fnmres != 0) != (result != 0) ? ' ' : '\n');
+
+      if ((fnmres != 0) != (result != 0))
+	{
+	  printf ("(FAIL, expected %s) ***\n",
+		  result == 0
+		  ? "0" : (result == FNM_NOMATCH
+			   ? "FNM_NOMATCH"
+			   : (sprintf (numbuf, "%d", result), numbuf)));
+	  ++nfailed;
+	}
+    }
+
+  printf ("=====================\n%3d tests, %3d failed, %3d skipped\n", ntests, nfailed, nskipped);
+
+  free (escpattern);
+  free (escinput);
+  free (linebuf);
+
+  return nfailed != 0;
+}
+
+
+static char *
+next_input (char **line, int first, int last)
+{
+  char *cp = *line;
+  char *result;
+
+  while (*cp == ' ' || *cp == '\t')
+    ++cp;
+
+  /* We allow comment lines starting with '#'.  */
+  if (first && *cp == '#')
+    return NULL;
+
+  if (*cp == '"')
+    {
+      char *wp;
+
+      result = ++cp;
+      wp = cp;
+
+      while (*cp != '"' && *cp != '\0' && *cp != '\n')
+	if (*cp == '\\')
+	  {
+	    if (cp[1] == '\n' || cp[1] == '\0')
+	      return NULL;
+
+	    ++cp;
+	    if (*cp == 't')
+	      *wp++ = '\t';
+	    else if (*cp == 'n')
+	      *wp++ = '\n';
+	    else
+	      *wp++ = *cp;
+
+	    ++cp;
+	  }
+	else
+	  *wp++ = *cp++;
+
+      if (*cp != '"')
+	return NULL;
+
+      if (wp != cp)
+	*wp = '\0';
+    }
+  else
+    {
+      result = cp;
+      while (*cp != '\0' && *cp != '\n' && *cp != ' ' && *cp != '\t')
+	++cp;
+
+      if (cp == result && ! last)
+	/* Premature end of line.  */
+	return NULL;
+    }
+
+  /* Terminate and skip over the next white spaces.  */
+  *cp++ = '\0';
+
+  *line = cp;
+  return result;
+}
+
+
+static int
+convert_flags (const char *str)
+{
+  int result = 0;
+
+  while (*str != '\0')
+    {
+      int len;
+
+      if (strncasecmp (str, "PATHNAME", 8) == 0
+	  && (str[8] == '|' || str[8] == '\0'))
+	{
+	  result |= FNM_PATHNAME;
+	  len = 8;
+	}
+      else if (strncasecmp (str, "NOESCAPE", 8) == 0
+	       && (str[8] == '|' || str[8] == '\0'))
+	{
+	  result |= FNM_NOESCAPE;
+	  len = 8;
+	}
+      else if (strncasecmp (str, "PERIOD", 6) == 0
+	       && (str[6] == '|' || str[6] == '\0'))
+	{
+	  result |= FNM_PERIOD;
+	  len = 6;
+	}
+#ifdef FNM_LEADING_DIR
+      else if (strncasecmp (str, "LEADING_DIR", 11) == 0
+	       && (str[11] == '|' || str[11] == '\0'))
+	{
+	  result |= FNM_LEADING_DIR;
+	  len = 11;
+	}
+#endif
+#ifdef FNM_CASEFOLD
+      else if (strncasecmp (str, "CASEFOLD", 8) == 0
+	       && (str[8] == '|' || str[8] == '\0'))
+	{
+	  result |= FNM_CASEFOLD;
+	  len = 8;
+	}
+#endif
+#ifdef FNM_EXTMATCH
+      else if (strncasecmp (str, "EXTMATCH", 8) == 0
+	       && (str[8] == '|' || str[8] == '\0'))
+	{
+	  result |= FNM_EXTMATCH;
+	  len = 8;
+	}
+#endif
+      else
+	return -1;
+
+      str += len;
+      if (*str != '\0')
+	++str;
+    }
+
+  return result;
+}
+
+
+static char *
+flag_output (int flags)
+{
+  static char buf[100];
+  int first = 1;
+  char *cp = buf;
+
+  if (flags & FNM_PATHNAME)
+    {
+      cp = stpcpy (cp, "FNM_PATHNAME");
+      first = 0;
+    }
+  if (flags & FNM_NOESCAPE)
+    {
+      if (! first)
+	*cp++ = '|';
+      cp = stpcpy (cp, "FNM_NOESCAPE");
+      first = 0;
+    }
+  if (flags & FNM_PERIOD)
+    {
+      if (! first)
+	*cp++ = '|';
+      cp = stpcpy (cp, "FNM_PERIOD");
+      first = 0;
+    }
+#ifdef FNM_LEADING_DIR
+  if (flags & FNM_LEADING_DIR)
+    {
+      if (! first)
+	*cp++ = '|';
+      cp = stpcpy (cp, "FNM_LEADING_DIR");
+      first = 0;
+    }
+#endif
+#ifdef FNM_CASEFOLD
+  if (flags & FNM_CASEFOLD)
+    {
+      if (! first)
+	*cp++ = '|';
+      cp = stpcpy (cp, "FNM_CASEFOLD");
+      first = 0;
+    }
+#endif
+#ifdef FNM_EXTMATCH
+  if (flags & FNM_EXTMATCH)
+    {
+      if (! first)
+	*cp++ = '|';
+      cp = stpcpy (cp, "FNM_EXTMATCH");
+      first = 0;
+    }
+#endif
+  if (cp == buf)
+    *cp++ = '0';
+  *cp = '\0';
+
+  return buf;
+}
+
+
+static char *
+escape (const char *str, size_t *reslenp, char **resbufp)
+{
+  size_t reslen = *reslenp;
+  char *resbuf = *resbufp;
+  size_t len = strlen (str);
+  char *wp;
+
+  if (2 * len + 1 > reslen)
+    {
+      resbuf = (char *) realloc (resbuf, 2 * len + 1);
+      if (resbuf == NULL)
+	error (EXIT_FAILURE, errno, "while allocating buffer for printing");
+      *reslenp = 2 * len + 1;
+      *resbufp = resbuf;
+    }
+
+  wp = resbuf;
+  while (*str != '\0')
+    if (*str == '\t')
+      {
+	*wp++ = '\\';
+	*wp++ = 't';
+	++str;
+      }
+    else if (*str == '\n')
+      {
+	*wp++ = '\\';
+	*wp++ = 'n';
+	++str;
+      }
+    else if (*str == '"')
+      {
+	*wp++ = '\\';
+	*wp++ = '"';
+	++str;
+      }
+    else if (*str == '\\')
+      {
+	*wp++ = '\\';
+	*wp++ = '\\';
+	++str;
+      }
+    else
+      *wp++ = *str++;
+
+  *wp = '\0';
+
+  return resbuf;
+}
diff --git a/ap/build/uClibc/test/misc/tst-fnmatch.input b/ap/build/uClibc/test/misc/tst-fnmatch.input
new file mode 100644
index 0000000..9061d19
--- /dev/null
+++ b/ap/build/uClibc/test/misc/tst-fnmatch.input
@@ -0,0 +1,755 @@
+# Tests for fnmatch.
+# Copyright (C) 2000, 2001, 2004 Free Software Foundation, Inc.
+# This file is part of the GNU C Library.
+# Contributes by Ulrich Drepper <drepper@redhat.com>.
+#
+
+# 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.
+
+
+# Derived from the IEEE 2003.2 text.  The standard only contains some
+# wording describing the situations to be tested.  It does not specify
+# any specific tests.  I.e., the tests below are in no case sufficient.
+# They are hopefully necessary, though.
+
+# B.6 004(C)
+C		 "!#%+,-./01234567889"	"!#%+,-./01234567889"  0
+C		 ":;=@ABCDEFGHIJKLMNO"	":;=@ABCDEFGHIJKLMNO"  0
+C		 "PQRSTUVWXYZ]abcdefg"	"PQRSTUVWXYZ]abcdefg"  0
+C		 "hijklmnopqrstuvwxyz"	"hijklmnopqrstuvwxyz"  0
+C		 "^_{}~"		"^_{}~"		       0
+
+# B.6 005(C)
+C		 "\"$&'()"		"\\\"\\$\\&\\'\\(\\)"  0
+C		 "*?[\\`|"		"\\*\\?\\[\\\\\\`\\|"  0
+C		 "<>"			"\\<\\>"	       0
+
+# B.6 006(C)
+C		 "?*["			"[?*[][?*[][?*[]"      0
+C		 "a/b"			"?/b"		       0
+
+# B.6 007(C)
+C		 "a/b"			"a?b"		       0
+C		 "a/b"			"a/?"		       0
+C		 "aa/b"			"?/b"		       NOMATCH
+C		 "aa/b"			"a?b"		       NOMATCH
+C		 "a/bb"			"a/?"		       NOMATCH
+
+# B.6 009(C)
+C		 "abc"			"[abc]"		       NOMATCH
+C		 "x"			"[abc]"		       NOMATCH
+C		 "a"			"[abc]"		       0
+C		 "["			"[[abc]"	       0
+C		 "a"			"[][abc]"	       0
+C		 "a]"			"[]a]]"		       0
+
+# B.6 010(C)
+C		 "xyz"			"[!abc]"	       NOMATCH
+C		 "x"			"[!abc]"	       0
+C		 "a"			"[!abc]"	       NOMATCH
+
+# B.6 011(C)
+C		 "]"			"[][abc]"	       0
+C		 "abc]"			"[][abc]"	       NOMATCH
+C		 "[]abc"		"[][]abc"	       NOMATCH
+C		 "]"		        "[!]]"		       NOMATCH
+C		 "aa]"			"[!]a]"		       NOMATCH
+C		 "]"		        "[!a]"		       0
+C		 "]]"		        "[!a]]"		       0
+
+# B.6 012(C)
+C		 "a"			"[[.a.]]"	       0
+C		 "-"			"[[.-.]]"	       0
+C		 "-"			"[[.-.][.].]]"	       0
+C		 "-"			"[[.].][.-.]]"	       0
+C		 "-"			"[[.-.][=u=]]"	       0
+C		 "-"			"[[.-.][:alpha:]]"     0
+C		 "a"			"[![.a.]]"	       NOMATCH
+
+# B.6 013(C)
+C		 "a"			"[[.b.]]"	       NOMATCH
+C		 "a"			"[[.b.][.c.]]"	       NOMATCH
+C		 "a"			"[[.b.][=b=]]"	       NOMATCH
+
+
+# B.6 015(C)
+C		 "a"			"[[=a=]]"	       0
+C		 "b"			"[[=a=]b]"	       0
+C		 "b"			"[[=a=][=b=]]"	       0
+C		 "a"			"[[=a=][=b=]]"	       0
+C		 "a"			"[[=a=][.b.]]"	       0
+C		 "a"			"[[=a=][:digit:]]"     0
+
+# B.6 016(C)
+C		 "="			"[[=a=]b]"	       NOMATCH
+C		 "]"			"[[=a=]b]"	       NOMATCH
+C		 "a"			"[[=b=][=c=]]"	       NOMATCH
+C		 "a"			"[[=b=][.].]]"	       NOMATCH
+C		 "a"			"[[=b=][:digit:]]"     NOMATCH
+
+# B.6 017(C)
+C		 "a"			"[[:alnum:]]"	       0
+C		 "a"			"[![:alnum:]]"	       NOMATCH
+C		 "-"			"[[:alnum:]]"	       NOMATCH
+C		 "a]a"			"[[:alnum:]]a"	       NOMATCH
+C		 "-"			"[[:alnum:]-]"	       0
+C		 "aa"			"[[:alnum:]]a"	       0
+C		 "-"			"[![:alnum:]]"	       0
+C		 "]"			"[!][:alnum:]]"	       NOMATCH
+C		 "["			"[![:alnum:][]"	       NOMATCH
+C		 "a"			"[[:alnum:]]"	       0
+C		 "b"			"[[:alnum:]]"	       0
+C		 "c"			"[[:alnum:]]"	       0
+C		 "d"			"[[:alnum:]]"	       0
+C		 "e"			"[[:alnum:]]"	       0
+C		 "f"			"[[:alnum:]]"	       0
+C		 "g"			"[[:alnum:]]"	       0
+C		 "h"			"[[:alnum:]]"	       0
+C		 "i"			"[[:alnum:]]"	       0
+C		 "j"			"[[:alnum:]]"	       0
+C		 "k"			"[[:alnum:]]"	       0
+C		 "l"			"[[:alnum:]]"	       0
+C		 "m"			"[[:alnum:]]"	       0
+C		 "n"			"[[:alnum:]]"	       0
+C		 "o"			"[[:alnum:]]"	       0
+C		 "p"			"[[:alnum:]]"	       0
+C		 "q"			"[[:alnum:]]"	       0
+C		 "r"			"[[:alnum:]]"	       0
+C		 "s"			"[[:alnum:]]"	       0
+C		 "t"			"[[:alnum:]]"	       0
+C		 "u"			"[[:alnum:]]"	       0
+C		 "v"			"[[:alnum:]]"	       0
+C		 "w"			"[[:alnum:]]"	       0
+C		 "x"			"[[:alnum:]]"	       0
+C		 "y"			"[[:alnum:]]"	       0
+C		 "z"			"[[:alnum:]]"	       0
+C		 "A"			"[[:alnum:]]"	       0
+C		 "B"			"[[:alnum:]]"	       0
+C		 "C"			"[[:alnum:]]"	       0
+C		 "D"			"[[:alnum:]]"	       0
+C		 "E"			"[[:alnum:]]"	       0
+C		 "F"			"[[:alnum:]]"	       0
+C		 "G"			"[[:alnum:]]"	       0
+C		 "H"			"[[:alnum:]]"	       0
+C		 "I"			"[[:alnum:]]"	       0
+C		 "J"			"[[:alnum:]]"	       0
+C		 "K"			"[[:alnum:]]"	       0
+C		 "L"			"[[:alnum:]]"	       0
+C		 "M"			"[[:alnum:]]"	       0
+C		 "N"			"[[:alnum:]]"	       0
+C		 "O"			"[[:alnum:]]"	       0
+C		 "P"			"[[:alnum:]]"	       0
+C		 "Q"			"[[:alnum:]]"	       0
+C		 "R"			"[[:alnum:]]"	       0
+C		 "S"			"[[:alnum:]]"	       0
+C		 "T"			"[[:alnum:]]"	       0
+C		 "U"			"[[:alnum:]]"	       0
+C		 "V"			"[[:alnum:]]"	       0
+C		 "W"			"[[:alnum:]]"	       0
+C		 "X"			"[[:alnum:]]"	       0
+C		 "Y"			"[[:alnum:]]"	       0
+C		 "Z"			"[[:alnum:]]"	       0
+C		 "0"			"[[:alnum:]]"	       0
+C		 "1"			"[[:alnum:]]"	       0
+C		 "2"			"[[:alnum:]]"	       0
+C		 "3"			"[[:alnum:]]"	       0
+C		 "4"			"[[:alnum:]]"	       0
+C		 "5"			"[[:alnum:]]"	       0
+C		 "6"			"[[:alnum:]]"	       0
+C		 "7"			"[[:alnum:]]"	       0
+C		 "8"			"[[:alnum:]]"	       0
+C		 "9"			"[[:alnum:]]"	       0
+C		 "!"			"[[:alnum:]]"	       NOMATCH
+C		 "#"			"[[:alnum:]]"	       NOMATCH
+C		 "%"			"[[:alnum:]]"	       NOMATCH
+C		 "+"			"[[:alnum:]]"	       NOMATCH
+C		 ","			"[[:alnum:]]"	       NOMATCH
+C		 "-"			"[[:alnum:]]"	       NOMATCH
+C		 "."			"[[:alnum:]]"	       NOMATCH
+C		 "/"			"[[:alnum:]]"	       NOMATCH
+C		 ":"			"[[:alnum:]]"	       NOMATCH
+C		 ";"			"[[:alnum:]]"	       NOMATCH
+C		 "="			"[[:alnum:]]"	       NOMATCH
+C		 "@"			"[[:alnum:]]"	       NOMATCH
+C		 "["			"[[:alnum:]]"	       NOMATCH
+C		 "\\"			"[[:alnum:]]"	       NOMATCH
+C		 "]"			"[[:alnum:]]"	       NOMATCH
+C		 "^"			"[[:alnum:]]"	       NOMATCH
+C		 "_"			"[[:alnum:]]"	       NOMATCH
+C		 "{"			"[[:alnum:]]"	       NOMATCH
+C		 "}"			"[[:alnum:]]"	       NOMATCH
+C		 "~"			"[[:alnum:]]"	       NOMATCH
+C		 "\""			"[[:alnum:]]"	       NOMATCH
+C		 "$"			"[[:alnum:]]"	       NOMATCH
+C		 "&"			"[[:alnum:]]"	       NOMATCH
+C		 "'"			"[[:alnum:]]"	       NOMATCH
+C		 "("			"[[:alnum:]]"	       NOMATCH
+C		 ")"			"[[:alnum:]]"	       NOMATCH
+C		 "*"			"[[:alnum:]]"	       NOMATCH
+C		 "?"			"[[:alnum:]]"	       NOMATCH
+C		 "`"			"[[:alnum:]]"	       NOMATCH
+C		 "|"			"[[:alnum:]]"	       NOMATCH
+C		 "<"			"[[:alnum:]]"	       NOMATCH
+C		 ">"			"[[:alnum:]]"	       NOMATCH
+C		 "\t"			"[[:cntrl:]]"	       0
+C		 "t"			"[[:cntrl:]]"	       NOMATCH
+C		 "t"			"[[:lower:]]"	       0
+C		 "\t"			"[[:lower:]]"	       NOMATCH
+C		 "T"			"[[:lower:]]"	       NOMATCH
+C		 "\t"			"[[:space:]]"	       0
+C		 "t"			"[[:space:]]"	       NOMATCH
+C		 "t"			"[[:alpha:]]"	       0
+C		 "\t"			"[[:alpha:]]"	       NOMATCH
+C		 "0"			"[[:digit:]]"	       0
+C		 "\t"			"[[:digit:]]"	       NOMATCH
+C		 "t"			"[[:digit:]]"	       NOMATCH
+C		 "\t"			"[[:print:]]"	       NOMATCH
+C		 "t"			"[[:print:]]"	       0
+C		 "T"			"[[:upper:]]"	       0
+C		 "\t"			"[[:upper:]]"	       NOMATCH
+C		 "t"			"[[:upper:]]"	       NOMATCH
+C		 "\t"			"[[:blank:]]"	       0
+C		 "t"			"[[:blank:]]"	       NOMATCH
+C		 "\t"			"[[:graph:]]"	       NOMATCH
+C		 "t"			"[[:graph:]]"	       0
+C		 "."			"[[:punct:]]"	       0
+C		 "t"			"[[:punct:]]"	       NOMATCH
+C		 "\t"			"[[:punct:]]"	       NOMATCH
+C		 "0"			"[[:xdigit:]]"	       0
+C		 "\t"			"[[:xdigit:]]"	       NOMATCH
+C		 "a"			"[[:xdigit:]]"	       0
+C		 "A"			"[[:xdigit:]]"	       0
+C		 "t"			"[[:xdigit:]]"	       NOMATCH
+C		 "a"			"[[alpha]]"	       NOMATCH
+C		 "a"			"[[alpha:]]"	       NOMATCH
+C		 "a]"			"[[alpha]]"	       0
+C		 "a]"			"[[alpha:]]"	       0
+C		 "a"			"[[:alpha:][.b.]]"     0
+C		 "a"			"[[:alpha:][=b=]]"     0
+C		 "a"			"[[:alpha:][:digit:]]" 0
+C		 "a"			"[[:digit:][:alpha:]]" 0
+
+# B.6 018(C)
+C		 "a"			"[a-c]"		       0
+C		 "b"			"[a-c]"		       0
+C		 "c"			"[a-c]"		       0
+C		 "a"			"[b-c]"		       NOMATCH
+C		 "d"			"[b-c]"		       NOMATCH
+C		 "B"			"[a-c]"		       NOMATCH
+C		 "b"			"[A-C]"		       NOMATCH
+C		 ""			"[a-c]"		       NOMATCH
+C		 "as"			"[a-ca-z]"	       NOMATCH
+C		 "a"			"[[.a.]-c]"	       0
+C		 "a"			"[a-[.c.]]"	       0
+C		 "a"			"[[.a.]-[.c.]]"	       0
+C		 "b"			"[[.a.]-c]"	       0
+C		 "b"			"[a-[.c.]]"	       0
+C		 "b"			"[[.a.]-[.c.]]"	       0
+C		 "c"			"[[.a.]-c]"	       0
+C		 "c"			"[a-[.c.]]"	       0
+C		 "c"			"[[.a.]-[.c.]]"	       0
+C		 "d"			"[[.a.]-c]"	       NOMATCH
+C		 "d"			"[a-[.c.]]"	       NOMATCH
+C		 "d"			"[[.a.]-[.c.]]"	       NOMATCH
+
+# B.6 019(C)
+C		 "a"			"[c-a]"		       NOMATCH
+C		 "a"			"[[.c.]-a]"	       NOMATCH
+C		 "a"			"[c-[.a.]]"	       NOMATCH
+C		 "a"			"[[.c.]-[.a.]]"	       NOMATCH
+C		 "c"			"[c-a]"		       NOMATCH
+C		 "c"			"[[.c.]-a]"	       NOMATCH
+C		 "c"			"[c-[.a.]]"	       NOMATCH
+C		 "c"			"[[.c.]-[.a.]]"	       NOMATCH
+
+# B.6 020(C)
+C		 "a"			"[a-c0-9]"	       0
+C		 "d"			"[a-c0-9]"	       NOMATCH
+C		 "B"			"[a-c0-9]"	       NOMATCH
+
+# B.6 021(C)
+C		 "-"			"[-a]"		       0
+C		 "a"			"[-b]"		       NOMATCH
+C		 "-"			"[!-a]"		       NOMATCH
+C		 "a"			"[!-b]"		       0
+C		 "-"			"[a-c-0-9]"	       0
+C		 "b"			"[a-c-0-9]"	       0
+C		 "a:"			"a[0-9-a]"	       NOMATCH
+C		 "a:"			"a[09-a]"	       0
+
+# B.6 024(C)
+C		 ""			"*"		       0
+C		 "asd/sdf"		"*"		       0
+
+# B.6 025(C)
+C		 "as"			"[a-c][a-z]"	       0
+C		 "as"			"??"		       0
+
+# B.6 026(C)
+C		 "asd/sdf"		"as*df"		       0
+C		 "asd/sdf"		"as*"		       0
+C		 "asd/sdf"		"*df"		       0
+C		 "asd/sdf"		"as*dg"		       NOMATCH
+C		 "asdf"			"as*df"		       0
+C		 "asdf"			"as*df?"	       NOMATCH
+C		 "asdf"			"as*??"		       0
+C		 "asdf"			"a*???"		       0
+C		 "asdf"			"*????"		       0
+C		 "asdf"			"????*"		       0
+C		 "asdf"			"??*?"		       0
+
+# B.6 027(C)
+C		 "/"			"/"		       0
+C		 "/"			"/*"		       0
+C		 "/"			"*/"		       0
+C		 "/"			"/?"		       NOMATCH
+C		 "/"			"?/"		       NOMATCH
+C		 "/"			"?"		       0
+C		 "."			"?"		       0
+C		 "/."			"??"		       0
+C		 "/"			"[!a-c]"	       0
+C		 "."			"[!a-c]"	       0
+
+# B.6 029(C)
+C		 "/"			"/"		       0       PATHNAME
+C		 "//"			"//"		       0       PATHNAME
+C		 "/.a"			"/*"		       0       PATHNAME
+C		 "/.a"			"/?a"		       0       PATHNAME
+C		 "/.a"			"/[!a-z]a"	       0       PATHNAME
+C		 "/.a/.b"		"/*/?b"		       0       PATHNAME
+
+# B.6 030(C)
+C		 "/"			"?"		       NOMATCH PATHNAME
+C		 "/"			"*"		       NOMATCH PATHNAME
+C		 "a/b"			"a?b"		       NOMATCH PATHNAME
+C		 "/.a/.b"		"/*b"		       NOMATCH PATHNAME
+
+# B.6 031(C)
+C		 "/$"			"\\/\\$"	       0
+C		 "/["			"\\/\\["	       0
+C		 "/["			"\\/["		       NOMATCH
+
+# B.6 032(C)
+C		 "/$"			"\\/\\$"	       NOMATCH NOESCAPE
+C		 "/\\$"			"\\/\\$"	       NOMATCH NOESCAPE
+C		 "\\/\\$"		"\\/\\$"	       0       NOESCAPE
+
+# B.6 033(C)
+C		 ".asd"			".*"		       0       PERIOD
+C		 "/.asd"		"*"		       0       PERIOD
+C		 "/as/.df"		"*/?*f"		       0       PERIOD
+C		 "..asd"		".[!a-z]*"	       0       PERIOD
+
+# B.6 034(C)
+C		 ".asd"			"*"		       NOMATCH PERIOD
+C		 ".asd"			"?asd"		       NOMATCH PERIOD
+C		 ".asd"			"[!a-z]*"	       NOMATCH PERIOD
+
+# B.6 035(C)
+C		 "/."			"/."		       0       PATHNAME|PERIOD
+C		 "/.a./.b."		"/.*/.*"	       0       PATHNAME|PERIOD
+C		 "/.a./.b."		"/.??/.??"	       0       PATHNAME|PERIOD
+
+# B.6 036(C)
+C		 "/."			"*"		       NOMATCH PATHNAME|PERIOD
+C		 "/."			"/*"		       NOMATCH PATHNAME|PERIOD
+C		 "/."			"/?"		       NOMATCH PATHNAME|PERIOD
+C		 "/."			"/[!a-z]"	       NOMATCH PATHNAME|PERIOD
+C		 "/a./.b."		"/*/*"		       NOMATCH PATHNAME|PERIOD
+C		 "/a./.b."		"/??/???"	       NOMATCH PATHNAME|PERIOD
+
+# Some home-grown tests.
+C		"foobar"		"foo*[abc]z"	       NOMATCH
+C		"foobaz"		"foo*[abc][xyz]"       0
+C		"foobaz"		"foo?*[abc][xyz]"      0
+C		"foobaz"		"foo?*[abc][x/yz]"     0
+C		"foobaz"		"foo?*[abc]/[xyz]"     NOMATCH PATHNAME
+C		"a"			"a/"                   NOMATCH PATHNAME
+C		"a/"			"a"		       NOMATCH PATHNAME
+C		"//a"			"/a"		       NOMATCH PATHNAME
+C		"/a"			"//a"		       NOMATCH PATHNAME
+C		"az"			"[a-]z"		       0
+C		"bz"			"[ab-]z"	       0
+C		"cz"			"[ab-]z"	       NOMATCH
+C		"-z"			"[ab-]z"	       0
+C		"az"			"[-a]z"		       0
+C		"bz"			"[-ab]z"	       0
+C		"cz"			"[-ab]z"	       NOMATCH
+C		"-z"			"[-ab]z"	       0
+C		"\\"			"[\\\\-a]"	       0
+C		"_"			"[\\\\-a]"	       0
+C		"a"			"[\\\\-a]"	       0
+C		"-"			"[\\\\-a]"	       NOMATCH
+C		"\\"			"[\\]-a]"	       NOMATCH
+C		"_"			"[\\]-a]"	       0
+C		"a"			"[\\]-a]"	       0
+C		"]"			"[\\]-a]"	       0
+C		"-"			"[\\]-a]"	       NOMATCH
+C		"\\"			"[!\\\\-a]"	       NOMATCH
+C		"_"			"[!\\\\-a]"	       NOMATCH
+C		"a"			"[!\\\\-a]"	       NOMATCH
+C		"-"			"[!\\\\-a]"	       0
+C		"!"			"[\\!-]"	       0
+C		"-"			"[\\!-]"	       0
+C		"\\"			"[\\!-]"	       NOMATCH
+C		"Z"			"[Z-\\\\]"	       0
+C		"["			"[Z-\\\\]"	       0
+C		"\\"			"[Z-\\\\]"	       0
+C		"-"			"[Z-\\\\]"	       NOMATCH
+C		"Z"			"[Z-\\]]"	       0
+C		"["			"[Z-\\]]"	       0
+C		"\\"			"[Z-\\]]"	       0
+C		"]"			"[Z-\\]]"	       0
+C		"-"			"[Z-\\]]"	       NOMATCH
+
+# Following are tests outside the scope of IEEE 2003.2 since they are using
+# locales other than the C locale.  The main focus of the tests is on the
+# handling of ranges and the recognition of character (vs bytes).
+de_DE.ISO-8859-1 "a"			"[a-z]"		       0
+de_DE.ISO-8859-1 "z"			"[a-z]"		       0
+de_DE.ISO-8859-1 "ä"			"[a-z]"		       0
+de_DE.ISO-8859-1 "ö"			"[a-z]"		       0
+de_DE.ISO-8859-1 "ü"			"[a-z]"		       0
+de_DE.ISO-8859-1 "A"			"[a-z]"		       NOMATCH
+de_DE.ISO-8859-1 "Z"			"[a-z]"		       NOMATCH
+de_DE.ISO-8859-1 "Ä"			"[a-z]"		       NOMATCH
+de_DE.ISO-8859-1 "Ö"			"[a-z]"		       NOMATCH
+de_DE.ISO-8859-1 "Ü"			"[a-z]"		       NOMATCH
+de_DE.ISO-8859-1 "a"			"[A-Z]"		       NOMATCH
+de_DE.ISO-8859-1 "z"			"[A-Z]"		       NOMATCH
+de_DE.ISO-8859-1 "ä"			"[A-Z]"		       NOMATCH
+de_DE.ISO-8859-1 "ö"			"[A-Z]"		       NOMATCH
+de_DE.ISO-8859-1 "ü"			"[A-Z]"		       NOMATCH
+de_DE.ISO-8859-1 "A"			"[A-Z]"		       0
+de_DE.ISO-8859-1 "Z"			"[A-Z]"		       0
+de_DE.ISO-8859-1 "Ä"			"[A-Z]"		       0
+de_DE.ISO-8859-1 "Ö"			"[A-Z]"		       0
+de_DE.ISO-8859-1 "Ü"			"[A-Z]"		       0
+de_DE.ISO-8859-1 "a"			"[[:lower:]]"	       0
+de_DE.ISO-8859-1 "z"			"[[:lower:]]"	       0
+de_DE.ISO-8859-1 "ä"			"[[:lower:]]"	       0
+de_DE.ISO-8859-1 "ö"			"[[:lower:]]"	       0
+de_DE.ISO-8859-1 "ü"			"[[:lower:]]"	       0
+de_DE.ISO-8859-1 "A"			"[[:lower:]]"	       NOMATCH
+de_DE.ISO-8859-1 "Z"			"[[:lower:]]"	       NOMATCH
+de_DE.ISO-8859-1 "Ä"			"[[:lower:]]"	       NOMATCH
+de_DE.ISO-8859-1 "Ö"			"[[:lower:]]"	       NOMATCH
+de_DE.ISO-8859-1 "Ü"			"[[:lower:]]"	       NOMATCH
+de_DE.ISO-8859-1 "a"			"[[:upper:]]"	       NOMATCH
+de_DE.ISO-8859-1 "z"			"[[:upper:]]"	       NOMATCH
+de_DE.ISO-8859-1 "ä"			"[[:upper:]]"	       NOMATCH
+de_DE.ISO-8859-1 "ö"			"[[:upper:]]"	       NOMATCH
+de_DE.ISO-8859-1 "ü"			"[[:upper:]]"	       NOMATCH
+de_DE.ISO-8859-1 "A"			"[[:upper:]]"	       0
+de_DE.ISO-8859-1 "Z"			"[[:upper:]]"	       0
+de_DE.ISO-8859-1 "Ä"			"[[:upper:]]"	       0
+de_DE.ISO-8859-1 "Ö"			"[[:upper:]]"	       0
+de_DE.ISO-8859-1 "Ü"			"[[:upper:]]"	       0
+de_DE.ISO-8859-1 "a"			"[[:alpha:]]"	       0
+de_DE.ISO-8859-1 "z"			"[[:alpha:]]"	       0
+de_DE.ISO-8859-1 "ä"			"[[:alpha:]]"	       0
+de_DE.ISO-8859-1 "ö"			"[[:alpha:]]"	       0
+de_DE.ISO-8859-1 "ü"			"[[:alpha:]]"	       0
+de_DE.ISO-8859-1 "A"			"[[:alpha:]]"	       0
+de_DE.ISO-8859-1 "Z"			"[[:alpha:]]"	       0
+de_DE.ISO-8859-1 "Ä"			"[[:alpha:]]"	       0
+de_DE.ISO-8859-1 "Ö"			"[[:alpha:]]"	       0
+de_DE.ISO-8859-1 "Ü"			"[[:alpha:]]"	       0
+
+de_DE.ISO-8859-1 "a"			"[[=a=]b]"	       0
+de_DE.ISO-8859-1 "â"			"[[=a=]b]"	       0
+de_DE.ISO-8859-1 "à"			"[[=a=]b]"	       0
+de_DE.ISO-8859-1 "á"			"[[=a=]b]"	       0
+de_DE.ISO-8859-1 "ä"			"[[=a=]b]"	       0
+de_DE.ISO-8859-1 "b"			"[[=a=]b]"	       0
+de_DE.ISO-8859-1 "c"			"[[=a=]b]"	       NOMATCH
+de_DE.ISO-8859-1 "a"			"[[=â=]b]"	       0
+de_DE.ISO-8859-1 "â"			"[[=â=]b]"	       0
+de_DE.ISO-8859-1 "à"			"[[=â=]b]"	       0
+de_DE.ISO-8859-1 "á"			"[[=â=]b]"	       0
+de_DE.ISO-8859-1 "ä"			"[[=â=]b]"	       0
+de_DE.ISO-8859-1 "b"			"[[=â=]b]"	       0
+de_DE.ISO-8859-1 "c"			"[[=â=]b]"	       NOMATCH
+de_DE.ISO-8859-1 "a"			"[[=à=]b]"	       0
+de_DE.ISO-8859-1 "â"			"[[=à=]b]"	       0
+de_DE.ISO-8859-1 "à"			"[[=à=]b]"	       0
+de_DE.ISO-8859-1 "á"			"[[=à=]b]"	       0
+de_DE.ISO-8859-1 "ä"			"[[=à=]b]"	       0
+de_DE.ISO-8859-1 "b"			"[[=à=]b]"	       0
+de_DE.ISO-8859-1 "c"			"[[=à=]b]"	       NOMATCH
+de_DE.ISO-8859-1 "a"			"[[=á=]b]"	       0
+de_DE.ISO-8859-1 "â"			"[[=á=]b]"	       0
+de_DE.ISO-8859-1 "à"			"[[=á=]b]"	       0
+de_DE.ISO-8859-1 "á"			"[[=á=]b]"	       0
+de_DE.ISO-8859-1 "ä"			"[[=á=]b]"	       0
+de_DE.ISO-8859-1 "b"			"[[=á=]b]"	       0
+de_DE.ISO-8859-1 "c"			"[[=á=]b]"	       NOMATCH
+de_DE.ISO-8859-1 "a"			"[[=ä=]b]"	       0
+de_DE.ISO-8859-1 "â"			"[[=ä=]b]"	       0
+de_DE.ISO-8859-1 "à"			"[[=ä=]b]"	       0
+de_DE.ISO-8859-1 "á"			"[[=ä=]b]"	       0
+de_DE.ISO-8859-1 "ä"			"[[=ä=]b]"	       0
+de_DE.ISO-8859-1 "b"			"[[=ä=]b]"	       0
+de_DE.ISO-8859-1 "c"			"[[=ä=]b]"	       NOMATCH
+
+de_DE.ISO-8859-1 "aa"			"[[.a.]]a"	       0
+de_DE.ISO-8859-1 "ba"			"[[.a.]]a"	       NOMATCH
+
+
+# And with a multibyte character set.
+de_DE.UTF-8	 "a"			"[a-z]"		       0
+de_DE.UTF-8	 "z"			"[a-z]"		       0
+de_DE.UTF-8	 "ä"			"[a-z]"		       0
+de_DE.UTF-8	 "ö"			"[a-z]"		       0
+de_DE.UTF-8	 "ü"			"[a-z]"		       0
+de_DE.UTF-8	 "A"			"[a-z]"		       NOMATCH
+de_DE.UTF-8	 "Z"			"[a-z]"		       NOMATCH
+de_DE.UTF-8	 "Ä"			"[a-z]"		       NOMATCH
+de_DE.UTF-8	 "Ö"			"[a-z]"		       NOMATCH
+de_DE.UTF-8	 "Ü"			"[a-z]"		       NOMATCH
+de_DE.UTF-8	 "a"			"[A-Z]"		       NOMATCH
+de_DE.UTF-8	 "z"			"[A-Z]"		       NOMATCH
+de_DE.UTF-8	 "ä"			"[A-Z]"		       NOMATCH
+de_DE.UTF-8	 "ö"			"[A-Z]"		       NOMATCH
+de_DE.UTF-8	 "ü"			"[A-Z]"		       NOMATCH
+de_DE.UTF-8	 "A"			"[A-Z]"		       0
+de_DE.UTF-8	 "Z"			"[A-Z]"		       0
+de_DE.UTF-8	 "Ä"			"[A-Z]"		       0
+de_DE.UTF-8	 "Ö"			"[A-Z]"		       0
+de_DE.UTF-8	 "Ü"			"[A-Z]"		       0
+de_DE.UTF-8	 "a"			"[[:lower:]]"	       0
+de_DE.UTF-8	 "z"			"[[:lower:]]"	       0
+de_DE.UTF-8	 "ä"			"[[:lower:]]"	       0
+de_DE.UTF-8	 "ö"			"[[:lower:]]"	       0
+de_DE.UTF-8	 "ü"			"[[:lower:]]"	       0
+de_DE.UTF-8	 "A"			"[[:lower:]]"	       NOMATCH
+de_DE.UTF-8	 "Z"			"[[:lower:]]"	       NOMATCH
+de_DE.UTF-8	 "Ä"			"[[:lower:]]"	       NOMATCH
+de_DE.UTF-8	 "Ö"			"[[:lower:]]"	       NOMATCH
+de_DE.UTF-8	 "Ü"			"[[:lower:]]"	       NOMATCH
+de_DE.UTF-8	 "a"			"[[:upper:]]"	       NOMATCH
+de_DE.UTF-8	 "z"			"[[:upper:]]"	       NOMATCH
+de_DE.UTF-8	 "ä"			"[[:upper:]]"	       NOMATCH
+de_DE.UTF-8	 "ö"			"[[:upper:]]"	       NOMATCH
+de_DE.UTF-8	 "ü"			"[[:upper:]]"	       NOMATCH
+de_DE.UTF-8	 "A"			"[[:upper:]]"	       0
+de_DE.UTF-8	 "Z"			"[[:upper:]]"	       0
+de_DE.UTF-8	 "Ä"			"[[:upper:]]"	       0
+de_DE.UTF-8	 "Ö"			"[[:upper:]]"	       0
+de_DE.UTF-8	 "Ü"			"[[:upper:]]"	       0
+de_DE.UTF-8	 "a"			"[[:alpha:]]"	       0
+de_DE.UTF-8	 "z"			"[[:alpha:]]"	       0
+de_DE.UTF-8	 "ä"			"[[:alpha:]]"	       0
+de_DE.UTF-8	 "ö"			"[[:alpha:]]"	       0
+de_DE.UTF-8	 "ü"			"[[:alpha:]]"	       0
+de_DE.UTF-8	 "A"			"[[:alpha:]]"	       0
+de_DE.UTF-8	 "Z"			"[[:alpha:]]"	       0
+de_DE.UTF-8	 "Ä"			"[[:alpha:]]"	       0
+de_DE.UTF-8	 "Ö"			"[[:alpha:]]"	       0
+de_DE.UTF-8	 "Ü"			"[[:alpha:]]"	       0
+
+de_DE.UTF-8	 "a"			"[[=a=]b]"	       0
+de_DE.UTF-8	 "â"			"[[=a=]b]"	       0
+de_DE.UTF-8	 "à"			"[[=a=]b]"	       0
+de_DE.UTF-8	 "á"			"[[=a=]b]"	       0
+de_DE.UTF-8	 "ä"			"[[=a=]b]"	       0
+de_DE.UTF-8	 "b"			"[[=a=]b]"	       0
+de_DE.UTF-8	 "c"			"[[=a=]b]"	       NOMATCH
+de_DE.UTF-8	 "a"			"[[=â=]b]"	       0
+de_DE.UTF-8	 "â"			"[[=â=]b]"	       0
+de_DE.UTF-8	 "à"			"[[=â=]b]"	       0
+de_DE.UTF-8	 "á"			"[[=â=]b]"	       0
+de_DE.UTF-8	 "ä"			"[[=â=]b]"	       0
+de_DE.UTF-8	 "b"			"[[=â=]b]"	       0
+de_DE.UTF-8	 "c"			"[[=â=]b]"	       NOMATCH
+de_DE.UTF-8	 "a"			"[[=à=]b]"	       0
+de_DE.UTF-8	 "â"			"[[=à=]b]"	       0
+de_DE.UTF-8	 "à"			"[[=à=]b]"	       0
+de_DE.UTF-8	 "á"			"[[=à=]b]"	       0
+de_DE.UTF-8	 "ä"			"[[=à=]b]"	       0
+de_DE.UTF-8	 "b"			"[[=à=]b]"	       0
+de_DE.UTF-8	 "c"			"[[=à=]b]"	       NOMATCH
+de_DE.UTF-8	 "a"			"[[=á=]b]"	       0
+de_DE.UTF-8	 "â"			"[[=á=]b]"	       0
+de_DE.UTF-8	 "à"			"[[=á=]b]"	       0
+de_DE.UTF-8	 "á"			"[[=á=]b]"	       0
+de_DE.UTF-8	 "ä"			"[[=á=]b]"	       0
+de_DE.UTF-8	 "b"			"[[=á=]b]"	       0
+de_DE.UTF-8	 "c"			"[[=á=]b]"	       NOMATCH
+de_DE.UTF-8	 "a"			"[[=ä=]b]"	       0
+de_DE.UTF-8	 "â"			"[[=ä=]b]"	       0
+de_DE.UTF-8	 "à"			"[[=ä=]b]"	       0
+de_DE.UTF-8	 "á"			"[[=ä=]b]"	       0
+de_DE.UTF-8	 "ä"			"[[=ä=]b]"	       0
+de_DE.UTF-8	 "b"			"[[=ä=]b]"	       0
+de_DE.UTF-8	 "c"			"[[=ä=]b]"	       NOMATCH
+
+de_DE.UTF-8	 "aa"			"[[.a.]]a"	       0
+de_DE.UTF-8	 "ba"			"[[.a.]]a"	       NOMATCH
+
+
+# Test of GNU extensions.
+C		 "x"			"x"		       0       PATHNAME|LEADING_DIR
+C		 "x/y"			"x"		       0       PATHNAME|LEADING_DIR
+C		 "x/y/z"		"x"		       0       PATHNAME|LEADING_DIR
+C		 "x"			"*"		       0       PATHNAME|LEADING_DIR
+C		 "x/y"			"*"		       0       PATHNAME|LEADING_DIR
+C		 "x/y/z"		"*"		       0       PATHNAME|LEADING_DIR
+C		 "x"			"*x"		       0       PATHNAME|LEADING_DIR
+C		 "x/y"			"*x"		       0       PATHNAME|LEADING_DIR
+C		 "x/y/z"		"*x"		       0       PATHNAME|LEADING_DIR
+C		 "x"			"x*"		       0       PATHNAME|LEADING_DIR
+C		 "x/y"			"x*"		       0       PATHNAME|LEADING_DIR
+C		 "x/y/z"		"x*"		       0       PATHNAME|LEADING_DIR
+C		 "x"			"a"		       NOMATCH PATHNAME|LEADING_DIR
+C		 "x/y"			"a"		       NOMATCH PATHNAME|LEADING_DIR
+C		 "x/y/z"		"a"		       NOMATCH PATHNAME|LEADING_DIR
+C		 "x"			"x/y"		       NOMATCH PATHNAME|LEADING_DIR
+C		 "x/y"			"x/y"		       0       PATHNAME|LEADING_DIR
+C		 "x/y/z"		"x/y"		       0       PATHNAME|LEADING_DIR
+C		 "x"			"x?y"		       NOMATCH PATHNAME|LEADING_DIR
+C		 "x/y"			"x?y"		       NOMATCH PATHNAME|LEADING_DIR
+C		 "x/y/z"		"x?y"		       NOMATCH PATHNAME|LEADING_DIR
+
+# ksh style matching.
+C		"abcd"			"?@(a|b)*@(c)d"	       0       EXTMATCH
+C		"/dev/udp/129.22.8.102/45" "/dev/@(tcp|udp)/*/*" 0     PATHNAME|EXTMATCH
+C		"12"			"[1-9]*([0-9])"        0       EXTMATCH
+C		"12abc"			"[1-9]*([0-9])"        NOMATCH EXTMATCH
+C		"1"			"[1-9]*([0-9])"	       0       EXTMATCH
+C		"07"			"+([0-7])"	       0       EXTMATCH
+C		"0377"			"+([0-7])"	       0       EXTMATCH
+C		"09"			"+([0-7])"	       NOMATCH EXTMATCH
+C		"paragraph"		"para@(chute|graph)"   0       EXTMATCH
+C		"paramour"		"para@(chute|graph)"   NOMATCH EXTMATCH
+C		"para991"		"para?([345]|99)1"     0       EXTMATCH
+C		"para381"		"para?([345]|99)1"     NOMATCH EXTMATCH
+C		"paragraph"		"para*([0-9])"	       NOMATCH EXTMATCH
+C		"para"			"para*([0-9])"	       0       EXTMATCH
+C		"para13829383746592"	"para*([0-9])"	       0       EXTMATCH
+C		"paragraph"		"para+([0-9])"	       NOMATCH EXTMATCH
+C		"para"			"para+([0-9])"	       NOMATCH EXTMATCH
+C		"para987346523"		"para+([0-9])"	       0       EXTMATCH
+C		"paragraph"		"para!(*.[0-9])"       0       EXTMATCH
+C		"para.38"		"para!(*.[0-9])"       0       EXTMATCH
+C		"para.graph"		"para!(*.[0-9])"       0       EXTMATCH
+C		"para39"		"para!(*.[0-9])"       0       EXTMATCH
+C		""			"*(0|1|3|5|7|9)"       0       EXTMATCH
+C		"137577991"		"*(0|1|3|5|7|9)"       0       EXTMATCH
+C		"2468"			"*(0|1|3|5|7|9)"       NOMATCH EXTMATCH
+C		"1358"			"*(0|1|3|5|7|9)"       NOMATCH EXTMATCH
+C		"file.c"		"*.c?(c)"	       0       EXTMATCH
+C		"file.C"		"*.c?(c)"	       NOMATCH EXTMATCH
+C		"file.cc"		"*.c?(c)"	       0       EXTMATCH
+C		"file.ccc"		"*.c?(c)"	       NOMATCH EXTMATCH
+C		"parse.y"		"!(*.c|*.h|Makefile.in|config*|README)" 0 EXTMATCH
+C		"shell.c"		"!(*.c|*.h|Makefile.in|config*|README)" NOMATCH EXTMATCH
+C		"Makefile"		"!(*.c|*.h|Makefile.in|config*|README)" 0 EXTMATCH
+C		"VMS.FILE;1"		"*\;[1-9]*([0-9])"     0       EXTMATCH
+C		"VMS.FILE;0"		"*\;[1-9]*([0-9])"     NOMATCH EXTMATCH
+C		"VMS.FILE;"		"*\;[1-9]*([0-9])"     NOMATCH EXTMATCH
+C		"VMS.FILE;139"		"*\;[1-9]*([0-9])"     0       EXTMATCH
+C		"VMS.FILE;1N"		"*\;[1-9]*([0-9])"     NOMATCH EXTMATCH
+C		"abcfefg"		"ab**(e|f)"	       0       EXTMATCH
+C		"abcfefg"		"ab**(e|f)g"	       0       EXTMATCH
+C		"ab"			"ab*+(e|f)"	       NOMATCH EXTMATCH
+C		"abef"			"ab***ef"	       0       EXTMATCH
+C		"abef"			"ab**"		       0       EXTMATCH
+C		"fofo"			"*(f*(o))"	       0       EXTMATCH
+C		"ffo"			"*(f*(o))"	       0       EXTMATCH
+C		"foooofo"		"*(f*(o))"	       0       EXTMATCH
+C		"foooofof"		"*(f*(o))"	       0       EXTMATCH
+C		"fooofoofofooo"		"*(f*(o))"	       0       EXTMATCH
+C		"foooofof"		"*(f+(o))"	       NOMATCH EXTMATCH
+C		"xfoooofof"		"*(f*(o))"	       NOMATCH EXTMATCH
+C		"foooofofx"		"*(f*(o))"	       NOMATCH EXTMATCH
+C		"ofxoofxo"		"*(*(of*(o)x)o)"       0       EXTMATCH
+C		"ofooofoofofooo"	"*(f*(o))"	       NOMATCH EXTMATCH
+C		"foooxfooxfoxfooox"	"*(f*(o)x)"	       0       EXTMATCH
+C		"foooxfooxofoxfooox"	"*(f*(o)x)"	       NOMATCH EXTMATCH
+C		"foooxfooxfxfooox"	"*(f*(o)x)"	       0       EXTMATCH
+C		"ofxoofxo"		"*(*(of*(o)x)o)"       0       EXTMATCH
+C		"ofoooxoofxo"		"*(*(of*(o)x)o)"       0       EXTMATCH
+C		"ofoooxoofxoofoooxoofxo" "*(*(of*(o)x)o)"      0       EXTMATCH
+C		"ofoooxoofxoofoooxoofxoo" "*(*(of*(o)x)o)"     0       EXTMATCH
+C		"ofoooxoofxoofoooxoofxofo" "*(*(of*(o)x)o)"    NOMATCH EXTMATCH
+C		"ofoooxoofxoofoooxoofxooofxofxo" "*(*(of*(o)x)o)" 0    EXTMATCH
+C		"aac"			"*(@(a))a@(c)"	       0       EXTMATCH
+C		"ac"			"*(@(a))a@(c)"	       0       EXTMATCH
+C		"c"			"*(@(a))a@(c)"	       NOMATCH EXTMATCH
+C		"aaac"			"*(@(a))a@(c)"	       0       EXTMATCH
+C		"baaac"			"*(@(a))a@(c)"	       NOMATCH EXTMATCH
+C		"abcd"			"?@(a|b)*@(c)d"	       0       EXTMATCH
+C		"abcd"			"@(ab|a*@(b))*(c)d"    0       EXTMATCH
+C		"acd"			"@(ab|a*(b))*(c)d"     0       EXTMATCH
+C		"abbcd"			"@(ab|a*(b))*(c)d"     0       EXTMATCH
+C		"effgz"			"@(b+(c)d|e*(f)g?|?(h)i@(j|k))" 0 EXTMATCH
+C		"efgz"			"@(b+(c)d|e*(f)g?|?(h)i@(j|k))" 0 EXTMATCH
+C		"egz"			"@(b+(c)d|e*(f)g?|?(h)i@(j|k))" 0 EXTMATCH
+C		"egzefffgzbcdij"	"*(b+(c)d|e*(f)g?|?(h)i@(j|k))" 0 EXTMATCH
+C		"egz"			"@(b+(c)d|e+(f)g?|?(h)i@(j|k))" NOMATCH EXTMATCH
+C		"ofoofo"		"*(of+(o))"	       0       EXTMATCH
+C		"oxfoxoxfox"		"*(oxf+(ox))"	       0       EXTMATCH
+C		"oxfoxfox"		"*(oxf+(ox))"	       NOMATCH EXTMATCH
+C		"ofoofo"		"*(of+(o)|f)"	       0       EXTMATCH
+C		"foofoofo"		"@(foo|f|fo)*(f|of+(o))" 0     EXTMATCH
+C		"oofooofo"		"*(of|oof+(o))"	       0       EXTMATCH
+C		"fffooofoooooffoofffooofff" "*(*(f)*(o))"      0       EXTMATCH
+C		"fofoofoofofoo"		"*(fo|foo)"	       0       EXTMATCH
+C		"foo"			"!(x)"		       0       EXTMATCH
+C		"foo"			"!(x)*"		       0       EXTMATCH
+C		"foo"			"!(foo)"	       NOMATCH EXTMATCH
+C		"foo"			"!(foo)*"	       0       EXTMATCH
+C		"foobar"		"!(foo)"	       0       EXTMATCH
+C		"foobar"		"!(foo)*"	       0       EXTMATCH
+C		"moo.cow"		"!(*.*).!(*.*)"	       0       EXTMATCH
+C		"mad.moo.cow"		"!(*.*).!(*.*)"	       NOMATCH EXTMATCH
+C		"mucca.pazza"		"mu!(*(c))?.pa!(*(z))?" NOMATCH EXTMATCH
+C		"fff"			"!(f)"		       0       EXTMATCH
+C		"fff"			"*(!(f))"	       0       EXTMATCH
+C		"fff"			"+(!(f))"	       0       EXTMATCH
+C		"ooo"			"!(f)"		       0       EXTMATCH
+C		"ooo"			"*(!(f))"	       0       EXTMATCH
+C		"ooo"			"+(!(f))"	       0       EXTMATCH
+C		"foo"			"!(f)"		       0       EXTMATCH
+C		"foo"			"*(!(f))"	       0       EXTMATCH
+C		"foo"			"+(!(f))"	       0       EXTMATCH
+C		"f"			"!(f)"		       NOMATCH EXTMATCH
+C		"f"			"*(!(f))"	       NOMATCH EXTMATCH
+C		"f"			"+(!(f))"	       NOMATCH EXTMATCH
+C		"foot"			"@(!(z*)|*x)"	       0       EXTMATCH
+C		"zoot"			"@(!(z*)|*x)"	       NOMATCH EXTMATCH
+C		"foox"			"@(!(z*)|*x)"	       0       EXTMATCH
+C		"zoox"			"@(!(z*)|*x)"	       0       EXTMATCH
+C		"foo"			"*(!(foo))	       0       EXTMATCH
+C		"foob"			"!(foo)b*"	       NOMATCH EXTMATCH
+C		"foobb"			"!(foo)b*"	       0       EXTMATCH
+C		"["			"*([a[])"	       0       EXTMATCH
+C		"]"			"*([]a[])"	       0       EXTMATCH
+C		"a"			"*([]a[])"	       0       EXTMATCH
+C		"b"			"*([!]a[])"	       0       EXTMATCH
+C		"["			"*([!]a[]|[[])"	       0       EXTMATCH
+C		"]"			"*([!]a[]|[]])"	       0       EXTMATCH
+C		"["			"!([!]a[])"	       0       EXTMATCH
+C		"]"			"!([!]a[])"	       0       EXTMATCH
+C		")"			"*([)])"	       0       EXTMATCH
+C		"*"			"*([*(])"	       0       EXTMATCH
+C		"abcd"			"*!(|a)cd"	       0       EXTMATCH
+C		"ab/.a"			"+([abc])/*"	       NOMATCH EXTMATCH|PATHNAME|PERIOD
+C		""			""		       0
+C		""			""		       0       EXTMATCH
+C		""			"*([abc])"	       0       EXTMATCH
+C		""			"?([abc])"	       0       EXTMATCH
diff --git a/ap/build/uClibc/test/misc/tst-gnuglob.c b/ap/build/uClibc/test/misc/tst-gnuglob.c
new file mode 100644
index 0000000..04c6743
--- /dev/null
+++ b/ap/build/uClibc/test/misc/tst-gnuglob.c
@@ -0,0 +1,447 @@
+/* Test the GNU extensions in glob which allow the user to provide callbacks
+   for the filesystem access functions.
+   Copyright (C) 2001-2002 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+   Contributed by Ulrich Drepper <drepper@redhat.com>, 2001.
+
+   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 <dirent.h>
+#include <errno.h>
+#include <error.h>
+#include <glob.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <sys/stat.h>
+
+
+// #define DEBUG
+#ifdef DEBUG
+# define PRINTF(fmt, args...) printf (fmt, ##args)
+#else
+# define PRINTF(fmt, args...)
+#endif
+
+
+#ifdef GLOB_ALTDIRFUNC
+static struct
+{
+  const char *name;
+  int level;
+  int type;
+} filesystem[] =
+{
+  { ".", 1, DT_DIR },
+  { "..", 1, DT_DIR },
+  { "file1lev1", 1, DT_REG },
+  { "file2lev1", 1, DT_UNKNOWN },
+  { "dir1lev1", 1, DT_UNKNOWN },
+    { ".", 2, DT_DIR },
+    { "..", 2, DT_DIR },
+    { "file1lev2", 2, DT_REG },
+    { "dir1lev2", 2, DT_DIR },
+      { ".", 3, DT_DIR },
+      { "..", 3, DT_DIR },
+    { "dir2lev2", 2, DT_DIR },
+      { ".", 3, DT_DIR },
+      { "..", 3, DT_DIR },
+      { ".foo", 3, DT_REG },
+      { "dir1lev3", 3, DT_DIR },
+        { ".", 4, DT_DIR },
+        { "..", 4, DT_DIR },
+        { "file1lev4", 4, DT_REG },
+      { "file1lev3", 3, DT_REG },
+      { "file2lev3", 3, DT_REG },
+    { "file2lev2", 2, DT_REG },
+    { "file3lev2", 2, DT_REG },
+    { "dir3lev2", 2, DT_DIR },
+      { ".", 3, DT_DIR },
+      { "..", 3, DT_DIR },
+      { "file3lev3", 3, DT_REG },
+      { "file4lev3", 3, DT_REG },
+  { "dir2lev1", 1, DT_DIR },
+    { ".", 2, DT_DIR },
+    { "..", 2, DT_DIR },
+    { "dir1lev2", 2, DT_UNKNOWN },
+      { ".", 3, DT_DIR },
+      { "..", 3, DT_DIR },
+      { ".foo", 3, DT_REG },
+      { ".dir", 3, DT_DIR },
+        { ".", 4, DT_DIR },
+        { "..", 4, DT_DIR },
+        { "hidden", 4, DT_REG }
+};
+#define nfiles (sizeof (filesystem) / sizeof (filesystem[0]))
+
+
+typedef struct
+{
+  int level;
+  int idx;
+  struct dirent d;
+  char room_for_dirent[NAME_MAX];
+} my_DIR;
+
+
+static long int
+find_file (const char *s)
+{
+  int level = 1;
+  long int idx = 0;
+
+  if (strcmp (s, ".") == 0)
+    return 0;
+
+  if (s[0] == '.' && s[1] == '/')
+    s += 2;
+
+  while (*s != '\0')
+    {
+      char *endp = strchrnul (s, '/');
+
+      PRINTF ("looking for %.*s, level %d\n", (int) (endp - s), s, level);
+
+      while (idx < nfiles && filesystem[idx].level >= level)
+	{
+	  if (filesystem[idx].level == level
+	      && memcmp (s, filesystem[idx].name, endp - s) == 0
+	      && filesystem[idx].name[endp - s] == '\0')
+	    break;
+	  ++idx;
+	}
+
+      if (idx == nfiles || filesystem[idx].level < level)
+	{
+	  errno = ENOENT;
+	  return -1;
+	}
+
+      if (*endp == '\0')
+	return idx + 1;
+
+      if (filesystem[idx].type != DT_DIR
+	  && (idx + 1 >= nfiles
+	      || filesystem[idx].level >= filesystem[idx + 1].level))
+	{
+	  errno = ENOTDIR;
+	  return -1;
+	}
+
+      ++idx;
+
+      s = endp + 1;
+      ++level;
+    }
+
+  errno = ENOENT;
+  return -1;
+}
+
+
+static void *
+my_opendir (const char *s)
+{
+  long int idx = find_file (s);
+  my_DIR *dir;
+
+
+  if (idx == -1)
+    {
+      PRINTF ("my_opendir(\"%s\") == NULL\n", s);
+      return NULL;
+    }
+
+  dir = (my_DIR *) malloc (sizeof (my_DIR));
+  if (dir == NULL)
+    error (EXIT_FAILURE, errno, "cannot allocate directory handle");
+
+  dir->level = filesystem[idx].level;
+  dir->idx = idx;
+
+  PRINTF ("my_opendir(\"%s\") == { level: %d, idx: %ld }\n",
+	  s, filesystem[idx].level, idx);
+
+  return dir;
+}
+
+
+static struct dirent *
+my_readdir (void *gdir)
+{
+  my_DIR *dir = gdir;
+
+  if (dir->idx == -1)
+    {
+      PRINTF ("my_readdir ({ level: %d, idx: %ld }) = NULL\n",
+	      dir->level, (long int) dir->idx);
+      return NULL;
+    }
+
+  while (dir->idx < nfiles && filesystem[dir->idx].level > dir->level)
+    ++dir->idx;
+
+  if (dir->idx == nfiles || filesystem[dir->idx].level < dir->level)
+    {
+      dir->idx = -1;
+      PRINTF ("my_readdir ({ level: %d, idx: %ld }) = NULL\n",
+	      dir->level, (long int) dir->idx);
+      return NULL;
+    }
+
+  dir->d.d_ino = dir->idx;
+
+#ifdef _DIRENT_HAVE_D_TYPE
+  dir->d.d_type = filesystem[dir->idx].type;
+#endif
+
+  strcpy (dir->d.d_name, filesystem[dir->idx].name);
+
+#ifdef _DIRENT_HAVE_D_TYPE
+  PRINTF ("my_readdir ({ level: %d, idx: %ld }) = { d_ino: %ld, d_type: %d, d_name: \"%s\" }\n",
+	  dir->level, (long int) dir->idx, dir->d.d_ino, dir->d.d_type,
+	  dir->d.d_name);
+#else
+  PRINTF ("my_readdir ({ level: %d, idx: %ld }) = { d_ino: %ld, d_name: \"%s\" }\n",
+	  dir->level, (long int) dir->idx, dir->d.d_ino,
+	  dir->d.d_name);
+#endif
+
+  ++dir->idx;
+
+  return &dir->d;
+}
+
+
+static void
+my_closedir (void *dir)
+{
+  PRINTF ("my_closedir ()\n");
+  free (dir);
+}
+
+
+/* We use this function for lstat as well since we don't have any.  */
+static int
+my_stat (const char *name, struct stat *st)
+{
+  long int idx = find_file (name);
+
+  if (idx == -1)
+    {
+      PRINTF ("my_stat (\"%s\", ...) = -1 (%s)\n", name, strerror (errno));
+      return -1;
+    }
+
+  memset (st, '\0', sizeof (*st));
+
+  if (filesystem[idx].type == DT_UNKNOWN)
+    st->st_mode = DTTOIF (idx + 1 < nfiles
+			  && filesystem[idx].level < filesystem[idx + 1].level
+			  ? DT_DIR : DT_REG) | 0777;
+  else
+    st->st_mode = DTTOIF (filesystem[idx].type) | 0777;
+
+  PRINTF ("my_stat (\"%s\", { st_mode: %o }) = 0\n", name, st->st_mode);
+
+  return 0;
+}
+
+
+static const char *glob_errstring[] =
+{
+  [GLOB_NOSPACE] = "out of memory",
+  [GLOB_ABORTED] = "read error",
+  [GLOB_NOMATCH] = "no matches found"
+};
+#define nglob_errstring (sizeof (glob_errstring) / sizeof (glob_errstring[0]))
+
+
+static const char *
+flagstr (int flags)
+{
+  const char *strs[] =
+  {
+    "GLOB_ERR", "GLOB_MARK", "GLOB_NOSORT", "GLOB_DOOFSS", "GLOB_NOCHECK",
+    "GLOB_APPEND", "GLOB_NOESCAPE", "GLOB_PERIOD", "GLOB_MAGCHAR",
+    "GLOB_ALTDIRFUNC", "GLOB_BRACE", "GLOB_NOMAGIC", "GLOB_TILDE",
+    "GLOB_ONLYDIR", "GLOB_TILDECHECK"
+  };
+#define nstrs (sizeof (strs) / sizeof (strs[0]))
+  static char buf[100];
+  char *cp = buf;
+  int cnt;
+
+  for (cnt = 0; cnt < nstrs; ++cnt)
+    if (flags & (1 << cnt))
+      {
+	flags &= ~(1 << cnt);
+	if (cp != buf)
+	  *cp++ = '|';
+	cp = stpcpy (cp, strs[cnt]);
+      }
+
+  if (flags != 0)
+    {
+      if (cp != buf)
+	*cp++ = '|';
+      sprintf (cp, "%#x", flags);
+    }
+
+  return buf;
+}
+
+
+static int
+test_result (const char *fmt, int flags, glob_t *gl, const char *str[])
+{
+  size_t cnt;
+  int result = 0;
+
+  printf ("results for glob (\"%s\", %s)\n", fmt, flagstr (flags));
+  for (cnt = 0; cnt < gl->gl_pathc && str[cnt] != NULL; ++cnt)
+    {
+      int ok = strcmp (gl->gl_pathv[cnt], str[cnt]) == 0;
+      const char *errstr = "";
+
+      if (! ok)
+	{
+	  size_t inner;
+
+	  for (inner = 0; str[inner] != NULL; ++inner)
+	    if (strcmp (gl->gl_pathv[cnt], str[inner]) == 0)
+	      break;
+
+	  if (str[inner] == NULL)
+	    errstr =  ok ? "" : " *** WRONG";
+	  else
+	    errstr = ok ? "" : " * wrong position";
+
+	  result = 1;
+	}
+
+      printf ("  %s%s\n", gl->gl_pathv[cnt], errstr);
+    }
+  puts ("");
+
+  if (str[cnt] != NULL || cnt < gl->gl_pathc)
+    {
+      puts ("  *** incorrect number of entries");
+      result = 1;
+    }
+
+  return result;
+}
+
+
+int
+main (void)
+{
+  glob_t gl;
+  int errval;
+  int result = 0;
+  const char *fmt;
+  int flags;
+
+  memset (&gl, '\0', sizeof (gl));
+
+  gl.gl_closedir = my_closedir;
+  gl.gl_readdir = my_readdir;
+  gl.gl_opendir = my_opendir;
+  gl.gl_lstat = my_stat;
+  gl.gl_stat = my_stat;
+
+#define test(a, b, c...) \
+  fmt = a;								      \
+  flags = b;								      \
+  errval = glob (fmt, flags, NULL, &gl);				      \
+  if (errval != 0)							      \
+    {									      \
+      printf ("glob (\"%s\", %s) failed: %s\n", fmt, flagstr (flags),	      \
+	      errval >= 0 && errval < nglob_errstring			      \
+	      ? glob_errstring[errval] : "???");			      \
+      result = 1;							      \
+    }									      \
+  else									      \
+    result |= test_result (fmt, flags, &gl, (const char *[]) { c, NULL })
+
+  test ("*/*/*", GLOB_ALTDIRFUNC,
+	"dir1lev1/dir2lev2/dir1lev3",
+	"dir1lev1/dir2lev2/file1lev3",
+	"dir1lev1/dir2lev2/file2lev3",
+	"dir1lev1/dir3lev2/file3lev3",
+	"dir1lev1/dir3lev2/file4lev3");
+
+  test ("*/*/*", GLOB_ALTDIRFUNC | GLOB_PERIOD,
+	"dir1lev1/dir1lev2/.",
+	"dir1lev1/dir1lev2/..",
+	"dir1lev1/dir2lev2/.",
+	"dir1lev1/dir2lev2/..",
+	"dir1lev1/dir2lev2/.foo",
+	"dir1lev1/dir2lev2/dir1lev3",
+	"dir1lev1/dir2lev2/file1lev3",
+	"dir1lev1/dir2lev2/file2lev3",
+	"dir1lev1/dir3lev2/.",
+	"dir1lev1/dir3lev2/..",
+	"dir1lev1/dir3lev2/file3lev3",
+	"dir1lev1/dir3lev2/file4lev3",
+	"dir2lev1/dir1lev2/.",
+	"dir2lev1/dir1lev2/..",
+	"dir2lev1/dir1lev2/.dir",
+	"dir2lev1/dir1lev2/.foo");
+
+  test ("*/*/.*", GLOB_ALTDIRFUNC,
+	"dir1lev1/dir1lev2/.",
+	"dir1lev1/dir1lev2/..",
+	"dir1lev1/dir2lev2/.",
+	"dir1lev1/dir2lev2/..",
+	"dir1lev1/dir2lev2/.foo",
+	"dir1lev1/dir3lev2/.",
+	"dir1lev1/dir3lev2/..",
+	"dir2lev1/dir1lev2/.",
+	"dir2lev1/dir1lev2/..",
+	"dir2lev1/dir1lev2/.dir",
+	"dir2lev1/dir1lev2/.foo");
+
+  test ("*1*/*2*/.*", GLOB_ALTDIRFUNC,
+	"dir1lev1/dir1lev2/.",
+	"dir1lev1/dir1lev2/..",
+	"dir1lev1/dir2lev2/.",
+	"dir1lev1/dir2lev2/..",
+	"dir1lev1/dir2lev2/.foo",
+	"dir1lev1/dir3lev2/.",
+	"dir1lev1/dir3lev2/..",
+	"dir2lev1/dir1lev2/.",
+	"dir2lev1/dir1lev2/..",
+	"dir2lev1/dir1lev2/.dir",
+	"dir2lev1/dir1lev2/.foo");
+
+  test ("*1*/*1*/.*", GLOB_ALTDIRFUNC,
+	"dir1lev1/dir1lev2/.",
+	"dir1lev1/dir1lev2/..",
+	"dir2lev1/dir1lev2/.",
+	"dir2lev1/dir1lev2/..",
+	"dir2lev1/dir1lev2/.dir",
+	"dir2lev1/dir1lev2/.foo");
+
+  globfree (&gl);
+
+  return result;
+}
+
+#else
+int main(void) { return 0; }
+#endif
diff --git a/ap/build/uClibc/test/misc/tst-scandir.c b/ap/build/uClibc/test/misc/tst-scandir.c
new file mode 100644
index 0000000..df62a40
--- /dev/null
+++ b/ap/build/uClibc/test/misc/tst-scandir.c
@@ -0,0 +1,23 @@
+#include <dirent.h>
+#include <errno.h>
+#include <stdio.h> /* perror() */
+#include <stdlib.h>
+
+int skip_all(const struct dirent *dirbuf)
+{
+	errno = EBADF;
+	return 0;
+}
+
+int main(void)
+{
+	struct dirent **namelist;
+	int n;
+
+	n = scandir(".", &namelist, skip_all, 0);
+	if (n < 0) {
+		perror("scandir");
+		return EXIT_FAILURE;
+	}
+	return EXIT_SUCCESS;
+}
diff --git a/ap/build/uClibc/test/misc/tst-seekdir.c b/ap/build/uClibc/test/misc/tst-seekdir.c
new file mode 100644
index 0000000..7dd5d2e
--- /dev/null
+++ b/ap/build/uClibc/test/misc/tst-seekdir.c
@@ -0,0 +1,79 @@
+#include <stdio.h>
+#include <string.h>
+#include <errno.h>
+#include <dirent.h>
+#include <stdlib.h>
+
+int
+main (int argc, char *argv[])
+{
+  DIR * dirp;
+  long int save3 = 0;
+  long int cur;
+  int i = 0;
+  int result = 0;
+  struct dirent *dp;
+  off_t save0, rewind_ret;
+
+  dirp = opendir (".");
+  if (dirp == NULL)
+    {
+      printf ("opendir failed: %s\n", strerror(errno));
+      return 1;
+    }
+
+  save0 = telldir (dirp);
+  if (save0 == -1)
+    {
+      printf ("telldir failed: %s\n", strerror(errno));
+      result = 1;
+    }
+
+  for (dp = readdir (dirp); dp != NULL; dp = readdir (dirp))
+    {
+      /* save position 3 (after fourth entry) */
+      if (i++ == 3)
+	save3 = telldir (dirp);
+
+      printf ("%s\n", dp->d_name);
+
+      /* stop at 400 (just to make sure dirp->__offset and dirp->__size are
+	 scrambled */
+      if (i == 400)
+	break;
+    }
+
+  printf ("going back past 4-th entry...\n");
+
+  /* go back to saved entry */
+  seekdir (dirp, save3);
+
+  /* Check whether telldir equals to save3 now.  */
+  cur = telldir (dirp);
+  if (cur != save3)
+    {
+      printf ("seekdir (d, %ld); telldir (d) == %ld\n", save3, cur);
+      result = 1;
+    }
+
+  /* print remaining files (3-last) */
+  for (dp = readdir (dirp); dp != NULL; dp = readdir (dirp))
+    printf ("%s\n", dp->d_name);
+
+  /* Check rewinddir */
+  rewinddir (dirp);
+  rewind_ret = telldir (dirp);
+  if (rewind_ret == -1)
+    {
+      printf ("telldir failed: %s\n", strerror(errno));
+      result = 1;
+    }
+  else if (save0 != rewind_ret)
+    {
+      printf ("rewinddir didn't reset directory stream\n");
+      result = 1;
+    }
+
+  closedir (dirp);
+  return result;
+}
diff --git a/ap/build/uClibc/test/misc/tst-utmp.c b/ap/build/uClibc/test/misc/tst-utmp.c
new file mode 100644
index 0000000..06ba140
--- /dev/null
+++ b/ap/build/uClibc/test/misc/tst-utmp.c
@@ -0,0 +1,404 @@
+/* Tests for UTMP functions.
+   Copyright (C) 1998, 2001-2003 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+   Contributed by Mark Kettenis <kettenis@phys.uva.nl>, 1998.
+
+   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 <errno.h>
+#include <error.h>
+#include <stdlib.h>
+#include <string.h>
+#include <sys/types.h>
+#include <time.h>
+
+#ifdef UTMPX
+# include <utmpx.h>
+# define utmp utmpx
+# define utmpname utmpxname
+# define setutent setutxent
+# define getutent getutxent
+# define endutent endutxent
+# define getutline getutxline
+# define getutid getutxid
+# define pututline pututxline
+#else
+# include <utmp.h>
+#endif
+
+
+#if _HAVE_UT_TYPE || defined UTMPX
+
+/* Prototype for our test function.  */
+static int do_test (int argc, char *argv[]);
+
+/* We have a preparation function.  */
+static void do_prepare (int argc, char *argv[]);
+#define PREPARE do_prepare
+
+/* This defines the `main' function and some more.  */
+#include "../test-skeleton.c"
+
+
+/* These are for the temporary file we generate.  */
+char *name;
+int fd;
+
+static void
+do_prepare (int argc, char *argv[])
+{
+  size_t name_len;
+
+  name_len = strlen (test_dir);
+  name = malloc (name_len + sizeof ("/utmpXXXXXX"));
+  mempcpy (mempcpy (name, test_dir, name_len),
+	   "/utmpXXXXXX", sizeof ("/utmpXXXXXX"));
+  add_temp_file (name);
+
+  /* Open our test file.  */
+  fd = mkstemp (name);
+  if (fd == -1)
+    error (EXIT_FAILURE, errno, "cannot open test file `%s'", name);
+}
+
+struct utmp entry[] =
+{
+#if _HAVE_UT_TV || defined UTMPX
+#define UT(a)  .ut_tv = { .tv_sec = (a)}
+#else
+#define UT(a)  .ut_time = (a)
+#endif
+
+  { .ut_type = BOOT_TIME, .ut_pid = 1, UT(1000) },
+  { .ut_type = RUN_LVL, .ut_pid = 1, UT(2000) },
+  { .ut_type = INIT_PROCESS, .ut_pid = 5, .ut_id = "si", UT(3000) },
+  { .ut_type = LOGIN_PROCESS, .ut_pid = 23, .ut_line = "tty1", .ut_id = "1",
+    .ut_user = "LOGIN", UT(4000) },
+  { .ut_type = USER_PROCESS, .ut_pid = 24, .ut_line = "tty2", .ut_id = "2",
+    .ut_user = "albert", UT(8000) },
+  { .ut_type = USER_PROCESS, .ut_pid = 196, .ut_line = "ttyp0", .ut_id = "p0",
+    .ut_user = "niels", UT(10000) },
+  { .ut_type = DEAD_PROCESS, .ut_line = "ttyp1", .ut_id = "p1", UT(16000) },
+  { .ut_type = EMPTY },
+  { .ut_type = EMPTY }
+};
+int num_entries = sizeof entry / sizeof (struct utmp);
+
+time_t entry_time = 20000;
+pid_t entry_pid = 234;
+
+static int
+do_init (void)
+{
+  int n;
+
+  setutent ();
+
+  for (n = 0; n < num_entries; n++)
+    {
+      if (pututline (&entry[n]) == NULL)
+	{
+	  error (0, errno, "cannot write UTMP entry");
+	  return 1;
+	}
+    }
+
+  endutent ();
+
+  return 0;
+}
+
+
+static int
+do_check (void)
+{
+  struct utmp *ut;
+  int n;
+
+  setutent ();
+
+  n = 0;
+  while ((ut = getutent ()))
+    {
+      if (n < num_entries &&
+	  memcmp (ut, &entry[n], sizeof (struct utmp)))
+	{
+	  error (0, 0, "UTMP entry does not match");
+	  return 1;
+	}
+
+      n++;
+    }
+
+  if (n != num_entries)
+    {
+      error (0, 0, "number of UTMP entries is incorrect");
+      return 1;
+    }
+
+  endutent ();
+
+  return 0;
+}
+
+static int
+simulate_login (const char *line, const char *user)
+{
+  int n;
+
+  for (n = 0; n < num_entries; n++)
+    {
+      if (strcmp (line, entry[n].ut_line) == 0 ||
+	  entry[n].ut_type == DEAD_PROCESS)
+	{
+	  if (entry[n].ut_pid == DEAD_PROCESS)
+	    entry[n].ut_pid = (entry_pid += 27);
+	  entry[n].ut_type = USER_PROCESS;
+	  strncpy (entry[n].ut_user, user, sizeof (entry[n].ut_user));
+#if _HAVE_UT_TV - 0 || defined UTMPX
+	  entry[n].ut_tv.tv_sec = (entry_time += 1000);
+#else
+          entry[n].ut_time = (entry_time += 1000);
+#endif
+	  setutent ();
+
+	  if (pututline (&entry[n]) == NULL)
+	    {
+	      error (0, errno, "cannot write UTMP entry");
+	      return 1;
+	    }
+
+	  endutent ();
+
+	  return 0;
+	}
+    }
+
+  error (0, 0, "no entries available");
+  return 1;
+}
+
+static int
+simulate_logout (const char *line)
+{
+  int n;
+
+  for (n = 0; n < num_entries; n++)
+    {
+      if (strcmp (line, entry[n].ut_line) == 0)
+	{
+	  entry[n].ut_type = DEAD_PROCESS;
+	  strncpy (entry[n].ut_user, "", sizeof (entry[n].ut_user));
+#if _HAVE_UT_TV - 0 || defined UTMPX
+          entry[n].ut_tv.tv_sec = (entry_time += 1000);
+#else
+          entry[n].ut_time = (entry_time += 1000);
+#endif
+	  setutent ();
+
+	  if (pututline (&entry[n]) == NULL)
+	    {
+	      error (0, errno, "cannot write UTMP entry");
+	      return 1;
+	    }
+
+	  endutent ();
+
+	  return 0;
+	}
+    }
+
+  error (0, 0, "no entry found for `%s'", line);
+  return 1;
+}
+
+static int
+check_login (const char *line)
+{
+  struct utmp *up;
+  struct utmp ut;
+  int n;
+
+  setutent ();
+
+  strcpy (ut.ut_line, line);
+  up = getutline (&ut);
+  if (up == NULL)
+    {
+      error (0, errno, "cannot get entry for line `%s'", line);
+      return 1;
+    }
+
+  endutent ();
+
+  for (n = 0; n < num_entries; n++)
+    {
+      if (strcmp (line, entry[n].ut_line) == 0)
+	{
+	  if (memcmp (up, &entry[n], sizeof (struct utmp)))
+	    {
+	      error (0, 0, "UTMP entry does not match");
+	      return 1;
+	    }
+
+	  return 0;
+	}
+    }
+
+  error (0, 0, "bogus entry for line `%s'", line);
+  return 1;
+}
+
+static int
+check_logout (const char *line)
+{
+  struct utmp ut;
+
+  setutent ();
+
+  strcpy (ut.ut_line, line);
+  if (getutline (&ut) != NULL)
+    {
+      error (0, 0, "bogus login entry for `%s'", line);
+      return 1;
+    }
+
+  endutent ();
+
+  return 0;
+}
+
+static int
+check_id (const char *id)
+{
+  struct utmp *up;
+  struct utmp ut;
+  int n;
+
+  setutent ();
+
+  ut.ut_type = USER_PROCESS;
+  strcpy (ut.ut_id, id);
+  up = getutid (&ut);
+  if (up == NULL)
+    {
+      error (0, errno, "cannot get entry for ID `%s'", id);
+      return 1;
+    }
+
+  endutent ();
+
+  for (n = 0; n < num_entries; n++)
+    {
+      if (strcmp (id, entry[n].ut_id) == 0)
+	{
+	  if (memcmp (up, &entry[n], sizeof (struct utmp)))
+	    {
+	      error (0, 0, "UTMP entry does not match");
+	      return 1;
+	    }
+
+	  return 0;
+	}
+    }
+
+  error (0, 0, "bogus entry for ID `%s'", id);
+  return 1;
+}
+
+static int
+check_type (int type)
+{
+  struct utmp *up;
+  struct utmp ut;
+  int n;
+
+  setutent ();
+
+  ut.ut_type = type;
+  up = getutid (&ut);
+  if (up == NULL)
+    {
+      error (0, errno, "cannot get entry for type `%d'", type);
+      return 1;
+    }
+
+  endutent ();
+
+  for (n = 0; n < num_entries; n++)
+    {
+      if (type == entry[n].ut_type)
+	{
+	  if (memcmp (up, &entry[n], sizeof (struct utmp)))
+	    {
+	      error (0, 0, "UTMP entry does not match");
+	      return 1;
+	    }
+
+	  return 0;
+	}
+    }
+
+  error (0, 0, "bogus entry for type `%d'", type);
+  return 1;
+}
+
+static int
+do_test (int argc, char *argv[])
+{
+  int result = 0;
+
+  utmpname (name);
+
+  result |= do_init ();
+  result |= do_check ();
+
+  result |= simulate_login ("tty1", "erwin");
+  result |= do_check ();
+
+  result |= simulate_login ("ttyp1", "paul");
+  result |= do_check ();
+
+  result |= simulate_logout ("tty2");
+  result |= do_check ();
+
+  result |= simulate_logout ("ttyp0");
+  result |= do_check ();
+
+  result |= simulate_login ("ttyp2", "richard");
+  result |= do_check ();
+
+  result |= check_login ("tty1");
+  result |= check_logout ("ttyp0");
+  result |= check_id ("p1");
+  result |= check_id ("2");
+  result |= check_id ("si");
+  result |= check_type (BOOT_TIME);
+  result |= check_type (RUN_LVL);
+
+  return result;
+}
+
+#else
+
+/* No field 'ut_type' in struct utmp.  */
+int
+main ()
+{
+  return 0;
+}
+
+#endif
diff --git a/ap/build/uClibc/test/mmap/Makefile b/ap/build/uClibc/test/mmap/Makefile
new file mode 100644
index 0000000..64b652d
--- /dev/null
+++ b/ap/build/uClibc/test/mmap/Makefile
@@ -0,0 +1,7 @@
+# uClibc mmap tests
+# Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
+
+top_builddir=../../
+include ../Rules.mak
+-include Makefile.in
+include ../Test.mak
diff --git a/ap/build/uClibc/test/mmap/mmap.c b/ap/build/uClibc/test/mmap/mmap.c
new file mode 100644
index 0000000..8b29737
--- /dev/null
+++ b/ap/build/uClibc/test/mmap/mmap.c
@@ -0,0 +1,73 @@
+
+/* The mmap test is useful, since syscalls with 6 arguments
+ * (as mmap) are done differently on various architectures.
+ */
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <errno.h>
+#include <unistd.h>
+#include <sys/mman.h>
+
+#define SIZEOF_ARRAY(type) (sizeof(type)/sizeof(*type))
+
+struct mmap_test {
+	void *ret;
+	int err;
+	struct {
+		void *start;
+		size_t length;
+		int prot;
+		int flags;
+		int fd;
+		off_t offset;
+	} args;
+};
+
+struct mmap_test tests[] = {
+	[0] {
+		.err = 0,
+		.args.start = NULL,
+		.args.length = 4096,
+		.args.prot = PROT_READ|PROT_WRITE,
+		.args.flags = MAP_PRIVATE|MAP_ANONYMOUS,
+		.args.fd = 0,
+		.args.offset = 0
+	},
+};
+
+#define err(fmt, args...) \
+	do { \
+		fprintf(stderr, fmt "\n" , ## args); \
+		exit(1); \
+	} while (0)
+#define errp(fmt, args...) err(fmt ": %s" , ## args , strerror(errno))
+
+int main(int argc, char **argv)
+{
+	int i;
+	struct mmap_test *t;
+
+	for (i=0; i<SIZEOF_ARRAY(tests); ++i) {
+		t = tests + i;
+
+		errno = 0;
+		t->ret = mmap(t->args.start, t->args.length, t->args.prot,
+		              t->args.flags, t->args.fd, t->args.offset);
+
+		if (t->err) {
+			if (t->ret != MAP_FAILED)
+				err("mmap test %i should have failed, but gave us %p", i, t->ret);
+			else if (t->err != errno)
+				errp("mmap test %i failed, but gave us wrong errno (got %i instead of %i)", i, errno, t->err);
+		} else {
+			if (t->ret == MAP_FAILED)
+				errp("mmap test %i failed", i);
+			else if (munmap(t->ret, t->args.length) != 0)
+				errp("munmap test %i failed", i);
+		}
+	}
+
+	exit(0);
+}
diff --git a/ap/build/uClibc/test/mmap/mmap2.c b/ap/build/uClibc/test/mmap/mmap2.c
new file mode 100644
index 0000000..8b94c61
--- /dev/null
+++ b/ap/build/uClibc/test/mmap/mmap2.c
@@ -0,0 +1,46 @@
+/* When trying to map /dev/mem with offset 0xFFFFF000 on the ARM platform, mmap
+ * returns -EOVERFLOW.
+ *
+ * Since off_t is defined as a long int and the sign bit is set in the address,
+ * the shift operation shifts in ones instead of zeroes
+ * from the left. This results the offset sent to the kernel function becomes
+ * 0xFFFFFFFF instead of 0x000FFFFF with MMAP2_PAGE_SHIFT set to 12.
+ */
+
+#include <unistd.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <errno.h>
+#include <fcntl.h>
+#include <sys/mman.h>
+
+#define FATAL do { fprintf(stderr, "Error at line %d, file %s (%d) [%s]\n", \
+  __LINE__, __FILE__, errno, strerror(errno)); exit(1); } while(0)
+
+#define MAP_SIZE 4096UL
+#define MAP_MASK (MAP_SIZE - 1)
+
+int main(int argc, char **argv) {
+    void* map_base = 0;
+    int fd;
+    off_t target = 0xfffff000;
+    if((fd = open("/dev/mem", O_RDWR | O_SYNC)) == -1) {
+        /* skip test for non-root users */
+        if (errno == EACCES)
+            return 0;
+        FATAL;
+    }
+    printf("/dev/mem opened.\n");
+    fflush(stdout);
+
+   /* Map one page */
+    map_base = mmap(0, MAP_SIZE, PROT_READ | PROT_WRITE, MAP_SHARED,
+                        fd, target & ~MAP_MASK);
+    if(map_base == (void *) -1) FATAL;
+    printf("Memory mapped at address %p.\n", map_base);
+    fflush(stdout);
+    if(munmap(map_base, MAP_SIZE) == -1) FATAL;
+    close(fd);
+    return 0;
+}
diff --git a/ap/build/uClibc/test/mmap/mmap64.c b/ap/build/uClibc/test/mmap/mmap64.c
new file mode 100644
index 0000000..87165fe
--- /dev/null
+++ b/ap/build/uClibc/test/mmap/mmap64.c
@@ -0,0 +1,29 @@
+
+/* The mmap test is useful, since syscalls with 6 arguments
+ * (as mmap) are done differently on various architectures.
+ */
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <unistd.h>
+#include <sys/mman.h>
+#include <features.h>
+
+int main(int argc, char **argv)
+{
+#ifdef __UCLIBC_HAS_LFS__
+	void *ptr;
+
+	ptr = mmap64(NULL, 4096, PROT_READ|PROT_WRITE,
+		MAP_PRIVATE|MAP_ANONYMOUS, 0, 0);
+
+	if (ptr == MAP_FAILED) {
+		perror("mmap");
+		exit(1);
+	}
+	printf("mmap returned %p\n", ptr);
+	exit(0);
+#else
+	exit(0);
+#endif
+}
diff --git a/ap/build/uClibc/test/nptl/Makefile b/ap/build/uClibc/test/nptl/Makefile
new file mode 100644
index 0000000..c22b635
--- /dev/null
+++ b/ap/build/uClibc/test/nptl/Makefile
@@ -0,0 +1,8 @@
+# uClibc NPTL tests
+# Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
+
+top_builddir=../../
+top_srcdir=../../
+include ../Rules.mak
+-include Makefile.in
+include ../Test.mak
diff --git a/ap/build/uClibc/test/nptl/Makefile.in b/ap/build/uClibc/test/nptl/Makefile.in
new file mode 100644
index 0000000..976034d
--- /dev/null
+++ b/ap/build/uClibc/test/nptl/Makefile.in
@@ -0,0 +1,224 @@
+# uClibc NPTL tests
+# Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
+
+TESTS := tst-align tst-align2 tst-atfork1 tst-attr1 tst-attr2 tst-attr3	\
+	tst-barrier1 tst-barrier2 tst-barrier3 tst-barrier4 tst-basic1	\
+	tst-basic2 tst-basic3 tst-basic4 tst-basic5 tst-basic6		\
+	tst-cancel1 tst-cancel2 tst-cancel3 tst-cancel6 tst-cancel7	\
+	tst-cancel8 tst-cancel9 tst-cancel10 tst-cancel11 tst-cancel12	\
+	tst-cancel13 tst-cancel14 tst-cancel15 tst-cancel16		\
+	tst-cancel19 tst-cancel20 tst-cancel21 tst-cancel22		\
+	tst-cleanup0 tst-cleanup1 tst-cleanup2 tst-cleanup3		\
+	tst-cleanup4 tst-clock1 tst-clock2 tst-cond1 tst-cond2		\
+	tst-cond3 tst-cond4 tst-cond5 tst-cond6 tst-cond7 tst-cond8	\
+	tst-cond9 tst-cond10 tst-cond11 tst-cond12 tst-cond13		\
+	tst-cond14 tst-cond15 tst-cond16 tst-cond17 tst-cond18		\
+	tst-cond19 tst-cond20 tst-cond21 tst-detach1 tst-eintr1		\
+	tst-eintr2 tst-eintr3 tst-eintr4 tst-eintr5 tst-exec2 tst-exec3	\
+	tst-exec4 tst-exit1 tst-exit2 tst-exit3 tst-flock1 tst-flock2	\
+	tst-fork1 tst-fork2 tst-fork3 tst-fork4 tst-initializers1	\
+	tst-join1 tst-join2 tst-join3 tst-join4 tst-join5 tst-key1	\
+	tst-key2 tst-key3 tst-key4 tst-kill1 tst-kill2 tst-kill3	\
+	tst-kill4 tst-kill5 tst-kill6 tst-mutex1 tst-mutex2 tst-mutex3	\
+	tst-mutex4 tst-mutex5 tst-mutex6 tst-mutex7 tst-mutex8		\
+	tst-mutex9 tst-mutex5a tst-mutex7a tst-once1 tst-once2		\
+	tst-once3 tst-once4 tst-popen1 tst-raise1 tst-rwlock1		\
+	tst-rwlock2 tst-rwlock3 tst-rwlock4 tst-rwlock5 tst-rwlock6	\
+	tst-rwlock7 tst-rwlock8 tst-rwlock9 tst-rwlock10 tst-rwlock11	\
+	tst-rwlock12 tst-rwlock13 tst-rwlock14 tst-sched1 tst-sem1	\
+	tst-sem2 tst-sem3 tst-sem4 tst-sem5 tst-sem6 tst-sem7 tst-sem8	\
+	tst-sem9 tst-signal1 tst-signal2 tst-signal3 tst-signal4	\
+	tst-signal5 tst-signal6 tst-spin1 tst-spin2 tst-spin3		\
+	tst-stack1 tst-stack2 tst-stdio1 tst-stdio2 tst-sysconf		\
+	tst-tls1 tst-tls2 tst-tls3 tst-tls4 tst-tls5 tst-tsd1 tst-tsd2	\
+	tst-tsd3 tst-tsd4 tst-tsd5 tst-umask1 \
+	tst-align3 tst-cancel4 tst-cancel5 tst-cancel18 tst-cancel23 \
+	tst-cancel25 tst-cancelx2 tst-cancelx3 tst-cancelx4 tst-cancelx6 \
+	tst-cancelx7 tst-cancelx8 tst-cancelx9 tst-cancelx10 tst-cancelx11 \
+	tst-cancelx12 tst-cancelx13 tst-cancelx14 tst-cancelx15 tst-cancelx16 \
+	tst-cancelx18 tst-cancelx20 tst-cancelx21 tst-cleanupx0 tst-cleanupx1 \
+	tst-cleanupx2 tst-cleanupx3 tst-cleanupx4 tst-cond22 tst-cond23 \
+	tst-dlsym1 tst-getpid1 tst-getpid2 tst-getpid3 tst-join6 tst-tsd6 \
+	tst-oddstacklimit tst-oncex3 tst-oncex4 tst-rwlock2a  \
+	tst-basic7 tst-fini1 tst-signal7 \
+	tst-unload tst-vfork1x tst-vfork2x tst-sem10 tst-sem11 tst-sem12 \
+	tst-typesizes tst-initializers1-c89 tst-initializers1-c99 \
+	tst-initializers1-gnu89 tst-initializers1-gnu99
+
+#
+# These are for the RT library and POSIX timers.
+#
+TESTS += tst-clock tst-clock_nanosleep tst-cpuclock1 tst-cpuclock2	\
+	tst-cputimer1 tst-cputimer2 tst-cputimer3 tst-mqueue1		\
+	tst-mqueue2 tst-mqueue3 tst-mqueue4 tst-mqueue5 tst-mqueue6	\
+	tst-mqueue7 tst-mqueue8 tst-mqueue9 tst-timer2 tst-timer3	\
+	tst-timer4 tst-timer5
+
+ifeq ($(UCLIBC_HAS_OBSOLETE_BSD_SIGNAL),)
+TESTS_DISABLED += tst-exec2 tst-exec3 tst-exec4
+endif
+
+ifeq ($(UCLIBC_SUSV4_LEGACY),)
+TESTS_DISABLED += tst-basic5 tst-cancel4 tst-cancel5 tst-cancelx4
+endif
+
+GLIBC_TESTS_DISABLED := tst-eintr1_glibc tst-eintr2_glibc \
+	tst-eintr3_glibc tst-eintr4_glibc tst-eintr5_glibc \
+	tst-tls1_glibc tst-tls2_glibc
+
+
+ifeq ($(HAVE_SHARED),)
+TESTS_DISABLED += tst-tls3 tst-tls4 tst-tls5
+else
+GLIBC_TESTS_DISABLED += tst-tls3_glibc tst-tls4_glibc tst-tls5_glibc
+endif
+
+PTDIR := $(top_builddir)libpthread/nptl
+SYSDEPS_DIR := $(top_srcdir)libc/sysdeps
+
+EXTRA_CFLAGS := -DNOT_IN_libc=1 -D_LIBC -D__USE_GNU -std=gnu99 \
+	-I$(SYSDEPS_DIR)/linux \
+	-I$(SYSDEPS_DIR)/linux/$(TARGET_ARCH) \
+	-I$(PTDIR) -I$(PTDIR)/sysdeps/unix/sysv/linux/$(TARGET_ARCH)	\
+	-I$(PTDIR)/sysdeps/$(TARGET_ARCH)				\
+	-I$(PTDIR)/sysdeps/unix/sysv/linux				\
+	-I$(PTDIR)/sysdeps/pthread					\
+	-I$(PTDIR)/sysdeps/pthread/bits					\
+	-I$(PTDIR)/sysdeps/generic					\
+	-I$(top_builddir)ldso/include					\
+	-I$(top_builddir)ldso/ldso/$(TARGET_ARCH)			\
+	-I$(top_builddir)include					\
+	-include $(top_builddir)include/libc-symbols.h
+
+ifeq ($(TARGET_ARCH),i386)
+CFLAGS_tst-align := -malign-double -mpreferred-stack-boundary=4
+endif
+ifeq ($(TARGET_ARCH),i686)
+CFLAGS_tst-align := -malign-double -mpreferred-stack-boundary=4 -msse
+endif
+CFLAGS_tst-cleanup4aux.o := -W
+CFLAGS_tst-initializers1 := -W -Werror
+CFLAGS_tst-tls3mod.so := -fPIC -DPIC -DSHARED -shared -DNOT_IN_libc
+CFLAGS_tst-tls4moda.so := -fPIC -DPIC -DSHARED -shared -DNOT_IN_libc
+CFLAGS_tst-tls4modb.so := -fPIC -DPIC -DSHARED -shared -DNOT_IN_libc
+CFLAGS_tst-tls5mod.so := -fPIC -DPIC -DSHARED -shared -DNOT_IN_libc
+CFLAGS_tst-tls5moda.so := -fPIC -DPIC -DSHARED -shared -DNOT_IN_libc
+CFLAGS_tst-tls5modb.so := -fPIC -DPIC -DSHARED -shared -DNOT_IN_libc
+CFLAGS_tst-tls5modc.so := -fPIC -DPIC -DSHARED -shared -DNOT_IN_libc
+CFLAGS_tst-tls5modd.so := -fPIC -DPIC -DSHARED -shared -DNOT_IN_libc
+CFLAGS_tst-tls5mode.so := -fPIC -DPIC -DSHARED -shared -DNOT_IN_libc
+CFLAGS_tst-tls5modf.so := -fPIC -DPIC -DSHARED -shared -DNOT_IN_libc
+
+CFLAGS_tst-fini1mod.so := -fPIC -DPIC -DSHARED -shared -DNOT_IN_libc
+LDFLAGS_tst-cond11 = -lrt
+LDFLAGS_tst-cond19 = -lrt
+LDFLAGS_tst-cancel18 = -lrt
+LDFLAGS_tst-cancelx18 = -lrt
+LDFLAGS_tst-clock2 = -lrt
+LDFLAGS_tst-rwlock14 = -lrt
+LDFLAGS_tst-fini1 = -Wl,-rpath=./ tst-fini1mod.so
+LDFLAGS_tst-fini1mod.so = -Wl,-soname=tst-fini1mod.so
+LDFLAGS_tst-unload = -ldl
+LDFLAGS_tst-cancel5 := -lpthread -lpthread_nonshared
+LDFLAGS_tst-cancel23 := -lc -lpthread
+LDFLAGS_tst-vfork1x := -lc -lpthread
+LDFLAGS_tst-vfork2x := -lc -lpthread
+
+CFLAGS_tst-cancelx2 += -fexceptions
+CFLAGS_tst-cancelx3 += -fexceptions
+CFLAGS_tst-cancelx4 += -fexceptions
+CFLAGS_tst-cancelx6 += -fexceptions
+CFLAGS_tst-cancelx7 += -fexceptions
+CFLAGS_tst-cancelx8 += -fexceptions
+CFLAGS_tst-cancelx9 += -fexceptions
+CFLAGS_tst-cancelx10 += -fexceptions
+CFLAGS_tst-cancelx11 += -fexceptions
+CFLAGS_tst-cancelx12 += -fexceptions
+CFLAGS_tst-cancelx13 += -fexceptions
+CFLAGS_tst-cancelx14 += -fexceptions
+CFLAGS_tst-cancelx15 += -fexceptions
+CFLAGS_tst-cancelx16 += -fexceptions
+CFLAGS_tst-cancelx18 += -fexceptions
+CFLAGS_tst-cancelx20 += -fexceptions -fasynchronous-unwind-tables
+CFLAGS_tst-cancelx21 += -fexceptions -fasynchronous-unwind-tables
+CFLAGS_tst-cleanupx0 += -fexceptions -fasynchronous-unwind-tables
+CFLAGS_tst-cleanupx1 += -fexceptions -fasynchronous-unwind-tables
+CFLAGS_tst-cleanupx2 += -fexceptions
+CFLAGS_tst-cleanupx3 += -fexceptions
+
+CFLAGS_tst-oncex3 += -fexceptions
+CFLAGS_tst-oncex4 += -fexceptions
+CFLAGS_tst-align += $(stack-align-test-flags)
+CFLAGS_tst-align3 += $(stack-align-test-flags)
+CFLAGS_tst-initializers1 = -W -Wall -Werror
+CFLAGS_tst-sem11 += -fexceptions -fasynchronous-unwind-tables
+CFLAGS_tst-sem12 += -fexceptions -fasynchronous-unwind-tables
+CFLAGS_tst-initializers1 = -W -Wall -Werror
+CFLAGS_tst-initializers1-c89 = $(CFLAGS-tst-initializers1) -std=c89
+CFLAGS_tst-initializers1-c99 = $(CFLAGS-tst-initializers1) -std=c99
+CFLAGS_tst-initializers1-gnu89 = $(CFLAGS-tst-initializers1) -std=gnu89
+CFLAGS_tst-initializers1-gnu99 = $(CFLAGS-tst-initializers1) -std=gnu99
+
+EXTRA_LDFLAGS = $(if $(findstring -lpthread,$(LDFLAGS_$@)),,-lpthread)
+
+LDFLAGS_tst-cleanup4 := tst-cleanup4aux.o
+LDFLAGS_tst-cleanupx4 := tst-cleanup4aux.o
+LDFLAGS_tst-clock2 := -lrt
+LDFLAGS_tst-cond11 := -lrt
+LDFLAGS_tst-cond19 := -lrt
+LDFLAGS_tst-rwlock14 := -lrt
+LDFLAGS_tst-tls3 := -ldl -rdynamic
+LDFLAGS_tst-tls4 := -ldl
+LDFLAGS_tst-tls5 :=  tst-tls5mod.so
+LDFLAGS_tst-clock := -lrt
+LDFLAGS_tst-clock_nanosleep := -lrt
+LDFLAGS_tst-cpuclock1 := -lrt
+LDFLAGS_tst-cpuclock2 := -lrt -lpthread
+LDFLAGS_tst-cputimer1 := -lrt -lpthread
+LDFLAGS_tst-cputimer2 := -lrt -lpthread
+LDFLAGS_tst-cputimer3 := -lrt -lpthread
+LDFLAGS_tst-mqueue1 := -lrt
+LDFLAGS_tst-mqueue2 := -lrt
+LDFLAGS_tst-mqueue3 := -lrt -lpthread
+LDFLAGS_tst-mqueue4 := -lrt
+LDFLAGS_tst-mqueue5 := -lrt -lpthread
+LDFLAGS_tst-mqueue6 := -lrt -lpthread
+LDFLAGS_tst-mqueue7 := -lrt
+LDFLAGS_tst-mqueue8 := -lrt
+LDFLAGS_tst-mqueue9 := -lrt
+LDFLAGS_tst-timer2 := -lrt -lpthread
+LDFLAGS_tst-timer3 := -lrt -lpthread
+LDFLAGS_tst-timer4 := -lrt -lpthread
+LDFLAGS_tst-timer5 := -lrt -lpthread
+LDFLAGS_tst-dlsym1 := -ldl -rdynamic
+LDFLAGS_tst-tls3mod.so := -shared -static-libgcc -lpthread
+LDFLAGS_tst-tls4moda.so := -shared -static-libgcc
+LDFLAGS_tst-tls4modb.so := -shared -static-libgcc
+LDFLAGS_tst-tls5mod.so := -shared -static-libgcc -Wl,-soname,tst-tls5mod.so
+LDFLAGS_tst-tls5moda.so := -shared -static-libgcc
+LDFLAGS_tst-tls5modb.so := -shared -static-libgcc
+LDFLAGS_tst-tls5modc.so := -shared -static-libgcc
+LDFLAGS_tst-tls5modd.so := -shared -static-libgcc
+LDFLAGS_tst-tls5mode.so := -shared -static-libgcc
+LDFLAGS_tst-tls5modf.so := -shared -static-libgcc
+LDFLAGS_tst-cleanupx4 := tst-cleanup4aux.o
+
+#
+# Special case
+#
+tst-cleanup4aux.o:
+	$(Q)$(CC) $(CFLAGS) $(CFLAGS_$@) $(EXTRA_CFLAGS) -c tst-cleanup4aux.c -o $@
+
+tst-cleanup4: tst-cleanup4aux.o
+tst-tls3: tst-tls3mod.so
+tst-tls4: tst-tls4moda.so tst-tls4modb.so
+tst-tls5: tst-tls5mod.so
+
+tst-cleanupx4 : tst-cleanup4aux.o
+tst-fini1: tst-fini1mod.so
+
+OPTS_tst-cancel7 = --command ./tst-cancel7
+OPTS_tst-mqueue7 = -- ./tst-mqueue7
+OPTS_tst-exec4 = ./tst-exec4
+
+WRAPPER := env LD_LIBRARY_PATH="$$PWD:.:$(LD_LIBRARY_PATH)" TIMEOUTFACTOR=100
diff --git a/ap/build/uClibc/test/nptl/eintr.c b/ap/build/uClibc/test/nptl/eintr.c
new file mode 100644
index 0000000..933c5d8
--- /dev/null
+++ b/ap/build/uClibc/test/nptl/eintr.c
@@ -0,0 +1,89 @@
+/* Copyright (C) 2003 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, write to the Free
+   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+   02111-1307 USA.  */
+
+#include <pthread.h>
+#include <signal.h>
+#include <unistd.h>
+
+
+static int the_sig;
+
+
+static void
+eintr_handler (int sig)
+{
+  if (sig != the_sig)
+    {
+      write (STDOUT_FILENO, "eintr_handler: signal number wrong\n", 35);
+      _exit (1);
+    }
+  write (STDOUT_FILENO, ".", 1);
+}
+
+
+static void *
+eintr_source (void *arg)
+{
+  struct timespec ts = { .tv_sec = 0, .tv_nsec = 500000 };
+
+  if (arg == NULL)
+    {
+      sigset_t ss;
+      sigemptyset (&ss);
+      sigaddset (&ss, the_sig);
+      pthread_sigmask (SIG_BLOCK, &ss, NULL);
+    }
+
+  while (1)
+    {
+      if (arg != NULL)
+	pthread_kill (*(pthread_t *) arg, the_sig);
+      else
+	kill (getpid (), the_sig);
+
+      nanosleep (&ts, NULL);
+    }
+
+  /* NOTREACHED */
+  return NULL;
+}
+
+
+static void
+setup_eintr (int sig, pthread_t *thp)
+{
+  struct sigaction sa;
+  sigemptyset (&sa.sa_mask);
+  sa.sa_flags = 0;
+  sa.sa_handler = eintr_handler;
+  if (sigaction (sig, &sa, NULL) != 0)
+    {
+      puts ("setup_eintr: sigaction failed");
+      exit (1);
+    }
+  the_sig = sig;
+
+  /* Create the thread which will fire off the signals.  */
+  pthread_t th;
+  if (pthread_create (&th, NULL, eintr_source, thp) != 0)
+    {
+      puts ("setup_eintr: pthread_create failed");
+      exit (1);
+    }
+}
diff --git a/ap/build/uClibc/test/nptl/tst-align.c b/ap/build/uClibc/test/nptl/tst-align.c
new file mode 100644
index 0000000..381db8f
--- /dev/null
+++ b/ap/build/uClibc/test/nptl/tst-align.c
@@ -0,0 +1,71 @@
+/* Copyright (C) 2003 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, write to the Free
+   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+   02111-1307 USA.  */
+
+#include <pthread.h>
+#include <stdbool.h>
+#include <stdint.h>
+#include <stdio.h>
+#include "tst-stack-align.h"
+
+static void *
+tf (void *arg)
+{
+  bool ok = true;
+
+  puts ("in thread");
+
+  if (TEST_STACK_ALIGN ())
+    ok = false;
+
+  return ok ? NULL : (void *) -1l;
+}
+
+static int
+do_test (void)
+{
+  bool ok = true;
+
+  puts ("in main");
+
+  if (TEST_STACK_ALIGN ())
+    ok = false;
+
+  pthread_t th;
+  if (pthread_create (&th, NULL, tf, NULL) != 0)
+    {
+      puts ("create failed");
+      return 1;
+    }
+
+  void *res;
+  if (pthread_join (th, &res) != 0)
+    {
+      puts ("join failed");
+      return 1;
+    }
+
+  if (res != NULL)
+    ok = false;
+
+  return ok ? 0 : 1;
+}
+
+
+#define TEST_FUNCTION do_test ()
+#include "../test-skeleton.c"
diff --git a/ap/build/uClibc/test/nptl/tst-align2.c b/ap/build/uClibc/test/nptl/tst-align2.c
new file mode 100644
index 0000000..7d8be53
--- /dev/null
+++ b/ap/build/uClibc/test/nptl/tst-align2.c
@@ -0,0 +1,87 @@
+/* Copyright (C) 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.  */
+
+#include <sched.h>
+#include <stdbool.h>
+#include <stdint.h>
+#include <stdio.h>
+#include <string.h>
+#include <sys/wait.h>
+#include <unistd.h>
+#include "tst-stack-align.h"
+
+static int
+f (void *arg)
+{
+  bool ok = true;
+
+  if (TEST_STACK_ALIGN ())
+    ok = false;
+
+  return ok ? 0 : 1;
+}
+
+static int
+do_test (void)
+{
+  bool ok = true;
+
+  puts ("in main");
+
+  if (TEST_STACK_ALIGN ())
+    ok = false;
+
+#ifdef __ia64__
+  extern int __clone2 (int (*__fn) (void *__arg), void *__child_stack_base,
+		       size_t __child_stack_size, int __flags,
+		       void *__arg, ...);
+  char st[256 * 1024];
+  pid_t p = __clone2 (f, st, sizeof (st), 0, 0);
+#else
+  char st[128 * 1024];
+  pid_t p = clone (f, st + sizeof (st), 0, 0);
+#endif
+  if (p == -1)
+    {
+      printf("clone failed: %m\n");
+      return 1;
+    }
+
+  int e;
+  if (waitpid (p, &e, __WCLONE) != p)
+    {
+      puts ("waitpid failed");
+      kill (p, SIGKILL);
+      return 1;
+    }
+  if (!WIFEXITED (e))
+    {
+      if (WIFSIGNALED (e))
+	printf ("died from signal %s\n", strsignal (WTERMSIG (e)));
+      else
+	puts ("did not terminate correctly");
+      return 1;
+    }
+  if (WEXITSTATUS (e) != 0)
+    ok = false;
+
+  return ok ? 0 : 1;
+}
+
+#define TEST_FUNCTION do_test ()
+#include "../test-skeleton.c"
diff --git a/ap/build/uClibc/test/nptl/tst-align3.c b/ap/build/uClibc/test/nptl/tst-align3.c
new file mode 100644
index 0000000..f4507f2
--- /dev/null
+++ b/ap/build/uClibc/test/nptl/tst-align3.c
@@ -0,0 +1,57 @@
+/* Copyright (C) 2005 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+   Contributed by Jakub Jelinek <jakub@redhat.com>, 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 <pthread.h>
+#include <stdbool.h>
+#include <stdint.h>
+#include <stdio.h>
+#include "tst-stack-align.h"
+
+static bool ok = true;
+static pthread_once_t once = PTHREAD_ONCE_INIT;
+
+static void
+once_test (void)
+{
+  puts ("in once_test");
+
+  if (TEST_STACK_ALIGN ())
+    ok = false;
+}
+
+static int
+do_test (void)
+{
+  puts ("in main");
+
+  if (TEST_STACK_ALIGN ())
+    ok = false;
+
+  if (pthread_once (&once, once_test))
+    {
+      puts ("pthread once failed");
+      return 1;
+    }
+
+  return ok ? 0 : 1;
+}
+
+
+#define TEST_FUNCTION do_test ()
+#include "../test-skeleton.c"
diff --git a/ap/build/uClibc/test/nptl/tst-atfork1.c b/ap/build/uClibc/test/nptl/tst-atfork1.c
new file mode 100644
index 0000000..b42ab42
--- /dev/null
+++ b/ap/build/uClibc/test/nptl/tst-atfork1.c
@@ -0,0 +1,121 @@
+/* Copyright (C) 2002, 2003 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+   Contributed by Ulrich Drepper <drepper@redhat.com>, 2002.
+
+   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 <errno.h>
+#include <pthread.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <unistd.h>
+#include <sys/wait.h>
+
+
+static int val;
+
+
+static void
+prepare1 (void)
+{
+  val *= 2;
+}
+
+static void
+prepare2 (void)
+{
+  ++val;
+}
+
+static void
+parent1 (void)
+{
+  val += 4;
+}
+
+static void
+parent2 (void)
+{
+  val *= 4;
+}
+
+static void
+child1 (void)
+{
+  val += 8;
+}
+
+static void
+child2 (void)
+{
+  val *= 8;
+}
+
+
+static int
+do_test (void)
+{
+  pid_t pid;
+  int status = 0;
+
+  if (pthread_atfork (prepare1, parent1, child1) != 0)
+    {
+      puts ("1st atfork failed");
+      exit (1);
+    }
+  if (pthread_atfork (prepare2, parent2, child2) != 0)
+    {
+      puts ("2nd atfork failed");
+      exit (1);
+    }
+
+  pid = fork ();
+  if (pid == -1)
+    {
+      puts ("fork failed");
+      exit (1);
+    }
+
+  if (pid != 0)
+    {
+      /* Parent.  */
+      if (val != 24)
+	{
+	  printf ("expected val=%d, got %d\n", 24, val);
+	  exit (1);
+	}
+
+      if (TEMP_FAILURE_RETRY (waitpid (pid, &status, 0)) != pid)
+	{
+	  puts ("waitpid failed");
+	  exit (1);
+	}
+    }
+  else
+    {
+      /* Child.  */
+      if (val != 80)
+	{
+	  printf ("expected val=%d, got %d\n", 80, val);
+	  exit (2);
+	}
+    }
+
+  return status;
+}
+
+#define TEST_FUNCTION do_test ()
+#include "../test-skeleton.c"
diff --git a/ap/build/uClibc/test/nptl/tst-attr1.c b/ap/build/uClibc/test/nptl/tst-attr1.c
new file mode 100644
index 0000000..13b62a6
--- /dev/null
+++ b/ap/build/uClibc/test/nptl/tst-attr1.c
@@ -0,0 +1,306 @@
+/* Copyright (C) 2003 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, write to the Free
+   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+   02111-1307 USA.  */
+
+#include <errno.h>
+#include <pthread.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <unistd.h>
+
+
+int
+do_test (void)
+{
+  int i;
+  pthread_attr_t a;
+
+  if (pthread_attr_init (&a) != 0)
+    {
+      puts ("attr_init failed");
+      exit (1);
+    }
+
+  pthread_mutexattr_t ma;
+
+  if (pthread_mutexattr_init (&ma) != 0)
+    {
+      puts ("mutexattr_init failed");
+      exit (1);
+    }
+
+  pthread_rwlockattr_t rwa;
+
+  if (pthread_rwlockattr_init (&rwa) != 0)
+    {
+      puts ("rwlockattr_init failed");
+      exit (1);
+    }
+
+  /* XXX Remove if default value is clear.  */
+  pthread_attr_setinheritsched (&a, PTHREAD_INHERIT_SCHED);
+  pthread_attr_setschedpolicy (&a, SCHED_OTHER);
+  pthread_attr_setscope (&a, PTHREAD_SCOPE_SYSTEM);
+
+  for (i = 0; i < 10000; ++i)
+    {
+      long int r = random ();
+
+      if (r != PTHREAD_CREATE_DETACHED && r != PTHREAD_CREATE_JOINABLE)
+	{
+	  int e = pthread_attr_setdetachstate (&a, r);
+
+	  if (e == 0)
+	    {
+	      printf ("attr_setdetachstate with value %ld succeeded\n", r);
+	      exit (1);
+	    }
+	  if (e != EINVAL)
+	    {
+	      puts ("attr_setdetachstate didn't return EINVAL");
+	      exit (1);
+	    }
+
+	  int s;
+	  if (pthread_attr_getdetachstate (&a, &s) != 0)
+	    {
+	      puts ("attr_getdetachstate failed");
+	      exit (1);
+	    }
+
+	  if (s != PTHREAD_CREATE_JOINABLE)
+	    {
+	      printf ("\
+detach state changed to %d by invalid setdetachstate call\n", s);
+	      exit (1);
+	    }
+	}
+
+      if (r != PTHREAD_INHERIT_SCHED && r != PTHREAD_EXPLICIT_SCHED)
+	{
+	  int e = pthread_attr_setinheritsched (&a, r);
+
+	  if (e == 0)
+	    {
+	      printf ("attr_setinheritsched with value %ld succeeded\n", r);
+	      exit (1);
+	    }
+	  if (e != EINVAL)
+	    {
+	      puts ("attr_setinheritsched didn't return EINVAL");
+	      exit (1);
+	    }
+
+	  int s;
+	  if (pthread_attr_getinheritsched (&a, &s) != 0)
+	    {
+	      puts ("attr_getinheritsched failed");
+	      exit (1);
+	    }
+
+	  if (s != PTHREAD_INHERIT_SCHED)
+	    {
+	      printf ("\
+inheritsched changed to %d by invalid setinheritsched call\n", s);
+	      exit (1);
+	    }
+	}
+
+      if (r != SCHED_OTHER && r != SCHED_RR && r != SCHED_FIFO)
+	{
+	  int e = pthread_attr_setschedpolicy (&a, r);
+
+	  if (e == 0)
+	    {
+	      printf ("attr_setschedpolicy with value %ld succeeded\n", r);
+	      exit (1);
+	    }
+	  if (e != EINVAL)
+	    {
+	      puts ("attr_setschedpolicy didn't return EINVAL");
+	      exit (1);
+	    }
+
+	  int s;
+	  if (pthread_attr_getschedpolicy (&a, &s) != 0)
+	    {
+	      puts ("attr_getschedpolicy failed");
+	      exit (1);
+	    }
+
+	  if (s != SCHED_OTHER)
+	    {
+	      printf ("\
+schedpolicy changed to %d by invalid setschedpolicy call\n", s);
+	      exit (1);
+	    }
+	}
+
+      if (r != PTHREAD_SCOPE_SYSTEM && r != PTHREAD_SCOPE_PROCESS)
+	{
+	  int e = pthread_attr_setscope (&a, r);
+
+	  if (e == 0)
+	    {
+	      printf ("attr_setscope with value %ld succeeded\n", r);
+	      exit (1);
+	    }
+	  if (e != EINVAL)
+	    {
+	      puts ("attr_setscope didn't return EINVAL");
+	      exit (1);
+	    }
+
+	  int s;
+	  if (pthread_attr_getscope (&a, &s) != 0)
+	    {
+	      puts ("attr_getscope failed");
+	      exit (1);
+	    }
+
+	  if (s != PTHREAD_SCOPE_SYSTEM)
+	    {
+	      printf ("\
+contentionscope changed to %d by invalid setscope call\n", s);
+	      exit (1);
+	    }
+	}
+
+      if (r != PTHREAD_PROCESS_PRIVATE && r != PTHREAD_PROCESS_SHARED)
+	{
+	  int e = pthread_mutexattr_setpshared (&ma, r);
+
+	  if (e == 0)
+	    {
+	      printf ("mutexattr_setpshared with value %ld succeeded\n", r);
+	      exit (1);
+	    }
+	  if (e != EINVAL)
+	    {
+	      puts ("mutexattr_setpshared didn't return EINVAL");
+	      exit (1);
+	    }
+
+	  int s;
+	  if (pthread_mutexattr_getpshared (&ma, &s) != 0)
+	    {
+	      puts ("mutexattr_getpshared failed");
+	      exit (1);
+	    }
+
+	  if (s != PTHREAD_PROCESS_PRIVATE)
+	    {
+	      printf ("\
+pshared changed to %d by invalid mutexattr_setpshared call\n", s);
+	      exit (1);
+	    }
+
+	  e = pthread_rwlockattr_setpshared (&rwa, r);
+
+	  if (e == 0)
+	    {
+	      printf ("rwlockattr_setpshared with value %ld succeeded\n", r);
+	      exit (1);
+	    }
+	  if (e != EINVAL)
+	    {
+	      puts ("rwlockattr_setpshared didn't return EINVAL");
+	      exit (1);
+	    }
+
+	  if (pthread_rwlockattr_getpshared (&rwa, &s) != 0)
+	    {
+	      puts ("rwlockattr_getpshared failed");
+	      exit (1);
+	    }
+
+	  if (s != PTHREAD_PROCESS_PRIVATE)
+	    {
+	      printf ("\
+pshared changed to %d by invalid rwlockattr_setpshared call\n", s);
+	      exit (1);
+	    }
+	}
+
+      if (r != PTHREAD_CANCEL_ENABLE && r != PTHREAD_CANCEL_DISABLE)
+	{
+	  int e = pthread_setcancelstate (r, NULL);
+
+	  if (e == 0)
+	    {
+	      printf ("setcancelstate with value %ld succeeded\n", r);
+	      exit (1);
+	    }
+
+	  if (e != EINVAL)
+	    {
+	      puts ("setcancelstate didn't return EINVAL");
+	      exit (1);
+	    }
+
+	  int s;
+	  if (pthread_setcancelstate (PTHREAD_CANCEL_ENABLE, &s) != 0)
+	    {
+	      puts ("setcancelstate failed for PTHREAD_CANCEL_ENABLE");
+	      exit (1);
+	    }
+
+	  if (s != PTHREAD_CANCEL_ENABLE)
+	    {
+	      puts ("invalid setcancelstate changed state");
+	      exit (1);
+	    }
+	}
+
+      if (r != PTHREAD_CANCEL_DEFERRED && r != PTHREAD_CANCEL_ASYNCHRONOUS)
+	{
+	  int e = pthread_setcanceltype (r, NULL);
+
+	  if (e == 0)
+	    {
+	      printf ("setcanceltype with value %ld succeeded\n", r);
+	      exit (1);
+	    }
+
+	  if (e != EINVAL)
+	    {
+	      puts ("setcanceltype didn't return EINVAL");
+	      exit (1);
+	    }
+
+	  int s;
+	  if (pthread_setcanceltype (PTHREAD_CANCEL_DEFERRED, &s) != 0)
+	    {
+	      puts ("setcanceltype failed for PTHREAD_CANCEL_DEFERRED");
+	      exit (1);
+	    }
+
+	  if (s != PTHREAD_CANCEL_DEFERRED)
+	    {
+	      puts ("invalid setcanceltype changed state");
+	      exit (1);
+	    }
+	}
+    }
+
+  return 0;
+}
+
+
+#define TEST_FUNCTION do_test ()
+#include "../test-skeleton.c"
diff --git a/ap/build/uClibc/test/nptl/tst-attr2.c b/ap/build/uClibc/test/nptl/tst-attr2.c
new file mode 100644
index 0000000..a60598d
--- /dev/null
+++ b/ap/build/uClibc/test/nptl/tst-attr2.c
@@ -0,0 +1,317 @@
+/* Copyright (C) 2003 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, write to the Free
+   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+   02111-1307 USA.  */
+
+#include <errno.h>
+#include <pthread.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <unistd.h>
+
+
+int
+do_test (void)
+{
+  pthread_attr_t a;
+
+  if (pthread_attr_init (&a) != 0)
+    {
+      puts ("attr_init failed");
+      exit (1);
+    }
+
+  /* Check default value of detach state.  */
+  int s;
+  if (pthread_attr_getdetachstate (&a, &s) != 0)
+    {
+      puts ("1st attr_getdestachstate failed");
+      exit (1);
+    }
+  if (s != PTHREAD_CREATE_JOINABLE)
+    {
+      printf ("\
+default detach state wrong: %d, expected %d (PTHREAD_CREATE_JOINABLE)\n",
+	      s, PTHREAD_CREATE_JOINABLE);
+      exit (1);
+    }
+
+  int e = pthread_attr_setdetachstate (&a, PTHREAD_CREATE_DETACHED);
+  if (e != 0)
+    {
+      puts ("1st attr_setdetachstate failed");
+      exit (1);
+    }
+  if (pthread_attr_getdetachstate (&a, &s) != 0)
+    {
+      puts ("2nd attr_getdestachstate failed");
+      exit (1);
+    }
+  if (s != PTHREAD_CREATE_DETACHED)
+    {
+      puts ("PTHREAD_CREATE_DETACHED set, but not given back");
+      exit (1);
+    }
+
+  e = pthread_attr_setdetachstate (&a, PTHREAD_CREATE_JOINABLE);
+  if (e != 0)
+    {
+      puts ("2nd attr_setdetachstate failed");
+      exit (1);
+    }
+  if (pthread_attr_getdetachstate (&a, &s) != 0)
+    {
+      puts ("3rd attr_getdestachstate failed");
+      exit (1);
+    }
+  if (s != PTHREAD_CREATE_JOINABLE)
+    {
+      puts ("PTHREAD_CREATE_JOINABLE set, but not given back");
+      exit (1);
+    }
+
+
+  size_t g;
+  if (pthread_attr_getguardsize (&a, &g) != 0)
+    {
+      puts ("1st attr_getguardsize failed");
+      exit (1);
+    }
+  if (g != (size_t) sysconf (_SC_PAGESIZE))
+    {
+      printf ("default guardsize %zu, expected %ld (PAGESIZE)\n",
+	      g, sysconf (_SC_PAGESIZE));
+      exit (1);
+    }
+
+  e = pthread_attr_setguardsize (&a, 0);
+  if (e != 0)
+    {
+      puts ("1st attr_setguardsize failed");
+      exit (1);
+    }
+  if (pthread_attr_getguardsize (&a, &g) != 0)
+    {
+      puts ("2nd attr_getguardsize failed");
+      exit (1);
+    }
+  if (g != 0)
+    {
+      printf ("guardsize set to zero but %zu returned\n", g);
+      exit (1);
+    }
+
+  e = pthread_attr_setguardsize (&a, 1);
+  if (e != 0)
+    {
+      puts ("2nd attr_setguardsize failed");
+      exit (1);
+    }
+  if (pthread_attr_getguardsize (&a, &g) != 0)
+    {
+      puts ("3rd attr_getguardsize failed");
+      exit (1);
+    }
+  if (g != 1)
+    {
+      printf ("guardsize set to 1 but %zu returned\n", g);
+      exit (1);
+    }
+
+
+  if (pthread_attr_getinheritsched (&a, &s) != 0)
+    {
+      puts ("1st attr_getinheritsched failed");
+      exit (1);
+    }
+  /* XXX What is the correct default value.  */
+  if (s != PTHREAD_INHERIT_SCHED && s != PTHREAD_EXPLICIT_SCHED)
+    {
+      puts ("incorrect default value for inheritsched");
+      exit (1);
+    }
+
+  e = pthread_attr_setinheritsched (&a, PTHREAD_EXPLICIT_SCHED);
+  if (e != 0)
+    {
+      puts ("1st attr_setinheritsched failed");
+      exit (1);
+    }
+  if (pthread_attr_getinheritsched (&a, &s) != 0)
+    {
+      puts ("2nd attr_getinheritsched failed");
+      exit (1);
+    }
+  if (s != PTHREAD_EXPLICIT_SCHED)
+    {
+      printf ("inheritsched set to PTHREAD_EXPLICIT_SCHED, but got %d\n", s);
+      exit (1);
+    }
+
+  e = pthread_attr_setinheritsched (&a, PTHREAD_INHERIT_SCHED);
+  if (e != 0)
+    {
+      puts ("2nd attr_setinheritsched failed");
+      exit (1);
+    }
+  if (pthread_attr_getinheritsched (&a, &s) != 0)
+    {
+      puts ("3rd attr_getinheritsched failed");
+      exit (1);
+    }
+  if (s != PTHREAD_INHERIT_SCHED)
+    {
+      printf ("inheritsched set to PTHREAD_INHERIT_SCHED, but got %d\n", s);
+      exit (1);
+    }
+
+
+  if (pthread_attr_getschedpolicy (&a, &s) != 0)
+    {
+      puts ("1st attr_getschedpolicy failed");
+      exit (1);
+    }
+  /* XXX What is the correct default value.  */
+  if (s != SCHED_OTHER && s != SCHED_FIFO && s != SCHED_RR)
+    {
+      puts ("incorrect default value for schedpolicy");
+      exit (1);
+    }
+
+  e = pthread_attr_setschedpolicy (&a, SCHED_RR);
+  if (e != 0)
+    {
+      puts ("1st attr_setschedpolicy failed");
+      exit (1);
+    }
+  if (pthread_attr_getschedpolicy (&a, &s) != 0)
+    {
+      puts ("2nd attr_getschedpolicy failed");
+      exit (1);
+    }
+  if (s != SCHED_RR)
+    {
+      printf ("schedpolicy set to SCHED_RR, but got %d\n", s);
+      exit (1);
+    }
+
+  e = pthread_attr_setschedpolicy (&a, SCHED_FIFO);
+  if (e != 0)
+    {
+      puts ("2nd attr_setschedpolicy failed");
+      exit (1);
+    }
+  if (pthread_attr_getschedpolicy (&a, &s) != 0)
+    {
+      puts ("3rd attr_getschedpolicy failed");
+      exit (1);
+    }
+  if (s != SCHED_FIFO)
+    {
+      printf ("schedpolicy set to SCHED_FIFO, but got %d\n", s);
+      exit (1);
+    }
+
+  e = pthread_attr_setschedpolicy (&a, SCHED_OTHER);
+  if (e != 0)
+    {
+      puts ("3rd attr_setschedpolicy failed");
+      exit (1);
+    }
+  if (pthread_attr_getschedpolicy (&a, &s) != 0)
+    {
+      puts ("4th attr_getschedpolicy failed");
+      exit (1);
+    }
+  if (s != SCHED_OTHER)
+    {
+      printf ("schedpolicy set to SCHED_OTHER, but got %d\n", s);
+      exit (1);
+    }
+
+
+  if (pthread_attr_getscope (&a, &s) != 0)
+    {
+      puts ("1st attr_getscope failed");
+      exit (1);
+    }
+  /* XXX What is the correct default value.  */
+  if (s != PTHREAD_SCOPE_SYSTEM && s != PTHREAD_SCOPE_PROCESS)
+    {
+      puts ("incorrect default value for contentionscope");
+      exit (1);
+    }
+
+  e = pthread_attr_setscope (&a, PTHREAD_SCOPE_PROCESS);
+  if (e != ENOTSUP)
+    {
+      if (e != 0)
+	{
+	  puts ("1st attr_setscope failed");
+	  exit (1);
+	}
+      if (pthread_attr_getscope (&a, &s) != 0)
+	{
+	  puts ("2nd attr_getscope failed");
+	  exit (1);
+	}
+      if (s != PTHREAD_SCOPE_PROCESS)
+	{
+	  printf ("\
+contentionscope set to PTHREAD_SCOPE_PROCESS, but got %d\n", s);
+	  exit (1);
+	}
+    }
+
+  e = pthread_attr_setscope (&a, PTHREAD_SCOPE_SYSTEM);
+  if (e != 0)
+    {
+      puts ("2nd attr_setscope failed");
+      exit (1);
+    }
+  if (pthread_attr_getscope (&a, &s) != 0)
+    {
+      puts ("3rd attr_getscope failed");
+      exit (1);
+    }
+  if (s != PTHREAD_SCOPE_SYSTEM)
+    {
+      printf ("contentionscope set to PTHREAD_SCOPE_SYSTEM, but got %d\n", s);
+      exit (1);
+    }
+
+  char buf[1];
+  e = pthread_attr_setstack (&a, buf, 1);
+  if (e != EINVAL)
+    {
+      puts ("setstack with size 1 did not produce EINVAL");
+      exit (1);
+    }
+
+  e = pthread_attr_setstacksize (&a, 1);
+  if (e != EINVAL)
+    {
+      puts ("setstacksize with size 1 did not produce EINVAL");
+      exit (1);
+    }
+
+  return 0;
+}
+
+
+#define TEST_FUNCTION do_test ()
+#include "../test-skeleton.c"
diff --git a/ap/build/uClibc/test/nptl/tst-attr3.c b/ap/build/uClibc/test/nptl/tst-attr3.c
new file mode 100644
index 0000000..29b4bbe
--- /dev/null
+++ b/ap/build/uClibc/test/nptl/tst-attr3.c
@@ -0,0 +1,420 @@
+/* pthread_getattr_np test.
+   Copyright (C) 2003, 2004 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+   Contributed by Jakub Jelinek <jakub@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, write to the Free
+   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+   02111-1307 USA.  */
+
+#include <errno.h>
+#include <error.h>
+#include <pthread.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <unistd.h>
+
+static void *
+tf (void *arg)
+{
+  pthread_attr_t a, *ap, a2;
+  int err;
+  void *result = NULL;
+
+  if (arg == NULL)
+    {
+      ap = &a2;
+      err = pthread_attr_init (ap);
+      if (err)
+        {
+          error (0, err, "pthread_attr_init failed");
+          return tf;
+        }
+    }
+  else
+    ap = (pthread_attr_t *) arg;
+
+  err = pthread_getattr_np (pthread_self (), &a);
+  if (err)
+    {
+      error (0, err, "pthread_getattr_np failed");
+      result = tf;
+    }
+
+  int detachstate1, detachstate2;
+  err = pthread_attr_getdetachstate (&a, &detachstate1);
+  if (err)
+    {
+      error (0, err, "pthread_attr_getdetachstate failed");
+      result = tf;
+    }
+  else
+    {
+      err = pthread_attr_getdetachstate (ap, &detachstate2);
+      if (err)
+	{
+	  error (0, err, "pthread_attr_getdetachstate failed");
+	  result = tf;
+	}
+      else if (detachstate1 != detachstate2)
+	{
+	  error (0, 0, "detachstate differs %d != %d",
+		 detachstate1, detachstate2);
+	  result = tf;
+	}
+    }
+
+  void *stackaddr;
+  size_t stacksize;
+  err = pthread_attr_getstack (&a, &stackaddr, &stacksize);
+  if (err)
+    {
+      error (0, err, "pthread_attr_getstack failed");
+      result = tf;
+    }
+  else if ((void *) &a < stackaddr
+	   || (void *) &a >= stackaddr + stacksize)
+    {
+      error (0, 0, "pthread_attr_getstack returned range does not cover thread's stack");
+      result = tf;
+    }
+  else
+    printf ("thread stack %p-%p (0x%zx)\n", stackaddr, stackaddr + stacksize,
+	    stacksize);
+
+  size_t guardsize1, guardsize2;
+  err = pthread_attr_getguardsize (&a, &guardsize1);
+  if (err)
+    {
+      error (0, err, "pthread_attr_getguardsize failed");
+      result = tf;
+    }
+  else
+    {
+      err = pthread_attr_getguardsize (ap, &guardsize2);
+      if (err)
+	{
+	  error (0, err, "pthread_attr_getguardsize failed");
+	  result = tf;
+	}
+      else if (guardsize1 != guardsize2)
+	{
+	  error (0, 0, "guardsize differs %zd != %zd",
+		 guardsize1, guardsize2);
+	  result = tf;
+	}
+      else
+	printf ("thread guardsize %zd\n", guardsize1);
+    }
+
+  int scope1, scope2;
+  err = pthread_attr_getscope (&a, &scope1);
+  if (err)
+    {
+      error (0, err, "pthread_attr_getscope failed");
+      result = tf;
+    }
+  else
+    {
+      err = pthread_attr_getscope (ap, &scope2);
+      if (err)
+	{
+	  error (0, err, "pthread_attr_getscope failed");
+	  result = tf;
+	}
+      else if (scope1 != scope2)
+	{
+	  error (0, 0, "scope differs %d != %d",
+		 scope1, scope2);
+	  result = tf;
+	}
+    }
+
+  int inheritsched1, inheritsched2;
+  err = pthread_attr_getinheritsched (&a, &inheritsched1);
+  if (err)
+    {
+      error (0, err, "pthread_attr_getinheritsched failed");
+      result = tf;
+    }
+  else
+    {
+      err = pthread_attr_getinheritsched (ap, &inheritsched2);
+      if (err)
+	{
+	  error (0, err, "pthread_attr_getinheritsched failed");
+	  result = tf;
+	}
+      else if (inheritsched1 != inheritsched2)
+	{
+	  error (0, 0, "inheritsched differs %d != %d",
+		 inheritsched1, inheritsched2);
+	  result = tf;
+	}
+    }
+
+  cpu_set_t c1, c2;
+  err = pthread_getaffinity_np (pthread_self (), sizeof (c1), &c1);
+  if (err == 0)
+    {
+      err = pthread_attr_getaffinity_np (&a, sizeof (c2), &c2);
+      if (err)
+	{
+	  error (0, err, "pthread_attr_getaffinity_np failed");
+	  result = tf;
+	}
+      else if (memcmp (&c1, &c2, sizeof (c1)))
+	{
+	  error (0, 0, "pthread_attr_getaffinity_np returned different CPU mask than pthread_getattr_np");
+	  result = tf;
+	}
+    }
+
+  err = pthread_attr_destroy (&a);
+  if (err)
+    {
+      error (0, err, "pthread_attr_destroy failed");
+      result = tf;
+    }
+
+  if (ap == &a2)
+    {
+      err = pthread_attr_destroy (ap);
+      if (err)
+	{
+	  error (0, err, "pthread_attr_destroy failed");
+	  result = tf;
+	}
+    }
+
+  return result;
+}
+
+
+static int
+do_test (void)
+{
+  int result = 0;
+  pthread_attr_t a;
+  cpu_set_t c1, c2;
+
+  int err = pthread_attr_init (&a);
+  if (err)
+    {
+      error (0, err, "pthread_attr_init failed");
+      result = 1;
+    }
+
+  err = pthread_attr_getaffinity_np (&a, sizeof (c1), &c1);
+  if (err && err != ENOSYS)
+    {
+      error (0, err, "pthread_attr_getaffinity_np failed");
+      result = 1;
+    }
+
+  err = pthread_attr_destroy (&a);
+  if (err)
+    {
+      error (0, err, "pthread_attr_destroy failed");
+      result = 1;
+    }
+
+  err = pthread_getattr_np (pthread_self (), &a);
+  if (err)
+    {
+      error (0, err, "pthread_getattr_np failed");
+      result = 1;
+    }
+
+  int detachstate;
+  err = pthread_attr_getdetachstate (&a, &detachstate);
+  if (err)
+    {
+      error (0, err, "pthread_attr_getdetachstate failed");
+      result = 1;
+    }
+  else if (detachstate != PTHREAD_CREATE_JOINABLE)
+    {
+      error (0, 0, "initial thread not joinable");
+      result = 1;
+    }
+
+  void *stackaddr;
+  size_t stacksize;
+  err = pthread_attr_getstack (&a, &stackaddr, &stacksize);
+  if (err)
+    {
+      error (0, err, "pthread_attr_getstack failed");
+      result = 1;
+    }
+  else if ((void *) &a < stackaddr
+	   || (void *) &a >= stackaddr + stacksize)
+    {
+      error (0, 0, "pthread_attr_getstack returned range does not cover main's stack");
+      result = 1;
+    }
+  else
+    printf ("initial thread stack %p-%p (0x%zx)\n", stackaddr,
+	    stackaddr + stacksize, stacksize);
+
+  size_t guardsize;
+  err = pthread_attr_getguardsize (&a, &guardsize);
+  if (err)
+    {
+      error (0, err, "pthread_attr_getguardsize failed");
+      result = 1;
+    }
+  else if (guardsize != 0)
+    {
+      error (0, 0, "pthread_attr_getguardsize returned %zd != 0",
+	     guardsize);
+      result = 1;
+    }
+
+  int scope;
+  err = pthread_attr_getscope (&a, &scope);
+  if (err)
+    {
+      error (0, err, "pthread_attr_getscope failed");
+      result = 1;
+    }
+  else if (scope != PTHREAD_SCOPE_SYSTEM)
+    {
+      error (0, 0, "pthread_attr_getscope returned %d != PTHREAD_SCOPE_SYSTEM",
+	     scope);
+      result = 1;
+    }
+
+  int inheritsched;
+  err = pthread_attr_getinheritsched (&a, &inheritsched);
+  if (err)
+    {
+      error (0, err, "pthread_attr_getinheritsched failed");
+      result = 1;
+    }
+  else if (inheritsched != PTHREAD_INHERIT_SCHED)
+    {
+      error (0, 0, "pthread_attr_getinheritsched returned %d != PTHREAD_INHERIT_SCHED",
+	     inheritsched);
+      result = 1;
+    }
+
+  err = pthread_getaffinity_np (pthread_self (), sizeof (c1), &c1);
+  if (err == 0)
+    {
+      err = pthread_attr_getaffinity_np (&a, sizeof (c2), &c2);
+      if (err)
+	{
+	  error (0, err, "pthread_attr_getaffinity_np failed");
+	  result = 1;
+	}
+      else if (memcmp (&c1, &c2, sizeof (c1)))
+	{
+	  error (0, 0, "pthread_attr_getaffinity_np returned different CPU mask than pthread_getattr_np");
+	  result = 1;
+	}
+    }
+
+  err = pthread_attr_destroy (&a);
+  if (err)
+    {
+      error (0, err, "pthread_attr_destroy failed");
+      result = 1;
+    }
+
+  pthread_t th;
+  err = pthread_create (&th, NULL, tf, NULL);
+  if (err)
+    {
+      error (0, err, "pthread_create #1 failed");
+      result = 1;
+    }
+  else
+    {
+      void *ret;
+      err = pthread_join (th, &ret);
+      if (err)
+	{
+	  error (0, err, "pthread_join #1 failed");
+	  result = 1;
+	}
+      else if (ret != NULL)
+        result = 1;
+    }
+
+  err = pthread_attr_init (&a);
+  if (err)
+    {
+      error (0, err, "pthread_attr_init failed");
+      result = 1;
+    }
+
+  err = pthread_create (&th, &a, tf, &a);
+  if (err)
+    {
+      error (0, err, "pthread_create #2 failed");
+      result = 1;
+    }
+  else
+    {
+      void *ret;
+      err = pthread_join (th, &ret);
+      if (err)
+	{
+	  error (0, err, "pthread_join #2 failed");
+	  result = 1;
+	}
+      else if (ret != NULL)
+        result = 1;
+    }
+
+  err = pthread_attr_setguardsize (&a, 16 * sysconf (_SC_PAGESIZE));
+  if (err)
+    {
+      error (0, err, "pthread_attr_setguardsize failed");
+      result = 1;
+    }
+
+  err = pthread_create (&th, &a, tf, &a);
+  if (err)
+    {
+      error (0, err, "pthread_create #3 failed");
+      result = 1;
+    }
+  else
+    {
+      void *ret;
+      err = pthread_join (th, &ret);
+      if (err)
+	{
+	  error (0, err, "pthread_join #3 failed");
+	  result = 1;
+	}
+      else if (ret != NULL)
+        result = 1;
+    }
+
+  err = pthread_attr_destroy (&a);
+  if (err)
+    {
+      error (0, err, "pthread_attr_destroy failed");
+      result = 1;
+    }
+
+  return result;
+}
+
+#define TEST_FUNCTION do_test ()
+#include "../test-skeleton.c"
diff --git a/ap/build/uClibc/test/nptl/tst-barrier1.c b/ap/build/uClibc/test/nptl/tst-barrier1.c
new file mode 100644
index 0000000..2859fb4
--- /dev/null
+++ b/ap/build/uClibc/test/nptl/tst-barrier1.c
@@ -0,0 +1,71 @@
+/* Copyright (C) 2002 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+   Contributed by Ulrich Drepper <drepper@redhat.com>, 2002.
+
+   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 <errno.h>
+#include <pthread.h>
+#include <stdio.h>
+
+
+static int
+do_test (void)
+{
+  pthread_barrier_t b;
+  int e;
+  int cnt;
+
+  e = pthread_barrier_init (&b, NULL, 0);
+  if (e == 0)
+    {
+      puts ("barrier_init with count 0 succeeded");
+      return 1;
+    }
+  if (e != EINVAL)
+    {
+      puts ("barrier_init with count 0 didn't return EINVAL");
+      return 1;
+    }
+
+  if (pthread_barrier_init (&b, NULL, 1) != 0)
+    {
+      puts ("real barrier_init failed");
+      return 1;
+    }
+
+  for (cnt = 0; cnt < 10; ++cnt)
+    {
+      e = pthread_barrier_wait (&b);
+
+      if (e != PTHREAD_BARRIER_SERIAL_THREAD)
+	{
+	  puts ("barrier_wait didn't return PTHREAD_BARRIER_SERIAL_THREAD");
+	  return 1;
+	}
+    }
+
+  if (pthread_barrier_destroy (&b) != 0)
+    {
+      puts ("barrier_destroy failed");
+      return 1;
+    }
+
+  return 0;
+}
+
+#define TEST_FUNCTION do_test ()
+#include "../test-skeleton.c"
diff --git a/ap/build/uClibc/test/nptl/tst-barrier2.c b/ap/build/uClibc/test/nptl/tst-barrier2.c
new file mode 100644
index 0000000..7f58869
--- /dev/null
+++ b/ap/build/uClibc/test/nptl/tst-barrier2.c
@@ -0,0 +1,185 @@
+/* Copyright (C) 2002, 2003, 2004 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+   Contributed by Ulrich Drepper <drepper@redhat.com>, 2002.
+
+   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 <errno.h>
+#include <pthread.h>
+#include <stdint.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <unistd.h>
+#include <sys/mman.h>
+#include <sys/wait.h>
+
+
+static int
+do_test (void)
+{
+  size_t ps = sysconf (_SC_PAGESIZE);
+  char tmpfname[] = "/tmp/tst-barrier2.XXXXXX";
+  char data[ps];
+  void *mem;
+  int fd;
+  pthread_barrier_t *b;
+  pthread_barrierattr_t a;
+  pid_t pid;
+  int serials = 0;
+  int cnt;
+  int status;
+  int p;
+
+  fd = mkstemp (tmpfname);
+  if (fd == -1)
+    {
+      printf ("cannot open temporary file: %m\n");
+      return 1;
+    }
+
+  /* Make sure it is always removed.  */
+  unlink (tmpfname);
+
+  /* Create one page of data.  */
+  memset (data, '\0', ps);
+
+  /* Write the data to the file.  */
+  if (write (fd, data, ps) != (ssize_t) ps)
+    {
+      puts ("short write");
+      return 1;
+    }
+
+  mem = mmap (NULL, ps, PROT_READ | PROT_WRITE, MAP_SHARED, fd, 0);
+  if (mem == MAP_FAILED)
+    {
+      printf ("mmap failed: %m\n");
+      return 1;
+    }
+
+  b = (pthread_barrier_t *) (((uintptr_t) mem + __alignof (pthread_barrier_t))
+			     & ~(__alignof (pthread_barrier_t) - 1));
+
+  if (pthread_barrierattr_init (&a) != 0)
+    {
+      puts ("barrierattr_init failed");
+      return 1;
+    }
+
+  if (pthread_barrierattr_getpshared (&a, &p) != 0)
+    {
+      puts ("1st barrierattr_getpshared failed");
+      return 1;
+    }
+
+  if (p != PTHREAD_PROCESS_PRIVATE)
+    {
+      puts ("default pshared value wrong");
+      return 1;
+    }
+
+  if (pthread_barrierattr_setpshared (&a, PTHREAD_PROCESS_SHARED) != 0)
+    {
+      puts ("barrierattr_setpshared failed");
+      return 1;
+    }
+
+  if (pthread_barrierattr_getpshared (&a, &p) != 0)
+    {
+      puts ("2nd barrierattr_getpshared failed");
+      return 1;
+    }
+
+  if (p != PTHREAD_PROCESS_SHARED)
+    {
+      puts ("pshared value after setpshared call wrong");
+      return 1;
+    }
+
+  if (pthread_barrier_init (b, &a, 2) != 0)
+    {
+      puts ("barrier_init failed");
+      return 1;
+    }
+
+  if (pthread_barrierattr_destroy (&a) != 0)
+    {
+      puts ("barrierattr_destroy failed");
+      return 1;
+    }
+
+  puts ("going to fork now");
+  pid = fork ();
+  if (pid == -1)
+    {
+      puts ("fork failed");
+      return 1;
+    }
+
+  /* Just to be sure we don't hang forever.  */
+  alarm (4);
+
+#define N 30
+  for (cnt = 0; cnt < N; ++cnt)
+    {
+      int e;
+
+      e = pthread_barrier_wait (b);
+      if (e == PTHREAD_BARRIER_SERIAL_THREAD)
+	++serials;
+      else if (e != 0)
+	{
+	  printf ("%s: barrier_wait returned value %d != 0 and PTHREAD_BARRIER_SERIAL_THREAD\n",
+		  pid == 0 ? "child" : "parent", e);
+	  return 1;
+	}
+    }
+
+  alarm (0);
+
+  printf ("%s: was %d times the serial thread\n",
+	  pid == 0 ? "child" : "parent", serials);
+
+  if (pid == 0)
+    /* The child.  Pass the number of times we had the serializing
+       thread back to the parent.  */
+    exit (serials);
+
+  if (waitpid (pid, &status, 0) != pid)
+    {
+      puts ("waitpid failed");
+      return 1;
+    }
+
+  if (!WIFEXITED (status))
+    {
+      puts ("child exited abnormally");
+      return 1;
+    }
+
+  if (WEXITSTATUS (status) + serials != N)
+    {
+      printf ("total number of serials is %d, expected %d\n",
+	      WEXITSTATUS (status) + serials, N);
+      return 1;
+    }
+
+  return 0;
+}
+
+#define TEST_FUNCTION do_test ()
+#include "../test-skeleton.c"
diff --git a/ap/build/uClibc/test/nptl/tst-barrier3.c b/ap/build/uClibc/test/nptl/tst-barrier3.c
new file mode 100644
index 0000000..b5478f8
--- /dev/null
+++ b/ap/build/uClibc/test/nptl/tst-barrier3.c
@@ -0,0 +1,154 @@
+/* Copyright (C) 2002 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+   Contributed by Ulrich Drepper <drepper@redhat.com>, 2002.
+
+   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.  */
+
+/* Test of POSIX barriers.  */
+
+#include <pthread.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+
+#define NTHREADS 20
+
+#define ROUNDS 20
+
+static pthread_barrier_t barriers[NTHREADS];
+
+static pthread_mutex_t lock = PTHREAD_MUTEX_INITIALIZER;
+static int counters[NTHREADS];
+static int serial[NTHREADS];
+
+static void *
+worker (void *arg)
+{
+  void *result = NULL;
+  int nr = (long int) arg;
+  int i;
+
+  for (i = 0; i < ROUNDS; ++i)
+    {
+      int j;
+      int retval;
+
+      if (nr == 0)
+	{
+	  memset (counters, '\0', sizeof (counters));
+	  memset (serial, '\0', sizeof (serial));
+	}
+
+      retval = pthread_barrier_wait (&barriers[NTHREADS - 1]);
+      if (retval != 0 && retval != PTHREAD_BARRIER_SERIAL_THREAD)
+	{
+	  printf ("thread %d failed to wait for all the others\n", nr);
+	  result = (void *) 1;
+	}
+
+      for (j = nr; j < NTHREADS; ++j)
+	{
+	  /* Increment the counter for this round.  */
+	  pthread_mutex_lock (&lock);
+	  ++counters[j];
+	  pthread_mutex_unlock (&lock);
+
+	  /* Wait for the rest.  */
+	  retval = pthread_barrier_wait (&barriers[j]);
+
+	  /* Test the result.  */
+	  if (nr == 0 && counters[j] != j + 1)
+	    {
+	      printf ("barrier in round %d released but count is %d\n",
+		      j, counters[j]);
+	      result = (void *) 1;
+	    }
+
+	  if (retval != 0)
+	    {
+	      if (retval != PTHREAD_BARRIER_SERIAL_THREAD)
+		{
+		  printf ("thread %d in round %d has nonzero return value != PTHREAD_BARRIER_SERIAL_THREAD\n",
+			  nr, j);
+		  result = (void *) 1;
+		}
+	      else
+		{
+		  pthread_mutex_lock (&lock);
+		  ++serial[j];
+		  pthread_mutex_unlock (&lock);
+		}
+	    }
+
+	  /* Wait for the rest again.  */
+	  retval = pthread_barrier_wait (&barriers[j]);
+
+	  /* Now we can check whether exactly one thread was serializing.  */
+	  if (nr == 0 && serial[j] != 1)
+	    {
+	      printf ("not exactly one serial thread in round %d\n", j);
+	      result = (void *) 1;
+	    }
+	}
+    }
+
+  return result;
+}
+
+
+#define TEST_FUNCTION do_test ()
+#define TIMEOUT 60
+static int
+do_test (void)
+{
+  pthread_t threads[NTHREADS];
+  int i;
+  void *res;
+  int result = 0;
+
+  /* Initialized the barrier variables.  */
+  for (i = 0; i < NTHREADS; ++i)
+    if (pthread_barrier_init (&barriers[i], NULL, i + 1) != 0)
+      {
+	printf ("Failed to initialize barrier %d\n", i);
+	exit (1);
+      }
+
+  /* Start the threads.  */
+  for (i = 0; i < NTHREADS; ++i)
+    if (pthread_create (&threads[i], NULL, worker, (void *) (long int) i) != 0)
+      {
+	printf ("Failed to start thread %d\n", i);
+	exit (1);
+      }
+
+  /* And wait for them.  */
+  for (i = 0; i < NTHREADS; ++i)
+    if (pthread_join (threads[i], &res) != 0 || res != NULL)
+      {
+	printf ("thread %d returned a failure\n", i);
+	result = 1;
+      }
+    else
+      printf ("joined threads %d\n", i);
+
+  if (result == 0)
+    puts ("all OK");
+
+  return result;
+}
+
+#include "../test-skeleton.c"
diff --git a/ap/build/uClibc/test/nptl/tst-barrier4.c b/ap/build/uClibc/test/nptl/tst-barrier4.c
new file mode 100644
index 0000000..efc2755
--- /dev/null
+++ b/ap/build/uClibc/test/nptl/tst-barrier4.c
@@ -0,0 +1,122 @@
+/* Copyright (C) 2004 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+   Contributed by Ulrich Drepper <drepper@redhat.com>, 2004.
+
+   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.  */
+
+/* This is a test for behavior not guaranteed by POSIX.  */
+#include <errno.h>
+#include <pthread.h>
+#include <stdio.h>
+#include <stdlib.h>
+
+
+static pthread_barrier_t b1;
+static pthread_barrier_t b2;
+
+
+#define N 20
+
+static void *
+tf (void *arg)
+{
+  int round = 0;
+
+  while (round++ < 30)
+    {
+      if (pthread_barrier_wait (&b1) == PTHREAD_BARRIER_SERIAL_THREAD)
+	{
+	  pthread_barrier_destroy (&b1);
+	  if (pthread_barrier_init (&b1, NULL, N) != 0)
+	    {
+	      puts ("tf: 1st barrier_init failed");
+	      exit (1);
+	    }
+	}
+
+      if (pthread_barrier_wait (&b2) == PTHREAD_BARRIER_SERIAL_THREAD)
+	{
+	  pthread_barrier_destroy (&b2);
+	  if (pthread_barrier_init (&b2, NULL, N) != 0)
+	    {
+	      puts ("tf: 2nd barrier_init failed");
+	      exit (1);
+	    }
+	}
+    }
+
+  return NULL;
+}
+
+
+static int
+do_test (void)
+{
+  pthread_attr_t at;
+  int cnt;
+
+  if (pthread_attr_init (&at) != 0)
+    {
+      puts ("attr_init failed");
+      return 1;
+    }
+
+  if (pthread_attr_setstacksize (&at, 1 * 1024 * 1024) != 0)
+    {
+      puts ("attr_setstacksize failed");
+      return 1;
+    }
+
+  if (pthread_barrier_init (&b1, NULL, N) != 0)
+    {
+      puts ("1st barrier_init failed");
+      return 1;
+    }
+
+  if (pthread_barrier_init (&b2, NULL, N) != 0)
+    {
+      puts ("2nd barrier_init failed");
+      return 1;
+    }
+
+  pthread_t th[N - 1];
+  for (cnt = 0; cnt < N - 1; ++cnt)
+    if (pthread_create (&th[cnt], &at, tf, NULL) != 0)
+      {
+	puts ("pthread_create failed");
+	return 1;
+      }
+
+  if (pthread_attr_destroy (&at) != 0)
+    {
+      puts ("attr_destroy failed");
+      return 1;
+    }
+
+  tf (NULL);
+
+  for (cnt = 0; cnt < N - 1; ++cnt)
+    if (pthread_join (th[cnt], NULL) != 0)
+      {
+	puts ("pthread_join failed");
+	return 1;
+      }
+
+  return 0;
+}
+
+#define TEST_FUNCTION do_test ()
+#include "../test-skeleton.c"
diff --git a/ap/build/uClibc/test/nptl/tst-basic1.c b/ap/build/uClibc/test/nptl/tst-basic1.c
new file mode 100644
index 0000000..7637c8e
--- /dev/null
+++ b/ap/build/uClibc/test/nptl/tst-basic1.c
@@ -0,0 +1,82 @@
+/* Copyright (C) 2002, 2003 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+   Contributed by Ulrich Drepper <drepper@redhat.com>, 2002.
+
+   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>
+#include <stdio.h>
+#include <unistd.h>
+#include <sys/types.h>
+
+
+static pid_t pid;
+
+static void *
+tf (void *a)
+{
+  if (getpid () != pid)
+    {
+      write (2, "pid mismatch\n", 13);
+      _exit (1);
+    }
+
+  return a;
+}
+
+
+int
+do_test (void)
+{
+  pid = getpid ();
+
+#define N 2
+  pthread_t t[N];
+  int i;
+
+  for (i = 0; i < N; ++i)
+    if (pthread_create (&t[i], NULL, tf, (void *) (long int) (i + 1)) != 0)
+      {
+	write (2, "create failed\n", 14);
+	_exit (1);
+      }
+    else
+      printf ("created thread %d\n", i);
+
+  for (i = 0; i < N; ++i)
+    {
+      void *r;
+      int e;
+      if ((e = pthread_join (t[i], &r)) != 0)
+	{
+	  printf ("join failed: %d\n", e);
+	  _exit (1);
+	}
+      else if (r != (void *) (long int) (i + 1))
+	{
+	  write (2, "result wrong\n", 13);
+	  _exit (1);
+	}
+      else
+	printf ("joined thread %d\n", i);
+    }
+
+  return 0;
+}
+
+
+#define TEST_FUNCTION do_test ()
+#include "../test-skeleton.c"
diff --git a/ap/build/uClibc/test/nptl/tst-basic2.c b/ap/build/uClibc/test/nptl/tst-basic2.c
new file mode 100644
index 0000000..1c4632c
--- /dev/null
+++ b/ap/build/uClibc/test/nptl/tst-basic2.c
@@ -0,0 +1,121 @@
+/* Copyright (C) 2002, 2003, 2004 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+   Contributed by Ulrich Drepper <drepper@redhat.com>, 2002.
+
+   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>
+#include <stdio.h>
+#include <stdint.h>
+#include <stdlib.h>
+#include <unistd.h>
+
+
+#define N 20
+
+static pthread_t th[N];
+static pthread_mutex_t lock[N];
+
+
+static void *tf (void *a)
+{
+  uintptr_t idx = (uintptr_t) a;
+
+  pthread_mutex_lock (&lock[idx]);
+
+  return pthread_equal (pthread_self (), th[idx]) ? NULL : (void *) 1l;
+}
+
+
+int
+do_test (void)
+{
+  if (pthread_equal (pthread_self (), pthread_self ()) == 0)
+    {
+      puts ("pthread_equal (pthread_self (), pthread_self ()) failed");
+      exit (1);
+    }
+
+  pthread_attr_t at;
+
+  if (pthread_attr_init (&at) != 0)
+    {
+      puts ("attr_init failed");
+      return 1;
+    }
+
+  if (pthread_attr_setstacksize (&at, 1 * 1024 * 1024) != 0)
+    {
+      puts ("attr_setstacksize failed");
+      return 1;
+    }
+
+  int i;
+  for (i = 0; i < N; ++i)
+    {
+      if (pthread_mutex_init (&lock[i], NULL) != 0)
+	{
+	  puts ("mutex_init failed");
+	  exit (1);
+	}
+
+      if (pthread_mutex_lock (&lock[i]) != 0)
+	{
+	  puts ("mutex_lock failed");
+	  exit (1);
+	}
+
+      if (pthread_create (&th[i], &at, tf, (void *) (long int) i) != 0)
+	{
+	  puts ("create failed");
+	  exit (1);
+	}
+
+      if (pthread_mutex_unlock (&lock[i]) != 0)
+	{
+	  puts ("mutex_unlock failed");
+	  exit (1);
+	}
+
+      printf ("created thread %d\n", i);
+    }
+
+  if (pthread_attr_destroy (&at) != 0)
+    {
+      puts ("attr_destroy failed");
+      return 1;
+    }
+
+  int result = 0;
+  for (i = 0; i < N; ++i)
+    {
+      void *r;
+      int e;
+      if ((e = pthread_join (th[i], &r)) != 0)
+	{
+	  printf ("join failed: %d\n", e);
+	  _exit (1);
+	}
+      else if (r != NULL)
+	result = 1;
+    }
+
+  return 0;
+}
+
+
+#define TEST_FUNCTION do_test ()
+#include "../test-skeleton.c"
diff --git a/ap/build/uClibc/test/nptl/tst-basic3.c b/ap/build/uClibc/test/nptl/tst-basic3.c
new file mode 100644
index 0000000..cb4816d
--- /dev/null
+++ b/ap/build/uClibc/test/nptl/tst-basic3.c
@@ -0,0 +1,87 @@
+/* Copyright (C) 2003 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, write to the Free
+   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+   02111-1307 USA.  */
+
+#include <pthread.h>
+#include <signal.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <unistd.h>
+
+
+static int nrunning = 1;
+
+
+static void
+final_test (void)
+{
+  puts ("final_test has been called");
+
+#define THE_SIGNAL SIGUSR1
+  kill (getpid (), SIGUSR1);
+}
+
+
+static void *
+tf (void *a)
+{
+  if (pthread_join ((pthread_t) a, NULL) != 0)
+    {
+      printf ("join failed while %d are running\n", nrunning);
+      _exit (1);
+    }
+
+  printf ("%2d left\n", --nrunning);
+
+  return NULL;
+}
+
+
+int
+do_test (void)
+{
+#define N 20
+  pthread_t t[N];
+  pthread_t last = pthread_self ();
+  int i;
+
+  atexit (final_test);
+
+  printf ("starting %d + 1 threads\n", N);
+  for (i = 0; i < N; ++i)
+    {
+      if (pthread_create (&t[i], NULL, tf, (void *) last) != 0)
+	{
+	  puts ("create failed");
+	  _exit (1);
+	}
+
+      ++nrunning;
+
+      last = t[i];
+    }
+
+  printf ("%2d left\n", --nrunning);
+
+  pthread_exit (NULL);
+}
+
+
+#define EXPECTED_SIGNAL THE_SIGNAL
+#define TEST_FUNCTION do_test ()
+#include "../test-skeleton.c"
diff --git a/ap/build/uClibc/test/nptl/tst-basic4.c b/ap/build/uClibc/test/nptl/tst-basic4.c
new file mode 100644
index 0000000..6eb6ea9
--- /dev/null
+++ b/ap/build/uClibc/test/nptl/tst-basic4.c
@@ -0,0 +1,101 @@
+/* Copyright (C) 2003 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, 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 <stdio.h>
+#include <stdlib.h>
+#include <unistd.h>
+#include <sys/wait.h>
+
+
+static void
+final_test (void)
+{
+  puts ("final_test has been called");
+
+#define THE_SIGNAL SIGUSR1
+  kill (getpid (), SIGUSR1);
+}
+
+
+static void *
+tf (void *a)
+{
+  pid_t pid = fork ();
+  if (pid == -1)
+    {
+      puts ("fork failed");
+      exit (1);
+    }
+
+  if (pid == 0)
+    {
+      atexit (final_test);
+
+      pthread_exit (NULL);
+    }
+
+  int r;
+  int e = TEMP_FAILURE_RETRY (waitpid (pid, &r, 0));
+  if (e != pid)
+    {
+      puts ("waitpid failed");
+      exit (1);
+    }
+
+  if (! WIFSIGNALED (r))
+    {
+      puts ("child not signled");
+      exit (1);
+    }
+
+  if (WTERMSIG (r) != THE_SIGNAL)
+    {
+      puts ("child's termination signal wrong");
+      exit (1);
+    }
+
+  return NULL;
+}
+
+
+int
+do_test (void)
+{
+  pthread_t th;
+
+  if (pthread_create (&th, NULL, tf, NULL) != 0)
+    {
+      puts ("create failed");
+      _exit (1);
+    }
+
+  if (pthread_join (th, NULL) != 0)
+    {
+      puts ("join failed");
+      exit (1);
+    }
+
+  return 0;
+}
+
+#define TEST_FUNCTION do_test ()
+#include "../test-skeleton.c"
diff --git a/ap/build/uClibc/test/nptl/tst-basic5.c b/ap/build/uClibc/test/nptl/tst-basic5.c
new file mode 100644
index 0000000..83a8810
--- /dev/null
+++ b/ap/build/uClibc/test/nptl/tst-basic5.c
@@ -0,0 +1,74 @@
+/* Copyright (C) 2003 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, write to the Free
+   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+   02111-1307 USA.  */
+
+#include <errno.h>
+#include <pthread.h>
+#include <stdio.h>
+#include <stdlib.h>
+
+
+
+int
+do_test (void)
+{
+  int c = pthread_getconcurrency ();
+  if (c != 0)
+    {
+      puts ("initial concurrencylevel wrong");
+      exit (1);
+    }
+
+  if (pthread_setconcurrency (1) != 0)
+    {
+      puts ("setconcurrency failed");
+      exit (1);
+    }
+
+  c = pthread_getconcurrency ();
+  if (c != 1)
+    {
+      puts ("getconcurrency didn't return the value previous set");
+      exit (1);
+    }
+
+  int e = pthread_setconcurrency (-1);
+  if (e == 0)
+    {
+      puts ("setconcurrency of negative value didn't failed");
+      exit (1);
+    }
+  if (e != EINVAL)
+    {
+      puts ("setconcurrency didn't return EINVAL for negative value");
+      exit (1);
+    }
+
+  c = pthread_getconcurrency ();
+  if (c != 1)
+    {
+      puts ("invalid getconcurrency changed level");
+      exit (1);
+    }
+
+  return 0;
+}
+
+
+#define TEST_FUNCTION do_test ()
+#include "../test-skeleton.c"
diff --git a/ap/build/uClibc/test/nptl/tst-basic6.c b/ap/build/uClibc/test/nptl/tst-basic6.c
new file mode 100644
index 0000000..413ae03
--- /dev/null
+++ b/ap/build/uClibc/test/nptl/tst-basic6.c
@@ -0,0 +1,132 @@
+/* Copyright (C) 2003 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, write to the Free
+   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+   02111-1307 USA.  */
+
+#include <pthread.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <unistd.h>
+
+
+static char *p;
+
+static pthread_barrier_t b;
+#define BT \
+  e = pthread_barrier_wait (&b);					      \
+  if (e != 0 && e != PTHREAD_BARRIER_SERIAL_THREAD)			      \
+    {									      \
+      puts ("barrier_wait failed");					      \
+      exit (1);								      \
+    }
+
+
+static void *
+tf (void *a)
+{
+  int e;
+
+  BT;
+
+  char *p2 = getcwd (NULL, 0);
+  if (p2 == NULL)
+    {
+      puts ("2nd getcwd failed");
+      exit (1);
+    }
+
+  if (strcmp (p, p2) != 0)
+    {
+      printf ("initial cwd mismatch: \"%s\" vs \"%s\"\n", p, p2);
+      exit (1);
+    }
+
+  free (p);
+  free (p2);
+
+  if (chdir ("..") != 0)
+    {
+      puts ("chdir failed");
+      exit (1);
+    }
+
+  p = getcwd (NULL, 0);
+  if (p == NULL)
+    {
+      puts ("getcwd failed");
+      exit (1);
+    }
+
+  return a;
+}
+
+
+int
+do_test (void)
+{
+  if (pthread_barrier_init (&b, NULL, 2) != 0)
+    {
+      puts ("barrier_init failed");
+      exit (1);
+    }
+
+  pthread_t th;
+  if (pthread_create (&th, NULL, tf, NULL) != 0)
+    {
+      puts ("create failed");
+      exit (1);
+    }
+
+  p = getcwd (NULL, 0);
+  if (p == NULL)
+    {
+      puts ("getcwd failed");
+      exit (1);
+    }
+
+  int e;
+  BT;
+
+  if (pthread_join (th, NULL) != 0)
+    {
+      puts ("join failed");
+      exit (1);
+    }
+
+  char *p2 = getcwd (NULL, 0);
+  if (p2 == NULL)
+    {
+      puts ("2nd getcwd failed");
+      exit (1);
+    }
+
+  if (strcmp (p, p2) != 0)
+    {
+      printf ("cwd after chdir mismatch: \"%s\" vs \"%s\"\n", p, p2);
+      exit (1);
+    }
+
+  free (p);
+  free (p2);
+
+  return 0;
+}
+
+
+#define TEST_FUNCTION do_test ()
+#include "../test-skeleton.c"
diff --git a/ap/build/uClibc/test/nptl/tst-basic7.c b/ap/build/uClibc/test/nptl/tst-basic7.c
new file mode 100644
index 0000000..15b6187
--- /dev/null
+++ b/ap/build/uClibc/test/nptl/tst-basic7.c
@@ -0,0 +1,75 @@
+#include <errno.h>
+#include <pthread.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <unistd.h>
+#include <limits.h>
+#include <sys/mman.h>
+#include <sys/resource.h>
+
+static void use_stack (size_t needed);
+
+void (*use_stack_ptr) (size_t) = use_stack;
+
+static void
+use_stack (size_t needed)
+{
+  size_t sz = sysconf (_SC_PAGESIZE);
+  char *buf = alloca (sz);
+  memset (buf, '\0', sz);
+
+  if (needed > sz)
+    use_stack_ptr (needed  - sz);
+}
+
+static void
+use_up_memory (void)
+{
+  struct rlimit rl;
+  getrlimit (RLIMIT_AS, &rl);
+  rl.rlim_cur = 10 * 1024 * 1024;
+  setrlimit (RLIMIT_AS, &rl);
+
+  char *c;
+  int PAGESIZE = getpagesize ();
+  while (1)
+    {
+      c = mmap (NULL, PAGESIZE, PROT_NONE, MAP_ANON | MAP_PRIVATE, -1, 0);
+      if (c == MAP_FAILED)
+	break;
+    }
+}
+
+static void *
+child (void *arg)
+{
+  sleep (1);
+  return arg;
+}
+
+static int
+do_test (void)
+{
+  int err;
+  pthread_t tid;
+
+  /* Allocate the memory needed for the stack.  */
+  use_stack_ptr (PTHREAD_STACK_MIN);
+
+  use_up_memory ();
+
+  err = pthread_create (&tid, NULL, child, NULL);
+  if (err != 0)
+    {
+      printf ("pthread_create returns %d: %s\n", err,
+	      err == EAGAIN ? "OK" : "FAIL");
+      return err != EAGAIN;
+    }
+
+  /* We did not fail to allocate memory despite the preparation.  Oh well.  */
+  return 0;
+}
+
+#define TEST_FUNCTION do_test ()
+#include "../test-skeleton.c"
diff --git a/ap/build/uClibc/test/nptl/tst-cancel1.c b/ap/build/uClibc/test/nptl/tst-cancel1.c
new file mode 100644
index 0000000..690319d
--- /dev/null
+++ b/ap/build/uClibc/test/nptl/tst-cancel1.c
@@ -0,0 +1,163 @@
+/* Copyright (C) 2002, 2003 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+   Contributed by Ulrich Drepper <drepper@redhat.com>, 2002.
+
+   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>
+#include <signal.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+
+
+static pthread_mutex_t m1 = PTHREAD_MUTEX_INITIALIZER;
+static pthread_mutex_t m2 = PTHREAD_MUTEX_INITIALIZER;
+
+static int cntr;
+
+
+static void
+cleanup (void *arg)
+{
+  if (arg != (void *) 42l)
+    cntr = 42;
+  else
+    cntr = 1;
+}
+
+
+static void *
+tf (void *arg)
+{
+  /* Ignore all signals.  This must not have any effect on delivering
+     the cancellation signal.  */
+  sigset_t ss;
+
+  sigfillset (&ss);
+
+  if (pthread_sigmask (SIG_BLOCK, &ss, NULL) != 0)
+    {
+      puts ("pthread_sigmask failed");
+      exit (1);
+    }
+
+  pthread_cleanup_push (cleanup, (void *) 42l);
+
+  int err = pthread_setcanceltype (PTHREAD_CANCEL_ASYNCHRONOUS, NULL);
+  if (err != 0)
+    {
+      printf ("setcanceltype failed: %s\n", strerror (err));
+      exit (1);
+    }
+  /* The following code is not standard compliant: the mutex functions
+     must not be called with asynchronous cancellation enabled.  */
+
+  err = pthread_mutex_unlock (&m2);
+  if (err != 0)
+    {
+      printf ("child: mutex_unlock failed: %s\n", strerror (err));
+      exit (1);
+    }
+
+  err = pthread_mutex_lock (&m1);
+  if (err != 0)
+    {
+      printf ("child: 1st mutex_lock failed: %s\n", strerror (err));
+      exit (1);
+    }
+
+  /* We should never come here.  */
+
+  pthread_cleanup_pop (0);
+
+  return NULL;
+}
+
+
+static int
+do_test (void)
+{
+  int err;
+  pthread_t th;
+  int result = 0;
+  void *retval;
+
+  /* Get the mutexes.  */
+  err = pthread_mutex_lock (&m1);
+  if (err != 0)
+    {
+      printf ("parent: 1st mutex_lock failed: %s\n", strerror (err));
+      return 1;
+    }
+  err = pthread_mutex_lock (&m2);
+  if (err != 0)
+    {
+      printf ("parent: 2nd mutex_lock failed: %s\n", strerror (err));
+      return 1;
+    }
+
+  err = pthread_create (&th, NULL, tf, NULL);
+  if (err != 0)
+    {
+      printf ("create failed: %s\n", strerror (err));
+      return 1;
+    }
+
+  err = pthread_mutex_lock (&m2);
+  if (err != 0)
+    {
+      printf ("parent: 3rd mutex_lock failed: %s\n", strerror (err));
+      return 1;
+    }
+
+  err = pthread_cancel (th);
+  if (err != 0)
+    {
+      printf ("cancel failed: %s\n", strerror (err));
+      return 1;
+    }
+
+  err = pthread_join (th, &retval);
+  if (err != 0)
+    {
+      printf ("join failed: %s\n", strerror (err));
+      return 1;
+    }
+
+  if (retval != PTHREAD_CANCELED)
+    {
+      printf ("wrong return value: %p\n", retval);
+      result = 1;
+    }
+
+  if (cntr == 42)
+    {
+      puts ("cleanup handler called with wrong argument");
+      result = 1;
+    }
+  else if (cntr != 1)
+    {
+      puts ("cleanup handling not called");
+      result = 1;
+    }
+
+  return result;
+}
+
+
+#define TEST_FUNCTION do_test ()
+#include "../test-skeleton.c"
diff --git a/ap/build/uClibc/test/nptl/tst-cancel10.c b/ap/build/uClibc/test/nptl/tst-cancel10.c
new file mode 100644
index 0000000..7af0f2f
--- /dev/null
+++ b/ap/build/uClibc/test/nptl/tst-cancel10.c
@@ -0,0 +1,126 @@
+/* Copyright (C) 2003, 2004 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, write to the Free
+   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+   02111-1307 USA.  */
+
+#include <pthread.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+
+
+static void
+cleanup (void *arg)
+{
+  /* Just for fun.  */
+  if (pthread_cancel (pthread_self ()) != 0)
+    {
+      puts ("cleanup: cancel failed");
+      exit (1);
+    }
+
+  printf ("cleanup for %ld\n", (long int) arg);
+}
+
+
+static void *
+tf (void *arg)
+{
+  long int n = (long int) arg;
+
+  pthread_cleanup_push (cleanup, arg);
+
+  if (pthread_setcanceltype ((n & 1) == 0
+			     ? PTHREAD_CANCEL_DEFERRED
+			     : PTHREAD_CANCEL_ASYNCHRONOUS, NULL) != 0)
+    {
+      puts ("setcanceltype failed");
+      exit (1);
+    }
+
+  if (pthread_cancel (pthread_self ()) != 0)
+    {
+      puts ("cancel failed");
+      exit (1);
+    }
+
+  pthread_testcancel ();
+
+  /* We should never come here.  */
+
+  pthread_cleanup_pop (0);
+
+  return NULL;
+}
+
+
+static int
+do_test (void)
+{
+  pthread_attr_t at;
+
+  if (pthread_attr_init (&at) != 0)
+    {
+      puts ("attr_init failed");
+      return 1;
+    }
+
+  if (pthread_attr_setstacksize (&at, 1 * 1024 * 1024) != 0)
+    {
+      puts ("attr_setstacksize failed");
+      return 1;
+    }
+
+#define N 20
+  int i;
+  pthread_t th[N];
+
+  for (i = 0; i < N; ++i)
+    if (pthread_create (&th[i], &at, tf, (void *) (long int) i) != 0)
+      {
+	puts ("create failed");
+	exit (1);
+      }
+
+  if (pthread_attr_destroy (&at) != 0)
+    {
+      puts ("attr_destroy failed");
+      return 1;
+    }
+
+  for (i = 0; i < N; ++i)
+    {
+      void *r;
+      if (pthread_join (th[i], &r) != 0)
+	{
+	  puts ("join failed");
+	  exit (1);
+	}
+
+      if (r != PTHREAD_CANCELED)
+	{
+	  puts ("thread not canceled");
+	  exit (1);
+	}
+    }
+
+  return 0;
+}
+
+
+#define TEST_FUNCTION do_test ()
+#include "../test-skeleton.c"
diff --git a/ap/build/uClibc/test/nptl/tst-cancel11.c b/ap/build/uClibc/test/nptl/tst-cancel11.c
new file mode 100644
index 0000000..235aef5
--- /dev/null
+++ b/ap/build/uClibc/test/nptl/tst-cancel11.c
@@ -0,0 +1,123 @@
+/* Copyright (C) 2003 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, write to the Free
+   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+   02111-1307 USA.  */
+
+#include <errno.h>
+#include <pthread.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <unistd.h>
+
+
+static pthread_barrier_t bar;
+static int fd[2];
+
+
+static void
+cleanup (void *arg)
+{
+  static int ncall;
+
+  if (++ncall != 1)
+    {
+      puts ("second call to cleanup");
+      exit (1);
+    }
+
+  printf ("cleanup call #%d\n", ncall);
+}
+
+
+static void *
+tf (void *arg)
+{
+  pthread_cleanup_push (cleanup, NULL);
+
+  int e = pthread_barrier_wait (&bar);
+  if (e != 0 && e != PTHREAD_BARRIER_SERIAL_THREAD)
+    {
+      puts ("tf: 1st barrier_wait failed");
+      exit (1);
+    }
+
+  /* This call should block and be cancelable.  */
+  char buf[20];
+  read (fd[0], buf, sizeof (buf));
+
+  pthread_cleanup_pop (0);
+
+  return NULL;
+}
+
+
+static int
+do_test (void)
+{
+  pthread_t th;
+
+  if (pthread_barrier_init (&bar, NULL, 2) != 0)
+    {
+      puts ("barrier_init failed");
+      exit (1);
+    }
+
+  if (pipe (fd) != 0)
+    {
+      puts ("pipe failed");
+      exit (1);
+    }
+
+  if (pthread_create (&th, NULL, tf, NULL) != 0)
+    {
+      puts ("create failed");
+      exit (1);
+    }
+
+  int e = pthread_barrier_wait (&bar);
+  if (e != 0 && e != PTHREAD_BARRIER_SERIAL_THREAD)
+    {
+      puts ("1st barrier_wait failed");
+      exit (1);
+    }
+
+  if (pthread_cancel (th) != 0)
+    {
+      puts ("1st cancel failed");
+      exit (1);
+    }
+
+  void *r;
+  if (pthread_join (th, &r) != 0)
+    {
+      puts ("join failed");
+      exit (1);
+    }
+
+  if (r != PTHREAD_CANCELED)
+    {
+      puts ("thread not canceled");
+      exit (1);
+    }
+
+  return 0;
+}
+
+
+#define TEST_FUNCTION do_test ()
+#include "../test-skeleton.c"
diff --git a/ap/build/uClibc/test/nptl/tst-cancel12.c b/ap/build/uClibc/test/nptl/tst-cancel12.c
new file mode 100644
index 0000000..6fdf5cf
--- /dev/null
+++ b/ap/build/uClibc/test/nptl/tst-cancel12.c
@@ -0,0 +1,127 @@
+/* Copyright (C) 2003 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, write to the Free
+   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+   02111-1307 USA.  */
+
+#include <errno.h>
+#include <pthread.h>
+#include <semaphore.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <unistd.h>
+
+
+static pthread_barrier_t bar;
+static sem_t sem;
+
+
+static void
+cleanup (void *arg)
+{
+  static int ncall;
+
+  if (++ncall != 1)
+    {
+      puts ("second call to cleanup");
+      exit (1);
+    }
+
+  printf ("cleanup call #%d\n", ncall);
+}
+
+
+static void *
+tf (void *arg)
+{
+  pthread_cleanup_push (cleanup, NULL);
+
+  int e = pthread_barrier_wait (&bar);
+  if (e != 0 && e != PTHREAD_BARRIER_SERIAL_THREAD)
+    {
+      puts ("tf: 1st barrier_wait failed");
+      exit (1);
+    }
+
+  /* This call should block and be cancelable.  */
+  sem_wait (&sem);
+
+  pthread_cleanup_pop (0);
+
+  puts ("sem_wait returned");
+
+  return NULL;
+}
+
+
+static int
+do_test (void)
+{
+  pthread_t th;
+
+  if (pthread_barrier_init (&bar, NULL, 2) != 0)
+    {
+      puts ("barrier_init failed");
+      exit (1);
+    }
+
+  if (sem_init (&sem, 0, 1) != 0)
+    {
+      puts ("sem_init failed");
+      exit (1);
+    }
+
+  if (pthread_create (&th, NULL, tf, NULL) != 0)
+    {
+      puts ("create failed");
+      exit (1);
+    }
+
+  /* Check whether cancellation is honored even before sem_wait does
+     anything.  */
+  if (pthread_cancel (th) != 0)
+    {
+      puts ("1st cancel failed");
+      exit (1);
+    }
+
+  int e = pthread_barrier_wait (&bar);
+  if (e != 0 && e != PTHREAD_BARRIER_SERIAL_THREAD)
+    {
+      puts ("1st barrier_wait failed");
+      exit (1);
+    }
+
+  void *r;
+  if (pthread_join (th, &r) != 0)
+    {
+      puts ("join failed");
+      exit (1);
+    }
+
+  if (r != PTHREAD_CANCELED)
+    {
+      puts ("thread not canceled");
+      exit (1);
+    }
+
+  return 0;
+}
+
+
+#define TEST_FUNCTION do_test ()
+#include "../test-skeleton.c"
diff --git a/ap/build/uClibc/test/nptl/tst-cancel13.c b/ap/build/uClibc/test/nptl/tst-cancel13.c
new file mode 100644
index 0000000..66ab455
--- /dev/null
+++ b/ap/build/uClibc/test/nptl/tst-cancel13.c
@@ -0,0 +1,129 @@
+/* Copyright (C) 2003 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, write to the Free
+   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+   02111-1307 USA.  */
+
+#include <errno.h>
+#include <pthread.h>
+#include <semaphore.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <unistd.h>
+
+
+static pthread_barrier_t bar;
+static sem_t sem;
+
+
+static void
+cleanup (void *arg)
+{
+  static int ncall;
+
+  if (++ncall != 1)
+    {
+      puts ("second call to cleanup");
+      exit (1);
+    }
+
+  printf ("cleanup call #%d\n", ncall);
+}
+
+
+static void *
+tf (void *arg)
+{
+  pthread_cleanup_push (cleanup, NULL);
+
+  int e = pthread_barrier_wait (&bar);
+  if (e != 0 && e != PTHREAD_BARRIER_SERIAL_THREAD)
+    {
+      puts ("tf: 1st barrier_wait failed");
+      exit (1);
+    }
+
+  /* This call should block and be cancelable.  */
+  sem_wait (&sem);
+
+  pthread_cleanup_pop (0);
+
+  puts ("sem_wait returned");
+
+  return NULL;
+}
+
+
+static int
+do_test (void)
+{
+  pthread_t th;
+
+  if (pthread_barrier_init (&bar, NULL, 2) != 0)
+    {
+      puts ("barrier_init failed");
+      exit (1);
+    }
+
+  if (sem_init (&sem, 0, 0) != 0)
+    {
+      puts ("sem_init failed");
+      exit (1);
+    }
+
+  if (pthread_create (&th, NULL, tf, NULL) != 0)
+    {
+      puts ("create failed");
+      exit (1);
+    }
+
+  int e = pthread_barrier_wait (&bar);
+  if (e != 0 && e != PTHREAD_BARRIER_SERIAL_THREAD)
+    {
+      puts ("1st barrier_wait failed");
+      exit (1);
+    }
+
+  /* Give the child a chance to go to sleep in sem_wait.  */
+  sleep (1);
+
+  /* Check whether cancellation is honored when waiting in sem_wait.  */
+  if (pthread_cancel (th) != 0)
+    {
+      puts ("1st cancel failed");
+      exit (1);
+    }
+
+  void *r;
+  if (pthread_join (th, &r) != 0)
+    {
+      puts ("join failed");
+      exit (1);
+    }
+
+  if (r != PTHREAD_CANCELED)
+    {
+      puts ("thread not canceled");
+      exit (1);
+    }
+
+  return 0;
+}
+
+
+#define TEST_FUNCTION do_test ()
+#include "../test-skeleton.c"
diff --git a/ap/build/uClibc/test/nptl/tst-cancel14.c b/ap/build/uClibc/test/nptl/tst-cancel14.c
new file mode 100644
index 0000000..592c086
--- /dev/null
+++ b/ap/build/uClibc/test/nptl/tst-cancel14.c
@@ -0,0 +1,137 @@
+/* Copyright (C) 2003 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, write to the Free
+   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+   02111-1307 USA.  */
+
+#include <errno.h>
+#include <pthread.h>
+#include <semaphore.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <unistd.h>
+#include <sys/time.h>
+
+
+static pthread_barrier_t bar;
+static sem_t sem;
+
+
+static void
+cleanup (void *arg)
+{
+  static int ncall;
+
+  if (++ncall != 1)
+    {
+      puts ("second call to cleanup");
+      exit (1);
+    }
+
+  printf ("cleanup call #%d\n", ncall);
+}
+
+
+static void *
+tf (void *arg)
+{
+  pthread_cleanup_push (cleanup, NULL);
+
+  int e = pthread_barrier_wait (&bar);
+  if (e != 0 && e != PTHREAD_BARRIER_SERIAL_THREAD)
+    {
+      puts ("tf: 1st barrier_wait failed");
+      exit (1);
+    }
+
+  struct timeval tv;
+  (void) gettimeofday (&tv, NULL);
+
+  struct timespec ts;
+  TIMEVAL_TO_TIMESPEC (&tv, &ts);
+
+  /* Timeout in 5 seconds.  */
+  ts.tv_sec += 5;
+
+  /* This call should block and be cancelable.  */
+  sem_timedwait (&sem, &ts);
+
+  pthread_cleanup_pop (0);
+
+  puts ("sem_timedwait returned");
+
+  return NULL;
+}
+
+
+static int
+do_test (void)
+{
+  pthread_t th;
+
+  if (pthread_barrier_init (&bar, NULL, 2) != 0)
+    {
+      puts ("barrier_init failed");
+      exit (1);
+    }
+
+  if (sem_init (&sem, 0, 1) != 0)
+    {
+      puts ("sem_init failed");
+      exit (1);
+    }
+
+  if (pthread_create (&th, NULL, tf, NULL) != 0)
+    {
+      puts ("create failed");
+      exit (1);
+    }
+
+  /* Check whether cancellation is honored even before sem_timedwait does
+     anything.  */
+  if (pthread_cancel (th) != 0)
+    {
+      puts ("1st cancel failed");
+      exit (1);
+    }
+
+  int e = pthread_barrier_wait (&bar);
+  if (e != 0 && e != PTHREAD_BARRIER_SERIAL_THREAD)
+    {
+      puts ("1st barrier_wait failed");
+      exit (1);
+    }
+
+  void *r;
+  if (pthread_join (th, &r) != 0)
+    {
+      puts ("join failed");
+      exit (1);
+    }
+
+  if (r != PTHREAD_CANCELED)
+    {
+      puts ("thread not canceled");
+      exit (1);
+    }
+
+  return 0;
+}
+
+
+#define TEST_FUNCTION do_test ()
+#include "../test-skeleton.c"
diff --git a/ap/build/uClibc/test/nptl/tst-cancel15.c b/ap/build/uClibc/test/nptl/tst-cancel15.c
new file mode 100644
index 0000000..5fd9502
--- /dev/null
+++ b/ap/build/uClibc/test/nptl/tst-cancel15.c
@@ -0,0 +1,142 @@
+/* Copyright (C) 2003 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, write to the Free
+   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+   02111-1307 USA.  */
+
+#include <errno.h>
+#include <pthread.h>
+#include <semaphore.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <unistd.h>
+#include <sys/time.h>
+
+
+static pthread_barrier_t bar;
+static sem_t sem;
+
+
+static void
+cleanup (void *arg)
+{
+  static int ncall;
+
+  if (++ncall != 1)
+    {
+      puts ("second call to cleanup");
+      exit (1);
+    }
+
+  printf ("cleanup call #%d\n", ncall);
+}
+
+
+static void *
+tf (void *arg)
+{
+  int e;
+
+  pthread_cleanup_push (cleanup, NULL);
+
+  e = pthread_barrier_wait (&bar);
+  if (e != 0 && e != PTHREAD_BARRIER_SERIAL_THREAD)
+    {
+      puts ("tf: 1st barrier_wait failed");
+      exit (1);
+    }
+
+  struct timeval tv;
+  (void) gettimeofday (&tv, NULL);
+
+  struct timespec ts;
+  TIMEVAL_TO_TIMESPEC (&tv, &ts);
+
+  /* Timeout in 5 seconds.  */
+  ts.tv_sec += 5;
+
+  /* This call should block and be cancelable.  */
+  errno = 0;
+  e = sem_timedwait (&sem, &ts);
+
+  pthread_cleanup_pop (0);
+
+  printf ("sem_timedwait returned, e = %d, errno = %d\n", e, errno);
+
+  return NULL;
+}
+
+
+static int
+do_test (void)
+{
+  pthread_t th;
+
+  if (pthread_barrier_init (&bar, NULL, 2) != 0)
+    {
+      puts ("barrier_init failed");
+      exit (1);
+    }
+
+  if (sem_init (&sem, 0, 0) != 0)
+    {
+      puts ("sem_init failed");
+      exit (1);
+    }
+
+  if (pthread_create (&th, NULL, tf, NULL) != 0)
+    {
+      puts ("create failed");
+      exit (1);
+    }
+
+  int e = pthread_barrier_wait (&bar);
+  if (e != 0 && e != PTHREAD_BARRIER_SERIAL_THREAD)
+    {
+      puts ("1st barrier_wait failed");
+      exit (1);
+    }
+
+  /* Give the child a chance to go to sleep in sem_wait.  */
+  sleep (1);
+
+  /* Check whether cancellation is honored when waiting in sem_timedwait.  */
+  if (pthread_cancel (th) != 0)
+    {
+      puts ("1st cancel failed");
+      exit (1);
+    }
+
+  void *r;
+  if (pthread_join (th, &r) != 0)
+    {
+      puts ("join failed");
+      exit (1);
+    }
+
+  if (r != PTHREAD_CANCELED)
+    {
+      puts ("thread not canceled");
+      exit (1);
+    }
+
+  return 0;
+}
+
+
+#define TEST_FUNCTION do_test ()
+#include "../test-skeleton.c"
diff --git a/ap/build/uClibc/test/nptl/tst-cancel16.c b/ap/build/uClibc/test/nptl/tst-cancel16.c
new file mode 100644
index 0000000..709902e
--- /dev/null
+++ b/ap/build/uClibc/test/nptl/tst-cancel16.c
@@ -0,0 +1,231 @@
+/* Copyright (C) 2003 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, write to the Free
+   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+   02111-1307 USA.  */
+
+#include <errno.h>
+#include <pthread.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <unistd.h>
+#include <sys/mman.h>
+#include <sys/wait.h>
+
+
+static pthread_barrier_t b2;
+static int fd;
+static int called;
+
+
+static void
+cl (void *arg)
+{
+  called = 1;
+}
+
+
+static void *
+tf (void *arg)
+{
+  int r = pthread_barrier_wait (&b2);
+  if (r != 0 && r != PTHREAD_BARRIER_SERIAL_THREAD)
+    {
+      puts ("child thread: barrier_wait failed");
+      exit (1);
+    }
+
+  pthread_cleanup_push (cl, NULL);
+
+  /* This call should never return.  */
+  (void) lockf (fd, F_LOCK, 0);
+
+  pthread_cleanup_pop (0);
+
+  return NULL;
+}
+
+
+static int
+do_test (void)
+{
+  char fname[] = "/tmp/cancel16XXXXXX";
+  fd = mkstemp (fname);
+  if (fd == -1)
+    {
+      puts ("mkstemp failed");
+      return 1;
+    }
+  unlink (fname);
+
+  char mem[sizeof (pthread_barrier_t)];
+  memset (mem, '\0', sizeof (mem));
+  if (TEMP_FAILURE_RETRY (pwrite (fd, mem, sizeof (mem), 0)) != sizeof (mem))
+    {
+      puts ("pwrite failed");
+      return 1;
+    }
+
+  void *p = mmap (NULL, sizeof (mem), PROT_READ|PROT_WRITE, MAP_SHARED, fd, 0);
+  if (p == MAP_FAILED)
+    {
+      puts ("mmap failed");
+      return 1;
+    }
+  pthread_barrier_t *b = (pthread_barrier_t *) p;
+
+  pthread_barrierattr_t ba;
+  if (pthread_barrierattr_init (&ba) != 0)
+    {
+      puts ("barrierattr_init failed");
+      return 1;
+    }
+  if (pthread_barrierattr_setpshared (&ba, 1) != 0)
+    {
+      puts ("barrierattr_setshared failed");
+      return 1;
+    }
+
+  if (pthread_barrier_init (b, &ba, 2) != 0)
+    {
+      puts ("1st barrier_init failed");
+      return 1;
+    }
+  if (pthread_barrierattr_destroy (&ba) != 0)
+    {
+      puts ("barrier_destroy failed");
+      return 1;
+    }
+
+  pid_t pid = fork ();
+  if (pid == 0)
+    {
+      /* Child.  Lock the file and wait.  */
+      if (lockf (fd, F_LOCK, 0) != 0)
+	{
+	  puts ("child process: lockf failed");
+	  _exit (1);
+	}
+
+      int r = pthread_barrier_wait (b);
+      if (r != 0 && r != PTHREAD_BARRIER_SERIAL_THREAD)
+	{
+	  puts ("child process: 1st barrier_wait failed");
+	  _exit (1);
+	}
+
+      /* Make sure the process dies.  */
+      alarm (5);
+
+      r = pthread_barrier_wait (b);
+      if (r != 0 && r != PTHREAD_BARRIER_SERIAL_THREAD)
+	{
+	  puts ("child process: 2nd barrier_wait failed");
+	  _exit (1);
+	}
+
+      _exit (0);
+    }
+  if (pid == -1)
+    {
+      puts ("fork failed");
+      return 1;
+    }
+
+  int r = pthread_barrier_wait (b);
+  if (r != 0 && r != PTHREAD_BARRIER_SERIAL_THREAD)
+    {
+      puts ("main: 1st barrier_wait failed");
+      _exit (1);
+    }
+
+  if (pthread_barrier_init (&b2, NULL, 2) != 0)
+    {
+      puts ("2nd barrier_init failed");
+      return 1;
+    }
+
+  pthread_t th;
+  if (pthread_create (&th, NULL, tf, NULL) != 0)
+    {
+      puts ("create failed");
+      return 1;
+    }
+
+  r = pthread_barrier_wait (&b2);
+  if (r != 0 && r != PTHREAD_BARRIER_SERIAL_THREAD)
+    {
+      puts ("main: 2nd barrier_wait failed");
+      return 1;
+    }
+
+  /* Delay.  */
+  sleep (1);
+
+  if (pthread_cancel (th) != 0)
+    {
+      puts ("cancel failed");
+      return 1;
+    }
+
+  void *result;
+  if (pthread_join (th, &result) != 0)
+    {
+      puts ("join failed");
+      return 1;
+    }
+  if (result != PTHREAD_CANCELED)
+    {
+      puts ("thread not canceled");
+      return 1;
+    }
+  if (called == 0)
+    {
+      puts ("cleanup handler not called");
+      return 1;
+    }
+
+  r = pthread_barrier_wait (b);
+  if (r != 0 && r != PTHREAD_BARRIER_SERIAL_THREAD)
+    {
+      puts ("main: 3rd barrier_wait failed");
+      return 1;
+    }
+
+  int status;
+  if (TEMP_FAILURE_RETRY (waitpid (pid, &status, 0)) != pid)
+    {
+      puts ("waitpid failed");
+      return 1;
+    }
+  if (WEXITSTATUS (status) != 0)
+    {
+      printf ("child process exits with %d\n", WEXITSTATUS (status));
+      return 1;
+    }
+
+  if (lockf (fd, F_LOCK, 0) != 0)
+    {
+      puts ("main: lockf failed");
+      return 1;
+    }
+
+  return 0;
+}
+
+#define TEST_FUNCTION do_test ()
+#include "../test-skeleton.c"
diff --git a/ap/build/uClibc/test/nptl/tst-cancel18.c b/ap/build/uClibc/test/nptl/tst-cancel18.c
new file mode 100644
index 0000000..15e9ddf
--- /dev/null
+++ b/ap/build/uClibc/test/nptl/tst-cancel18.c
@@ -0,0 +1,174 @@
+/* Copyright (C) 2003 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, write to the Free
+   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+   02111-1307 USA.  */
+
+#include <errno.h>
+#include <pthread.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <time.h>
+#include <unistd.h>
+
+
+static pthread_barrier_t b;
+
+
+/* Cleanup handling test.  */
+static int cl_called;
+
+static void
+cl (void *arg)
+{
+  ++cl_called;
+}
+
+
+static void *
+tf (void *arg)
+{
+  int r = pthread_barrier_wait (&b);
+  if (r != 0 && r != PTHREAD_BARRIER_SERIAL_THREAD)
+    {
+      puts ("barrier_wait failed");
+      exit (1);
+    }
+
+  pthread_cleanup_push (cl, NULL);
+
+  struct timespec ts = { .tv_sec = arg == NULL ? 10000000 : 0, .tv_nsec = 0 };
+  TEMP_FAILURE_RETRY (clock_nanosleep (CLOCK_REALTIME, 0, &ts, &ts));
+
+  pthread_cleanup_pop (0);
+
+  puts ("clock_nanosleep returned");
+
+  exit (1);
+}
+
+
+static int
+do_test (void)
+{
+  if (pthread_barrier_init (&b, NULL, 2) != 0)
+    {
+      puts ("barrier_init failed");
+      return 1;
+    }
+
+  pthread_t th;
+  if (pthread_create (&th, NULL, tf, NULL) != 0)
+    {
+      puts ("1st create failed");
+      return 1;
+    }
+
+  int r = pthread_barrier_wait (&b);
+  if (r != 0 && r != PTHREAD_BARRIER_SERIAL_THREAD)
+    {
+      puts ("barrier_wait failed");
+      exit (1);
+    }
+
+  struct timespec  ts = { .tv_sec = 0, .tv_nsec = 100000000 };
+  while (nanosleep (&ts, &ts) != 0)
+    continue;
+
+  puts ("going to cancel in-time");
+  if (pthread_cancel (th) != 0)
+    {
+      puts ("1st cancel failed");
+      return 1;
+    }
+
+  void *status;
+  if (pthread_join (th, &status) != 0)
+    {
+      puts ("1st join failed");
+      return 1;
+    }
+  if (status != PTHREAD_CANCELED)
+    {
+      puts ("1st thread not canceled");
+      return 1;
+    }
+
+  if (cl_called == 0)
+    {
+      puts ("cleanup handler not called");
+      return 1;
+    }
+  if (cl_called > 1)
+    {
+      puts ("cleanup handler called more than once");
+      return 1;
+    }
+
+  puts ("in-time cancellation succeeded");
+
+
+  cl_called = 0;
+
+  if (pthread_create (&th, NULL, tf, NULL) != 0)
+    {
+      puts ("2nd create failed");
+      return 1;
+    }
+
+  puts ("going to cancel early");
+  if (pthread_cancel (th) != 0)
+    {
+      puts ("2nd cancel failed");
+      return 1;
+    }
+
+  r = pthread_barrier_wait (&b);
+  if (r != 0 && r != PTHREAD_BARRIER_SERIAL_THREAD)
+    {
+      puts ("barrier_wait failed");
+      exit (1);
+    }
+
+  if (pthread_join (th, &status) != 0)
+    {
+      puts ("2nd join failed");
+      return 1;
+    }
+  if (status != PTHREAD_CANCELED)
+    {
+      puts ("2nd thread not canceled");
+      return 1;
+    }
+
+  if (cl_called == 0)
+    {
+      printf ("cleanup handler not called\n");
+      return 1;
+    }
+  if (cl_called > 1)
+    {
+      printf ("cleanup handler called more than once\n");
+      return 1;
+    }
+
+  puts ("early cancellation succeeded");
+
+  return 0;
+}
+
+#define TEST_FUNCTION do_test ()
+#include "../test-skeleton.c"
diff --git a/ap/build/uClibc/test/nptl/tst-cancel19.c b/ap/build/uClibc/test/nptl/tst-cancel19.c
new file mode 100644
index 0000000..b346f60
--- /dev/null
+++ b/ap/build/uClibc/test/nptl/tst-cancel19.c
@@ -0,0 +1,287 @@
+/* Copyright (C) 2003 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+   Contributed by Jakub Jelinek <jakub@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, write to the Free
+   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+   02111-1307 USA.  */
+
+#include <errno.h>
+#include <error.h>
+#include <fcntl.h>
+#include <pthread.h>
+#include <signal.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <sys/select.h>
+#include <sys/time.h>
+#include <unistd.h>
+
+static void *
+tf (void *arg)
+{
+  return NULL;
+}
+
+static void
+handler (int sig)
+{
+}
+
+static void __attribute__ ((noinline))
+clobber_lots_of_regs (void)
+{
+#define X1(n) long r##n = 10##n; __asm__ __volatile__ ("" : "+r" (r##n));
+#define X2(n) X1(n##0) X1(n##1) X1(n##2) X1(n##3) X1(n##4)
+#define X3(n) X2(n##0) X2(n##1) X2(n##2) X2(n##3) X2(n##4)
+  X3(0) X3(1) X3(2) X3(3) X3(4)
+#undef X1
+#define X1(n) __asm__ __volatile__ ("" : : "r" (r##n));
+  X3(0) X3(1) X3(2) X3(3) X3(4)
+#undef X1
+#undef X2
+#undef X3
+}
+
+static int
+do_test (void)
+{
+  pthread_t th;
+  int old, rc;
+  int ret = 0;
+  int fd[2];
+
+  rc = pipe (fd);
+  if (rc < 0)
+    error (EXIT_FAILURE, errno, "couldn't create pipe");
+
+  rc = pthread_create (&th, NULL, tf, NULL);
+  if (rc)
+    error (EXIT_FAILURE, rc, "couldn't create thread");
+
+  rc = pthread_setcanceltype (PTHREAD_CANCEL_DEFERRED, &old);
+  if (rc)
+    {
+      error (0, rc, "1st pthread_setcanceltype failed");
+      ret = 1;
+    }
+  if (old != PTHREAD_CANCEL_DEFERRED && old != PTHREAD_CANCEL_ASYNCHRONOUS)
+    {
+      error (0, 0, "1st pthread_setcanceltype returned invalid value %d",
+	     old);
+      ret = 1;
+    }
+
+  clobber_lots_of_regs ();
+  close (fd[0]);
+
+  rc = pthread_setcanceltype (PTHREAD_CANCEL_ASYNCHRONOUS, &old);
+  if (rc)
+    {
+      error (0, rc, "pthread_setcanceltype after close failed");
+      ret = 1;
+    }
+  if (old != PTHREAD_CANCEL_DEFERRED)
+    {
+      error (0, 0, "pthread_setcanceltype after close returned invalid value %d",
+	     old);
+      ret = 1;
+    }
+
+  clobber_lots_of_regs ();
+  close (fd[1]);
+
+  rc = pthread_setcanceltype (PTHREAD_CANCEL_DEFERRED, &old);
+  if (rc)
+    {
+      error (0, rc, "pthread_setcanceltype after 2nd close failed");
+      ret = 1;
+    }
+  if (old != PTHREAD_CANCEL_ASYNCHRONOUS)
+    {
+      error (0, 0, "pthread_setcanceltype after 2nd close returned invalid value %d",
+	     old);
+      ret = 1;
+    }
+
+  struct sigaction sa = { .sa_handler = handler, .sa_flags = 0 };
+  sigemptyset (&sa.sa_mask);
+  sigaction (SIGALRM, &sa, NULL);
+
+  struct itimerval it;
+  it.it_value.tv_sec = 1;
+  it.it_value.tv_usec = 0;
+  it.it_interval = it.it_value;
+  setitimer (ITIMER_REAL, &it, NULL);
+
+  clobber_lots_of_regs ();
+  pause ();
+
+  memset (&it, 0, sizeof (it));
+  setitimer (ITIMER_REAL, &it, NULL);
+
+  rc = pthread_setcanceltype (PTHREAD_CANCEL_ASYNCHRONOUS, &old);
+  if (rc)
+    {
+      error (0, rc, "pthread_setcanceltype after pause failed");
+      ret = 1;
+    }
+  if (old != PTHREAD_CANCEL_DEFERRED)
+    {
+      error (0, 0, "pthread_setcanceltype after pause returned invalid value %d",
+	     old);
+      ret = 1;
+    }
+
+  it.it_value.tv_sec = 1;
+  it.it_value.tv_usec = 0;
+  it.it_interval = it.it_value;
+  setitimer (ITIMER_REAL, &it, NULL);
+
+  clobber_lots_of_regs ();
+  pause ();
+
+  memset (&it, 0, sizeof (it));
+  setitimer (ITIMER_REAL, &it, NULL);
+
+  rc = pthread_setcanceltype (PTHREAD_CANCEL_DEFERRED, &old);
+  if (rc)
+    {
+      error (0, rc, "pthread_setcanceltype after 2nd pause failed");
+      ret = 1;
+    }
+  if (old != PTHREAD_CANCEL_ASYNCHRONOUS)
+    {
+      error (0, 0, "pthread_setcanceltype after 2nd pause returned invalid value %d",
+	     old);
+      ret = 1;
+    }
+
+  char fname[] = "/tmp/tst-cancel19-dir-XXXXXX\0foo/bar";
+  char *enddir = strchr (fname, '\0');
+  if (mkdtemp (fname) == NULL)
+    {
+      error (0, errno, "mkdtemp failed");
+      ret = 1;
+    }
+  *enddir = '/';
+
+  clobber_lots_of_regs ();
+  creat (fname, 0400);
+
+  rc = pthread_setcanceltype (PTHREAD_CANCEL_ASYNCHRONOUS, &old);
+  if (rc)
+    {
+      error (0, rc, "pthread_setcanceltype after creat failed");
+      ret = 1;
+    }
+  if (old != PTHREAD_CANCEL_DEFERRED)
+    {
+      error (0, 0, "pthread_setcanceltype after creat returned invalid value %d",
+	     old);
+      ret = 1;
+    }
+
+  clobber_lots_of_regs ();
+  creat (fname, 0400);
+
+  rc = pthread_setcanceltype (PTHREAD_CANCEL_DEFERRED, &old);
+  if (rc)
+    {
+      error (0, rc, "pthread_setcanceltype after 2nd creat failed");
+      ret = 1;
+    }
+  if (old != PTHREAD_CANCEL_ASYNCHRONOUS)
+    {
+      error (0, 0, "pthread_setcanceltype after 2nd creat returned invalid value %d",
+	     old);
+      ret = 1;
+    }
+
+  clobber_lots_of_regs ();
+  open (fname, O_CREAT, 0400);
+
+  rc = pthread_setcanceltype (PTHREAD_CANCEL_ASYNCHRONOUS, &old);
+  if (rc)
+    {
+      error (0, rc, "pthread_setcanceltype after open failed");
+      ret = 1;
+    }
+  if (old != PTHREAD_CANCEL_DEFERRED)
+    {
+      error (0, 0, "pthread_setcanceltype after open returned invalid value %d",
+	     old);
+      ret = 1;
+    }
+
+  clobber_lots_of_regs ();
+  open (fname, O_CREAT, 0400);
+
+  rc = pthread_setcanceltype (PTHREAD_CANCEL_DEFERRED, &old);
+  if (rc)
+    {
+      error (0, rc, "pthread_setcanceltype after 2nd open failed");
+      ret = 1;
+    }
+  if (old != PTHREAD_CANCEL_ASYNCHRONOUS)
+    {
+      error (0, 0, "pthread_setcanceltype after 2nd open returned invalid value %d",
+	     old);
+      ret = 1;
+    }
+
+  *enddir = '\0';
+  rmdir (fname);
+
+  clobber_lots_of_regs ();
+  select (-1, NULL, NULL, NULL, NULL);
+
+  rc = pthread_setcanceltype (PTHREAD_CANCEL_ASYNCHRONOUS, &old);
+  if (rc)
+    {
+      error (0, rc, "pthread_setcanceltype after select failed");
+      ret = 1;
+    }
+  if (old != PTHREAD_CANCEL_DEFERRED)
+    {
+      error (0, 0, "pthread_setcanceltype after select returned invalid value %d",
+	     old);
+      ret = 1;
+    }
+
+  clobber_lots_of_regs ();
+  select (-1, NULL, NULL, NULL, NULL);
+
+  rc = pthread_setcanceltype (PTHREAD_CANCEL_DEFERRED, &old);
+  if (rc)
+    {
+      error (0, rc, "pthread_setcanceltype after 2nd select failed");
+      ret = 1;
+    }
+  if (old != PTHREAD_CANCEL_ASYNCHRONOUS)
+    {
+      error (0, 0, "pthread_setcanceltype after 2nd select returned invalid value %d",
+	     old);
+      ret = 1;
+    }
+
+  pthread_join (th, NULL);
+
+  return ret;
+}
+
+#define TIMEOUT 20
+#define TEST_FUNCTION do_test ()
+#include "../test-skeleton.c"
diff --git a/ap/build/uClibc/test/nptl/tst-cancel2.c b/ap/build/uClibc/test/nptl/tst-cancel2.c
new file mode 100644
index 0000000..6d80f8a
--- /dev/null
+++ b/ap/build/uClibc/test/nptl/tst-cancel2.c
@@ -0,0 +1,100 @@
+/* Copyright (C) 2002 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+   Contributed by Ulrich Drepper <drepper@redhat.com>, 2002.
+
+   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>
+#include <signal.h>
+#include <stdio.h>
+#include <unistd.h>
+
+
+static int fd[2];
+
+
+static void *
+tf (void *arg)
+{
+  /* The buffer size must be larger than the pipe size so that the
+     write blocks.  */
+  char buf[100000];
+
+  if (write (fd[1], buf, sizeof (buf)) == sizeof (buf))
+    {
+      puts ("write succeeded");
+      return (void *) 1l;
+    }
+
+  return (void *) 42l;
+}
+
+
+static int
+do_test (void)
+{
+  pthread_t th;
+  void *r;
+  struct sigaction sa;
+
+  sa.sa_handler = SIG_IGN;
+  sigemptyset (&sa.sa_mask);
+  sa.sa_flags = 0;
+
+  if (sigaction (SIGPIPE, &sa, NULL) != 0)
+    {
+      puts ("sigaction failed");
+      return 1;
+    }
+
+  if (pipe (fd) != 0)
+    {
+      puts ("pipe failed");
+      return 1;
+    }
+
+  if (pthread_create (&th, NULL, tf, NULL) != 0)
+    {
+      puts ("create failed");
+      return 1;
+    }
+
+  if (pthread_cancel (th) != 0)
+    {
+      puts ("cancel failed");
+      return 1;
+    }
+
+  /* This will cause the write in the child to return.  */
+  close (fd[0]);
+
+  if (pthread_join (th, &r) != 0)
+    {
+      puts ("join failed");
+      return 1;
+    }
+
+  if (r != PTHREAD_CANCELED)
+    {
+      printf ("result is wrong: expected %p, got %p\n", PTHREAD_CANCELED, r);
+      return 1;
+    }
+
+  return 0;
+}
+
+#define TEST_FUNCTION do_test ()
+#include "../test-skeleton.c"
diff --git a/ap/build/uClibc/test/nptl/tst-cancel20.c b/ap/build/uClibc/test/nptl/tst-cancel20.c
new file mode 100644
index 0000000..d88cb9c
--- /dev/null
+++ b/ap/build/uClibc/test/nptl/tst-cancel20.c
@@ -0,0 +1,264 @@
+/* Copyright (C) 2003, 2004 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+   Contributed by Jakub Jelinek <jakub@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, 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 <stdio.h>
+#include <stdlib.h>
+#include <unistd.h>
+
+
+static int fd[4];
+static pthread_barrier_t b;
+volatile int in_sh_body;
+unsigned long cleanups;
+
+static void
+cl (void *arg)
+{
+  cleanups = (cleanups << 4) | (long) arg;
+}
+
+
+static void __attribute__((noinline))
+sh_body (void)
+{
+  char c;
+
+  pthread_cleanup_push (cl, (void *) 1L);
+
+  in_sh_body = 1;
+  if (read (fd[2], &c, 1) == 1)
+    {
+      puts ("read succeeded");
+      exit (1);
+    }
+
+  pthread_cleanup_pop (0);
+}
+
+
+static void
+sh (int sig)
+{
+  pthread_cleanup_push (cl, (void *) 2L);
+  sh_body ();
+  in_sh_body = 0;
+
+  pthread_cleanup_pop (0);
+}
+
+
+static void __attribute__((noinline))
+tf_body (void)
+{
+  char c;
+
+  pthread_cleanup_push (cl, (void *) 3L);
+
+  int r = pthread_barrier_wait (&b);
+  if (r != 0 && r != PTHREAD_BARRIER_SERIAL_THREAD)
+    {
+      puts ("child thread: barrier_wait failed");
+      exit (1);
+    }
+
+  if (read (fd[0], &c, 1) == 1)
+    {
+      puts ("read succeeded");
+      exit (1);
+    }
+
+  read (fd[0], &c, 1);
+
+  pthread_cleanup_pop (0);
+}
+
+
+static void *
+tf (void *arg)
+{
+  pthread_cleanup_push (cl, (void *) 4L);
+  tf_body ();
+  pthread_cleanup_pop (0);
+  return NULL;
+}
+
+
+static int
+do_one_test (void)
+{
+  in_sh_body = 0;
+  cleanups = 0;
+  if (pipe (fd) != 0 || pipe (fd + 2) != 0)
+    {
+      puts ("pipe failed");
+      return 1;
+    }
+
+  pthread_t th;
+  if (pthread_create (&th, NULL, tf, NULL) != 0)
+    {
+      puts ("create failed");
+      return 1;
+    }
+
+  int r = pthread_barrier_wait (&b);
+  if (r != 0 && r != PTHREAD_BARRIER_SERIAL_THREAD)
+    {
+      puts ("parent thread: barrier_wait failed");
+      return 1;
+    }
+
+  sleep (1);
+
+  r = pthread_kill (th, SIGHUP);
+  if (r)
+    {
+      errno = r;
+      printf ("pthread_kill failed %m\n");
+      return 1;
+    }
+
+  while (in_sh_body == 0)
+    sleep (1);
+
+  if (pthread_cancel (th) != 0)
+    {
+      puts ("cancel failed");
+      return 1;
+    }
+
+  /* This will cause the read in the child to return.  */
+  close (fd[0]);
+  close (fd[1]);
+  close (fd[2]);
+  close (fd[3]);
+
+  void *ret;
+  if (pthread_join (th, &ret) != 0)
+    {
+      puts ("join failed");
+      return 1;
+    }
+
+  if (ret != PTHREAD_CANCELED)
+    {
+      puts ("result is wrong");
+      return 1;
+    }
+
+  if (cleanups != 0x1234L)
+    {
+      printf ("called cleanups %lx\n", cleanups);
+      return 1;
+    }
+
+  return 0;
+}
+
+
+static int
+do_test (void)
+{
+  stack_t ss;
+  ss.ss_sp = malloc (2 * SIGSTKSZ);
+  if (ss.ss_sp == NULL)
+    {
+      puts ("failed to allocate alternate stack");
+      return 1;
+    }
+  ss.ss_flags = 0;
+  ss.ss_size = 2 * SIGSTKSZ;
+  if (sigaltstack (&ss, NULL) < 0)
+    {
+      printf ("sigaltstack failed %m\n");
+      return 1;
+    }
+
+  if (pthread_barrier_init (&b, NULL, 2) != 0)
+    {
+      puts ("barrier_init failed");
+      return 1;
+    }
+
+  struct sigaction sa;
+  sa.sa_handler = sh;
+  sigemptyset (&sa.sa_mask);
+  sa.sa_flags = 0;
+
+  if (sigaction (SIGHUP, &sa, NULL) != 0)
+    {
+      puts ("sigaction failed");
+      return 1;
+    }
+
+  puts ("sa_flags = 0 test");
+  if (do_one_test ())
+    return 1;
+
+  sa.sa_handler = sh;
+  sigemptyset (&sa.sa_mask);
+  sa.sa_flags = SA_ONSTACK;
+
+  if (sigaction (SIGHUP, &sa, NULL) != 0)
+    {
+      puts ("sigaction failed");
+      return 1;
+    }
+
+  puts ("sa_flags = SA_ONSTACK test");
+  if (do_one_test ())
+    return 1;
+
+  sa.sa_sigaction = (void (*)(int, siginfo_t *, void *)) sh;
+  sigemptyset (&sa.sa_mask);
+  sa.sa_flags = SA_SIGINFO;
+
+  if (sigaction (SIGHUP, &sa, NULL) != 0)
+    {
+      puts ("sigaction failed");
+      return 1;
+    }
+
+  puts ("sa_flags = SA_SIGINFO test");
+  if (do_one_test ())
+    return 1;
+
+  sa.sa_sigaction = (void (*)(int, siginfo_t *, void *)) sh;
+  sigemptyset (&sa.sa_mask);
+  sa.sa_flags = SA_SIGINFO | SA_ONSTACK;
+
+  if (sigaction (SIGHUP, &sa, NULL) != 0)
+    {
+      puts ("sigaction failed");
+      return 1;
+    }
+
+  puts ("sa_flags = SA_SIGINFO|SA_ONSTACK test");
+  if (do_one_test ())
+    return 1;
+
+  return 0;
+}
+
+#define TIMEOUT 40
+#define TEST_FUNCTION do_test ()
+#include "../test-skeleton.c"
diff --git a/ap/build/uClibc/test/nptl/tst-cancel21.c b/ap/build/uClibc/test/nptl/tst-cancel21.c
new file mode 100644
index 0000000..cc00cc1
--- /dev/null
+++ b/ap/build/uClibc/test/nptl/tst-cancel21.c
@@ -0,0 +1,294 @@
+/* Copyright (C) 2003, 2004 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+   Contributed by Jakub Jelinek <jakub@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, 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 <stdio.h>
+#include <stdlib.h>
+#include <sys/wait.h>
+#include <unistd.h>
+
+
+static int fd[4];
+static pthread_barrier_t b;
+volatile int in_sh_body;
+unsigned long cleanups;
+
+static void
+cl (void *arg)
+{
+  cleanups = (cleanups << 4) | (long) arg;
+}
+
+
+static void __attribute__((noinline))
+sh_body (void)
+{
+  char c;
+
+  pthread_cleanup_push (cl, (void *) 1L);
+
+  in_sh_body = 1;
+  if (read (fd[2], &c, 1) == 1)
+    {
+      puts ("read succeeded");
+      exit (1);
+    }
+
+  pthread_cleanup_pop (0);
+}
+
+
+static void
+sh (int sig)
+{
+  pthread_cleanup_push (cl, (void *) 2L);
+  sh_body ();
+  in_sh_body = 0;
+
+  pthread_cleanup_pop (0);
+}
+
+
+static void __attribute__((noinline))
+tf_body (void)
+{
+  char c;
+
+  pthread_cleanup_push (cl, (void *) 3L);
+
+  int r = pthread_barrier_wait (&b);
+  if (r != 0 && r != PTHREAD_BARRIER_SERIAL_THREAD)
+    {
+      puts ("child thread: barrier_wait failed");
+      exit (1);
+    }
+
+  if (read (fd[0], &c, 1) == 1)
+    {
+      puts ("read succeeded");
+      exit (1);
+    }
+
+  read (fd[0], &c, 1);
+
+  pthread_cleanup_pop (0);
+}
+
+
+static void *
+tf (void *arg)
+{
+  pthread_t th = (pthread_t) arg;
+
+  int r = pthread_barrier_wait (&b);
+  if (r != 0 && r != PTHREAD_BARRIER_SERIAL_THREAD)
+    {
+      puts ("parent thread: barrier_wait failed");
+      exit (1);
+    }
+
+  sleep (1);
+
+  r = pthread_kill (th, SIGHUP);
+  if (r)
+    {
+      errno = r;
+      printf ("pthread_kill failed %m\n");
+      exit (1);
+    }
+
+  while (in_sh_body == 0)
+    sleep (1);
+
+  if (pthread_cancel (th) != 0)
+    {
+      puts ("cancel failed");
+      exit (1);
+    }
+
+  /* This will cause the read in the initial thread to return.  */
+  close (fd[0]);
+  close (fd[1]);
+  close (fd[2]);
+  close (fd[3]);
+
+  void *ret;
+  if (pthread_join (th, &ret) != 0)
+    {
+      puts ("join failed");
+      exit (1);
+    }
+
+  if (ret != PTHREAD_CANCELED)
+    {
+      puts ("result is wrong");
+      exit (1);
+    }
+
+  if (cleanups != 0x1234L)
+    {
+      printf ("called cleanups %lx\n", cleanups);
+      exit (1);
+    }
+
+  if (pthread_barrier_destroy (&b))
+    {
+      puts ("barrier destroy failed");
+      exit (1);
+    }
+
+  exit (0);
+}
+
+
+static int
+do_one_test (void)
+{
+  in_sh_body = 0;
+
+  pid_t pid = fork ();
+
+  if (pid == -1)
+    {
+      printf ("fork failed: %m\n");
+      return 1;
+    }
+
+  if (pid)
+    {
+      int status;
+      if (waitpid (pid, &status, 0) < 0)
+	{
+	  printf ("waitpid failed %m\n");
+	  return 1;
+	}
+
+      return !WIFEXITED (status) || WEXITSTATUS (status);
+    }
+
+  if (pthread_barrier_init (&b, NULL, 2) != 0)
+    {
+      puts ("barrier_init failed");
+      exit (1);
+    }
+
+  cleanups = 0;
+  if (pipe (fd) != 0 || pipe (fd + 2) != 0)
+    {
+      puts ("pipe failed");
+      exit (1);
+    }
+
+  pthread_t th;
+  if (pthread_create (&th, NULL, tf, (void *) pthread_self ()) != 0)
+    {
+      puts ("create failed");
+      exit (1);
+    }
+
+  pthread_cleanup_push (cl, (void *) 4L);
+  tf_body ();
+  pthread_cleanup_pop (0);
+  exit (1);
+}
+
+
+static int
+do_test (void)
+{
+  stack_t ss;
+  ss.ss_sp = malloc (2 * SIGSTKSZ);
+  if (ss.ss_sp == NULL)
+    {
+      puts ("failed to allocate alternate stack");
+      return 1;
+    }
+  ss.ss_flags = 0;
+  ss.ss_size = 2 * SIGSTKSZ;
+  if (sigaltstack (&ss, NULL) < 0)
+    {
+      printf ("sigaltstack failed %m\n");
+      return 1;
+    }
+
+  struct sigaction sa;
+  sa.sa_handler = sh;
+  sigemptyset (&sa.sa_mask);
+  sa.sa_flags = 0;
+
+  if (sigaction (SIGHUP, &sa, NULL) != 0)
+    {
+      puts ("sigaction failed");
+      return 1;
+    }
+
+  puts ("sa_flags = 0 test");
+  if (do_one_test ())
+    return 1;
+
+  sa.sa_handler = sh;
+  sigemptyset (&sa.sa_mask);
+  sa.sa_flags = SA_ONSTACK;
+
+  if (sigaction (SIGHUP, &sa, NULL) != 0)
+    {
+      puts ("sigaction failed");
+      return 1;
+    }
+
+  puts ("sa_flags = SA_ONSTACK test");
+  if (do_one_test ())
+    return 1;
+
+  sa.sa_sigaction = (void (*)(int, siginfo_t *, void *)) sh;
+  sigemptyset (&sa.sa_mask);
+  sa.sa_flags = SA_SIGINFO;
+
+  if (sigaction (SIGHUP, &sa, NULL) != 0)
+    {
+      puts ("sigaction failed");
+      return 1;
+    }
+
+  puts ("sa_flags = SA_SIGINFO test");
+  if (do_one_test ())
+    return 1;
+
+  sa.sa_sigaction = (void (*)(int, siginfo_t *, void *)) sh;
+  sigemptyset (&sa.sa_mask);
+  sa.sa_flags = SA_SIGINFO | SA_ONSTACK;
+
+  if (sigaction (SIGHUP, &sa, NULL) != 0)
+    {
+      puts ("sigaction failed");
+      return 1;
+    }
+
+  puts ("sa_flags = SA_SIGINFO|SA_ONSTACK test");
+  if (do_one_test ())
+    return 1;
+
+  return 0;
+}
+
+#define TIMEOUT 40
+#define TEST_FUNCTION do_test ()
+#include "../test-skeleton.c"
diff --git a/ap/build/uClibc/test/nptl/tst-cancel22.c b/ap/build/uClibc/test/nptl/tst-cancel22.c
new file mode 100644
index 0000000..c47167b
--- /dev/null
+++ b/ap/build/uClibc/test/nptl/tst-cancel22.c
@@ -0,0 +1,122 @@
+/* Copyright (C) 2003 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+   Contributed by Jakub Jelinek <jakub@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, write to the Free
+   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+   02111-1307 USA.  */
+
+#include <errno.h>
+#include <pthread.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <unistd.h>
+
+pthread_barrier_t b;
+int seen;
+
+static void *
+tf (void *arg)
+{
+  int i;
+  int old;
+  int r = pthread_setcancelstate (PTHREAD_CANCEL_DISABLE, &old);
+  if (r != 0)
+    {
+      puts ("setcancelstate failed");
+      exit (1);
+    }
+
+  r = pthread_barrier_wait (&b);
+  if (r != 0 && r != PTHREAD_BARRIER_SERIAL_THREAD)
+    {
+      puts ("barrier_wait failed");
+      exit (1);
+    }
+
+  for (i = 0; i < 10; ++i)
+    {
+      struct timespec ts = { .tv_sec = 0, .tv_nsec = 100000000 };
+      TEMP_FAILURE_RETRY (nanosleep (&ts, &ts));
+    }
+
+  seen = 1;
+  pthread_setcancelstate (old, NULL);
+
+  struct timespec ts = { .tv_sec = 0, .tv_nsec = 100000000 };
+  TEMP_FAILURE_RETRY (nanosleep (&ts, &ts));
+
+  exit (1);
+}
+
+
+static int
+do_test (void)
+{
+  if (pthread_barrier_init (&b, NULL, 2) != 0)
+   {
+     puts ("barrier init failed");
+     return 1;
+   }
+
+  pthread_t th;
+  if (pthread_create (&th, NULL, tf, NULL) != 0)
+    {
+      puts ("thread creation failed");
+      return 1;
+    }
+
+  int r = pthread_barrier_wait (&b);
+  if (r != 0 && r != PTHREAD_BARRIER_SERIAL_THREAD)
+    {
+      puts ("barrier_wait failed");
+      return 1;
+    }
+
+  if (pthread_cancel (th) != 0)
+    {
+      puts ("cancel failed");
+      return 1;
+    }
+
+  void *status;
+  if (pthread_join (th, &status) != 0)
+    {
+      puts ("join failed");
+      return 1;
+    }
+  if (status != PTHREAD_CANCELED)
+    {
+      puts ("thread not canceled");
+      return 1;
+    }
+
+  if (pthread_barrier_destroy (&b) != 0)
+    {
+      puts ("barrier_destroy failed");
+      return 1;
+    }
+
+  if (seen != 1)
+    {
+      puts ("thread cancelled when PTHREAD_CANCEL_DISABLED");
+      return 1;
+    }
+
+  return 0;
+}
+
+#define TIMEOUT 5
+#define TEST_FUNCTION do_test ()
+#include "../test-skeleton.c"
diff --git a/ap/build/uClibc/test/nptl/tst-cancel23.c b/ap/build/uClibc/test/nptl/tst-cancel23.c
new file mode 100644
index 0000000..2111687
--- /dev/null
+++ b/ap/build/uClibc/test/nptl/tst-cancel23.c
@@ -0,0 +1 @@
+#include "tst-cancel22.c"
diff --git a/ap/build/uClibc/test/nptl/tst-cancel25.c b/ap/build/uClibc/test/nptl/tst-cancel25.c
new file mode 100644
index 0000000..00b99ad
--- /dev/null
+++ b/ap/build/uClibc/test/nptl/tst-cancel25.c
@@ -0,0 +1,171 @@
+#include <pthreadP.h>
+#include <signal.h>
+#include <stdio.h>
+#include <stdlib.h>
+
+
+static pthread_barrier_t b;
+static pthread_t th2;
+
+
+static void *
+tf2 (void *arg)
+{
+  sigset_t mask;
+  if (pthread_sigmask (SIG_SETMASK, NULL, &mask) != 0)
+    {
+      puts ("pthread_sigmask failed");
+      exit (1);
+    }
+  if (sigismember (&mask, SIGCANCEL))
+    {
+      puts ("SIGCANCEL blocked in new thread");
+      exit (1);
+    }
+
+  /* Sync with the main thread so that we do not test anything else.  */
+  int e = pthread_barrier_wait (&b);
+  if (e != 0  && e != PTHREAD_BARRIER_SERIAL_THREAD)
+    {
+      puts ("barrier_wait failed");
+      exit (1);
+    }
+
+  while (1)
+    {
+      /* Just a cancelable call.  */
+      struct timespec ts = { 10000, 0 };
+      nanosleep (&ts, 0);
+    }
+
+  return NULL;
+}
+
+
+static void
+unwhand (void *arg)
+{
+  if (pthread_create (&th2, NULL, tf2, NULL) != 0)
+    {
+      puts ("unwhand: create failed");
+      exit (1);
+    }
+}
+
+
+static void *
+tf (void *arg)
+{
+  pthread_cleanup_push (unwhand, NULL);
+
+  /* Sync with the main thread so that we do not test anything else.  */
+  int e = pthread_barrier_wait (&b);
+  if (e != 0  && e != PTHREAD_BARRIER_SERIAL_THREAD)
+    {
+      puts ("barrier_wait failed");
+      exit (1);
+    }
+
+  while (1)
+    {
+      /* Just a cancelable call.  */
+      struct timespec ts = { 10000, 0 };
+      nanosleep (&ts, 0);
+    }
+
+  pthread_cleanup_pop (0);
+
+  return NULL;
+}
+
+
+static int
+do_test (void)
+{
+  if (pthread_barrier_init (&b, NULL, 2) != 0)
+    {
+      puts ("barrier_init failed");
+      return 1;
+    }
+
+  pthread_t th1;
+  if (pthread_create (&th1, NULL, tf, NULL) != 0)
+    {
+      puts ("create failed");
+      return 1;
+    }
+
+  int e = pthread_barrier_wait (&b);
+  if (e != 0  && e != PTHREAD_BARRIER_SERIAL_THREAD)
+    {
+      puts ("barrier_wait failed");
+      return 1;
+    }
+
+  /* Make sure tf1 enters nanosleep.  */
+  struct timespec ts = { 0, 500000000 };
+  while (nanosleep (&ts, &ts) != 0)
+    ;
+
+  if (pthread_cancel (th1) != 0)
+    {
+      puts ("1st cancel failed");
+      return 1;
+    }
+
+  void *res;
+  if (pthread_join (th1, &res) != 0)
+    {
+      puts ("1st join failed");
+      return 1;
+    }
+  if (res != PTHREAD_CANCELED)
+    {
+      puts ("1st thread not canceled");
+      return 1;
+    }
+
+  e = pthread_barrier_wait (&b);
+  if (e != 0  && e != PTHREAD_BARRIER_SERIAL_THREAD)
+    {
+      puts ("barrier_wait failed");
+      return 1;
+    }
+
+  /* Make sure tf2 enters nanosleep.  */
+  ts.tv_sec = 0;
+  ts.tv_nsec = 500000000;
+  while (nanosleep (&ts, &ts) != 0)
+    ;
+
+  puts ("calling pthread_cancel the second time");
+  if (pthread_cancel (th2) != 0)
+    {
+      puts ("2nd cancel failed");
+      return 1;
+    }
+
+  puts ("calling pthread_join the second time");
+  if (pthread_join (th2, &res) != 0)
+    {
+      puts ("2nd join failed");
+      return 1;
+    }
+  if (res != PTHREAD_CANCELED)
+    {
+      puts ("2nd thread not canceled");
+      return 1;
+    }
+
+  if (pthread_barrier_destroy (&b) != 0)
+    {
+      puts ("barrier_destroy failed");
+      return 0;
+    }
+
+  return 0;
+}
+
+#define TEST_FUNCTION do_test ()
+#define TIMEOUT 4
+#include "../test-skeleton.c"
diff --git a/ap/build/uClibc/test/nptl/tst-cancel3.c b/ap/build/uClibc/test/nptl/tst-cancel3.c
new file mode 100644
index 0000000..86c482b
--- /dev/null
+++ b/ap/build/uClibc/test/nptl/tst-cancel3.c
@@ -0,0 +1,98 @@
+/* Copyright (C) 2002 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+   Contributed by Ulrich Drepper <drepper@redhat.com>, 2002.
+
+   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>
+#include <signal.h>
+#include <stdio.h>
+#include <unistd.h>
+
+
+static int fd[2];
+
+
+static void *
+tf (void *arg)
+{
+  char buf[100];
+
+  if (read (fd[0], buf, sizeof (buf)) == sizeof (buf))
+    {
+      puts ("read succeeded");
+      return (void *) 1l;
+    }
+
+  return NULL;
+}
+
+
+static int
+do_test (void)
+{
+  pthread_t th;
+  void *r;
+  struct sigaction sa;
+
+  sa.sa_handler = SIG_IGN;
+  sigemptyset (&sa.sa_mask);
+  sa.sa_flags = 0;
+
+  if (sigaction (SIGPIPE, &sa, NULL) != 0)
+    {
+      puts ("sigaction failed");
+      return 1;
+    }
+
+  if (pipe (fd) != 0)
+    {
+      puts ("pipe failed");
+      return 1;
+    }
+
+  if (pthread_create (&th, NULL, tf, NULL) != 0)
+    {
+      puts ("create failed");
+      return 1;
+    }
+
+  if (pthread_cancel (th) != 0)
+    {
+      puts ("cancel failed");
+      return 1;
+    }
+
+  /* This will cause the read in the child to return.  */
+  close (fd[0]);
+
+  if (pthread_join (th, &r) != 0)
+    {
+      puts ("join failed");
+      return 1;
+    }
+
+  if (r != PTHREAD_CANCELED)
+    {
+      puts ("result is wrong");
+      return 1;
+    }
+
+  return 0;
+}
+
+#define TEST_FUNCTION do_test ()
+#include "../test-skeleton.c"
diff --git a/ap/build/uClibc/test/nptl/tst-cancel4.c b/ap/build/uClibc/test/nptl/tst-cancel4.c
new file mode 100644
index 0000000..c0f1cd8
--- /dev/null
+++ b/ap/build/uClibc/test/nptl/tst-cancel4.c
@@ -0,0 +1,2390 @@
+/* Copyright (C) 2002, 2003, 2004, 2006, 2007 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+   Contributed by Ulrich Drepper <drepper@redhat.com>, 2002.
+
+   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.  */
+
+/* NOTE: this tests functionality beyond POSIX.  POSIX does not allow
+   exit to be called more than once.  */
+
+#include <errno.h>
+#include <fcntl.h>
+#include <limits.h>
+#include <pthread.h>
+#include <stddef.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <termios.h>
+#include <unistd.h>
+#include <sys/mman.h>
+#include <sys/msg.h>
+#include <sys/poll.h>
+#include <sys/select.h>
+#include <sys/socket.h>
+#include <sys/uio.h>
+#include <sys/un.h>
+#include <sys/wait.h>
+
+#include "pthreadP.h"
+
+
+/* Since STREAMS are not supported in the standard Linux kernel and
+   there we don't advertise STREAMS as supported is no need to test
+   the STREAMS related functions.  This affects
+     getmsg()              getpmsg()          putmsg()
+     putpmsg()
+
+   lockf() and fcntl() are tested in tst-cancel16.
+
+   pthread_join() is tested in tst-join5.
+
+   pthread_testcancel()'s only purpose is to allow cancellation.  This
+   is tested in several places.
+
+   sem_wait() and sem_timedwait() are checked in tst-cancel1[2345] tests.
+
+   mq_send(), mq_timedsend(), mq_receive() and mq_timedreceive() are checked
+   in tst-mqueue8{,x} tests.
+
+   aio_suspend() is tested in tst-cancel17.
+
+   clock_nanosleep() is tested in tst-cancel18.
+*/
+
+/* Pipe descriptors.  */
+static int fds[2];
+
+/* Temporary file descriptor, to be closed after each round.  */
+static int tempfd = -1;
+static int tempfd2 = -1;
+/* Name of temporary file to be removed after each round.  */
+static char *tempfname;
+/* Temporary message queue.  */
+static int tempmsg = -1;
+
+/* Often used barrier for two threads.  */
+static pthread_barrier_t b2;
+
+
+#ifndef IPC_ADDVAL
+# define IPC_ADDVAL 0
+#endif
+
+#define WRITE_BUFFER_SIZE 4096
+
+/* Cleanup handling test.  */
+static int cl_called;
+
+static void
+cl (void *arg)
+{
+  ++cl_called;
+}
+
+
+
+static void *
+tf_read  (void *arg)
+{
+  int fd;
+  int r;
+
+  if (arg == NULL)
+    fd = fds[0];
+  else
+    {
+      char fname[] = "/tmp/tst-cancel4-fd-XXXXXX";
+      tempfd = fd = mkstemp (fname);
+      if (fd == -1)
+	printf ("%s: mkstemp failed\n", __FUNCTION__);
+      unlink (fname);
+
+      r = pthread_barrier_wait (&b2);
+      if (r != 0 && r != PTHREAD_BARRIER_SERIAL_THREAD)
+	{
+	  printf ("%s: barrier_wait failed\n", __FUNCTION__);
+	  exit (1);
+	}
+    }
+
+  r = pthread_barrier_wait (&b2);
+  if (r != 0 && r != PTHREAD_BARRIER_SERIAL_THREAD)
+    {
+      printf ("%s: barrier_wait failed\n", __FUNCTION__);
+      exit (1);
+    }
+
+  ssize_t s;
+  pthread_cleanup_push (cl, NULL);
+
+  char buf[100];
+  s = read (fd, buf, sizeof (buf));
+
+  pthread_cleanup_pop (0);
+
+  printf ("%s: read returns with %zd\n", __FUNCTION__, s);
+
+  exit (1);
+}
+
+
+static void *
+tf_readv  (void *arg)
+{
+  int fd;
+  int r;
+
+  if (arg == NULL)
+    fd = fds[0];
+  else
+    {
+      char fname[] = "/tmp/tst-cancel4-fd-XXXXXX";
+      tempfd = fd = mkstemp (fname);
+      if (fd == -1)
+	printf ("%s: mkstemp failed\n", __FUNCTION__);
+      unlink (fname);
+
+      r = pthread_barrier_wait (&b2);
+      if (r != 0 && r != PTHREAD_BARRIER_SERIAL_THREAD)
+	{
+	  printf ("%s: barrier_wait failed\n", __FUNCTION__);
+	  exit (1);
+	}
+    }
+
+  r = pthread_barrier_wait (&b2);
+  if (r != 0 && r != PTHREAD_BARRIER_SERIAL_THREAD)
+    {
+      printf ("%s: barrier_wait failed\n", __FUNCTION__);
+      exit (1);
+    }
+
+  ssize_t s;
+  pthread_cleanup_push (cl, NULL);
+
+  char buf[100];
+  struct iovec iov[1] = { [0] = { .iov_base = buf, .iov_len = sizeof (buf) } };
+  s = readv (fd, iov, 1);
+
+  pthread_cleanup_pop (0);
+
+  printf ("%s: readv returns with %zd\n", __FUNCTION__, s);
+
+  exit (1);
+}
+
+
+static void *
+tf_write  (void *arg)
+{
+  int fd;
+  int r;
+
+  if (arg == NULL)
+    fd = fds[1];
+  else
+    {
+      char fname[] = "/tmp/tst-cancel4-fd-XXXXXX";
+      tempfd = fd = mkstemp (fname);
+      if (fd == -1)
+	printf ("%s: mkstemp failed\n", __FUNCTION__);
+      unlink (fname);
+
+      r = pthread_barrier_wait (&b2);
+      if (r != 0 && r != PTHREAD_BARRIER_SERIAL_THREAD)
+	{
+	  printf ("%s: barrier_wait failed\n", __FUNCTION__);
+	  exit (1);
+	}
+    }
+
+  r = pthread_barrier_wait (&b2);
+  if (r != 0 && r != PTHREAD_BARRIER_SERIAL_THREAD)
+    {
+      printf ("%s: barrier_wait failed\n", __FUNCTION__);
+      exit (1);
+    }
+
+  ssize_t s;
+  pthread_cleanup_push (cl, NULL);
+
+  char buf[WRITE_BUFFER_SIZE];
+  memset (buf, '\0', sizeof (buf));
+  s = write (fd, buf, sizeof (buf));
+
+  pthread_cleanup_pop (0);
+
+  printf ("%s: write returns with %zd\n", __FUNCTION__, s);
+
+  exit (1);
+}
+
+
+static void *
+tf_writev  (void *arg)
+{
+  int fd;
+  int r;
+
+  if (arg == NULL)
+    fd = fds[1];
+  else
+    {
+      char fname[] = "/tmp/tst-cancel4-fd-XXXXXX";
+      tempfd = fd = mkstemp (fname);
+      if (fd == -1)
+	printf ("%s: mkstemp failed\n", __FUNCTION__);
+      unlink (fname);
+
+      r = pthread_barrier_wait (&b2);
+      if (r != 0 && r != PTHREAD_BARRIER_SERIAL_THREAD)
+	{
+	  printf ("%s: barrier_wait failed\n", __FUNCTION__);
+	  exit (1);
+	}
+    }
+
+  r = pthread_barrier_wait (&b2);
+  if (r != 0 && r != PTHREAD_BARRIER_SERIAL_THREAD)
+    {
+      printf ("%s: barrier_wait failed\n", __FUNCTION__);
+      exit (1);
+    }
+
+  ssize_t s;
+  pthread_cleanup_push (cl, NULL);
+
+  char buf[WRITE_BUFFER_SIZE];
+  memset (buf, '\0', sizeof (buf));
+  struct iovec iov[1] = { [0] = { .iov_base = buf, .iov_len = sizeof (buf) } };
+  s = writev (fd, iov, 1);
+
+  pthread_cleanup_pop (0);
+
+  printf ("%s: writev returns with %zd\n", __FUNCTION__, s);
+
+  exit (1);
+}
+
+
+static void *
+tf_sleep (void *arg)
+{
+  int r = pthread_barrier_wait (&b2);
+  if (r != 0 && r != PTHREAD_BARRIER_SERIAL_THREAD)
+    {
+      printf ("%s: barrier_wait failed\n", __FUNCTION__);
+      exit (1);
+    }
+
+  if (arg != NULL)
+    {
+      r = pthread_barrier_wait (&b2);
+      if (r != 0 && r != PTHREAD_BARRIER_SERIAL_THREAD)
+	{
+	  printf ("%s: barrier_wait failed\n", __FUNCTION__);
+	  exit (1);
+	}
+    }
+
+  pthread_cleanup_push (cl, NULL);
+
+  sleep (arg == NULL ? 1000000 : 0);
+
+  pthread_cleanup_pop (0);
+
+  printf ("%s: sleep returns\n", __FUNCTION__);
+
+  exit (1);
+}
+
+
+static void *
+tf_usleep (void *arg)
+{
+  int r = pthread_barrier_wait (&b2);
+  if (r != 0 && r != PTHREAD_BARRIER_SERIAL_THREAD)
+    {
+      printf ("%s: barrier_wait failed\n", __FUNCTION__);
+      exit (1);
+    }
+
+  if (arg != NULL)
+    {
+      r = pthread_barrier_wait (&b2);
+      if (r != 0 && r != PTHREAD_BARRIER_SERIAL_THREAD)
+	{
+	  printf ("%s: 2nd barrier_wait failed\n", __FUNCTION__);
+	  exit (1);
+	}
+    }
+
+  pthread_cleanup_push (cl, NULL);
+
+  usleep (arg == NULL ? (useconds_t) ULONG_MAX : 0);
+
+  pthread_cleanup_pop (0);
+
+  printf ("%s: usleep returns\n", __FUNCTION__);
+
+  exit (1);
+}
+
+
+static void *
+tf_nanosleep (void *arg)
+{
+  int r = pthread_barrier_wait (&b2);
+  if (r != 0 && r != PTHREAD_BARRIER_SERIAL_THREAD)
+    {
+      printf ("%s: barrier_wait failed\n", __FUNCTION__);
+      exit (1);
+    }
+
+  if (arg != NULL)
+    {
+      r = pthread_barrier_wait (&b2);
+      if (r != 0 && r != PTHREAD_BARRIER_SERIAL_THREAD)
+	{
+	  printf ("%s: barrier_wait failed\n", __FUNCTION__);
+	  exit (1);
+	}
+    }
+
+  pthread_cleanup_push (cl, NULL);
+
+  struct timespec ts = { .tv_sec = arg == NULL ? 10000000 : 0, .tv_nsec = 0 };
+  TEMP_FAILURE_RETRY (nanosleep (&ts, &ts));
+
+  pthread_cleanup_pop (0);
+
+  printf ("%s: nanosleep returns\n", __FUNCTION__);
+
+  exit (1);
+}
+
+
+static void *
+tf_select (void *arg)
+{
+  int fd;
+  int r;
+
+  if (arg == NULL)
+    fd = fds[0];
+  else
+    {
+      char fname[] = "/tmp/tst-cancel4-fd-XXXXXX";
+      tempfd = fd = mkstemp (fname);
+      if (fd == -1)
+	printf ("%s: mkstemp failed\n", __FUNCTION__);
+      unlink (fname);
+
+      r = pthread_barrier_wait (&b2);
+      if (r != 0 && r != PTHREAD_BARRIER_SERIAL_THREAD)
+	{
+	  printf ("%s: barrier_wait failed\n", __FUNCTION__);
+	  exit (1);
+	}
+    }
+
+  r = pthread_barrier_wait (&b2);
+  if (r != 0 && r != PTHREAD_BARRIER_SERIAL_THREAD)
+    {
+      printf ("%s: barrier_wait failed\n", __FUNCTION__);
+      exit (1);
+    }
+
+  fd_set rfs;
+  FD_ZERO (&rfs);
+  FD_SET (fd, &rfs);
+
+  int s;
+  pthread_cleanup_push (cl, NULL);
+
+  s = select (fd + 1, &rfs, NULL, NULL, NULL);
+
+  pthread_cleanup_pop (0);
+
+  printf ("%s: select returns with %d (%s)\n", __FUNCTION__, s,
+	  strerror (errno));
+
+  exit (1);
+}
+
+
+static void *
+tf_pselect (void *arg)
+{
+  int fd;
+  int r;
+
+  if (arg == NULL)
+    fd = fds[0];
+  else
+    {
+      char fname[] = "/tmp/tst-cancel4-fd-XXXXXX";
+      tempfd = fd = mkstemp (fname);
+      if (fd == -1)
+	printf ("%s: mkstemp failed\n", __FUNCTION__);
+      unlink (fname);
+
+      r = pthread_barrier_wait (&b2);
+      if (r != 0 && r != PTHREAD_BARRIER_SERIAL_THREAD)
+	{
+	  printf ("%s: barrier_wait failed\n", __FUNCTION__);
+	  exit (1);
+	}
+    }
+
+  r = pthread_barrier_wait (&b2);
+  if (r != 0 && r != PTHREAD_BARRIER_SERIAL_THREAD)
+    {
+      printf ("%s: barrier_wait failed\n", __FUNCTION__);
+      exit (1);
+    }
+
+  fd_set rfs;
+  FD_ZERO (&rfs);
+  FD_SET (fd, &rfs);
+
+  int s;
+  pthread_cleanup_push (cl, NULL);
+
+  s = pselect (fd + 1, &rfs, NULL, NULL, NULL, NULL);
+
+  pthread_cleanup_pop (0);
+
+  printf ("%s: pselect returns with %d (%s)\n", __FUNCTION__, s,
+	  strerror (errno));
+
+  exit (1);
+}
+
+
+static void *
+tf_poll (void *arg)
+{
+  int fd;
+  int r;
+
+  if (arg == NULL)
+    fd = fds[0];
+  else
+    {
+      char fname[] = "/tmp/tst-cancel4-fd-XXXXXX";
+      tempfd = fd = mkstemp (fname);
+      if (fd == -1)
+	printf ("%s: mkstemp failed\n", __FUNCTION__);
+      unlink (fname);
+
+      r = pthread_barrier_wait (&b2);
+      if (r != 0 && r != PTHREAD_BARRIER_SERIAL_THREAD)
+	{
+	  printf ("%s: barrier_wait failed\n", __FUNCTION__);
+	  exit (1);
+	}
+    }
+
+  r = pthread_barrier_wait (&b2);
+  if (r != 0 && r != PTHREAD_BARRIER_SERIAL_THREAD)
+    {
+      printf ("%s: barrier_wait failed\n", __FUNCTION__);
+      exit (1);
+    }
+
+  struct pollfd rfs[1] = { [0] = { .fd = fd, .events = POLLIN } };
+
+  int s;
+  pthread_cleanup_push (cl, NULL);
+
+  s = poll (rfs, 1, -1);
+
+  pthread_cleanup_pop (0);
+
+  printf ("%s: poll returns with %d (%s)\n", __FUNCTION__, s,
+	  strerror (errno));
+
+  exit (1);
+}
+
+
+static void *
+tf_ppoll (void *arg)
+{
+  int fd;
+  int r;
+
+  if (arg == NULL)
+    fd = fds[0];
+  else
+    {
+      char fname[] = "/tmp/tst-cancel4-fd-XXXXXX";
+      tempfd = fd = mkstemp (fname);
+      if (fd == -1)
+	printf ("%s: mkstemp failed\n", __FUNCTION__);
+      unlink (fname);
+
+      r = pthread_barrier_wait (&b2);
+      if (r != 0 && r != PTHREAD_BARRIER_SERIAL_THREAD)
+	{
+	  printf ("%s: barrier_wait failed\n", __FUNCTION__);
+	  exit (1);
+	}
+    }
+
+  r = pthread_barrier_wait (&b2);
+  if (r != 0 && r != PTHREAD_BARRIER_SERIAL_THREAD)
+    {
+      printf ("%s: barrier_wait failed\n", __FUNCTION__);
+      exit (1);
+    }
+
+  struct pollfd rfs[1] = { [0] = { .fd = fd, .events = POLLIN } };
+
+  int s;
+  pthread_cleanup_push (cl, NULL);
+
+  s = ppoll (rfs, 1, NULL, NULL);
+
+  pthread_cleanup_pop (0);
+
+  printf ("%s: ppoll returns with %d (%s)\n", __FUNCTION__, s,
+	  strerror (errno));
+
+  exit (1);
+}
+
+
+static void *
+tf_wait (void *arg)
+{
+  pid_t pid = fork ();
+  if (pid == -1)
+    {
+      puts ("fork failed");
+      exit (1);
+    }
+
+  if (pid == 0)
+    {
+      /* Make the program disappear after a while.  */
+      if (arg == NULL)
+	sleep (10);
+      exit (0);
+    }
+
+  int r;
+  if (arg != NULL)
+    {
+      struct timespec  ts = { .tv_sec = 0, .tv_nsec = 100000000 };
+      while (nanosleep (&ts, &ts) != 0)
+	continue;
+
+      r = pthread_barrier_wait (&b2);
+      if (r != 0 && r != PTHREAD_BARRIER_SERIAL_THREAD)
+	{
+	  printf ("%s: barrier_wait failed\n", __FUNCTION__);
+	  exit (1);
+	}
+    }
+
+  r = pthread_barrier_wait (&b2);
+  if (r != 0 && r != PTHREAD_BARRIER_SERIAL_THREAD)
+    {
+      printf ("%s: barrier_wait failed\n", __FUNCTION__);
+      exit (1);
+    }
+
+  int s;
+  pthread_cleanup_push (cl, NULL);
+
+  s = wait (NULL);
+
+  pthread_cleanup_pop (0);
+
+  printf ("%s: wait returns with %d (%s)\n", __FUNCTION__, s,
+	  strerror (errno));
+
+  exit (1);
+}
+
+
+static void *
+tf_waitpid (void *arg)
+{
+
+  pid_t pid = fork ();
+  if (pid == -1)
+    {
+      puts ("fork failed");
+      exit (1);
+    }
+
+  if (pid == 0)
+    {
+      /* Make the program disappear after a while.  */
+      if (arg == NULL)
+	sleep (10);
+      exit (0);
+    }
+
+  int r;
+  if (arg != NULL)
+    {
+      struct timespec  ts = { .tv_sec = 0, .tv_nsec = 100000000 };
+      while (nanosleep (&ts, &ts) != 0)
+	continue;
+
+      r = pthread_barrier_wait (&b2);
+      if (r != 0 && r != PTHREAD_BARRIER_SERIAL_THREAD)
+	{
+	  printf ("%s: barrier_wait failed\n", __FUNCTION__);
+	  exit (1);
+	}
+    }
+
+  r = pthread_barrier_wait (&b2);
+  if (r != 0 && r != PTHREAD_BARRIER_SERIAL_THREAD)
+    {
+      printf ("%s: barrier_wait failed\n", __FUNCTION__);
+      exit (1);
+    }
+
+  int s;
+ pthread_cleanup_push (cl, NULL);
+
+  s = waitpid (-1, NULL, 0);
+
+  pthread_cleanup_pop (0);
+
+  printf ("%s: waitpid returns with %d (%s)\n", __FUNCTION__, s,
+	  strerror (errno));
+
+  exit (1);
+}
+
+
+static void *
+tf_waitid (void *arg)
+{
+  pid_t pid = fork ();
+  if (pid == -1)
+    {
+      puts ("fork failed");
+      exit (1);
+    }
+
+  if (pid == 0)
+    {
+      /* Make the program disappear after a while.  */
+      if (arg == NULL)
+	sleep (10);
+      exit (0);
+    }
+
+  int r;
+  if (arg != NULL)
+    {
+      struct timespec  ts = { .tv_sec = 0, .tv_nsec = 100000000 };
+      while (nanosleep (&ts, &ts) != 0)
+	continue;
+
+      r = pthread_barrier_wait (&b2);
+      if (r != 0 && r != PTHREAD_BARRIER_SERIAL_THREAD)
+	{
+	  printf ("%s: barrier_wait failed\n", __FUNCTION__);
+	  exit (1);
+	}
+    }
+
+  r = pthread_barrier_wait (&b2);
+  if (r != 0 && r != PTHREAD_BARRIER_SERIAL_THREAD)
+    {
+      printf ("%s: barrier_wait failed\n", __FUNCTION__);
+      exit (1);
+    }
+
+  int s;
+  pthread_cleanup_push (cl, NULL);
+
+#ifndef WEXITED
+# define WEXITED 0
+#endif
+  siginfo_t si;
+  s = waitid (P_PID, pid, &si, WEXITED);
+
+  pthread_cleanup_pop (0);
+
+  printf ("%s: waitid returns with %d (%s)\n", __FUNCTION__, s,
+	  strerror (errno));
+
+  exit (1);
+}
+
+
+static void *
+tf_sigpause (void *arg)
+{
+  int r = pthread_barrier_wait (&b2);
+  if (r != 0 && r != PTHREAD_BARRIER_SERIAL_THREAD)
+    {
+      printf ("%s: barrier_wait failed\n", __FUNCTION__);
+      exit (1);
+    }
+
+  if (arg != NULL)
+    {
+      r = pthread_barrier_wait (&b2);
+      if (r != 0 && r != PTHREAD_BARRIER_SERIAL_THREAD)
+	{
+	  printf ("%s: 2nd barrier_wait failed\n", __FUNCTION__);
+	  exit (1);
+	}
+    }
+
+  pthread_cleanup_push (cl, NULL);
+
+  /* Just for fun block the cancellation signal.  We need to use
+     __xpg_sigpause since otherwise we will get the BSD version.  */
+  //__xpg_sigpause (SIGCANCEL);
+
+  __sigpause (SIGCANCEL, 1);
+
+  pthread_cleanup_pop (0);
+
+  printf ("%s: sigpause returned\n", __FUNCTION__);
+
+  exit (1);
+}
+
+
+static void *
+tf_sigsuspend (void *arg)
+{
+  int r = pthread_barrier_wait (&b2);
+  if (r != 0 && r != PTHREAD_BARRIER_SERIAL_THREAD)
+    {
+      printf ("%s: barrier_wait failed\n", __FUNCTION__);
+      exit (1);
+    }
+
+  if (arg != NULL)
+    {
+      r = pthread_barrier_wait (&b2);
+      if (r != 0 && r != PTHREAD_BARRIER_SERIAL_THREAD)
+	{
+	  printf ("%s: 2nd barrier_wait failed\n", __FUNCTION__);
+	  exit (1);
+	}
+    }
+
+  pthread_cleanup_push (cl, NULL);
+
+  /* Just for fun block all signals.  */
+  sigset_t mask;
+  sigfillset (&mask);
+  sigsuspend (&mask);
+
+  pthread_cleanup_pop (0);
+
+  printf ("%s: sigsuspend returned\n", __FUNCTION__);
+
+  exit (1);
+}
+
+
+static void *
+tf_sigwait (void *arg)
+{
+  int r = pthread_barrier_wait (&b2);
+  if (r != 0 && r != PTHREAD_BARRIER_SERIAL_THREAD)
+    {
+      printf ("%s: barrier_wait failed\n", __FUNCTION__);
+      exit (1);
+    }
+
+  if (arg != NULL)
+    {
+      r = pthread_barrier_wait (&b2);
+      if (r != 0 && r != PTHREAD_BARRIER_SERIAL_THREAD)
+	{
+	  printf ("%s: 2nd barrier_wait failed\n", __FUNCTION__);
+	  exit (1);
+	}
+    }
+
+  /* Block SIGUSR1.  */
+  sigset_t mask;
+  sigemptyset (&mask);
+  sigaddset (&mask, SIGUSR1);
+  if (pthread_sigmask (SIG_BLOCK, &mask, NULL) != 0)
+    {
+      printf ("%s: pthread_sigmask failed\n", __FUNCTION__);
+      exit (1);
+    }
+
+  int sig;
+  pthread_cleanup_push (cl, NULL);
+
+  /* Wait for SIGUSR1.  */
+  sigwait (&mask, &sig);
+
+  pthread_cleanup_pop (0);
+
+  printf ("%s: sigwait returned with signal %d\n", __FUNCTION__, sig);
+
+  exit (1);
+}
+
+
+static void *
+tf_sigwaitinfo (void *arg)
+{
+  int r = pthread_barrier_wait (&b2);
+  if (r != 0 && r != PTHREAD_BARRIER_SERIAL_THREAD)
+    {
+      printf ("%s: barrier_wait failed\n", __FUNCTION__);
+      exit (1);
+    }
+
+  if (arg != NULL)
+    {
+      r = pthread_barrier_wait (&b2);
+      if (r != 0 && r != PTHREAD_BARRIER_SERIAL_THREAD)
+	{
+	  printf ("%s: 2nd barrier_wait failed\n", __FUNCTION__);
+	  exit (1);
+	}
+    }
+
+  /* Block SIGUSR1.  */
+  sigset_t mask;
+  sigemptyset (&mask);
+  sigaddset (&mask, SIGUSR1);
+  if (pthread_sigmask (SIG_BLOCK, &mask, NULL) != 0)
+    {
+      printf ("%s: pthread_sigmask failed\n", __FUNCTION__);
+      exit (1);
+    }
+
+  siginfo_t info;
+  pthread_cleanup_push (cl, NULL);
+
+  /* Wait for SIGUSR1.  */
+  sigwaitinfo (&mask, &info);
+
+  pthread_cleanup_pop (0);
+
+  printf ("%s: sigwaitinfo returned with signal %d\n", __FUNCTION__,
+	  info.si_signo);
+
+  exit (1);
+}
+
+
+static void *
+tf_sigtimedwait (void *arg)
+{
+  int r = pthread_barrier_wait (&b2);
+  if (r != 0 && r != PTHREAD_BARRIER_SERIAL_THREAD)
+    {
+      printf ("%s: barrier_wait failed\n", __FUNCTION__);
+      exit (1);
+    }
+
+  if (arg != NULL)
+    {
+      r = pthread_barrier_wait (&b2);
+      if (r != 0 && r != PTHREAD_BARRIER_SERIAL_THREAD)
+	{
+	  printf ("%s: 2nd barrier_wait failed\n", __FUNCTION__);
+	  exit (1);
+	}
+    }
+
+  /* Block SIGUSR1.  */
+  sigset_t mask;
+  sigemptyset (&mask);
+  sigaddset (&mask, SIGUSR1);
+  if (pthread_sigmask (SIG_BLOCK, &mask, NULL) != 0)
+    {
+      printf ("%s: pthread_sigmask failed\n", __FUNCTION__);
+      exit (1);
+    }
+
+  /* Wait for SIGUSR1.  */
+  siginfo_t info;
+  struct timespec ts = { .tv_sec = 60, .tv_nsec = 0 };
+  pthread_cleanup_push (cl, NULL);
+
+  sigtimedwait (&mask, &info, &ts);
+
+  pthread_cleanup_pop (0);
+
+  printf ("%s: sigtimedwait returned with signal %d\n", __FUNCTION__,
+	  info.si_signo);
+
+  exit (1);
+}
+
+
+static void *
+tf_pause (void *arg)
+{
+  int r = pthread_barrier_wait (&b2);
+  if (r != 0 && r != PTHREAD_BARRIER_SERIAL_THREAD)
+    {
+      printf ("%s: barrier_wait failed\n", __FUNCTION__);
+      exit (1);
+    }
+
+  if (arg != NULL)
+    {
+      r = pthread_barrier_wait (&b2);
+      if (r != 0 && r != PTHREAD_BARRIER_SERIAL_THREAD)
+	{
+	  printf ("%s: 2nd barrier_wait failed\n", __FUNCTION__);
+	  exit (1);
+	}
+    }
+
+  pthread_cleanup_push (cl, NULL);
+
+  pause ();
+
+  pthread_cleanup_pop (0);
+
+  printf ("%s: pause returned\n", __FUNCTION__);
+
+  exit (1);
+}
+
+
+static void *
+tf_accept (void *arg)
+{
+  int tfd;
+  struct sockaddr_un sun;
+  /* To test a non-blocking accept call we make the call file by using
+     a datagrame socket.  */
+  int pf = arg == NULL ? SOCK_STREAM : SOCK_DGRAM;
+
+  tempfd = socket (AF_UNIX, pf, 0);
+  if (tempfd == -1)
+    {
+      printf ("%s: socket call failed\n", __FUNCTION__);
+      exit (1);
+    }
+
+  int tries = 0;
+  do
+    {
+      if (++tries > 10)
+	{
+	  printf ("%s: too many unsuccessful bind calls\n", __FUNCTION__);
+	}
+
+      strcpy (sun.sun_path, "/tmp/tst-cancel4-socket-1-XXXXXX");
+      tfd = mkstemp(sun.sun_path);
+      if (tfd < 0)
+	{
+	  printf ("%s: cannot generate temp file name\n", __FUNCTION__);
+	  exit (1);
+	}
+      close(tfd);
+      sun.sun_family = AF_UNIX;
+    }
+  while (bind (tempfd, (struct sockaddr *) &sun,
+	       offsetof (struct sockaddr_un, sun_path)
+	       + strlen (sun.sun_path) + 1) != 0);
+
+  unlink (sun.sun_path);
+
+  listen (tempfd, 5);
+
+  socklen_t len = sizeof (sun);
+
+  int r = pthread_barrier_wait (&b2);
+  if (r != 0 && r != PTHREAD_BARRIER_SERIAL_THREAD)
+    {
+      printf ("%s: barrier_wait failed\n", __FUNCTION__);
+      exit (1);
+    }
+
+  if (arg != NULL)
+    {
+      r = pthread_barrier_wait (&b2);
+      if (r != 0 && r != PTHREAD_BARRIER_SERIAL_THREAD)
+	{
+	  printf ("%s: 2nd barrier_wait failed\n", __FUNCTION__);
+	  exit (1);
+	}
+    }
+
+  pthread_cleanup_push (cl, NULL);
+
+  accept (tempfd, (struct sockaddr *) &sun, &len);
+
+  pthread_cleanup_pop (0);
+
+  printf ("%s: accept returned\n", __FUNCTION__);
+
+  exit (1);
+}
+
+
+static void *
+tf_send (void *arg)
+{
+  int tfd;
+  struct sockaddr_un sun;
+
+  tempfd = socket (AF_UNIX, SOCK_STREAM, 0);
+  if (tempfd == -1)
+    {
+      printf ("%s: first socket call failed\n", __FUNCTION__);
+      exit (1);
+    }
+
+  int tries = 0;
+  do
+    {
+      if (++tries > 10)
+	{
+	  printf ("%s: too many unsuccessful bind calls\n", __FUNCTION__);
+	}
+
+      strcpy (sun.sun_path, "/tmp/tst-cancel4-socket-2-XXXXXX");
+      tfd = mkstemp(sun.sun_path);
+      if (tfd < 0)
+	{
+	  printf ("%s: cannot generate temp file name\n", __FUNCTION__);
+	  exit (1);
+	}
+      close(tfd);
+      sun.sun_family = AF_UNIX;
+    }
+  while (bind (tempfd, (struct sockaddr *) &sun,
+	       offsetof (struct sockaddr_un, sun_path)
+	       + strlen (sun.sun_path) + 1) != 0);
+
+  listen (tempfd, 5);
+
+  tempfd2 = socket (AF_UNIX, SOCK_STREAM, 0);
+  if (tempfd2 == -1)
+    {
+      printf ("%s: second socket call failed\n", __FUNCTION__);
+      exit (1);
+    }
+
+  if (connect (tempfd2, (struct sockaddr *) &sun, sizeof (sun)) != 0)
+    {
+      printf ("%s: connect failed\n", __FUNCTION__);
+      exit(1);
+    }
+
+  unlink (sun.sun_path);
+
+  int r = pthread_barrier_wait (&b2);
+  if (r != 0 && r != PTHREAD_BARRIER_SERIAL_THREAD)
+    {
+      printf ("%s: barrier_wait failed\n", __FUNCTION__);
+      exit (1);
+    }
+
+  if (arg != NULL)
+    {
+      r = pthread_barrier_wait (&b2);
+      if (r != 0 && r != PTHREAD_BARRIER_SERIAL_THREAD)
+	{
+	  printf ("%s: 2nd barrier_wait failed\n", __FUNCTION__);
+	  exit (1);
+	}
+    }
+
+  pthread_cleanup_push (cl, NULL);
+
+  /* Very large block, so that the send call blocks.  */
+  char mem[700000];
+
+  send (tempfd2, mem, arg == NULL ? sizeof (mem) : 1, 0);
+
+  pthread_cleanup_pop (0);
+
+  printf ("%s: send returned\n", __FUNCTION__);
+
+  exit (1);
+}
+
+
+static void *
+tf_recv (void *arg)
+{
+  int tfd;
+  struct sockaddr_un sun;
+
+  tempfd = socket (AF_UNIX, SOCK_STREAM, 0);
+  if (tempfd == -1)
+    {
+      printf ("%s: first socket call failed\n", __FUNCTION__);
+      exit (1);
+    }
+
+  int tries = 0;
+  do
+    {
+      if (++tries > 10)
+	{
+	  printf ("%s: too many unsuccessful bind calls\n", __FUNCTION__);
+	}
+
+      strcpy (sun.sun_path, "/tmp/tst-cancel4-socket-3-XXXXXX");
+      tfd = mkstemp(sun.sun_path);
+      if (tfd < 0)
+	{
+	  printf ("%s: cannot generate temp file name\n", __FUNCTION__);
+	  exit (1);
+	}
+      close(tfd);
+      sun.sun_family = AF_UNIX;
+    }
+  while (bind (tempfd, (struct sockaddr *) &sun,
+	       offsetof (struct sockaddr_un, sun_path)
+	       + strlen (sun.sun_path) + 1) != 0);
+
+  listen (tempfd, 5);
+
+  tempfd2 = socket (AF_UNIX, SOCK_STREAM, 0);
+  if (tempfd2 == -1)
+    {
+      printf ("%s: second socket call failed\n", __FUNCTION__);
+      exit (1);
+    }
+
+  if (connect (tempfd2, (struct sockaddr *) &sun, sizeof (sun)) != 0)
+    {
+      printf ("%s: connect failed\n", __FUNCTION__);
+      exit(1);
+    }
+
+  unlink (sun.sun_path);
+
+  int r = pthread_barrier_wait (&b2);
+  if (r != 0 && r != PTHREAD_BARRIER_SERIAL_THREAD)
+    {
+      printf ("%s: barrier_wait failed\n", __FUNCTION__);
+      exit (1);
+    }
+
+  if (arg != NULL)
+    {
+      r = pthread_barrier_wait (&b2);
+      if (r != 0 && r != PTHREAD_BARRIER_SERIAL_THREAD)
+	{
+	  printf ("%s: 2nd barrier_wait failed\n", __FUNCTION__);
+	  exit (1);
+	}
+    }
+
+  pthread_cleanup_push (cl, NULL);
+
+  char mem[70];
+
+  recv (tempfd2, mem, arg == NULL ? sizeof (mem) : 0, 0);
+
+  pthread_cleanup_pop (0);
+
+  printf ("%s: recv returned\n", __FUNCTION__);
+
+  exit (1);
+}
+
+
+static void *
+tf_recvfrom (void *arg)
+{
+  int tfd;
+  struct sockaddr_un sun;
+
+  tempfd = socket (AF_UNIX, SOCK_DGRAM, 0);
+  if (tempfd == -1)
+    {
+      printf ("%s: first socket call failed\n", __FUNCTION__);
+      exit (1);
+    }
+
+  int tries = 0;
+  do
+    {
+      if (++tries > 10)
+	{
+	  printf ("%s: too many unsuccessful bind calls\n", __FUNCTION__);
+	}
+
+      strcpy (sun.sun_path, "/tmp/tst-cancel4-socket-4-XXXXXX");
+      tfd = mkstemp(sun.sun_path);
+      if (tfd < 0)
+	{
+	  printf ("%s: cannot generate temp file name\n", __FUNCTION__);
+	  exit (1);
+	}
+      close(tfd);
+      sun.sun_family = AF_UNIX;
+    }
+  while (bind (tempfd, (struct sockaddr *) &sun,
+	       offsetof (struct sockaddr_un, sun_path)
+	       + strlen (sun.sun_path) + 1) != 0);
+
+  tempfname = strdup (sun.sun_path);
+
+  tempfd2 = socket (AF_UNIX, SOCK_DGRAM, 0);
+  if (tempfd2 == -1)
+    {
+      printf ("%s: second socket call failed\n", __FUNCTION__);
+      exit (1);
+    }
+
+  int r = pthread_barrier_wait (&b2);
+  if (r != 0 && r != PTHREAD_BARRIER_SERIAL_THREAD)
+    {
+      printf ("%s: barrier_wait failed\n", __FUNCTION__);
+      exit (1);
+    }
+
+  if (arg != NULL)
+    {
+      r = pthread_barrier_wait (&b2);
+      if (r != 0 && r != PTHREAD_BARRIER_SERIAL_THREAD)
+	{
+	  printf ("%s: 2nd barrier_wait failed\n", __FUNCTION__);
+	  exit (1);
+	}
+    }
+
+  pthread_cleanup_push (cl, NULL);
+
+  char mem[70];
+  socklen_t len = sizeof (sun);
+
+  recvfrom (tempfd2, mem, arg == NULL ? sizeof (mem) : 0, 0,
+	    (struct sockaddr *) &sun, &len);
+
+  pthread_cleanup_pop (0);
+
+  printf ("%s: recvfrom returned\n", __FUNCTION__);
+
+  exit (1);
+}
+
+
+static void *
+tf_recvmsg (void *arg)
+{
+  int tfd;
+  struct sockaddr_un sun;
+
+  tempfd = socket (AF_UNIX, SOCK_DGRAM, 0);
+  if (tempfd == -1)
+    {
+      printf ("%s: first socket call failed\n", __FUNCTION__);
+      exit (1);
+    }
+
+  int tries = 0;
+  do
+    {
+      if (++tries > 10)
+	{
+	  printf ("%s: too many unsuccessful bind calls\n", __FUNCTION__);
+	}
+
+      strcpy (sun.sun_path, "/tmp/tst-cancel4-socket-5-XXXXXX");
+      tfd = mkstemp(sun.sun_path);
+      if (tfd < 0)
+	{
+	  printf ("%s: cannot generate temp file name\n", __FUNCTION__);
+	  exit (1);
+	}
+      close(tfd);
+      sun.sun_family = AF_UNIX;
+    }
+  while (bind (tempfd, (struct sockaddr *) &sun,
+	       offsetof (struct sockaddr_un, sun_path)
+	       + strlen (sun.sun_path) + 1) != 0);
+
+  tempfname = strdup (sun.sun_path);
+
+  tempfd2 = socket (AF_UNIX, SOCK_DGRAM, 0);
+  if (tempfd2 == -1)
+    {
+      printf ("%s: second socket call failed\n", __FUNCTION__);
+      exit (1);
+    }
+
+  int r = pthread_barrier_wait (&b2);
+  if (r != 0 && r != PTHREAD_BARRIER_SERIAL_THREAD)
+    {
+      printf ("%s: barrier_wait failed\n", __FUNCTION__);
+      exit (1);
+    }
+
+  if (arg != NULL)
+    {
+      r = pthread_barrier_wait (&b2);
+      if (r != 0 && r != PTHREAD_BARRIER_SERIAL_THREAD)
+	{
+	  printf ("%s: 2nd barrier_wait failed\n", __FUNCTION__);
+	  exit (1);
+	}
+    }
+
+  pthread_cleanup_push (cl, NULL);
+
+  char mem[70];
+  struct iovec iov[1];
+  iov[0].iov_base = mem;
+  iov[0].iov_len = arg == NULL ? sizeof (mem) : 0;
+
+  struct msghdr m;
+  m.msg_name = &sun;
+  m.msg_namelen = sizeof (sun);
+  m.msg_iov = iov;
+  m.msg_iovlen = 1;
+  m.msg_control = NULL;
+  m.msg_controllen = 0;
+
+  recvmsg (tempfd2, &m, 0);
+
+  pthread_cleanup_pop (0);
+
+  printf ("%s: recvmsg returned\n", __FUNCTION__);
+
+  exit (1);
+}
+
+
+static void *
+tf_open (void *arg)
+{
+  if (arg == NULL)
+    // XXX If somebody can provide a portable test case in which open()
+    // blocks we can enable this test to run in both rounds.
+    abort ();
+
+  int r = pthread_barrier_wait (&b2);
+  if (r != 0 && r != PTHREAD_BARRIER_SERIAL_THREAD)
+    {
+      printf ("%s: barrier_wait failed\n", __FUNCTION__);
+      exit (1);
+    }
+
+  r = pthread_barrier_wait (&b2);
+  if (r != 0 && r != PTHREAD_BARRIER_SERIAL_THREAD)
+    {
+      printf ("%s: 2nd barrier_wait failed\n", __FUNCTION__);
+      exit (1);
+    }
+
+  pthread_cleanup_push (cl, NULL);
+
+  open ("Makefile", O_RDONLY);
+
+  pthread_cleanup_pop (0);
+
+  printf ("%s: open returned\n", __FUNCTION__);
+
+  exit (1);
+}
+
+
+static void *
+tf_close (void *arg)
+{
+  if (arg == NULL)
+    // XXX If somebody can provide a portable test case in which close()
+    // blocks we can enable this test to run in both rounds.
+    abort ();
+
+  char fname[] = "/tmp/tst-cancel-fd-XXXXXX";
+  tempfd = mkstemp (fname);
+  if (tempfd == -1)
+    {
+      printf ("%s: mkstemp failed\n", __FUNCTION__);
+      exit (1);
+    }
+  unlink (fname);
+
+  int r = pthread_barrier_wait (&b2);
+  if (r != 0 && r != PTHREAD_BARRIER_SERIAL_THREAD)
+    {
+      printf ("%s: barrier_wait failed\n", __FUNCTION__);
+      exit (1);
+    }
+
+  r = pthread_barrier_wait (&b2);
+  if (r != 0 && r != PTHREAD_BARRIER_SERIAL_THREAD)
+    {
+      printf ("%s: 2nd barrier_wait failed\n", __FUNCTION__);
+      exit (1);
+    }
+
+  pthread_cleanup_push (cl, NULL);
+
+  close (tempfd);
+
+  pthread_cleanup_pop (0);
+
+  printf ("%s: close returned\n", __FUNCTION__);
+
+  exit (1);
+}
+
+
+static void *
+tf_pread (void *arg)
+{
+  if (arg == NULL)
+    // XXX If somebody can provide a portable test case in which pread()
+    // blocks we can enable this test to run in both rounds.
+    abort ();
+
+  tempfd = open ("Makefile", O_RDONLY);
+  if (tempfd == -1)
+    {
+      printf ("%s: cannot open Makefile\n", __FUNCTION__);
+      exit (1);
+    }
+
+  int r = pthread_barrier_wait (&b2);
+  if (r != 0 && r != PTHREAD_BARRIER_SERIAL_THREAD)
+    {
+      printf ("%s: barrier_wait failed\n", __FUNCTION__);
+      exit (1);
+    }
+
+  r = pthread_barrier_wait (&b2);
+  if (r != 0 && r != PTHREAD_BARRIER_SERIAL_THREAD)
+    {
+      printf ("%s: 2nd barrier_wait failed\n", __FUNCTION__);
+      exit (1);
+    }
+
+  pthread_cleanup_push (cl, NULL);
+
+  char mem[10];
+  pread (tempfd, mem, sizeof (mem), 0);
+
+  pthread_cleanup_pop (0);
+
+  printf ("%s: pread returned\n", __FUNCTION__);
+
+  exit (1);
+}
+
+
+static void *
+tf_pwrite (void *arg)
+{
+  if (arg == NULL)
+    // XXX If somebody can provide a portable test case in which pwrite()
+    // blocks we can enable this test to run in both rounds.
+    abort ();
+
+  char fname[] = "/tmp/tst-cancel4-fd-XXXXXX";
+  tempfd = mkstemp (fname);
+  if (tempfd == -1)
+    {
+      printf ("%s: mkstemp failed\n", __FUNCTION__);
+      exit (1);
+    }
+  unlink (fname);
+
+  int r = pthread_barrier_wait (&b2);
+  if (r != 0 && r != PTHREAD_BARRIER_SERIAL_THREAD)
+    {
+      printf ("%s: barrier_wait failed\n", __FUNCTION__);
+      exit (1);
+    }
+
+  r = pthread_barrier_wait (&b2);
+  if (r != 0 && r != PTHREAD_BARRIER_SERIAL_THREAD)
+    {
+      printf ("%s: 2nd barrier_wait failed\n", __FUNCTION__);
+      exit (1);
+    }
+
+  pthread_cleanup_push (cl, NULL);
+
+  char mem[10];
+  pwrite (tempfd, mem, sizeof (mem), 0);
+
+  pthread_cleanup_pop (0);
+
+  printf ("%s: pwrite returned\n", __FUNCTION__);
+
+  exit (1);
+}
+
+
+static void *
+tf_fsync (void *arg)
+{
+  if (arg == NULL)
+    // XXX If somebody can provide a portable test case in which fsync()
+    // blocks we can enable this test to run in both rounds.
+    abort ();
+
+  tempfd = open ("Makefile", O_RDONLY);
+  if (tempfd == -1)
+    {
+      printf ("%s: cannot open Makefile\n", __FUNCTION__);
+      exit (1);
+    }
+
+  int r = pthread_barrier_wait (&b2);
+  if (r != 0 && r != PTHREAD_BARRIER_SERIAL_THREAD)
+    {
+      printf ("%s: barrier_wait failed\n", __FUNCTION__);
+      exit (1);
+    }
+
+  r = pthread_barrier_wait (&b2);
+  if (r != 0 && r != PTHREAD_BARRIER_SERIAL_THREAD)
+    {
+      printf ("%s: 2nd barrier_wait failed\n", __FUNCTION__);
+      exit (1);
+    }
+
+  pthread_cleanup_push (cl, NULL);
+
+  fsync (tempfd);
+
+  pthread_cleanup_pop (0);
+
+  printf ("%s: fsync returned\n", __FUNCTION__);
+
+  exit (1);
+}
+
+
+static void *
+tf_fdatasync (void *arg)
+{
+  if (arg == NULL)
+    // XXX If somebody can provide a portable test case in which fdatasync()
+    // blocks we can enable this test to run in both rounds.
+    abort ();
+
+  tempfd = open ("Makefile", O_RDONLY);
+  if (tempfd == -1)
+    {
+      printf ("%s: cannot open Makefile\n", __FUNCTION__);
+      exit (1);
+    }
+
+  int r = pthread_barrier_wait (&b2);
+  if (r != 0 && r != PTHREAD_BARRIER_SERIAL_THREAD)
+    {
+      printf ("%s: barrier_wait failed\n", __FUNCTION__);
+      exit (1);
+    }
+
+  r = pthread_barrier_wait (&b2);
+  if (r != 0 && r != PTHREAD_BARRIER_SERIAL_THREAD)
+    {
+      printf ("%s: 2nd barrier_wait failed\n", __FUNCTION__);
+      exit (1);
+    }
+
+  pthread_cleanup_push (cl, NULL);
+
+  fdatasync (tempfd);
+
+  pthread_cleanup_pop (0);
+
+  printf ("%s: fdatasync returned\n", __FUNCTION__);
+
+  exit (1);
+}
+
+
+static void *
+tf_msync (void *arg)
+{
+  if (arg == NULL)
+    // XXX If somebody can provide a portable test case in which msync()
+    // blocks we can enable this test to run in both rounds.
+    abort ();
+
+  tempfd = open ("Makefile", O_RDONLY);
+  if (tempfd == -1)
+    {
+      printf ("%s: cannot open Makefile\n", __FUNCTION__);
+      exit (1);
+    }
+  void *p = mmap (NULL, 10, PROT_READ, MAP_SHARED, tempfd, 0);
+  if (p == MAP_FAILED)
+    {
+      printf ("%s: mmap failed\n", __FUNCTION__);
+      exit (1);
+    }
+
+  int r = pthread_barrier_wait (&b2);
+  if (r != 0 && r != PTHREAD_BARRIER_SERIAL_THREAD)
+    {
+      printf ("%s: barrier_wait failed\n", __FUNCTION__);
+      exit (1);
+    }
+
+  r = pthread_barrier_wait (&b2);
+  if (r != 0 && r != PTHREAD_BARRIER_SERIAL_THREAD)
+    {
+      printf ("%s: 2nd barrier_wait failed\n", __FUNCTION__);
+      exit (1);
+    }
+
+  pthread_cleanup_push (cl, NULL);
+
+  msync (p, 10, 0);
+
+  pthread_cleanup_pop (0);
+
+  printf ("%s: msync returned\n", __FUNCTION__);
+
+  exit (1);
+}
+
+
+static void *
+tf_sendto (void *arg)
+{
+  int tfd;
+  if (arg == NULL)
+    // XXX If somebody can provide a portable test case in which sendto()
+    // blocks we can enable this test to run in both rounds.
+    abort ();
+
+  struct sockaddr_un sun;
+
+  tempfd = socket (AF_UNIX, SOCK_DGRAM, 0);
+  if (tempfd == -1)
+    {
+      printf ("%s: first socket call failed\n", __FUNCTION__);
+      exit (1);
+    }
+
+  int tries = 0;
+  do
+    {
+      if (++tries > 10)
+	{
+	  printf ("%s: too many unsuccessful bind calls\n", __FUNCTION__);
+	}
+
+      strcpy (sun.sun_path, "/tmp/tst-cancel4-socket-6-XXXXXX");
+      tfd = mkstemp(sun.sun_path);
+      if (tfd < 0)
+	{
+	  printf ("%s: cannot generate temp file name\n", __FUNCTION__);
+	  exit (1);
+	}
+      close(tfd);
+      sun.sun_family = AF_UNIX;
+    }
+  while (bind (tempfd, (struct sockaddr *) &sun,
+	       offsetof (struct sockaddr_un, sun_path)
+	       + strlen (sun.sun_path) + 1) != 0);
+  tempfname = strdup (sun.sun_path);
+
+  tempfd2 = socket (AF_UNIX, SOCK_DGRAM, 0);
+  if (tempfd2 == -1)
+    {
+      printf ("%s: second socket call failed\n", __FUNCTION__);
+      exit (1);
+    }
+
+  int r = pthread_barrier_wait (&b2);
+  if (r != 0 && r != PTHREAD_BARRIER_SERIAL_THREAD)
+    {
+      printf ("%s: barrier_wait failed\n", __FUNCTION__);
+      exit (1);
+    }
+
+  r = pthread_barrier_wait (&b2);
+  if (r != 0 && r != PTHREAD_BARRIER_SERIAL_THREAD)
+    {
+      printf ("%s: 2nd barrier_wait failed\n", __FUNCTION__);
+      exit (1);
+    }
+
+  pthread_cleanup_push (cl, NULL);
+
+  char mem[1];
+
+  sendto (tempfd2, mem, arg == NULL ? sizeof (mem) : 1, 0,
+	  (struct sockaddr *) &sun,
+	  offsetof (struct sockaddr_un, sun_path) + strlen (sun.sun_path) + 1);
+
+  pthread_cleanup_pop (0);
+
+  printf ("%s: sendto returned\n", __FUNCTION__);
+
+  exit (1);
+}
+
+
+static void *
+tf_sendmsg (void *arg)
+{
+  int tfd;
+  if (arg == NULL)
+    // XXX If somebody can provide a portable test case in which sendmsg()
+    // blocks we can enable this test to run in both rounds.
+    abort ();
+
+  struct sockaddr_un sun;
+
+  tempfd = socket (AF_UNIX, SOCK_DGRAM, 0);
+  if (tempfd == -1)
+    {
+      printf ("%s: first socket call failed\n", __FUNCTION__);
+      exit (1);
+    }
+
+  int tries = 0;
+  do
+    {
+      if (++tries > 10)
+	{
+	  printf ("%s: too many unsuccessful bind calls\n", __FUNCTION__);
+	}
+
+      strcpy (sun.sun_path, "/tmp/tst-cancel4-socket-7-XXXXXX");
+      tfd = mkstemp(sun.sun_path);
+      if (tfd < 0)
+	{
+	  printf ("%s: cannot generate temp file name\n", __FUNCTION__);
+	  exit (1);
+	}
+      close(tfd);
+      sun.sun_family = AF_UNIX;
+    }
+  while (bind (tempfd, (struct sockaddr *) &sun,
+	       offsetof (struct sockaddr_un, sun_path)
+	       + strlen (sun.sun_path) + 1) != 0);
+  tempfname = strdup (sun.sun_path);
+
+  tempfd2 = socket (AF_UNIX, SOCK_DGRAM, 0);
+  if (tempfd2 == -1)
+    {
+      printf ("%s: second socket call failed\n", __FUNCTION__);
+      exit (1);
+    }
+
+  int r = pthread_barrier_wait (&b2);
+  if (r != 0 && r != PTHREAD_BARRIER_SERIAL_THREAD)
+    {
+      printf ("%s: barrier_wait failed\n", __FUNCTION__);
+      exit (1);
+    }
+
+  r = pthread_barrier_wait (&b2);
+  if (r != 0 && r != PTHREAD_BARRIER_SERIAL_THREAD)
+    {
+      printf ("%s: 2nd barrier_wait failed\n", __FUNCTION__);
+      exit (1);
+    }
+
+  pthread_cleanup_push (cl, NULL);
+
+  char mem[1];
+  struct iovec iov[1];
+  iov[0].iov_base = mem;
+  iov[0].iov_len = 1;
+
+  struct msghdr m;
+  m.msg_name = &sun;
+  m.msg_namelen = (offsetof (struct sockaddr_un, sun_path)
+		   + strlen (sun.sun_path) + 1);
+  m.msg_iov = iov;
+  m.msg_iovlen = 1;
+  m.msg_control = NULL;
+  m.msg_controllen = 0;
+
+  sendmsg (tempfd2, &m, 0);
+
+  pthread_cleanup_pop (0);
+
+  printf ("%s: sendmsg returned\n", __FUNCTION__);
+
+  exit (1);
+}
+
+
+static void *
+tf_creat (void *arg)
+{
+  if (arg == NULL)
+    // XXX If somebody can provide a portable test case in which sendmsg()
+    // blocks we can enable this test to run in both rounds.
+    abort ();
+
+  int r = pthread_barrier_wait (&b2);
+  if (r != 0 && r != PTHREAD_BARRIER_SERIAL_THREAD)
+    {
+      printf ("%s: barrier_wait failed\n", __FUNCTION__);
+      exit (1);
+    }
+
+  r = pthread_barrier_wait (&b2);
+  if (r != 0 && r != PTHREAD_BARRIER_SERIAL_THREAD)
+    {
+      printf ("%s: 2nd barrier_wait failed\n", __FUNCTION__);
+      exit (1);
+    }
+
+  pthread_cleanup_push (cl, NULL);
+
+  creat ("tmp/tst-cancel-4-should-not-exist", 0666);
+
+  pthread_cleanup_pop (0);
+
+  printf ("%s: creat returned\n", __FUNCTION__);
+
+  exit (1);
+}
+
+
+static void *
+tf_connect (void *arg)
+{
+  int tfd;
+  if (arg == NULL)
+    // XXX If somebody can provide a portable test case in which connect()
+    // blocks we can enable this test to run in both rounds.
+    abort ();
+
+  struct sockaddr_un sun;
+
+  tempfd = socket (AF_UNIX, SOCK_STREAM, 0);
+  if (tempfd == -1)
+    {
+      printf ("%s: first socket call failed\n", __FUNCTION__);
+      exit (1);
+    }
+
+  int tries = 0;
+  do
+    {
+      if (++tries > 10)
+	{
+	  printf ("%s: too many unsuccessful bind calls\n", __FUNCTION__);
+	}
+
+      strcpy (sun.sun_path, "/tmp/tst-cancel4-socket-2-XXXXXX");
+      tfd = mkstemp(sun.sun_path);
+      if (tfd < 0)
+	{
+	  printf ("%s: cannot generate temp file name\n", __FUNCTION__);
+	  exit (1);
+	}
+      close(tfd);
+      sun.sun_family = AF_UNIX;
+    }
+  while (bind (tempfd, (struct sockaddr *) &sun,
+	       offsetof (struct sockaddr_un, sun_path)
+	       + strlen (sun.sun_path) + 1) != 0);
+  tempfname = strdup (sun.sun_path);
+
+  listen (tempfd, 5);
+
+  tempfd2 = socket (AF_UNIX, SOCK_STREAM, 0);
+  if (tempfd2 == -1)
+    {
+      printf ("%s: second socket call failed\n", __FUNCTION__);
+      exit (1);
+    }
+
+  int r = pthread_barrier_wait (&b2);
+  if (r != 0 && r != PTHREAD_BARRIER_SERIAL_THREAD)
+    {
+      printf ("%s: barrier_wait failed\n", __FUNCTION__);
+      exit (1);
+    }
+
+  if (arg != NULL)
+    {
+      r = pthread_barrier_wait (&b2);
+      if (r != 0 && r != PTHREAD_BARRIER_SERIAL_THREAD)
+	{
+	  printf ("%s: 2nd barrier_wait failed\n", __FUNCTION__);
+	  exit (1);
+	}
+    }
+
+  pthread_cleanup_push (cl, NULL);
+
+  connect (tempfd2, (struct sockaddr *) &sun, sizeof (sun));
+
+  pthread_cleanup_pop (0);
+
+  printf ("%s: connect returned\n", __FUNCTION__);
+
+  exit (1);
+}
+
+
+static void *
+tf_tcdrain (void *arg)
+{
+  if (arg == NULL)
+    // XXX If somebody can provide a portable test case in which tcdrain()
+    // blocks we can enable this test to run in both rounds.
+    abort ();
+
+  int r = pthread_barrier_wait (&b2);
+  if (r != 0 && r != PTHREAD_BARRIER_SERIAL_THREAD)
+    {
+      printf ("%s: barrier_wait failed\n", __FUNCTION__);
+      exit (1);
+    }
+
+  if (arg != NULL)
+    {
+      r = pthread_barrier_wait (&b2);
+      if (r != 0 && r != PTHREAD_BARRIER_SERIAL_THREAD)
+	{
+	  printf ("%s: 2nd barrier_wait failed\n", __FUNCTION__);
+	  exit (1);
+	}
+    }
+
+  pthread_cleanup_push (cl, NULL);
+
+  /* Regardless of stderr being a terminal, the tcdrain call should be
+     canceled.  */
+  tcdrain (STDERR_FILENO);
+
+  pthread_cleanup_pop (0);
+
+  printf ("%s: tcdrain returned\n", __FUNCTION__);
+
+  exit (1);
+}
+
+
+static void *
+tf_msgrcv (void *arg)
+{
+  tempmsg = msgget (IPC_PRIVATE, 0666 | IPC_CREAT);
+  if (tempmsg == -1)
+    {
+      printf ("%s: msgget failed: %s\n", __FUNCTION__, strerror (errno));
+      exit (1);
+    }
+
+  int r = pthread_barrier_wait (&b2);
+  if (r != 0 && r != PTHREAD_BARRIER_SERIAL_THREAD)
+    {
+      printf ("%s: barrier_wait failed\n", __FUNCTION__);
+      exit (1);
+    }
+
+  if (arg != NULL)
+    {
+      r = pthread_barrier_wait (&b2);
+      if (r != 0 && r != PTHREAD_BARRIER_SERIAL_THREAD)
+	{
+	  printf ("%s: 2nd barrier_wait failed\n", __FUNCTION__);
+	  exit (1);
+	}
+    }
+
+  ssize_t s;
+
+  pthread_cleanup_push (cl, NULL);
+
+  struct
+  {
+    long int type;
+    char mem[10];
+  } m;
+  int randnr;
+  /* We need a positive random number.  */
+  do
+    randnr = random () % 64000;
+  while (randnr <= 0);
+  do
+    {
+      errno = 0;
+      s = msgrcv (tempmsg, (struct msgbuf *) &m, 10, randnr, 0);
+    }
+  while (errno == EIDRM || errno == EINTR);
+
+  pthread_cleanup_pop (0);
+
+  printf ("%s: msgrcv returned %zd with errno = %m\n", __FUNCTION__, s);
+
+  msgctl (tempmsg, IPC_RMID, NULL);
+
+  exit (1);
+}
+
+
+static void *
+tf_msgsnd (void *arg)
+{
+  if (arg == NULL)
+    // XXX If somebody can provide a portable test case in which msgsnd()
+    // blocks we can enable this test to run in both rounds.
+    abort ();
+
+  tempmsg = msgget (IPC_PRIVATE, 0666 | IPC_CREAT);
+  if (tempmsg == -1)
+    {
+      printf ("%s: msgget failed: %s\n", __FUNCTION__, strerror (errno));
+      exit (1);
+    }
+
+  int r = pthread_barrier_wait (&b2);
+  if (r != 0 && r != PTHREAD_BARRIER_SERIAL_THREAD)
+    {
+      printf ("%s: barrier_wait failed\n", __FUNCTION__);
+      exit (1);
+    }
+
+  r = pthread_barrier_wait (&b2);
+  if (r != 0 && r != PTHREAD_BARRIER_SERIAL_THREAD)
+    {
+      printf ("%s: 2nd barrier_wait failed\n", __FUNCTION__);
+      exit (1);
+    }
+
+  pthread_cleanup_push (cl, NULL);
+
+  struct
+  {
+    long int type;
+    char mem[1];
+  } m;
+  /* We need a positive random number.  */
+  do
+    m.type = random () % 64000;
+  while (m.type <= 0);
+  msgsnd (tempmsg, (struct msgbuf *) &m, sizeof (m.mem), 0);
+
+  pthread_cleanup_pop (0);
+
+  printf ("%s: msgsnd returned\n", __FUNCTION__);
+
+  msgctl (tempmsg, IPC_RMID, NULL);
+
+  exit (1);
+}
+
+
+static struct
+{
+  const char *name;
+  void *(*tf) (void *);
+  int nb;
+  int only_early;
+} tests[] =
+{
+#define ADD_TEST(name, nbar, early) { #name, tf_##name, nbar, early }
+  ADD_TEST (read, 2, 0),
+  ADD_TEST (readv, 2, 0),
+  ADD_TEST (select, 2, 0),
+  ADD_TEST (pselect, 2, 0),
+  ADD_TEST (poll, 2, 0),
+  ADD_TEST (ppoll, 2, 0),
+  ADD_TEST (write, 2, 0),
+  ADD_TEST (writev, 2, 0),
+  ADD_TEST (sleep, 2, 0),
+  ADD_TEST (usleep, 2, 0),
+  ADD_TEST (nanosleep, 2, 0),
+  ADD_TEST (wait, 2, 0),
+  ADD_TEST (waitid, 2, 0),
+  ADD_TEST (waitpid, 2, 0),
+  ADD_TEST (sigpause, 2, 0),
+  ADD_TEST (sigsuspend, 2, 0),
+  ADD_TEST (sigwait, 2, 0),
+  ADD_TEST (sigwaitinfo, 2, 0),
+  ADD_TEST (sigtimedwait, 2, 0),
+  ADD_TEST (pause, 2, 0),
+  ADD_TEST (accept, 2, 0),
+  ADD_TEST (send, 2, 0),
+  ADD_TEST (recv, 2, 0),
+  ADD_TEST (recvfrom, 2, 0),
+  ADD_TEST (recvmsg, 2, 0),
+  ADD_TEST (open, 2, 1),
+  ADD_TEST (close, 2, 1),
+  ADD_TEST (pread, 2, 1),
+  ADD_TEST (pwrite, 2, 1),
+  ADD_TEST (fsync, 2, 1),
+  ADD_TEST (fdatasync, 2, 1),
+  ADD_TEST (msync, 2, 1),
+  ADD_TEST (sendto, 2, 1),
+  ADD_TEST (sendmsg, 2, 1),
+  ADD_TEST (creat, 2, 1),
+  ADD_TEST (connect, 2, 1),
+  ADD_TEST (tcdrain, 2, 1),
+  ADD_TEST (msgrcv, 2, 0),
+  ADD_TEST (msgsnd, 2, 1),
+};
+#define ntest_tf (sizeof (tests) / sizeof (tests[0]))
+
+
+static int
+do_test (void)
+{
+  int val;
+  socklen_t len;
+
+  if (socketpair (AF_UNIX, SOCK_STREAM, PF_UNIX, fds) != 0)
+    {
+      perror ("socketpair");
+      exit (1);
+    }
+
+  val = 1;
+  len = sizeof(val);
+  setsockopt (fds[1], SOL_SOCKET, SO_SNDBUF, &val, sizeof(val));
+  if (getsockopt (fds[1], SOL_SOCKET, SO_SNDBUF, &val, &len) < 0)
+    {
+      perror ("getsockopt");
+      exit (1);
+    }
+  if (val >= WRITE_BUFFER_SIZE)
+    {
+      puts ("minimum write buffer size too large");
+      exit (1);
+    }
+  setsockopt (fds[1], SOL_SOCKET, SO_SNDBUF, &val, sizeof(val));
+
+  int result = 0;
+  size_t cnt;
+  for (cnt = 0; cnt < ntest_tf; ++cnt)
+    {
+      if (tests[cnt].only_early)
+	continue;
+
+      if (pthread_barrier_init (&b2, NULL, tests[cnt].nb) != 0)
+	{
+	  puts ("b2 init failed");
+	  exit (1);
+	}
+
+      /* Reset the counter for the cleanup handler.  */
+      cl_called = 0;
+
+      pthread_t th;
+      if (pthread_create (&th, NULL, tests[cnt].tf, NULL) != 0)
+	{
+	  printf ("create for '%s' test failed\n", tests[cnt].name);
+	  result = 1;
+	  continue;
+	}
+
+      int r = pthread_barrier_wait (&b2);
+      if (r != 0 && r != PTHREAD_BARRIER_SERIAL_THREAD)
+	{
+	  printf ("%s: barrier_wait failed\n", __FUNCTION__);
+	  result = 1;
+	  continue;
+	}
+
+      struct timespec  ts = { .tv_sec = 0, .tv_nsec = 100000000 };
+      while (nanosleep (&ts, &ts) != 0)
+	continue;
+
+      if (pthread_cancel (th) != 0)
+	{
+	  printf ("cancel for '%s' failed\n", tests[cnt].name);
+	  result = 1;
+	  continue;
+	}
+
+      void *status;
+      if (pthread_join (th, &status) != 0)
+	{
+	  printf ("join for '%s' failed\n", tests[cnt].name);
+	  result = 1;
+	  continue;
+	}
+      if (status != PTHREAD_CANCELED)
+	{
+	  printf ("thread for '%s' not canceled\n", tests[cnt].name);
+	  result = 1;
+	  continue;
+	}
+
+      if (pthread_barrier_destroy (&b2) != 0)
+	{
+	  puts ("barrier_destroy failed");
+	  result = 1;
+	  continue;
+	}
+
+      if (cl_called == 0)
+	{
+	  printf ("cleanup handler not called for '%s'\n", tests[cnt].name);
+	  result = 1;
+	  continue;
+	}
+      if (cl_called > 1)
+	{
+	  printf ("cleanup handler called more than once for '%s'\n",
+		  tests[cnt].name);
+	  result = 1;
+	  continue;
+	}
+
+      printf ("in-time cancel test of '%s' successful\n", tests[cnt].name);
+
+      if (tempfd != -1)
+	{
+	  close (tempfd);
+	  tempfd = -1;
+	}
+      if (tempfd2 != -1)
+	{
+	  close (tempfd2);
+	  tempfd2 = -1;
+	}
+      if (tempfname != NULL)
+	{
+	  unlink (tempfname);
+	  free (tempfname);
+	  tempfname = NULL;
+	}
+      if (tempmsg != -1)
+	{
+	  msgctl (tempmsg, IPC_RMID, NULL);
+	  tempmsg = -1;
+	}
+    }
+
+  for (cnt = 0; cnt < ntest_tf; ++cnt)
+    {
+      if (pthread_barrier_init (&b2, NULL, tests[cnt].nb) != 0)
+	{
+	  puts ("b2 init failed");
+	  exit (1);
+	}
+
+      /* Reset the counter for the cleanup handler.  */
+      cl_called = 0;
+
+      pthread_t th;
+      if (pthread_create (&th, NULL, tests[cnt].tf, (void *) 1l) != 0)
+	{
+	  printf ("create for '%s' test failed\n", tests[cnt].name);
+	  result = 1;
+	  continue;
+	}
+
+      int r = pthread_barrier_wait (&b2);
+      if (r != 0 && r != PTHREAD_BARRIER_SERIAL_THREAD)
+	{
+	  printf ("%s: barrier_wait failed\n", __FUNCTION__);
+	  result = 1;
+	  continue;
+	}
+
+      if (pthread_cancel (th) != 0)
+	{
+	  printf ("cancel for '%s' failed\n", tests[cnt].name);
+	  result = 1;
+	  continue;
+	}
+
+      r = pthread_barrier_wait (&b2);
+      if (r != 0 && r != PTHREAD_BARRIER_SERIAL_THREAD)
+	{
+	  printf ("%s: barrier_wait failed\n", __FUNCTION__);
+	  result = 1;
+	  continue;
+	}
+
+      void *status;
+      if (pthread_join (th, &status) != 0)
+	{
+	  printf ("join for '%s' failed\n", tests[cnt].name);
+	  result = 1;
+	  continue;
+	}
+      if (status != PTHREAD_CANCELED)
+	{
+	  printf ("thread for '%s' not canceled\n", tests[cnt].name);
+	  result = 1;
+	  continue;
+	}
+
+      if (pthread_barrier_destroy (&b2) != 0)
+	{
+	  puts ("barrier_destroy failed");
+	  result = 1;
+	  continue;
+	}
+
+      if (cl_called == 0)
+	{
+	  printf ("cleanup handler not called for '%s'\n", tests[cnt].name);
+	  result = 1;
+	  continue;
+	}
+      if (cl_called > 1)
+	{
+	  printf ("cleanup handler called more than once for '%s'\n",
+		  tests[cnt].name);
+	  result = 1;
+	  continue;
+	}
+
+      printf ("early cancel test of '%s' successful\n", tests[cnt].name);
+
+      if (tempfd != -1)
+	{
+	  close (tempfd);
+	  tempfd = -1;
+	}
+      if (tempfd2 != -1)
+	{
+	  close (tempfd2);
+	  tempfd2 = -1;
+	}
+      if (tempfname != NULL)
+	{
+	  unlink (tempfname);
+	  free (tempfname);
+	  tempfname = NULL;
+	}
+      if (tempmsg != -1)
+	{
+	  msgctl (tempmsg, IPC_RMID, NULL);
+	  tempmsg = -1;
+	}
+    }
+
+  return result;
+}
+
+#define TIMEOUT 60
+#define TEST_FUNCTION do_test ()
+#include "../test-skeleton.c"
diff --git a/ap/build/uClibc/test/nptl/tst-cancel5.c b/ap/build/uClibc/test/nptl/tst-cancel5.c
new file mode 100644
index 0000000..1c879eb
--- /dev/null
+++ b/ap/build/uClibc/test/nptl/tst-cancel5.c
@@ -0,0 +1 @@
+#include "tst-cancel4.c"
diff --git a/ap/build/uClibc/test/nptl/tst-cancel6.c b/ap/build/uClibc/test/nptl/tst-cancel6.c
new file mode 100644
index 0000000..94de858
--- /dev/null
+++ b/ap/build/uClibc/test/nptl/tst-cancel6.c
@@ -0,0 +1,79 @@
+/* Copyright (C) 2002 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+   Contributed by Ulrich Drepper <drepper@redhat.com>, 2002.
+
+   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>
+#include <stdio.h>
+#include <stdlib.h>
+#include <unistd.h>
+
+
+static void *
+tf (void *arg)
+{
+  char buf[100];
+  fgets (buf, sizeof (buf), arg);
+  /* This call should never return.  */
+  return NULL;
+}
+
+
+static int
+do_test (void)
+{
+  int fd[2];
+  if (pipe (fd) != 0)
+    {
+      puts ("pipe failed");
+      return 1;
+    }
+
+  FILE *fp = fdopen (fd[0], "r");
+  if (fp == NULL)
+    {
+      puts ("fdopen failed");
+      return 1;
+    }
+
+  pthread_t th;
+  if (pthread_create (&th, NULL, tf, fp) != 0)
+    {
+      puts ("pthread_create failed");
+      return 1;
+    }
+
+  sleep (1);
+
+  if (pthread_cancel (th) != 0)
+    {
+      puts ("pthread_cancel failed");
+      return 1;
+    }
+
+  void *r;
+  if (pthread_join (th, &r) != 0)
+    {
+      puts ("pthread_join failed");
+      return 1;
+    }
+
+  return r != PTHREAD_CANCELED;
+}
+
+#define TEST_FUNCTION do_test ()
+#include "../test-skeleton.c"
diff --git a/ap/build/uClibc/test/nptl/tst-cancel7.c b/ap/build/uClibc/test/nptl/tst-cancel7.c
new file mode 100644
index 0000000..16cc47c
--- /dev/null
+++ b/ap/build/uClibc/test/nptl/tst-cancel7.c
@@ -0,0 +1,213 @@
+/* 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.
+
+   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 <errno.h>
+#include <fcntl.h>
+#include <pthread.h>
+#include <signal.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <unistd.h>
+
+const char *command;
+const char *pidfile;
+char pidfilename[] = "/tmp/tst-cancel7-XXXXXX";
+
+static void *
+tf (void *arg)
+{
+  const char *args = " --direct --pidfile ";
+  char *cmd = alloca (strlen (command) + strlen (args)
+		      + strlen (pidfilename) + 1);
+
+  strcpy (stpcpy (stpcpy (cmd, command), args), pidfilename);
+  system (cmd);
+  /* This call should never return.  */
+  return NULL;
+}
+
+
+static void
+sl (void)
+{
+  FILE *f = fopen (pidfile, "w");
+  if (f == NULL)
+    exit (1);
+
+  fprintf (f, "%lld\n", (long long) getpid ());
+  fflush (f);
+
+  struct flock fl =
+    {
+      .l_type = F_WRLCK,
+      .l_start = 0,
+      .l_whence = SEEK_SET,
+      .l_len = 1
+    };
+  if (fcntl (fileno (f), F_SETLK, &fl) != 0)
+    exit (1);
+
+  sigset_t ss;
+  sigfillset (&ss);
+  sigsuspend (&ss);
+  exit (0);
+}
+
+
+static void
+do_prepare (int argc, char *argv[])
+{
+  if (command == NULL)
+    command = argv[0];
+
+  if (pidfile)
+    sl ();
+
+  int fd = mkstemp (pidfilename);
+  if (fd == -1)
+    {
+      puts ("mkstemp failed");
+      exit (1);
+    }
+
+  write (fd, " ", 1);
+  close (fd);
+}
+
+
+static int
+do_test (void)
+{
+  pthread_t th;
+  if (pthread_create (&th, NULL, tf, NULL) != 0)
+    {
+      puts ("pthread_create failed");
+      return 1;
+    }
+
+  do
+    sleep (1);
+  while (access (pidfilename, R_OK) != 0);
+
+  if (pthread_cancel (th) != 0)
+    {
+      puts ("pthread_cancel failed");
+      return 1;
+    }
+
+  void *r;
+  if (pthread_join (th, &r) != 0)
+    {
+      puts ("pthread_join failed");
+      return 1;
+    }
+
+  sleep (1);
+
+  FILE *f = fopen (pidfilename, "r+");
+  if (f == NULL)
+    {
+      puts ("no pidfile");
+      return 1;
+    }
+
+  long long ll;
+  if (fscanf (f, "%lld\n", &ll) != 1)
+    {
+      puts ("could not read pid");
+      unlink (pidfilename);
+      return 1;
+    }
+
+  struct flock fl =
+    {
+      .l_type = F_WRLCK,
+      .l_start = 0,
+      .l_whence = SEEK_SET,
+      .l_len = 1
+    };
+  if (fcntl (fileno (f), F_GETLK, &fl) != 0)
+    {
+      puts ("F_GETLK failed");
+      unlink (pidfilename);
+      return 1;
+    }
+
+  if (fl.l_type != F_UNLCK)
+    {
+      printf ("child %lld still running\n", (long long) fl.l_pid);
+      if (fl.l_pid == ll)
+	kill (fl.l_pid, SIGKILL);
+
+      unlink (pidfilename);
+      return 1;
+    }
+
+  fclose (f);
+
+  unlink (pidfilename);
+
+  return r != PTHREAD_CANCELED;
+}
+
+#if 0 /* unused */
+static void
+do_cleanup (void)
+{
+  FILE *f = fopen (pidfilename, "r+");
+  long long ll;
+
+  if (f != NULL && fscanf (f, "%lld\n", &ll) == 1)
+    {
+      struct flock fl =
+	{
+	  .l_type = F_WRLCK,
+	  .l_start = 0,
+	  .l_whence = SEEK_SET,
+	  .l_len = 1
+	};
+      if (fcntl (fileno (f), F_GETLK, &fl) == 0 && fl.l_type != F_UNLCK
+	  && fl.l_pid == ll)
+	kill (fl.l_pid, SIGKILL);
+
+      fclose (f);
+    }
+
+  unlink (pidfilename);
+}
+#endif
+
+#define OPT_COMMAND	10000
+#define OPT_PIDFILE	10001
+#define CMDLINE_OPTIONS \
+  { "command", required_argument, NULL, OPT_COMMAND },	\
+  { "pidfile", required_argument, NULL, OPT_PIDFILE },
+#define CMDLINE_PROCESS \
+  case OPT_COMMAND:	\
+    command = optarg;	\
+    break;		\
+  case OPT_PIDFILE:	\
+    pidfile = optarg;	\
+    break;
+// #define CLEANUP_HANDLER do_cleanup ()
+#define PREPARE(argc, argv) do_prepare (argc, argv)
+#define TEST_FUNCTION do_test ()
+#define TIMEOUT 5
+#include "../test-skeleton.c"
diff --git a/ap/build/uClibc/test/nptl/tst-cancel8.c b/ap/build/uClibc/test/nptl/tst-cancel8.c
new file mode 100644
index 0000000..fc83662
--- /dev/null
+++ b/ap/build/uClibc/test/nptl/tst-cancel8.c
@@ -0,0 +1,143 @@
+/* Copyright (C) 2003 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, write to the Free
+   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+   02111-1307 USA.  */
+
+#include <pthread.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <unistd.h>
+
+
+static pthread_barrier_t bar;
+
+static int global;
+
+
+static void
+cleanup (void *arg)
+{
+  global = 1;
+}
+
+
+static void *
+tf (void *arg)
+{
+  /* Enable cancellation, but defer it.  */
+  if (pthread_setcancelstate (PTHREAD_CANCEL_ENABLE, NULL) != 0)
+    {
+      puts ("setcancelstate failed");
+      exit (1);
+    }
+  if (pthread_setcanceltype (PTHREAD_CANCEL_DEFERRED, NULL) != 0)
+    {
+      puts ("setcanceltype failed");
+      exit (1);
+    }
+
+  /* Add cleanup handler.  */
+  pthread_cleanup_push (cleanup, NULL);
+
+  /* Synchronize with the main thread.  */
+  int r = pthread_barrier_wait (&bar);
+  if (r != 0 && r!= PTHREAD_BARRIER_SERIAL_THREAD)
+    {
+      puts ("tf: first barrier_wait failed");
+      exit (1);
+    }
+
+  /* And again.  Once this is done the main thread should have canceled
+     this thread.  */
+  r = pthread_barrier_wait (&bar);
+  if (r != 0 && r!= PTHREAD_BARRIER_SERIAL_THREAD)
+    {
+      puts ("tf: second barrier_wait failed");
+      exit (1);
+    }
+
+  /* Remove the cleanup handler without executing it.  */
+  pthread_cleanup_pop (0);
+
+  /* Now react on the cancellation.  */
+  pthread_testcancel ();
+
+  /* This call should never return.  */
+  return NULL;
+}
+
+
+static int
+do_test (void)
+{
+  if (pthread_barrier_init (&bar, NULL, 2) != 0)
+    {
+      puts ("barrier_init failed");
+      exit (1);
+    }
+
+  pthread_t th;
+  if (pthread_create (&th, NULL, tf, NULL) != 0)
+    {
+      puts ("pthread_create failed");
+      return 1;
+    }
+
+  int r = pthread_barrier_wait (&bar);
+  if (r != 0 && r!= PTHREAD_BARRIER_SERIAL_THREAD)
+    {
+      puts ("first barrier_wait failed");
+      exit (1);
+    }
+
+  if (pthread_cancel (th) != 0)
+    {
+      puts ("pthread_cancel failed");
+      return 1;
+    }
+
+  r = pthread_barrier_wait (&bar);
+  if (r != 0 && r!= PTHREAD_BARRIER_SERIAL_THREAD)
+    {
+      puts ("second barrier_wait failed");
+      exit (1);
+    }
+
+  void *result;
+  if (pthread_join (th, &result) != 0)
+    {
+      puts ("pthread_join failed");
+      return 1;
+    }
+
+  if (result != PTHREAD_CANCELED)
+    {
+      puts ("thread was not canceled");
+      exit (1);
+    }
+
+  if (global != 0)
+    {
+      puts ("cancellation handler has been called");
+      exit (1);
+    }
+
+  return 0;
+}
+
+#define TEST_FUNCTION do_test ()
+#include "../test-skeleton.c"
diff --git a/ap/build/uClibc/test/nptl/tst-cancel9.c b/ap/build/uClibc/test/nptl/tst-cancel9.c
new file mode 100644
index 0000000..037ef30
--- /dev/null
+++ b/ap/build/uClibc/test/nptl/tst-cancel9.c
@@ -0,0 +1,126 @@
+/* Copyright (C) 2003, 2004 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, write to the Free
+   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+   02111-1307 USA.  */
+
+#include <fcntl.h>
+#include <pthread.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <unistd.h>
+
+
+static pthread_barrier_t b;
+
+
+static void
+cleanup (void *arg)
+{
+  fputs ("in cleanup\n", stdout);
+}
+
+
+static void *
+tf (void *arg)
+{
+  int fd = open ("/dev/null", O_RDWR);
+  if (fd == -1)
+    {
+      puts ("cannot open /dev/null");
+      exit (1);
+    }
+  FILE *fp = fdopen (fd, "w");
+  if (fp == NULL)
+    {
+      puts ("fdopen failed");
+      exit (1);
+    }
+
+  pthread_cleanup_push (cleanup, NULL);
+
+  int e = pthread_barrier_wait (&b);
+  if (e != 0 && e != PTHREAD_BARRIER_SERIAL_THREAD)
+    {
+      puts ("barrier_wait failed");
+      exit (1);
+    }
+
+  while (1)
+    /* fprintf() uses write() which is a cancallation point.  */
+    fprintf (fp, "foo");
+
+  pthread_cleanup_pop (0);
+
+  return NULL;
+}
+
+
+static int
+do_test (void)
+{
+  if (pthread_barrier_init (&b, NULL, 2) != 0)
+    {
+      puts ("barrier_init failed");
+      exit (1);
+    }
+
+  pthread_t th;
+  if (pthread_create (&th, NULL, tf, NULL) != 0)
+    {
+      puts ("create failed");
+      return 1;
+    }
+
+  int e = pthread_barrier_wait (&b);
+  if (e != 0 && e != PTHREAD_BARRIER_SERIAL_THREAD)
+    {
+      puts ("barrier_wait failed");
+      exit (1);
+    }
+
+  sleep (1);
+
+  puts ("cancel now");
+
+  if (pthread_cancel (th) != 0)
+    {
+      puts ("cancel failed");
+      exit (1);
+    }
+
+  puts ("waiting for the child");
+
+  void *r;
+  if (pthread_join (th, &r) != 0)
+    {
+      puts ("join failed");
+      exit (1);
+    }
+
+  if (r != PTHREAD_CANCELED)
+    {
+      puts ("thread wasn't canceled");
+      exit (1);
+    }
+
+  return 0;
+}
+
+
+#define TEST_FUNCTION do_test ()
+#include "../test-skeleton.c"
diff --git a/ap/build/uClibc/test/nptl/tst-cancelx10.c b/ap/build/uClibc/test/nptl/tst-cancelx10.c
new file mode 100644
index 0000000..e5bbb34
--- /dev/null
+++ b/ap/build/uClibc/test/nptl/tst-cancelx10.c
@@ -0,0 +1 @@
+#include "tst-cancel10.c"
diff --git a/ap/build/uClibc/test/nptl/tst-cancelx11.c b/ap/build/uClibc/test/nptl/tst-cancelx11.c
new file mode 100644
index 0000000..ffcc2ee
--- /dev/null
+++ b/ap/build/uClibc/test/nptl/tst-cancelx11.c
@@ -0,0 +1 @@
+#include "tst-cancel11.c"
diff --git a/ap/build/uClibc/test/nptl/tst-cancelx12.c b/ap/build/uClibc/test/nptl/tst-cancelx12.c
new file mode 100644
index 0000000..f90ae61
--- /dev/null
+++ b/ap/build/uClibc/test/nptl/tst-cancelx12.c
@@ -0,0 +1 @@
+#include "tst-cancel12.c"
diff --git a/ap/build/uClibc/test/nptl/tst-cancelx13.c b/ap/build/uClibc/test/nptl/tst-cancelx13.c
new file mode 100644
index 0000000..37c4c39
--- /dev/null
+++ b/ap/build/uClibc/test/nptl/tst-cancelx13.c
@@ -0,0 +1 @@
+#include "tst-cancel13.c"
diff --git a/ap/build/uClibc/test/nptl/tst-cancelx14.c b/ap/build/uClibc/test/nptl/tst-cancelx14.c
new file mode 100644
index 0000000..ba4e775
--- /dev/null
+++ b/ap/build/uClibc/test/nptl/tst-cancelx14.c
@@ -0,0 +1 @@
+#include "tst-cancel14.c"
diff --git a/ap/build/uClibc/test/nptl/tst-cancelx15.c b/ap/build/uClibc/test/nptl/tst-cancelx15.c
new file mode 100644
index 0000000..005c1f6
--- /dev/null
+++ b/ap/build/uClibc/test/nptl/tst-cancelx15.c
@@ -0,0 +1 @@
+#include "tst-cancel15.c"
diff --git a/ap/build/uClibc/test/nptl/tst-cancelx16.c b/ap/build/uClibc/test/nptl/tst-cancelx16.c
new file mode 100644
index 0000000..99af3b1
--- /dev/null
+++ b/ap/build/uClibc/test/nptl/tst-cancelx16.c
@@ -0,0 +1 @@
+#include "tst-cancel16.c"
diff --git a/ap/build/uClibc/test/nptl/tst-cancelx18.c b/ap/build/uClibc/test/nptl/tst-cancelx18.c
new file mode 100644
index 0000000..56da18f
--- /dev/null
+++ b/ap/build/uClibc/test/nptl/tst-cancelx18.c
@@ -0,0 +1 @@
+#include "tst-cancel18.c"
diff --git a/ap/build/uClibc/test/nptl/tst-cancelx2.c b/ap/build/uClibc/test/nptl/tst-cancelx2.c
new file mode 100644
index 0000000..95dc8a8
--- /dev/null
+++ b/ap/build/uClibc/test/nptl/tst-cancelx2.c
@@ -0,0 +1 @@
+#include "tst-cancel2.c"
diff --git a/ap/build/uClibc/test/nptl/tst-cancelx20.c b/ap/build/uClibc/test/nptl/tst-cancelx20.c
new file mode 100644
index 0000000..6bd8637
--- /dev/null
+++ b/ap/build/uClibc/test/nptl/tst-cancelx20.c
@@ -0,0 +1 @@
+#include "tst-cancel20.c"
diff --git a/ap/build/uClibc/test/nptl/tst-cancelx21.c b/ap/build/uClibc/test/nptl/tst-cancelx21.c
new file mode 100644
index 0000000..2a01061
--- /dev/null
+++ b/ap/build/uClibc/test/nptl/tst-cancelx21.c
@@ -0,0 +1 @@
+#include "tst-cancel21.c"
diff --git a/ap/build/uClibc/test/nptl/tst-cancelx3.c b/ap/build/uClibc/test/nptl/tst-cancelx3.c
new file mode 100644
index 0000000..3937f10
--- /dev/null
+++ b/ap/build/uClibc/test/nptl/tst-cancelx3.c
@@ -0,0 +1 @@
+#include "tst-cancel3.c"
diff --git a/ap/build/uClibc/test/nptl/tst-cancelx4.c b/ap/build/uClibc/test/nptl/tst-cancelx4.c
new file mode 100644
index 0000000..1c879eb
--- /dev/null
+++ b/ap/build/uClibc/test/nptl/tst-cancelx4.c
@@ -0,0 +1 @@
+#include "tst-cancel4.c"
diff --git a/ap/build/uClibc/test/nptl/tst-cancelx6.c b/ap/build/uClibc/test/nptl/tst-cancelx6.c
new file mode 100644
index 0000000..6926e21
--- /dev/null
+++ b/ap/build/uClibc/test/nptl/tst-cancelx6.c
@@ -0,0 +1 @@
+#include "tst-cancel6.c"
diff --git a/ap/build/uClibc/test/nptl/tst-cancelx7.c b/ap/build/uClibc/test/nptl/tst-cancelx7.c
new file mode 100644
index 0000000..4df1a58
--- /dev/null
+++ b/ap/build/uClibc/test/nptl/tst-cancelx7.c
@@ -0,0 +1 @@
+#include "tst-cancel7.c"
diff --git a/ap/build/uClibc/test/nptl/tst-cancelx8.c b/ap/build/uClibc/test/nptl/tst-cancelx8.c
new file mode 100644
index 0000000..0555c7c
--- /dev/null
+++ b/ap/build/uClibc/test/nptl/tst-cancelx8.c
@@ -0,0 +1 @@
+#include "tst-cancel8.c"
diff --git a/ap/build/uClibc/test/nptl/tst-cancelx9.c b/ap/build/uClibc/test/nptl/tst-cancelx9.c
new file mode 100644
index 0000000..9d84663
--- /dev/null
+++ b/ap/build/uClibc/test/nptl/tst-cancelx9.c
@@ -0,0 +1 @@
+#include "tst-cancel9.c"
diff --git a/ap/build/uClibc/test/nptl/tst-cleanup0.c b/ap/build/uClibc/test/nptl/tst-cleanup0.c
new file mode 100644
index 0000000..6fc2209
--- /dev/null
+++ b/ap/build/uClibc/test/nptl/tst-cleanup0.c
@@ -0,0 +1,76 @@
+/* Copyright (C) 2002, 2003 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+   Contributed by Ulrich Drepper <drepper@redhat.com>, 2002.
+
+   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>
+#include <stdio.h>
+#include <stdlib.h>
+#include <unistd.h>
+
+
+static int global;
+
+
+static void
+ch (void *arg)
+{
+  int val = (long int) arg;
+
+  printf ("ch (%d)\n", val);
+
+  global *= val;
+  global += val;
+}
+
+
+static void
+endfct (void)
+{
+  /* We force exit right here.  */
+  _exit (global);
+}
+
+
+static int
+do_test (void)
+{
+  atexit (endfct);
+
+  pthread_cancel (pthread_self ());
+
+  pthread_cleanup_push (ch, (void *) 1l);
+
+  pthread_cleanup_push (ch, (void *) 2l);
+
+  pthread_cleanup_push (ch, (void *) 3l);
+
+//  pthread_setcanceltype (PTHREAD_CANCEL_ASYNCHRONOUS, NULL);
+
+  pthread_cleanup_pop (1);
+
+  pthread_cleanup_pop (1);
+
+  pthread_cleanup_pop (1);
+
+  return 100;
+}
+
+
+#define EXPECTED_STATUS 9
+#define TEST_FUNCTION do_test ()
+#include "../test-skeleton.c"
diff --git a/ap/build/uClibc/test/nptl/tst-cleanup1.c b/ap/build/uClibc/test/nptl/tst-cleanup1.c
new file mode 100644
index 0000000..2230e0f
--- /dev/null
+++ b/ap/build/uClibc/test/nptl/tst-cleanup1.c
@@ -0,0 +1,100 @@
+/* Copyright (C) 2002, 2003 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+   Contributed by Ulrich Drepper <drepper@redhat.com>, 2002.
+
+   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>
+#include <stdio.h>
+#include <stdlib.h>
+#include <unistd.h>
+
+
+static int global;
+
+
+static void
+ch (void *arg)
+{
+  int val = (long int) arg;
+
+  printf ("ch (%d)\n", val);
+
+  global *= val;
+  global += val;
+}
+
+
+static void *
+tf (void *a)
+{
+  pthread_cancel (pthread_self ());
+
+  pthread_cleanup_push (ch, (void *) 1l);
+
+  pthread_cleanup_push (ch, (void *) 2l);
+
+  pthread_cleanup_push (ch, (void *) 3l);
+
+  pthread_setcanceltype (PTHREAD_CANCEL_ASYNCHRONOUS, NULL);
+
+  pthread_cleanup_pop (1);
+
+  pthread_cleanup_pop (1);
+
+  pthread_cleanup_pop (1);
+
+  return NULL;
+}
+
+
+int
+do_test (void)
+{
+  pthread_t th;
+
+  if (pthread_create (&th, NULL, tf, NULL) != 0)
+    {
+      write (2, "create failed\n", 14);
+      _exit (1);
+    }
+
+  void *r;
+  int e;
+  if ((e = pthread_join (th, &r)) != 0)
+    {
+      printf ("join failed: %d\n", e);
+      _exit (1);
+    }
+
+  if (r != PTHREAD_CANCELED)
+    {
+      puts ("thread not canceled");
+      exit (1);
+    }
+
+  if (global != 9)
+    {
+      printf ("global = %d, expected 9\n", global);
+      exit (1);
+    }
+
+  return 0;
+}
+
+
+#define TEST_FUNCTION do_test ()
+#include "../test-skeleton.c"
diff --git a/ap/build/uClibc/test/nptl/tst-cleanup2.c b/ap/build/uClibc/test/nptl/tst-cleanup2.c
new file mode 100644
index 0000000..30e10b1
--- /dev/null
+++ b/ap/build/uClibc/test/nptl/tst-cleanup2.c
@@ -0,0 +1,63 @@
+/* Copyright (C) 2003 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+   Contributed by Bao Duong <bduong@progress.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, write to the Free
+   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+   02111-1307 USA.  */
+
+#include <setjmp.h>
+#include <signal.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <sys/types.h>
+
+static sigjmp_buf jmpbuf;
+
+static void
+sig_handler (int signo)
+{
+  siglongjmp (jmpbuf, 1);
+}
+
+static int
+do_test (void)
+{
+  char *p = NULL;
+  struct sigaction sa;
+
+  sa.sa_handler = sig_handler;
+  sigemptyset (&sa.sa_mask);
+  sa.sa_flags = SA_SIGINFO;
+
+  if (sigaction (SIGSEGV, &sa, 0))
+    {
+      perror ("installing SIGSEGV handler\n");
+      exit (1);
+    }
+
+  puts ("Attempting to sprintf to null ptr");
+  if (setjmp (jmpbuf))
+    {
+      puts ("Exiting main...");
+      return 0;
+    }
+
+  sprintf (p, "This should segv\n");
+
+  return 1;
+}
+
+#define TEST_FUNCTION do_test ()
+#include "../test-skeleton.c"
diff --git a/ap/build/uClibc/test/nptl/tst-cleanup3.c b/ap/build/uClibc/test/nptl/tst-cleanup3.c
new file mode 100644
index 0000000..c442773
--- /dev/null
+++ b/ap/build/uClibc/test/nptl/tst-cleanup3.c
@@ -0,0 +1,98 @@
+/* Copyright (C) 2003 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, write to the Free
+   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+   02111-1307 USA.  */
+
+#include <pthread.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <unistd.h>
+
+
+static int global;
+
+
+static void
+ch (void *arg)
+{
+  int val = (long int) arg;
+
+  printf ("ch (%d)\n", val);
+
+  global *= val;
+  global += val;
+}
+
+
+static void *
+tf (void *a)
+{
+  pthread_cleanup_push (ch, (void *) 1l);
+
+  pthread_cleanup_push (ch, (void *) 2l);
+
+  pthread_cleanup_push (ch, (void *) 3l);
+
+  pthread_exit ((void *) 1l);
+
+  pthread_cleanup_pop (1);
+
+  pthread_cleanup_pop (1);
+
+  pthread_cleanup_pop (1);
+
+  return NULL;
+}
+
+
+int
+do_test (void)
+{
+  pthread_t th;
+
+  if (pthread_create (&th, NULL, tf, NULL) != 0)
+    {
+      write (2, "create failed\n", 14);
+      _exit (1);
+    }
+
+  void *r;
+  int e;
+  if ((e = pthread_join (th, &r)) != 0)
+    {
+      printf ("join failed: %d\n", e);
+      _exit (1);
+    }
+
+  if (r != (void *) 1l)
+    {
+      puts ("thread not canceled");
+      exit (1);
+    }
+
+  if (global != 9)
+    {
+      printf ("global = %d, expected 9\n", global);
+      exit (1);
+    }
+
+  return 0;
+}
+
+
+#define TEST_FUNCTION do_test ()
+#include "../test-skeleton.c"
diff --git a/ap/build/uClibc/test/nptl/tst-cleanup4.c b/ap/build/uClibc/test/nptl/tst-cleanup4.c
new file mode 100644
index 0000000..1489fd3
--- /dev/null
+++ b/ap/build/uClibc/test/nptl/tst-cleanup4.c
@@ -0,0 +1,198 @@
+/* Copyright (C) 2003 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+   Contributed by Jakub Jelinek <jakub@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, write to the Free
+   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+   02111-1307 USA.  */
+
+#include <pthread.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <unistd.h>
+
+/* LinuxThreads pthread_cleanup_{push,pop} helpers.  */
+extern void _pthread_cleanup_push (struct _pthread_cleanup_buffer *__buffer,
+                                   void (*__routine) (void *),
+                                   void *__arg);
+extern void _pthread_cleanup_pop (struct _pthread_cleanup_buffer *__buffer,
+                                  int __execute);
+
+static int fds[2];
+static pthread_barrier_t b2;
+static int global;
+
+/* Defined in tst-cleanup4aux.c, never compiled with -fexceptions.  */
+extern void fn5 (void);
+extern void fn7 (void);
+extern void fn9 (void);
+
+void
+clh (void *arg)
+{
+  int val = (long int) arg;
+
+  printf ("clh (%d)\n", val);
+
+  global *= val;
+  global += val;
+}
+
+
+static __attribute__((noinline)) void
+fn_read (void)
+{
+  int r = pthread_barrier_wait (&b2);
+  if (r != 0 && r != PTHREAD_BARRIER_SERIAL_THREAD)
+    {
+      printf ("%s: barrier_wait failed\n", __FUNCTION__);
+      exit (1);
+    }
+
+  char c;
+  read (fds[0], &c, 1);
+}
+
+
+__attribute__((noinline)) void
+fn0 (void)
+{
+  pthread_cleanup_push (clh, (void *) 1l);
+
+  fn_read ();
+
+  pthread_cleanup_pop (1);
+}
+
+
+__attribute__((noinline)) void
+fn1 (void)
+{
+  /* This is the old LinuxThreads pthread_cleanup_{push,pop}.  */
+  struct _pthread_cleanup_buffer b;
+  _pthread_cleanup_push (&b, clh, (void *) 2l);
+
+  fn0 ();
+
+  _pthread_cleanup_pop (&b, 1);
+}
+
+
+static __attribute__((noinline)) void
+fn2 (void)
+{
+  pthread_cleanup_push (clh, (void *) 3l);
+
+  fn1 ();
+
+  pthread_cleanup_pop (1);
+}
+
+
+static void *
+tf (void *a)
+{
+  switch ((long) a)
+    {
+    case 0:
+      fn2 ();
+      break;
+    case 1:
+      fn5 ();
+      break;
+    case 2:
+      fn7 ();
+      break;
+    case 3:
+      fn9 ();
+      break;
+    }
+
+  return NULL;
+}
+
+
+int
+do_test (void)
+{
+  int result = 0;
+
+  if (pipe (fds) != 0)
+    {
+      puts ("pipe failed");
+      exit (1);
+    }
+
+  if (pthread_barrier_init (&b2, NULL, 2) != 0)
+    {
+      puts ("b2 init failed");
+      exit (1);
+    }
+
+  const int expect[] =
+    {
+      15,	/* 1 2 3 */
+      276,	/* 1 4 5 6 */
+      120,	/* 1 7 8 */
+      460	/* 1 2 9 10 */
+    };
+
+  long i;
+  for (i = 0; i < 4; ++i)
+    {
+      global = 0;
+
+      printf ("test %ld\n", i);
+
+      pthread_t th;
+      if (pthread_create (&th, NULL, tf, (void *) i) != 0)
+	{
+	  puts ("create failed");
+	  exit (1);
+	}
+
+      int e = pthread_barrier_wait (&b2);
+      if (e != 0 && e != PTHREAD_BARRIER_SERIAL_THREAD)
+	{
+	  printf ("%s: barrier_wait failed\n", __FUNCTION__);
+	  exit (1);
+	}
+
+      pthread_cancel (th);
+
+      void *r;
+      if ((e = pthread_join (th, &r)) != 0)
+	{
+	  printf ("join failed: %d\n", e);
+	  _exit (1);
+	}
+
+      if (r != PTHREAD_CANCELED)
+	{
+	  puts ("thread not canceled");
+	  exit (1);
+	}
+
+      if (global != expect[i])
+	{
+	  printf ("global = %d, expected %d\n", global, expect[i]);
+	  result = 1;
+	}
+    }
+
+  return result;
+}
+
+#define TEST_FUNCTION do_test ()
+#include "../test-skeleton.c"
diff --git a/ap/build/uClibc/test/nptl/tst-cleanup4aux.c b/ap/build/uClibc/test/nptl/tst-cleanup4aux.c
new file mode 100644
index 0000000..cd1a89a
--- /dev/null
+++ b/ap/build/uClibc/test/nptl/tst-cleanup4aux.c
@@ -0,0 +1,121 @@
+/* Copyright (C) 2003 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+   Contributed by Jakub Jelinek <jakub@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, write to the Free
+   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+   02111-1307 USA.  */
+
+#include <pthread.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <unistd.h>
+
+extern void _pthread_cleanup_push (struct _pthread_cleanup_buffer *__buffer,
+                                   void (*__routine) (void *),
+                                   void *__arg);
+extern void _pthread_cleanup_pop (struct _pthread_cleanup_buffer *__buffer,
+                                  int __execute);
+
+extern void clh (void *arg);
+extern void fn0 (void);
+extern void fn1 (void);
+extern void fn5 (void);
+extern void fn7 (void);
+extern void fn9 (void);
+
+
+static __attribute__((noinline)) void
+fn3 (void)
+{
+  /* This is the old LinuxThreads pthread_cleanup_{push,pop}.  */
+     struct _pthread_cleanup_buffer b;
+  _pthread_cleanup_push (&b, clh, (void *) 4l);
+
+  fn0 ();
+
+  _pthread_cleanup_pop (&b, 1);
+}
+
+
+static __attribute__((noinline)) void
+fn4 (void)
+{
+  pthread_cleanup_push (clh, (void *) 5l);
+
+  fn3 ();
+
+  pthread_cleanup_pop (1);
+}
+
+
+void
+fn5 (void)
+{
+  /* This is the old LinuxThreads pthread_cleanup_{push,pop}.  */
+     struct _pthread_cleanup_buffer b;
+  _pthread_cleanup_push (&b, clh, (void *) 6l);
+
+  fn4 ();
+
+  _pthread_cleanup_pop (&b, 1);
+}
+
+
+static __attribute__((noinline)) void
+fn6 (void)
+{
+  pthread_cleanup_push (clh, (void *) 7l);
+
+  fn0 ();
+
+  pthread_cleanup_pop (1);
+}
+
+
+void
+fn7 (void)
+{
+  /* This is the old LinuxThreads pthread_cleanup_{push,pop}.  */
+     struct _pthread_cleanup_buffer b;
+  _pthread_cleanup_push (&b, clh, (void *) 8l);
+
+  fn6 ();
+
+  _pthread_cleanup_pop (&b, 1);
+}
+
+
+static __attribute__((noinline)) void
+fn8 (void)
+{
+  pthread_cleanup_push (clh, (void *) 9l);
+
+  fn1 ();
+
+  pthread_cleanup_pop (1);
+}
+
+
+void
+fn9 (void)
+{
+  /* This is the old LinuxThreads pthread_cleanup_{push,pop}.  */
+     struct _pthread_cleanup_buffer b;
+  _pthread_cleanup_push (&b, clh, (void *) 10l);
+
+  fn8 ();
+
+  _pthread_cleanup_pop (&b, 1);
+}
diff --git a/ap/build/uClibc/test/nptl/tst-cleanupx0.c b/ap/build/uClibc/test/nptl/tst-cleanupx0.c
new file mode 100644
index 0000000..0012ab1
--- /dev/null
+++ b/ap/build/uClibc/test/nptl/tst-cleanupx0.c
@@ -0,0 +1 @@
+#include "tst-cleanup0.c"
diff --git a/ap/build/uClibc/test/nptl/tst-cleanupx1.c b/ap/build/uClibc/test/nptl/tst-cleanupx1.c
new file mode 100644
index 0000000..21e9e58
--- /dev/null
+++ b/ap/build/uClibc/test/nptl/tst-cleanupx1.c
@@ -0,0 +1 @@
+#include "tst-cleanup1.c"
diff --git a/ap/build/uClibc/test/nptl/tst-cleanupx2.c b/ap/build/uClibc/test/nptl/tst-cleanupx2.c
new file mode 100644
index 0000000..8b9e350
--- /dev/null
+++ b/ap/build/uClibc/test/nptl/tst-cleanupx2.c
@@ -0,0 +1 @@
+#include "tst-cleanup2.c"
diff --git a/ap/build/uClibc/test/nptl/tst-cleanupx3.c b/ap/build/uClibc/test/nptl/tst-cleanupx3.c
new file mode 100644
index 0000000..90baf90
--- /dev/null
+++ b/ap/build/uClibc/test/nptl/tst-cleanupx3.c
@@ -0,0 +1 @@
+#include "tst-cleanup3.c"
diff --git a/ap/build/uClibc/test/nptl/tst-cleanupx4.c b/ap/build/uClibc/test/nptl/tst-cleanupx4.c
new file mode 100644
index 0000000..8dea954
--- /dev/null
+++ b/ap/build/uClibc/test/nptl/tst-cleanupx4.c
@@ -0,0 +1 @@
+#include "tst-cleanup4.c"
diff --git a/ap/build/uClibc/test/nptl/tst-clock.c b/ap/build/uClibc/test/nptl/tst-clock.c
new file mode 100644
index 0000000..f2f1887
--- /dev/null
+++ b/ap/build/uClibc/test/nptl/tst-clock.c
@@ -0,0 +1,124 @@
+/* Test program for POSIX clock_* functions.
+   Copyright (C) 2000 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+   Contributed by Ulrich Drepper <drepper@cygnus.com>, 2000.
+
+   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 <stdio.h>
+#include <string.h>
+#include <time.h>
+
+
+/* We want to see output immediately.  */
+#define STDOUT_UNBUFFERED
+
+/* We expect to run at least 10 seconds.  */
+#define TIMEOUT 15
+
+static int
+clock_test (clockid_t cl)
+{
+  struct timespec old_ts;
+  struct timespec ts;
+  struct timespec waitit;
+  int result = 0;
+  int i;
+
+  memset (&ts, '\0', sizeof ts);
+
+  waitit.tv_sec = 0;
+  waitit.tv_nsec = 500000000;
+
+  /* Get and print resolution of the clock.  */
+  if (clock_getres (cl, &ts) == 0)
+    {
+      if (ts.tv_nsec < 0 || ts.tv_nsec >= 1000000000)
+	{
+	  printf ("clock %d: nanosecond value of resolution wrong\n", cl);
+	  result = 1;
+	}
+      else
+	printf ("clock %d: resolution = %ld.%09ld secs\n",
+		cl, ts.tv_sec, ts.tv_nsec);
+    }
+  else
+    {
+      printf ("clock %d: cannot get resolution\n", cl);
+      result = 1;
+    }
+
+  memset (&ts, '\0', sizeof ts);
+  memset (&old_ts, '\0', sizeof old_ts);
+
+  /* Next get the current time value a few times.  */
+  for (i = 0; i < 10; ++i)
+    {
+      if (clock_gettime (cl, &ts) == 0)
+	{
+	  if (ts.tv_nsec < 0 || ts.tv_nsec >= 1000000000)
+	    {
+	      printf ("clock %d: nanosecond value of time wrong (try %d)\n",
+		      cl, i);
+	      result = 1;
+	    }
+	  else
+	    {
+	      printf ("clock %d: time = %ld.%09ld secs\n",
+		      cl, ts.tv_sec, ts.tv_nsec);
+
+	      if (memcmp (&ts, &old_ts, sizeof ts) == 0)
+		{
+		  printf ("clock %d: time hasn't changed (try %d)\n", cl, i);
+		  result = 1;
+
+		  old_ts = ts;
+		}
+	    }
+	}
+      else
+	{
+	  printf ("clock %d: cannot get time (try %d)\n", cl, i);
+	  result = 1;
+	}
+
+      /* Wait a bit before the next iteration.  */
+      nanosleep (&waitit, NULL);
+    }
+
+  return result;
+}
+
+static int
+do_test (void)
+{
+  clockid_t cl;
+  int result;
+
+  result = clock_test (CLOCK_REALTIME);
+
+  if (clock_getcpuclockid (0, &cl) == 0)
+    /* XXX It's not yet a bug when this fails.  */
+    clock_test (cl);
+  else
+	  printf("CPU clock unavailble, skipping test\n");
+
+  return result;
+}
+#define TEST_FUNCTION do_test ()
+
+
+#include "../test-skeleton.c"
diff --git a/ap/build/uClibc/test/nptl/tst-clock1.c b/ap/build/uClibc/test/nptl/tst-clock1.c
new file mode 100644
index 0000000..0848d77
--- /dev/null
+++ b/ap/build/uClibc/test/nptl/tst-clock1.c
@@ -0,0 +1,51 @@
+/* Copyright (C) 2003, 2004 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, write to the Free
+   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+   02111-1307 USA.  */
+
+#include <pthread.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <time.h>
+#include <unistd.h>
+
+
+int
+do_test (void)
+{
+#if defined _POSIX_THREAD_CPUTIME && _POSIX_THREAD_CPUTIME >= 0
+  clockid_t cl;
+  /* This is really only a linking-test here.  */
+  int e = pthread_getcpuclockid (pthread_self (), &cl);
+  if (e != 0)
+    {
+# if _POSIX_THREAD_CPUTIME == 0
+      if (sysconf (_SC_THREAD_CPUTIME) >= 0)
+# endif
+	{
+	  puts ("cpuclock advertized, but cannot get ID");
+	  exit (1);
+	}
+    }
+#endif
+
+  return 0;
+}
+
+
+#define TEST_FUNCTION do_test ()
+#include "../test-skeleton.c"
diff --git a/ap/build/uClibc/test/nptl/tst-clock2.c b/ap/build/uClibc/test/nptl/tst-clock2.c
new file mode 100644
index 0000000..bca4095
--- /dev/null
+++ b/ap/build/uClibc/test/nptl/tst-clock2.c
@@ -0,0 +1,202 @@
+/* Copyright (C) 2003, 2004 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, write to the Free
+   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+   02111-1307 USA.  */
+
+#include <errno.h>
+#include <pthread.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <time.h>
+#include <unistd.h>
+
+
+#if defined _POSIX_THREAD_CPUTIME && _POSIX_THREAD_CPUTIME >= 0
+static pthread_barrier_t b2;
+static pthread_barrier_t bN;
+
+
+static void *
+tf (void *arg)
+{
+  int e = pthread_barrier_wait (&b2);
+  if (e != 0 && e != PTHREAD_BARRIER_SERIAL_THREAD)
+    {
+      puts ("barrier_wait failed");
+      exit (1);
+    }
+
+  e = pthread_barrier_wait (&bN);
+  if (e != 0 && e != PTHREAD_BARRIER_SERIAL_THREAD)
+    {
+      puts ("barrier_wait failed");
+      exit (1);
+    }
+
+  return NULL;
+}
+#endif
+
+
+int
+do_test (void)
+{
+#if defined _POSIX_THREAD_CPUTIME && _POSIX_THREAD_CPUTIME >= 0
+# define N 10
+
+# if _POSIX_THREAD_CPUTIME == 0
+  if (sysconf (_SC_THREAD_CPUTIME) < 0)
+    {
+      puts ("_POSIX_THREAD_CPUTIME option not available");
+      return 0;
+    }
+# endif
+
+  if (pthread_barrier_init (&b2, NULL, 2) != 0
+      || pthread_barrier_init (&bN, NULL, N + 1) != 0)
+    {
+      puts ("barrier_init failed");
+      return 1;
+    }
+
+  struct timespec ts = { .tv_sec = 0, .tv_nsec = 100000000 };
+  TEMP_FAILURE_RETRY (nanosleep (&ts, &ts));
+
+  pthread_t th[N + 1];
+  clockid_t cl[N + 1];
+# ifndef CLOCK_THREAD_CPUTIME_ID
+  if (pthread_getcpuclockid (pthread_self (), &cl[0]) != 0)
+    {
+      puts ("own pthread_getcpuclockid failed");
+      return 1;
+    }
+# else
+  cl[0] = CLOCK_THREAD_CPUTIME_ID;
+# endif
+
+  pthread_attr_t at;
+
+  if (pthread_attr_init (&at) != 0)
+    {
+      puts ("attr_init failed");
+      return 1;
+    }
+
+  if (pthread_attr_setstacksize (&at, 1 * 1024 * 1024) != 0)
+    {
+      puts ("attr_setstacksize failed");
+      return 1;
+    }
+
+  int i;
+  int e;
+  for (i = 0; i < N; ++i)
+    {
+      if (pthread_create (&th[i], &at, tf, NULL) != 0)
+	{
+	  puts ("create failed");
+	  return 1;
+	}
+
+      e = pthread_barrier_wait (&b2);
+      if (e != 0 && e != PTHREAD_BARRIER_SERIAL_THREAD)
+	{
+	  puts ("barrier_wait failed");
+	  return 1;
+	}
+
+      ts.tv_sec = 0;
+      ts.tv_nsec = 100000000;
+      TEMP_FAILURE_RETRY (nanosleep (&ts, &ts));
+
+      if (pthread_getcpuclockid (th[i], &cl[i + 1]) != 0)
+	{
+	  puts ("pthread_getcpuclockid failed");
+	  return 1;
+	}
+    }
+
+  if (pthread_attr_destroy (&at) != 0)
+    {
+      puts ("attr_destroy failed");
+      return 1;
+    }
+
+  struct timespec t[N + 1];
+  for (i = 0; i < N + 1; ++i)
+    if (clock_gettime (cl[i], &t[i]) != 0)
+      {
+	printf ("clock_gettime round %d failed\n", i);
+	return 1;
+      }
+
+  for (i = 0; i < N; ++i)
+    {
+      struct timespec diff;
+
+      diff.tv_sec = t[i].tv_sec - t[i + 1].tv_sec;
+      diff.tv_nsec = t[i].tv_nsec - t[i + 1].tv_nsec;
+      if (diff.tv_nsec < 0)
+	{
+	  diff.tv_nsec += 1000000000;
+	  --diff.tv_sec;
+	}
+
+      if (diff.tv_sec < 0 || (diff.tv_sec == 0 && diff.tv_nsec < 100000000))
+	{
+	  printf ("\
+difference between thread %d and %d too small (%ld.%09ld)\n",
+		  i, i + 1, (long int) diff.tv_sec, (long int) diff.tv_nsec);
+	  return 1;
+	}
+
+      printf ("diff %d->%d: %ld.%09ld\n",
+	      i, i + 1, (long int) diff.tv_sec, (long int) diff.tv_nsec);
+    }
+
+  ts.tv_sec = 0;
+  ts.tv_nsec = 0;
+  for (i = 0; i < N + 1; ++i)
+    if (clock_settime (cl[i], &ts) != 0)
+      {
+	printf ("clock_settime(%d) round %d failed\n", cl[i], i);
+	return 1;
+      }
+
+  for (i = 0; i < N + 1; ++i)
+    {
+      if (clock_gettime (cl[i], &ts) != 0)
+	{
+	  puts ("clock_gettime failed");
+	  return 1;
+	}
+
+      if (ts.tv_sec > t[i].tv_sec
+	  || (ts.tv_sec == t[i].tv_sec && ts.tv_nsec > t[i].tv_nsec))
+	{
+	  puts ("clock_settime didn't reset clock");
+	  return 1;
+	}
+    }
+#endif
+
+  return 0;
+}
+
+
+#define TEST_FUNCTION do_test ()
+#include "../test-skeleton.c"
diff --git a/ap/build/uClibc/test/nptl/tst-clock_nanosleep.c b/ap/build/uClibc/test/nptl/tst-clock_nanosleep.c
new file mode 100644
index 0000000..98a8b5f
--- /dev/null
+++ b/ap/build/uClibc/test/nptl/tst-clock_nanosleep.c
@@ -0,0 +1,58 @@
+/* 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 <errno.h>
+#include <stdio.h>
+#include <unistd.h>
+#include <sys/time.h>
+#include <time.h>
+
+
+/* Test that clock_nanosleep() does sleep.  */
+static int
+do_test (void)
+{
+  /* Current time.  */
+  struct timeval tv1;
+  (void) gettimeofday (&tv1, NULL);
+
+  struct timespec ts;
+  ts.tv_sec = 1;
+  ts.tv_nsec = 0;
+  TEMP_FAILURE_RETRY (clock_nanosleep (CLOCK_REALTIME, 0, &ts, &ts));
+
+  /* At least one second must have passed.  */
+  struct timeval tv2;
+  (void) gettimeofday (&tv2, NULL);
+
+  tv2.tv_sec -= tv1.tv_sec;
+  tv2.tv_usec -= tv1.tv_usec;
+  if (tv2.tv_usec < 0)
+    --tv2.tv_sec;
+
+  if (tv2.tv_sec < 1)
+    {
+      puts ("clock_nanosleep didn't sleep long enough");
+      return 1;
+    }
+
+  return 0;
+}
+
+#define TEST_FUNCTION do_test ()
+#include "../test-skeleton.c"
diff --git a/ap/build/uClibc/test/nptl/tst-cond1.c b/ap/build/uClibc/test/nptl/tst-cond1.c
new file mode 100644
index 0000000..46085c2
--- /dev/null
+++ b/ap/build/uClibc/test/nptl/tst-cond1.c
@@ -0,0 +1,94 @@
+/* Copyright (C) 2002 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+   Contributed by Ulrich Drepper <drepper@redhat.com>, 2002.
+
+   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 <error.h>
+#include <pthread.h>
+#include <stdio.h>
+#include <stdlib.h>
+
+
+static pthread_cond_t cond = PTHREAD_COND_INITIALIZER;
+static pthread_mutex_t mut = PTHREAD_MUTEX_INITIALIZER;
+
+
+static void *
+tf (void *p)
+{
+  int err;
+
+  err = pthread_mutex_lock (&mut);
+  if (err != 0)
+    error (EXIT_FAILURE, err, "child: cannot get mutex");
+
+  puts ("child: got mutex; signalling");
+
+  pthread_cond_signal (&cond);
+
+  puts ("child: unlock");
+
+  err = pthread_mutex_unlock (&mut);
+  if (err != 0)
+    error (EXIT_FAILURE, err, "child: cannot unlock");
+
+  puts ("child: done");
+
+  return NULL;
+}
+
+
+static int
+do_test (void)
+{
+  pthread_t th;
+  int err;
+
+  printf ("&cond = %p\n&mut = %p\n", &cond, &mut);
+
+  puts ("parent: get mutex");
+
+  err = pthread_mutex_lock (&mut);
+  if (err != 0)
+    error (EXIT_FAILURE, err, "parent: cannot get mutex");
+
+  puts ("parent: create child");
+
+  err = pthread_create (&th, NULL, tf, NULL);
+  if (err != 0)
+    error (EXIT_FAILURE, err, "parent: cannot create thread");
+
+  puts ("parent: wait for condition");
+
+  err = pthread_cond_wait (&cond, &mut);
+  if (err != 0)
+    error (EXIT_FAILURE, err, "parent: cannot wait fir signal");
+
+  puts ("parent: got signal");
+
+  err = pthread_join (th, NULL);
+  if (err != 0)
+    error (EXIT_FAILURE, err, "parent: failed to join");
+
+  puts ("done");
+
+  return 0;
+}
+
+
+#define TEST_FUNCTION do_test ()
+#include "../test-skeleton.c"
diff --git a/ap/build/uClibc/test/nptl/tst-cond10.c b/ap/build/uClibc/test/nptl/tst-cond10.c
new file mode 100644
index 0000000..34956d4
--- /dev/null
+++ b/ap/build/uClibc/test/nptl/tst-cond10.c
@@ -0,0 +1,173 @@
+/* Copyright (C) 2003, 2004 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, write to the Free
+   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+   02111-1307 USA.  */
+
+#include <error.h>
+#include <pthread.h>
+#include <stdbool.h>
+#include <stdio.h>
+#include <stdlib.h>
+
+
+#define N 10
+#define ROUNDS 100
+
+static pthread_cond_t cond = PTHREAD_COND_INITIALIZER;
+static pthread_mutex_t mut = PTHREAD_MUTEX_INITIALIZER;
+static pthread_barrier_t bN1;
+static pthread_barrier_t b2;
+
+
+static void *
+tf (void *p)
+{
+  if (pthread_mutex_lock (&mut) != 0)
+    {
+      puts ("child: 1st mutex_lock failed");
+      exit (1);
+    }
+
+  int e = pthread_barrier_wait (&b2);
+  if (e != 0 && e != PTHREAD_BARRIER_SERIAL_THREAD)
+    {
+      puts ("child: 1st barrier_wait failed");
+      exit (1);
+    }
+
+  if (pthread_cond_wait (&cond, &mut) != 0)
+    {
+      puts ("child: cond_wait failed");
+      exit (1);
+    }
+
+  if (pthread_mutex_unlock (&mut) != 0)
+    {
+      puts ("child: mutex_unlock failed");
+      exit (1);
+    }
+
+  e = pthread_barrier_wait (&bN1);
+  if (e != 0 && e != PTHREAD_BARRIER_SERIAL_THREAD)
+    {
+      puts ("child: 2nd barrier_wait failed");
+      exit (1);
+    }
+
+  return NULL;
+}
+
+
+static int
+do_test (void)
+{
+  if (pthread_barrier_init (&bN1, NULL, N + 1) != 0)
+    {
+      puts ("barrier_init failed");
+      exit (1);
+    }
+
+  if (pthread_barrier_init (&b2, NULL, 2) != 0)
+    {
+      puts ("barrier_init failed");
+      exit (1);
+    }
+
+  pthread_attr_t at;
+
+  if (pthread_attr_init (&at) != 0)
+    {
+      puts ("attr_init failed");
+      return 1;
+    }
+
+  if (pthread_attr_setstacksize (&at, 1 * 1024 * 1024) != 0)
+    {
+      puts ("attr_setstacksize failed");
+      return 1;
+    }
+
+  int r;
+  for (r = 0; r < ROUNDS; ++r)
+    {
+      printf ("round %d\n", r + 1);
+
+      int i;
+      pthread_t th[N];
+      for (i = 0; i < N; ++i)
+	{
+	  if (pthread_create (&th[i], &at, tf, NULL) != 0)
+	    {
+	      puts ("create failed");
+	      exit (1);
+	    }
+
+	  int e = pthread_barrier_wait (&b2);
+	  if (e != 0 && e != PTHREAD_BARRIER_SERIAL_THREAD)
+	    {
+	      puts ("parent: 1st barrier_wait failed");
+	      exit (1);
+	    }
+	}
+
+      if (pthread_mutex_lock (&mut) != 0)
+	{
+	  puts ("parent: mutex_lock failed");
+	  exit (1);
+	}
+      if (pthread_mutex_unlock (&mut) != 0)
+	{
+	  puts ("parent: mutex_unlock failed");
+	  exit (1);
+	}
+
+      /* N single signal calls.  Without locking.  This tests that no
+	 signal gets lost.  */
+      for (i = 0; i < N; ++i)
+	if (pthread_cond_signal (&cond) != 0)
+	  {
+	    puts ("cond_signal failed");
+	    exit (1);
+	  }
+
+      int e = pthread_barrier_wait (&bN1);
+      if (e != 0 && e != PTHREAD_BARRIER_SERIAL_THREAD)
+	{
+	  puts ("parent: 2nd barrier_wait failed");
+	  exit (1);
+	}
+
+      for (i = 0; i < N; ++i)
+	if (pthread_join (th[i], NULL) != 0)
+	  {
+	    puts ("join failed");
+	    exit (1);
+	  }
+    }
+
+  if (pthread_attr_destroy (&at) != 0)
+    {
+      puts ("attr_destroy failed");
+      return 1;
+    }
+
+  return 0;
+}
+
+
+#define TEST_FUNCTION do_test ()
+#include "../test-skeleton.c"
diff --git a/ap/build/uClibc/test/nptl/tst-cond11.c b/ap/build/uClibc/test/nptl/tst-cond11.c
new file mode 100644
index 0000000..0de4d56
--- /dev/null
+++ b/ap/build/uClibc/test/nptl/tst-cond11.c
@@ -0,0 +1,191 @@
+/* Copyright (C) 2003, 2004 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, write to the Free
+   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+   02111-1307 USA.  */
+
+#include <errno.h>
+#include <pthread.h>
+#include <stdio.h>
+#include <time.h>
+#include <unistd.h>
+
+
+#if defined _POSIX_CLOCK_SELECTION && _POSIX_CLOCK_SELECTION >= 0
+static int
+run_test (clockid_t cl)
+{
+  pthread_condattr_t condattr;
+  pthread_cond_t cond;
+  pthread_mutexattr_t mutattr;
+  pthread_mutex_t mut;
+
+  printf ("clock = %d\n", (int) cl);
+
+  if (pthread_condattr_init (&condattr) != 0)
+    {
+      puts ("condattr_init failed");
+      return 1;
+    }
+
+  if (pthread_condattr_setclock (&condattr, cl) != 0)
+    {
+      puts ("condattr_setclock failed");
+      return 1;
+    }
+
+  clockid_t cl2;
+  if (pthread_condattr_getclock (&condattr, &cl2) != 0)
+    {
+      puts ("condattr_getclock failed");
+      return 1;
+    }
+  if (cl != cl2)
+    {
+      printf ("condattr_getclock returned wrong value: %d, expected %d\n",
+	      (int) cl2, (int) cl);
+      return 1;
+    }
+
+  if (pthread_cond_init (&cond, &condattr) != 0)
+    {
+      puts ("cond_init failed");
+      return 1;
+    }
+
+  if (pthread_condattr_destroy (&condattr) != 0)
+    {
+      puts ("condattr_destroy failed");
+      return 1;
+    }
+
+  if (pthread_mutexattr_init (&mutattr) != 0)
+    {
+      puts ("mutexattr_init failed");
+      return 1;
+    }
+
+  if (pthread_mutexattr_settype (&mutattr, PTHREAD_MUTEX_ERRORCHECK) != 0)
+    {
+      puts ("mutexattr_settype failed");
+      return 1;
+    }
+
+  if (pthread_mutex_init (&mut, &mutattr) != 0)
+    {
+      puts ("mutex_init failed");
+      return 1;
+    }
+
+  if (pthread_mutexattr_destroy (&mutattr) != 0)
+    {
+      puts ("mutexattr_destroy failed");
+      return 1;
+    }
+
+  if (pthread_mutex_lock (&mut) != 0)
+    {
+      puts ("mutex_lock failed");
+      return 1;
+    }
+
+  if (pthread_mutex_lock (&mut) != EDEADLK)
+    {
+      puts ("2nd mutex_lock did not return EDEADLK");
+      return 1;
+    }
+
+  struct timespec ts;
+  if (clock_gettime (cl, &ts) != 0)
+    {
+      puts ("clock_gettime failed");
+      return 1;
+    }
+
+  /* Wait one second.  */
+  ++ts.tv_sec;
+
+  int e = pthread_cond_timedwait (&cond, &mut, &ts);
+  if (e == 0)
+    {
+      puts ("cond_timedwait succeeded");
+      return 1;
+    }
+  else if (e != ETIMEDOUT)
+    {
+      puts ("cond_timedwait did not return ETIMEDOUT");
+      return 1;
+    }
+
+  if (pthread_mutex_unlock (&mut) != 0)
+    {
+      puts ("mutex_unlock failed");
+      return 1;
+    }
+
+  if (pthread_mutex_destroy (&mut) != 0)
+    {
+      puts ("mutex_destroy failed");
+      return 1;
+    }
+
+  if (pthread_cond_destroy (&cond) != 0)
+    {
+      puts ("cond_destroy failed");
+      return 1;
+    }
+
+  return 0;
+}
+#endif
+
+
+static int
+do_test (void)
+{
+#if !defined _POSIX_CLOCK_SELECTION || _POSIX_CLOCK_SELECTION == -1
+
+  puts ("_POSIX_CLOCK_SELECTION not supported, test skipped");
+  return 0;
+
+#else
+
+  int res = run_test (CLOCK_REALTIME);
+
+# if defined _POSIX_MONOTONIC_CLOCK && _POSIX_MONOTONIC_CLOCK >= 0
+#  if _POSIX_MONOTONIC_CLOCK == 0
+  int e = sysconf (_SC_MONOTONIC_CLOCK);
+  if (e < 0)
+    puts ("CLOCK_MONOTONIC not supported");
+  else if (e == 0)
+    {
+      puts ("sysconf (_SC_MONOTONIC_CLOCK) must not return 0");
+      res = 1;
+    }
+  else
+#  endif
+    res |= run_test (CLOCK_MONOTONIC);
+# else
+  puts ("_POSIX_MONOTONIC_CLOCK not defined");
+# endif
+
+  return res;
+#endif
+}
+
+#define TIMEOUT 3
+#define TEST_FUNCTION do_test ()
+#include "../test-skeleton.c"
diff --git a/ap/build/uClibc/test/nptl/tst-cond12.c b/ap/build/uClibc/test/nptl/tst-cond12.c
new file mode 100644
index 0000000..03e4881
--- /dev/null
+++ b/ap/build/uClibc/test/nptl/tst-cond12.c
@@ -0,0 +1,196 @@
+/* Copyright (C) 2003 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, 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 <stdio.h>
+#include <stdlib.h>
+#include <unistd.h>
+#include <sys/mman.h>
+#include <sys/wait.h>
+
+
+static char fname[] = "/tmp/tst-cond12-XXXXXX";
+static int fd;
+
+
+static void prepare (void);
+#define PREPARE(argc, argv) prepare ()
+
+static int do_test (void);
+#define TEST_FUNCTION do_test ()
+
+#include "../test-skeleton.c"
+
+
+static void
+prepare (void)
+{
+  fd = mkstemp (fname);
+  if (fd == -1)
+    {
+      printf ("mkstemp failed: %m\n");
+      exit (1);
+    }
+  add_temp_file (fname);
+  if (ftruncate (fd, 1000) < 0)
+    {
+      printf ("ftruncate failed: %m\n");
+      exit (1);
+    }
+}
+
+
+static int
+do_test (void)
+{
+  struct
+  {
+    pthread_mutex_t m;
+    pthread_cond_t c;
+    int var;
+  } *p = mmap (NULL, sizeof (*p), PROT_READ|PROT_WRITE, MAP_SHARED, fd, 0);
+  if (p == MAP_FAILED)
+    {
+      printf ("initial mmap failed: %m\n");
+      return 1;
+    }
+
+  pthread_mutexattr_t ma;
+  if (pthread_mutexattr_init (&ma) != 0)
+    {
+      puts ("mutexattr_init failed");
+      return 1;
+    }
+  if (pthread_mutexattr_setpshared (&ma, 1) != 0)
+    {
+      puts ("mutexattr_setpshared failed");
+      return 1;
+    }
+  if (pthread_mutex_init (&p->m, &ma) != 0)
+    {
+      puts ("mutex_init failed");
+      return 1;
+    }
+  if (pthread_mutexattr_destroy (&ma) != 0)
+    {
+      puts ("mutexattr_destroy failed");
+      return 1;
+    }
+
+  pthread_condattr_t ca;
+  if (pthread_condattr_init (&ca) != 0)
+    {
+      puts ("condattr_init failed");
+      return 1;
+    }
+  if (pthread_condattr_setpshared (&ca, 1) != 0)
+    {
+      puts ("condattr_setpshared failed");
+      return 1;
+    }
+  if (pthread_cond_init (&p->c, &ca) != 0)
+    {
+      puts ("mutex_init failed");
+      return 1;
+    }
+  if (pthread_condattr_destroy (&ca) != 0)
+    {
+      puts ("condattr_destroy failed");
+      return 1;
+    }
+
+  if (pthread_mutex_lock (&p->m) != 0)
+    {
+      puts ("initial mutex_lock failed");
+      return 1;
+    }
+
+  p->var = 42;
+
+  pid_t pid = fork ();
+  if (pid == -1)
+    {
+      printf ("fork failed: %m\n");
+      return 1;
+    }
+
+  if (pid == 0)
+    {
+      void *oldp = p;
+      p = mmap (NULL, sizeof (*p), PROT_READ|PROT_WRITE, MAP_SHARED, fd, 0);
+
+      if (p == oldp)
+	{
+	  puts ("child: mapped to same address");
+	  kill (getppid (), SIGKILL);
+	  exit (1);
+	}
+
+      munmap (oldp, sizeof (*p));
+
+      if (pthread_mutex_lock (&p->m) != 0)
+	{
+	  puts ("child: mutex_lock failed");
+	  kill (getppid (), SIGKILL);
+	  exit (1);
+	}
+
+      p->var = 0;
+
+#ifndef USE_COND_SIGNAL
+      if (pthread_cond_broadcast (&p->c) != 0)
+	{
+	  puts ("child: cond_broadcast failed");
+	  kill (getppid (), SIGKILL);
+	  exit (1);
+	}
+#else
+      if (pthread_cond_signal (&p->c) != 0)
+	{
+	  puts ("child: cond_signal failed");
+	  kill (getppid (), SIGKILL);
+	  exit (1);
+	}
+#endif
+
+      if (pthread_mutex_unlock (&p->m) != 0)
+	{
+	  puts ("child: mutex_unlock failed");
+	  kill (getppid (), SIGKILL);
+	  exit (1);
+	}
+
+      exit (0);
+    }
+
+  do
+    pthread_cond_wait (&p->c, &p->m);
+  while (p->var != 0);
+
+  if (TEMP_FAILURE_RETRY (waitpid (pid, NULL, 0)) != pid)
+    {
+      printf ("waitpid failed: %m\n");
+      kill (pid, SIGKILL);
+      return 1;
+    }
+
+  return 0;
+}
diff --git a/ap/build/uClibc/test/nptl/tst-cond13.c b/ap/build/uClibc/test/nptl/tst-cond13.c
new file mode 100644
index 0000000..29d79b5
--- /dev/null
+++ b/ap/build/uClibc/test/nptl/tst-cond13.c
@@ -0,0 +1,2 @@
+#define USE_COND_SIGNAL 1
+#include "tst-cond12.c"
diff --git a/ap/build/uClibc/test/nptl/tst-cond14.c b/ap/build/uClibc/test/nptl/tst-cond14.c
new file mode 100644
index 0000000..106fa8c
--- /dev/null
+++ b/ap/build/uClibc/test/nptl/tst-cond14.c
@@ -0,0 +1,118 @@
+/* Copyright (C) 2004 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+   Contributed by Ulrich Drepper <drepper@redhat.com>, 2004.
+
+   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>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <unistd.h>
+
+
+static pthread_cond_t cond = PTHREAD_COND_INITIALIZER;
+static pthread_mutex_t mut = PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP;
+static pthread_mutex_t mut2 = PTHREAD_MUTEX_INITIALIZER;
+
+static void *
+tf (void *p)
+{
+  if (pthread_mutex_lock (&mut) != 0)
+    {
+      printf ("%s: 1st mutex_lock failed\n", __func__);
+      exit (1);
+    }
+  if (pthread_mutex_lock (&mut) != 0)
+    {
+      printf ("%s: 2nd mutex_lock failed\n", __func__);
+      exit (1);
+    }
+  if (pthread_mutex_lock (&mut) != 0)
+    {
+      printf ("%s: 3rd mutex_lock failed\n", __func__);
+      exit (1);
+    }
+
+  if (pthread_mutex_unlock (&mut2) != 0)
+    {
+      printf ("%s: mutex_unlock failed\n", __func__);
+      exit (1);
+    }
+
+  if (pthread_cond_wait (&cond, &mut) != 0)
+    {
+      printf ("%s: cond_wait failed\n", __func__);
+      exit (1);
+    }
+
+  puts ("child: done");
+
+  return NULL;
+}
+
+
+static int
+do_test (void)
+{
+  if (pthread_mutex_lock (&mut2) != 0)
+    {
+      puts ("1st mutex_lock failed");
+      return 1;
+    }
+
+  puts ("parent: create child");
+
+  pthread_t th;
+  int err = pthread_create (&th, NULL, tf, NULL);
+  if (err != 0)
+    {
+      printf ("parent: cannot create thread: %s\n", strerror (err));
+      return 1;
+    }
+
+  /* We have to synchronize with the child.  */
+  if (pthread_mutex_lock (&mut2) != 0)
+    {
+      puts ("2nd mutex_lock failed");
+      return 1;
+    }
+
+  /* Give the child to reach to pthread_cond_wait.  */
+  sleep (1);
+
+  if (pthread_cond_signal (&cond) != 0)
+    {
+      puts ("cond_signal failed");
+      return 1;
+    }
+
+  err = pthread_join (th, NULL);
+  if (err != 0)
+    {
+      printf ("parent: failed to join: %s\n", strerror (err));
+      return 1;
+    }
+
+  puts ("done");
+
+  return 0;
+}
+
+
+#define TEST_FUNCTION do_test ()
+#define TIMEOUT 3
+#include "../test-skeleton.c"
diff --git a/ap/build/uClibc/test/nptl/tst-cond15.c b/ap/build/uClibc/test/nptl/tst-cond15.c
new file mode 100644
index 0000000..e815e25
--- /dev/null
+++ b/ap/build/uClibc/test/nptl/tst-cond15.c
@@ -0,0 +1,160 @@
+/* Copyright (C) 2004 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+   Contributed by Ulrich Drepper <drepper@redhat.com>, 2004.
+
+   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 <errno.h>
+#include <pthread.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <unistd.h>
+#include <sys/time.h>
+
+
+static pthread_cond_t cond = PTHREAD_COND_INITIALIZER;
+static pthread_mutex_t mut = PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP;
+static pthread_mutex_t mut2 = PTHREAD_MUTEX_INITIALIZER;
+
+static void *
+tf (void *p)
+{
+  if (pthread_mutex_lock (&mut) != 0)
+    {
+      printf ("%s: 1st mutex_lock failed\n", __func__);
+      exit (1);
+    }
+  if (pthread_mutex_lock (&mut) != 0)
+    {
+      printf ("%s: 2nd mutex_lock failed\n", __func__);
+      exit (1);
+    }
+  if (pthread_mutex_lock (&mut) != 0)
+    {
+      printf ("%s: 3rd mutex_lock failed\n", __func__);
+      exit (1);
+    }
+
+  if (pthread_mutex_unlock (&mut2) != 0)
+    {
+      printf ("%s: mutex_unlock failed\n", __func__);
+      exit (1);
+    }
+
+  struct timeval tv;
+  gettimeofday (&tv, NULL);
+  struct timespec ts;
+  TIMEVAL_TO_TIMESPEC (&tv, &ts);
+  ts.tv_sec += p == NULL ? 100 : 1;
+
+  int err = pthread_cond_timedwait (&cond, &mut, &ts);
+  if ((err != 0 && p == NULL) || (err != ETIMEDOUT && p != NULL))
+    {
+      printf ("%s: cond_wait failed\n", __func__);
+      exit (1);
+    }
+
+  if (pthread_mutex_unlock (&mut) != 0)
+    {
+      printf ("%s: 1st mutex_unlock failed\n", __func__);
+      exit (1);
+    }
+  if (pthread_mutex_unlock (&mut) != 0)
+    {
+      printf ("%s: 2nd mutex_unlock failed\n", __func__);
+      exit (1);
+    }
+  if (pthread_mutex_unlock (&mut) != 0)
+    {
+      printf ("%s: 3rd mutex_unlock failed\n", __func__);
+      exit (1);
+    }
+
+  puts ("child: done");
+
+  return NULL;
+}
+
+
+static int
+do_test (void)
+{
+  if (pthread_mutex_lock (&mut2) != 0)
+    {
+      puts ("1st mutex_lock failed");
+      return 1;
+    }
+
+  puts ("parent: create 1st child");
+
+  pthread_t th;
+  int err = pthread_create (&th, NULL, tf, NULL);
+  if (err != 0)
+    {
+      printf ("parent: cannot 1st create thread: %s\n", strerror (err));
+      return 1;
+    }
+
+  /* We have to synchronize with the child.  */
+  if (pthread_mutex_lock (&mut2) != 0)
+    {
+      puts ("2nd mutex_lock failed");
+      return 1;
+    }
+
+  /* Give the child to reach to pthread_cond_wait.  */
+  sleep (1);
+
+  if (pthread_cond_signal (&cond) != 0)
+    {
+      puts ("cond_signal failed");
+      return 1;
+    }
+
+  err = pthread_join (th, NULL);
+  if (err != 0)
+    {
+      printf ("parent: failed to join: %s\n", strerror (err));
+      return 1;
+    }
+
+
+  puts ("parent: create 2nd child");
+
+  err = pthread_create (&th, NULL, tf, (void *) 1l);
+  if (err != 0)
+    {
+      printf ("parent: cannot 2nd create thread: %s\n", strerror (err));
+      return 1;
+    }
+
+  err = pthread_join (th, NULL);
+  if (err != 0)
+    {
+      printf ("parent: failed to join: %s\n", strerror (err));
+      return 1;
+    }
+
+  puts ("done");
+
+  return 0;
+}
+
+
+#define TEST_FUNCTION do_test ()
+#define TIMEOUT 6
+#include "../test-skeleton.c"
diff --git a/ap/build/uClibc/test/nptl/tst-cond16.c b/ap/build/uClibc/test/nptl/tst-cond16.c
new file mode 100644
index 0000000..00c27ec
--- /dev/null
+++ b/ap/build/uClibc/test/nptl/tst-cond16.c
@@ -0,0 +1,105 @@
+/* Copyright (C) 2004 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+   Contributed by Jakub Jelinek <jakub@redhat.com>, 2004.
+
+   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 <errno.h>
+#include <pthread.h>
+#include <stdbool.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <unistd.h>
+
+pthread_cond_t cv = PTHREAD_COND_INITIALIZER;
+pthread_mutex_t lock = PTHREAD_MUTEX_INITIALIZER;
+bool n, exiting;
+FILE *f;
+int count;
+
+void *
+tf (void *dummy)
+{
+  bool loop = true;
+
+  while (loop)
+    {
+      pthread_mutex_lock (&lock);
+      while (n && !exiting)
+	pthread_cond_wait (&cv, &lock);
+      n = true;
+      pthread_mutex_unlock (&lock);
+
+      fputs (".", f);
+
+      pthread_mutex_lock (&lock);
+      n = false;
+      if (exiting)
+	loop = false;
+#ifdef UNLOCK_AFTER_BROADCAST
+      pthread_cond_broadcast (&cv);
+      pthread_mutex_unlock (&lock);
+#else
+      pthread_mutex_unlock (&lock);
+      pthread_cond_broadcast (&cv);
+#endif
+    }
+
+  return NULL;
+}
+
+int
+do_test (void)
+{
+  f = fopen ("/dev/null", "w");
+  if (f == NULL)
+    {
+      printf ("couldn't open /dev/null, %m\n");
+      return 1;
+    }
+
+  count = sysconf (_SC_NPROCESSORS_ONLN);
+  if (count <= 0)
+    count = 1;
+  count *= 4;
+
+  pthread_t th[count];
+  int i, ret;
+  for (i = 0; i < count; ++i)
+    if ((ret = pthread_create (&th[i], NULL, tf, NULL)) != 0)
+      {
+	errno = ret;
+	printf ("pthread_create %d failed: %m\n", i);
+	return 1;
+      }
+
+  struct timespec ts = { .tv_sec = 20, .tv_nsec = 0 };
+  while (nanosleep (&ts, &ts) != 0);
+
+  pthread_mutex_lock (&lock);
+  exiting = true;
+  pthread_mutex_unlock (&lock);
+
+  for (i = 0; i < count; ++i)
+    pthread_join (th[i], NULL);
+
+  fclose (f);
+  return 0;
+}
+
+#define TEST_FUNCTION do_test ()
+#define TIMEOUT 40
+#include "../test-skeleton.c"
diff --git a/ap/build/uClibc/test/nptl/tst-cond17.c b/ap/build/uClibc/test/nptl/tst-cond17.c
new file mode 100644
index 0000000..0586fa5
--- /dev/null
+++ b/ap/build/uClibc/test/nptl/tst-cond17.c
@@ -0,0 +1,2 @@
+#define UNLOCK_AFTER_BROADCAST 1
+#include "tst-cond16.c"
diff --git a/ap/build/uClibc/test/nptl/tst-cond18.c b/ap/build/uClibc/test/nptl/tst-cond18.c
new file mode 100644
index 0000000..9fd81d2
--- /dev/null
+++ b/ap/build/uClibc/test/nptl/tst-cond18.c
@@ -0,0 +1,117 @@
+/* Copyright (C) 2004 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+   Contributed by Jakub Jelinek <jakub@redhat.com>, 2004.
+
+   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 <errno.h>
+#include <fcntl.h>
+#include <pthread.h>
+#include <stdbool.h>
+#include <stdlib.h>
+#include <stdio.h>
+#include <unistd.h>
+
+pthread_cond_t cv = PTHREAD_COND_INITIALIZER;
+pthread_mutex_t lock = PTHREAD_MUTEX_INITIALIZER;
+bool exiting;
+int fd, count, spins, nn;
+
+void *
+tf (void *id)
+{
+  pthread_mutex_lock (&lock);
+
+  if ((long) id == 0)
+    {
+      while (!exiting)
+	{
+	  if ((spins++ % 1000) == 0)
+	    write (fd, ".", 1);
+	  pthread_mutex_unlock (&lock);
+
+	  pthread_mutex_lock (&lock);
+	  int njobs = rand () % (count + 1);
+	  nn = njobs;
+	  if ((rand () % 30) == 0)
+	    pthread_cond_broadcast (&cv);
+	  else
+	    while (njobs--)
+	      pthread_cond_signal (&cv);
+	}
+
+      pthread_cond_broadcast (&cv);
+    }
+  else
+    {
+      while (!exiting)
+	{
+	  while (!nn && !exiting)
+	    pthread_cond_wait (&cv, &lock);
+	  --nn;
+	  pthread_mutex_unlock (&lock);
+
+	  pthread_mutex_lock (&lock);
+	}
+    }
+
+  pthread_mutex_unlock (&lock);
+  return NULL;
+}
+
+int
+do_test (void)
+{
+  fd = open ("/dev/null", O_WRONLY);
+  if (fd < 0)
+    {
+      printf ("couldn't open /dev/null, %m\n");
+      return 1;
+    }
+
+  count = sysconf (_SC_NPROCESSORS_ONLN);
+  if (count <= 0)
+    count = 1;
+  count *= 8;
+
+  pthread_t th[count + 1];
+  int i, ret;
+
+  for (i = 0; i <= count; ++i)
+    if ((ret = pthread_create (&th[i], NULL, tf, (void *) (long) i)) != 0)
+      {
+	errno = ret;
+	printf ("pthread_create %d failed: %m\n", i);
+	return 1;
+      }
+
+  struct timespec ts = { .tv_sec = 20, .tv_nsec = 0 };
+  while (nanosleep (&ts, &ts) != 0);
+
+  pthread_mutex_lock (&lock);
+  exiting = true;
+  pthread_mutex_unlock (&lock);
+
+  for (i = 0; i < count; ++i)
+    pthread_join (th[i], NULL);
+
+  close (fd);
+  return 0;
+}
+
+#define TEST_FUNCTION do_test ()
+#define TIMEOUT 40
+#include "../test-skeleton.c"
diff --git a/ap/build/uClibc/test/nptl/tst-cond19.c b/ap/build/uClibc/test/nptl/tst-cond19.c
new file mode 100644
index 0000000..1c9bb7d
--- /dev/null
+++ b/ap/build/uClibc/test/nptl/tst-cond19.c
@@ -0,0 +1,76 @@
+/* Copyright (C) 2004 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+   Contributed by Ulrich Drepper <drepper@redhat.com>, 2004.
+
+   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 <errno.h>
+#include <pthread.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <time.h>
+
+
+static pthread_cond_t cond = PTHREAD_COND_INITIALIZER;
+static pthread_mutex_t mut = PTHREAD_MUTEX_INITIALIZER;
+
+
+static int
+do_test (void)
+{
+  int result = 0;
+  struct timespec ts;
+
+  if (clock_gettime (CLOCK_REALTIME, &ts) != 0)
+    {
+      puts ("clock_gettime failed");
+      return 1;
+    }
+
+  ts.tv_nsec = -1;
+
+  int e = pthread_cond_timedwait (&cond, &mut, &ts);
+  if (e == 0)
+    {
+      puts ("first cond_timedwait did not fail");
+      result = 1;
+    }
+  else if (e != EINVAL)
+    {
+      puts ("first cond_timedwait did not return EINVAL");
+      result = 1;
+    }
+
+  ts.tv_nsec = 2000000000;
+
+  e = pthread_cond_timedwait (&cond, &mut, &ts);
+  if (e == 0)
+    {
+      puts ("second cond_timedwait did not fail");
+      result = 1;
+    }
+  else if (e != EINVAL)
+    {
+      puts ("second cond_timedwait did not return EINVAL");
+      result = 1;
+    }
+
+  return result;
+}
+
+
+#define TEST_FUNCTION do_test ()
+#include "../test-skeleton.c"
diff --git a/ap/build/uClibc/test/nptl/tst-cond2.c b/ap/build/uClibc/test/nptl/tst-cond2.c
new file mode 100644
index 0000000..36f0f29
--- /dev/null
+++ b/ap/build/uClibc/test/nptl/tst-cond2.c
@@ -0,0 +1,163 @@
+/* Copyright (C) 2002, 2003, 2004 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+   Contributed by Ulrich Drepper <drepper@redhat.com>, 2002.
+
+   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 <error.h>
+#include <pthread.h>
+#include <stdio.h>
+#include <stdlib.h>
+
+
+static pthread_mutex_t mut = PTHREAD_MUTEX_INITIALIZER;
+static pthread_cond_t cond = PTHREAD_COND_INITIALIZER;
+
+static pthread_barrier_t bar;
+
+
+static void *
+tf (void *a)
+{
+  int i = (long int) a;
+  int err;
+
+  printf ("child %d: lock\n", i);
+
+  err = pthread_mutex_lock (&mut);
+  if (err != 0)
+    error (EXIT_FAILURE, err, "locking in child failed");
+
+  printf ("child %d: sync\n", i);
+
+  int e = pthread_barrier_wait (&bar);
+  if (e != 0 && e != PTHREAD_BARRIER_SERIAL_THREAD)
+    {
+      puts ("child: barrier_wait failed");
+      exit (1);
+    }
+
+  printf ("child %d: wait\n", i);
+
+  err = pthread_cond_wait (&cond, &mut);
+  if (err != 0)
+    error (EXIT_FAILURE, err, "child %d: failed to wait", i);
+
+  printf ("child %d: woken up\n", i);
+
+  err = pthread_mutex_unlock (&mut);
+  if (err != 0)
+    error (EXIT_FAILURE, err, "child %d: unlock[2] failed", i);
+
+  printf ("child %d: done\n", i);
+
+  return NULL;
+}
+
+
+#define N 10
+
+
+static int
+do_test (void)
+{
+  pthread_t th[N];
+  int i;
+  int err;
+
+  printf ("&cond = %p\n&mut = %p\n", &cond, &mut);
+
+  if (pthread_barrier_init (&bar, NULL, 2) != 0)
+    {
+      puts ("barrier_init failed");
+      exit (1);
+    }
+
+  pthread_attr_t at;
+
+  if (pthread_attr_init (&at) != 0)
+    {
+      puts ("attr_init failed");
+      return 1;
+    }
+
+  if (pthread_attr_setstacksize (&at, 1 * 1024 * 1024) != 0)
+    {
+      puts ("attr_setstacksize failed");
+      return 1;
+    }
+
+  for (i = 0; i < N; ++i)
+    {
+      printf ("create thread %d\n", i);
+
+      err = pthread_create (&th[i], &at, tf, (void *) (long int) i);
+      if (err != 0)
+	error (EXIT_FAILURE, err, "cannot create thread %d", i);
+
+      printf ("wait for child %d\n", i);
+
+      /* Wait for the child to start up and get the mutex for the
+	 conditional variable.  */
+      int e = pthread_barrier_wait (&bar);
+      if (e != 0 && e != PTHREAD_BARRIER_SERIAL_THREAD)
+	{
+	  puts ("barrier_wait failed");
+	  exit (1);
+	}
+    }
+
+  if (pthread_attr_destroy (&at) != 0)
+    {
+      puts ("attr_destroy failed");
+      return 1;
+    }
+
+  puts ("get lock outselves");
+
+  err = pthread_mutex_lock (&mut);
+  if (err != 0)
+    error (EXIT_FAILURE, err, "mut locking failed");
+
+  puts ("broadcast");
+
+  /* Wake up all threads.  */
+  err = pthread_cond_broadcast (&cond);
+  if (err != 0)
+    error (EXIT_FAILURE, err, "parent: broadcast failed");
+
+  err = pthread_mutex_unlock (&mut);
+  if (err != 0)
+    error (EXIT_FAILURE, err, "mut unlocking failed");
+
+  /* Join all threads.  */
+  for (i = 0; i < N; ++i)
+    {
+      printf ("join thread %d\n", i);
+
+      err = pthread_join (th[i], NULL);
+      if (err != 0)
+	error (EXIT_FAILURE, err, "join of child %d failed", i);
+    }
+
+  puts ("done");
+
+  return 0;
+}
+
+
+#define TEST_FUNCTION do_test ()
+#include "../test-skeleton.c"
diff --git a/ap/build/uClibc/test/nptl/tst-cond20.c b/ap/build/uClibc/test/nptl/tst-cond20.c
new file mode 100644
index 0000000..18918f3
--- /dev/null
+++ b/ap/build/uClibc/test/nptl/tst-cond20.c
@@ -0,0 +1,170 @@
+/* Copyright (C) 2004 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+   Contributed by Jakub Jelinek <jakub@redhat.com>, 2004.
+
+   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>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <unistd.h>
+
+#define N 10
+#define ROUNDS 1000
+static pthread_cond_t cond = PTHREAD_COND_INITIALIZER;
+static pthread_cond_t cond2 = PTHREAD_COND_INITIALIZER;
+static pthread_mutex_t mut = PTHREAD_MUTEX_INITIALIZER;
+static pthread_barrier_t b;
+static int count;
+
+static void *
+tf (void *p)
+{
+  int i;
+  for (i = 0; i < ROUNDS; ++i)
+    {
+      pthread_mutex_lock (&mut);
+
+      if (++count == N)
+	pthread_cond_signal (&cond2);
+
+#ifdef TIMED
+      struct timeval tv;
+      gettimeofday (&tv, NULL);
+      struct timespec ts;
+      /* Wait three seconds.  */
+      ts.tv_sec = tv.tv_sec + 3;
+      ts.tv_nsec = tv.tv_usec * 1000;
+      pthread_cond_timedwait (&cond, &mut, &ts);
+#else
+      pthread_cond_wait (&cond, &mut);
+#endif
+
+      pthread_mutex_unlock (&mut);
+
+      int err = pthread_barrier_wait (&b);
+      if (err != 0 && err != PTHREAD_BARRIER_SERIAL_THREAD)
+	{
+	  puts ("child: barrier_wait failed");
+	  exit (1);
+	}
+
+      err = pthread_barrier_wait (&b);
+      if (err != 0 && err != PTHREAD_BARRIER_SERIAL_THREAD)
+	{
+	  puts ("child: barrier_wait failed");
+	  exit (1);
+	}
+    }
+
+  return NULL;
+}
+
+
+static int
+do_test (void)
+{
+  if (pthread_barrier_init (&b, NULL, N + 1) != 0)
+    {
+      puts ("barrier_init failed");
+      return 1;
+    }
+
+  pthread_mutex_lock (&mut);
+
+  int i, j, err;
+  pthread_t th[N];
+  for (i = 0; i < N; ++i)
+    if ((err = pthread_create (&th[i], NULL, tf, NULL)) != 0)
+      {
+	printf ("cannot create thread %d: %s\n", i, strerror (err));
+	return 1;
+      }
+
+  for (i = 0; i < ROUNDS; ++i)
+    {
+      pthread_cond_wait (&cond2, &mut);
+
+      if (i & 1)
+        pthread_mutex_unlock (&mut);
+
+      if (i & 2)
+	pthread_cond_broadcast (&cond);
+      else if (i & 4)
+	for (j = 0; j < N; ++j)
+	  pthread_cond_signal (&cond);
+      else
+	{
+	  for (j = 0; j < (i / 8) % N; ++j)
+	    pthread_cond_signal (&cond);
+	  pthread_cond_broadcast (&cond);
+	}
+
+      if ((i & 1) == 0)
+        pthread_mutex_unlock (&mut);
+
+      err = pthread_cond_destroy (&cond);
+      if (err)
+	{
+	  printf ("pthread_cond_destroy failed: %s\n", strerror (err));
+	  return 1;
+	}
+
+      /* Now clobber the cond variable which has been successfully
+         destroyed above.  */
+      memset (&cond, (char) i, sizeof (cond));
+
+      err = pthread_barrier_wait (&b);
+      if (err != 0 && err != PTHREAD_BARRIER_SERIAL_THREAD)
+	{
+	  puts ("parent: barrier_wait failed");
+	  return 1;
+	}
+
+      pthread_mutex_lock (&mut);
+
+      err = pthread_barrier_wait (&b);
+      if (err != 0 && err != PTHREAD_BARRIER_SERIAL_THREAD)
+	{
+	  puts ("parent: barrier_wait failed");
+	  return 1;
+	}
+
+      count = 0;
+      err = pthread_cond_init (&cond, NULL);
+      if (err)
+	{
+	  printf ("pthread_cond_init failed: %s\n", strerror (err));
+	  return 1;
+	}
+    }
+
+  for (i = 0; i < N; ++i)
+    if ((err = pthread_join (th[i], NULL)) != 0)
+      {
+	printf ("failed to join thread %d: %s\n", i, strerror (err));
+	return 1;
+      }
+
+  puts ("done");
+
+  return 0;
+}
+
+
+#define TEST_FUNCTION do_test ()
+#include "../test-skeleton.c"
diff --git a/ap/build/uClibc/test/nptl/tst-cond21.c b/ap/build/uClibc/test/nptl/tst-cond21.c
new file mode 100644
index 0000000..89cb771
--- /dev/null
+++ b/ap/build/uClibc/test/nptl/tst-cond21.c
@@ -0,0 +1,3 @@
+#include <sys/time.h>
+#define TIMED 1
+#include "tst-cond20.c"
diff --git a/ap/build/uClibc/test/nptl/tst-cond22.c b/ap/build/uClibc/test/nptl/tst-cond22.c
new file mode 100644
index 0000000..bd978e5
--- /dev/null
+++ b/ap/build/uClibc/test/nptl/tst-cond22.c
@@ -0,0 +1,160 @@
+#include <pthread.h>
+#include <stdio.h>
+#include <stdlib.h>
+
+
+static pthread_barrier_t b;
+static pthread_cond_t c = PTHREAD_COND_INITIALIZER;
+static pthread_mutex_t m = PTHREAD_MUTEX_INITIALIZER;
+
+
+static void
+cl (void *arg)
+{
+  pthread_mutex_unlock (&m);
+}
+
+
+static void *
+tf (void *arg)
+{
+  if (pthread_mutex_lock (&m) != 0)
+    {
+      printf ("%s: mutex_lock failed\n", __func__);
+      exit (1);
+    }
+  int e = pthread_barrier_wait (&b);
+  if (e != 0 && e != PTHREAD_BARRIER_SERIAL_THREAD)
+    {
+      printf ("%s: barrier_wait failed\n", __func__);
+      exit (1);
+    }
+  pthread_cleanup_push (cl, NULL);
+  /* We have to loop here because the cancellation might come after
+     the cond_wait call left the cancelable area and is then waiting
+     on the mutex.  In this case the beginning of the second cond_wait
+     call will cause the cancellation to happen.  */
+  do
+    if (pthread_cond_wait (&c, &m) != 0)
+      {
+	printf ("%s: cond_wait failed\n", __func__);
+	exit (1);
+      }
+  while (arg == NULL);
+  pthread_cleanup_pop (0);
+  if (pthread_mutex_unlock (&m) != 0)
+    {
+      printf ("%s: mutex_unlock failed\n", __func__);
+      exit (1);
+    }
+  return NULL;
+}
+
+
+static int
+do_test (void)
+{
+  int status = 0;
+
+  if (pthread_barrier_init (&b, NULL, 2) != 0)
+    {
+      puts ("barrier_init failed");
+      return 1;
+    }
+
+  pthread_t th;
+  if (pthread_create (&th, NULL, tf, NULL) != 0)
+    {
+      puts ("1st create failed");
+      return 1;
+    }
+  int e = pthread_barrier_wait (&b);
+  if (e != 0 && e != PTHREAD_BARRIER_SERIAL_THREAD)
+    {
+      puts ("1st barrier_wait failed");
+      return 1;
+    }
+  if (pthread_mutex_lock (&m) != 0)
+    {
+      puts ("1st mutex_lock failed");
+      return 1;
+    }
+  if (pthread_cond_signal (&c) != 0)
+    {
+      puts ("1st cond_signal failed");
+      return 1;
+    }
+  if (pthread_cancel (th) != 0)
+    {
+      puts ("cancel failed");
+      return 1;
+    }
+  if (pthread_mutex_unlock (&m) != 0)
+    {
+      puts ("1st mutex_unlock failed");
+      return 1;
+    }
+  void *res;
+  if (pthread_join (th, &res) != 0)
+    {
+      puts ("1st join failed");
+      return 1;
+    }
+  if (res != PTHREAD_CANCELED)
+    {
+      puts ("first thread not canceled");
+      status = 1;
+    }
+
+  printf ("cond = { %d, %x, %lld, %lld, %lld, %p, %u, %u }\n",
+	  c.__data.__lock, c.__data.__futex, c.__data.__total_seq,
+	  c.__data.__wakeup_seq, c.__data.__woken_seq, c.__data.__mutex,
+	  c.__data.__nwaiters, c.__data.__broadcast_seq);
+
+  if (pthread_create (&th, NULL, tf, (void *) 1l) != 0)
+    {
+      puts ("2nd create failed");
+      return 1;
+    }
+  e = pthread_barrier_wait (&b);
+  if (e != 0 && e != PTHREAD_BARRIER_SERIAL_THREAD)
+    {
+      puts ("2nd barrier_wait failed");
+      return 1;
+    }
+  if (pthread_mutex_lock (&m) != 0)
+    {
+      puts ("2nd mutex_lock failed");
+      return 1;
+    }
+  if (pthread_cond_signal (&c) != 0)
+    {
+      puts ("2nd cond_signal failed");
+      return 1;
+    }
+  if (pthread_mutex_unlock (&m) != 0)
+    {
+      puts ("2nd mutex_unlock failed");
+      return 1;
+    }
+  if (pthread_join (th, &res) != 0)
+    {
+      puts ("2nd join failed");
+      return 1;
+    }
+  if (res != NULL)
+    {
+      puts ("2nd thread canceled");
+      status = 1;
+    }
+
+  printf ("cond = { %d, %x, %lld, %lld, %lld, %p, %u, %u }\n",
+	  c.__data.__lock, c.__data.__futex, c.__data.__total_seq,
+	  c.__data.__wakeup_seq, c.__data.__woken_seq, c.__data.__mutex,
+	  c.__data.__nwaiters, c.__data.__broadcast_seq);
+
+  return status;
+}
+
+#define TEST_FUNCTION do_test ()
+#include "../test-skeleton.c"
diff --git a/ap/build/uClibc/test/nptl/tst-cond23.c b/ap/build/uClibc/test/nptl/tst-cond23.c
new file mode 100644
index 0000000..254d821
--- /dev/null
+++ b/ap/build/uClibc/test/nptl/tst-cond23.c
@@ -0,0 +1,184 @@
+/* Copyright (C) 2008 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+   Contributed by Jakub Jelinek <jakub@redhat.com>, 2008.
+
+   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 <errno.h>
+#include <pthread.h>
+#include <stdio.h>
+#include <time.h>
+#include <unistd.h>
+
+
+#if defined _POSIX_CLOCK_SELECTION && _POSIX_CLOCK_SELECTION >= 0
+static int
+check (pthread_condattr_t *condattr, int pshared, clockid_t cl)
+{
+  clockid_t cl2;
+  if (pthread_condattr_getclock (condattr, &cl2) != 0)
+    {
+      puts ("condattr_getclock failed");
+      return 1;
+    }
+  if (cl != cl2)
+    {
+      printf ("condattr_getclock returned wrong value: %d, expected %d\n",
+	      (int) cl2, (int) cl);
+      return 1;
+    }
+
+  int p;
+  if (pthread_condattr_getpshared (condattr, &p) != 0)
+    {
+      puts ("condattr_getpshared failed");
+      return 1;
+    }
+  else if (p != pshared)
+    {
+      printf ("condattr_getpshared returned wrong value: %d, expected %d\n",
+	      p, pshared);
+      return 1;
+    }
+
+  return 0;
+}
+
+static int
+run_test (clockid_t cl)
+{
+  pthread_condattr_t condattr;
+
+  printf ("clock = %d\n", (int) cl);
+
+  if (pthread_condattr_init (&condattr) != 0)
+    {
+      puts ("condattr_init failed");
+      return 1;
+    }
+
+  if (check (&condattr, PTHREAD_PROCESS_PRIVATE, CLOCK_REALTIME))
+    return 1;
+
+  if (pthread_condattr_setpshared (&condattr, PTHREAD_PROCESS_SHARED) != 0)
+    {
+      puts ("1st condattr_setpshared failed");
+      return 1;
+    }
+
+  if (check (&condattr, PTHREAD_PROCESS_SHARED, CLOCK_REALTIME))
+    return 1;
+
+  if (pthread_condattr_setclock (&condattr, cl) != 0)
+    {
+      puts ("1st condattr_setclock failed");
+      return 1;
+    }
+
+  if (check (&condattr, PTHREAD_PROCESS_SHARED, cl))
+    return 1;
+
+  if (pthread_condattr_setpshared (&condattr, PTHREAD_PROCESS_PRIVATE) != 0)
+    {
+      puts ("2nd condattr_setpshared failed");
+      return 1;
+    }
+
+  if (check (&condattr, PTHREAD_PROCESS_PRIVATE, cl))
+    return 1;
+
+  if (pthread_condattr_setclock (&condattr, CLOCK_REALTIME) != 0)
+    {
+      puts ("2nd condattr_setclock failed");
+      return 1;
+    }
+
+  if (check (&condattr, PTHREAD_PROCESS_PRIVATE, CLOCK_REALTIME))
+    return 1;
+
+  if (pthread_condattr_setclock (&condattr, cl) != 0)
+    {
+      puts ("3rd condattr_setclock failed");
+      return 1;
+    }
+
+  if (check (&condattr, PTHREAD_PROCESS_PRIVATE, cl))
+    return 1;
+
+  if (pthread_condattr_setpshared (&condattr, PTHREAD_PROCESS_SHARED) != 0)
+    {
+      puts ("3rd condattr_setpshared failed");
+      return 1;
+    }
+
+  if (check (&condattr, PTHREAD_PROCESS_SHARED, cl))
+    return 1;
+
+  if (pthread_condattr_setclock (&condattr, CLOCK_REALTIME) != 0)
+    {
+      puts ("4th condattr_setclock failed");
+      return 1;
+    }
+
+  if (check (&condattr, PTHREAD_PROCESS_SHARED, CLOCK_REALTIME))
+    return 1;
+
+  if (pthread_condattr_destroy (&condattr) != 0)
+    {
+      puts ("condattr_destroy failed");
+      return 1;
+    }
+
+  return 0;
+}
+#endif
+
+
+static int
+do_test (void)
+{
+#if !defined _POSIX_CLOCK_SELECTION || _POSIX_CLOCK_SELECTION == -1
+
+  puts ("_POSIX_CLOCK_SELECTION not supported, test skipped");
+  return 0;
+
+#else
+
+  int res = run_test (CLOCK_REALTIME);
+
+# if defined _POSIX_MONOTONIC_CLOCK && _POSIX_MONOTONIC_CLOCK >= 0
+#  if _POSIX_MONOTONIC_CLOCK == 0
+  int e = sysconf (_SC_MONOTONIC_CLOCK);
+  if (e < 0)
+    puts ("CLOCK_MONOTONIC not supported");
+  else if (e == 0)
+    {
+      puts ("sysconf (_SC_MONOTONIC_CLOCK) must not return 0");
+      res = 1;
+    }
+  else
+#  endif
+    res |= run_test (CLOCK_MONOTONIC);
+# else
+  puts ("_POSIX_MONOTONIC_CLOCK not defined");
+# endif
+
+  return res;
+#endif
+}
+
+#define TEST_FUNCTION do_test ()
+#include "../test-skeleton.c"
diff --git a/ap/build/uClibc/test/nptl/tst-cond3.c b/ap/build/uClibc/test/nptl/tst-cond3.c
new file mode 100644
index 0000000..cb9eb85
--- /dev/null
+++ b/ap/build/uClibc/test/nptl/tst-cond3.c
@@ -0,0 +1,113 @@
+/* Copyright (C) 2002 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+   Contributed by Ulrich Drepper <drepper@redhat.com>, 2002.
+
+   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>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <unistd.h>
+
+
+/* Note that this test requires more than the standard.  It is
+   required that there are no spurious wakeups if only more readers
+   are added.  This is a reasonable demand.  */
+
+
+static pthread_cond_t cond = PTHREAD_COND_INITIALIZER;
+static pthread_mutex_t mut = PTHREAD_MUTEX_INITIALIZER;
+
+
+#define N 10
+
+
+static void *
+tf (void *arg)
+{
+  int i = (long int) arg;
+  int err;
+
+  /* Get the mutex.  */
+  err = pthread_mutex_lock (&mut);
+  if (err != 0)
+    {
+      printf ("child %d mutex_lock failed: %s\n", i, strerror (err));
+      exit (1);
+    }
+
+  /* This call should never return.  */
+  pthread_cond_wait (&cond, &mut);
+
+  /* We should never get here.  */
+  exit (1);
+
+  return NULL;
+}
+
+
+static int
+do_test (void)
+{
+  int err;
+  int i;
+
+  for (i = 0; i < N; ++i)
+    {
+      pthread_t th;
+
+      if (i != 0)
+	{
+	  /* Release the mutex.  */
+	  err = pthread_mutex_unlock (&mut);
+	  if (err != 0)
+	    {
+	      printf ("mutex_unlock %d failed: %s\n", i, strerror (err));
+	      return 1;
+	    }
+	}
+
+      err = pthread_create (&th, NULL, tf, (void *) (long int) i);
+      if (err != 0)
+	{
+	  printf ("create %d failed: %s\n", i, strerror (err));
+	  return 1;
+	}
+
+      /* Get the mutex.  */
+      err = pthread_mutex_lock (&mut);
+      if (err != 0)
+	{
+	  printf ("mutex_lock %d failed: %s\n", i, strerror (err));
+	  return 1;
+	}
+    }
+
+  /* Set an alarm for 1 second.  The wrapper will expect this.  */
+  alarm (1);
+
+  /* This call should never return.  */
+  pthread_cond_wait (&cond, &mut);
+
+  puts ("cond_wait returned");
+  return 1;
+}
+
+
+#define EXPECTED_SIGNAL SIGALRM
+#define TEST_FUNCTION do_test ()
+#include "../test-skeleton.c"
diff --git a/ap/build/uClibc/test/nptl/tst-cond4.c b/ap/build/uClibc/test/nptl/tst-cond4.c
new file mode 100644
index 0000000..4d88596
--- /dev/null
+++ b/ap/build/uClibc/test/nptl/tst-cond4.c
@@ -0,0 +1,264 @@
+/* Copyright (C) 2002, 2003, 2004 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+   Contributed by Ulrich Drepper <drepper@redhat.com>, 2002.
+
+   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 <errno.h>
+#include <pthread.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <unistd.h>
+#include <sys/mman.h>
+#include <sys/wait.h>
+#include <stdint.h>
+
+
+int *condition;
+
+static int
+do_test (void)
+{
+  size_t ps = sysconf (_SC_PAGESIZE);
+  char tmpfname[] = "/tmp/tst-cond4.XXXXXX";
+  char data[ps];
+  void *mem;
+  int fd;
+  pthread_mutexattr_t ma;
+  pthread_mutex_t *mut1;
+  pthread_mutex_t *mut2;
+  pthread_condattr_t ca;
+  pthread_cond_t *cond;
+  pid_t pid;
+  int result = 0;
+  int p;
+
+  fd = mkstemp (tmpfname);
+  if (fd == -1)
+    {
+      printf ("cannot open temporary file: %m\n");
+      return 1;
+    }
+
+  /* Make sure it is always removed.  */
+  unlink (tmpfname);
+
+  /* Create one page of data.  */
+  memset (data, '\0', ps);
+
+  /* Write the data to the file.  */
+  if (write (fd, data, ps) != (ssize_t) ps)
+    {
+      puts ("short write");
+      return 1;
+    }
+
+  mem = mmap (NULL, ps, PROT_READ | PROT_WRITE, MAP_SHARED, fd, 0);
+  if (mem == MAP_FAILED)
+    {
+      printf ("mmap failed: %m\n");
+      return 1;
+    }
+
+  mut1 = (pthread_mutex_t *) (((uintptr_t) mem
+			       + __alignof (pthread_mutex_t))
+			      & ~(__alignof (pthread_mutex_t) - 1));
+  mut2 = mut1 + 1;
+
+  cond = (pthread_cond_t *) (((uintptr_t) (mut2 + 1)
+			      + __alignof (pthread_cond_t))
+			     & ~(__alignof (pthread_cond_t) - 1));
+
+  condition = (int *) (((uintptr_t) (cond + 1) + __alignof (int))
+		       & ~(__alignof (int) - 1));
+
+  if (pthread_mutexattr_init (&ma) != 0)
+    {
+      puts ("mutexattr_init failed");
+      return 1;
+    }
+
+  if (pthread_mutexattr_getpshared (&ma, &p) != 0)
+    {
+      puts ("1st mutexattr_getpshared failed");
+      return 1;
+    }
+
+  if (p != PTHREAD_PROCESS_PRIVATE)
+    {
+      puts ("default pshared value wrong");
+      return 1;
+    }
+
+  if (pthread_mutexattr_setpshared (&ma, PTHREAD_PROCESS_SHARED) != 0)
+    {
+      puts ("mutexattr_setpshared failed");
+      return 1;
+    }
+
+  if (pthread_mutexattr_getpshared (&ma, &p) != 0)
+    {
+      puts ("2nd mutexattr_getpshared failed");
+      return 1;
+    }
+
+  if (p != PTHREAD_PROCESS_SHARED)
+    {
+      puts ("pshared value after setpshared call wrong");
+      return 1;
+    }
+
+  if (pthread_mutex_init (mut1, &ma) != 0)
+    {
+      puts ("1st mutex_init failed");
+      return 1;
+    }
+
+  if (pthread_mutex_init (mut2, &ma) != 0)
+    {
+      puts ("2nd mutex_init failed");
+      return 1;
+    }
+
+  if (pthread_condattr_init (&ca) != 0)
+    {
+      puts ("condattr_init failed");
+      return 1;
+    }
+
+  if (pthread_condattr_getpshared (&ca, &p) != 0)
+    {
+      puts ("1st condattr_getpshared failed");
+      return 1;
+    }
+
+  if (p != PTHREAD_PROCESS_PRIVATE)
+    {
+      puts ("default value for pshared in condattr wrong");
+      return 1;
+    }
+
+  if (pthread_condattr_setpshared (&ca, PTHREAD_PROCESS_SHARED) != 0)
+    {
+      puts ("condattr_setpshared failed");
+      return 1;
+    }
+
+  if (pthread_condattr_getpshared (&ca, &p) != 0)
+    {
+      puts ("2nd condattr_getpshared failed");
+      return 1;
+    }
+
+  if (p != PTHREAD_PROCESS_SHARED)
+    {
+      puts ("pshared condattr still not set");
+      return 1;
+    }
+
+  if (pthread_cond_init (cond, &ca) != 0)
+    {
+      puts ("cond_init failed");
+      return 1;
+    }
+
+  if (pthread_mutex_lock (mut1) != 0)
+    {
+      puts ("parent: 1st mutex_lock failed");
+      return 1;
+    }
+
+  puts ("going to fork now");
+  pid = fork ();
+  if (pid == -1)
+    {
+      puts ("fork failed");
+      return 1;
+    }
+  else if (pid == 0)
+    {
+      if (pthread_mutex_lock (mut2) != 0)
+	{
+	  puts ("child: mutex_lock failed");
+	  return 1;
+	}
+
+      if (pthread_mutex_unlock (mut1) != 0)
+	{
+	  puts ("child: 1st mutex_unlock failed");
+	  return 1;
+	}
+
+      do
+	if (pthread_cond_wait (cond, mut2) != 0)
+	  {
+	    puts ("child: cond_wait failed");
+	    return 1;
+	  }
+      while (*condition == 0);
+
+      if (pthread_mutex_unlock (mut2) != 0)
+	{
+	  puts ("child: 2nd mutex_unlock failed");
+	  return 1;
+	}
+
+      puts ("child done");
+    }
+  else
+    {
+      int status;
+
+      if (pthread_mutex_lock (mut1) != 0)
+	{
+	  puts ("parent: 2nd mutex_lock failed");
+	  return 1;
+	}
+
+      if (pthread_mutex_lock (mut2) != 0)
+	{
+	  puts ("parent: 3rd mutex_lock failed");
+	  return 1;
+	}
+
+      if (pthread_cond_signal (cond) != 0)
+	{
+	  puts ("parent: cond_signal failed");
+	  return 1;
+	}
+
+      *condition = 1;
+
+      if (pthread_mutex_unlock (mut2) != 0)
+	{
+	  puts ("parent: mutex_unlock failed");
+	  return 1;
+	}
+
+      puts ("waiting for child");
+
+      waitpid (pid, &status, 0);
+      result |= status;
+
+      puts ("parent done");
+    }
+
+ return result;
+}
+
+#define TEST_FUNCTION do_test ()
+#include "../test-skeleton.c"
diff --git a/ap/build/uClibc/test/nptl/tst-cond5.c b/ap/build/uClibc/test/nptl/tst-cond5.c
new file mode 100644
index 0000000..efa207b
--- /dev/null
+++ b/ap/build/uClibc/test/nptl/tst-cond5.c
@@ -0,0 +1,106 @@
+/* Copyright (C) 2002 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+   Contributed by Ulrich Drepper <drepper@redhat.com>, 2002.
+
+   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 <errno.h>
+#include <pthread.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <time.h>
+#include <sys/time.h>
+
+
+static pthread_mutex_t mut;
+static pthread_cond_t cond = PTHREAD_COND_INITIALIZER;
+
+
+static int
+do_test (void)
+{
+  pthread_mutexattr_t ma;
+  int err;
+  struct timespec ts;
+  struct timeval tv;
+
+  if (pthread_mutexattr_init (&ma) != 0)
+    {
+      puts ("mutexattr_init failed");
+      exit (1);
+    }
+
+  if (pthread_mutexattr_settype (&ma, PTHREAD_MUTEX_ERRORCHECK) != 0)
+    {
+      puts ("mutexattr_settype failed");
+      exit (1);
+    }
+
+  if (pthread_mutex_init (&mut, &ma) != 0)
+    {
+      puts ("mutex_init failed");
+      exit (1);
+    }
+
+  /* Get the mutex.  */
+  if (pthread_mutex_lock (&mut) != 0)
+    {
+      puts ("mutex_lock failed");
+      exit (1);
+    }
+
+  /* Waiting for the condition will fail.  But we want the timeout here.  */
+  if (gettimeofday (&tv, NULL) != 0)
+    {
+      puts ("gettimeofday failed");
+      exit (1);
+    }
+
+  TIMEVAL_TO_TIMESPEC (&tv, &ts);
+  ts.tv_nsec += 500000000;
+  if (ts.tv_nsec >= 1000000000)
+    {
+      ts.tv_nsec -= 1000000000;
+      ++ts.tv_sec;
+    }
+  err = pthread_cond_timedwait (&cond, &mut, &ts);
+  if (err == 0)
+    {
+      /* This could in theory happen but here without any signal and
+	 additional waiter it should not.  */
+      puts ("cond_timedwait succeeded");
+      exit (1);
+    }
+  else if (err != ETIMEDOUT)
+    {
+      printf ("cond_timedwait returned with %s\n", strerror (err));
+      exit (1);
+    }
+
+  err = pthread_mutex_unlock (&mut);
+  if (err != 0)
+    {
+      printf ("mutex_unlock failed: %s\n", strerror (err));
+      exit (1);
+    }
+
+  return 0;
+}
+
+
+#define TEST_FUNCTION do_test ()
+#include "../test-skeleton.c"
diff --git a/ap/build/uClibc/test/nptl/tst-cond6.c b/ap/build/uClibc/test/nptl/tst-cond6.c
new file mode 100644
index 0000000..8c5fe20
--- /dev/null
+++ b/ap/build/uClibc/test/nptl/tst-cond6.c
@@ -0,0 +1,234 @@
+/* Copyright (C) 2002, 2003, 2004 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+   Contributed by Ulrich Drepper <drepper@redhat.com>, 2002.
+
+   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 <errno.h>
+#include <pthread.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <time.h>
+#include <unistd.h>
+#include <sys/mman.h>
+#include <sys/time.h>
+#include <sys/wait.h>
+#include <stdint.h>
+
+
+int *condition;
+
+static int
+do_test (void)
+{
+  size_t ps = sysconf (_SC_PAGESIZE);
+  char tmpfname[] = "/tmp/tst-cond6.XXXXXX";
+  char data[ps];
+  void *mem;
+  int fd;
+  pthread_mutexattr_t ma;
+  pthread_mutex_t *mut1;
+  pthread_mutex_t *mut2;
+  pthread_condattr_t ca;
+  pthread_cond_t *cond;
+  pid_t pid;
+  int result = 0;
+
+  fd = mkstemp (tmpfname);
+  if (fd == -1)
+    {
+      printf ("cannot open temporary file: %m\n");
+      exit (1);
+    }
+
+  /* Make sure it is always removed.  */
+  unlink (tmpfname);
+
+  /* Create one page of data.  */
+  memset (data, '\0', ps);
+
+  /* Write the data to the file.  */
+  if (write (fd, data, ps) != (ssize_t) ps)
+    {
+      puts ("short write");
+      exit (1);
+    }
+
+  mem = mmap (NULL, ps, PROT_READ | PROT_WRITE, MAP_SHARED, fd, 0);
+  if (mem == MAP_FAILED)
+    {
+      printf ("mmap failed: %m\n");
+      exit (1);
+    }
+
+  mut1 = (pthread_mutex_t *) (((uintptr_t) mem
+			       + __alignof (pthread_mutex_t))
+			      & ~(__alignof (pthread_mutex_t) - 1));
+  mut2 = mut1 + 1;
+
+  cond = (pthread_cond_t *) (((uintptr_t) (mut2 + 1)
+			      + __alignof (pthread_cond_t))
+			     & ~(__alignof (pthread_cond_t) - 1));
+
+  condition = (int *) (((uintptr_t) (cond + 1) + __alignof (int))
+		       & ~(__alignof (int) - 1));
+
+  if (pthread_mutexattr_init (&ma) != 0)
+    {
+      puts ("mutexattr_init failed");
+      exit (1);
+    }
+
+  if (pthread_mutexattr_setpshared (&ma, PTHREAD_PROCESS_SHARED) != 0)
+    {
+      puts ("mutexattr_setpshared failed");
+      exit (1);
+    }
+
+  if (pthread_mutex_init (mut1, &ma) != 0)
+    {
+      puts ("1st mutex_init failed");
+      exit (1);
+    }
+
+  if (pthread_mutex_init (mut2, &ma) != 0)
+    {
+      puts ("2nd mutex_init failed");
+      exit (1);
+    }
+
+  if (pthread_condattr_init (&ca) != 0)
+    {
+      puts ("condattr_init failed");
+      exit (1);
+    }
+
+  if (pthread_condattr_setpshared (&ca, PTHREAD_PROCESS_SHARED) != 0)
+    {
+      puts ("condattr_setpshared failed");
+      exit (1);
+    }
+
+  if (pthread_cond_init (cond, &ca) != 0)
+    {
+      puts ("cond_init failed");
+      exit (1);
+    }
+
+  if (pthread_mutex_lock (mut1) != 0)
+    {
+      puts ("parent: 1st mutex_lock failed");
+      exit (1);
+    }
+
+  puts ("going to fork now");
+  pid = fork ();
+  if (pid == -1)
+    {
+      puts ("fork failed");
+      exit (1);
+    }
+  else if (pid == 0)
+    {
+      struct timespec ts;
+      struct timeval tv;
+
+      if (pthread_mutex_lock (mut2) != 0)
+	{
+	  puts ("child: mutex_lock failed");
+	  exit (1);
+	}
+
+      if (pthread_mutex_unlock (mut1) != 0)
+	{
+	  puts ("child: 1st mutex_unlock failed");
+	  exit (1);
+	}
+
+      if (gettimeofday (&tv, NULL) != 0)
+	{
+	  puts ("gettimeofday failed");
+	  exit (1);
+	}
+
+      TIMEVAL_TO_TIMESPEC (&tv, &ts);
+      ts.tv_nsec += 500000000;
+      if (ts.tv_nsec >= 1000000000)
+	{
+	  ts.tv_nsec -= 1000000000;
+	  ++ts.tv_sec;
+	}
+
+      do
+	if (pthread_cond_timedwait (cond, mut2, &ts) != 0)
+	  {
+	    puts ("child: cond_wait failed");
+	    exit (1);
+	  }
+      while (*condition == 0);
+
+      if (pthread_mutex_unlock (mut2) != 0)
+	{
+	  puts ("child: 2nd mutex_unlock failed");
+	  exit (1);
+	}
+
+      puts ("child done");
+    }
+  else
+    {
+      int status;
+
+      if (pthread_mutex_lock (mut1) != 0)
+	{
+	  puts ("parent: 2nd mutex_lock failed");
+	  exit (1);
+	}
+
+      if (pthread_mutex_lock (mut2) != 0)
+	{
+	  puts ("parent: 3rd mutex_lock failed");
+	  exit (1);
+	}
+
+      if (pthread_cond_signal (cond) != 0)
+	{
+	  puts ("parent: cond_signal failed");
+	  exit (1);
+	}
+
+      *condition = 1;
+
+      if (pthread_mutex_unlock (mut2) != 0)
+	{
+	  puts ("parent: mutex_unlock failed");
+	  exit (1);
+	}
+
+      puts ("waiting for child");
+
+      waitpid (pid, &status, 0);
+      result |= status;
+
+      puts ("parent done");
+    }
+
+ return result;
+}
+
+#define TEST_FUNCTION do_test ()
+#include "../test-skeleton.c"
diff --git a/ap/build/uClibc/test/nptl/tst-cond7.c b/ap/build/uClibc/test/nptl/tst-cond7.c
new file mode 100644
index 0000000..5ab7b8f
--- /dev/null
+++ b/ap/build/uClibc/test/nptl/tst-cond7.c
@@ -0,0 +1,168 @@
+/* Copyright (C) 2003 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+   Contributed by Jakub Jelinek <jakub@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, write to the Free
+   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+   02111-1307 USA.  */
+
+#include <errno.h>
+#include <pthread.h>
+#include <stdbool.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <time.h>
+#include <sys/time.h>
+
+
+typedef struct
+  {
+    pthread_cond_t cond;
+    pthread_mutex_t lock;
+    pthread_t h;
+  } T;
+
+
+static volatile bool done;
+
+
+static void *
+tf (void *arg)
+{
+  puts ("child created");
+
+  if (pthread_setcancelstate (PTHREAD_CANCEL_ENABLE, NULL) != 0
+      || pthread_setcanceltype (PTHREAD_CANCEL_DEFERRED, NULL) != 0)
+    {
+      puts ("cannot set cancellation options");
+      exit (1);
+    }
+
+  T *t = (T *) arg;
+
+  if (pthread_mutex_lock (&t->lock) != 0)
+    {
+      puts ("child: lock failed");
+      exit (1);
+    }
+
+  done = true;
+
+  if (pthread_cond_signal (&t->cond) != 0)
+    {
+      puts ("child: cond_signal failed");
+      exit (1);
+    }
+
+  if (pthread_cond_wait (&t->cond, &t->lock) != 0)
+    {
+      puts ("child: cond_wait failed");
+      exit (1);
+    }
+
+  if (pthread_mutex_unlock (&t->lock) != 0)
+    {
+      puts ("child: unlock failed");
+      exit (1);
+    }
+
+  return NULL;
+}
+
+
+static int
+do_test (void)
+{
+  int i;
+#define N 100
+  T *t[N];
+  for (i = 0; i < N; ++i)
+    {
+      printf ("round %d\n", i);
+
+      t[i] = (T *) malloc (sizeof (T));
+      if (t[i] == NULL)
+	{
+	  puts ("out of memory");
+	  exit (1);
+	}
+
+      if (pthread_mutex_init (&t[i]->lock, NULL) != 0
+	  || pthread_cond_init (&t[i]->cond, NULL) != 0)
+	{
+	  puts ("an _init function failed");
+	  exit (1);
+	}
+
+      if (pthread_mutex_lock (&t[i]->lock) != 0)
+	{
+	  puts ("initial mutex_lock failed");
+	  exit (1);
+	}
+
+      done = false;
+
+      if (pthread_create (&t[i]->h, NULL, tf, t[i]) != 0)
+	{
+	  puts ("pthread_create failed");
+	  exit (1);
+	}
+
+      do
+	if (pthread_cond_wait (&t[i]->cond, &t[i]->lock) != 0)
+	  {
+	    puts ("cond_wait failed");
+	    exit (1);
+	  }
+      while (! done);
+
+      /* Release the lock since the cancel handler will get it.  */
+      if (pthread_mutex_unlock (&t[i]->lock) != 0)
+	{
+	  puts ("mutex_unlock failed");
+	  exit (1);
+	}
+
+      if (pthread_cancel (t[i]->h) != 0)
+	{
+	  puts ("cancel failed");
+	  exit (1);
+	}
+
+      puts ("parent: joining now");
+
+      void *result;
+      if (pthread_join (t[i]->h, &result) != 0)
+	{
+	  puts ("join failed");
+	  exit (1);
+	}
+
+      if (result != PTHREAD_CANCELED)
+	{
+	  puts ("result != PTHREAD_CANCELED");
+	  exit (1);
+	}
+    }
+
+  for (i = 0; i < N; ++i)
+    free (t[i]);
+
+  return 0;
+}
+
+
+#define TEST_FUNCTION do_test ()
+#include "../test-skeleton.c"
diff --git a/ap/build/uClibc/test/nptl/tst-cond8.c b/ap/build/uClibc/test/nptl/tst-cond8.c
new file mode 100644
index 0000000..9c97a96
--- /dev/null
+++ b/ap/build/uClibc/test/nptl/tst-cond8.c
@@ -0,0 +1,277 @@
+/* Copyright (C) 2003 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, write to the Free
+   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+   02111-1307 USA.  */
+
+#include <errno.h>
+#include <pthread.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <time.h>
+#include <sys/time.h>
+
+
+static pthread_cond_t cond = PTHREAD_COND_INITIALIZER;
+static pthread_mutex_t mut = PTHREAD_ERRORCHECK_MUTEX_INITIALIZER_NP;
+
+static pthread_barrier_t bar;
+
+
+static void
+ch (void *arg)
+{
+  int e = pthread_mutex_lock (&mut);
+  if (e == 0)
+    {
+      puts ("mutex not locked at all by cond_wait");
+      exit (1);
+    }
+
+  if (e != EDEADLK)
+    {
+      puts ("no deadlock error signaled");
+      exit (1);
+    }
+
+  if (pthread_mutex_unlock (&mut) != 0)
+    {
+      puts ("ch: cannot unlock mutex");
+      exit (1);
+    }
+
+  puts ("ch done");
+}
+
+
+static void *
+tf1 (void *p)
+{
+  int err;
+
+  if (pthread_setcancelstate (PTHREAD_CANCEL_ENABLE, NULL) != 0
+      || pthread_setcanceltype (PTHREAD_CANCEL_DEFERRED, NULL) != 0)
+    {
+      puts ("cannot set cancellation options");
+      exit (1);
+    }
+
+  err = pthread_mutex_lock (&mut);
+  if (err != 0)
+    {
+      puts ("child: cannot get mutex");
+      exit (1);
+    }
+
+  err = pthread_barrier_wait (&bar);
+  if (err != 0 && err != PTHREAD_BARRIER_SERIAL_THREAD)
+    {
+      printf ("barrier_wait returned %d\n", err);
+      exit (1);
+    }
+
+  puts ("child: got mutex; waiting");
+
+  pthread_cleanup_push (ch, NULL);
+
+  pthread_cond_wait (&cond, &mut);
+
+  pthread_cleanup_pop (0);
+
+  puts ("child: cond_wait should not have returned");
+
+  return NULL;
+}
+
+
+static void *
+tf2 (void *p)
+{
+  int err;
+
+  if (pthread_setcancelstate (PTHREAD_CANCEL_ENABLE, NULL) != 0
+      || pthread_setcanceltype (PTHREAD_CANCEL_DEFERRED, NULL) != 0)
+    {
+      puts ("cannot set cancellation options");
+      exit (1);
+    }
+
+  err = pthread_mutex_lock (&mut);
+  if (err != 0)
+    {
+      puts ("child: cannot get mutex");
+      exit (1);
+    }
+
+  err = pthread_barrier_wait (&bar);
+  if (err != 0 && err != PTHREAD_BARRIER_SERIAL_THREAD)
+    {
+      printf ("barrier_wait returned %d\n", err);
+      exit (1);
+    }
+
+  puts ("child: got mutex; waiting");
+
+  pthread_cleanup_push (ch, NULL);
+
+  /* Current time.  */
+  struct timeval tv;
+  (void) gettimeofday (&tv, NULL);
+  /* +1000 seconds in correct format.  */
+  struct timespec ts;
+  TIMEVAL_TO_TIMESPEC (&tv, &ts);
+  ts.tv_sec += 1000;
+
+  pthread_cond_timedwait (&cond, &mut, &ts);
+
+  pthread_cleanup_pop (0);
+
+  puts ("child: cond_wait should not have returned");
+
+  return NULL;
+}
+
+
+static int
+do_test (void)
+{
+  pthread_t th;
+  int err;
+
+  printf ("&cond = %p\n&mut = %p\n", &cond, &mut);
+
+  puts ("parent: get mutex");
+
+  err = pthread_barrier_init (&bar, NULL, 2);
+  if (err != 0)
+    {
+      puts ("parent: cannot init barrier");
+      exit (1);
+    }
+
+  puts ("parent: create child");
+
+  err = pthread_create (&th, NULL, tf1, NULL);
+  if (err != 0)
+    {
+      puts ("parent: cannot create thread");
+      exit (1);
+    }
+
+  puts ("parent: wait for child to lock mutex");
+
+  err = pthread_barrier_wait (&bar);
+  if (err != 0 && err != PTHREAD_BARRIER_SERIAL_THREAD)
+    {
+      puts ("parent: cannot wait for barrier");
+      exit (1);
+    }
+
+  err = pthread_mutex_lock (&mut);
+  if (err != 0)
+    {
+      puts ("parent: mutex_lock failed");
+      exit (1);
+    }
+
+  err = pthread_mutex_unlock (&mut);
+  if (err != 0)
+    {
+      puts ("parent: mutex_unlock failed");
+      exit (1);
+    }
+
+  if (pthread_cancel (th) != 0)
+    {
+      puts ("cannot cancel thread");
+      exit (1);
+    }
+
+  void *r;
+  err = pthread_join (th, &r);
+  if (err != 0)
+    {
+      puts ("parent: failed to join");
+      exit (1);
+    }
+
+  if (r != PTHREAD_CANCELED)
+    {
+      puts ("child hasn't been canceled");
+      exit (1);
+    }
+
+
+
+  puts ("parent: create 2nd child");
+
+  err = pthread_create (&th, NULL, tf2, NULL);
+  if (err != 0)
+    {
+      puts ("parent: cannot create thread");
+      exit (1);
+    }
+
+  puts ("parent: wait for child to lock mutex");
+
+  err = pthread_barrier_wait (&bar);
+  if (err != 0 && err != PTHREAD_BARRIER_SERIAL_THREAD)
+    {
+      puts ("parent: cannot wait for barrier");
+      exit (1);
+    }
+
+  err = pthread_mutex_lock (&mut);
+  if (err != 0)
+    {
+      puts ("parent: mutex_lock failed");
+      exit (1);
+    }
+
+  err = pthread_mutex_unlock (&mut);
+  if (err != 0)
+    {
+      puts ("parent: mutex_unlock failed");
+      exit (1);
+    }
+
+  if (pthread_cancel (th) != 0)
+    {
+      puts ("cannot cancel thread");
+      exit (1);
+    }
+
+  err = pthread_join (th, &r);
+  if (err != 0)
+    {
+      puts ("parent: failed to join");
+      exit (1);
+    }
+
+  if (r != PTHREAD_CANCELED)
+    {
+      puts ("child hasn't been canceled");
+      exit (1);
+    }
+
+  puts ("done");
+
+  return 0;
+}
+
+
+#define TEST_FUNCTION do_test ()
+#include "../test-skeleton.c"
diff --git a/ap/build/uClibc/test/nptl/tst-cond9.c b/ap/build/uClibc/test/nptl/tst-cond9.c
new file mode 100644
index 0000000..2a8477d
--- /dev/null
+++ b/ap/build/uClibc/test/nptl/tst-cond9.c
@@ -0,0 +1,150 @@
+/* Copyright (C) 2003 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, write to the Free
+   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+   02111-1307 USA.  */
+
+#include <errno.h>
+#include <pthread.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <time.h>
+#include <sys/time.h>
+
+
+static pthread_cond_t cond = PTHREAD_COND_INITIALIZER;
+static pthread_mutex_t mut = PTHREAD_ERRORCHECK_MUTEX_INITIALIZER_NP;
+
+
+static void *
+tf (void *arg)
+{
+  int err = pthread_cond_wait (&cond, &mut);
+  if (err == 0)
+    {
+      puts ("cond_wait did not fail");
+      exit (1);
+    }
+
+  if (err != EPERM)
+    {
+      printf ("cond_wait didn't return EPERM but %d\n", err);
+      exit (1);
+    }
+
+
+  /* Current time.  */
+  struct timeval tv;
+  (void) gettimeofday (&tv, NULL);
+  /* +1000 seconds in correct format.  */
+  struct timespec ts;
+  TIMEVAL_TO_TIMESPEC (&tv, &ts);
+  ts.tv_sec += 1000;
+
+  err = pthread_cond_timedwait (&cond, &mut, &ts);
+  if (err == 0)
+    {
+      puts ("cond_timedwait did not fail");
+      exit (1);
+    }
+
+  if (err != EPERM)
+    {
+      printf ("cond_timedwait didn't return EPERM but %d\n", err);
+      exit (1);
+    }
+
+  return (void *) 1l;
+}
+
+
+static int
+do_test (void)
+{
+  pthread_t th;
+  int err;
+
+  printf ("&cond = %p\n&mut = %p\n", &cond, &mut);
+
+  err = pthread_cond_wait (&cond, &mut);
+  if (err == 0)
+    {
+      puts ("cond_wait did not fail");
+      exit (1);
+    }
+
+  if (err != EPERM)
+    {
+      printf ("cond_wait didn't return EPERM but %d\n", err);
+      exit (1);
+    }
+
+
+  /* Current time.  */
+  struct timeval tv;
+  (void) gettimeofday (&tv, NULL);
+  /* +1000 seconds in correct format.  */
+  struct timespec ts;
+  TIMEVAL_TO_TIMESPEC (&tv, &ts);
+  ts.tv_sec += 1000;
+
+  err = pthread_cond_timedwait (&cond, &mut, &ts);
+  if (err == 0)
+    {
+      puts ("cond_timedwait did not fail");
+      exit (1);
+    }
+
+  if (err != EPERM)
+    {
+      printf ("cond_timedwait didn't return EPERM but %d\n", err);
+      exit (1);
+    }
+
+  if (pthread_mutex_lock (&mut) != 0)
+    {
+      puts ("parent: mutex_lock failed");
+      exit (1);
+    }
+
+  puts ("creating thread");
+
+  if (pthread_create (&th, NULL, tf, NULL) != 0)
+    {
+      puts ("create failed");
+      exit (1);
+    }
+
+  void *r;
+  if (pthread_join (th, &r) != 0)
+    {
+      puts ("join failed");
+      exit (1);
+    }
+  if (r != (void *) 1l)
+    {
+      puts ("thread has wrong return value");
+      exit (1);
+    }
+
+  puts ("done");
+
+  return 0;
+}
+
+
+#define TEST_FUNCTION do_test ()
+#include "../test-skeleton.c"
diff --git a/ap/build/uClibc/test/nptl/tst-cpuclock1.c b/ap/build/uClibc/test/nptl/tst-cpuclock1.c
new file mode 100644
index 0000000..024df63
--- /dev/null
+++ b/ap/build/uClibc/test/nptl/tst-cpuclock1.c
@@ -0,0 +1,307 @@
+/* Test program for process CPU clocks.
+   Copyright (C) 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.  */
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <time.h>
+#include <unistd.h>
+#include <fcntl.h>
+#include <string.h>
+#include <errno.h>
+#include <signal.h>
+#include <sys/wait.h>
+
+/* This function is intended to rack up both user and system time.  */
+static void
+chew_cpu (void)
+{
+  while (1)
+    {
+      static volatile char buf[4096];
+      for (int i = 0; i < 100; ++i)
+	for (size_t j = 0; j < sizeof buf; ++j)
+	  buf[j] = 0xaa;
+      int nullfd = open ("/dev/null", O_WRONLY);
+      for (int i = 0; i < 100; ++i)
+	for (size_t j = 0; j < sizeof buf; ++j)
+	  buf[j] = 0xbb;
+      write (nullfd, (char *) buf, sizeof buf);
+      close (nullfd);
+      if (getppid () == 1)
+	_exit (2);
+    }
+}
+
+static int
+do_test (void)
+{
+  int result = 0;
+  clockid_t cl;
+  int e;
+  pid_t dead_child, child;
+
+  /* Fork a child and let it die, to give us a PID known not be valid
+     (assuming PIDs don't wrap around during the test).  */
+  {
+    dead_child = fork ();
+    if (dead_child == 0)
+      _exit (0);
+    if (dead_child < 0)
+      {
+	perror ("fork");
+	return 1;
+      }
+    int x;
+    if (wait (&x) != dead_child)
+      {
+	perror ("wait");
+	return 2;
+      }
+  }
+
+  /* POSIX says we should get ESRCH for this.  */
+  e = clock_getcpuclockid (dead_child, &cl);
+  if (e != ENOSYS && e != ESRCH && e != EPERM)
+    {
+      printf ("clock_getcpuclockid on dead PID %d => %s\n",
+	      dead_child, strerror (e));
+      result = 1;
+    }
+
+  /* Now give us a live child eating up CPU time.  */
+  child = fork ();
+  if (child == 0)
+    {
+      chew_cpu ();
+      _exit (1);
+    }
+  if (child < 0)
+    {
+      perror ("fork");
+      return 1;
+    }
+
+  e = clock_getcpuclockid (child, &cl);
+  if (e == EPERM)
+    {
+      puts ("clock_getcpuclockid does not support other processes");
+      goto done;
+    }
+  if (e != 0)
+    {
+      printf ("clock_getcpuclockid on live PID %d => %s\n",
+	      child, strerror (e));
+      result = 1;
+      goto done;
+    }
+
+  const clockid_t child_clock = cl;
+  struct timespec res;
+  if (clock_getres (child_clock, &res) < 0)
+    {
+      printf ("clock_getres on live PID %d clock %lx => %s\n",
+	      child, (unsigned long int) child_clock, strerror (errno));
+      result = 1;
+      goto done;
+    }
+  printf ("live PID %d clock %lx resolution %lu.%.9lu\n",
+	  child, (unsigned long int) child_clock, res.tv_sec, res.tv_nsec);
+
+  struct timespec before, after;
+  if (clock_gettime (child_clock, &before) < 0)
+    {
+      printf ("clock_gettime on live PID %d clock %lx => %s\n",
+	      child, (unsigned long int) child_clock, strerror (errno));
+      result = 1;
+      goto done;
+    }
+  printf ("live PID %d before sleep => %lu.%.9lu\n",
+	  child, before.tv_sec, before.tv_nsec);
+
+  struct timespec sleeptime = { .tv_nsec = 500000000 };
+  nanosleep (&sleeptime, NULL);
+
+  if (clock_gettime (child_clock, &after) < 0)
+    {
+      printf ("clock_gettime on live PID %d clock %lx => %s\n",
+	      child, (unsigned long int) child_clock, strerror (errno));
+      result = 1;
+      goto done;
+    }
+  printf ("live PID %d after sleep => %lu.%.9lu\n",
+	  child, after.tv_sec, after.tv_nsec);
+
+  struct timespec diff = { .tv_sec = after.tv_sec - before.tv_sec,
+			   .tv_nsec = after.tv_nsec - before.tv_nsec };
+  if (diff.tv_nsec < 0)
+    {
+      --diff.tv_sec;
+      diff.tv_nsec += 1000000000;
+    }
+  if (diff.tv_sec != 0
+      || diff.tv_nsec > 600000000
+      || diff.tv_nsec < 100000000)
+    {
+      printf ("before - after %lu.%.9lu outside reasonable range\n",
+	      diff.tv_sec, diff.tv_nsec);
+      result = 1;
+    }
+
+  sleeptime.tv_nsec = 100000000;
+  e = clock_nanosleep (child_clock, 0, &sleeptime, NULL);
+  if (e == EINVAL || e == ENOTSUP || e == ENOSYS)
+    {
+      printf ("clock_nanosleep not supported for other process clock: %s\n",
+	      strerror (e));
+    }
+  else if (e != 0)
+    {
+      printf ("clock_nanosleep on other process clock: %s\n", strerror (e));
+      result = 1;
+    }
+  else
+    {
+      struct timespec afterns;
+      if (clock_gettime (child_clock, &afterns) < 0)
+	{
+	  printf ("clock_gettime on live PID %d clock %lx => %s\n",
+		  child, (unsigned long int) child_clock, strerror (errno));
+	  result = 1;
+	}
+      else
+	{
+	  struct timespec d = { .tv_sec = afterns.tv_sec - after.tv_sec,
+				.tv_nsec = afterns.tv_nsec - after.tv_nsec };
+	  if (d.tv_nsec < 0)
+	    {
+	      --d.tv_sec;
+	      d.tv_nsec += 1000000000;
+	    }
+	  if (d.tv_sec > 0
+	      || d.tv_nsec < sleeptime.tv_nsec
+	      || d.tv_nsec > sleeptime.tv_nsec * 2)
+	    {
+	      printf ("nanosleep time %lu.%.9lu outside reasonable range\n",
+		      d.tv_sec, d.tv_nsec);
+	      result = 1;
+	    }
+	}
+    }
+
+  if (kill (child, SIGKILL) != 0)
+    {
+      perror ("kill");
+      result = 2;
+      goto done;
+    }
+
+  /* Wait long enough to let the child finish dying.  */
+
+  sleeptime.tv_nsec = 200000000;
+  nanosleep (&sleeptime, NULL);
+
+  struct timespec dead;
+  if (clock_gettime (child_clock, &dead) < 0)
+    {
+      printf ("clock_gettime on dead PID %d clock %lx => %s\n",
+	      child, (unsigned long int) child_clock, strerror (errno));
+      result = 1;
+      goto done;
+    }
+  printf ("dead PID %d => %lu.%.9lu\n",
+	  child, dead.tv_sec, dead.tv_nsec);
+
+  diff.tv_sec = dead.tv_sec - after.tv_sec;
+  diff.tv_nsec = dead.tv_nsec - after.tv_nsec;
+  if (diff.tv_nsec < 0)
+    {
+      --diff.tv_sec;
+      diff.tv_nsec += 1000000000;
+    }
+  if (diff.tv_sec != 0 || diff.tv_nsec > 200000000)
+    {
+      printf ("dead - after %lu.%.9lu outside reasonable range\n",
+	      diff.tv_sec, diff.tv_nsec);
+      result = 1;
+    }
+
+  /* Now reap the child and verify that its clock is no longer valid.  */
+  {
+    int x;
+    if (waitpid (child, &x, 0) != child)
+      {
+	perror ("waitpid");
+	result = 1;
+      }
+  }
+
+  if (clock_gettime (child_clock, &dead) == 0)
+    {
+      printf ("clock_gettime on reaped PID %d clock %lx => %lu%.9lu\n",
+	      child, (unsigned long int) child_clock,
+	      dead.tv_sec, dead.tv_nsec);
+      result = 1;
+    }
+  else
+    {
+      if (errno != EINVAL)
+	result = 1;
+      printf ("clock_gettime on reaped PID %d clock %lx => %s\n",
+	      child, (unsigned long int) child_clock, strerror (errno));
+    }
+
+  if (clock_getres (child_clock, &dead) == 0)
+    {
+      printf ("clock_getres on reaped PID %d clock %lx => %lu%.9lu\n",
+	      child, (unsigned long int) child_clock,
+	      dead.tv_sec, dead.tv_nsec);
+      result = 1;
+    }
+  else
+    {
+      if (errno != EINVAL)
+	result = 1;
+      printf ("clock_getres on reaped PID %d clock %lx => %s\n",
+	      child, (unsigned long int) child_clock, strerror (errno));
+    }
+
+  return result;
+
+ done:
+  {
+    if (kill (child, SIGKILL) != 0 && errno != ESRCH)
+      {
+	perror ("kill");
+	return 2;
+      }
+    int x;
+    if (waitpid (child, &x, 0) != child && errno != ECHILD)
+      {
+	perror ("waitpid");
+	return 2;
+      }
+  }
+
+  return result;
+}
+
+
+#define TIMEOUT 5
+#define TEST_FUNCTION do_test ()
+#include "../test-skeleton.c"
diff --git a/ap/build/uClibc/test/nptl/tst-cpuclock2.c b/ap/build/uClibc/test/nptl/tst-cpuclock2.c
new file mode 100644
index 0000000..d1621f3
--- /dev/null
+++ b/ap/build/uClibc/test/nptl/tst-cpuclock2.c
@@ -0,0 +1,332 @@
+/* Test program for process and thread CPU clocks.
+   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.  */
+
+#include <unistd.h>
+
+#if (_POSIX_THREADS - 0) <= 0
+
+# define TEST_FUNCTION 0
+
+#else
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <time.h>
+#include <fcntl.h>
+#include <string.h>
+#include <errno.h>
+#include <pthread.h>
+
+static pthread_barrier_t barrier;
+
+/* This function is intended to rack up both user and system time.  */
+static void *
+chew_cpu (void *arg)
+{
+  pthread_barrier_wait (&barrier);
+
+  while (1)
+    {
+      static volatile char buf[4096];
+      for (int i = 0; i < 100; ++i)
+	for (size_t j = 0; j < sizeof buf; ++j)
+	  buf[j] = 0xaa;
+      int nullfd = open ("/dev/null", O_WRONLY);
+      for (int i = 0; i < 100; ++i)
+	for (size_t j = 0; j < sizeof buf; ++j)
+	  buf[j] = 0xbb;
+      write (nullfd, (char *) buf, sizeof buf);
+      close (nullfd);
+    }
+
+  return NULL;
+}
+
+static unsigned long long int
+tsdiff (const struct timespec *before, const struct timespec *after)
+{
+  struct timespec diff = { .tv_sec = after->tv_sec - before->tv_sec,
+			   .tv_nsec = after->tv_nsec - before->tv_nsec };
+  while (diff.tv_nsec < 0)
+    {
+      --diff.tv_sec;
+      diff.tv_nsec += 1000000000;
+    }
+  return diff.tv_sec * 1000000000ULL + diff.tv_nsec;
+}
+
+static unsigned long long int
+test_nanosleep (clockid_t clock, const char *which,
+		const struct timespec *before, int *bad)
+{
+  const struct timespec sleeptime = { .tv_nsec = 100000000 };
+  int e = clock_nanosleep (clock, 0, &sleeptime, NULL);
+  if (e == EINVAL || e == ENOTSUP || e == ENOSYS)
+    {
+      printf ("clock_nanosleep not supported for %s CPU clock: %s\n",
+	      which, strerror (e));
+      return 0;
+    }
+  if (e != 0)
+    {
+      printf ("clock_nanosleep on %s CPU clock: %s\n", which, strerror (e));
+      *bad = 1;
+      return 0;
+    }
+
+  struct timespec after;
+  if (clock_gettime (clock, &after) < 0)
+    {
+      printf ("clock_gettime on %s CPU clock %lx => %s\n",
+	      which, (unsigned long int) clock, strerror (errno));
+      *bad = 1;
+      return 0;
+    }
+
+  unsigned long long int diff = tsdiff (before, &after);
+  if (diff < sleeptime.tv_nsec || diff > sleeptime.tv_nsec * 2)
+    {
+      printf ("clock_nanosleep on %s slept %llu (outside reasonable range)\n",
+	      which, diff);
+      *bad = 1;
+      return diff;
+    }
+
+  struct timespec sleeptimeabs = sleeptime;
+  sleeptimeabs.tv_sec += after.tv_sec;
+  sleeptimeabs.tv_nsec += after.tv_nsec;
+  while (sleeptimeabs.tv_nsec > 1000000000)
+    {
+      ++sleeptimeabs.tv_sec;
+      sleeptimeabs.tv_nsec -= 1000000000;
+    }
+  e = clock_nanosleep (clock, TIMER_ABSTIME, &sleeptimeabs, NULL);
+  if (e != 0)
+    {
+      printf ("absolute clock_nanosleep on %s CPU clock: %s\n",
+	      which, strerror (e));
+      *bad = 1;
+      return diff;
+    }
+
+  struct timespec afterabs;
+  if (clock_gettime (clock, &afterabs) < 0)
+    {
+      printf ("clock_gettime on %s CPU clock %lx => %s\n",
+	      which, (unsigned long int) clock, strerror (errno));
+      *bad = 1;
+      return diff;
+    }
+
+  unsigned long long int sleepdiff = tsdiff (&sleeptimeabs, &afterabs);
+  if (sleepdiff > sleeptime.tv_nsec)
+    {
+      printf ("\
+absolute clock_nanosleep on %s %llu past target (outside reasonable range)\n",
+	      which, sleepdiff);
+      *bad = 1;
+    }
+
+  unsigned long long int diffabs = tsdiff (&after, &afterabs);
+  if (diffabs < sleeptime.tv_nsec || diffabs > sleeptime.tv_nsec * 2)
+    {
+      printf ("\
+absolute clock_nanosleep on %s slept %llu (outside reasonable range)\n",
+	      which, diffabs);
+      *bad = 1;
+    }
+
+  return diff + diffabs;
+}
+
+
+
+static int
+do_test (void)
+{
+  int result = 0;
+  clockid_t process_clock, th_clock, my_thread_clock;
+  int e;
+  pthread_t th;
+
+  e = clock_getcpuclockid (0, &process_clock);
+  if (e != 0)
+    {
+      printf ("clock_getcpuclockid on self => %s\n", strerror (e));
+      return 1;
+    }
+
+  e = pthread_getcpuclockid (pthread_self (), &my_thread_clock);
+  if (e != 0)
+    {
+      printf ("pthread_getcpuclockid on self => %s\n", strerror (e));
+      return 1;
+    }
+
+  /* This is a kludge.  This test fails if the semantics of thread and
+     process clocks are wrong.  The old code using hp-timing without kernel
+     support has bogus semantics if there are context switches.  We don't
+     fail to report failure when the proper functionality is not available
+     in the kernel.  It so happens that Linux kernels without correct CPU
+     clock support also lack CPU timer support, so we use use that to guess
+     that we are using the bogus code and not test it.  */
+  timer_t t;
+  if (timer_create (my_thread_clock, NULL, &t) != 0)
+    {
+      printf ("timer_create: %m\n");
+      puts ("No support for CPU clocks with good semantics, skipping test");
+      return 0;
+    }
+  timer_delete (t);
+
+
+  pthread_barrier_init (&barrier, NULL, 2);
+
+  e = pthread_create (&th, NULL, chew_cpu, NULL);
+  if (e != 0)
+    {
+      printf ("pthread_create: %s\n", strerror (e));
+      return 1;
+    }
+
+  e = pthread_getcpuclockid (th, &th_clock);
+  if (e == ENOENT || e == ENOSYS || e == ENOTSUP)
+    {
+      puts ("pthread_getcpuclockid does not support other threads");
+      return 1;
+    }
+
+  pthread_barrier_wait (&barrier);
+
+  struct timespec res;
+  if (clock_getres (th_clock, &res) < 0)
+    {
+      printf ("clock_getres on thread clock %lx => %s\n",
+	      (unsigned long int) th_clock, strerror (errno));
+      result = 1;
+      return 1;
+    }
+  printf ("live thread clock %lx resolution %lu.%.9lu\n",
+	  (unsigned long int) th_clock, res.tv_sec, res.tv_nsec);
+
+  struct timespec process_before, process_after;
+  if (clock_gettime (process_clock, &process_before) < 0)
+    {
+      printf ("clock_gettime on process clock %lx => %s\n",
+	      (unsigned long int) th_clock, strerror (errno));
+      return 1;
+    }
+
+  struct timespec before, after;
+  if (clock_gettime (th_clock, &before) < 0)
+    {
+      printf ("clock_gettime on live thread clock %lx => %s\n",
+	      (unsigned long int) th_clock, strerror (errno));
+      return 1;
+    }
+  printf ("live thread before sleep => %lu.%.9lu\n",
+	  before.tv_sec, before.tv_nsec);
+
+  struct timespec me_before, me_after;
+  if (clock_gettime (my_thread_clock, &me_before) < 0)
+    {
+      printf ("clock_gettime on live thread clock %lx => %s\n",
+	      (unsigned long int) th_clock, strerror (errno));
+      return 1;
+    }
+  printf ("self thread before sleep => %lu.%.9lu\n",
+	  me_before.tv_sec, me_before.tv_nsec);
+
+  struct timespec sleeptime = { .tv_nsec = 500000000 };
+  nanosleep (&sleeptime, NULL);
+
+  if (clock_gettime (th_clock, &after) < 0)
+    {
+      printf ("clock_gettime on live thread clock %lx => %s\n",
+	      (unsigned long int) th_clock, strerror (errno));
+      return 1;
+    }
+  printf ("live thread after sleep => %lu.%.9lu\n",
+	  after.tv_sec, after.tv_nsec);
+
+  if (clock_gettime (process_clock, &process_after) < 0)
+    {
+      printf ("clock_gettime on process clock %lx => %s\n",
+	      (unsigned long int) th_clock, strerror (errno));
+      return 1;
+    }
+
+  if (clock_gettime (my_thread_clock, &me_after) < 0)
+    {
+      printf ("clock_gettime on live thread clock %lx => %s\n",
+	      (unsigned long int) th_clock, strerror (errno));
+      return 1;
+    }
+  printf ("self thread after sleep => %lu.%.9lu\n",
+	  me_after.tv_sec, me_after.tv_nsec);
+
+  unsigned long long int th_diff = tsdiff (&before, &after);
+  unsigned long long int pdiff = tsdiff (&process_before, &process_after);
+  unsigned long long int my_diff = tsdiff (&me_before, &me_after);
+
+  if (th_diff < 100000000 || th_diff > 600000000)
+    {
+      printf ("thread before - after %llu outside reasonable range\n",
+	      th_diff);
+      result = 1;
+    }
+
+  if (my_diff > 100000000)
+    {
+      printf ("self thread before - after %llu outside reasonable range\n",
+	      my_diff);
+      result = 1;
+    }
+
+  if (pdiff < th_diff)
+    {
+      printf ("process before - after %llu outside reasonable range (%llu)\n",
+	      pdiff, th_diff);
+      result = 1;
+    }
+
+  process_after.tv_nsec += test_nanosleep (th_clock, "thread",
+					   &after, &result);
+  process_after.tv_nsec += test_nanosleep (process_clock, "process",
+					   &process_after, &result);
+  test_nanosleep (CLOCK_PROCESS_CPUTIME_ID,
+		  "PROCESS_CPUTIME_ID", &process_after, &result);
+
+  pthread_cancel (th);
+
+  e = clock_nanosleep (CLOCK_THREAD_CPUTIME_ID, 0, &sleeptime, NULL);
+  if (e != EINVAL)
+    {
+      printf ("clock_nanosleep CLOCK_THREAD_CPUTIME_ID: %s\n",
+	      strerror (e));
+      result = 1;
+    }
+
+  return result;
+}
+# define TIMEOUT 8
+# define TEST_FUNCTION do_test ()
+#endif
+
+#include "../test-skeleton.c"
diff --git a/ap/build/uClibc/test/nptl/tst-cputimer1.c b/ap/build/uClibc/test/nptl/tst-cputimer1.c
new file mode 100644
index 0000000..8f5dd76
--- /dev/null
+++ b/ap/build/uClibc/test/nptl/tst-cputimer1.c
@@ -0,0 +1,68 @@
+/* Tests for POSIX timer implementation using process CPU clock.  */
+
+#include <unistd.h>
+
+#if _POSIX_THREADS && defined _POSIX_CPUTIME
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <fcntl.h>
+#include <time.h>
+#include <pthread.h>
+
+#define TEST_CLOCK CLOCK_PROCESS_CPUTIME_ID
+#define TEST_CLOCK_MISSING(clock) \
+  (setup_test () ? "process CPU clock timer support" : NULL)
+
+/* This function is intended to rack up both user and system time.  */
+static void *
+chew_cpu (void *arg)
+{
+  while (1)
+    {
+      static volatile char buf[4096];
+      for (int i = 0; i < 100; ++i)
+	for (size_t j = 0; j < sizeof buf; ++j)
+	  buf[j] = 0xaa;
+      int nullfd = open ("/dev/null", O_WRONLY);
+      for (int i = 0; i < 100; ++i)
+	for (size_t j = 0; j < sizeof buf; ++j)
+	  buf[j] = 0xbb;
+      write (nullfd, (char *) buf, sizeof buf);
+      close (nullfd);
+    }
+
+  return NULL;
+}
+
+static int
+setup_test (void)
+{
+  /* Test timers on our own process CPU clock by having a worker thread
+     eating CPU.  First make sure we can make such timers at all.  */
+
+  timer_t t;
+  if (timer_create (TEST_CLOCK, NULL, &t) != 0)
+    {
+      printf ("timer_create: %m\n");
+      return 1;
+    }
+  timer_delete (t);
+
+  pthread_t th;
+  int e = pthread_create (&th, NULL, chew_cpu, NULL);
+  if (e != 0)
+    {
+      printf ("pthread_create: %s\n", strerror (e));
+      exit (1);
+    }
+
+  return 0;
+}
+
+#else
+# define TEST_CLOCK_MISSING(clock) "process clocks"
+#endif
+
+#include "tst-timer4.c"
diff --git a/ap/build/uClibc/test/nptl/tst-cputimer2.c b/ap/build/uClibc/test/nptl/tst-cputimer2.c
new file mode 100644
index 0000000..397d799
--- /dev/null
+++ b/ap/build/uClibc/test/nptl/tst-cputimer2.c
@@ -0,0 +1,83 @@
+/* Tests for POSIX timer implementation using thread CPU clock.  */
+
+#include <unistd.h>
+
+#if _POSIX_THREADS && defined _POSIX_CPUTIME
+
+#include <errno.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <fcntl.h>
+#include <time.h>
+#include <pthread.h>
+
+static clockid_t worker_thread_clock;
+
+#define TEST_CLOCK worker_thread_clock
+#define TEST_CLOCK_MISSING(clock) \
+  (setup_test () ? "thread CPU clock timer support" : NULL)
+
+/* This function is intended to rack up both user and system time.  */
+static void *
+chew_cpu (void *arg)
+{
+  while (1)
+    {
+      static volatile char buf[4096];
+      for (int i = 0; i < 100; ++i)
+	for (size_t j = 0; j < sizeof buf; ++j)
+	  buf[j] = 0xaa;
+      int nullfd = open ("/dev/null", O_WRONLY);
+      for (int i = 0; i < 100; ++i)
+	for (size_t j = 0; j < sizeof buf; ++j)
+	  buf[j] = 0xbb;
+      write (nullfd, (char *) buf, sizeof buf);
+      close (nullfd);
+    }
+
+  return NULL;
+}
+
+static int
+setup_test (void)
+{
+  /* Test timers on a thread CPU clock by having a worker thread eating
+     CPU.  First make sure we can make such timers at all.  */
+
+  pthread_t th;
+  int e = pthread_create (&th, NULL, chew_cpu, NULL);
+  if (e != 0)
+    {
+      printf ("pthread_create: %s\n", strerror (e));
+      exit (1);
+    }
+
+  e = pthread_getcpuclockid (th, &worker_thread_clock);
+  if (e == EPERM || e == ENOENT || e == ENOTSUP)
+    {
+      puts ("pthread_getcpuclockid does not support other threads");
+      return 1;
+    }
+  if (e != 0)
+    {
+      printf ("pthread_getcpuclockid: %s\n", strerror (e));
+      exit (1);
+    }
+
+  timer_t t;
+  if (timer_create (TEST_CLOCK, NULL, &t) != 0)
+    {
+      printf ("timer_create: %m\n");
+      return 1;
+    }
+  timer_delete (t);
+
+  return 0;
+}
+
+#else
+# define TEST_CLOCK_MISSING(clock) "process clocks"
+#endif
+
+#include "tst-timer4.c"
diff --git a/ap/build/uClibc/test/nptl/tst-cputimer3.c b/ap/build/uClibc/test/nptl/tst-cputimer3.c
new file mode 100644
index 0000000..056766a
--- /dev/null
+++ b/ap/build/uClibc/test/nptl/tst-cputimer3.c
@@ -0,0 +1,130 @@
+/* Tests for POSIX timer implementation using another process's CPU clock.  */
+
+#include <unistd.h>
+
+#if _POSIX_THREADS && defined _POSIX_CPUTIME
+
+#include <errno.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <fcntl.h>
+#include <time.h>
+#include <signal.h>
+#include <sys/wait.h>
+
+static clockid_t child_clock;
+
+#define TEST_CLOCK child_clock
+#define TEST_CLOCK_MISSING(clock) \
+  (setup_test () ? "other-process CPU clock timer support" : NULL)
+
+/* This function is intended to rack up both user and system time.  */
+static void
+chew_cpu (void)
+{
+  while (1)
+    {
+      static volatile char buf[4096];
+      for (int i = 0; i < 100; ++i)
+	for (size_t j = 0; j < sizeof buf; ++j)
+	  buf[j] = 0xaa;
+      int nullfd = open ("/dev/null", O_WRONLY);
+      for (int i = 0; i < 100; ++i)
+	for (size_t j = 0; j < sizeof buf; ++j)
+	  buf[j] = 0xbb;
+      write (nullfd, (char *) buf, sizeof buf);
+      close (nullfd);
+      if (getppid () == 1)
+	_exit (2);
+    }
+}
+
+static pid_t child;
+static void
+cleanup_child (void)
+{
+  if (child <= 0)
+    return;
+  if (kill (child, SIGKILL) < 0 && errno != ESRCH)
+    printf ("cannot kill child %d: %m\n", child);
+  else
+    {
+      int status;
+      errno = 0;
+      if (waitpid (child, &status, 0) != child)
+	printf ("waitpid %d: %m\n", child);
+    }
+}
+#define CLEANUP_HANDLER cleanup_child ()
+
+static int
+setup_test (void)
+{
+  /* Test timers on a process CPU clock by having a child process eating
+     CPU.  First make sure we can make such timers at all.  */
+
+  int pipefd[2];
+  if (pipe (pipefd) < 0)
+    {
+      printf ("pipe: %m\n");
+      exit (1);
+    }
+
+  child = fork ();
+
+  if (child == 0)
+    {
+      char c;
+      close (pipefd[1]);
+      if (read (pipefd[0], &c, 1) == 1)
+	chew_cpu ();
+      _exit (1);
+    }
+
+  if (child < 0)
+    {
+      printf ("fork: %m\n");
+      exit (1);
+    }
+
+  atexit (&cleanup_child);
+
+  close (pipefd[0]);
+
+  int e = clock_getcpuclockid (child, &child_clock);
+  if (e == EPERM)
+    {
+      puts ("clock_getcpuclockid does not support other processes");
+      return 1;
+    }
+  if (e != 0)
+    {
+      printf ("clock_getcpuclockid: %s\n", strerror (e));
+      exit (1);
+    }
+
+  timer_t t;
+  if (timer_create (TEST_CLOCK, NULL, &t) != 0)
+    {
+      printf ("timer_create: %m\n");
+      return 1;
+    }
+  timer_delete (t);
+
+  /* Get the child started chewing.  */
+  if (write (pipefd[1], "x", 1) != 1)
+    {
+      printf ("write to pipe: %m\n");
+      return 1;
+    }
+  close (pipefd[1]);
+
+  return 0;
+}
+
+#else
+# define TEST_CLOCK_MISSING(clock) "process clocks"
+#endif
+
+#include "tst-timer4.c"
diff --git a/ap/build/uClibc/test/nptl/tst-detach1.c b/ap/build/uClibc/test/nptl/tst-detach1.c
new file mode 100644
index 0000000..7b27f6e
--- /dev/null
+++ b/ap/build/uClibc/test/nptl/tst-detach1.c
@@ -0,0 +1,56 @@
+/* Copyright (C) 2003 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, write to the Free
+   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+   02111-1307 USA.  */
+
+#include <pthread.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <unistd.h>
+
+
+static void *
+tf (void *arg)
+{
+  return NULL;
+}
+
+
+static int
+do_test (void)
+{
+  pthread_t th;
+  if (pthread_create (&th, NULL, tf, (void *) pthread_self ()) != 0)
+    {
+      puts ("create failed");
+      exit (1);
+    }
+
+  /* Give the child a chance to finish.  */
+  sleep (1);
+
+  if (pthread_detach (th) != 0)
+    {
+      puts ("detach failed");
+      exit (1);
+    }
+
+  return 0;
+}
+
+#define TEST_FUNCTION do_test ()
+#include "../test-skeleton.c"
diff --git a/ap/build/uClibc/test/nptl/tst-dlsym1.c b/ap/build/uClibc/test/nptl/tst-dlsym1.c
new file mode 100644
index 0000000..3744570
--- /dev/null
+++ b/ap/build/uClibc/test/nptl/tst-dlsym1.c
@@ -0,0 +1,66 @@
+/* Test case by Hui Huang <hui.huang@sun.com>.  */
+#include <dlfcn.h>
+#include <pthread.h>
+#include <stdio.h>
+#include <stdlib.h>
+
+
+static void *
+start_routine (void *args)
+{
+  int i;
+  void **addrs = (void **) args;
+  for (i = 0; i < 10000; ++i)
+    addrs[i % 1024] = dlsym (NULL, "does_not_exist");
+
+  return addrs;
+}
+
+
+static int
+do_test (void)
+{
+  pthread_t tid1, tid2, tid3;
+
+  void *addrs1[1024];
+  void *addrs2[1024];
+  void *addrs3[1024];
+
+  if (pthread_create (&tid1, NULL, start_routine, addrs1) != 0)
+    {
+      puts ("1st create failed");
+      exit (1);
+    }
+  if (pthread_create (&tid2, NULL, start_routine, addrs2) != 0)
+    {
+      puts ("2nd create failed");
+      exit (1);
+    }
+  if (pthread_create (&tid3, NULL, start_routine, addrs3) != 0)
+    {
+      puts ("3rd create failed");
+      exit (1);
+    }
+
+  if (pthread_join (tid1, NULL) != 0)
+    {
+      puts ("1st join failed");
+      exit (1);
+    }
+  if (pthread_join (tid2, NULL) != 0)
+    {
+      puts ("2nd join failed");
+      exit (1);
+    }
+  if (pthread_join (tid3, NULL) != 0)
+    {
+      puts ("2rd join failed");
+      exit (1);
+    }
+
+  return 0;
+}
+
+
+#define TEST_FUNCTION do_test ()
+#include "../test-skeleton.c"
diff --git a/ap/build/uClibc/test/nptl/tst-eintr1.c b/ap/build/uClibc/test/nptl/tst-eintr1.c
new file mode 100644
index 0000000..43a5df5
--- /dev/null
+++ b/ap/build/uClibc/test/nptl/tst-eintr1.c
@@ -0,0 +1,105 @@
+/* Copyright (C) 2003 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, 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 <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+
+#include "eintr.c"
+
+
+static void *
+tf2 (void *arg)
+{
+  return arg;
+}
+
+
+static void *
+tf1 (void *arg)
+{
+  while (1)
+    {
+      pthread_t th;
+
+      int e = pthread_create (&th, NULL, tf2, NULL);
+      if (e != 0)
+	{
+	  if (e == EINTR)
+	    {
+	      puts ("pthread_create returned EINTR");
+	      exit (1);
+	    }
+
+	  char buf[100];
+	  printf ("tf1: pthread_create failed: %s\n",
+		  strerror_r (e, buf, sizeof (buf)));
+	  exit (1);
+	}
+
+      e = pthread_join (th, NULL);
+      if (e != 0)
+	{
+	  if (e == EINTR)
+	    {
+	      puts ("pthread_join returned EINTR");
+	      exit (1);
+	    }
+
+	  char buf[100];
+	  printf ("tf1: pthread_join failed: %s\n",
+		  strerror_r (e, buf, sizeof (buf)));
+	  exit (1);
+	}
+    }
+}
+
+
+static int
+do_test (void)
+{
+  setup_eintr (SIGUSR1, NULL);
+
+  int i;
+  for (i = 0; i < 10; ++i)
+    {
+      pthread_t th;
+      int e = pthread_create (&th, NULL, tf1, NULL);
+      if (e != 0)
+	{
+	  char buf[100];
+	  printf ("main: pthread_create failed: %s\n",
+		  strerror_r (e, buf, sizeof (buf)));
+	  exit (1);
+	}
+    }
+
+  (void) tf1 (NULL);
+  /* NOTREACHED */
+
+  return 0;
+}
+
+#define EXPECTED_SIGNAL SIGALRM
+#define TIMEOUT 3
+#define TEST_FUNCTION do_test ()
+#include "../test-skeleton.c"
diff --git a/ap/build/uClibc/test/nptl/tst-eintr2.c b/ap/build/uClibc/test/nptl/tst-eintr2.c
new file mode 100644
index 0000000..8cbbc5a
--- /dev/null
+++ b/ap/build/uClibc/test/nptl/tst-eintr2.c
@@ -0,0 +1,118 @@
+/* Copyright (C) 2003 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, 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 <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <sys/time.h>
+
+#include "eintr.c"
+
+
+static pthread_mutex_t m1 = PTHREAD_MUTEX_INITIALIZER;
+static pthread_mutex_t m2 = PTHREAD_MUTEX_INITIALIZER;
+
+
+static void *
+tf1 (void *arg)
+{
+  struct timespec ts;
+  struct timeval tv;
+
+  gettimeofday (&tv, NULL);
+  TIMEVAL_TO_TIMESPEC (&tv, &ts);
+  ts.tv_sec += 10000;
+
+  /* This call must never return.  */
+  int e = pthread_mutex_timedlock (&m1, &ts);
+  char buf[100];
+  printf ("tf1: mutex_timedlock returned: %s\n",
+	  strerror_r (e, buf, sizeof (buf)));
+
+  exit (1);
+}
+
+
+static void *
+tf2 (void *arg)
+{
+  while (1)
+    {
+      int e = pthread_mutex_lock (&m2);
+      if (e != 0)
+	{
+	  puts ("tf2: mutex_lock failed");
+	  exit (1);
+	}
+      e = pthread_mutex_unlock (&m2);
+      if (e != 0)
+	{
+	  puts ("tf2: mutex_unlock failed");
+	  exit (1);
+	}
+      struct timespec ts = { .tv_sec = 0, .tv_nsec = 10000000 };
+      nanosleep (&ts, NULL);
+    }
+}
+
+
+static int
+do_test (void)
+{
+  if (pthread_mutex_lock (&m1) != 0)
+    {
+      puts ("mutex_lock failed");
+      exit (1);
+    }
+
+  setup_eintr (SIGUSR1, NULL);
+
+  pthread_t th;
+  char buf[100];
+  int e = pthread_create (&th, NULL, tf1, NULL);
+  if (e != 0)
+    {
+      printf ("main: 1st pthread_create failed: %s\n",
+	      strerror_r (e, buf, sizeof (buf)));
+      exit (1);
+    }
+
+  e = pthread_create (&th, NULL, tf2, NULL);
+  if (e != 0)
+    {
+      printf ("main: 2nd pthread_create failed: %s\n",
+	      strerror_r (e, buf, sizeof (buf)));
+      exit (1);
+    }
+
+  /* This call must never return.  */
+  e = pthread_mutex_lock (&m1);
+  printf ("main: mutex_lock returned: %s\n",
+	  strerror_r (e, buf, sizeof (buf)));
+
+  return 0;
+}
+
+#define EXPECTED_SIGNAL SIGALRM
+#define TIMEOUT 3
+#define TEST_FUNCTION do_test ()
+#include "../test-skeleton.c"
diff --git a/ap/build/uClibc/test/nptl/tst-eintr3.c b/ap/build/uClibc/test/nptl/tst-eintr3.c
new file mode 100644
index 0000000..eecab48
--- /dev/null
+++ b/ap/build/uClibc/test/nptl/tst-eintr3.c
@@ -0,0 +1,72 @@
+/* Copyright (C) 2003 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, 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 <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+
+#include "eintr.c"
+
+
+static void *
+tf (void *arg)
+{
+  pthread_mutex_t m = PTHREAD_MUTEX_INITIALIZER;
+  pthread_mutex_lock (&m);
+  /* This call must not return.  */
+  pthread_mutex_lock (&m);
+
+  puts ("tf: mutex_lock returned");
+  exit (1);
+}
+
+
+static int
+do_test (void)
+{
+  pthread_t self = pthread_self ();
+
+  setup_eintr (SIGUSR1, &self);
+
+  pthread_t th;
+  char buf[100];
+  int e = pthread_create (&th, NULL, tf, NULL);
+  if (e != 0)
+    {
+      printf ("main: pthread_create failed: %s\n",
+	      strerror_r (e, buf, sizeof (buf)));
+      exit (1);
+    }
+
+  /* This call must never return.  */
+  e = pthread_join (th, NULL);
+
+  if (e == EINTR)
+    puts ("pthread_join returned with EINTR");
+
+  return 0;
+}
+
+#define EXPECTED_SIGNAL SIGALRM
+#define TIMEOUT 1
+#define TEST_FUNCTION do_test ()
+#include "../test-skeleton.c"
diff --git a/ap/build/uClibc/test/nptl/tst-eintr4.c b/ap/build/uClibc/test/nptl/tst-eintr4.c
new file mode 100644
index 0000000..dffbdd6
--- /dev/null
+++ b/ap/build/uClibc/test/nptl/tst-eintr4.c
@@ -0,0 +1,56 @@
+/* Copyright (C) 2003 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, 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 <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+
+#include "eintr.c"
+
+
+static int
+do_test (void)
+{
+  pthread_t self = pthread_self ();
+
+  setup_eintr (SIGUSR1, &self);
+
+  pthread_barrier_t b;
+  if (pthread_barrier_init (&b, NULL, 2) != 0)
+    {
+      puts ("barrier_init failed");
+      exit (1);
+    }
+
+  /* This call must never return.  */
+  int e = pthread_barrier_wait (&b);
+
+  if (e == EINTR)
+    puts ("pthread_join returned with EINTR");
+
+  return 0;
+}
+
+#define EXPECTED_SIGNAL SIGALRM
+#define TIMEOUT 1
+#define TEST_FUNCTION do_test ()
+#include "../test-skeleton.c"
diff --git a/ap/build/uClibc/test/nptl/tst-eintr5.c b/ap/build/uClibc/test/nptl/tst-eintr5.c
new file mode 100644
index 0000000..91473ec
--- /dev/null
+++ b/ap/build/uClibc/test/nptl/tst-eintr5.c
@@ -0,0 +1,81 @@
+/* Copyright (C) 2003 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, 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 <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <sys/time.h>
+
+#include "eintr.c"
+
+
+static pthread_mutex_t m = PTHREAD_MUTEX_INITIALIZER;
+static pthread_cond_t c = PTHREAD_COND_INITIALIZER;
+
+
+static void *
+tf (void *arg)
+{
+  struct timespec ts;
+  struct timeval tv;
+
+  gettimeofday (&tv, NULL);
+  TIMEVAL_TO_TIMESPEC (&tv, &ts);
+  ts.tv_sec += 10000;
+
+  /* This call must never return.  */
+  int e = pthread_cond_timedwait (&c, &m, &ts);
+  char buf[100];
+  printf ("tf: cond_timedwait returned: %s\n",
+	  strerror_r (e, buf, sizeof (buf)));
+
+  exit (1);
+}
+
+
+static int
+do_test (void)
+{
+  setup_eintr (SIGUSR1, NULL);
+
+  pthread_t th;
+  char buf[100];
+  int e = pthread_create (&th, NULL, tf, NULL);
+  if (e != 0)
+    {
+      printf ("main: pthread_create failed: %s\n",
+	      strerror_r (e, buf, sizeof (buf)));
+      exit (1);
+    }
+
+  /* This call must never return.  */
+  e = pthread_cond_wait (&c, &m);
+  printf ("main: cond_wait returned: %s\n",
+	  strerror_r (e, buf, sizeof (buf)));
+
+  return 0;
+}
+
+#define EXPECTED_SIGNAL SIGALRM
+#define TIMEOUT 3
+#define TEST_FUNCTION do_test ()
+#include "../test-skeleton.c"
diff --git a/ap/build/uClibc/test/nptl/tst-exec2.c b/ap/build/uClibc/test/nptl/tst-exec2.c
new file mode 100644
index 0000000..432da32
--- /dev/null
+++ b/ap/build/uClibc/test/nptl/tst-exec2.c
@@ -0,0 +1,154 @@
+/* Thread with running thread calls exec.
+   Copyright (C) 2002 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+   Contributed by Ulrich Drepper <drepper@redhat.com>, 2002.
+
+   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 <errno.h>
+#include <paths.h>
+#include <pthread.h>
+#include <signal.h>
+#include <stdbool.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <unistd.h>
+#include <sys/wait.h>
+
+
+static void *
+tf (void *arg)
+{
+  pthread_t th = (pthread_t) arg;
+
+  if (pthread_join (th, NULL) == 0)
+    {
+      puts ("thread in parent joined!?");
+      exit (1);
+    }
+
+  puts ("join in thread in parent returned!?");
+  exit (1);
+}
+
+
+static int
+do_test (void)
+{
+  int fd[2];
+  if (pipe (fd) != 0)
+    {
+      puts ("pipe failed");
+      exit (1);
+    }
+
+  /* Not interested in knowing when the pipe is closed.  */
+  if (sigignore (SIGPIPE) != 0)
+    {
+      puts ("sigignore failed");
+      exit (1);
+    }
+
+  pid_t pid = fork ();
+  if (pid == -1)
+    {
+      puts ("fork failed");
+      exit (1);
+    }
+
+  if (pid == 0)
+    {
+      /* Use the fd for stdout.  This is kind of ugly because it
+	 substitutes the fd of stdout but we know what we are doing
+	 here...  */
+      if (dup2 (fd[1], STDOUT_FILENO) != STDOUT_FILENO)
+	{
+	  puts ("dup2 failed");
+	  exit (1);
+	}
+
+      close (fd[0]);
+
+      pthread_t th;
+      if (pthread_create (&th, NULL, tf, (void *) pthread_self ()) != 0)
+	{
+	  puts ("create failed");
+	  exit (1);
+	}
+
+      execl (_PATH_BSHELL, _PATH_BSHELL, "-c", "echo $$", NULL);
+
+      puts ("execl failed");
+      exit (1);
+    }
+
+  close (fd[1]);
+
+  char buf[200];
+  ssize_t n;
+  bool seen_pid = false;
+  while (TEMP_FAILURE_RETRY ((n = read (fd[0], buf, sizeof (buf)))) > 0)
+    {
+      /* We only expect to read the PID.  */
+      char *endp;
+      long int rpid = strtol (buf, &endp, 10);
+
+      if (*endp != '\n')
+	{
+	  printf ("didn't parse whole line: \"%s\"\n", buf);
+	  exit (1);
+	}
+      if (endp == buf)
+	{
+	  puts ("read empty line");
+	  exit (1);
+	}
+
+      if (rpid != pid)
+	{
+	  printf ("found \"%s\", expected PID %ld\n", buf, (long int) pid);
+	  exit (1);
+	}
+
+      if (seen_pid)
+	{
+	  puts ("found more than one PID line");
+	  exit (1);
+	}
+      seen_pid = true;
+    }
+
+  close (fd[0]);
+
+  int status;
+  int err = waitpid (pid, &status, 0);
+  if (err != pid)
+    {
+      puts ("waitpid failed");
+      exit (1);
+    }
+
+  if (!seen_pid)
+    {
+      puts ("didn't get PID");
+      exit (1);
+    }
+
+  return 0;
+}
+
+#define TEST_FUNCTION do_test ()
+#include "../test-skeleton.c"
diff --git a/ap/build/uClibc/test/nptl/tst-exec3.c b/ap/build/uClibc/test/nptl/tst-exec3.c
new file mode 100644
index 0000000..be49b04
--- /dev/null
+++ b/ap/build/uClibc/test/nptl/tst-exec3.c
@@ -0,0 +1,152 @@
+/* Thread calls exec.
+   Copyright (C) 2002 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+   Contributed by Ulrich Drepper <drepper@redhat.com>, 2002.
+
+   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 <errno.h>
+#include <paths.h>
+#include <pthread.h>
+#include <signal.h>
+#include <stdbool.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <unistd.h>
+#include <sys/wait.h>
+
+
+static void *
+tf (void *arg)
+{
+  execl (_PATH_BSHELL, _PATH_BSHELL, "-c", "echo $$", NULL);
+
+  puts ("execl failed");
+  exit (1);
+}
+
+
+static int
+do_test (void)
+{
+  int fd[2];
+  if (pipe (fd) != 0)
+    {
+      puts ("pipe failed");
+      exit (1);
+    }
+
+  /* Not interested in knowing when the pipe is closed.  */
+  if (sigignore (SIGPIPE) != 0)
+    {
+      puts ("sigignore failed");
+      exit (1);
+    }
+
+  pid_t pid = fork ();
+  if (pid == -1)
+    {
+      puts ("fork failed");
+      exit (1);
+    }
+
+  if (pid == 0)
+    {
+      /* Use the fd for stdout.  This is kind of ugly because it
+	 substitutes the fd of stdout but we know what we are doing
+	 here...  */
+      if (dup2 (fd[1], STDOUT_FILENO) != STDOUT_FILENO)
+	{
+	  puts ("dup2 failed");
+	  exit (1);
+	}
+
+      close (fd[0]);
+
+      pthread_t th;
+      if (pthread_create (&th, NULL, tf, NULL) != 0)
+	{
+	  puts ("create failed");
+	  exit (1);
+	}
+
+      if (pthread_join (th, NULL) == 0)
+	{
+	  puts ("join succeeded!?");
+	  exit (1);
+	}
+
+      puts ("join returned!?");
+      exit (1);
+    }
+
+  close (fd[1]);
+
+  char buf[200];
+  ssize_t n;
+  bool seen_pid = false;
+  while (TEMP_FAILURE_RETRY ((n = read (fd[0], buf, sizeof (buf)))) > 0)
+    {
+      /* We only expect to read the PID.  */
+      char *endp;
+      long int rpid = strtol (buf, &endp, 10);
+
+      if (*endp != '\n')
+	{
+	  printf ("didn't parse whole line: \"%s\"\n", buf);
+	  exit (1);
+	}
+      if (endp == buf)
+	{
+	  puts ("read empty line");
+	  exit (1);
+	}
+
+      if (rpid != pid)
+	{
+	  printf ("found \"%s\", expected PID %ld\n", buf, (long int) pid);
+	  exit (1);
+	}
+
+      if (seen_pid)
+	{
+	  puts ("found more than one PID line");
+	  exit (1);
+	}
+      seen_pid = true;
+    }
+
+  close (fd[0]);
+
+  int status;
+  int err = waitpid (pid, &status, 0);
+  if (err != pid)
+    {
+      puts ("waitpid failed");
+      exit (1);
+    }
+
+  if (!seen_pid)
+    {
+      puts ("didn't get PID");
+      exit (1);
+    }
+
+  return 0;
+}
+
+#define TEST_FUNCTION do_test ()
+#include "../test-skeleton.c"
diff --git a/ap/build/uClibc/test/nptl/tst-exec4.c b/ap/build/uClibc/test/nptl/tst-exec4.c
new file mode 100644
index 0000000..b3920a0
--- /dev/null
+++ b/ap/build/uClibc/test/nptl/tst-exec4.c
@@ -0,0 +1,116 @@
+/* Signal handler and mask set in thread which calls exec.
+   Copyright (C) 2003 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, write to the Free
+   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+   02111-1307 USA.  */
+
+#include <pthread.h>
+#include <signal.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <unistd.h>
+
+
+static void *
+tf (void *arg)
+{
+  /* Ignore SIGUSR1 and block SIGUSR2.  */
+  if (sigignore (SIGUSR1) != 0)
+    {
+      puts ("sigignore failed");
+      exit (1);
+    }
+
+  sigset_t ss;
+  sigemptyset (&ss);
+  sigaddset (&ss, SIGUSR2);
+  if (pthread_sigmask (SIG_BLOCK, &ss, NULL) != 0)
+    {
+      puts ("1st run: sigmask failed");
+      exit (1);
+    }
+
+  char **oldargv = (char **) arg;
+  size_t n = 1;
+  while (oldargv[n] != NULL)
+    ++n;
+
+  char **argv = (char **) alloca ((n + 1) * sizeof (char *));
+  for (n = 0; oldargv[n + 1] != NULL; ++n)
+    argv[n] = oldargv[n + 1];
+  argv[n++] = (char *) "--direct";
+  argv[n] = NULL;
+
+  execv (argv[0], argv);
+
+  puts ("execv failed");
+
+  exit (1);
+}
+
+
+static int
+do_test (int argc, char *argv[])
+{
+  if (argc == 1)
+    {
+      /* This is the second call.  Perform the test.  */
+      struct sigaction sa;
+
+      if (sigaction (SIGUSR1, NULL, &sa) != 0)
+	{
+	  puts ("2nd run: sigaction failed");
+	  return 1;
+	}
+      if (sa.sa_handler != SIG_IGN)
+	{
+	  puts ("SIGUSR1 not ignored");
+	  return 1;
+	}
+
+      sigset_t ss;
+      if (pthread_sigmask (SIG_SETMASK, NULL, &ss) != 0)
+	{
+	  puts ("2nd run: sigmask failed");
+	  return 1;
+	}
+      if (! sigismember (&ss, SIGUSR2))
+	{
+	  puts ("SIGUSR2 not blocked");
+	  return 1;
+	}
+
+      return 0;
+    }
+
+  pthread_t th;
+  if (pthread_create (&th, NULL, tf, argv) != 0)
+    {
+      puts ("create failed");
+      exit (1);
+    }
+
+  /* This call should never return.  */
+  pthread_join (th, NULL);
+
+  puts ("join returned");
+
+  return 1;
+}
+
+#define TEST_FUNCTION do_test (argc, argv)
+#include "../test-skeleton.c"
diff --git a/ap/build/uClibc/test/nptl/tst-exit1.c b/ap/build/uClibc/test/nptl/tst-exit1.c
new file mode 100644
index 0000000..44175f7
--- /dev/null
+++ b/ap/build/uClibc/test/nptl/tst-exit1.c
@@ -0,0 +1,79 @@
+/* Copyright (C) 2002, 2003 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+   Contributed by Ulrich Drepper <drepper@redhat.com>, 2002.
+
+   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.  */
+
+/* NOTE: this tests functionality beyond POSIX.  POSIX does not allow
+   exit to be called more than once.  */
+
+#include <pthread.h>
+#include <stdio.h>
+#include <stdlib.h>
+
+static pthread_barrier_t b;
+
+
+static void *
+tf (void *arg)
+{
+  int r = pthread_barrier_wait (&b);
+  if (r != 0 && r != PTHREAD_BARRIER_SERIAL_THREAD)
+    {
+      puts ("barrier_wait failed");
+      exit (1);
+    }
+
+  exit (0);
+}
+
+
+static int
+do_test (void)
+{
+  if (pthread_barrier_init (&b, NULL, 2) != 0)
+    {
+      puts ("barrier_init failed");
+      exit (1);
+    }
+
+  pthread_t th;
+  if (pthread_create (&th, NULL, tf, NULL) != 0)
+    {
+      puts ("create failed");
+      exit (1);
+    }
+
+  int r = pthread_barrier_wait (&b);
+  if (r != 0 && r != PTHREAD_BARRIER_SERIAL_THREAD)
+    {
+      puts ("barrier_wait failed");
+      exit (1);
+    }
+
+  /* Do nothing.  */
+  if (pthread_join (th, NULL) == 0)
+    {
+      puts ("join succeeded!?");
+      exit (1);
+    }
+
+  puts ("join returned!?");
+  exit (1);
+}
+
+#define TEST_FUNCTION do_test ()
+#include "../test-skeleton.c"
diff --git a/ap/build/uClibc/test/nptl/tst-exit2.c b/ap/build/uClibc/test/nptl/tst-exit2.c
new file mode 100644
index 0000000..3f5ff27
--- /dev/null
+++ b/ap/build/uClibc/test/nptl/tst-exit2.c
@@ -0,0 +1,40 @@
+#include <pthread.h>
+#include <signal.h>
+#include <stdio.h>
+#include <string.h>
+#include <unistd.h>
+
+
+static void *
+tf (void *arg)
+{
+  while (1)
+    sleep (100);
+
+  /* NOTREACHED */
+  return NULL;
+}
+
+
+static int
+do_test (void)
+{
+  pthread_t th;
+
+  int e = pthread_create (&th, NULL, tf, NULL);
+  if (e != 0)
+    {
+      printf ("create failed: %s\n", strerror (e));
+      return 1;
+    }
+
+  /* Terminate only this thread.  */
+  pthread_exit (NULL);
+
+  /* NOTREACHED */
+  return 1;
+}
+
+#define EXPECTED_SIGNAL SIGALRM
+#define TEST_FUNCTION do_test ()
+#include "../test-skeleton.c"
diff --git a/ap/build/uClibc/test/nptl/tst-exit3.c b/ap/build/uClibc/test/nptl/tst-exit3.c
new file mode 100644
index 0000000..da92c82
--- /dev/null
+++ b/ap/build/uClibc/test/nptl/tst-exit3.c
@@ -0,0 +1,81 @@
+#include <pthread.h>
+#include <signal.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <unistd.h>
+
+
+static pthread_barrier_t b;
+
+
+static void *
+tf2 (void *arg)
+{
+  while (1)
+    sleep (100);
+
+  /* NOTREACHED */
+  return NULL;
+}
+
+
+static void *
+tf (void *arg)
+{
+  pthread_t th;
+
+  int e = pthread_barrier_wait (&b);
+  if (e != 0 && e != PTHREAD_BARRIER_SERIAL_THREAD)
+    {
+      puts ("barrier_wait failed");
+      exit (1);
+    }
+
+  e = pthread_create (&th, NULL, tf2, NULL);
+  if (e != 0)
+    {
+      printf ("create failed: %s\n", strerror (e));
+      exit (1);
+    }
+
+  /* Terminate only this thread.  */
+  return NULL;
+}
+
+
+static int
+do_test (void)
+{
+  pthread_t th;
+
+  if (pthread_barrier_init (&b, NULL, 2) != 0)
+    {
+      puts ("barrier_init failed");
+      exit (1);
+    }
+
+  int e = pthread_create (&th, NULL, tf, NULL);
+  if (e != 0)
+    {
+      printf ("create failed: %s\n", strerror (e));
+      exit (1);
+    }
+
+  e = pthread_barrier_wait (&b);
+  if (e != 0 && e != PTHREAD_BARRIER_SERIAL_THREAD)
+    {
+      puts ("barrier_wait failed");
+      exit (1);
+    }
+
+  /* Terminate only this thread.  */
+  pthread_exit (NULL);
+
+  /* NOTREACHED */
+  return 1;
+}
+
+#define EXPECTED_SIGNAL SIGALRM
+#define TEST_FUNCTION do_test ()
+#include "../test-skeleton.c"
diff --git a/ap/build/uClibc/test/nptl/tst-fini1.c b/ap/build/uClibc/test/nptl/tst-fini1.c
new file mode 100644
index 0000000..bec4be1
--- /dev/null
+++ b/ap/build/uClibc/test/nptl/tst-fini1.c
@@ -0,0 +1,35 @@
+/* Copyright (C) 2004 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+   Contributed by Ulrich Drepper <drepper@redhat.com>, 2004.
+
+   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 <unistd.h>
+
+extern void m (void);
+
+int
+main (void)
+{
+  alarm (5);
+
+  m ();
+
+  /* The destructor is supposed to run now.  Make sure that if it is
+     not we will notice it by using 42 as the exit code.  In case the
+     destructor is run it will terminate with status zero.  */
+  return 42;
+}
diff --git a/ap/build/uClibc/test/nptl/tst-fini1mod.c b/ap/build/uClibc/test/nptl/tst-fini1mod.c
new file mode 100644
index 0000000..492d9ff
--- /dev/null
+++ b/ap/build/uClibc/test/nptl/tst-fini1mod.c
@@ -0,0 +1,72 @@
+/* Copyright (C) 2004 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+   Contributed by Ulrich Drepper <drepper@redhat.com>, 2004.
+
+   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>
+#include <stdio.h>
+#include <stdlib.h>
+#include <unistd.h>
+
+
+static void *
+tf (void *arg)
+{
+  int fds[2];
+  if (pipe (fds) != 0)
+    {
+      puts ("pipe failed");
+      exit (1);
+    }
+
+  char buf[10];
+  read (fds[0], buf, sizeof (buf));
+
+  puts ("read returned");
+  exit (1);
+}
+
+static pthread_t th;
+
+static void
+__attribute ((destructor))
+dest (void)
+{
+  if (pthread_cancel (th) != 0)
+    {
+      puts ("cancel failed");
+      _exit (1);
+    }
+  void *r;
+  if (pthread_join (th, &r) != 0)
+    {
+      puts ("join failed");
+      _exit (1);
+    }
+  /* Exit successfully.  */
+  _exit (0);
+}
+
+void
+m (void)
+{
+  if (pthread_create (&th, NULL, tf, NULL) != 0)
+    {
+      puts ("create failed");
+      _exit (1);
+    }
+}
diff --git a/ap/build/uClibc/test/nptl/tst-flock1.c b/ap/build/uClibc/test/nptl/tst-flock1.c
new file mode 100644
index 0000000..ed2472d
--- /dev/null
+++ b/ap/build/uClibc/test/nptl/tst-flock1.c
@@ -0,0 +1,93 @@
+/* Copyright (C) 2002 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+   Contributed by Ulrich Drepper <drepper@redhat.com>, 2002.
+
+   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>
+#include <stdio.h>
+#include <stdlib.h>
+#include <unistd.h>
+#include <sys/file.h>
+
+
+static pthread_mutex_t lock = PTHREAD_MUTEX_INITIALIZER;
+
+static int fd;
+
+
+static void *
+tf (void *arg)
+{
+  if (flock (fd, LOCK_SH | LOCK_NB) != 0)
+    {
+      puts ("second flock failed");
+      exit (1);
+    }
+
+  pthread_mutex_unlock (&lock);
+
+  return NULL;
+}
+
+
+static int
+do_test (void)
+{
+  char tmp[] = "/tmp/tst-flock1-XXXXXX";
+
+  fd = mkstemp (tmp);
+  if (fd == -1)
+    {
+      puts ("mkstemp failed");
+      exit (1);
+    }
+
+  unlink (tmp);
+
+  write (fd, "foobar xyzzy", 12);
+
+  if (flock (fd, LOCK_EX | LOCK_NB) != 0)
+    {
+      puts ("first flock failed");
+      exit (1);
+    }
+
+  pthread_mutex_lock (&lock);
+
+  pthread_t th;
+  if (pthread_create (&th, NULL, tf, NULL) != 0)
+    {
+      puts ("pthread_create failed");
+      exit (1);
+    }
+
+  pthread_mutex_lock (&lock);
+
+  void *result;
+  if (pthread_join (th, &result) != 0)
+    {
+      puts ("pthread_join failed");
+      exit (1);
+    }
+
+  close (fd);
+
+  return result != NULL;
+}
+
+#define TEST_FUNCTION do_test ()
+#include "../test-skeleton.c"
diff --git a/ap/build/uClibc/test/nptl/tst-flock2.c b/ap/build/uClibc/test/nptl/tst-flock2.c
new file mode 100644
index 0000000..8ef3206
--- /dev/null
+++ b/ap/build/uClibc/test/nptl/tst-flock2.c
@@ -0,0 +1,260 @@
+/* Copyright (C) 2002, 2003, 2004 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+   Contributed by Ulrich Drepper <drepper@redhat.com>, 2002.
+
+   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 <errno.h>
+#include <pthread.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <unistd.h>
+#include <sys/file.h>
+#include <sys/mman.h>
+#include <sys/wait.h>
+
+
+static pthread_mutex_t lock = PTHREAD_MUTEX_INITIALIZER;
+static pthread_mutex_t lock2 = PTHREAD_MUTEX_INITIALIZER;
+static int fd;
+
+
+static void *
+tf (void *arg)
+{
+  struct flock fl =
+    {
+      .l_type = F_WRLCK,
+      .l_start = 0,
+      .l_whence = SEEK_SET,
+      .l_len = 10
+    };
+  if (TEMP_FAILURE_RETRY (fcntl (fd, F_SETLKW, &fl)) != 0)
+    {
+      puts ("fourth fcntl failed");
+      exit (1);
+    }
+
+  pthread_mutex_unlock (&lock);
+
+  pthread_mutex_lock (&lock2);
+
+  return NULL;
+}
+
+
+static int
+do_test (void)
+{
+  char tmp[] = "/tmp/tst-flock2-XXXXXX";
+
+  fd = mkstemp (tmp);
+  if (fd == -1)
+    {
+      puts ("mkstemp failed");
+      return 1;
+    }
+
+  unlink (tmp);
+
+  int i;
+  for (i = 0; i < 20; ++i)
+    write (fd, "foobar xyzzy", 12);
+
+  pthread_barrier_t *b;
+  b = mmap (NULL, sizeof (pthread_barrier_t), PROT_READ | PROT_WRITE,
+	    MAP_SHARED, fd, 0);
+  if (b == MAP_FAILED)
+    {
+      puts ("mmap failed");
+      return 1;
+    }
+
+  pthread_barrierattr_t ba;
+  if (pthread_barrierattr_init (&ba) != 0)
+    {
+      puts ("barrierattr_init failed");
+      return 1;
+    }
+
+  if (pthread_barrierattr_setpshared (&ba, PTHREAD_PROCESS_SHARED) != 0)
+    {
+      puts ("barrierattr_setpshared failed");
+      return 1;
+    }
+
+  if (pthread_barrier_init (b, &ba, 2) != 0)
+    {
+      puts ("barrier_init failed");
+      return 1;
+    }
+
+  if (pthread_barrierattr_destroy (&ba) != 0)
+    {
+      puts ("barrierattr_destroy failed");
+      return 1;
+    }
+
+  struct flock fl =
+    {
+      .l_type = F_WRLCK,
+      .l_start = 0,
+      .l_whence = SEEK_SET,
+      .l_len = 10
+    };
+  if (TEMP_FAILURE_RETRY (fcntl (fd, F_SETLKW, &fl)) != 0)
+    {
+      puts ("first fcntl failed");
+      return 1;
+    }
+
+  pid_t pid = fork ();
+  if (pid == -1)
+    {
+      puts ("fork failed");
+      return 1;
+    }
+
+  if (pid == 0)
+    {
+      /* Make sure the child does not stay around indefinitely.  */
+      alarm (10);
+
+      /* Try to get the lock.  */
+      if (TEMP_FAILURE_RETRY (fcntl (fd, F_SETLK, &fl)) == 0)
+	{
+	  puts ("child:  second flock succeeded");
+	  return 1;
+	}
+    }
+
+  pthread_barrier_wait (b);
+
+  if (pid != 0)
+    {
+      fl.l_type = F_UNLCK;
+      if (TEMP_FAILURE_RETRY (fcntl (fd, F_SETLKW, &fl)) != 0)
+	{
+	  puts ("third fcntl failed");
+	  return 1;
+	}
+    }
+
+  pthread_barrier_wait (b);
+
+  pthread_t th;
+  if (pid == 0)
+    {
+      if (pthread_mutex_lock (&lock) != 0)
+	{
+	  puts ("1st locking of lock failed");
+	  return 1;
+	}
+
+      if (pthread_mutex_lock (&lock2) != 0)
+	{
+	  puts ("1st locking of lock2 failed");
+	  return 1;
+	}
+
+      if (pthread_create (&th, NULL, tf, NULL) != 0)
+	{
+	  puts ("pthread_create failed");
+	  return 1;
+	}
+
+      if (pthread_mutex_lock (&lock) != 0)
+	{
+	  puts ("2nd locking of lock failed");
+	  return 1;
+	}
+
+      puts ("child locked file");
+    }
+
+  pthread_barrier_wait (b);
+
+  if (pid != 0)
+    {
+      fl.l_type = F_WRLCK;
+      if (TEMP_FAILURE_RETRY (fcntl (fd, F_SETLK, &fl)) == 0)
+	{
+	  puts ("fifth fcntl succeeded");
+	  return 1;
+	}
+
+      puts ("file locked by child");
+    }
+
+  pthread_barrier_wait (b);
+
+  if (pid == 0)
+    {
+      if (pthread_mutex_unlock (&lock2) != 0)
+	{
+	  puts ("unlock of lock2 failed");
+	  return 1;
+	}
+
+      if (pthread_join (th, NULL) != 0)
+	{
+	  puts ("join failed");
+	  return 1;
+	}
+
+      puts ("child's thread terminated");
+    }
+
+  pthread_barrier_wait (b);
+
+  if (pid != 0)
+    {
+      fl.l_type = F_WRLCK;
+      if (TEMP_FAILURE_RETRY (fcntl (fd, F_SETLK, &fl)) == 0)
+	{
+	  puts ("fifth fcntl succeeded");
+	  return 1;
+	}
+
+      puts ("file still locked");
+    }
+
+  pthread_barrier_wait (b);
+
+  if (pid == 0)
+    {
+      _exit (0);
+    }
+
+  int status;
+  if (TEMP_FAILURE_RETRY (waitpid (pid, &status, 0)) != pid)
+    {
+      puts ("waitpid failed");
+      return 1;
+    }
+  puts ("child terminated");
+
+  if (TEMP_FAILURE_RETRY (fcntl (fd, F_SETLKW, &fl)) != 0)
+    {
+      puts ("sixth fcntl failed");
+      return 1;
+    }
+
+  return status;
+}
+
+#define TEST_FUNCTION do_test ()
+#include "../test-skeleton.c"
diff --git a/ap/build/uClibc/test/nptl/tst-fork1.c b/ap/build/uClibc/test/nptl/tst-fork1.c
new file mode 100644
index 0000000..33c4ed8
--- /dev/null
+++ b/ap/build/uClibc/test/nptl/tst-fork1.c
@@ -0,0 +1,120 @@
+/* Copyright (C) 2002, 2004 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+   Contributed by Roland McGrath <roland@redhat.com>, 2002.
+
+   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 <errno.h>
+#include <pthread.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <unistd.h>
+#include <sys/wait.h>
+
+static void *
+thread_function (void * arg)
+{
+  int i = (intptr_t) arg;
+  int status;
+  pid_t pid;
+  pid_t pid2;
+
+  pid = fork ();
+  switch (pid)
+    {
+    case 0:
+      printf ("%ld for %d\n", (long int) getpid (), i);
+      struct timespec ts = { .tv_sec = 0, .tv_nsec = 100000000 * i };
+      nanosleep (&ts, NULL);
+      _exit (i);
+      break;
+    case -1:
+      printf ("fork: %m\n");
+      return (void *) 1l;
+      break;
+    }
+
+  pid2 = TEMP_FAILURE_RETRY (waitpid (pid, &status, 0));
+  if (pid2 != pid)
+    {
+      printf ("waitpid returned %ld, expected %ld\n",
+	      (long int) pid2, (long int) pid);
+      return (void *) 1l;
+    }
+
+  printf ("%ld with %d, expected %d\n",
+	  (long int) pid, WEXITSTATUS (status), i);
+
+  return WEXITSTATUS (status) == i ? NULL : (void *) 1l;
+}
+
+#define N 5
+static const int t[N] = { 7, 6, 5, 4, 3 };
+
+int
+main (void)
+{
+  pthread_t th[N];
+  int i;
+  int result = 0;
+  pthread_attr_t at;
+
+  if (pthread_attr_init (&at) != 0)
+    {
+      puts ("attr_init failed");
+      return 1;
+    }
+
+  if (pthread_attr_setstacksize (&at, 1 * 1024 * 1024) != 0)
+    {
+      puts ("attr_setstacksize failed");
+      return 1;
+    }
+
+  for (i = 0; i < N; ++i)
+    if (pthread_create (&th[i], NULL, thread_function,
+			(void *) (intptr_t) t[i]) != 0)
+      {
+	printf ("creation of thread %d failed\n", i);
+	exit (1);
+      }
+
+  if (pthread_attr_destroy (&at) != 0)
+    {
+      puts ("attr_destroy failed");
+      return 1;
+    }
+
+  for (i = 0; i < N; ++i)
+    {
+      void *v;
+      if (pthread_join (th[i], &v) != 0)
+	{
+	  printf ("join of thread %d failed\n", i);
+	  result = 1;
+	}
+      else if (v != NULL)
+	{
+	  printf ("join %d successful, but child failed\n", i);
+	  result = 1;
+	}
+      else
+	printf ("join %d successful\n", i);
+    }
+
+  return result;
+}
diff --git a/ap/build/uClibc/test/nptl/tst-fork2.c b/ap/build/uClibc/test/nptl/tst-fork2.c
new file mode 100644
index 0000000..07d6c22
--- /dev/null
+++ b/ap/build/uClibc/test/nptl/tst-fork2.c
@@ -0,0 +1,90 @@
+/* Copyright (C) 2002 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+   Contributed by Roland McGrath <roland@redhat.com>, 2002.
+
+   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 <errno.h>
+#include <pthread.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <unistd.h>
+#include <sys/wait.h>
+
+
+static pid_t initial_pid;
+
+
+static void *
+tf (void *arg)
+{
+  if (getppid () != initial_pid)
+    {
+      printf ("getppid in thread returned %ld, expected %ld\n",
+	      (long int) getppid (), (long int) initial_pid);
+      return (void *) -1;
+    }
+
+  return NULL;
+}
+
+
+int
+main (void)
+{
+  initial_pid = getpid ();
+
+  pid_t child = fork ();
+  if (child == 0)
+    {
+      if (getppid () != initial_pid)
+	{
+	  printf ("first getppid returned %ld, expected %ld\n",
+		  (long int) getppid (), (long int) initial_pid);
+	  exit (1);
+	}
+
+      pthread_t th;
+      if (pthread_create (&th, NULL, tf, NULL) != 0)
+	{
+	  puts ("pthread_create failed");
+	  exit (1);
+	}
+
+      void *result;
+      if (pthread_join (th, &result) != 0)
+	{
+	  puts ("pthread_join failed");
+	  exit  (1);
+	}
+
+      exit (result == NULL ? 0 : 1);
+    }
+  else if (child == -1)
+    {
+      puts ("initial fork failed");
+      return 1;
+    }
+
+  int status;
+  if (TEMP_FAILURE_RETRY (waitpid (child, &status, 0)) != child)
+    {
+      printf ("waitpid failed: %m\n");
+      return 1;
+    }
+
+  return status;
+}
diff --git a/ap/build/uClibc/test/nptl/tst-fork3.c b/ap/build/uClibc/test/nptl/tst-fork3.c
new file mode 100644
index 0000000..bc73853
--- /dev/null
+++ b/ap/build/uClibc/test/nptl/tst-fork3.c
@@ -0,0 +1,107 @@
+/* Copyright (C) 2002 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+   Contributed by Roland McGrath <roland@redhat.com>, 2002.
+
+   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 <errno.h>
+#include <pthread.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <unistd.h>
+#include <sys/wait.h>
+
+
+static pid_t initial_pid;
+
+
+static void *
+tf2 (void *arg)
+{
+  if (getppid () != initial_pid)
+    {
+      printf ("getppid in thread returned %ld, expected %ld\n",
+	      (long int) getppid (), (long int) initial_pid);
+      return (void *) -1;
+    }
+
+  return NULL;
+}
+
+
+static void *
+tf1 (void *arg)
+{
+  pid_t child = fork ();
+  if (child == 0)
+    {
+      if (getppid () != initial_pid)
+	{
+	  printf ("first getppid returned %ld, expected %ld\n",
+		  (long int) getppid (), (long int) initial_pid);
+	  exit (1);
+	}
+
+      pthread_t th2;
+      if (pthread_create (&th2, NULL, tf2, NULL) != 0)
+	{
+	  puts ("child: pthread_create failed");
+	  exit (1);
+	}
+
+      void *result;
+      if (pthread_join (th2, &result) != 0)
+	{
+	  puts ("pthread_join failed");
+	  exit  (1);
+	}
+
+      exit (result == NULL ? 0 : 1);
+    }
+  else if (child == -1)
+    {
+      puts ("initial fork failed");
+      exit (1);
+    }
+
+  int status;
+  if (TEMP_FAILURE_RETRY (waitpid (child, &status, 0)) != child)
+    {
+      printf ("waitpid failed: %m\n");
+      exit (1);
+    }
+
+  exit (status);
+}
+
+
+int
+main (void)
+{
+  initial_pid = getpid ();
+
+  pthread_t th1;
+  if (pthread_create (&th1, NULL, tf1, NULL) != 0)
+    {
+      puts ("parent: pthread_create failed");
+      exit (1);
+    }
+
+  /* This call should never return.  */
+  pthread_join (th1, NULL);
+
+  return 1;
+}
diff --git a/ap/build/uClibc/test/nptl/tst-fork4.c b/ap/build/uClibc/test/nptl/tst-fork4.c
new file mode 100644
index 0000000..cca19f4
--- /dev/null
+++ b/ap/build/uClibc/test/nptl/tst-fork4.c
@@ -0,0 +1,65 @@
+/* Test of fork updating child universe's pthread structures.
+   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 <errno.h>
+#include <pthread.h>
+#include <stdio.h>
+#include <unistd.h>
+#include <sys/types.h>
+#include <sys/wait.h>
+#include <string.h>
+
+
+static int
+do_test (void)
+{
+  pthread_t me = pthread_self ();
+
+  pid_t pid = fork ();
+
+  if (pid < 0)
+    {
+      printf ("fork: %m\n");
+      return 1;
+    }
+
+  if (pid == 0)
+    {
+      int err = pthread_kill (me, SIGTERM);
+      printf ("pthread_kill returned: %s\n", strerror (err));
+      return 3;
+    }
+
+  int status;
+  errno = 0;
+  if (wait (&status) != pid)
+    printf ("wait failed: %m\n");
+  else if (WIFSIGNALED (status) && WTERMSIG (status) == SIGTERM)
+    {
+      printf ("child correctly died with SIGTERM\n");
+      return 0;
+    }
+  else
+    printf ("child died with bad status %#x\n", status);
+
+  return 1;
+}
+
+#define TEST_FUNCTION do_test ()
+#include "../test-skeleton.c"
diff --git a/ap/build/uClibc/test/nptl/tst-getpid1.c b/ap/build/uClibc/test/nptl/tst-getpid1.c
new file mode 100644
index 0000000..4d25b0d
--- /dev/null
+++ b/ap/build/uClibc/test/nptl/tst-getpid1.c
@@ -0,0 +1,122 @@
+#include <sched.h>
+#include <signal.h>
+#include <string.h>
+#include <stdio.h>
+#include <unistd.h>
+#include <sys/types.h>
+#include <sys/wait.h>
+#include <bits/stackinfo.h>
+
+#ifndef TEST_CLONE_FLAGS
+#define TEST_CLONE_FLAGS 0
+#endif
+
+static int sig;
+
+static int
+f (void *a)
+{
+  puts ("in f");
+  union sigval sival;
+  sival.sival_int = getpid ();
+  printf ("pid = %d\n", sival.sival_int);
+  if (sigqueue (getppid (), sig, sival) != 0)
+    return 1;
+  return 0;
+}
+
+
+static int
+do_test (void)
+{
+  int mypid = getpid ();
+
+  sig = SIGRTMIN;
+  sigset_t ss;
+  sigemptyset (&ss);
+  sigaddset (&ss, sig);
+  if (sigprocmask (SIG_BLOCK, &ss, NULL) != 0)
+    {
+      printf ("sigprocmask failed: %m\n");
+      return 1;
+    }
+
+#ifdef __ia64__
+  extern int __clone2 (int (*__fn) (void *__arg), void *__child_stack_base,
+		       size_t __child_stack_size, int __flags,
+		       void *__arg, ...);
+  char st[256 * 1024] __attribute__ ((aligned));
+  pid_t p = __clone2 (f, st, sizeof (st), TEST_CLONE_FLAGS, 0);
+#else
+  char st[128 * 1024] __attribute__ ((aligned));
+# if _STACK_GROWS_DOWN
+  pid_t p = clone (f, st + sizeof (st), TEST_CLONE_FLAGS, 0);
+# elif _STACK_GROWS_UP
+  pid_t p = clone (f, st, TEST_CLONE_FLAGS, 0);
+# else
+#  error "Define either _STACK_GROWS_DOWN or _STACK_GROWS_UP"
+# endif
+#endif
+  if (p == -1)
+    {
+      printf("clone failed: %m\n");
+      return 1;
+    }
+  printf ("new thread: %d\n", (int) p);
+
+  siginfo_t si;
+  do
+    if (sigwaitinfo (&ss, &si) < 0)
+      {
+	printf("sigwaitinfo failed: %m\n");
+	kill (p, SIGKILL);
+	return 1;
+      }
+  while  (si.si_signo != sig || si.si_code != SI_QUEUE);
+
+  int e;
+  if (waitpid (p, &e, __WCLONE) != p)
+    {
+      puts ("waitpid failed");
+      kill (p, SIGKILL);
+      return 1;
+    }
+  if (!WIFEXITED (e))
+    {
+      if (WIFSIGNALED (e))
+	printf ("died from signal %s\n", strsignal (WTERMSIG (e)));
+      else
+	puts ("did not terminate correctly");
+      return 1;
+    }
+  if (WEXITSTATUS (e) != 0)
+    {
+      printf ("exit code %d\n", WEXITSTATUS (e));
+      return 1;
+    }
+
+  if (si.si_int != (int) p)
+    {
+      printf ("expected PID %d, got si_int %d\n", (int) p, si.si_int);
+      kill (p, SIGKILL);
+      return 1;
+    }
+
+  if (si.si_pid != p)
+    {
+      printf ("expected PID %d, got si_pid %d\n", (int) p, (int) si.si_pid);
+      kill (p, SIGKILL);
+      return 1;
+    }
+
+  if (getpid () != mypid)
+    {
+      puts ("my PID changed");
+      return 1;
+    }
+
+  return 0;
+}
+
+#define TEST_FUNCTION do_test ()
+#include "../test-skeleton.c"
diff --git a/ap/build/uClibc/test/nptl/tst-getpid2.c b/ap/build/uClibc/test/nptl/tst-getpid2.c
new file mode 100644
index 0000000..fc98cb6
--- /dev/null
+++ b/ap/build/uClibc/test/nptl/tst-getpid2.c
@@ -0,0 +1,2 @@
+#define TEST_CLONE_FLAGS CLONE_VM
+#include "tst-getpid1.c"
diff --git a/ap/build/uClibc/test/nptl/tst-getpid3.c b/ap/build/uClibc/test/nptl/tst-getpid3.c
new file mode 100644
index 0000000..f1e77f6
--- /dev/null
+++ b/ap/build/uClibc/test/nptl/tst-getpid3.c
@@ -0,0 +1,114 @@
+#include <errno.h>
+#include <pthread.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <unistd.h>
+#include <sys/wait.h>
+
+
+static pid_t pid;
+
+static void *
+pid_thread (void *arg)
+{
+  if (pid != getpid ())
+    {
+      printf ("pid wrong in thread: should be %d, is %d\n",
+	      (int) pid, (int) getpid ());
+      return (void *) 1L;
+    }
+
+  return NULL;
+}
+
+static int
+do_test (void)
+{
+  pid = getpid ();
+
+  pthread_t thr;
+  int ret = pthread_create (&thr, NULL, pid_thread, NULL);
+  if (ret)
+    {
+      printf ("pthread_create failed: %d\n", ret);
+      return 1;
+    }
+
+  void *thr_ret;
+  ret = pthread_join (thr, &thr_ret);
+  if (ret)
+    {
+      printf ("pthread_create failed: %d\n", ret);
+      return 1;
+    }
+  else if (thr_ret)
+    {
+      printf ("thread getpid failed\n");
+      return 1;
+    }
+
+  pid_t child = fork ();
+  if (child == -1)
+    {
+      printf ("fork failed: %m\n");
+      return 1;
+    }
+  else if (child == 0)
+    {
+      if (pid == getpid ())
+	{
+	  puts ("pid did not change after fork");
+	  exit (1);
+	}
+
+      pid = getpid ();
+      ret = pthread_create (&thr, NULL, pid_thread, NULL);
+      if (ret)
+	{
+	  printf ("pthread_create failed: %d\n", ret);
+	  return 1;
+	}
+
+      ret = pthread_join (thr, &thr_ret);
+      if (ret)
+	{
+	  printf ("pthread_create failed: %d\n", ret);
+	  return 1;
+	}
+      else if (thr_ret)
+	{
+	  printf ("thread getpid failed\n");
+	  return 1;
+	}
+
+      return 0;
+    }
+
+  int status;
+  if (TEMP_FAILURE_RETRY (waitpid (child, &status, 0)) != child)
+    {
+      puts ("waitpid failed");
+      kill (child, SIGKILL);
+      return 1;
+    }
+
+  if (!WIFEXITED (status))
+    {
+      if (WIFSIGNALED (status))
+	printf ("died from signal %s\n", strsignal (WTERMSIG (status)));
+      else
+	puts ("did not terminate correctly");
+      return 1;
+    }
+  if (WEXITSTATUS (status) != 0)
+    {
+      printf ("exit code %d\n", WEXITSTATUS (status));
+      return 1;
+    }
+
+  return 0;
+}
+
+#define TEST_FUNCTION do_test ()
+#include "../test-skeleton.c"
diff --git a/ap/build/uClibc/test/nptl/tst-initializers1-c89.c b/ap/build/uClibc/test/nptl/tst-initializers1-c89.c
new file mode 100644
index 0000000..7c27c1d
--- /dev/null
+++ b/ap/build/uClibc/test/nptl/tst-initializers1-c89.c
@@ -0,0 +1 @@
+#include "tst-initializers1.c"
diff --git a/ap/build/uClibc/test/nptl/tst-initializers1-c99.c b/ap/build/uClibc/test/nptl/tst-initializers1-c99.c
new file mode 100644
index 0000000..7c27c1d
--- /dev/null
+++ b/ap/build/uClibc/test/nptl/tst-initializers1-c99.c
@@ -0,0 +1 @@
+#include "tst-initializers1.c"
diff --git a/ap/build/uClibc/test/nptl/tst-initializers1-gnu89.c b/ap/build/uClibc/test/nptl/tst-initializers1-gnu89.c
new file mode 100644
index 0000000..7c27c1d
--- /dev/null
+++ b/ap/build/uClibc/test/nptl/tst-initializers1-gnu89.c
@@ -0,0 +1 @@
+#include "tst-initializers1.c"
diff --git a/ap/build/uClibc/test/nptl/tst-initializers1-gnu99.c b/ap/build/uClibc/test/nptl/tst-initializers1-gnu99.c
new file mode 100644
index 0000000..7c27c1d
--- /dev/null
+++ b/ap/build/uClibc/test/nptl/tst-initializers1-gnu99.c
@@ -0,0 +1 @@
+#include "tst-initializers1.c"
diff --git a/ap/build/uClibc/test/nptl/tst-initializers1.c b/ap/build/uClibc/test/nptl/tst-initializers1.c
new file mode 100644
index 0000000..ccd2728
--- /dev/null
+++ b/ap/build/uClibc/test/nptl/tst-initializers1.c
@@ -0,0 +1,48 @@
+/* Copyright (C) 2005 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+   Contributed by Jakub Jelinek <jakub@redhat.com>, 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 <pthread.h>
+
+pthread_mutex_t mtx_normal = PTHREAD_MUTEX_INITIALIZER;
+pthread_mutex_t mtx_recursive = PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP;
+pthread_mutex_t mtx_errorchk = PTHREAD_ERRORCHECK_MUTEX_INITIALIZER_NP;
+pthread_mutex_t mtx_adaptive = PTHREAD_ADAPTIVE_MUTEX_INITIALIZER_NP;
+pthread_rwlock_t rwl_normal = PTHREAD_RWLOCK_INITIALIZER;
+pthread_rwlock_t rwl_writer
+  = PTHREAD_RWLOCK_WRITER_NONRECURSIVE_INITIALIZER_NP;
+pthread_cond_t cond = PTHREAD_COND_INITIALIZER;
+
+int
+main (void)
+{
+  if (mtx_normal.__data.__kind != PTHREAD_MUTEX_TIMED_NP)
+    return 1;
+  if (mtx_recursive.__data.__kind != PTHREAD_MUTEX_RECURSIVE_NP)
+    return 1;
+  if (mtx_errorchk.__data.__kind != PTHREAD_MUTEX_ERRORCHECK_NP)
+    return 1;
+  if (mtx_adaptive.__data.__kind != PTHREAD_MUTEX_ADAPTIVE_NP)
+    return 1;
+  if (rwl_normal.__data.__flags != PTHREAD_RWLOCK_PREFER_READER_NP)
+    return 1;
+  if (rwl_writer.__data.__flags
+      != PTHREAD_RWLOCK_PREFER_WRITER_NONRECURSIVE_NP)
+    return 1;
+  return 0;
+}
diff --git a/ap/build/uClibc/test/nptl/tst-join1.c b/ap/build/uClibc/test/nptl/tst-join1.c
new file mode 100644
index 0000000..95a78ba
--- /dev/null
+++ b/ap/build/uClibc/test/nptl/tst-join1.c
@@ -0,0 +1,83 @@
+/* Copyright (C) 2002 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+   Contributed by Ulrich Drepper <drepper@redhat.com>, 2002.
+
+   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>
+#include <stdio.h>
+#include <stdlib.h>
+
+
+static pthread_mutex_t lock = PTHREAD_MUTEX_INITIALIZER;
+
+
+static void *
+tf (void *arg)
+{
+  pthread_t mh = (pthread_t) arg;
+  void *result;
+
+  if (pthread_mutex_unlock (&lock) != 0)
+    {
+      puts ("unlock failed");
+      exit (1);
+    }
+
+  if (pthread_join (mh, &result) != 0)
+    {
+      puts ("join failed");
+      exit (1);
+    }
+
+  if (result != (void *) 42l)
+    {
+      printf ("result wrong: expected %p, got %p\n", (void *) 42, result);
+      exit (1);
+    }
+
+  exit (0);
+}
+
+
+static int
+do_test (void)
+{
+  pthread_t th;
+
+  if (pthread_mutex_lock (&lock) != 0)
+    {
+      puts ("1st lock failed");
+      exit (1);
+    }
+
+  if (pthread_create (&th, NULL, tf, (void *) pthread_self ()) != 0)
+    {
+      puts ("create failed");
+      exit (1);
+    }
+
+  if (pthread_mutex_lock (&lock) != 0)
+    {
+      puts ("2nd lock failed");
+      exit (1);
+    }
+
+  pthread_exit ((void *) 42);
+}
+
+#define TEST_FUNCTION do_test ()
+#include "../test-skeleton.c"
diff --git a/ap/build/uClibc/test/nptl/tst-join2.c b/ap/build/uClibc/test/nptl/tst-join2.c
new file mode 100644
index 0000000..2cfab8b
--- /dev/null
+++ b/ap/build/uClibc/test/nptl/tst-join2.c
@@ -0,0 +1,104 @@
+/* Copyright (C) 2002 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+   Contributed by Ulrich Drepper <drepper@redhat.com>, 2002.
+
+   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 <errno.h>
+#include <pthread.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <time.h>
+
+
+static pthread_mutex_t lock = PTHREAD_MUTEX_INITIALIZER;
+
+
+static void *
+tf (void *arg)
+{
+  if (pthread_mutex_lock (&lock) != 0)
+    {
+      puts ("child: mutex_lock failed");
+      return NULL;
+    }
+
+  return (void *) 42l;
+}
+
+
+static int
+do_test (void)
+{
+  pthread_t th;
+
+  if (pthread_mutex_lock (&lock) != 0)
+    {
+      puts ("mutex_lock failed");
+      exit (1);
+    }
+
+  if (pthread_create (&th, NULL, tf, NULL) != 0)
+    {
+      puts ("mutex_create failed");
+      exit (1);
+    }
+
+  void *status;
+  int val = pthread_tryjoin_np (th, &status);
+  if (val == 0)
+    {
+      puts ("1st tryjoin succeeded");
+      exit (1);
+    }
+  else if (val != EBUSY)
+    {
+      puts ("1st tryjoin didn't return EBUSY");
+      exit (1);
+    }
+
+  if (pthread_mutex_unlock (&lock) != 0)
+    {
+      puts ("mutex_unlock failed");
+      exit (1);
+    }
+
+  while ((val = pthread_tryjoin_np (th, &status)) != 0)
+    {
+      if (val != EBUSY)
+	{
+	  printf ("tryjoin returned %s (%d), expected only 0 or EBUSY\n",
+		  strerror (val), val);
+	  exit (1);
+	}
+
+      /* Delay minimally.  */
+      struct timespec ts = { .tv_sec = 0, .tv_nsec = 10000000 };
+      nanosleep (&ts, NULL);
+    }
+
+  if (status != (void *) 42l)
+    {
+      printf ("return value %p, expected %p\n", status, (void *) 42l);
+      exit (1);
+    }
+
+  return 0;
+}
+
+#define TEST_FUNCTION do_test ()
+#include "../test-skeleton.c"
diff --git a/ap/build/uClibc/test/nptl/tst-join3.c b/ap/build/uClibc/test/nptl/tst-join3.c
new file mode 100644
index 0000000..df1135f
--- /dev/null
+++ b/ap/build/uClibc/test/nptl/tst-join3.c
@@ -0,0 +1,123 @@
+/* Copyright (C) 2002 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+   Contributed by Ulrich Drepper <drepper@redhat.com>, 2002.
+
+   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 <errno.h>
+#include <pthread.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <sys/time.h>
+
+
+static pthread_mutex_t lock = PTHREAD_MUTEX_INITIALIZER;
+
+
+static void *
+tf (void *arg)
+{
+  if (pthread_mutex_lock (&lock) != 0)
+    {
+      puts ("child: mutex_lock failed");
+      return NULL;
+    }
+
+  return (void *) 42l;
+}
+
+
+static int
+do_test (void)
+{
+  pthread_t th;
+
+  if (pthread_mutex_lock (&lock) != 0)
+    {
+      puts ("mutex_lock failed");
+      exit (1);
+    }
+
+  if (pthread_create (&th, NULL, tf, NULL) != 0)
+    {
+      puts ("mutex_create failed");
+      exit (1);
+    }
+
+  void *status;
+  struct timespec ts;
+  struct timeval tv;
+  (void) gettimeofday (&tv, NULL);
+  TIMEVAL_TO_TIMESPEC (&tv, &ts);
+  ts.tv_nsec += 200000000;
+  if (ts.tv_nsec >= 1000000000)
+    {
+      ts.tv_nsec -= 1000000000;
+      ++ts.tv_sec;
+    }
+  int val = pthread_timedjoin_np (th, &status, &ts);
+  if (val == 0)
+    {
+      puts ("1st timedjoin succeeded");
+      exit (1);
+    }
+  else if (val != ETIMEDOUT)
+    {
+      puts ("1st timedjoin didn't return ETIMEDOUT");
+      exit (1);
+    }
+
+  if (pthread_mutex_unlock (&lock) != 0)
+    {
+      puts ("mutex_unlock failed");
+      exit (1);
+    }
+
+  while (1)
+    {
+      (void) gettimeofday (&tv, NULL);
+      TIMEVAL_TO_TIMESPEC (&tv, &ts);
+      ts.tv_nsec += 200000000;
+      if (ts.tv_nsec >= 1000000000)
+	{
+	  ts.tv_nsec -= 1000000000;
+	  ++ts.tv_sec;
+	}
+
+      val = pthread_timedjoin_np (th, &status, &ts);
+      if (val == 0)
+	break;
+
+      if (val != ETIMEDOUT)
+	{
+	  printf ("timedjoin returned %s (%d), expected only 0 or ETIMEDOUT\n",
+		  strerror (val), val);
+	  exit (1);
+	}
+    }
+
+  if (status != (void *) 42l)
+    {
+      printf ("return value %p, expected %p\n", status, (void *) 42l);
+      exit (1);
+    }
+
+  return 0;
+}
+
+#define TEST_FUNCTION do_test ()
+#include "../test-skeleton.c"
diff --git a/ap/build/uClibc/test/nptl/tst-join4.c b/ap/build/uClibc/test/nptl/tst-join4.c
new file mode 100644
index 0000000..b13a510
--- /dev/null
+++ b/ap/build/uClibc/test/nptl/tst-join4.c
@@ -0,0 +1,125 @@
+/* Copyright (C) 2003, 2004 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, write to the Free
+   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+   02111-1307 USA.  */
+
+#include <errno.h>
+#include <pthread.h>
+#include <stdio.h>
+#include <stdlib.h>
+
+
+static pthread_barrier_t bar;
+
+
+static void *
+tf (void *arg)
+{
+  if (pthread_barrier_wait (&bar) != 0)
+    {
+      puts ("tf: barrier_wait failed");
+      exit (1);
+    }
+
+  return (void *) 1l;
+}
+
+
+static int
+do_test (void)
+{
+  if (pthread_barrier_init (&bar, NULL, 3) != 0)
+    {
+      puts ("barrier_init failed");
+      exit (1);
+    }
+
+  pthread_attr_t a;
+
+  if (pthread_attr_init (&a) != 0)
+    {
+      puts ("attr_init failed");
+      exit (1);
+    }
+
+  if (pthread_attr_setstacksize (&a, 1 * 1024 * 1024) != 0)
+    {
+      puts ("attr_setstacksize failed");
+      return 1;
+    }
+
+  pthread_t th[2];
+
+  if (pthread_create (&th[0], &a, tf, NULL) != 0)
+    {
+      puts ("1st create failed");
+      exit (1);
+    }
+
+  if (pthread_attr_setdetachstate (&a, PTHREAD_CREATE_DETACHED) != 0)
+    {
+      puts ("attr_setdetachstate failed");
+      exit (1);
+    }
+
+  if (pthread_create (&th[1], &a, tf, NULL) != 0)
+    {
+      puts ("1st create failed");
+      exit (1);
+    }
+
+  if (pthread_attr_destroy (&a) != 0)
+    {
+      puts ("attr_destroy failed");
+      exit (1);
+    }
+
+  if (pthread_detach (th[0]) != 0)
+    {
+      puts ("could not detach 1st thread");
+      exit (1);
+    }
+
+  int err = pthread_detach (th[0]);
+  if (err == 0)
+    {
+      puts ("second detach of 1st thread succeeded");
+      exit (1);
+    }
+  if (err != EINVAL)
+    {
+      printf ("second detach of 1st thread returned %d, not EINVAL\n", err);
+      exit (1);
+    }
+
+  err = pthread_detach (th[1]);
+  if (err == 0)
+    {
+      puts ("detach of 2nd thread succeeded");
+      exit (1);
+    }
+  if (err != EINVAL)
+    {
+      printf ("detach of 2nd thread returned %d, not EINVAL\n", err);
+      exit (1);
+    }
+
+  exit (0);
+}
+
+#define TEST_FUNCTION do_test ()
+#include "../test-skeleton.c"
diff --git a/ap/build/uClibc/test/nptl/tst-join5.c b/ap/build/uClibc/test/nptl/tst-join5.c
new file mode 100644
index 0000000..b08af6e
--- /dev/null
+++ b/ap/build/uClibc/test/nptl/tst-join5.c
@@ -0,0 +1,143 @@
+/* Copyright (C) 2003 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, write to the Free
+   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+   02111-1307 USA.  */
+
+#include <errno.h>
+#include <pthread.h>
+#include <stdio.h>
+#include <stdlib.h>
+
+
+static void *
+tf1 (void *arg)
+{
+  pthread_join ((pthread_t) arg, NULL);
+
+  puts ("1st join returned");
+
+  return (void *) 1l;
+}
+
+
+static void *
+tf2 (void *arg)
+{
+  int a;
+  a = pthread_join ((pthread_t) arg, NULL);
+
+  puts ("2nd join returned");
+  printf("a = %i\n", a);
+
+  return (void *) 1l;
+}
+
+
+static int
+do_test (void)
+{
+  pthread_t th;
+
+  int err = pthread_join (pthread_self (), NULL);
+  if (err == 0)
+    {
+      puts ("1st circular join succeeded");
+      exit (1);
+    }
+  if (err != EDEADLK)
+    {
+      printf ("1st circular join %d, not EDEADLK\n", err);
+      exit (1);
+    }
+
+  if (pthread_create (&th, NULL, tf1, (void *) pthread_self ()) != 0)
+    {
+      puts ("1st create failed");
+      exit (1);
+    }
+
+  if (pthread_cancel (th) != 0)
+    {
+      puts ("cannot cancel 1st thread");
+      exit (1);
+    }
+
+  void *r;
+  err = pthread_join (th, &r);
+  if (err != 0)
+    {
+      printf ("cannot join 1st thread: %d\n", err);
+      exit (1);
+    }
+  if (r != PTHREAD_CANCELED)
+    {
+      puts ("1st thread not canceled");
+      exit (1);
+    }
+
+  err = pthread_join (pthread_self (), NULL);
+  if (err == 0)
+    {
+      puts ("2nd circular join succeeded");
+      exit (1);
+    }
+  if (err != EDEADLK)
+    {
+      printf ("2nd circular join %d, not EDEADLK\n", err);
+      exit (1);
+    }
+
+  if (pthread_create (&th, NULL, tf2, (void *) pthread_self ()) != 0)
+    {
+      puts ("2nd create failed");
+      exit (1);
+    }
+
+  if (pthread_cancel (th) != 0)
+    {
+      puts ("cannot cancel 2nd thread");
+      exit (1);
+    }
+
+  if (pthread_join (th, &r) != 0)
+    {
+      puts ("cannot join 2nd thread");
+      exit (1);
+    }
+  if (r != PTHREAD_CANCELED)
+    {
+      puts ("2nd thread not canceled");
+      exit (1);
+    }
+
+  err = pthread_join (pthread_self (), NULL);
+  if (err == 0)
+    {
+      puts ("2nd circular join succeeded");
+      exit (1);
+    }
+  if (err != EDEADLK)
+    {
+      printf ("2nd circular join %d, not EDEADLK\n", err);
+      exit (1);
+    }
+
+  exit (0);
+}
+
+#define TEST_FUNCTION do_test ()
+#include "../test-skeleton.c"
diff --git a/ap/build/uClibc/test/nptl/tst-join6.c b/ap/build/uClibc/test/nptl/tst-join6.c
new file mode 100644
index 0000000..0c9e7c0
--- /dev/null
+++ b/ap/build/uClibc/test/nptl/tst-join6.c
@@ -0,0 +1,2 @@
+#define WAIT_IN_CHILD 1
+#include "tst-join5.c"
diff --git a/ap/build/uClibc/test/nptl/tst-key1.c b/ap/build/uClibc/test/nptl/tst-key1.c
new file mode 100644
index 0000000..dfbe584
--- /dev/null
+++ b/ap/build/uClibc/test/nptl/tst-key1.c
@@ -0,0 +1,89 @@
+/* Copyright (C) 2002 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+   Contributed by Ulrich Drepper <drepper@redhat.com>, 2002.
+
+   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 <limits.h>
+#include <pthread.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <unistd.h>
+
+
+int
+do_test (void)
+{
+  int max;
+#ifdef PTHREAD_KEYS_MAX
+  max = PTHREAD_KEYS_MAX;
+#else
+  max = _POSIX_THREAD_KEYS_MAX;
+#endif
+  pthread_key_t *keys = alloca (max * sizeof (pthread_key_t));
+
+  int i;
+  for (i = 0; i < max; ++i)
+    if (pthread_key_create (&keys[i], NULL) != 0)
+      {
+	write (2, "key_create failed\n", 18);
+	_exit (1);
+      }
+    else
+      {
+	printf ("created key %d\n", i);
+
+	if (pthread_setspecific (keys[i], (const void *) (i + 100l)) != 0)
+	  {
+	    write (2, "setspecific failed\n", 19);
+	    _exit (1);
+	  }
+      }
+
+  for (i = 0; i < max; ++i)
+    {
+      if (pthread_getspecific (keys[i]) != (void *) (i + 100l))
+	{
+	  write (2, "getspecific failed\n", 19);
+	  _exit (1);
+	}
+
+      if (pthread_key_delete (keys[i]) != 0)
+	{
+	  write (2, "key_delete failed\n", 18);
+	  _exit (1);
+	}
+    }
+
+  /* Now it must be once again possible to allocate keys.  */
+  if (pthread_key_create (&keys[0], NULL) != 0)
+    {
+      write (2, "2nd key_create failed\n", 22);
+      _exit (1);
+    }
+
+  if (pthread_key_delete (keys[0]) != 0)
+    {
+      write (2, "2nd key_delete failed\n", 22);
+      _exit (1);
+    }
+
+  return 0;
+}
+
+
+#define TEST_FUNCTION do_test ()
+#include "../test-skeleton.c"
diff --git a/ap/build/uClibc/test/nptl/tst-key2.c b/ap/build/uClibc/test/nptl/tst-key2.c
new file mode 100644
index 0000000..c549332
--- /dev/null
+++ b/ap/build/uClibc/test/nptl/tst-key2.c
@@ -0,0 +1,115 @@
+/* Copyright (C) 2002 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+   Contributed by Ulrich Drepper <drepper@redhat.com>, 2002.
+
+   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>
+#include <stdio.h>
+#include <unistd.h>
+
+#define N 2
+
+
+static int cnt0;
+static void
+f0 (void *p)
+{
+  ++cnt0;
+}
+
+
+static int cnt1;
+static void
+f1 (void *p)
+{
+  ++cnt1;
+}
+
+
+static void (*fcts[N]) (void *) =
+{
+  f0,
+  f1
+};
+
+
+static void *
+tf (void *arg)
+{
+  pthread_key_t *key = (pthread_key_t *) arg;
+
+  if (pthread_setspecific (*key, (void *) -1l) != 0)
+    {
+      write (2, "setspecific failed\n", 19);
+      _exit (1);
+    }
+
+  return NULL;
+}
+
+
+int
+do_test (void)
+{
+  pthread_key_t keys[N];
+
+  int i;
+  for (i = 0; i < N; ++i)
+    if (pthread_key_create (&keys[i], fcts[i]) != 0)
+      {
+	write (2, "key_create failed\n", 18);
+	_exit (1);
+      }
+
+  pthread_t th;
+  if (pthread_create (&th, NULL, tf, &keys[1]) != 0)
+    {
+      write (2, "create failed\n", 14);
+      _exit (1);
+    }
+
+  if (pthread_join (th, NULL) != 0)
+    {
+      write (2, "join failed\n", 12);
+      _exit (1);
+    }
+
+  if (cnt0 != 0)
+    {
+      write (2, "cnt0 != 0\n", 10);
+      _exit (1);
+    }
+
+  if (cnt1 != 1)
+    {
+      write (2, "cnt1 != 1\n", 10);
+      _exit (1);
+    }
+
+  for (i = 0; i < N; ++i)
+    if (pthread_key_delete (keys[i]) != 0)
+      {
+	write (2, "key_delete failed\n", 18);
+	_exit (1);
+      }
+
+  return 0;
+}
+
+
+#define TEST_FUNCTION do_test ()
+#include "../test-skeleton.c"
diff --git a/ap/build/uClibc/test/nptl/tst-key3.c b/ap/build/uClibc/test/nptl/tst-key3.c
new file mode 100644
index 0000000..73cb741
--- /dev/null
+++ b/ap/build/uClibc/test/nptl/tst-key3.c
@@ -0,0 +1,156 @@
+/* Copyright (C) 2002 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+   Contributed by Ulrich Drepper <drepper@redhat.com>, 2002.
+
+   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>
+#include <stdio.h>
+#include <unistd.h>
+
+#define N 2
+
+
+static int cnt0;
+static void
+f0 (void *p)
+{
+  ++cnt0;
+}
+
+
+static int cnt1;
+static void
+f1 (void *p)
+{
+  ++cnt1;
+}
+
+
+static void (*fcts[N]) (void *) =
+{
+  f0,
+  f1
+};
+
+
+static pthread_barrier_t b;
+
+
+static void *
+tf (void *arg)
+{
+  pthread_key_t *key = (pthread_key_t *) arg;
+
+  if (pthread_setspecific (*key, (void *) -1l) != 0)
+    {
+      write (2, "setspecific failed\n", 19);
+      _exit (1);
+    }
+
+  pthread_barrier_wait (&b);
+
+  const struct timespec t = { .tv_sec = 1000, .tv_nsec = 0 };
+  while (1)
+    nanosleep (&t, NULL);
+
+  /* NOTREACHED */
+  return NULL;
+}
+
+
+int
+do_test (void)
+{
+  pthread_key_t keys[N];
+
+  int i;
+  for (i = 0; i < N; ++i)
+    if (pthread_key_create (&keys[i], fcts[i]) != 0)
+      {
+	write (2, "key_create failed\n", 18);
+	_exit (1);
+      }
+
+  if (pthread_barrier_init (&b, NULL, 2) != 0)
+    {
+      write (2, "barrier_init failed\n", 20);
+      _exit (1);
+    }
+
+  pthread_t th;
+  if (pthread_create (&th, NULL, tf, &keys[1]) != 0)
+    {
+      write (2, "create failed\n", 14);
+      _exit (1);
+    }
+
+  pthread_barrier_wait (&b);
+
+  if (pthread_cancel (th) != 0)
+    {
+      write (2, "cancel failed\n", 14);
+      _exit (1);
+    }
+
+  void *status;
+  if (pthread_join (th, &status) != 0)
+    {
+      write (2, "join failed\n", 12);
+      _exit (1);
+    }
+
+  if (status != PTHREAD_CANCELED)
+    {
+      write (2, "thread not canceled\n", 20);
+      _exit (1);
+    }
+
+  /* Note that the TSD destructors not necessarily have to have
+     finished by the time pthread_join returns.  At least according to
+     POSIX.  We implement the stronger requirement that they indeed
+     have run and therefore these tests succeed.  */
+  if (cnt0 != 0)
+    {
+      write (2, "cnt0 != 0\n", 10);
+      _exit (1);
+    }
+
+  if (cnt1 != 1)
+    {
+      write (2, "cnt1 != 1\n", 10);
+      _exit (1);
+    }
+
+  for (i = 0; i < N; ++i)
+    if (pthread_key_delete (keys[i]) != 0)
+      {
+	write (2, "key_delete failed\n", 18);
+	_exit (1);
+      }
+
+  if (pthread_barrier_destroy (&b) != 0)
+    {
+      write (2, "barrier_destroy failed\n", 23);
+      _exit (1);
+    }
+
+  return 0;
+}
+
+
+#define TEST_FUNCTION do_test ()
+#include "../test-skeleton.c"
diff --git a/ap/build/uClibc/test/nptl/tst-key4.c b/ap/build/uClibc/test/nptl/tst-key4.c
new file mode 100644
index 0000000..0a5b448
--- /dev/null
+++ b/ap/build/uClibc/test/nptl/tst-key4.c
@@ -0,0 +1,137 @@
+/* Copyright (C) 2003, 2004 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, write to the Free
+   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+   02111-1307 USA.  */
+
+#include <limits.h>
+#include <pthread.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <unistd.h>
+
+
+#ifdef PTHREAD_KEYS_MAX
+const int max = PTHREAD_KEYS_MAX;
+#else
+const int max = _POSIX_THREAD_KEYS_MAX;
+#endif
+static pthread_key_t *keys;
+
+
+static void *
+tf1 (void *arg)
+{
+  int i;
+  for (i = 0; i < max; ++i)
+    if (pthread_setspecific (keys[i], (void *) (long int) (i + 1)) != 0)
+      {
+	puts ("setspecific failed");
+	exit (1);
+      }
+
+  return NULL;
+}
+
+
+static void *
+tf2 (void *arg)
+{
+  int i;
+  for (i = 0; i < max; ++i)
+    if (pthread_getspecific (keys[i]) != NULL)
+      {
+	printf ("getspecific for key %d not NULL\n", i);
+	exit (1);
+      }
+
+  return NULL;
+}
+
+
+static int
+do_test (void)
+{
+  keys = alloca (max * sizeof (pthread_key_t));
+
+  int i;
+  for (i = 0; i < max; ++i)
+    if (pthread_key_create (&keys[i], NULL) != 0)
+      {
+	puts ("key_create failed");
+	exit (1);
+      }
+
+  pthread_attr_t a;
+
+  if (pthread_attr_init (&a) != 0)
+    {
+      puts ("attr_init failed");
+      exit (1);
+    }
+
+  if (pthread_attr_setstacksize (&a, 1 * 1024 * 1024) != 0)
+    {
+      puts ("attr_setstacksize failed");
+      return 1;
+    }
+
+  for (i = 0; i < 10; ++i)
+    {
+      int j;
+#define N 2
+      pthread_t th[N];
+      for (j = 0; j < N; ++j)
+	if (pthread_create (&th[j], NULL, tf1, NULL) != 0)
+	  {
+	    puts ("1st create failed");
+	    exit (1);
+	  }
+
+      for (j = 0; j < N; ++j)
+	if (pthread_join (th[j], NULL) != 0)
+	  {
+	    puts ("1st join failed");
+	    exit (1);
+	  }
+
+      for (j = 0; j < N; ++j)
+	if (pthread_create (&th[j], NULL, tf2, NULL) != 0)
+	  {
+	    puts ("2nd create failed");
+	    exit (1);
+	  }
+
+      for (j = 0; j < N; ++j)
+	if (pthread_join (th[j], NULL) != 0)
+	  {
+	    puts ("2nd join failed");
+	    exit (1);
+	  }
+    }
+
+  if (pthread_attr_destroy (&a) != 0)
+    {
+      puts ("attr_destroy failed");
+      exit (1);
+    }
+
+  return 0;
+}
+
+
+#define TEST_FUNCTION do_test ()
+#include "../test-skeleton.c"
diff --git a/ap/build/uClibc/test/nptl/tst-kill1.c b/ap/build/uClibc/test/nptl/tst-kill1.c
new file mode 100644
index 0000000..9eaf29b
--- /dev/null
+++ b/ap/build/uClibc/test/nptl/tst-kill1.c
@@ -0,0 +1,100 @@
+/* Copyright (C) 2003 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, write to the Free
+   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+   02111-1307 USA.  */
+
+#include <pthread.h>
+#include <signal.h>
+#include <stdio.h>
+#include <stdlib.h>
+
+
+static pthread_cond_t c = PTHREAD_COND_INITIALIZER;
+static pthread_mutex_t m = PTHREAD_MUTEX_INITIALIZER;
+static pthread_barrier_t b;
+
+static void *
+tf (void *a)
+{
+  if (pthread_mutex_lock (&m) != 0)
+    {
+      puts ("child: mutex_lock failed");
+      exit (1);
+    }
+
+  int e = pthread_barrier_wait (&b);
+  if (e != 0 && e != PTHREAD_BARRIER_SERIAL_THREAD)
+    {
+      puts ("child: barrier_wait failed");
+      exit (1);
+    }
+
+  /* This call should never return.  */
+  pthread_cond_wait (&c, &m);
+
+  return NULL;
+}
+
+
+int
+do_test (void)
+{
+  pthread_t th;
+
+  if (pthread_barrier_init (&b, NULL, 2) != 0)
+    {
+      puts ("barrier_init failed");
+      exit (1);
+    }
+
+  if (pthread_create (&th, NULL, tf, NULL) != 0)
+    {
+      puts ("create failed");
+      exit (1);
+    }
+
+  int e = pthread_barrier_wait (&b);
+  if (e != 0 && e != PTHREAD_BARRIER_SERIAL_THREAD)
+    {
+      puts ("barrier_wait failed");
+      exit (1);
+    }
+
+  if (pthread_mutex_lock (&m) != 0)
+    {
+      puts ("mutex_lock failed");
+      exit (1);
+    }
+
+  /* Send the thread a signal which it doesn't catch and which will
+     cause the process to terminate.  */
+  if (pthread_kill (th, SIGUSR1) != 0)
+    {
+      puts ("kill failed");
+      exit (1);
+    }
+
+  /* This call should never return.  */
+  pthread_join (th, NULL);
+
+  return 0;
+}
+
+
+#define EXPECTED_SIGNAL SIGUSR1
+#define TEST_FUNCTION do_test ()
+#include "../test-skeleton.c"
diff --git a/ap/build/uClibc/test/nptl/tst-kill2.c b/ap/build/uClibc/test/nptl/tst-kill2.c
new file mode 100644
index 0000000..1e3dc41
--- /dev/null
+++ b/ap/build/uClibc/test/nptl/tst-kill2.c
@@ -0,0 +1,139 @@
+/* Copyright (C) 2003 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, 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 <stdio.h>
+#include <stdlib.h>
+#include <sys/time.h>
+
+
+static pthread_cond_t c = PTHREAD_COND_INITIALIZER;
+static pthread_mutex_t m = PTHREAD_MUTEX_INITIALIZER;
+static pthread_barrier_t b;
+
+static void *
+tf (void *a)
+{
+  /* Block SIGUSR1.  */
+  sigset_t ss;
+
+  sigemptyset (&ss);
+  sigaddset (&ss, SIGUSR1);
+  if (pthread_sigmask (SIG_BLOCK, &ss, NULL) != 0)
+    {
+      puts ("child: sigmask failed");
+      exit (1);
+    }
+
+  if (pthread_mutex_lock (&m) != 0)
+    {
+      puts ("child: mutex_lock failed");
+      exit (1);
+    }
+
+  int e = pthread_barrier_wait (&b);
+  if (e != 0 && e != PTHREAD_BARRIER_SERIAL_THREAD)
+    {
+      puts ("child: barrier_wait failed");
+      exit (1);
+    }
+
+  /* Compute timeout.  */
+  struct timeval tv;
+  (void) gettimeofday (&tv, NULL);
+  struct timespec ts;
+  TIMEVAL_TO_TIMESPEC (&tv, &ts);
+  /* Timeout: 1sec.  */
+  ts.tv_sec += 1;
+
+  /* This call should never return.  */
+  if (pthread_cond_timedwait (&c, &m, &ts) != ETIMEDOUT)
+    {
+      puts ("cond_timedwait didn't time out");
+      exit (1);
+    }
+
+  return NULL;
+}
+
+
+int
+do_test (void)
+{
+  pthread_t th;
+
+  if (pthread_barrier_init (&b, NULL, 2) != 0)
+    {
+      puts ("barrier_init failed");
+      exit (1);
+    }
+
+  if (pthread_create (&th, NULL, tf, NULL) != 0)
+    {
+      puts ("create failed");
+      exit (1);
+    }
+
+  int e = pthread_barrier_wait (&b);
+  if (e != 0 && e != PTHREAD_BARRIER_SERIAL_THREAD)
+    {
+      puts ("barrier_wait failed");
+      exit (1);
+    }
+
+  if (pthread_mutex_lock (&m) != 0)
+    {
+      puts ("mutex_lock failed");
+      exit (1);
+    }
+
+  /* Send the thread a signal which it has blocked.  */
+  if (pthread_kill (th, SIGUSR1) != 0)
+    {
+      puts ("kill failed");
+      exit (1);
+    }
+
+  if (pthread_mutex_unlock (&m) != 0)
+    {
+      puts ("mutex_unlock failed");
+      exit (1);
+    }
+
+  void *r;
+  if (pthread_join (th, &r) != 0)
+    {
+      puts ("join failed");
+      exit (1);
+    }
+  if (r != NULL)
+    {
+      puts ("return value wrong");
+      exit (1);
+    }
+
+  return 0;
+}
+
+
+#define TIMEOUT 5
+#define TEST_FUNCTION do_test ()
+#include "../test-skeleton.c"
diff --git a/ap/build/uClibc/test/nptl/tst-kill3.c b/ap/build/uClibc/test/nptl/tst-kill3.c
new file mode 100644
index 0000000..9ea8d55
--- /dev/null
+++ b/ap/build/uClibc/test/nptl/tst-kill3.c
@@ -0,0 +1,159 @@
+/* Copyright (C) 2003 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, 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 <stdio.h>
+#include <stdlib.h>
+#include <unistd.h>
+#include <sys/time.h>
+
+
+static pthread_cond_t c = PTHREAD_COND_INITIALIZER;
+static pthread_mutex_t m = PTHREAD_MUTEX_INITIALIZER;
+static pthread_barrier_t b;
+
+
+static void
+handler (int sig)
+{
+  write (1, "handler called\n", 15);
+  _exit (1);
+}
+
+
+static void *
+tf (void *a)
+{
+  /* Block SIGUSR1.  */
+  sigset_t ss;
+
+  sigemptyset (&ss);
+  sigaddset (&ss, SIGUSR1);
+  if (pthread_sigmask (SIG_BLOCK, &ss, NULL) != 0)
+    {
+      puts ("child: sigmask failed");
+      exit (1);
+    }
+
+  if (pthread_mutex_lock (&m) != 0)
+    {
+      puts ("child: mutex_lock failed");
+      exit (1);
+    }
+
+  int e = pthread_barrier_wait (&b);
+  if (e != 0 && e != PTHREAD_BARRIER_SERIAL_THREAD)
+    {
+      puts ("child: barrier_wait failed");
+      exit (1);
+    }
+
+  /* Compute timeout.  */
+  struct timeval tv;
+  (void) gettimeofday (&tv, NULL);
+  struct timespec ts;
+  TIMEVAL_TO_TIMESPEC (&tv, &ts);
+  /* Timeout: 1sec.  */
+  ts.tv_sec += 1;
+
+  /* This call should never return.  */
+  if (pthread_cond_timedwait (&c, &m, &ts) != ETIMEDOUT)
+    {
+      puts ("cond_timedwait didn't time out");
+      exit (1);
+    }
+
+  return NULL;
+}
+
+
+int
+do_test (void)
+{
+  pthread_t th;
+
+  struct sigaction sa;
+  sigemptyset (&sa.sa_mask);
+  sa.sa_flags = 0;
+  sa.sa_handler = handler;
+  if (sigaction (SIGUSR1, &sa, NULL) != 0)
+    {
+      puts ("sigaction failed");
+      exit (1);
+    }
+
+  if (pthread_barrier_init (&b, NULL, 2) != 0)
+    {
+      puts ("barrier_init failed");
+      exit (1);
+    }
+
+  if (pthread_create (&th, NULL, tf, NULL) != 0)
+    {
+      puts ("create failed");
+      exit (1);
+    }
+
+  int e = pthread_barrier_wait (&b);
+  if (e != 0 && e != PTHREAD_BARRIER_SERIAL_THREAD)
+    {
+      puts ("barrier_wait failed");
+      exit (1);
+    }
+
+  if (pthread_mutex_lock (&m) != 0)
+    {
+      puts ("mutex_lock failed");
+      exit (1);
+    }
+
+  /* Send the thread a signal which it has blocked.  */
+  if (pthread_kill (th, SIGUSR1) != 0)
+    {
+      puts ("kill failed");
+      exit (1);
+    }
+
+  if (pthread_mutex_unlock (&m) != 0)
+    {
+      puts ("mutex_unlock failed");
+      exit (1);
+    }
+
+  void *r;
+  if (pthread_join (th, &r) != 0)
+    {
+      puts ("join failed");
+      exit (1);
+    }
+  if (r != NULL)
+    {
+      puts ("return value wrong");
+      exit (1);
+    }
+
+  return 0;
+}
+
+
+#define TIMEOUT 5
+#define TEST_FUNCTION do_test ()
+#include "../test-skeleton.c"
diff --git a/ap/build/uClibc/test/nptl/tst-kill4.c b/ap/build/uClibc/test/nptl/tst-kill4.c
new file mode 100644
index 0000000..4e7ff5e
--- /dev/null
+++ b/ap/build/uClibc/test/nptl/tst-kill4.c
@@ -0,0 +1,74 @@
+/* Copyright (C) 2003 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, 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 <stdio.h>
+#include <stdlib.h>
+#include <unistd.h>
+
+
+static void *
+tf (void *a)
+{
+  return NULL;
+}
+
+
+int
+do_test (void)
+{
+  pthread_t th;
+  if (pthread_create (&th, NULL, tf, NULL) != 0)
+    {
+      puts ("create failed");
+      exit (1);
+    }
+
+  if (pthread_join (th, NULL) != 0)
+    {
+      puts ("join failed");
+      exit (1);
+    }
+
+  /* The following only works because we assume here something about
+     the implementation.  Namely, that the memory allocated for the
+     thread descriptor is not going away, that the the TID field is
+     cleared and therefore the signal is sent to process 0, and that
+     we can savely assume there is no other process with this ID at
+     that time.  */
+  int e = pthread_kill (th, 0);
+  if (e == 0)
+    {
+      puts ("pthread_kill succeeded");
+      exit (1);
+    }
+  if (e != ESRCH)
+    {
+      puts ("pthread_kill didn't return ESRCH");
+      exit (1);
+    }
+
+  return 0;
+}
+
+
+#define TEST_FUNCTION do_test ()
+#include "../test-skeleton.c"
diff --git a/ap/build/uClibc/test/nptl/tst-kill5.c b/ap/build/uClibc/test/nptl/tst-kill5.c
new file mode 100644
index 0000000..1256094
--- /dev/null
+++ b/ap/build/uClibc/test/nptl/tst-kill5.c
@@ -0,0 +1,49 @@
+/* Copyright (C) 2003 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, 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 <stdio.h>
+#include <stdlib.h>
+
+
+int
+do_test (void)
+{
+  /* XXX This test might require architecture and system specific changes.
+     There is no guarantee that this signal number is invalid.  */
+  int e = pthread_kill (pthread_self (), SIGRTMAX + 10);
+  if (e == 0)
+    {
+      puts ("kill didn't failed");
+      exit (1);
+    }
+  if (e != EINVAL)
+    {
+      puts ("error not EINVAL");
+      exit (1);
+    }
+
+  return 0;
+}
+
+
+#define TEST_FUNCTION do_test ()
+#include "../test-skeleton.c"
diff --git a/ap/build/uClibc/test/nptl/tst-kill6.c b/ap/build/uClibc/test/nptl/tst-kill6.c
new file mode 100644
index 0000000..26e82d9
--- /dev/null
+++ b/ap/build/uClibc/test/nptl/tst-kill6.c
@@ -0,0 +1,162 @@
+/* Copyright (C) 2003, 2004 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, write to the Free
+   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+   02111-1307 USA.  */
+
+#include <errno.h>
+#include <pthread.h>
+#include <semaphore.h>
+#include <signal.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <unistd.h>
+
+
+static pthread_t receiver;
+static sem_t sem;
+static pthread_barrier_t b;
+
+static void
+handler (int sig)
+{
+  if (sig != SIGUSR1)
+    {
+      write (STDOUT_FILENO, "wrong signal\n", 13);
+      _exit (1);
+    }
+
+  if (pthread_self () != receiver)
+    {
+      write (STDOUT_FILENO, "not the intended receiver\n", 26);
+      _exit (1);
+    }
+
+  if (sem_post (&sem) != 0)
+    {
+      write (STDOUT_FILENO, "sem_post failed\n", 16);
+      _exit (1);
+    }
+}
+
+
+static void *
+tf (void *a)
+{
+  int e = pthread_barrier_wait (&b);
+  if (e != 0 && e != PTHREAD_BARRIER_SERIAL_THREAD)
+    {
+      puts ("child: barrier_wait failed");
+      exit (1);
+    }
+
+  return NULL;
+}
+
+
+int
+do_test (void)
+{
+  struct sigaction sa;
+  sigemptyset (&sa.sa_mask);
+  sa.sa_flags = 0;
+  sa.sa_handler = handler;
+  if (sigaction (SIGUSR1, &sa, NULL) != 0)
+    {
+      puts ("sigaction failed");
+      exit (1);
+    }
+
+#define N 20
+
+  if (pthread_barrier_init (&b, NULL, N + 1) != 0)
+    {
+      puts ("barrier_init failed");
+      exit (1);
+    }
+
+  pthread_attr_t a;
+
+  if (pthread_attr_init (&a) != 0)
+    {
+      puts ("attr_init failed");
+      exit (1);
+    }
+
+  if (pthread_attr_setstacksize (&a, 1 * 1024 * 1024) != 0)
+    {
+      puts ("attr_setstacksize failed");
+      return 1;
+    }
+
+  pthread_t th[N];
+  int i;
+  for (i = 0; i < N; ++i)
+    if (pthread_create (&th[i], &a, tf, NULL) != 0)
+      {
+	puts ("create failed");
+	exit (1);
+      }
+
+  if (pthread_attr_destroy (&a) != 0)
+    {
+      puts ("attr_destroy failed");
+      exit (1);
+    }
+
+  if (sem_init (&sem, 0, 0) != 0)
+    {
+      puts ("sem_init failed");
+      exit (1);
+    }
+
+  for (i = 0; i < N * 10; ++i)
+    {
+      receiver = th[i % N];
+
+      if (pthread_kill (receiver, SIGUSR1) != 0)
+	{
+	  puts ("kill failed");
+	  exit (1);
+	}
+
+      if (TEMP_FAILURE_RETRY (sem_wait (&sem)) != 0)
+	{
+	  puts ("sem_wait failed");
+	  exit (1);
+	}
+    }
+
+  int e = pthread_barrier_wait (&b);
+  if (e != 0 && e != PTHREAD_BARRIER_SERIAL_THREAD)
+    {
+      puts ("barrier_wait failed");
+      exit (1);
+    }
+
+  for (i = 0; i < N; ++i)
+    if (pthread_join (th[i], NULL) != 0)
+      {
+	puts ("join failed");
+	exit (1);
+      }
+
+  return 0;
+}
+
+
+#define TEST_FUNCTION do_test ()
+#include "../test-skeleton.c"
diff --git a/ap/build/uClibc/test/nptl/tst-mqueue.h b/ap/build/uClibc/test/nptl/tst-mqueue.h
new file mode 100644
index 0000000..8e73be5
--- /dev/null
+++ b/ap/build/uClibc/test/nptl/tst-mqueue.h
@@ -0,0 +1,84 @@
+/* Common code for message queue passing tests.
+   Copyright (C) 2004 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+   Contributed by Jakub Jelinek <jakub@redhat.com>, 2004.
+
+   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 <mqueue.h>
+#include <search.h>
+#include <stdlib.h>
+#include <stdio.h>
+#include <string.h>
+#include <sys/uio.h>
+#include <unistd.h>
+
+static int temp_mq_fd;
+
+/* Add temporary files in list.  */
+static void
+__attribute__ ((unused))
+add_temp_mq (const char *name)
+{
+  struct iovec iov[2];
+  iov[0].iov_base = (char *) name;
+  iov[0].iov_len = strlen (name);
+  iov[1].iov_base = (char *) "\n";
+  iov[1].iov_len = 1;
+  if (writev (temp_mq_fd, iov, 2) != iov[0].iov_len + 1)
+    printf ("Could not record temp mq filename %s\n", name);
+}
+
+/* Delete all temporary message queues.  */
+static void
+do_cleanup (void)
+{
+  if (lseek (temp_mq_fd, 0, SEEK_SET) != 0)
+    return;
+
+  FILE *f = fdopen (temp_mq_fd, "r");
+  if (f == NULL)
+    return;
+
+  char *line = NULL;
+  size_t n = 0;
+  ssize_t rets;
+  while ((rets = getline (&line, &n, f)) > 0)
+    {
+      if (line[rets - 1] != '\n')
+        continue;
+
+      line[rets - 1] = '\0';
+      mq_unlink (line);
+    }
+  fclose (f);
+}
+
+static void
+do_prepare (void)
+{
+  char name [] = "/tmp/tst-mqueueN.XXXXXX";
+  temp_mq_fd = mkstemp (name);
+  if (temp_mq_fd == -1)
+    {
+      printf ("Could not create temporary file %s: %m\n", name);
+      exit (1);
+    }
+  unlink (name);
+}
+
+#define PREPARE(argc, argv) do_prepare ()
+#define CLEANUP_HANDLER	do_cleanup ()
diff --git a/ap/build/uClibc/test/nptl/tst-mqueue1.c b/ap/build/uClibc/test/nptl/tst-mqueue1.c
new file mode 100644
index 0000000..70e4237
--- /dev/null
+++ b/ap/build/uClibc/test/nptl/tst-mqueue1.c
@@ -0,0 +1,417 @@
+/* Test message queue passing.
+   Copyright (C) 2004 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+   Contributed by Jakub Jelinek <jakub@redhat.com>, 2004.
+
+   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 <errno.h>
+#include <fcntl.h>
+#include <mqueue.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <sys/wait.h>
+#include <time.h>
+#include <unistd.h>
+#include "tst-mqueue.h"
+
+static int
+intcmp (const void *a, const void *b)
+{
+  if (*(unsigned char *)a < *(unsigned char *)b)
+    return 1;
+  if (*(unsigned char *)a > *(unsigned char *)b)
+    return -1;
+  return 0;
+}
+
+static int
+check_attrs (struct mq_attr *attr, int nonblock, long cnt)
+{
+  int result = 0;
+
+  if (attr->mq_maxmsg != 10 || attr->mq_msgsize != 1)
+    {
+      printf ("attributes don't match those passed to mq_open\n"
+	      "mq_maxmsg %ld, mq_msgsize %ld\n",
+	      attr->mq_maxmsg, attr->mq_msgsize);
+      result = 1;
+    }
+
+  if ((attr->mq_flags & O_NONBLOCK) != nonblock)
+    {
+      printf ("mq_flags %lx != %x\n", (attr->mq_flags & O_NONBLOCK), nonblock);
+      result = 1;
+    }
+
+  if (attr->mq_curmsgs != cnt)
+    {
+      printf ("mq_curmsgs %ld != %ld\n", attr->mq_curmsgs, cnt);
+      result = 1;
+    }
+
+  return result;
+}
+
+static int
+do_one_test (mqd_t q, const char *name, int nonblock)
+{
+  int result = 0;
+
+  char v []
+    = { 0x32, 0x62, 0x22, 0x31, 0x11, 0x73, 0x61, 0x21, 0x72, 0x71, 0x81 };
+
+  struct mq_attr attr;
+  memset (&attr, 0xaa, sizeof (attr));
+  if (mq_getattr (q, &attr) != 0)
+    {
+      printf ("mq_getattr failed: %m\n");
+      result = 1;
+    }
+  else
+    result |= check_attrs (&attr, nonblock, 0);
+
+  if (mq_receive (q, &v[0], 1, NULL) != -1)
+    {
+      puts ("mq_receive on O_WRONLY mqd_t unexpectedly succeeded");
+      result = 1;
+    }
+  else if (errno != EBADF)
+    {
+      printf ("mq_receive on O_WRONLY mqd_t did not fail with EBADF: %m\n");
+      result = 1;
+    }
+
+  struct timespec ts;
+  if (clock_gettime (CLOCK_REALTIME, &ts) == 0)
+    --ts.tv_sec;
+  else
+    {
+      ts.tv_sec = time (NULL) - 1;
+      ts.tv_nsec = 0;
+    }
+
+  int ret;
+  for (int i = 0; i < 10; ++i)
+    {
+      if (i & 1)
+	ret = mq_send (q, &v[i], 1, v[i] >> 4);
+      else
+	ret = mq_timedsend (q, &v[i], 1, v[i] >> 4, &ts);
+
+      if (ret)
+	{
+	  printf ("mq_%ssend failed: %m\n", (i & 1) ? "" : "timed");
+	  result = 1;
+	}
+    }
+
+  ret = mq_timedsend (q, &v[10], 1, 8, &ts);
+  if (ret != -1)
+    {
+      puts ("mq_timedsend on full queue did not fail");
+      result = 1;
+    }
+  else if (errno != (nonblock ? EAGAIN : ETIMEDOUT))
+    {
+      printf ("mq_timedsend on full queue did not fail with %s: %m\n",
+	      nonblock ? "EAGAIN" : "ETIMEDOUT");
+      result = 1;
+    }
+
+  if (nonblock)
+    {
+      ret = mq_send (q, &v[10], 1, 8);
+      if (ret != -1)
+	{
+	  puts ("mq_send on full non-blocking queue did not fail");
+	  result = 1;
+	}
+      else if (errno != EAGAIN)
+	{
+	  printf ("mq_send on full non-blocking queue did not fail"
+		  "with EAGAIN: %m\n");
+	  result = 1;
+	}
+    }
+
+  memset (&attr, 0xaa, sizeof (attr));
+  if (mq_getattr (q, &attr) != 0)
+    {
+      printf ("mq_getattr failed: %m\n");
+      result = 1;
+    }
+  else
+    result |= check_attrs (&attr, nonblock, 10);
+
+  pid_t pid = fork ();
+  if (pid == -1)
+    {
+      printf ("fork failed: %m\n");
+      result = 1;
+    }
+  else if (pid == 0)
+    {
+      result = 0;
+
+      if (mq_close (q) != 0)
+	{
+	  printf ("mq_close in child failed: %m\n");
+	  result = 1;
+	}
+
+      q = mq_open (name, O_RDONLY | nonblock);
+      if (q == (mqd_t) -1)
+        {
+	  printf ("mq_open in child failed: %m\n");
+	  exit (1);
+        }
+
+      memset (&attr, 0xaa, sizeof (attr));
+      if (mq_getattr (q, &attr) != 0)
+	{
+	  printf ("mq_getattr failed: %m\n");
+	  result = 1;
+	}
+      else
+	result |= check_attrs (&attr, nonblock, 10);
+
+      char vr[11] = { };
+      unsigned int prio;
+      ssize_t rets;
+
+      if (mq_send (q, &v[0], 1, 1) != -1)
+	{
+	  puts ("mq_send on O_RDONLY mqd_t unexpectedly succeeded");
+	  result = 1;
+	}
+      else if (errno != EBADF)
+	{
+	  printf ("mq_send on O_WRONLY mqd_t did not fail with EBADF: %m\n");
+	  result = 1;
+	}
+
+      for (int i = 0; i < 10; ++i)
+	{
+	  if (i & 1)
+	    rets = mq_receive (q, &vr[i], 1, &prio);
+	  else
+	    rets = mq_timedreceive (q, &vr[i], 1, &prio, &ts);
+
+	  if (rets != 1)
+	    {
+	      if (rets == -1)
+		printf ("mq_%sreceive failed: %m\n", (i & 1) ? "" : "timed");
+	      else
+		printf ("mq_%sreceive returned %zd != 1\n",
+			(i & 1) ? "" : "timed", rets);
+	      result = 1;
+	    }
+	  else if (prio != (unsigned int) vr[i] >> 4)
+	    {
+	      printf ("unexpected priority %x for value %02x\n", prio,
+		      vr[i]);
+	      result = 1;
+	    }
+	}
+
+      qsort (v, 10, 1, intcmp);
+      if (memcmp (v, vr, 10) != 0)
+	{
+	  puts ("messages not received in expected order");
+	  result = 1;
+	}
+
+      rets = mq_timedreceive (q, &vr[10], 1, &prio, &ts);
+      if (rets != -1)
+	{
+	  puts ("mq_timedreceive on empty queue did not fail");
+	  result = 1;
+	}
+      else if (errno != (nonblock ? EAGAIN : ETIMEDOUT))
+	{
+	  printf ("mq_timedreceive on empty queue did not fail with %s: %m\n",
+		  nonblock ? "EAGAIN" : "ETIMEDOUT");
+	  result = 1;
+	}
+
+      if (nonblock)
+	{
+	  ret = mq_receive (q, &vr[10], 1, &prio);
+	  if (ret != -1)
+	    {
+	      puts ("mq_receive on empty non-blocking queue did not fail");
+	      result = 1;
+	    }
+	  else if (errno != EAGAIN)
+	    {
+	      printf ("mq_receive on empty non-blocking queue did not fail"
+		      "with EAGAIN: %m\n");
+	      result = 1;
+	    }
+	}
+
+      memset (&attr, 0xaa, sizeof (attr));
+      if (mq_getattr (q, &attr) != 0)
+	{
+	  printf ("mq_getattr failed: %m\n");
+	  result = 1;
+	}
+      else
+	result |= check_attrs (&attr, nonblock, 0);
+
+      if (mq_close (q) != 0)
+	{
+	  printf ("mq_close in child failed: %m\n");
+	  result = 1;
+	}
+
+      exit (result);
+    }
+
+  int status;
+  if (TEMP_FAILURE_RETRY (waitpid (pid, &status, 0)) != pid)
+    {
+      printf ("waitpid failed: %m\n");
+      kill (pid, SIGKILL);
+      result = 1;
+    }
+  else if (!WIFEXITED (status) || WEXITSTATUS (status))
+    {
+      printf ("child failed: %d\n", status);
+      result = 1;
+    }
+
+  memset (&attr, 0xaa, sizeof (attr));
+  if (mq_getattr (q, &attr) != 0)
+    {
+      printf ("mq_getattr failed: %m\n");
+      result = 1;
+    }
+  else
+    result |= check_attrs (&attr, nonblock, 0);
+
+  return result;
+}
+
+#define TEST_FUNCTION do_test ()
+static int
+do_test (void)
+{
+  int result = 0;
+
+  char name[sizeof "/tst-mqueue1-" + sizeof (pid_t) * 3];
+  snprintf (name, sizeof (name), "/tst-mqueue1-%u", getpid ());
+
+  struct mq_attr attr = { .mq_maxmsg = 10, .mq_msgsize = 1 };
+  mqd_t q = mq_open (name, O_CREAT | O_EXCL | O_WRONLY, 0600, &attr);
+
+  if (q == (mqd_t) -1)
+    {
+      printf ("mq_open failed with: %m\n");
+      return result;
+    }
+  else
+    add_temp_mq (name);
+
+  result |= do_one_test (q, name, 0);
+
+  mqd_t q2 = mq_open (name, O_WRONLY | O_NONBLOCK);
+  if (q2 == (mqd_t) -1)
+    {
+      printf ("mq_open failed with: %m\n");
+      q2 = q;
+      result = 1;
+    }
+  else
+    {
+      if (mq_close (q) != 0)
+	{
+	  printf ("mq_close in parent failed: %m\n");
+	  result = 1;
+	}
+
+      q = q2;
+      result |= do_one_test (q, name, O_NONBLOCK);
+
+      if (mq_getattr (q, &attr) != 0)
+	{
+	  printf ("mq_getattr failed: %m\n");
+	  result = 1;
+	}
+      else
+	{
+	  attr.mq_flags ^= O_NONBLOCK;
+
+	  struct mq_attr attr2;
+	  memset (&attr2, 0x55, sizeof (attr2));
+	  if (mq_setattr (q, &attr, &attr2) != 0)
+	    {
+	      printf ("mq_setattr failed: %m\n");
+	      result = 1;
+	    }
+	  else if (attr.mq_flags != (attr2.mq_flags ^ O_NONBLOCK)
+		   || attr.mq_maxmsg != attr2.mq_maxmsg
+		   || attr.mq_msgsize != attr2.mq_msgsize
+		   || attr.mq_curmsgs != 0
+		   || attr2.mq_curmsgs != 0)
+	    {
+	      puts ("mq_setattr returned unexpected values in *omqstat");
+	      result = 1;
+	    }
+	  else
+	    {
+	      result |= do_one_test (q, name, 0);
+
+	      if (mq_setattr (q, &attr2, NULL) != 0)
+		{
+		  printf ("mq_setattr failed: %m\n");
+		  result = 1;
+		}
+	      else
+		result |= do_one_test (q, name, O_NONBLOCK);
+	    }
+	}
+    }
+
+  if (mq_unlink (name) != 0)
+    {
+      printf ("mq_unlink failed: %m\n");
+      result = 1;
+    }
+
+  if (mq_close (q) != 0)
+    {
+      printf ("mq_close in parent failed: %m\n");
+      result = 1;
+    }
+
+  if (mq_close (q) != -1)
+    {
+      puts ("second mq_close did not fail");
+      result = 1;
+    }
+  else if (errno != EBADF)
+    {
+      printf ("second mq_close did not fail with EBADF: %m\n");
+      result = 1;
+    }
+
+  return result;
+}
+
+#include "../test-skeleton.c"
diff --git a/ap/build/uClibc/test/nptl/tst-mqueue2.c b/ap/build/uClibc/test/nptl/tst-mqueue2.c
new file mode 100644
index 0000000..1948965
--- /dev/null
+++ b/ap/build/uClibc/test/nptl/tst-mqueue2.c
@@ -0,0 +1,477 @@
+/* Test message queue passing.
+   Copyright (C) 2004 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+   Contributed by Jakub Jelinek <jakub@redhat.com>, 2004.
+
+   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 <errno.h>
+#include <fcntl.h>
+#include <mqueue.h>
+#include <signal.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <sys/time.h>
+#include <sys/wait.h>
+#include <time.h>
+#include <unistd.h>
+#include "tst-mqueue.h"
+
+static void
+alrm_handler (int sig)
+{
+}
+
+#define TIMEOUT 10
+#define TEST_FUNCTION do_test ()
+static int
+do_test (void)
+{
+  int result = 0;
+
+  char name[sizeof "/tst-mqueue2-" + sizeof (pid_t) * 3];
+  snprintf (name, sizeof (name), "/tst-mqueue2-%u", getpid ());
+
+  struct mq_attr attr = { .mq_maxmsg = 2, .mq_msgsize = 2 };
+  mqd_t q = mq_open (name, O_CREAT | O_EXCL | O_RDWR, 0600, &attr);
+
+  if (q == (mqd_t) -1)
+    {
+      printf ("mq_open failed with: %m\n");
+      return result;
+    }
+  else
+    add_temp_mq (name);
+
+  mqd_t q2 = mq_open (name, O_CREAT | O_EXCL | O_RDWR, 0600, &attr);
+  if (q2 != (mqd_t) -1)
+    {
+      puts ("mq_open with O_EXCL unexpectedly succeeded");
+      result = 1;
+    }
+  else if (errno != EEXIST)
+    {
+      printf ("mq_open did not fail with EEXIST: %m\n");
+      result = 1;
+    }
+
+  char name2[sizeof "/tst-mqueue2-2-" + sizeof (pid_t) * 3];
+  snprintf (name2, sizeof (name2), "/tst-mqueue2-2-%u", getpid ());
+
+  attr.mq_maxmsg = -2;
+  q2 = mq_open (name2, O_CREAT | O_EXCL | O_RDWR, 0600, &attr);
+  if (q2 != (mqd_t) -1)
+    {
+      puts ("mq_open with invalid mq_maxmsg unexpectedly succeeded");
+      add_temp_mq (name2);
+      result = 1;
+    }
+  else if (errno != EINVAL)
+    {
+      printf ("mq_open with invalid mq_maxmsg did not fail with "
+	      "EINVAL: %m\n");
+      result = 1;
+    }
+
+  attr.mq_maxmsg = 2;
+  attr.mq_msgsize = -56;
+  q2 = mq_open (name2, O_CREAT | O_EXCL | O_RDWR, 0600, &attr);
+  if (q2 != (mqd_t) -1)
+    {
+      puts ("mq_open with invalid mq_msgsize unexpectedly succeeded");
+      add_temp_mq (name2);
+      result = 1;
+    }
+  else if (errno != EINVAL)
+    {
+      printf ("mq_open with invalid mq_msgsize did not fail with "
+	      "EINVAL: %m\n");
+      result = 1;
+    }
+
+  char buf[3];
+  struct timespec ts;
+  if (clock_gettime (CLOCK_REALTIME, &ts) == 0)
+    ts.tv_sec += 10;
+  else
+    {
+      ts.tv_sec = time (NULL) + 10;
+      ts.tv_nsec = 0;
+    }
+
+  if (mq_timedreceive (q, buf, 1, NULL, &ts) == 0)
+    {
+      puts ("mq_timedreceive with too small msg_len did not fail");
+      result = 1;
+    }
+  else if (errno != EMSGSIZE)
+    {
+      printf ("mq_timedreceive with too small msg_len did not fail with "
+	      "EMSGSIZE: %m\n");
+      result = 1;
+    }
+
+  ts.tv_nsec = -1;
+  if (mq_timedreceive (q, buf, 2, NULL, &ts) == 0)
+    {
+      puts ("mq_timedreceive with negative tv_nsec did not fail");
+      result = 1;
+    }
+  else if (errno != EINVAL)
+    {
+      printf ("mq_timedreceive with negative tv_nsec did not fail with "
+	      "EINVAL: %m\n");
+      result = 1;
+    }
+
+  ts.tv_nsec = 1000000000;
+  if (mq_timedreceive (q, buf, 2, NULL, &ts) == 0)
+    {
+      puts ("mq_timedreceive with tv_nsec >= 1000000000 did not fail");
+      result = 1;
+    }
+  else if (errno != EINVAL)
+    {
+      printf ("mq_timedreceive with tv_nsec >= 1000000000 did not fail with "
+	      "EINVAL: %m\n");
+      result = 1;
+    }
+
+  struct sigaction sa = { .sa_handler = alrm_handler, .sa_flags = 0 };
+  sigemptyset (&sa.sa_mask);
+  sigaction (SIGALRM, &sa, NULL);
+
+  struct itimerval it = { .it_value = { .tv_sec = 1 } };
+  setitimer (ITIMER_REAL, &it, NULL);
+
+  if (mq_receive (q, buf, 2, NULL) == 0)
+    {
+      puts ("mq_receive on empty queue did not block");
+      result = 1;
+    }
+  else if (errno != EINTR)
+    {
+      printf ("mq_receive on empty queue did not fail with EINTR: %m\n");
+      result = 1;
+    }
+
+  setitimer (ITIMER_REAL, &it, NULL);
+
+  ts.tv_nsec = 0;
+  if (mq_timedreceive (q, buf, 2, NULL, &ts) == 0)
+    {
+      puts ("mq_timedreceive on empty queue did not block");
+      result = 1;
+    }
+  else if (errno != EINTR)
+    {
+      printf ("mq_timedreceive on empty queue did not fail with EINTR: %m\n");
+      result = 1;
+    }
+
+  buf[0] = '6';
+  buf[1] = '7';
+  if (mq_send (q, buf, 2, 3) != 0
+      || (buf[0] = '8', mq_send (q, buf, 1, 4) != 0))
+    {
+      printf ("mq_send failed: %m\n");
+      result = 1;
+    }
+
+  memset (buf, ' ', sizeof (buf));
+
+  unsigned int prio;
+  ssize_t rets = mq_receive (q, buf, 3, &prio);
+  if (rets != 1)
+    {
+      if (rets == -1)
+	printf ("mq_receive failed: %m\n");
+      else
+	printf ("mq_receive returned %zd != 1\n", rets);
+      result = 1;
+    }
+  else if (prio != 4 || memcmp (buf, "8  ", 3) != 0)
+    {
+      printf ("mq_receive prio %u (4) buf \"%c%c%c\" (\"8  \")\n",
+	      prio, buf[0], buf[1], buf[2]);
+      result = 1;
+    }
+
+  rets = mq_receive (q, buf, 2, NULL);
+  if (rets != 2)
+    {
+      if (rets == -1)
+	printf ("mq_receive failed: %m\n");
+      else
+	printf ("mq_receive returned %zd != 2\n", rets);
+      result = 1;
+    }
+  else if (memcmp (buf, "67 ", 3) != 0)
+    {
+      printf ("mq_receive buf \"%c%c%c\" != \"67 \"\n",
+	      buf[0], buf[1], buf[2]);
+      result = 1;
+    }
+
+  buf[0] = '2';
+  buf[1] = '1';
+  if (clock_gettime (CLOCK_REALTIME, &ts) != 0)
+    ts.tv_sec = time (NULL);
+  ts.tv_nsec = -1000000001;
+  if ((mq_timedsend (q, buf, 2, 5, &ts) != 0
+       && (errno != EINVAL || mq_send (q, buf, 2, 5) != 0))
+      || (buf[0] = '3', ts.tv_nsec = -ts.tv_nsec,
+	  (mq_timedsend (q, buf, 1, 4, &ts) != 0
+	   && (errno != EINVAL || mq_send (q, buf, 1, 4) != 0))))
+    {
+      printf ("mq_timedsend failed: %m\n");
+      result = 1;
+    }
+
+  buf[0] = '-';
+  ts.tv_nsec = 1000000001;
+  if (mq_timedsend (q, buf, 1, 6, &ts) == 0)
+    {
+      puts ("mq_timedsend with tv_nsec >= 1000000000 did not fail");
+      result = 1;
+    }
+  else if (errno != EINVAL)
+    {
+      printf ("mq_timedsend with tv_nsec >= 1000000000 did not fail with "
+	      "EINVAL: %m\n");
+      result = 1;
+    }
+
+  ts.tv_nsec = -2;
+  if (mq_timedsend (q, buf, 1, 6, &ts) == 0)
+    {
+      puts ("mq_timedsend with negative tv_nsec did not fail");
+      result = 1;
+    }
+  else if (errno != EINVAL)
+    {
+      printf ("mq_timedsend with megatove tv_nsec did not fail with "
+	      "EINVAL: %m\n");
+      result = 1;
+    }
+
+  setitimer (ITIMER_REAL, &it, NULL);
+
+  if (mq_send (q, buf, 2, 8) == 0)
+    {
+      puts ("mq_send on full queue did not block");
+      result = 1;
+    }
+  else if (errno != EINTR)
+    {
+      printf ("mq_send on full queue did not fail with EINTR: %m\n");
+      result = 1;
+    }
+
+  setitimer (ITIMER_REAL, &it, NULL);
+
+  ts.tv_sec += 10;
+  ts.tv_nsec = 0;
+  if (mq_timedsend (q, buf, 2, 7, &ts) == 0)
+    {
+      puts ("mq_timedsend on full queue did not block");
+      result = 1;
+    }
+  else if (errno != EINTR)
+    {
+      printf ("mq_timedsend on full queue did not fail with EINTR: %m\n");
+      result = 1;
+    }
+
+  memset (buf, ' ', sizeof (buf));
+
+  if (clock_gettime (CLOCK_REALTIME, &ts) != 0)
+    ts.tv_sec = time (NULL);
+  ts.tv_nsec = -1000000001;
+  rets = mq_timedreceive (q, buf, 2, &prio, &ts);
+  if (rets == -1 && errno == EINVAL)
+    rets = mq_receive (q, buf, 2, &prio);
+  if (rets != 2)
+    {
+      if (rets == -1)
+	printf ("mq_timedreceive failed: %m\n");
+      else
+	printf ("mq_timedreceive returned %zd != 2\n", rets);
+      result = 1;
+    }
+  else if (prio != 5 || memcmp (buf, "21 ", 3) != 0)
+    {
+      printf ("mq_timedreceive prio %u (5) buf \"%c%c%c\" (\"21 \")\n",
+	      prio, buf[0], buf[1], buf[2]);
+      result = 1;
+    }
+
+  if (mq_receive (q, buf, 1, NULL) == 0)
+    {
+      puts ("mq_receive with too small msg_len did not fail");
+      result = 1;
+    }
+  else if (errno != EMSGSIZE)
+    {
+      printf ("mq_receive with too small msg_len did not fail with "
+	      "EMSGSIZE: %m\n");
+      result = 1;
+    }
+
+  ts.tv_nsec = -ts.tv_nsec;
+  rets = mq_timedreceive (q, buf, 2, NULL, &ts);
+  if (rets == -1 && errno == EINVAL)
+    rets = mq_receive (q, buf, 2, NULL);
+  if (rets != 1)
+    {
+      if (rets == -1)
+	printf ("mq_timedreceive failed: %m\n");
+      else
+	printf ("mq_timedreceive returned %zd != 1\n", rets);
+      result = 1;
+    }
+  else if (memcmp (buf, "31 ", 3) != 0)
+    {
+      printf ("mq_timedreceive buf \"%c%c%c\" != \"31 \"\n",
+	      buf[0], buf[1], buf[2]);
+      result = 1;
+    }
+
+  if (mq_send (q, "", 0, 2) != 0)
+    {
+      printf ("mq_send with msg_len 0 failed: %m\n");
+      result = 1;
+    }
+
+  rets = mq_receive (q, buf, 2, &prio);
+  if (rets)
+    {
+      if (rets == -1)
+	printf ("mq_receive failed: %m\n");
+      else
+	printf ("mq_receive returned %zd != 0\n", rets);
+      result = 1;
+    }
+
+  long mq_prio_max = sysconf (_SC_MQ_PRIO_MAX);
+  if (mq_prio_max > 0 && (unsigned int) mq_prio_max == mq_prio_max)
+    {
+      if (mq_send (q, buf, 1, mq_prio_max) == 0)
+	{
+	  puts ("mq_send with MQ_PRIO_MAX priority unpexpectedly succeeded");
+	  result = 1;
+	}
+      else if (errno != EINVAL)
+	{
+	  printf ("mq_send with MQ_PRIO_MAX priority did not fail with "
+		  "EINVAL: %m\n");
+	  result = 1;
+	}
+
+      if (mq_send (q, buf, 1, mq_prio_max - 1) != 0)
+	{
+	  printf ("mq_send with MQ_PRIO_MAX-1 priority failed: %m\n");
+	  result = 1;
+	}
+    }
+
+  if (mq_unlink (name) != 0)
+    {
+      printf ("mq_unlink failed: %m\n");
+      result = 1;
+    }
+
+  q2 = mq_open (name, O_RDWR);
+  if (q2 != (mqd_t) -1)
+    {
+      printf ("mq_open of unlinked %s without O_CREAT unexpectedly"
+	      "succeeded\n", name);
+      result = 1;
+    }
+  else if (errno != ENOENT)
+    {
+      printf ("mq_open of unlinked %s without O_CREAT did not fail with "
+	      "ENOENT: %m\n", name);
+      result = 1;
+    }
+
+  if (mq_close (q) != 0)
+    {
+      printf ("mq_close in parent failed: %m\n");
+      result = 1;
+    }
+
+  if (mq_receive (q, buf, 2, NULL) == 0)
+    {
+      puts ("mq_receive on invalid mqd_t did not fail");
+      result = 1;
+    }
+  else if (errno != EBADF)
+    {
+      printf ("mq_receive on invalid mqd_t did not fail with EBADF: %m\n");
+      result = 1;
+    }
+
+  if (mq_send (q, buf, 1, 2) == 0)
+    {
+      puts ("mq_send on invalid mqd_t did not fail");
+      result = 1;
+    }
+  else if (errno != EBADF)
+    {
+      printf ("mq_send on invalid mqd_t did not fail with EBADF: %m\n");
+      result = 1;
+    }
+
+  if (mq_getattr (q, &attr) == 0)
+    {
+      puts ("mq_getattr on invalid mqd_t did not fail");
+      result = 1;
+    }
+  else if (errno != EBADF)
+    {
+      printf ("mq_getattr on invalid mqd_t did not fail with EBADF: %m\n");
+      result = 1;
+    }
+
+  memset (&attr, 0, sizeof (attr));
+  if (mq_setattr (q, &attr, NULL) == 0)
+    {
+      puts ("mq_setattr on invalid mqd_t did not fail");
+      result = 1;
+    }
+  else if (errno != EBADF)
+    {
+      printf ("mq_setattr on invalid mqd_t did not fail with EBADF: %m\n");
+      result = 1;
+    }
+
+  if (mq_unlink ("/tst-mqueue2-which-should-never-exist") != -1)
+    {
+      puts ("mq_unlink of non-existant message queue unexpectedly succeeded");
+      result = 1;
+    }
+  else if (errno != ENOENT)
+    {
+      printf ("mq_unlink of non-existant message queue did not fail with "
+	      "ENOENT: %m\n");
+      result = 1;
+    }
+  return result;
+}
+
+#include "../test-skeleton.c"
diff --git a/ap/build/uClibc/test/nptl/tst-mqueue3.c b/ap/build/uClibc/test/nptl/tst-mqueue3.c
new file mode 100644
index 0000000..990e057
--- /dev/null
+++ b/ap/build/uClibc/test/nptl/tst-mqueue3.c
@@ -0,0 +1,244 @@
+/* Test SIGEV_THREAD handling for POSIX message queues.
+   Copyright (C) 2004 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+   Contributed by Ulrich Drepper <drepper@redhat.com>, 2004.
+
+   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 <errno.h>
+#include <mqueue.h>
+#include <signal.h>
+#include <stddef.h>
+#include <stdint.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <sys/mman.h>
+#include <sys/wait.h>
+#include <unistd.h>
+
+#if _POSIX_THREADS
+# include <pthread.h>
+
+static pid_t pid;
+static mqd_t m;
+static const char message[] = "hello";
+
+# define MAXMSG 10
+# define MSGSIZE 10
+# define UNIQUE 42
+
+
+static void
+fct (union sigval s)
+{
+  /* Put the mq in non-blocking mode.  */
+  struct mq_attr attr;
+  if (mq_getattr (m, &attr) != 0)
+    {
+      printf ("%s: mq_getattr failed: %m\n", __FUNCTION__);
+      exit (1);
+    }
+  attr.mq_flags |= O_NONBLOCK;
+  if (mq_setattr (m, &attr, NULL) != 0)
+    {
+      printf ("%s: mq_setattr failed: %m\n", __FUNCTION__);
+      exit (1);
+    }
+
+  /* Check the values.  */
+  if (attr.mq_maxmsg != MAXMSG)
+    {
+      printf ("%s: mq_maxmsg wrong: is %ld, expecte %d\n",
+	      __FUNCTION__, attr.mq_maxmsg, MAXMSG);
+      exit (1);
+    }
+  if (attr.mq_msgsize != MAXMSG)
+    {
+      printf ("%s: mq_msgsize wrong: is %ld, expecte %d\n",
+	      __FUNCTION__, attr.mq_msgsize, MSGSIZE);
+      exit (1);
+    }
+
+  /* Read the message.  */
+  char buf[attr.mq_msgsize];
+  ssize_t n = TEMP_FAILURE_RETRY (mq_receive (m, buf, attr.mq_msgsize, NULL));
+  if (n != sizeof (message))
+    {
+      printf ("%s: length of message wrong: is %zd, expected %zu\n",
+	      __FUNCTION__, n, sizeof (message));
+      exit (1);
+    }
+  if (memcmp (buf, message, sizeof (message)) != 0)
+    {
+      printf ("%s: message wrong: is \"%s\", expected \"%s\"\n",
+	      __FUNCTION__, buf, message);
+      exit (1);
+    }
+
+  exit (UNIQUE);
+}
+
+
+int
+do_test (void)
+{
+  char tmpfname[] = "/tmp/tst-mqueue3-barrier.XXXXXX";
+  int fd = mkstemp (tmpfname);
+  if (fd == -1)
+    {
+      printf ("cannot open temporary file: %m\n");
+      return 1;
+    }
+
+  /* Make sure it is always removed.  */
+  unlink (tmpfname);
+
+  /* Create one page of data.  */
+  size_t ps = sysconf (_SC_PAGESIZE);
+  char data[ps];
+  memset (data, '\0', ps);
+
+  /* Write the data to the file.  */
+  if (write (fd, data, ps) != (ssize_t) ps)
+    {
+      puts ("short write");
+      return 1;
+    }
+
+  void *mem = mmap (NULL, ps, PROT_READ | PROT_WRITE, MAP_SHARED, fd, 0);
+  if (mem == MAP_FAILED)
+    {
+      printf ("mmap failed: %m\n");
+      return 1;
+    }
+
+  pthread_barrier_t *b;
+  b = (pthread_barrier_t *) (((uintptr_t) mem + __alignof (pthread_barrier_t))
+                             & ~(__alignof (pthread_barrier_t) - 1));
+
+  pthread_barrierattr_t a;
+  if (pthread_barrierattr_init (&a) != 0)
+    {
+      puts ("barrierattr_init failed");
+      return 1;
+    }
+
+  if (pthread_barrierattr_setpshared (&a, PTHREAD_PROCESS_SHARED) != 0)
+    {
+      puts ("barrierattr_setpshared failed, could not test");
+      return 0;
+    }
+
+  if (pthread_barrier_init (b, &a, 2) != 0)
+    {
+      puts ("barrier_init failed");
+      return 1;
+    }
+
+  if (pthread_barrierattr_destroy (&a) != 0)
+    {
+      puts ("barrierattr_destroy failed");
+      return 1;
+    }
+
+  /* Name for the message queue.  */
+  char mqname[sizeof ("/tst-mqueue3-") + 3 * sizeof (pid_t)];
+  snprintf (mqname, sizeof (mqname) - 1, "/tst-mqueue3-%ld",
+	    (long int) getpid ());
+
+  /* Create the message queue.  */
+  struct mq_attr attr = { .mq_maxmsg = MAXMSG, .mq_msgsize = MSGSIZE };
+  m = mq_open (mqname, O_CREAT | O_EXCL | O_RDWR, 0600, &attr);
+  if (m == -1)
+    {
+      if (errno == ENOSYS)
+	{
+	  puts ("not implemented");
+	  return 0;
+	}
+
+      puts ("mq_open failed");
+      return 1;
+    }
+
+  /* Unlink the message queue right away.  */
+  if (mq_unlink (mqname) != 0)
+    {
+      puts ("mq_unlink failed");
+      return 1;
+    }
+
+  pid = fork ();
+  if (pid == -1)
+    {
+      puts ("fork failed");
+      return 1;
+    }
+  if (pid == 0)
+    {
+      /* Request notification via thread.  */
+      struct sigevent ev;
+      ev.sigev_notify = SIGEV_THREAD;
+      ev.sigev_notify_function = fct;
+      ev.sigev_value.sival_ptr = NULL;
+      ev.sigev_notify_attributes = NULL;
+
+      /* Tell the kernel.  */
+      if (mq_notify (m,&ev) != 0)
+	{
+	  puts ("mq_notify failed");
+	  exit (1);
+	}
+
+      /* Tell the parent we are ready.  */
+      (void) pthread_barrier_wait (b);
+
+      /* Make sure the process goes away eventually.  */
+      alarm (10);
+
+      /* Do nothing forever.  */
+      while (1)
+	pause ();
+    }
+
+  /* Wait for the child process to register to notification method.  */
+  (void) pthread_barrier_wait (b);
+
+  /* Send the message.  */
+  if (mq_send (m, message, sizeof (message), 1) != 0)
+    {
+      kill (pid, SIGKILL);
+      puts ("mq_send failed");
+      return 1;
+    }
+
+  int r;
+  if (TEMP_FAILURE_RETRY (waitpid (pid, &r, 0)) != pid)
+    {
+      kill (pid, SIGKILL);
+      puts ("waitpid failed");
+      return 1;
+    }
+
+  return WIFEXITED (r) && WEXITSTATUS (r) == UNIQUE ? 0 : 1;
+}
+# define TEST_FUNCTION do_test ()
+#else
+# define TEST_FUNCTION 0
+#endif
+
+#include "../test-skeleton.c"
diff --git a/ap/build/uClibc/test/nptl/tst-mqueue4.c b/ap/build/uClibc/test/nptl/tst-mqueue4.c
new file mode 100644
index 0000000..aa31706
--- /dev/null
+++ b/ap/build/uClibc/test/nptl/tst-mqueue4.c
@@ -0,0 +1,288 @@
+/* Test message queue passing.
+   Copyright (C) 2004 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+   Contributed by Jakub Jelinek <jakub@redhat.com>, 2004.
+
+   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 <errno.h>
+#include <fcntl.h>
+#include <mqueue.h>
+#include <limits.h>
+#include <signal.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <sys/time.h>
+#include <sys/wait.h>
+#include <time.h>
+#include <unistd.h>
+#include "tst-mqueue.h"
+
+#define TIMEOUT 4
+#define TEST_FUNCTION do_test ()
+static int
+do_test (void)
+{
+  int result = 0;
+
+  char name[sizeof "/tst-mqueue4-" + sizeof (pid_t) * 3 + NAME_MAX];
+  char *p;
+  p = name + snprintf (name, sizeof (name), "/tst-mqueue4-%u", getpid ());
+  struct mq_attr attr = { .mq_maxmsg = 2, .mq_msgsize = 2 };
+  mqd_t q = mq_open (name, O_CREAT | O_EXCL | O_RDWR, 0600, &attr);
+
+  if (q == (mqd_t) -1)
+    {
+      printf ("mq_open failed with: %m\n");
+      return result;
+    }
+  else
+    add_temp_mq (name);
+
+  *p = '.';
+  memset (p + 1, 'x', NAME_MAX + 1 - (p - name));
+  name[NAME_MAX + 1] = '\0';
+
+  mqd_t q2 = mq_open (name, O_CREAT | O_EXCL | O_RDWR, 0600, &attr);
+  if (q2 == (mqd_t) -1)
+    {
+      printf ("mq_open with NAME_MAX long name compoment failed with: %m\n");
+      result = 1;
+    }
+
+  if (mq_unlink (name) != 0)
+    {
+      printf ("mq_unlink failed: %m\n");
+      result = 1;
+    }
+
+  if (mq_close (q2) != 0)
+    {
+      printf ("mq_close failed: %m\n");
+      result = 1;
+    }
+
+  name[NAME_MAX + 1] = 'x';
+  name[NAME_MAX + 2] = '\0';
+  q2 = mq_open (name, O_CREAT | O_EXCL | O_RDWR, 0600, &attr);
+  if (q2 != (mqd_t) -1)
+    {
+      puts ("mq_open with too long name component unexpectedly succeeded");
+      mq_unlink (name);
+      mq_close (q2);
+      result = 1;
+    }
+  else if (errno != ENAMETOOLONG)
+    {
+      printf ("mq_open with too long name component did not fail with "
+	      "ENAMETOOLONG: %m\n");
+      result = 1;
+    }
+
+  if (mq_unlink (name) == 0)
+    {
+      puts ("mq_unlink with too long name component unexpectedly succeeded");
+      result = 1;
+    }
+  else if (errno != ENAMETOOLONG)
+    {
+      printf ("mq_unlink with too long name component did not fail with "
+	      "ENAMETOOLONG: %m\n");
+      result = 1;
+    }
+
+  *p = '\0';
+  attr.mq_maxmsg = 1;
+  attr.mq_msgsize = 3;
+  q2 = mq_open (name, O_CREAT | O_RDWR, 0600, &attr);
+  if (q2 == (mqd_t) -1)
+    {
+      printf ("mq_open without O_EXCL failed with %m\n");
+      result = 1;
+    }
+
+  char buf[3];
+  strcpy (buf, "jk");
+  if (mq_send (q, buf, 2, 4) != 0)
+    {
+      printf ("mq_send failed: %m\n");
+      result = 1;
+    }
+
+  if (mq_send (q, buf + 1, 1, 5) != 0)
+    {
+      printf ("mq_send failed: %m\n");
+      result = 1;
+    }
+
+  if (mq_getattr (q2, &attr) != 0)
+    {
+      printf ("mq_getattr failed: %m\n");
+      result = 1;
+    }
+
+  if ((attr.mq_flags & O_NONBLOCK)
+      || attr.mq_maxmsg != 2
+      || attr.mq_msgsize != 2
+      || attr.mq_curmsgs != 2)
+    {
+      printf ("mq_getattr returned unexpected { .mq_flags = %ld,\n"
+	      ".mq_maxmsg = %ld, .mq_msgsize = %ld, .mq_curmsgs = %ld }\n",
+	      attr.mq_flags, attr.mq_maxmsg, attr.mq_msgsize, attr.mq_curmsgs);
+      result = 1;
+    }
+
+  struct timespec ts;
+  if (clock_gettime (CLOCK_REALTIME, &ts) == 0)
+    ++ts.tv_sec;
+  else
+    {
+      ts.tv_sec = time (NULL) + 1;
+      ts.tv_nsec = 0;
+    }
+
+  if (mq_timedsend (q2, buf, 1, 1, &ts) == 0)
+    {
+      puts ("mq_timedsend unexpectedly succeeded");
+      result = 1;
+    }
+  else if (errno != ETIMEDOUT)
+    {
+      printf ("mq_timedsend did not fail with ETIMEDOUT: %m\n");
+      result = 1;
+    }
+
+  if (mq_close (q2) != 0)
+    {
+      printf ("mq_close failed: %m\n");
+      result = 1;
+    }
+
+  q2 = mq_open (name, O_RDONLY, 0600);
+  if (q2 == (mqd_t) -1)
+    {
+      printf ("mq_open without O_CREAT failed with %m\n");
+      result = 1;
+    }
+
+  mqd_t q3 = mq_open (name, O_RDONLY, 0600);
+  if (q3 == (mqd_t) -1)
+    {
+      printf ("mq_open without O_CREAT failed with %m\n");
+      result = 1;
+    }
+
+  memset (buf, ' ', sizeof (buf));
+
+  unsigned int prio;
+  ssize_t rets = mq_receive (q2, buf, 2, &prio);
+  if (rets != 1)
+    {
+      if (rets == -1)
+	printf ("mq_receive failed with: %m\n");
+      else
+	printf ("mq_receive returned %zd != 1\n", rets);
+      result = 1;
+    }
+  else if (prio != 5 || memcmp (buf, "k  ", 3) != 0)
+    {
+      printf ("mq_receive returned prio %u (2) buf \"%c%c%c\" (\"k  \")\n",
+	      prio, buf[0], buf[1], buf[2]);
+      result = 1;
+    }
+
+  if (mq_getattr (q3, &attr) != 0)
+    {
+      printf ("mq_getattr failed: %m\n");
+      result = 1;
+    }
+
+  if ((attr.mq_flags & O_NONBLOCK)
+      || attr.mq_maxmsg != 2
+      || attr.mq_msgsize != 2
+      || attr.mq_curmsgs != 1)
+    {
+      printf ("mq_getattr returned unexpected { .mq_flags = %ld,\n"
+	      ".mq_maxmsg = %ld, .mq_msgsize = %ld, .mq_curmsgs = %ld }\n",
+	      attr.mq_flags, attr.mq_maxmsg, attr.mq_msgsize, attr.mq_curmsgs);
+      result = 1;
+    }
+
+  rets = mq_receive (q3, buf, 2, NULL);
+  if (rets != 2)
+    {
+      if (rets == -1)
+	printf ("mq_receive failed with: %m\n");
+      else
+	printf ("mq_receive returned %zd != 2\n", rets);
+      result = 1;
+    }
+  else if (memcmp (buf, "jk ", 3) != 0)
+    {
+      printf ("mq_receive returned buf \"%c%c%c\" != \"jk \"\n",
+	      buf[0], buf[1], buf[2]);
+      result = 1;
+    }
+
+  if (clock_gettime (CLOCK_REALTIME, &ts) == 0)
+    ++ts.tv_sec;
+  else
+    {
+      ts.tv_sec = time (NULL) + 1;
+      ts.tv_nsec = 0;
+    }
+
+  if (mq_timedreceive (q2, buf, 2, NULL, &ts) != -1)
+    {
+      puts ("mq_timedreceive on empty queue unexpectedly succeeded");
+      result = 1;
+    }
+  else if (errno != ETIMEDOUT)
+    {
+      printf ("mq_timedreceive on empty queue did not fail with "
+	      "ETIMEDOUT: %m\n");
+      result = 1;
+    }
+
+  if (mq_unlink (name) != 0)
+    {
+      printf ("mq_unlink failed: %m\n");
+      result = 1;
+    }
+
+  if (mq_close (q) != 0)
+    {
+      printf ("mq_close failed: %m\n");
+      result = 1;
+    }
+
+  if (mq_close (q2) != 0)
+    {
+      printf ("mq_close failed: %m\n");
+      result = 1;
+    }
+
+  if (mq_close (q3) != 0)
+    {
+      printf ("mq_close failed: %m\n");
+      result = 1;
+    }
+
+  return result;
+}
+
+#include "../test-skeleton.c"
diff --git a/ap/build/uClibc/test/nptl/tst-mqueue5.c b/ap/build/uClibc/test/nptl/tst-mqueue5.c
new file mode 100644
index 0000000..97571da
--- /dev/null
+++ b/ap/build/uClibc/test/nptl/tst-mqueue5.c
@@ -0,0 +1,1014 @@
+/* Test mq_notify.
+   Copyright (C) 2004 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+   Contributed by Jakub Jelinek <jakub@redhat.com>, 2004.
+
+   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 <errno.h>
+#include <fcntl.h>
+#include <mqueue.h>
+#include <limits.h>
+#include <signal.h>
+#include <stdint.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <sys/mman.h>
+#include <sys/time.h>
+#include <sys/wait.h>
+#include <time.h>
+#include <unistd.h>
+#include "tst-mqueue.h"
+
+#define TIMEOUT 3
+
+#if _POSIX_THREADS
+# include <pthread.h>
+
+volatile int rtmin_cnt;
+volatile pid_t rtmin_pid;
+volatile uid_t rtmin_uid;
+volatile int rtmin_code;
+volatile union sigval rtmin_sigval;
+
+static void
+rtmin_handler (int sig, siginfo_t *info, void *ctx)
+{
+  if (sig != SIGRTMIN)
+    abort ();
+  ++rtmin_cnt;
+  rtmin_pid = info->si_pid;
+  rtmin_uid = info->si_uid;
+  rtmin_code = info->si_code;
+  rtmin_sigval = info->si_value;
+}
+
+#define mqsend(q) (mqsend) (q, __LINE__)
+static int
+(mqsend) (mqd_t q, int line)
+{
+  char c;
+  if (mq_send (q, &c, 1, 1) != 0)
+    {
+      printf ("mq_send on line %d failed with: %m\n", line);
+      return 1;
+    }
+  return 0;
+}
+
+#define mqrecv(q) (mqrecv) (q, __LINE__)
+static int
+(mqrecv) (mqd_t q, int line)
+{
+  char c;
+  ssize_t rets = TEMP_FAILURE_RETRY (mq_receive (q, &c, 1, NULL));
+  if (rets != 1)
+    {
+      if (rets == -1)
+	printf ("mq_receive on line %d failed with: %m\n", line);
+      else
+	printf ("mq_receive on line %d returned %zd != 1\n",
+		line, rets);
+      return 1;
+    }
+  return 0;
+}
+
+struct thr_data
+{
+  const char *name;
+  pthread_barrier_t *b3;
+  mqd_t q;
+};
+
+static void *
+thr (void *arg)
+{
+  pthread_barrier_t *b3 = ((struct thr_data *)arg)->b3;
+  mqd_t q = ((struct thr_data *)arg)->q;
+  const char *name = ((struct thr_data *)arg)->name;
+  int result = 0;
+
+  result |= mqrecv (q);
+
+  (void) pthread_barrier_wait (b3);
+
+  /* Child verifies SIGRTMIN has not been sent.  */
+
+  (void) pthread_barrier_wait (b3);
+
+  /* Parent calls mqsend (q), which should trigger notification.  */
+
+  (void) pthread_barrier_wait (b3);
+
+  if (rtmin_cnt != 2)
+    {
+      puts ("SIGRTMIN signal in child did not arrive");
+      result = 1;
+    }
+  else if (rtmin_pid != getppid ()
+	   || rtmin_uid != getuid ()
+	   || rtmin_code != SI_MESGQ
+	   || rtmin_sigval.sival_int != 0xdeadbeef)
+    {
+      printf ("unexpected siginfo_t fields: pid %u (%u), uid %u (%u), code %d (%d), si_int %d (%d)\n",
+	      rtmin_pid, getppid (), rtmin_uid, getuid (),
+	      rtmin_code, SI_MESGQ, rtmin_sigval.sival_int, 0xdeadbeef);
+      result = 1;
+    }
+
+  struct sigevent ev;
+  memset (&ev, 0x82, sizeof (ev));
+  ev.sigev_notify = SIGEV_NONE;
+  if (mq_notify (q, &ev) != 0)
+    {
+      printf ("mq_notify in thread (q, { SIGEV_NONE }) failed with: %m\n");
+      result = 1;
+    }
+
+  if (mq_notify (q, NULL) != 0)
+    {
+      printf ("mq_notify in thread (q, NULL) failed with: %m\n");
+      result = 1;
+    }
+
+  result |= mqrecv (q);
+
+  (void) pthread_barrier_wait (b3);
+
+  /* Child calls mq_notify (q, { SIGEV_SIGNAL }).  */
+
+  (void) pthread_barrier_wait (b3);
+
+  if (mq_notify (q, NULL) != 0)
+    {
+      printf ("second mq_notify in thread (q, NULL) failed with: %m\n");
+      result = 1;
+    }
+
+  (void) pthread_barrier_wait (b3);
+
+  /* Parent calls mqsend (q), which should not trigger notification.  */
+
+  (void) pthread_barrier_wait (b3);
+
+  /* Child verifies SIGRTMIN has not been received.  */
+  /* Child calls mq_notify (q, { SIGEV_SIGNAL }).  */
+
+  (void) pthread_barrier_wait (b3);
+
+  mqd_t q4 = mq_open (name, O_RDONLY);
+  if (q4 == (mqd_t) -1)
+    {
+      printf ("mq_open in thread failed with: %m\n");
+      result = 1;
+    }
+
+  if (mq_notify (q4, NULL) != 0)
+    {
+      printf ("mq_notify in thread (q4, NULL) failed with: %m\n");
+      result = 1;
+    }
+
+  if (mq_close (q4) != 0)
+    {
+      printf ("mq_close in thread failed with: %m\n");
+      result = 1;
+    }
+
+  (void) pthread_barrier_wait (b3);
+
+  /* Parent calls mqsend (q), which should not trigger notification.  */
+
+  (void) pthread_barrier_wait (b3);
+
+  /* Child verifies SIGRTMIN has not been received.  */
+  /* Child calls mq_notify (q, { SIGEV_SIGNAL }).  */
+
+  (void) pthread_barrier_wait (b3);
+
+  mqd_t q5 = mq_open (name, O_WRONLY);
+  if (q5 == (mqd_t) -1)
+    {
+      printf ("mq_open O_WRONLY in thread failed with: %m\n");
+      result = 1;
+    }
+
+  if (mq_notify (q5, NULL) != 0)
+    {
+      printf ("mq_notify in thread (q5, NULL) failed with: %m\n");
+      result = 1;
+    }
+
+  if (mq_close (q5) != 0)
+    {
+      printf ("mq_close in thread failed with: %m\n");
+      result = 1;
+    }
+
+  (void) pthread_barrier_wait (b3);
+
+  /* Parent calls mqsend (q), which should not trigger notification.  */
+
+  (void) pthread_barrier_wait (b3);
+
+  /* Child verifies SIGRTMIN has not been received.  */
+
+  return (void *) (long) result;
+}
+
+static void
+do_child (const char *name, pthread_barrier_t *b2, pthread_barrier_t *b3,
+	  mqd_t q)
+{
+  int result = 0;
+
+  struct sigevent ev;
+  memset (&ev, 0x55, sizeof (ev));
+  ev.sigev_notify = SIGEV_SIGNAL;
+  ev.sigev_signo = SIGRTMIN;
+  ev.sigev_value.sival_ptr = &ev;
+  if (mq_notify (q, &ev) == 0)
+    {
+      puts ("first mq_notify in child (q, { SIGEV_SIGNAL }) unexpectedly succeeded");
+      result = 1;
+    }
+  else if (errno != EBUSY)
+    {
+      printf ("first mq_notify in child (q, { SIGEV_SIGNAL }) failed with: %m\n");
+      result = 1;
+    }
+
+  (void) pthread_barrier_wait (b2);
+
+  /* Parent calls mqsend (q), which makes notification available.  */
+
+  (void) pthread_barrier_wait (b2);
+
+  rtmin_cnt = 0;
+
+  if (mq_notify (q, &ev) != 0)
+    {
+      printf ("second mq_notify in child (q, { SIGEV_SIGNAL }) failed with: %m\n");
+      result = 1;
+    }
+
+  if (rtmin_cnt != 0)
+    {
+      puts ("SIGRTMIN signal in child caught too early");
+      result = 1;
+    }
+
+  (void) pthread_barrier_wait (b2);
+
+  /* Parent unsuccessfully attempts to mq_notify.  */
+  /* Parent calls mqsend (q), which makes notification available
+     and triggers a signal in the child.  */
+  /* Parent successfully calls mq_notify SIGEV_SIGNAL.  */
+
+  (void) pthread_barrier_wait (b2);
+
+  if (rtmin_cnt != 1)
+    {
+      puts ("SIGRTMIN signal in child did not arrive");
+      result = 1;
+    }
+  else if (rtmin_pid != getppid ()
+	   || rtmin_uid != getuid ()
+	   || rtmin_code != SI_MESGQ
+	   || rtmin_sigval.sival_ptr != &ev)
+    {
+      printf ("unexpected siginfo_t fields: pid %u (%u), uid %u (%u), code %d (%d), si_ptr %p (%p)\n",
+	      rtmin_pid, getppid (), rtmin_uid, getuid (),
+	      rtmin_code, SI_MESGQ, rtmin_sigval.sival_ptr, &ev);
+      result = 1;
+    }
+
+  result |= mqsend (q);
+
+  (void) pthread_barrier_wait (b2);
+
+  /* Parent verifies caught SIGRTMIN.  */
+
+  mqd_t q2 = mq_open (name, O_RDWR);
+  if (q2 == (mqd_t) -1)
+    {
+      printf ("mq_open in child failed with: %m\n");
+      result = 1;
+    }
+
+  (void) pthread_barrier_wait (b2);
+
+  /* Parent mq_open's another mqd_t for the same queue (q3).  */
+
+  memset (&ev, 0x11, sizeof (ev));
+  ev.sigev_notify = SIGEV_SIGNAL;
+  ev.sigev_signo = SIGRTMIN;
+  ev.sigev_value.sival_ptr = &ev;
+  if (mq_notify (q2, &ev) != 0)
+    {
+      printf ("mq_notify in child (q2, { SIGEV_SIGNAL }) failed with: %m\n");
+      result = 1;
+    }
+
+  (void) pthread_barrier_wait (b2);
+
+  /* Parent unsuccessfully attempts to mq_notify { SIGEV_NONE } on q.  */
+
+  (void) pthread_barrier_wait (b2);
+
+  if (mq_close (q2) != 0)
+    {
+      printf ("mq_close failed: %m\n");
+      result = 1;
+    }
+
+  (void) pthread_barrier_wait (b2);
+
+  /* Parent successfully calls mq_notify { SIGEV_NONE } on q3.  */
+
+  (void) pthread_barrier_wait (b2);
+
+  memset (&ev, 0xbb, sizeof (ev));
+  ev.sigev_notify = SIGEV_SIGNAL;
+  ev.sigev_signo = SIGRTMIN;
+  ev.sigev_value.sival_ptr = &b2;
+  if (mq_notify (q, &ev) == 0)
+    {
+      puts ("third mq_notify in child (q, { SIGEV_SIGNAL }) unexpectedly succeeded");
+      result = 1;
+    }
+  else if (errno != EBUSY)
+    {
+      printf ("third mq_notify in child (q, { SIGEV_SIGNAL }) failed with: %m\n");
+      result = 1;
+    }
+
+  (void) pthread_barrier_wait (b2);
+
+  /* Parent calls mq_close on q3, which makes the queue available again for
+     notification.  */
+
+  (void) pthread_barrier_wait (b2);
+
+  memset (&ev, 0x13, sizeof (ev));
+  ev.sigev_notify = SIGEV_NONE;
+  if (mq_notify (q, &ev) != 0)
+    {
+      printf ("mq_notify in child (q, { SIGEV_NONE }) failed with: %m\n");
+      result = 1;
+    }
+
+  if (mq_notify (q, NULL) != 0)
+    {
+      printf ("mq_notify in child (q, NULL) failed with: %m\n");
+      result = 1;
+    }
+
+  (void) pthread_barrier_wait (b2);
+
+  struct thr_data thr_data = { .name = name, .b3 = b3, .q = q };
+  pthread_t th;
+  int ret = pthread_create (&th, NULL, thr, &thr_data);
+  if (ret)
+    {
+      errno = ret;
+      printf ("pthread_created failed with: %m\n");
+      result = 1;
+    }
+
+  /* Wait till thr calls mq_receive on the empty queue q and blocks on it.  */
+  sleep (1);
+
+  memset (&ev, 0x5f, sizeof (ev));
+  ev.sigev_notify = SIGEV_SIGNAL;
+  ev.sigev_signo = SIGRTMIN;
+  ev.sigev_value.sival_int = 0xdeadbeef;
+  if (mq_notify (q, &ev) != 0)
+    {
+      printf ("fourth mq_notify in child (q, { SIGEV_SIGNAL }) failed with: %m\n");
+      result = 1;
+    }
+
+  (void) pthread_barrier_wait (b2);
+
+  /* Parent calls mqsend (q), which should wake up mqrecv (q)
+     in the thread but no notification should be sent.  */
+
+  (void) pthread_barrier_wait (b3);
+
+  if (rtmin_cnt != 1)
+    {
+      puts ("SIGRTMIN signal caught while thr was blocked on mq_receive");
+      result = 1;
+    }
+
+  (void) pthread_barrier_wait (b3);
+
+  /* Parent calls mqsend (q), which should trigger notification.  */
+
+  (void) pthread_barrier_wait (b3);
+
+  /* Thread verifies SIGRTMIN has been received.  */
+  /* Thread calls mq_notify (q, { SIGEV_NONE }) to verify notification is now
+     available for registration.  */
+  /* Thread calls mq_notify (q, NULL).  */
+
+  (void) pthread_barrier_wait (b3);
+
+  memset (&ev, 0x6a, sizeof (ev));
+  ev.sigev_notify = SIGEV_SIGNAL;
+  ev.sigev_signo = SIGRTMIN;
+  ev.sigev_value.sival_ptr = do_child;
+  if (mq_notify (q, &ev) != 0)
+    {
+      printf ("fifth mq_notify in child (q, { SIGEV_SIGNAL }) failed with: %m\n");
+      result = 1;
+    }
+
+  (void) pthread_barrier_wait (b3);
+
+  /* Thread calls mq_notify (q, NULL), which should unregister the above
+     notification.  */
+
+  (void) pthread_barrier_wait (b3);
+
+  /* Parent calls mqsend (q), which should not trigger notification.  */
+
+  (void) pthread_barrier_wait (b3);
+
+  if (rtmin_cnt != 2)
+    {
+      puts ("SIGRTMIN signal caught while notification has been disabled");
+      result = 1;
+    }
+
+  memset (&ev, 0x7b, sizeof (ev));
+  ev.sigev_notify = SIGEV_SIGNAL;
+  ev.sigev_signo = SIGRTMIN;
+  ev.sigev_value.sival_ptr = thr;
+  if (mq_notify (q, &ev) != 0)
+    {
+      printf ("sixth mq_notify in child (q, { SIGEV_SIGNAL }) failed with: %m\n");
+      result = 1;
+    }
+
+  (void) pthread_barrier_wait (b3);
+
+  /* Thread opens a new O_RDONLY mqd_t (q4).  */
+  /* Thread calls mq_notify (q4, NULL), which should unregister the above
+     notification.  */
+  /* Thread calls mq_close (q4).  */
+
+  (void) pthread_barrier_wait (b3);
+
+  /* Parent calls mqsend (q), which should not trigger notification.  */
+
+  (void) pthread_barrier_wait (b3);
+
+  if (rtmin_cnt != 2)
+    {
+      puts ("SIGRTMIN signal caught while notification has been disabled");
+      result = 1;
+    }
+
+  memset (&ev, 0xe1, sizeof (ev));
+  ev.sigev_notify = SIGEV_SIGNAL;
+  ev.sigev_signo = SIGRTMIN;
+  ev.sigev_value.sival_int = 127;
+  if (mq_notify (q, &ev) != 0)
+    {
+      printf ("seventh mq_notify in child (q, { SIGEV_SIGNAL }) failed with: %m\n");
+      result = 1;
+    }
+
+  (void) pthread_barrier_wait (b3);
+
+  /* Thread opens a new O_WRONLY mqd_t (q5).  */
+  /* Thread calls mq_notify (q5, NULL), which should unregister the above
+     notification.  */
+  /* Thread calls mq_close (q5).  */
+
+  (void) pthread_barrier_wait (b3);
+
+  /* Parent calls mqsend (q), which should not trigger notification.  */
+
+  (void) pthread_barrier_wait (b3);
+
+  if (rtmin_cnt != 2)
+    {
+      puts ("SIGRTMIN signal caught while notification has been disabled");
+      result = 1;
+    }
+
+ void *thr_ret;
+  ret = pthread_join (th, &thr_ret);
+  if (ret)
+    {
+      errno = ret;
+      printf ("pthread_join failed: %m\n");
+      result = 1;
+    }
+  else if (thr_ret)
+    result = 1;
+
+  if (mq_close (q) != 0)
+    {
+      printf ("mq_close failed: %m\n");
+      result = 1;
+    }
+
+  exit (result);
+}
+
+#define TEST_FUNCTION do_test ()
+static int
+do_test (void)
+{
+  int result = 0;
+
+  char tmpfname[] = "/tmp/tst-mqueue5-barrier.XXXXXX";
+  int fd = mkstemp (tmpfname);
+  if (fd == -1)
+    {
+      printf ("cannot open temporary file: %m\n");
+      return 1;
+    }
+
+  /* Make sure it is always removed.  */
+  unlink (tmpfname);
+
+  /* Create one page of data.  */
+  size_t ps = sysconf (_SC_PAGESIZE);
+  char data[ps];
+  memset (data, '\0', ps);
+
+  /* Write the data to the file.  */
+  if (write (fd, data, ps) != (ssize_t) ps)
+    {
+      puts ("short write");
+      return 1;
+    }
+
+  void *mem = mmap (NULL, ps, PROT_READ | PROT_WRITE, MAP_SHARED, fd, 0);
+  if (mem == MAP_FAILED)
+    {
+      printf ("mmap failed: %m\n");
+      return 1;
+    }
+
+  pthread_barrier_t *b2;
+  b2 = (pthread_barrier_t *) (((uintptr_t) mem + __alignof (pthread_barrier_t))
+			      & ~(__alignof (pthread_barrier_t) - 1));
+
+  pthread_barrier_t *b3;
+  b3 = b2 + 1;
+
+  pthread_barrierattr_t a;
+  if (pthread_barrierattr_init (&a) != 0)
+    {
+      puts ("barrierattr_init failed");
+      return 1;
+    }
+
+  if (pthread_barrierattr_setpshared (&a, PTHREAD_PROCESS_SHARED) != 0)
+    {
+      puts ("barrierattr_setpshared failed, could not test");
+      return 0;
+    }
+
+  if (pthread_barrier_init (b2, &a, 2) != 0)
+    {
+      puts ("barrier_init failed");
+      return 1;
+    }
+
+  if (pthread_barrier_init (b3, &a, 3) != 0)
+    {
+      puts ("barrier_init failed");
+      return 1;
+    }
+
+  if (pthread_barrierattr_destroy (&a) != 0)
+    {
+      puts ("barrierattr_destroy failed");
+      return 1;
+    }
+
+  char name[sizeof "/tst-mqueue5-" + sizeof (pid_t) * 3];
+  snprintf (name, sizeof (name), "/tst-mqueue5-%u", getpid ());
+
+  struct mq_attr attr = { .mq_maxmsg = 1, .mq_msgsize = 1 };
+  mqd_t q = mq_open (name, O_CREAT | O_EXCL | O_RDWR, 0600, &attr);
+
+  if (q == (mqd_t) -1)
+    {
+      printf ("mq_open failed with: %m\n");
+      return result;
+    }
+  else
+    add_temp_mq (name);
+
+  struct sigevent ev;
+  memset (&ev, 0xaa, sizeof (ev));
+  ev.sigev_notify = SIGEV_NONE;
+  if (mq_notify (q, &ev) != 0)
+    {
+      printf ("mq_notify (q, { SIGEV_NONE }) failed with: %m\n");
+      result = 1;
+    }
+
+  if (mq_notify (q, &ev) == 0)
+    {
+      puts ("second mq_notify (q, { SIGEV_NONE }) unexpectedly succeeded");
+      result = 1;
+    }
+  else if (errno != EBUSY)
+    {
+      printf ("second mq_notify (q, { SIGEV_NONE }) failed with: %m\n");
+      result = 1;
+    }
+
+  result |= mqsend (q);
+
+  if (mq_notify (q, &ev) != 0)
+    {
+      printf ("third mq_notify (q, { SIGEV_NONE }) failed with: %m\n");
+      result = 1;
+    }
+
+  result |= mqrecv (q);
+
+  if (mq_notify (q, NULL) != 0)
+    {
+      printf ("mq_notify (q, NULL) failed with: %m\n");
+      result = 1;
+    }
+
+  if (mq_notify (q, NULL) != 0)
+    {
+      /* Implementation-defined behaviour, so don't fail,
+	 just inform.  */
+      printf ("second mq_notify (q, NULL) failed with: %m\n");
+    }
+
+  struct sigaction sa = { .sa_sigaction = rtmin_handler,
+			  .sa_flags = SA_SIGINFO };
+  sigemptyset (&sa.sa_mask);
+  sigaction (SIGRTMIN, &sa, NULL);
+
+  memset (&ev, 0x55, sizeof (ev));
+  ev.sigev_notify = SIGEV_SIGNAL;
+  ev.sigev_signo = SIGRTMIN;
+  ev.sigev_value.sival_int = 26;
+  if (mq_notify (q, &ev) != 0)
+    {
+      printf ("mq_notify (q, { SIGEV_SIGNAL }) failed with: %m\n");
+      result = 1;
+    }
+
+  ev.sigev_value.sival_ptr = &ev;
+  if (mq_notify (q, &ev) == 0)
+    {
+      puts ("second mq_notify (q, { SIGEV_SIGNAL }) unexpectedly succeeded");
+      result = 1;
+    }
+  else if (errno != EBUSY)
+    {
+      printf ("second mq_notify (q, { SIGEV_SIGNAL }) failed with: %m\n");
+      result = 1;
+    }
+
+  if (rtmin_cnt != 0)
+    {
+      puts ("SIGRTMIN signal caught too early");
+      result = 1;
+    }
+
+  result |= mqsend (q);
+
+  if (rtmin_cnt != 1)
+    {
+      puts ("SIGRTMIN signal did not arrive");
+      result = 1;
+    }
+  else if (rtmin_pid != getpid ()
+	   || rtmin_uid != getuid ()
+	   || rtmin_code != SI_MESGQ
+	   || rtmin_sigval.sival_int != 26)
+    {
+      printf ("unexpected siginfo_t fields: pid %u (%u), uid %u (%u), code %d (%d), si_int %d (26)\n",
+	      rtmin_pid, getpid (), rtmin_uid, getuid (),
+	      rtmin_code, SI_MESGQ, rtmin_sigval.sival_int);
+      result = 1;
+    }
+
+  ev.sigev_value.sival_int = 75;
+  if (mq_notify (q, &ev) != 0)
+    {
+      printf ("third mq_notify (q, { SIGEV_SIGNAL }) failed with: %m\n");
+      result = 1;
+    }
+
+  result |= mqrecv (q);
+
+  if (mq_notify (q, NULL) != 0)
+    {
+      printf ("mq_notify (q, NULL) failed with: %m\n");
+      result = 1;
+    }
+
+  memset (&ev, 0x33, sizeof (ev));
+  ev.sigev_notify = SIGEV_NONE;
+  if (mq_notify (q, &ev) != 0)
+    {
+      printf ("fourth mq_notify (q, { SIGEV_NONE }) failed with: %m\n");
+      result = 1;
+    }
+
+  pid_t pid = fork ();
+  if (pid == -1)
+    {
+      printf ("fork () failed: %m\n");
+      mq_unlink (name);
+      return 1;
+    }
+
+  if (pid == 0)
+    do_child (name, b2, b3, q);
+
+  /* Child unsuccessfully attempts to mq_notify.  */
+
+  (void) pthread_barrier_wait (b2);
+
+  result |= mqsend (q);
+
+  (void) pthread_barrier_wait (b2);
+
+  /* Child successfully calls mq_notify SIGEV_SIGNAL now.  */
+
+  result |= mqrecv (q);
+
+  (void) pthread_barrier_wait (b2);
+
+  memset (&ev, 0xbb, sizeof (ev));
+  ev.sigev_notify = SIGEV_SIGNAL;
+  ev.sigev_signo = SIGRTMIN;
+  ev.sigev_value.sival_int = 15;
+  if (mq_notify (q, &ev) == 0)
+    {
+      puts ("fourth mq_notify (q, { SIGEV_SIGNAL }) unexpectedly succeeded");
+      result = 1;
+    }
+  else if (errno != EBUSY)
+    {
+      printf ("fourth mq_notify (q, { SIGEV_SIGNAL }) failed with: %m\n");
+      result = 1;
+    }
+
+  result |= mqsend (q);
+
+  if (mq_notify (q, &ev) != 0)
+    {
+      printf ("fifth mq_notify (q, { SIGEV_SIGNAL }) failed with: %m\n");
+      result = 1;
+    }
+
+  if (rtmin_cnt != 1)
+    {
+      puts ("SIGRTMIN signal caught too early");
+      result = 1;
+    }
+
+  result |= mqrecv (q);
+
+  (void) pthread_barrier_wait (b2);
+
+  /* Child verifies caught SIGRTMIN signal.  */
+  /* Child calls mq_send (q) which triggers SIGRTMIN signal here.  */
+
+  (void) pthread_barrier_wait (b2);
+
+  /* Child mq_open's another mqd_t for the same queue (q2).  */
+
+  if (rtmin_cnt != 2)
+    {
+      puts ("SIGRTMIN signal did not arrive");
+      result = 1;
+    }
+  else if (rtmin_pid != pid
+	   || rtmin_uid != getuid ()
+	   || rtmin_code != SI_MESGQ
+	   || rtmin_sigval.sival_int != 15)
+    {
+      printf ("unexpected siginfo_t fields: pid %u (%u), uid %u (%u), code %d (%d), si_int %d (15)\n",
+	      rtmin_pid, pid, rtmin_uid, getuid (),
+	      rtmin_code, SI_MESGQ, rtmin_sigval.sival_int);
+      result = 1;
+    }
+
+  result |= mqrecv (q);
+
+  (void) pthread_barrier_wait (b2);
+
+  /* Child successfully calls mq_notify { SIGEV_SIGNAL } on q2.  */
+
+  (void) pthread_barrier_wait (b2);
+
+  memset (&ev, 0xbb, sizeof (ev));
+  ev.sigev_notify = SIGEV_NONE;
+  if (mq_notify (q, &ev) == 0)
+    {
+      puts ("fifth mq_notify (q, { SIGEV_NONE }) unexpectedly succeeded");
+      result = 1;
+    }
+  else if (errno != EBUSY)
+    {
+      printf ("fifth mq_notify (q, { SIGEV_NONE }) failed with: %m\n");
+      result = 1;
+    }
+
+  (void) pthread_barrier_wait (b2);
+
+  /* Child calls mq_close on q2, which makes the queue available again for
+     notification.  */
+
+  mqd_t q3 = mq_open (name, O_RDWR);
+  if (q3 == (mqd_t) -1)
+    {
+      printf ("mq_open q3 in parent failed with: %m\n");
+      result = 1;
+    }
+
+  (void) pthread_barrier_wait (b2);
+
+  memset (&ev, 0x12, sizeof (ev));
+  ev.sigev_notify = SIGEV_NONE;
+  if (mq_notify (q3, &ev) != 0)
+    {
+      printf ("mq_notify (q3, { SIGEV_NONE }) failed with: %m\n");
+      result = 1;
+    }
+
+  (void) pthread_barrier_wait (b2);
+
+  /* Child unsuccessfully attempts to mq_notify { SIGEV_SIGNAL } on q.  */
+
+  (void) pthread_barrier_wait (b2);
+
+  if (mq_close (q3) != 0)
+    {
+      printf ("mq_close failed: %m\n");
+      result = 1;
+    }
+
+  (void) pthread_barrier_wait (b2);
+
+  /* Child successfully calls mq_notify { SIGEV_NONE } on q.  */
+  /* Child successfully calls mq_notify NULL on q.  */
+
+  (void) pthread_barrier_wait (b2);
+
+  /* Child creates new thread.  */
+  /* Thread blocks on mqrecv (q).  */
+  /* Child sleeps for 1sec so that thread has time to reach that point.  */
+  /* Child successfully calls mq_notify { SIGEV_SIGNAL } on q.  */
+
+  (void) pthread_barrier_wait (b2);
+
+  result |= mqsend (q);
+
+  (void) pthread_barrier_wait (b3);
+
+  /* Child verifies SIGRTMIN has not been sent.  */
+
+  (void) pthread_barrier_wait (b3);
+
+  result |= mqsend (q);
+
+  (void) pthread_barrier_wait (b3);
+
+  /* Thread verifies SIGRTMIN has been caught.  */
+  /* Thread calls mq_notify (q, { SIGEV_NONE }) to verify notification is now
+     available for registration.  */
+  /* Thread calls mq_notify (q, NULL).  */
+
+  (void) pthread_barrier_wait (b3);
+
+  /* Child calls mq_notify (q, { SIGEV_SIGNAL }).  */
+
+  (void) pthread_barrier_wait (b3);
+
+  /* Thread calls mq_notify (q, NULL). */
+
+  (void) pthread_barrier_wait (b3);
+
+  result |= mqsend (q);
+  result |= mqrecv (q);
+
+  (void) pthread_barrier_wait (b3);
+
+  /* Child verifies SIGRTMIN has not been sent.  */
+  /* Child calls mq_notify (q, { SIGEV_SIGNAL }).  */
+
+  (void) pthread_barrier_wait (b3);
+
+  /* Thread opens a new O_RDONLY mqd_t (q4).  */
+  /* Thread calls mq_notify (q4, NULL). */
+  /* Thread calls mq_close (q4).  */
+
+  (void) pthread_barrier_wait (b3);
+
+  result |= mqsend (q);
+  result |= mqrecv (q);
+
+  (void) pthread_barrier_wait (b3);
+
+  /* Child verifies SIGRTMIN has not been sent.  */
+  /* Child calls mq_notify (q, { SIGEV_SIGNAL }).  */
+
+  (void) pthread_barrier_wait (b3);
+
+  /* Thread opens a new O_WRONLY mqd_t (q5).  */
+  /* Thread calls mq_notify (q5, NULL). */
+  /* Thread calls mq_close (q5).  */
+
+  (void) pthread_barrier_wait (b3);
+
+  result |= mqsend (q);
+  result |= mqrecv (q);
+
+  (void) pthread_barrier_wait (b3);
+
+  /* Child verifies SIGRTMIN has not been sent.  */
+
+  int status;
+  if (TEMP_FAILURE_RETRY (waitpid (pid, &status, 0)) != pid)
+    {
+      puts ("waitpid failed");
+      kill (pid, SIGKILL);
+      result = 1;
+    }
+  else if (!WIFEXITED (status) || WEXITSTATUS (status))
+    {
+      printf ("child failed with status %d\n", status);
+      result = 1;
+    }
+
+  if (mq_unlink (name) != 0)
+    {
+      printf ("mq_unlink failed: %m\n");
+      result = 1;
+    }
+
+  if (mq_close (q) != 0)
+    {
+      printf ("mq_close failed: %m\n");
+      result = 1;
+    }
+
+  if (mq_notify (q, NULL) == 0)
+    {
+      puts ("mq_notify on closed mqd_t unexpectedly succeeded");
+      result = 1;
+    }
+  else if (errno != EBADF)
+    {
+      printf ("mq_notify on closed mqd_t did not fail with EBADF: %m\n");
+      result = 1;
+    }
+
+  memset (&ev, 0x55, sizeof (ev));
+  ev.sigev_notify = SIGEV_NONE;
+  if (mq_notify (q, &ev) == 0)
+    {
+      puts ("mq_notify on closed mqd_t unexpectedly succeeded");
+      result = 1;
+    }
+  else if (errno != EBADF)
+    {
+      printf ("mq_notify on closed mqd_t did not fail with EBADF: %m\n");
+      result = 1;
+    }
+
+  return result;
+}
+#else
+# define TEST_FUNCTION 0
+#endif
+
+#include "../test-skeleton.c"
diff --git a/ap/build/uClibc/test/nptl/tst-mqueue6.c b/ap/build/uClibc/test/nptl/tst-mqueue6.c
new file mode 100644
index 0000000..5c9ee69
--- /dev/null
+++ b/ap/build/uClibc/test/nptl/tst-mqueue6.c
@@ -0,0 +1,305 @@
+/* Test mq_notify.
+   Copyright (C) 2004 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+   Contributed by Jakub Jelinek <jakub@redhat.com>, 2004.
+
+   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 <errno.h>
+#include <fcntl.h>
+#include <mqueue.h>
+#include <limits.h>
+#include <signal.h>
+#include <stdint.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <sys/mman.h>
+#include <sys/time.h>
+#include <sys/wait.h>
+#include <time.h>
+#include <unistd.h>
+#include "tst-mqueue.h"
+
+#if _POSIX_THREADS
+# include <pthread.h>
+
+# define mqsend(q) (mqsend) (q, __LINE__)
+static int
+(mqsend) (mqd_t q, int line)
+{
+  char c;
+  if (mq_send (q, &c, 1, 1) != 0)
+    {
+      printf ("mq_send on line %d failed with: %m\n", line);
+      return 1;
+    }
+  return 0;
+}
+
+# define mqrecv(q) (mqrecv) (q, __LINE__)
+static int
+(mqrecv) (mqd_t q, int line)
+{
+  char c;
+  ssize_t rets = TEMP_FAILURE_RETRY (mq_receive (q, &c, 1, NULL));
+  if (rets != 1)
+    {
+      if (rets == -1)
+	printf ("mq_receive on line %d failed with: %m\n", line);
+      else
+	printf ("mq_receive on line %d returned %zd != 1\n",
+		line, rets);
+      return 1;
+    }
+  return 0;
+}
+
+volatile int fct_cnt, fct_err;
+size_t fct_guardsize;
+
+static void
+fct (union sigval s)
+{
+  mqd_t q = *(mqd_t *) s.sival_ptr;
+
+  pthread_attr_t nattr;
+  int ret = pthread_getattr_np (pthread_self (), &nattr);
+  if (ret)
+    {
+      errno = ret;
+      printf ("pthread_getattr_np failed: %m\n");
+      fct_err = 1;
+    }
+  else
+    {
+      ret = pthread_attr_getguardsize (&nattr, &fct_guardsize);
+      if (ret)
+	{
+	  errno = ret;
+	  printf ("pthread_attr_getguardsize failed: %m\n");
+	  fct_err = 1;
+	}
+      if (pthread_attr_destroy (&nattr) != 0)
+	{
+	  puts ("pthread_attr_destroy failed");
+	  fct_err = 1;
+	}
+    }
+
+  ++fct_cnt;
+  fct_err |= mqsend (q);
+}
+
+# define TEST_FUNCTION do_test ()
+static int
+do_test (void)
+{
+  int result = 0;
+
+  char name[sizeof "/tst-mqueue6-" + sizeof (pid_t) * 3];
+  snprintf (name, sizeof (name), "/tst-mqueue6-%u", getpid ());
+
+  struct mq_attr attr = { .mq_maxmsg = 1, .mq_msgsize = 1 };
+  mqd_t q = mq_open (name, O_CREAT | O_EXCL | O_RDWR, 0600, &attr);
+
+  if (q == (mqd_t) -1)
+    {
+      printf ("mq_open failed with: %m\n");
+      return result;
+    }
+  else
+    add_temp_mq (name);
+
+  pthread_attr_t nattr;
+  if (pthread_attr_init (&nattr)
+      || pthread_attr_setguardsize (&nattr, 0))
+    {
+      puts ("pthread_attr_t setup failed");
+      result = 1;
+    }
+
+  fct_guardsize = 1;
+
+  struct sigevent ev;
+  memset (&ev, 0xaa, sizeof (ev));
+  ev.sigev_notify = SIGEV_THREAD;
+  ev.sigev_notify_function = fct;
+  ev.sigev_notify_attributes = &nattr;
+  ev.sigev_value.sival_ptr = &q;
+  if (mq_notify (q, &ev) != 0)
+    {
+      printf ("mq_notify (q, { SIGEV_THREAD }) failed with: %m\n");
+      result = 1;
+    }
+
+  size_t ps = sysconf (_SC_PAGESIZE);
+  if (pthread_attr_setguardsize (&nattr, 32 * ps))
+    {
+      puts ("pthread_attr_t setup failed");
+      result = 1;
+    }
+
+  if (mq_notify (q, &ev) == 0)
+    {
+      puts ("second mq_notify (q, { SIGEV_NONE }) unexpectedly succeeded");
+      result = 1;
+    }
+  else if (errno != EBUSY)
+    {
+      printf ("second mq_notify (q, { SIGEV_NONE }) failed with: %m\n");
+      result = 1;
+    }
+
+  if (fct_cnt != 0)
+    {
+      printf ("fct called too early (%d on %d)\n", fct_cnt, __LINE__);
+      result = 1;
+    }
+
+  result |= mqsend (q);
+
+  result |= mqrecv (q);
+  result |= mqrecv (q);
+
+  if (fct_cnt != 1)
+    {
+      printf ("fct not called (%d on %d)\n", fct_cnt, __LINE__);
+      result = 1;
+    }
+  else if (fct_guardsize != 0)
+    {
+      printf ("fct_guardsize %zd != 0\n", fct_guardsize);
+      result = 1;
+    }
+
+  if (mq_notify (q, &ev) != 0)
+    {
+      printf ("third mq_notify (q, { SIGEV_NONE }) failed with: %m\n");
+      result = 1;
+    }
+
+  if (mq_notify (q, NULL) != 0)
+    {
+      printf ("mq_notify (q, NULL) failed with: %m\n");
+      result = 1;
+    }
+
+  memset (&ev, 0x11, sizeof (ev));
+  ev.sigev_notify = SIGEV_THREAD;
+  ev.sigev_notify_function = fct;
+  ev.sigev_notify_attributes = &nattr;
+  ev.sigev_value.sival_ptr = &q;
+  if (mq_notify (q, &ev) != 0)
+    {
+      printf ("mq_notify (q, { SIGEV_THREAD }) failed with: %m\n");
+      result = 1;
+    }
+
+  if (pthread_attr_setguardsize (&nattr, 0))
+    {
+      puts ("pthread_attr_t setup failed");
+      result = 1;
+    }
+
+  if (mq_notify (q, &ev) == 0)
+    {
+      puts ("second mq_notify (q, { SIGEV_NONE }) unexpectedly succeeded");
+      result = 1;
+    }
+  else if (errno != EBUSY)
+    {
+      printf ("second mq_notify (q, { SIGEV_NONE }) failed with: %m\n");
+      result = 1;
+    }
+
+  if (fct_cnt != 1)
+    {
+      printf ("fct called too early (%d on %d)\n", fct_cnt, __LINE__);
+      result = 1;
+    }
+
+  result |= mqsend (q);
+
+  result |= mqrecv (q);
+  result |= mqrecv (q);
+
+  if (fct_cnt != 2)
+    {
+      printf ("fct not called (%d on %d)\n", fct_cnt, __LINE__);
+      result = 1;
+    }
+  else if (fct_guardsize != 32 * ps)
+    {
+      printf ("fct_guardsize %zd != %zd\n", fct_guardsize, 32 * ps);
+      result = 1;
+    }
+
+  if (mq_notify (q, &ev) != 0)
+    {
+      printf ("third mq_notify (q, { SIGEV_NONE }) failed with: %m\n");
+      result = 1;
+    }
+
+  if (mq_notify (q, NULL) != 0)
+    {
+      printf ("mq_notify (q, NULL) failed with: %m\n");
+      result = 1;
+    }
+
+  if (pthread_attr_destroy (&nattr) != 0)
+    {
+      puts ("pthread_attr_destroy failed");
+      result = 1;
+    }
+
+  if (mq_unlink (name) != 0)
+    {
+      printf ("mq_unlink failed: %m\n");
+      result = 1;
+    }
+
+  if (mq_close (q) != 0)
+    {
+      printf ("mq_close failed: %m\n");
+      result = 1;
+    }
+
+  memset (&ev, 0x55, sizeof (ev));
+  ev.sigev_notify = SIGEV_THREAD;
+  ev.sigev_notify_function = fct;
+  ev.sigev_notify_attributes = NULL;
+  ev.sigev_value.sival_int = 0;
+  if (mq_notify (q, &ev) == 0)
+    {
+      puts ("mq_notify on closed mqd_t unexpectedly succeeded");
+      result = 1;
+    }
+  else if (errno != EBADF)
+    {
+      printf ("mq_notify on closed mqd_t did not fail with EBADF: %m\n");
+      result = 1;
+    }
+
+  if (fct_err)
+    result = 1;
+  return result;
+}
+#else
+# define TEST_FUNCTION 0
+#endif
+
+#include "../test-skeleton.c"
diff --git a/ap/build/uClibc/test/nptl/tst-mqueue7.c b/ap/build/uClibc/test/nptl/tst-mqueue7.c
new file mode 100644
index 0000000..34222f8
--- /dev/null
+++ b/ap/build/uClibc/test/nptl/tst-mqueue7.c
@@ -0,0 +1,109 @@
+/* Test all open message queues descriptors are closed during exec*.
+   Copyright (C) 2004 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+   Contributed by Jakub Jelinek <jakub@redhat.com>, 2004.
+
+   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 <errno.h>
+#include <fcntl.h>
+#include <mqueue.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <sys/wait.h>
+#include <time.h>
+#include <unistd.h>
+
+#define OPT_AFTEREXEC 20000
+
+static mqd_t after_exec = (mqd_t) -1;
+
+#define CMDLINE_OPTIONS \
+  { "after-exec", required_argument, NULL, OPT_AFTEREXEC },
+
+#define CMDLINE_PROCESS \
+  case OPT_AFTEREXEC:					\
+    after_exec = (mqd_t) strtoul (optarg, NULL, 0);	\
+    break;
+
+static int
+do_after_exec (void)
+{
+  int result = 0;
+
+  struct mq_attr attr;
+  if (mq_getattr (after_exec, &attr) == 0)
+    {
+      puts ("mq_getattr after exec unexpectedly succeeded");
+      result = 1;
+    }
+  else if (errno != EBADF)
+    {
+      printf ("mq_getattr after exec did not fail with EBADF: %m\n");
+      result = 1;
+    }
+
+  return result;
+}
+
+static int
+do_test (int argc, char **argv)
+{
+  if (after_exec != (mqd_t) -1)
+    return do_after_exec ();
+
+  char name[sizeof "/tst-mqueue7-" + sizeof (pid_t) * 3];
+  snprintf (name, sizeof (name), "/tst-mqueue7-%u", getpid ());
+
+  struct mq_attr attr = { .mq_maxmsg = 10, .mq_msgsize = 1 };
+  mqd_t q = mq_open (name, O_CREAT | O_EXCL | O_WRONLY, 0600, &attr);
+
+  if (q == (mqd_t) -1)
+    {
+      printf ("mq_open failed with: %m\n");
+      return 0;
+    }
+  else if (mq_unlink (name) != 0)
+    {
+      printf ("mq_unlink failed with: %m\n");
+      return 1;
+    }
+
+  if (mq_getattr (q, &attr) != 0)
+    {
+      printf ("mq_getattr failed: %m\n");
+      return 1;
+    }
+
+  char after_exec_arg[sizeof "--after-exec=0x" + sizeof (long) * 3];
+  snprintf (after_exec_arg, sizeof (after_exec_arg),
+	    "--after-exec=0x%lx", (long) q);
+
+  const char *newargv[argc + 2];
+  for (int i = 1; i < argc; ++i)
+    newargv[i - 1] = argv[i];
+  newargv[argc - 1] = "--direct";
+  newargv[argc] = after_exec_arg;
+  newargv[argc + 1] = NULL;
+
+  /* Verify that exec* has the effect of mq_close (q).  */
+  execv (newargv[0], (char * const *) newargv);
+  printf ("execv failed: %m\n");
+  return 1;
+}
+
+#include "../test-skeleton.c"
diff --git a/ap/build/uClibc/test/nptl/tst-mqueue8.c b/ap/build/uClibc/test/nptl/tst-mqueue8.c
new file mode 100644
index 0000000..7e902aa
--- /dev/null
+++ b/ap/build/uClibc/test/nptl/tst-mqueue8.c
@@ -0,0 +1,266 @@
+/* Copyright (C) 2004 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+   Contributed by Jakub Jelinek <jakub@redhat.com>, 2004.
+
+   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 <errno.h>
+#include <mqueue.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <unistd.h>
+#if _POSIX_THREADS
+# include <pthread.h>
+
+static pthread_barrier_t b;
+
+/* Cleanup handling test.  */
+static int cl_called;
+
+static void
+cl (void *arg)
+{
+  ++cl_called;
+}
+
+#define TF_MQ_RECEIVE		0L
+#define TF_MQ_TIMEDRECEIVE	1L
+#define TF_MQ_SEND		2L
+#define TF_MQ_TIMEDSEND		3L
+
+static const char *names[]
+  = { "mq_receive", "mq_timedreceive", "mq_send", "mq_timedsend" };
+
+static mqd_t q;
+static struct timespec never;
+
+static void *
+tf (void *arg)
+{
+  int r = pthread_barrier_wait (&b);
+  if (r != 0 && r != PTHREAD_BARRIER_SERIAL_THREAD)
+    {
+      puts ("tf: barrier_wait failed");
+      exit (1);
+    }
+
+  pthread_cleanup_push (cl, NULL);
+
+  char c = ' ';
+
+  switch ((long) arg)
+    {
+    case TF_MQ_SEND:
+      TEMP_FAILURE_RETRY (mq_send (q, &c, 1, 1));
+      break;
+    case TF_MQ_TIMEDSEND:
+      TEMP_FAILURE_RETRY (mq_timedsend (q, &c, 1, 1, &never));
+      break;
+    case TF_MQ_RECEIVE:
+      TEMP_FAILURE_RETRY (mq_receive (q, &c, 1, NULL));
+      break;
+    case TF_MQ_TIMEDRECEIVE:
+      TEMP_FAILURE_RETRY (mq_timedreceive (q, &c, 1, NULL, &never));
+      break;
+    }
+
+  pthread_cleanup_pop (0);
+
+  printf ("tf: %s returned\n", names[(long) arg]);
+
+  exit (1);
+}
+
+#define TEST_FUNCTION do_test ()
+static int
+do_test (void)
+{
+  char name[sizeof "/tst-mqueue8-" + sizeof (pid_t) * 3];
+  snprintf (name, sizeof (name), "/tst-mqueue8-%u", getpid ());
+
+  struct mq_attr attr = { .mq_maxmsg = 1, .mq_msgsize = 1 };
+  q = mq_open (name, O_CREAT | O_EXCL | O_RDWR, 0600, &attr);
+
+  if (q == (mqd_t) -1)
+    {
+      printf ("mq_open failed with: %m\n");
+      return 0;
+    }
+
+  if (mq_unlink (name) != 0)
+    {
+      printf ("mq_unlink failed with: %m\n");
+      return 1;
+    }
+
+  if (pthread_barrier_init (&b, NULL, 2) != 0)
+    {
+      puts ("barrier_init failed");
+      return 1;
+    }
+
+  if (clock_gettime (CLOCK_REALTIME, &never) == 0)
+    never.tv_sec += 100;
+  else
+    {
+      never.tv_sec = time (NULL) + 100;
+      never.tv_nsec = 0;
+    }
+
+  int result = 0;
+  for (long l = TF_MQ_RECEIVE; l <= TF_MQ_TIMEDSEND; ++l)
+    {
+      cl_called = 0;
+
+      pthread_t th;
+      if (pthread_create (&th, NULL, tf, (void *) l) != 0)
+	{
+	  printf ("1st %s create failed\n", names[l]);
+	  result = 1;
+	  continue;
+	}
+
+      int r = pthread_barrier_wait (&b);
+      if (r != 0 && r != PTHREAD_BARRIER_SERIAL_THREAD)
+	{
+	  puts ("barrier_wait failed");
+	  result = 1;
+	  continue;
+	}
+
+      struct timespec ts = { .tv_sec = 0, .tv_nsec = 100000000 };
+      while (nanosleep (&ts, &ts) != 0)
+	continue;
+
+      printf ("going to cancel %s in-time\n", names[l]);
+      if (pthread_cancel (th) != 0)
+	{
+	  printf ("1st cancel of %s failed\n", names[l]);
+	  result = 1;
+	  continue;
+	}
+
+      void *status;
+      if (pthread_join (th, &status) != 0)
+	{
+	  printf ("1st join of %s failed\n", names[l]);
+	  result = 1;
+	  continue;
+	}
+      if (status != PTHREAD_CANCELED)
+	{
+	  printf ("1st %s thread not canceled\n", names[l]);
+	  result = 1;
+	  continue;
+	}
+
+      if (cl_called == 0)
+	{
+	  printf ("%s cleanup handler not called\n", names[l]);
+	  result = 1;
+	  continue;
+	}
+      if (cl_called > 1)
+	{
+	  printf ("%s cleanup handler called more than once\n", names[l]);
+	  result = 1;
+	  continue;
+	}
+
+      printf ("in-time %s cancellation succeeded\n", names[l]);
+
+      cl_called = 0;
+
+      if (pthread_create (&th, NULL, tf, (void *) l) != 0)
+	{
+	  printf ("2nd %s create failed\n", names[l]);
+	  result = 1;
+	  continue;
+	}
+
+      printf ("going to cancel %s early\n", names[l]);
+      if (pthread_cancel (th) != 0)
+	{
+	  printf ("2nd cancel of %s failed\n", names[l]);
+	  result = 1;
+	  continue;
+	}
+
+      r = pthread_barrier_wait (&b);
+      if (r != 0 && r != PTHREAD_BARRIER_SERIAL_THREAD)
+	{
+	  puts ("barrier_wait failed");
+	  result = 1;
+	  continue;
+	}
+
+      if (pthread_join (th, &status) != 0)
+	{
+	  printf ("2nd join of %s failed\n", names[l]);
+	  result = 1;
+	  continue;
+	}
+      if (status != PTHREAD_CANCELED)
+	{
+	  printf ("2nd %s thread not canceled\n", names[l]);
+	  result = 1;
+	  continue;
+	}
+
+      if (cl_called == 0)
+	{
+	  printf ("%s cleanup handler not called\n", names[l]);
+	  result = 1;
+	  continue;
+	}
+      if (cl_called > 1)
+	{
+	  printf ("%s cleanup handler called more than once\n", names[l]);
+	  result = 1;
+	  continue;
+	}
+
+      printf ("early %s cancellation succeeded\n", names[l]);
+
+      if (l == TF_MQ_TIMEDRECEIVE)
+	{
+	  /* mq_receive and mq_timedreceive are tested on empty mq.
+	     For mq_send and mq_timedsend we need to make it full.
+	     If this fails, there is no point in doing further testing.  */
+	  char c = ' ';
+	  if (mq_send (q, &c, 1, 1) != 0)
+	    {
+	      printf ("mq_send failed: %m\n");
+	      result = 1;
+	      break;
+	    }
+	}
+    }
+
+  if (mq_close (q) != 0)
+    {
+      printf ("mq_close failed: %m\n");
+      result = 1;
+    }
+
+  return result;
+}
+#else
+# define TEST_FUNCTION 0
+#endif
+
+#include "../test-skeleton.c"
diff --git a/ap/build/uClibc/test/nptl/tst-mqueue9.c b/ap/build/uClibc/test/nptl/tst-mqueue9.c
new file mode 100644
index 0000000..fb057d4
--- /dev/null
+++ b/ap/build/uClibc/test/nptl/tst-mqueue9.c
@@ -0,0 +1,92 @@
+/* Copyright (C) 2004 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+   Contributed by Jakub Jelinek <jakub@redhat.com>, 2004.
+
+   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 <errno.h>
+#include <mqueue.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <unistd.h>
+#include "tst-mqueue.h"
+
+#define TEST_FUNCTION do_test ()
+static int
+do_test (void)
+{
+  if (geteuid () != 0)
+    {
+      puts ("this test requires root");
+      return 0;
+    }
+
+  char name[sizeof "/tst-mqueue9-" + sizeof (pid_t) * 3];
+  snprintf (name, sizeof (name), "/tst-mqueue9-%u", getpid ());
+
+  struct mq_attr attr = { .mq_maxmsg = 1, .mq_msgsize = 1 };
+  mqd_t q = mq_open (name, O_CREAT | O_EXCL | O_RDWR, 0600, &attr);
+
+  if (q == (mqd_t) -1)
+    {
+      printf ("mq_open failed with: %m\n");
+      return 0;
+    }
+  else
+    add_temp_mq (name);
+
+  if (seteuid (1) != 0)
+    {
+      printf ("failed to seteuid (1): %m\n");
+      mq_unlink (name);
+      return 0;
+    }
+
+  int result = 0;
+  if (mq_unlink (name) == 0)
+    {
+      puts ("mq_unlink unexpectedly succeeded");
+      result = 1;
+    }
+  else if (errno != EACCES)
+    {
+      printf ("mq_unlink did not fail with EACCES: %m\n");
+      result = 1;;
+    }
+
+  if (seteuid (0) != 0)
+    {
+      printf ("failed to seteuid (0): %m\n");
+      result = 1;
+    }
+
+  if (mq_unlink (name) != 0)
+    {
+      printf ("mq_unlink failed with: %m\n");
+      result = 1;
+    }
+
+  if (mq_close (q) != 0)
+    {
+      printf ("mq_close failed with: %m\n");
+      result = 1;
+    }
+
+  return result;
+}
+
+#include "../test-skeleton.c"
diff --git a/ap/build/uClibc/test/nptl/tst-mutex1.c b/ap/build/uClibc/test/nptl/tst-mutex1.c
new file mode 100644
index 0000000..50b5cca
--- /dev/null
+++ b/ap/build/uClibc/test/nptl/tst-mutex1.c
@@ -0,0 +1,57 @@
+/* Copyright (C) 2002 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+   Contributed by Ulrich Drepper <drepper@redhat.com>, 2002.
+
+   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>
+#include <stdio.h>
+
+
+static int
+do_test (void)
+{
+  pthread_mutex_t m;
+
+  if (pthread_mutex_init (&m, NULL) != 0)
+    {
+      puts ("mutex_init failed");
+      return 1;
+    }
+
+  if (pthread_mutex_lock (&m) != 0)
+    {
+      puts ("mutex_lock failed");
+      return 1;
+    }
+
+  if (pthread_mutex_unlock (&m) != 0)
+    {
+      puts ("mutex_unlock failed");
+      return 1;
+    }
+
+  if (pthread_mutex_destroy (&m) != 0)
+    {
+      puts ("mutex_destroy failed");
+      return 1;
+    }
+
+  return 0;
+}
+
+#define TEST_FUNCTION do_test ()
+#include "../test-skeleton.c"
diff --git a/ap/build/uClibc/test/nptl/tst-mutex2.c b/ap/build/uClibc/test/nptl/tst-mutex2.c
new file mode 100644
index 0000000..f589a1e
--- /dev/null
+++ b/ap/build/uClibc/test/nptl/tst-mutex2.c
@@ -0,0 +1,223 @@
+/* Copyright (C) 2002, 2003 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+   Contributed by Ulrich Drepper <drepper@redhat.com>, 2002.
+
+   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 <errno.h>
+#include <pthread.h>
+#include <stdio.h>
+#include <stdlib.h>
+
+
+static pthread_mutex_t m;
+static pthread_barrier_t b;
+
+
+static void *
+tf (void *arg)
+{
+  int e = pthread_mutex_unlock (&m);
+  if (e == 0)
+    {
+      puts ("child: 1st mutex_unlock succeeded");
+      exit (1);
+    }
+  else if (e != EPERM)
+    {
+      puts ("child: 1st mutex_unlock error != EPERM");
+      exit (1);
+    }
+
+  e = pthread_mutex_trylock (&m);
+  if (e == 0)
+    {
+      puts ("child: 1st trylock suceeded");
+      exit (1);
+    }
+  if (e != EBUSY)
+    {
+      puts ("child: 1st trylock didn't return EBUSY");
+      exit (1);
+    }
+
+  e = pthread_barrier_wait (&b);
+  if (e != 0 && e != PTHREAD_BARRIER_SERIAL_THREAD)
+    {
+      puts ("child: 1st barrier_wait failed");
+      exit (1);
+    }
+
+  e = pthread_barrier_wait (&b);
+  if (e != 0 && e != PTHREAD_BARRIER_SERIAL_THREAD)
+    {
+      puts ("child: 2nd barrier_wait failed");
+      exit (1);
+    }
+
+  e = pthread_mutex_unlock (&m);
+  if (e == 0)
+    {
+      puts ("child: 2nd mutex_unlock succeeded");
+      exit (1);
+    }
+  else if (e != EPERM)
+    {
+      puts ("child: 2nd mutex_unlock error != EPERM");
+      exit (1);
+    }
+
+  if (pthread_mutex_trylock (&m) != 0)
+    {
+      puts ("child: 2nd trylock failed");
+      exit (1);
+    }
+
+  if (pthread_mutex_unlock (&m) != 0)
+    {
+      puts ("child: 3rd mutex_unlock failed");
+      exit (1);
+    }
+
+  return NULL;
+}
+
+
+static int
+do_test (void)
+{
+  pthread_mutexattr_t a;
+  int e;
+
+  if (pthread_mutexattr_init (&a) != 0)
+    {
+      puts ("mutexattr_init failed");
+      exit (1);
+    }
+
+  if (pthread_mutexattr_settype (&a, PTHREAD_MUTEX_ERRORCHECK) != 0)
+    {
+      puts ("mutexattr_settype failed");
+      exit (1);
+    }
+
+  if (pthread_mutex_init (&m, &a) != 0)
+    {
+      puts ("mutex_init failed");
+      exit (1);
+    }
+
+  if (pthread_barrier_init (&b, NULL, 2) != 0)
+    {
+      puts ("barrier_init failed");
+      exit (1);
+    }
+
+  if ((e = pthread_mutex_unlock (&m)) == 0)
+    {
+      puts ("1st mutex_unlock succeeded");
+      exit (1);
+    }
+  else if (e != EPERM)
+    {
+      puts ("1st mutex_unlock error != EPERM");
+      exit (1);
+    }
+
+  if (pthread_mutex_lock (&m) != 0)
+    {
+      puts ("mutex_lock failed");
+      exit (1);
+    }
+
+  if ((e = pthread_mutex_lock (&m)) == 0)
+    {
+      puts ("2nd mutex_lock succeeded");
+      exit (1);
+    }
+  else if (e != EDEADLK)
+    {
+      puts ("2nd mutex_lock error != EDEADLK");
+      exit (1);
+    }
+
+  pthread_t th;
+  if (pthread_create (&th, NULL, tf, NULL) != 0)
+    {
+      puts ("create failed");
+      exit (1);
+    }
+
+  e = pthread_barrier_wait (&b);
+  if (e != 0 && e != PTHREAD_BARRIER_SERIAL_THREAD)
+    {
+      puts ("1st barrier_wait failed");
+      exit (1);
+    }
+
+  if (pthread_mutex_unlock (&m) != 0)
+    {
+      puts ("2nd mutex_unlock failed");
+      exit (1);
+    }
+
+  if ((e = pthread_mutex_unlock (&m)) == 0)
+    {
+      puts ("3rd mutex_unlock succeeded");
+      exit (1);
+    }
+  else if (e != EPERM)
+    {
+      puts ("3rd mutex_unlock error != EPERM");
+      exit (1);
+    }
+
+  e = pthread_barrier_wait (&b);
+  if (e != 0 && e != PTHREAD_BARRIER_SERIAL_THREAD)
+    {
+      puts ("2nd barrier_wait failed");
+      exit (1);
+    }
+
+  if (pthread_join (th, NULL) != 0)
+    {
+      puts ("join failed");
+      exit (1);
+    }
+
+  if (pthread_mutex_destroy (&m) != 0)
+    {
+      puts ("mutex_destroy failed");
+      exit (1);
+    }
+
+  if (pthread_barrier_destroy (&b) != 0)
+    {
+      puts ("barrier_destroy failed");
+      exit (1);
+    }
+
+  if (pthread_mutexattr_destroy (&a) != 0)
+    {
+      puts ("mutexattr_destroy failed");
+      exit (1);
+    }
+
+  return 0;
+}
+
+#define TEST_FUNCTION do_test ()
+#include "../test-skeleton.c"
diff --git a/ap/build/uClibc/test/nptl/tst-mutex3.c b/ap/build/uClibc/test/nptl/tst-mutex3.c
new file mode 100644
index 0000000..8e57924
--- /dev/null
+++ b/ap/build/uClibc/test/nptl/tst-mutex3.c
@@ -0,0 +1,225 @@
+/* Copyright (C) 2002, 2003 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+   Contributed by Ulrich Drepper <drepper@redhat.com>, 2002.
+
+   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 <errno.h>
+#include <pthread.h>
+#include <stdio.h>
+#include <stdlib.h>
+
+
+static pthread_mutex_t m;
+static pthread_barrier_t b;
+
+
+static void *
+tf (void *arg)
+{
+  int e = pthread_mutex_unlock (&m);
+  if (e == 0)
+    {
+      puts ("1st mutex_unlock in child succeeded");
+      exit (1);
+    }
+  if (e != EPERM)
+    {
+      puts ("1st mutex_unlock in child didn't return EPERM");
+      exit (1);
+    }
+
+  e = pthread_mutex_trylock (&m);
+  if (e == 0)
+    {
+      puts ("mutex_trylock in second thread succeeded");
+      exit (1);
+    }
+  if (e != EBUSY)
+    {
+      puts ("mutex_trylock returned wrong value");
+      exit (1);
+    }
+
+  e = pthread_barrier_wait (&b);
+  if (e != 0 && e != PTHREAD_BARRIER_SERIAL_THREAD)
+    {
+      puts ("barrier_wait failed");
+      exit (1);
+    }
+
+  e = pthread_barrier_wait (&b);
+  if (e != 0 && e != PTHREAD_BARRIER_SERIAL_THREAD)
+    {
+      puts ("barrier_wait failed");
+      exit (1);
+    }
+
+  e = pthread_mutex_unlock (&m);
+  if (e == 0)
+    {
+      puts ("2nd mutex_unlock in child succeeded");
+      exit (1);
+    }
+  if (e != EPERM)
+    {
+      puts ("2nd mutex_unlock in child didn't return EPERM");
+      exit (1);
+    }
+
+  if (pthread_mutex_trylock (&m) != 0)
+    {
+      puts ("2nd mutex_trylock in second thread failed");
+      exit (1);
+    }
+
+  if (pthread_mutex_unlock (&m) != 0)
+    {
+      puts ("3rd mutex_unlock in second thread failed");
+      exit (1);
+    }
+
+  return NULL;
+}
+
+
+static int
+do_test (void)
+{
+  pthread_mutexattr_t a;
+
+  if (pthread_mutexattr_init (&a) != 0)
+    {
+      puts ("mutexattr_init failed");
+      return 1;
+    }
+
+  if (pthread_mutexattr_settype (&a, PTHREAD_MUTEX_RECURSIVE) != 0)
+    {
+      puts ("mutexattr_settype failed");
+      return 1;
+    }
+
+  if (pthread_mutex_init (&m, &a) != 0)
+    {
+      puts ("mutex_init failed");
+      return 1;
+    }
+
+  if (pthread_barrier_init (&b, NULL, 2) != 0)
+    {
+      puts ("barrier_init failed");
+      return 1;
+    }
+
+  if (pthread_mutex_lock (&m) != 0)
+    {
+      puts ("mutex_lock failed");
+      return 1;
+    }
+
+  if (pthread_mutex_lock (&m) != 0)
+    {
+      puts ("2nd mutex_lock failed");
+      return 1;
+    }
+
+  if (pthread_mutex_trylock (&m) != 0)
+    {
+      puts ("1st trylock failed");
+      return 1;
+    }
+
+  if (pthread_mutex_unlock (&m) != 0)
+    {
+      puts ("mutex_unlock failed");
+      return 1;
+    }
+
+  if (pthread_mutex_unlock (&m) != 0)
+    {
+      puts ("2nd mutex_unlock failed");
+      return 1;
+    }
+
+  pthread_t th;
+  if (pthread_create (&th, NULL, tf, NULL) != 0)
+    {
+      puts ("create failed");
+      return 1;
+    }
+
+  int e = pthread_barrier_wait (&b);
+  if (e != 0 && e != PTHREAD_BARRIER_SERIAL_THREAD)
+    {
+      puts ("barrier_wait failed");
+      return 1;
+    }
+
+  if (pthread_mutex_unlock (&m) != 0)
+    {
+      puts ("3rd mutex_unlock failed");
+      return 1;
+    }
+
+  e = pthread_mutex_unlock (&m);
+  if (e == 0)
+    {
+      puts ("4th mutex_unlock succeeded");
+      return 1;
+    }
+  if (e != EPERM)
+    {
+      puts ("4th mutex_unlock didn't return EPERM");
+      return 1;
+    }
+
+  e = pthread_barrier_wait (&b);
+  if (e != 0 && e != PTHREAD_BARRIER_SERIAL_THREAD)
+    {
+      puts ("barrier_wait failed");
+      return 1;
+    }
+
+  if (pthread_join (th, NULL) != 0)
+    {
+      puts ("join failed");
+      return 1;
+    }
+
+  if (pthread_barrier_destroy (&b) != 0)
+    {
+      puts ("barrier_destroy failed");
+      return 1;
+    }
+
+  if (pthread_mutex_destroy (&m) != 0)
+    {
+      puts ("mutex_destroy failed");
+      return 1;
+    }
+
+  if (pthread_mutexattr_destroy (&a) != 0)
+    {
+      puts ("mutexattr_destroy failed");
+      return 1;
+    }
+
+  return 0;
+}
+
+#define TEST_FUNCTION do_test ()
+#include "../test-skeleton.c"
diff --git a/ap/build/uClibc/test/nptl/tst-mutex4.c b/ap/build/uClibc/test/nptl/tst-mutex4.c
new file mode 100644
index 0000000..0ce7313
--- /dev/null
+++ b/ap/build/uClibc/test/nptl/tst-mutex4.c
@@ -0,0 +1,191 @@
+/* Copyright (C) 2002, 2003, 2004 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+   Contributed by Ulrich Drepper <drepper@redhat.com>, 2002.
+
+   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 <errno.h>
+#include <pthread.h>
+#include <stdint.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <unistd.h>
+#include <sys/mman.h>
+#include <sys/wait.h>
+
+
+static int
+do_test (void)
+{
+  size_t ps = sysconf (_SC_PAGESIZE);
+  char tmpfname[] = "/tmp/tst-mutex4.XXXXXX";
+  char data[ps];
+  void *mem;
+  int fd;
+  pthread_mutex_t *m;
+  pthread_mutexattr_t a;
+  pid_t pid;
+  char *p;
+  int err;
+  int s;
+
+  fd = mkstemp (tmpfname);
+  if (fd == -1)
+    {
+      printf ("cannot open temporary file: %m\n");
+      return 1;
+    }
+
+  /* Make sure it is always removed.  */
+  unlink (tmpfname);
+
+  /* Create one page of data.  */
+  memset (data, '\0', ps);
+
+  /* Write the data to the file.  */
+  if (write (fd, data, ps) != (ssize_t) ps)
+    {
+      puts ("short write");
+      return 1;
+    }
+
+  mem = mmap (NULL, ps, PROT_READ | PROT_WRITE, MAP_SHARED, fd, 0);
+  if (mem == MAP_FAILED)
+    {
+      printf ("mmap failed: %m\n");
+      return 1;
+    }
+
+  m = (pthread_mutex_t *) (((uintptr_t) mem + __alignof (pthread_mutex_t))
+			   & ~(__alignof (pthread_mutex_t) - 1));
+  p = (char *) (m + 1);
+
+  if (pthread_mutexattr_init (&a) != 0)
+    {
+      puts ("mutexattr_init failed");
+      return 1;
+    }
+
+  if (pthread_mutexattr_getpshared (&a, &s) != 0)
+    {
+      puts ("1st mutexattr_getpshared failed");
+      return 1;
+    }
+
+  if (s != PTHREAD_PROCESS_PRIVATE)
+    {
+      puts ("default pshared value wrong");
+      return 1;
+    }
+
+  if (pthread_mutexattr_setpshared (&a, PTHREAD_PROCESS_SHARED) != 0)
+    {
+      puts ("mutexattr_setpshared failed");
+      return 1;
+    }
+
+  if (pthread_mutexattr_getpshared (&a, &s) != 0)
+    {
+      puts ("2nd mutexattr_getpshared failed");
+      return 1;
+    }
+
+  if (s != PTHREAD_PROCESS_SHARED)
+    {
+      puts ("pshared value after setpshared call wrong");
+      return 1;
+    }
+
+  if (pthread_mutex_init (m, &a) != 0)
+    {
+      puts ("mutex_init failed");
+      return 1;
+    }
+
+  if (pthread_mutex_lock (m) != 0)
+    {
+      puts ("mutex_lock failed");
+      return 1;
+    }
+
+  if (pthread_mutexattr_destroy (&a) != 0)
+    {
+      puts ("mutexattr_destroy failed");
+      return 1;
+    }
+
+  err = pthread_mutex_trylock (m);
+  if (err == 0)
+    {
+      puts ("mutex_trylock succeeded");
+      return 1;
+    }
+  else if (err != EBUSY)
+    {
+      puts ("mutex_trylock didn't return EBUSY");
+      return 1;
+    }
+
+  *p = 0;
+
+  puts ("going to fork now");
+  pid = fork ();
+  if (pid == -1)
+    {
+      puts ("fork failed");
+      return 1;
+    }
+  else if (pid == 0)
+    {
+      /* Play some lock ping-pong.  It's our turn to unlock first.  */
+      if ((*p)++ != 0)
+	{
+	  puts ("child: *p != 0");
+	  return 1;
+	}
+
+      if (pthread_mutex_unlock (m) != 0)
+	{
+	  puts ("child: 1st mutex_unlock failed");
+	  return 1;
+	}
+
+      puts ("child done");
+    }
+  else
+    {
+      if (pthread_mutex_lock (m) != 0)
+	{
+	  puts ("parent: 2nd mutex_lock failed");
+	  return 1;
+	}
+
+      if (*p != 1)
+	{
+	  puts ("*p != 1");
+	  return 1;
+	}
+
+      puts ("parent done");
+    }
+
+  return 0;
+}
+
+#define TIMEOUT 4
+#define TEST_FUNCTION do_test ()
+#include "../test-skeleton.c"
diff --git a/ap/build/uClibc/test/nptl/tst-mutex5.c b/ap/build/uClibc/test/nptl/tst-mutex5.c
new file mode 100644
index 0000000..eb35b78
--- /dev/null
+++ b/ap/build/uClibc/test/nptl/tst-mutex5.c
@@ -0,0 +1,186 @@
+/* Copyright (C) 2002, 2003, 2004 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+   Contributed by Ulrich Drepper <drepper@redhat.com>, 2002.
+
+   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 <errno.h>
+#include <pthread.h>
+#include <stdio.h>
+#include <time.h>
+#include <unistd.h>
+#include <sys/time.h>
+
+
+#ifndef TYPE
+# define TYPE PTHREAD_MUTEX_NORMAL
+#endif
+
+
+static int
+do_test (void)
+{
+  pthread_mutex_t m;
+  struct timespec ts;
+  struct timeval tv;
+  struct timeval tv2;
+  int err;
+  pthread_mutexattr_t a;
+
+  if (pthread_mutexattr_init (&a) != 0)
+    {
+      puts ("mutexattr_init failed");
+      return 1;
+    }
+
+  if (pthread_mutexattr_settype (&a, TYPE) != 0)
+    {
+      puts ("mutexattr_settype failed");
+      return 1;
+    }
+
+  if (pthread_mutex_init (&m, &a) != 0)
+    {
+      puts ("mutex_init failed");
+      return 1;
+    }
+
+  if (pthread_mutexattr_destroy (&a) != 0)
+    {
+      puts ("mutexattr_destroy failed");
+      return 1;
+    }
+
+  if (pthread_mutex_lock (&m) != 0)
+    {
+      puts ("mutex_lock failed");
+      return 1;
+    }
+
+  if (pthread_mutex_trylock (&m) == 0)
+    {
+      puts ("mutex_trylock succeeded");
+      return 1;
+    }
+
+  gettimeofday (&tv, NULL);
+  TIMEVAL_TO_TIMESPEC (&tv, &ts);
+
+  ts.tv_sec += 2;	/* Wait 2 seconds.  */
+
+  err = pthread_mutex_timedlock (&m, &ts);
+  if (err == 0)
+    {
+      puts ("timedlock succeeded");
+      return 1;
+    }
+  else if (err != ETIMEDOUT)
+    {
+      printf ("timedlock error != ETIMEDOUT: %d\n", err);
+      return 1;
+    }
+  else
+    {
+      int clk_tck = sysconf (_SC_CLK_TCK);
+
+      gettimeofday (&tv2, NULL);
+
+      tv2.tv_sec -= tv.tv_sec;
+      tv2.tv_usec -= tv.tv_usec;
+      if (tv2.tv_usec < 0)
+	{
+	  tv2.tv_usec += 1000000;
+	  tv2.tv_sec -= 1;
+	}
+
+      /* Be a bit tolerant, add one CLK_TCK.  */
+      tv2.tv_usec += 1000000 / clk_tck;
+      if (tv2.tv_usec >= 1000000)
+	{
+	  tv2.tv_usec -= 1000000;
+	  ++tv2.tv_sec;
+	}
+
+      if (tv2.tv_sec < 2)
+	{
+	  printf ("premature timeout: %ld.%06ld difference\n",
+		  tv2.tv_sec, tv2.tv_usec);
+	  return 1;
+	}
+    }
+
+  (void) gettimeofday (&tv, NULL);
+  TIMEVAL_TO_TIMESPEC (&tv, &ts);
+
+  ts.tv_sec += 2;	/* Wait 2 seconds.  */
+  /* The following makes the ts value invalid.  */
+  ts.tv_nsec += 1000000000;
+
+  err = pthread_mutex_timedlock (&m, &ts);
+  if (err == 0)
+    {
+      puts ("2nd timedlock succeeded");
+      return 1;
+    }
+  else if (err != EINVAL)
+    {
+      printf ("2nd timedlock error != EINVAL: %d\n", err);
+      return 1;
+    }
+
+  if (pthread_mutex_unlock (&m) != 0)
+    {
+      puts ("mutex_unlock failed");
+      return 1;
+    }
+
+  (void) gettimeofday (&tv, NULL);
+  TIMEVAL_TO_TIMESPEC (&tv, &ts);
+
+  ts.tv_sec += 2;	/* Wait 2 seconds.  */
+  if (pthread_mutex_timedlock (&m, &ts) != 0)
+    {
+      puts ("3rd timedlock failed");
+    }
+
+  (void) gettimeofday (&tv2, NULL);
+
+  /* Check that timedlock didn't delay.  We use a limit of 0.1 secs.  */
+  timersub (&tv2, &tv, &tv2);
+  if (tv2.tv_sec > 0 || tv2.tv_usec > 100000)
+    {
+      puts ("3rd timedlock didn't return right away");
+      return 1;
+    }
+
+  if (pthread_mutex_unlock (&m) != 0)
+    {
+      puts ("final mutex_unlock failed");
+      return 1;
+    }
+
+  if (pthread_mutex_destroy (&m) != 0)
+    {
+      puts ("mutex_destroy failed");
+      return 1;
+    }
+
+  return 0;
+}
+
+#define TIMEOUT 4
+#define TEST_FUNCTION do_test ()
+#include "../test-skeleton.c"
diff --git a/ap/build/uClibc/test/nptl/tst-mutex5a.c b/ap/build/uClibc/test/nptl/tst-mutex5a.c
new file mode 100644
index 0000000..f91eec0
--- /dev/null
+++ b/ap/build/uClibc/test/nptl/tst-mutex5a.c
@@ -0,0 +1,2 @@
+#define TYPE PTHREAD_MUTEX_ADAPTIVE_NP
+#include "tst-mutex5.c"
diff --git a/ap/build/uClibc/test/nptl/tst-mutex6.c b/ap/build/uClibc/test/nptl/tst-mutex6.c
new file mode 100644
index 0000000..f066c62
--- /dev/null
+++ b/ap/build/uClibc/test/nptl/tst-mutex6.c
@@ -0,0 +1,55 @@
+/* Copyright (C) 2002 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+   Contributed by Ulrich Drepper <drepper@redhat.com>, 2002.
+
+   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>
+#include <signal.h>
+#include <stdio.h>
+#include <unistd.h>
+
+
+static int
+do_test (void)
+{
+  pthread_mutex_t m;
+
+  if (pthread_mutex_init (&m, NULL) != 0)
+    {
+      puts ("mutex_init failed");
+      return 1;
+    }
+
+  if (pthread_mutex_lock (&m) != 0)
+    {
+      puts ("1st mutex_lock failed");
+      return 1;
+    }
+
+  /* Set an alarm for 1 second.  The wrapper will expect this.  */
+  alarm (1);
+
+  /* This call should never return.  */
+  pthread_mutex_lock (&m);
+
+  puts ("2nd mutex_lock returned");
+  return 1;
+}
+
+#define EXPECTED_SIGNAL SIGALRM
+#define TEST_FUNCTION do_test ()
+#include "../test-skeleton.c"
diff --git a/ap/build/uClibc/test/nptl/tst-mutex7.c b/ap/build/uClibc/test/nptl/tst-mutex7.c
new file mode 100644
index 0000000..a9b9f31
--- /dev/null
+++ b/ap/build/uClibc/test/nptl/tst-mutex7.c
@@ -0,0 +1,121 @@
+/* Copyright (C) 2002, 2004 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+   Contributed by Ulrich Drepper <drepper@redhat.com>, 2002.
+
+   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>
+#include <stdio.h>
+#include <time.h>
+
+
+#ifndef INIT
+# define INIT PTHREAD_MUTEX_INITIALIZER
+#endif
+
+
+static pthread_mutex_t lock = INIT;
+
+
+#define ROUNDS 1000
+#define N 100
+
+
+static void *
+tf (void *arg)
+{
+  int nr = (long int) arg;
+  int cnt;
+  struct timespec ts = { .tv_sec = 0, .tv_nsec = 11000 };
+
+  for (cnt = 0; cnt < ROUNDS; ++cnt)
+    {
+      if (pthread_mutex_lock (&lock) != 0)
+	{
+	  printf ("thread %d: failed to get the lock\n", nr);
+	  return (void *) 1l;
+	}
+
+      if (pthread_mutex_unlock (&lock) != 0)
+	{
+	  printf ("thread %d: failed to release the lock\n", nr);
+	  return (void *) 1l;
+	}
+
+      nanosleep (&ts, NULL);
+    }
+
+  return NULL;
+}
+
+
+static int
+do_test (void)
+{
+  pthread_attr_t at;
+  pthread_t th[N];
+  int cnt;
+
+  if (pthread_attr_init (&at) != 0)
+    {
+      puts ("attr_init failed");
+      return 1;
+    }
+
+  if (pthread_attr_setstacksize (&at, 1 * 1024 * 1024) != 0)
+    {
+      puts ("attr_setstacksize failed");
+      return 1;
+    }
+
+  if (pthread_mutex_lock (&lock) != 0)
+    {
+      puts ("locking in parent failed");
+      return 1;
+    }
+
+  for (cnt = 0; cnt < N; ++cnt)
+    if (pthread_create (&th[cnt], &at, tf, (void *) (long int) cnt) != 0)
+      {
+	printf ("creating thread %d failed\n", cnt);
+	return 1;
+      }
+
+  if (pthread_attr_destroy (&at) != 0)
+    {
+      puts ("attr_destroy failed");
+      return 1;
+    }
+
+  if (pthread_mutex_unlock (&lock) != 0)
+    {
+      puts ("unlocking in parent failed");
+      return 1;
+    }
+
+  for (cnt = 0; cnt < N; ++cnt)
+    if (pthread_join (th[cnt], NULL) != 0)
+      {
+	printf ("joining thread %d failed\n", cnt);
+	return 1;
+      }
+
+  return 0;
+}
+
+#define TIMEOUT 60
+#define TEST_FUNCTION do_test ()
+#include "../test-skeleton.c"
diff --git a/ap/build/uClibc/test/nptl/tst-mutex7a.c b/ap/build/uClibc/test/nptl/tst-mutex7a.c
new file mode 100644
index 0000000..f08799a
--- /dev/null
+++ b/ap/build/uClibc/test/nptl/tst-mutex7a.c
@@ -0,0 +1,2 @@
+#define INIT PTHREAD_ADAPTIVE_MUTEX_INITIALIZER_NP
+#include "tst-mutex7.c"
diff --git a/ap/build/uClibc/test/nptl/tst-mutex8.c b/ap/build/uClibc/test/nptl/tst-mutex8.c
new file mode 100644
index 0000000..80ebe71
--- /dev/null
+++ b/ap/build/uClibc/test/nptl/tst-mutex8.c
@@ -0,0 +1,367 @@
+/* Copyright (C) 2003 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, write to the Free
+   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+   02111-1307 USA.  */
+
+/* This test checks behavior not required by POSIX.  */
+#include <errno.h>
+#include <pthread.h>
+#include <stdbool.h>
+#include <stdio.h>
+#include <stdlib.h>
+
+
+static pthread_mutex_t *m;
+static pthread_barrier_t b;
+static pthread_cond_t c;
+static bool done;
+
+
+static void
+cl (void *arg)
+{
+  if (pthread_mutex_unlock (m) != 0)
+    {
+      puts ("cl: mutex_unlocked failed");
+      exit (1);
+    }
+}
+
+
+static void *
+tf (void *arg)
+{
+  if (pthread_mutex_lock (m) != 0)
+    {
+      puts ("tf: mutex_lock failed");
+      return (void *) 1l;
+    }
+
+  int e = pthread_barrier_wait (&b);
+  if (e != 0 && e != PTHREAD_BARRIER_SERIAL_THREAD)
+    {
+      puts ("barrier_wait failed");
+      return (void *) 1l;
+    }
+
+  if (arg == NULL)
+    do
+      if (pthread_cond_wait (&c, m) != 0)
+	{
+	  puts ("tf: cond_wait failed");
+	  return (void *) 1l;
+	}
+    while (! done);
+  else
+    do
+      {
+	pthread_cleanup_push (cl, NULL);
+
+	if (pthread_cond_wait (&c, m) != 0)
+	  {
+	    puts ("tf: cond_wait failed");
+	    return (void *) 1l;
+	  }
+
+	pthread_cleanup_pop (0);
+      }
+    while (! done);
+
+  if (pthread_mutex_unlock (m) != 0)
+    {
+      puts ("tf: mutex_unlock failed");
+      return (void *) 1l;
+    }
+
+  return NULL;
+}
+
+
+static int
+check_type (const char *mas, pthread_mutexattr_t *ma)
+{
+  if (pthread_mutex_init (m, ma) != 0)
+    {
+      printf ("1st mutex_init failed for %s\n", mas);
+      return 1;
+    }
+
+  if (pthread_mutex_destroy (m) != 0)
+    {
+      printf ("immediate mutex_destroy failed for %s\n", mas);
+      return 1;
+    }
+
+  if (pthread_mutex_init (m, ma) != 0)
+    {
+      printf ("2nd mutex_init failed for %s\n", mas);
+      return 1;
+    }
+
+  if (pthread_mutex_lock (m) != 0)
+    {
+      printf ("1st mutex_lock failed for %s\n", mas);
+      return 1;
+    }
+
+  int e = pthread_mutex_destroy (m);
+  if (e == 0)
+    {
+      printf ("mutex_destroy of self-locked mutex succeeded for %s\n", mas);
+      return 1;
+    }
+  if (e != EBUSY)
+    {
+      printf ("mutex_destroy of self-locked mutex did not return EBUSY %s\n",
+	      mas);
+      return 1;
+    }
+
+  if (pthread_mutex_unlock (m) != 0)
+    {
+      printf ("1st mutex_unlock failed for %s\n", mas);
+      return 1;
+    }
+
+  if (pthread_mutex_trylock (m) != 0)
+    {
+      printf ("mutex_trylock failed for %s\n", mas);
+      return 1;
+    }
+
+  e = pthread_mutex_destroy (m);
+  if (e == 0)
+    {
+      printf ("mutex_destroy of self-trylocked mutex succeeded for %s\n", mas);
+      return 1;
+    }
+  if (e != EBUSY)
+    {
+      printf ("\
+mutex_destroy of self-trylocked mutex did not return EBUSY %s\n",
+	      mas);
+      return 1;
+    }
+
+  if (pthread_mutex_unlock (m) != 0)
+    {
+      printf ("2nd mutex_unlock failed for %s\n", mas);
+      return 1;
+    }
+
+  pthread_t th;
+  if (pthread_create (&th, NULL, tf, NULL) != 0)
+    {
+      puts ("1st create failed");
+      return 1;
+    }
+  done = false;
+
+  e = pthread_barrier_wait (&b);
+  if (e != 0 && e != PTHREAD_BARRIER_SERIAL_THREAD)
+    {
+      puts ("1st barrier_wait failed");
+      return 1;
+    }
+
+  if (pthread_mutex_lock (m) != 0)
+    {
+      printf ("2nd mutex_lock failed for %s\n", mas);
+      return 1;
+    }
+
+  if (pthread_mutex_unlock (m) != 0)
+    {
+      printf ("3rd mutex_unlock failed for %s\n", mas);
+      return 1;
+    }
+
+  e = pthread_mutex_destroy (m);
+  if (e == 0)
+    {
+      printf ("mutex_destroy of condvar-used mutex succeeded for %s\n", mas);
+      return 1;
+    }
+  if (e != EBUSY)
+    {
+      printf ("\
+mutex_destroy of condvar-used mutex did not return EBUSY for %s\n", mas);
+      return 1;
+    }
+
+  done = true;
+  if (pthread_cond_signal (&c) != 0)
+    {
+      puts ("cond_signal failed");
+      return 1;
+    }
+
+  void *r;
+  if (pthread_join (th, &r) != 0)
+    {
+      puts ("join failed");
+      return 1;
+    }
+  if (r != NULL)
+    {
+      puts ("thread didn't return NULL");
+      return 1;
+    }
+
+  if (pthread_mutex_destroy (m) != 0)
+    {
+      printf ("mutex_destroy after condvar-use failed for %s\n", mas);
+      return 1;
+    }
+
+  if (pthread_mutex_init (m, ma) != 0)
+    {
+      printf ("3rd mutex_init failed for %s\n", mas);
+      return 1;
+    }
+
+  if (pthread_create (&th, NULL, tf, (void *) 1) != 0)
+    {
+      puts ("2nd create failed");
+      return 1;
+    }
+  done = false;
+
+  e = pthread_barrier_wait (&b);
+  if (e != 0 && e != PTHREAD_BARRIER_SERIAL_THREAD)
+    {
+      puts ("2nd barrier_wait failed");
+      return 1;
+    }
+
+  if (pthread_mutex_lock (m) != 0)
+    {
+      printf ("3rd mutex_lock failed for %s\n", mas);
+      return 1;
+    }
+
+  if (pthread_mutex_unlock (m) != 0)
+    {
+      printf ("4th mutex_unlock failed for %s\n", mas);
+      return 1;
+    }
+
+  e = pthread_mutex_destroy (m);
+  if (e == 0)
+    {
+      printf ("2nd mutex_destroy of condvar-used mutex succeeded for %s\n",
+	      mas);
+      return 1;
+    }
+  if (e != EBUSY)
+    {
+      printf ("\
+2nd mutex_destroy of condvar-used mutex did not return EBUSY for %s\n",
+	      mas);
+      return 1;
+    }
+
+  if (pthread_cancel (th) != 0)
+    {
+      puts ("cond_cancel failed");
+      return 1;
+    }
+
+  if (pthread_join (th, &r) != 0)
+    {
+      puts ("join failed");
+      return 1;
+    }
+  if (r != PTHREAD_CANCELED)
+    {
+      puts ("thread not canceled");
+      return 1;
+    }
+
+  if (pthread_mutex_destroy (m) != 0)
+    {
+      printf ("mutex_destroy after condvar-canceled failed for %s\n", mas);
+      return 1;
+    }
+
+  return 0;
+}
+
+
+static int
+do_test (void)
+{
+  pthread_mutex_t mm;
+  m = &mm;
+
+  if (pthread_barrier_init (&b, NULL, 2) != 0)
+    {
+      puts ("barrier_init failed");
+      return 1;
+    }
+
+  if (pthread_cond_init (&c, NULL) != 0)
+    {
+      puts ("cond_init failed");
+      return 1;
+    }
+
+  puts ("check normal mutex");
+  int res = check_type ("normal", NULL);
+
+  pthread_mutexattr_t ma;
+  if (pthread_mutexattr_init (&ma) != 0)
+    {
+      puts ("1st mutexattr_init failed");
+      return 1;
+    }
+  if (pthread_mutexattr_settype (&ma, PTHREAD_MUTEX_RECURSIVE) != 0)
+    {
+      puts ("1st mutexattr_settype failed");
+      return 1;
+    }
+  puts ("check recursive mutex");
+  res |= check_type ("recursive", &ma);
+  if (pthread_mutexattr_destroy (&ma) != 0)
+    {
+      puts ("1st mutexattr_destroy failed");
+      return 1;
+    }
+
+  if (pthread_mutexattr_init (&ma) != 0)
+    {
+      puts ("2nd mutexattr_init failed");
+      return 1;
+    }
+  if (pthread_mutexattr_settype (&ma, PTHREAD_MUTEX_ERRORCHECK) != 0)
+    {
+      puts ("2nd mutexattr_settype failed");
+      return 1;
+    }
+  puts ("check error-checking mutex");
+  res |= check_type ("error-checking", &ma);
+  if (pthread_mutexattr_destroy (&ma) != 0)
+    {
+      puts ("2nd mutexattr_destroy failed");
+      return 1;
+    }
+
+  return res;
+}
+
+#define TEST_FUNCTION do_test ()
+#include "../test-skeleton.c"
diff --git a/ap/build/uClibc/test/nptl/tst-mutex9.c b/ap/build/uClibc/test/nptl/tst-mutex9.c
new file mode 100644
index 0000000..3748584
--- /dev/null
+++ b/ap/build/uClibc/test/nptl/tst-mutex9.c
@@ -0,0 +1,191 @@
+/* Copyright (C) 2003, 2004 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, write to the Free
+   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+   02111-1307 USA.  */
+
+#include <errno.h>
+#include <pthread.h>
+#include <stdio.h>
+#include <string.h>
+#include <unistd.h>
+#include <sys/mman.h>
+#include <sys/wait.h>
+#include <stdint.h>
+#include <stdlib.h>
+#include <sys/time.h>
+
+int gettimeofday(struct timeval *tv, struct timezone *tz);
+
+
+static int
+do_test (void)
+{
+  size_t ps = sysconf (_SC_PAGESIZE);
+  char tmpfname[] = "/tmp/tst-mutex9.XXXXXX";
+  char data[ps];
+  void *mem;
+  int fd;
+  pthread_mutex_t *m;
+  pthread_mutexattr_t a;
+  pid_t pid;
+  char *p;
+
+  fd = mkstemp (tmpfname);
+  if (fd == -1)
+    {
+      printf ("cannot open temporary file: %m\n");
+      return 1;
+    }
+
+  /* Make sure it is always removed.  */
+  unlink (tmpfname);
+
+  /* Create one page of data.  */
+  memset (data, '\0', ps);
+
+  /* Write the data to the file.  */
+  if (write (fd, data, ps) != (ssize_t) ps)
+    {
+      puts ("short write");
+      return 1;
+    }
+
+  mem = mmap (NULL, ps, PROT_READ | PROT_WRITE, MAP_SHARED, fd, 0);
+  if (mem == MAP_FAILED)
+    {
+      printf ("mmap failed: %m\n");
+      return 1;
+    }
+
+  m = (pthread_mutex_t *) (((uintptr_t) mem + __alignof (pthread_mutex_t))
+			   & ~(__alignof (pthread_mutex_t) - 1));
+  p = (char *) (m + 1);
+
+  if (pthread_mutexattr_init (&a) != 0)
+    {
+      puts ("mutexattr_init failed");
+      return 1;
+    }
+
+  if (pthread_mutexattr_setpshared (&a, PTHREAD_PROCESS_SHARED) != 0)
+    {
+      puts ("mutexattr_setpshared failed");
+      return 1;
+    }
+
+  if (pthread_mutexattr_settype (&a, PTHREAD_MUTEX_RECURSIVE) != 0)
+    {
+      puts ("mutexattr_settype failed");
+      return 1;
+    }
+
+  if (pthread_mutex_init (m, &a) != 0)
+    {
+      puts ("mutex_init failed");
+      return 1;
+    }
+
+  if (pthread_mutex_lock (m) != 0)
+    {
+      puts ("mutex_lock failed");
+      return 1;
+    }
+
+  if (pthread_mutexattr_destroy (&a) != 0)
+    {
+      puts ("mutexattr_destroy failed");
+      return 1;
+    }
+
+  puts ("going to fork now");
+  pid = fork ();
+  if (pid == -1)
+    {
+      puts ("fork failed");
+      return 1;
+    }
+  else if (pid == 0)
+    {
+      if (pthread_mutex_trylock (m) == 0)
+	{
+	  puts ("child: mutex_trylock succeeded");
+	  exit (1);
+	}
+
+      if (pthread_mutex_unlock (m) == 0)
+	{
+	  puts ("child: mutex_unlock succeeded");
+	  exit (1);
+	}
+
+      struct timeval tv;
+      gettimeofday (&tv, NULL);
+      struct timespec ts;
+      TIMEVAL_TO_TIMESPEC (&tv, &ts);
+      ts.tv_nsec += 500000000;
+      if (ts.tv_nsec >= 1000000000)
+	{
+	  ++ts.tv_sec;
+	  ts.tv_nsec -= 1000000000;
+	}
+
+      int e = pthread_mutex_timedlock (m, &ts);
+      if (e == 0)
+	{
+	  puts ("child: mutex_timedlock succeeded");
+	  exit (1);
+	}
+      if (e != ETIMEDOUT)
+	{
+	  puts ("child: mutex_timedlock didn't time out");
+	  exit (1);
+	}
+
+      alarm (1);
+
+      pthread_mutex_lock (m);
+
+      puts ("child: mutex_lock returned");
+
+      exit (0);
+    }
+
+  sleep (2);
+
+  int status;
+  if (TEMP_FAILURE_RETRY (waitpid (pid, &status, 0)) != pid)
+    {
+      puts ("waitpid failed");
+      return 1;
+    }
+  if (! WIFSIGNALED (status))
+    {
+      puts ("child not killed by signal");
+      return 1;
+    }
+  if (WTERMSIG (status) != SIGALRM)
+    {
+      puts ("child not killed by SIGALRM");
+      return 1;
+    }
+
+  return 0;
+}
+
+#define TIMEOUT 3
+#define TEST_FUNCTION do_test ()
+#include "../test-skeleton.c"
diff --git a/ap/build/uClibc/test/nptl/tst-oddstacklimit.c b/ap/build/uClibc/test/nptl/tst-oddstacklimit.c
new file mode 100644
index 0000000..9fbef18
--- /dev/null
+++ b/ap/build/uClibc/test/nptl/tst-oddstacklimit.c
@@ -0,0 +1 @@
+#include "tst-basic1.c"
diff --git a/ap/build/uClibc/test/nptl/tst-once1.c b/ap/build/uClibc/test/nptl/tst-once1.c
new file mode 100644
index 0000000..87ed51c
--- /dev/null
+++ b/ap/build/uClibc/test/nptl/tst-once1.c
@@ -0,0 +1,51 @@
+/* Copyright (C) 2002 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+   Contributed by Ulrich Drepper <drepper@redhat.com>, 2002.
+
+   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>
+#include <stdio.h>
+
+
+static pthread_once_t once = PTHREAD_ONCE_INIT;
+
+static int global;
+
+static void
+once_handler (void)
+{
+  ++global;
+}
+
+
+static int
+do_test (void)
+{
+  pthread_once (&once, once_handler);
+  pthread_once (&once, once_handler);
+
+  if (global != 1)
+    {
+      printf ("global = %d, expected 1\n", global);
+      return 1;
+    }
+
+  return 0;
+}
+
+#define TEST_FUNCTION do_test ()
+#include "../test-skeleton.c"
diff --git a/ap/build/uClibc/test/nptl/tst-once2.c b/ap/build/uClibc/test/nptl/tst-once2.c
new file mode 100644
index 0000000..c606345
--- /dev/null
+++ b/ap/build/uClibc/test/nptl/tst-once2.c
@@ -0,0 +1,104 @@
+/* Copyright (C) 2002, 2004 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+   Contributed by Ulrich Drepper <drepper@redhat.com>, 2002.
+
+   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>
+#include <stdio.h>
+#include <stdlib.h>
+#include <time.h>
+
+
+#define N 100
+
+static pthread_once_t once = PTHREAD_ONCE_INIT;
+
+static int global;
+
+static void
+once_handler (void)
+{
+  struct timespec ts;
+
+  ++global;
+
+  ts.tv_sec = 2;
+  ts.tv_nsec = 0;
+  nanosleep (&ts, NULL);
+}
+
+
+static void *
+tf (void *arg)
+{
+  pthread_once (&once, once_handler);
+
+  if (global != 1)
+    {
+      printf ("thread %ld: global == %d\n", (long int) arg, global);
+      exit (1);
+    }
+
+  return NULL;
+}
+
+
+static int
+do_test (void)
+{
+  pthread_attr_t at;
+  pthread_t th[N];
+  int cnt;
+
+  if (pthread_attr_init (&at) != 0)
+    {
+      puts ("attr_init failed");
+      return 1;
+    }
+
+  if (pthread_attr_setstacksize (&at, 1 * 1024 * 1024) != 0)
+    {
+      puts ("attr_setstacksize failed");
+      return 1;
+    }
+
+  for (cnt = 0; cnt < N; ++cnt)
+    if (pthread_create (&th[cnt], &at, tf, (void *) (long int) cnt) != 0)
+      {
+	printf ("creation of thread %d failed\n", cnt);
+	return 1;
+      }
+
+  if (pthread_attr_destroy (&at) != 0)
+    {
+      puts ("attr_destroy failed");
+      return 1;
+    }
+
+  for (cnt = 0; cnt < N; ++cnt)
+    if (pthread_join (th[cnt], NULL) != 0)
+      {
+	printf ("join of thread %d failed\n", cnt);
+	return 1;
+      }
+
+  return 0;
+}
+
+#define TEST_FUNCTION do_test ()
+#define TIMEOUT 4
+#include "../test-skeleton.c"
diff --git a/ap/build/uClibc/test/nptl/tst-once3.c b/ap/build/uClibc/test/nptl/tst-once3.c
new file mode 100644
index 0000000..43b354a
--- /dev/null
+++ b/ap/build/uClibc/test/nptl/tst-once3.c
@@ -0,0 +1,162 @@
+/* Copyright (C) 2002, 2003 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+   Contributed by Ulrich Drepper <drepper@redhat.com>, 2002.
+
+   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>
+#include <stdio.h>
+#include <stdlib.h>
+#include <time.h>
+
+
+#define N 100
+
+static pthread_once_t once = PTHREAD_ONCE_INIT;
+
+static pthread_cond_t cond = PTHREAD_COND_INITIALIZER;
+static pthread_mutex_t mut = PTHREAD_MUTEX_INITIALIZER;
+
+static pthread_barrier_t bar;
+
+static int global;
+static int cl_called;
+
+static void
+once_handler1 (void)
+{
+  if (pthread_mutex_lock (&mut) != 0)
+    {
+      puts ("once_handler1: mutex_lock failed");
+      exit (1);
+    }
+  puts ("once_handler1: locked");
+
+  int r = pthread_barrier_wait (&bar);
+  if (r != 0 && r!= PTHREAD_BARRIER_SERIAL_THREAD)
+    {
+      puts ("once_handler1: barrier_wait failed");
+      exit (1);
+    }
+
+  pthread_cond_wait (&cond, &mut);
+
+  /* We should never get here.  */
+  exit (42);
+}
+
+static void
+once_handler2 (void)
+{
+  global = 1;
+}
+
+
+static void
+cl (void *arg)
+{
+  cl_called = 1;
+}
+
+
+static void *
+tf (void *arg)
+{
+  pthread_cleanup_push (cl, NULL)
+
+  pthread_once (&once, once_handler1);
+
+  pthread_cleanup_pop (0);
+
+  /* We should never get here.  */
+  puts ("pthread_once in tf returned");
+  exit (1);
+}
+
+
+static int
+do_test (void)
+{
+  pthread_t th;
+
+  if (pthread_barrier_init (&bar, NULL, 2) != 0)
+    {
+      puts ("barrier_init failed");
+      return 1;
+    }
+
+  if (pthread_create (&th, NULL, tf, NULL) != 0)
+    {
+      puts ("first create failed");
+      return 1;
+    }
+
+  int r = pthread_barrier_wait (&bar);
+  if (r != 0 && r!= PTHREAD_BARRIER_SERIAL_THREAD)
+    {
+      puts ("barrier_wait failed");
+      return 1;
+    }
+
+  if (pthread_mutex_lock (&mut) != 0)
+    {
+      puts ("mutex_lock failed");
+      return 1;
+    }
+  /* We unlock the mutex so that we catch the case where the pthread_cond_wait
+     call incorrectly resumes and tries to get the mutex.  */
+  if (pthread_mutex_unlock (&mut) != 0)
+    {
+      puts ("mutex_unlock failed");
+      return 1;
+    }
+
+  /* Cancel the thread.  */
+  puts ("going to cancel");
+  if (pthread_cancel (th) != 0)
+    {
+      puts ("cancel failed");
+      return 1;
+    }
+
+  void *result;
+  pthread_join (th, &result);
+  if (result != PTHREAD_CANCELED)
+    {
+      puts ("join didn't return PTHREAD_CANCELED");
+      return 1;
+    }
+
+  if (cl_called != 1)
+    {
+      puts ("cleanup handler not called");
+      return 1;
+    }
+
+  pthread_once (&once, once_handler2);
+
+  if (global != 1)
+    {
+      puts ("global still 0");
+      return 1;
+    }
+
+  return 0;
+}
+
+#define TEST_FUNCTION do_test ()
+#define TIMEOUT 4
+#include "../test-skeleton.c"
diff --git a/ap/build/uClibc/test/nptl/tst-once4.c b/ap/build/uClibc/test/nptl/tst-once4.c
new file mode 100644
index 0000000..35bae3c
--- /dev/null
+++ b/ap/build/uClibc/test/nptl/tst-once4.c
@@ -0,0 +1,202 @@
+/* Copyright (C) 2003, 2004 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, write to the Free
+   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+   02111-1307 USA.  */
+
+#include <pthread.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <time.h>
+#include <unistd.h>
+
+
+static pthread_once_t once = PTHREAD_ONCE_INIT;
+
+static pthread_cond_t cond = PTHREAD_COND_INITIALIZER;
+static pthread_mutex_t mut = PTHREAD_MUTEX_INITIALIZER;
+
+static pthread_barrier_t bar;
+
+static int global;
+static int cl_called;
+
+static void
+once_handler1 (void)
+{
+  if (pthread_mutex_lock (&mut) != 0)
+    {
+      puts ("once_handler1: mutex_lock failed");
+      exit (1);
+    }
+
+  int r = pthread_barrier_wait (&bar);
+  if (r != 0 && r!= PTHREAD_BARRIER_SERIAL_THREAD)
+    {
+      puts ("once_handler1: barrier_wait failed");
+      exit (1);
+    }
+
+  pthread_cond_wait (&cond, &mut);
+
+  /* We should never get here.  */
+}
+
+
+static void
+once_handler2 (void)
+{
+  global = 1;
+}
+
+
+static void
+cl (void *arg)
+{
+  ++cl_called;
+}
+
+
+static void *
+tf1 (void *arg)
+{
+  pthread_cleanup_push (cl, NULL);
+
+  pthread_once (&once, once_handler1);
+
+  pthread_cleanup_pop (0);
+
+  /* We should never get here.  */
+  puts ("pthread_once in tf returned");
+  exit (1);
+}
+
+
+static void *
+tf2 (void *arg)
+{
+  pthread_cleanup_push (cl, NULL);
+
+  int r = pthread_barrier_wait (&bar);
+  if (r != 0 && r!= PTHREAD_BARRIER_SERIAL_THREAD)
+    {
+      puts ("once_handler2: barrier_wait failed");
+      exit (1);
+    }
+
+  pthread_cleanup_pop (0);
+
+  pthread_once (&once, once_handler2);
+
+  return NULL;
+}
+
+
+static int
+do_test (void)
+{
+  pthread_t th[2];
+
+  if (pthread_barrier_init (&bar, NULL, 2) != 0)
+    {
+      puts ("barrier_init failed");
+      return 1;
+    }
+
+  if (pthread_create (&th[0], NULL, tf1, NULL) != 0)
+    {
+      puts ("first create failed");
+      return 1;
+    }
+
+  int r = pthread_barrier_wait (&bar);
+  if (r != 0 && r!= PTHREAD_BARRIER_SERIAL_THREAD)
+    {
+      puts ("first barrier_wait failed");
+      return 1;
+    }
+
+  if (pthread_mutex_lock (&mut) != 0)
+    {
+      puts ("mutex_lock failed");
+      return 1;
+    }
+  /* We unlock the mutex so that we catch the case where the pthread_cond_wait
+     call incorrectly resumes and tries to get the mutex.  */
+  if (pthread_mutex_unlock (&mut) != 0)
+    {
+      puts ("mutex_unlock failed");
+      return 1;
+    }
+
+  if (pthread_create (&th[1], NULL, tf2, NULL) != 0)
+    {
+      puts ("second create failed");
+      return 1;
+    }
+
+  r = pthread_barrier_wait (&bar);
+  if (r != 0 && r!= PTHREAD_BARRIER_SERIAL_THREAD)
+    {
+      puts ("second barrier_wait failed");
+      return 1;
+    }
+
+  /* Give the second thread a chance to reach the pthread_once call.  */
+  sleep (2);
+
+  /* Cancel the thread.  */
+  if (pthread_cancel (th[0]) != 0)
+    {
+      puts ("cancel failed");
+      return 1;
+    }
+
+  void *result;
+  pthread_join (th[0], &result);
+  if (result != PTHREAD_CANCELED)
+    {
+      puts ("first join didn't return PTHREAD_CANCELED");
+      return 1;
+    }
+
+  puts ("joined first thread");
+
+  pthread_join (th[1], &result);
+  if (result != NULL)
+    {
+      puts ("second join didn't return PTHREAD_CANCELED");
+      return 1;
+    }
+
+  if (global != 1)
+    {
+      puts ("global still 0");
+      return 1;
+    }
+
+  if (cl_called != 1)
+    {
+      printf ("cl_called = %d\n", cl_called);
+      return 1;
+    }
+
+  return 0;
+}
+
+#define TEST_FUNCTION do_test ()
+#define TIMEOUT 4
+#include "../test-skeleton.c"
diff --git a/ap/build/uClibc/test/nptl/tst-oncex3.c b/ap/build/uClibc/test/nptl/tst-oncex3.c
new file mode 100644
index 0000000..08225b8
--- /dev/null
+++ b/ap/build/uClibc/test/nptl/tst-oncex3.c
@@ -0,0 +1 @@
+#include "tst-once3.c"
diff --git a/ap/build/uClibc/test/nptl/tst-oncex4.c b/ap/build/uClibc/test/nptl/tst-oncex4.c
new file mode 100644
index 0000000..9b4d98f
--- /dev/null
+++ b/ap/build/uClibc/test/nptl/tst-oncex4.c
@@ -0,0 +1 @@
+#include "tst-once4.c"
diff --git a/ap/build/uClibc/test/nptl/tst-popen1.c b/ap/build/uClibc/test/nptl/tst-popen1.c
new file mode 100644
index 0000000..a9d0773
--- /dev/null
+++ b/ap/build/uClibc/test/nptl/tst-popen1.c
@@ -0,0 +1,60 @@
+/* Copyright (C) 2003 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+   Contributed by Jakub Jelinek <jakub@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, write to the Free
+   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+   02111-1307 USA.  */
+
+#include <errno.h>
+#include <error.h>
+#include <pthread.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <unistd.h>
+
+static void *
+dummy (void *x)
+{
+  return NULL;
+}
+
+static char buf[sizeof "something\n"];
+
+static int
+do_test (void)
+{
+  FILE *f;
+  pthread_t p;
+  int err;
+
+  f = popen ("echo something", "r");
+  if (f == NULL)
+    error (EXIT_FAILURE, errno, "popen failed");
+  if (fgets (buf, sizeof (buf), f) == NULL)
+    error (EXIT_FAILURE, 0, "fgets failed");
+  if (strcmp (buf, "something\n"))
+    error (EXIT_FAILURE, 0, "read wrong data");
+  if (pclose (f))
+    error (EXIT_FAILURE, errno, "pclose returned non-zero");
+  if ((err = pthread_create (&p, NULL, dummy, NULL)))
+    error (EXIT_FAILURE, err, "pthread_create failed");
+  if ((err = pthread_join (p, NULL)))
+    error (EXIT_FAILURE, err, "pthread_join failed");
+  exit (0);
+}
+
+#define TEST_FUNCTION do_test ()
+#include "../test-skeleton.c"
diff --git a/ap/build/uClibc/test/nptl/tst-raise1.c b/ap/build/uClibc/test/nptl/tst-raise1.c
new file mode 100644
index 0000000..5ea9886
--- /dev/null
+++ b/ap/build/uClibc/test/nptl/tst-raise1.c
@@ -0,0 +1,62 @@
+/* Copyright (C) 2003 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+   Contributed by Jakub Jelinek <jakub@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, write to the Free
+   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+   02111-1307 USA.  */
+
+#include <errno.h>
+#include <error.h>
+#include <signal.h>
+#include <stdlib.h>
+#include <stdio.h>
+
+volatile int count;
+
+void
+sh (int sig)
+{
+  ++count;
+}
+
+int
+main (void)
+{
+  struct sigaction sa;
+  sa.sa_handler = sh;
+  sigemptyset (&sa.sa_mask);
+  sa.sa_flags = 0;
+  if (sigaction (SIGUSR1, &sa, NULL) < 0)
+    {
+      printf ("sigaction failed: %m\n");
+      exit (1);
+    }
+  if (raise (SIGUSR1) < 0)
+    {
+      printf ("first raise failed: %m\n");
+      exit (1);
+    }
+  if (raise (SIGUSR1) < 0)
+    {
+      printf ("second raise failed: %m\n");
+      exit (1);
+    }
+  if (count != 2)
+    {
+      printf ("signal handler not called 2 times\n");
+      exit (1);
+    }
+  exit (0);
+}
diff --git a/ap/build/uClibc/test/nptl/tst-rwlock1.c b/ap/build/uClibc/test/nptl/tst-rwlock1.c
new file mode 100644
index 0000000..c97e0e6
--- /dev/null
+++ b/ap/build/uClibc/test/nptl/tst-rwlock1.c
@@ -0,0 +1,117 @@
+/* Copyright (C) 2002 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+   Contributed by Ulrich Drepper <drepper@redhat.com>, 2002.
+
+   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>
+#include <stdio.h>
+
+
+static int
+do_test (void)
+{
+  pthread_rwlock_t r;
+
+  if (pthread_rwlock_init (&r, NULL) != 0)
+    {
+      puts ("rwlock_init failed");
+      return 1;
+    }
+  puts ("rwlock_init succeeded");
+
+  if (pthread_rwlock_rdlock (&r) != 0)
+    {
+      puts ("1st rwlock_rdlock failed");
+      return 1;
+    }
+  puts ("1st rwlock_rdlock succeeded");
+
+  if (pthread_rwlock_rdlock (&r) != 0)
+    {
+      puts ("2nd rwlock_rdlock failed");
+      return 1;
+    }
+  puts ("2nd rwlock_rdlock succeeded");
+
+  if (pthread_rwlock_unlock (&r) != 0)
+    {
+      puts ("1st rwlock_unlock failed");
+      return 1;
+    }
+  puts ("1st rwlock_unlock succeeded");
+
+  if (pthread_rwlock_unlock (&r) != 0)
+    {
+      puts ("2nd rwlock_unlock failed");
+      return 1;
+    }
+  puts ("2nd rwlock_unlock succeeded");
+
+  if (pthread_rwlock_wrlock (&r) != 0)
+    {
+      puts ("1st rwlock_wrlock failed");
+      return 1;
+    }
+  puts ("1st rwlock_wrlock succeeded");
+
+  if (pthread_rwlock_unlock (&r) != 0)
+    {
+      puts ("3rd rwlock_unlock failed");
+      return 1;
+    }
+  puts ("3rd rwlock_unlock succeeded");
+
+  if (pthread_rwlock_wrlock (&r) != 0)
+    {
+      puts ("2nd rwlock_wrlock failed");
+      return 1;
+    }
+  puts ("2nd rwlock_wrlock succeeded");
+
+  if (pthread_rwlock_unlock (&r) != 0)
+    {
+      puts ("4th rwlock_unlock failed");
+      return 1;
+    }
+  puts ("4th rwlock_unlock succeeded");
+
+  if (pthread_rwlock_rdlock (&r) != 0)
+    {
+      puts ("3rd rwlock_rdlock failed");
+      return 1;
+    }
+  puts ("3rd rwlock_rdlock succeeded");
+
+  if (pthread_rwlock_unlock (&r) != 0)
+    {
+      puts ("5th rwlock_unlock failed");
+      return 1;
+    }
+  puts ("5th rwlock_unlock succeeded");
+
+  if (pthread_rwlock_destroy (&r) != 0)
+    {
+      puts ("rwlock_destroy failed");
+      return 1;
+    }
+  puts ("rwlock_destroy succeeded");
+
+  return 0;
+}
+
+#define TEST_FUNCTION do_test ()
+#include "../test-skeleton.c"
diff --git a/ap/build/uClibc/test/nptl/tst-rwlock10.c b/ap/build/uClibc/test/nptl/tst-rwlock10.c
new file mode 100644
index 0000000..43156ea
--- /dev/null
+++ b/ap/build/uClibc/test/nptl/tst-rwlock10.c
@@ -0,0 +1,21 @@
+/* Test program for timedout read/write lock functions.
+   Copyright (C) 2003 Free Software Foundation, Inc.
+   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.  */
+
+#define INIT PTHREAD_RWLOCK_INITIALIZER
+#include "tst-rwlock8.c"
diff --git a/ap/build/uClibc/test/nptl/tst-rwlock11.c b/ap/build/uClibc/test/nptl/tst-rwlock11.c
new file mode 100644
index 0000000..ed9af7e
--- /dev/null
+++ b/ap/build/uClibc/test/nptl/tst-rwlock11.c
@@ -0,0 +1,21 @@
+/* Test program for timedout read/write lock functions.
+   Copyright (C) 2003 Free Software Foundation, Inc.
+   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.  */
+
+#define INIT PTHREAD_RWLOCK_INITIALIZER
+#include "tst-rwlock9.c"
diff --git a/ap/build/uClibc/test/nptl/tst-rwlock12.c b/ap/build/uClibc/test/nptl/tst-rwlock12.c
new file mode 100644
index 0000000..91f25d3
--- /dev/null
+++ b/ap/build/uClibc/test/nptl/tst-rwlock12.c
@@ -0,0 +1,208 @@
+/* Copyright (C) 2002, 2003, 2004 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+   Contributed by Ulrich Drepper <drepper@redhat.com>, 2002.
+
+   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 <errno.h>
+#include <pthread.h>
+#include <stdint.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <unistd.h>
+#include <sys/mman.h>
+#include <sys/wait.h>
+
+
+static int
+do_test (void)
+{
+  size_t ps = sysconf (_SC_PAGESIZE);
+  char tmpfname[] = "/tmp/tst-rwlock12.XXXXXX";
+  char data[ps];
+  void *mem;
+  int fd;
+  pthread_mutex_t *m;
+  pthread_mutexattr_t ma;
+  pthread_rwlock_t *r;
+  pthread_rwlockattr_t ra;
+  pid_t pid;
+  int status = 0;
+
+  fd = mkstemp (tmpfname);
+  if (fd == -1)
+    {
+      printf ("cannot open temporary file: %m\n");
+      return 1;
+    }
+
+  /* Make sure it is always removed.  */
+  unlink (tmpfname);
+
+  /* Create one page of data.  */
+  memset (data, '\0', ps);
+
+  /* Write the data to the file.  */
+  if (write (fd, data, ps) != (ssize_t) ps)
+    {
+      puts ("short write");
+      return 1;
+    }
+
+  mem = mmap (NULL, ps, PROT_READ | PROT_WRITE, MAP_SHARED, fd, 0);
+  if (mem == MAP_FAILED)
+    {
+      printf ("mmap failed: %m\n");
+      return 1;
+    }
+
+  r = (pthread_rwlock_t *) (((uintptr_t) mem + __alignof (pthread_rwlock_t))
+			    & ~(__alignof (pthread_rwlock_t) - 1));
+  /* The following assumes alignment for a mutex is at least as high
+     as that for a rwlock.  Which is true in our case.  */
+  m = (pthread_mutex_t *) (r + 1);
+
+  if (pthread_rwlockattr_init (&ra) != 0)
+    {
+      puts ("rwlockattr_init failed");
+      return 1;
+    }
+
+  if (pthread_rwlockattr_setpshared (&ra, PTHREAD_PROCESS_SHARED) != 0)
+    {
+      puts ("rwlockattr_setpshared failed");
+      return 1;
+    }
+
+  if (pthread_rwlock_init (r, &ra) != 0)
+    {
+      puts ("rwlock_init failed");
+      return 1;
+    }
+
+  if (pthread_mutexattr_init (&ma) != 0)
+    {
+      puts ("rwlockattr_init failed");
+      return 1;
+    }
+
+  if (pthread_mutexattr_setpshared (&ma, PTHREAD_PROCESS_SHARED) != 0)
+    {
+      puts ("mutexattr_setpshared failed");
+      return 1;
+    }
+
+  if (pthread_mutex_init (m, &ma) != 0)
+    {
+      puts ("mutex_init failed");
+      return 1;
+    }
+
+  /* Lock the mutex.  */
+  if (pthread_mutex_lock (m) != 0)
+    {
+      puts ("mutex_lock failed");
+      return 1;
+    }
+
+  puts ("going to fork now");
+  pid = fork ();
+  if (pid == -1)
+    {
+      puts ("fork failed");
+      return 1;
+    }
+  else if (pid == 0)
+    {
+      /* Lock the mutex.  */
+      if (pthread_mutex_lock (m) != 0)
+	{
+	  puts ("child: mutex_lock failed");
+	  return 1;
+	}
+
+      /* Try to get the rwlock.  */
+      if (pthread_rwlock_trywrlock (r) == 0)
+	{
+	  puts ("rwlock_trywrlock succeeded");
+	  return 1;
+	}
+
+      /* Try again.  */
+      struct timespec ts = { .tv_sec = 0, .tv_nsec = 500000000 };
+      int e = pthread_rwlock_timedwrlock (r, &ts);
+      if (e == 0)
+	{
+	  puts ("rwlock_timedwrlock succeeded");
+	  return 1;
+	}
+      if (e != ETIMEDOUT)
+	{
+	  puts ("rwlock_timedwrlock didn't return ETIMEDOUT");
+	  status = 1;
+	}
+
+      if (pthread_rwlock_tryrdlock (r) == 0)
+	{
+	  puts ("rwlock_tryrdlock succeeded");
+	  return 1;
+	}
+
+      e = pthread_rwlock_timedrdlock (r, &ts);
+      if (e == 0)
+	{
+	  puts ("rwlock_timedrdlock succeeded");
+	  return 1;
+	}
+      if (e != ETIMEDOUT)
+	{
+	  puts ("rwlock_timedrdlock didn't return ETIMEDOUT");
+	  status = 1;
+	}
+    }
+  else
+    {
+      /* Lock the rwlock for writing.  */
+      if (pthread_rwlock_wrlock (r) != 0)
+	{
+	  puts ("rwlock_wrlock failed");
+	  kill (pid, SIGTERM);
+	  return 1;
+	}
+
+      /* Allow the child to run.  */
+      if (pthread_mutex_unlock (m) != 0)
+	{
+	  puts ("mutex_unlock failed");
+	  kill (pid, SIGTERM);
+	  return 1;
+	}
+
+      /* Just wait for the child.  */
+      if (TEMP_FAILURE_RETRY (waitpid (pid, &status, 0)) != pid)
+	{
+	  puts ("waitpid failed");
+	  kill (pid, SIGTERM);
+	  return 1;
+	}
+    }
+
+  return status;
+}
+
+#define TEST_FUNCTION do_test ()
+#include "../test-skeleton.c"
diff --git a/ap/build/uClibc/test/nptl/tst-rwlock13.c b/ap/build/uClibc/test/nptl/tst-rwlock13.c
new file mode 100644
index 0000000..61d5b83
--- /dev/null
+++ b/ap/build/uClibc/test/nptl/tst-rwlock13.c
@@ -0,0 +1,71 @@
+/* Copyright (C) 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.  */
+
+#include <pthread.h>
+#include <stdio.h>
+#include <string.h>
+
+
+static int
+do_test (void)
+{
+  pthread_rwlock_t r;
+  int ret;
+
+  memset (&r, 0xaa, sizeof (r));
+  if ((ret = pthread_rwlock_init (&r, NULL)) != 0)
+    {
+      printf ("rwlock_init failed: %d\n", ret);
+      return 1;
+    }
+
+  if ((ret = pthread_rwlock_rdlock (&r)) != 0)
+    {
+      printf ("rwlock_rdlock failed: %d\n", ret);
+      return 1;
+    }
+
+  if ((ret = pthread_rwlock_unlock (&r)) != 0)
+    {
+      printf ("rwlock_unlock failed: %d\n", ret);
+      return 1;
+    }
+
+  if ((ret = pthread_rwlock_wrlock (&r)) != 0)
+    {
+      printf ("rwlock_wrlock failed: %d\n", ret);
+      return 1;
+    }
+
+  if ((ret = pthread_rwlock_unlock (&r)) != 0)
+    {
+      printf ("second rwlock_unlock failed: %d\n", ret);
+      return 1;
+    }
+
+  if ((ret = pthread_rwlock_destroy (&r)) != 0)
+    {
+      printf ("second rwlock_destroy failed: %d\n", ret);
+      return 1;
+    }
+
+  return 0;
+}
+
+#define TEST_FUNCTION do_test ()
+#include "../test-skeleton.c"
diff --git a/ap/build/uClibc/test/nptl/tst-rwlock14.c b/ap/build/uClibc/test/nptl/tst-rwlock14.c
new file mode 100644
index 0000000..fc0d3d2
--- /dev/null
+++ b/ap/build/uClibc/test/nptl/tst-rwlock14.c
@@ -0,0 +1,169 @@
+/* Copyright (C) 2004 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+   Contributed by Ulrich Drepper <drepper@redhat.com>, 2004.
+
+   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 <errno.h>
+#include <pthread.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <time.h>
+
+
+static pthread_barrier_t b;
+static pthread_rwlock_t r = PTHREAD_RWLOCK_INITIALIZER;
+
+
+static void *
+tf (void *arg)
+{
+  /* Lock the read-write lock.  */
+  if (pthread_rwlock_wrlock (&r) != 0)
+    {
+      puts ("tf: cannot lock rwlock");
+      exit (EXIT_FAILURE);
+    }
+
+  pthread_t mt = *(pthread_t *) arg;
+
+  pthread_barrier_wait (&b);
+
+  /* This call will never return.  */
+  pthread_join (mt, NULL);
+
+  return NULL;
+}
+
+
+static int
+do_test (void)
+{
+  int result = 0;
+  struct timespec ts;
+
+  if (clock_gettime (CLOCK_REALTIME, &ts) != 0)
+    {
+      puts ("clock_gettime failed");
+      return 1;
+    }
+
+  if (pthread_barrier_init (&b, NULL, 2) != 0)
+    {
+      puts ("barrier_init failed");
+      return 1;
+    }
+
+  pthread_t me = pthread_self ();
+  pthread_t th;
+  if (pthread_create (&th, NULL, tf, &me) != 0)
+    {
+      puts ("create failed");
+      return 1;
+    }
+
+  /* Wait until the rwlock is locked.  */
+  pthread_barrier_wait (&b);
+
+  ts.tv_nsec = -1;
+
+  int e = pthread_rwlock_timedrdlock (&r, &ts);
+  if (e == 0)
+    {
+      puts ("first rwlock_timedrdlock did not fail");
+      result = 1;
+    }
+  else if (e != EINVAL)
+    {
+      puts ("first rwlock_timedrdlock did not return EINVAL");
+      result = 1;
+    }
+
+  e = pthread_rwlock_timedwrlock (&r, &ts);
+  if (e == 0)
+    {
+      puts ("first rwlock_timedwrlock did not fail");
+      result = 1;
+    }
+  else if (e != EINVAL)
+    {
+      puts ("first rwlock_timedwrlock did not return EINVAL");
+      result = 1;
+    }
+
+  ts.tv_nsec = 1000000000;
+
+  e = pthread_rwlock_timedrdlock (&r, &ts);
+  if (e == 0)
+    {
+      puts ("second rwlock_timedrdlock did not fail");
+      result = 1;
+    }
+  else if (e != EINVAL)
+    {
+      puts ("second rwlock_timedrdlock did not return EINVAL");
+      result = 1;
+    }
+
+  e = pthread_rwlock_timedrdlock (&r, &ts);
+  if (e == 0)
+    {
+      puts ("second rwlock_timedrdlock did not fail");
+      result = 1;
+    }
+  else if (e != EINVAL)
+    {
+      puts ("second rwlock_timedrdlock did not return EINVAL");
+      result = 1;
+    }
+
+  ts.tv_nsec = 0x100001000LL;
+  if (ts.tv_nsec != 0x100001000LL)
+    ts.tv_nsec = 2000000000;
+
+  e = pthread_rwlock_timedrdlock (&r, &ts);
+  if (e == 0)
+    {
+      puts ("third rwlock_timedrdlock did not fail");
+      result = 1;
+    }
+  else if (e != EINVAL)
+    {
+      puts ("third rwlock_timedrdlock did not return EINVAL");
+      result = 1;
+    }
+
+  e = pthread_rwlock_timedrdlock (&r, &ts);
+  if (e == 0)
+    {
+      puts ("third rwlock_timedrdlock did not fail");
+      result = 1;
+    }
+  else if (e != EINVAL)
+    {
+      puts ("third rwlock_timedrdlock did not return EINVAL");
+      result = 1;
+    }
+
+  if (result == 0)
+    puts ("no bugs");
+
+  return result;
+}
+
+
+#define TEST_FUNCTION do_test ()
+#include "../test-skeleton.c"
diff --git a/ap/build/uClibc/test/nptl/tst-rwlock2.c b/ap/build/uClibc/test/nptl/tst-rwlock2.c
new file mode 100644
index 0000000..6f38682
--- /dev/null
+++ b/ap/build/uClibc/test/nptl/tst-rwlock2.c
@@ -0,0 +1,143 @@
+/* Copyright (C) 2002 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+   Contributed by Ulrich Drepper <drepper@redhat.com>, 2002.
+
+   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 <errno.h>
+#include <pthread.h>
+#include <stdio.h>
+
+
+static int
+do_test (void)
+{
+  pthread_rwlock_t r;
+  int e;
+
+  if (pthread_rwlock_init (&r, NULL) != 0)
+    {
+      puts ("rwlock_init failed");
+      return 1;
+    }
+  puts ("rwlock_init succeeded");
+
+  if (pthread_rwlock_wrlock (&r) != 0)
+    {
+      puts ("1st rwlock_wrlock failed");
+      return 1;
+    }
+  puts ("1st rwlock_wrlock succeeded");
+
+  e = pthread_rwlock_tryrdlock (&r);
+  if (e == 0)
+    {
+      puts ("rwlock_tryrdlock on rwlock with writer succeeded");
+      return 1;
+    }
+  if (e != EBUSY)
+    {
+      puts ("rwlock_tryrdlock on rwlock with writer return value != EBUSY");
+      return 1;
+    }
+  puts ("rwlock_tryrdlock on rwlock with writer failed with EBUSY");
+
+  e = pthread_rwlock_trywrlock (&r);
+  if (e == 0)
+    {
+      puts ("rwlock_trywrlock on rwlock with writer succeeded");
+      return 1;
+    }
+  if (e != EBUSY)
+    {
+      puts ("rwlock_trywrlock on rwlock with writer return value != EBUSY");
+      return 1;
+    }
+  puts ("rwlock_trywrlock on rwlock with writer failed with EBUSY");
+
+  if (pthread_rwlock_unlock (&r) != 0)
+    {
+      puts ("1st rwlock_unlock failed");
+      return 1;
+    }
+  puts ("1st rwlock_unlock succeeded");
+
+  if (pthread_rwlock_tryrdlock (&r) != 0)
+    {
+      puts ("rwlock_tryrdlock on unlocked rwlock failed");
+      return 1;
+    }
+  puts ("rwlock_tryrdlock on unlocked rwlock succeeded");
+
+  e = pthread_rwlock_trywrlock (&r);
+  if (e == 0)
+    {
+      puts ("rwlock_trywrlock on rwlock with reader succeeded");
+      return 1;
+    }
+  if (e != EBUSY)
+    {
+      puts ("rwlock_trywrlock on rwlock with reader return value != EBUSY");
+      return 1;
+    }
+  puts ("rwlock_trywrlock on rwlock with reader failed with EBUSY");
+
+  if (pthread_rwlock_unlock (&r) != 0)
+    {
+      puts ("2nd rwlock_unlock failed");
+      return 1;
+    }
+  puts ("2nd rwlock_unlock succeeded");
+
+  if (pthread_rwlock_trywrlock (&r) != 0)
+    {
+      puts ("rwlock_trywrlock on unlocked rwlock failed");
+      return 1;
+    }
+  puts ("rwlock_trywrlock on unlocked rwlock succeeded");
+
+  e = pthread_rwlock_tryrdlock (&r);
+  if (e == 0)
+    {
+      puts ("rwlock_tryrdlock on rwlock with writer succeeded");
+      return 1;
+    }
+  if (e != EBUSY)
+    {
+      puts ("rwlock_tryrdlock on rwlock with writer return value != EBUSY");
+      return 1;
+    }
+  puts ("rwlock_tryrdlock on rwlock with writer failed with EBUSY");
+
+  if (pthread_rwlock_unlock (&r) != 0)
+    {
+      puts ("3rd rwlock_unlock failed");
+      return 1;
+    }
+  puts ("3rd rwlock_unlock succeeded");
+
+  if (pthread_rwlock_destroy (&r) != 0)
+    {
+      puts ("rwlock_destroy failed");
+      return 1;
+    }
+  puts ("rwlock_destroy succeeded");
+
+  return 0;
+}
+
+#define TEST_FUNCTION do_test ()
+#include "../test-skeleton.c"
diff --git a/ap/build/uClibc/test/nptl/tst-rwlock2a.c b/ap/build/uClibc/test/nptl/tst-rwlock2a.c
new file mode 100644
index 0000000..615de5c
--- /dev/null
+++ b/ap/build/uClibc/test/nptl/tst-rwlock2a.c
@@ -0,0 +1,2 @@
+#define TYPE PTHREAD_RWLOCK_PREFER_WRITER_NONRECURSIVE_NP
+#include "tst-rwlock2.c"
diff --git a/ap/build/uClibc/test/nptl/tst-rwlock3.c b/ap/build/uClibc/test/nptl/tst-rwlock3.c
new file mode 100644
index 0000000..c1cac87
--- /dev/null
+++ b/ap/build/uClibc/test/nptl/tst-rwlock3.c
@@ -0,0 +1,93 @@
+/* Copyright (C) 2002 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+   Contributed by Ulrich Drepper <drepper@redhat.com>, 2002.
+
+   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.  */
+
+/* This test case checks more than standard compliance.  An
+   implementation may provide this service but it is not required to
+   do so.  */
+
+#include <errno.h>
+#include <pthread.h>
+#include <stdio.h>
+
+
+static int
+do_test (void)
+{
+  pthread_rwlock_t r;
+  int e;
+
+  if (pthread_rwlock_init (&r, NULL) != 0)
+    {
+      puts ("rwlock_init failed");
+      return 1;
+    }
+  puts ("rwlock_init succeeded");
+
+  if (pthread_rwlock_trywrlock (&r) != 0)
+    {
+      puts ("rwlock_trywrlock on unlocked rwlock failed");
+      return 1;
+    }
+  puts ("rwlock_trywrlock on unlocked rwlock succeeded");
+
+  e = pthread_rwlock_rdlock (&r);
+  if (e == 0)
+    {
+      puts ("rwlock_rdlock on rwlock with writer succeeded");
+      return 1;
+    }
+  if (e != EDEADLK)
+    {
+      puts ("rwlock_rdlock on rwlock with writer failed != EDEADLK");
+      return 1;
+    }
+  puts ("rwlock_rdlock on rwlock with writer failed with EDEADLK");
+
+  e = pthread_rwlock_wrlock (&r);
+  if (e == 0)
+    {
+      puts ("rwlock_wrlock on rwlock with writer succeeded");
+      return 1;
+    }
+  if (e != EDEADLK)
+    {
+      puts ("rwlock_wrlock on rwlock with writer failed != EDEADLK");
+      return 1;
+    }
+  puts ("rwlock_wrlock on rwlock with writer failed with EDEADLK");
+
+  if (pthread_rwlock_unlock (&r) != 0)
+    {
+      puts ("rwlock_unlock failed");
+      return 1;
+    }
+  puts ("rwlock_unlock succeeded");
+
+  if (pthread_rwlock_destroy (&r) != 0)
+    {
+      puts ("rwlock_destroy failed");
+      return 1;
+    }
+  puts ("rwlock_destroy succeeded");
+
+  return 0;
+}
+
+#define TEST_FUNCTION do_test ()
+#include "../test-skeleton.c"
diff --git a/ap/build/uClibc/test/nptl/tst-rwlock4.c b/ap/build/uClibc/test/nptl/tst-rwlock4.c
new file mode 100644
index 0000000..8de0121
--- /dev/null
+++ b/ap/build/uClibc/test/nptl/tst-rwlock4.c
@@ -0,0 +1,190 @@
+/* Copyright (C) 2002, 2003, 2004 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+   Contributed by Ulrich Drepper <drepper@redhat.com>, 2002.
+
+   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 <errno.h>
+#include <pthread.h>
+#include <stdint.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <unistd.h>
+#include <sys/mman.h>
+#include <sys/wait.h>
+
+
+static int
+do_test (void)
+{
+  size_t ps = sysconf (_SC_PAGESIZE);
+  char tmpfname[] = "/tmp/tst-rwlock4.XXXXXX";
+  char data[ps];
+  void *mem;
+  int fd;
+  pthread_rwlock_t *r;
+  pthread_rwlockattr_t a;
+  pid_t pid;
+  char *p;
+  int err;
+  int s;
+
+  fd = mkstemp (tmpfname);
+  if (fd == -1)
+    {
+      printf ("cannot open temporary file: %m\n");
+      return 1;
+    }
+
+  /* Make sure it is always removed.  */
+  unlink (tmpfname);
+
+  /* Create one page of data.  */
+  memset (data, '\0', ps);
+
+  /* Write the data to the file.  */
+  if (write (fd, data, ps) != (ssize_t) ps)
+    {
+      puts ("short write");
+      return 1;
+    }
+
+  mem = mmap (NULL, ps, PROT_READ | PROT_WRITE, MAP_SHARED, fd, 0);
+  if (mem == MAP_FAILED)
+    {
+      printf ("mmap failed: %m\n");
+      return 1;
+    }
+
+  r = (pthread_rwlock_t *) (((uintptr_t) mem + __alignof (pthread_rwlock_t))
+			    & ~(__alignof (pthread_rwlock_t) - 1));
+  p = (char *) (r + 1);
+
+  if (pthread_rwlockattr_init (&a) != 0)
+    {
+      puts ("rwlockattr_init failed");
+      return 1;
+    }
+
+  if (pthread_rwlockattr_getpshared (&a, &s) != 0)
+    {
+      puts ("1st rwlockattr_getpshared failed");
+      return 1;
+    }
+
+  if (s != PTHREAD_PROCESS_PRIVATE)
+    {
+      puts ("default pshared value wrong");
+      return 1;
+    }
+
+  if (pthread_rwlockattr_setpshared (&a, PTHREAD_PROCESS_SHARED) != 0)
+    {
+      puts ("rwlockattr_setpshared failed");
+      return 1;
+    }
+
+  if (pthread_rwlockattr_getpshared (&a, &s) != 0)
+    {
+      puts ("2nd rwlockattr_getpshared failed");
+      return 1;
+    }
+
+  if (s != PTHREAD_PROCESS_SHARED)
+    {
+      puts ("pshared value after setpshared call wrong");
+      return 1;
+    }
+
+  if (pthread_rwlock_init (r, &a) != 0)
+    {
+      puts ("rwlock_init failed");
+      return 1;
+    }
+
+  if (pthread_rwlock_rdlock (r) != 0)
+    {
+      puts ("rwlock_rdlock failed");
+      return 1;
+    }
+
+  if (pthread_rwlockattr_destroy (&a) != 0)
+    {
+      puts ("rwlockattr_destroy failed");
+      return 1;
+    }
+
+  err = pthread_rwlock_trywrlock (r);
+  if (err == 0)
+    {
+      puts ("rwlock_trywrlock succeeded");
+      return 1;
+    }
+  else if (err != EBUSY)
+    {
+      puts ("rwlock_trywrlock didn't return EBUSY");
+      return 1;
+    }
+
+  *p = 0;
+
+  puts ("going to fork now");
+  pid = fork ();
+  if (pid == -1)
+    {
+      puts ("fork failed");
+      return 1;
+    }
+  else if (pid == 0)
+    {
+      /* Play some lock ping-pong.  It's our turn to unlock first.  */
+      if ((*p)++ != 0)
+	{
+	  puts ("child: *p != 0");
+	  return 1;
+	}
+
+      if (pthread_rwlock_unlock (r) != 0)
+	{
+	  puts ("child: 1st rwlock_unlock failed");
+	  return 1;
+	}
+
+      puts ("child done");
+    }
+  else
+    {
+      if (pthread_rwlock_wrlock (r) != 0)
+	{
+	  puts ("parent: rwlock_wrlock failed");
+	  return 1;
+	}
+
+      if (*p != 1)
+	{
+	  puts ("*p != 1");
+	  return 1;
+	}
+
+      puts ("parent done");
+    }
+
+  return 0;
+}
+
+#define TEST_FUNCTION do_test ()
+#include "../test-skeleton.c"
diff --git a/ap/build/uClibc/test/nptl/tst-rwlock5.c b/ap/build/uClibc/test/nptl/tst-rwlock5.c
new file mode 100644
index 0000000..a04eb26
--- /dev/null
+++ b/ap/build/uClibc/test/nptl/tst-rwlock5.c
@@ -0,0 +1,87 @@
+/* Copyright (C) 2002 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+   Contributed by Ulrich Drepper <drepper@redhat.com>, 2002.
+
+   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>
+#include <signal.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <unistd.h>
+
+
+static pthread_mutex_t m = PTHREAD_MUTEX_INITIALIZER;
+static pthread_rwlock_t r;
+
+
+static void *
+tf (void *arg)
+{
+  if (pthread_rwlock_wrlock (&r) == 0)
+    {
+      puts ("child: rwlock_wrlock succeeded");
+      exit (1);
+    }
+
+  puts ("child: rwlock_wrlock returned");
+
+  exit (1);
+}
+
+
+static int
+do_test (void)
+{
+  pthread_t th;
+
+  if (pthread_rwlock_init (&r, NULL) != 0)
+    {
+      puts ("rwlock_init failed");
+      return 1;
+    }
+
+  if (pthread_rwlock_wrlock (&r) != 0)
+    {
+      puts ("rwlock_wrlock failed");
+      return 1;
+    }
+
+  if (pthread_mutex_lock (&m) != 0)
+    {
+      puts ("mutex_lock failed");
+      return 1;
+    }
+
+  /* Set an alarm for 1 second.  The wrapper will expect this.  */
+  alarm (1);
+
+  if (pthread_create (&th, NULL, tf, NULL) != 0)
+    {
+      puts ("create failed");
+      return 1;
+    }
+
+  /* This call should never return.  */
+  pthread_mutex_lock (&m);
+
+  puts ("2nd mutex_lock returned");
+  return 1;
+}
+
+#define EXPECTED_SIGNAL SIGALRM
+#define TEST_FUNCTION do_test ()
+#include "../test-skeleton.c"
diff --git a/ap/build/uClibc/test/nptl/tst-rwlock6.c b/ap/build/uClibc/test/nptl/tst-rwlock6.c
new file mode 100644
index 0000000..3b525b9
--- /dev/null
+++ b/ap/build/uClibc/test/nptl/tst-rwlock6.c
@@ -0,0 +1,226 @@
+/* Copyright (C) 2002, 2003 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+   Contributed by Ulrich Drepper <drepper@redhat.com>, 2002.
+
+   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 <errno.h>
+#include <pthread.h>
+#include <stdlib.h>
+#include <stdio.h>
+#include <string.h>
+#include <sys/time.h>
+
+
+static int kind[] =
+  {
+    PTHREAD_RWLOCK_PREFER_READER_NP,
+    PTHREAD_RWLOCK_PREFER_WRITER_NONRECURSIVE_NP,
+    PTHREAD_RWLOCK_PREFER_WRITER_NP,
+  };
+
+
+static void *
+tf (void *arg)
+{
+  pthread_rwlock_t *r = arg;
+
+  /* Timeout: 0.3 secs.  */
+  struct timeval tv;
+  (void) gettimeofday (&tv, NULL);
+
+  struct timespec ts;
+  TIMEVAL_TO_TIMESPEC (&tv, &ts);
+  ts.tv_nsec += 300000000;
+  if (ts.tv_nsec >= 1000000000)
+    {
+      ts.tv_nsec -= 1000000000;
+      ++ts.tv_sec;
+    }
+
+  puts ("child calling timedrdlock");
+
+  int err = pthread_rwlock_timedrdlock (r, &ts);
+  if (err == 0)
+    {
+      puts ("rwlock_timedrdlock returned");
+      pthread_exit ((void *) 1l);
+    }
+
+  if (err != ETIMEDOUT)
+    {
+      printf ("err = %s (%d), expected %s (%d)\n",
+	      strerror (err), err, strerror (ETIMEDOUT), ETIMEDOUT);
+      pthread_exit ((void *) 1l);
+    }
+
+  puts ("1st child timedrdlock done");
+
+  struct timeval tv2;
+  (void) gettimeofday (&tv2, NULL);
+
+  timersub (&tv2, &tv, &tv);
+
+  if (tv.tv_usec < 200000)
+    {
+      puts ("timeout too short");
+      pthread_exit ((void *) 1l);
+    }
+
+  (void) gettimeofday (&tv, NULL);
+  TIMEVAL_TO_TIMESPEC (&tv, &ts);
+  ts.tv_sec += 10;
+  /* Note that the following operation makes ts invalid.  */
+  ts.tv_nsec += 1000000000;
+
+  err = pthread_rwlock_timedrdlock (r, &ts);
+  if (err == 0)
+    {
+      puts ("2nd timedrdlock succeeded");
+      pthread_exit ((void *) 1l);
+    }
+  if (err != EINVAL)
+    {
+      puts ("2nd timedrdlock did not return EINVAL");
+      pthread_exit ((void *) 1l);
+    }
+
+  puts ("2nd child timedrdlock done");
+
+  return NULL;
+}
+
+
+static int
+do_test (void)
+{
+  size_t cnt;
+  for (cnt = 0; cnt < sizeof (kind) / sizeof (kind[0]); ++cnt)
+    {
+      pthread_rwlock_t r;
+      pthread_rwlockattr_t a;
+
+      if (pthread_rwlockattr_init (&a) != 0)
+	{
+	  printf ("round %Zu: rwlockattr_t failed\n", cnt);
+	  exit (1);
+	}
+
+      if (pthread_rwlockattr_setkind_np (&a, kind[cnt]) != 0)
+	{
+	  printf ("round %Zu: rwlockattr_setkind failed\n", cnt);
+	  exit (1);
+	}
+
+      if (pthread_rwlock_init (&r, &a) != 0)
+	{
+	  printf ("round %Zu: rwlock_init failed\n", cnt);
+	  exit (1);
+	}
+
+      if (pthread_rwlockattr_destroy (&a) != 0)
+	{
+	  printf ("round %Zu: rwlockattr_destroy failed\n", cnt);
+	  exit (1);
+	}
+
+      struct timeval tv;
+      (void) gettimeofday (&tv, NULL);
+
+      struct timespec ts;
+      TIMEVAL_TO_TIMESPEC (&tv, &ts);
+
+      ++ts.tv_sec;
+
+      /* Get a write lock.  */
+      int e = pthread_rwlock_timedwrlock (&r, &ts);
+      if (e != 0)
+	{
+	  printf ("round %Zu: rwlock_timedwrlock failed (%d)\n", cnt, e);
+	  exit (1);
+	}
+
+      puts ("1st timedwrlock done");
+
+      (void) gettimeofday (&tv, NULL);
+      TIMEVAL_TO_TIMESPEC (&tv, &ts);
+      ++ts.tv_sec;
+      e = pthread_rwlock_timedrdlock (&r, &ts);
+      if (e == 0)
+	{
+	  puts ("timedrdlock succeeded");
+	  exit (1);
+	}
+      if (e != EDEADLK)
+	{
+	  puts ("timedrdlock did not return EDEADLK");
+	  exit (1);
+	}
+
+      puts ("1st timedrdlock done");
+
+      (void) gettimeofday (&tv, NULL);
+      TIMEVAL_TO_TIMESPEC (&tv, &ts);
+      ++ts.tv_sec;
+      e = pthread_rwlock_timedwrlock (&r, &ts);
+      if (e == 0)
+	{
+	  puts ("2nd timedwrlock succeeded");
+	  exit (1);
+	}
+      if (e != EDEADLK)
+	{
+	  puts ("2nd timedwrlock did not return EDEADLK");
+	  exit (1);
+	}
+
+      puts ("2nd timedwrlock done");
+
+      pthread_t th;
+      if (pthread_create (&th, NULL, tf, &r) != 0)
+	{
+	  printf ("round %Zu: create failed\n", cnt);
+	  exit (1);
+	}
+
+      puts ("started thread");
+
+      void *status;
+      if (pthread_join (th, &status) != 0)
+	{
+	  printf ("round %Zu: join failed\n", cnt);
+	  exit (1);
+	}
+      if (status != NULL)
+	{
+	  printf ("failure in round %Zu\n", cnt);
+	  exit (1);
+	}
+
+      puts ("joined thread");
+
+      if (pthread_rwlock_destroy (&r) != 0)
+	{
+	  printf ("round %Zu: rwlock_destroy failed\n", cnt);
+	  exit (1);
+	}
+    }
+
+  return 0;
+}
+
+#define TEST_FUNCTION do_test ()
+#include "../test-skeleton.c"
diff --git a/ap/build/uClibc/test/nptl/tst-rwlock7.c b/ap/build/uClibc/test/nptl/tst-rwlock7.c
new file mode 100644
index 0000000..1f34c06
--- /dev/null
+++ b/ap/build/uClibc/test/nptl/tst-rwlock7.c
@@ -0,0 +1,179 @@
+/* Copyright (C) 2002, 2003 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+   Contributed by Ulrich Drepper <drepper@redhat.com>, 2002.
+
+   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 <errno.h>
+#include <pthread.h>
+#include <stdlib.h>
+#include <stdio.h>
+#include <string.h>
+#include <sys/time.h>
+
+
+static int kind[] =
+  {
+    PTHREAD_RWLOCK_PREFER_READER_NP,
+    PTHREAD_RWLOCK_PREFER_WRITER_NONRECURSIVE_NP,
+    PTHREAD_RWLOCK_PREFER_WRITER_NP,
+  };
+
+
+static void *
+tf (void *arg)
+{
+  pthread_rwlock_t *r = arg;
+
+  /* Timeout: 0.3 secs.  */
+  struct timeval tv;
+  (void) gettimeofday (&tv, NULL);
+
+  struct timespec ts;
+  TIMEVAL_TO_TIMESPEC (&tv, &ts);
+  ts.tv_nsec += 300000000;
+  if (ts.tv_nsec >= 1000000000)
+    {
+      ts.tv_nsec -= 1000000000;
+      ++ts.tv_sec;
+    }
+
+  int err = pthread_rwlock_timedwrlock (r, &ts);
+  if (err == 0)
+    {
+      puts ("rwlock_timedwrlock returned");
+      pthread_exit ((void *) 1l);
+    }
+
+  if (err != ETIMEDOUT)
+    {
+      printf ("err = %s (%d), expected %s (%d)\n",
+	      strerror (err), err, strerror (ETIMEDOUT), ETIMEDOUT);
+      pthread_exit ((void *) 1l);
+    }
+
+  struct timeval tv2;
+  (void) gettimeofday (&tv2, NULL);
+
+  timersub (&tv2, &tv, &tv);
+
+  if (tv.tv_usec < 200000)
+    {
+      puts ("timeout too short");
+      pthread_exit ((void *) 1l);
+    }
+
+  (void) gettimeofday (&tv, NULL);
+  TIMEVAL_TO_TIMESPEC (&tv, &ts);
+  ts.tv_sec += 10;
+  /* Note that the following operation makes ts invalid.  */
+  ts.tv_nsec += 1000000000;
+
+  err = pthread_rwlock_timedwrlock (r, &ts);
+  if (err == 0)
+    {
+      puts ("2nd timedwrlock succeeded");
+      pthread_exit ((void *) 1l);
+    }
+  if (err != EINVAL)
+    {
+      puts ("2nd timedwrlock did not return EINVAL");
+      pthread_exit ((void *) 1l);
+    }
+
+  return NULL;
+}
+
+
+static int
+do_test (void)
+{
+  size_t cnt;
+  for (cnt = 0; cnt < sizeof (kind) / sizeof (kind[0]); ++cnt)
+    {
+      pthread_rwlock_t r;
+      pthread_rwlockattr_t a;
+
+      if (pthread_rwlockattr_init (&a) != 0)
+	{
+	  printf ("round %Zu: rwlockattr_t failed\n", cnt);
+	  exit (1);
+	}
+
+      if (pthread_rwlockattr_setkind_np (&a, kind[cnt]) != 0)
+	{
+	  printf ("round %Zu: rwlockattr_setkind failed\n", cnt);
+	  exit (1);
+	}
+
+      if (pthread_rwlock_init (&r, &a) != 0)
+	{
+	  printf ("round %Zu: rwlock_init failed\n", cnt);
+	  exit (1);
+	}
+
+      if (pthread_rwlockattr_destroy (&a) != 0)
+	{
+	  printf ("round %Zu: rwlockattr_destroy failed\n", cnt);
+	  exit (1);
+	}
+
+      struct timeval tv;
+      (void) gettimeofday (&tv, NULL);
+
+      struct timespec ts;
+      TIMEVAL_TO_TIMESPEC (&tv, &ts);
+
+      ++ts.tv_sec;
+
+      /* Get a read lock.  */
+      if (pthread_rwlock_timedrdlock (&r, &ts) != 0)
+	{
+	  printf ("round %Zu: rwlock_timedrdlock failed\n", cnt);
+	  exit (1);
+	}
+
+      pthread_t th;
+      if (pthread_create (&th, NULL, tf, &r) != 0)
+	{
+	  printf ("round %Zu: create failed\n", cnt);
+	  exit (1);
+	}
+
+      void *status;
+      if (pthread_join (th, &status) != 0)
+	{
+	  printf ("round %Zu: join failed\n", cnt);
+	  exit (1);
+	}
+      if (status != NULL)
+	{
+	  printf ("failure in round %Zu\n", cnt);
+	  exit (1);
+	}
+
+      if (pthread_rwlock_destroy (&r) != 0)
+	{
+	  printf ("round %Zu: rwlock_destroy failed\n", cnt);
+	  exit (1);
+	}
+    }
+
+  return 0;
+}
+
+#define TEST_FUNCTION do_test ()
+#include "../test-skeleton.c"
diff --git a/ap/build/uClibc/test/nptl/tst-rwlock8.c b/ap/build/uClibc/test/nptl/tst-rwlock8.c
new file mode 100644
index 0000000..7eeaea8
--- /dev/null
+++ b/ap/build/uClibc/test/nptl/tst-rwlock8.c
@@ -0,0 +1,164 @@
+/* Test program for timedout read/write lock functions.
+   Copyright (C) 2000, 2003 Free Software Foundation, Inc.
+   Contributed by Ulrich Drepper <drepper@redhat.com>, 2000.
+
+   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 <error.h>
+#include <pthread.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <time.h>
+#include <unistd.h>
+
+
+#define NWRITERS 15
+#define WRITETRIES 10
+#define NREADERS 15
+#define READTRIES 15
+
+#define DELAY   1000000
+
+#ifndef INIT
+# define INIT PTHREAD_RWLOCK_WRITER_NONRECURSIVE_INITIALIZER_NP
+#endif
+
+static pthread_rwlock_t lock = INIT;
+
+
+static void *
+writer_thread (void *nr)
+{
+  struct timespec delay;
+  int n;
+
+  delay.tv_sec = 0;
+  delay.tv_nsec = DELAY;
+
+  for (n = 0; n < WRITETRIES; ++n)
+    {
+      printf ("writer thread %ld tries again\n", (long int) nr);
+
+      if (pthread_rwlock_wrlock (&lock) != 0)
+	{
+	  puts ("wrlock failed");
+	  exit (1);
+	}
+
+      printf ("writer thread %ld succeeded\n", (long int) nr);
+
+      nanosleep (&delay, NULL);
+
+      if (pthread_rwlock_unlock (&lock) != 0)
+	{
+	  puts ("unlock for writer failed");
+	  exit (1);
+	}
+
+      printf ("writer thread %ld released\n", (long int) nr);
+    }
+
+  return NULL;
+}
+
+
+static void *
+reader_thread (void *nr)
+{
+  struct timespec delay;
+  int n;
+
+  delay.tv_sec = 0;
+  delay.tv_nsec = DELAY;
+
+  for (n = 0; n < READTRIES; ++n)
+    {
+      printf ("reader thread %ld tries again\n", (long int) nr);
+
+      if (pthread_rwlock_rdlock (&lock) != 0)
+	{
+	  puts ("rdlock failed");
+	  exit (1);
+	}
+
+      printf ("reader thread %ld succeeded\n", (long int) nr);
+
+      nanosleep (&delay, NULL);
+
+      if (pthread_rwlock_unlock (&lock) != 0)
+	{
+	  puts ("unlock for reader failed");
+	  exit (1);
+	}
+
+      printf ("reader thread %ld released\n", (long int) nr);
+    }
+
+  return NULL;
+}
+
+
+static int
+do_test (void)
+{
+  pthread_t thwr[NWRITERS];
+  pthread_t thrd[NREADERS];
+  int n;
+  void *res;
+
+  /* Make standard error the same as standard output.  */
+  dup2 (1, 2);
+
+  /* Make sure we see all message, even those on stdout.  */
+  setvbuf (stdout, NULL, _IONBF, 0);
+
+  for (n = 0; n < NWRITERS; ++n)
+    if (pthread_create (&thwr[n], NULL, writer_thread,
+			(void *) (long int) n) != 0)
+      {
+	puts ("writer create failed");
+	exit (1);
+      }
+
+  for (n = 0; n < NREADERS; ++n)
+    if (pthread_create (&thrd[n], NULL, reader_thread,
+			(void *) (long int) n) != 0)
+      {
+	puts ("reader create failed");
+	exit (1);
+      }
+
+  /* Wait for all the threads.  */
+  for (n = 0; n < NWRITERS; ++n)
+    if (pthread_join (thwr[n], &res) != 0)
+      {
+	puts ("writer join failed");
+	exit (1);
+      }
+  for (n = 0; n < NREADERS; ++n)
+    if (pthread_join (thrd[n], &res) != 0)
+      {
+	puts ("reader join failed");
+	exit (1);
+      }
+
+  return 0;
+}
+
+#define TIMEOUT 30
+#define TEST_FUNCTION do_test ()
+#include "../test-skeleton.c"
diff --git a/ap/build/uClibc/test/nptl/tst-rwlock9.c b/ap/build/uClibc/test/nptl/tst-rwlock9.c
new file mode 100644
index 0000000..a5522ce
--- /dev/null
+++ b/ap/build/uClibc/test/nptl/tst-rwlock9.c
@@ -0,0 +1,203 @@
+/* Test program for timedout read/write lock functions.
+   Copyright (C) 2000, 2003 Free Software Foundation, Inc.
+   Contributed by Ulrich Drepper <drepper@redhat.com>, 2000.
+
+   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 <error.h>
+#include <pthread.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <time.h>
+#include <unistd.h>
+#include <sys/time.h>
+
+
+#define NWRITERS 15
+#define WRITETRIES 10
+#define NREADERS 15
+#define READTRIES 15
+
+#define TIMEOUT 1000000
+#define DELAY   1000000
+
+#ifndef INIT
+# define INIT PTHREAD_RWLOCK_WRITER_NONRECURSIVE_INITIALIZER_NP
+#endif
+
+static pthread_rwlock_t lock = INIT;
+
+
+static void *
+writer_thread (void *nr)
+{
+  struct timespec ts;
+  struct timespec delay;
+  int n;
+
+  delay.tv_sec = 0;
+  delay.tv_nsec = DELAY;
+
+  for (n = 0; n < WRITETRIES; ++n)
+    {
+      int e;
+      do
+	{
+	  struct timeval tv;
+	  (void) gettimeofday (&tv, NULL);
+	  TIMEVAL_TO_TIMESPEC (&tv, &ts);
+
+	  ts.tv_nsec += 2 * TIMEOUT;
+	  if (ts.tv_nsec >= 1000000000)
+	    {
+	      ts.tv_nsec -= 1000000000;
+	      ++ts.tv_sec;
+	    }
+
+	  printf ("writer thread %ld tries again\n", (long int) nr);
+
+	  e = pthread_rwlock_timedwrlock (&lock, &ts);
+	  if (e != 0 && e != ETIMEDOUT)
+	    {
+	      puts ("timedwrlock failed");
+	      exit (1);
+	    }
+	}
+      while (e == ETIMEDOUT);
+
+      printf ("writer thread %ld succeeded\n", (long int) nr);
+
+      nanosleep (&delay, NULL);
+
+      if (pthread_rwlock_unlock (&lock) != 0)
+	{
+	  puts ("unlock for writer failed");
+	  exit (1);
+	}
+
+      printf ("writer thread %ld released\n", (long int) nr);
+    }
+
+  return NULL;
+}
+
+
+static void *
+reader_thread (void *nr)
+{
+  struct timespec ts;
+  struct timespec delay;
+  int n;
+
+  delay.tv_sec = 0;
+  delay.tv_nsec = DELAY;
+
+  for (n = 0; n < READTRIES; ++n)
+    {
+      int e;
+      do
+	{
+	  struct timeval tv;
+	  (void) gettimeofday (&tv, NULL);
+	  TIMEVAL_TO_TIMESPEC (&tv, &ts);
+
+	  ts.tv_nsec += TIMEOUT;
+	  if (ts.tv_nsec >= 1000000000)
+	    {
+	      ts.tv_nsec -= 1000000000;
+	      ++ts.tv_sec;
+	    }
+
+	  printf ("reader thread %ld tries again\n", (long int) nr);
+
+	  e = pthread_rwlock_timedrdlock (&lock, &ts);
+	  if (e != 0 && e != ETIMEDOUT)
+	    {
+	      puts ("timedrdlock failed");
+	      exit (1);
+	    }
+	}
+      while (e == ETIMEDOUT);
+
+      printf ("reader thread %ld succeeded\n", (long int) nr);
+
+      nanosleep (&delay, NULL);
+
+      if (pthread_rwlock_unlock (&lock) != 0)
+	{
+	  puts ("unlock for reader failed");
+	  exit (1);
+	}
+
+      printf ("reader thread %ld released\n", (long int) nr);
+    }
+
+  return NULL;
+}
+
+
+static int
+do_test (void)
+{
+  pthread_t thwr[NWRITERS];
+  pthread_t thrd[NREADERS];
+  int n;
+  void *res;
+
+  /* Make standard error the same as standard output.  */
+  dup2 (1, 2);
+
+  /* Make sure we see all message, even those on stdout.  */
+  setvbuf (stdout, NULL, _IONBF, 0);
+
+  for (n = 0; n < NWRITERS; ++n)
+    if (pthread_create (&thwr[n], NULL, writer_thread,
+			(void *) (long int) n) != 0)
+      {
+	puts ("writer create failed");
+	exit (1);
+      }
+
+  for (n = 0; n < NREADERS; ++n)
+    if (pthread_create (&thrd[n], NULL, reader_thread,
+			(void *) (long int) n) != 0)
+      {
+	puts ("reader create failed");
+	exit (1);
+      }
+
+  /* Wait for all the threads.  */
+  for (n = 0; n < NWRITERS; ++n)
+    if (pthread_join (thwr[n], &res) != 0)
+      {
+	puts ("writer join failed");
+	exit (1);
+      }
+  for (n = 0; n < NREADERS; ++n)
+    if (pthread_join (thrd[n], &res) != 0)
+      {
+	puts ("reader join failed");
+	exit (1);
+      }
+
+  return 0;
+}
+
+#undef TIMEOUT
+#define TIMEOUT 30
+#define TEST_FUNCTION do_test ()
+#include "../test-skeleton.c"
diff --git a/ap/build/uClibc/test/nptl/tst-sched1.c b/ap/build/uClibc/test/nptl/tst-sched1.c
new file mode 100644
index 0000000..4d0702c
--- /dev/null
+++ b/ap/build/uClibc/test/nptl/tst-sched1.c
@@ -0,0 +1,98 @@
+/* Copyright (C) 2003 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+   Contributed by Ulrich Drepper <drepper@redhat.com>, 2002.
+
+   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>
+#include <stdio.h>
+#include <unistd.h>
+#include <sys/types.h>
+
+
+static int global;
+
+static void *
+tf (void *a)
+{
+  global = 1;
+
+  return 0;
+}
+
+
+int
+do_test (void)
+{
+  pthread_t th;
+  pthread_attr_t at;
+
+  if (pthread_attr_init (&at) != 0)
+    {
+      puts ("attr_init failed");
+      return 1;
+    }
+
+  if (pthread_attr_setschedpolicy (&at, SCHED_OTHER) != 0)
+    {
+      puts ("attr_setschedpolicy failed");
+      return 1;
+    }
+
+  struct sched_param pa;
+  if (sched_getparam (getpid (), &pa) != 0)
+    {
+      puts ("sched_getschedparam failed");
+      return 1;
+    }
+
+  if (pthread_attr_setschedparam (&at, &pa) != 0)
+    {
+      puts ("attr_setschedparam failed");
+      return 1;
+    }
+
+  if (pthread_attr_setinheritsched (&at, PTHREAD_EXPLICIT_SCHED) != 0)
+    {
+      puts ("attr_setinheritsched failed");
+      return 1;
+    }
+
+  if (pthread_create (&th, &at, tf, NULL) != 0)
+    {
+      puts ("create failed");
+      return 1;
+    }
+
+  int e = pthread_join (th, NULL);
+  if (e != 0)
+    {
+      printf ("join failed: %d\n", e);
+      return 1;
+    }
+
+  if (global == 0)
+    {
+      puts ("thread didn't run");
+      return 1;
+    }
+
+  return 0;
+}
+
+
+#define TEST_FUNCTION do_test ()
+#include "../test-skeleton.c"
diff --git a/ap/build/uClibc/test/nptl/tst-sem1.c b/ap/build/uClibc/test/nptl/tst-sem1.c
new file mode 100644
index 0000000..32d59eb
--- /dev/null
+++ b/ap/build/uClibc/test/nptl/tst-sem1.c
@@ -0,0 +1,89 @@
+/* Copyright (C) 2002 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+   Contributed by Ulrich Drepper <drepper@redhat.com>, 2002.
+
+   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 <errno.h>
+#include <semaphore.h>
+#include <stdio.h>
+#include <unistd.h>
+
+
+static int
+do_test (void)
+{
+  sem_t s;
+
+  if (sem_init (&s, 0, 1) == -1)
+    {
+      puts ("init failed");
+      return 1;
+    }
+
+  if (TEMP_FAILURE_RETRY (sem_wait (&s)) == -1)
+    {
+      puts ("1st wait failed");
+      return 1;
+    }
+
+  if (sem_post (&s) == -1)
+    {
+      puts ("1st post failed");
+      return 1;
+    }
+
+  if (TEMP_FAILURE_RETRY (sem_trywait (&s)) == -1)
+    {
+      puts ("1st trywait failed");
+      return 1;
+    }
+
+  errno = 0;
+  if (TEMP_FAILURE_RETRY (sem_trywait (&s)) != -1)
+    {
+      puts ("2nd trywait succeeded");
+      return 1;
+    }
+  else if (errno != EAGAIN)
+    {
+      puts ("2nd trywait did not set errno to EAGAIN");
+      return 1;
+    }
+
+  if (sem_post (&s) == -1)
+    {
+      puts ("2nd post failed");
+      return 1;
+    }
+
+  if (TEMP_FAILURE_RETRY (sem_wait (&s)) == -1)
+    {
+      puts ("2nd wait failed");
+      return 1;
+    }
+
+  if (sem_destroy (&s) == -1)
+    {
+      puts ("destroy failed");
+      return 1;
+    }
+
+  return 0;
+}
+
+#define TEST_FUNCTION do_test ()
+#include "../test-skeleton.c"
diff --git a/ap/build/uClibc/test/nptl/tst-sem10.c b/ap/build/uClibc/test/nptl/tst-sem10.c
new file mode 100644
index 0000000..9f6e870
--- /dev/null
+++ b/ap/build/uClibc/test/nptl/tst-sem10.c
@@ -0,0 +1,88 @@
+/* Copyright (C) 2007 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+   Contributed by Jakub Jelinek <jakub@redhat.com>, 2007.
+
+   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 <errno.h>
+#include <pthread.h>
+#include <semaphore.h>
+#include <stdio.h>
+#include <time.h>
+#include <unistd.h>
+#include <sys/time.h>
+
+
+static int
+do_test (void)
+{
+  sem_t s;
+  if (sem_init (&s, 0, 0) == -1)
+    {
+      puts ("sem_init failed");
+      return 1;
+    }
+
+  struct timeval tv;
+  if (gettimeofday (&tv, NULL) != 0)
+    {
+      puts ("gettimeofday failed");
+      return 1;
+    }
+
+  struct timespec ts;
+  TIMEVAL_TO_TIMESPEC (&tv, &ts);
+
+  /* Set ts to yesterday.  */
+  ts.tv_sec -= 86400;
+
+  int type_before;
+  if (pthread_setcanceltype (PTHREAD_CANCEL_DEFERRED, &type_before) != 0)
+    {
+      puts ("first pthread_setcanceltype failed");
+      return 1;
+    }
+
+  errno = 0;
+  if (TEMP_FAILURE_RETRY (sem_timedwait (&s, &ts)) != -1)
+    {
+      puts ("sem_timedwait succeeded");
+      return 1;
+    }
+  if (errno != ETIMEDOUT)
+    {
+      printf ("sem_timedwait return errno = %d instead of ETIMEDOUT\n",
+	      errno);
+      return 1;
+    }
+
+  int type_after;
+  if (pthread_setcanceltype (PTHREAD_CANCEL_DEFERRED, &type_after) != 0)
+    {
+      puts ("second pthread_setcanceltype failed");
+      return 1;
+    }
+  if (type_after != PTHREAD_CANCEL_DEFERRED)
+    {
+      puts ("sem_timedwait changed cancellation type");
+      return 1;
+    }
+
+  return 0;
+}
+
+#define TEST_FUNCTION do_test ()
+#include "../test-skeleton.c"
diff --git a/ap/build/uClibc/test/nptl/tst-sem11.c b/ap/build/uClibc/test/nptl/tst-sem11.c
new file mode 100644
index 0000000..6633ddd
--- /dev/null
+++ b/ap/build/uClibc/test/nptl/tst-sem11.c
@@ -0,0 +1,76 @@
+#include <semaphore.h>
+#include <stdio.h>
+#include <unistd.h>
+#include <pthread.h>
+#include <internaltypes.h>
+
+#ifndef SEM_WAIT
+# define SEM_WAIT(s) sem_wait (s)
+#endif
+
+static void *
+tf (void *arg)
+{
+#ifdef PREPARE
+  PREPARE
+#endif
+  SEM_WAIT (arg);
+  return NULL;
+}
+
+int
+main (void)
+{
+  int tries = 5;
+  pthread_t th;
+  sem_t s;
+ again:
+  if (sem_init (&s, 0, 0) != 0)
+    {
+      puts ("sem_init failed");
+      return 1;
+    }
+
+  struct new_sem *is = (struct new_sem *) &s;
+
+  if (is->nwaiters != 0)
+    {
+      puts ("nwaiters not initialized");
+      return 1;
+    }
+
+  if (pthread_create (&th, NULL, tf, &s) != 0)
+    {
+      puts ("pthread_create failed");
+      return 1;
+    }
+
+  sleep (1);
+
+  if (pthread_cancel (th) != 0)
+    {
+      puts ("pthread_cancel failed");
+      return 1;
+    }
+
+  void *r;
+  if (pthread_join (th, &r) != 0)
+    {
+      puts ("pthread_join failed");
+      return 1;
+    }
+  if (r != PTHREAD_CANCELED && --tries > 0)
+    {
+      /* Maybe we get the scheduling right the next time.  */
+      sem_destroy (&s);
+      goto again;
+    }
+
+  if (is->nwaiters != 0)
+    {
+      puts ("nwaiters not reset");
+      return 1;
+    }
+
+  return 0;
+}
diff --git a/ap/build/uClibc/test/nptl/tst-sem12.c b/ap/build/uClibc/test/nptl/tst-sem12.c
new file mode 100644
index 0000000..71d02b7
--- /dev/null
+++ b/ap/build/uClibc/test/nptl/tst-sem12.c
@@ -0,0 +1,14 @@
+#include <time.h>
+#include <sys/time.h>
+
+
+#define PREPARE \
+  struct timespec ts; \
+  struct timeval tv; \
+  gettimeofday (&tv, NULL); \
+  TIMEVAL_TO_TIMESPEC (&tv, &ts); \
+  ts.tv_sec += 60;
+
+#define SEM_WAIT(s) sem_timedwait (s, &ts)
+
+#include "tst-sem11.c"
diff --git a/ap/build/uClibc/test/nptl/tst-sem2.c b/ap/build/uClibc/test/nptl/tst-sem2.c
new file mode 100644
index 0000000..026939e
--- /dev/null
+++ b/ap/build/uClibc/test/nptl/tst-sem2.c
@@ -0,0 +1,54 @@
+/* Copyright (C) 2002 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+   Contributed by Ulrich Drepper <drepper@redhat.com>, 2002.
+
+   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 <errno.h>
+#include <semaphore.h>
+#include <signal.h>
+#include <stdio.h>
+#include <unistd.h>
+
+
+static int
+do_test (void)
+{
+  sem_t s;
+
+  if (sem_init (&s, 0, 0) == -1)
+    {
+      puts ("init failed");
+      return 1;
+    }
+
+  /* Set an alarm for 1 second.  The wrapper will expect this.  */
+  alarm (1);
+
+  if (TEMP_FAILURE_RETRY (sem_wait (&s)) == -1)
+    {
+      puts ("wait failed");
+      return 1;
+    }
+
+  /* We should never get here.  */
+  puts ("wait succeeded");
+  return 1;
+}
+
+#define EXPECTED_SIGNAL SIGALRM
+#define TEST_FUNCTION do_test ()
+#include "../test-skeleton.c"
diff --git a/ap/build/uClibc/test/nptl/tst-sem3.c b/ap/build/uClibc/test/nptl/tst-sem3.c
new file mode 100644
index 0000000..91b9f08
--- /dev/null
+++ b/ap/build/uClibc/test/nptl/tst-sem3.c
@@ -0,0 +1,142 @@
+/* Copyright (C) 2002, 2003 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+   Contributed by Ulrich Drepper <drepper@redhat.com>, 2002.
+
+   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 <errno.h>
+#include <semaphore.h>
+#include <stdint.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <unistd.h>
+#include <sys/mman.h>
+#include <sys/wait.h>
+
+
+int
+main (void)
+{
+  size_t ps = sysconf (_SC_PAGESIZE);
+  char tmpfname[] = "/tmp/tst-sem3.XXXXXX";
+  char data[ps];
+  void *mem;
+  int fd;
+  sem_t *s;
+  pid_t pid;
+  char *p;
+
+  fd = mkstemp (tmpfname);
+  if (fd == -1)
+    {
+      printf ("cannot open temporary file: %m\n");
+      exit (1);
+    }
+
+  /* Make sure it is always removed.  */
+  unlink (tmpfname);
+
+  /* Create one page of data.  */
+  memset (data, '\0', ps);
+
+  /* Write the data to the file.  */
+  if (write (fd, data, ps) != (ssize_t) ps)
+    {
+      puts ("short write");
+      exit (1);
+    }
+
+  mem = mmap (NULL, ps, PROT_READ | PROT_WRITE, MAP_SHARED, fd, 0);
+  if (mem == MAP_FAILED)
+    {
+      printf ("mmap failed: %m\n");
+      exit (1);
+    }
+
+  s = (sem_t *) (((uintptr_t) mem + __alignof (sem_t))
+		 & ~(__alignof (sem_t) - 1));
+  p = (char *) (s + 1);
+
+  if (sem_init (s, 1, 1) == -1)
+    {
+      puts ("init failed");
+      exit (1);
+    }
+
+  if (TEMP_FAILURE_RETRY (sem_wait (s)) == -1)
+    {
+      puts ("1st wait failed");
+      exit (1);
+    }
+
+  errno = 0;
+  if (TEMP_FAILURE_RETRY (sem_trywait (s)) != -1)
+    {
+      puts ("trywait succeeded");
+      exit (1);
+    }
+  else if (errno != EAGAIN)
+    {
+      puts ("trywait didn't return EAGAIN");
+      exit (1);
+    }
+
+  *p = 0;
+
+  puts ("going to fork now");
+  pid = fork ();
+  if (pid == -1)
+    {
+      puts ("fork failed");
+      exit (1);
+    }
+  else if (pid == 0)
+    {
+      /* Play some lock ping-pong.  It's our turn to unlock first.  */
+      if ((*p)++ != 0)
+	{
+	  puts ("child: *p != 0");
+	  exit (1);
+	}
+
+      if (sem_post (s) == -1)
+	{
+	  puts ("child: 1st post failed");
+	  exit (1);
+	}
+
+      puts ("child done");
+    }
+  else
+    {
+      if (TEMP_FAILURE_RETRY (sem_wait (s)) == -1)
+	{
+	  printf ("parent: 2nd wait failed: %m\n");
+	  exit (1);
+	}
+
+      if (*p != 1)
+	{
+	  puts ("*p != 1");
+	  exit (1);
+	}
+
+      puts ("parent done");
+    }
+
+  exit (0);
+}
diff --git a/ap/build/uClibc/test/nptl/tst-sem4.c b/ap/build/uClibc/test/nptl/tst-sem4.c
new file mode 100644
index 0000000..ccffbdd
--- /dev/null
+++ b/ap/build/uClibc/test/nptl/tst-sem4.c
@@ -0,0 +1,147 @@
+/* Copyright (C) 2002 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+   Contributed by Ulrich Drepper <drepper@redhat.com>, 2002.
+
+   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 <errno.h>
+#include <fcntl.h>
+#include <semaphore.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <unistd.h>
+
+
+static void
+remove_sem (int status, void *arg)
+{
+  sem_unlink (arg);
+}
+
+
+int
+main (void)
+{
+  sem_t *s;
+  sem_t *s2;
+  pid_t pid;
+  int val;
+
+  s = sem_open ("/glibc-tst-sem4", O_CREAT, 0600, 1);
+  if (s == SEM_FAILED)
+    {
+      if (errno == ENOSYS)
+	{
+	  puts ("sem_open not supported.  Oh well.");
+	  return 0;
+	}
+
+      /* Maybe the shm filesystem has strict permissions.  */
+      if (errno == EACCES)
+	{
+	  puts ("sem_open not allowed.  Oh well.");
+	  return 0;
+	}
+
+      printf ("sem_open: %m\n");
+      return 1;
+    }
+
+  on_exit (remove_sem, (void *) "/glibc-tst-sem4");
+
+  /* We have the semaphore object.  Now try again with O_EXCL, this
+     should fail.  */
+  s2 = sem_open ("/glibc-tst-sem4", O_CREAT | O_EXCL, 0600, 1);
+  if (s2 != SEM_FAILED)
+    {
+      puts ("2nd sem_open didn't fail");
+      return 1;
+    }
+  if (errno != EEXIST)
+    {
+      puts ("2nd sem_open returned wrong error");
+      return 1;
+    }
+
+  /* Check the value.  */
+  if (sem_getvalue (s, &val) == -1)
+    {
+      puts ("getvalue failed");
+      return 1;
+    }
+  if (val != 1)
+    {
+      printf ("initial value wrong: got %d, expected 1\n", val);
+      return 1;
+    }
+
+  if (TEMP_FAILURE_RETRY (sem_wait (s)) == -1)
+    {
+      puts ("1st sem_wait failed");
+      return 1;
+    }
+
+  pid = fork ();
+  if (pid == -1)
+    {
+      printf ("fork failed: %m\n");
+      return 1;
+    }
+
+  if (pid == 0)
+    {
+      /* Child.  */
+
+      /* Check the value.  */
+      if (sem_getvalue (s, &val) == -1)
+	{
+	  puts ("child: getvalue failed");
+	  return 1;
+	}
+      if (val != 0)
+	{
+	  printf ("child: value wrong: got %d, expect 0\n", val);
+	  return 1;
+	}
+
+      if (sem_post (s) == -1)
+	{
+	  puts ("child: post failed");
+	  return 1;
+	}
+    }
+  else
+    {
+      if (TEMP_FAILURE_RETRY (sem_wait (s)) == -1)
+	{
+	  puts ("2nd sem_wait failed");
+	  return 1;
+	}
+
+      if (sem_getvalue (s, &val) == -1)
+	{
+	  puts ("parent: 2nd getvalue failed");
+	  return 1;
+	}
+      if (val != 0)
+	{
+	  printf ("parent: value wrong: got %d, expected 0\n", val);
+	  return 1;
+	}
+    }
+
+  return 0;
+}
diff --git a/ap/build/uClibc/test/nptl/tst-sem5.c b/ap/build/uClibc/test/nptl/tst-sem5.c
new file mode 100644
index 0000000..cb85b8e
--- /dev/null
+++ b/ap/build/uClibc/test/nptl/tst-sem5.c
@@ -0,0 +1,80 @@
+/* Copyright (C) 2002, 2003 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+   Contributed by Ulrich Drepper <drepper@redhat.com>, 2002.
+
+   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 <errno.h>
+#include <semaphore.h>
+#include <stdio.h>
+#include <time.h>
+#include <unistd.h>
+#include <sys/time.h>
+
+
+static int
+do_test (void)
+{
+  sem_t s;
+  struct timespec ts;
+  struct timeval tv;
+
+  if (sem_init (&s, 0, 1) == -1)
+    {
+      puts ("sem_init failed");
+      return 1;
+    }
+
+  if (TEMP_FAILURE_RETRY (sem_wait (&s)) == -1)
+    {
+      puts ("sem_wait failed");
+      return 1;
+    }
+
+  if (gettimeofday (&tv, NULL) != 0)
+    {
+      puts ("gettimeofday failed");
+      return 1;
+    }
+
+  TIMEVAL_TO_TIMESPEC (&tv, &ts);
+
+  /* We wait for half a second.  */
+  ts.tv_nsec += 500000000;
+  if (ts.tv_nsec >= 1000000000)
+    {
+      ++ts.tv_sec;
+      ts.tv_nsec -= 1000000000;
+    }
+
+  errno = 0;
+  if (TEMP_FAILURE_RETRY (sem_timedwait (&s, &ts)) != -1)
+    {
+      puts ("sem_timedwait succeeded");
+      return 1;
+    }
+  if (errno != ETIMEDOUT)
+    {
+      printf ("sem_timedwait return errno = %d instead of ETIMEDOUT\n",
+	      errno);
+      return 1;
+    }
+
+  return 0;
+}
+
+#define TEST_FUNCTION do_test ()
+#include "../test-skeleton.c"
diff --git a/ap/build/uClibc/test/nptl/tst-sem6.c b/ap/build/uClibc/test/nptl/tst-sem6.c
new file mode 100644
index 0000000..49240d9
--- /dev/null
+++ b/ap/build/uClibc/test/nptl/tst-sem6.c
@@ -0,0 +1,81 @@
+/* Copyright (C) 2003 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, write to the Free
+   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+   02111-1307 USA.  */
+
+#include <errno.h>
+#include <semaphore.h>
+#include <signal.h>
+#include <stdio.h>
+#include <unistd.h>
+
+
+static void
+handler (int sig)
+{
+  struct sigaction sa;
+
+  sa.sa_handler = SIG_DFL;
+  sa.sa_flags = 0;
+  sigemptyset (&sa.sa_mask);
+
+  sigaction (SIGALRM, &sa, NULL);
+
+  /* Rearm the timer.  */
+  alarm (1);
+}
+
+
+static int
+do_test (void)
+{
+  sem_t s;
+  struct sigaction sa;
+
+  sa.sa_handler = handler;
+  sa.sa_flags = 0;
+  sigemptyset (&sa.sa_mask);
+
+  sigaction (SIGALRM, &sa, NULL);
+
+  if (sem_init (&s, 0, 0) == -1)
+    {
+      puts ("init failed");
+      return 1;
+    }
+
+  /* Set an alarm for 1 second.  The wrapper will expect this.  */
+  alarm (1);
+
+  int res = sem_wait (&s);
+  if (res == 0)
+    {
+      puts ("wait succeeded");
+      return 1;
+    }
+  if (res != -1 || errno != EINTR)
+    {
+      puts ("wait didn't fail with EINTR");
+      return 1;
+    }
+
+  return 0;
+}
+
+#define TIMEOUT 3
+#define TEST_FUNCTION do_test ()
+#include "../test-skeleton.c"
diff --git a/ap/build/uClibc/test/nptl/tst-sem7.c b/ap/build/uClibc/test/nptl/tst-sem7.c
new file mode 100644
index 0000000..a85c73e
--- /dev/null
+++ b/ap/build/uClibc/test/nptl/tst-sem7.c
@@ -0,0 +1,109 @@
+/* Copyright (C) 2003 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, write to the Free
+   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+   02111-1307 USA.  */
+
+#include <errno.h>
+#include <fcntl.h>
+#include <semaphore.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <unistd.h>
+
+
+static void
+remove_sem (int status, void *arg)
+{
+  sem_unlink (arg);
+}
+
+
+int
+main (void)
+{
+  sem_t *s;
+  sem_t *s2;
+  sem_t *s3;
+
+  s = sem_open ("/glibc-tst-sem7", O_CREAT, 0600, 1);
+  if (s == SEM_FAILED)
+    {
+      if (errno == ENOSYS)
+	{
+	  puts ("sem_open not supported.  Oh well.");
+	  return 0;
+	}
+
+      /* Maybe the shm filesystem has strict permissions.  */
+      if (errno == EACCES)
+	{
+	  puts ("sem_open not allowed.  Oh well.");
+	  return 0;
+	}
+
+      printf ("sem_open: %m\n");
+      return 1;
+    }
+
+  on_exit (remove_sem, (void *) "/glibc-tst-sem7");
+
+  /* We have the semaphore object.  Now try again.  We should get the
+     same address.  */
+  s2 = sem_open ("/glibc-tst-sem7", O_CREAT, 0600, 1);
+  if (s2 == SEM_FAILED)
+    {
+      puts ("2nd sem_open failed");
+      return 1;
+    }
+  if (s != s2)
+    {
+      puts ("2nd sem_open didn't return the same address");
+      return 1;
+    }
+
+  /* And again, this time without O_CREAT.  */
+  s3 = sem_open ("/glibc-tst-sem7", 0);
+  if (s3 == SEM_FAILED)
+    {
+      puts ("3rd sem_open failed");
+      return 1;
+    }
+  if (s != s3)
+    {
+      puts ("3rd sem_open didn't return the same address");
+      return 1;
+    }
+
+  /* Now close the handle.  Three times.  */
+  if (sem_close (s2) != 0)
+    {
+      puts ("1st sem_close failed");
+      return 1;
+    }
+  if (sem_close (s) != 0)
+    {
+      puts ("2nd sem_close failed");
+      return 1;
+    }
+  if (sem_close (s3) != 0)
+    {
+      puts ("3rd sem_close failed");
+      return 1;
+    }
+
+  return 0;
+}
diff --git a/ap/build/uClibc/test/nptl/tst-sem8.c b/ap/build/uClibc/test/nptl/tst-sem8.c
new file mode 100644
index 0000000..5dea575
--- /dev/null
+++ b/ap/build/uClibc/test/nptl/tst-sem8.c
@@ -0,0 +1,74 @@
+/* Copyright (C) 2003 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, write to the Free
+   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+   02111-1307 USA.  */
+
+#include <errno.h>
+#include <fcntl.h>
+#include <semaphore.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <unistd.h>
+
+
+static void
+remove_sem (int status, void *arg)
+{
+  sem_unlink (arg);
+}
+
+
+int
+main (void)
+{
+  sem_t *s;
+  int i;
+
+  on_exit (remove_sem, (void *) "/glibc-tst-sem8");
+
+  for (i = 0; i < 3; ++i)
+    {
+      s = sem_open ("/glibc-tst-sem8", O_CREAT, 0600, 1);
+      if (s == SEM_FAILED)
+	{
+	  if (errno == ENOSYS)
+	    {
+	      puts ("sem_open not supported.  Oh well.");
+	      return 0;
+	    }
+
+	  /* Maybe the shm filesystem has strict permissions.  */
+	  if (errno == EACCES)
+	    {
+	      puts ("sem_open not allowed.  Oh well.");
+	      return 0;
+	    }
+
+	  printf ("sem_open: %m\n");
+	  return 1;
+	}
+
+      /* Now close the handle.  */
+      if (sem_close (s) != 0)
+	{
+	  puts ("sem_close failed");
+	  return 1;
+	}
+    }
+
+  return 0;
+}
diff --git a/ap/build/uClibc/test/nptl/tst-sem9.c b/ap/build/uClibc/test/nptl/tst-sem9.c
new file mode 100644
index 0000000..cdd8eaa
--- /dev/null
+++ b/ap/build/uClibc/test/nptl/tst-sem9.c
@@ -0,0 +1,81 @@
+/* Copyright (C) 2003 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, write to the Free
+   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+   02111-1307 USA.  */
+
+#include <errno.h>
+#include <fcntl.h>
+#include <semaphore.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <unistd.h>
+
+
+static void
+remove_sem (int status, void *arg)
+{
+  sem_unlink (arg);
+}
+
+
+int
+main (void)
+{
+  sem_t *s;
+  int i;
+
+  on_exit (remove_sem, (void *) "/glibc-tst-sem9");
+
+  for (i = 0; i < 3; ++i)
+    {
+      s = sem_open ("/glibc-tst-sem9", O_CREAT, 0600, 1);
+      if (s == SEM_FAILED)
+	{
+	  if (errno == ENOSYS)
+	    {
+	      puts ("sem_open not supported.  Oh well.");
+	      return 0;
+	    }
+
+	  /* Maybe the shm filesystem has strict permissions.  */
+	  if (errno == EACCES)
+	    {
+	      puts ("sem_open not allowed.  Oh well.");
+	      return 0;
+	    }
+
+	  printf ("sem_open: %m\n");
+	  return 1;
+	}
+
+      /* Now close the handle.  */
+      if (sem_close (s) != 0)
+	{
+	  puts ("sem_close failed");
+	  return 1;
+	}
+
+      /* And remove it.  */
+      if (sem_unlink ("/glibc-tst-sem9") != 0)
+	{
+	  puts ("sem_unlink failed");
+	  return 1;
+	}
+    }
+
+  return 0;
+}
diff --git a/ap/build/uClibc/test/nptl/tst-signal1.c b/ap/build/uClibc/test/nptl/tst-signal1.c
new file mode 100644
index 0000000..3022f18
--- /dev/null
+++ b/ap/build/uClibc/test/nptl/tst-signal1.c
@@ -0,0 +1,189 @@
+/* Copyright (C) 2002, 2003, 2004 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+   Contributed by Ulrich Drepper <drepper@redhat.com>, 2002.
+
+   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 <errno.h>
+#include <pthread.h>
+#include <signal.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <unistd.h>
+#include <sys/mman.h>
+#include <sys/wait.h>
+
+
+static sigset_t ss;
+static pthread_barrier_t *b;
+
+
+static void *
+tf (void *arg)
+{
+  sigdelset (&ss, SIGINT);
+
+  if (pthread_sigmask (SIG_SETMASK, &ss, NULL) != 0)
+    {
+      puts ("2nd pthread_sigmask failed");
+      exit (1);
+    }
+
+  pthread_barrier_wait (b);
+
+  int sig;
+  int res = sigwait (&ss, &sig);
+  if (res == 0)
+    {
+      printf ("sigwait returned successfully with signal %d\n", sig);
+      exit (1);
+    }
+
+  printf ("sigwait returned with %s (%d)\n", strerror (res), res);
+
+  return NULL;
+}
+
+
+static void
+receiver (void)
+{
+  pthread_t th;
+
+  /* Make sure the process doesn't run forever.  */
+  alarm (10);
+
+  sigfillset (&ss);
+
+  if (pthread_sigmask (SIG_SETMASK, &ss, NULL) != 0)
+    {
+      puts ("1st pthread_sigmask failed");
+      exit (1);
+    }
+
+  if (pthread_create (&th, NULL, tf, NULL) != 0)
+    {
+      puts ("pthread_create failed");
+      exit (1);
+    }
+
+  if (pthread_join (th, NULL) == 0)
+    {
+      puts ("thread joined?!");
+      exit (1);
+    }
+
+  _exit (0);
+}
+
+
+static int
+do_test (void)
+{
+  char tmp[] = "/tmp/tst-signal1-XXXXXX";
+
+  int fd = mkstemp (tmp);
+  if (fd == -1)
+    {
+      puts ("mkstemp failed");
+      exit (1);
+    }
+
+  unlink (tmp);
+
+  int i;
+  for (i = 0; i < 20; ++i)
+    write (fd, "foobar xyzzy", 12);
+
+  b = mmap (NULL, sizeof (pthread_barrier_t), PROT_READ | PROT_WRITE,
+	    MAP_SHARED, fd, 0);
+  if (b == MAP_FAILED)
+    {
+      puts ("mmap failed");
+      exit (1);
+    }
+
+  pthread_barrierattr_t ba;
+  if (pthread_barrierattr_init (&ba) != 0)
+    {
+      puts ("barrierattr_init failed");
+      exit (1);
+    }
+
+  if (pthread_barrierattr_setpshared (&ba, PTHREAD_PROCESS_SHARED) != 0)
+    {
+      puts ("barrierattr_setpshared failed");
+      exit (1);
+    }
+
+  if (pthread_barrier_init (b, &ba, 2) != 0)
+    {
+      puts ("barrier_init failed");
+      exit (1);
+    }
+
+  if (pthread_barrierattr_destroy (&ba) != 0)
+    {
+      puts ("barrierattr_destroy failed");
+      exit (1);
+    }
+
+  pid_t pid = fork ();
+  if (pid == -1)
+    {
+      puts ("fork failed");
+      exit (1);
+    }
+
+  if (pid == 0)
+    receiver ();
+
+  pthread_barrier_wait (b);
+
+  /* Wait a bit more.  */
+  struct timespec ts = { .tv_sec = 0, .tv_nsec = 10000000 };
+  nanosleep (&ts, NULL);
+
+  /* Send the signal.  */
+  puts ("sending the signal now");
+  kill (pid, SIGINT);
+
+  /* Wait for the process to terminate.  */
+  int status;
+  if (TEMP_FAILURE_RETRY (waitpid (pid, &status, 0)) != pid)
+    {
+      puts ("wrong child reported terminated");
+      exit (1);
+    }
+
+  if (!WIFSIGNALED (status))
+    {
+      puts ("child wasn't signalled");
+      exit (1);
+    }
+
+  if (WTERMSIG (status) != SIGINT)
+    {
+      puts ("child not terminated with SIGINT");
+      exit (1);
+    }
+
+  return 0;
+}
+
+#define TEST_FUNCTION do_test ()
+#include "../test-skeleton.c"
diff --git a/ap/build/uClibc/test/nptl/tst-signal2.c b/ap/build/uClibc/test/nptl/tst-signal2.c
new file mode 100644
index 0000000..3f2c75d
--- /dev/null
+++ b/ap/build/uClibc/test/nptl/tst-signal2.c
@@ -0,0 +1,198 @@
+/* Copyright (C) 2002, 2003 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+   Contributed by Ulrich Drepper <drepper@redhat.com>, 2002.
+
+   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 <errno.h>
+#include <pthread.h>
+#include <signal.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <unistd.h>
+#include <sys/mman.h>
+#include <sys/wait.h>
+#include <string.h>
+
+
+static sigset_t ss;
+static pthread_barrier_t *b;
+
+
+static void *
+tf (void *arg)
+{
+  pthread_barrier_wait (b);
+
+  puts ("child: calling sigwait now");
+
+  int sig;
+  int err;
+  err = sigwait (&ss, &sig);
+  if (err != 0)
+    {
+      printf ("sigwait returned unsuccessfully: %s (%d)\n",
+	      strerror (err), err);
+      _exit (1);
+    }
+
+  puts ("sigwait returned");
+
+  if (sig != SIGINT)
+    {
+      printf ("caught signal %d, expected %d (SIGINT)\n", sig, SIGINT);
+      _exit (1);
+    }
+
+  puts ("child thread terminating now");
+
+  return NULL;
+}
+
+
+static void
+receiver (void)
+{
+  pthread_t th;
+
+  /* Make sure the process doesn't run forever.  */
+  alarm (10);
+
+  sigfillset (&ss);
+
+  if (pthread_sigmask (SIG_SETMASK, &ss, NULL) != 0)
+    {
+      puts ("1st pthread_sigmask failed");
+      _exit (1);
+    }
+
+  if (pthread_create (&th, NULL, tf, NULL) != 0)
+    {
+      puts ("pthread_create failed");
+      _exit (1);
+    }
+
+  if (pthread_join (th, NULL) != 0)
+    {
+      puts ("thread didn't join");
+      _exit (1);
+    }
+
+  puts ("join succeeded");
+
+  _exit (0);
+}
+
+
+static int
+do_test (void)
+{
+  char tmp[] = "/tmp/tst-signal1-XXXXXX";
+
+  int fd = mkstemp (tmp);
+  if (fd == -1)
+    {
+      puts ("mkstemp failed");
+      exit (1);
+    }
+
+  unlink (tmp);
+
+  int i;
+  for (i = 0; i < 20; ++i)
+    write (fd, "foobar xyzzy", 12);
+
+  b = mmap (NULL, sizeof (pthread_barrier_t), PROT_READ | PROT_WRITE,
+	    MAP_SHARED, fd, 0);
+  if (b == MAP_FAILED)
+    {
+      puts ("mmap failed");
+      exit (1);
+    }
+
+  pthread_barrierattr_t ba;
+  if (pthread_barrierattr_init (&ba) != 0)
+    {
+      puts ("barrierattr_init failed");
+      exit (1);
+    }
+
+  if (pthread_barrierattr_setpshared (&ba, PTHREAD_PROCESS_SHARED) != 0)
+    {
+      puts ("barrierattr_setpshared failed");
+      exit (1);
+    }
+
+  if (pthread_barrier_init (b, &ba, 2) != 0)
+    {
+      puts ("barrier_init failed");
+      exit (1);
+    }
+
+  if (pthread_barrierattr_destroy (&ba) != 0)
+    {
+      puts ("barrierattr_destroy failed");
+      exit (1);
+    }
+
+  pid_t pid = fork ();
+  if (pid == -1)
+    {
+      puts ("fork failed");
+      exit (1);
+    }
+
+  if (pid == 0)
+    receiver ();
+
+  pthread_barrier_wait (b);
+
+  /* Wait a bit more.  */
+  struct timespec ts = { .tv_sec = 0, .tv_nsec = 10000000 };
+  nanosleep (&ts, NULL);
+
+  /* Send the signal.  */
+  puts ("sending the signal now");
+  kill (pid, SIGINT);
+
+  /* Wait for the process to terminate.  */
+  int status;
+  if (TEMP_FAILURE_RETRY (waitpid (pid, &status, 0)) != pid)
+    {
+      puts ("wrong child reported terminated");
+      exit (1);
+    }
+
+  if (!WIFEXITED (status))
+    {
+      if (WIFSIGNALED (status))
+	printf ("child exited with signal %d\n", WTERMSIG (status));
+      else
+	puts ("child didn't exit normally");
+      exit (1);
+    }
+
+  if (WEXITSTATUS (status) != 0)
+    {
+      printf ("exit status %d != 0\n", WEXITSTATUS (status));
+      exit (1);
+    }
+
+  return 0;
+}
+
+#define TEST_FUNCTION do_test ()
+#include "../test-skeleton.c"
diff --git a/ap/build/uClibc/test/nptl/tst-signal3.c b/ap/build/uClibc/test/nptl/tst-signal3.c
new file mode 100644
index 0000000..e4756c5
--- /dev/null
+++ b/ap/build/uClibc/test/nptl/tst-signal3.c
@@ -0,0 +1,261 @@
+/* Copyright (C) 2002, 2003, 2004 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+   Contributed by Ulrich Drepper <drepper@redhat.com>, 2002.
+
+   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 <errno.h>
+#include <pthread.h>
+#include <semaphore.h>
+#include <signal.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <unistd.h>
+
+
+/* Number of different signalss to use.  Also is the number of
+   threads.  */
+#define N 10
+/* Maximum number of threads in flight at any one time.  */
+#define INFLIGHT 5
+/* Number of signals sent in total.  */
+#define ROUNDS 10000
+
+
+static int received[N][N];
+static int nsig[N];
+static pthread_t th[N];
+static sem_t sem;
+static pthread_mutex_t lock[N];
+static pthread_t th_main;
+static int sig0;
+
+static void
+handler (int sig)
+{
+  int i;
+  for (i = 0; i < N; ++i)
+    if (pthread_equal (pthread_self (), th[i]))
+      break;
+
+  if (i == N)
+    {
+      if (pthread_equal (pthread_self (), th_main))
+	puts ("signal received by main thread");
+      else
+	printf ("signal received by unknown thread (%lx)\n",
+		(unsigned long int) pthread_self ());
+      exit (1);
+    }
+
+  ++received[i][sig - sig0];
+
+  sem_post (&sem);
+}
+
+
+static void *
+tf (void *arg)
+{
+  int idx = (long int) arg;
+
+  sigset_t ss;
+  sigemptyset (&ss);
+
+  int i;
+  for (i = 0; i <= idx; ++i)
+    sigaddset (&ss, sig0 + i);
+
+  if (pthread_sigmask (SIG_UNBLOCK, &ss, NULL) != 0)
+    {
+      printf ("thread %d: pthread_sigmask failed\n", i);
+      exit (1);
+    }
+
+  pthread_mutex_lock (&lock[idx]);
+
+  return NULL;
+}
+
+
+static int
+do_test (void)
+{
+  /* Block all signals.  */
+  sigset_t ss;
+  sigfillset (&ss);
+
+  th_main = pthread_self ();
+
+  sig0 = SIGRTMIN;
+
+  if (pthread_sigmask (SIG_SETMASK, &ss, NULL) != 0)
+    {
+      puts ("1st pthread_sigmask failed");
+      exit (1);
+    }
+
+  /* Install the handler.  */
+  int i;
+  for (i = 0; i < N; ++i)
+    {
+      struct sigaction sa =
+	{
+	  .sa_handler = handler,
+	  .sa_flags = 0
+	};
+      sigfillset (&sa.sa_mask);
+
+      if (sigaction (sig0 + i, &sa, NULL) != 0)
+	{
+	  printf ("sigaction for signal %d failed\n", i);
+	  exit (1);
+	}
+    }
+
+  if (sem_init (&sem, 0, INFLIGHT) != 0)
+    {
+      puts ("sem_init failed");
+      exit (1);
+    }
+
+  pthread_attr_t a;
+
+  if (pthread_attr_init (&a) != 0)
+    {
+      puts ("attr_init failed");
+      exit (1);
+    }
+
+  if (pthread_attr_setstacksize (&a, 1 * 1024 * 1024) != 0)
+    {
+      puts ("attr_setstacksize failed");
+      return 1;
+    }
+
+  for (i = 0; i < N; ++i)
+    {
+      if (pthread_mutex_init (&lock[i], NULL) != 0)
+	{
+	  printf ("mutex_init[%d] failed\n", i);
+	}
+
+      if (pthread_mutex_lock (&lock[i]) != 0)
+	{
+	  printf ("mutex_lock[%d] failed\n", i);
+	}
+
+      if (pthread_create (&th[i], &a, tf, (void *) (long int) i) != 0)
+	{
+	  printf ("create of thread %d failed\n", i);
+	  exit (1);
+	}
+    }
+
+  if (pthread_attr_destroy (&a) != 0)
+    {
+      puts ("attr_destroy failed");
+      exit (1);
+    }
+
+  int result = 0;
+  unsigned int r = 42;
+  pid_t pid = getpid ();
+
+  for (i = 0; i < ROUNDS; ++i)
+    {
+      if (TEMP_FAILURE_RETRY (sem_wait (&sem)) != 0)
+	{
+	  printf ("sem_wait round %d failed: %m\n", i);
+	  exit (1);
+	}
+
+      int s = rand_r (&r) % N;
+
+      kill (pid, sig0 + s);
+    }
+
+  void *status;
+  for (i = 0; i < N; ++i)
+    {
+      if (pthread_mutex_unlock (&lock[i]) != 0)
+	{
+	  printf ("unlock %d failed\n", i);
+	  exit (1);
+	}
+
+      if (pthread_join (th[i], &status) != 0)
+	{
+	  printf ("join %d failed\n", i);
+	  result = 1;
+	}
+      else if (status != NULL)
+	{
+	  printf ("%d: result != NULL\n", i);
+	  result = 1;
+	}
+    }
+
+  int total = 0;
+  for (i = 0; i < N; ++i)
+    {
+      int j;
+
+      for (j = 0; j <= i; ++j)
+	total += received[i][j];
+
+      for (j = i + 1; j < N; ++j)
+	if (received[i][j] != 0)
+	  {
+	    printf ("thread %d received signal SIGRTMIN+%d\n", i, j);
+	    result = 1;
+	  }
+    }
+
+  if (total != ROUNDS)
+    {
+      printf ("total number of handled signals is %d, expected %d\n",
+	      total, ROUNDS);
+      result = 1;
+    }
+
+  printf ("A total of %d signals sent and received\n", total);
+  for (i = 0; i < N; ++i)
+    {
+      printf ("thread %2d:", i);
+
+      int j;
+      for (j = 0; j <= i; ++j)
+	{
+	  printf (" %5d", received[i][j]);
+	  nsig[j] += received[i][j];
+	}
+
+      putchar ('\n');
+
+    }
+
+  printf ("\nTotal    :");
+  for (i = 0; i < N; ++i)
+    printf (" %5d", nsig[i]);
+  putchar ('\n');
+
+  return result;
+}
+
+#define TIMEOUT 10
+#define TEST_FUNCTION do_test ()
+#include "../test-skeleton.c"
diff --git a/ap/build/uClibc/test/nptl/tst-signal4.c b/ap/build/uClibc/test/nptl/tst-signal4.c
new file mode 100644
index 0000000..dcb2893
--- /dev/null
+++ b/ap/build/uClibc/test/nptl/tst-signal4.c
@@ -0,0 +1,60 @@
+/* Copyright (C) 2003 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, 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 <stdio.h>
+#include <stdlib.h>
+
+static int
+do_test (void)
+{
+  sigset_t ss;
+
+  sigemptyset (&ss);
+
+  int i;
+  for (i = 0; i < 10000; ++i)
+    {
+      long int r = random ();
+
+      if (r != SIG_BLOCK && r != SIG_SETMASK && r != SIG_UNBLOCK)
+	{
+	  int e = pthread_sigmask (r, &ss, NULL);
+
+	  if (e == 0)
+	    {
+	      printf ("pthread_sigmask succeeded for how = %ld\n", r);
+	      exit (1);
+	    }
+
+	  if (e != EINVAL)
+	    {
+	      puts ("pthread_sigmask didn't return EINVAL");
+	      exit (1);
+	    }
+	}
+    }
+
+  return 0;
+}
+
+#define TEST_FUNCTION do_test ()
+#include "../test-skeleton.c"
diff --git a/ap/build/uClibc/test/nptl/tst-signal5.c b/ap/build/uClibc/test/nptl/tst-signal5.c
new file mode 100644
index 0000000..cea6ec1
--- /dev/null
+++ b/ap/build/uClibc/test/nptl/tst-signal5.c
@@ -0,0 +1,111 @@
+/* Copyright (C) 2003 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, 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 <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <unistd.h>
+#include <sys/mman.h>
+#include <sys/wait.h>
+
+
+static sigset_t ss;
+
+
+static void *
+tf (void *arg)
+{
+  sigset_t ss2;
+  if (pthread_sigmask (SIG_SETMASK, NULL, &ss2) != 0)
+    {
+      puts ("child: sigmask failed");
+      exit (1);
+    }
+
+  int i;
+  for (i = 1; i < 32; ++i)
+    if (sigismember (&ss, i) && ! sigismember (&ss2, i))
+      {
+	printf ("signal %d set in parent mask, but not in child\n", i);
+	exit (1);
+      }
+    else if (! sigismember (&ss, i) && sigismember (&ss2, i))
+      {
+	printf ("signal %d set in child mask, but not in parent\n", i);
+	exit (1);
+      }
+
+  return NULL;
+}
+
+
+static int
+do_test (void)
+{
+  sigemptyset (&ss);
+  sigaddset (&ss, SIGUSR1);
+  if (pthread_sigmask (SIG_SETMASK, &ss, NULL) != 0)
+    {
+      puts ("1st sigmask failed");
+      exit (1);
+    }
+
+  pthread_t th;
+  if (pthread_create (&th, NULL, tf, NULL) != 0)
+    {
+      puts ("1st create failed");
+      exit (1);
+    }
+
+  void *r;
+  if (pthread_join (th, &r) != 0)
+    {
+      puts ("1st join failed");
+      exit (1);
+    }
+
+  sigemptyset (&ss);
+  sigaddset (&ss, SIGUSR2);
+  sigaddset (&ss, SIGFPE);
+  if (pthread_sigmask (SIG_SETMASK, &ss, NULL) != 0)
+    {
+      puts ("2nd sigmask failed");
+      exit (1);
+    }
+
+  if (pthread_create (&th, NULL, tf, NULL) != 0)
+    {
+      puts ("2nd create failed");
+      exit (1);
+    }
+
+  if (pthread_join (th, &r) != 0)
+    {
+      puts ("2nd join failed");
+      exit (1);
+    }
+
+  return 0;
+}
+
+#define TEST_FUNCTION do_test ()
+#include "../test-skeleton.c"
diff --git a/ap/build/uClibc/test/nptl/tst-signal6.c b/ap/build/uClibc/test/nptl/tst-signal6.c
new file mode 100644
index 0000000..85a8640
--- /dev/null
+++ b/ap/build/uClibc/test/nptl/tst-signal6.c
@@ -0,0 +1,192 @@
+/* Copyright (C) 2003 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, write to the Free
+   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+   02111-1307 USA.  */
+
+#include <pthread.h>
+#include <signal.h>
+#include <stdint.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <unistd.h>
+
+
+#define N 2
+static pthread_barrier_t bar;
+static struct
+{
+  void *p;
+  pthread_t s;
+} ti[N];
+static int sig1;
+
+
+static void
+handler (int sig)
+{
+  pthread_t self = pthread_self ();
+  size_t i;
+
+  for (i = 0; i < N; ++i)
+    if (ti[i].s == self)
+      {
+	if ((uintptr_t) ti[i].p <= (uintptr_t) &self
+	    && (uintptr_t) ti[i].p + 2 * MINSIGSTKSZ > (uintptr_t) &self)
+	  {
+	    puts ("alt stack not used");
+	    exit (1);
+	  }
+
+	printf ("thread %zu used alt stack for signal %d\n", i, sig);
+
+	return;
+      }
+
+  puts ("handler: thread not found");
+  exit (1);
+}
+
+
+static void *
+tf (void *arg)
+{
+  size_t nr = (uintptr_t) arg;
+  if (nr >= N)
+    {
+      puts ("wrong nr parameter");
+      exit (1);
+    }
+
+  sigset_t ss;
+  sigemptyset (&ss);
+  size_t i;
+  for (i = 0; i < N; ++i)
+    if (i != nr)
+      if (sigaddset (&ss, sig1 + i) != 0)
+	{
+	  puts ("tf: sigaddset failed");
+	  exit (1);
+	}
+  if (pthread_sigmask (SIG_BLOCK, &ss, NULL) != 0)
+    {
+      puts ("tf: sigmask failed");
+      exit (1);
+    }
+
+  void *p = malloc (2 * MINSIGSTKSZ);
+  if (p == NULL)
+    {
+      puts ("tf: malloc failed");
+      exit (1);
+    }
+
+  stack_t s;
+  s.ss_sp = p;
+  s.ss_size = 2 * MINSIGSTKSZ;
+  s.ss_flags = 0;
+  if (sigaltstack (&s, NULL) != 0)
+    {
+      puts ("tf: sigaltstack failed");
+      exit (1);
+    }
+
+  ti[nr].p = p;
+  ti[nr].s = pthread_self ();
+
+  pthread_barrier_wait (&bar);
+
+  pthread_barrier_wait (&bar);
+
+  return NULL;
+}
+
+
+static int
+do_test (void)
+{
+  sig1 = SIGRTMIN;
+  if (sig1 + N > SIGRTMAX)
+    {
+      puts ("too few RT signals");
+      return 0;
+    }
+
+  struct sigaction sa;
+  sa.sa_handler = handler;
+  sa.sa_flags = 0;
+  sigemptyset (&sa.sa_mask);
+
+  if (sigaction (sig1, &sa, NULL) != 0
+      || sigaction (sig1 + 1, &sa, NULL) != 0
+      || sigaction (sig1 + 2, &sa, NULL) != 0)
+    {
+      puts ("sigaction failed");
+      return 1;
+    }
+
+  if (pthread_barrier_init (&bar, NULL, 1 + N) != 0)
+    {
+      puts ("barrier_init failed");
+      return 1;
+    }
+
+  pthread_t th[N];
+  size_t i;
+  for (i = 0; i < N; ++i)
+    if (pthread_create (&th[i], NULL, tf, (void *) (long int) i) != 0)
+      {
+	puts ("create failed");
+	return 1;
+      }
+
+  /* Block the three signals.  */
+  sigset_t ss;
+  sigemptyset (&ss);
+  for (i = 0; i <= N; ++i)
+    sigaddset (&ss, sig1 + i);
+  if (pthread_sigmask (SIG_BLOCK, &ss, NULL) != 0)
+    {
+      puts ("main: sigmask failed");
+      return 1;
+    }
+
+  pthread_barrier_wait (&bar);
+
+  /* Send some signals.  */
+  pid_t me = getpid ();
+  kill (me, sig1 + N);
+  for (i = 0; i < N; ++i)
+    kill (me, sig1 + i);
+  kill (me, sig1 + N);
+
+  /* Give the signals a chance to be worked on.  */
+  sleep (1);
+
+  pthread_barrier_wait (&bar);
+
+  for (i = 0; i < N; ++i)
+    if (pthread_join (th[i], NULL) != 0)
+      {
+	puts ("join failed");
+	return 1;
+      }
+
+  return 0;
+}
+
+#define TEST_FUNCTION do_test ()
+#include "../test-skeleton.c"
diff --git a/ap/build/uClibc/test/nptl/tst-signal7.c b/ap/build/uClibc/test/nptl/tst-signal7.c
new file mode 100644
index 0000000..82ef11c
--- /dev/null
+++ b/ap/build/uClibc/test/nptl/tst-signal7.c
@@ -0,0 +1,59 @@
+/* Copyright (C) 2005 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+   Contributed by Ulrich Drepper <drepper@redhat.com>, 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 <errno.h>
+#include <pthreadP.h>
+#include <signal.h>
+#include <stdio.h>
+
+
+static int
+do_test (void)
+{
+  int result = 0;
+
+  errno = 0;
+  if (sigaction (SIGCANCEL, NULL, NULL) == 0)
+    {
+      puts ("sigaction(SIGCANCEL) did not fail");
+      result = 1;
+    }
+  else if (errno != EINVAL)
+    {
+      puts ("sigaction(SIGCANCEL) did not set errno to EINVAL");
+      result = 1;
+    }
+
+  errno = 0;
+  if (sigaction (SIGSETXID, NULL, NULL) == 0)
+    {
+      puts ("sigaction(SIGSETXID) did not fail");
+      result = 1;
+    }
+  else if (errno != EINVAL)
+    {
+      puts ("sigaction(SIGSETXID) did not set errno to EINVAL");
+      result = 1;
+    }
+
+  return result;
+}
+
+#define TEST_FUNCTION do_test ()
+#include "../test-skeleton.c"
diff --git a/ap/build/uClibc/test/nptl/tst-spin1.c b/ap/build/uClibc/test/nptl/tst-spin1.c
new file mode 100644
index 0000000..259b4b4
--- /dev/null
+++ b/ap/build/uClibc/test/nptl/tst-spin1.c
@@ -0,0 +1,57 @@
+/* Copyright (C) 2002 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+   Contributed by Ulrich Drepper <drepper@redhat.com>, 2002.
+
+   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>
+#include <stdio.h>
+
+
+static int
+do_test (void)
+{
+  pthread_spinlock_t s;
+
+  if (pthread_spin_init (&s, PTHREAD_PROCESS_PRIVATE) != 0)
+    {
+      puts ("spin_init failed");
+      return 1;
+    }
+
+  if (pthread_spin_lock (&s) != 0)
+    {
+      puts ("spin_lock failed");
+      return 1;
+    }
+
+  if (pthread_spin_unlock (&s) != 0)
+    {
+      puts ("spin_unlock failed");
+      return 1;
+    }
+
+  if (pthread_spin_destroy (&s) != 0)
+    {
+      puts ("spin_destroy failed");
+      return 1;
+    }
+
+  return 0;
+}
+
+#define TEST_FUNCTION do_test ()
+#include "../test-skeleton.c"
diff --git a/ap/build/uClibc/test/nptl/tst-spin2.c b/ap/build/uClibc/test/nptl/tst-spin2.c
new file mode 100644
index 0000000..5b1df6c
--- /dev/null
+++ b/ap/build/uClibc/test/nptl/tst-spin2.c
@@ -0,0 +1,159 @@
+/* Copyright (C) 2002, 2003, 2004 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+   Contributed by Ulrich Drepper <drepper@redhat.com>, 2002.
+
+   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 <errno.h>
+#include <pthread.h>
+#include <stdint.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <unistd.h>
+#include <sys/mman.h>
+#include <sys/wait.h>
+
+
+static int
+do_test (void)
+{
+  size_t ps = sysconf (_SC_PAGESIZE);
+  char tmpfname[] = "/tmp/tst-spin2.XXXXXX";
+  char data[ps];
+  void *mem;
+  int fd;
+  pthread_spinlock_t *s;
+  pid_t pid;
+  char *p;
+  int err;
+
+  fd = mkstemp (tmpfname);
+  if (fd == -1)
+    {
+      printf ("cannot open temporary file: %m\n");
+      return 1;
+    }
+
+  /* Make sure it is always removed.  */
+  unlink (tmpfname);
+
+  /* Create one page of data.  */
+  memset (data, '\0', ps);
+
+  /* Write the data to the file.  */
+  if (write (fd, data, ps) != (ssize_t) ps)
+    {
+      puts ("short write");
+      return 1;
+    }
+
+  mem = mmap (NULL, ps, PROT_READ | PROT_WRITE, MAP_SHARED, fd, 0);
+  if (mem == MAP_FAILED)
+    {
+      printf ("mmap failed: %m\n");
+      return 1;
+    }
+
+  s = (pthread_spinlock_t *) (((uintptr_t) mem
+			       + __alignof (pthread_spinlock_t))
+			      & ~(__alignof (pthread_spinlock_t) - 1));
+  p = (char *) (s + 1);
+
+  if (pthread_spin_init (s, PTHREAD_PROCESS_SHARED) != 0)
+    {
+      puts ("spin_init failed");
+      return 1;
+    }
+
+  if (pthread_spin_lock (s) != 0)
+    {
+      puts ("spin_lock failed");
+      return 1;
+    }
+
+  err = pthread_spin_trylock (s);
+  if (err == 0)
+    {
+      puts ("1st spin_trylock succeeded");
+      return 1;
+    }
+  else if (err != EBUSY)
+    {
+      puts ("1st spin_trylock didn't return EBUSY");
+      return 1;
+    }
+
+  err = pthread_spin_unlock (s);
+  if (err != 0)
+    {
+      puts ("parent: spin_unlock failed");
+      return 1;
+    }
+
+  err = pthread_spin_trylock (s);
+  if (err != 0)
+    {
+      puts ("2nd spin_trylock failed");
+      return 1;
+    }
+
+  *p = 0;
+
+  puts ("going to fork now");
+  pid = fork ();
+  if (pid == -1)
+    {
+      puts ("fork failed");
+      return 1;
+    }
+  else if (pid == 0)
+    {
+      /* Play some lock ping-pong.  It's our turn to unlock first.  */
+      if ((*p)++ != 0)
+	{
+	  puts ("child: *p != 0");
+	  return 1;
+	}
+
+      if (pthread_spin_unlock (s) != 0)
+	{
+	  puts ("child: 1st spin_unlock failed");
+	  return 1;
+	}
+
+      puts ("child done");
+    }
+  else
+    {
+      if (pthread_spin_lock (s) != 0)
+	{
+	  puts ("parent: 2nd spin_lock failed");
+	  return 1;
+	}
+
+      puts ("waiting for child");
+
+      waitpid (pid, NULL, 0);
+
+      puts ("parent done");
+    }
+
+  return 0;
+}
+
+#define TEST_FUNCTION do_test ()
+#include "../test-skeleton.c"
diff --git a/ap/build/uClibc/test/nptl/tst-spin3.c b/ap/build/uClibc/test/nptl/tst-spin3.c
new file mode 100644
index 0000000..4437740
--- /dev/null
+++ b/ap/build/uClibc/test/nptl/tst-spin3.c
@@ -0,0 +1,55 @@
+/* Copyright (C) 2002 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+   Contributed by Ulrich Drepper <drepper@redhat.com>, 2002.
+
+   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>
+#include <signal.h>
+#include <stdio.h>
+#include <unistd.h>
+
+
+static int
+do_test (void)
+{
+  pthread_spinlock_t s;
+
+  if (pthread_spin_init (&s, PTHREAD_PROCESS_PRIVATE) != 0)
+    {
+      puts ("spin_init failed");
+      return 1;
+    }
+
+  if (pthread_spin_lock (&s) != 0)
+    {
+      puts ("1st spin_lock failed");
+      return 1;
+    }
+
+  /* Set an alarm for 1 second.  The wrapper will expect this.  */
+  alarm (1);
+
+  /* This call should never return.  */
+  pthread_spin_lock (&s);
+
+  puts ("2nd spin_lock returned");
+  return 1;
+}
+
+#define EXPECTED_SIGNAL SIGALRM
+#define TEST_FUNCTION do_test ()
+#include "../test-skeleton.c"
diff --git a/ap/build/uClibc/test/nptl/tst-stack-align.h b/ap/build/uClibc/test/nptl/tst-stack-align.h
new file mode 100644
index 0000000..59b1e65
--- /dev/null
+++ b/ap/build/uClibc/test/nptl/tst-stack-align.h
@@ -0,0 +1,35 @@
+/* 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 <stdio.h>
+#include <stdint.h>
+
+#define TEST_STACK_ALIGN() \
+  ({									     \
+    double _d = 12.0;							     \
+    long double _ld = 15.0;						     \
+    int _ret = 0;							     \
+    printf ("double:  %g %p %zu\n", _d, &_d, __alignof (double));	     \
+    if ((((uintptr_t) &_d) & (__alignof (double) - 1)) != 0)		     \
+      _ret = 1;								     \
+									     \
+    printf ("ldouble: %Lg %p %zu\n", _ld, &_ld, __alignof (long double));    \
+    if ((((uintptr_t) &_ld) & (__alignof (long double) - 1)) != 0)	     \
+      _ret = 1;								     \
+    _ret;								     \
+    })
diff --git a/ap/build/uClibc/test/nptl/tst-stack1.c b/ap/build/uClibc/test/nptl/tst-stack1.c
new file mode 100644
index 0000000..9340598
--- /dev/null
+++ b/ap/build/uClibc/test/nptl/tst-stack1.c
@@ -0,0 +1,146 @@
+/* Copyright (C) 2002, 2003 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+   Contributed by Ulrich Drepper <drepper@redhat.com>, 2002.
+
+   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 <limits.h>
+#include <pthread.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <sys/param.h>
+#include <unistd.h>
+
+
+static void *stack;
+static size_t size;
+
+
+static void *
+tf (void *a)
+{
+  int result = 0;
+
+  puts ("child start");
+
+  pthread_attr_t attr;
+  if (pthread_getattr_np (pthread_self (), &attr) != 0)
+    {
+      puts ("getattr_np failed");
+      exit (1);
+    }
+
+  size_t test_size;
+  void *test_stack;
+  if (pthread_attr_getstack (&attr, &test_stack, &test_size) != 0)
+    {
+      puts ("attr_getstack failed");
+      exit (1);
+    }
+
+  if (test_size != size)
+    {
+      printf ("child: reported size differs: is %zu, expected %zu\n",
+	      test_size, size);
+      result = 1;
+    }
+
+  if (test_stack != stack)
+    {
+      printf ("child: reported stack address differs: is %p, expected %p\n",
+	      test_stack, stack);
+      result = 1;
+    }
+
+  puts ("child OK");
+
+  return result ? (void *) 1l : NULL;
+}
+
+
+int
+do_test (void)
+{
+  int result = 0;
+
+  size = MAX (4 * getpagesize (), PTHREAD_STACK_MIN);
+  if (posix_memalign (&stack, getpagesize (), size) != 0)
+    {
+      puts ("out of memory while allocating the stack memory");
+      exit (1);
+    }
+
+  pthread_attr_t attr;
+  if (pthread_attr_init (&attr) != 0)
+    {
+      puts ("attr_init failed");
+      exit (1);
+    }
+
+  puts ("attr_setstack");
+  if (pthread_attr_setstack (&attr, stack, size) != 0)
+    {
+      puts ("attr_setstack failed");
+      exit (1);
+    }
+
+  size_t test_size;
+  void *test_stack;
+  puts ("attr_getstack");
+  if (pthread_attr_getstack (&attr, &test_stack, &test_size) != 0)
+    {
+      puts ("attr_getstack failed");
+      exit (1);
+    }
+
+  if (test_size != size)
+    {
+      printf ("reported size differs: is %zu, expected %zu\n",
+	      test_size, size);
+      result = 1;
+    }
+
+  if (test_stack != stack)
+    {
+      printf ("reported stack address differs: is %p, expected %p\n",
+	      test_stack, stack);
+      result = 1;
+    }
+
+  puts ("create");
+
+  pthread_t th;
+  if (pthread_create (&th, &attr, tf, NULL) != 0)
+    {
+      puts ("failed to create thread");
+      exit (1);
+    }
+
+  void *status;
+  if (pthread_join (th, &status) != 0)
+    {
+      puts ("join failed");
+      exit (1);
+    }
+
+  result |= status != NULL;
+
+  return result;
+}
+
+
+#define TEST_FUNCTION do_test ()
+#include "../test-skeleton.c"
diff --git a/ap/build/uClibc/test/nptl/tst-stack2.c b/ap/build/uClibc/test/nptl/tst-stack2.c
new file mode 100644
index 0000000..5fcdb18
--- /dev/null
+++ b/ap/build/uClibc/test/nptl/tst-stack2.c
@@ -0,0 +1,80 @@
+/* Copyright (C) 2003 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+   Contributed by Jakub Jelinek <jakub@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, write to the Free
+   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+   02111-1307 USA.  */
+
+/* Test whether it is possible to create a thread with PTHREAD_STACK_MIN
+   stack size.  */
+
+#include <pthread.h>
+#include <stdlib.h>
+#include <stdio.h>
+#include <limits.h>
+
+static int seen;
+
+static void *
+tf (void *p)
+{
+  ++seen;
+  return NULL;
+}
+
+static int
+do_test (void)
+{
+  pthread_attr_t attr;
+  pthread_attr_init (&attr);
+
+  int result = 0;
+  int res = pthread_attr_setstacksize (&attr, PTHREAD_STACK_MIN);
+  if (res)
+    {
+      printf ("pthread_attr_setstacksize failed %d\n", res);
+      result = 1;
+    }
+
+  /* Create the thread.  */
+  pthread_t th;
+  res = pthread_create (&th, &attr, tf, NULL);
+  if (res)
+    {
+      printf ("pthread_create failed %d\n", res);
+      result = 1;
+    }
+  else
+    {
+      res = pthread_join (th, NULL);
+      if (res)
+	{
+	  printf ("pthread_join failed %d\n", res);
+	  result = 1;
+	}
+    }
+
+  if (seen != 1)
+    {
+      printf ("seen %d != 1\n", seen);
+      result = 1;
+    }
+
+  return result;
+}
+
+
+#define TEST_FUNCTION do_test ()
+#include "../test-skeleton.c"
diff --git a/ap/build/uClibc/test/nptl/tst-stdio1.c b/ap/build/uClibc/test/nptl/tst-stdio1.c
new file mode 100644
index 0000000..ebb3e2f
--- /dev/null
+++ b/ap/build/uClibc/test/nptl/tst-stdio1.c
@@ -0,0 +1,57 @@
+/* Copyright (C) 2002 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+   Contributed by Ulrich Drepper <drepper@redhat.com>, 2002.
+
+   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>
+#include <signal.h>
+#include <stdio.h>
+#include <unistd.h>
+
+
+static void *tf (void *a)
+{
+  flockfile (stdout);
+  /* This call should never return.  */
+  return a;
+}
+
+
+int
+do_test (void)
+{
+  pthread_t th;
+
+  flockfile (stdout);
+
+  if (pthread_create (&th, NULL, tf, NULL) != 0)
+    {
+      write (2, "create failed\n", 14);
+      _exit (1);
+    }
+
+  pthread_join (th, NULL);
+
+  puts ("join returned");
+
+  return 0;
+}
+
+
+#define EXPECTED_SIGNAL SIGALRM
+#define TEST_FUNCTION do_test ()
+#include "../test-skeleton.c"
diff --git a/ap/build/uClibc/test/nptl/tst-stdio2.c b/ap/build/uClibc/test/nptl/tst-stdio2.c
new file mode 100644
index 0000000..08d6add
--- /dev/null
+++ b/ap/build/uClibc/test/nptl/tst-stdio2.c
@@ -0,0 +1,82 @@
+/* Copyright (C) 2002 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+   Contributed by Ulrich Drepper <drepper@redhat.com>, 2002.
+
+   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>
+#include <signal.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <unistd.h>
+
+
+static void *tf (void *a)
+{
+  puts ("start tf");
+
+  /* Multiple locking, implicitly or explicitly, must be possible.  */
+  flockfile (stdout);
+
+  puts ("after first flockfile");
+
+  flockfile (stdout);
+
+  puts ("foo");
+
+  funlockfile (stdout);
+
+  puts ("after first funlockfile");
+
+  funlockfile (stdout);
+
+  puts ("all done");
+
+  return a;
+}
+
+
+int
+do_test (void)
+{
+  pthread_t th;
+
+  if (pthread_create (&th, NULL, tf, NULL) != 0)
+    {
+      write (2, "create failed\n", 14);
+      _exit (1);
+    }
+
+  void *result;
+  if (pthread_join (th, &result) != 0)
+    {
+      puts ("join failed");
+      exit (1);
+    }
+  else if (result != NULL)
+    {
+      printf ("wrong return value: %p, expected %p\n", result, NULL);
+      exit (1);
+    }
+
+  puts ("join returned succsefully");
+
+  return 0;
+}
+
+
+#define TEST_FUNCTION do_test ()
+#include "../test-skeleton.c"
diff --git a/ap/build/uClibc/test/nptl/tst-sysconf.c b/ap/build/uClibc/test/nptl/tst-sysconf.c
new file mode 100644
index 0000000..3ad1b6a
--- /dev/null
+++ b/ap/build/uClibc/test/nptl/tst-sysconf.c
@@ -0,0 +1,48 @@
+/* Copyright (C) 2002, 2003 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+   Contributed by Ulrich Drepper <drepper@redhat.com>, 2002.
+
+   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>
+#include <stdio.h>
+#include <unistd.h>
+
+
+static int
+do_test (void)
+{
+  puts ("We expect no limits");
+  /* We have no fixed limit on the number of threads.  Make sure the
+     headers tell the right story.  */
+#ifdef PTHREAD_THREADS_MAX
+  printf ("Header report maximum number of threads = %lu\n",
+	  (unsigned long int) PTHREAD_THREADS_MAX);
+  return 1;
+#else
+  long int r = sysconf (_SC_THREAD_THREADS_MAX);
+  if (r != -1)
+    {
+      printf ("sysconf(_SC_THREAD_THREADS_MAX) return %ld\n", r);
+      return 1;
+    }
+#endif
+
+  return 0;
+}
+
+#define TEST_FUNCTION do_test ()
+#include "../test-skeleton.c"
diff --git a/ap/build/uClibc/test/nptl/tst-timer2.c b/ap/build/uClibc/test/nptl/tst-timer2.c
new file mode 100644
index 0000000..60026c1
--- /dev/null
+++ b/ap/build/uClibc/test/nptl/tst-timer2.c
@@ -0,0 +1,65 @@
+/* Test for crashing bugs when trying to create too many timers.  */
+
+#include <stdio.h>
+#include <time.h>
+#include <signal.h>
+#include <sys/time.h>
+#include <sys/resource.h>
+#include <unistd.h>
+
+#if _POSIX_THREADS
+# include <pthread.h>
+
+void
+thread (union sigval arg)
+{
+  puts ("Timeout");
+}
+
+int
+do_test (void)
+{
+  int i, res;
+  timer_t timerId;
+  struct itimerspec itval;
+  struct sigevent sigev;
+
+  itval.it_interval.tv_sec = 2;
+  itval.it_interval.tv_nsec = 0;
+  itval.it_value.tv_sec = 2;
+  itval.it_value.tv_nsec = 0;
+
+  sigev.sigev_notify = SIGEV_THREAD;
+  sigev.sigev_signo = SIGRTMIN;
+  sigev.sigev_notify_function = thread;
+  sigev.sigev_notify_attributes = 0;
+  sigev.sigev_value.sival_ptr = (void *) &timerId;
+
+  for (i = 0; i < 100; i++)
+    {
+      printf ("cnt = %d\n", i);
+
+      if (timer_create (CLOCK_REALTIME, &sigev, &timerId) < 0)
+	{
+	  perror ("timer_create");
+	  continue;
+	}
+
+      res = timer_settime (timerId, 0, &itval, NULL);
+      if (res < 0)
+	perror ("timer_settime");
+
+      res = timer_delete (timerId);
+      if (res < 0)
+	perror ("timer_delete");
+    }
+
+  return 0;
+}
+
+# define TEST_FUNCTION do_test ()
+#else
+# define TEST_FUNCTION 0
+#endif
+
+#include "../test-skeleton.c"
diff --git a/ap/build/uClibc/test/nptl/tst-timer3.c b/ap/build/uClibc/test/nptl/tst-timer3.c
new file mode 100644
index 0000000..8113f66
--- /dev/null
+++ b/ap/build/uClibc/test/nptl/tst-timer3.c
@@ -0,0 +1,86 @@
+/* Test for bogus per-thread deletion of timers.  */
+
+#include <stdio.h>
+#include <error.h>
+#include <time.h>
+#include <signal.h>
+#include <stdint.h>
+#include <string.h>
+#include <sys/time.h>
+#include <sys/resource.h>
+#include <unistd.h>
+#if _POSIX_THREADS
+# include <pthread.h>
+
+
+/* Creating timers in another thread should work too.  */
+static void *
+do_timer_create (void *arg)
+{
+  struct sigevent *const sigev = arg;
+  timer_t *const timerId = sigev->sigev_value.sival_ptr;
+  if (timer_create (CLOCK_REALTIME, sigev, timerId) < 0)
+    {
+      printf ("timer_create: %m\n");
+      return NULL;
+    }
+  return timerId;
+}
+
+
+static int
+do_test (void)
+{
+  int i, res;
+  timer_t timerId;
+  struct itimerspec itval;
+  struct sigevent sigev;
+
+  itval.it_interval.tv_sec = 2;
+  itval.it_interval.tv_nsec = 0;
+  itval.it_value.tv_sec = 2;
+  itval.it_value.tv_nsec = 0;
+
+  sigev.sigev_notify = SIGEV_SIGNAL;
+  sigev.sigev_signo = SIGALRM;
+  sigev.sigev_value.sival_ptr = (void *) &timerId;
+
+  for (i = 0; i < 100; i++)
+    {
+      printf ("cnt = %d\n", i);
+
+      pthread_t thr;
+      res = pthread_create (&thr, NULL, &do_timer_create, &sigev);
+      if (res)
+	{
+	  printf ("pthread_create: %s\n", strerror (res));
+	  continue;
+	}
+      void *val;
+      res = pthread_join (thr, &val);
+      if (res)
+	{
+	  printf ("pthread_join: %s\n", strerror (res));
+	  continue;
+	}
+      if (val == NULL)
+	continue;
+
+      res = timer_settime (timerId, 0, &itval, NULL);
+      if (res < 0)
+	printf ("timer_settime: %m\n");
+
+      res = timer_delete (timerId);
+      if (res < 0)
+	printf ("timer_delete: %m\n");
+    }
+
+  return 0;
+}
+
+# define TEST_FUNCTION do_test ()
+#else
+# define TEST_FUNCTION 0
+#endif
+
+#include "../test-skeleton.c"
diff --git a/ap/build/uClibc/test/nptl/tst-timer4.c b/ap/build/uClibc/test/nptl/tst-timer4.c
new file mode 100644
index 0000000..5bec011
--- /dev/null
+++ b/ap/build/uClibc/test/nptl/tst-timer4.c
@@ -0,0 +1,648 @@
+/* Tests for POSIX timer implementation.
+   Copyright (C) 2004 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+   Contributed by Jakub Jelinek <jakub@redhat.com>, 2004
+
+   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 <signal.h>
+#include <stdio.h>
+#include <string.h>
+#include <time.h>
+#include <unistd.h>
+#if _POSIX_THREADS
+# include <pthread.h>
+
+# ifndef TEST_CLOCK
+#  define TEST_CLOCK		CLOCK_REALTIME
+# endif
+
+pthread_mutex_t lock = PTHREAD_MUTEX_INITIALIZER;
+pthread_cond_t cond = PTHREAD_COND_INITIALIZER;
+
+timer_t timer_none, timer_sig1, timer_sig2, timer_thr1, timer_thr2;
+
+int thr1_cnt, thr1_err;
+union sigval thr1_sigval;
+struct timespec thr1_ts;
+
+static void
+thr1 (union sigval sigval)
+{
+  pthread_mutex_lock (&lock);
+  thr1_err = clock_gettime (TEST_CLOCK, &thr1_ts);
+  if (thr1_cnt >= 5)
+    {
+      struct itimerspec it = { };
+      thr1_err |= timer_settime (timer_thr1, 0, &it, NULL);
+    }
+  thr1_sigval = sigval;
+  ++thr1_cnt;
+  pthread_cond_signal (&cond);
+  pthread_mutex_unlock (&lock);
+}
+
+int thr2_cnt, thr2_err;
+union sigval thr2_sigval;
+size_t thr2_guardsize;
+struct timespec thr2_ts;
+
+static void
+thr2 (union sigval sigval)
+{
+  pthread_attr_t nattr;
+  int err = 0;
+  size_t guardsize = -1;
+  int ret = pthread_getattr_np (pthread_self (), &nattr);
+  if (ret)
+    {
+      errno = ret;
+      printf ("*** pthread_getattr_np failed: %m\n");
+      err = 1;
+    }
+  else
+    {
+      ret = pthread_attr_getguardsize (&nattr, &guardsize);
+      if (ret)
+        {
+          errno = ret;
+          printf ("*** pthread_attr_getguardsize failed: %m\n");
+          err = 1;
+        }
+      if (pthread_attr_destroy (&nattr) != 0)
+        {
+          puts ("*** pthread_attr_destroy failed");
+          err = 1;
+        }
+    }
+  pthread_mutex_lock (&lock);
+  thr2_err = clock_gettime (TEST_CLOCK, &thr2_ts) | err;
+  if (thr2_cnt >= 5)
+    {
+      struct itimerspec it = { };
+      thr2_err |= timer_settime (timer_thr2, 0, &it, NULL);
+    }
+  thr2_sigval = sigval;
+  ++thr2_cnt;
+  thr2_guardsize = guardsize;
+  pthread_cond_signal (&cond);
+  pthread_mutex_unlock (&lock);
+}
+
+volatile int sig1_cnt, sig1_err;
+volatile union sigval sig1_sigval;
+struct timespec sig1_ts;
+
+static void
+sig1_handler (int sig, siginfo_t *info, void *ctx)
+{
+  int err = 0;
+  if (sig != SIGRTMIN) err |= 1 << 0;
+  if (info->si_signo != SIGRTMIN) err |= 1 << 1;
+  if (info->si_code != SI_TIMER) err |= 1 << 2;
+  if (clock_gettime (TEST_CLOCK, &sig1_ts) != 0)
+    err |= 1 << 3;
+  if (sig1_cnt >= 5)
+    {
+      struct itimerspec it = { };
+      if (timer_settime (timer_sig1, 0, &it, NULL))
+	err |= 1 << 4;
+    }
+  sig1_err |= err;
+  sig1_sigval = info->si_value;
+  ++sig1_cnt;
+}
+
+volatile int sig2_cnt, sig2_err;
+volatile union sigval sig2_sigval;
+struct timespec sig2_ts;
+
+static void
+sig2_handler (int sig, siginfo_t *info, void *ctx)
+{
+  int err = 0;
+  if (sig != SIGRTMIN + 1) err |= 1 << 0;
+  if (info->si_signo != SIGRTMIN + 1) err |= 1 << 1;
+  if (info->si_code != SI_TIMER) err |= 1 << 2;
+  if (clock_gettime (TEST_CLOCK, &sig2_ts) != 0)
+    err |= 1 << 3;
+  if (sig2_cnt >= 5)
+    {
+      struct itimerspec it = { };
+      if (timer_settime (timer_sig2, 0, &it, NULL))
+	err |= 1 << 4;
+    }
+  sig2_err |= err;
+  sig2_sigval = info->si_value;
+  ++sig2_cnt;
+}
+
+/* Check if end is later or equal to start + nsec.  */
+static int
+check_ts (const char *name, const struct timespec *start,
+	  const struct timespec *end, long msec)
+{
+  struct timespec ts = *start;
+
+  ts.tv_sec += msec / 1000000;
+  ts.tv_nsec += (msec % 1000000) * 1000;
+  if (ts.tv_nsec >= 1000000000)
+    {
+      ++ts.tv_sec;
+      ts.tv_nsec -= 1000000000;
+    }
+  if (end->tv_sec < ts.tv_sec
+      || (end->tv_sec == ts.tv_sec && end->tv_nsec < ts.tv_nsec))
+    {
+      printf ("\
+*** timer %s invoked too soon: %ld.%09ld instead of expected %ld.%09ld\n",
+	      name, (long) end->tv_sec, end->tv_nsec,
+	      (long) ts.tv_sec, ts.tv_nsec);
+      return 1;
+    }
+  else
+    return 0;
+}
+
+#define TIMEOUT 15
+#define TEST_FUNCTION do_test ()
+static int
+do_test (void)
+{
+  int result = 0;
+
+#ifdef TEST_CLOCK_MISSING
+  const char *missing = TEST_CLOCK_MISSING (TEST_CLOCK);
+  if (missing != NULL)
+    {
+      printf ("%s missing, skipping test\n", missing);
+      return 0;
+    }
+#endif
+
+  struct timespec ts;
+  if (clock_gettime (TEST_CLOCK, &ts) != 0)
+    {
+      printf ("*** clock_gettime failed: %m\n");
+      result = 1;
+    }
+  else
+    printf ("clock_gettime returned timespec = { %ld, %ld }\n",
+	    (long) ts.tv_sec, ts.tv_nsec);
+
+  if (clock_getres (TEST_CLOCK, &ts) != 0)
+    {
+      printf ("*** clock_getres failed: %m\n");
+      result = 1;
+    }
+  else
+    printf ("clock_getres returned timespec = { %ld, %ld }\n",
+	    (long) ts.tv_sec, ts.tv_nsec);
+
+  struct sigevent ev;
+  memset (&ev, 0x11, sizeof (ev));
+  ev.sigev_notify = SIGEV_NONE;
+  if (timer_create (TEST_CLOCK, &ev, &timer_none) != 0)
+    {
+      printf ("*** timer_create for timer_none failed: %m\n");
+      return 1;
+    }
+
+  struct sigaction sa = { .sa_sigaction = sig1_handler,
+			  .sa_flags = SA_SIGINFO };
+  sigemptyset (&sa.sa_mask);
+  sigaction (SIGRTMIN, &sa, NULL);
+  sa.sa_sigaction = sig2_handler;
+  sigaction (SIGRTMIN + 1, &sa, NULL);
+
+  memset (&ev, 0x22, sizeof (ev));
+  ev.sigev_notify = SIGEV_SIGNAL;
+  ev.sigev_signo = SIGRTMIN;
+  ev.sigev_value.sival_ptr = &ev;
+  if (timer_create (TEST_CLOCK, &ev, &timer_sig1) != 0)
+    {
+      printf ("*** timer_create for timer_sig1 failed: %m\n");
+      return 1;
+    }
+
+  memset (&ev, 0x33, sizeof (ev));
+  ev.sigev_notify = SIGEV_SIGNAL;
+  ev.sigev_signo = SIGRTMIN + 1;
+  ev.sigev_value.sival_int = 163;
+  if (timer_create (TEST_CLOCK, &ev, &timer_sig2) != 0)
+    {
+      printf ("*** timer_create for timer_sig2 failed: %m\n");
+      return 1;
+    }
+
+  memset (&ev, 0x44, sizeof (ev));
+  ev.sigev_notify = SIGEV_THREAD;
+  ev.sigev_notify_function = thr1;
+  ev.sigev_notify_attributes = NULL;
+  ev.sigev_value.sival_ptr = &ev;
+  if (timer_create (TEST_CLOCK, &ev, &timer_thr1) != 0)
+    {
+      printf ("*** timer_create for timer_thr1 failed: %m\n");
+      return 1;
+    }
+
+  pthread_attr_t nattr;
+  if (pthread_attr_init (&nattr)
+      || pthread_attr_setguardsize (&nattr, 0))
+    {
+      puts ("*** pthread_attr_t setup failed");
+      result = 1;
+    }
+
+  memset (&ev, 0x55, sizeof (ev));
+  ev.sigev_notify = SIGEV_THREAD;
+  ev.sigev_notify_function = thr2;
+  ev.sigev_notify_attributes = &nattr;
+  ev.sigev_value.sival_int = 111;
+  if (timer_create (TEST_CLOCK, &ev, &timer_thr2) != 0)
+    {
+      printf ("*** timer_create for timer_thr2 failed: %m\n");
+      return 1;
+    }
+
+  int ret = timer_getoverrun (timer_thr1);
+  if (ret != 0)
+    {
+      if (ret == -1)
+	printf ("*** timer_getoverrun failed: %m\n");
+      else
+	printf ("*** timer_getoverrun returned %d != 0\n", ret);
+      result = 1;
+    }
+
+  struct itimerspec it;
+  it.it_value.tv_sec = 0;
+  it.it_value.tv_nsec = -26;
+  it.it_interval.tv_sec = 0;
+  it.it_interval.tv_nsec = 0;
+  if (timer_settime (timer_sig1, 0, &it, NULL) == 0)
+    {
+      puts ("*** timer_settime with negative tv_nsec unexpectedly succeeded");
+      result = 1;
+    }
+  else if (errno != EINVAL)
+    {
+      printf ("*** timer_settime with negative tv_nsec did not fail with "
+	      "EINVAL: %m\n");
+      result = 1;
+    }
+
+  it.it_value.tv_nsec = 100000;
+  it.it_interval.tv_nsec = 1000000000;
+  if (timer_settime (timer_sig2, 0, &it, NULL) == 0)
+    {
+      puts ("\
+*** timer_settime with tv_nsec 1000000000 unexpectedly succeeded");
+      result = 1;
+    }
+  else if (errno != EINVAL)
+    {
+      printf ("*** timer_settime with tv_nsec 1000000000 did not fail with "
+	      "EINVAL: %m\n");
+      result = 1;
+    }
+
+#if 0
+  it.it_value.tv_nsec = 0;
+  it.it_interval.tv_nsec = -26;
+  if (timer_settime (timer_thr1, 0, &it, NULL) != 0)
+    {
+      printf ("\
+!!! timer_settime with it_value 0 it_interval invalid failed: %m\n");
+      /* FIXME: is this mandated by POSIX?
+      result = 1; */
+    }
+
+  it.it_interval.tv_nsec = 3000000000;
+  if (timer_settime (timer_thr2, 0, &it, NULL) != 0)
+    {
+      printf ("\
+!!! timer_settime with it_value 0 it_interval invalid failed: %m\n");
+      /* FIXME: is this mandated by POSIX?
+      result = 1; */
+    }
+#endif
+
+  struct timespec startts;
+  if (clock_gettime (TEST_CLOCK, &startts) != 0)
+    {
+      printf ("*** clock_gettime failed: %m\n");
+      result = 1;
+    }
+
+  it.it_value.tv_nsec = 100000000;
+  it.it_interval.tv_nsec = 0;
+  if (timer_settime (timer_none, 0, &it, NULL) != 0)
+    {
+      printf ("*** timer_settime timer_none failed: %m\n");
+      result = 1;
+    }
+
+  it.it_value.tv_nsec = 200000000;
+  if (timer_settime (timer_thr1, 0, &it, NULL) != 0)
+    {
+      printf ("*** timer_settime timer_thr1 failed: %m\n");
+      result = 1;
+    }
+
+  it.it_value.tv_nsec = 300000000;
+  if (timer_settime (timer_thr2, 0, &it, NULL) != 0)
+    {
+      printf ("*** timer_settime timer_thr2 failed: %m\n");
+      result = 1;
+    }
+
+  it.it_value.tv_nsec = 400000000;
+  if (timer_settime (timer_sig1, 0, &it, NULL) != 0)
+    {
+      printf ("*** timer_settime timer_sig1 failed: %m\n");
+      result = 1;
+    }
+
+  it.it_value.tv_nsec = 500000000;
+  if (TEMP_FAILURE_RETRY (timer_settime (timer_sig2, 0, &it, NULL)) != 0)
+    {
+      printf ("*** timer_settime timer_sig2 failed: %m\n");
+      result = 1;
+    }
+
+  pthread_mutex_lock (&lock);
+  while (thr1_cnt == 0 || thr2_cnt == 0)
+    pthread_cond_wait (&cond, &lock);
+  pthread_mutex_unlock (&lock);
+
+  while (sig1_cnt == 0 || sig2_cnt == 0)
+    {
+      ts.tv_sec = 0;
+      ts.tv_nsec = 100000000;
+      nanosleep (&ts, NULL);
+    }
+
+  pthread_mutex_lock (&lock);
+
+  if (thr1_cnt != 1)
+    {
+      printf ("*** thr1 not called exactly once, but %d times\n", thr1_cnt);
+      result = 1;
+    }
+  else if (thr1_err)
+    {
+      puts ("*** an error occurred in thr1");
+      result = 1;
+    }
+  else if (thr1_sigval.sival_ptr != &ev)
+    {
+      printf ("*** thr1_sigval.sival_ptr %p != %p\n",
+	      thr1_sigval.sival_ptr, &ev);
+      result = 1;
+    }
+  else if (check_ts ("thr1", &startts, &thr1_ts, 200000))
+    result = 1;
+
+  if (thr2_cnt != 1)
+    {
+      printf ("*** thr2 not called exactly once, but %d times\n", thr2_cnt);
+      result = 1;
+    }
+  else if (thr2_err)
+    {
+      puts ("*** an error occurred in thr2");
+      result = 1;
+    }
+  else if (thr2_sigval.sival_int != 111)
+    {
+      printf ("*** thr2_sigval.sival_ptr %d != 111\n", thr2_sigval.sival_int);
+      result = 1;
+    }
+  else if (check_ts ("thr2", &startts, &thr2_ts, 300000))
+    result = 1;
+  else if (thr2_guardsize != 0)
+    {
+      printf ("*** thr2 guardsize %zd != 0\n", thr2_guardsize);
+      result = 1;
+    }
+
+  pthread_mutex_unlock (&lock);
+
+  if (sig1_cnt != 1)
+    {
+      printf ("*** sig1 not called exactly once, but %d times\n", sig1_cnt);
+      result = 1;
+    }
+  else if (sig1_err)
+    {
+      printf ("*** errors occurred in sig1 handler %x\n", sig1_err);
+      result = 1;
+    }
+  else if (sig1_sigval.sival_ptr != &ev)
+    {
+      printf ("*** sig1_sigval.sival_ptr %p != %p\n",
+	      sig1_sigval.sival_ptr, &ev);
+      result = 1;
+    }
+  else if (check_ts ("sig1", &startts, &sig1_ts, 400000))
+    result = 1;
+
+  if (sig2_cnt != 1)
+    {
+      printf ("*** sig2 not called exactly once, but %d times\n", sig2_cnt);
+      result = 1;
+    }
+  else if (sig2_err)
+    {
+      printf ("*** errors occurred in sig2 handler %x\n", sig2_err);
+      result = 1;
+    }
+  else if (sig2_sigval.sival_int != 163)
+    {
+      printf ("*** sig2_sigval.sival_ptr %d != 163\n", sig2_sigval.sival_int);
+      result = 1;
+    }
+  else if (check_ts ("sig2", &startts, &sig2_ts, 500000))
+    result = 1;
+
+  if (timer_gettime (timer_none, &it) != 0)
+    {
+      printf ("*** timer_gettime timer_none failed: %m\n");
+      result = 1;
+    }
+  else if (it.it_value.tv_sec || it.it_value.tv_nsec
+	   || it.it_interval.tv_sec || it.it_interval.tv_nsec)
+    {
+      printf ("\
+*** timer_gettime timer_none returned { %ld.%09ld, %ld.%09ld }\n",
+	      (long) it.it_value.tv_sec, it.it_value.tv_nsec,
+	      (long) it.it_interval.tv_sec, it.it_interval.tv_nsec);
+      result = 1;
+    }
+
+  if (clock_gettime (TEST_CLOCK, &startts) != 0)
+    {
+      printf ("*** clock_gettime failed: %m\n");
+      result = 1;
+    }
+
+  it.it_value.tv_sec = 1;
+  it.it_value.tv_nsec = 0;
+  it.it_interval.tv_sec = 0;
+  it.it_interval.tv_nsec = 100000000;
+  if (timer_settime (timer_none, 0, &it, NULL) != 0)
+    {
+      printf ("*** timer_settime timer_none failed: %m\n");
+      result = 1;
+    }
+
+  it.it_value.tv_nsec = 100000000;
+  it.it_interval.tv_nsec = 200000000;
+  if (timer_settime (timer_thr1, 0, &it, NULL) != 0)
+    {
+      printf ("*** timer_settime timer_thr1 failed: %m\n");
+      result = 1;
+    }
+
+  it.it_value.tv_nsec = 200000000;
+  it.it_interval.tv_nsec = 300000000;
+  if (timer_settime (timer_thr2, 0, &it, NULL) != 0)
+    {
+      printf ("*** timer_settime timer_thr2 failed: %m\n");
+      result = 1;
+    }
+
+  it.it_value.tv_nsec = 300000000;
+  it.it_interval.tv_nsec = 400000000;
+  if (timer_settime (timer_sig1, 0, &it, NULL) != 0)
+    {
+      printf ("*** timer_settime timer_sig1 failed: %m\n");
+      result = 1;
+    }
+
+  it.it_value.tv_nsec = 400000000;
+  it.it_interval.tv_nsec = 500000000;
+  if (TEMP_FAILURE_RETRY (timer_settime (timer_sig2, 0, &it, NULL)) != 0)
+    {
+      printf ("*** timer_settime timer_sig2 failed: %m\n");
+      result = 1;
+    }
+
+  pthread_mutex_lock (&lock);
+  while (thr1_cnt < 6 || thr2_cnt < 6)
+    pthread_cond_wait (&cond, &lock);
+  pthread_mutex_unlock (&lock);
+
+  while (sig1_cnt < 6 || sig2_cnt < 6)
+    {
+      ts.tv_sec = 0;
+      ts.tv_nsec = 100000000;
+      nanosleep (&ts, NULL);
+    }
+
+  pthread_mutex_lock (&lock);
+
+  if (thr1_err)
+    {
+      puts ("*** an error occurred in thr1");
+      result = 1;
+    }
+  else if (check_ts ("thr1", &startts, &thr1_ts, 1100000 + 4 * 200000))
+    result = 1;
+
+  if (thr2_err)
+    {
+      puts ("*** an error occurred in thr2");
+      result = 1;
+    }
+  else if (check_ts ("thr2", &startts, &thr2_ts, 1200000 + 4 * 300000))
+    result = 1;
+  else if (thr2_guardsize != 0)
+    {
+      printf ("*** thr2 guardsize %zd != 0\n", thr2_guardsize);
+      result = 1;
+    }
+
+  pthread_mutex_unlock (&lock);
+
+  if (sig1_err)
+    {
+      printf ("*** errors occurred in sig1 handler %x\n", sig1_err);
+      result = 1;
+    }
+  else if (check_ts ("sig1", &startts, &sig1_ts, 1300000 + 4 * 400000))
+    result = 1;
+
+  if (sig2_err)
+    {
+      printf ("*** errors occurred in sig2 handler %x\n", sig2_err);
+      result = 1;
+    }
+  else if (check_ts ("sig2", &startts, &sig2_ts, 1400000 + 4 * 500000))
+    result = 1;
+
+  if (timer_gettime (timer_none, &it) != 0)
+    {
+      printf ("*** timer_gettime timer_none failed: %m\n");
+      result = 1;
+    }
+  else if (it.it_interval.tv_sec || it.it_interval.tv_nsec != 100000000)
+    {
+      printf ("\
+!!! second timer_gettime timer_none returned it_interval %ld.%09ld\n",
+	      (long) it.it_interval.tv_sec, it.it_interval.tv_nsec);
+      /* FIXME: For now disabled.
+      result = 1; */
+    }
+
+  if (timer_delete (timer_none) != 0)
+    {
+      printf ("*** timer_delete for timer_none failed: %m\n");
+      result = 1;
+    }
+
+  if (timer_delete (timer_sig1) != 0)
+    {
+      printf ("*** timer_delete for timer_sig1 failed: %m\n");
+      result = 1;
+    }
+
+  if (timer_delete (timer_sig2) != 0)
+    {
+      printf ("*** timer_delete for timer_sig2 failed: %m\n");
+      result = 1;
+    }
+
+  if (timer_delete (timer_thr1) != 0)
+    {
+      printf ("*** timer_delete for timer_thr1 failed: %m\n");
+      result = 1;
+    }
+
+  if (timer_delete (timer_thr2) != 0)
+    {
+      printf ("*** timer_delete for timer_thr2 failed: %m\n");
+      result = 1;
+    }
+  return result;
+}
+#else
+# define TEST_FUNCTION 0
+#endif
+
+#include "../test-skeleton.c"
diff --git a/ap/build/uClibc/test/nptl/tst-timer5.c b/ap/build/uClibc/test/nptl/tst-timer5.c
new file mode 100644
index 0000000..6466c8e
--- /dev/null
+++ b/ap/build/uClibc/test/nptl/tst-timer5.c
@@ -0,0 +1,38 @@
+/* Timer test using the monotonic clock.  */
+
+#include <time.h>
+#include <unistd.h>
+
+#if defined CLOCK_MONOTONIC && defined _POSIX_MONOTONIC_CLOCK
+
+# define TEST_CLOCK	CLOCK_MONOTONIC
+# define TEST_CLOCK_MISSING(clock) \
+  (setup_test () ? "CLOCK_MONOTONIC" : NULL)
+
+# include <stdio.h>
+
+static int
+setup_test (void)
+{
+  if (sysconf (_SC_MONOTONIC_CLOCK) <= 0)
+    return 1;
+
+  /* The user-level timers implementation doesn't support CLOCK_MONOTONIC,
+     even though sysconf claims it will.  */
+  timer_t t;
+  if (timer_create (TEST_CLOCK, NULL, &t) != 0)
+    {
+      printf ("timer_create: %m\n");
+      return 1;
+    }
+  timer_delete (t);
+
+  return 0;
+}
+
+# include "tst-timer4.c"
+
+#else
+# define TEST_FUNCTION	0
+# include "../test-skeleton.c"
+#endif
diff --git a/ap/build/uClibc/test/nptl/tst-tls1.c b/ap/build/uClibc/test/nptl/tst-tls1.c
new file mode 100644
index 0000000..541035e
--- /dev/null
+++ b/ap/build/uClibc/test/nptl/tst-tls1.c
@@ -0,0 +1,122 @@
+/* Copyright (C) 2003, 2004 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, write to the Free
+   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+   02111-1307 USA.  */
+
+#include <pthread.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <tls.h>
+
+#if HAVE___THREAD
+struct test_s
+{
+  int a;
+  int b;
+};
+
+#define INIT_A 1
+#define INIT_B 42
+/* Deliberately not static.  */
+__thread struct test_s s __attribute__ ((tls_model ("initial-exec"))) =
+{
+  .a = INIT_A,
+  .b = INIT_B
+};
+
+
+static void *
+tf (void *arg)
+{
+  if (s.a != INIT_A || s.b != INIT_B)
+    {
+      puts ("initial value of s in child thread wrong");
+      exit (1);
+    }
+
+  ++s.a;
+
+  return NULL;
+}
+#endif
+
+
+int
+do_test (void)
+{
+#if !HAVE___THREAD
+
+  puts ("No __thread support in compiler, test skipped.");
+
+  return 0;
+#else
+
+  if (s.a != INIT_A || s.b != INIT_B)
+    {
+      puts ("initial value of s in main thread wrong");
+      exit (1);
+    }
+
+  pthread_attr_t a;
+
+  if (pthread_attr_init (&a) != 0)
+    {
+      puts ("attr_init failed");
+      exit (1);
+    }
+
+  if (pthread_attr_setstacksize (&a, 1 * 1024 * 1024) != 0)
+    {
+      puts ("attr_setstacksize failed");
+      return 1;
+    }
+
+#define N 10
+  int i;
+  for (i = 0; i < N; ++i)
+    {
+#define M 10
+      pthread_t th[M];
+      int j;
+      for (j = 0; j < M; ++j, ++s.a)
+	if (pthread_create (&th[j], &a, tf, NULL) != 0)
+	  {
+	    puts ("pthread_create failed");
+	    exit (1);
+	  }
+
+      for (j = 0; j < M; ++j)
+	if (pthread_join (th[j], NULL) != 0)
+	  {
+	    puts ("pthread_join failed");
+	    exit (1);
+	  }
+    }
+
+  if (pthread_attr_destroy (&a) != 0)
+    {
+      puts ("attr_destroy failed");
+      exit (1);
+    }
+
+  return 0;
+#endif
+}
+
+
+#define TEST_FUNCTION do_test ()
+#include "../test-skeleton.c"
diff --git a/ap/build/uClibc/test/nptl/tst-tls2.c b/ap/build/uClibc/test/nptl/tst-tls2.c
new file mode 100644
index 0000000..3615d1b
--- /dev/null
+++ b/ap/build/uClibc/test/nptl/tst-tls2.c
@@ -0,0 +1,216 @@
+/* Copyright (C) 2003, 2004 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, 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 <semaphore.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <unistd.h>
+#include <tls.h>
+
+#if HAVE___THREAD
+
+#define N 10
+static pthread_t th[N];
+
+
+#define CB(n) \
+static void								      \
+cb##n (void)								      \
+{									      \
+  if (th[n] != pthread_self ())						      \
+    {									      \
+      write (STDOUT_FILENO, "wrong callback\n", 15);			      \
+      _exit (1);							      \
+    }									      \
+}
+CB (0)
+CB (1)
+CB (2)
+CB (3)
+CB (4)
+CB (5)
+CB (6)
+CB (7)
+CB (8)
+CB (9)
+static void (*cbs[]) (void) =
+{
+  cb0, cb1, cb2, cb3, cb4, cb5, cb6, cb7, cb8, cb9
+};
+
+
+static __thread void (*fp) (void) __attribute__ ((tls_model ("local-exec")));
+
+
+static sem_t s;
+
+
+#define THE_SIG SIGUSR1
+static void
+handler (int sig)
+{
+  if (sig != THE_SIG)
+    {
+      write (STDOUT_FILENO, "wrong signal\n", 13);
+      _exit (1);
+    }
+
+  fp ();
+
+  if (sem_post (&s) != 0)
+    {
+      write (STDOUT_FILENO, "sem_post failed\n", 16);
+      _exit (1);
+    }
+}
+
+
+static pthread_barrier_t b;
+
+#define TOTAL_SIGS 1000
+static int nsigs;
+
+
+static void *
+tf (void *arg)
+{
+  fp = arg;
+
+  pthread_barrier_wait (&b);
+
+  pthread_barrier_wait (&b);
+
+  if (nsigs != TOTAL_SIGS)
+    {
+      puts ("barrier_wait prematurely returns");
+      exit (1);
+    }
+
+  return NULL;
+}
+#endif
+
+int
+do_test (void)
+{
+#if !HAVE___THREAD
+
+  puts ("No __thread support in compiler, test skipped.");
+
+  return 0;
+#else
+
+  if (pthread_barrier_init (&b, NULL, N + 1) != 0)
+    {
+      puts ("barrier_init failed");
+      exit (1);
+    }
+
+  if (sem_init (&s, 0, 0) != 0)
+    {
+      puts ("sem_init failed");
+      exit (1);
+    }
+
+  struct sigaction sa;
+  sa.sa_handler = handler;
+  sigemptyset (&sa.sa_mask);
+  sa.sa_flags = 0;
+  if (sigaction (THE_SIG, &sa, NULL) != 0)
+    {
+      puts ("sigaction failed");
+      exit (1);
+    }
+
+  pthread_attr_t a;
+
+  if (pthread_attr_init (&a) != 0)
+    {
+      puts ("attr_init failed");
+      exit (1);
+    }
+
+  if (pthread_attr_setstacksize (&a, 1 * 1024 * 1024) != 0)
+    {
+      puts ("attr_setstacksize failed");
+      return 1;
+    }
+
+  int i;
+  for (i = 0; i < N; ++i)
+    if (pthread_create (&th[i], &a, tf, cbs[i]) != 0)
+      {
+	puts ("pthread_create failed");
+	exit (1);
+      }
+
+  if (pthread_attr_destroy (&a) != 0)
+    {
+      puts ("attr_destroy failed");
+      exit (1);
+    }
+
+  pthread_barrier_wait (&b);
+
+  sigset_t ss;
+  sigemptyset (&ss);
+  sigaddset (&ss, THE_SIG);
+  if (pthread_sigmask (SIG_BLOCK, &ss, NULL) != 0)
+    {
+      puts ("pthread_sigmask failed");
+      exit (1);
+    }
+
+  /* Start sending signals.  */
+  for (i = 0; i < TOTAL_SIGS; ++i)
+    {
+      if (kill (getpid (), THE_SIG) != 0)
+	{
+	  puts ("kill failed");
+	  exit (1);
+	}
+
+      if (TEMP_FAILURE_RETRY (sem_wait (&s)) != 0)
+	{
+	  puts ("sem_wait failed");
+	  exit (1);
+	}
+
+      ++nsigs;
+    }
+
+  pthread_barrier_wait (&b);
+
+  for (i = 0; i < N; ++i)
+    if (pthread_join (th[i], NULL) != 0)
+      {
+	puts ("join failed");
+	exit (1);
+      }
+
+  return 0;
+#endif
+}
+
+
+#define TEST_FUNCTION do_test ()
+#include "../test-skeleton.c"
diff --git a/ap/build/uClibc/test/nptl/tst-tls3.c b/ap/build/uClibc/test/nptl/tst-tls3.c
new file mode 100644
index 0000000..abc5f4c
--- /dev/null
+++ b/ap/build/uClibc/test/nptl/tst-tls3.c
@@ -0,0 +1,225 @@
+/* Copyright (C) 2003, 2004 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, write to the Free
+   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+   02111-1307 USA.  */
+
+#include <dlfcn.h>
+#include <errno.h>
+#include <pthread.h>
+#include <signal.h>
+#include <semaphore.h>
+#include <stdint.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <unistd.h>
+#include <pthreaddef.h>
+#include <tls.h>
+
+#define THE_SIG SIGUSR1
+
+
+#define N 10
+static pthread_t th[N];
+
+
+#define CB(n) \
+static void								      \
+cb##n (void)								      \
+{									      \
+  if (th[n] != pthread_self ())						      \
+    {									      \
+      write (STDOUT_FILENO, "wrong callback\n", 15);			      \
+      _exit (1);							      \
+    }									      \
+}
+CB (0)
+CB (1)
+CB (2)
+CB (3)
+CB (4)
+CB (5)
+CB (6)
+CB (7)
+CB (8)
+CB (9)
+static void (*cbs[]) (void) =
+{
+  cb0, cb1, cb2, cb3, cb4, cb5, cb6, cb7, cb8, cb9
+};
+
+
+sem_t s;
+
+
+pthread_barrier_t b;
+
+#define TOTAL_SIGS 1000
+int nsigs;
+
+
+int
+do_test (void)
+{
+#if !HAVE___THREAD
+
+  puts ("No __thread support in compiler, test skipped.");
+
+  return 0;
+#else
+
+  if ((uintptr_t) pthread_self () & (TCB_ALIGNMENT - 1))
+    {
+      puts ("initial thread's struct pthread not aligned enough");
+      exit (1);
+    }
+
+  if (pthread_barrier_init (&b, NULL, N + 1) != 0)
+    {
+      puts ("barrier_init failed");
+      exit (1);
+    }
+
+  if (sem_init (&s, 0, 0) != 0)
+    {
+      puts ("sem_init failed");
+      exit (1);
+    }
+
+  void *h = dlopen ("tst-tls3mod.so", RTLD_LAZY);
+  if (h == NULL)
+    {
+      puts ("dlopen failed");
+      exit (1);
+    }
+
+  void *(*tf) (void *) = dlsym (h, "tf");
+  if (tf == NULL)
+    {
+      puts ("dlsym for tf failed");
+      exit (1);
+    }
+
+  void (*setup_tf) (pthread_barrier_t*, int*, sem_t*) = dlsym(h, "setup_tf");
+  if (setup_tf == NULL)
+    {
+      puts ("dlsym for setup_tf failed");
+      exit(1);
+    }
+
+  setup_tf (&b, &nsigs, &s);
+
+  struct sigaction sa;
+  sa.sa_handler = dlsym (h, "handler");
+  if (sa.sa_handler == NULL)
+    {
+      puts ("dlsym for handler failed");
+      exit (1);
+    }
+  sigemptyset (&sa.sa_mask);
+  sa.sa_flags = 0;
+  if (sigaction (THE_SIG, &sa, NULL) != 0)
+    {
+      puts ("sigaction failed");
+      exit (1);
+    }
+
+  pthread_attr_t a;
+
+  if (pthread_attr_init (&a) != 0)
+    {
+      puts ("attr_init failed");
+      exit (1);
+    }
+
+  if (pthread_attr_setstacksize (&a, 1 * 1024 * 1024) != 0)
+    {
+      puts ("attr_setstacksize failed");
+      return 1;
+    }
+
+  int r;
+  for (r = 0; r < 10; ++r)
+    {
+      int i;
+      for (i = 0; i < N; ++i)
+	if (pthread_create (&th[i], &a, tf, cbs[i]) != 0)
+	  {
+	    puts ("pthread_create failed");
+	    exit (1);
+	  }
+
+      nsigs = 0;
+
+      pthread_barrier_wait (&b);
+
+      sigset_t ss;
+      sigemptyset (&ss);
+      sigaddset (&ss, THE_SIG);
+      if (pthread_sigmask (SIG_BLOCK, &ss, NULL) != 0)
+	{
+	  puts ("pthread_sigmask failed");
+	  exit (1);
+	}
+
+      /* Start sending signals.  */
+      for (i = 0; i < TOTAL_SIGS; ++i)
+	{
+	  if (kill (getpid (), THE_SIG) != 0)
+	    {
+	      puts ("kill failed");
+	      exit (1);
+	    }
+
+	  if (TEMP_FAILURE_RETRY (sem_wait (&s)) != 0)
+	    {
+	      puts ("sem_wait failed");
+	      exit (1);
+	    }
+
+	  ++nsigs;
+	}
+
+      pthread_barrier_wait (&b);
+
+      if (pthread_sigmask (SIG_UNBLOCK, &ss, NULL) != 0)
+	{
+	  puts ("pthread_sigmask failed");
+	  exit (1);
+	}
+
+      for (i = 0; i < N; ++i)
+	if (pthread_join (th[i], NULL) != 0)
+	  {
+	    puts ("join failed");
+	    exit (1);
+	  }
+    }
+
+  if (pthread_attr_destroy (&a) != 0)
+    {
+      puts ("attr_destroy failed");
+      exit (1);
+    }
+
+  return 0;
+#endif
+}
+
+
+#define TIMEOUT 5
+#define TEST_FUNCTION do_test ()
+#include "../test-skeleton.c"
diff --git a/ap/build/uClibc/test/nptl/tst-tls3mod.c b/ap/build/uClibc/test/nptl/tst-tls3mod.c
new file mode 100644
index 0000000..53206d3
--- /dev/null
+++ b/ap/build/uClibc/test/nptl/tst-tls3mod.c
@@ -0,0 +1,106 @@
+/* Copyright (C) 2003 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, write to the Free
+   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+   02111-1307 USA.  */
+
+#include <pthread.h>
+#include <semaphore.h>
+#include <signal.h>
+#include <stdint.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <unistd.h>
+#include <pthreaddef.h>
+#include <tls.h>
+
+#if HAVE___THREAD
+
+static pthread_barrier_t* b = NULL;
+
+#define TOTAL_SIGS 1000
+static int* nsigs = NULL;
+
+static sem_t* s = NULL;
+
+static __thread void (*fp) (void);
+
+
+#define THE_SIG SIGUSR1
+void
+handler (int sig)
+{
+  if (sig != THE_SIG)
+    {
+      write (STDOUT_FILENO, "wrong signal\n", 13);
+      _exit (1);
+    }
+
+  fp ();
+
+  if (sem_post (s) != 0)
+    {
+      write (STDOUT_FILENO, "sem_post failed\n", 16);
+      _exit (1);
+    }
+}
+
+void
+setup_tf (pthread_barrier_t* t_b, int* t_nsigs, sem_t* t_s)
+{
+  b = t_b;
+  nsigs = t_nsigs;
+  s = t_s;
+}
+
+void *
+tf (void *arg)
+{
+  if (!b || !s || !nsigs)
+    {
+      puts ("need to call setup_tf first");
+      exit (1);
+    }
+
+  if ((uintptr_t) pthread_self () & (TCB_ALIGNMENT - 1))
+    {
+      puts ("thread's struct pthread not aligned enough");
+      exit (1);
+    }
+
+  if (fp != NULL)
+    {
+      printf("fp=%p\n", (void *)&fp);
+      puts ("fp not initially NULL");
+      exit (1);
+    }
+
+  fp = arg;
+
+  pthread_barrier_wait (b);
+
+  pthread_barrier_wait (b);
+
+  if (*nsigs != TOTAL_SIGS)
+    {
+      puts ("barrier_wait prematurely returns");
+      exit (1);
+    }
+
+  return NULL;
+}
+
+#endif
diff --git a/ap/build/uClibc/test/nptl/tst-tls4.c b/ap/build/uClibc/test/nptl/tst-tls4.c
new file mode 100644
index 0000000..52775de
--- /dev/null
+++ b/ap/build/uClibc/test/nptl/tst-tls4.c
@@ -0,0 +1,191 @@
+/* Copyright (C) 2003 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+   Contributed by Jakub Jelinek <jakub@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, write to the Free
+   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+   02111-1307 USA.  */
+
+#include <dlfcn.h>
+#include <errno.h>
+#include <pthread.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <unistd.h>
+#include <tls.h>
+
+#if HAVE___THREAD && defined HAVE_TLS_MODEL_ATTRIBUTE
+
+#define N 3
+
+void (*test1) (void), (*test2) (void);
+
+pthread_barrier_t b2, b3;
+
+static void *
+tf (void *arg)
+{
+  int i;
+
+  for (i = 0; i <= (uintptr_t) arg; ++i)
+    {
+      int r = pthread_barrier_wait (&b3);
+      if (r != 0 && r != PTHREAD_BARRIER_SERIAL_THREAD)
+	{
+	  puts ("tf: barrier_wait failed");
+	  exit (1);
+	}
+    }
+
+  test1 ();
+
+  for (i = 0; i < 3; ++i)
+    {
+      int r = pthread_barrier_wait (&b3);
+      if (r != 0 && r != PTHREAD_BARRIER_SERIAL_THREAD)
+	{
+	  puts ("tf: barrier_wait failed");
+	  exit (1);
+	}
+    }
+
+  test2 ();
+
+  for (i = 0; i < 3 - (uintptr_t) arg; ++i)
+    {
+      int r = pthread_barrier_wait (&b3);
+      if (r != 0 && r != PTHREAD_BARRIER_SERIAL_THREAD)
+	{
+	  puts ("tf: barrier_wait failed");
+	  exit (1);
+	}
+    }
+
+  return NULL;
+}
+
+static void *
+tf2 (void *arg)
+{
+  int r = pthread_barrier_wait (&b2);
+  if (r != 0 && r != PTHREAD_BARRIER_SERIAL_THREAD)
+    {
+      puts ("tf2: barrier_wait failed");
+      exit (1);
+    }
+
+  int i;
+  for (i = 0; i < N; ++i)
+    tf (arg);
+  return NULL;
+}
+
+int
+do_test (void)
+{
+  pthread_t th[2];
+  const char *modules[N]
+    = { "tst-tls4moda.so", "tst-tls4moda.so", "tst-tls4modb.so" };
+
+  if (pthread_barrier_init (&b2, NULL, 2) != 0)
+    {
+      puts ("barrier_init failed");
+      return 1;
+    }
+
+  if (pthread_barrier_init (&b3, NULL, 3) != 0)
+    {
+      puts ("barrier_init failed");
+      return 1;
+    }
+
+  if (pthread_create (&th[0], NULL, tf2, (void *) (uintptr_t) 1))
+    {
+      puts ("pthread_create failed");
+      return 1;
+    }
+
+  int r = pthread_barrier_wait (&b2);
+  if (r != 0 && r != PTHREAD_BARRIER_SERIAL_THREAD)
+    {
+      puts ("barrier_wait failed");
+      return 1;
+    }
+
+  int i;
+  for (i = 0; i < N; ++i)
+    {
+      void *h = dlopen (modules[i], RTLD_LAZY);
+      if (h == NULL)
+	{
+	  printf ("dlopen failed %s\n", dlerror ());
+	  return 1;
+	}
+
+      test1 = dlsym (h, "test1");
+      if (test1 == NULL)
+	{
+	  printf ("dlsym for test1 failed %s\n", dlerror ());
+	  return 1;
+	}
+
+      test2 = dlsym (h, "test2");
+      if (test2 == NULL)
+	{
+	  printf ("dlsym for test2 failed %s\n", dlerror ());
+	  return 1;
+	}
+
+      if (pthread_create (&th[1], NULL, tf, (void *) (uintptr_t) 2))
+	{
+	  puts ("pthread_create failed");
+	  return 1;
+	}
+
+      tf ((void *) (uintptr_t) 0);
+
+      if (pthread_join (th[1], NULL) != 0)
+	{
+	  puts ("join failed");
+	  return 1;
+	}
+
+      if (dlclose (h))
+	{
+	  puts ("dlclose failed");
+	  return 1;
+	}
+
+      printf ("test %d with %s succeeded\n", i, modules[i]);
+    }
+
+  if (pthread_join (th[0], NULL) != 0)
+    {
+      puts ("join failed");
+      return 1;
+    }
+
+  return 0;
+}
+
+#define TIMEOUT 5
+#define TEST_FUNCTION do_test ()
+
+#else
+
+#define TEST_FUNCTION 0
+
+#endif
+
+#include "../test-skeleton.c"
diff --git a/ap/build/uClibc/test/nptl/tst-tls4moda.c b/ap/build/uClibc/test/nptl/tst-tls4moda.c
new file mode 100644
index 0000000..ff7ee56
--- /dev/null
+++ b/ap/build/uClibc/test/nptl/tst-tls4moda.c
@@ -0,0 +1,56 @@
+/* Copyright (C) 2003 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+   Contributed by Jakub Jelinek <jakub@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, write to the Free
+   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+   02111-1307 USA.  */
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <unistd.h>
+#include <tls.h>
+
+#if HAVE___THREAD && defined HAVE_TLS_MODEL_ATTRIBUTE
+
+static __thread unsigned char foo [32]
+  __attribute__ ((tls_model ("initial-exec"), aligned (sizeof (void *))));
+
+void
+test1 (void)
+{
+  size_t s;
+
+  for (s = 0; s < sizeof (foo); ++s)
+    {
+      if (foo [s])
+        abort ();
+      foo [s] = s;
+    }
+}
+
+void
+test2 (void)
+{
+  size_t s;
+
+  for (s = 0; s < sizeof (foo); ++s)
+    {
+      if (foo [s] != s)
+        abort ();
+      foo [s] = sizeof (foo) - s;
+    }
+}
+
+#endif
diff --git a/ap/build/uClibc/test/nptl/tst-tls4modb.c b/ap/build/uClibc/test/nptl/tst-tls4modb.c
new file mode 100644
index 0000000..99f3b54
--- /dev/null
+++ b/ap/build/uClibc/test/nptl/tst-tls4modb.c
@@ -0,0 +1,65 @@
+/* Copyright (C) 2003 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+   Contributed by Jakub Jelinek <jakub@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, write to the Free
+   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+   02111-1307 USA.  */
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <unistd.h>
+#include <tls.h>
+
+#if HAVE___THREAD && defined HAVE_TLS_MODEL_ATTRIBUTE
+
+static int i;
+int bar;
+
+static __thread void *foo [32 / sizeof (void *)]
+  __attribute__ ((tls_model ("initial-exec"), aligned (sizeof (void *))))
+  = { &i, &bar };
+
+void
+test1 (void)
+{
+  size_t s;
+
+  if (foo [0] != &i || foo [1] != &bar)
+    abort ();
+
+  foo [0] = NULL;
+  foo [1] = NULL;
+  for (s = 0; s < sizeof (foo) / sizeof (void *); ++s)
+    {
+      if (foo [s])
+        abort ();
+      foo [s] = &foo[s];
+    }
+}
+
+void
+test2 (void)
+{
+  size_t s;
+
+  for (s = 0; s < sizeof (foo) / sizeof (void *); ++s)
+    {
+      if (foo [s] != &foo [s])
+        abort ();
+      foo [s] = &foo [s ^ 1];
+    }
+}
+
+#endif
diff --git a/ap/build/uClibc/test/nptl/tst-tls5.c b/ap/build/uClibc/test/nptl/tst-tls5.c
new file mode 100644
index 0000000..476f09a
--- /dev/null
+++ b/ap/build/uClibc/test/nptl/tst-tls5.c
@@ -0,0 +1,119 @@
+/* Copyright (C) 2003 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+   Contributed by Jakub Jelinek <jakub@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, write to the Free
+   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+   02111-1307 USA.  */
+
+/* Check alignment, overlapping and layout of TLS variables.  */
+#include <stdint.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <pthread.h>
+#include <sys/param.h>
+
+#include "tst-tls5.h"
+
+#ifdef TLS_REGISTER
+
+struct tls_obj tls_registry[64];
+
+static int
+tls_addr_cmp (const void *a, const void *b)
+{
+  if (((struct tls_obj *)a)->addr < ((struct tls_obj *)b)->addr)
+    return -1;
+  if (((struct tls_obj *)a)->addr > ((struct tls_obj *)b)->addr)
+    return 1;
+  return 0;
+}
+
+static int
+do_test (void)
+{
+  size_t cnt, i;
+  int res = 0;
+  uintptr_t min_addr = ~(uintptr_t) 0, max_addr = 0;
+
+  for (cnt = 0; tls_registry[cnt].name; ++cnt);
+  tls_registry[cnt].name = NULL;
+  tls_registry[cnt].addr = (uintptr_t) pthread_self ();
+  tls_registry[cnt].size = sizeof (struct pthread);
+  tls_registry[cnt++].align = __alignof__ (struct pthread);
+
+  qsort (tls_registry, cnt, sizeof (struct tls_obj), tls_addr_cmp);
+
+  for (i = 0; i < cnt; ++i)
+    {
+      printf ("%s%s = %p, size %zd, align %zd",
+	      tls_registry[i].name ? "&" : "",
+	      tls_registry[i].name ?: "pthread_self ()",
+	      (void *) tls_registry[i].addr,
+	      tls_registry[i].size, tls_registry[i].align);
+      if (tls_registry[i].addr & (tls_registry[i].align - 1))
+	{
+	  fputs (", WRONG ALIGNMENT", stdout);
+	  res = 1;
+	}
+      if (i > 0
+	  && (tls_registry[i - 1].addr + tls_registry[i - 1].size
+	      > tls_registry[i].addr))
+	{
+	  fputs (", ADDRESS OVERLAP", stdout);
+	  res = 1;
+	}
+      puts ("");
+      if (tls_registry[i].name)
+	{
+	  min_addr = MIN (tls_registry[i].addr, min_addr);
+	  max_addr = MAX (tls_registry[i].addr + tls_registry[i].size,
+			  max_addr);
+	}
+    }
+
+  if (cnt > 1)
+    {
+#if defined(TLS_TCB_AT_TP)
+      if (tls_registry[cnt - 1].name)
+	{
+	  puts ("pthread_self () not larger than all TLS addresses");
+	  res = 1;
+	}
+      else
+	max_addr = MAX (tls_registry[cnt - 1].addr, max_addr);
+#elif defined(TLS_DTV_AT_TP)
+      if (tls_registry[0].name)
+	{
+	  puts ("pthread_self () not smaller than all TLS addresses");
+	  res = 1;
+	}
+#else
+      abort ();
+#endif
+      printf ("Initial TLS used block size %zd\n",
+	      (size_t) (max_addr - min_addr));
+    }
+  return res;
+}
+
+#define TEST_FUNCTION do_test ()
+
+#else
+
+#define TEST_FUNCTION 0
+
+#endif
+
+#include "../test-skeleton.c"
diff --git a/ap/build/uClibc/test/nptl/tst-tls5.h b/ap/build/uClibc/test/nptl/tst-tls5.h
new file mode 100644
index 0000000..b7c14eb
--- /dev/null
+++ b/ap/build/uClibc/test/nptl/tst-tls5.h
@@ -0,0 +1,28 @@
+#include <stdint.h>
+#include <stdlib.h>
+#include <tls.h>
+
+#if USE_TLS && HAVE___THREAD
+
+struct tls_obj
+{
+  const char *name;
+  uintptr_t addr;
+  size_t size;
+  size_t align;
+};
+extern struct tls_obj tls_registry[];
+
+#define TLS_REGISTER(x)				\
+static void __attribute__((constructor))	\
+tls_register_##x (void)				\
+{						\
+  size_t i;					\
+  for (i = 0; tls_registry[i].name; ++i);	\
+  tls_registry[i].name = #x;			\
+  tls_registry[i].addr = (uintptr_t) &x;	\
+  tls_registry[i].size = sizeof (x);		\
+  tls_registry[i].align = __alignof__ (x);	\
+}
+
+#endif
diff --git a/ap/build/uClibc/test/nptl/tst-tls5mod.c b/ap/build/uClibc/test/nptl/tst-tls5mod.c
new file mode 100644
index 0000000..4616a20
--- /dev/null
+++ b/ap/build/uClibc/test/nptl/tst-tls5mod.c
@@ -0,0 +1,6 @@
+#include "tst-tls5.h"
+
+#ifdef TLS_REGISTER
+/* Ensure tls_registry is exported from the binary.  */
+void *tst_tls5mod attribute_hidden = tls_registry;
+#endif
diff --git a/ap/build/uClibc/test/nptl/tst-tls5moda.c b/ap/build/uClibc/test/nptl/tst-tls5moda.c
new file mode 100644
index 0000000..4644d76
--- /dev/null
+++ b/ap/build/uClibc/test/nptl/tst-tls5moda.c
@@ -0,0 +1,6 @@
+#include "tst-tls5.h"
+
+#ifdef TLS_REGISTER
+static __thread char a [32] __attribute__ ((aligned (64)));
+TLS_REGISTER (a)
+#endif
diff --git a/ap/build/uClibc/test/nptl/tst-tls5modb.c b/ap/build/uClibc/test/nptl/tst-tls5modb.c
new file mode 100644
index 0000000..09b4396
--- /dev/null
+++ b/ap/build/uClibc/test/nptl/tst-tls5modb.c
@@ -0,0 +1,6 @@
+#include "tst-tls5.h"
+
+#ifdef TLS_REGISTER
+static __thread int b;
+TLS_REGISTER (b)
+#endif
diff --git a/ap/build/uClibc/test/nptl/tst-tls5modc.c b/ap/build/uClibc/test/nptl/tst-tls5modc.c
new file mode 100644
index 0000000..bbd8963
--- /dev/null
+++ b/ap/build/uClibc/test/nptl/tst-tls5modc.c
@@ -0,0 +1,6 @@
+#include "tst-tls5.h"
+
+#ifdef TLS_REGISTER
+static __thread int c;
+TLS_REGISTER (c)
+#endif
diff --git a/ap/build/uClibc/test/nptl/tst-tls5modd.c b/ap/build/uClibc/test/nptl/tst-tls5modd.c
new file mode 100644
index 0000000..8b54d16
--- /dev/null
+++ b/ap/build/uClibc/test/nptl/tst-tls5modd.c
@@ -0,0 +1,6 @@
+#include "tst-tls5.h"
+
+#ifdef TLS_REGISTER
+static __thread int d;
+TLS_REGISTER (d)
+#endif
diff --git a/ap/build/uClibc/test/nptl/tst-tls5mode.c b/ap/build/uClibc/test/nptl/tst-tls5mode.c
new file mode 100644
index 0000000..d30b067
--- /dev/null
+++ b/ap/build/uClibc/test/nptl/tst-tls5mode.c
@@ -0,0 +1,8 @@
+#include "tst-tls5.h"
+
+#ifdef TLS_REGISTER
+static __thread int e1 = 24;
+static __thread char e2 [32] __attribute__ ((aligned (64)));
+TLS_REGISTER (e1)
+TLS_REGISTER (e2)
+#endif
diff --git a/ap/build/uClibc/test/nptl/tst-tls5modf.c b/ap/build/uClibc/test/nptl/tst-tls5modf.c
new file mode 100644
index 0000000..52dcb94
--- /dev/null
+++ b/ap/build/uClibc/test/nptl/tst-tls5modf.c
@@ -0,0 +1,9 @@
+#include "tst-tls5.h"
+
+#ifdef TLS_REGISTER
+char tst_tls5modf[60] attribute_hidden = { 26 };
+static __thread int f1 = 24;
+static __thread char f2 [32] __attribute__ ((aligned (64)));
+TLS_REGISTER (f1)
+TLS_REGISTER (f2)
+#endif
diff --git a/ap/build/uClibc/test/nptl/tst-tsd1.c b/ap/build/uClibc/test/nptl/tst-tsd1.c
new file mode 100644
index 0000000..51b2d0c
--- /dev/null
+++ b/ap/build/uClibc/test/nptl/tst-tsd1.c
@@ -0,0 +1,118 @@
+/* Copyright (C) 2002 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+   Contributed by Ulrich Drepper <drepper@redhat.com>, 2002.
+
+   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>
+#include <stdio.h>
+#include <string.h>
+
+
+static int
+do_test (void)
+{
+  pthread_key_t key1;
+  pthread_key_t key2;
+  void *value;
+  int result = 0;
+  int err;
+
+  err = pthread_key_create (&key1, NULL);
+  if (err != 0)
+    {
+      printf ("1st key_create failed: %s\n", strerror (err));
+      return 1;
+    }
+
+  /* Initial value must be NULL.  */
+  value = pthread_getspecific (key1);
+  if (value != NULL)
+    {
+      puts ("1st getspecific != NULL");
+      result = 1;
+    }
+
+  err = pthread_setspecific (key1, (void *) -2l);
+  if (err != 0)
+    {
+      printf ("1st setspecific failed: %s\n", strerror (err));
+      return 1;
+    }
+
+  value = pthread_getspecific (key1);
+  if (value == NULL)
+    {
+      puts ("2nd getspecific == NULL\n");
+      result = 1;
+    }
+  else if (value != (void *) -2l)
+    {
+      puts ("2nd getspecific != -2l\n");
+      result = 1;
+    }
+
+  err = pthread_setspecific (key1, (void *) -3l);
+  if (err != 0)
+    {
+      printf ("2nd setspecific failed: %s\n", strerror (err));
+      return 1;
+    }
+
+  value = pthread_getspecific (key1);
+  if (value == NULL)
+    {
+      puts ("3rd getspecific == NULL\n");
+      result = 1;
+    }
+  else if (value != (void *) -3l)
+    {
+      puts ("3rd getspecific != -2l\n");
+      result = 1;
+    }
+
+  err = pthread_key_delete (key1);
+  if (err != 0)
+    {
+      printf ("key_delete failed: %s\n", strerror (err));
+      result = 1;
+    }
+
+
+  err = pthread_key_create (&key2, NULL);
+  if (err != 0)
+    {
+      printf ("2nd key_create failed: %s\n", strerror (err));
+      return 1;
+    }
+
+  if (key1 != key2)
+    puts ("key1 != key2; no more tests performed");
+  else
+    {
+      value = pthread_getspecific (key2);
+      if (value != NULL)
+	{
+	  puts ("4th getspecific != NULL");
+	  result = 1;
+	}
+    }
+
+  return result;
+}
+
+#define TEST_FUNCTION do_test ()
+#include "../test-skeleton.c"
diff --git a/ap/build/uClibc/test/nptl/tst-tsd2.c b/ap/build/uClibc/test/nptl/tst-tsd2.c
new file mode 100644
index 0000000..19d8a69
--- /dev/null
+++ b/ap/build/uClibc/test/nptl/tst-tsd2.c
@@ -0,0 +1,97 @@
+/* Copyright (C) 2002, 2003 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+   Contributed by Ulrich Drepper <drepper@redhat.com>, 2002.
+
+   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>
+#include <stdio.h>
+#include <string.h>
+
+
+static int result;
+
+
+static void
+destr (void *arg)
+{
+  if (arg != (void *) -2l)
+    result = 2;
+  else
+    result = 0;
+}
+
+
+static void *
+tf (void *arg)
+{
+  pthread_key_t key = (pthread_key_t) (long int) arg;
+  int err;
+
+  err = pthread_setspecific (key, (void *) -2l);
+  if (err != 0)
+    result = 3;
+
+  return NULL;
+}
+
+
+static int
+do_test (void)
+{
+  pthread_key_t key;
+  pthread_t th;
+  int err;
+
+  err = pthread_key_create (&key, destr);
+  if (err != 0)
+    {
+      printf ("key_create failed: %s\n", strerror (err));
+      return 1;
+    }
+
+  result = 1;
+
+  err = pthread_create (&th, NULL, tf, (void *) (long int) key);
+  if (err != 0)
+    {
+      printf ("create failed: %s\n", strerror (err));
+      return 1;
+    }
+
+  /* Wait for the thread to terminate.  */
+  err = pthread_join (th, NULL);
+  if (err != 0)
+    {
+      printf ("join failed: %s\n", strerror (err));
+      return 1;
+    }
+
+  if (result == 1)
+    puts ("destructor not called");
+  else if (result == 2)
+    puts ("destructor got passed a wrong value");
+  else if (result == 3)
+    puts ("setspecific in child failed");
+  else if (result != 0)
+    puts ("result != 0");
+
+  return result;
+}
+
+
+#define TEST_FUNCTION do_test ()
+#include "../test-skeleton.c"
diff --git a/ap/build/uClibc/test/nptl/tst-tsd3.c b/ap/build/uClibc/test/nptl/tst-tsd3.c
new file mode 100644
index 0000000..6cdf749
--- /dev/null
+++ b/ap/build/uClibc/test/nptl/tst-tsd3.c
@@ -0,0 +1,129 @@
+/* Copyright (C) 2003 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, write to the Free
+   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+   02111-1307 USA.  */
+
+#include <limits.h>
+#include <pthread.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <unistd.h>
+
+
+static pthread_key_t key1;
+static pthread_key_t key2;
+
+
+static int left;
+
+
+static void
+destr1 (void *arg)
+{
+  if (--left > 0)
+    {
+      puts ("set key2");
+
+      if (pthread_setspecific (key2, (void *) 1l) != 0)
+	{
+	  puts ("destr1: setspecific failed");
+	  exit (1);
+	}
+    }
+}
+
+
+static void
+destr2 (void *arg)
+{
+  if (--left > 0)
+    {
+      puts ("set key1");
+
+      if (pthread_setspecific (key1, (void *) 1l) != 0)
+	{
+	  puts ("destr2: setspecific failed");
+	  exit (1);
+	}
+    }
+}
+
+
+static void *
+tf (void *arg)
+{
+  /* Let the destructors work.  */
+  left = 7;
+
+  if (pthread_setspecific (key1, (void *) 1l) != 0
+      || pthread_setspecific (key2, (void *) 1l) != 0)
+    {
+      puts ("tf: setspecific failed");
+      exit (1);
+    }
+
+  return NULL;
+}
+
+
+static int
+do_test (void)
+{
+  /* Allocate two keys, both with destructors.  */
+  if (pthread_key_create (&key1, destr1) != 0
+      || pthread_key_create (&key2, destr2) != 0)
+    {
+      puts ("key_create failed");
+      return 1;
+    }
+
+  pthread_t th;
+  if (pthread_create (&th, NULL, tf, NULL) != 0)
+    {
+      puts ("create failed");
+      return 1;
+    }
+
+  if (pthread_join (th, NULL) != 0)
+    {
+      puts ("join failed");
+      return 1;
+    }
+
+  if (left != 0)
+    {
+      printf ("left == %d\n", left);
+      return 1;
+    }
+
+  if (pthread_getspecific (key1) != NULL)
+    {
+      puts ("key1 data != NULL");
+      return 1;
+    }
+  if (pthread_getspecific (key2) != NULL)
+    {
+      puts ("key2 data != NULL");
+      return 1;
+    }
+
+  return 0;
+}
+
+
+#define TEST_FUNCTION do_test ()
+#include "../test-skeleton.c"
diff --git a/ap/build/uClibc/test/nptl/tst-tsd4.c b/ap/build/uClibc/test/nptl/tst-tsd4.c
new file mode 100644
index 0000000..44bbadb
--- /dev/null
+++ b/ap/build/uClibc/test/nptl/tst-tsd4.c
@@ -0,0 +1,103 @@
+/* Copyright (C) 2003 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, write to the Free
+   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+   02111-1307 USA.  */
+
+#include <limits.h>
+#include <pthread.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <unistd.h>
+
+
+static pthread_key_t key;
+
+
+static int rounds;
+
+
+static void
+destr (void *arg)
+{
+  ++rounds;
+
+  if (pthread_setspecific (key, (void *) 1l) != 0)
+    {
+      puts ("destr: setspecific failed");
+      exit (1);
+    }
+}
+
+
+static void *
+tf (void *arg)
+{
+  if (pthread_setspecific (key, (void *) 1l) != 0)
+    {
+      puts ("tf: setspecific failed");
+      exit (1);
+    }
+
+  return NULL;
+}
+
+
+/* This test check non-standard behavior.  The standard does not
+   require that the implementation has to stop calling TSD destructors
+   when they are set over and over again.  But NPTL does.  */
+static int
+do_test (void)
+{
+  /* Allocate two keys, both with destructors.  */
+  if (pthread_key_create (&key, destr) != 0)
+    {
+      puts ("key_create failed");
+      return 1;
+    }
+
+  pthread_t th;
+  if (pthread_create (&th, NULL, tf, NULL) != 0)
+    {
+      puts ("create failed");
+      return 1;
+    }
+
+  if (pthread_join (th, NULL) != 0)
+    {
+      puts ("join failed");
+      return 1;
+    }
+
+  if (rounds < PTHREAD_DESTRUCTOR_ITERATIONS)
+    {
+      printf ("rounds == %d, PTHREAD_DESTRUCTOR_ITERATIONS = %d\n",
+	      rounds, PTHREAD_DESTRUCTOR_ITERATIONS);
+      return 1;
+    }
+
+  if (pthread_getspecific (key) != NULL)
+    {
+      puts ("key data != NULL");
+      return 1;
+    }
+
+  return 0;
+}
+
+
+#define TEST_FUNCTION do_test ()
+#include "../test-skeleton.c"
diff --git a/ap/build/uClibc/test/nptl/tst-tsd5.c b/ap/build/uClibc/test/nptl/tst-tsd5.c
new file mode 100644
index 0000000..8793e33
--- /dev/null
+++ b/ap/build/uClibc/test/nptl/tst-tsd5.c
@@ -0,0 +1,81 @@
+/* Copyright (C) 2004 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+   Contributed by Ulrich Drepper <drepper@redhat.com>, 2004.
+
+   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>
+#include <stdio.h>
+#include <stdlib.h>
+
+
+static pthread_mutex_t m = PTHREAD_MUTEX_INITIALIZER;
+
+
+static void
+cl (void *p)
+{
+  pthread_mutex_unlock (&m);
+}
+
+
+static void *
+tf (void *arg)
+{
+  if (pthread_mutex_lock (&m) != 0)
+    {
+      puts ("2nd mutex_lock failed");
+      exit (1);
+    }
+
+  exit (0);
+}
+
+
+static int
+do_test (void)
+{
+  pthread_key_t k;
+  if (pthread_key_create (&k, cl) != 0)
+    {
+      puts ("key_create failed");
+      return 1;
+    }
+  if (pthread_setspecific (k, (void *) 1) != 0)
+    {
+      puts ("setspecific failed");
+      return 1;
+    }
+
+  if (pthread_mutex_lock (&m) != 0)
+    {
+      puts ("1st mutex_lock failed");
+      return 1;
+    }
+
+  pthread_t th;
+  if (pthread_create (&th, NULL, tf, NULL) != 0)
+    {
+      puts ("create failed");
+      return 1;
+    }
+
+  pthread_exit (NULL);
+}
+
+
+#define TEST_FUNCTION do_test ()
+#include "../test-skeleton.c"
diff --git a/ap/build/uClibc/test/nptl/tst-tsd6.c b/ap/build/uClibc/test/nptl/tst-tsd6.c
new file mode 100644
index 0000000..debb1dd
--- /dev/null
+++ b/ap/build/uClibc/test/nptl/tst-tsd6.c
@@ -0,0 +1,89 @@
+#include <errno.h>
+#include <pthread.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <unistd.h>
+#include <sys/wait.h>
+
+#define NKEYS 100
+static pthread_key_t keys[NKEYS];
+static pthread_barrier_t b;
+
+
+static void *
+tf (void *arg)
+{
+  void *res = NULL;
+  for (int i = 0; i < NKEYS; ++i)
+    {
+      void *p = pthread_getspecific (keys[i]);
+      pthread_setspecific (keys[i], (void *) 7);
+      if (p != NULL)
+	res = p;
+    }
+  if (arg != NULL)
+    {
+      pthread_barrier_wait (arg);
+      pthread_barrier_wait (arg);
+    }
+  return res;
+}
+
+
+static int
+do_test (void)
+{
+  pthread_barrier_init (&b, NULL, 2);
+
+  for (int i = 0; i < NKEYS; ++i)
+    if (pthread_key_create (&keys[i], NULL) != 0)
+      {
+	puts ("cannot create keys");
+	return 1;
+      }
+
+  pthread_t th;
+  if (pthread_create (&th, NULL, tf, &b) != 0)
+    {
+      puts ("cannot create thread in parent");
+      return 1;
+    }
+
+  pthread_barrier_wait (&b);
+
+  pid_t pid = fork ();
+  if (pid == 0)
+    {
+      if (pthread_create (&th, NULL, tf, NULL) != 0)
+	{
+	  puts ("cannot create thread in child");
+	  exit (1);
+	}
+
+      void *res;
+      pthread_join (th, &res);
+
+      exit (res != NULL);
+    }
+  else if (pid == -1)
+    {
+      puts ("cannot create child process");
+      return 1;
+    }
+
+  int s;
+  if (TEMP_FAILURE_RETRY (waitpid (pid, &s, 0)) != pid)
+    {
+      puts ("failing to wait for child process");
+      return 1;
+    }
+
+  pthread_barrier_wait (&b);
+  pthread_join (th, NULL);
+
+  return !WIFEXITED (s) ? 2 : WEXITSTATUS (s);
+}
+
+
+#define TEST_FUNCTION do_test ()
+#include "../test-skeleton.c"
diff --git a/ap/build/uClibc/test/nptl/tst-typesizes.c b/ap/build/uClibc/test/nptl/tst-typesizes.c
new file mode 100644
index 0000000..545cee6
--- /dev/null
+++ b/ap/build/uClibc/test/nptl/tst-typesizes.c
@@ -0,0 +1,96 @@
+/* Copyright (C) 2005, 2007, 2008 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+   Contributed by Ulrich Drepper <drepper@redhat.com>, 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 <stdio.h>
+#include <pthreadP.h>
+#include <semaphore.h>
+
+static const struct
+{
+  const char *name;
+  size_t expected;
+  size_t is;
+} types[] =
+  {
+#define T(t, c) \
+    { #t, c, sizeof (t) }
+    T (pthread_attr_t, __SIZEOF_PTHREAD_ATTR_T),
+    T (pthread_mutex_t, __SIZEOF_PTHREAD_MUTEX_T),
+    T (pthread_mutexattr_t, __SIZEOF_PTHREAD_MUTEXATTR_T),
+    T (pthread_cond_t, __SIZEOF_PTHREAD_COND_T),
+    T (pthread_condattr_t, __SIZEOF_PTHREAD_CONDATTR_T),
+    T (pthread_rwlock_t, __SIZEOF_PTHREAD_RWLOCK_T),
+    T (pthread_rwlockattr_t, __SIZEOF_PTHREAD_RWLOCKATTR_T),
+    T (pthread_barrier_t, __SIZEOF_PTHREAD_BARRIER_T),
+    T (pthread_barrierattr_t, __SIZEOF_PTHREAD_BARRIERATTR_T)
+  };
+
+static int
+do_test (void)
+{
+  int result = 0;
+
+#define TEST_TYPE(name) \
+  printf ("%s: ", #name);						      \
+  if (sizeof (name) != sizeof (((name *) 0)->__size))			      \
+    {									      \
+      printf ("expected %zu, is %zu\n",					      \
+	      sizeof (((name *) 0)->__size), sizeof (name));		      \
+      result = 1;							      \
+    }									      \
+  else									      \
+    puts ("OK")
+
+  TEST_TYPE (pthread_mutex_t);
+  TEST_TYPE (pthread_cond_t);
+  TEST_TYPE (pthread_rwlock_t);
+
+#define TEST_TYPE2(name, internal)					      \
+  printf ("%s: ", #name);						      \
+  if (sizeof (((name *) 0)->__size) < sizeof (internal))		      \
+    {									      \
+      printf ("expected %zu, is %zu\n",					      \
+	      sizeof (((name *) 0)->__size), sizeof (internal));	      \
+      result = 1;							      \
+    }									      \
+  else									      \
+    puts ("OK")
+
+  TEST_TYPE2 (pthread_attr_t, struct pthread_attr);
+  TEST_TYPE2 (pthread_mutexattr_t, struct pthread_mutexattr);
+  TEST_TYPE2 (pthread_condattr_t, struct pthread_condattr);
+  TEST_TYPE2 (pthread_rwlockattr_t, struct pthread_rwlockattr);
+  TEST_TYPE2 (pthread_barrier_t, struct pthread_barrier);
+  TEST_TYPE2 (pthread_barrierattr_t, struct pthread_barrierattr);
+  TEST_TYPE2 (sem_t, struct new_sem);
+  TEST_TYPE2 (sem_t, struct old_sem);
+
+  for (size_t i = 0; i < sizeof (types) / sizeof (types[0]); ++i)
+    if (types[i].expected != types[i].is)
+      {
+	printf ("%s: expected %zu, is %zu\n",
+		types[i].name, types[i].expected, types[i].is);
+	result = 1;
+      }
+
+  return result;
+}
+
+#define TEST_FUNCTION do_test ()
+#include "../test-skeleton.c"
diff --git a/ap/build/uClibc/test/nptl/tst-umask1.c b/ap/build/uClibc/test/nptl/tst-umask1.c
new file mode 100644
index 0000000..4bbf6d0
--- /dev/null
+++ b/ap/build/uClibc/test/nptl/tst-umask1.c
@@ -0,0 +1,137 @@
+/* Copyright (C) 2003 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, write to the Free
+   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+   02111-1307 USA.  */
+
+#include <fcntl.h>
+#include <pthread.h>
+#include <stdbool.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <unistd.h>
+#include <sys/stat.h>
+
+
+static struct
+{
+  int (*fp) (const char *, mode_t);
+  const char *name;
+  bool is_fd;
+} fcts[] =
+{
+  { creat, "creat", true },
+  { mkdir, "mkdir", false },
+  { mkfifo, "mkfifo", false },
+};
+#define nfcts (sizeof (fcts) / sizeof (fcts[0]))
+
+
+static int
+work (const char *fname, int mask)
+{
+  int result = 0;
+  size_t i;
+  for (i = 0; i < nfcts; ++i)
+    {
+      remove (fname);
+      int fd = fcts[i].fp (fname, 0777);
+      if (fd == -1)
+	{
+	  printf ("cannot %s %s: %m\n", fcts[i].name, fname);
+	  exit (1);
+	}
+      if (fcts[i].is_fd)
+	close (fd);
+      struct stat st;
+      if (stat (fname, &st) == -1)
+	{
+	  printf ("cannot stat %s after %s: %m\n", fname, fcts[i].name);
+	  exit (1);
+	}
+
+      if ((st.st_mode & mask) != 0)
+	{
+	  printf ("mask not successful after %s: %x still set\n",
+	      fcts[i].name, (unsigned int) (st.st_mode & mask));
+	  result = 1;
+	}
+    }
+
+  return result;
+}
+
+
+static pthread_barrier_t bar;
+
+
+static void *
+tf (void *arg)
+{
+  pthread_barrier_wait (&bar);
+
+  int result = work (arg, 022);
+
+  pthread_barrier_wait (&bar);
+
+  pthread_barrier_wait (&bar);
+
+  return (work (arg, 0) | result) ? (void *) -1l : NULL;
+}
+
+
+static int
+do_test (const char *fname)
+{
+  int result = 0;
+
+  umask (0);
+  result |= work (fname, 0);
+
+  pthread_barrier_init (&bar, NULL, 2);
+
+  pthread_t th;
+  if (pthread_create (&th, NULL, tf, (void *) fname) != 0)
+    {
+      puts ("cannot create thread");
+      exit (1);
+    }
+
+  umask (022);
+  result |= work (fname, 022);
+
+  pthread_barrier_wait (&bar);
+
+  pthread_barrier_wait (&bar);
+
+  umask (0);
+
+  pthread_barrier_wait (&bar);
+
+  void *res;
+  if (pthread_join (th, &res) != 0)
+    {
+      puts ("join failed");
+      exit (1);
+    }
+
+  remove (fname);
+
+  return result || res != NULL;
+}
+
+#define TEST_FUNCTION do_test (argc < 2 ? "/tmp/tst-umask.tmp" : argv[1])
+#include "../test-skeleton.c"
diff --git a/ap/build/uClibc/test/nptl/tst-unload.c b/ap/build/uClibc/test/nptl/tst-unload.c
new file mode 100644
index 0000000..5c552e2
--- /dev/null
+++ b/ap/build/uClibc/test/nptl/tst-unload.c
@@ -0,0 +1,47 @@
+/* Tests for non-unloading of libpthread.
+   Copyright (C) 2000, 2002, 2003, 2004 Free Software Foundation, Inc.
+   Contributed by Ulrich Drepper <drepper@redhat.com>, 2000.
+
+   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 <dlfcn.h>
+#include <stdio.h>
+#include <stdlib.h>
+
+static int
+do_test (void)
+{
+  void *p = dlopen ("libpthread.so.0", RTLD_LAZY);
+
+  if (p == NULL)
+    {
+      puts ("failed to load libpthread.so.0");
+      return 1;
+    }
+
+  if (dlclose (p) != 0)
+    {
+      puts ("dlclose (libpthread.so.0) failed");
+      return 1;
+    }
+
+  puts ("seems to work");
+
+  return 0;
+}
+
+#define TEST_FUNCTION do_test ()
+#include "../test-skeleton.c"
diff --git a/ap/build/uClibc/test/nptl/tst-vfork1.c b/ap/build/uClibc/test/nptl/tst-vfork1.c
new file mode 100644
index 0000000..1f36f1f
--- /dev/null
+++ b/ap/build/uClibc/test/nptl/tst-vfork1.c
@@ -0,0 +1,150 @@
+/* Test for vfork functions.
+   Copyright (C) 2004 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+   Contributed by Ulrich Drepper <drepper@redhat.com>, 2004.
+
+   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 <errno.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <unistd.h>
+#include <sys/types.h>
+#include <sys/wait.h>
+
+/* This test relies on non-POSIX functionality since the child
+   processes call write and getpid.  */
+static int
+do_test (void)
+{
+  int result = 0;
+  int fd[2];
+
+  if (pipe (fd) == -1)
+    {
+      puts ("pipe failed");
+      return 1;
+    }
+
+  /* First vfork() without previous getpid().  */
+  pid_t p1;
+  if ((p1 = vfork ()) == 0)
+    {
+      pid_t p = getpid ();
+      _exit (TEMP_FAILURE_RETRY (write (fd[1], &p, sizeof (p))) != sizeof (p));
+    }
+  else if (p1 == -1)
+    {
+      puts ("1st vfork failed");
+      result = 1;
+    }
+
+  pid_t p2 = 0;
+  if (TEMP_FAILURE_RETRY (read (fd[0], &p2, sizeof (pid_t))) != sizeof (pid_t))
+    {
+      puts ("1st read failed");
+      result = 1;
+    }
+  int r;
+  if (TEMP_FAILURE_RETRY (waitpid (p1, &r, 0)) != p1)
+    {
+      puts ("1st waitpid failed");
+      result = 1;
+    }
+  else if (r != 0)
+    {
+      puts ("write in 1st child failed");
+      result = 1;
+    }
+
+  /* Main process' ID.  */
+  pid_t p0 = getpid ();
+
+  /* vfork() again, but after a getpid() in the main process.  */
+  pid_t p3;
+  if ((p3 = vfork ()) == 0)
+    {
+      pid_t p = getpid ();
+      _exit (TEMP_FAILURE_RETRY (write (fd[1], &p, sizeof (p))) != sizeof (p));
+    }
+  else if (p1 == -1)
+    {
+      puts ("2nd vfork failed");
+      result = 1;
+    }
+
+  pid_t p4;
+  if (TEMP_FAILURE_RETRY (read (fd[0], &p4, sizeof (pid_t))) != sizeof (pid_t))
+    {
+      puts ("2nd read failed");
+      result = 1;
+    }
+  if (TEMP_FAILURE_RETRY (waitpid (p3, &r, 0)) != p3)
+    {
+      puts ("2nd waitpid failed");
+      result = 1;
+    }
+  else if (r != 0)
+    {
+      puts ("write in 2nd child failed");
+      result = 1;
+    }
+
+  /* And getpid in the main process again.  */
+  pid_t p5 = getpid ();
+
+  /* Analysis of the results.  */
+  if (p0 != p5)
+    {
+      printf ("p0(%ld) != p5(%ld)\n", (long int) p0, (long int) p5);
+      result = 1;
+    }
+
+  if (p0 == p1)
+    {
+      printf ("p0(%ld) == p1(%ld)\n", (long int) p0, (long int) p1);
+      result = 1;
+    }
+
+  if (p1 != p2)
+    {
+      printf ("p1(%ld) != p2(%ld)\n", (long int) p1, (long int) p2);
+      result = 1;
+    }
+
+  if (p0 == p3)
+    {
+      printf ("p0(%ld) == p3(%ld)\n", (long int) p0, (long int) p3);
+      result = 1;
+    }
+
+  if (p3 != p4)
+    {
+      printf ("p3(%ld) != p4(%ld)\n", (long int) p3, (long int) p4);
+      result = 1;
+    }
+
+  close (fd[0]);
+  close (fd[1]);
+
+  if (result == 0)
+    puts ("All OK");
+
+  return result;
+}
+
+#define TEST_FUNCTION do_test ()
+#include "../test-skeleton.c"
diff --git a/ap/build/uClibc/test/nptl/tst-vfork1x.c b/ap/build/uClibc/test/nptl/tst-vfork1x.c
new file mode 100644
index 0000000..1f36f1f
--- /dev/null
+++ b/ap/build/uClibc/test/nptl/tst-vfork1x.c
@@ -0,0 +1,150 @@
+/* Test for vfork functions.
+   Copyright (C) 2004 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+   Contributed by Ulrich Drepper <drepper@redhat.com>, 2004.
+
+   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 <errno.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <unistd.h>
+#include <sys/types.h>
+#include <sys/wait.h>
+
+/* This test relies on non-POSIX functionality since the child
+   processes call write and getpid.  */
+static int
+do_test (void)
+{
+  int result = 0;
+  int fd[2];
+
+  if (pipe (fd) == -1)
+    {
+      puts ("pipe failed");
+      return 1;
+    }
+
+  /* First vfork() without previous getpid().  */
+  pid_t p1;
+  if ((p1 = vfork ()) == 0)
+    {
+      pid_t p = getpid ();
+      _exit (TEMP_FAILURE_RETRY (write (fd[1], &p, sizeof (p))) != sizeof (p));
+    }
+  else if (p1 == -1)
+    {
+      puts ("1st vfork failed");
+      result = 1;
+    }
+
+  pid_t p2 = 0;
+  if (TEMP_FAILURE_RETRY (read (fd[0], &p2, sizeof (pid_t))) != sizeof (pid_t))
+    {
+      puts ("1st read failed");
+      result = 1;
+    }
+  int r;
+  if (TEMP_FAILURE_RETRY (waitpid (p1, &r, 0)) != p1)
+    {
+      puts ("1st waitpid failed");
+      result = 1;
+    }
+  else if (r != 0)
+    {
+      puts ("write in 1st child failed");
+      result = 1;
+    }
+
+  /* Main process' ID.  */
+  pid_t p0 = getpid ();
+
+  /* vfork() again, but after a getpid() in the main process.  */
+  pid_t p3;
+  if ((p3 = vfork ()) == 0)
+    {
+      pid_t p = getpid ();
+      _exit (TEMP_FAILURE_RETRY (write (fd[1], &p, sizeof (p))) != sizeof (p));
+    }
+  else if (p1 == -1)
+    {
+      puts ("2nd vfork failed");
+      result = 1;
+    }
+
+  pid_t p4;
+  if (TEMP_FAILURE_RETRY (read (fd[0], &p4, sizeof (pid_t))) != sizeof (pid_t))
+    {
+      puts ("2nd read failed");
+      result = 1;
+    }
+  if (TEMP_FAILURE_RETRY (waitpid (p3, &r, 0)) != p3)
+    {
+      puts ("2nd waitpid failed");
+      result = 1;
+    }
+  else if (r != 0)
+    {
+      puts ("write in 2nd child failed");
+      result = 1;
+    }
+
+  /* And getpid in the main process again.  */
+  pid_t p5 = getpid ();
+
+  /* Analysis of the results.  */
+  if (p0 != p5)
+    {
+      printf ("p0(%ld) != p5(%ld)\n", (long int) p0, (long int) p5);
+      result = 1;
+    }
+
+  if (p0 == p1)
+    {
+      printf ("p0(%ld) == p1(%ld)\n", (long int) p0, (long int) p1);
+      result = 1;
+    }
+
+  if (p1 != p2)
+    {
+      printf ("p1(%ld) != p2(%ld)\n", (long int) p1, (long int) p2);
+      result = 1;
+    }
+
+  if (p0 == p3)
+    {
+      printf ("p0(%ld) == p3(%ld)\n", (long int) p0, (long int) p3);
+      result = 1;
+    }
+
+  if (p3 != p4)
+    {
+      printf ("p3(%ld) != p4(%ld)\n", (long int) p3, (long int) p4);
+      result = 1;
+    }
+
+  close (fd[0]);
+  close (fd[1]);
+
+  if (result == 0)
+    puts ("All OK");
+
+  return result;
+}
+
+#define TEST_FUNCTION do_test ()
+#include "../test-skeleton.c"
diff --git a/ap/build/uClibc/test/nptl/tst-vfork2.c b/ap/build/uClibc/test/nptl/tst-vfork2.c
new file mode 100644
index 0000000..1d096e1
--- /dev/null
+++ b/ap/build/uClibc/test/nptl/tst-vfork2.c
@@ -0,0 +1,199 @@
+/* Test for vfork functions.
+   Copyright (C) 2004 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+   Contributed by Ulrich Drepper <drepper@redhat.com>, 2004.
+
+   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 <errno.h>
+#include <signal.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <time.h>
+#include <unistd.h>
+#include <sys/time.h>
+#include <sys/types.h>
+#include <sys/wait.h>
+
+int raise_fail;
+
+static void
+alrm (int sig)
+{
+  if (raise (SIGUSR1) < 0)
+    raise_fail = 1;
+}
+
+/* This test relies on non-POSIX functionality since the child
+   processes call write, nanosleep and getpid.  */
+static int
+do_test (void)
+{
+  int result = 0;
+  int fd[2];
+
+  signal (SIGUSR1, SIG_IGN);
+
+  struct sigaction sa;
+  sa.sa_handler = alrm;
+  sigemptyset (&sa.sa_mask);
+  sa.sa_flags = 0;
+  if (sigaction (SIGALRM, &sa, NULL) < 0)
+    {
+      puts ("couldn't set up SIGALRM handler");
+      return 1;
+    }
+
+  if (pipe (fd) == -1)
+    {
+      puts ("pipe failed");
+      return 1;
+    }
+
+  struct itimerval it;
+  it.it_value.tv_sec = 0;
+  it.it_value.tv_usec = 200 * 1000;
+  it.it_interval = it.it_value;
+  if (setitimer (ITIMER_REAL, &it, NULL) < 0)
+    {
+      puts ("couldn't set up timer");
+      return 1;
+    }
+
+  /* First vfork() without previous getpid().  */
+  pid_t p1;
+  if ((p1 = vfork ()) == 0)
+    {
+      pid_t p = getpid ();
+
+      struct timespec ts;
+      ts.tv_sec = 1;
+      ts.tv_nsec = 0;
+      TEMP_FAILURE_RETRY (nanosleep (&ts, &ts));
+      _exit (TEMP_FAILURE_RETRY (write (fd[1], &p, sizeof (p))) != sizeof (p));
+    }
+  else if (p1 == -1)
+    {
+      puts ("1st vfork failed");
+      result = 1;
+    }
+
+  memset (&it, 0, sizeof (it));
+  setitimer (ITIMER_REAL, &it, NULL);
+
+  pid_t p2 = 0;
+  if (TEMP_FAILURE_RETRY (read (fd[0], &p2, sizeof (pid_t))) != sizeof (pid_t))
+    {
+      puts ("1st read failed");
+      result = 1;
+    }
+  int r;
+  if (TEMP_FAILURE_RETRY (waitpid (p1, &r, 0)) != p1)
+    {
+      puts ("1st waitpid failed");
+      result = 1;
+    }
+  else if (r != 0)
+    {
+      puts ("write in 1st child failed");
+      result = 1;
+    }
+
+  /* Main process' ID.  */
+  pid_t p0 = getpid ();
+
+  /* vfork() again, but after a getpid() in the main process.  */
+  pid_t p3;
+  if ((p3 = vfork ()) == 0)
+    {
+      pid_t p = getpid ();
+      _exit (TEMP_FAILURE_RETRY (write (fd[1], &p, sizeof (p))) != sizeof (p));
+    }
+  else if (p1 == -1)
+    {
+      puts ("2nd vfork failed");
+      result = 1;
+    }
+
+  pid_t p4;
+  if (TEMP_FAILURE_RETRY (read (fd[0], &p4, sizeof (pid_t))) != sizeof (pid_t))
+    {
+      puts ("2nd read failed");
+      result = 1;
+    }
+  if (TEMP_FAILURE_RETRY (waitpid (p3, &r, 0)) != p3)
+    {
+      puts ("2nd waitpid failed");
+      result = 1;
+    }
+  else if (r != 0)
+    {
+      puts ("write in 2nd child failed");
+      result = 1;
+    }
+
+  /* And getpid in the main process again.  */
+  pid_t p5 = getpid ();
+
+  /* Analysis of the results.  */
+  if (p0 != p5)
+    {
+      printf ("p0(%ld) != p5(%ld)\n", (long int) p0, (long int) p5);
+      result = 1;
+    }
+
+  if (p0 == p1)
+    {
+      printf ("p0(%ld) == p1(%ld)\n", (long int) p0, (long int) p1);
+      result = 1;
+    }
+
+  if (p1 != p2)
+    {
+      printf ("p1(%ld) != p2(%ld)\n", (long int) p1, (long int) p2);
+      result = 1;
+    }
+
+  if (p0 == p3)
+    {
+      printf ("p0(%ld) == p3(%ld)\n", (long int) p0, (long int) p3);
+      result = 1;
+    }
+
+  if (p3 != p4)
+    {
+      printf ("p3(%ld) != p4(%ld)\n", (long int) p3, (long int) p4);
+      result = 1;
+    }
+
+  close (fd[0]);
+  close (fd[1]);
+
+  if (raise_fail)
+    {
+      puts ("raise failed");
+      result = 1;
+    }
+
+  if (result == 0)
+    puts ("All OK");
+
+  return result;
+}
+
+#define TEST_FUNCTION do_test ()
+#include "../test-skeleton.c"
diff --git a/ap/build/uClibc/test/nptl/tst-vfork2x.c b/ap/build/uClibc/test/nptl/tst-vfork2x.c
new file mode 100644
index 0000000..1d096e1
--- /dev/null
+++ b/ap/build/uClibc/test/nptl/tst-vfork2x.c
@@ -0,0 +1,199 @@
+/* Test for vfork functions.
+   Copyright (C) 2004 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+   Contributed by Ulrich Drepper <drepper@redhat.com>, 2004.
+
+   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 <errno.h>
+#include <signal.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <time.h>
+#include <unistd.h>
+#include <sys/time.h>
+#include <sys/types.h>
+#include <sys/wait.h>
+
+int raise_fail;
+
+static void
+alrm (int sig)
+{
+  if (raise (SIGUSR1) < 0)
+    raise_fail = 1;
+}
+
+/* This test relies on non-POSIX functionality since the child
+   processes call write, nanosleep and getpid.  */
+static int
+do_test (void)
+{
+  int result = 0;
+  int fd[2];
+
+  signal (SIGUSR1, SIG_IGN);
+
+  struct sigaction sa;
+  sa.sa_handler = alrm;
+  sigemptyset (&sa.sa_mask);
+  sa.sa_flags = 0;
+  if (sigaction (SIGALRM, &sa, NULL) < 0)
+    {
+      puts ("couldn't set up SIGALRM handler");
+      return 1;
+    }
+
+  if (pipe (fd) == -1)
+    {
+      puts ("pipe failed");
+      return 1;
+    }
+
+  struct itimerval it;
+  it.it_value.tv_sec = 0;
+  it.it_value.tv_usec = 200 * 1000;
+  it.it_interval = it.it_value;
+  if (setitimer (ITIMER_REAL, &it, NULL) < 0)
+    {
+      puts ("couldn't set up timer");
+      return 1;
+    }
+
+  /* First vfork() without previous getpid().  */
+  pid_t p1;
+  if ((p1 = vfork ()) == 0)
+    {
+      pid_t p = getpid ();
+
+      struct timespec ts;
+      ts.tv_sec = 1;
+      ts.tv_nsec = 0;
+      TEMP_FAILURE_RETRY (nanosleep (&ts, &ts));
+      _exit (TEMP_FAILURE_RETRY (write (fd[1], &p, sizeof (p))) != sizeof (p));
+    }
+  else if (p1 == -1)
+    {
+      puts ("1st vfork failed");
+      result = 1;
+    }
+
+  memset (&it, 0, sizeof (it));
+  setitimer (ITIMER_REAL, &it, NULL);
+
+  pid_t p2 = 0;
+  if (TEMP_FAILURE_RETRY (read (fd[0], &p2, sizeof (pid_t))) != sizeof (pid_t))
+    {
+      puts ("1st read failed");
+      result = 1;
+    }
+  int r;
+  if (TEMP_FAILURE_RETRY (waitpid (p1, &r, 0)) != p1)
+    {
+      puts ("1st waitpid failed");
+      result = 1;
+    }
+  else if (r != 0)
+    {
+      puts ("write in 1st child failed");
+      result = 1;
+    }
+
+  /* Main process' ID.  */
+  pid_t p0 = getpid ();
+
+  /* vfork() again, but after a getpid() in the main process.  */
+  pid_t p3;
+  if ((p3 = vfork ()) == 0)
+    {
+      pid_t p = getpid ();
+      _exit (TEMP_FAILURE_RETRY (write (fd[1], &p, sizeof (p))) != sizeof (p));
+    }
+  else if (p1 == -1)
+    {
+      puts ("2nd vfork failed");
+      result = 1;
+    }
+
+  pid_t p4;
+  if (TEMP_FAILURE_RETRY (read (fd[0], &p4, sizeof (pid_t))) != sizeof (pid_t))
+    {
+      puts ("2nd read failed");
+      result = 1;
+    }
+  if (TEMP_FAILURE_RETRY (waitpid (p3, &r, 0)) != p3)
+    {
+      puts ("2nd waitpid failed");
+      result = 1;
+    }
+  else if (r != 0)
+    {
+      puts ("write in 2nd child failed");
+      result = 1;
+    }
+
+  /* And getpid in the main process again.  */
+  pid_t p5 = getpid ();
+
+  /* Analysis of the results.  */
+  if (p0 != p5)
+    {
+      printf ("p0(%ld) != p5(%ld)\n", (long int) p0, (long int) p5);
+      result = 1;
+    }
+
+  if (p0 == p1)
+    {
+      printf ("p0(%ld) == p1(%ld)\n", (long int) p0, (long int) p1);
+      result = 1;
+    }
+
+  if (p1 != p2)
+    {
+      printf ("p1(%ld) != p2(%ld)\n", (long int) p1, (long int) p2);
+      result = 1;
+    }
+
+  if (p0 == p3)
+    {
+      printf ("p0(%ld) == p3(%ld)\n", (long int) p0, (long int) p3);
+      result = 1;
+    }
+
+  if (p3 != p4)
+    {
+      printf ("p3(%ld) != p4(%ld)\n", (long int) p3, (long int) p4);
+      result = 1;
+    }
+
+  close (fd[0]);
+  close (fd[1]);
+
+  if (raise_fail)
+    {
+      puts ("raise failed");
+      result = 1;
+    }
+
+  if (result == 0)
+    puts ("All OK");
+
+  return result;
+}
+
+#define TEST_FUNCTION do_test ()
+#include "../test-skeleton.c"
diff --git a/ap/build/uClibc/test/plt/check-plt.sh b/ap/build/uClibc/test/plt/check-plt.sh
new file mode 100755
index 0000000..bedc8fd
--- /dev/null
+++ b/ap/build/uClibc/test/plt/check-plt.sh
@@ -0,0 +1,38 @@
+#!/bin/sh
+allowed="
+calloc
+free
+malloc
+memalign
+realloc
+"
+
+${OBJDUMP:-objdump} -d ${top_builddir:-../..}/lib/libc.so.? | \
+gawk -v allowed="${allowed}" '
+BEGIN {
+	COUNT = split(" " allowed, ALLOWED);
+}
+
+# Strip away the noise.  The name will be like:
+# <brk>:
+# <foo@plt>
+function symstrip(name) {
+	return gensub(/.*<([^>@]*).*/, "\\1", "", name);
+}
+
+{
+# Match the start of the symbol disassembly
+# 00009720 <brk>:
+if ($2 ~ />:$/) {
+	f = symstrip($2);
+
+} else if ($NF ~ /@plt>/) {
+	rf = symstrip($NF);
+	for (a in ALLOWED) {
+		a = ALLOWED[a];
+		if (a == rf)
+			next;
+	}
+	print "Func " f " references " rf;
+}
+}' | sort -u
diff --git a/ap/build/uClibc/test/pthread/Makefile b/ap/build/uClibc/test/pthread/Makefile
new file mode 100644
index 0000000..d6f00d6
--- /dev/null
+++ b/ap/build/uClibc/test/pthread/Makefile
@@ -0,0 +1,7 @@
+# uClibc pthread tests
+# Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
+
+top_builddir=../../
+include ../Rules.mak
+-include Makefile.in
+include ../Test.mak
diff --git a/ap/build/uClibc/test/pthread/Makefile.in b/ap/build/uClibc/test/pthread/Makefile.in
new file mode 100644
index 0000000..c50748d
--- /dev/null
+++ b/ap/build/uClibc/test/pthread/Makefile.in
@@ -0,0 +1,8 @@
+# uClibc pthread tests
+# Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
+
+TESTS_DISABLED += cancellation-points
+
+EXTRA_LDFLAGS := -lpthread
+
+LDFLAGS_cancellation-points := -lrt
diff --git a/ap/build/uClibc/test/pthread/cancellation-points.c b/ap/build/uClibc/test/pthread/cancellation-points.c
new file mode 100644
index 0000000..5453060
--- /dev/null
+++ b/ap/build/uClibc/test/pthread/cancellation-points.c
@@ -0,0 +1,286 @@
+/*
+ * Make sure functions marked as cancellation points actually are.
+ * http://www.opengroup.org/onlinepubs/009695399/functions/xsh_chap02_09.html#tag_02_09_05
+ */
+
+#ifndef _GNU_SOURCE
+#define _GNU_SOURCE
+#endif
+
+#include <features.h>
+#include <sys/ipc.h>
+#include <sys/mman.h>
+#include <sys/msg.h>
+#include <sys/socket.h>
+#include <sys/types.h>
+#include <sys/wait.h>
+#include <fcntl.h>
+#include <mqueue.h>
+#include <poll.h>
+#include <pthread.h>
+#include <semaphore.h>
+#include <signal.h>
+#include <stdbool.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <termios.h>
+#include <time.h>
+#include <unistd.h>
+
+/* take care of optional things ... */
+#define STUB(func, args) static void func args { sleep(0); }
+#if defined(__UCLIBC_AIO__)
+# include <aio.h>
+#else
+STUB(aio_suspend, (void *p, int n, const void *p2))
+#endif
+#if defined(__UCLIBC_STROPTS__)
+# include <stropts.h>
+#else
+STUB(getmsg, (int f, void *p, void *p2, void *p3))
+STUB(getpmsg, (int f, void *p, void *p2, void *p3, void *p4))
+STUB(putmsg, (int f, void *p, void *p2, void *p3))
+STUB(putpmsg, (int f, void *p, void *p2, void *p3, void *p4))
+#endif
+#if defined(__UCLIBC__)
+STUB(clock_nanosleep, (int i, int f, const void *p, void *p2))
+#endif
+
+int cnt;
+bool ready;
+
+void cancel_timeout(int sig)
+{
+	ready = false;
+}
+void cancel_thread_cleanup(void *arg)
+{
+	ready = false;
+}
+
+/* some funcs need some help as they wont take NULL args ... */
+const struct timespec zero_sec = { .tv_sec = 0, .tv_nsec = 0 };
+
+sem_t sem;
+void help_sem_setup(void)
+{
+	if (sem_init(&sem, 0, 1) == -1) {
+		perror("sem_init() failed");
+		exit(-1);
+	}
+}
+
+pthread_cond_t cond = PTHREAD_COND_INITIALIZER;
+pthread_mutex_t mutex;
+void help_pthread_setup(void)
+{
+	pthread_mutex_init(&mutex, NULL);
+	pthread_mutex_lock(&mutex);
+}
+
+/* the pthread function that will call the cancellable function over and over */
+#define _MAKE_CANCEL_THREAD_FUNC_EX(func, sysfunc, args, setup) \
+void *cancel_thread_##func(void *arg) \
+{ \
+	if (pthread_setcanceltype(PTHREAD_CANCEL_DEFERRED, NULL)) { \
+		perror("unable to set cancel type to deferred; something is seriously broken"); \
+		exit(-1); \
+	} \
+	pthread_cleanup_push(cancel_thread_cleanup, NULL); \
+	setup; \
+	ready = true; \
+	while (ready) \
+		sysfunc args; \
+	pthread_cleanup_pop(1); \
+	return NULL; \
+}
+#define MAKE_CANCEL_THREAD_FUNC_RE(func, sysfunc, args) _MAKE_CANCEL_THREAD_FUNC_EX(func, sysfunc, args, (void)0)
+#define MAKE_CANCEL_THREAD_FUNC_EX(func, args, setup)   _MAKE_CANCEL_THREAD_FUNC_EX(func, func, args, setup)
+#define MAKE_CANCEL_THREAD_FUNC(func, args)             _MAKE_CANCEL_THREAD_FUNC_EX(func, func, args, (void)0)
+
+MAKE_CANCEL_THREAD_FUNC(accept, (-1, NULL, NULL))
+MAKE_CANCEL_THREAD_FUNC(aio_suspend, (NULL, 0, &zero_sec))
+MAKE_CANCEL_THREAD_FUNC(clock_nanosleep, (0, 0, NULL, NULL))
+MAKE_CANCEL_THREAD_FUNC(close, (-1))
+MAKE_CANCEL_THREAD_FUNC(connect, (-1, NULL, 0))
+MAKE_CANCEL_THREAD_FUNC(creat, ("", 0))
+MAKE_CANCEL_THREAD_FUNC(fcntl, (0, F_SETLKW, NULL))
+MAKE_CANCEL_THREAD_FUNC(fdatasync, (-1))
+MAKE_CANCEL_THREAD_FUNC(fsync, (0))
+MAKE_CANCEL_THREAD_FUNC(getmsg, (-1, NULL, NULL, NULL))
+MAKE_CANCEL_THREAD_FUNC(getpmsg, (-1, NULL, NULL, NULL, NULL))
+MAKE_CANCEL_THREAD_FUNC(lockf, (-1, F_TEST, 0))
+MAKE_CANCEL_THREAD_FUNC(mq_receive, (0, NULL, 0, NULL))
+MAKE_CANCEL_THREAD_FUNC(mq_send, (0, NULL, 0, 0))
+MAKE_CANCEL_THREAD_FUNC(mq_timedreceive, (0, NULL, 0, NULL, NULL))
+MAKE_CANCEL_THREAD_FUNC(mq_timedsend, (0, NULL, 0, 0, NULL))
+MAKE_CANCEL_THREAD_FUNC(msgrcv, (-1, NULL, 0, 0, 0))
+MAKE_CANCEL_THREAD_FUNC(msgsnd, (-1, NULL, 0, 0))
+MAKE_CANCEL_THREAD_FUNC(msync, (NULL, 0, 0))
+MAKE_CANCEL_THREAD_FUNC(nanosleep, (NULL, NULL))
+MAKE_CANCEL_THREAD_FUNC(open, ("", 0))
+MAKE_CANCEL_THREAD_FUNC(pause, ())
+MAKE_CANCEL_THREAD_FUNC(poll, (NULL, 0, 0))
+MAKE_CANCEL_THREAD_FUNC(pread, (-1, NULL, 0, 0))
+MAKE_CANCEL_THREAD_FUNC(pselect, (0, NULL, NULL, NULL, NULL, NULL))
+MAKE_CANCEL_THREAD_FUNC_EX(pthread_cond_timedwait, (&cond, &mutex, &zero_sec), help_pthread_setup())
+MAKE_CANCEL_THREAD_FUNC_EX(pthread_cond_wait, (&cond, &mutex), help_pthread_setup())
+/*MAKE_CANCEL_THREAD_FUNC_EX(pthread_join, (0, NULL))*/
+MAKE_CANCEL_THREAD_FUNC(pthread_testcancel, ())
+MAKE_CANCEL_THREAD_FUNC(putmsg, (-1, NULL, NULL, 0))
+MAKE_CANCEL_THREAD_FUNC(putpmsg, (-1, NULL, NULL, 0, 0))
+MAKE_CANCEL_THREAD_FUNC(pwrite, (-1, NULL, 0, 0))
+MAKE_CANCEL_THREAD_FUNC(read, (-1, NULL, 0))
+MAKE_CANCEL_THREAD_FUNC(readv, (-1, NULL, 0))
+MAKE_CANCEL_THREAD_FUNC(recv, (-1, NULL, 0, 0))
+MAKE_CANCEL_THREAD_FUNC(recvfrom, (-1, NULL, 0, 0, NULL, NULL))
+MAKE_CANCEL_THREAD_FUNC(recvmsg, (-1, NULL, 0))
+MAKE_CANCEL_THREAD_FUNC(select, (0, NULL, NULL, NULL, NULL))
+MAKE_CANCEL_THREAD_FUNC_EX(sem_timedwait, (&sem, &zero_sec), help_sem_setup())
+MAKE_CANCEL_THREAD_FUNC_EX(sem_wait, (&sem), help_sem_setup())
+MAKE_CANCEL_THREAD_FUNC(send, (-1, NULL, 0, 0))
+MAKE_CANCEL_THREAD_FUNC(sendmsg, (-1, NULL, 0))
+MAKE_CANCEL_THREAD_FUNC(sendto, (-1, NULL, 0, 0, NULL, 0))
+#ifdef __UCLIBC_SUSV4_LEGACY__
+MAKE_CANCEL_THREAD_FUNC(sigpause, (0))
+#endif
+MAKE_CANCEL_THREAD_FUNC(sigsuspend, (NULL))
+MAKE_CANCEL_THREAD_FUNC(sigtimedwait, (NULL, NULL, NULL))
+MAKE_CANCEL_THREAD_FUNC(sigwait, (NULL, NULL))
+MAKE_CANCEL_THREAD_FUNC(sigwaitinfo, (NULL, NULL))
+MAKE_CANCEL_THREAD_FUNC(sleep, (0))
+MAKE_CANCEL_THREAD_FUNC(system, (""))
+MAKE_CANCEL_THREAD_FUNC(tcdrain, (-1))
+#ifdef __UCLIBC_SUSV3_LEGACY__
+MAKE_CANCEL_THREAD_FUNC(usleep, (0))
+#endif
+MAKE_CANCEL_THREAD_FUNC(wait, (NULL))
+MAKE_CANCEL_THREAD_FUNC(waitid, (0, 0, NULL, 0))
+MAKE_CANCEL_THREAD_FUNC(waitpid, (-1, NULL, 0))
+MAKE_CANCEL_THREAD_FUNC(write, (-1, NULL, 0))
+MAKE_CANCEL_THREAD_FUNC(writev, (-1, NULL, 0))
+
+/* test a few variations that should not cancel ... */
+MAKE_CANCEL_THREAD_FUNC_RE(fcntl_another, fcntl, (0, F_GETFD))
+
+/* main test that creates thread, cancels it, etc... */
+int _test_func(const char *func_name, void *(*func)(void*), const int should_cancel)
+{
+	int ret;
+	pthread_t cancel_thread_id;
+
+	++cnt;
+
+	printf("testing %-30s ", func_name);
+
+	printf(".");
+	if (signal(SIGALRM, cancel_timeout) == SIG_ERR) {
+		perror("unable to bind SIGALRM");
+		exit(-1);
+	}
+
+	printf(".");
+	ready = false;
+	pthread_create(&cancel_thread_id, NULL, func, NULL);
+
+	printf(".");
+	while (!ready)
+		sched_yield();
+
+	printf(".");
+	if (pthread_cancel(cancel_thread_id)) {
+		perror("unable to cancel thread");
+		exit(-1);
+	}
+
+	printf(".");
+	alarm(5);
+	while (ready)
+		sched_yield();
+
+	printf(".");
+	ret = (!!!alarm(0) == should_cancel);
+
+	if (ret)
+		printf(" failed ;(\n");
+	else
+		printf(" OK!\n");
+
+	return ret;
+}
+#define TEST_FUNC(f)    _test_func(#f, cancel_thread_##f, 1)
+#define TEST_FUNC_RE(f) _test_func(#f, cancel_thread_##f, 0)
+
+int main(int argc, char *argv[])
+{
+	int ret = 0;
+	setbuf(stdout, NULL);
+	cnt = 0;
+
+	ret += TEST_FUNC(accept);
+	ret += TEST_FUNC(aio_suspend);
+	ret += TEST_FUNC(clock_nanosleep);
+	ret += TEST_FUNC(close);
+	ret += TEST_FUNC(connect);
+	ret += TEST_FUNC(creat);
+	ret += TEST_FUNC(fcntl);
+	ret += TEST_FUNC(fdatasync);
+	ret += TEST_FUNC(fsync);
+	ret += TEST_FUNC(getmsg);
+	ret += TEST_FUNC(getpmsg);
+	ret += TEST_FUNC(lockf);
+	ret += TEST_FUNC(mq_receive);
+	ret += TEST_FUNC(mq_send);
+	ret += TEST_FUNC(mq_timedreceive);
+	ret += TEST_FUNC(mq_timedsend);
+	ret += TEST_FUNC(msgrcv);
+	ret += TEST_FUNC(msgsnd);
+	ret += TEST_FUNC(msync);
+	ret += TEST_FUNC(nanosleep);
+	ret += TEST_FUNC(open);
+	ret += TEST_FUNC(pause);
+	ret += TEST_FUNC(poll);
+	ret += TEST_FUNC(pread);
+	ret += TEST_FUNC(pselect);
+	ret += TEST_FUNC(pthread_cond_timedwait);
+	ret += TEST_FUNC(pthread_cond_wait);
+	/*ret += TEST_FUNC(pthread_join);*/
+	ret += TEST_FUNC(pthread_testcancel);
+	ret += TEST_FUNC(putmsg);
+	ret += TEST_FUNC(putpmsg);
+	ret += TEST_FUNC(pwrite);
+	ret += TEST_FUNC(read);
+	ret += TEST_FUNC(readv);
+	ret += TEST_FUNC(recv);
+	ret += TEST_FUNC(recvfrom);
+	ret += TEST_FUNC(recvmsg);
+	ret += TEST_FUNC(select);
+	ret += TEST_FUNC(sem_timedwait);
+	ret += TEST_FUNC(sem_wait);
+	ret += TEST_FUNC(send);
+	ret += TEST_FUNC(sendmsg);
+	ret += TEST_FUNC(sendto);
+	ret += TEST_FUNC(sigpause);
+	ret += TEST_FUNC(sigsuspend);
+	ret += TEST_FUNC(sigtimedwait);
+	ret += TEST_FUNC(sigwait);
+	ret += TEST_FUNC(sigwaitinfo);
+	ret += TEST_FUNC(sleep);
+	ret += TEST_FUNC(system);
+	ret += TEST_FUNC(tcdrain);
+#ifdef __UCLIBC_SUSV3_LEGACY__
+	ret += TEST_FUNC(usleep);
+#endif
+	ret += TEST_FUNC(wait);
+	ret += TEST_FUNC(waitid);
+	ret += TEST_FUNC(waitpid);
+	ret += TEST_FUNC(write);
+	ret += TEST_FUNC(writev);
+
+	ret += TEST_FUNC_RE(fcntl_another);
+
+	if (ret)
+		printf("!!! %i / %i tests failed\n", ret, cnt);
+
+	return ret;
+}
diff --git a/ap/build/uClibc/test/pthread/ex1.c b/ap/build/uClibc/test/pthread/ex1.c
new file mode 100644
index 0000000..4d9de03
--- /dev/null
+++ b/ap/build/uClibc/test/pthread/ex1.c
@@ -0,0 +1,35 @@
+/* Creates two threads, one printing 10000 "a"s, the other printing
+   10000 "b"s.
+   Illustrates: thread creation, thread joining. */
+
+#include <stddef.h>
+#include <stdio.h>
+#include <unistd.h>
+#include "pthread.h"
+
+static void *process(void * arg)
+{
+	int i;
+	printf("Starting process %s\n", (char *)arg);
+	for (i = 0; i < 10000; i++)
+		write(1, (char *) arg, 1);
+	return NULL;
+}
+
+#define sucfail(r) (r != 0 ? "failed" : "succeeded")
+int main(void)
+{
+	int pret, ret = 0;
+	pthread_t th_a, th_b;
+	void *retval;
+
+	ret += (pret = pthread_create(&th_a, NULL, process, (void *)"a"));
+	printf("create a %s %d\n", sucfail(pret), pret);
+	ret += (pret = pthread_create(&th_b, NULL, process, (void *)"b"));
+	printf("create b %s %d\n", sucfail(pret), pret);
+	ret += (pret = pthread_join(th_a, &retval));
+	printf("join a %s %d\n", sucfail(pret), pret);
+	ret += (pret = pthread_join(th_b, &retval));
+	printf("join b %s %d\n", sucfail(pret), pret);
+	return ret;
+}
diff --git a/ap/build/uClibc/test/pthread/ex2.c b/ap/build/uClibc/test/pthread/ex2.c
new file mode 100644
index 0000000..98bd4b3
--- /dev/null
+++ b/ap/build/uClibc/test/pthread/ex2.c
@@ -0,0 +1,113 @@
+/* The classic producer-consumer example.
+   Illustrates mutexes and conditions.
+   All integers between 0 and 9999 should be printed exactly twice,
+   once to the right of the arrow and once to the left. */
+
+#include <stdio.h>
+#include "pthread.h"
+
+#define BUFFER_SIZE 16
+
+/* Circular buffer of integers. */
+
+struct prodcons {
+  int buffer[BUFFER_SIZE];      /* the actual data */
+  pthread_mutex_t lock;         /* mutex ensuring exclusive access to buffer */
+  int readpos, writepos;        /* positions for reading and writing */
+  pthread_cond_t notempty;      /* signaled when buffer is not empty */
+  pthread_cond_t notfull;       /* signaled when buffer is not full */
+};
+
+/* Initialize a buffer */
+
+static void init(struct prodcons * b)
+{
+  pthread_mutex_init(&b->lock, NULL);
+  pthread_cond_init(&b->notempty, NULL);
+  pthread_cond_init(&b->notfull, NULL);
+  b->readpos = 0;
+  b->writepos = 0;
+}
+
+/* Store an integer in the buffer */
+
+static void put(struct prodcons * b, int data)
+{
+  pthread_mutex_lock(&b->lock);
+  /* Wait until buffer is not full */
+  while ((b->writepos + 1) % BUFFER_SIZE == b->readpos) {
+    pthread_cond_wait(&b->notfull, &b->lock);
+    /* pthread_cond_wait reacquired b->lock before returning */
+  }
+  /* Write the data and advance write pointer */
+  b->buffer[b->writepos] = data;
+  b->writepos++;
+  if (b->writepos >= BUFFER_SIZE) b->writepos = 0;
+  /* Signal that the buffer is now not empty */
+  pthread_cond_signal(&b->notempty);
+  pthread_mutex_unlock(&b->lock);
+}
+
+/* Read and remove an integer from the buffer */
+
+static int get(struct prodcons * b)
+{
+  int data;
+  pthread_mutex_lock(&b->lock);
+  /* Wait until buffer is not empty */
+  while (b->writepos == b->readpos) {
+    pthread_cond_wait(&b->notempty, &b->lock);
+  }
+  /* Read the data and advance read pointer */
+  data = b->buffer[b->readpos];
+  b->readpos++;
+  if (b->readpos >= BUFFER_SIZE) b->readpos = 0;
+  /* Signal that the buffer is now not full */
+  pthread_cond_signal(&b->notfull);
+  pthread_mutex_unlock(&b->lock);
+  return data;
+}
+
+/* A test program: one thread inserts integers from 1 to 10000,
+   the other reads them and prints them. */
+
+#define OVER (-1)
+
+struct prodcons buffer;
+
+static void * producer(void * data)
+{
+  int n;
+  for (n = 0; n < 10000; n++) {
+    printf("%d --->\n", n);
+    put(&buffer, n);
+  }
+  put(&buffer, OVER);
+  return NULL;
+}
+
+static void * consumer(void * data)
+{
+  int d;
+  while (1) {
+    d = get(&buffer);
+    if (d == OVER) break;
+    printf("---> %d\n", d);
+  }
+  return NULL;
+}
+
+int main(void)
+{
+  pthread_t th_a, th_b;
+  void * retval;
+
+  init(&buffer);
+  /* Create the threads */
+  pthread_create(&th_a, NULL, producer, 0);
+  pthread_create(&th_b, NULL, consumer, 0);
+  /* Wait until producer and consumer finish. */
+  pthread_join(th_a, &retval);
+  pthread_join(th_b, &retval);
+  return 0;
+}
diff --git a/ap/build/uClibc/test/pthread/ex3.c b/ap/build/uClibc/test/pthread/ex3.c
new file mode 100644
index 0000000..8ef7797
--- /dev/null
+++ b/ap/build/uClibc/test/pthread/ex3.c
@@ -0,0 +1,152 @@
+/* Multi-thread searching.
+   Illustrates: thread cancellation, cleanup handlers. */
+
+#include <errno.h>
+#include <stdio.h>
+#include <unistd.h>
+#include <stdlib.h>
+#include <sys/types.h>
+#include <pthread.h>
+
+/* Defines the number of searching threads */
+#define NUM_THREADS 5
+
+/* Function prototypes */
+void *search(void *);
+void print_it(void *);
+
+/* Global variables */
+pthread_t threads[NUM_THREADS];
+pthread_mutex_t lock;
+int tries;
+volatile int started;
+
+int main(int argc, char ** argv)
+{
+  unsigned long i;
+  unsigned long pid;
+
+  /* create a number to search for */
+  pid = getpid();
+  printf("Searching for the number = %ld...\n", pid);
+
+  /* Initialize the mutex lock */
+  pthread_mutex_init(&lock, NULL);
+
+  /* Create the searching threads */
+  for (started=0; started<NUM_THREADS; started++)
+    pthread_create(&threads[started], NULL, search, (void *)pid);
+
+  /* Wait for (join) all the searching threads */
+  for (i=0; i<NUM_THREADS; i++)
+    pthread_join(threads[i], NULL);
+
+  printf("It took %d tries to find the number.\n", tries);
+
+  /* Exit the program */
+  return 0;
+}
+
+/* This is the cleanup function that is called
+   when the threads are cancelled */
+
+void print_it(void *arg)
+{
+  int *try = (int *) arg;
+  pthread_t tid;
+
+  /* Get the calling thread's ID */
+  tid = pthread_self();
+
+  /* Print where the thread was in its search when it was cancelled */
+  printf("Thread %lx was canceled on its %d try.\n", tid, *try);
+}
+
+/* This is the search routine that is executed in each thread */
+
+void *search(void *arg)
+{
+  unsigned long num = (unsigned long) arg;
+  unsigned long i, j, ntries;
+  pthread_t tid;
+
+  /* get the calling thread ID */
+  tid = pthread_self();
+
+  /* use the thread ID to set the seed for the random number generator */
+  /* Since srand and rand are not thread-safe, serialize with lock */
+
+  /* Try to lock the mutex lock --
+     if locked, check to see if the thread has been cancelled
+     if not locked then continue */
+  while (pthread_mutex_trylock(&lock) == EBUSY)
+    pthread_testcancel();
+
+  srand((int)tid);
+  i = rand() & 0xFFFFFF;
+  pthread_mutex_unlock(&lock);
+  ntries = 0;
+
+  /* Set the cancellation parameters --
+     - Enable thread cancellation
+     - Defer the action of the cancellation */
+
+  pthread_setcancelstate(PTHREAD_CANCEL_ENABLE, NULL);
+  pthread_setcanceltype(PTHREAD_CANCEL_DEFERRED, NULL);
+
+  while (started < NUM_THREADS)
+    sched_yield ();
+
+  /* Push the cleanup routine (print_it) onto the thread
+     cleanup stack.  This routine will be called when the
+     thread is cancelled.  Also note that the pthread_cleanup_push
+     call must have a matching pthread_cleanup_pop call.  The
+     push and pop calls MUST be at the same lexical level
+     within the code */
+
+  /* Pass address of `ntries' since the current value of `ntries' is not
+     the one we want to use in the cleanup function */
+
+  pthread_cleanup_push(print_it, (void *)&ntries);
+
+  /* Loop forever */
+  while (1) {
+    i = (i + 1) & 0xFFFFFF;
+    ntries++;
+
+    /* Does the random number match the target number? */
+    if (num == i) {
+      /* Try to lock the mutex lock --
+         if locked, check to see if the thread has been cancelled
+         if not locked then continue */
+      while (pthread_mutex_trylock(&lock) == EBUSY)
+        pthread_testcancel();
+
+      /* Set the global variable for the number of tries */
+      tries = ntries;
+      printf("Thread %lx found the number!\n", tid);
+
+      /* Cancel all the other threads */
+      for (j=0; j<NUM_THREADS; j++)
+        if (threads[j] != tid) pthread_cancel(threads[j]);
+
+      /* Break out of the while loop */
+      break;
+    }
+
+    /* Every 100 tries check to see if the thread has been cancelled. */
+    if (ntries % 100 == 0) {
+      pthread_testcancel();
+    }
+  }
+
+  /* The only way we can get here is when the thread breaks out
+     of the while loop.  In this case the thread that makes it here
+     has found the number we are looking for and does not need to run
+     the thread cleanup function.  This is why the pthread_cleanup_pop
+     function is called with a 0 argument; this will pop the cleanup
+     function off the stack without executing it */
+
+  pthread_cleanup_pop(0);
+  return((void *)0);
+}
diff --git a/ap/build/uClibc/test/pthread/ex4.c b/ap/build/uClibc/test/pthread/ex4.c
new file mode 100644
index 0000000..cf4cf1d
--- /dev/null
+++ b/ap/build/uClibc/test/pthread/ex4.c
@@ -0,0 +1,107 @@
+/* Making a library function that uses static variables thread-safe.
+   Illustrates: thread-specific data, pthread_once(). */
+
+#include <stddef.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <pthread.h>
+
+/* This is a typical example of a library function that uses
+   static variables to accumulate results between calls.
+   Here, it just returns the concatenation of all string arguments
+   that were given to it. */
+
+#if 0
+
+static char * str_accumulate(char * s)
+{
+  static char accu[1024] = { 0 };
+  strcat(accu, s);
+  return accu;
+}
+
+#endif
+
+/* Of course, this cannot be used in a multi-threaded program
+   because all threads store "accu" at the same location.
+   So, we'll use thread-specific data to have a different "accu"
+   for each thread. */
+
+/* Key identifying the thread-specific data */
+static pthread_key_t str_key;
+/* "Once" variable ensuring that the key for str_alloc will be allocated
+   exactly once. */
+static pthread_once_t str_alloc_key_once = PTHREAD_ONCE_INIT;
+
+/* Forward functions */
+static void str_alloc_key(void);
+static void str_alloc_destroy_accu(void * accu);
+
+/* Thread-safe version of str_accumulate */
+
+static char * str_accumulate(const char * s)
+{
+  char * accu;
+
+  /* Make sure the key is allocated */
+  pthread_once(&str_alloc_key_once, str_alloc_key);
+  /* Get the thread-specific data associated with the key */
+  accu = (char *) pthread_getspecific(str_key);
+  /* It's initially NULL, meaning that we must allocate the buffer first. */
+  if (accu == NULL) {
+    accu = malloc(1024);
+    if (accu == NULL) return NULL;
+    accu[0] = 0;
+    /* Store the buffer pointer in the thread-specific data. */
+    pthread_setspecific(str_key, (void *) accu);
+    printf("Thread %lx: allocating buffer at %p\n", pthread_self(), accu);
+  }
+  /* Now we can use accu just as in the non thread-safe code. */
+  strcat(accu, s);
+  return accu;
+}
+
+/* Function to allocate the key for str_alloc thread-specific data. */
+
+static void str_alloc_key(void)
+{
+  pthread_key_create(&str_key, str_alloc_destroy_accu);
+  printf("Thread %lx: allocated key %d\n", pthread_self(), str_key);
+}
+
+/* Function to free the buffer when the thread exits. */
+/* Called only when the thread-specific data is not NULL. */
+
+static void str_alloc_destroy_accu(void * accu)
+{
+  printf("Thread %lx: freeing buffer at %p\n", pthread_self(), accu);
+  free(accu);
+}
+
+/* Test program */
+
+static void * process(void * arg)
+{
+  char * res;
+  res = str_accumulate("Result of ");
+  res = str_accumulate((char *) arg);
+  res = str_accumulate(" thread");
+  printf("Thread %lx: \"%s\"\n", pthread_self(), res);
+  return NULL;
+}
+
+int main(int argc, char ** argv)
+{
+  char * res;
+  pthread_t th1, th2;
+
+  res = str_accumulate("Result of ");
+  pthread_create(&th1, NULL, process, (void *) "first");
+  pthread_create(&th2, NULL, process, (void *) "second");
+  res = str_accumulate("initial thread");
+  printf("Thread %lx: \"%s\"\n", pthread_self(), res);
+  pthread_join(th1, NULL);
+  pthread_join(th2, NULL);
+  exit(0);
+}
diff --git a/ap/build/uClibc/test/pthread/ex5.c b/ap/build/uClibc/test/pthread/ex5.c
new file mode 100644
index 0000000..7a293eb
--- /dev/null
+++ b/ap/build/uClibc/test/pthread/ex5.c
@@ -0,0 +1,102 @@
+/* The classic producer-consumer example, implemented with semaphores.
+   All integers between 0 and 9999 should be printed exactly twice,
+   once to the right of the arrow and once to the left. */
+
+#include <stdio.h>
+#include "pthread.h"
+#include "semaphore.h"
+
+#define BUFFER_SIZE 16
+
+/* Circular buffer of integers. */
+
+struct prodcons {
+  int buffer[BUFFER_SIZE];      /* the actual data */
+  int readpos, writepos;        /* positions for reading and writing */
+  sem_t sem_read;               /* number of elements available for reading */
+  sem_t sem_write;              /* number of locations available for writing */
+};
+
+/* Initialize a buffer */
+
+static void init(struct prodcons * b)
+{
+  sem_init(&b->sem_write, 0, BUFFER_SIZE - 1);
+  sem_init(&b->sem_read, 0, 0);
+  b->readpos = 0;
+  b->writepos = 0;
+}
+
+/* Store an integer in the buffer */
+
+static void put(struct prodcons * b, int data)
+{
+  /* Wait until buffer is not full */
+  sem_wait(&b->sem_write);
+  /* Write the data and advance write pointer */
+  b->buffer[b->writepos] = data;
+  b->writepos++;
+  if (b->writepos >= BUFFER_SIZE) b->writepos = 0;
+  /* Signal that the buffer contains one more element for reading */
+  sem_post(&b->sem_read);
+}
+
+/* Read and remove an integer from the buffer */
+
+static int get(struct prodcons * b)
+{
+  int data;
+  /* Wait until buffer is not empty */
+  sem_wait(&b->sem_read);
+  /* Read the data and advance read pointer */
+  data = b->buffer[b->readpos];
+  b->readpos++;
+  if (b->readpos >= BUFFER_SIZE) b->readpos = 0;
+  /* Signal that the buffer has now one more location for writing */
+  sem_post(&b->sem_write);
+  return data;
+}
+
+/* A test program: one thread inserts integers from 1 to 10000,
+   the other reads them and prints them. */
+
+#define OVER (-1)
+
+struct prodcons buffer;
+
+static void * producer(void * data)
+{
+  int n;
+  for (n = 0; n < 10000; n++) {
+    printf("%d --->\n", n);
+    put(&buffer, n);
+  }
+  put(&buffer, OVER);
+  return NULL;
+}
+
+static void * consumer(void * data)
+{
+  int d;
+  while (1) {
+    d = get(&buffer);
+    if (d == OVER) break;
+    printf("---> %d\n", d);
+  }
+  return NULL;
+}
+
+int main(void)
+{
+  pthread_t th_a, th_b;
+  void * retval;
+
+  init(&buffer);
+  /* Create the threads */
+  pthread_create(&th_a, NULL, producer, 0);
+  pthread_create(&th_b, NULL, consumer, 0);
+  /* Wait until producer and consumer finish. */
+  pthread_join(th_a, &retval);
+  pthread_join(th_b, &retval);
+  return 0;
+}
diff --git a/ap/build/uClibc/test/pthread/ex6.c b/ap/build/uClibc/test/pthread/ex6.c
new file mode 100644
index 0000000..ffb6287
--- /dev/null
+++ b/ap/build/uClibc/test/pthread/ex6.c
@@ -0,0 +1,44 @@
+#include <errno.h>
+#include <stdio.h>
+#include <string.h>
+#include <pthread.h>
+#include <time.h>
+
+static void *
+test_thread (void *v_param)
+{
+  return NULL;
+}
+
+int
+main (void)
+{
+  unsigned long count;
+  struct timespec ts;
+  ts.tv_sec = 0;
+  ts.tv_nsec = 10 * 1000;
+
+  setvbuf (stdout, NULL, _IONBF, 0);
+
+  for (count = 0; count < 2000; ++count)
+    {
+      pthread_t thread;
+      int status;
+
+      status = pthread_create (&thread, NULL, test_thread, NULL);
+      if (status != 0)
+	{
+	  printf ("status = %d, count = %lu: %s\n", status, count,
+		  strerror (errno));
+	  return 1;
+	}
+      else
+	{
+	  printf ("count = %lu\n", count);
+	}
+      /* pthread_detach (thread); */
+      pthread_join (thread, NULL);
+      nanosleep (&ts, NULL);
+    }
+  return 0;
+}
diff --git a/ap/build/uClibc/test/pthread/ex7.c b/ap/build/uClibc/test/pthread/ex7.c
new file mode 100644
index 0000000..8eeb9a2
--- /dev/null
+++ b/ap/build/uClibc/test/pthread/ex7.c
@@ -0,0 +1,106 @@
+/* ex7
+ *
+ * Test case that illustrates a timed wait on a condition variable.
+ */
+
+#include <errno.h>
+#include <stdio.h>
+#include <string.h>
+#include <pthread.h>
+#include <sys/time.h>
+#include <time.h>
+
+/* Our event variable using a condition variable contruct. */
+typedef struct {
+    pthread_mutex_t	mutex;
+    pthread_cond_t	cond;
+    int			flag;
+} event_t;
+
+
+/* Global event to signal main thread the timeout of the child thread. */
+event_t main_event;
+
+
+static void *
+test_thread (void *ms_param)
+{
+    unsigned long status = 0;
+    event_t foo;
+    struct timespec timeout;
+    struct timeval  now;
+    long ms = (long) ms_param;
+
+    /* initialize cond var */
+    pthread_cond_init(&foo.cond, NULL);
+    pthread_mutex_init(&foo.mutex, NULL);
+    foo.flag = 0;
+
+    /* set the time out value */
+    printf("waiting %ld ms ...\n", ms);
+    gettimeofday(&now, NULL);
+    timeout.tv_sec  = now.tv_sec + ms/1000 + (now.tv_usec + (ms%1000)*1000)/1000000;
+    timeout.tv_nsec = ((now.tv_usec + (ms%1000)*1000) % 1000000) * 1000;
+
+    /* Just use this to test the time out. The cond var is never signaled. */
+    pthread_mutex_lock(&foo.mutex);
+    while (foo.flag == 0 && status != ETIMEDOUT) {
+	status = pthread_cond_timedwait(&foo.cond, &foo.mutex, &timeout);
+    }
+    pthread_mutex_unlock(&foo.mutex);
+
+    /* post the main event */
+    pthread_mutex_lock(&main_event.mutex);
+    main_event.flag = 1;
+    pthread_cond_signal(&main_event.cond);
+    pthread_mutex_unlock(&main_event.mutex);
+
+    /* that's it, bye */
+    return (void*) status;
+}
+
+int
+main (void)
+{
+  unsigned long count;
+  struct timespec ts;
+  ts.tv_sec = 0;
+  ts.tv_nsec = 10 * 1000;
+
+  setvbuf (stdout, NULL, _IONBF, 0);
+
+  /* initialize main event cond var */
+  pthread_cond_init(&main_event.cond, NULL);
+  pthread_mutex_init(&main_event.mutex, NULL);
+  main_event.flag = 0;
+
+  for (count = 0; count < 20; ++count)
+  {
+      pthread_t thread;
+      int status;
+
+      /* pass down the milli-second timeout in the void* param */
+      status = pthread_create (&thread, NULL, test_thread, (void*) (count*100));
+      if (status != 0) {
+	  printf ("status = %d, count = %lu: %s\n", status, count,
+		  strerror (errno));
+	  return 1;
+      }
+      else {
+
+	  /* wait for the event posted by the child thread */
+	  pthread_mutex_lock(&main_event.mutex);
+	  while (main_event.flag == 0) {
+	      pthread_cond_wait(&main_event.cond, &main_event.mutex);
+	  }
+	  main_event.flag = 0;
+	  pthread_mutex_unlock(&main_event.mutex);
+
+	  printf ("count = %lu\n", count);
+      }
+
+      nanosleep (&ts, NULL);
+  }
+
+  return 0;
+}
diff --git a/ap/build/uClibc/test/pthread/tst-too-many-cleanups.c b/ap/build/uClibc/test/pthread/tst-too-many-cleanups.c
new file mode 100644
index 0000000..7828c50
--- /dev/null
+++ b/ap/build/uClibc/test/pthread/tst-too-many-cleanups.c
@@ -0,0 +1,104 @@
+/*
+ * This illustrates the bug where the cleanup function
+ * of a thread may be called too many times.
+ *
+ * main thread:
+ *  - grab mutex
+ *  - spawn thread1
+ *  - go to sleep
+ * thread1:
+ *  - register cleanup handler via pthread_cleanup_push()
+ *  - try to grab mutex and sleep
+ * main:
+ *  - kill thread1
+ *  - go to sleep
+ * thread1 cleanup handler:
+ *  - try to grab mutex and sleep
+ * main:
+ *  - kill thread1
+ *  - go to sleep
+ * thread1 cleanup handler:
+ *  - wrongly called again
+ */
+
+#ifndef _GNU_SOURCE
+#define _GNU_SOURCE
+#endif
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <pthread.h>
+#include <assert.h>
+#include <unistd.h>
+
+#define warn(fmt, args...) fprintf(stderr, "[%p] " fmt, (void*)pthread_self(), ## args)
+#define warnf(fmt, args...) warn("%s:%i: " fmt, __FUNCTION__, __LINE__, ## args)
+
+int ok_to_kill_thread;
+
+static void thread_killed(void *arg);
+
+static void *KillMeThread(void *thread_par)
+{
+	pthread_t pthread_id;
+
+	warnf("Starting child thread\n");
+
+	pthread_id = pthread_self();
+	pthread_cleanup_push(thread_killed, (void *)pthread_id);
+
+	pthread_setcanceltype(PTHREAD_CANCEL_ASYNCHRONOUS, NULL);
+	pthread_setcancelstate(PTHREAD_CANCEL_ENABLE, NULL);
+
+	/* main code */
+	warnf("please kill me now\n");
+	while (1) {
+		ok_to_kill_thread = 1;
+		sleep(1);
+	}
+
+	pthread_cleanup_pop(0);
+
+	return 0;
+}
+
+static void thread_killed(void *arg)
+{
+	static int num_times_called = 0;
+
+	warnf("killing %p [cnt=%i]\n", arg, ++num_times_called);
+	assert(num_times_called == 1);
+
+	/* pick any cancellation endpoint, sleep() will do just fine */
+	while (1) {
+		warnf("sleeping in cancellation endpoint ...\n");
+		sleep(1);
+	}
+
+	warnf("done cleaning up\n");
+}
+
+int main(int argc, char *argv[])
+{
+	int count = 3;
+	pthread_t app_pthread_id;
+
+	/* need to tweak this test a bit to play nice with signals and LT */
+	return 0;
+
+	ok_to_kill_thread = 0;
+
+	pthread_create(&app_pthread_id, NULL, KillMeThread, NULL);
+
+	warnf("waiting for thread to prepare itself\n");
+	while (!ok_to_kill_thread)
+		sleep(1);
+
+	while (count--) {
+		warnf("killing thread\n");
+		pthread_cancel(app_pthread_id);
+		sleep(3);
+	}
+
+	return 0;
+}
diff --git a/ap/build/uClibc/test/pwd_grp/.indent.pro b/ap/build/uClibc/test/pwd_grp/.indent.pro
new file mode 100644
index 0000000..492ecf1
--- /dev/null
+++ b/ap/build/uClibc/test/pwd_grp/.indent.pro
@@ -0,0 +1,33 @@
+--blank-lines-after-declarations
+--blank-lines-after-procedures
+--break-before-boolean-operator
+--no-blank-lines-after-commas
+--braces-on-if-line
+--braces-on-struct-decl-line
+--comment-indentation25
+--declaration-comment-column25
+--no-comment-delimiters-on-blank-lines
+--cuddle-else
+--continuation-indentation4
+--case-indentation0
+--else-endif-column33
+--space-after-cast
+--line-comments-indentation0
+--declaration-indentation1
+--dont-format-first-column-comments
+--dont-format-comments
+--honour-newlines
+--indent-level4
+/* changed from 0 to 4 */
+--parameter-indentation4
+--line-length78 /* changed from 75 */
+--continue-at-parentheses
+--no-space-after-function-call-names
+--dont-break-procedure-type
+--dont-star-comments
+--leave-optional-blank-lines
+--dont-space-special-semicolon
+--tab-size4
+/* additions by Mark */
+--case-brace-indentation0
+--leave-preprocessor-space
diff --git a/ap/build/uClibc/test/pwd_grp/Makefile b/ap/build/uClibc/test/pwd_grp/Makefile
new file mode 100644
index 0000000..21070f4
--- /dev/null
+++ b/ap/build/uClibc/test/pwd_grp/Makefile
@@ -0,0 +1,7 @@
+# uClibc pwd_grp tests
+# Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
+
+top_builddir=../../
+include ../Rules.mak
+-include Makefile.in
+include ../Test.mak
diff --git a/ap/build/uClibc/test/pwd_grp/Makefile.in b/ap/build/uClibc/test/pwd_grp/Makefile.in
new file mode 100644
index 0000000..d561f3d
--- /dev/null
+++ b/ap/build/uClibc/test/pwd_grp/Makefile.in
@@ -0,0 +1,8 @@
+# uClibc pwd_grp tests
+# Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
+
+DODIFF_test_pwd  := 1
+DODIFF_test_grp  := 1
+DODIFF_pwcat     := 1
+DODIFF_grcat     := 1
+DODIFF_getgroups := 1
diff --git a/ap/build/uClibc/test/pwd_grp/getgroups.c b/ap/build/uClibc/test/pwd_grp/getgroups.c
new file mode 100644
index 0000000..5769b18
--- /dev/null
+++ b/ap/build/uClibc/test/pwd_grp/getgroups.c
@@ -0,0 +1,99 @@
+/* This test was ripped out of GNU 'id' from coreutils-5.0
+ * by Erik Andersen.
+ *
+ *
+ * id is Copyright (C) 1989-2003 Free Software Foundation, Inc.
+ * and licensed under the GPL v2 or later, and was written by
+ * Arnold Robbins, with a major rewrite by David MacKenzie,
+ */
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <unistd.h>
+#include <sys/types.h>
+#include <pwd.h>
+#include <grp.h>
+#include <err.h>
+
+/* The number of errors encountered so far. */
+static int problems = 0;
+
+/* Print the name or value of group ID GID. */
+static void print_group(gid_t gid)
+{
+	struct group *grp = NULL;
+
+	grp = getgrgid(gid);
+	if (grp == NULL) {
+		warn("cannot find name for group ID %u", gid);
+		problems++;
+	}
+
+	if (grp == NULL)
+		printf("%u", (unsigned)gid);
+	else
+		printf("%s", grp->gr_name);
+}
+
+static int xgetgroups(gid_t gid, int *n_groups, gid_t ** groups)
+{
+	int max_n_groups;
+	int ng;
+	gid_t *g;
+	int fail = 0;
+
+	max_n_groups = getgroups(0, NULL);
+
+	/* Add 1 just in case max_n_groups is zero.  */
+	g = (gid_t *) malloc(max_n_groups * sizeof(gid_t) + 1);
+	if (g == NULL)
+		err(EXIT_FAILURE, "out of memory");
+	ng = getgroups(max_n_groups, g);
+
+	if (ng < 0) {
+		warn("cannot get supplemental group list");
+		++fail;
+		free(g);
+	}
+	if (!fail) {
+		*n_groups = ng;
+		*groups = g;
+	}
+	return fail;
+}
+
+/* Print all of the distinct groups the user is in. */
+int main(int argc, char *argv[])
+{
+	struct passwd *pwd;
+
+	pwd = getpwuid(getuid());
+	if (pwd == NULL)
+		problems++;
+
+	print_group(getgid());
+	if (getegid() != getgid()) {
+		putchar(' ');
+		print_group(getegid());
+	}
+
+	{
+		int n_groups = 0;
+		gid_t *groups;
+		register int i;
+
+		if (xgetgroups((pwd ? pwd->pw_gid : (gid_t) - 1),
+			       &n_groups, &groups)) {
+			return ++problems;
+		}
+
+		for (i = 0; i < n_groups; i++)
+			if (groups[i] != getgid() && groups[i] != getegid()) {
+				putchar(' ');
+				print_group(groups[i]);
+			}
+		free(groups);
+	}
+	putchar('\n');
+	return (problems != 0);
+}
diff --git a/ap/build/uClibc/test/pwd_grp/grcat.c b/ap/build/uClibc/test/pwd_grp/grcat.c
new file mode 100644
index 0000000..a896140
--- /dev/null
+++ b/ap/build/uClibc/test/pwd_grp/grcat.c
@@ -0,0 +1,32 @@
+/*
+ * grcat.c
+ *
+ * Generate a printable version of the group database
+ */
+/*
+ * Arnold Robbins, arnold@gnu.org, May 1993
+ * Public Domain
+ */
+
+#include <stdlib.h>
+#include <stdio.h>
+#include <grp.h>
+
+int main(int argc, char **argv)
+{
+    struct group *g;
+    int i;
+
+    while ((g = getgrent()) != NULL) {
+	printf("%s:%s:%ld:", g->gr_name, g->gr_passwd,
+		(long) g->gr_gid);
+	for (i = 0; g->gr_mem[i] != NULL; i++) {
+	    printf("%s", g->gr_mem[i]);
+	    if (g->gr_mem[i+1] != NULL)
+		putchar(',');
+	}
+	putchar('\n');
+    }
+    endgrent();
+    return 0;
+}
diff --git a/ap/build/uClibc/test/pwd_grp/pwcat.c b/ap/build/uClibc/test/pwd_grp/pwcat.c
new file mode 100644
index 0000000..afad8e1
--- /dev/null
+++ b/ap/build/uClibc/test/pwd_grp/pwcat.c
@@ -0,0 +1,26 @@
+/*
+ * pwcat.c
+ *
+ * Generate a printable version of the password database
+ */
+/*
+ * Arnold Robbins, arnold@gnu.org, May 1993
+ * Public Domain
+ */
+
+#include <stdio.h>
+#include <pwd.h>
+#include <stdlib.h>
+
+int main(int argc, char **argv)
+{
+    struct passwd *p;
+
+    while ((p = getpwent()) != NULL)
+	printf("%s:%s:%ld:%ld:%s:%s:%s\n",
+		p->pw_name, p->pw_passwd, (long) p->pw_uid,
+		(long) p->pw_gid, p->pw_gecos, p->pw_dir, p->pw_shell);
+
+    endpwent();
+    return 0;
+}
diff --git a/ap/build/uClibc/test/pwd_grp/test_grp.c b/ap/build/uClibc/test/pwd_grp/test_grp.c
new file mode 100644
index 0000000..573806c
--- /dev/null
+++ b/ap/build/uClibc/test/pwd_grp/test_grp.c
@@ -0,0 +1,87 @@
+/*
+ * test_grp.c - This file is part of the libc-8086/grp package for ELKS,
+ * Copyright (C) 1995, 1996 Nat Friedman <ndf@linux.mit.edu>.
+ *
+ * Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
+ */
+
+#include <unistd.h>
+#include <stdio.h>
+#include <fcntl.h>
+#include <grp.h>
+
+int main(int argc, char **argv)
+{
+	struct group *group;
+	char **tmp_mem;
+	int test_gid;
+
+	fprintf(stdout, "Beginning test of libc/grp...\n");
+
+	fprintf(stdout, "=> Testing setgrent(), getgrent(), endgrent()...\n");
+	fprintf(stdout, "-> setgrent()...\n");
+	setgrent();
+	fprintf(stdout, "-> getgrent()...\n");
+	printf
+		("********************************************************************************\n");
+	while ((group = getgrent()) != NULL) {
+		printf("gr_name\t\t: %s\n", group->gr_name);
+		printf("gr_passwd\t: %s\n", group->gr_passwd);
+		printf("gr_gid\t\t: %d\n", (int) group->gr_gid);
+		printf("gr_mem\t\t: ");
+		fflush(stdout);
+		tmp_mem = group->gr_mem;
+		while (*tmp_mem != NULL) {
+			printf("%s, ", *tmp_mem);
+			tmp_mem++;
+		}
+		printf
+			("\n********************************************************************************\n");
+	}
+	fprintf(stdout, "-> endgrent()...\n");
+	endgrent();
+	fprintf(stdout,
+			"=> Test of setgrent(), getgrent(), endgrent() complete.\n");
+	fprintf(stdout, "=> Testing getgrid(), getgrnam()...\n");
+	fprintf(stdout, "-> getgrgid()...\n");
+	printf
+		("********************************************************************************\n");
+	for (test_gid = 0; test_gid < 100; test_gid++) {
+		fprintf(stdout, "-> getgrgid(%d)...\n", test_gid);
+		group = getgrgid((gid_t) test_gid);
+		if (group != NULL) {
+			printf("gr_name\t: %s\n", group->gr_name);
+			printf("gr_passwd\t: %s\n", group->gr_passwd);
+			printf("gr_gid\t: %d\n", (int) group->gr_gid);
+			printf("gr_mem\t\t: ");
+			fflush(stdout);
+			tmp_mem = group->gr_mem;
+			while (*tmp_mem != NULL) {
+				printf("%s, ", *tmp_mem);
+				tmp_mem++;
+			}
+		}
+		printf
+			("\n********************************************************************************\n");
+	}
+	fprintf(stdout, "-> getgrnam()...\n");
+	group = getgrnam("root");
+	if (group == NULL) {
+		printf(">NULL<\n");
+	} else {
+		printf("gr_name\t: %s\n", group->gr_name);
+		printf("gr_passwd\t: %s\n", group->gr_passwd);
+		printf("gr_gid\t: %d\n", (int) group->gr_gid);
+		printf("gr_mem\t\t: ");
+		fflush(stdout);
+		tmp_mem = group->gr_mem;
+		while (*tmp_mem != NULL) {
+			printf("%s, ", *tmp_mem);
+			tmp_mem++;
+		}
+		printf("\n");
+	}
+
+
+	return 0;
+}
diff --git a/ap/build/uClibc/test/pwd_grp/test_pwd.c b/ap/build/uClibc/test/pwd_grp/test_pwd.c
new file mode 100644
index 0000000..065864e
--- /dev/null
+++ b/ap/build/uClibc/test/pwd_grp/test_pwd.c
@@ -0,0 +1,74 @@
+/*
+ * test_pwd.c - This file is part of the libc-8086/pwd package for ELKS,
+ * Copyright (C) 1995, 1996 Nat Friedman <ndf@linux.mit.edu>.
+ *
+ * Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
+ */
+
+#include <unistd.h>
+#include <stdio.h>
+#include <fcntl.h>
+#include <pwd.h>
+
+int main(int argc, char **argv)
+{
+	struct passwd *passwd;
+	int test_uid;
+
+	fprintf(stdout, "Beginning test of libc/pwd...\n");
+
+	fprintf(stdout, "=> Testing setpwent(), getpwent(), endpwent()...\n");
+	fprintf(stdout, "-> setpwent()...\n");
+	setpwent();
+	fprintf(stdout, "-> getpwent()...\n");
+	printf
+		("********************************************************************************\n");
+	while ((passwd = getpwent()) != NULL) {
+		printf("pw_name\t\t: %s\n", passwd->pw_name);
+		printf("pw_passwd\t: %s\n", passwd->pw_passwd);
+		printf("pw_uid\t\t: %d\n", (int) passwd->pw_uid);
+		printf("pw_gid\t\t: %d\n", (int) passwd->pw_gid);
+		printf("pw_gecos\t: %s\n", passwd->pw_gecos);
+		printf("pw_dir\t\t: %s\n", passwd->pw_dir);
+		printf("pw_shell\t: %s\n", passwd->pw_shell);
+		printf
+			("********************************************************************************\n");
+	}
+	fprintf(stdout, "-> endpwent()...\n");
+	endpwent();
+	fprintf(stdout,
+			"=> Test of setpwent(), getpwent(), endpwent() complete.\n");
+	fprintf(stdout, "=> Testing getpwuid(), getpwnam()...\n");
+	fprintf(stdout, "-> getpwuid()...\n");
+	printf
+		("********************************************************************************\n");
+	for (test_uid = 0; test_uid < 1000; test_uid++) {
+		fprintf(stdout, "-> getpwuid(%d)...\n", test_uid);
+		passwd = getpwuid((uid_t) test_uid);
+		if (passwd != NULL) {
+			printf("pw_name\t\t: %s\n", passwd->pw_name);
+			printf("pw_passwd\t: %s\n", passwd->pw_passwd);
+			printf("pw_uid\t\t: %d\n", (int) passwd->pw_uid);
+			printf("pw_gid\t\t: %d\n", (int) passwd->pw_gid);
+			printf("pw_gecos\t: %s\n", passwd->pw_gecos);
+			printf("pw_dir\t\t: %s\n", passwd->pw_dir);
+			printf("pw_shell\t: %s\n", passwd->pw_shell);
+			printf
+				("********************************************************************************\n");
+		}
+	}
+	fprintf(stdout, "-> getpwnam()...\n");
+	passwd = getpwnam("root");
+	if (passwd == NULL) {
+		printf(">NULL<\n");
+	} else {
+		printf("pw_name\t\t: %s\n", passwd->pw_name);
+		printf("pw_passwd\t: %s\n", passwd->pw_passwd);
+		printf("pw_uid\t\t: %d\n", (int) passwd->pw_uid);
+		printf("pw_gid\t\t: %d\n", (int) passwd->pw_gid);
+		printf("pw_gecos\t: %s\n", passwd->pw_gecos);
+		printf("pw_dir\t\t: %s\n", passwd->pw_dir);
+		printf("pw_shell\t: %s\n", passwd->pw_shell);
+	}
+	return 0;
+}
diff --git a/ap/build/uClibc/test/regex/LICENSE b/ap/build/uClibc/test/regex/LICENSE
new file mode 100644
index 0000000..2e5acb9
--- /dev/null
+++ b/ap/build/uClibc/test/regex/LICENSE
@@ -0,0 +1,72 @@
+From gsf@research.att.com  Wed Mar  1 20:30:54 2006
+Return-Path: <gsf@research.att.com>
+X-Original-To: mps@bridge.intra
+Delivered-To: mps@bridge.intra
+Received: from localhost (localhost [127.0.0.1])
+	by localhost (Postfix) with ESMTP id B8C814E4F
+	for <mps@bridge.intra>; Wed,  1 Mar 2006 20:30:53 +0100 (CET)
+Received: from mail.bridge.intra ([127.0.0.1])
+ by localhost (lnx.bridge.intra [127.0.0.1]) (amavisd-new, port 10024)
+ with LMTP id 05987-03 for <mps@bridge.intra>;
+ Wed,  1 Mar 2006 20:30:42 +0100 (CET)
+Received: from pop.gmx.net (localhost [127.0.0.1])
+	by mail.bridge.intra (Postfix) with ESMTP id C8C73794D
+	for <mps@bridge.intra>; Wed,  1 Mar 2006 20:30:38 +0100 (CET)
+X-Flags: 0000
+Delivered-To: GMX delivery to ps.m@gmx.net
+Received: (qmail invoked by alias); 01 Mar 2006 19:23:46 -0000
+Received: from mail-red.research.att.com (EHLO mail-white.research.att.com) [192.20.225.110]
+  by mx0.gmx.net (mx085) with SMTP; 01 Mar 2006 20:23:46 +0100
+Received: from raptor.research.att.com (raptor.research.att.com [135.207.23.32])
+	by mail-blue.research.att.com (Postfix) with ESMTP id B7929147CBB
+	for <ps.m@gmx.net>; Wed,  1 Mar 2006 14:23:45 -0500 (EST)
+Received: (from gsf@localhost)
+	by raptor.research.att.com (SGI-8.9.3p2/8.8.7) id OAA86112
+	for ps.m@gmx.net; Wed, 1 Mar 2006 14:23:45 -0500 (EST)
+Date: Wed, 1 Mar 2006 14:23:45 -0500 (EST)
+From: Glenn Fowler <gsf@research.att.com>
+Message-Id: <200603011923.OAA86112@raptor.research.att.com>
+Organization: AT&T Research
+X-Mailer: mailx (AT&T/BSD) 9.9 2005-04-21
+Mime-Version: 1.0
+Content-Type: text/plain; charset=us-ascii
+Content-Transfer-Encoding: 7bit
+References: <Pine.LNX.4.44.0603012011250.6386-100000@lnx.bridge.intra>
+To: mps@bridge.intra
+Subject: Re: testregex licensing question
+X-GMX-Antivirus: -1 (not scanned, may not use virus scanner)
+X-GMX-Antispam: 0 (Mail was not recognized as spam)
+X-GMX-UID: lJF3ZO9DeSEkJ2TcbHQhaXN1IGRvb0Ca
+X-Virus-Scanned: by amavisd-new at localhost
+Status: RO
+X-Status: 
+X-Keywords:                 
+X-UID: 44736
+
+
+you may include it directly
+retain the testregex.c header comment
+it uses a very free license to maximize distribution
+you can copy that .c comment to any test data files you use
+using # comment style to be complete
+
+let me know how it works with your libc
+also pass on any new tests you cook up
+
+On Wed, 1 Mar 2006 20:15:02 +0100 (CET) Peter S. Mazinger wrote:
+> Hello Glenn!
+
+> I would want to add testregex.c and the related *.dat files to the uClibc 
+> testsuite. uClibc is licensed under LGPL v2.1. I haven't found any 
+> licensing related info on testregex.
+
+> Is it allowed to use the code there, or should I accomodate the testsuite 
+> to download the needed files from the original site each time it is ran?
+
+> Thanks, Peter
+
+> -- 
+> Peter S. Mazinger <ps dot m at gmx dot net>           ID: 0xA5F059F2
+> Key fingerprint = 92A4 31E1 56BC 3D5A 2D08  BB6E C389 975E A5F0 59F2
+
+
diff --git a/ap/build/uClibc/test/regex/Makefile b/ap/build/uClibc/test/regex/Makefile
new file mode 100644
index 0000000..6391222
--- /dev/null
+++ b/ap/build/uClibc/test/regex/Makefile
@@ -0,0 +1,7 @@
+# uClibc regex tests
+# Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
+
+top_builddir=../../
+include ../Rules.mak
+-include Makefile.in
+include ../Test.mak
diff --git a/ap/build/uClibc/test/regex/basic.dat b/ap/build/uClibc/test/regex/basic.dat
new file mode 100644
index 0000000..5c50f37
--- /dev/null
+++ b/ap/build/uClibc/test/regex/basic.dat
@@ -0,0 +1,216 @@
+NOTE	all standard compliant implementations should pass these : 2002-05-31
+
+BE	abracadabra$	abracadabracadabra	(7,18)
+BE	a...b		abababbb		(2,7)
+BE	XXXXXX		..XXXXXX		(2,8)
+E	\)		()	(1,2)
+BE	a]		a]a	(0,2)
+B	}		}	(0,1)
+E	\}		}	(0,1)
+BE	\]		]	(0,1)
+B	]		]	(0,1)
+E	]		]	(0,1)
+B	{		{	(0,1)
+B	}		}	(0,1)
+BE	^a		ax	(0,1)
+BE	\^a		a^a	(1,3)
+BE	a\^		a^	(0,2)
+BE	a$		aa	(1,2)
+BE	a\$		a$	(0,2)
+BE	^$		NULL	(0,0)
+E	$^		NULL	(0,0)
+E	a($)		aa	(1,2)(2,2)
+E	a*(^a)		aa	(0,1)(0,1)
+E	(..)*(...)*		a	(0,0)
+E	(..)*(...)*		abcd	(0,4)(2,4)
+E	(ab|a)(bc|c)		abc	(0,3)(0,2)(2,3)
+E	(ab)c|abc		abc	(0,3)(0,2)
+E	a{0}b		ab			(1,2)
+E	(a*)(b?)(b+)b{3}	aaabbbbbbb	(0,10)(0,3)(3,4)(4,7)
+E	(a*)(b{0,1})(b{1,})b{3}	aaabbbbbbb	(0,10)(0,3)(3,4)(4,7)
+E	a{9876543210}	NULL	BADBR
+E	((a|a)|a)			a	(0,1)(0,1)(0,1)
+E	(a*)(a|aa)			aaaa	(0,4)(0,3)(3,4)
+E	a*(a.|aa)			aaaa	(0,4)(2,4)
+E	a(b)|c(d)|a(e)f			aef	(0,3)(?,?)(?,?)(1,2)
+E	(a|b)?.*			b	(0,1)(0,1)
+E	(a|b)c|a(b|c)			ac	(0,2)(0,1)
+E	(a|b)c|a(b|c)			ab	(0,2)(?,?)(1,2)
+E	(a|b)*c|(a|ab)*c		abc	(0,3)(1,2)
+E	(a|b)*c|(a|ab)*c		xc	(1,2)
+E	(.a|.b).*|.*(.a|.b)		xa	(0,2)(0,2)
+E	a?(ab|ba)ab			abab	(0,4)(0,2)
+E	a?(ac{0}b|ba)ab			abab	(0,4)(0,2)
+E	ab|abab				abbabab	(0,2)
+E	aba|bab|bba			baaabbbaba	(5,8)
+E	aba|bab				baaabbbaba	(6,9)
+E	(aa|aaa)*|(a|aaaaa)		aa	(0,2)(0,2)
+E	(a.|.a.)*|(a|.a...)		aa	(0,2)(0,2)
+E	ab|a				xabc	(1,3)
+E	ab|a				xxabc	(2,4)
+Ei	(Ab|cD)*			aBcD	(0,4)(2,4)
+BE	[^-]			--a		(2,3)
+BE	[a-]*			--a		(0,3)
+BE	[a-m-]*			--amoma--	(0,4)
+E	:::1:::0:|:::1:1:0:	:::0:::1:::1:::0:	(8,17)
+E	:::1:::0:|:::1:1:1:	:::0:::1:::1:::0:	(8,17)
+{E	[[:upper:]]		A		(0,1)	[[<element>]] not supported
+E	[[:lower:]]+		`az{		(1,3)
+E	[[:upper:]]+		@AZ[		(1,3)
+BE	[[-]]			[[-]]		(2,4)
+BE	[[.NIL.]]	NULL	ECOLLATE
+BE	[[=aleph=]]	NULL	ECOLLATE
+}
+BE$	\n		\n	(0,1)
+BEn$	\n		\n	(0,1)
+BE$	[^a]		\n	(0,1)
+BE$	\na		\na	(0,2)
+E	(a)(b)(c)	abc	(0,3)(0,1)(1,2)(2,3)
+BE	xxx		xxx	(0,3)
+E1	(^|[ (,;])((([Ff]eb[^ ]* *|0*2/|\* */?)0*[6-7]))([^0-9]|$)	feb 6,	(0,6)
+E1	(^|[ (,;])((([Ff]eb[^ ]* *|0*2/|\* */?)0*[6-7]))([^0-9]|$)	2/7	(0,3)
+E1	(^|[ (,;])((([Ff]eb[^ ]* *|0*2/|\* */?)0*[6-7]))([^0-9]|$)	feb 1,Feb 6	(5,11)
+E3	((((((((((((((((((((((((((((((x))))))))))))))))))))))))))))))	x	(0,1)(0,1)(0,1)
+E3	((((((((((((((((((((((((((((((x))))))))))))))))))))))))))))))*	xx	(0,2)(1,2)(1,2)
+E	a?(ab|ba)*	ababababababababababababababababababababababababababababababababababababababababa	(0,81)(79,81)
+E	abaa|abbaa|abbbaa|abbbbaa	ababbabbbabbbabbbbabbbbaa	(18,25)
+E	abaa|abbaa|abbbaa|abbbbaa	ababbabbbabbbabbbbabaa	(18,22)
+E	aaac|aabc|abac|abbc|baac|babc|bbac|bbbc	baaabbbabac	(7,11)
+BE$	.*			\x01\xff	(0,2)
+E	aaaa|bbbb|cccc|ddddd|eeeeee|fffffff|gggg|hhhh|iiiii|jjjjj|kkkkk|llll		XaaaXbbbXcccXdddXeeeXfffXgggXhhhXiiiXjjjXkkkXlllXcbaXaaaa	(53,57)
+L	aaaa\nbbbb\ncccc\nddddd\neeeeee\nfffffff\ngggg\nhhhh\niiiii\njjjjj\nkkkkk\nllll		XaaaXbbbXcccXdddXeeeXfffXgggXhhhXiiiXjjjXkkkXlllXcbaXaaaa	NOMATCH
+E	a*a*a*a*a*b		aaaaaaaaab	(0,10)
+BE	^			NULL		(0,0)
+BE	$			NULL		(0,0)
+BE	^$			NULL		(0,0)
+BE	^a$			a		(0,1)
+BE	abc			abc		(0,3)
+BE	abc			xabcy		(1,4)
+BE	abc			ababc		(2,5)
+BE	ab*c			abc		(0,3)
+BE	ab*bc			abc		(0,3)
+BE	ab*bc			abbc		(0,4)
+BE	ab*bc			abbbbc		(0,6)
+E	ab+bc			abbc		(0,4)
+E	ab+bc			abbbbc		(0,6)
+E	ab?bc			abbc		(0,4)
+E	ab?bc			abc		(0,3)
+E	ab?c			abc		(0,3)
+BE	^abc$			abc		(0,3)
+BE	^abc			abcc		(0,3)
+BE	abc$			aabc		(1,4)
+BE	^			abc		(0,0)
+BE	$			abc		(3,3)
+BE	a.c			abc		(0,3)
+BE	a.c			axc		(0,3)
+BE	a.*c			axyzc		(0,5)
+BE	a[bc]d			abd		(0,3)
+BE	a[b-d]e			ace		(0,3)
+BE	a[b-d]			aac		(1,3)
+BE	a[-b]			a-		(0,2)
+BE	a[b-]			a-		(0,2)
+BE	a]			a]		(0,2)
+BE	a[]]b			a]b		(0,3)
+BE	a[^bc]d			aed		(0,3)
+BE	a[^-b]c			adc		(0,3)
+BE	a[^]b]c			adc		(0,3)
+E	ab|cd			abc		(0,2)
+E	ab|cd			abcd		(0,2)
+E	a\(b			a(b		(0,3)
+E	a\(*b			ab		(0,2)
+E	a\(*b			a((b		(0,4)
+E	((a))			abc		(0,1)(0,1)(0,1)
+E	(a)b(c)			abc		(0,3)(0,1)(2,3)
+E	a+b+c			aabbabc		(4,7)
+E	a*			aaa		(0,3)
+E	(a*)*			-		(0,0)(0,0)
+E	(a*)+			-		(0,0)(0,0)
+E	(a*|b)*			-		(0,0)(0,0)
+E	(a+|b)*			ab		(0,2)(1,2)
+E	(a+|b)+			ab		(0,2)(1,2)
+E	(a+|b)?			ab		(0,1)(0,1)
+BE	[^ab]*			cde		(0,3)
+E	(^)*			-		(0,0)(0,0)
+BE	a*			NULL		(0,0)
+E	([abc])*d		abbbcd		(0,6)(4,5)
+E	([abc])*bcd		abcd		(0,4)(0,1)
+E	a|b|c|d|e		e		(0,1)
+E	(a|b|c|d|e)f		ef		(0,2)(0,1)
+E	((a*|b))*		-		(0,0)(0,0)(0,0)
+BE	abcd*efg		abcdefg		(0,7)
+BE	ab*			xabyabbbz	(1,3)
+BE	ab*			xayabbbz	(1,2)
+E	(ab|cd)e		abcde		(2,5)(2,4)
+BE	[abhgefdc]ij		hij		(0,3)
+E	(a|b)c*d		abcd		(1,4)(1,2)
+E	(ab|ab*)bc		abc		(0,3)(0,1)
+E	a([bc]*)c*		abc		(0,3)(1,3)
+E	a([bc]*)(c*d)		abcd		(0,4)(1,3)(3,4)
+E	a([bc]+)(c*d)		abcd		(0,4)(1,3)(3,4)
+E	a([bc]*)(c+d)		abcd		(0,4)(1,2)(2,4)
+E	a[bcd]*dcdcde		adcdcde		(0,7)
+E	(ab|a)b*c		abc		(0,3)(0,2)
+E	((a)(b)c)(d)		abcd		(0,4)(0,3)(0,1)(1,2)(3,4)
+BE	[A-Za-z_][A-Za-z0-9_]*	alpha		(0,5)
+E	^a(bc+|b[eh])g|.h$	abh		(1,3)
+E	(bc+d$|ef*g.|h?i(j|k))	effgz		(0,5)(0,5)
+E	(bc+d$|ef*g.|h?i(j|k))	ij		(0,2)(0,2)(1,2)
+E	(bc+d$|ef*g.|h?i(j|k))	reffgz		(1,6)(1,6)
+E	(((((((((a)))))))))	a		(0,1)(0,1)(0,1)(0,1)(0,1)(0,1)(0,1)(0,1)(0,1)(0,1)
+BE	multiple words		multiple words yeah	(0,14)
+E	(.*)c(.*)		abcde		(0,5)(0,2)(3,5)
+BE	abcd			abcd		(0,4)
+E	a(bc)d			abcd		(0,4)(1,3)
+E	a[-]?c		ac		(0,3)
+E	M[ou]'?am+[ae]r .*([AEae]l[- ])?[GKQ]h?[aeu]+([dtz][dhz]?)+af[iy]	Muammar Qaddafi	(0,15)(?,?)(10,12)
+E	M[ou]'?am+[ae]r .*([AEae]l[- ])?[GKQ]h?[aeu]+([dtz][dhz]?)+af[iy]	Mo'ammar Gadhafi	(0,16)(?,?)(11,13)
+E	M[ou]'?am+[ae]r .*([AEae]l[- ])?[GKQ]h?[aeu]+([dtz][dhz]?)+af[iy]	Muammar Kaddafi	(0,15)(?,?)(10,12)
+E	M[ou]'?am+[ae]r .*([AEae]l[- ])?[GKQ]h?[aeu]+([dtz][dhz]?)+af[iy]	Muammar Qadhafi	(0,15)(?,?)(10,12)
+E	M[ou]'?am+[ae]r .*([AEae]l[- ])?[GKQ]h?[aeu]+([dtz][dhz]?)+af[iy]	Muammar Gadafi	(0,14)(?,?)(10,11)
+E	M[ou]'?am+[ae]r .*([AEae]l[- ])?[GKQ]h?[aeu]+([dtz][dhz]?)+af[iy]	Mu'ammar Qadafi	(0,15)(?,?)(11,12)
+E	M[ou]'?am+[ae]r .*([AEae]l[- ])?[GKQ]h?[aeu]+([dtz][dhz]?)+af[iy]	Moamar Gaddafi	(0,14)(?,?)(9,11)
+E	M[ou]'?am+[ae]r .*([AEae]l[- ])?[GKQ]h?[aeu]+([dtz][dhz]?)+af[iy]	Mu'ammar Qadhdhafi	(0,18)(?,?)(13,15)
+E	M[ou]'?am+[ae]r .*([AEae]l[- ])?[GKQ]h?[aeu]+([dtz][dhz]?)+af[iy]	Muammar Khaddafi	(0,16)(?,?)(11,13)
+E	M[ou]'?am+[ae]r .*([AEae]l[- ])?[GKQ]h?[aeu]+([dtz][dhz]?)+af[iy]	Muammar Ghaddafy	(0,16)(?,?)(11,13)
+E	M[ou]'?am+[ae]r .*([AEae]l[- ])?[GKQ]h?[aeu]+([dtz][dhz]?)+af[iy]	Muammar Ghadafi	(0,15)(?,?)(11,12)
+E	M[ou]'?am+[ae]r .*([AEae]l[- ])?[GKQ]h?[aeu]+([dtz][dhz]?)+af[iy]	Muammar Ghaddafi	(0,16)(?,?)(11,13)
+E	M[ou]'?am+[ae]r .*([AEae]l[- ])?[GKQ]h?[aeu]+([dtz][dhz]?)+af[iy]	Muamar Kaddafi	(0,14)(?,?)(9,11)
+E	M[ou]'?am+[ae]r .*([AEae]l[- ])?[GKQ]h?[aeu]+([dtz][dhz]?)+af[iy]	Muammar Quathafi	(0,16)(?,?)(11,13)
+E	M[ou]'?am+[ae]r .*([AEae]l[- ])?[GKQ]h?[aeu]+([dtz][dhz]?)+af[iy]	Muammar Gheddafi	(0,16)(?,?)(11,13)
+E	M[ou]'?am+[ae]r .*([AEae]l[- ])?[GKQ]h?[aeu]+([dtz][dhz]?)+af[iy]	Moammar Khadafy	(0,15)(?,?)(11,12)
+E	M[ou]'?am+[ae]r .*([AEae]l[- ])?[GKQ]h?[aeu]+([dtz][dhz]?)+af[iy]	Moammar Qudhafi	(0,15)(?,?)(10,12)
+E	a+(b|c)*d+		aabcdd			(0,6)(3,4)
+E	^.+$			vivi			(0,4)
+E	^(.+)$			vivi			(0,4)(0,4)
+E	^([^!.]+).att.com!(.+)$	gryphon.att.com!eby	(0,19)(0,7)(16,19)
+E	^([^!]+!)?([^!]+)$	bas			(0,3)(?,?)(0,3)
+E	^([^!]+!)?([^!]+)$	bar!bas			(0,7)(0,4)(4,7)
+E	^([^!]+!)?([^!]+)$	foo!bas			(0,7)(0,4)(4,7)
+E	^.+!([^!]+!)([^!]+)$	foo!bar!bas		(0,11)(4,8)(8,11)
+E	((foo)|(bar))!bas	bar!bas			(0,7)(0,3)(?,?)(0,3)
+E	((foo)|(bar))!bas	foo!bar!bas		(4,11)(4,7)(?,?)(4,7)
+E	((foo)|(bar))!bas	foo!bas			(0,7)(0,3)(0,3)
+E	((foo)|bar)!bas		bar!bas			(0,7)(0,3)
+E	((foo)|bar)!bas		foo!bar!bas		(4,11)(4,7)
+E	((foo)|bar)!bas		foo!bas			(0,7)(0,3)(0,3)
+E	(foo|(bar))!bas		bar!bas			(0,7)(0,3)(0,3)
+E	(foo|(bar))!bas		foo!bar!bas		(4,11)(4,7)(4,7)
+E	(foo|(bar))!bas		foo!bas			(0,7)(0,3)
+E	(foo|bar)!bas		bar!bas			(0,7)(0,3)
+E	(foo|bar)!bas		foo!bar!bas		(4,11)(4,7)
+E	(foo|bar)!bas		foo!bas			(0,7)(0,3)
+E	^(([^!]+!)?([^!]+)|.+!([^!]+!)([^!]+))$	foo!bar!bas	(0,11)(0,11)(?,?)(?,?)(4,8)(8,11)
+E	^([^!]+!)?([^!]+)$|^.+!([^!]+!)([^!]+)$	bas		(0,3)(?,?)(0,3)
+E	^([^!]+!)?([^!]+)$|^.+!([^!]+!)([^!]+)$	bar!bas		(0,7)(0,4)(4,7)
+E	^([^!]+!)?([^!]+)$|^.+!([^!]+!)([^!]+)$	foo!bar!bas	(0,11)(?,?)(?,?)(4,8)(8,11)
+E	^([^!]+!)?([^!]+)$|^.+!([^!]+!)([^!]+)$	foo!bas		(0,7)(0,4)(4,7)
+E	^(([^!]+!)?([^!]+)|.+!([^!]+!)([^!]+))$	bas		(0,3)(0,3)(?,?)(0,3)
+E	^(([^!]+!)?([^!]+)|.+!([^!]+!)([^!]+))$	bar!bas		(0,7)(0,7)(0,4)(4,7)
+E	^(([^!]+!)?([^!]+)|.+!([^!]+!)([^!]+))$	foo!bar!bas	(0,11)(0,11)(?,?)(?,?)(4,8)(8,11)
+E	^(([^!]+!)?([^!]+)|.+!([^!]+!)([^!]+))$	foo!bas		(0,7)(0,7)(0,4)(4,7)
+E	.*(/XXX).*			/XXX			(0,4)(0,4)
+E	.*(\\XXX).*			\XXX			(0,4)(0,4)
+E	\\XXX				\XXX			(0,4)
+E	.*(/000).*			/000			(0,4)(0,4)
+E	.*(\\000).*			\000			(0,4)(0,4)
+E	\\000				\000			(0,4)
diff --git a/ap/build/uClibc/test/regex/categorize.dat b/ap/build/uClibc/test/regex/categorize.dat
new file mode 100644
index 0000000..d348512
--- /dev/null
+++ b/ap/build/uClibc/test/regex/categorize.dat
@@ -0,0 +1,62 @@
+NOTE	regex implementation categorization 2004-05-31
+
+?E	aa*			xaxaax	(1,2)					POSITION=leftmost
+;										POSITION=bug
+
+?E	(a*)(ab)*(b*)		abc	(0,2)(0,1)(?,?)(1,2)			ASSOCIATIVITY=right
+|E	(a*)(ab)*(b*)		abc	(0,2)(0,0)(0,2)(2,2)			ASSOCIATIVITY=left
+;										ASSOCIATIVITY=bug
+
+?E	((a*)(ab)*)((b*)(a*))	aba	(0,3)(0,2)(0,0)(0,2)(2,3)(2,2)(2,3)	SUBEXPRESSION=precedence
+|E	((a*)(ab)*)((b*)(a*))	aba	(0,3)(0,1)(0,1)(?,?)(1,3)(1,2)(2,3)	SUBEXPRESSION=grouping
+;										SUBEXPRESSION=bug
+
+?E	(...?.?)*		xxxxxx	(0,6)(4,6)				REPEAT_LONGEST=first
+|E	(...?.?)*		xxxxxx	(0,6)(2,6)				REPEAT_LONGEST=last
+|E	(...?.?)*		xxxxxx	OK					REPEAT_LONGEST=unknown
+;										REPEAT_LONGEST=bug
+
+?E	(a|ab)(bc|c)		abcabc	(0,3)(0,2)(2,3)				EXPECTED
+|E	(a|ab)(bc|c)		abcabc	(0,3)(0,1)(1,3)				BUG=alternation-order
+;										BUG=alternation-order-UNKNOWN
+
+?E	(aba|a*b)(aba|a*b)	ababa	(0,5)(0,2)(2,5)				EXPECTED
+|E	(aba|a*b)(aba|a*b)	ababa	(0,4)(0,3)(3,4)				BUG=first-match
+;										BUG=unknown-match
+
+?B	a\(b\)*\1		a	NOMATCH					EXPECTED
+|B	a\(b\)*\1		a	(0,1)					BUG=nomatch-match
+|B	a\(b\)*\1		abab	(0,2)(1,2)				# BUG=repeat-any
+;										BUG=nomatch-match-UNKNOWN
+
+?E	(a*){2}			xxxxx	(0,0)(0,0)				EXPECTED
+|E	(a*){2}			xxxxx	(5,5)(5,5)				BUG=range-null
+;										BUG=range-null-UNKNOWN
+
+?B	a\(b\)*\1		abab	NOMATCH					EXPECTED
+|B	a\(b\)*\1		abab	(0,1)					# BUG=nomatch-match
+|B	a\(b\)*\1		abab	(0,2)(1,2)				BUG=repeat-any
+;										BUG=repeat-any-UNKNOWN
+
+?E	(a*)*			a	(0,1)(0,1)				EXPECTED
+|E	(a*)*			ax	(0,1)(0,1)				BUG=repeat-null-unknown
+|E	(a*)*			a	(0,1)(1,1)				BUG=repeat-null
+;										BUG=repeat-null-UNKNOWN
+
+?E	(aba|a*b)*		ababa	(0,5)(2,5)				EXPECTED
+|E	(aba|a*b)*		ababa	(0,5)(3,4)				BUG=repeat-short
+|E	(aba|a*b)*		ababa	(0,4)(3,4)				# LENGTH=first
+;										BUG=repeat-short-UNKNOWN
+
+?E	(a(b)?)+		aba	(0,3)(2,3)				EXPECTED
+|E	(a(b)?)+		aba	(0,3)(2,3)(1,2)				BUG=repeat-artifact
+;										BUG=repeat-artifact-UNKNOWN
+
+?B	\(a\(b\)*\)*\2		abab	NOMATCH					EXPECTED
+|B	\(a\(b\)*\)*\2		abab	(0,4)(2,3)(1,2)				BUG=repeat-artifact-nomatch
+;										BUG=repeat-artifact-nomatch-UNKNOWN
+
+?E	(a?)((ab)?)(b?)a?(ab)?b?	abab	(0,4)(0,1)(1,1)(?,?)(1,2)(2,4)	BUG=subexpression-first
+|E	.*(.*)				ab	(0,2)(2,2)			EXPECTED
+|E	.*(.*)				ab	(0,2)(0,2)			BUG=subexpression-first
+;										BUG=subexpression-first-UNKNOWN
diff --git a/ap/build/uClibc/test/regex/forcedassoc.dat b/ap/build/uClibc/test/regex/forcedassoc.dat
new file mode 100644
index 0000000..39f3111
--- /dev/null
+++ b/ap/build/uClibc/test/regex/forcedassoc.dat
@@ -0,0 +1,30 @@
+NOTE	left-assoc:pass-all right-assoc:pass-all : 2002-04-29
+
+E	(a|ab)(c|bcd)		abcd	(0,4)(0,1)(1,4)
+E	(a|ab)(bcd|c)		abcd	(0,4)(0,1)(1,4)
+E	(ab|a)(c|bcd)		abcd	(0,4)(0,1)(1,4)
+E	(ab|a)(bcd|c)		abcd	(0,4)(0,1)(1,4)
+E	((a|ab)(c|bcd))(d*)	abcd	(0,4)(0,4)(0,1)(1,4)(4,4)
+E	((a|ab)(bcd|c))(d*)	abcd	(0,4)(0,4)(0,1)(1,4)(4,4)
+E	((ab|a)(c|bcd))(d*)	abcd	(0,4)(0,4)(0,1)(1,4)(4,4)
+E	((ab|a)(bcd|c))(d*)	abcd	(0,4)(0,4)(0,1)(1,4)(4,4)
+E	(a|ab)((c|bcd)(d*))	abcd	(0,4)(0,2)(2,4)(2,3)(3,4)
+E	(a|ab)((bcd|c)(d*))	abcd	(0,4)(0,2)(2,4)(2,3)(3,4)
+E	(ab|a)((c|bcd)(d*))	abcd	(0,4)(0,2)(2,4)(2,3)(3,4)
+E	(ab|a)((bcd|c)(d*))	abcd	(0,4)(0,2)(2,4)(2,3)(3,4)
+E	(a*)(b|abc)		abc	(0,3)(0,0)(0,3)
+E	(a*)(abc|b)		abc	(0,3)(0,0)(0,3)
+E	((a*)(b|abc))(c*)	abc	(0,3)(0,3)(0,0)(0,3)(3,3)
+E	((a*)(abc|b))(c*)	abc	(0,3)(0,3)(0,0)(0,3)(3,3)
+E	(a*)((b|abc)(c*))	abc	(0,3)(0,1)(1,3)(1,2)(2,3)
+E	(a*)((abc|b)(c*))	abc	(0,3)(0,1)(1,3)(1,2)(2,3)
+E	(a*)(b|abc)		abc	(0,3)(0,0)(0,3)
+E	(a*)(abc|b)		abc	(0,3)(0,0)(0,3)
+E	((a*)(b|abc))(c*)	abc	(0,3)(0,3)(0,0)(0,3)(3,3)
+E	((a*)(abc|b))(c*)	abc	(0,3)(0,3)(0,0)(0,3)(3,3)
+E	(a*)((b|abc)(c*))	abc	(0,3)(0,1)(1,3)(1,2)(2,3)
+E	(a*)((abc|b)(c*))	abc	(0,3)(0,1)(1,3)(1,2)(2,3)
+E	(a|ab)			ab	(0,2)(0,2)
+E	(ab|a)			ab	(0,2)(0,2)
+E	(a|ab)(b*)		ab	(0,2)(0,2)(2,2)
+E	(ab|a)(b*)		ab	(0,2)(0,2)(2,2)
diff --git a/ap/build/uClibc/test/regex/interpretation.dat b/ap/build/uClibc/test/regex/interpretation.dat
new file mode 100644
index 0000000..72e186e
--- /dev/null
+++ b/ap/build/uClibc/test/regex/interpretation.dat
@@ -0,0 +1,93 @@
+:RE#01:E	a+			xaax	(1,3)
+:RE#02:B	.\(a*\).		xaax	(0,4)(1,3)
+:RE#03:E	(a?)((ab)?)		ab	(0,2)(0,0)(0,2)(0,2)
+:RE#04:E	(a?)((ab)?)(b?)		ab	(0,2)(0,1)(1,1)(?,?)(1,2)
+:RE#05:E	((a?)((ab)?))(b?)	ab	(0,2)(0,2)(0,0)(0,2)(0,2)(2,2)
+:RE#06:E	(a?)(((ab)?)(b?))	ab	(0,2)(0,1)(1,2)(1,1)(?,?)(1,2)
+:RE#07:E	(.?)			x	(0,1)(0,1)
+:RE#08:E	(.?){1}			x	(0,1)(0,1)
+:RE#09:E	(.?)(.?)		x	(0,1)(0,1)(1,1)
+:RE#10:E	(.?){2}			x	(0,1)(1,1)
+:RE#11:E	(.?)*			x	(0,1)(0,1)
+:RE#12:E	(.?.?)			xxx	(0,2)(0,2)
+:RE#13:E	(.?.?){1}		xxx	(0,2)(0,2)
+:RE#14:E	(.?.?)(.?.?)		xxx	(0,3)(0,2)(2,3)
+:RE#15:E	(.?.?){2}		xxx	(0,3)(2,3)
+:RE#16:E	(.?.?)(.?.?)(.?.?)	xxx	(0,3)(0,2)(2,3)(3,3)
+:RE#17:E	(.?.?){3}		xxx	(0,3)(3,3)
+:RE#18:E	(.?.?)*			xxx	(0,3)(2,3)
+:RE#19:E	a?((ab)?)(b?)		ab	(0,2)(1,1)(?,?)(1,2)
+:RE#20:E	(a?)((ab)?)b?		ab	(0,2)(0,1)(1,1)(?,?)
+:RE#21:E	a?((ab)?)b?		ab	(0,2)(1,1)(?,?)
+:RE#22:E	(a*){2}			xxxxx	(0,0)(0,0)
+:RE#23:E	(ab?)(b?a)		aba	(0,3)(0,2)(2,3)
+:RE#24:E	(a|ab)(ba|a)		aba	(0,3)(0,2)(2,3)
+:RE#25:E	(a|ab|ba)		aba	(0,2)(0,2)
+:RE#26:E	(a|ab|ba)(a|ab|ba)	aba	(0,3)(0,2)(2,3)
+:RE#27:E	(a|ab|ba)*		aba	(0,3)(2,3)
+:RE#28:E	(aba|a*b)		ababa	(0,3)(0,3)
+:RE#29:E	(aba|a*b)(aba|a*b)	ababa	(0,5)(0,2)(2,5)
+:RE#30:E	(aba|a*b)*		ababa	(0,5)(2,5)
+:RE#31:E	(aba|ab|a)		ababa	(0,3)(0,3)
+:RE#32:E	(aba|ab|a)(aba|ab|a)	ababa	(0,5)(0,2)(2,5)
+:RE#33:E	(aba|ab|a)*		ababa	(0,5)(2,5)
+:RE#34:E	(a(b)?)			aba	(0,2)(0,2)(1,2)
+:RE#35:E	(a(b)?)(a(b)?)		aba	(0,3)(0,2)(1,2)(2,3)(?,?)
+:RE#36:E	(a(b)?)+		aba	(0,3)(2,3)(?,?)
+:RE#37:E	(.*)(.*)		xx	(0,2)(0,2)(2,2)
+:RE#38:E	.*(.*)			xx	(0,2)(2,2)
+:RE#39:E	(a.*z|b.*y)		azbazby	(0,5)(0,5)
+:RE#40:E	(a.*z|b.*y)(a.*z|b.*y)	azbazby	(0,7)(0,5)(5,7)
+:RE#41:E	(a.*z|b.*y)*		azbazby	(0,7)(5,7)
+:RE#42:E	(.|..)(.*)		ab	(0,2)(0,2)(2,2)
+:RE#43:E	((..)*(...)*)			xxx		(0,3)(0,3)(?,?)(0,3)
+:RE#44:E	((..)*(...)*)((..)*(...)*)	xxx		(0,3)(0,3)(?,?)(0,3)(3,3)(?,?)
+:RE#45:E	((..)*(...)*)*			xxx		(0,3)(0,3)(?,?)(0,3)
+:RE#46:B	\(a\{0,1\}\)*b\1	ab	(0,2)(1,1)
+:RE#47:B	\(a*\)*b\1		ab	(0,2)(1,1)
+:RE#48:B	\(a*\)b\1*		ab	(0,2)(0,1)
+:RE#49:B	\(a*\)*b\1*		ab	(0,2)(1,1)
+:RE#50:B	\(a\{0,1\}\)*b\(\1\)	ab	(0,2)(1,1)(2,2)
+:RE#51:B	\(a*\)*b\(\1\)		ab	(0,2)(1,1)(2,2)
+:RE#52:B	\(a*\)b\(\1\)*		ab	(0,2)(0,1)(?,?)
+:RE#53:B	\(a*\)*b\(\1\)*		ab	(0,2)(1,1)(2,2)
+:RE#54:B	\(a\{0,1\}\)*b\1	aba	(0,3)(0,1)
+:RE#55:B	\(a*\)*b\1		aba	(0,3)(0,1)
+:RE#56:B	\(a*\)b\1*		aba	(0,3)(0,1)
+:RE#57:B	\(a*\)*b\1*		aba	(0,3)(0,1)
+:RE#58:B	\(a*\)*b\(\1\)*		aba	(0,3)(0,1)(2,3)
+:RE#59:B	\(a\{0,1\}\)*b\1	abaa	(0,3)(0,1)
+:RE#60:B	\(a*\)*b\1		abaa	(0,3)(0,1)
+:RE#61:B	\(a*\)b\1*		abaa	(0,4)(0,1)
+:RE#62:B	\(a*\)*b\1*		abaa	(0,4)(0,1)
+:RE#63:B	\(a*\)*b\(\1\)*		abaa	(0,4)(0,1)(3,4)
+:RE#64:B	\(a\{0,1\}\)*b\1	aab	(0,3)(2,2)
+:RE#65:B	\(a*\)*b\1		aab	(0,3)(2,2)
+:RE#66:B	\(a*\)b\1*		aab	(0,3)(0,2)
+:RE#67:B	\(a*\)*b\1*		aab	(0,3)(2,2)
+:RE#68:B	\(a*\)*b\(\1\)*		aab	(0,3)(2,2)(3,3)
+:RE#69:B	\(a\{0,1\}\)*b\1	aaba	(0,4)(1,2)
+:RE#70:B	\(a*\)*b\1		aaba	(0,4)(1,2)
+:RE#71:B	\(a*\)b\1*		aaba	(0,3)(0,2)
+:RE#72:B	\(a*\)*b\1*		aaba	(0,4)(1,2)
+:RE#73:B	\(a*\)*b\(\1\)*		aaba	(0,4)(1,2)(3,4)
+:RE#74:B	\(a\{0,1\}\)*b\1	aabaa	(0,4)(1,2)
+:RE#75:B	\(a*\)*b\1		aabaa	(0,5)(0,2)
+:RE#76:B	\(a*\)b\1*		aabaa	(0,5)(0,2)
+:RE#77:B	\(a*\)*b\1*		aabaa	(0,5)(0,2)
+:RE#78:B	\(a*\)*b\(\1\)*		aabaa	(0,5)(0,2)(3,5)
+:RE#79:B	\(x\)*a\1		a	NOMATCH
+:RE#80:B	\(x\)*a\1*		a	(0,1)(?,?)
+:RE#81:B	\(x\)*a\(\1\)		a	NOMATCH
+:RE#82:B	\(x\)*a\(\1\)*		a	(0,1)(?,?)(?,?)
+:RE#83:E	(aa(b(b))?)+		aabbaa	(0,6)(4,6)(?,?)(?,?)
+:RE#84:E	(a(b)?)+		aba	(0,3)(2,3)(?,?)
+:RE#85:E	([ab]+)([bc]+)([cd]*)		abcd		(0,4)(0,2)(2,3)(3,4)
+:RE#86:B	\([ab]*\)\([bc]*\)\([cd]*\)\1	abcdaa		(0,5)(0,1)(1,3)(3,4)
+:RE#87:B	\([ab]*\)\([bc]*\)\([cd]*\)\1	abcdab		(0,6)(0,2)(2,3)(3,4)
+:RE#88:B	\([ab]*\)\([bc]*\)\([cd]*\)\1*	abcdaa		(0,6)(0,1)(1,3)(3,4)
+:RE#89:B	\([ab]*\)\([bc]*\)\([cd]*\)\1*	abcdab		(0,6)(0,2)(2,3)(3,4)
+:RE#90:E	^(A([^B]*))?(B(.*))?		Aa		(0,2)(0,2)(1,2)
+:RE#91:E	^(A([^B]*))?(B(.*))?		Bb		(0,2)(?,?)(?,?)(0,2)(1,2)
+:RE#92:B	.*\([AB]\).*\1			ABA		(0,3)(0,1)
+:RE#93:B$	[^A]*A				\nA		(0,2)
diff --git a/ap/build/uClibc/test/regex/leftassoc.dat b/ap/build/uClibc/test/regex/leftassoc.dat
new file mode 100644
index 0000000..9c068c6
--- /dev/null
+++ b/ap/build/uClibc/test/regex/leftassoc.dat
@@ -0,0 +1,16 @@
+NOTE	left-assoc:pass-all right-assoc:pass-none : 2002-04-29
+
+E	(a|ab)(c|bcd)(d*)	abcd	(0,4)(0,1)(1,4)(4,4)
+E	(a|ab)(bcd|c)(d*)	abcd	(0,4)(0,1)(1,4)(4,4)
+E	(ab|a)(c|bcd)(d*)	abcd	(0,4)(0,1)(1,4)(4,4)
+E	(ab|a)(bcd|c)(d*)	abcd	(0,4)(0,1)(1,4)(4,4)
+
+E	(a*)(b|abc)(c*)		abc	(0,3)(0,0)(0,3)(3,3)
+E	(a*)(abc|b)(c*)		abc	(0,3)(0,0)(0,3)(3,3)
+E	(a*)(b|abc)(c*)		abc	(0,3)(0,0)(0,3)(3,3)
+E	(a*)(abc|b)(c*)		abc	(0,3)(0,0)(0,3)(3,3)
+
+E	(a|ab)(c|bcd)(d|.*)	abcd	(0,4)(0,1)(1,4)(4,4)
+E	(a|ab)(bcd|c)(d|.*)	abcd	(0,4)(0,1)(1,4)(4,4)
+E	(ab|a)(c|bcd)(d|.*)	abcd	(0,4)(0,1)(1,4)(4,4)
+E	(ab|a)(bcd|c)(d|.*)	abcd	(0,4)(0,1)(1,4)(4,4)
diff --git a/ap/build/uClibc/test/regex/nullsubexpr.dat b/ap/build/uClibc/test/regex/nullsubexpr.dat
new file mode 100644
index 0000000..c73d8f0
--- /dev/null
+++ b/ap/build/uClibc/test/regex/nullsubexpr.dat
@@ -0,0 +1,73 @@
+NOTE	null subexpression matches : 2002-06-06
+
+E	(a*)*		a		(0,1)(0,1)
+E	SAME		x		(0,0)(0,0)
+E	SAME		aaaaaa		(0,6)(0,6)
+E	SAME		aaaaaax		(0,6)(0,6)
+E	(a*)+		a		(0,1)(0,1)
+E	SAME		x		(0,0)(0,0)
+E	SAME		aaaaaa		(0,6)(0,6)
+E	SAME		aaaaaax		(0,6)(0,6)
+E	(a+)*		a		(0,1)(0,1)
+E	SAME		x		(0,0)
+E	SAME		aaaaaa		(0,6)(0,6)
+E	SAME		aaaaaax		(0,6)(0,6)
+E	(a+)+		a		(0,1)(0,1)
+E	SAME		x		NOMATCH
+E	SAME		aaaaaa		(0,6)(0,6)
+E	SAME		aaaaaax		(0,6)(0,6)
+
+E	([a]*)*		a		(0,1)(0,1)
+E	SAME		x		(0,0)(0,0)
+E	SAME		aaaaaa		(0,6)(0,6)
+E	SAME		aaaaaax		(0,6)(0,6)
+E	([a]*)+		a		(0,1)(0,1)
+E	SAME		x		(0,0)(0,0)
+E	SAME		aaaaaa		(0,6)(0,6)
+E	SAME		aaaaaax		(0,6)(0,6)
+E	([^b]*)*	a		(0,1)(0,1)
+E	SAME		b		(0,0)(0,0)
+E	SAME		aaaaaa		(0,6)(0,6)
+E	SAME		aaaaaab		(0,6)(0,6)
+E	([ab]*)*	a		(0,1)(0,1)
+E	SAME		aaaaaa		(0,6)(0,6)
+E	SAME		ababab		(0,6)(0,6)
+E	SAME		bababa		(0,6)(0,6)
+E	SAME		b		(0,1)(0,1)
+E	SAME		bbbbbb		(0,6)(0,6)
+E	SAME		aaaabcde	(0,5)(0,5)
+E	([^a]*)*	b		(0,1)(0,1)
+E	SAME		bbbbbb		(0,6)(0,6)
+E	SAME		aaaaaa		(0,0)(0,0)
+E	([^ab]*)*	ccccxx		(0,6)(0,6)
+E	SAME		ababab		(0,0)(0,0)
+
+E	((z)+|a)*	zabcde		(0,2)(1,2)
+
+{E	a+?		aaaaaa		(0,1)	no *? +? mimimal match ops
+E	(a)		aaa		(0,1)(0,1)
+E	(a*?)		aaa		(0,0)(0,0)
+E	(a)*?		aaa		(0,0)
+E	(a*?)*?		aaa		(0,0)
+}
+
+B	\(a*\)*\(x\)		x	(0,1)(0,0)(0,1)
+B	\(a*\)*\(x\)		ax	(0,2)(0,1)(1,2)
+B	\(a*\)*\(x\)		axa	(0,2)(0,1)(1,2)
+B	\(a*\)*\(x\)\(\1\)	x	(0,1)(0,0)(0,1)(1,1)
+B	\(a*\)*\(x\)\(\1\)	ax	(0,2)(1,1)(1,2)(2,2)
+B	\(a*\)*\(x\)\(\1\)	axa	(0,3)(0,1)(1,2)(2,3)
+B	\(a*\)*\(x\)\(\1\)\(x\)	axax	(0,4)(0,1)(1,2)(2,3)(3,4)
+B	\(a*\)*\(x\)\(\1\)\(x\)	axxa	(0,3)(1,1)(1,2)(2,2)(2,3)
+
+E	(a*)*(x)		x	(0,1)(0,0)(0,1)
+E	(a*)*(x)		ax	(0,2)(0,1)(1,2)
+E	(a*)*(x)		axa	(0,2)(0,1)(1,2)
+
+E	(a*)+(x)		x	(0,1)(0,0)(0,1)
+E	(a*)+(x)		ax	(0,2)(0,1)(1,2)
+E	(a*)+(x)		axa	(0,2)(0,1)(1,2)
+
+E	(a*){2}(x)		x	(0,1)(0,0)(0,1)
+E	(a*){2}(x)		ax	(0,2)(1,1)(1,2)
+E	(a*){2}(x)		axa	(0,2)(1,1)(1,2)
diff --git a/ap/build/uClibc/test/regex/repetition.dat b/ap/build/uClibc/test/regex/repetition.dat
new file mode 100644
index 0000000..b54a2c6
--- /dev/null
+++ b/ap/build/uClibc/test/regex/repetition.dat
@@ -0,0 +1,79 @@
+NOTE	implicit vs. explicit repetitions : 2002-08-01
+#
+# Glenn Fowler <gsf@research.att.com>
+# conforming matches (column 4) must match one of the following BREs
+#	NOMATCH
+#	(0,.)\((\(.\),\(.\))(?,?)(\2,\3)\)*
+#	(0,.)\((\(.\),\(.\))(\2,\3)(?,?)\)*
+# i.e., each 3-tuple has two identical elements and one (?,?)
+#
+
+E	((..)|(.))				NULL		NOMATCH
+E	((..)|(.))((..)|(.))			NULL		NOMATCH
+E	((..)|(.))((..)|(.))((..)|(.))		NULL		NOMATCH
+
+E	((..)|(.)){1}				NULL		NOMATCH
+E	((..)|(.)){2}				NULL		NOMATCH
+E	((..)|(.)){3}				NULL		NOMATCH
+
+E	((..)|(.))*				NULL		(0,0)
+
+E	((..)|(.))				a		(0,1)(0,1)(?,?)(0,1)
+E	((..)|(.))((..)|(.))			a		NOMATCH
+E	((..)|(.))((..)|(.))((..)|(.))		a		NOMATCH
+
+E	((..)|(.)){1}				a		(0,1)(0,1)(?,?)(0,1)
+E	((..)|(.)){2}				a		NOMATCH
+E	((..)|(.)){3}				a		NOMATCH
+
+E	((..)|(.))*				a		(0,1)(0,1)(?,?)(0,1)
+
+E	((..)|(.))				aa		(0,2)(0,2)(0,2)(?,?)
+E	((..)|(.))((..)|(.))			aa		(0,2)(0,1)(?,?)(0,1)(1,2)(?,?)(1,2)
+E	((..)|(.))((..)|(.))((..)|(.))		aa		NOMATCH
+
+E	((..)|(.)){1}				aa		(0,2)(0,2)(0,2)(?,?)
+E	((..)|(.)){2}				aa		(0,2)(1,2)(?,?)(1,2)
+E	((..)|(.)){3}				aa		NOMATCH
+
+E	((..)|(.))*				aa		(0,2)(0,2)(0,2)(?,?)
+
+E	((..)|(.))				aaa		(0,2)(0,2)(0,2)(?,?)
+E	((..)|(.))((..)|(.))			aaa		(0,3)(0,2)(0,2)(?,?)(2,3)(?,?)(2,3)
+E	((..)|(.))((..)|(.))((..)|(.))		aaa		(0,3)(0,1)(?,?)(0,1)(1,2)(?,?)(1,2)(2,3)(?,?)(2,3)
+
+E	((..)|(.)){1}				aaa		(0,2)(0,2)(0,2)(?,?)
+E	((..)|(.)){2}				aaa		(0,3)(2,3)(?,?)(2,3)
+E	((..)|(.)){3}				aaa		(0,3)(2,3)(?,?)(2,3)
+
+E	((..)|(.))*				aaa		(0,3)(2,3)(?,?)(2,3)
+
+E	((..)|(.))				aaaa		(0,2)(0,2)(0,2)(?,?)
+E	((..)|(.))((..)|(.))			aaaa		(0,4)(0,2)(0,2)(?,?)(2,4)(2,4)(?,?)
+E	((..)|(.))((..)|(.))((..)|(.))		aaaa		(0,4)(0,2)(0,2)(?,?)(2,3)(?,?)(2,3)(3,4)(?,?)(3,4)
+
+E	((..)|(.)){1}				aaaa		(0,2)(0,2)(0,2)(?,?)
+E	((..)|(.)){2}				aaaa		(0,4)(2,4)(2,4)(?,?)
+E	((..)|(.)){3}				aaaa		(0,4)(3,4)(?,?)(3,4)
+
+E	((..)|(.))*				aaaa		(0,4)(2,4)(2,4)(?,?)
+
+E	((..)|(.))				aaaaa		(0,2)(0,2)(0,2)(?,?)
+E	((..)|(.))((..)|(.))			aaaaa		(0,4)(0,2)(0,2)(?,?)(2,4)(2,4)(?,?)
+E	((..)|(.))((..)|(.))((..)|(.))		aaaaa		(0,5)(0,2)(0,2)(?,?)(2,4)(2,4)(?,?)(4,5)(?,?)(4,5)
+
+E	((..)|(.)){1}				aaaaa		(0,2)(0,2)(0,2)(?,?)
+E	((..)|(.)){2}				aaaaa		(0,4)(2,4)(2,4)(?,?)
+E	((..)|(.)){3}				aaaaa		(0,5)(4,5)(?,?)(4,5)
+
+E	((..)|(.))*				aaaaa		(0,5)(4,5)(?,?)(4,5)
+
+E	((..)|(.))				aaaaaa		(0,2)(0,2)(0,2)(?,?)
+E	((..)|(.))((..)|(.))			aaaaaa		(0,4)(0,2)(0,2)(?,?)(2,4)(2,4)(?,?)
+E	((..)|(.))((..)|(.))((..)|(.))		aaaaaa		(0,6)(0,2)(0,2)(?,?)(2,4)(2,4)(?,?)(4,6)(4,6)(?,?)
+
+E	((..)|(.)){1}				aaaaaa		(0,2)(0,2)(0,2)(?,?)
+E	((..)|(.)){2}				aaaaaa		(0,4)(2,4)(2,4)(?,?)
+E	((..)|(.)){3}				aaaaaa		(0,6)(4,6)(4,6)(?,?)
+
+E	((..)|(.))*				aaaaaa		(0,6)(4,6)(4,6)(?,?)
diff --git a/ap/build/uClibc/test/regex/rightassoc.dat b/ap/build/uClibc/test/regex/rightassoc.dat
new file mode 100644
index 0000000..ed7f28e
--- /dev/null
+++ b/ap/build/uClibc/test/regex/rightassoc.dat
@@ -0,0 +1,16 @@
+NOTE	left-assoc:pass-none right-assoc:pass-all : 2002-04-29
+
+E	(a|ab)(c|bcd)(d*)	abcd	(0,4)(0,2)(2,3)(3,4)
+E	(a|ab)(bcd|c)(d*)	abcd	(0,4)(0,2)(2,3)(3,4)
+E	(ab|a)(c|bcd)(d*)	abcd	(0,4)(0,2)(2,3)(3,4)
+E	(ab|a)(bcd|c)(d*)	abcd	(0,4)(0,2)(2,3)(3,4)
+
+E	(a*)(b|abc)(c*)		abc	(0,3)(0,1)(1,2)(2,3)
+E	(a*)(abc|b)(c*)		abc	(0,3)(0,1)(1,2)(2,3)
+E	(a*)(b|abc)(c*)		abc	(0,3)(0,1)(1,2)(2,3)
+E	(a*)(abc|b)(c*)		abc	(0,3)(0,1)(1,2)(2,3)
+
+E	(a|ab)(c|bcd)(d|.*)	abcd	(0,4)(0,2)(2,3)(3,4)
+E	(a|ab)(bcd|c)(d|.*)	abcd	(0,4)(0,2)(2,3)(3,4)
+E	(ab|a)(c|bcd)(d|.*)	abcd	(0,4)(0,2)(2,3)(3,4)
+E	(ab|a)(bcd|c)(d|.*)	abcd	(0,4)(0,2)(2,3)(3,4)
diff --git a/ap/build/uClibc/test/regex/testregex.c b/ap/build/uClibc/test/regex/testregex.c
new file mode 100644
index 0000000..993ac26
--- /dev/null
+++ b/ap/build/uClibc/test/regex/testregex.c
@@ -0,0 +1,2145 @@
+/*
+ * regex(3) test harness
+ *
+ * build:	cc -o testregex testregex.c
+ * help:	testregex --man
+ * note:	REG_* features are detected by #ifdef; if REG_* are enums
+ *		then supply #define REG_foo REG_foo for each enum REG_foo
+ *
+ *	Glenn Fowler <gsf@research.att.com>
+ *	AT&T Labs Research
+ *
+ * PLEASE: publish your tests so everyone can benefit
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of THIS SOFTWARE FILE (the "Software"), to deal in the Software
+ * without restriction, including without limitation the rights to use,
+ * copy, modify, merge, publish, distribute, and/or sell copies of the
+ * Software, and to permit persons to whom the Software is furnished to do
+ * so, subject to the following disclaimer:
+ *
+ * THIS SOFTWARE IS PROVIDED BY AT&T ``AS IS'' AND ANY EXPRESS OR IMPLIED
+ * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+ * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL AT&T BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+static const char id[] = "\n@(#)$Id: testregex (AT&T Research) 2005-05-20 $\0\n";
+
+#if _PACKAGE_ast
+#include <ast.h>
+#else
+#include <sys/types.h>
+#endif
+
+#include <stdio.h>
+#include <regex.h>
+#include <ctype.h>
+#include <setjmp.h>
+#include <signal.h>
+#include <string.h>
+#include <unistd.h>
+
+#ifdef	__STDC__
+#include <stdlib.h>
+#include <locale.h>
+#endif
+
+#if !_PACKAGE_ast
+#undef	REG_DISCIPLINE
+#endif
+
+#ifndef REG_DELIMITED
+#undef	_REG_subcomp
+#endif
+
+#define TEST_ARE		0x00000001
+#define TEST_BRE		0x00000002
+#define TEST_ERE		0x00000004
+#define TEST_KRE		0x00000008
+#define TEST_LRE		0x00000010
+#define TEST_SRE		0x00000020
+
+#define TEST_EXPAND		0x00000040
+#define TEST_LENIENT		0x00000080
+
+#define TEST_QUERY		0x00000100
+#define TEST_SUB		0x00000200
+#define TEST_UNSPECIFIED	0x00000400
+#define TEST_VERIFY		0x00000800
+#define TEST_AND		0x00001000
+#define TEST_OR			0x00002000
+
+#define TEST_DELIMIT		0x00010000
+#define TEST_OK			0x00020000
+#define TEST_SAME		0x00040000
+
+#define TEST_ACTUAL		0x00100000
+#define TEST_BASELINE		0x00200000
+#define TEST_FAIL		0x00400000
+#define TEST_PASS		0x00800000
+#define TEST_SUMMARY		0x01000000
+
+#define TEST_IGNORE_ERROR	0x02000000
+#define TEST_IGNORE_OVER	0x04000000
+#define TEST_IGNORE_POSITION	0x08000000
+
+#define TEST_CATCH		0x10000000
+#define TEST_VERBOSE		0x20000000
+
+#define TEST_GLOBAL		(TEST_ACTUAL|TEST_AND|TEST_BASELINE|TEST_CATCH|TEST_FAIL|TEST_IGNORE_ERROR|TEST_IGNORE_OVER|TEST_IGNORE_POSITION|TEST_OR|TEST_PASS|TEST_SUMMARY|TEST_VERBOSE)
+
+#ifdef REG_DISCIPLINE
+
+
+#include <stk.h>
+
+typedef struct Disc_s
+{
+	regdisc_t	disc;
+	int		ordinal;
+	Sfio_t*		sp;
+} Disc_t;
+
+static void*
+compf(const regex_t* re, const char* xstr, size_t xlen, regdisc_t* disc)
+{
+	Disc_t*		dp = (Disc_t*)disc;
+
+	return (void*)++dp->ordinal;
+}
+
+static int
+execf(const regex_t* re, void* data, const char* xstr, size_t xlen, const char* sstr, size_t slen, char** snxt, regdisc_t* disc)
+{
+	Disc_t*		dp = (Disc_t*)disc;
+
+	sfprintf(dp->sp, "{%-.*s}(%d:%d)", xlen, xstr, (int)data, slen);
+	return atoi(xstr);
+}
+
+static void*
+resizef(void* handle, void* data, size_t size)
+{
+	if (!size)
+		return 0;
+	return stkalloc((Sfio_t*)handle, size);
+}
+
+#endif
+
+#ifndef NiL
+#ifdef	__STDC__
+#define NiL		0
+#else
+#define NiL		(char*)0
+#endif
+#endif
+
+#define H(x)		do{if(html)fprintf(stderr,x);}while(0)
+#define T(x)		fprintf(stderr,x)
+
+static void
+help(int html)
+{
+H("<!DOCTYPE HTML PUBLIC \"-//IETF//DTD HTML//EN\">\n");
+H("<HTML>\n");
+H("<HEAD>\n");
+H("<TITLE>testregex man document</TITLE>\n");
+H("</HEAD>\n");
+H("<BODY bgcolor=white>\n");
+H("<PRE>\n");
+T("NAME\n");
+T("  testregex - regex(3) test harness\n");
+T("\n");
+T("SYNOPSIS\n");
+T("  testregex [ options ]\n");
+T("\n");
+T("DESCRIPTION\n");
+T("  testregex reads regex(3) test specifications, one per line, from the\n");
+T("  standard input and writes one output line for each failed test. A\n");
+T("  summary line is written after all tests are done. Each successful\n");
+T("  test is run again with REG_NOSUB. Unsupported features are noted\n");
+T("  before the first test, and tests requiring these features are\n");
+T("  silently ignored.\n");
+T("\n");
+T("OPTIONS\n");
+T("  -c	catch signals and non-terminating calls\n");
+T("  -e	ignore error return mismatches\n");
+T("  -h	list help on standard error\n");
+T("  -n	do not repeat successful tests with regnexec()\n");
+T("  -o	ignore match[] overrun errors\n");
+T("  -p	ignore negative position mismatches\n");
+T("  -s	use stack instead of malloc\n");
+T("  -x	do not repeat successful tests with REG_NOSUB\n");
+T("  -v	list each test line\n");
+T("  -A	list failed test lines with actual answers\n");
+T("  -B	list all test lines with actual answers\n");
+T("  -F	list failed test lines\n");
+T("  -P	list passed test lines\n");
+T("  -S	output one summary line\n");
+T("\n");
+T("INPUT FORMAT\n");
+T("  Input lines may be blank, a comment beginning with #, or a test\n");
+T("  specification. A specification is five fields separated by one\n");
+T("  or more tabs. NULL denotes the empty string and NIL denotes the\n");
+T("  0 pointer.\n");
+T("\n");
+T("  Field 1: the regex(3) flags to apply, one character per REG_feature\n");
+T("  flag. The test is skipped if REG_feature is not supported by the\n");
+T("  implementation. If the first character is not [BEASKL] then the\n");
+T("  specification is a global control line. One or more of [BEASKL] may be\n");
+T("  specified; the test will be repeated for each mode.\n");
+T("\n");
+T("    B 	basic			BRE	(grep, ed, sed)\n");
+T("    E 	REG_EXTENDED		ERE	(egrep)\n");
+T("    A	REG_AUGMENTED		ARE	(egrep with negation)\n");
+T("    S	REG_SHELL		SRE	(sh glob)\n");
+T("    K	REG_SHELL|REG_AUGMENTED	KRE	(ksh glob)\n");
+T("    L	REG_LITERAL		LRE	(fgrep)\n");
+T("\n");
+T("    a	REG_LEFT|REG_RIGHT	implicit ^...$\n");
+T("    b	REG_NOTBOL		lhs does not match ^\n");
+T("    c	REG_COMMENT		ignore space and #...\\n\n");
+T("    d	REG_SHELL_DOT		explicit leading . match\n");
+T("    e	REG_NOTEOL		rhs does not match $\n");
+T("    f	REG_MULTIPLE		multiple \\n separated patterns\n");
+T("    g	FNM_LEADING_DIR		testfnmatch only -- match until /\n");
+T("    h	REG_MULTIREF		multiple digit backref\n");
+T("    i	REG_ICASE		ignore case\n");
+T("    j	REG_SPAN		. matches \\n\n");
+T("    k	REG_ESCAPE		\\ to ecape [...] delimiter\n");
+T("    l	REG_LEFT		implicit ^...\n");
+T("    m	REG_MINIMAL		minimal match\n");
+T("    n	REG_NEWLINE		explicit \\n match\n");
+T("    o	REG_ENCLOSED		(|&) magic inside [@|&](...)\n");
+T("    p	REG_SHELL_PATH		explicit / match\n");
+T("    q	REG_DELIMITED		delimited pattern\n");
+T("    r	REG_RIGHT		implicit ...$\n");
+T("    s	REG_SHELL_ESCAPED	\\ not special\n");
+T("    t	REG_MUSTDELIM		all delimiters must be specified\n");
+T("    u	standard unspecified behavior -- errors not counted\n");
+T("    w	REG_NOSUB		no subexpression match array\n");
+T("    x	REG_LENIENT		let some errors slide\n");
+T("    y	REG_LEFT		regexec() implicit ^...\n");
+T("    z	REG_NULL		NULL subexpressions ok\n");
+T("    $	                        expand C \\c escapes in fields 2 and 3\n");
+T("    /	                        field 2 is a regsubcomp() expression\n");
+T("\n");
+T("  Field 1 control lines:\n");
+T("\n");
+T("    C		set LC_COLLATE and LC_CTYPE to locale in field 2\n");
+T("\n");
+T("    ?test ...	output field 5 if passed and != EXPECTED, silent otherwise\n");
+T("    &test ...	output field 5 if current and previous passed\n");
+T("    |test ...	output field 5 if current passed and previous failed\n");
+T("    ; ...	output field 2 if previous failed\n");
+T("    {test ...	skip if failed until }\n");
+T("    }		end of skip\n");
+T("\n");
+T("    : comment		comment copied as output NOTE\n");
+T("    :comment:test	:comment: ignored\n");
+T("    N[OTE] comment	comment copied as output NOTE\n");
+T("    T[EST] comment	comment\n");
+T("\n");
+T("    number		use number for nmatch (20 by default)\n");
+T("\n");
+T("  Field 2: the regular expression pattern; SAME uses the pattern from\n");
+T("    the previous specification.\n");
+T("\n");
+T("  Field 3: the string to match.\n");
+T("\n");
+T("  Field 4: the test outcome. This is either one of the posix error\n");
+T("    codes (with REG_ omitted) or the match array, a list of (m,n)\n");
+T("    entries with m and n being first and last+1 positions in the\n");
+T("    field 3 string, or NULL if REG_NOSUB is in effect and success\n");
+T("    is expected. BADPAT is acceptable in place of any regcomp(3)\n");
+T("    error code. The match[] array is initialized to (-2,-2) before\n");
+T("    each test. All array elements from 0 to nmatch-1 must be specified\n");
+T("    in the outcome. Unspecified endpoints (offset -1) are denoted by ?.\n");
+T("    Unset endpoints (offset -2) are denoted by X. {x}(o:n) denotes a\n");
+T("    matched (?{...}) expression, where x is the text enclosed by {...},\n");
+T("    o is the expression ordinal counting from 1, and n is the length of\n");
+T("    the unmatched portion of the subject string. If x starts with a\n");
+T("    number then that is the return value of re_execf(), otherwise 0 is\n");
+T("    returned.\n");
+T("\n");
+T("  Field 5: optional comment appended to the report.\n");
+T("\n");
+T("CAVEAT\n");
+T("    If a regex implementation misbehaves with memory then all bets are off.\n");
+T("\n");
+T("CONTRIBUTORS\n");
+T("  Glenn Fowler    gsf@research.att.com        (ksh strmatch, regex extensions)\n");
+T("  David Korn      dgk@research.att.com        (ksh glob matcher)\n");
+T("  Doug McIlroy    mcilroy@dartmouth.edu       (ast regex/testre in C++)\n");
+T("  Tom Lord        lord@regexps.com            (rx tests)\n");
+T("  Henry Spencer   henry@zoo.toronto.edu       (original public regex)\n");
+T("  Andrew Hume     andrew@research.att.com     (gre tests)\n");
+T("  John Maddock    John_Maddock@compuserve.com (regex++ tests)\n");
+T("  Philip Hazel    ph10@cam.ac.uk              (pcre tests)\n");
+T("  Ville Laurikari vl@iki.fi                   (libtre tests)\n");
+H("</PRE>\n");
+H("</BODY>\n");
+H("</HTML>\n");
+}
+
+#ifndef elementsof
+#define elementsof(x)	(sizeof(x)/sizeof(x[0]))
+#endif
+
+#ifndef streq
+#define streq(a,b)	(*(a)==*(b)&&!strcmp(a,b))
+#endif
+
+#define HUNG		5
+#define NOTEST		(~0)
+
+#ifndef REG_TEST_DEFAULT
+#define REG_TEST_DEFAULT	0
+#endif
+
+#ifndef REG_EXEC_DEFAULT
+#define REG_EXEC_DEFAULT	0
+#endif
+
+static const char* unsupported[] =
+{
+	"BASIC",
+#ifndef REG_EXTENDED
+	"EXTENDED",
+#endif
+#ifndef REG_AUGMENTED
+	"AUGMENTED",
+#endif
+#ifndef REG_SHELL
+	"SHELL",
+#endif
+
+#ifndef REG_COMMENT
+	"COMMENT",
+#endif
+#ifndef REG_DELIMITED
+	"DELIMITED",
+#endif
+#ifndef REG_DISCIPLINE
+	"DISCIPLINE",
+#endif
+#ifndef REG_ESCAPE
+	"ESCAPE",
+#endif
+#ifndef REG_ICASE
+	"ICASE",
+#endif
+#ifndef REG_LEFT
+	"LEFT",
+#endif
+#ifndef REG_LENIENT
+	"LENIENT",
+#endif
+#ifndef REG_LITERAL
+	"LITERAL",
+#endif
+#ifndef REG_MINIMAL
+	"MINIMAL",
+#endif
+#ifndef REG_MULTIPLE
+	"MULTIPLE",
+#endif
+#ifndef REG_MULTIREF
+	"MULTIREF",
+#endif
+#ifndef REG_MUSTDELIM
+	"MUSTDELIM",
+#endif
+#ifndef REG_NEWLINE
+	"NEWLINE",
+#endif
+#ifndef REG_NOTBOL
+	"NOTBOL",
+#endif
+#ifndef REG_NOTEOL
+	"NOTEOL",
+#endif
+#ifndef REG_NULL
+	"NULL",
+#endif
+#ifndef REG_RIGHT
+	"RIGHT",
+#endif
+#ifndef REG_SHELL_DOT
+	"SHELL_DOT",
+#endif
+#ifndef REG_SHELL_ESCAPED
+	"SHELL_ESCAPED",
+#endif
+#ifndef REG_SHELL_GROUP
+	"SHELL_GROUP",
+#endif
+#ifndef REG_SHELL_PATH
+	"SHELL_PATH",
+#endif
+#ifndef REG_SPAN
+	"SPAN",
+#endif
+#if REG_NOSUB & REG_TEST_DEFAULT
+	"SUBMATCH",
+#endif
+#if !_REG_nexec
+	"regnexec",
+#endif
+#if !_REG_subcomp
+	"regsubcomp",
+#endif
+	0
+};
+
+#ifndef REG_COMMENT
+#define REG_COMMENT	NOTEST
+#endif
+#ifndef REG_DELIMITED
+#define REG_DELIMITED	NOTEST
+#endif
+#ifndef REG_ESCAPE
+#define REG_ESCAPE	NOTEST
+#endif
+#ifndef REG_ICASE
+#define REG_ICASE	NOTEST
+#endif
+#ifndef REG_LEFT
+#define REG_LEFT	NOTEST
+#endif
+#ifndef REG_LENIENT
+#define REG_LENIENT	0
+#endif
+#ifndef REG_MINIMAL
+#define REG_MINIMAL	NOTEST
+#endif
+#ifndef REG_MULTIPLE
+#define REG_MULTIPLE	NOTEST
+#endif
+#ifndef REG_MULTIREF
+#define REG_MULTIREF	NOTEST
+#endif
+#ifndef REG_MUSTDELIM
+#define REG_MUSTDELIM	NOTEST
+#endif
+#ifndef REG_NEWLINE
+#define REG_NEWLINE	NOTEST
+#endif
+#ifndef REG_NOTBOL
+#define REG_NOTBOL	NOTEST
+#endif
+#ifndef REG_NOTEOL
+#define REG_NOTEOL	NOTEST
+#endif
+#ifndef REG_NULL
+#define REG_NULL	NOTEST
+#endif
+#ifndef REG_RIGHT
+#define REG_RIGHT	NOTEST
+#endif
+#ifndef REG_SHELL_DOT
+#define REG_SHELL_DOT	NOTEST
+#endif
+#ifndef REG_SHELL_ESCAPED
+#define REG_SHELL_ESCAPED	NOTEST
+#endif
+#ifndef REG_SHELL_GROUP
+#define REG_SHELL_GROUP	NOTEST
+#endif
+#ifndef REG_SHELL_PATH
+#define REG_SHELL_PATH	NOTEST
+#endif
+#ifndef REG_SPAN
+#define REG_SPAN	NOTEST
+#endif
+
+#define REG_UNKNOWN	(-1)
+
+#ifndef REG_ENEWLINE
+#define REG_ENEWLINE	(REG_UNKNOWN-1)
+#endif
+#ifndef REG_ENULL
+#ifndef REG_EMPTY
+#define REG_ENULL	(REG_UNKNOWN-2)
+#else
+#define REG_ENULL	REG_EMPTY
+#endif
+#endif
+#ifndef REG_ECOUNT
+#define REG_ECOUNT	(REG_UNKNOWN-3)
+#endif
+#ifndef REG_BADESC
+#define REG_BADESC	(REG_UNKNOWN-4)
+#endif
+#ifndef REG_EMEM
+#define REG_EMEM	(REG_UNKNOWN-5)
+#endif
+#ifndef REG_EHUNG
+#define REG_EHUNG	(REG_UNKNOWN-6)
+#endif
+#ifndef REG_EBUS
+#define REG_EBUS	(REG_UNKNOWN-7)
+#endif
+#ifndef REG_EFAULT
+#define REG_EFAULT	(REG_UNKNOWN-8)
+#endif
+#ifndef REG_EFLAGS
+#define REG_EFLAGS	(REG_UNKNOWN-9)
+#endif
+#ifndef REG_EDELIM
+#define REG_EDELIM	(REG_UNKNOWN-9)
+#endif
+
+static const struct { int code; char* name; } codes[] =
+{
+	{REG_UNKNOWN,	"UNKNOWN"},
+	{REG_NOMATCH,	"NOMATCH"},
+	{REG_BADPAT,	"BADPAT"},
+	{REG_ECOLLATE,	"ECOLLATE"},
+	{REG_ECTYPE,	"ECTYPE"},
+	{REG_EESCAPE,	"EESCAPE"},
+	{REG_ESUBREG,	"ESUBREG"},
+	{REG_EBRACK,	"EBRACK"},
+	{REG_EPAREN,	"EPAREN"},
+	{REG_EBRACE,	"EBRACE"},
+	{REG_BADBR,	"BADBR"},
+	{REG_ERANGE,	"ERANGE"},
+	{REG_ESPACE,	"ESPACE"},
+	{REG_BADRPT,	"BADRPT"},
+	{REG_ENEWLINE,	"ENEWLINE"},
+	{REG_ENULL,	"ENULL"},
+	{REG_ECOUNT,	"ECOUNT"},
+	{REG_BADESC,	"BADESC"},
+	{REG_EMEM,	"EMEM"},
+	{REG_EHUNG,	"EHUNG"},
+	{REG_EBUS,	"EBUS"},
+	{REG_EFAULT,	"EFAULT"},
+	{REG_EFLAGS,	"EFLAGS"},
+	{REG_EDELIM,	"EDELIM"},
+};
+
+static struct
+{
+	regmatch_t	NOMATCH;
+	int		errors;
+	int		extracted;
+	int		ignored;
+	int		lineno;
+	int		passed;
+	int		signals;
+	int		unspecified;
+	int		verify;
+	int		warnings;
+	char*		file;
+	char*		stack;
+	char*		which;
+	jmp_buf		gotcha;
+#ifdef REG_DISCIPLINE
+	Disc_t		disc;
+#endif
+} state;
+
+static void
+quote(char* s, int len, unsigned long test)
+{
+	unsigned char*	u = (unsigned char*)s;
+	unsigned char*	e;
+	int		c;
+
+	if (!u)
+		printf("NIL");
+	else if (!*u && len <= 1)
+		printf("NULL");
+	else if (test & TEST_EXPAND)
+	{
+		if (len < 0)
+			len = strlen((char*)u);
+		e = u + len;
+		if (test & TEST_DELIMIT)
+			printf("\"");
+		while (u < e)
+			switch (c = *u++)
+			{
+			case '\\':
+				printf("\\\\");
+				break;
+			case '"':
+				if (test & TEST_DELIMIT)
+					printf("\\\"");
+				else
+					printf("\"");
+				break;
+			case '\a':
+				printf("\\a");
+				break;
+			case '\b':
+				printf("\\b");
+				break;
+			case 033:
+				printf("\\e");
+				break;
+			case '\f':
+				printf("\\f");
+				break;
+			case '\n':
+				printf("\\n");
+				break;
+			case '\r':
+				printf("\\r");
+				break;
+			case '\t':
+				printf("\\t");
+				break;
+			case '\v':
+				printf("\\v");
+				break;
+			default:
+				if (!iscntrl(c) && isprint(c))
+					putchar(c);
+				else
+					printf("\\x%02x", c);
+				break;
+			}
+		if (test & TEST_DELIMIT)
+			printf("\"");
+	}
+	else
+		printf("%s", s);
+}
+
+static void
+report(char* comment, char* fun, char* re, char* s, int len, char* msg, int flags, unsigned long test)
+{
+	if (state.file)
+		printf("%s:", state.file);
+	printf("%d:", state.lineno);
+	if (re)
+	{
+		printf(" ");
+		quote(re, -1, test|TEST_DELIMIT);
+		if (s)
+		{
+			printf(" versus ");
+			quote(s, len, test|TEST_DELIMIT);
+		}
+	}
+	if (test & TEST_UNSPECIFIED)
+	{
+		state.unspecified++;
+		printf(" unspecified behavior");
+	}
+	else
+		state.errors++;
+	if (state.which)
+		printf(" %s", state.which);
+	if (flags & REG_NOSUB)
+		printf(" NOSUB");
+	if (fun)
+		printf(" %s", fun);
+	if (comment[strlen(comment)-1] == '\n')
+		printf(" %s", comment);
+	else
+	{
+		printf(" %s: ", comment);
+		if (msg)
+			printf("%s: ", msg);
+	}
+}
+
+static void
+error(regex_t* preg, int code)
+{
+	char*	msg;
+	char	buf[256];
+
+	switch (code)
+	{
+	case REG_EBUS:
+		msg = "bus error";
+		break;
+	case REG_EFAULT:
+		msg = "memory fault";
+		break;
+	case REG_EHUNG:
+		msg = "did not terminate";
+		break;
+	default:
+		regerror(code, preg, msg = buf, sizeof buf);
+		break;
+	}
+	printf("%s\n", msg);
+}
+
+static void
+bad(char* comment, char* re, char* s, int len, unsigned long test)
+{
+	printf("bad test case ");
+	report(comment, NiL, re, s, len, NiL, 0, test);
+	exit(1);
+}
+
+static int
+escape(char* s)
+{
+	char*	b;
+	char*	t;
+	char*	q;
+	char*	e;
+	int	c;
+
+	for (b = t = s; (*t = *s); s++, t++)
+		if (*s == '\\')
+			switch (*++s)
+			{
+			case '\\':
+				break;
+			case 'a':
+				*t = '\a';
+				break;
+			case 'b':
+				*t = '\b';
+				break;
+			case 'c':
+				if ((*t = *++s))
+					*t &= 037;
+				else
+					s--;
+				break;
+			case 'e':
+			case 'E':
+				*t = 033;
+				break;
+			case 'f':
+				*t = '\f';
+				break;
+			case 'n':
+				*t = '\n';
+				break;
+			case 'r':
+				*t = '\r';
+				break;
+			case 's':
+				*t = ' ';
+				break;
+			case 't':
+				*t = '\t';
+				break;
+			case 'v':
+				*t = '\v';
+				break;
+			case 'u':
+			case 'x':
+				c = 0;
+				q = c == 'u' ? (s + 5) : (char*)0;
+				e = s + 1;
+				while (!e || !q || s < q)
+				{
+					switch (*++s)
+					{
+					case 'a': case 'b': case 'c': case 'd': case 'e': case 'f':
+						c = (c << 4) + *s - 'a' + 10;
+						continue;
+					case 'A': case 'B': case 'C': case 'D': case 'E': case 'F':
+						c = (c << 4) + *s - 'A' + 10;
+						continue;
+					case '0': case '1': case '2': case '3': case '4':
+					case '5': case '6': case '7': case '8': case '9':
+						c = (c << 4) + *s - '0';
+						continue;
+					case '{':
+					case '[':
+						if (s != e)
+						{
+							s--;
+							break;
+						}
+						e = 0;
+						continue;
+					case '}':
+					case ']':
+						if (e)
+							s--;
+						break;
+					default:
+						s--;
+						break;
+					}
+					break;
+				}
+				*t = c;
+				break;
+			case '0': case '1': case '2': case '3':
+			case '4': case '5': case '6': case '7':
+				c = *s - '0';
+				q = s + 2;
+				while (s < q)
+				{
+					switch (*++s)
+					{
+					case '0': case '1': case '2': case '3':
+					case '4': case '5': case '6': case '7':
+						c = (c << 3) + *s - '0';
+						break;
+					default:
+						q = --s;
+						break;
+					}
+				}
+				*t = c;
+				break;
+			default:
+				*(s + 1) = 0;
+				bad("invalid C \\ escape\n", s - 1, NiL, 0, 0);
+			}
+	return t - b;
+}
+
+static void
+matchoffprint(int off)
+{
+	switch (off)
+	{
+	case -2:
+		printf("X");
+		break;
+	case -1:
+		printf("?");
+		break;
+	default:
+		printf("%d", off);
+		break;
+	}
+}
+
+static void
+matchprint(regmatch_t* match, int nmatch, int nsub, char* ans, unsigned long test)
+{
+	int	i;
+
+	for (; nmatch > nsub + 1; nmatch--)
+		if ((match[nmatch-1].rm_so != -1 || match[nmatch-1].rm_eo != -1) && (!(test & TEST_IGNORE_POSITION) || (match[nmatch-1].rm_so >= 0 && match[nmatch-1].rm_eo >= 0)))
+			break;
+	for (i = 0; i < nmatch; i++)
+	{
+		printf("(");
+		matchoffprint(match[i].rm_so);
+		printf(",");
+		matchoffprint(match[i].rm_eo);
+		printf(")");
+	}
+	if (!(test & (TEST_ACTUAL|TEST_BASELINE)))
+	{
+		if (ans)
+			printf(" expected: %s", ans);
+		printf("\n");
+	}
+}
+
+static int
+matchcheck(regmatch_t* match, int nmatch, int nsub, char* ans, char* re, char* s, int len, int flags, unsigned long test)
+{
+	char*	p;
+	int	i;
+	int	m;
+	int	n;
+
+	if (streq(ans, "OK"))
+		return test & (TEST_BASELINE|TEST_PASS|TEST_VERIFY);
+	for (i = 0, p = ans; i < nmatch && *p; i++)
+	{
+		if (*p == '{')
+		{
+#ifdef REG_DISCIPLINE
+			char*	x;
+
+			x = sfstruse(state.disc.sp);
+			if (strcmp(p, x))
+			{
+				if (test & (TEST_ACTUAL|TEST_BASELINE|TEST_FAIL|TEST_PASS|TEST_QUERY|TEST_SUMMARY|TEST_VERIFY))
+					return 0;
+				report("callout failed", NiL, re, s, len, NiL, flags, test);
+				quote(p, -1, test);
+				printf(" expected, ");
+				quote(x, -1, test);
+				printf(" returned\n");
+			}
+#endif
+			break;
+		}
+		if (*p++ != '(')
+			bad("improper answer\n", re, s, -1, test);
+		if (*p == '?')
+		{
+			m = -1;
+			p++;
+		}
+		else
+			m = strtol(p, &p, 10);
+		if (*p++ != ',')
+			bad("improper answer\n", re, s, -1, test);
+		if (*p == '?')
+		{
+			n = -1;
+			p++;
+		}
+		else
+			n = strtol(p, &p, 10);
+		if (*p++ != ')')
+			bad("improper answer\n", re, s, -1, test);
+		if (m!=match[i].rm_so || n!=match[i].rm_eo)
+		{
+			if (!(test & (TEST_ACTUAL|TEST_BASELINE|TEST_FAIL|TEST_PASS|TEST_QUERY|TEST_SUMMARY|TEST_VERIFY)))
+			{
+				report("failed: match was", NiL, re, s, len, NiL, flags, test);
+				matchprint(match, nmatch, nsub, ans, test);
+			}
+			return 0;
+		}
+	}
+	for (; i < nmatch; i++)
+	{
+		if (match[i].rm_so!=-1 || match[i].rm_eo!=-1)
+		{
+			if (!(test & (TEST_ACTUAL|TEST_BASELINE|TEST_FAIL|TEST_PASS|TEST_QUERY|TEST_VERIFY)))
+			{
+				if ((test & TEST_IGNORE_POSITION) && (match[i].rm_so<0 || match[i].rm_eo<0))
+				{
+					state.ignored++;
+					return 0;
+				}
+				if (!(test & TEST_SUMMARY))
+				{
+					report("failed: match was", NiL, re, s, len, NiL, flags, test);
+					matchprint(match, nmatch, nsub, ans, test);
+				}
+			}
+			return 0;
+		}
+	}
+	if (!(test & TEST_IGNORE_OVER) && match[nmatch].rm_so != state.NOMATCH.rm_so)
+	{
+		if (!(test & (TEST_ACTUAL|TEST_BASELINE|TEST_FAIL|TEST_PASS|TEST_QUERY|TEST_SUMMARY|TEST_VERIFY)))
+		{
+			report("failed: overran match array", NiL, re, s, len, NiL, flags, test);
+			matchprint(match, nmatch + 1, nsub, NiL, test);
+		}
+		return 0;
+	}
+	return 1;
+}
+
+static void
+sigunblock(int s)
+{
+#ifdef SIG_SETMASK
+	int		op;
+	sigset_t	mask;
+
+	sigemptyset(&mask);
+	if (s)
+	{
+		sigaddset(&mask, s);
+		op = SIG_UNBLOCK;
+	}
+	else op = SIG_SETMASK;
+	sigprocmask(op, &mask, NiL);
+#else
+#ifdef sigmask
+	sigsetmask(s ? (sigsetmask(0L) & ~sigmask(s)) : 0L);
+#endif
+#endif
+}
+
+static void
+gotcha(int sig)
+{
+	int	ret;
+
+	signal(sig, gotcha);
+	alarm(0);
+	state.signals++;
+	switch (sig)
+	{
+	case SIGALRM:
+		ret = REG_EHUNG;
+		break;
+	case SIGBUS:
+		ret = REG_EBUS;
+		break;
+	default:
+		ret = REG_EFAULT;
+		break;
+	}
+	sigunblock(sig);
+	longjmp(state.gotcha, ret);
+}
+
+static char*
+my_getline(FILE* fp)
+{
+	static char	buf[32 * 1024];
+
+	register char*	s = buf;
+	register char*	e = &buf[sizeof(buf)];
+	register char*	b;
+
+	for (;;)
+	{
+		if (!(b = fgets(s, e - s, fp)))
+			return 0;
+		state.lineno++;
+		s += strlen(s);
+		if (s == b || *--s != '\n' || s == b || *(s - 1) != '\\')
+		{
+			*s = 0;
+			break;
+		}
+		s--;
+	}
+	return buf;
+}
+
+static unsigned long
+note(unsigned long level, char* msg, unsigned long skip, unsigned long test)
+{
+	if (!(test & (TEST_ACTUAL|TEST_BASELINE|TEST_FAIL|TEST_PASS|TEST_SUMMARY)) && !skip)
+	{
+		printf("NOTE\t");
+		if (msg)
+			printf("%s: ", msg);
+		printf("skipping lines %d", state.lineno);
+	}
+	return skip | level;
+}
+
+#define TABS(n)		&ts[7-((n)&7)]
+
+static char		ts[] = "\t\t\t\t\t\t\t";
+
+static unsigned long
+extract(int* tabs, char* spec, char* re, char* s, char* ans, char* msg, char* accept, regmatch_t* match, int nmatch, int nsub, unsigned long skip, unsigned long level, unsigned long test)
+{
+	if (test & (TEST_ACTUAL|TEST_BASELINE|TEST_FAIL|TEST_OK|TEST_PASS|TEST_SUMMARY))
+	{
+		state.extracted = 1;
+		if (test & TEST_OK)
+		{
+			state.passed++;
+			if ((test & TEST_VERIFY) && !(test & (TEST_ACTUAL|TEST_BASELINE|TEST_FAIL|TEST_PASS|TEST_SUMMARY)))
+			{
+				if (msg && strcmp(msg, "EXPECTED"))
+					printf("NOTE\t%s\n", msg);
+				return skip;
+			}
+			test &= ~(TEST_PASS|TEST_QUERY);
+		}
+		if (test & (TEST_QUERY|TEST_VERIFY))
+		{
+			if (test & TEST_BASELINE)
+				test &= ~(TEST_BASELINE|TEST_PASS);
+			else
+				test |= TEST_PASS;
+			skip |= level;
+		}
+		if (!(test & TEST_OK))
+		{
+			if (test & TEST_UNSPECIFIED)
+				state.unspecified++;
+			else
+				state.errors++;
+		}
+		if (test & (TEST_PASS|TEST_SUMMARY))
+			return skip;
+		test &= ~TEST_DELIMIT;
+		printf("%s%s", spec, TABS(*tabs++));
+		if ((test & (TEST_BASELINE|TEST_SAME)) == (TEST_BASELINE|TEST_SAME))
+			printf("SAME");
+		else
+			quote(re, -1, test);
+		printf("%s", TABS(*tabs++));
+		quote(s, -1, test);
+		printf("%s", TABS(*tabs++));
+		if (!(test & (TEST_ACTUAL|TEST_BASELINE)) || (!accept && !match))
+			printf("%s", ans);
+		else if (accept)
+			printf("%s", accept);
+		else
+			matchprint(match, nmatch, nsub, NiL, test);
+		if (msg)
+			printf("%s%s", TABS(*tabs++), msg);
+		putchar('\n');
+	}
+	else if (test & TEST_QUERY)
+		skip = note(level, msg, skip, test);
+	else if (test & TEST_VERIFY)
+		state.extracted = 1;
+	return skip;
+}
+
+static int
+catchfree(regex_t* preg, int flags, int* tabs, char* spec, char* re, char* s, char* ans, char* msg, char* accept, regmatch_t* match, int nmatch, int nsub, unsigned long skip, unsigned long level, unsigned long test)
+{
+	int	eret;
+
+	if (!(test & TEST_CATCH))
+	{
+		regfree(preg);
+		eret = 0;
+	}
+	else if (!(eret = setjmp(state.gotcha)))
+	{
+		alarm(HUNG);
+		regfree(preg);
+		alarm(0);
+	}
+	else if (test & (TEST_ACTUAL|TEST_BASELINE|TEST_FAIL|TEST_PASS|TEST_QUERY|TEST_SUMMARY|TEST_VERIFY))
+		extract(tabs, spec, re, s, ans, msg, NiL, NiL, 0, 0, skip, level, test);
+	else
+	{
+		report("failed", "regfree", re, NiL, -1, msg, flags, test);
+		error(preg, eret);
+	}
+	return eret;
+}
+
+int
+old_main(int unused_param_argc, char** argv)
+{
+	int		flags;
+	int		cflags;
+	int		eflags;
+	int		nmatch;
+	int		nexec;
+	int		nstr;
+	int		cret;
+	int		eret;
+	int		nsub;
+	int		i;
+	int		j;
+	int		expected;
+	int		got;
+	int		locale;
+	int		subunitlen = 0;
+	int		testno;
+	unsigned long	level;
+	unsigned long	skip;
+	char*		p;
+	char*		line;
+	char*		spec;
+	char*		re;
+	char*		s;
+	char*		ans;
+	char*		msg;
+	char*		fun;
+	char*		ppat = NULL;
+	char*		subunit = NULL;
+	char*		version;
+	char*		field[6];
+	char*		delim[6];
+	FILE*		fp;
+	int		tabs[6];
+	char		unit[64];
+	regmatch_t	match[100];
+	regex_t		preg;
+
+	static char	pat[32 * 1024];
+
+	int		nonosub = REG_NOSUB == 0;
+	int		nonexec = 0;
+
+	unsigned long	test = 0;
+
+	static char*	filter[] = { "-", 0 };
+
+	state.NOMATCH.rm_so = state.NOMATCH.rm_eo = -2;
+	p = unit;
+	version = (char*)id + 10;
+	while (p < &unit[sizeof(unit)-1] && (*p = *version++) && !isspace(*p))
+		p++;
+	*p = 0;
+	while ((p = *++argv) && *p == '-')
+		for (;;)
+		{
+			switch (*++p)
+			{
+			case 0:
+				break;
+			case 'c':
+				test |= TEST_CATCH;
+				continue;
+			case 'e':
+				test |= TEST_IGNORE_ERROR;
+				continue;
+			case 'h':
+			case '?':
+				help(0);
+				return 2;
+			case '-':
+				help(p[1] == 'h');
+				return 2;
+			case 'n':
+				nonexec = 1;
+				continue;
+			case 'o':
+				test |= TEST_IGNORE_OVER;
+				continue;
+			case 'p':
+				test |= TEST_IGNORE_POSITION;
+				continue;
+			case 's':
+#ifdef REG_DISCIPLINE
+				if (!(state.stack = stkalloc(stkstd, 0)))
+					fprintf(stderr, "%s: out of space [stack]", unit);
+				state.disc.disc.re_resizef = resizef;
+				state.disc.disc.re_resizehandle = (void*)stkstd;
+#endif
+				continue;
+			case 'x':
+				nonosub = 1;
+				continue;
+			case 'v':
+				test |= TEST_VERBOSE;
+				continue;
+			case 'A':
+				test |= TEST_ACTUAL;
+				continue;
+			case 'B':
+				test |= TEST_BASELINE;
+				continue;
+			case 'F':
+				test |= TEST_FAIL;
+				continue;
+			case 'P':
+				test |= TEST_PASS;
+				continue;
+			case 'S':
+				test |= TEST_SUMMARY;
+				continue;
+			default:
+				fprintf(stderr, "%s: %c: invalid option\n", unit, *p);
+				return 2;
+			}
+			break;
+		}
+	if (!*argv)
+		argv = filter;
+	locale = 0;
+	while ((state.file = *argv++))
+	{
+		if (streq(state.file, "-") || streq(state.file, "/dev/stdin") || streq(state.file, "/dev/fd/0"))
+		{
+			state.file = 0;
+			fp = stdin;
+		}
+		else if (!(fp = fopen(state.file, "r")))
+		{
+			fprintf(stderr, "%s: %s: cannot read\n", unit, state.file);
+			return 2;
+		}
+		testno = state.errors = state.ignored = state.lineno = state.passed =
+		state.signals = state.unspecified = state.warnings = 0;
+		skip = 0;
+		level = 1;
+		if (!(test & (TEST_ACTUAL|TEST_BASELINE|TEST_FAIL|TEST_PASS|TEST_SUMMARY)))
+		{
+			printf("TEST\t%s ", unit);
+			if ((s = state.file))
+			{
+				subunit = p = 0;
+				for (;;)
+				{
+					switch (*s++)
+					{
+					case 0:
+						break;
+					case '/':
+						subunit = s;
+						continue;
+					case '.':
+						p = s - 1;
+						continue;
+					default:
+						continue;
+					}
+					break;
+				}
+				if (!subunit)
+					subunit = state.file;
+				if (p < subunit)
+					p = s - 1;
+				subunitlen = p - subunit;
+				printf("%-.*s ", subunitlen, subunit);
+			}
+			else
+				subunit = 0;
+			for (s = version; *s && (*s != ' ' || *(s + 1) != '$'); s++)
+				putchar(*s);
+			if (test & TEST_CATCH)
+				printf(", catch");
+			if (test & TEST_IGNORE_ERROR)
+				printf(", ignore error code mismatches");
+			if (test & TEST_IGNORE_POSITION)
+				printf(", ignore negative position mismatches");
+#ifdef REG_DISCIPLINE
+			if (state.stack)
+				printf(", stack");
+#endif
+			if (test & TEST_VERBOSE)
+				printf(", verbose");
+			printf("\n");
+#ifdef REG_VERSIONID
+			if (regerror(REG_VERSIONID, NiL, pat, sizeof(pat)) > 0)
+				s = pat;
+			else
+#endif
+#ifdef REG_TEST_VERSION
+			s = REG_TEST_VERSION;
+#else
+			s = "regex";
+#endif
+			printf("NOTE\t%s\n", s);
+			if (elementsof(unsupported) > 1)
+			{
+#if (REG_TEST_DEFAULT & (REG_AUGMENTED|REG_EXTENDED|REG_SHELL)) || !defined(REG_EXTENDED)
+				i = 0;
+#else
+				i = REG_EXTENDED != 0;
+#endif
+				for (got = 0; i < elementsof(unsupported) - 1; i++)
+				{
+					if (!got)
+					{
+						got = 1;
+						printf("NOTE\tunsupported: %s", unsupported[i]);
+					}
+					else
+						printf(",%s", unsupported[i]);
+				}
+				if (got)
+					printf("\n");
+			}
+		}
+#ifdef REG_DISCIPLINE
+		state.disc.disc.re_version = REG_VERSION;
+		state.disc.disc.re_compf = compf;
+		state.disc.disc.re_execf = execf;
+		if (!(state.disc.sp = sfstropen()))
+			bad("out of space [discipline string stream]\n", NiL, NiL, 0, 0);
+		preg.re_disc = &state.disc.disc;
+#endif
+		if (test & TEST_CATCH)
+		{
+			signal(SIGALRM, gotcha);
+			signal(SIGBUS, gotcha);
+			signal(SIGSEGV, gotcha);
+		}
+		while ((p = my_getline(fp)))
+		{
+
+		/* parse: */
+
+			line = p;
+			if (*p == ':' && !isspace(*(p + 1)))
+			{
+				while (*++p && *p != ':');
+				if (!*p++)
+				{
+					if (test & TEST_BASELINE)
+						printf("%s\n", line);
+					continue;
+				}
+			}
+			while (isspace(*p))
+				p++;
+			if (*p == 0 || *p == '#' || *p == 'T')
+			{
+				if (test & TEST_BASELINE)
+					printf("%s\n", line);
+				continue;
+			}
+			if (*p == ':' || *p == 'N')
+			{
+				if (test & TEST_BASELINE)
+					printf("%s\n", line);
+				else if (!(test & (TEST_ACTUAL|TEST_FAIL|TEST_PASS|TEST_SUMMARY)))
+				{
+					while (*++p && !isspace(*p));
+					while (isspace(*p))
+						p++;
+					printf("NOTE	%s\n", p);
+				}
+				continue;
+			}
+			j = 0;
+			i = 0;
+			field[i++] = p;
+			for (;;)
+			{
+				switch (*p++)
+				{
+				case 0:
+					p--;
+					j = 0;
+					goto checkfield;
+				case '\t':
+					*(delim[i] = p - 1) = 0;
+					j = 1;
+				checkfield:
+					s = field[i - 1];
+					if (streq(s, "NIL"))
+						field[i - 1] = 0;
+					else if (streq(s, "NULL"))
+						*s = 0;
+					while (*p == '\t')
+					{
+						p++;
+						j++;
+					}
+					tabs[i - 1] = j;
+					if (!*p)
+						break;
+					if (i >= elementsof(field))
+						bad("too many fields\n", NiL, NiL, 0, 0);
+					field[i++] = p;
+					/*FALLTHROUGH*/
+				default:
+					continue;
+				}
+				break;
+			}
+			if (!(spec = field[0]))
+				bad("NIL spec\n", NiL, NiL, 0, 0);
+
+		/* interpret: */
+
+			cflags = REG_TEST_DEFAULT;
+			eflags = REG_EXEC_DEFAULT;
+			test &= TEST_GLOBAL;
+			state.extracted = 0;
+			nmatch = 20;
+			nsub = -1;
+			for (p = spec; *p; p++)
+			{
+				if (isdigit(*p))
+				{
+					nmatch = strtol(p, &p, 10);
+					if (nmatch >= elementsof(match))
+						bad("nmatch must be < 100\n", NiL, NiL, 0, 0);
+					p--;
+					continue;
+				}
+				switch (*p)
+				{
+				case 'A':
+					test |= TEST_ARE;
+					continue;
+				case 'B':
+					test |= TEST_BRE;
+					continue;
+				case 'C':
+					if (!(test & TEST_QUERY) && !(skip & level))
+						bad("locale must be nested\n", NiL, NiL, 0, 0);
+					test &= ~TEST_QUERY;
+					if (locale)
+						bad("locale nesting not supported\n", NiL, NiL, 0, 0);
+					if (i != 2)
+						bad("locale field expected\n", NiL, NiL, 0, 0);
+					if (!(skip & level))
+					{
+#if defined(LC_COLLATE) && defined(LC_CTYPE)
+						s = field[1];
+						if (!s || streq(s, "POSIX"))
+							s = "C";
+						if (!(ans = setlocale(LC_COLLATE, s)) || streq(ans, "C") || streq(ans, "POSIX") || !(ans = setlocale(LC_CTYPE, s)) || streq(ans, "C") || streq(ans, "POSIX"))
+							skip = note(level, s, skip, test);
+						else
+						{
+							if (!(test & (TEST_ACTUAL|TEST_BASELINE|TEST_FAIL|TEST_PASS|TEST_SUMMARY)))
+								printf("NOTE	\"%s\" locale\n", s);
+							locale = level;
+						}
+#else
+						skip = note(level, skip, test, "locales not supported");
+#endif
+					}
+					cflags = NOTEST;
+					continue;
+				case 'E':
+					test |= TEST_ERE;
+					continue;
+				case 'K':
+					test |= TEST_KRE;
+					continue;
+				case 'L':
+					test |= TEST_LRE;
+					continue;
+				case 'S':
+					test |= TEST_SRE;
+					continue;
+
+				case 'a':
+					cflags |= REG_LEFT|REG_RIGHT;
+					continue;
+				case 'b':
+					eflags |= REG_NOTBOL;
+					continue;
+				case 'c':
+					cflags |= REG_COMMENT;
+					continue;
+				case 'd':
+					cflags |= REG_SHELL_DOT;
+					continue;
+				case 'e':
+					eflags |= REG_NOTEOL;
+					continue;
+				case 'f':
+					cflags |= REG_MULTIPLE;
+					continue;
+				case 'g':
+					cflags |= NOTEST;
+					continue;
+				case 'h':
+					cflags |= REG_MULTIREF;
+					continue;
+				case 'i':
+					cflags |= REG_ICASE;
+					continue;
+				case 'j':
+					cflags |= REG_SPAN;
+					continue;
+				case 'k':
+					cflags |= REG_ESCAPE;
+					continue;
+				case 'l':
+					cflags |= REG_LEFT;
+					continue;
+				case 'm':
+					cflags |= REG_MINIMAL;
+					continue;
+				case 'n':
+					cflags |= REG_NEWLINE;
+					continue;
+				case 'o':
+					cflags |= REG_SHELL_GROUP;
+					continue;
+				case 'p':
+					cflags |= REG_SHELL_PATH;
+					continue;
+				case 'q':
+					cflags |= REG_DELIMITED;
+					continue;
+				case 'r':
+					cflags |= REG_RIGHT;
+					continue;
+				case 's':
+					cflags |= REG_SHELL_ESCAPED;
+					continue;
+				case 't':
+					cflags |= REG_MUSTDELIM;
+					continue;
+				case 'u':
+					test |= TEST_UNSPECIFIED;
+					continue;
+				case 'w':
+					cflags |= REG_NOSUB;
+					continue;
+				case 'x':
+					if (REG_LENIENT)
+						cflags |= REG_LENIENT;
+					else
+						test |= TEST_LENIENT;
+					continue;
+				case 'y':
+					eflags |= REG_LEFT;
+					continue;
+				case 'z':
+					cflags |= REG_NULL;
+					continue;
+
+				case '$':
+					test |= TEST_EXPAND;
+					continue;
+
+				case '/':
+					test |= TEST_SUB;
+					continue;
+
+				case '?':
+					test |= TEST_VERIFY;
+					test &= ~(TEST_AND|TEST_OR);
+					state.verify = state.passed;
+					continue;
+				case '&':
+					test |= TEST_VERIFY|TEST_AND;
+					test &= ~TEST_OR;
+					continue;
+				case '|':
+					test |= TEST_VERIFY|TEST_OR;
+					test &= ~TEST_AND;
+					continue;
+				case ';':
+					test |= TEST_OR;
+					test &= ~TEST_AND;
+					continue;
+
+				case '{':
+					level <<= 1;
+					if (skip & (level >> 1))
+					{
+						skip |= level;
+						cflags = NOTEST;
+					}
+					else
+					{
+						skip &= ~level;
+						test |= TEST_QUERY;
+					}
+					continue;
+				case '}':
+					if (level == 1)
+						bad("invalid {...} nesting\n", NiL, NiL, 0, 0);
+					if ((skip & level) && !(skip & (level>>1)))
+					{
+						if (!(test & (TEST_BASELINE|TEST_SUMMARY)))
+						{
+							if (test & (TEST_ACTUAL|TEST_FAIL))
+								printf("}\n");
+							else if (!(test & TEST_PASS))
+								printf("-%d\n", state.lineno);
+						}
+					}
+#if defined(LC_COLLATE) && defined(LC_CTYPE)
+					else if (locale & level)
+					{
+						locale = 0;
+						if (!(skip & level))
+						{
+							s = "C";
+							setlocale(LC_COLLATE, s);
+							setlocale(LC_CTYPE, s);
+							if (!(test & (TEST_ACTUAL|TEST_BASELINE|TEST_FAIL|TEST_PASS|TEST_SUMMARY)))
+								printf("NOTE	\"%s\" locale\n", s);
+							else if (test & (TEST_ACTUAL|TEST_BASELINE|TEST_PASS))
+								printf("}\n");
+						}
+						else if (test & (TEST_ACTUAL|TEST_BASELINE|TEST_FAIL))
+							printf("}\n");
+					}
+#endif
+					level >>= 1;
+					cflags = NOTEST;
+					continue;
+
+				default:
+					bad("bad spec\n", spec, NiL, 0, test);
+					break;
+
+				}
+				break;
+			}
+			if ((cflags|eflags) == NOTEST || ((skip & level) && (test & TEST_BASELINE)))
+			{
+				if (test & TEST_BASELINE)
+				{
+					while (i > 1)
+						*delim[--i] = '\t';
+					printf("%s\n", line);
+				}
+				continue;
+			}
+			if (test & TEST_OR)
+			{
+				if (!(test & TEST_VERIFY))
+				{
+					test &= ~TEST_OR;
+					if (state.passed == state.verify && i > 1)
+						printf("NOTE\t%s\n", field[1]);
+					continue;
+				}
+				else if (state.passed > state.verify)
+					continue;
+			}
+			else if (test & TEST_AND)
+			{
+				if (state.passed == state.verify)
+					continue;
+				state.passed = state.verify;
+			}
+			if (i < 4)
+				bad("too few fields\n", NiL, NiL, 0, test);
+			while (i < elementsof(field))
+				field[i++] = 0;
+			if ((re = field[1]))
+			{
+				if (streq(re, "SAME"))
+				{
+					re = ppat;
+					test |= TEST_SAME;
+				}
+				else
+				{
+					if (test & TEST_EXPAND)
+						escape(re);
+					strcpy(ppat = pat, re);
+				}
+			}
+			else
+				ppat = 0;
+			nstr = -1;
+			if ((s = field[2]) && (test & TEST_EXPAND))
+			{
+				nstr = escape(s);
+#if _REG_nexec
+				if (nstr != strlen(s))
+					nexec = nstr;
+#endif
+			}
+			if (!(ans = field[3]))
+				bad("NIL answer\n", NiL, NiL, 0, test);
+			msg = field[4];
+			fflush(stdout);
+			if (test & TEST_SUB)
+#if _REG_subcomp
+				cflags |= REG_DELIMITED;
+#else
+				continue;
+#endif
+
+		compile:
+
+			if (state.extracted || (skip & level))
+				continue;
+#if !(REG_TEST_DEFAULT & (REG_AUGMENTED|REG_EXTENDED|REG_SHELL))
+#ifdef REG_EXTENDED
+			if (REG_EXTENDED != 0 && (test & TEST_BRE))
+#else
+			if (test & TEST_BRE)
+#endif
+			{
+				test &= ~TEST_BRE;
+				flags = cflags;
+				state.which = "BRE";
+			}
+			else
+#endif
+#ifdef REG_EXTENDED
+			if (test & TEST_ERE)
+			{
+				test &= ~TEST_ERE;
+				flags = cflags | REG_EXTENDED;
+				state.which = "ERE";
+			}
+			else
+#endif
+#ifdef REG_AUGMENTED
+			if (test & TEST_ARE)
+			{
+				test &= ~TEST_ARE;
+				flags = cflags | REG_AUGMENTED;
+				state.which = "ARE";
+			}
+			else
+#endif
+#ifdef REG_LITERAL
+			if (test & TEST_LRE)
+			{
+				test &= ~TEST_LRE;
+				flags = cflags | REG_LITERAL;
+				state.which = "LRE";
+			}
+			else
+#endif
+#ifdef REG_SHELL
+			if (test & TEST_SRE)
+			{
+				test &= ~TEST_SRE;
+				flags = cflags | REG_SHELL;
+				state.which = "SRE";
+			}
+			else
+#ifdef REG_AUGMENTED
+			if (test & TEST_KRE)
+			{
+				test &= ~TEST_KRE;
+				flags = cflags | REG_SHELL | REG_AUGMENTED;
+				state.which = "KRE";
+			}
+			else
+#endif
+#endif
+			{
+				if (test & (TEST_BASELINE|TEST_PASS|TEST_VERIFY))
+					extract(tabs, line, re, s, ans, msg, NiL, NiL, 0, 0, skip, level, test|TEST_OK);
+				continue;
+			}
+			if ((test & (TEST_QUERY|TEST_VERBOSE|TEST_VERIFY)) == TEST_VERBOSE)
+			{
+				printf("test %-3d %s ", state.lineno, state.which);
+				quote(re, -1, test|TEST_DELIMIT);
+				printf(" ");
+				quote(s, nstr, test|TEST_DELIMIT);
+				printf("\n");
+			}
+
+		nosub:
+			fun = "regcomp";
+#if _REG_nexec
+			if (nstr >= 0 && nstr != strlen(s))
+				nexec = nstr;
+
+			else
+#endif
+				nexec = -1;
+			if (state.extracted || (skip & level))
+				continue;
+			if (!(test & TEST_QUERY))
+				testno++;
+#ifdef REG_DISCIPLINE
+			if (state.stack)
+				stkset(stkstd, state.stack, 0);
+			flags |= REG_DISCIPLINE;
+			state.disc.ordinal = 0;
+			sfstrseek(state.disc.sp, 0, SEEK_SET);
+#endif
+			if (!(test & TEST_CATCH))
+				cret = regcomp(&preg, re, flags);
+			else if (!(cret = setjmp(state.gotcha)))
+			{
+				alarm(HUNG);
+				cret = regcomp(&preg, re, flags);
+				alarm(0);
+			}
+#if _REG_subcomp
+			if (!cret && (test & TEST_SUB))
+			{
+				fun = "regsubcomp";
+				p = re + preg.re_npat;
+				if (!(test & TEST_CATCH))
+					cret = regsubcomp(&preg, p, NiL, 0, 0);
+				else if (!(cret = setjmp(state.gotcha)))
+				{
+					alarm(HUNG);
+					cret = regsubcomp(&preg, p, NiL, 0, 0);
+					alarm(0);
+				}
+				if (!cret && *(p += preg.re_npat) && !(preg.re_sub->re_flags & REG_SUB_LAST))
+				{
+					if (catchfree(&preg, flags, tabs, line, re, s, ans, msg, NiL, NiL, 0, 0, skip, level, test))
+						continue;
+					cret = REG_EFLAGS;
+				}
+			}
+#endif
+			if (!cret)
+			{
+				if (!(flags & REG_NOSUB) && nsub < 0 && *ans == '(')
+				{
+					for (p = ans; *p; p++)
+						if (*p == '(')
+							nsub++;
+						else if (*p == '{')
+							nsub--;
+					if (nsub >= 0)
+					{
+						if (test & TEST_IGNORE_OVER)
+						{
+							if (nmatch > nsub)
+								nmatch = nsub + 1;
+						}
+						else if (nsub != preg.re_nsub)
+						{
+							if (nsub > preg.re_nsub)
+							{
+								if (test & (TEST_ACTUAL|TEST_BASELINE|TEST_FAIL|TEST_PASS|TEST_QUERY|TEST_SUMMARY|TEST_VERIFY))
+									skip = extract(tabs, line, re, s, ans, msg, "OK", NiL, 0, 0, skip, level, test|TEST_DELIMIT);
+								else
+								{
+									report("re_nsub incorrect", fun, re, NiL, -1, msg, flags, test);
+									printf("at least %d expected, %zd returned\n", nsub, preg.re_nsub);
+									state.errors++;
+								}
+							}
+							else
+								nsub = preg.re_nsub;
+						}
+					}
+				}
+				if (!(test & TEST_SUB) && *ans && *ans != '(' && !streq(ans, "OK") && !streq(ans, "NOMATCH"))
+				{
+					if (test & (TEST_ACTUAL|TEST_BASELINE|TEST_FAIL|TEST_PASS|TEST_QUERY|TEST_SUMMARY|TEST_VERIFY))
+						skip = extract(tabs, line, re, s, ans, msg, "OK", NiL, 0, 0, skip, level, test|TEST_DELIMIT);
+					else if (!(test & TEST_LENIENT))
+					{
+						report("failed", fun, re, NiL, -1, msg, flags, test);
+						printf("%s expected, OK returned\n", ans);
+					}
+					catchfree(&preg, flags, tabs, line, re, s, ans, msg, NiL, NiL, 0, 0, skip, level, test);
+					continue;
+				}
+			}
+			else
+			{
+				if (test & TEST_LENIENT)
+					/* we'll let it go this time */;
+				else if (!*ans || ans[0]=='(' || (cret == REG_BADPAT && streq(ans, "NOMATCH")))
+				{
+					got = 0;
+					for (i = 1; i < elementsof(codes); i++)
+						if (cret==codes[i].code)
+							got = i;
+					if (test & (TEST_ACTUAL|TEST_BASELINE|TEST_FAIL|TEST_PASS|TEST_QUERY|TEST_SUMMARY|TEST_VERIFY))
+						skip = extract(tabs, line, re, s, ans, msg, codes[got].name, NiL, 0, 0, skip, level, test|TEST_DELIMIT);
+					else
+					{
+						report("failed", fun, re, NiL, -1, msg, flags, test);
+						printf("%s returned: ", codes[got].name);
+						error(&preg, cret);
+					}
+				}
+				else
+				{
+					expected = got = 0;
+					for (i = 1; i < elementsof(codes); i++)
+					{
+						if (streq(ans, codes[i].name))
+							expected = i;
+						if (cret==codes[i].code)
+							got = i;
+					}
+					if (!expected)
+					{
+						if (test & (TEST_ACTUAL|TEST_BASELINE|TEST_FAIL|TEST_PASS|TEST_QUERY|TEST_SUMMARY|TEST_VERIFY))
+							skip = extract(tabs, line, re, s, ans, msg, codes[got].name, NiL, 0, 0, skip, level, test|TEST_DELIMIT);
+						else
+						{
+							report("failed: invalid error code", NiL, re, NiL, -1, msg, flags, test);
+							printf("%s expected, %s returned\n", ans, codes[got].name);
+						}
+					}
+					else if (cret != codes[expected].code && cret != REG_BADPAT)
+					{
+						if (test & (TEST_ACTUAL|TEST_BASELINE|TEST_FAIL|TEST_PASS|TEST_QUERY|TEST_SUMMARY|TEST_VERIFY))
+							skip = extract(tabs, line, re, s, ans, msg, codes[got].name, NiL, 0, 0, skip, level, test|TEST_DELIMIT);
+						else if (test & TEST_IGNORE_ERROR)
+							state.ignored++;
+						else
+						{
+							report("should fail and did", fun, re, NiL, -1, msg, flags, test);
+							printf("%s expected, %s returned: ", ans, codes[got].name);
+							state.errors--;
+							state.warnings++;
+							error(&preg, cret);
+						}
+					}
+				}
+				goto compile;
+			}
+
+#if _REG_nexec
+		execute:
+			if (nexec >= 0)
+				fun = "regnexec";
+			else
+#endif
+				fun = "regexec";
+
+			for (i = 0; i < elementsof(match); i++)
+				match[i] = state.NOMATCH;
+
+#if _REG_nexec
+			if (nexec >= 0)
+			{
+				eret = regnexec(&preg, s, nexec, nmatch, match, eflags);
+				s[nexec] = 0;
+			}
+			else
+#endif
+			{
+				if (!(test & TEST_CATCH))
+					eret = regexec(&preg, s, nmatch, match, eflags);
+				else if (!(eret = setjmp(state.gotcha)))
+				{
+					alarm(HUNG);
+					eret = regexec(&preg, s, nmatch, match, eflags);
+					alarm(0);
+				}
+			}
+#if _REG_subcomp
+			if ((test & TEST_SUB) && !eret)
+			{
+				fun = "regsubexec";
+				if (!(test & TEST_CATCH))
+					eret = regsubexec(&preg, s, nmatch, match);
+				else if (!(eret = setjmp(state.gotcha)))
+				{
+					alarm(HUNG);
+					eret = regsubexec(&preg, s, nmatch, match);
+					alarm(0);
+				}
+			}
+#endif
+			if (flags & REG_NOSUB)
+			{
+				if (eret)
+				{
+					if (eret != REG_NOMATCH || !streq(ans, "NOMATCH"))
+					{
+						if (test & (TEST_ACTUAL|TEST_BASELINE|TEST_FAIL|TEST_PASS|TEST_QUERY|TEST_SUMMARY|TEST_VERIFY))
+							skip = extract(tabs, line, re, s, ans, msg, "NOMATCH", NiL, 0, 0, skip, level, test|TEST_DELIMIT);
+						else
+						{
+							report("REG_NOSUB failed", fun, re, s, nstr, msg, flags, test);
+							error(&preg, eret);
+						}
+					}
+				}
+				else if (streq(ans, "NOMATCH"))
+				{
+					if (test & (TEST_ACTUAL|TEST_BASELINE|TEST_FAIL|TEST_PASS|TEST_QUERY|TEST_SUMMARY|TEST_VERIFY))
+						skip = extract(tabs, line, re, s, ans, msg, NiL, match, nmatch, nsub, skip, level, test|TEST_DELIMIT);
+					else
+					{
+						report("should fail and didn't", fun, re, s, nstr, msg, flags, test);
+						error(&preg, eret);
+					}
+				}
+			}
+			else if (eret)
+			{
+				if (eret != REG_NOMATCH || !streq(ans, "NOMATCH"))
+				{
+					if (test & (TEST_ACTUAL|TEST_BASELINE|TEST_FAIL|TEST_PASS|TEST_QUERY|TEST_SUMMARY|TEST_VERIFY))
+						skip = extract(tabs, line, re, s, ans, msg, "NOMATCH", NiL, 0, nsub, skip, level, test|TEST_DELIMIT);
+					else
+					{
+						report("failed", fun, re, s, nstr, msg, flags, test);
+						if (eret != REG_NOMATCH)
+							error(&preg, eret);
+						else if (*ans)
+							printf("expected: %s\n", ans);
+						else
+							printf("\n");
+					}
+				}
+			}
+			else if (streq(ans, "NOMATCH"))
+			{
+				if (test & (TEST_ACTUAL|TEST_BASELINE|TEST_FAIL|TEST_PASS|TEST_QUERY|TEST_SUMMARY|TEST_VERIFY))
+					skip = extract(tabs, line, re, s, ans, msg, NiL, match, nmatch, nsub, skip, level, test|TEST_DELIMIT);
+				else
+				{
+					report("should fail and didn't", fun, re, s, nstr, msg, flags, test);
+					matchprint(match, nmatch, nsub, NiL, test);
+				}
+			}
+#if _REG_subcomp
+			else if (test & TEST_SUB)
+			{
+				p = preg.re_sub->re_buf;
+				if (strcmp(p, ans))
+				{
+					report("failed", fun, re, s, nstr, msg, flags, test);
+					quote(ans, -1, test|TEST_DELIMIT);
+					printf(" expected, ");
+					quote(p, -1, test|TEST_DELIMIT);
+					printf(" returned\n");
+				}
+			}
+#endif
+			else if (!*ans)
+			{
+				if (match[0].rm_so != state.NOMATCH.rm_so)
+				{
+					if (test & (TEST_ACTUAL|TEST_BASELINE|TEST_FAIL|TEST_PASS|TEST_QUERY|TEST_SUMMARY|TEST_VERIFY))
+						skip = extract(tabs, line, re, s, ans, msg, NiL, NiL, 0, 0, skip, level, test);
+					else
+					{
+						report("failed: no match but match array assigned", NiL, re, s, nstr, msg, flags, test);
+						matchprint(match, nmatch, nsub, NiL, test);
+					}
+				}
+			}
+			else if (matchcheck(match, nmatch, nsub, ans, re, s, nstr, flags, test))
+			{
+#if _REG_nexec
+				if (nexec < 0 && !nonexec)
+				{
+					nexec = nstr >= 0 ? nstr : strlen(s);
+					s[nexec] = '\n';
+					testno++;
+					goto execute;
+				}
+#endif
+				if (!(test & (TEST_SUB|TEST_VERIFY)) && !nonosub)
+				{
+					if (catchfree(&preg, flags, tabs, line, re, s, ans, msg, NiL, NiL, 0, 0, skip, level, test))
+						continue;
+					flags |= REG_NOSUB;
+					goto nosub;
+				}
+				if (test & (TEST_BASELINE|TEST_PASS|TEST_VERIFY))
+					skip = extract(tabs, line, re, s, ans, msg, NiL, match, nmatch, nsub, skip, level, test|TEST_OK);
+			}
+			else if (test & (TEST_ACTUAL|TEST_BASELINE|TEST_FAIL|TEST_PASS|TEST_QUERY|TEST_SUMMARY|TEST_VERIFY))
+				skip = extract(tabs, line, re, s, ans, msg, NiL, match, nmatch, nsub, skip, level, test|TEST_DELIMIT);
+			if (catchfree(&preg, flags, tabs, line, re, s, ans, msg, NiL, NiL, 0, 0, skip, level, test))
+				continue;
+			goto compile;
+		}
+		if (test & TEST_SUMMARY)
+			printf("tests=%-4d errors=%-4d warnings=%-2d ignored=%-2d unspecified=%-2d signals=%d\n", testno, state.errors, state.warnings, state.ignored, state.unspecified, state.signals);
+		else if (!(test & (TEST_ACTUAL|TEST_BASELINE|TEST_FAIL|TEST_PASS)))
+		{
+			printf("TEST\t%s", unit);
+			if (subunit)
+				printf(" %-.*s", subunitlen, subunit);
+			printf(", %d test%s", testno, testno == 1 ? "" : "s");
+			if (state.ignored)
+				printf(", %d ignored mismatch%s", state.ignored, state.ignored == 1 ? "" : "es");
+			if (state.warnings)
+				printf(", %d warning%s", state.warnings, state.warnings == 1 ? "" : "s");
+			if (state.unspecified)
+				printf(", %d unspecified difference%s", state.unspecified, state.unspecified == 1 ? "" : "s");
+			if (state.signals)
+				printf(", %d signal%s", state.signals, state.signals == 1 ? "" : "s");
+			printf(", %d error%s\n", state.errors, state.errors == 1 ? "" : "s");
+		}
+		if (fp != stdin)
+			fclose(fp);
+	}
+	return 0;
+}
+
+int main(int argc, char **argv)
+{
+	static char *param[][4] = {
+		{ NULL,       "basic.dat"         , NULL },
+		{ NULL,       "categorize.dat"    , NULL },
+		{ NULL,       "forcedassoc.dat"   , NULL },
+		{ NULL, "-c", "interpretation.dat", NULL },
+		{ NULL,       "leftassoc.dat"     , NULL },
+		{ NULL, "-c", "nullsubexpr.dat"   , NULL },
+		{ NULL,       "repetition.dat"    , NULL },
+		{ NULL,       "rightassoc.dat"    , NULL },
+	};
+	int r, i;
+
+	if (argv[1])
+		return old_main(argc, argv);
+
+	r = 0;
+	for (i = 0; i < sizeof(param) / sizeof(param[0]); i++) {
+		param[i][0] = argv[0];
+		printf("Testing %s\n", param[i][1][0] != '-' ? param[i][1] : param[i][2]);
+		r |= old_main(3 /* not used */, param[i]);
+	}
+	return r;
+}
diff --git a/ap/build/uClibc/test/regex/tst-regex2.c b/ap/build/uClibc/test/regex/tst-regex2.c
new file mode 100644
index 0000000..2e3260a
--- /dev/null
+++ b/ap/build/uClibc/test/regex/tst-regex2.c
@@ -0,0 +1,250 @@
+#define _GNU_SOURCE 1
+
+#include <fcntl.h>
+#include <locale.h>
+#include <regex.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <sys/stat.h>
+#include <sys/time.h>
+#include <time.h>
+#include <unistd.h>
+#include <errno.h>
+
+static int
+do_test(void)
+{
+	static const char *pat[] = {
+		".?.?.?.?.?.?.?Log\\.13",
+		"(.?)(.?)(.?)(.?)(.?)(.?)(.?)Log\\.13",
+		"((((((((((.?))))))))))((((((((((.?))))))))))((((((((((.?))))))))))"
+		"((((((((((.?))))))))))((((((((((.?))))))))))((((((((((.?))))))))))"
+		"((((((((((.?))))))))))Log\\.13"
+	};
+	char *buf, *string;
+	const char *fname = "tst-regex2.dat";
+	struct stat st;
+	unsigned len;
+	int testno;
+	int exitcode = 0;
+
+	int fd = open(fname, O_RDONLY);
+	if (fd < 0) {
+		printf("Couldn't open %s: %s\n", fname, strerror(errno));
+		return 1;
+	}
+	if (fstat(fd, &st) < 0) {
+		printf("Couldn't fstat %s: %s\n", fname, strerror(errno));
+		return 1;
+	}
+	len = st.st_size;
+	string = buf = malloc(len + 1);
+	if (buf == NULL) {
+		printf("Couldn't allocate %u bytes\n", len + 1);
+		return 1;
+	}
+	if (read(fd, buf, st.st_size) != (ssize_t) st.st_size) {
+		printf("Couldn't read %s\n", fname);
+		return 1;
+	}
+
+	close(fd);
+	buf[len] = '\0';
+
+#if defined __UCLIBC_HAS_XLOCALE__ || !defined __UCLIBC__
+	setlocale(LC_ALL, "de_DE.UTF-8");
+#endif
+
+	for (testno = 0; testno < 2; ++testno) {
+		int i;
+		for (i = 0; i < sizeof(pat) / sizeof(pat[0]); ++i) {
+			struct timeval start, stop;
+			regex_t rbuf;
+			int err;
+
+			printf("test %d pattern %d '%s'\n", testno, i, pat[i]);
+			gettimeofday(&start, NULL);
+
+			err = regcomp(&rbuf, pat[i],
+				REG_EXTENDED | (testno ? REG_NOSUB : 0));
+			if (err != 0) {
+				char errstr[300];
+				regerror(err, &rbuf, errstr, sizeof(errstr));
+				puts(errstr);
+				exitcode = 1;
+				goto contin1;
+			}
+
+			regmatch_t pmatch[71];
+			err = regexec(&rbuf, string, 71, pmatch, 0);
+			if (err == REG_NOMATCH) {
+				puts("regexec failed");
+				exitcode = 1;
+				goto contin1;
+			}
+
+			if (testno == 0) {
+				if (pmatch[0].rm_eo != pmatch[0].rm_so + 13
+				 || pmatch[0].rm_eo > len
+				 || pmatch[0].rm_so < len - 100
+				 || strncmp(string + pmatch[0].rm_so,
+					" ChangeLog.13 for earlier changes",
+					sizeof " ChangeLog.13 for earlier changes" - 1
+				    ) != 0
+				) {
+					puts("regexec without REG_NOSUB did not find the correct match");
+					exitcode = 1;
+					goto contin1;
+				}
+
+				if (i > 0) {
+					int j, k, l;
+					for (j = 0, l = 1; j < 7; ++j) {
+						for (k = 0; k < (i == 1 ? 1 : 10); ++k, ++l) {
+							if (pmatch[l].rm_so != pmatch[0].rm_so + j
+							|| pmatch[l].rm_eo != pmatch[l].rm_so + 1
+							) {
+								printf("pmatch[%d] incorrect\n", l);
+								exitcode = 1;
+								goto contin1;
+							}
+						}
+					}
+				}
+			}
+
+			gettimeofday(&stop, NULL);
+			stop.tv_sec -= start.tv_sec;
+			if (stop.tv_usec < start.tv_usec) {
+				stop.tv_sec--;
+				stop.tv_usec += 1000000;
+			}
+			stop.tv_usec -= start.tv_usec;
+			printf(" %lu.%06lus\n", (unsigned long) stop.tv_sec,
+						(unsigned long) stop.tv_usec);
+ contin1:
+			regfree(&rbuf);
+		}
+	}
+
+	for (testno = 2; testno < 4; ++testno) {
+		int i;
+		for (i = 0; i < sizeof(pat) / sizeof(pat[0]); ++i) {
+			struct timeval start, stop;
+			struct re_pattern_buffer rpbuf;
+			struct re_registers regs;
+			const char *s;
+			int match;
+
+			printf("test %d pattern %d '%s'\n", testno, i, pat[i]);
+			gettimeofday(&start, NULL);
+
+			re_set_syntax(RE_SYNTAX_POSIX_EGREP
+				| (testno == 3 ? RE_NO_SUB : 0));
+			memset(&rpbuf, 0, sizeof(rpbuf));
+			s = re_compile_pattern(pat[i], strlen(pat[i]), &rpbuf);
+			if (s != NULL) {
+				printf("%s\n", s);
+				exitcode = 1;
+				goto contin2;
+			}
+
+			memset(&regs, 0, sizeof(regs));
+			match = re_search(&rpbuf, string, len, 0, len, &regs);
+			if (match < 0) {
+				printf("re_search failed (err:%d)\n", match);
+				exitcode = 1;
+				goto contin2;
+			}
+			if (match + 13 > len) {
+				printf("re_search: match+13 > len (%d > %d)\n", match + 13, len);
+				exitcode = 1;
+				goto contin2;
+			}
+			if (match < len - 100) {
+				printf("re_search: match < len-100 (%d < %d)\n", match, len - 100);
+				exitcode = 1;
+				goto contin2;
+			}
+			if (strncmp(string + match, " ChangeLog.13 for earlier changes",
+				sizeof(" ChangeLog.13 for earlier changes") - 1
+			    ) != 0
+			) {
+				printf("re_search did not find the correct match"
+					"(found '%s' instead)\n", string + match);
+				exitcode = 1;
+				goto contin2;
+			}
+
+			if (testno == 2) {
+				int expected = 72;
+				if (i == 0)
+					expected = 2;
+				if (i == 1)
+					expected = 9;
+				if (regs.num_regs != expected) {
+					printf("incorrect num_regs %d, expected %d\n", regs.num_regs, expected);
+					exitcode = 1;
+					goto contin2;
+				}
+				if (regs.start[0] != match || regs.end[0] != match + 13) {
+					printf("incorrect regs.{start,end}[0] = { %d, %d },"
+						" expected { %d, %d }\n",
+						regs.start[0], regs.end[0],
+						match, match + 13
+					);
+					exitcode = 1;
+					goto contin2;
+				}
+				if (regs.start[regs.num_regs - 1] != -1
+				 || regs.end[regs.num_regs - 1] != -1
+				) {
+					printf("incorrect regs.{start,end}[num_regs - 1] = { %d, %d },"
+						" expected { -1, -1 }\n",
+						regs.start[regs.num_regs - 1], regs.end[regs.num_regs - 1]
+					);
+					exitcode = 1;
+					goto contin2;
+				}
+
+				if (i > 0) {
+					int j, k, l;
+					for (j = 0, l = 1; j < 7; ++j) {
+						for (k = 0; k < (i == 1 ? 1 : 10); ++k, ++l) {
+							if (regs.start[l] != match + j
+							 || regs.end[l] != match + j + 1
+							) {
+								printf("incorrect regs.{start,end}[%d] = { %d, %d },"
+									" expected { %d, %d }\n",
+									l,
+									regs.start[l], regs.end[l],
+									match + j, match + j + 1
+								);
+								exitcode = 1;
+								goto contin2;
+							}
+						}
+					}
+				}
+			}
+
+			gettimeofday(&stop, NULL);
+			stop.tv_sec -= start.tv_sec;
+			if (stop.tv_usec < start.tv_usec) {
+				stop.tv_sec--;
+				stop.tv_usec += 1000000;
+			}
+			stop.tv_usec -= start.tv_usec;
+			printf(" %lu.%06lus\n", (unsigned long) stop.tv_sec,
+						(unsigned long) stop.tv_usec);
+ contin2:
+			regfree(&rpbuf);
+		}
+	}
+	return exitcode;
+}
+
+#define TIMEOUT 20
+#define TEST_FUNCTION do_test()
+#include "../test-skeleton.c"
diff --git a/ap/build/uClibc/test/regex/tst-regex2.dat b/ap/build/uClibc/test/regex/tst-regex2.dat
new file mode 100644
index 0000000..ace9f3b
--- /dev/null
+++ b/ap/build/uClibc/test/regex/tst-regex2.dat
@@ -0,0 +1,2176 @@
+2002-11-19  Ulrich Drepper  <drepper@redhat.com>
+
+	* intl/localealias.c (read_alias_file): Use only about 400 bytes
+	of stack space instead of 16k.
+
+2002-11-18  Wolfram Gloger  <wg@malloc.de>
+
+	* malloc/arena.c
+	(ptmalloc_lock_all, ptmalloc_unlock_all, ptmalloc_unlock_all2): Do
+	nothing if not initialized.  Bug report from Marcus Brinkmann
+	<Marcus.Brinkmann@ruhr-uni-bochum.de>.
+
+2002-11-19  Roland McGrath  <roland@redhat.com>
+
+	* posix/Versions (libc: GLIBC_2.3.2): Add sched_getaffinity and
+	sched_setaffinity.
+
+	* configure.in (libc_cv_gcc_dwarf2_unwind_info check): Use libraries
+	`-lgcc -lgcc_eh -lgcc', not just `-lgcc -lgcc_eh' in link commands for
+	test leading to libc_cv_gcc_dwarf2_unwind_info=no_registry_needed.
+	* configure: Regenerated.
+
+2002-11-19  Ulrich Drepper  <drepper@redhat.com>
+
+	* include/dlfcn.h: __libc_dlopen is now a macro calling
+	__libc_dlopen_mode with the extra parameter RTLD_LAZY.
+	(__libc_dlopen_mode): New prototype.
+	* elf/dl-libc.c (__libc_dlopen_mode): Renamed from __libc_dlopen.  Add
+	new parameter.  Store new parameter in mode field of structure passed
+	to do_dlopen.
+	(struct do_dlopen_args): Add new field mode.
+	(do_dlopen): Pass mode from parameter structure to _dl_open.
+
+2002-11-11  Randolf Chung  <tausq@debian.org>
+
+	* sysdeps/unix/sysv/linux/hppa/bits/fcntl.h [__USE_FILE_OFFSET64]
+	(F_GETLK, F_SETLK, F_SETLKW): Define to F_*64 versions.
+	* sysdeps/unix/sysv/linux/hppa/fcntl.c: New file.
+
+	* sysdeps/hppa/fpu/libm-test-ulps: New file (generated).
+
+	* sysdeps/hppa/Makefile (CFLAGS-rtld.c): New variable.
+	Set -mdisable-fpregs for this file.
+
+2002-11-11  Carlos O'Donell  <carlos@baldric.uwo.ca>
+
+	* sysdeps/unix/sysv/linux/configure.in:
+	Make 2.4.19 minimum linux kernel for hppa, and add unwind symbols
+	from gcc-3.0 era for backwards compatibility.
+	* sysdeps/unix/sysv/linux/configure: Regenerate.
+
+	* sysdeps/unix/sysv/linux/hppa/sys/ucontext.h:
+	Define mcontext_t as a sigcontext.
+
+2002-11-18  Roland McGrath  <roland@redhat.com>
+
+	* dlfcn/dlerror.c (fini): New function, __attribute__ ((destructor)).
+	Free memory in `last_result' if it was used.
+
+	* resolv/nss_dns/dns-network.c (getanswer_r): In BYNAME case, search
+	all aliases for one that matches the "<dotted-quad>.IN-ADDR.ARPA" form.
+	Do the parsing inline instead of copying strings and calling
+	inet_network, and properly skip all alias names not matching the form.
+
+	* manual/pattern.texi (Variable Substitution): Fix # and ## examples.
+
+2002-11-17  Ulrich Drepper  <drepper@redhat.com>
+
+	* manual/pattern.texi (Wordexp Example): Fix sample code.
+
+	* sysdeps/unix/sysv/linux/i386/clone.S: Initialize word in the
+	childs stack which will be loaded into the %esi register.
+
+2002-11-14  Paul Eggert  <eggert@twinsun.com>
+
+	* resolv/nss_dns/dns-network.c (getanswer_r): Check for buffer
+	overflow when skipping the question part and when unpacking aliases.
+
+2002-11-15  Roland McGrath  <roland@redhat.com>
+
+	* math/Makefile (libm-calls): Remove s_copysign, s_isinf, s_isnan,
+	s_finite, s_modf, s_scalbn, s_frexp, m_ldexp, s_signbit.
+	Instead add $(calls:s_%=m_%) to get m_* versions of them all.
+
+2002-11-15  Jakub Jelinek  <jakub@redhat.com>
+
+	* sysdeps/i386/dl-machine.h (elf_machine_rela): Handle R_386_COPY.
+	* sysdeps/arm/dl-machine.h (elf_machine_rela): Handle R_ARM_COPY.
+
+2002-11-15  Roland McGrath  <roland@redhat.com>
+
+	* math/Makefile (libm-calls): Change s_ldexp to m_ldexp.
+	* Makerules ($(+sysdir_pfx)sysd-rules): Emit pattern rules for m_%.[Sc]
+	from sysdeps/.../s_%.[Sc] with commands $(+make-include-of-dep).
+	(+make-include-of-dep): New canned sequence.
+
+	* stdlib/canonicalize.c (__realpath): Check for malloc failure.
+	From Dmitry V. Levin <ldv@altlinux.org>.
+
+2002-11-14  Roland McGrath  <roland@redhat.com>
+
+	* sysdeps/generic/errno.c (__libc_errno): Remove alias.
+	* inet/herrno.c (__libc_h_errno): Likewise.
+	* resolv/res_libc.c (__libc_res): Likewise.
+	[USE___THREAD]: Use this in place of [USE_TLS && HAVE___THREAD].
+	(__res_state) [! USE___THREAD]: Don't define as weak.
+	* csu/Versions: Revert last change.
+	* resolv/Versions: Revert last change.
+
+	* Makerules ($(common-objpfx)%.make): New pattern rule.
+	* tls.make.c: New file.
+	* Makefile (distribute): Add it.
+
+	* sysdeps/generic/errno.c [! USE___THREAD]
+	[HAVE_ELF && SHARED && DO_VERSIONING] (errno, _errno): Declare these
+	with compat_symbol so they are not link-time visible.
+	[! USE___THREAD] (__libc_errno): New alias for errno.
+	* csu/Versions [!(USE_TLS && HAVE___THREAD)] (libc: GLIBC_PRIVATE):
+	Add __libc_errno here.
+	* inet/herrno.c [USE___THREAD]: Use this conditional
+	in place of [USE_TLS && HAVE___THREAD].
+	[! USE___THREAD] [HAVE_ELF && SHARED && DO_VERSIONING]
+	(h_errno, _h_errno): Declare these with compat_symbol so they are not
+	link-time visible.
+	[! USE___THREAD] (__libc_h_errno): New alias for h_errno.
+	* resolv/res_libc.c [! USE___THREAD]
+	[HAVE_ELF && SHARED && DO_VERSIONING] (_res): Likewise.
+	(_res): Use __attribute__ ((section (".bss"))) so we can have an alias.
+	(__libc_res): Define as alias for _res.
+	* resolv/Versions [!(USE_TLS && HAVE___THREAD)] (libc: GLIBC_PRIVATE):
+	Add __libc_h_errno and __libc_res here.
+
+2002-11-14  Jakub Jelinek  <jakub@redhat.com>
+
+	* csu/Versions (errno): Move STT_TLS symbol to GLIBC_PRIVATE for now.
+	* resolv/Versions (h_errno, _res): Likewise.
+
+2002-11-14  Roland McGrath  <roland@redhat.com>
+
+	* Makerules (%.dynsym): Remove $(objpfx) from target and dep.
+	(%.symlist): Likewise.
+
+2002-11-13  Roland McGrath  <roland@redhat.com>
+
+	* scripts/abilist.awk: New file.
+	* Makefile (distribute): Add it.
+	* Makerules ($(objpfx)%.dynsym, $(objpfx)%.symlist): New rules.
+	(tests): Depend on .symlist file for each $(install-lib.so-versioned).
+	[$(subdir) = elf] (tests): Depend on libc.symlist.
+	(generated, common-generated): Add those files.
+
+	* aclocal.m4 (LIBC_PROG_BINUTILS): Check for objdump, set OBJDUMP.
+	* configure: Regenerated.
+	* config.make.in (OBJDUMP): New variable, substituted by configure.
+
+	* malloc/mcheck.c (struct hdr): New members `block' and `magic2'.
+	(mallochook, reallochook): Set them up.
+	(checkhdr): Check HDR->magic2 value.
+	(freehook): Reset HDR->magic2.
+	(memalignhook): New static function.
+	(old_memalign_hook): New static variable.
+	(mcheck, reallochook): Set __memalign_hook to memalignhook.
+
+	* sysdeps/generic/dl-tls.c (_dl_allocate_tls_storage): Zero the space
+	for the new TCB.
+
+2002-11-13  Andreas Jaeger  <aj@suse.de>
+
+	* sysdeps/unix/sysv/linux/x86_64/sigaction.c: Check for visibility
+	attribute.
+	* sysdeps/unix/sysv/linux/i386/sigaction.c: Likewise.
+
+2002-11-11  Paul Eggert  <eggert@twinsun.com>
+
+	* manual/crypt.texi (Cryptographic Functions): Mention that
+	the MD5 one-way algorithm is compatible with BSD's.
+
+2002-11-11  Isamu Hasegawa  <isamu@yamato.ibm.com>
+
+	* posix/regex_internal.c (re_string_skip_chars): Also return the last
+	wide character.
+	(re_string_reconstruct): Calculate the context by itself when the
+	offset points out of the valid range.
+	(re_string_context_at): Use wide character when MB_CUR_MAX > 1.
+	* posix/regex_internal.h (WIDE_NEWLINE_CHAR): New macro.
+	(IS_WIDE_WORD_CHAR): New macro.
+	(IS_WIDE_NEWLINE): New macro.
+
+2002-11-12  Andreas Jaeger  <aj@suse.de>
+
+	* sysdeps/x86_64/strchr.S: Don't use one register for two
+	purposes, this fixes a bug noticed by test-strchr.c.
+
+	* sysdeps/x86_64/strcat.S: Fix algorithm to align source pointer
+	correctly.
+
+2002-11-12  Roland McGrath  <roland@redhat.com>
+
+	* libio/libioP.h [_LIBC && !SHLIB_COMPAT (libc, GLIBC_2_0, GLIBC_2_1)]
+	(_G_IO_NO_BACKWARD_COMPAT): Define it.
+
+	* sysdeps/ia64/dl-fptr.c [_LIBC_REENTRANT]: Include <ia64intrin.h>
+	instead of <pt-machine.h>.
+	[_LIBC_REENTRANT] (lock, unlock): Use __sync_lock_* macros instead of
+	testandset.
+	From Ian Wienand <ianw@gelato.unsw.edu.au>.
+
+2002-11-10  Roland McGrath  <roland@redhat.com>
+
+	* libio/bug-wfflush.c (do_test): Call rewind instead of fsetpos.
+	Call fputs instead of fwprintf (simpler to follow in debugger).
+
+	* crypt/md5-crypt.c: Doc fix.
+
+	* sysdeps/unix/make-syscalls.sh: Insert $(make-target-directory) at
+	the beginning of generated target commands.
+
+	* csu/Makefile ($(objpfx)crti.o, $(objpfx)crtn.o): Add explicit
+	dependencies for these in case implicit rule search skipped the
+	nonexistent source directory.
+	* sysdeps/gnu/Makefile ($(objpfx)errlist.d): Give this rule all the
+	files with $(object-suffixes) as targets too.
+	* Makerules [no_deps && objpfx] (before-compile): Add $(objpfx).
+	and a target for it using $(make-target-directory).
+
+	* Rules (before-compile): Add $(common-objpfx)bits/stdio-lim.h.
+
+2002-11-10  Roland McGrath  <roland@frob.com>
+
+	* sysdeps/unix/sysv/linux/bits/pthreadtypes.h: Moved to ...
+	* sysdeps/generic/bits/pthreadtypes.h: ... here.
+
+	* sysdeps/mach/hurd/fcntl.c (__libc_fcntl): Treat a struct flock with
+	l_start == 0 and l_len == 1 as we do l_len == 0.
+
+2002-11-10  Ulrich Drepper  <drepper@redhat.com>
+
+	* po/da.po: Update from translation team.
+
+2002-11-10  Roland McGrath  <roland@redhat.com>
+
+	* config.make.in (includedir): New variable, substituted by configure.
+	Reported missing by Jocelyn Fournier <joc@presence-pc.com>.
+	* Makeconfig (includedir): Use $(prefix), not $(exec_prefix).
+
+2002-11-10  Andreas Jaeger  <aj@suse.de>
+
+	* sysdeps/unix/sysv/linux/x86_64/sys/ucontext.h (enum): Add
+	REG_OLDMASK and REG_CR2 to synch with kernel header.
+	(NGREG): Increase.
+
+	* nss/getXXent.c (GETFUNC_NAME): Use union type to avoid strict
+	aliasing problem.
+	* nss/getXXbyYY_r.c (INTERNAL): Likewise.
+	* nss/getnssent_r.c (__nss_getent_r): Likewise.
+	(__nss_setent): Likewise.
+	(__nss_getent_r): Likewise.
+	* inet/getnetgrent_r.c (innetgr): Likewise.
+	(__internal_setnetgrent_reuse): Likewise.
+	(internal_getnetgrent_r): Likewise.
+	* inet/ether_hton.c (ether_hostton): Likewise.
+	* inet/ether_ntoh.c (ether_ntohost): Likewise.
+	* sunrpc/netname.c (netname2user): Likewise.
+	* sunrpc/publickey.c (getpublickey): Likewise.
+	(getsecretkey): Likewise.
+
+2002-11-09  Marcus Brinkmann  <marcus@gnu.org>
+
+	* sysdeps/mach/hurd/i386/ioperm.c (ioperm): Correct off by one
+	error in range calculation.
+
+2002-10-09  Jakub Jelinek  <jakub@redhat.com>
+
+	* string/test-strspn.c (do_test): Ensure zero termination.
+	* string/test-strpbrk.c (do_test): Likewise.
+	* string/test-strncmp.c (stupid_strncmp): Use strnlen, not strlen.
+	* string/test-strncpy.c (stupid_strncpy): Likewise.
+	* string/test-stpncpy.c (stupid_stpncpy): Likewise.
+
+2002-10-08  Roland McGrath  <roland@redhat.com>
+
+	* string/test-string.h (test_init): Fill BUF1 and BUF2 with
+	nonzero characters.
+
+2002-09-22  H.J. Lu  <hjl@gnu.org>
+
+	* sysdeps/unix/sysv/linux/mmap64.c (MMAP2_PAGE_SHIFT): Renamed
+	from PAGE_SHIFT.  Define if not defined.  Check MMAP2_PAGE_SHIFT
+	only if __NR_mmap2 is defined.
+
+	* sysdeps/unix/sysv/linux/powerpc/mmap64.c: Moved to ...
+	* sysdeps/unix/sysv/linux/mmap64.c: ... here.
+	* sysdeps/unix/sysv/linux/hppa/mmap64.c: File removed.
+	* sysdeps/unix/sysv/linux/sparc/sparc32/mmap64.c: FIle removed,
+
+2002-11-08  Jakub Jelinek  <jakub@redhat.com>
+
+	* posix/bug-regex13.c (tests): Add new test.
+
+	* string/test-strchr.c (stupid_strchr): New function.
+	(do_random_tests): Make sure the string is zero terminated.
+	* string/test-strpbrk.c (stupid_strpbrk): New function.
+	(do_random_tests): Make sure the string is zero terminated.
+	* string/test-strcmp.c (stupid_strcmp): New function.
+	(do_random_tests): Make sure the strings are zero terminated.
+	* string/test-strspn.c (stupid_strspn): New function.
+	(simple_strspn): Rename rej argument to acc.
+	(do_random_tests): Make sure the string is zero terminated.
+	* string/test-strcspn.c (stupid_strcspn): New function.
+	* string/test-strncpy.c (stupid_strncpy): New function.
+	* string/test-stpncpy.c (stupid_stpncpy): New function.
+	* string/test-strncmp.c (stupid_strncmp): New function.
+	(do_random_tests): Make sure the strings are zero terminated.
+	* string/test-string.h (impl_t): Change test into long.
+	(IMPL): Add __attribute__((aligned (sizeof (void *)))).
+
+2002-11-08  Roland McGrath  <roland@redhat.com>
+
+	* sysdeps/ia64/elf/configure.in: Add TLS check.
+	From Ian Wienand <ianw@cse.unsw.edu.au>.
+	* sysdeps/ia64/elf/configure: Regenerated.
+
+2002-11-07  Roland McGrath  <roland@redhat.com>
+
+	* libio/fileops.c (_IO_new_file_overflow): Use INTUSE(_IO_do_write) in
+	place of _IO_new_do_write.
+	[_LIBC] (_IO_do_write): Define as macro for _IO_new_do_write and
+	#undef before versioned_symbol use.
+
+2002-11-07  Richard Henderson  <rth@redhat.com>
+
+	* configure.in (ASM_ALPHA_NG_SYMBOL_PREFIX): Remove test.
+	* configure: Regenerated.
+	* config.h.in (ASM_ALPHA_NG_SYMBOL_PREFIX): Remove #undef.
+	* sysdeps/alpha/dl-machine.h (TRAMPOLINE_TEMPLATE): Use !samegp.
+	(RTLD_START): Likewise.  Access _dl_skip_args, _rtld_local, and
+	_dl_fini via gp-relative relocations.
+	* sysdeps/alpha/fpu/e_sqrt.c: Use !samegp.
+
+	* elf/tls-macros.h: Add alpha versions.
+	* sysdeps/alpha/dl-machine.h (elf_machine_rela): Handle TLS relocs.
+	* sysdeps/unix/alpha/sysdep.S: Support USE___THREAD.
+	* sysdeps/unix/alpha/sysdep.h: Likewise.  Add SYSCALL_ERROR_HANDLER.
+	* sysdeps/unix/sysv/linux/alpha/brk.S: Use it.
+	* sysdeps/unix/sysv/linux/alpha/clone.S: Likewise.
+	* sysdeps/unix/sysv/linux/alpha/getitimer.S: Likewise.
+	* sysdeps/unix/sysv/linux/alpha/getrusage.S: Likewise.
+	* sysdeps/unix/sysv/linux/alpha/gettimeofday.S: Likewise.
+	* sysdeps/unix/sysv/linux/alpha/ieee_get_fp_control.S: Likewise.
+	* sysdeps/unix/sysv/linux/alpha/ieee_set_fp_control.S: Likewise.
+	* sysdeps/unix/sysv/linux/alpha/rt_sigaction.S: Likewise.
+	* sysdeps/unix/sysv/linux/alpha/select.S: Likewise.
+	* sysdeps/unix/sysv/linux/alpha/setitimer.S: Likewise.
+	* sysdeps/unix/sysv/linux/alpha/settimeofday.S: Likewise.
+	* sysdeps/unix/sysv/linux/alpha/sigsuspend.S: Likewise.
+	* sysdeps/unix/sysv/linux/alpha/syscall.S: Likewise.
+	* sysdeps/unix/sysv/linux/alpha/utimes.S: Likewise.
+	* sysdeps/unix/sysv/linux/alpha/wait4.S: Likewise.
+
+	* sysdeps/unix/sysv/linux/alpha/sysdep.h: Re-include protect.
+	Kill argument registers across the inline syscall.
+
+	* sysdeps/unix/sysv/linux/alpha/clone.S: Add user_tid and tls args.
+
+	* linuxthreads/sysdeps/alpha/tls.h: New file.
+	* sysdeps/alpha/dl-tls.h: New file.
+
+2002-10-29  David Mosberger  <davidm@hpl.hp.com>
+
+	* sysdeps/ia64/elf/initfini.c [HAVE_INITFINI_ARRAY]
+	(gmon_initializer): New function.
+	(.init prologue): If HAVE_INITFINI_ARRAY is true, don't call
+	__gmon_start__ here.  Call it from gmon_initializer() instead.
+
+2002-03-12  H.J. Lu  <hjl@gnu.org>
+
+	* elf/Makefile [$(have-initfini-array) = yes] (tests): Add tst-array1,
+	tst-array2, and tst-array3.
+	[$(have-initfini-array) = yes] (tests-static): Add tst-array3.
+	[$(have-initfini-array) = yes] (modules-names): Add tst-array2dep.
+	($(objpfx)tst-array1.out): New target.
+	($(objpfx)tst-array2): Likewise.
+	($(objpfx)tst-array2.out): Likewise.
+	($(objpfx)tst-array3.out): Likewise.
+	* elf/tst-array1.c: New file.
+	* elf/tst-array1.exp: Likewise.
+	* elf/tst-array2.c: Likewise.
+	* elf/tst-array2dep.c: Likewise.
+	* elf/tst-array2.exp: Likewise.
+	* elf/tst-array3.c: Likewise.
+
+2002-10-28  David Mosberger  <davidm@hpl.hp.com>
+
+	* elf/dl-fini.c (_dl_fini): Invoke fini_array in _reverse_ order.
+	Don't add L->l_addr to array entry values.
+
+2002-11-07  Jakub Jelinek  <jakub@redhat.com>
+
+	* string/test-string.h: New file.
+	* string/test-strlen.c: New file.
+	* string/test-string.h: New file.
+	* string/test-strcmp.c: New file.
+	* string/test-strchr.c: New file.
+	* string/test-strrchr.c: New file.
+	* string/test-strcpy.c: New file.
+	* string/test-stpcpy.c: New file.
+	* string/test-strncpy.c: New file.
+	* string/test-stpncpy.c: New file.
+	* string/test-strpbrk.c: New file.
+	* string/test-strcspn.c: New file.
+	* string/test-strspn.c: New file.
+	* string/test-strcat.c: New file.
+	* string/test-strncmp.c: New file.
+	* string/test-memchr.c: New file.
+	* string/test-memcmp.c: New file.
+	* string/test-memset.c: New file.
+	* string/test-memcpy.c: New file.
+	* string/test-mempcpy.c: New file.
+	* string/test-memmove.c: New file.
+	* string/Makefile (strop-tests): New variable.
+	(tests): Add strop-tests.
+	(distribute): Add test-string.h.
+
+2002-11-06  Ulrich Drepper  <drepper@redhat.com>
+
+	* posix/regcomp.c: Use tabs instead of spaces.
+	* posix/regexec.c: Likewise.
+	* posix/regex_internal.h: Likewise.
+
+	* posix/regcomp.c (re_compile_fastmap_iter): Use __wcrtomb not wctomb.
+
+2002-11-06  Jakub Jelinek  <jakub@redhat.com>
+
+	* posix/regcomp.c (re_compile_pattern): Don't set regs_allocated
+	here.
+	(regcomp): Don't set can_be_null here.
+	(re_comp): Clear whole re_comp_buf with the exception of fastmap.
+	(re_compile_internal): Clear can_be_null, set regs_allocated.
+
+	* posix/regcomp.c (re_set_fastmap): New function.
+	(re_compile_fastmap_iter): Use it.  Remove redundant type ==
+	COMPLEX_BRACKET check.
+	* posix/regexec.c (re_search_internal): Optimize searching with
+	fastmap.  Call re_string_reconstruct even if match_first is
+	smaller than raw_mbs_idx.
+
+2002-11-06  Isamu Hasegawa  <isamu@yamato.ibm.com>
+
+	* posix/regcomp (free_dfa_content): Use free_state.
+	* posix/regex_internal.c (re_string_realloc_buffers): Don't edit
+	pointers in case that realloc failed.
+	(re_node_set_merge): Likewise.
+	(register_state): Likewise.
+	(create_newstate_common): Invoke memory release functions in case of
+	error conditions.
+	(create_ci_newstate): Likewise.
+	(create_cd_newstate): Likewise.
+	(free_state): New function.
+	* posix/regexec.c (re_search_internal): Invoke memory release
+	functions in case of error conditions.
+	(sift_states_backward): Likewise.
+	(merge_state_array): Likewise.
+	(add_epsilon_src_nodes): Likewise.
+	(sub_epsilon_src_nodes): Likewise.
+	(search_subexp): Likewise.
+	(sift_states_bkref): Likewise.
+	(transit_state_sb): Likewise.
+	(transit_state_mb): Likewise.
+	(transit_state_bkref_loop): Likewise.
+	(group_nodes_into_DFAstates): Likewise.
+	(push_fail_stack): Don't edit pointers in case that realloc failed.
+	(extend_buffers): Likewise.
+	(match_ctx_add_entry): Likewise.
+
+2002-11-06  Roland McGrath  <roland@redhat.com>
+
+	* sysdeps/unix/sysv/linux/mips/configure.in: File removed.
+	* sysdeps/unix/sysv/linux/mips/configure: Likewise.
+
+	* configure.in: Add checks on as and ld for binutils 2.13 or later.
+	* configure: Regenerated.
+
+2002-11-06  Ulrich Drepper  <drepper@redhat.com>
+
+	* posix/regcomp.c (regcomp): __re_compile_fastmap can never fail.
+	If re_compile_internal failed free fastmap buffer.
+	(free_dfa_content): Broken out of regfree function.  Frees all dfa
+	related data.
+	(regfree): Add free_dfa_content.
+	(re_compile_internal): If any of the called functions fails free
+	all dfa related memory.
+
+2002-11-05  Ulrich Drepper  <drepper@redhat.com>
+
+	* sysdeps/unix/sysv/linux/sys/sysctl.h: Add ugly hacks to prevent
+	warnings from the kernel headers.
+
+2002-11-05  Roland McGrath  <roland@redhat.com>
+
+	* sysdeps/unix/mips/sysdep.h [! __PIC__] (PSEUDO): Add nop after jump.
+	From Johannes Stezenbach <js@convergence.de>.
+
+	* sysdeps/unix/sysv/linux/mips/Versions (libc: GLIBC_2.0): Change
+	#errlist-compat magic comment to give 123 as size.
+	(libc: GLIBC_2.1): Remove this set, moving #errlist-compat magic to ...
+	(libc: GLIBC_2.2): ... here.
+	(libc: GLIBC_2.3): Likewise.
+
+2002-11-05  Ulrich Drepper  <drepper@redhat.com>
+
+	* elf/dl-fini.c (_dl_fini): Correct the increment of l_opencount
+	which happens at the beginning so that we can unload modules in
+	__libc_freeres.
+
+2002-11-06  Kaz Kojima  <kkojima@rr.iij4u.or.jp>
+
+	* sysdeps/sh/bits/setjmp.h (JB_SIZE): Define only
+	under [__USE_MISC || _ASM].
+
+	* elf/elf.h: Remove the obsolete SH TLS relocations.
+
+2002-11-05  Ulrich Drepper  <drepper@redhat.com>
+
+	* posix/regcomp.c (regcomp): Initialize preg->can_be_null to zero.
+
+2002-11-05  Franz Sirl  <Franz.Sirl-kernel@lauterbach.com>
+
+	* sysdeps/unix/sysv/linux/powerpc/powerpc32/sysdep.h: Handle
+	__NR_pread64 and __NR_pwrite64.
+	* sysdeps/unix/sysv/linux/powerpc/powerpc64/sysdep.h: Likewise.
+	* sysdeps/unix/sysv/linux/powerpc/pread.c: Remove __NR_pread64
+	and __NR_pwrite64.
+	Revert change to use INLINE_SYSCALL.
+	* sysdeps/unix/sysv/linux/powerpc/pread64.c: Likewise.
+	* sysdeps/unix/sysv/linux/powerpc/pwrite.c: Likewise.
+	* sysdeps/unix/sysv/linux/powerpc/pwrite64.c: Likewise.
+	* sysdeps/unix/sysv/linux/powerpc/ftruncate64.c: Revert change to use
+	INLINE_SYSCALL.
+	* sysdeps/unix/sysv/linux/powerpc/truncate64.c: Likewise.
+
+	* sysdeps/unix/sysv/linux/powerpc/powerpc32/sysdep.h (INLINE_SYSCALL):
+	Update clobber list and add a comment about the syscall ABI.
+
+	* sysdeps/unix/sysv/linux/powerpc/powerpc32/syscalls.list (s_pread64,
+	s_pwrite64, s_ftruncate, s_truncate): Re-add.
+
+2002-11-05  Jakub Jelinek  <jakub@redhat.com>
+
+	* iconv/gconv_dl.c (free_mem): Clear loaded.
+	* locale/loadarchive.c (_nl_archive_subfreeres): Call locale_data's
+	cleanup if any.
+
+2002-11-05  Ulrich Drepper  <drepper@redhat.com>
+
+	* sysdeps/unix/sysv/linux/fexecve.c: Include <stdio.h>.
+
+	* libio/ioseekoff.c: Remove INTDEF.  Define _IO_seekoff_unlocked.  Same
+	as old code without locking.  _IO_seekoff calls this function after
+	locking the stream.
+	* libio/ioseekpos.c: Likewise for _IO_seekpos.
+	* libio/libioP.h: Replace _IO_seekoff_internal and _IO_seekpos_internal
+	prototypes with _IO_seekoff_unlocked and _IO_seekpos_unlocked
+	prototypes.
+	* libio/iolibio.h (_IO_fseek): Call _IO_seekoff_unlocked instead
+	of _IO_seekoff_internal.
+	(_IO_rewind): Likewise.
+	* libio/ioftell.c: Likewise.
+	* libio/ftello.c: Likewise.
+	* libio/ftello64.c: Likewise.
+	* libio/iofgetpos.c: Likewise.
+	* libio/iofgetpos64.c: Likewise.
+	* libio/oldiofgetpos.c: Likewise.
+	* libio/oldiofgetpos64.c: Likewise.
+	* libio/iofsetpos.c: Call _IO_seekpos_unlocked instead of
+	_IO_seekpos_internal.
+	* libio/iofsetpos64.c: Likewise.
+	* libio/oldiofsetpos.c: Likewise.
+	* libio/oldiofsetpos64.c: Likewise.
+
+2002-11-04  Roland McGrath  <roland@redhat.com>
+
+	* sysdeps/unix/sysv/linux/powerpc/chown.c: Use INLINE_SYSCALL macro.
+	* sysdeps/unix/sysv/linux/powerpc/ftruncate64.c: Likewise.
+	* sysdeps/unix/sysv/linux/powerpc/ioctl.c: Likewise.
+	* sysdeps/unix/sysv/linux/powerpc/pread.c: Likewise.
+	* sysdeps/unix/sysv/linux/powerpc/pread64.c: Likewise.
+	* sysdeps/unix/sysv/linux/powerpc/pwrite.c: Likewise.
+	* sysdeps/unix/sysv/linux/powerpc/pwrite64.c: Likewise.
+	* sysdeps/unix/sysv/linux/powerpc/tcgetattr.c: Likewise.
+	* sysdeps/unix/sysv/linux/powerpc/tcsetattr.c: Likewise.
+	* sysdeps/unix/sysv/linux/powerpc/truncate64.c: Likewise.
+	* sysdeps/unix/sysv/linux/powerpc/powerpc32/syscalls.list (s_ioctl,
+	s_chown, s_ftruncate64, s_mmap2, s_pread64, s_pwrite64, s_truncate64,
+	sys_fstat, sys_lstat, sys_mknod, sys_readv, sys_stat, sys_writev):
+	Remove these, no longer used.
+
+2002-11-04  Franz Sirl  <Franz.Sirl-kernel@lauterbach.com>
+
+	* sysdeps/unix/sysv/linux/powerpc/powerpc32/syscalls.list (s_ipc,
+	s_llseek, s_readahead, s_execve, s_fcntl, s_fcntl64, s_fstat64,
+	s_getcwd, s_getdents, s_getdents64, s_getpmsg, s_getpriority,
+	s_getrlimit, s_lstat64, s_poll, s_ptrace, s_putpmsg, s_reboot,
+	s_setrlimit, s_sigaction, s_sigpending, s_sigprocmask, s_sigsuspend,
+	s_stat64, s_sysctl, s_ugetrlimit, s_ustat, s_vfork): Remove now unused
+	syscall stubs.
+
+	* sysdeps/unix/sysv/linux/pwrite.c: Fix typo.
+	* sysdeps/unix/sysv/linux/pwrite64.c: Likewise.
+	* sysdeps/unix/sysv/linux/powerpc/pread.c: Handle both __NR_pread64
+	and __NR_pread.
+	* sysdeps/unix/sysv/linux/powerpc/pread64.c: Likewise.
+	* sysdeps/unix/sysv/linux/powerpc/pwrite.c: Handle both __NR_pwrite64
+	and __NR_pwrite.
+	* sysdeps/unix/sysv/linux/powerpc/pwrite64.c: Likewise.
+
+2002-11-03  Roland McGrath  <roland@redhat.com>
+
+	* sysdeps/generic/ldsodefs.h (struct rtld_global): New member
+	`_dl_tls_static_used'.
+	* sysdeps/generic/libc-tls.c (_dl_tls_static_used): New variable.
+	(__libc_setup_tls): Initialize it.  Let the initial value of
+	_dl_tls_static_size indicate some surplus space in the computed value.
+	* elf/dl-open.c (_dl_tls_static_size): New variable.
+	* sysdeps/generic/dl-tls.c (_dl_determine_tlsoffset): Initialize
+	_dl_tls_static_used.  Add some surplus space into _dl_tls_static_size.
+	* elf/dl-reloc.c [USE_TLS] (allocate_static_tls): New function.
+	(CHECK_STATIC_TLS): Use it.
+	* elf/dl-close.c (_dl_close): Adjust _dl_tls_static_used when the
+	closed objects occupied a trailing contiguous chunk of static TLS area.
+
+2002-10-18  Bruno Haible  <bruno@clisp.org>
+
+	* charmaps/ISO_5428: Use Greek characters introduced in Unicode 3.0.
+
+2002-11-04  Ulrich Drepper  <drepper@redhat.com>
+
+	* libio/wfileops.c (_IO_wfile_seekoff): Don't modify _offset and
+	_wide_data->_IO_read_end if adjustment can be made in the current
+	buffer.
+
+	* sysdeps/unix/sysv/linux/fexecve.c: New file.
+
+	* libio/bug-wfflush.c (do_test): Using fseek is not allowed when
+	wide oriented streams are used.
+
+	* nss/getXXent_r.c (ENDFUNC_NAME): Don't do anything if the
+	service hasn't been used [PR libc/4744].
+
+	* include/features.h: Use __STDC_VERSION__ not __STDC_VERSION.
+	Reported by Miloslav Trmac <mitr@volny.cz> [PR libc/4766].
+
+	* manual/examples/dir.c: Don't include <stddef.h>.
+	* manual/examples/select.c: Include <errno.h> for TEMP_FAILURE_RETRY.
+	Reported by Frédéric Delanoy <delanoy_f@yahoo.com>.
+
+2002-11-02  H.J. Lu  <hjl@gnu.org>
+
+	* stdio-common/reg-printf.c: Include <stddef.h>.
+
+2002-11-03  Ulrich Drepper  <drepper@redhat.com>
+
+	* sysdeps/generic/libc-tls.c: Define _dl_tls_static_used.
+
+	* po/ca.po: Update from translation team.
+	* po/es.po: Likewise.
+
+	* sysdeps/generic/segfault.c (catch_segfault): If HAVE_PROC_SELF
+	is defined write out memory map.
+	* sysdeps/unix/sysv/linux/segfault.c: New file.
+
+2002-11-02  Roland McGrath  <roland@redhat.com>
+
+	* sysdeps/unix/sysv/linux/getdents.c (__GETDENTS): Use union type for
+	pointers that can alias.
+	Reported by Daniel Jacobowitz <drow@mvista.com>.
+
+	* sysdeps/unix/bsd/bsd4.4/freebsd/bits/typesizes.h: New file.
+
+2002-11-02  Roland McGrath  <roland@redhat.com>
+
+	* manual/filesys.texi (Reading/Closing Directory): Rewrite readdir_r
+	description to be clearer and to say that *RESULT is set to ENTRY.
+
+2002-10-30  Jakub Jelinek  <jakub@redhat.com>
+
+	* posix/regexec.c (build_trtable): Alloca or malloc dests_node and
+	dests_ch arrays together.  Alloca or malloc dest_states,
+	dest_states_word and dest_states_nl arrays together.  Free memory on
+	error exit.
+
+2002-10-29  Daniel Jacobowitz  <drow@mvista.com>
+
+	* crypt/crypt_util.c (__init_des_r): Initialize current_salt
+	and current_saltbits.
+
+2002-11-02  Roland McGrath  <roland@redhat.com>
+
+	* stdio-common/reg-printf.c: Include <stdlib.h>.
+
+2002-11-02  H.J. Lu  <hjl@gnu.org>
+
+	* sysdeps/unix/sysv/linux/mips/syscalls.list (s_execve): Set
+	caller to EXTRA instead of execve.
+
+2002-11-01  Roland McGrath  <roland@redhat.com>
+
+	* sysdeps/generic/errno-loc.c [! USE___THREAD]: Use this conditional
+	in place of [!(USE_TLS && HAVE___THREAD)].
+	(__errno_location) [! USE___THREAD]: Define as strong, not weak.
+
+2002-10-31  Roger Sayle  <roger@eyesopen.com>
+
+	* sysdeps/i386/soft-fp/sfp-machine.h (_FP_NANFRAC_Q, _FP_NANSIGN_Q):
+	New macros.
+	* sysdeps/x86_64/soft-fp/sfp-machine.h: Likewise.
+
+	* soft-fp/soft-fp.h: Allow sfp-machine.h to define FP_RND_NEAREST
+	without defining FP_ROUNDMODE.
+
+2002-10-29  Jakub Jelinek  <jakub@redhat.com>
+
+	* sysdeps/gnu/siglist.c (PTR_SIZE_STR): Remove.
+	(__old_sys_siglist, __old_sys_sigabbrev): Use strong_alias and
+	declare_symbol.
+	* sysdeps/mach/hurd/siglist.h (OLD_SIGLIST_SIZE_STR): Remove.
+	(OLD_SIGLIST_SIZE): Define.
+	* sysdeps/unix/sysv/linux/siglist.h (OLD_SIGLIST_SIZE_STR): Remove.
+	(OLD_SIGLIST_SIZE): Define.
+	* sysdeps/unix/sysv/linux/arm/siglist.c: Remove.
+
+2002-11-01  Jakub Jelinek  <jakub@redhat.com>
+
+	* sysdeps/ia64/strncpy.S: Fix recovery code.
+
+2002-10-30  Jakub Jelinek  <jakub@redhat.com>
+
+	* include/libc-symbols.h (__libc_freeres_fn_section, libc_freeres_fn):
+	New macros.
+	* elf/dl-close.c (free_mem): Use libc_freeres_fn macro, remove
+	text_set_element.
+	* elf/dl-libc.c (free_mem): Likewise.
+	* iconv/gconv_conf.c (free_mem): Likewise.
+	* iconv/gconv_db.c (free_mem): Likewise.
+	* iconv/gconv_dl.c (free_mem): Likewise.
+	* iconv/gconv_cache.c (free_mem): Likewise.
+	* intl/finddomain.c (free_mem): Likewise.
+	* intl/dcigettext.c (free_mem): Likewise.
+	* locale/setlocale.c (free_mem): Likewise.
+	* misc/fstab.c (fstab_free): Likewise.
+	* nss/nsswitch.c (free_mem): Likewise.
+	* posix/regcomp.c (free_mem): Likewise.
+	* resolv/gai_misc.c (free_res): Likewise.
+	* stdlib/fmtmsg.c (free_mem): Likewise.
+	* sunrpc/clnt_perr.c (free_mem): Likewise.
+	* sysdeps/generic/setenv.c (free_mem): Likewise.
+	* sysdeps/unix/sysv/linux/shm_open.c (freeit): Likewise.
+	* sysdeps/pthread/aio_misc.c (free_res): Likewise.
+	* time/tzset.c (free_mem): Likewise.
+	* malloc/mtrace.c (release_libc_mem): Add __libc_freeres_fn_section.
+	* locale/loadarchive.c (_nl_archive_subfreeres): Likewise.
+	* malloc/set-freeres.c (__libc_freeres): Likewise.
+
+	* login/getutent.c: Include stdlib.h instead of stddef.h.
+	(buffer): Change into pointer to utmp, add libc_freeres_ptr.
+	(__getutent): Allocate buffer the first time it is run.
+	* login/getutid.c: Include stdlib.h instead of stddef.h.
+	(buffer): Change into pointer to utmp, add libc_freeres_ptr.
+	(__getutid): Allocate buffer the first time it is run.
+	* login/getutline.c: Include stdlib.h instead of stddef.h.
+	(buffer): Change into pointer to utmp, add libc_freeres_ptr.
+	(__getutline): Allocate buffer the first time it is run.
+	* malloc/mtrace.c (malloc_trace_buffer): Change into char *.
+	(mtrace): Allocate malloc_trace_buffer.
+	* resolv/nsap_addr.c (inet_nsap_ntoa): Decrease size of tmpbuf.
+	* resolv/ns_print.c (ns_sprintrrf): Decrease size of t.
+	* string/strerror.c: Include libintl.h and errno.h.
+	(buf): New variable.
+	(strerror): Only allocate buffer if actually needed (unknown error).
+	* time/tzfile.c (transitions): Add libc_freeres_ptr.
+	(freeres): Remove.
+
+2002-10-25  Jakub Jelinek  <jakub@redhat.com>
+
+	* include/libc-symbols.h (libc_freeres_ptr): New macro.
+	* malloc/set-freeres.c (__libc_freeres_ptrs): Define using
+	symbol_set_define.
+	(__libc_freeres): Free all pointers in that section.
+	* Makerules (build-shlib): Add $(LDSEDCMD-$(@F:lib%.so=%).so) to sed
+	commands when creating .lds script.
+	(LDSEDCMD-c.so): New variable.
+	* inet/rcmd.c (ahostbuf): Change into char *.  Add libc_freeres_ptr.
+	(rcmd_af): Use strdup to allocate ahostbuf.
+	* inet/rexec.c (ahostbuf): Change into char *.  Add libc_freeres_ptr.
+	(rexec_af): Use strdup to allocate ahostbuf.
+	* stdio-common/reg-printf.c (printf_funcs): Remove.
+	(__printf_arginfo_table): Change into printf_arginfo_function **.
+	Add libc_freeres_ptr.
+	(__register_printf_function): Allocate __printf_arginfo_table
+	and __printf_function_table the first time it is called.
+	* stdio-common/printf-parse.h (__printf_arginfo_table): Change into
+	printf_arginfo_function **.
+	(parse_one_spec): Add __builtin_expect.
+	* grp/fgetgrent.c (buffer): Add libc_freeres_ptr.
+	(free_mem): Remove.
+	* inet/getnetgrent.c (buffer): Add libc_freeres_ptr.
+	(free_mem): Remove.
+	* intl/localealias.c (libc_freeres_ptr): Define if !_LIBC.
+	(string_space, map): Add libc_freeres_ptr.
+	(free_mem): Remove.
+	* misc/efgcvt.c (FCVT_BUFPTR): Add libc_freeres_ptr.
+	(free_mem): Remove.
+	* misc/mntent.c (getmntent_buffer): Add libc_freeres_ptr.
+	(free_mem): Remove.
+	* crypt/md5-crypt.c (libc_freeres_ptr): Define if !_LIBC.
+	(buffer): Add libc_freeres_ptr.
+	(free_mem): Remove for _LIBC.
+	* nss/getXXbyYY.c (buffer): Add libc_freeres_ptr.
+	(free_mem): Remove.
+	* nss/getXXent.c (buffer): Add libc_freeres_ptr.
+	(free_mem): Remove.
+	* pwd/fgetpwent.c (buffer): Add libc_freeres_ptr.
+	(free_mem): Remove.
+	* resolv/res_hconf.c (ifaddrs): Add libc_freeres_ptr.
+	(free_mem): Remove.
+	* shadow/fgetspent.c (buffer): Add libc_freeres_ptr.
+	(free_mem): Remove.
+	* sysdeps/posix/ttyname.c (getttyname_name): Add libc_freeres_ptr.
+	(free_mem): Remove.
+	* sysdeps/unix/sysv/linux/getsysstats.c (mount_proc): Add
+	libc_freeres_ptr.
+	(free_mem): Remove.
+	* sysdeps/unix/sysv/linux/ttyname.c (getttyname_name, ttyname_buf): Add
+	libc_freeres_ptr.
+	(free_mem): Remove.
+
+2002-10-30  Jakub Jelinek  <jakub@redhat.com>
+
+	* malloc/obstack.c [_LIBC] (obstack_free): Change into strong_alias
+	instead of duplicating the whole function in libc.
+
+2002-10-31  Roland McGrath  <roland@redhat.com>
+
+	* sysdeps/i386/bits/byteswap.h [__GNUC__ < 2] (__bswap_32):
+	Renamed from __bswap_16 (typo fix).  Reported by <dens@stl.sarov.ru>.
+
+2002-10-30  Jakub Jelinek  <jakub@redhat.com>
+
+	* sysdeps/unix/sysv/linux/Makefile (syscall-%.h): Add -D for each
+	32bit-predefine when creating .new32 list and -U for each
+	32bit-predefine when creating .new64 list.
+	* sysdeps/unix/sysv/linux/x86_64/Makefile (32bit-predefine): New.
+
+2002-10-29  Andreas Schwab  <schwab@suse.de>
+
+	* sysdeps/generic/allocrtsig.c: Include <testrtsig.h>, not
+	"testrtsig.h".  Reported by Daniel Jacobowitz <dan@debian.org>.
+
+2002-10-25  Roland McGrath  <roland@redhat.com>
+
+	* sysdeps/unix/sysv/linux/configure.in: Fix typo in last change.
+	* sysdeps/unix/sysv/linux/configure: Regenerated.
+
+	* sysdeps/generic/ldsodefs.h: Remove [! SHARED] conditional from
+	_dl_starting_up decl.
+
+2002-10-20  H.J. Lu  <hjl@gnu.org>
+
+	* sysdeps/unix/sysv/linux/configure.in: Don't check
+	/lib/modules/`uname -r`/build/include for kernel headers if
+	cross compiling.
+	* sysdeps/unix/sysv/linux/configure: Regenerated.
+
+2002-10-25  Roland McGrath  <roland@redhat.com>
+
+	* math/math.h (M_LOG2El): Correct the value.
+	From Stephen L Moshier <steve@moshier.net>.
+
+	* sysdeps/unix/sysv/linux/init-first.c (init): Remove [! SHARED]
+	conditional from __libc_multiple_libcs access.  Remove kludge for weak
+	symbol access with old compilers we no longer support.
+	* sysdeps/unix/sysv/aix/init-first.c (init): Likewise.
+	* sysdeps/generic/libc-start.c (__libc_start_main): Likewise.
+
+2002-10-25  Roland McGrath  <roland@redhat.com>
+
+	* sysdeps/posix/sigvec.c [SA_RESETHAND]: Disable wrapper hacks and
+	implement SV_RESETHAND by translating it to SA_RESETHAND.
+
+2002-10-23  Alexandre Oliva  <aoliva@redhat.com>
+
+	* elf/dl-reloc.c (_dl_reloc_bad_use): Print the full 32-bit relocation
+	type on ELF64 platforms.
+
+2002-10-24  Ulrich Drepper  <drepper@redhat.com>
+
+	* elf/elf.h (R_X86_64_GOTTPOFF): Renamed from r_x86_64_GOTTPOFF.
+
+	* elf/elf.h: Define ELF_NOTE_OS_FREEBSD and NT_TASKSTRUCT.
+
+2002-10-24  Jakub Jelinek  <jakub@redhat.com>
+
+	* elf/dl-misc.c: Include <sysdep.h>.
+	(_dl_debug_vdprintf): Only take dl_load_lock if not _dl_starting_up.
+
+	* sysdeps/unix/sysv/linux/s390/s390-32/sysdep.h (INTERNAL_SYSCALL,
+	INTERNAL_SYSCALL_ERROR_P, INTERNAL_SYSCALL_ERRNO): New macros.
+	(INLINE_SYSCALL): Use that.
+	* sysdeps/unix/sysv/linux/s390/s390-64/sysdep.h (INTERNAL_SYSCALL,
+	INTERNAL_SYSCALL_ERROR_P, INTERNAL_SYSCALL_ERRNO): New macros.
+	(INLINE_SYSCALL): Use that.
+	* sysdeps/unix/sysv/linux/x86_64/sysdep.h (INTERNAL_SYSCALL,
+	INTERNAL_SYSCALL_ERROR_P, INTERNAL_SYSCALL_ERRNO): New macros.
+	(INLINE_SYSCALL): Use that.
+	* sysdeps/unix/sysv/linux/sparc/sparc32/sysdep.h: Include
+	dl-sysdep.h.
+	(SYSCALL_ERROR_HANDLER): Define RTLD_PRIVATE_ERRNO variant.
+	(__INTERNAL_SYSCALL_STRING): Define.
+	* sysdeps/unix/sysv/linux/sparc/sparc64/sysdep.h: Include
+	dl-sysdep.h.
+	(SYSCALL_ERROR_HANDLER): Define RTLD_PRIVATE_ERRNO variant.
+	(__INTERNAL_SYSCALL_STRING): Define.
+	* sysdeps/unix/sysv/linux/sparc/sysdep.h (INLINE_SYSCALL): Pass
+	__SYSCALL_STRING to inline_syscall*.
+	(INTERNAL_SYSCALL, INTERNAL_SYSCALL_ERROR_P, INTERNAL_SYSCALL_ERRNO):
+	New macros.
+	(inline_syscall0, inline_syscall1, inline_syscall2, inline_syscall3,
+	inline_syscall4, inline_syscall5, inline_syscall6): Add string
+	argument.
+
+2002-10-24  Roland McGrath  <roland@redhat.com>
+
+	* sysdeps/generic/ldsodefs.h (_dl_starting_up): Declare it here.
+	* sysdeps/unix/sysv/linux/init-first.c: Not here.
+	* sysdeps/powerpc/elf/libc-start.c: Or here.
+	* sysdeps/unix/sysv/aix/libc-start.c: Or here.
+	* sysdeps/unix/sysv/aix/start-libc.c: Or here.
+	* sysdeps/unix/sysv/aix/init-first.c: Or here.
+	* sysdeps/generic/libc-start.c: Or here.
+	* sysdeps/unix/sysv/linux/init-first.c (init): Protect _dl_starting_up
+	access with [! SHARED].
+	* sysdeps/unix/sysv/aix/init-first.c (init): Likewise.
+
+	* libio/bug-wfflush.c: New file.
+	* libio/Makefile (tests): Add bug-wfflush.
+
+2002-10-23  Roland McGrath  <roland@redhat.com>
+
+	* stdio-common/tst-fphex.c: New file.
+	* stdio-common/Makefile (tests): Add tst-fphex.
+	* sysdeps/generic/printf_fphex.c (__printf_fphex): Fix initialization
+	of WNUMEND.  Fix counting of decimal point in WIDTH.  Print '0' pad
+	chars always before the value digits.
+	Reported by James Antill <james.antill@redhat.com>.
+
+2002-10-24  Jakub Jelinek  <jakub@redhat.com>
+
+	* posix/regcomp.c (re_comp): Call __regfree on re_comp_buf.
+	(free_mem): New function.
+	* posix/Makefile (tests): Add bug-regex14.  Add bug-regex14-mem
+	if not cross compiling.
+	(generated): Add bug-regex14-mem and bug-regex14.mtrace.
+	(bug-regex14-ENV): Set.
+	(bug-regex14-mem): New target.
+	* posix/bug-regex14.c: New file.
+
+2002-10-23  Roland McGrath  <roland@redhat.com>
+
+	* elf/Makefile ($(objpfx)librtld.map): Use temporary file for output
+	target, so we don't touch it when the link fails.
+
+	* libio/ftello.c (ftello): Use _IO_off64_t for type of POS.
+	Check for the result overflowing off_t and fail with EOVERFLOW.
+	* libio/ioftell.c (_IO_ftell): Likewise.
+	* libio/iofgetpos.c (_IO_new_fgetpos): Likewise.
+
+	* login/logwtmp.c (logwtmp): If sizeof ut_tv != sizeof struct timeval,
+	use a temporary timeval on the stack for gettimeofday and copy it.
+	* login/logout.c (logout): Likewise.
+	Reported by Steven Munroe <sjmunroe@us.ibm.com>.
+
+	* sysdeps/unix/sysv/linux/bits/statfs.h (struct statfs):
+	Use __SWORD_TYPE instead of int for member types.
+	(struct statfs64): Likewise.
+	* sysdeps/unix/sysv/linux/alpha/bits/statfs.h: New file.
+	* sysdeps/unix/sysv/linux/s390/bits/statfs.h: New file.
+	* sysdeps/unix/sysv/linux/ia64/bits/statfs.h: File removed.
+	* sysdeps/unix/sysv/linux/sparc/bits/statfs.h: File removed.
+	* sysdeps/unix/sysv/linux/x86_64/bits/statfs.h: File removed.
+
+	* sysdeps/unix/sysv/linux/sparc/bits/statvfs.h: Moved to ...
+	* sysdeps/unix/sysv/linux/bits/statvfs.h: ... here.
+	(ST_NODIRATIME): Restore fixed value of 2048.
+	* sysdeps/unix/sysv/linux/alpha/bits/statvfs.h: File removed.
+	* sysdeps/unix/sysv/linux/ia64/bits/statvfs.h: File removed.
+
+	Rearranged <bits/types.h> definitions to reduce duplication.
+	* sysdeps/generic/bits/types.h: Rewritten, using macros from
+	<bits/wordsize.h> and new header <bits/typesizes.h>.
+	* posix/Makefile (headers): Add bits/typesizes.h here.
+	* sysdeps/generic/bits/typesizes.h: New file.
+	* sysdeps/unix/sysv/linux/alpha/bits/typesizes.h: New file.
+	* sysdeps/unix/sysv/linux/sparc/bits/typesizes.h: New file.
+	* sysdeps/mach/hurd/bits/typesizes.h: New file.
+	* sysdeps/unix/sysv/linux/alpha/bits/types.h: File removed.
+	* sysdeps/unix/sysv/linux/bits/types.h: File removed.
+	* sysdeps/unix/sysv/linux/ia64/bits/types.h: File removed.
+	* sysdeps/unix/sysv/linux/mips/bits/types.h: File removed.
+	* sysdeps/unix/sysv/linux/s390/bits/types.h: File removed.
+	* sysdeps/unix/sysv/linux/sparc/bits/types.h: File removed.
+	* sysdeps/unix/sysv/linux/x86_64/bits/types.h: File removed.
+	* posix/sys/types.h [__USE_POSIX199506 || __USE_UNIX98]: Include
+	<bits/pthreadtypes.h> here, not in <bits/types.h>.
+	* signal/signal.h: Likewise.
+
+	* streams/stropts.h: Include <bits/xtitypes.h>.
+	* streams/Makefile (headers): Add bits/xtitypes.h here.
+	* sysdeps/generic/bits/xtitypes.h: New file.
+	* sysdeps/s390/bits/xtitypes.h: New file.
+	* sysdeps/ia64/bits/xtitypes.h: New file.
+	* sysdeps/x86_64/bits/xtitypes.h: New file.
+
+	* sysvipc/Makefile (headers): Add bits/ipctypes.h here.
+	* sysdeps/generic/bits/ipctypes.h: New file.
+	* sysdeps/mips/bits/ipctypes.h: New file.
+	* sysdeps/gnu/bits/shm.h: Include <bits/ipctypes.h>.
+	* sysdeps/gnu/bits/msq.h: Likewise.
+	* sysvipc/sys/ipc.h: Likewise.
+
+2002-10-22  Ulrich Drepper  <drepper@redhat.com>
+
+	* elf/dl-load.c (struct filebuf): For buf element to have the
+	alignment of ElfXX_Ehdr since this is what will be stored in it.
+
+2002-10-22  Jakub Jelinek  <jakub@redhat.com>
+
+	* locale/programs/locarchive.c (add_alias): Change locrec_offset arg
+	into pointer to locrec_offset.
+	(add_locale_to_archive): Adjust callers.  Free normalized_name right
+	before returning, not immediately after add_locale, pass it to
+	add_alias if not NULL instead of name.  Rename second normalized_name
+	occurence to nnormalized_codeset_name.
+
+	* locale/programs/locarchive.c (enlarge_archive): Make sure
+	string_size is always a multiple of 4.
+	Reported by Andreas Schwab <schwab@suse.de>.
+
+2002-10-21  Andreas Schwab  <schwab@suse.de>
+
+	* sysdeps/unix/sysv/linux/ia64/syscalls.list (s_execve): Set
+	caller to EXTRA instead of execve, since the latter has a
+	higher-priority implementation in linuxthreads.
+
+2002-10-21  Roland McGrath  <roland@redhat.com>
+
+	* sysdeps/generic/libc-tls.c (__libc_setup_tls): Initialize the static
+	slotinfo list's len member to the proper size, not just 1.
+	Initialize static_map.l_tls_initimage.
+
+	* elf/dl-open.c (dl_open_worker): Fix loop searching for
+	dtv_slotinfo_list element containing new modules' l_tls_modid.
+
+	* elf/tst-tls9.c, elf/tst-tls9-static.c: New files.
+	* elf/tst-tlsmod5.c, elf/tst-tlsmod6.c: New files.
+	* elf/Makefile (tests): Add tst-tls9.
+	(tests-static): Add tst-tls9-static.
+	(tst-tls9-static-ENV): New variable.
+	($(objpfx)tst-tls9-static, $(objpfx)tst-tls9-static.out): New targets.
+
+	* elf/dl-close.c (remove_slotinfo): Remove an assert; the number of
+	modids used by partially loaded modules being closed can't be known.
+
+2002-10-21  Isamu Hasegawa  <isamu@yamato.ibm.com>
+
+	* posix/Makefile: Add a test case for the bug reported by Aharon
+	Robbins <arnold@skeeve.com>.
+	* posix/bug-regex13.c: New file.
+	* posix/regcomp.c (peek_token_bracket): Skip the byte already read.
+
+2002-10-21  Ulrich Drepper  <drepper@redhat.com>
+
+	* csu/gmon-start.c: Pretty printing.
+
+2002-10-19  Art Haas  <ahaas@neosoft.com>
+
+	* configure.in: Replace AC_CONFIG_HEADER with AC_CONFIG_HEADERS,
+	add AC_HELP_STRING to all AC_ARG_WITH and AC_ARG_ENABLE macros,
+	add autoconf quotes to the AC_CONFIG_AUX_DIR macro.
+	* configure: Regenerated.
+
+2002-10-19  Roland McGrath  <roland@redhat.com>
+
+	* configure.in: Call AC_CONFIG_SUBDIRS with empty argument
+	and then set $subdirs directly, because the new Autoconf breaks
+	compatibility in every way imaginable and insists on whining
+	about usage that worked since the dawn of time.
+	* configure: Regenerated.
+
+	* configure: Regenerated (using Autoconf 2.54).
+	* sysdeps/alpha/elf/configure: Likewise.
+	* sysdeps/generic/configure: Likewise.
+	* sysdeps/i386/elf/configure: Likewise.
+	* sysdeps/ia64/elf/configure: Likewise.
+	* sysdeps/mach/hurd/configure: Likewise.
+	* sysdeps/mach/configure: Likewise.
+	* sysdeps/unix/configure: Likewise.
+	* sysdeps/unix/common/configure: Likewise.
+	* sysdeps/unix/sysv/aix/configure: Likewise.
+	* sysdeps/unix/sysv/linux/configure: Likewise.
+	* sysdeps/unix/sysv/linux/mips/configure: Likewise.
+	* sysdeps/x86_64/elf/configure: Likewise.
+
+	* config.make.in: Nix completely-soft nonsense.
+	* configure.in: Likewise.  Under --without-fp, use nofpu subdirectory
+	of machine directories instead of fpu subdirectory.
+	* sysdeps/powerpc/soft-fp/Makefile: Remove cruft added in last change.
+	* sysdeps/powerpc/nofpu/Makefile: Put it in this new file instead.
+	* sysdeps/powerpc/soft-fp/sim-full.c: Moved to ...
+	* sysdeps/powerpc/nofpu/sim-full.c: ... here.
+	* sysdeps/powerpc/soft-fp/fraiseexcpt.c: Moved to ...
+	* sysdeps/powerpc/nofpu/fraiseexcpt.c: ... here.
+	* sysdeps/powerpc/soft-fp/fegetexcept.c: Moved to ...
+	* sysdeps/powerpc/nofpu/fegetexcept.c: ... here.
+	* sysdeps/powerpc/soft-fp/fclrexcpt.c: Moved to ...
+	* sysdeps/powerpc/nofpu/fclrexcpt.c: ... here.
+	* sysdeps/powerpc/soft-fp/ftestexcept.c: Moved to ...
+	* sysdeps/powerpc/nofpu/ftestexcept.c: ... here.
+	* sysdeps/powerpc/soft-fp/fgetexcptflg.c: Moved to ...
+	* sysdeps/powerpc/nofpu/fgetexcptflg.c: ... here.
+	* sysdeps/powerpc/soft-fp/fsetexcptflg.c: Moved to ...
+	* sysdeps/powerpc/nofpu/fsetexcptflg.c: ... here.
+	* sysdeps/powerpc/soft-fp/fedisblxcpt.c: Moved to ...
+	* sysdeps/powerpc/nofpu/fedisblxcpt.c: ... here.
+	* sysdeps/powerpc/soft-fp/feenablxcpt.c: Moved to ...
+	* sysdeps/powerpc/nofpu/feenablxcpt.c: ... here.
+	* sysdeps/powerpc/soft-fp/fegetenv.c: Moved to ...
+	* sysdeps/powerpc/nofpu/fegetenv.c: ... here.
+	* sysdeps/powerpc/soft-fp/fesetenv.c: Moved to ...
+	* sysdeps/powerpc/nofpu/fesetenv.c: ... here.
+	* sysdeps/powerpc/soft-fp/fegetround.c: Moved to ...
+	* sysdeps/powerpc/nofpu/fegetround.c: ... here.
+	* sysdeps/powerpc/soft-fp/fesetround.c: Moved to ...
+	* sysdeps/powerpc/nofpu/fesetround.c: ... here.
+	* sysdeps/powerpc/soft-fp/feupdateenv.c: Moved to ...
+	* sysdeps/powerpc/nofpu/feupdateenv.c: ... here.
+	* sysdeps/powerpc/soft-fp/feholdexcpt.c: Moved to ...
+	* sysdeps/powerpc/nofpu/feholdexcpt.c: ... here.
+	* sysdeps/powerpc/soft-fp/fenv_const.c: Moved to ...
+	* sysdeps/powerpc/nofpu/fenv_const.c: ... here.
+	* sysdeps/powerpc/soft-fp/libm-test-ulps: Moved to ...
+	* sysdeps/powerpc/nofpu/libm-test-ulps: ... here.
+	* sysdeps/powerpc/soft-fp/soft-supp.h: Moved to ...
+	* sysdeps/powerpc/nofpu/soft-supp.h: ... here.
+	* sysdeps/powerpc/soft-fp/Versions (libc: GLIBC_2.3.2): Moved to ...
+	* sysdeps/powerpc/nofpu/Versions: ... here, new file.
+
+2002-10-19  Bruno Haible  <bruno@clisp.org>
+
+	* sysdeps/unix/bsd/bsd4.4/freebsd/sys/sysmacros.h: New file.
+
+2002-10-18  Roland McGrath  <roland@redhat.com>
+
+	* io/Makefile (routines): Add lchmod.
+	* io/sys/stat.h [__USE_BSD] (lchmod): Declare it.
+	* sysdeps/generic/lchmod.c: New file.
+	* sysdeps/mach/hurd/lchmod.c: New file.
+	* io/Versions (libc: GLIBC_2.3.2): New set, add lchmod.
+
+2002-10-18  Art Haas  <ahaas@neosoft.com>
+
+	* configure.in: Remove remaining AC_FD_CC macros, and replace
+	AC_FD_MSG with AS_MESSAGE_FD.
+
+2002-10-18  Roland McGrath  <roland@redhat.com>
+
+	* sysdeps/powerpc/powerpc32/dl-machine.c (__process_machine_rela): Fix
+	typos: VALUE -> FINALADDR.
+
+	* sysdeps/unix/alpha/sysdep.h (INLINE_SYSCALL, INLINE_SYSCALL1)
+	(inline_syscall_clobbers, inline_syscall0, inline_syscall1)
+	(inline_syscall2, inline_syscall3, inline_syscall4, inline_syscall5)
+	(inline_syscall6): Move these macros ...
+	* sysdeps/unix/sysv/linux/alpha/sysdep.h: ... to here.
+
+	* configure.in (libc_link_dests, libc_link_sources): Remove these
+	variables and the AC_LINK_FILES call.
+
+	* sysdeps/powerpc/soft-fp/Versions (libc: GLIBC_2.3.2): Fix last
+	change to put new symbols here instead of in GLIBC_2.2.
+	* sysdeps/powerpc/Subdirs: Move this file ...
+	* sysdeps/powerpc/soft-fp/Subdirs: ... here.
+
+2002-10-07  Roland McGrath  <roland@redhat.com>
+
+	* sysdeps/generic/bits/time.h: Replaced with contents of the
+	sysdeps/unix/sysv/linux/i386/bits/time.h file.  All the following
+	files were identical except for the absence of CLOCK_THREAD_CPUTIME_ID
+	and CLOCK_PROCESS_CPUTIME_ID in .../linux/bits/time.h; adding these
+	macros is ok even for architectures that don't now implement them.
+	* sysdeps/mach/hurd/bits/time.h: File removed.
+	* sysdeps/unix/sysv/linux/bits/time.h: File removed.
+	* sysdeps/unix/sysv/linux/i386/bits/time.h: File removed.
+	* sysdeps/unix/sysv/linux/ia64/bits/time.h: File removed.
+	* sysdeps/unix/sysv/linux/sparc/bits/time.h: File removed.
+	* sysdeps/unix/sysv/linux/x86_64/bits/time.h: File removed.
+
+2002-10-18  Jeff Bailey  <jbailey@gnu.org>
+
+	* configure.in: Replace obsolete AC_OUTPUT syntax with
+	AC_CONFIG_FILES, AC_CONFIG_COMMANDS, and new-type AC_OUTPUT trio.
+
+	* aclocal.m4 (GLIBC_PROVIDES): Add AC_PROVIDEs for
+	_AS_PATH_SEPARATOR_PREPARE and _AS_TEST_PREPARE.
+
+	* configure.in: Replace AC_FD_CC with AS_MESSAGE_LOG_FD.
+	* sysdeps/alpha/elf/configure.in: Likewise.
+	* sysdeps/i386/elf/configure.in: Likewise.
+	* sysdeps/mach/hurd/configure.in: Likewise.
+	* sysdeps/x86_64/elf/configure.in: Likewise.
+
+	* configure.in: Use AC_CONFIG_SRCDIR and new AC_INIT syntax.
+
+	* sysdeps/alpha/elf/configure.in: Remove unneeded sinclude statement.
+	* sysdeps/generic/configure.in: Likewise.
+	* sysdeps/i386/elf/configure.in: Likewise.
+	* sysdeps/ia64/elf/configure.in: Likewise.
+	* sysdeps/mach/configure.in: Likewise.
+	* sysdeps/mach/hurd/configure.in: Likewise.
+	* sysdeps/unix/configure.in: Likewise.
+	* sysdeps/unix/common/configure.in: Likewise.
+	* sysdeps/unix/sysv/aix/configure.in: Likewise.
+	* sysdeps/unix/sysv/linux/configure.in: Likewise.
+	* sysdeps/unix/sysv/linux/mips/configure.in: Likewise.
+	* sysdeps/x86_64/elf/configure.in: Likewise.
+
+	* aclocal.m4: Use just the bits from AS_INIT that are needed for the
+	GLIBC_PROVIDES.  Use plain comment instead of HEADER-COMMENT so
+	that it's obvious when extra autoconf machinery is being dragged in.
+
+2002-10-18  Roland McGrath  <roland@redhat.com>
+
+	* configure.in: Remove bogus echo included in
+	2002-10-08  Aldy Hernandez  <aldyh@redhat.com> change.
+	* configure: Regenerated.
+
+2002-10-18  Jakub Jelinek  <jakub@redhat.com>
+
+	* sysdeps/unix/sysv/linux/pathconf.h (statfs_link_max): Add inline.
+	(statfs_filesize_max): New function.
+	* sysdeps/unix/sysv/linux/linux_fsinfo.h (JFFS_SUPER_MAGIC,
+	JFFS2_SUPER_MAGIC, JFS_SUPER_MAGIC, NTFS_SUPER_MAGIC,
+	ROMFS_SUPER_MAGIC, UDF_SUPER_MAGIC): Define.
+	* sysdeps/unix/sysv/linux/fpathconf.c (__fpathconf): Use
+	statfs_filesize_max.
+	* sysdeps/unix/sysv/linux/pathconf.c (__pathconf): Likewise.
+	* sysdeps/unix/sysv/linux/alpha/fpathconf.c: Removed.
+	* sysdeps/unix/sysv/linux/alpha/pathconf.c: Removed.
+
+2002-10-17  Roland McGrath  <roland@redhat.com>
+
+	* configure.in (MIG): Just AC_SUBST it here.
+	* configure: Regenerated.
+	* sysdeps/mach/configure.in (MIG): Do the AC_CHECK_TOOL here.
+	Adding final - argument to all AC_CHECK_HEADER uses for .defs files.
+	* sysdeps/mach/configure: Regenerated.
+
+	* aclocal.m4 (GLIBC_PROVIDES): Add AC_PROVIDE([_AS_TR_SH_PREPARE])
+	and AC_PROVIDE([_AS_CR_PREPARE]).
+
+	* aclocal.m4 (GLIBC_PROVIDES): Add AC_PROVIDE([_AS_ECHO_N_PREPARE]).
+	Remove AC_LANG(C) call, instead just define([_AC_LANG], [C]).
+
+	* elf/dl-support.c: Move _dl_tls_* variables to ...
+	* sysdeps/generic/libc-tls.c: ... here.
+
+	* elf/dl-close.c (remove_slotinfo): Take new argument.  If false,
+	allow IDX to be one past the current last slotinfo entry.
+	(_dl_close): Pass IMAP->l_init_called for that parameter.
+
+2002-10-07  Andreas Schwab  <schwab@suse.de>
+
+	* aclocal.m4: Fix for autoconf 2.53.
+	* configure.in: Likewise.  Require autoconf 2.53.
+
+2002-10-08  Richard Henderson  <rth@redhat.com>
+
+	* soft-fp/op-4.h: Handle carry correctly in
+	__FP_FRAC_ADD_3, __FP_FRAC_ADD_4, __FP_FRAC_SUB_3,
+	__FP_FRAC_SUB_4, __FP_FRAC_DEC_3, __FP_FRAC_DEC_4.
+	* soft-fp/op-common.h: New macros _FP_DIV_MEAT_N_loop.
+
+2002-10-08  Aldy Hernandez  <aldyh@redhat.com>
+
+	* configure.in: Compute completely-soft.
+	* config.make.in: Make completely-soft available to sub-makes.
+	* sysdeps/powerpc/soft-fp/Makefile: Add gcc-single-routines and
+	gcc-double-routines.  Add sim-full.c.  Add fenv_const and
+	fe_nomask to libm-support.
+	* sysdeps/powerpc/soft-fp/sim-full.c: New file.
+	* sysdeps/powerpc/soft-fp/fraiseexcpt.c: New file.
+	* sysdeps/powerpc/soft-fp/fegetexcept.c: New file.
+	* sysdeps/powerpc/soft-fp/fclrexcpt.c: New file.
+	* sysdeps/powerpc/soft-fp/ftestexcept.c: New file.
+	* sysdeps/powerpc/soft-fp/fgetexcptflg.c: New file.
+	* sysdeps/powerpc/soft-fp/fsetexcptflg.c: New file.
+	* sysdeps/powerpc/soft-fp/fedisblxcpt.c: New file.
+	* sysdeps/powerpc/soft-fp/feenablxcpt.c: New file.
+	* sysdeps/powerpc/soft-fp/fegetenv.c: New file.
+	* sysdeps/powerpc/soft-fp/fesetenv.c: New file.
+	* sysdeps/powerpc/soft-fp/fegetround.c: New file.
+	* sysdeps/powerpc/soft-fp/fesetround.c: New file.
+	* sysdeps/powerpc/soft-fp/feupdateenv.c: New file.
+	* sysdeps/powerpc/soft-fp/feholdexcpt.c: New file.
+	* sysdeps/powerpc/soft-fp/fenv_const.c: New file.
+	* sysdeps/powerpc/soft-fp/libm-test-ulps: New file.
+	* sysdeps/powerpc/soft-fp/soft-supp.h: New file.
+	* sysdeps/powerpc/soft-fp/Versions: Add libgcc soft-float
+	symbols.  Add __sim_disabled_exceptions, __sim_exceptions,
+	__sim_round_mode.
+	* sysdeps/powerpc/soft-float/Dist: Add sim-full.c, fenv_const.c.
+	* sysdeps/powerpc/soft-float/sfp-machine.h: Define
+	FP_HANDLE_EXCEPTIONS.
+	Define FP_ROUNDMODE.
+	Redefine FP_* macros to correspond to the FE_* bit positions.
+	Define FP_DIV_MEAT_S to _FP_DIV_MEAT_1_loop.
+	Define externs for __sim_exceptions, __sim_disabled_exceptions,
+	__sim_round_mode, __simulate_exceptions.
+	* sysdeps/powerpc/fpu/bits/fenv.h: Move file from here...
+	* sysdeps/powerpc/bits/fenv.h: ...to here.
+
+2002-10-06  Jakub Jelinek  <jakub@redhat.com>
+
+	* sysdeps/powerpc/powerpc32/dl-machine.c (__process_machine_rela):
+	Store R_PPC_UADDR32 and R_PPC_UADDR16 one byte at a time.
+	Use __builtin_expect for R_PPC_ADDR24 overflow check.  Fix
+	R_PPC_ADDR16, R_PPC_UADDR16 and R_PPC_ADDR14* overflow check, use
+	__builtin_expect.
+
+2002-10-15  Jakub Jelinek  <jakub@redhat.com>
+
+	* include/resolv.h (__libc_res_nquery, __libc_res_nsearch,
+	__libc_res_nsend): New prototypes.
+	* resolv/res_query.c (QUERYSIZE): Define.
+	(__libc_res_nquery): Renamed from res_nquery.  Added answerp
+	argument.  Allocate only QUERYSIZE bytes first, if res_nmkquery
+	fails use MAXPACKET buffer.  Call __libc_res_nsend instead of
+	res_nsend, pass answerp.
+	(res_nquery): Changed into wrapper around __libc_res_nquery.
+	(__libc_res_nsearch): Renamed from res_nsearch.  Added answerp
+	argument.  Call __libc_res_nquerydomain and __libc_res_nquery
+	instead of the non-__libc_ variants, pass them answerp.
+	(res_nsearch): Changed into wrapper around __libc_res_nsearch.
+	(__libc_res_nquerydomain): Renamed from res_nquerydomain.
+	Added answerp argument.  Call __libc_res_nquery instead of
+	res_nquery, pass answerp.
+	(res_nquerydomain): Changed into wrapper around
+	__libc_res_nquerydomain.
+	* resolv/res_send.c: Include sys/ioctl.h.
+	(MAXPACKET): Define.
+	(send_vc): Change arguments.  Reallocate answer buffer if it is
+	too small.
+	(send_dg): Likewise.
+	(__libc_res_nsend): Renamed from res_nsend.  Added ansp argument.
+	Reallocate answer buffer if it is too small and hooks are in use.
+	Adjust calls to send_vc and send_dg.
+	(res_nsend): Changed into wrapper around __libc_res_nsend.
+	* resolv/nss_dns/dns-host.c (_nss_dns_gethostbyname2_r): Allocate
+	just 1K answer buffer on the stack, use __libc_res_nsearch instead
+	of res_nsearch.
+	(_nss_dns_gethostbyaddr_r): Similarly with __libc_res_nquery.
+	* resolv/nss_dns/dns-network.c (_nss_dns_getnetbyaddr_r): Likewise.
+	(_nss_dns_getnetbyname_r): Similarly with __libc_res_nsearch.
+	* resolv/gethnamaddr.c (gethostbyname2): Likewise.
+	(gethostbyaddr): Similarly with __libc_res_nquery.
+	* resolv/Versions (libresolv): Export __libc_res_nquery and
+	__libc_res_nsearch at GLIBC_PRIVATE.
+
+2002-10-17  Roland McGrath  <roland@redhat.com>
+
+	* configure.in: Grok --without-__thread and disable HAVE___THREAD.
+	* configure: Regenerated.
+
+	* sysdeps/x86_64/dl-machine.h (elf_machine_rela): Do CHECK_STATIC_TLS
+	before performing the reloc, not after.
+	* sysdeps/i386/dl-machine.h (elf_machine_rel): Likewise.
+
+2002-10-17  Ulrich Drepper  <drepper@redhat.com>
+
+	* locale/programs/locale.c (write_locales): Use 'm' flag in fopen call.
+	* locale/programs/linereader.c (lr_open): Likewise.
+	* locale/programs/charmap-dir.c (charmap_open): Likewise.
+	* locale/programs/locarchive.c (add_locale_to_archive): Likewise.
+
+2002-10-17  Isamu Hasegawa  <isamu@yamato.ibm.com>
+
+	* posix/bug-regex11.c: Add a test case for the bug reported by
+	Paolo Bonzini <bonzini@gnu.org>.
+	* posix/regexec.c (sift_states_bkref): Use correct destination of
+	the back reference.
+
+2002-10-17  Roland McGrath  <roland@redhat.com>
+
+	* elf/dl-load.c (_dl_map_object_from_fd): Don't check DF_STATIC_TLS.
+	* elf/dl-reloc.c (_dl_relocate_object: CHECK_STATIC_TLS): New macro
+	to signal error if an IE-model TLS reloc resolved to a dlopen'd module.
+	* sysdeps/i386/dl-machine.h (elf_machine_rel, elf_machine_rela):
+	Call it after performing TPOFF relocs.
+	* sysdeps/x86_64/dl-machine.h (elf_machine_rela): Likewise.
+	* sysdeps/sh/dl-machine.h (elf_machine_rela): Likewise.
+	* elf/dl-conflict.c (CHECK_STATIC_TLS): New macro (no-op).
+
+	* elf/dl-close.c (remove_slotinfo): Change asserts so as not to crash
+	when closing a partially-initialized object.
+
+	* elf/dl-load.c (_dl_map_object_from_fd) [! USE_TLS]: Call lose
+	instead of _dl_fatal_printf when we see PT_TLS.
+
+	* Makeconfig (CPPFLAGS): Fix last change to use $(libof-$(<F))
+	instead of $(libof-$<).
+
+2002-10-16  Roland McGrath  <roland@redhat.com>
+
+	* cppflags-iterator.mk (CPPFLAGS-$(cpp-src)): Variable removed.
+	instead of += to append, to be sure $(lib) gets expanded at defn time.
+	(libof-$(cpp-src)): New variable, define this instead.
+	* extra-lib.mk (cpp-srcs-left): Reduce duplication in include setup.
+	(lib): Don't use override.
+	(CPPFLAGS-$(lib)): New variable, put -D's here.
+	* Makeconfig (CPPFLAGS): Use basename fn for CPPFLAGS-basename.
+	Also add $(CPPFLAGS-LIB) before the file-specific flags, for each
+	LIB found by $(libof-*) for basename, target, or source.
+	* Makerules (CPPFLAGS-nonlib): New variable.
+	* nscd/Makefile (lib): Set to nonlib when using cppflags-iterator.mk.
+	* locale/Makefile (lib): Likewise.
+	* sunrpc/Makefile (lib): Likewise.
+
+	* sysdeps/unix/sysv/linux/fpathconf.c (LINUX_LINK_MAX): Move macro ...
+	* sysdeps/unix/sysv/linux/linux_fsinfo.h (LINUX_LINK_MAX): ... here.
+	* sysdeps/unix/sysv/linux/pathconf.h: New file.
+	(statfs_link_max): New function, guts from fpathconf.c.
+	* sysdeps/unix/sysv/linux/fpathconf.c: Rewritten using that.
+	* sysdeps/unix/sysv/linux/pathconf.c (__pathconf): Likewise.
+	* sysdeps/unix/sysv/linux/alpha/pathconf.c (__pathconf): Rewritten
+	to use the linux/pathconf.c code by #include rather than duplication.
+	* sysdeps/unix/sysv/linux/alpha/fpathconf.c (__pathconf): Likewise.
+
+2002-10-16  Jakub Jelinek  <jakub@redhat.com>
+
+	* sysdeps/unix/sysv/linux/x86_64/sysdep.h (SYSCALL_ERROR_HANDLER):
+	Use __libc_errno only for libc itself.
+
+2002-10-16  Andreas Jaeger  <aj@suse.de>
+
+	* sysdeps/x86_64/_mcount.S: Fix off-by-1 error in argument access.
+
+2002-10-16  Ulrich Drepper  <drepper@redhat.com>
+
+	* sysdeps/unix/sysv/linux/i386/sysdep.h (SYSCALL_ERROR_HANDLER):
+	Use __libc_errno only for libc itself.
+
+2002-10-15  Roland McGrath  <roland@redhat.com>
+	    Jakub Jelinek  <jakub@redhat.com>
+
+	* sysdeps/unix/sysv/linux/Makefile
+	($(objpfx)syscall-%.h $(objpfx)syscall-%.d): Take code from
+	sparc/Makefile to produce a bi-arch file as needed.
+	That's now parameterized by the variable $(64bit-predefine).
+	Use LC_ALL=C for `comm' commands in that rule.
+	No longer conditional on [$(no_syscall_list_h)].
+	* sysdeps/unix/sysv/linux/sparc/Makefile: Remove replacement rules.
+	(64bit-predefine): New variable.
+	* sysdeps/unix/sysv/linux/x86_64/Makefile: Likewise.
+	* sysdeps/unix/sysv/linux/s390/Makefile: New file.
+	* sysdeps/unix/sysv/linux/powerpc/Makefile
+	(64bit-predefine): New variable.
+
+2002-10-15  Roland McGrath  <roland@redhat.com>
+
+	* sysdeps/unix/sysv/linux/Makefile
+	($(objpfx)syscall-%.h $(objpfx)syscall-%.d)
+
+	* login/utmp-private.h: Declare __libc_utmp_lock.
+	* sysdeps/unix/getlogin_r.c (getlogin_r): Take __libc_utmp_lock once
+	and call __libc_utmp_jump_table functions directly, instead of using
+	__setutent et al.
+
+	* sysdeps/unix/sysv/linux/configure.in: Use case instead of if.
+	* sysdeps/unix/sysv/linux/configure: Regenerated.
+
+	* sysdeps/gnu/bits/utmp.h: Include <bits/wordsize.h>.
+	(struct lastlog) [__WORDSIZE == 64 && __WORDSIZE_COMPAT32]:
+	Use int32_t for ll_time.
+	(struct utmp) [__WORDSIZE == 64 && __WORDSIZE_COMPAT32]:
+	Use int32_t instead of long int for ut_session.
+	Use an anonymous struct with 32-bit fields for ut_tv.
+	* sysdeps/gnu/bits/utmpx.h: Include <bits/wordsize.h>.
+	(struct utmpx) [__WORDSIZE == 64 && __WORDSIZE_COMPAT32]: Do the same
+	here as in utmp.h for `struct utmp'.
+	* sysdeps/unix/sysv/linux/powerpc/bits/utmp.h: File removed.
+	* sysdeps/unix/sysv/linux/powerpc/bits/utmpx.h: File removed.
+	* sysdeps/unix/sysv/linux/sparc/bits/utmp.h: File removed.
+	* sysdeps/unix/sysv/linux/sparc/bits/utmpx.h: File removed.
+	* sysdeps/unix/sysv/linux/x86_64/bits/utmp.h: File removed.
+	* sysdeps/unix/sysv/linux/x86_64/bits/utmpx.h: File removed.
+
+	* sysdeps/unix/sysv/linux/bits/resource.h: Replaced with the contents
+	of the sysdeps/unix/sysv/linux/i386/bits/resource.h file.
+	All the following files were identical or equivalent to it.
+	* sysdeps/unix/sysv/linux/i386/bits/resource.h: File removed.
+	* sysdeps/unix/sysv/linux/arm/bits/resource.h: File removed.
+	* sysdeps/unix/sysv/linux/cris/bits/resource.h: File removed.
+	* sysdeps/unix/sysv/linux/hppa/bits/resource.h: File removed.
+	* sysdeps/unix/sysv/linux/ia64/bits/resource.h: File removed.
+	* sysdeps/unix/sysv/linux/m68k/bits/resource.h: File removed.
+	* sysdeps/unix/sysv/linux/powerpc/bits/resource.h: File removed.
+	* sysdeps/unix/sysv/linux/s390/bits/resource.h: File removed.
+	* sysdeps/unix/sysv/linux/sh/bits/resource.h: File removed.
+	* sysdeps/unix/sysv/linux/x86_64/bits/resource.h: File removed.
+
+	* sysdeps/unix/sysv/linux/bits/socket.h (struct msghdr): Use size_t
+	instead of int for msg_iovlen, instead of socklen_t for msg_controllen.
+	Other than the previously incorrect sign of msg_iovlen, this is a
+	no-op on 32-bit platforms.  On 64-bit platforms it makes this header
+	match their layouts as well, so the following are now identical to it.
+	* sysdeps/unix/sysv/linux/s390/bits/socket.h: File removed.
+	* sysdeps/unix/sysv/linux/sparc/bits/socket.h: File removed.
+	* sysdeps/unix/sysv/linux/x86_64/bits/socket.h: File removed.
+	* sysdeps/unix/sysv/linux/ia64/bits/socket.h: File removed.
+	* sysdeps/unix/sysv/linux/alpha/bits/socket.h: File removed.
+
+2002-10-15  Ulrich Drepper  <drepper@redhat.com>
+
+	* sysdeps/unix/sysv/linux/kernel-features.h (__ASSUME_VFORK_SYSCALL):
+	Define for 2.4+ kernels.
+
+	* sysdeps/unix/sysv/linux/i386/vfork.S: Optimize for kernels which
+	are known to have the vfork syscall.  Don't confuse the CPUs
+	branch prediction unit by jumping to the return address.
+
+	* sysdeps/unix/sysv/linux/alpha/fpathconf.c (__fpathconf): Add
+	support for reiserfs and xfs.
+
+	* sysdeps/unix/sysv/linux/fpathconf.c (__fpathconf): Add case for
+	XFS link count.
+	* sysdeps/unix/sysv/linux/linux_fsinfo.h: Define XFS_SUPER_MAGIC
+	and XFS_LINK_MAX.
+	Patch by Eric Sandeen <sandeen@sgi.com> [PR libc/4706].
+
+2002-10-16  Jakub Jelinek  <jakub@redhat.com>
+
+	* include/libc-symbols.h (attribute_tls_model_ie): Define.
+	* include/errno.h (errno): Define to __libc_errno in libc.so.
+	Add attribute_tls_model_ie.
+	* include/netdb.h (h_errno): Define to __libc_h_errno in libc.so.
+	Add attribute_tls_model_ie.
+	* include/resolv.h (_res): Define to __libc_res in libc.so.  Add
+	attribute_tls_model_ie.
+	* inet/herrno.c (__libc_h_errno): Add hidden alias to h_errno.
+	(h_errno): Define.
+	* resolv/res_libc.c (__libc_res): Add hidden alias to _res.
+	(_res): Define.
+	* sysdeps/generic/bits/libc-tsd.h (__libc_tsd_define): Add
+	attribute_tls_model_ie.
+	* sysdeps/generic/errno-loc.c (errno): Only undefine if not using
+	__thread.
+	* sysdeps/generic/errno.c (__libc_errno): Add hidden alias to errno.
+	* sysdeps/unix/sysv/linux/i386/sysdep.h (SYSCALL_ERROR_HANDLER): Use
+	__libc_errno in USE___THREAD case.
+	* sysdeps/unix/sysv/linux/x86_64/sysdep.h (SYSCALL_ERROR_HANDLER):
+	Likewise.
+	* configure.in (HAVE_TLS_MODEL_ATTRIBUTE): Check for
+	__attribute__((tls_model (""))).
+	* configure: Rebuilt.
+	* config.h.in (HAVE_TLS_MODEL_ATTRIBUTE): Add.
+
+2002-10-15  Ulrich Drepper  <drepper@redhat.com>
+
+	* timezone/asia: Update from tzdata2002d.
+	* timezone/australasia: Likewise.
+	* timezone/iso3166.tab: Likewise.
+	* timezone/southamerica: Likewise.
+	* timezone/zone-tab: Likewise.
+
+2002-10-15  Roland McGrath  <roland@redhat.com>
+
+	* sysdeps/generic/dl-tls.c (_dl_deallocate_tls) [TLS_TCB_AT_TP]:
+	Adjust TCB pointer before calling free, so we get the whole block.
+
+2002-10-14  Roland McGrath  <roland@redhat.com>
+
+	* sysdeps/unix/sysv/linux/x86_64/sigaction.c
+	[HAVE_HIDDEN && !HAVE_BROKEN_VISIBILITY_ATTRIBUTE]: Declare restore_rt
+	extern using attribute_hidden instead of static, avoids warning.
+
+2002-10-09  Jakub Jelinek  <jakub@redhat.com>
+
+	* sysdeps/unix/sysv/linux/configure.in: Use */lib64 for s390x too.
+	* sysdeps/unix/sysv/linux/configure: Rebuilt.
+
+2002-10-14  Ulrich Drepper  <drepper@redhat.com>
+
+	* po/sv.po: Update from translation team.
+
+2002-10-12  H.J. Lu  <hjl@gnu.org>
+
+	* sunrpc/thrsvc.c (PROCQUIT): New.
+	(struct rpc_arg): New.
+	(dispatch): Call exit (0) if request->rq_proc == PROCQUIT.
+	(test_one_call): Take struct rpc_arg * instead of CLIENT *c.
+	(thread_wrapper): Modified for struct rpc_arg * and call PROCQUIT.
+	(main): Modified for struct rpc_arg *.
+
+2002-10-14  Ulrich Drepper  <drepper@redhat.com>
+
+	* dirent/scandir.c: Rearrange code a bit to reduce binary size.
+
+2002-10-14  Jakub Jelinek  <jakub@redhat.com>
+
+	* sysdeps/unix/sysv/linux/x86_64/sysdep.h: Include tls.h.
+	(SYSCALL_ERROR_HANDLER): Use RTLD_PRIVATE_ERRNO sequence
+	in ld.so even if __thread is supported.
+
+2002-10-13  Jakub Jelinek  <jakub@redhat.com>
+
+	* sysdeps/unix/sysv/linux/arm/profil-counter.h (profil_counter):
+	Add hack to prevent the compiler from clobbering the signal context.
+	* sysdeps/unix/sysv/linux/sh/profil-counter.h (profil_counter):
+	Likewise.
+	* sysdeps/unix/sysv/linux/x86_64/profil-counter.h (profil_counter):
+	Likewise.
+
+2002-10-14  Andreas Jaeger  <aj@suse.de>
+
+	* sysdeps/mips/fpu/libm-test-ulps: Regenerated by
+	Guido Guenther <agx@sigxcpu.org>.
+
+2002-10-14  Ulrich Drepper  <drepper@redhat.com>
+
+	* po/sk.po: Update from translation team.
+
+2002-09-26  Roland McGrath  <roland@redhat.com>
+
+	* elf/dl-load.c (_dl_dst_count, _dl_dst_substitute): Handle $LIB
+	dynamic string tag.
+	* elf/Makefile ($(objpfx)trusted-dirs.st): Make the output define
+	DL_DST_LIB based on $(slibdir).
+
+2002-10-13  Roland McGrath  <roland@frob.com>
+
+	* elf/rtld-Rules ($(objpfx)rtld-libc.a): Use $(verbose) in ar command.
+
+	* sysdeps/mach/hurd/getresuid.c: New file.
+	* sysdeps/mach/hurd/getresgid.c: New file.
+	* sysdeps/mach/hurd/setresuid.c: New file.
+	* sysdeps/mach/hurd/setresgid.c: New file.
+
+	* posix/unistd.h [__USE_GNU] (getresuid, getresgid, setresuid,
+	setresgid): Declare them.
+	* NEWS: Mention it.
+	* include/unistd.h
+	(__getresuid, __getresgid, __setresuid, __setresgid): Declare them,
+	add libc_hidden_proto.
+	* posix/Versions (libc: GLIBC_2.3.2): New set.  Add
+	getresuid, getresgid, setresuid, setresgid here.
+	* Versions.def (libc): Define GLIBC_2.3.2 set.
+	* sysdeps/generic/getresuid.c (__getresuid): Fix argument types.
+	Add libc_hidden_def.
+	* sysdeps/generic/getresgid.c (__getresgid): Likewise.
+	* sysdeps/generic/setresgid.c: New file.
+	* sysdeps/generic/setresuid.c: New file.
+	* sysdeps/unix/sysv/linux/Makefile [$(subdir) = misc]
+	(sysdep_routines): Don't add getresuid and getresgid here.
+	* sysdeps/unix/sysv/linux/arm/Makefile [$(subdir) = misc]
+	(sysdep_routines): Don't add setresuid and setresgid here.
+	* sysdeps/unix/sysv/linux/cris/Makefile: Likewise.
+	* sysdeps/unix/sysv/linux/sh/Makefile: Likewise.
+	* sysdeps/unix/sysv/linux/s390/s390-32/Makefile: Likewise.
+	* sysdeps/unix/sysv/linux/s390/s390-64/Makefile: Likewise.
+	* sysdeps/unix/sysv/linux/i386/Makefile: Likewise.
+	* sysdeps/unix/sysv/linux/m68k/Makefile: Likewise.
+	* posix/Makefile (routines): Add them all here instead.
+	* sysdeps/unix/sysv/linux/i386/getresuid.c (getresuid): Renamed to
+	__getresuid.  Add libc_hidden_def for that, and weak alias to old name.
+	* sysdeps/unix/sysv/linux/i386/getresgid.c (getresgid): Renamed to
+	__getresgid.  Add libc_hidden_def for that, and weak alias to old name.
+	* sysdeps/unix/sysv/linux/i386/setresuid.c: Add libc_hidden_def.
+	[! __NR_setresuid]: Include generic file.
+	* sysdeps/unix/sysv/linux/i386/setresgid.c (setresgid): Renamed to
+	__setresgid.  Add libc_hidden_def for that, and weak alias to old name.
+	[! __NR_setresuid]: Include generic file.
+	* sysdeps/unix/sysv/linux/syscalls.list (setresuid, setresgid):
+	Caller is - now, not EXTRA.
+	* sysdeps/unix/sysv/linux/sparc/sparc32/syscalls.list
+	(setresuid, setresgid, getresuid, getresgid): Likewise.
+	* sysdeps/unix/sysv/linux/syscalls.list (getresuid, getresgid):
+	Add these calls here.
+	* sysdeps/unix/sysv/linux/alpha/syscalls.list: Remove them here.
+	* sysdeps/unix/sysv/linux/hppa/syscalls.list: Likewise.
+	* sysdeps/unix/sysv/linux/sparc/sparc64/syscalls.list: Likewise.
+	* sysdeps/unix/sysv/linux/s390/s390-64/syscalls.list: Likewise.
+	* sysdeps/unix/sysv/linux/x86_64/syscalls.list: Likewise.
+	* sysdeps/unix/sysv/linux/powerpc/powerpc32/syscalls.list: Likewise.
+	* sysdeps/unix/sysv/linux/powerpc/powerpc64/syscalls.list: Likewise.
+	* sysdeps/unix/sysv/linux/mips/syscalls.list: Likewise.
+	* sysdeps/unix/sysv/linux/ia64/syscalls.list: Likewise.
+
+	* sysdeps/unix/sysv/linux/Makefile [$(subdir) = misc]
+	(sysdep_routines): Add setfsuid and setfsgid here.
+	* sysdeps/unix/sysv/linux/arm/Makefile: Not here.
+	* sysdeps/unix/sysv/linux/sparc/sparc32/Makefile: Likewise.
+	* sysdeps/unix/sysv/linux/cris/Makefile: Likewise.
+	* sysdeps/unix/sysv/linux/sh/Makefile: Likewise.
+	* sysdeps/unix/sysv/linux/s390/s390-32/Makefile: Likewise.
+	* sysdeps/unix/sysv/linux/s390/s390-64/Makefile: Likewise.
+	* sysdeps/unix/sysv/linux/i386/Makefile: Likewise.
+	* sysdeps/unix/sysv/linux/m68k/Makefile: Likewise.
+
+	* hurd/errno.c: Renamed to ...
+	* hurd/errno-loc.c: ... this.
+	* hurd/Makefile (routines): errno -> errno-loc
+
+2002-10-13  Ulrich Drepper  <drepper@redhat.com>
+
+	* po/de.po: Update from translation team.
+
+	* MakeTAGS: Add -E flag to xgettext runs.
+
+2002-10-12  Ulrich Drepper  <drepper@redhat.com>
+
+	* po/fr.po: Update from translation team.
+
+	* sysdeps/posix/system.c: Remove support for old and buggy SCO systems.
+	Optimize a bit for use in glibc.
+
+2002-10-12  Roland McGrath  <roland@redhat.com>
+
+	* stdio-common/tst-rndseek.c (TIMEOUT): Increase to 10 seconds.
+	Some machines are slow.  Guido Guenther <agx@sigxcpu.org> has one.
+
+2002-10-12  Ulrich Drepper  <drepper@redhat.com>
+
+	* po/sv.po: Update from translation team.
+
+2002-10-11  Isamu Hasegawa  <isamu@yamato.ibm.com>
+
+	* posix/regcomp.c (re_compile_fastmap_iter): Remove the handling
+	OP_CONTEXT_NODE.
+	(regfree): Likewise.
+	(create_initial_state): Likewise.
+	(analyze): Remove the substitutions which became useless.
+	(calc_first): Likewise.
+	(calc_epsdest): Use edests of OP_BACK_REF in case that it has
+	epsilon destination.
+	(duplicate_node_closure): New function.
+	(duplicate_node): Remove the handling OP_CONTEXT_NODE.
+	(calc_inveclosure): Likewise.
+	(calc_eclosure): Likewise.
+	(calc_eclosure_iter): Invoke duplicate_node_closure instead of
+	direct invocation of duplicate_node.
+	(parse): Don't use comma operator in the return to avoid compiler
+	warning.
+	(parse_reg_exp): Likewise.
+	(parse_branch): Likewise.
+	(parse_expression): Likewise.
+	(parse_sub_exp): Likewise.
+	(parse_dup_op): Likewise.
+	* posix/regex_internal.c (re_dfa_add_node): Remove the substitutions
+	which became useless.
+	(create_ci_newstate): Remove the handling OP_CONTEXT_NODE.
+	(create_cd_newstate): Likewise.
+	* posix/regex_internal.h (re_token_type_t): Remove the obsolete type.
+	(re_token_t): Likewise.
+	(re_dfa_t): Likewise.
+	(re_node_set_remove): New macro.
+	* posix/regexec.c (check_matching): Remove the handling
+	OP_CONTEXT_NODE.
+	(check_halt_node_context): Likewise.
+	(proceed_next_node): Likewise.
+	(pop_fail_stack): Fix the memory leak.
+	(set_regs): Likewise.
+	(free_fail_stack_return): New function.
+	(sift_states_backward): Fix the memory leak.  Remove the handling
+	OP_CONTEXT_NODE.
+	(update_cur_sifted_state): Append some if clause to avoid redundant
+	call.
+	(sub_epsilon_src_nodes): Use IS_EPSILON_NODE since it might be a
+	back reference.
+	(check_dst_limits): Remove the handling OP_CONTEXT_NODE.
+	(check_subexp_limits): Likewise.
+	(search_subexp): Likewise.
+	(sift_states_bkref): Likewise.
+	(transit_state_mb): Likewise.
+	(transit_state_bkref_loop): Likewise.
+	(transit_state_bkref_loop): Likewise.
+	(group_nodes_into_DFAstates): Likewise.
+	(check_node_accept): Likewise.
+	(sift_ctx_init): Add initializing.
+
+2002-10-12  Ulrich Drepper  <drepper@redhat.com>
+
+	* sysdeps/unix/sysv/linux/i386/sysdep.h (INLINE_SYSCALL): Use
+	__builtin_expect.
+
+2002-10-11  Ulrich Drepper  <drepper@redhat.com>
+
+	* elf/dl-load.c (_dl_map_object_from_fd): Remove unnecessarily
+	duplicated variable c.
+
+	* sysdeps/unix/sysv/linux/sigwait.c (__sigwait): Use INTERNAL_SYSCALL
+	if possible.
+
+	* sysdeps/unix/sysv/linux/i386/sysdep.h
+	(INTERNAL_SYSCALL_ERROR_P): New define.
+	(INTERNAL_SYSCALL_ERRNO): Likewise.
+
+	* sysdeps/unix/sysv/linux/i386/profil-counter.h (profil_counter):
+	Add hack to prevent the compiler from clobbering the signal context.
+
+2002-10-11  Roland McGrath  <roland@redhat.com>
+
+	* sysdeps/unix/sysv/linux/x86_64/sysdep.h (SYSCALL_ERROR_HANDLER):
+	Fix typos.
+
+	* sysdeps/generic/dl-lookupcfg.h: Include <tls.h>.
+	* sysdeps/sh/dl-lookupcfg.h: File removed.
+	* sysdeps/i386/dl-lookupcfg.h: File removed.
+
+	* sysdeps/unix/sysv/linux/x86_64/sysdep.h (SYSCALL_ERROR_HANDLER): Add
+	missing labels and ; from last change.
+
+	* stdio-common/tst-sscanf.c (val_double): Append .0 to large whole
+	number literals, so they are doubles instead of ints.
+
+2002-10-09  Roland McGrath  <roland@redhat.com>
+
+	* sysdeps/generic/bits/libc-tsd.h [USE___THREAD]: Conditional
+	changed from [USE_TLS && HAVE___THREAD].
+
+	* sysdeps/i386/dl-machine.h (elf_machine_type_class, elf_machine_rel):
+	Disable TLS relocs if [RTLD_BOOTSTRAP && !USE___THREAD].
+	* sysdeps/x86_64/dl-machine.h
+	(elf_machine_type_class, elf_machine_rela): Likewise.
+	* sysdeps/sh/dl-machine.h (elf_machine_type_class, elf_machine_rela):
+	Likewise.
+
+	* include/link.h (struct link_map): Remove member l_tls_tp_initialized.
+	* elf/rtld.c (_dl_start_final, dl_main): Don't use it.
+	(_dl_start): Conditionalize PT_TLS check on [USE___THREAD].
+
+	* sysdeps/i386/dl-tls.h (__TLS_GET_ADDR): Use ___tls_get_addr_internal
+	instead of ___tls_get_addr.
+	(___tls_get_addr_internal): Add attribute_hidden to decl.
+
+	* sysdeps/generic/ldsodefs.h (struct rtld_global): New variable
+	_dl_error_catch_tsd.
+	* elf/rtld.c (startup_error_tsd): New function.
+	(dl_main): Point _dl_error_catch_tsd at that.
+	* elf/dl-error.c: Don't use libc-tsd.h for DL_ERROR,
+	use new function pointer instead.
+	* elf/dl-tsd.c: New file.
+	* elf/Makefile (routines): Add it.
+
+2002-10-07  Roland McGrath  <roland@redhat.com>
+
+	* elf/dl-misc.c (_dl_debug_vdprintf): Use INTERNAL_SYSCALL macro for
+	writev if it's available.  Otherwise if [RTLD_PRIVATE_ERRNO] then
+	take _dl_load_lock around calling __writev.
+
+	* sysdeps/unix/sysv/linux/i386/sysdep.h (INTERNAL_SYSCALL): New macro.
+	(INLINE_SYSCALL): Use that.
+
+	* sysdeps/generic/dl-sysdep.h: New file.
+	* sysdeps/mach/hurd/dl-sysdep.h: New file.
+	* sysdeps/generic/ldsodefs.h: Include <dl-sysdep.h>.
+	* include/errno.h [IS_IN_rtld]: Include <dl-sysdep.h> to define ...
+	[RTLD_PRIVATE_ERRNO]: Use a hidden global variable for errno and
+	access it directly.
+	* elf/dl-minimal.c (__errno_location): Removed.
+	* sysdeps/unix/i386/sysdep.S (__syscall_errno) [RTLD_PRIVATE_ERRNO]:
+	Use GOTOFF access for errno.
+	* sysdeps/unix/sysv/linux/i386/sysdep.h
+	[RTLD_PRIVATE_ERRNO] (SYSCALL_ERROR_HANDLER): Likewise.
+
+	* sysdeps/unix/x86_64/sysdep.S (__syscall_errno) [RTLD_PRIVATE_ERRNO]:
+	Use PC-relative access for errno.
+	* sysdeps/unix/sysv/linux/x86_64/sysdep.h
+	[RTLD_PRIVATE_ERRNO] (SYSCALL_ERROR_HANDLER): Likewise.
+
+	* include/tls.h: New file.
+	(USE___THREAD): New macro.
+	Define to 1 under [USE_TLS && HAVE___THREAD] and only when compiling
+	libc or libpthread.
+	* sysdeps/unix/sysv/linux/i386/sysdep.h [USE___THREAD]: Conditional
+	changed from [USE_TLS && HAVE___THREAD].
+	* sysdeps/unix/sysv/linux/x86_64/sysdep.h: Likewise.
+	* sysdeps/unix/i386/sysdep.S: Likewise.
+	* sysdeps/unix/x86_64/sysdep.S: Likewise.
+	* include/errno.h: Likewise.
+	* include/netdb.h: Likewise.
+	* include/resolv.h: Likewise.
+
+	* sysdeps/generic/errno.c: New file.
+	* csu/Makefile (aux): New variable, list errno.
+	* sysdeps/unix/sysv/linux/i386/sysdep.S (errno, _errno): Remove defns.
+	* sysdeps/unix/sysv/linux/m68k/sysdep.S: Likewise.
+	* sysdeps/unix/sysv/linux/x86_64/sysdep.S: Likewise.
+	* sysdeps/unix/sysv/linux/s390/s390-64/sysdep.S: Likewise.
+	* sysdeps/unix/sysv/linux/s390/s390-32/sysdep.S: Likewise.
+	* sysdeps/unix/sysv/linux/arm/sysdep.S: Likewise.
+	* sysdeps/unix/sysv/linux/cris/sysdep.S: Likewise.
+	* sysdeps/unix/sysv/linux/hppa/sysdep.c: Likewise.
+	* sysdeps/unix/sysv/linux/ia64/sysdep.S: Likewise.
+	* sysdeps/unix/sysv/linux/powerpc/sysdep.c: Likewise.
+	* sysdeps/unix/sysv/linux/sparc/sysdep.S: Likewise.
+	* sysdeps/unix/sysv/linux/sh/sysdep.S: Likewise.
+	* sysdeps/unix/alpha/sysdep.S: Likewise.
+	* sysdeps/generic/start.c: Likewise.
+	* sysdeps/unix/start.c: Likewise.
+	* sysdeps/unix/arm/start.c: Likewise.
+	* sysdeps/unix/bsd/ultrix4/mips/start.S: Likewise.
+	* sysdeps/unix/sparc/start.c: Likewise.
+	* sysdeps/unix/sysv/irix4/start.c: Likewise.
+	* sysdeps/unix/sysv/linux/mips/sysdep.S: File removed.
+
+	* manual/search.texi (Tree Search Function, Hash Search Function):
+	Mention search.h clearly.
+
+2002-10-05  Roland McGrath  <roland@redhat.com>
+
+	* elf/dl-fxstat64.c: File removed.
+	* elf/dl-xstat64.c: File removed.
+	* elf/Makefile (rtld-routines): Remove them.
+	* sysdeps/unix/sysv/linux/xstat64.c: Remove RTLD_STAT64 conditionals.
+	Instead, use strong_alias instead of versioned_symbol in the
+	!SHLIB_COMPAT case.
+	* sysdeps/unix/sysv/linux/fxstat64.c: Likewise.
+	* sysdeps/unix/sysv/linux/lxstat64.c: Likewise.
+
+	* include/shlib-compat.h
+	(SHLIB_COMPAT): Require that IS_IN_##lib be defined nonzero.
+	[! NOT_IN_libc] (IS_IN_libc): Define it.
+	* cppflags-iterator.mk (CPPFLAGS-$(cpp-src)): Use -Dx=1 not just -Dx.
+	* elf/Makefile (CPPFLAGS-.os): Likewise.
+
+	* sunrpc/rpc_main.c (main): Don't declare with noreturn attribute.
+	Return the status instead of calling exit.
+
+	* Makeconfig (CFLAGS): Prepend -std=gnu99.
+	* Makerules (+make-deps): Use $(CFLAGS) only for .c sources.
+	Remove superfluous rm command, whose @ plus make bugs hid
+	all these commands from the make output.
+
+	* include/stubs-prologue.h: New file.  Give #error under #ifdef _LIBC.
+	* Makefile ($(inst_includedir)/gnu/stubs.h): Depend on it.
+	Use that file's contents instead of literal echo's for the prologue.
+	* include/features.h: Include <gnu/stubs.h> unconditionally.
+	* include/gnu/stubs.h: New file.
+
+2002-09-30  Roland McGrath  <roland@redhat.com>
+
+	* elf/rtld-Rules: New file.
+	* elf/Makefile ($(objpfx)librtld.map, $(objpfx)librtld.mk,
+	$(objpfx)rtld-libc.a): New targets.
+	(generated): Add them.
+	(reloc-link): Remove -o $@ from the variable.
+	($(objpfx)dl-allobjs.os): Add -o $@ after $(reloc-link).
+	(distribute): Add rtld-Rules.
+	(CPPFLAGS-.os): Define this instead of CFLAGS-.os.
+	* Makerules ($(+sysdir_pfx)sysd-rules): Emit rules for rtld-% targets.
+	(common-mostlyclean, common-clean): Clean up rtld-* files.
+	* sysdeps/unix/make-syscalls.sh: Add rtld-*.os target name to rules.
+
+2003-05-20  Jakub Jelinek  <jakub@redhat.com>
+
+	* elf/dynamic-link.h (elf_get_dynamic_info): Add temp argument.
+	If temp != NULL, copy dynamic entries which need relocation to temp
+	array before relocating.
+	(DL_RO_DYN_TEMP_CNT): Define.
+	* elf/dl-load.c (_dl_map_object_from_fd): Adjust caller.
+	* elf/rtld.c (_dl_start): Likewise.
+	(dl_main): Likewise.  Add dyn_temp static variable.
+
+2002-10-11  Roland McGrath  <roland@redhat.com>
+
+	* sysdeps/generic/dl-tls.c (__tls_get_addr): After freeing block in
+	now-unused dtv slot, reset the slot to TLS_DTV_UNALLOCATED.
+
+	* elf/tls-macros.h [__x86_64__] (TLS_GD): Fix the sequence with the
+	proper set of no-op insn prefixes.
+
+	* elf/tst-tls8.c (do_test): Use %zd format for l_tls_modid members.
+
+2002-10-11  Ulrich Drepper  <drepper@redhat.com>
+
+	* sysdeps/unix/sysv/linux/execve.c: Don't try calling
+	__pthread_kill_other_threads_np.
+
+	* sysdeps/generic/pselect.c: Avoid unnecessary sigprocmask calls.
+
+2002-10-08  Roland McGrath  <roland@redhat.com>
+
+	* locale/newlocale.c (__newlocale): If setting all categories to "C",
+	just return &_nl_C_locobj instead of copying it.
+	* locale/freelocale.c (__freelocale): Check for &_nl_C_locobj.
+	* locale/duplocale.c (__duplocale): Likewise.
+
+2002-10-07  Roland McGrath  <roland@frob.com>
+
+	* config.h.in (HAVE_I386_SET_GDT): New #undef.
+	* sysdeps/mach/configure.in: Define it with new check for i386_set_gdt.
+	* sysdeps/mach/configure: Regenerated.
+
+2002-10-06  Franz Sirl  <Franz.Sirl-kernel@lauterbach.com>
+
+	* sysdeps/unix/sysv/linux/powerpc/powerpc32/sysdep.h (INLINE_SYSCALL):
+	Add all necessary register outputs for syscall-clobbered registers.
+
+2002-10-02  David Mosberger  <davidm@hpl.hp.com>
+
+	* sysdeps/ia64/bzero.S: Rewritten by Sverre Jarp to tune for
+	Itanium 2 (and Itanium).
+	Fix unwind directives and make it fit in 80 columns.
+	* sysdeps/ia64/memset.S: Likewise.
+	* sysdeps/ia64/memcpy.S: Likewise.
+	Move jump table to .rodata section.
+
+2002-10-03  Roland McGrath  <roland@frob.com>
+
+	* sysdeps/mach/hurd/i386/init-first.c (_hurd_stack_setup): Add
+	clobbers to asm.
+
+2002-10-10  Andreas Jaeger  <aj@suse.de>
+
+	* sysdeps/x86_64/_mcount.S: Restore correct registers.
+
+2002-10-10  Ulrich Drepper  <drepper@redhat.com>
+
+	* posix/Versions (libc) [GLIBC_PRIVATE]: Add __pselect.
+
+2002-10-09  Ulrich Drepper  <drepper@redhat.com>
+
+	* sysdeps/generic/ldsodefs.h: Remove attribute_hidden from
+	_dl_allocate_tls_init.  Add rtld_hidden_proto.
+	* sysdeps/generic/dl-tls.c (_dl_allocate_tls_init): Add
+	rtld_hidden_def.
+	* elf/Versions (ld) [GLIBC_PRIVATE]: Add _dl_allocate_tls_init.
+
+	* version.h (VERSION): Bump to 2.3.1.
+
+	* Make-dist: Add back one of the tar invocations removed before.
+
+	* stdlib/Makefile (distribute): Add allocalim.h.
+
+	* sysdeps/generic/bits/libc-tsd.h [!(USE_TLS && HAVE___THREAD)]
+	(__libc_tsd_address): Use correct variable name.
+	Patch by Stefan Jones <stefan.jones@multigig.com>.
+
+	* sysdeps/unix/sysv/linux/ia64/getcontext.S: Add missing ;;.
+	Reported by edwardsg@sgi.com [PR libc/4678].
+
+	* Versions.def (libc): Add GLIBC_2.3.1.
+	(libpthread): Add GLIBC_2.3.1.
+
+	* include/signal.h: Add libc_hidden_proto for __sigwait, __sigwaitinfo,
+	and __sigtimedwait.
+	* signal/Versions: Add __sigtimedwait, __sigwait, and __sigwaitinfo.
+	* sysdeps/unix/sysv/linux/sigtimedwait.c (__sigtimedwait): Add
+	libc_hidden_def.
+	* sysdeps/unix/sysv/linux/sigwait.c (__sigwait): Likewise.
+	* sysdeps/unix/sysv/linux/sigwaitinfo.c (__sigwaitinfo): Likewise.
+
+	* include/sys/msg.h: Declare __libc_msgrcv and __libc_msgsnd.
+	* sysdeps/unix/sysv/linux/msgrcv.c (__msgrcv): Rename to __libc_msgrcv
+	and make old name an alias.
+	* sysdeps/unix/sysv/linux/msgsnd.c (__msgsnd): Rename to __libc_msgsnd
+	and make old name an alias.
+	* sysvipc/Versions (libc) [GLIBC_PRIVATE]: Add __libc_msgrcv and
+	__libc_msgsnd.
+
+	* include/sys/uio.h: Declare __libc_readv and __libc_writev.
+	* misc/Versions (libc) [GLIBC_PRIVATE]: Add __libc_readv and
+	__libc_writev.
+	* sysdeps/generic/readv.c (__readv): Rename to __libc_readv and make
+	old name an alias.
+	* sysdeps/posix/readv.c: Likewise
+	* sysdeps/unix/sysv/aix/readv.c: Likewise.
+	* sysdeps/unix/sysv/linux/readv.c: Likewise.
+	* sysdeps/generic/writev.c (__writev): Rename to __libc_writev and make
+	old name an alias.
+	* sysdeps/posix/writev.c: Likewise
+	* sysdeps/unix/sysv/aix/writev.c: Likewise.
+	* sysdeps/unix/sysv/linux/writev.c: Likewise.
+
+	* include/sys/wait.h: Declare __waitid.
+	* posix/Versions (libc) [GLIBC_PRIVATE]: Add __waitid.
+	* sysdeps/generic/waitid.c (waitid): Rename to __waitid and make old
+	name an alias.
+	* sysdeps/posix/waitid.c: Likewise.
+	* sysdeps/unix/sysv/aix/waitid.c: Likewise.
+
+	* sysdeps/unix/sysv/linux/syscalls.list: Add creat syscall.
+
+2002-10-07  Jakub Jelinek  <jakub@redhat.com>
+
+	* include/alloca.h (__libc_use_alloca, __libc_alloca_cutoff): New
+	prototypes.
+	(__MAX_ALLOCA_CUTOFF): Define.
+	Include allocalim.h.
+	* resolv/nss_dns/dns-host.c (_nss_dns_gethostbyname2_r,
+	_nss_dns_gethostbyaddr_r): Use alloca or malloc to allocate
+	host_buffer depending on __libc_use_alloca.
+	* resolv/nss_dns/dns-network.c (_nss_dns_getnetbyname_r,
+	_nss_dns_getnetbyaddr_r): Use alloca or malloc to allocate
+	net_buffer depending on __libc_use_alloca.
+	* resolv/res_query.c (res_nquery): Use alloca or malloc to allocate
+	buf depending on __libc_use_alloca.
+	* resolv/gethnamaddr.c (gethostbyname2, gethostbyaddr): Likewise.
+	* stdio-common/vfprintf.c (vfprintf): Use __libc_use_alloca
+	instead of hardcoded constants.
+	Pass proper size argument to alloca and compute end for wide char
+	version.
+	* stdio-common/printf_fp.c (__printf_fp): Use __libc_use_alloca
+	instead of hardcoded constants.
+	* string/strcoll.c (strcoll): Likewise.
+	* string/strxfrm.c (strxfrm): Likewise.
+	* sysdeps/posix/readv.c (__readv): Likewise.
+	* sysdeps/posix/writev.c (__writev): Likewise.
+	* sysdeps/generic/allocalim.h: New file.
+
+2002-10-08  Roland McGrath  <roland@redhat.com>
+
+	* configure.in (aux_missing warning): Change "too old" to
+	"incompatible versions", since for autoconf it's "too new" right now.
+	* configure: Regenerated.
+
+	* configure.in (AUTOCONF): New check to set it.  Set to "no" if the
+	one found doesn't work on our configure.in.
+	* configure: Regenerated.
+	* config.make.in (AUTOCONF): New substituted variable.
+	* Makefile (autoconf-it-cvs): New canned sequence, broken out of ...
+	(autoconf-it): ... here, use that instead of defining conditionally.
+	Use $(AUTOCONF) instead of literal autoconf.
+	[$(AUTOCONF) != no] (configure, %/configure): Protect these rules
+	with this condition.
+	* Make-dist (autoconf-it, configure, %/configure): Copy those changes.
+
+2002-10-08  Ulrich Drepper  <drepper@redhat.com>
+
+	* Make-dist (dist): Cleanup a bit.  We are not interested in the
+	14 char filename limit anymore.  Remove intermediate files and
+	symlinks.
+
+2002-10-05  Ulrich Drepper  <drepper@redhat.com>
+
+	* po/sk.po: Update from translation team.
+	* po/tr.po: Likewise.
+	* po/gl.po: Likewise.
+
+2002-10-05  Kaz Kojima  <kkojima@rr.iij4u.or.jp>
+
+	* elf/tls-macros.h: Fix SH version of macros so as to match ABI syntax.
+
+2002-10-03  Ulrich Drepper  <drepper@redhat.com>
+
+	* version.h (RELEASE): Change to stable.
+
+2002-10-03  Jakub Jelinek  <jakub@redhat.com>
+
+	* sysdeps/unix/sysv/linux/_exit.c (__syscall_exit,
+	__syscall_exit_group): New prototypes.
+
+2002-10-03  Ulrich Drepper  <drepper@redhat.com>
+
+	* glibc 2.3 released.
+
+
+See ChangeLog.13 for earlier changes.
diff --git a/ap/build/uClibc/test/regex/tst-regexloc.c b/ap/build/uClibc/test/regex/tst-regexloc.c
new file mode 100644
index 0000000..4bc65f6
--- /dev/null
+++ b/ap/build/uClibc/test/regex/tst-regexloc.c
@@ -0,0 +1,54 @@
+/* Copyright (C) 2001 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/types.h>
+#include <regex.h>
+#include <locale.h>
+#include <stdio.h>
+
+int
+main (int argc, char *argv[])
+{
+/* If uclibc has extended locale, or if it's a host build
+ * (assuming host libc always has locale): */
+#if defined __UCLIBC_HAS_XLOCALE__ || !defined __UCLIBC__
+  regex_t re;
+  regmatch_t mat[1];
+  int exitcode = 1;
+
+  if (setlocale (LC_ALL, "de_DE.ISO-8859-1") == NULL)
+    puts ("cannot set locale");
+  else if (regcomp (&re, "[a-f]*", 0) != REG_NOERROR)
+    puts ("cannot compile expression \"[a-f]*\"");
+  else if (regexec (&re, "abcdefCDEF", 1, mat, 0) == REG_NOMATCH)
+    puts ("no match");
+  else
+    {
+      exitcode = mat[0].rm_so != 0 || mat[0].rm_eo != 6;
+      printf ("match from %d to %d - %s\n",
+		mat[0].rm_so, mat[0].rm_eo,
+		exitcode ? "WRONG!" : "ok"
+      );
+    }
+
+  return exitcode;
+#else
+  puts("Test requires locale; skipping");
+  return 0;
+#endif
+}
diff --git a/ap/build/uClibc/test/rpc/Makefile b/ap/build/uClibc/test/rpc/Makefile
new file mode 100644
index 0000000..47accc6
--- /dev/null
+++ b/ap/build/uClibc/test/rpc/Makefile
@@ -0,0 +1,7 @@
+# uClibc rpc tests
+# Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
+
+top_builddir=../../
+include ../Rules.mak
+-include Makefile.in
+include ../Test.mak
diff --git a/ap/build/uClibc/test/rpc/Makefile.in b/ap/build/uClibc/test/rpc/Makefile.in
new file mode 100644
index 0000000..5612ff2
--- /dev/null
+++ b/ap/build/uClibc/test/rpc/Makefile.in
@@ -0,0 +1,11 @@
+# uClibc rpc tests
+# Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
+
+TESTS := getrpcent
+
+ifeq ($(UCLIBC_HAS_REENTRANT_RPC),y)
+TESTS += getrpcent_r
+endif
+
+DODIFF_getrpcent := 1
+
diff --git a/ap/build/uClibc/test/rpc/getrpcent.c b/ap/build/uClibc/test/rpc/getrpcent.c
new file mode 100644
index 0000000..e12e768
--- /dev/null
+++ b/ap/build/uClibc/test/rpc/getrpcent.c
@@ -0,0 +1,18 @@
+#include <netdb.h>
+#include <stdio.h>
+
+int main(int argc, char *argv[])
+{
+	struct rpcent *ent;
+
+	while ((ent = getrpcent()) != NULL) {
+		printf("%s: %i", ent->r_name, ent->r_number);
+		while (ent->r_aliases[0])
+			printf(" %s", *ent->r_aliases++);
+		printf("\n");
+	}
+
+	endrpcent();
+
+	return 0;
+}
diff --git a/ap/build/uClibc/test/rpc/getrpcent_r.c b/ap/build/uClibc/test/rpc/getrpcent_r.c
new file mode 100644
index 0000000..65ca61c
--- /dev/null
+++ b/ap/build/uClibc/test/rpc/getrpcent_r.c
@@ -0,0 +1,25 @@
+#include <netdb.h>
+#include <stdio.h>
+#include <errno.h>
+#include <string.h>
+
+int main(int argc, char *argv[])
+{
+	int ret;
+	char rpcdata[1024];
+	struct rpcent rpcbuf, *ent;
+
+	while ((ret = getrpcent_r(&rpcbuf, rpcdata, sizeof(rpcdata), &ent)) == 0) {
+		printf("%s: %i", ent->r_name, ent->r_number);
+		while (ent->r_aliases[0])
+			printf(" %s", *ent->r_aliases++);
+		printf("\n");
+	}
+
+	if (ret != ENOENT)
+		printf("Test failed: %s\n", strerror(ret));
+
+	endrpcent();
+
+	return 0;
+}
diff --git a/ap/build/uClibc/test/setjmp/Makefile b/ap/build/uClibc/test/setjmp/Makefile
new file mode 100644
index 0000000..a26e2d5
--- /dev/null
+++ b/ap/build/uClibc/test/setjmp/Makefile
@@ -0,0 +1,7 @@
+# uClibc setjmp tests
+# Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
+
+top_builddir=../../
+include ../Rules.mak
+-include Makefile.in
+include ../Test.mak
diff --git a/ap/build/uClibc/test/setjmp/bug269-setjmp.c b/ap/build/uClibc/test/setjmp/bug269-setjmp.c
new file mode 100644
index 0000000..b11ac7b
--- /dev/null
+++ b/ap/build/uClibc/test/setjmp/bug269-setjmp.c
@@ -0,0 +1,107 @@
+/* Copyright (C) 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.  */ ;
+
+/* Test case for Bugzilla # 269 */
+
+#include <stdio.h>
+#include <setjmp.h>
+#include <stdlib.h>
+
+jmp_buf buf1;
+jmp_buf buf2;
+int *p;
+int n_x = 6;
+
+static int g_counter = 0;
+
+static int
+f (void)
+{
+  static int counter = 0;
+  static int way_point1 = 3;
+  static int way_point2 = 2;
+  int lose = 0;
+
+  if (setjmp (buf1) != 101)
+    {
+      int a[n_x];		/* reallocate stack space */
+      g_counter++;
+      p = &a[0];
+      if (g_counter < 5)
+	longjmp (buf1, 2);
+      else if (g_counter == 5)
+	longjmp (buf1, 101);
+      else
+	{
+	  _setjmp (buf2);
+	  _longjmp (buf1, 101);
+	}
+    }
+
+  way_point1--;
+
+  if (counter == 0)
+    {
+      counter++;
+      {
+	int a[n_x];		/* reallocate stack space */
+	g_counter++;
+	p = &a[0];
+	if (g_counter < 5)
+	  longjmp (buf1, 2);
+	else if (g_counter == 5)
+	  longjmp (buf1, 101);
+	else
+	  {
+	    _setjmp (buf2);
+	    _longjmp (buf1, 101);
+	  }
+      }
+    }
+
+  way_point2--;
+
+  if (counter == 1)
+    {
+      counter++;
+      longjmp (buf2, 2);
+    }
+
+  lose = !(way_point1 == 0 && way_point2 == 0
+	   && g_counter == 6 && counter == 2);
+
+  return lose;
+}
+
+static int
+do_test (void)
+{
+  int lose;
+
+  lose = f ();
+
+  if (lose)
+    puts ("Test FAILED!");
+  else
+    puts ("Test succeeded!");
+
+  return lose ? EXIT_FAILURE : EXIT_SUCCESS;
+}
+
+#define TEST_FUNCTION do_test ()
+#include "../test-skeleton.c"
diff --git a/ap/build/uClibc/test/setjmp/jmpbug.c b/ap/build/uClibc/test/setjmp/jmpbug.c
new file mode 100644
index 0000000..da087a7
--- /dev/null
+++ b/ap/build/uClibc/test/setjmp/jmpbug.c
@@ -0,0 +1,51 @@
+/* setjmp vs alloca test case.  Exercised bug on sparc.  */
+
+#include <stdio.h>
+#include <setjmp.h>
+#include <alloca.h>
+
+int ret;
+int verbose;
+
+__attribute__ ((__noreturn__))
+static void
+sub5 (jmp_buf buf)
+{
+  longjmp (buf, 1);
+}
+
+static void
+test (int x)
+{
+  jmp_buf buf;
+  char *foo;
+  int arr[100];
+
+  ++ret;
+
+  arr[77] = x;
+  if (setjmp (buf))
+    {
+      --ret;
+      if (verbose)
+        printf ("made it ok; %d\n", arr[77]);
+      return;
+    }
+
+  foo = (char *) alloca (128);
+  sub5 (buf);
+}
+
+int
+main (int argc, char *argv[])
+{
+  int i;
+
+  verbose = (argc != 1);
+  ret = 0;
+
+  for (i = 123; i < 345; ++i)
+    test (i);
+
+  return ret;
+}
diff --git a/ap/build/uClibc/test/setjmp/sigjmpbug.c b/ap/build/uClibc/test/setjmp/sigjmpbug.c
new file mode 100644
index 0000000..5b17181
--- /dev/null
+++ b/ap/build/uClibc/test/setjmp/sigjmpbug.c
@@ -0,0 +1,51 @@
+/* sigsetjmp vs alloca test case.  Exercised bug on sparc.  */
+
+#include <stdio.h>
+#include <setjmp.h>
+#include <alloca.h>
+
+int ret;
+int verbose;
+
+__attribute__ ((__noreturn__))
+static void
+sub5 (jmp_buf buf)
+{
+  siglongjmp (buf, 1);
+}
+
+static void
+test (int x)
+{
+  sigjmp_buf buf;
+  char *foo;
+  int arr[100];
+
+  ++ret;
+
+  arr[77] = x;
+  if (sigsetjmp (buf, 1))
+    {
+      --ret;
+      if (verbose)
+        printf ("made it ok; %d\n", arr[77]);
+      return;
+    }
+
+  foo = (char *) alloca (128);
+  sub5 (buf);
+}
+
+int
+main (int argc, char *argv[])
+{
+  int i;
+
+  verbose = (argc != 1);
+  ret = 0;
+
+  for (i = 123; i < 345; ++i)
+    test (i);
+
+  return ret;
+}
diff --git a/ap/build/uClibc/test/setjmp/tst-setjmp.c b/ap/build/uClibc/test/setjmp/tst-setjmp.c
new file mode 100644
index 0000000..f0feb99
--- /dev/null
+++ b/ap/build/uClibc/test/setjmp/tst-setjmp.c
@@ -0,0 +1,119 @@
+/* Copyright (C) 1991, 1992, 1997, 1998, 2000 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 <stdio.h>
+#include <setjmp.h>
+#include <stdlib.h>
+
+static jmp_buf env;
+static int last_value = -1, lose = 0;
+
+__attribute__ ((__noreturn__))
+static void
+jump (int val)
+{
+  longjmp (env, val);
+}
+
+int
+main (void)
+{
+  int value;
+
+  value = setjmp (env);
+  if (value != last_value + 1)
+    {
+      fputs("Shouldn't have ", stdout);
+      lose = 1;
+    }
+  last_value = value;
+  switch (value)
+    {
+    case 0:
+      puts("Saved environment.");
+      jump (0);
+    default:
+      printf ("Jumped to %d.\n", value);
+      if (value < 10)
+	jump (value + 1);
+    }
+
+  if (!lose && value == 10)
+    {
+      /* Do a second test, this time without `setjmp' being a macro.
+         This is not required by ISO C but we have this for compatibility.  */
+#undef setjmp
+      extern int setjmp (jmp_buf);
+
+      last_value = -1;
+      lose = 0;
+
+      value = setjmp (env);
+      if (value != last_value + 1)
+	{
+	  fputs("Shouldn't have ", stdout);
+	  lose = 1;
+	}
+      last_value = value;
+      switch (value)
+	{
+	case 0:
+	  puts("Saved environment.");
+	  jump (0);
+	default:
+	  printf ("Jumped to %d.\n", value);
+	  if (value < 10)
+	    jump (value + 1);
+	}
+    }
+
+  if (!lose && value == 10)
+    {
+      /* And again for the `_setjmp' function.  */
+#ifndef _setjmp
+      extern int _setjmp (jmp_buf);
+#endif
+      last_value = -1;
+      lose = 0;
+
+      value = _setjmp (env);
+      if (value != last_value + 1)
+	{
+	  fputs("Shouldn't have ", stdout);
+	  lose = 1;
+	}
+      last_value = value;
+      switch (value)
+	{
+	case 0:
+	  puts("Saved environment.");
+	  jump (0);
+	default:
+	  printf ("Jumped to %d.\n", value);
+	  if (value < 10)
+	    jump (value + 1);
+	}
+    }
+
+  if (lose || value != 10)
+    puts ("Test FAILED!");
+  else
+    puts ("Test succeeded!");
+
+  return lose ? EXIT_FAILURE : EXIT_SUCCESS;
+}
diff --git a/ap/build/uClibc/test/setjmp/tst-vfork-longjmp.c b/ap/build/uClibc/test/setjmp/tst-vfork-longjmp.c
new file mode 100644
index 0000000..2784424
--- /dev/null
+++ b/ap/build/uClibc/test/setjmp/tst-vfork-longjmp.c
@@ -0,0 +1,108 @@
+/* make sure we can vfork/exec across setjmp/longjmp's
+ * and make sure signal block masks don't get corrupted
+ * in the process.
+ */
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <assert.h>
+#include <unistd.h>
+#include <errno.h>
+#include <setjmp.h>
+#include <signal.h>
+#include <sys/types.h>
+#include <sys/wait.h>
+#include <string.h>
+
+int verbose = 0;
+
+static int execute_child(const char *prog)
+{
+	int status;
+	pid_t child;
+	child = vfork();
+	if (child == 0) {
+		execlp(prog, prog, NULL);
+		perror("Could not execute specified prog");
+		_exit(1);
+	} else if (child == 1)
+		return 1;
+	wait(&status);
+	return WEXITSTATUS(status);
+}
+
+sigset_t orig_mask;
+
+static int check_sig_mask(void)
+{
+	int status;
+	pid_t child;
+
+	child = vfork();
+	if (child == 0) {
+		int ret;
+		sigset_t child_mask;
+		memset(&child_mask, 0x00, sizeof(child_mask));
+		ret = sigprocmask(SIG_BLOCK, NULL, &child_mask);
+		if (ret != 0) {
+			perror("could not get child sig block mask");
+			_exit(1);
+		}
+		ret = memcmp(&orig_mask, &child_mask, sizeof(orig_mask));
+		if (verbose) {
+			printf("sigmsk: %08lx%08lx ", child_mask.__val[1], child_mask.__val[0]);
+			printf("sigmsk: %08lx%08lx ", orig_mask.__val[1], orig_mask.__val[0]);
+			printf("%i\n", ret);
+		}
+		_exit(ret);
+	} else if (child == 1)
+		return 1;
+	wait(&status);
+	return WEXITSTATUS(status);
+}
+
+int main(int argc, char *argv[])
+{
+	const char *prog;
+	jmp_buf env;
+	sigjmp_buf sigenv;
+	int max;
+	/* values modified between setjmp/longjmp cannot be local to this func */
+	static int cnt, ret;
+
+	memset(&orig_mask, 0x00, sizeof(orig_mask));
+	ret = sigprocmask(SIG_BLOCK, NULL, &orig_mask);
+	if (ret != 0) {
+		perror("could not get orig sig block mask");
+		return 1;
+	}
+
+	prog = (argc > 1 ? argv[1] : "true");
+	ret = 0;
+	verbose = 0;
+	max = 10;
+
+	/* test vfork()/exec() inside of sigsetjmp/siglongjmp */
+	cnt = 0;
+	sigsetjmp(sigenv, 1);
+	++cnt;
+	if (verbose)
+		printf("sigsetjmp loop %i\n", cnt);
+	ret |= check_sig_mask();
+	ret |= execute_child(prog);
+	if (cnt < max)
+		siglongjmp(sigenv, 0);
+
+	/* test vfork()/sigprocmask() inside of setjmp/longjmp */
+	cnt = 0;
+	setjmp(env);
+	++cnt;
+	if (verbose)
+		printf("setjmp loop %i\n", cnt);
+	ret |= check_sig_mask();
+	ret |= execute_child(prog);
+	if (cnt < max)
+		longjmp(env, 0);
+
+	return ret;
+}
diff --git a/ap/build/uClibc/test/signal/.indent.pro b/ap/build/uClibc/test/signal/.indent.pro
new file mode 100644
index 0000000..492ecf1
--- /dev/null
+++ b/ap/build/uClibc/test/signal/.indent.pro
@@ -0,0 +1,33 @@
+--blank-lines-after-declarations
+--blank-lines-after-procedures
+--break-before-boolean-operator
+--no-blank-lines-after-commas
+--braces-on-if-line
+--braces-on-struct-decl-line
+--comment-indentation25
+--declaration-comment-column25
+--no-comment-delimiters-on-blank-lines
+--cuddle-else
+--continuation-indentation4
+--case-indentation0
+--else-endif-column33
+--space-after-cast
+--line-comments-indentation0
+--declaration-indentation1
+--dont-format-first-column-comments
+--dont-format-comments
+--honour-newlines
+--indent-level4
+/* changed from 0 to 4 */
+--parameter-indentation4
+--line-length78 /* changed from 75 */
+--continue-at-parentheses
+--no-space-after-function-call-names
+--dont-break-procedure-type
+--dont-star-comments
+--leave-optional-blank-lines
+--dont-space-special-semicolon
+--tab-size4
+/* additions by Mark */
+--case-brace-indentation0
+--leave-preprocessor-space
diff --git a/ap/build/uClibc/test/signal/Makefile b/ap/build/uClibc/test/signal/Makefile
new file mode 100644
index 0000000..e829365
--- /dev/null
+++ b/ap/build/uClibc/test/signal/Makefile
@@ -0,0 +1,7 @@
+# uClibc signal tests
+# Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
+
+top_builddir=../../
+include ../Rules.mak
+-include Makefile.in
+include ../Test.mak
diff --git a/ap/build/uClibc/test/signal/Makefile.in b/ap/build/uClibc/test/signal/Makefile.in
new file mode 100644
index 0000000..c8e2545
--- /dev/null
+++ b/ap/build/uClibc/test/signal/Makefile.in
@@ -0,0 +1,6 @@
+# uClibc signal tests
+# Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
+
+ifeq ($(UCLIBC_HAS_OBSOLETE_BSD_SIGNAL),)
+TESTS_DISABLED := tst-sigsimple
+endif
diff --git a/ap/build/uClibc/test/signal/sigchld.c b/ap/build/uClibc/test/signal/sigchld.c
new file mode 100644
index 0000000..22febac
--- /dev/null
+++ b/ap/build/uClibc/test/signal/sigchld.c
@@ -0,0 +1,68 @@
+#include <stdlib.h>
+#include <string.h>
+#include <errno.h>
+#include <stdio.h>
+#include <sys/signal.h>
+#include <sys/wait.h>
+#include <unistd.h>
+
+
+#ifdef __ARCH_USE_MMU__
+
+static void test_handler(int signo)
+{
+    write(1, "caught SIGCHLD\n", 15);
+    return;
+}
+
+int main(void)
+{
+    pid_t mypid;
+    struct sigaction siga;
+    static sigset_t set;
+
+    /* Set up sighandling */
+    sigfillset(&set);
+    siga.sa_handler = test_handler;
+    siga.sa_mask = set;
+    siga.sa_flags = 0;
+    if (sigaction(SIGCHLD, &siga, (struct sigaction *)NULL) != 0) {
+	fprintf(stderr, "sigaction choked: %s!", strerror(errno));
+	exit(EXIT_FAILURE);
+    }
+
+    /* Setup a child process to exercise the sig handling for us */
+    mypid = getpid();
+    if (fork() == 0) {
+	int i;
+
+	for (i=0; i < 3; i++) {
+	    sleep(2);
+	    kill(mypid, SIGCHLD);
+	}
+	_exit(EXIT_SUCCESS);
+    }
+
+
+    /* Wait for signals */
+    write(1, "waiting for a SIGCHLD\n",22);
+    for(;;) {
+	sleep(10);
+	if (waitpid(-1, NULL, WNOHANG | WUNTRACED) > 0)
+	    break;
+	write(1, "after sleep\n", 12);
+    }
+
+    printf("Bye-bye!  All done!\n");
+    return 0;
+}
+
+#else
+
+int main(void)
+{
+    printf("Skipping test on non-mmu host!\n");
+    return 0;
+}
+
+#endif
diff --git a/ap/build/uClibc/test/signal/signal.c b/ap/build/uClibc/test/signal/signal.c
new file mode 100644
index 0000000..01d1a78
--- /dev/null
+++ b/ap/build/uClibc/test/signal/signal.c
@@ -0,0 +1,95 @@
+/* vi: set sw=4 ts=4: */
+/*
+ * signal testing function for uClibc
+ * Copyright (C) 2000-2006 by Erik Andersen <andersen@uclibc.org>
+ *
+ * Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
+ */
+
+#ifndef _GNU_SOURCE
+# define _GNU_SOURCE
+#endif
+#include <errno.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <strings.h>
+#include <fcntl.h>
+#include <signal.h>
+
+
+/* -------------------------------------------------*/
+/* This stuff is common to all the testing routines */
+/* -------------------------------------------------*/
+const char *it = "<UNSET>";		/* Routine name for message routines. */
+size_t errors = 0;
+
+static void check(int thing, int number)
+{
+	if (!thing) {
+		printf("%s: flunked test %d\n", it, number);
+		++errors;
+	}
+}
+
+#if 0
+static void equal(const char *a, const char *b, int number)
+{
+	check(a != NULL && b != NULL && (strcmp(a, b) == 0), number);
+}
+#endif
+
+
+/* -------------------------------------------------*/
+/* Let the tests begin....                          */
+/* -------------------------------------------------*/
+
+int global_int = 0;
+
+static void set_global_int_to_one(int signum)
+{
+	printf ("Received signal %d (%s).\n", signum, strsignal(signum));
+	global_int = 1;
+	return;
+}
+
+static void signal_test_1(void)
+{
+	global_int = 0;
+
+	it = "global variable set from signal handler";
+	if (signal(SIGUSR1, set_global_int_to_one) == SIG_ERR) {
+		perror("signal(SIGUSR1) failed");
+		exit(-1);
+	}
+	raise(SIGUSR1);
+
+	/* This should already have jumped to the signal handler */
+	check((global_int == 1), 1);
+
+	global_int = 0;
+	if (signal(SIGUSR1, SIG_IGN) == SIG_ERR) {
+		perror("signal(SIGUSR1) failed");
+		exit(-1);
+	}
+	raise(SIGUSR1);
+	/* This should not go to the signal handler this time since we  */
+	check((global_int == 0), 1);
+}
+
+
+int main(void)
+{
+	int status;
+
+	signal_test_1();
+
+	if (errors == 0) {
+		status = EXIT_SUCCESS;
+		printf("No errors.\n");
+	} else {
+		status = EXIT_FAILURE;
+		printf("%lu errors.\n", (unsigned long)errors);
+	}
+	exit(status);
+}
diff --git a/ap/build/uClibc/test/signal/tst-raise.c b/ap/build/uClibc/test/signal/tst-raise.c
new file mode 100644
index 0000000..d24c316
--- /dev/null
+++ b/ap/build/uClibc/test/signal/tst-raise.c
@@ -0,0 +1,63 @@
+/* Copyright (C) 2003 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+   Contributed by Jakub Jelinek <jakub@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, write to the Free
+   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+   02111-1307 USA.  */
+
+#include <errno.h>
+#include <string.h>
+#include <error.h>
+#include <signal.h>
+#include <stdlib.h>
+#include <stdio.h>
+
+volatile int count;
+
+static void
+sh (int sig)
+{
+  ++count;
+}
+
+int
+main (void)
+{
+  struct sigaction sa;
+  sa.sa_handler = sh;
+  sigemptyset (&sa.sa_mask);
+  sa.sa_flags = 0;
+  if (sigaction (SIGUSR1, &sa, NULL) < 0)
+    {
+      printf ("sigaction failed: %s\n", strerror(errno));
+      exit (1);
+    }
+  if (raise (SIGUSR1) < 0)
+    {
+      printf ("first raise failed: %s\n", strerror(errno));
+      exit (1);
+    }
+  if (raise (SIGUSR1) < 0)
+    {
+      printf ("second raise failed: %s\n", strerror(errno));
+      exit (1);
+    }
+  if (count != 2)
+    {
+      printf ("signal handler not called 2 times\n");
+      exit (1);
+    }
+  exit (0);
+}
diff --git a/ap/build/uClibc/test/signal/tst-signal.c b/ap/build/uClibc/test/signal/tst-signal.c
new file mode 100644
index 0000000..6d31787
--- /dev/null
+++ b/ap/build/uClibc/test/signal/tst-signal.c
@@ -0,0 +1,44 @@
+#include <signal.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+
+int win = 0;
+
+static void
+handler (int sig)
+{
+  printf ("Received signal %d (%s).\n", sig, strsignal(sig));
+  win = 1;
+}
+
+int
+main (void)
+{
+  if (signal (SIGTERM, handler) == SIG_ERR)
+    {
+      perror ("signal: SIGTERM");
+      exit (EXIT_FAILURE);
+    }
+
+  puts ("Set handler.");
+
+  printf ("Sending myself signal %d.\n", SIGTERM);
+  fflush (stdout);
+
+  if (raise (SIGTERM) < 0)
+    {
+      perror ("raise: SIGTERM");
+      exit (EXIT_FAILURE);
+    }
+
+  if (!win)
+    {
+      puts ("Didn't get any signal.  Test FAILED!");
+      exit (EXIT_FAILURE);
+    }
+
+  puts ("Got a signal.  Test succeeded.");
+
+  return EXIT_SUCCESS;
+}
diff --git a/ap/build/uClibc/test/signal/tst-sigset.c b/ap/build/uClibc/test/signal/tst-sigset.c
new file mode 100644
index 0000000..bc1b057
--- /dev/null
+++ b/ap/build/uClibc/test/signal/tst-sigset.c
@@ -0,0 +1,45 @@
+/* Test sig*set functions.  */
+
+#include <signal.h>
+#include <string.h>
+#include <errno.h>
+#include <stdio.h>
+
+#define TEST_FUNCTION do_test ()
+static int
+do_test (void)
+{
+  int result = 0;
+  int sig = -1;
+
+#define TRY(call)							      \
+  if (call)								      \
+    {									      \
+      printf ("%s (sig = %d): %s\n", #call, sig, strerror(errno));			      \
+      result = 1;							      \
+    }									      \
+  else
+
+
+  sigset_t set;
+  TRY (sigemptyset (&set) != 0);
+
+#ifdef SIGRTMAX
+  int max_sig = SIGRTMAX;
+#else
+  int max_sig = NSIG - 1;
+#endif
+
+  for (sig = 1; sig <= max_sig; ++sig)
+    {
+      TRY (sigismember (&set, sig) != 0);
+      TRY (sigaddset (&set, sig) != 0);
+      TRY (sigismember (&set, sig) == 0);
+      TRY (sigdelset (&set, sig) != 0);
+      TRY (sigismember (&set, sig) != 0);
+    }
+
+  return result;
+}
+
+#include "../test-skeleton.c"
diff --git a/ap/build/uClibc/test/signal/tst-sigsimple.c b/ap/build/uClibc/test/signal/tst-sigsimple.c
new file mode 100644
index 0000000..22bb85c
--- /dev/null
+++ b/ap/build/uClibc/test/signal/tst-sigsimple.c
@@ -0,0 +1,57 @@
+/* Copyright (C) 2003 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, write to the Free
+   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+   02111-1307 USA.  */
+
+#include <errno.h>
+#include <signal.h>
+#include <stdio.h>
+#include <string.h>
+
+
+static int
+do_test (void)
+{
+  int result = 0;
+  int e;
+
+#define RUN(test) \
+  errno = 0;								      \
+  e = test;								      \
+  if (e != -1)								      \
+    {									      \
+      printf ("%s returned %d\n", #test, e);				      \
+      result = 1;							      \
+    }									      \
+  else if (errno != EINVAL)						      \
+    {									      \
+      printf ("%s didn't set errno to EINVAL (%s instead)\n",		      \
+	      #test, strerror (errno));					      \
+      result = 1;							      \
+    }
+
+  RUN (sighold (-1));
+  RUN (sighold (_NSIG + 100));
+
+  RUN (sigrelse (-1));
+  RUN (sigrelse (_NSIG + 100));
+
+  return result;
+}
+
+#define TEST_FUNCTION do_test ()
+#include "../test-skeleton.c"
diff --git a/ap/build/uClibc/test/silly/Makefile b/ap/build/uClibc/test/silly/Makefile
new file mode 100644
index 0000000..4db1850
--- /dev/null
+++ b/ap/build/uClibc/test/silly/Makefile
@@ -0,0 +1,7 @@
+# uClibc silly tests
+# Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
+
+top_builddir=../../
+include ../Rules.mak
+-include Makefile.in
+include ../Test.mak
diff --git a/ap/build/uClibc/test/silly/Makefile.in b/ap/build/uClibc/test/silly/Makefile.in
new file mode 100644
index 0000000..bb08e0d
--- /dev/null
+++ b/ap/build/uClibc/test/silly/Makefile.in
@@ -0,0 +1,5 @@
+# uClibc silly tests
+# Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
+
+RET_hello := 42
+RET_tiny  := 42
diff --git a/ap/build/uClibc/test/silly/hello.c b/ap/build/uClibc/test/silly/hello.c
new file mode 100644
index 0000000..4aba926
--- /dev/null
+++ b/ap/build/uClibc/test/silly/hello.c
@@ -0,0 +1,8 @@
+#include<stdio.h>
+#include <stdlib.h>
+
+int main(void)
+{
+    printf("hello world\n");
+    exit(42);
+}
diff --git a/ap/build/uClibc/test/silly/tiny.c b/ap/build/uClibc/test/silly/tiny.c
new file mode 100644
index 0000000..e54c0ff
--- /dev/null
+++ b/ap/build/uClibc/test/silly/tiny.c
@@ -0,0 +1,6 @@
+#include <unistd.h>
+
+int main(void)
+{
+    _exit(42);
+}
diff --git a/ap/build/uClibc/test/stat/Makefile b/ap/build/uClibc/test/stat/Makefile
new file mode 100644
index 0000000..ecde416
--- /dev/null
+++ b/ap/build/uClibc/test/stat/Makefile
@@ -0,0 +1,7 @@
+# uClibc stat tests
+# Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
+
+top_builddir=../../
+include ../Rules.mak
+-include Makefile.in
+include ../Test.mak
diff --git a/ap/build/uClibc/test/stat/Makefile.in b/ap/build/uClibc/test/stat/Makefile.in
new file mode 100644
index 0000000..9c06ded
--- /dev/null
+++ b/ap/build/uClibc/test/stat/Makefile.in
@@ -0,0 +1,13 @@
+# uClibc stat tests
+# Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
+
+ifeq ($(UCLIBC_HAS_LFS),)
+TESTS_DISABLED := stat64
+endif
+CFLAGS_stat64 := -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64
+
+DODIFF_stat   := 1
+DODIFF_stat64 := 1
+
+OPTS_stat   := Makefile
+OPTS_stat64 := Makefile
diff --git a/ap/build/uClibc/test/stat/memcmp-stat.c b/ap/build/uClibc/test/stat/memcmp-stat.c
new file mode 100644
index 0000000..254c754
--- /dev/null
+++ b/ap/build/uClibc/test/stat/memcmp-stat.c
@@ -0,0 +1,107 @@
+/* Distilled from issue found with tar and symlinks.
+ * Make sure that the whole stat struct between runs
+ * is agreeable.
+ */
+
+#ifndef _GNU_SOURCE
+# define _GNU_SOURCE
+#endif
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <errno.h>
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <fcntl.h>
+#include <unistd.h>
+#include <assert.h>
+#include <time.h>
+
+static void show_stat(struct stat *st)
+{
+	printf(
+		"------------------\n"
+		"st_dev     = %li\n"
+		"st_ino     = %li\n"
+		"st_mode    = %li\n"
+		"st_nlink   = %li\n"
+		"st_uid     = %li\n"
+		"st_gid     = %li\n"
+		"st_rdev    = %li\n"
+		"st_size    = %li\n"
+		"st_blksize = %li\n"
+		"st_blocks  = %li\n"
+		"st_atime   = %li\n"
+		"st_ansec   = %li\n"
+		"st_mtime   = %li\n"
+		"st_mnsec   = %li\n"
+		"st_ctime   = %li\n"
+		"st_cnsec   = %li\n",
+		(long int)st->st_dev,
+		(long int)st->st_ino,
+		(long int)st->st_mode,
+		(long int)st->st_nlink,
+		(long int)st->st_uid,
+		(long int)st->st_gid,
+		(long int)st->st_rdev,
+		(long int)st->st_size,
+		(long int)st->st_blksize,
+		(long int)st->st_blocks,
+#if !defined(__UCLIBC__) || defined(__USE_MISC)
+		(long int)st->st_atime,
+		(long int)st->st_atim.tv_nsec,
+		(long int)st->st_mtime,
+		(long int)st->st_mtim.tv_nsec,
+		(long int)st->st_ctime,
+		(long int)st->st_ctim.tv_nsec
+#else
+		(long int)st->st_atime,
+		(long int)st->st_atimensec,
+		(long int)st->st_mtime,
+		(long int)st->st_mtimensec,
+		(long int)st->st_ctime,
+		(long int)st->st_ctimensec
+#endif
+	);
+}
+
+int main(void)
+{
+	int ret;
+	int fd;
+	struct stat fst, st;
+
+	memset(&fst, 0xAA, sizeof(fst));
+	memset(&st, 0x55, sizeof(st));
+
+	unlink(".testfile");
+	fd = open(".testfile", O_WRONLY | O_CREAT | O_EXCL, 0);
+	if (fd < 0) {
+		perror("open(.testfile) failed");
+		return 1;
+	}
+	ret = fstat(fd, &fst);
+	if (ret != 0) {
+		perror("fstat(.testfile) failed");
+		return 1;
+	}
+	close(fd);
+
+	ret = stat(".testfile", &st);
+	if (ret != 0) {
+		perror("stat(.testfile) failed");
+		return 1;
+	}
+
+	ret = memcmp(&fst, &st, sizeof(fst));
+	if (ret != 0) {
+		printf("FAILED: memcmp() = %i\n", ret);
+		show_stat(&fst);
+		show_stat(&st);
+	}
+
+	unlink(".testfile");
+
+	return ret;
+}
diff --git a/ap/build/uClibc/test/stat/stat-loop256.c b/ap/build/uClibc/test/stat/stat-loop256.c
new file mode 100644
index 0000000..14284c1
--- /dev/null
+++ b/ap/build/uClibc/test/stat/stat-loop256.c
@@ -0,0 +1,32 @@
+#include <stdio.h>
+#include <unistd.h>
+#include <stdlib.h>
+#include <sys/stat.h>
+int main()
+{
+    struct stat statbuf;
+    int ret = 0;
+    char* loop255 = "/dev/loop255";
+    char* loop256 = "/dev/loop256";
+    mode_t mode = 0660;
+    mknod(loop255, mode, 0x7ff);
+    mknod(loop256, mode, 0x100700);
+    ret = stat(loop255, &statbuf);
+    if(ret < 0) {
+	printf("stat: Cant stat %s\n",loop255);
+	unlink(loop255);
+	exit(1);
+    }
+    ret = stat(loop256, &statbuf);
+    if(ret < 0) {
+        printf("stat: Cant stat %s\n",loop256);
+	unlink(loop255);
+	unlink(loop256);
+        exit(1);
+    }
+
+    unlink(loop255);
+    unlink(loop256);
+    exit(0);
+}
+
diff --git a/ap/build/uClibc/test/stat/stat.c b/ap/build/uClibc/test/stat/stat.c
new file mode 100644
index 0000000..4980cdd
--- /dev/null
+++ b/ap/build/uClibc/test/stat/stat.c
@@ -0,0 +1,71 @@
+#include <stdio.h>
+#include <string.h>
+#include <fcntl.h>
+#include <sys/stat.h>
+#include <unistd.h>
+#include <stdlib.h>
+
+static void print_struct_stat(char *msg, struct stat *s)
+{
+    printf("%s\n", msg);
+    /* The casts are because glibc thinks it's cool */
+    printf("device    : 0x%llx\n",(long long)s->st_dev);
+    printf("inode     : %lld\n",  (long long)s->st_ino);
+    printf("mode      : 0x%llx\n",(long long)s->st_mode);
+    printf("nlink     : %lld\n",  (long long)s->st_nlink);
+    printf("uid       : %lld\n",  (long long)s->st_uid);
+    printf("gid       : %lld\n",  (long long)s->st_gid);
+    printf("rdev      : 0x%llx\n",(long long)s->st_rdev);
+    printf("size      : %lld\n",  (long long)s->st_size);
+    printf("blksize   : %lld\n",  (long long)s->st_blksize);
+    printf("blocks    : %lld\n",  (long long)s->st_blocks);
+    printf("atime     : %lld\n",  (long long)s->st_atime);
+    printf("mtime     : %lld\n",  (long long)s->st_mtime);
+    printf("ctime     : %lld\n",  (long long)s->st_ctime);
+}
+
+int main(int argc,char **argv)
+{
+    int fd, ret;
+    char *file;
+    struct stat s;
+
+    if (argc < 2) {
+	fprintf(stderr, "Usage: stat FILE\n");
+	exit(1);
+    }
+    file = argv[1];
+
+    memset(&s, 0, sizeof(struct stat));
+    ret = stat(file, &s);
+    if(ret<0){
+	perror("stat");
+	exit(1);
+    }
+    print_struct_stat("\nTesting stat:", &s);
+
+    memset(&s, 0, sizeof(struct stat));
+    ret = lstat(file, &s);
+    if(ret<0){
+	perror("lstat");
+	exit(1);
+    }
+    print_struct_stat("\nTesting lstat:", &s);
+
+
+    fd = open(file, O_RDONLY);
+    if(fd<0){
+	perror("open");
+	exit(1);
+    }
+    memset(&s, 0, sizeof(struct stat));
+    ret = fstat(fd,&s);
+    if(ret<0){
+	perror("fstat");
+	exit(1);
+    }
+    print_struct_stat("\nTesting fstat:", &s);
+
+    exit(0);
+}
+
diff --git a/ap/build/uClibc/test/stat/stat64.c b/ap/build/uClibc/test/stat/stat64.c
new file mode 100644
index 0000000..a074251
--- /dev/null
+++ b/ap/build/uClibc/test/stat/stat64.c
@@ -0,0 +1 @@
+#include "stat.c"
diff --git a/ap/build/uClibc/test/stdio/64bit.c b/ap/build/uClibc/test/stdio/64bit.c
new file mode 100644
index 0000000..9b94dd8
--- /dev/null
+++ b/ap/build/uClibc/test/stdio/64bit.c
@@ -0,0 +1,12 @@
+#include <stdio.h>
+
+int main(void)
+{
+	unsigned long long val = -1;
+	void *ptr = (void *)-1;
+	printf("%p\n", ptr);
+
+	sscanf("123456789", "%Lx", &val);
+	printf("val = %Lx\n", val);
+	return 0;
+}
diff --git a/ap/build/uClibc/test/stdio/Makefile b/ap/build/uClibc/test/stdio/Makefile
new file mode 100644
index 0000000..a5d662a
--- /dev/null
+++ b/ap/build/uClibc/test/stdio/Makefile
@@ -0,0 +1,7 @@
+# uClibc stdio tests
+# Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
+
+top_builddir=../../
+include ../Rules.mak
+-include Makefile.in
+include ../Test.mak
diff --git a/ap/build/uClibc/test/stdio/Makefile.in b/ap/build/uClibc/test/stdio/Makefile.in
new file mode 100644
index 0000000..0bfbd13
--- /dev/null
+++ b/ap/build/uClibc/test/stdio/Makefile.in
@@ -0,0 +1,4 @@
+# uClibc stdio tests
+# Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
+
+DODIFF_64bit := 1
diff --git a/ap/build/uClibc/test/stdio/fclose-loop.c b/ap/build/uClibc/test/stdio/fclose-loop.c
new file mode 100644
index 0000000..fc0cc42
--- /dev/null
+++ b/ap/build/uClibc/test/stdio/fclose-loop.c
@@ -0,0 +1,21 @@
+/* From: Denis Vlasenko <vda.linux@googlemail.com>
+ *	With certain combination of .config options fclose() does not
+ *	remove FILE* pointer from _stdio_openlist.  As a result, subsequent
+ *	fopen() may allocate new FILE structure exactly in place of one
+ *	freed by previous fclose(), which then makes _stdio_openlist
+ *	circularlt looped. The following program will enter infinite loop
+ *	trying to walk _stdio_openlist in exit():
+ */
+
+#include <stdlib.h>
+#include <stdio.h>
+
+int main(int argc, char *argv[])
+{
+	FILE* fp;
+	fp = fopen("/dev/null", "r");
+	fclose(fp);
+	fp = fopen("/dev/zero", "r");
+	fclose(fp);
+	return 0;
+}
diff --git a/ap/build/uClibc/test/stdlib/Makefile b/ap/build/uClibc/test/stdlib/Makefile
new file mode 100644
index 0000000..f8a4038
--- /dev/null
+++ b/ap/build/uClibc/test/stdlib/Makefile
@@ -0,0 +1,7 @@
+# uClibc stdlib tests
+# Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
+
+top_builddir=../../
+include ../Rules.mak
+-include Makefile.in
+include ../Test.mak
diff --git a/ap/build/uClibc/test/stdlib/Makefile.in b/ap/build/uClibc/test/stdlib/Makefile.in
new file mode 100644
index 0000000..0bb0697
--- /dev/null
+++ b/ap/build/uClibc/test/stdlib/Makefile.in
@@ -0,0 +1,7 @@
+# uClibc stdlib tests
+# Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
+
+DODIFF_qsort       := 1
+DODIFF_testatexit  := 1
+DODIFF_teston_exit := 1
+DODIFF_teststrtol  := 1
diff --git a/ap/build/uClibc/test/stdlib/ptytest.c b/ap/build/uClibc/test/stdlib/ptytest.c
new file mode 100644
index 0000000..a795638
--- /dev/null
+++ b/ap/build/uClibc/test/stdlib/ptytest.c
@@ -0,0 +1,20 @@
+#define _XOPEN_SOURCE
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <fcntl.h>
+#include <stdio.h>
+#include <stdlib.h>
+
+int main(int argc, char **argv)
+{
+    int fd;
+    char *cp;
+
+    fd=open("/dev/ptmx",O_NOCTTY|O_RDWR);
+    cp=ptsname(fd);
+    if (cp==NULL)
+	return EXIT_FAILURE;
+    printf("ptsname %s\n",cp);
+    return EXIT_SUCCESS;
+}
+
diff --git a/ap/build/uClibc/test/stdlib/qsort.c b/ap/build/uClibc/test/stdlib/qsort.c
new file mode 100644
index 0000000..74f9331
--- /dev/null
+++ b/ap/build/uClibc/test/stdlib/qsort.c
@@ -0,0 +1,53 @@
+#include <stdio.h>
+#include <dirent.h>
+#include <stdlib.h>
+#include <unistd.h>
+
+static int select_files(const struct dirent *dirbuf)
+{
+	if (dirbuf->d_name[0] == '.')
+		return 0;
+	else
+		return 1;
+}
+
+int main(void)
+{
+	struct dirent **array;
+	struct dirent *dirbuf;
+
+	int i, numdir;
+
+	chdir("/");
+	numdir = scandir(".", &array, select_files, NULL);
+	printf("\nGot %d entries from scandir().\n", numdir);
+	for (i = 0; i < numdir; ++i) {
+		dirbuf = array[i];
+		printf("[%d] %s\n", i, dirbuf->d_name);
+		free(array[i]);
+	}
+	free(array);
+	numdir = scandir(".", &array, select_files, alphasort);
+	printf("\nGot %d entries from scandir() using alphasort().\n", numdir);
+	for (i = 0; i < numdir; ++i) {
+		dirbuf = array[i];
+		printf("[%d] %s\n", i, dirbuf->d_name);
+	}
+	printf("\nCalling qsort()\n");
+	/* Even though some manpages say that alphasort should be
+	 * int alphasort(const void *a, const void *b),
+	 * in reality glibc and uclibc have const struct dirent**
+	 * instead of const void*.
+	 * Therefore we get a warning here unless we use a cast,
+	 * which makes people think that alphasort prototype
+	 * needs to be fixed in uclibc headers.
+	 */
+	qsort(array, numdir, sizeof(struct dirent *), (void*) alphasort);
+	for (i = 0; i < numdir; ++i) {
+		dirbuf = array[i];
+		printf("[%d] %s\n", i, dirbuf->d_name);
+		free(array[i]);
+	}
+	free(array);
+	return (0);
+}
diff --git a/ap/build/uClibc/test/stdlib/test-canon.c b/ap/build/uClibc/test/stdlib/test-canon.c
new file mode 100644
index 0000000..f335443
--- /dev/null
+++ b/ap/build/uClibc/test/stdlib/test-canon.c
@@ -0,0 +1,252 @@
+/* Test program for returning the canonical absolute name of a given file.
+   Copyright (C) 1996,1997,2000,2002,2004,2005,2006
+   Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+   Contributed by David Mosberger <davidm@azstarnet.com>.
+
+   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.  */
+
+/* This file must be run from within a directory called "stdlib".  */
+
+#include <errno.h>
+#include <fcntl.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <unistd.h>
+#include <sys/param.h>
+#include <sys/stat.h>
+
+/* Prototype for our test function.  */
+extern int do_test (int argc, char *argv[]);
+#include "../test-skeleton.c"
+
+#ifndef PATH_MAX
+# define PATH_MAX 4096
+#endif
+static char	cwd[PATH_MAX];
+static size_t	cwd_len;
+
+struct {
+  const char *	name;
+  const char *	value;
+} symlinks[] = {
+  {"SYMLINK_LOOP",	"SYMLINK_LOOP"},
+  {"SYMLINK_1",		"."},
+  {"SYMLINK_2",		"//////./../../etc"},
+  {"SYMLINK_3",		"SYMLINK_1"},
+  {"SYMLINK_4",		"SYMLINK_2"},
+  {"SYMLINK_5",		"doesNotExist"},
+};
+
+struct {
+  const char * in;
+  const char * retval; /* what realpath should return */
+  const char * retbuf; /* what realpath should store in buf */
+  /* if both of the above are NULL, we won't check for result,
+   * it's undefined */
+  int error; /* expected errno value */
+} tests[] = {
+  /*  0 */
+  {"/",					"/"},
+  {"/////////////////////////////////",	"/"},
+  {"/.././.././.././..///",		"/"},
+  {"/etc",				"/etc"},
+  {"/etc/../etc",			"/etc"},
+  /*  5 */
+  {"/doesNotExist/../etc",		0, "/doesNotExist", ENOENT},
+  {"./././././././././.",		"."},
+  {"/etc/.//doesNotExist",		0, "/etc/doesNotExist", ENOENT},
+  {"./doesExist",			"./doesExist"},
+  {"./doesExist/",			"./doesExist"},
+  /* 10 */
+  {"./doesExist/../doesExist",		"./doesExist"},
+  {"foobar",				0, "./foobar", ENOENT},
+  {".",					"."},
+  {"./foobar",				0, "./foobar", ENOENT},
+  {"SYMLINK_LOOP",			0, 0, ELOOP},
+  /* 15 */
+  {"./SYMLINK_LOOP",			0, 0, ELOOP},
+  {"SYMLINK_1",				"."},
+  {"SYMLINK_1/foobar",			0, "./foobar", ENOENT},
+  {"SYMLINK_2",				"/etc"},
+  {"SYMLINK_3",				"."},
+  /* 20 */
+  {"SYMLINK_4",				"/etc"},
+  {"../stdlib/SYMLINK_1",		"."},
+  {"../stdlib/SYMLINK_2",		"/etc"},
+  {"../stdlib/SYMLINK_3",		"."},
+  {"../stdlib/SYMLINK_4",		"/etc"},
+  /* 25 */
+  {"./SYMLINK_5",			0, "./doesNotExist", ENOENT},
+  {"SYMLINK_5",				0, "./doesNotExist", ENOENT},
+  {"SYMLINK_5/foobar",			0, "./doesNotExist", ENOENT},
+  {"doesExist/../../stdlib/doesExist",	"./doesExist"},
+  {"doesExist/.././../stdlib/.",	"."},
+#ifndef __UCLIBC__
+  /* we dont check for ENOTDIR in readlink() which causes failures to
+   * propogate up to realpath() ... so disable for now ... */
+  /* 30 */
+  {"./doesExist/someFile/",		0, "./doesExist/someFile", ENOTDIR},
+  {"./doesExist/someFile/..",		0, "./doesExist/someFile", ENOTDIR},
+#endif
+};
+
+
+static int
+check_path (const char * result, const char * expected)
+{
+  int good;
+
+  if (!result)
+    return (expected == NULL);
+
+  if (!expected)
+    return 0;
+
+  if (expected[0] == '.' && (expected[1] == '/' || expected[1] == '\0'))
+    good = (strncmp (result, cwd, cwd_len) == 0
+	    && strcmp (result + cwd_len, expected + 1) == 0);
+  else
+    good = (strcmp (expected, result) == 0);
+
+  return good;
+}
+
+
+int
+do_test (int argc, char ** argv)
+{
+  char * result;
+  int i, errors = 0;
+  char buf[PATH_MAX];
+
+  getcwd (cwd, sizeof(buf));
+  cwd_len = strlen (cwd);
+
+#ifndef __UCLIBC__
+  /* we choose to crash in uClibc when given a NULL */
+  errno = 0;
+  if (realpath (NULL, buf) != NULL || errno != EINVAL)
+    {
+      printf ("%s: expected return value NULL and errno set to EINVAL"
+	      " for realpath(NULL,...)\n", argv[0]);
+      ++errors;
+    }
+#endif
+
+#if 0
+  /* This is now allowed.  The test is invalid.  */
+  errno = 0;
+  if (realpath ("/", NULL) != NULL || errno != EINVAL)
+    {
+      printf ("%s: expected return value NULL and errno set to EINVAL"
+	      " for realpath(...,NULL)\n", argv[0]);
+      ++errors;
+    }
+#endif
+
+  errno = 0;
+  if (realpath ("", buf) != NULL || errno != ENOENT)
+    {
+      printf ("%s: expected return value NULL and set errno to ENOENT"
+	      " for realpath(\"\",...)\n", argv[0]);
+      ++errors;
+    }
+
+  for (i = 0; i < (int) (sizeof (symlinks) / sizeof (symlinks[0])); ++i)
+    symlink (symlinks[i].value, symlinks[i].name);
+
+  int has_dir = mkdir ("doesExist", 0777) == 0;
+
+  int fd = has_dir ? creat ("doesExist/someFile", 0777) : -1;
+
+  for (i = 0; i < (int) (sizeof (tests) / sizeof (tests[0])); ++i)
+    {
+      buf[0] = '\0';
+      errno = 0;
+      result = realpath (tests[i].in, buf);
+
+      if (!check_path (result, tests[i].retval))
+	{
+	  printf ("%s: flunked test %d (expected `%s', got `%s')\n",
+		  argv[0], i, tests[i].retval ? tests[i].retval : "NULL",
+		  result ? result : "NULL");
+	  ++errors;
+	  continue;
+	}
+
+      if (result && !check_path (buf, tests[i].retval ? tests[i].retval : tests[i].retbuf))
+	{
+	  printf ("%s: flunked test %d (expected resolved `%s', got `%s')\n",
+		  argv[0], i, tests[i].retval ? tests[i].retval : tests[i].retbuf,
+		  buf);
+	  ++errors;
+	  continue;
+	}
+
+      if (errno != tests[i].error)
+	{
+	  printf ("%s: flunked test %d (expected errno %d, got %d)\n",
+		  argv[0], i, tests[i].error, errno);
+	  ++errors;
+	  continue;
+	}
+
+#ifndef __UCLIBC__
+      /* we choose to crash in uClibc when given a NULL */
+      char *result2 = realpath (tests[i].in, NULL);
+      if ((result2 == NULL && result != NULL)
+	  || (result2 != NULL && strcmp (result, result2) != 0))
+	{
+	  printf ("\
+%s: realpath(..., NULL) produced different result than realpath(..., buf): '%s' vs '%s'\n",
+		  argv[0], result2, result);
+	  ++errors;
+	}
+      free (result2);
+#endif
+    }
+
+  getcwd (buf, sizeof(buf));
+  if (strcmp (buf, cwd))
+    {
+      printf ("%s: current working directory changed from %s to %s\n",
+	      argv[0], cwd, buf);
+      ++errors;
+    }
+
+  if (fd >= 0)
+    {
+      close (fd);
+      unlink ("doesExist/someFile");
+    }
+
+  if (has_dir)
+    rmdir ("doesExist");
+
+  for (i = 0; i < (int) (sizeof (symlinks) / sizeof (symlinks[0])); ++i)
+    unlink (symlinks[i].name);
+
+  if (errors != 0)
+    {
+      printf ("%d errors.\n", errors);
+      return EXIT_FAILURE;
+    }
+
+  puts ("No errors.");
+  return EXIT_SUCCESS;
+}
diff --git a/ap/build/uClibc/test/stdlib/test-canon2.c b/ap/build/uClibc/test/stdlib/test-canon2.c
new file mode 100644
index 0000000..e7e02e5
--- /dev/null
+++ b/ap/build/uClibc/test/stdlib/test-canon2.c
@@ -0,0 +1,87 @@
+/* Test for realpath/canonicalize function.
+   Copyright (C) 1998 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+   Contributed by Ulrich Drepper <drepper@cygnus.com>, 1998.
+
+   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 <errno.h>
+#include <string.h>
+
+
+/* Prototype for our test function.  */
+extern void do_prepare (int argc, char *argv[]);
+extern int do_test (int argc, char *argv[]);
+
+/* We have a preparation function.  */
+#define PREPARE do_prepare
+
+#include <test-skeleton.c>
+
+/* Name of the temporary files we create.  */
+char *name1;
+char *name2;
+
+/* Preparation.  */
+void
+do_prepare (int argc, char *argv[])
+{
+  size_t test_dir_len;
+  int tfd;
+
+  test_dir_len = strlen (test_dir);
+
+  /* Generate the circular symlinks.  */
+  name1 = malloc (test_dir_len + sizeof ("/canonXXXXXX"));
+  mempcpy (mempcpy (name1, test_dir, test_dir_len),
+	   "/canonXXXXXX", sizeof ("/canonXXXXXX"));
+  name2 = strdup (name1);
+  tfd = mkstemp(name1);
+  if (tfd < 0) {
+	  printf("%s: cannot generate temp file name\n", __FUNCTION__);
+	  exit(1);
+  }
+  close(tfd);
+  add_temp_file (name1);
+  tfd = mkstemp(name2);
+  if (tfd < 0) {
+	  printf("%s: cannot generate temp file name\n", __FUNCTION__);
+	  exit(1);
+  }
+  close(tfd);
+  add_temp_file (name2);
+}
+
+
+/* Run the test.  */
+int
+do_test (int argc, char *argv[])
+{
+  char *canon;
+
+  printf ("create symlinks from %s to %s and vice versa\n", name1, name2);
+  if (symlink (name1, name2) == -1
+      || symlink (name2, name1) == -1)
+    /* We cannot test this.  */
+    return 0;
+
+  /* Call the function.  This is equivalent the using `realpath' but the
+     function allocates the room for the result.  */
+  errno = 0;
+  canon = canonicalize_file_name (name1);
+
+  return canon != NULL || errno != ELOOP;
+}
diff --git a/ap/build/uClibc/test/stdlib/testatexit.c b/ap/build/uClibc/test/stdlib/testatexit.c
new file mode 100644
index 0000000..01874fd
--- /dev/null
+++ b/ap/build/uClibc/test/stdlib/testatexit.c
@@ -0,0 +1,81 @@
+/*
+ * This test program will register the maximum number of exit functions
+ * with atexit().  When this program exits, each exit function should get
+ * called in the reverse order in which it was registered.  (If the system
+ * supports more than 25 exit functions, the function names will loop, but
+ * the effect will be the same.  Feel free to add more functions if desired)
+ */
+#include <stdio.h>
+#include <stdlib.h>
+
+typedef void (*vfuncp) (void);
+
+/* All functions call exit(), in order to test that exit functions can call
+ * exit() without screwing everything up. :)
+ */
+#define make_exitfunc(num) \
+__attribute__ ((__noreturn__)) static \
+void exitfunc##num(void) \
+{ \
+	printf("Executing exitfunc"#num".\n"); \
+	exit(0); \
+}
+make_exitfunc(0)
+make_exitfunc(1)
+make_exitfunc(2)
+make_exitfunc(3)
+make_exitfunc(4)
+make_exitfunc(5)
+make_exitfunc(6)
+make_exitfunc(7)
+make_exitfunc(8)
+make_exitfunc(9)
+make_exitfunc(10)
+make_exitfunc(11)
+make_exitfunc(12)
+make_exitfunc(13)
+make_exitfunc(14)
+make_exitfunc(15)
+make_exitfunc(16)
+make_exitfunc(17)
+make_exitfunc(18)
+make_exitfunc(19)
+make_exitfunc(20)
+make_exitfunc(21)
+make_exitfunc(22)
+make_exitfunc(23)
+make_exitfunc(24)
+
+static vfuncp func_table[] =
+	{
+	exitfunc0, exitfunc1, exitfunc2, exitfunc3, exitfunc4,
+	exitfunc5, exitfunc6, exitfunc7, exitfunc8, exitfunc9,
+	exitfunc10, exitfunc11, exitfunc12, exitfunc13, exitfunc14,
+	exitfunc15, exitfunc16, exitfunc17, exitfunc18, exitfunc19,
+	exitfunc20, exitfunc21, exitfunc22, exitfunc23, exitfunc24
+	};
+
+/* glibc dynamically adds exit functions, so it will keep adding until
+ * it runs out of memory!  So this will limit the number of exit functions
+ * we add in the loop below.  uClibc has a set limit (currently 20), so the
+ * loop will go until it can't add any more (so it should not hit this limit).
+ */
+#define ATEXIT_LIMIT 20
+
+int
+main ( void )
+{
+	int i = 0;
+	int count = 0;
+	int numfuncs = sizeof(func_table)/sizeof(vfuncp);
+
+	/* loop until no more can be added */
+	while(count < ATEXIT_LIMIT && atexit(func_table[i]) >= 0) {
+		printf("Registered exitfunc%d with atexit()\n", i);
+		count++;
+		i = (i+1) % numfuncs;
+	}
+	printf("%d functions registered with atexit.\n", count);
+
+	return 0;
+}
diff --git a/ap/build/uClibc/test/stdlib/teston_exit.c b/ap/build/uClibc/test/stdlib/teston_exit.c
new file mode 100644
index 0000000..f7e8fd0
--- /dev/null
+++ b/ap/build/uClibc/test/stdlib/teston_exit.c
@@ -0,0 +1,82 @@
+/*
+ * This test program will register the maximum number of exit functions
+ * with on_exit().  When this program exits, each exit function should get
+ * called in the reverse order in which it was registered.  (If the system
+ * supports more than 25 exit functions, the function names will loop, but
+ * the effect will be the same.  Feel free to add more functions if desired)
+ */
+#include <stdio.h>
+#include <stdlib.h>
+
+typedef void (*efuncp) (int, void *);
+
+/* All functions call exit(), in order to test that exit functions can call
+ * exit() without screwing everything up. The value passed in through arg gets
+ * used as the next exit status.
+ */
+#define make_exitfunc(num) \
+__attribute__ ((__noreturn__)) static \
+void exitfunc##num(int status, void *arg) \
+{ \
+	printf("Executing exitfunc"#num" (status=%d, arg=%lu)\n", status, (unsigned long)arg); \
+	exit((unsigned long)arg); \
+}
+make_exitfunc(0)
+make_exitfunc(1)
+make_exitfunc(2)
+make_exitfunc(3)
+make_exitfunc(4)
+make_exitfunc(5)
+make_exitfunc(6)
+make_exitfunc(7)
+make_exitfunc(8)
+make_exitfunc(9)
+make_exitfunc(10)
+make_exitfunc(11)
+make_exitfunc(12)
+make_exitfunc(13)
+make_exitfunc(14)
+make_exitfunc(15)
+make_exitfunc(16)
+make_exitfunc(17)
+make_exitfunc(18)
+make_exitfunc(19)
+make_exitfunc(20)
+make_exitfunc(21)
+make_exitfunc(22)
+make_exitfunc(23)
+make_exitfunc(24)
+
+static efuncp func_table[] =
+	{
+	exitfunc0, exitfunc1, exitfunc2, exitfunc3, exitfunc4,
+	exitfunc5, exitfunc6, exitfunc7, exitfunc8, exitfunc9,
+	exitfunc10, exitfunc11, exitfunc12, exitfunc13, exitfunc14,
+	exitfunc15, exitfunc16, exitfunc17, exitfunc18, exitfunc19,
+	exitfunc20, exitfunc21, exitfunc22, exitfunc23, exitfunc24
+	};
+
+/* glibc dynamically adds exit functions, so it will keep adding until
+ * it runs out of memory!  So this will limit the number of exit functions
+ * we add in the loop below.  uClibc has a set limit (currently 20), so the
+ * loop will go until it can't add any more (so it should not hit this limit).
+ */
+#define ON_EXIT_LIMIT 20
+
+int
+main ( void )
+{
+	int i = 0;
+	unsigned long count = 0;
+	int numfuncs = sizeof(func_table)/sizeof(efuncp);
+
+	/* loop until no more can be added */
+	while(count < ON_EXIT_LIMIT && on_exit(func_table[i], (void *)count) >= 0) {
+		count++;
+		printf("Registered exitfunc%d with on_exit()\n", i);
+		i = (i+1) % numfuncs;
+	}
+	printf("%lu functions registered with on_exit.\n", count);
+	exit(count);
+}
+
diff --git a/ap/build/uClibc/test/stdlib/teststrtol.c b/ap/build/uClibc/test/stdlib/teststrtol.c
new file mode 100644
index 0000000..5b43a9b
--- /dev/null
+++ b/ap/build/uClibc/test/stdlib/teststrtol.c
@@ -0,0 +1,109 @@
+
+#include <stdlib.h>
+#include <stdio.h>
+
+
+const char *strings[]={
+	/* some simple stuff */
+	"0", "1", "10",
+	"100", "1000", "10000", "100000", "1000000",
+	"10000000", "100000000", "1000000000",
+
+	/* negative */
+	"-0", "-1", "-10",
+	"-100", "-1000", "-10000", "-100000", "-1000000",
+	"-10000000", "-100000000", "-1000000000",
+
+	/* test base>10 */
+	"a", "b", "f", "g", "z",
+
+	/* test hex */
+	"0x0", "0x1", "0xa", "0xf", "0x10",
+
+	/* test octal */
+	"00", "01", "07", "08", "0a", "010",
+
+	/* other */
+	"0x8000000",
+
+	/* check overflow cases: (for 32 bit) */
+	"2147483645",
+	"2147483646",
+	"2147483647",
+	"2147483648",
+	"2147483649",
+	"-2147483645",
+	"-2147483646",
+	"-2147483647",
+	"-2147483648",
+	"-2147483649",
+	"4294967293",
+	"4294967294",
+	"4294967295",
+	"4294967296",
+	"4294967297",
+	"-4294967293",
+	"-4294967294",
+	"-4294967295",
+	"-4294967296",
+	"-4294967297",
+
+	/* bad input tests */
+	"",
+	"00",
+	"0x",
+	"0x0",
+	"-",
+	"+",
+	" ",
+	" -",
+	" - 0",
+};
+int n_tests=sizeof(strings)/sizeof(strings[0]);
+
+void do_test(int base);
+void do_utest(int base);
+
+int main(int argc,char *argv[])
+{
+	do_test(0);
+	do_test(8);
+	do_test(10);
+	do_test(16);
+	do_test(36);
+
+	do_utest(0);
+	do_utest(8);
+	do_utest(10);
+	do_utest(16);
+	do_utest(36);
+
+	return 0;
+}
+
+void do_test(int base)
+{
+	int i;
+	long n;
+	char *endptr;
+
+	for(i=0;i<n_tests;i++){
+		n=strtol(strings[i],&endptr,base);
+		printf("strtol(\"%s\",%d) len=%lu res=%ld\n",
+			strings[i],base,(unsigned long)(endptr-strings[i]),n);
+	}
+}
+
+void do_utest(int base)
+{
+	int i;
+	unsigned long n;
+	char *endptr;
+
+	for(i=0;i<n_tests;i++){
+		n=strtoul(strings[i],&endptr,base);
+		printf("strtoul(\"%s\",%d) len=%lu res=%lu\n",
+			strings[i],base,(unsigned long)(endptr-strings[i]),n);
+	}
+}
+
diff --git a/ap/build/uClibc/test/stdlib/teststrtoq.c b/ap/build/uClibc/test/stdlib/teststrtoq.c
new file mode 100644
index 0000000..6e1a4cb
--- /dev/null
+++ b/ap/build/uClibc/test/stdlib/teststrtoq.c
@@ -0,0 +1,89 @@
+
+#include <stdlib.h>
+#include <stdio.h>
+
+
+const char *strings[]={
+	/* some simple stuff */
+	"0", "1", "10",
+	"100", "1000", "10000", "100000", "1000000",
+	"10000000", "100000000", "1000000000",
+
+	/* negative */
+	"-0", "-1", "-10",
+	"-100", "-1000", "-10000", "-100000", "-1000000",
+	"-10000000", "-100000000", "-1000000000",
+
+	/* test base>10 */
+	"a", "b", "f", "g", "z",
+
+	/* test hex */
+	"0x0", "0x1", "0xa", "0xf", "0x10",
+
+	/* test octal */
+	"00", "01", "07", "08", "0a", "010",
+
+	/* other */
+	"0x8000000",
+
+	/* check overflow cases: (for 32 bit) */
+	"2147483645",
+	"2147483646",
+	"2147483647",
+	"2147483648",
+	"2147483649",
+	"-2147483645",
+	"-2147483646",
+	"-2147483647",
+	"-2147483648",
+	"-2147483649",
+	"4294967293",
+	"4294967294",
+	"4294967295",
+	"4294967296",
+	"4294967297",
+	"-4294967293",
+	"-4294967294",
+	"-4294967295",
+	"-4294967296",
+	"-4294967297",
+
+	/* bad input tests */
+	"",
+	"00",
+	"0x",
+	"0x0",
+	"-",
+	"+",
+	" ",
+	" -",
+	" - 0",
+};
+int n_tests=sizeof(strings)/sizeof(strings[0]);
+
+
+
+void do_test(int base);
+void do_test(int base)
+{
+	int i;
+	quad_t n;
+	char *endptr;
+
+	for(i=0;i<n_tests;i++){
+		n=strtoq(strings[i],&endptr,base);
+		printf("strtoq(\"%s\",%d) len=%lu res=%qd\n",
+			strings[i],base,(unsigned long)(endptr-strings[i]),n);
+	}
+}
+
+int main(int argc,char *argv[])
+{
+	do_test(0);
+	do_test(8);
+	do_test(10);
+	do_test(16);
+	do_test(36);
+
+	return 0;
+}
diff --git a/ap/build/uClibc/test/string/Makefile b/ap/build/uClibc/test/string/Makefile
new file mode 100644
index 0000000..62c8269
--- /dev/null
+++ b/ap/build/uClibc/test/string/Makefile
@@ -0,0 +1,7 @@
+# uClibc string tests
+# Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
+
+top_builddir=../../
+include ../Rules.mak
+-include Makefile.in
+include ../Test.mak
diff --git a/ap/build/uClibc/test/string/Makefile.in b/ap/build/uClibc/test/string/Makefile.in
new file mode 100644
index 0000000..ad52a9f
--- /dev/null
+++ b/ap/build/uClibc/test/string/Makefile.in
@@ -0,0 +1,4 @@
+# uClibc string tests
+# Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
+
+EXTRA_CFLAGS := -fno-builtin
diff --git a/ap/build/uClibc/test/string/bug-strcoll1.c b/ap/build/uClibc/test/string/bug-strcoll1.c
new file mode 100644
index 0000000..b6510d9
--- /dev/null
+++ b/ap/build/uClibc/test/string/bug-strcoll1.c
@@ -0,0 +1,24 @@
+#include <stdio.h>
+#include <string.h>
+#include <locale.h>
+
+int
+main (void)
+{
+  const char t1[] = "0-0-0-0-0-0-0-0-0-0.COM";
+  const char t2[] = "00000-00000.COM";
+  int res1;
+  int res2;
+
+  setlocale (LC_ALL, "en_US.ISO-8859-1");
+
+  res1 = strcoll (t1, t2);
+  printf ("strcoll (\"%s\", \"%s\") = %d\n", t1, t2, res1);
+  res2 = strcoll (t2, t1);
+  printf ("strcoll (\"%s\", \"%s\") = %d\n", t2, t1, res2);
+
+  return ((res1 == 0 && res2 != 0)
+	  || (res1 != 0 && res2 == 0)
+	  || (res1 < 0 && res2 < 0)
+	  || (res1 > 0 && res2 > 0));
+}
diff --git a/ap/build/uClibc/test/string/bug-strncat1.c b/ap/build/uClibc/test/string/bug-strncat1.c
new file mode 100644
index 0000000..f1b5c37
--- /dev/null
+++ b/ap/build/uClibc/test/string/bug-strncat1.c
@@ -0,0 +1,31 @@
+/* Test case by Joseph S. Myers <jsm28@cam.ac.uk>.  */
+#undef __USE_STRING_INLINES
+#define __USE_STRING_INLINES
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+
+char d[3] = "\0\1\2";
+
+int
+main (void)
+{
+  strncat (d, "\5\6", 1);
+  if (d[0] != '\5')
+    {
+      puts ("d[0] != '\\5'");
+      exit (1);
+    }
+  if (d[1] != '\0')
+    {
+      puts ("d[1] != '\\0'");
+      exit (1);
+    }
+  if (d[2] != '\2')
+    {
+      puts ("d[2] != '\\2'");
+      exit (1);
+    }
+
+  return 0;
+}
diff --git a/ap/build/uClibc/test/string/bug-strpbrk1.c b/ap/build/uClibc/test/string/bug-strpbrk1.c
new file mode 100644
index 0000000..28238b0
--- /dev/null
+++ b/ap/build/uClibc/test/string/bug-strpbrk1.c
@@ -0,0 +1,19 @@
+/* Test case by Joseph S. Myers <jsm28@cam.ac.uk>.  */
+#undef __USE_STRING_INLINES
+#define __USE_STRING_INLINES
+#include <string.h>
+#include <stdlib.h>
+#include <stdio.h>
+
+int
+main (void)
+{
+  const char *a = "abc";
+  const char *b = a;
+
+  strpbrk (b++, "");
+  if (b != a + 1)
+    return 1;
+
+  return 0;
+}
diff --git a/ap/build/uClibc/test/string/bug-strspn1.c b/ap/build/uClibc/test/string/bug-strspn1.c
new file mode 100644
index 0000000..a657baf
--- /dev/null
+++ b/ap/build/uClibc/test/string/bug-strspn1.c
@@ -0,0 +1,19 @@
+/* Test case by Joseph S. Myers <jsm28@cam.ac.uk>.  */
+#undef __USE_STRING_INLINES
+#define __USE_STRING_INLINES
+#include <string.h>
+#include <stdlib.h>
+#include <stdio.h>
+
+int
+main (void)
+{
+  const char *a = "abc";
+  const char *b = a;
+
+  strspn (b++, "");
+  if (b != a + 1)
+    return 1;
+
+  return 0;
+}
diff --git a/ap/build/uClibc/test/string/stratcliff.c b/ap/build/uClibc/test/string/stratcliff.c
new file mode 100644
index 0000000..41e7746
--- /dev/null
+++ b/ap/build/uClibc/test/string/stratcliff.c
@@ -0,0 +1,349 @@
+/* Test for string function add boundaries of usable memory.
+   Copyright (C) 1996,1997,1999-2002,2003 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+   Contributed by Ulrich Drepper <drepper@cygnus.com>, 1996.
+
+   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.  */
+
+#define _GNU_SOURCE 1
+
+/* Make sure we don't test the optimized inline functions if we want to
+   test the real implementation.  */
+#undef __USE_STRING_INLINES
+
+#include <errno.h>
+#include <stdio.h>
+#include <string.h>
+#include <unistd.h>
+#include <sys/mman.h>
+#include <sys/param.h>
+
+#ifndef MAX
+#define MAX(a, b) ((a) > (b) ? (a) : (b))
+#endif
+
+int
+main (int argc, char *argv[])
+{
+  int size = sysconf (_SC_PAGESIZE);
+  char *adr, *dest;
+  int result = 0;
+
+  adr = (char *) mmap (NULL, 3 * size, PROT_READ | PROT_WRITE,
+		       MAP_PRIVATE | MAP_ANON, -1, 0);
+  dest = (char *) mmap (NULL, 3 * size, PROT_READ | PROT_WRITE,
+			MAP_PRIVATE | MAP_ANON, -1, 0);
+  if (adr == MAP_FAILED || dest == MAP_FAILED)
+    {
+      if (errno == ENOSYS)
+        puts ("No test, mmap not available.");
+      else
+        {
+          printf ("mmap failed: %s", strerror(errno));
+          result = 1;
+        }
+    }
+  else
+    {
+      int inner, middle, outer;
+
+      mprotect(adr, size, PROT_NONE);
+      mprotect(adr + 2 * size, size, PROT_NONE);
+      adr += size;
+
+      mprotect(dest, size, PROT_NONE);
+      mprotect(dest + 2 * size, size, PROT_NONE);
+      dest += size;
+
+      memset (adr, 'T', size);
+
+      /* strlen test */
+      for (outer = size - 1; outer >= MAX (0, size - 128); --outer)
+        {
+          for (inner = MAX (outer, size - 64); inner < size; ++inner)
+	    {
+	      adr[inner] = '\0';
+
+	      if (strlen (&adr[outer]) != (size_t) (inner - outer))
+		{
+		  printf ("strlen flunked for outer = %d, inner = %d\n",
+			  outer, inner);
+		  result = 1;
+		}
+
+	      adr[inner] = 'T';
+	    }
+        }
+
+      /* strchr test */
+      for (outer = size - 1; outer >= MAX (0, size - 128); --outer)
+        {
+	  for (middle = MAX (outer, size - 64); middle < size; ++middle)
+	    {
+	      for (inner = middle; inner < size; ++inner)
+		{
+		  char *cp;
+		  adr[middle] = 'V';
+		  adr[inner] = '\0';
+
+		  cp = strchr (&adr[outer], 'V');
+
+		  if ((inner == middle && cp != NULL)
+		      || (inner != middle
+			  && (cp - &adr[outer]) != middle - outer))
+		    {
+		      printf ("strchr flunked for outer = %d, middle = %d, "
+			      "inner = %d\n", outer, middle, inner);
+		      result = 1;
+		    }
+
+		  adr[inner] = 'T';
+		  adr[middle] = 'T';
+		}
+	    }
+        }
+
+      /* Special test.  */
+      adr[size - 1] = '\0';
+      if (strchr (&adr[size - 1], '\n') != NULL)
+	{
+	  puts ("strchr flunked for test of empty string at end of page");
+	  result = 1;
+	}
+
+      /* strrchr test */
+      for (outer = size - 1; outer >= MAX (0, size - 128); --outer)
+        {
+	  for (middle = MAX (outer, size - 64); middle < size; ++middle)
+	    {
+	      for (inner = middle; inner < size; ++inner)
+		{
+		  char *cp;
+		  adr[middle] = 'V';
+		  adr[inner] = '\0';
+
+		  cp = strrchr (&adr[outer], 'V');
+
+		  if ((inner == middle && cp != NULL)
+		      || (inner != middle
+			  && (cp - &adr[outer]) != middle - outer))
+		    {
+		      printf ("strrchr flunked for outer = %d, middle = %d, "
+			      "inner = %d\n", outer, middle, inner);
+		      result = 1;
+		    }
+
+		  adr[inner] = 'T';
+		  adr[middle] = 'T';
+		}
+	    }
+        }
+
+      /* rawmemchr test */
+      for (outer = size - 1; outer >= MAX (0, size - 128); --outer)
+        {
+	  for (middle = MAX (outer, size - 64); middle < size; ++middle)
+	    {
+	      char *cp;
+	      adr[middle] = 'V';
+
+	      cp = rawmemchr (&adr[outer], 'V');
+
+	      if (cp - &adr[outer] != middle - outer)
+		{
+		  printf ("rawmemchr flunked for outer = %d, middle = %d\n",
+			  outer, middle);
+		  result = 1;
+		}
+
+	      adr[middle] = 'T';
+	    }
+        }
+
+      /* strcpy test */
+      for (outer = size - 1; outer >= MAX (0, size - 128); --outer)
+        {
+          for (inner = MAX (outer, size - 64); inner < size; ++inner)
+	    {
+	      adr[inner] = '\0';
+
+	      if (strcpy (dest, &adr[outer]) != dest
+		  || strlen (dest) != (size_t) (inner - outer))
+		{
+		  printf ("strcpy flunked for outer = %d, inner = %d\n",
+			  outer, inner);
+		  result = 1;
+		}
+
+	      adr[inner] = 'T';
+	    }
+        }
+
+      /* strncpy tests */
+      adr[size-1] = 'T';
+      for (outer = size - 1; outer >= MAX (0, size - 128); --outer)
+	{
+	  size_t len;
+
+	  for (len = 0; len < size - outer; ++len)
+	    {
+	      if (strncpy (dest, &adr[outer], len) != dest
+		  || memcmp (dest, &adr[outer], len) != 0)
+		{
+		  printf ("outer strncpy flunked for outer = %d, len = %Zd\n",
+			  outer, len);
+		  result = 1;
+		}
+	    }
+        }
+      adr[size-1] = '\0';
+
+      for (outer = size - 1; outer >= MAX (0, size - 128); --outer)
+        {
+          for (inner = MAX (outer, size - 64); inner < size; ++inner)
+	    {
+	      size_t len;
+
+	      adr[inner] = '\0';
+
+	      for (len = 0; len < size - outer + 64; ++len)
+		{
+		  if (strncpy (dest, &adr[outer], len) != dest
+		      || memcmp (dest, &adr[outer],
+				 MIN (inner - outer, len)) != 0
+		      || (inner - outer < len
+			  && strlen (dest) != (inner - outer)))
+		    {
+		      printf ("strncpy flunked for outer = %d, inner = %d, len = %Zd\n",
+			      outer, inner, len);
+		      result = 1;
+		    }
+		  if (strncpy (dest + 1, &adr[outer], len) != dest + 1
+		      || memcmp (dest + 1, &adr[outer],
+				 MIN (inner - outer, len)) != 0
+		      || (inner - outer < len
+			  && strlen (dest + 1) != (inner - outer)))
+		    {
+		      printf ("strncpy+1 flunked for outer = %d, inner = %d, len = %Zd\n",
+			      outer, inner, len);
+		      result = 1;
+		    }
+		}
+
+	      adr[inner] = 'T';
+	    }
+        }
+
+      /* stpcpy test */
+      for (outer = size - 1; outer >= MAX (0, size - 128); --outer)
+        {
+          for (inner = MAX (outer, size - 64); inner < size; ++inner)
+	    {
+	      adr[inner] = '\0';
+
+	      if ((stpcpy (dest, &adr[outer]) - dest) != inner - outer)
+		{
+		  printf ("stpcpy flunked for outer = %d, inner = %d\n",
+			  outer, inner);
+		  result = 1;
+		}
+
+	      adr[inner] = 'T';
+	    }
+        }
+
+      /* stpncpy test */
+      for (outer = size - 1; outer >= MAX (0, size - 128); --outer)
+        {
+          for (middle = MAX (outer, size - 64); middle < size; ++middle)
+	    {
+	      adr[middle] = '\0';
+
+	      for (inner = 0; inner < size - outer; ++ inner)
+		{
+		  if ((stpncpy (dest, &adr[outer], inner) - dest)
+		      != MIN (inner, middle - outer))
+		    {
+		      printf ("stpncpy flunked for outer = %d, middle = %d, "
+			      "inner = %d\n", outer, middle, inner);
+		      result = 1;
+		    }
+		}
+
+	      adr[middle] = 'T';
+	    }
+        }
+
+      /* memcpy test */
+      for (outer = size - 1; outer >= MAX (0, size - 128); --outer)
+	for (inner = 0; inner < size - outer; ++inner)
+	  if (memcpy (dest, &adr[outer], inner) !=  dest)
+	    {
+	      printf ("memcpy flunked for outer = %d, inner = %d\n",
+		      outer, inner);
+	      result = 1;
+	    }
+
+      /* mempcpy test */
+      for (outer = size - 1; outer >= MAX (0, size - 128); --outer)
+	for (inner = 0; inner < size - outer; ++inner)
+	  if (mempcpy (dest, &adr[outer], inner) !=  dest + inner)
+	    {
+	      printf ("mempcpy flunked for outer = %d, inner = %d\n",
+		      outer, inner);
+	      result = 1;
+	    }
+
+      /* memccpy test */
+      memset (adr, '\0', size);
+      for (outer = size - 1; outer >= MAX (0, size - 128); --outer)
+	for (inner = 0; inner < size - outer; ++inner)
+	  if (memccpy (dest, &adr[outer], '\1', inner) != NULL)
+	    {
+	      printf ("memccpy flunked full copy for outer = %d, inner = %d\n",
+		      outer, inner);
+	      result = 1;
+	    }
+      for (outer = size - 1; outer >= MAX (0, size - 128); --outer)
+	for (middle = 0; middle < size - outer; ++middle)
+	  {
+	    memset (dest, '\2', middle + 1);
+	    for (inner = 0; inner < middle; ++inner)
+	      {
+		adr[outer + inner] = '\1';
+
+		if (memccpy (dest, &adr[outer], '\1', middle + 128)
+		    !=  dest + inner + 1)
+		  {
+		    printf ("\
+memccpy flunked partial copy for outer = %d, middle = %d, inner = %d\n",
+			    outer, middle, inner);
+		    result = 1;
+		  }
+		else if (dest[inner + 1] != '\2')
+		  {
+		    printf ("\
+memccpy copied too much for outer = %d, middle = %d, inner = %d\n",
+			    outer, middle, inner);
+		    result = 1;
+		  }
+		adr[outer + inner] = '\0';
+	      }
+	  }
+    }
+
+  return result;
+}
diff --git a/ap/build/uClibc/test/string/test-ffs.c b/ap/build/uClibc/test/string/test-ffs.c
new file mode 100644
index 0000000..86e1175
--- /dev/null
+++ b/ap/build/uClibc/test/string/test-ffs.c
@@ -0,0 +1,66 @@
+/* Copyright (C) 1994, 1997, 2000, 2004 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+   Contributed by Joel Sherrill (jsherril@redstone-emh2.army.mil),
+     On-Line Applications Research Corporation.
+
+   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 <stdlib.h>
+#include <stdio.h>
+#include <string.h>
+
+int
+main (void)
+{
+  int failures = 0;
+  int i;
+
+  auto void try (const char *name, long long int param, int value,
+		 int expected);
+
+  void try (const char *name, long long int param, int value, int expected)
+    {
+      if (value != expected)
+	{
+	  printf ("%s(%#llx) expected %d got %d\n",
+		  name, param, expected, value);
+	  ++failures;
+	}
+      else
+	printf ("%s(%#llx) as expected %d\n", name, param, value);
+    }
+
+#define TEST(fct, type) \
+  try (#fct, 0, fct ((type) 0), 0);					      \
+  for (i=0 ; i < 8 * sizeof (type); i++)				      \
+    try (#fct, 1ll << i, fct (((type) 1) << i), i + 1);			      \
+  for (i=0 ; i < 8 * sizeof (type) ; i++)				      \
+    try (#fct, (~((type) 0) >> i) << i, fct ((~((type) 0) >> i) << i), i + 1);\
+  try (#fct, 0x80008000, fct ((type) 0x80008000), 16)
+
+  TEST (ffs, int);
+/* Not implemented in uClibc (yet?)
+  TEST (ffsl, long int);
+  TEST (ffsll, long long int);
+*/
+
+  if (failures)
+    printf ("Test FAILED!  %d failure%s.\n", failures, &"s"[failures == 1]);
+  else
+    puts ("Test succeeded.");
+
+  return failures;
+}
diff --git a/ap/build/uClibc/test/string/testcopy.c b/ap/build/uClibc/test/string/testcopy.c
new file mode 100644
index 0000000..60039f7
--- /dev/null
+++ b/ap/build/uClibc/test/string/testcopy.c
@@ -0,0 +1,108 @@
+/* Copyright (C) 1990, 1991, 1992, 1997 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+   Contributed by Torbjorn Granlund (tege@sics.se).
+
+   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 <stdlib.h>
+#include <stdio.h>
+#include <string.h>
+#include <malloc.h>
+
+int
+main (void)
+{
+  char *mem, *memp;
+  char *rand_mem;
+  char *lo_around, *hi_around;
+  int size, max_size;
+  int src_off, dst_off;
+  int i;
+  int space_around = 10;
+
+  max_size = 256;
+
+  mem = malloc (max_size + 2 * max_size + 2 * space_around);
+  rand_mem = malloc (max_size);
+  lo_around = malloc (space_around);
+  hi_around = malloc (space_around);
+  memp = mem + space_around;
+
+  /* Fill RAND_MEM with random bytes, each non-zero.  */
+  for (i = 0; i < max_size; i++)
+    {
+      int x;
+      do
+	x = random ();
+      while (x == 0);
+      rand_mem[i] = x;
+    }
+
+  for (size = 0; size < max_size; size++)
+    {
+      printf("phase %d\n", size);
+      for (src_off = 0; src_off <= 16; src_off++)
+	{
+	  for (dst_off = 0; dst_off <= 16; dst_off++)
+	    {
+	      /* Put zero around the intended destination, to check
+		 that it's not clobbered.  */
+	      for (i = 1; i < space_around; i++)
+		{
+		  memp[dst_off - i] = 0;
+		  memp[dst_off + size - 1 + i] = 0;
+		}
+
+	      /* Fill the source area with known contents.  */
+	      for (i = 0; i < size; i++)
+		memp[src_off + i] = rand_mem[i];
+
+	      /* Remember the contents around the destination area.
+		 (It might not be what we wrote some lines above, since
+		 the src area and the dst area overlap.)  */
+	      for (i = 1; i < space_around; i++)
+		{
+		  lo_around[i] = memp[dst_off - i];
+		  hi_around[i] = memp[dst_off + size - 1 + i];
+		}
+
+	      memmove (memp + dst_off, memp + src_off, size);
+
+	      /* Check that the destination area has the same
+		 contents we wrote to the source area.  */
+	      for (i = 0; i < size; i++)
+		{
+		  if (memp[dst_off + i] != rand_mem[i])
+		    abort ();
+		}
+
+	      /* Check that the area around the destination is not
+		 clobbered.  */
+	      for (i = 1; i < space_around; i++)
+		{
+		  if (memp[dst_off - i] != lo_around[i])
+		    abort ();
+		  if (memp[dst_off + size - 1 + i] != hi_around[i])
+		    abort ();
+		}
+	    }
+	}
+    }
+
+  puts ("Test succeeded.");
+
+  return 0;
+}
diff --git a/ap/build/uClibc/test/string/tester.c b/ap/build/uClibc/test/string/tester.c
new file mode 100644
index 0000000..7c8d314
--- /dev/null
+++ b/ap/build/uClibc/test/string/tester.c
@@ -0,0 +1,1647 @@
+/* Tester for string functions.
+   Copyright (C) 1995-2001, 2003, 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 _GNU_SOURCE
+#define _GNU_SOURCE
+#endif
+
+/* Make sure we don't test the optimized inline functions if we want to
+   test the real implementation.  */
+#if !defined DO_STRING_INLINES
+#undef __USE_STRING_INLINES
+#endif
+
+#include <errno.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <strings.h>
+#include <fcntl.h>
+
+#ifdef __UCLIBC__
+# define __TEST_BSD_FUNCS__
+#else
+# undef __TEST_BSD_FUNCS__
+#endif
+
+#if defined(__UCLIBC_SUSV3_LEGACY__) || defined(__UCLIBC_SUSV3_LEGACY_MACROS__)
+# define __TEST_SUSV3_LEGACY__
+#else
+# undef __TEST_SUSV3_LEGACY__
+#endif
+
+#define	STREQ(a, b)	(strcmp((a), (b)) == 0)
+
+const char *it = "<UNSET>";	/* Routine name for message routines. */
+size_t errors = 0;
+
+/* Complain if condition is not true.  */
+static void
+check (int thing, int number)
+{
+  if (!thing)
+    {
+      printf("%s flunked test %d\n", it, number);
+      ++errors;
+    }
+}
+
+/* Complain if first two args don't strcmp as equal.  */
+static void
+equal (const char *a, const char *b, int number)
+{
+  check(a != NULL && b != NULL && STREQ (a, b), number);
+}
+
+char one[50];
+char two[50];
+char *cp;
+
+static void
+test_strcmp (void)
+{
+  it = "strcmp";
+  check (strcmp ("", "") == 0, 1);		/* Trivial case. */
+  check (strcmp ("a", "a") == 0, 2);		/* Identity. */
+  check (strcmp ("abc", "abc") == 0, 3);	/* Multicharacter. */
+  check (strcmp ("abc", "abcd") < 0, 4);	/* Length mismatches. */
+  check (strcmp ("abcd", "abc") > 0, 5);
+  check (strcmp ("abcd", "abce") < 0, 6);	/* Honest miscompares. */
+  check (strcmp ("abce", "abcd") > 0, 7);
+  check (strcmp ("a\203", "a") > 0, 8);		/* Tricky if char signed. */
+  check (strcmp ("a\203", "a\003") > 0, 9);
+
+  {
+    char buf1[0x40], buf2[0x40];
+    int i, j;
+    for (i=0; i < 0x10; i++)
+      for (j = 0; j < 0x10; j++)
+	{
+	  int k;
+	  for (k = 0; k < 0x3f; k++)
+	    {
+	      buf1[k] = '0' ^ (k & 4);
+	      buf2[k] = '4' ^ (k & 4);
+	    }
+	  buf1[i] = buf1[0x3f] = 0;
+	  buf2[j] = buf2[0x3f] = 0;
+	  for (k = 0; k < 0xf; k++)
+	    {
+	      int cnum = 0x10+0x10*k+0x100*j+0x1000*i;
+	      check (strcmp (buf1+i,buf2+j) == 0, cnum);
+	      buf1[i+k] = 'A' + i + k;
+	      buf1[i+k+1] = 0;
+	      check (strcmp (buf1+i,buf2+j) > 0, cnum+1);
+	      check (strcmp (buf2+j,buf1+i) < 0, cnum+2);
+	      buf2[j+k] = 'B' + i + k;
+	      buf2[j+k+1] = 0;
+	      check (strcmp (buf1+i,buf2+j) < 0, cnum+3);
+	      check (strcmp (buf2+j,buf1+i) > 0, cnum+4);
+	      buf2[j+k] = 'A' + i + k;
+	      buf1[i] = 'A' + i + 0x80;
+	      check (strcmp (buf1+i,buf2+j) > 0, cnum+5);
+	      check (strcmp (buf2+j,buf1+i) < 0, cnum+6);
+	      buf1[i] = 'A' + i;
+	    }
+	}
+  }
+}
+
+#define SIMPLE_COPY(fn, n, str, ntest) \
+  do {									      \
+    int __n;								      \
+    char *cp;								      \
+    for (__n = 0; __n < (int) sizeof (one); ++__n)			      \
+      one[__n] = 'Z';							      \
+    fn (one, str);							      \
+    for (cp = one, __n = 0; __n < n; ++__n, ++cp)			      \
+      check (*cp == '0' + (n % 10), ntest);				      \
+    check (*cp == '\0', ntest);						      \
+  } while (0)
+
+static void
+test_strcpy (void)
+{
+  int i;
+  it = "strcpy";
+  check (strcpy (one, "abcd") == one, 1); /* Returned value. */
+  equal (one, "abcd", 2);		/* Basic test. */
+
+  (void) strcpy (one, "x");
+  equal (one, "x", 3);			/* Writeover. */
+  equal (one+2, "cd", 4);		/* Wrote too much? */
+
+  (void) strcpy (two, "hi there");
+  (void) strcpy (one, two);
+  equal (one, "hi there", 5);		/* Basic test encore. */
+  equal (two, "hi there", 6);		/* Stomped on source? */
+
+  (void) strcpy (one, "");
+  equal (one, "", 7);			/* Boundary condition. */
+
+  for (i = 0; i < 16; i++)
+    {
+      (void) strcpy (one + i, "hi there");	/* Unaligned destination. */
+      equal (one + i, "hi there", 8 + (i * 2));
+      (void) strcpy (two, one + i);		/* Unaligned source. */
+      equal (two, "hi there", 9 + (i * 2));
+    }
+
+  SIMPLE_COPY(strcpy, 0, "", 41);
+  SIMPLE_COPY(strcpy, 1, "1", 42);
+  SIMPLE_COPY(strcpy, 2, "22", 43);
+  SIMPLE_COPY(strcpy, 3, "333", 44);
+  SIMPLE_COPY(strcpy, 4, "4444", 45);
+  SIMPLE_COPY(strcpy, 5, "55555", 46);
+  SIMPLE_COPY(strcpy, 6, "666666", 47);
+  SIMPLE_COPY(strcpy, 7, "7777777", 48);
+  SIMPLE_COPY(strcpy, 8, "88888888", 49);
+  SIMPLE_COPY(strcpy, 9, "999999999", 50);
+  SIMPLE_COPY(strcpy, 10, "0000000000", 51);
+  SIMPLE_COPY(strcpy, 11, "11111111111", 52);
+  SIMPLE_COPY(strcpy, 12, "222222222222", 53);
+  SIMPLE_COPY(strcpy, 13, "3333333333333", 54);
+  SIMPLE_COPY(strcpy, 14, "44444444444444", 55);
+  SIMPLE_COPY(strcpy, 15, "555555555555555", 56);
+  SIMPLE_COPY(strcpy, 16, "6666666666666666", 57);
+
+  /* Simple test using implicitly coerced `void *' arguments.  */
+  const void *src = "frobozz";
+  void *dst = one;
+  check (strcpy (dst, src) == dst, 1);
+  equal (dst, "frobozz", 2);
+}
+
+static void
+test_stpcpy (void)
+{
+  it = "stpcpy";
+  check ((stpcpy (one, "a") - one) == 1, 1);
+  equal (one, "a", 2);
+
+  check ((stpcpy (one, "ab") - one) == 2, 3);
+  equal (one, "ab", 4);
+
+  check ((stpcpy (one, "abc") - one) == 3, 5);
+  equal (one, "abc", 6);
+
+  check ((stpcpy (one, "abcd") - one) == 4, 7);
+  equal (one, "abcd", 8);
+
+  check ((stpcpy (one, "abcde") - one) == 5, 9);
+  equal (one, "abcde", 10);
+
+  check ((stpcpy (one, "abcdef") - one) == 6, 11);
+  equal (one, "abcdef", 12);
+
+  check ((stpcpy (one, "abcdefg") - one) == 7, 13);
+  equal (one, "abcdefg", 14);
+
+  check ((stpcpy (one, "abcdefgh") - one) == 8, 15);
+  equal (one, "abcdefgh", 16);
+
+  check ((stpcpy (one, "abcdefghi") - one) == 9, 17);
+  equal (one, "abcdefghi", 18);
+
+  check ((stpcpy (one, "x") - one) == 1, 19);
+  equal (one, "x", 20);			/* Writeover. */
+  equal (one+2, "cdefghi", 21);		/* Wrote too much? */
+
+  check ((stpcpy (one, "xx") - one) == 2, 22);
+  equal (one, "xx", 23);		/* Writeover. */
+  equal (one+3, "defghi", 24);		/* Wrote too much? */
+
+  check ((stpcpy (one, "xxx") - one) == 3, 25);
+  equal (one, "xxx", 26);		/* Writeover. */
+  equal (one+4, "efghi", 27);		/* Wrote too much? */
+
+  check ((stpcpy (one, "xxxx") - one) == 4, 28);
+  equal (one, "xxxx", 29);		/* Writeover. */
+  equal (one+5, "fghi", 30);		/* Wrote too much? */
+
+  check ((stpcpy (one, "xxxxx") - one) == 5, 31);
+  equal (one, "xxxxx", 32);		/* Writeover. */
+  equal (one+6, "ghi", 33);		/* Wrote too much? */
+
+  check ((stpcpy (one, "xxxxxx") - one) == 6, 34);
+  equal (one, "xxxxxx", 35);		/* Writeover. */
+  equal (one+7, "hi", 36);		/* Wrote too much? */
+
+  check ((stpcpy (one, "xxxxxxx") - one) == 7, 37);
+  equal (one, "xxxxxxx", 38);		/* Writeover. */
+  equal (one+8, "i", 39);		/* Wrote too much? */
+
+  check ((stpcpy (stpcpy (stpcpy (one, "a"), "b"), "c") - one) == 3, 40);
+  equal (one, "abc", 41);
+  equal (one + 4, "xxx", 42);
+
+  SIMPLE_COPY(stpcpy, 0, "", 43);
+  SIMPLE_COPY(stpcpy, 1, "1", 44);
+  SIMPLE_COPY(stpcpy, 2, "22", 45);
+  SIMPLE_COPY(stpcpy, 3, "333", 46);
+  SIMPLE_COPY(stpcpy, 4, "4444", 47);
+  SIMPLE_COPY(stpcpy, 5, "55555", 48);
+  SIMPLE_COPY(stpcpy, 6, "666666", 49);
+  SIMPLE_COPY(stpcpy, 7, "7777777", 50);
+  SIMPLE_COPY(stpcpy, 8, "88888888", 51);
+  SIMPLE_COPY(stpcpy, 9, "999999999", 52);
+  SIMPLE_COPY(stpcpy, 10, "0000000000", 53);
+  SIMPLE_COPY(stpcpy, 11, "11111111111", 54);
+  SIMPLE_COPY(stpcpy, 12, "222222222222", 55);
+  SIMPLE_COPY(stpcpy, 13, "3333333333333", 56);
+  SIMPLE_COPY(stpcpy, 14, "44444444444444", 57);
+  SIMPLE_COPY(stpcpy, 15, "555555555555555", 58);
+  SIMPLE_COPY(stpcpy, 16, "6666666666666666", 59);
+}
+
+static void
+test_stpncpy (void)
+{
+  it = "stpncpy";
+  memset (one, 'x', sizeof (one));
+  check (stpncpy (one, "abc", 2) == one + 2, 1);
+  check (stpncpy (one, "abc", 3) == one + 3, 2);
+  check (stpncpy (one, "abc", 4) == one + 3, 3);
+  check (one[3] == '\0' && one[4] == 'x', 4);
+  check (stpncpy (one, "abcd", 5) == one + 4, 5);
+  check (one[4] == '\0' && one[5] == 'x', 6);
+  check (stpncpy (one, "abcd", 6) == one + 4, 7);
+  check (one[4] == '\0' && one[5] == '\0' && one[6] == 'x', 8);
+}
+
+static void
+test_strcat (void)
+{
+  it = "strcat";
+  (void) strcpy (one, "ijk");
+  check (strcat (one, "lmn") == one, 1); /* Returned value. */
+  equal (one, "ijklmn", 2);		/* Basic test. */
+
+  (void) strcpy (one, "x");
+  (void) strcat (one, "yz");
+  equal (one, "xyz", 3);			/* Writeover. */
+  equal (one+4, "mn", 4);			/* Wrote too much? */
+
+  (void) strcpy (one, "gh");
+  (void) strcpy (two, "ef");
+  (void) strcat (one, two);
+  equal (one, "ghef", 5);			/* Basic test encore. */
+  equal (two, "ef", 6);			/* Stomped on source? */
+
+  (void) strcpy (one, "");
+  (void) strcat (one, "");
+  equal (one, "", 7);			/* Boundary conditions. */
+  (void) strcpy (one, "ab");
+  (void) strcat (one, "");
+  equal (one, "ab", 8);
+  (void) strcpy (one, "");
+  (void) strcat (one, "cd");
+  equal (one, "cd", 9);
+}
+
+static void
+test_strncat (void)
+{
+  /* First test it as strcat, with big counts, then test the count
+     mechanism.  */
+  it = "strncat";
+  (void) strcpy (one, "ijk");
+  check (strncat (one, "lmn", 99) == one, 1);	/* Returned value. */
+  equal (one, "ijklmn", 2);		/* Basic test. */
+
+  (void) strcpy (one, "x");
+  (void) strncat (one, "yz", 99);
+  equal (one, "xyz", 3);		/* Writeover. */
+  equal (one+4, "mn", 4);		/* Wrote too much? */
+
+  (void) strcpy (one, "gh");
+  (void) strcpy (two, "ef");
+  (void) strncat (one, two, 99);
+  equal (one, "ghef", 5);			/* Basic test encore. */
+  equal (two, "ef", 6);			/* Stomped on source? */
+
+  (void) strcpy (one, "");
+  (void) strncat (one, "", 99);
+  equal (one, "", 7);			/* Boundary conditions. */
+  (void) strcpy (one, "ab");
+  (void) strncat (one, "", 99);
+  equal (one, "ab", 8);
+  (void) strcpy (one, "");
+  (void) strncat (one, "cd", 99);
+  equal (one, "cd", 9);
+
+  (void) strcpy (one, "ab");
+  (void) strncat (one, "cdef", 2);
+  equal (one, "abcd", 10);			/* Count-limited. */
+
+  (void) strncat (one, "gh", 0);
+  equal (one, "abcd", 11);			/* Zero count. */
+
+  (void) strncat (one, "gh", 2);
+  equal (one, "abcdgh", 12);		/* Count and length equal. */
+
+  (void) strncat (one, "ij", (size_t)-1);	/* set sign bit in count */
+  equal (one, "abcdghij", 13);
+}
+
+static void
+test_strlcat (void)
+{
+#ifdef __TEST_BSD_FUNCS__
+  /* First test it as strcat, with big counts, then test the count
+     mechanism.  */
+  it = "strlcat";
+  (void) strcpy (one, "ijk");
+  check (strlcat (one, "lmn", 99) == 6, 1);	/* Returned value. */
+  equal (one, "ijklmn", 2);		/* Basic test. */
+
+  (void) strcpy (one, "x");
+  (void) strlcat (one, "yz", 99);
+  equal (one, "xyz", 3);		/* Writeover. */
+  equal (one+4, "mn", 4);		/* Wrote too much? */
+
+  (void) strcpy (one, "gh");
+  (void) strcpy (two, "ef");
+  (void) strlcat (one, two, 99);
+  equal (one, "ghef", 5);			/* Basic test encore. */
+  equal (two, "ef", 6);			/* Stomped on source? */
+
+  (void) strcpy (one, "");
+  (void) strlcat (one, "", 99);
+  equal (one, "", 7);			/* Boundary conditions. */
+  (void) strcpy (one, "ab");
+  (void) strlcat (one, "", 99);
+  equal (one, "ab", 8);
+  (void) strcpy (one, "");
+  (void) strlcat (one, "cd", 99);
+  equal (one, "cd", 9);
+
+  (void) strcpy (one, "ab");
+  (void) strlcat (one, "cdef", 2);
+  equal (one, "ab", 10);			/* Count-limited. */
+
+  (void) strlcat (one, "gh", 0);
+  equal (one, "ab", 11);			/* Zero count. */
+
+  (void) strlcat (one, "gh", 4);
+  equal (one, "abg", 12);		/* Count and length equal. */
+
+  (void) strlcat (one, "ij", (size_t)-1);	/* set sign bit in count */
+  equal (one, "abgij", 13);
+#endif
+}
+
+static void
+test_strncmp (void)
+{
+  /* First test as strcmp with big counts, then test count code.  */
+  it = "strncmp";
+  check (strncmp ("", "", 99) == 0, 1);	/* Trivial case. */
+  check (strncmp ("a", "a", 99) == 0, 2);	/* Identity. */
+  check (strncmp ("abc", "abc", 99) == 0, 3);	/* Multicharacter. */
+  check (strncmp ("abc", "abcd", 99) < 0, 4);	/* Length unequal. */
+  check (strncmp ("abcd", "abc", 99) > 0, 5);
+  check (strncmp ("abcd", "abce", 99) < 0, 6);	/* Honestly unequal. */
+  check (strncmp ("abce", "abcd", 99) > 0, 7);
+  check (strncmp ("a\203", "a", 2) > 0, 8);	/* Tricky if '\203' < 0 */
+  check (strncmp ("a\203", "a\003", 2) > 0, 9);
+  check (strncmp ("abce", "abcd", 3) == 0, 10);	/* Count limited. */
+  check (strncmp ("abce", "abc", 3) == 0, 11);	/* Count == length. */
+  check (strncmp ("abcd", "abce", 4) < 0, 12);	/* Nudging limit. */
+  check (strncmp ("abc", "def", 0) == 0, 13);	/* Zero count. */
+  check (strncmp ("abc", "", (size_t)-1) > 0, 14);	/* set sign bit in count */
+  check (strncmp ("abc", "abc", (size_t)-2) == 0, 15);
+  check (strncmp ("aa", "ab", (size_t)-1) < 0, 16);
+}
+
+static void
+test_strncpy (void)
+{
+  /* Testing is a bit different because of odd semantics.  */
+  it = "strncpy";
+  check (strncpy (one, "abc", 4) == one, 1);	/* Returned value. */
+  equal (one, "abc", 2);			/* Did the copy go right? */
+
+  (void) strcpy (one, "abcdefgh");
+  (void) strncpy (one, "xyz", 2);
+  equal (one, "xycdefgh", 3);			/* Copy cut by count. */
+
+  (void) strcpy (one, "abcdefgh");
+  (void) strncpy (one, "xyz", 3);		/* Copy cut just before NUL. */
+  equal (one, "xyzdefgh", 4);
+
+  (void) strcpy (one, "abcdefgh");
+  (void) strncpy (one, "xyz", 4);		/* Copy just includes NUL. */
+  equal (one, "xyz", 5);
+  equal (one+4, "efgh", 6);			/* Wrote too much? */
+
+  (void) strcpy (one, "abcdefgh");
+  (void) strncpy (one, "xyz", 5);		/* Copy includes padding. */
+  equal (one, "xyz", 7);
+  equal (one+4, "", 8);
+  equal (one+5, "fgh", 9);
+
+  (void) strcpy (one, "abc");
+  (void) strncpy (one, "xyz", 0);		/* Zero-length copy. */
+  equal (one, "abc", 10);
+
+  (void) strncpy (one, "", 2);		/* Zero-length source. */
+  equal (one, "", 11);
+  equal (one+1, "", 12);
+  equal (one+2, "c", 13);
+
+  (void) strcpy (one, "hi there");
+  (void) strncpy (two, one, 9);
+  equal (two, "hi there", 14);		/* Just paranoia. */
+  equal (one, "hi there", 15);		/* Stomped on source? */
+}
+
+static void
+test_strlcpy (void)
+{
+#ifdef __TEST_BSD_FUNCS__
+  /* Testing is a bit different because of odd semantics.  */
+  it = "strlcpy";
+  check (strlcpy (one, "abc", sizeof(one)) == 3, 1);	/* Returned value. */
+  equal (one, "abc", 2);			/* Did the copy go right? */
+
+  (void) strcpy (one, "abcdefgh");
+  (void) strlcpy (one, "xyz", 2);
+  equal (one, "x\0cdefgh", 3);			/* Copy cut by count. */
+
+  (void) strcpy (one, "abcdefgh");
+  (void) strlcpy (one, "xyz", 3);		/* Copy cut just before NUL. */
+  equal (one, "xy\0defgh", 4);
+
+  (void) strcpy (one, "abcdefgh");
+  (void) strlcpy (one, "xyz", 4);		/* Copy just includes NUL. */
+  equal (one, "xyz", 5);
+  equal (one+4, "efgh", 6);			/* Wrote too much? */
+
+  (void) strcpy (one, "abcdefgh");
+  (void) strlcpy (one, "xyz", 5);		/* Copy includes padding. */
+  equal (one, "xyz", 7);
+  equal (one+3, "", 8);
+  equal (one+4, "efgh", 9);
+
+  (void) strcpy (one, "abc");
+  (void) strlcpy (one, "xyz", 0);		/* Zero-length copy. */
+  equal (one, "abc", 10);
+
+  (void) strlcpy (one, "", 2);		/* Zero-length source. */
+  equal (one, "", 11);
+  equal (one+1, "bc", 12);
+  equal (one+2, "c", 13);
+
+  (void) strcpy (one, "hi there");
+  (void) strlcpy (two, one, 9);
+  equal (two, "hi there", 14);		/* Just paranoia. */
+  equal (one, "hi there", 15);		/* Stomped on source? */
+#endif
+}
+
+static void
+test_strlen (void)
+{
+  it = "strlen";
+  check (strlen ("") == 0, 1);		/* Empty. */
+  check (strlen ("a") == 1, 2);		/* Single char. */
+  check (strlen ("abcd") == 4, 3);	/* Multiple chars. */
+  {
+    char buf[4096];
+    int i;
+    char *p;
+    for (i=0; i < 0x100; i++)
+      {
+	p = (char *) ((unsigned long int)(buf + 0xff) & ~0xff) + i;
+	strcpy (p, "OK");
+	strcpy (p+3, "BAD/WRONG");
+	check (strlen (p) == 2, 4+i);
+      }
+   }
+}
+
+static void
+test_strnlen (void)
+{
+  it = "strnlen";
+  check (strnlen ("", 10) == 0, 1);		/* Empty. */
+  check (strnlen ("a", 10) == 1, 2);		/* Single char. */
+  check (strnlen ("abcd", 10) == 4, 3);		/* Multiple chars. */
+  check (strnlen ("foo", (size_t)-1) == 3, 4);	/* limits of n. */
+
+  {
+    char buf[4096];
+    int i;
+    char *p;
+    for (i=0; i < 0x100; i++)
+      {
+	p = (char *) ((unsigned long int)(buf + 0xff) & ~0xff) + i;
+	strcpy (p, "OK");
+	strcpy (p+3, "BAD/WRONG");
+	check (strnlen (p, 100) == 2, 5+i);
+      }
+   }
+}
+
+static void
+test_strchr (void)
+{
+  it = "strchr";
+  check (strchr ("abcd", 'z') == NULL, 1);	/* Not found. */
+  (void) strcpy (one, "abcd");
+  check (strchr (one, 'c') == one+2, 2);	/* Basic test. */
+  check (strchr (one, 'd') == one+3, 3);	/* End of string. */
+  check (strchr (one, 'a') == one, 4);		/* Beginning. */
+  check (strchr (one, '\0') == one+4, 5);	/* Finding NUL. */
+  (void) strcpy (one, "ababa");
+  check (strchr (one, 'b') == one+1, 6);	/* Finding first. */
+  (void) strcpy (one, "");
+  check (strchr (one, 'b') == NULL, 7);		/* Empty string. */
+  check (strchr (one, '\0') == one, 8);		/* NUL in empty string. */
+  {
+    char buf[4096];
+    int i;
+    char *p;
+    for (i=0; i < 0x100; i++)
+      {
+	p = (char *) ((unsigned long int) (buf + 0xff) & ~0xff) + i;
+	strcpy (p, "OK");
+	strcpy (p+3, "BAD/WRONG");
+	check (strchr (p, '/') == NULL, 9+i);
+      }
+   }
+}
+
+static void
+test_strchrnul (void)
+{
+  const char *os;
+  it = "strchrnul";
+  cp = strchrnul ((os = "abcd"), 'z');
+  check (*cp == '\0', 1);			/* Not found. */
+  check (cp == os + 4, 2);
+  (void) strcpy (one, "abcd");
+  check (strchrnul (one, 'c') == one+2, 3);	/* Basic test. */
+  check (strchrnul (one, 'd') == one+3, 4);	/* End of string. */
+  check (strchrnul (one, 'a') == one, 5);	/* Beginning. */
+  check (strchrnul (one, '\0') == one+4, 6);	/* Finding NUL. */
+  (void) strcpy (one, "ababa");
+  check (strchrnul (one, 'b') == one+1, 7);	/* Finding first. */
+  (void) strcpy (one, "");
+  check (strchrnul (one, 'b') == one, 8);	/* Empty string. */
+  check (strchrnul (one, '\0') == one, 9);	/* NUL in empty string. */
+  {
+    char buf[4096];
+    int i;
+    char *p;
+    for (i=0; i < 0x100; i++)
+      {
+	p = (char *) ((unsigned long int) (buf + 0xff) & ~0xff) + i;
+	strcpy (p, "OK");
+	strcpy (p+3, "BAD/WRONG");
+	cp = strchrnul (p, '/');
+	check (*cp == '\0', 9+2*i);
+	check (cp == p+2, 10+2*i);
+      }
+   }
+}
+
+static void
+test_rawmemchr (void)
+{
+  it = "rawmemchr";
+  (void) strcpy (one, "abcd");
+  check (rawmemchr (one, 'c') == one+2, 1);	/* Basic test. */
+  check (rawmemchr (one, 'd') == one+3, 2);	/* End of string. */
+  check (rawmemchr (one, 'a') == one, 3);		/* Beginning. */
+  check (rawmemchr (one, '\0') == one+4, 4);	/* Finding NUL. */
+  (void) strcpy (one, "ababa");
+  check (rawmemchr (one, 'b') == one+1, 5);	/* Finding first. */
+  (void) strcpy (one, "");
+  check (rawmemchr (one, '\0') == one, 6);	/* NUL in empty string. */
+  {
+    char buf[4096];
+    int i;
+    char *p;
+    for (i=0; i < 0x100; i++)
+      {
+	p = (char *) ((unsigned long int) (buf + 0xff) & ~0xff) + i;
+	strcpy (p, "OK");
+	strcpy (p+3, "BAD/WRONG");
+	check (rawmemchr (p, 'R') == p+8, 6+i);
+      }
+   }
+}
+
+static void
+test_index (void)
+{
+#ifdef __TEST_SUSV3_LEGACY__
+  it = "index";
+  check (index ("abcd", 'z') == NULL, 1);	/* Not found. */
+  (void) strcpy (one, "abcd");
+  check (index (one, 'c') == one+2, 2);	/* Basic test. */
+  check (index (one, 'd') == one+3, 3);	/* End of string. */
+  check (index (one, 'a') == one, 4);	/* Beginning. */
+  check (index (one, '\0') == one+4, 5);	/* Finding NUL. */
+  (void) strcpy (one, "ababa");
+  check (index (one, 'b') == one+1, 6);	/* Finding first. */
+  (void) strcpy (one, "");
+  check (index (one, 'b') == NULL, 7);	/* Empty string. */
+  check (index (one, '\0') == one, 8);	/* NUL in empty string. */
+#endif
+}
+
+static void
+test_strrchr (void)
+{
+  it = "strrchr";
+  check (strrchr ("abcd", 'z') == NULL, 1);	/* Not found. */
+  (void) strcpy (one, "abcd");
+  check (strrchr (one, 'c') == one+2, 2);	/* Basic test. */
+  check (strrchr (one, 'd') == one+3, 3);	/* End of string. */
+  check (strrchr (one, 'a') == one, 4);		/* Beginning. */
+  check (strrchr (one, '\0') == one+4, 5);	/* Finding NUL. */
+  (void) strcpy (one, "ababa");
+  check (strrchr (one, 'b') == one+3, 6);	/* Finding last. */
+  (void) strcpy (one, "");
+  check (strrchr (one, 'b') == NULL, 7);	/* Empty string. */
+  check (strrchr (one, '\0') == one, 8);	/* NUL in empty string. */
+  {
+    char buf[4096];
+    int i;
+    char *p;
+    for (i=0; i < 0x100; i++)
+      {
+	p = (char *) ((unsigned long int) (buf + 0xff) & ~0xff) + i;
+	strcpy (p, "OK");
+	strcpy (p+3, "BAD/WRONG");
+	check (strrchr (p, '/') == NULL, 9+i);
+      }
+   }
+}
+
+static void
+test_memrchr (void)
+{
+  size_t l;
+  it = "memrchr";
+  check (memrchr ("abcd", 'z', 5) == NULL, 1);	/* Not found. */
+  (void) strcpy (one, "abcd");
+  l = strlen (one) + 1;
+  check (memrchr (one, 'c', l) == one+2, 2);	/* Basic test. */
+  check (memrchr (one, 'd', l) == one+3, 3);	/* End of string. */
+  check (memrchr (one, 'a', l) == one, 4);		/* Beginning. */
+  check (memrchr (one, '\0', l) == one+4, 5);	/* Finding NUL. */
+  (void) strcpy (one, "ababa");
+  l = strlen (one) + 1;
+  check (memrchr (one, 'b', l) == one+3, 6);	/* Finding last. */
+  (void) strcpy (one, "");
+  l = strlen (one) + 1;
+  check (memrchr (one, 'b', l) == NULL, 7);	/* Empty string. */
+  check (memrchr (one, '\0', l) == one, 8);	/* NUL in empty string. */
+
+  /* now test all possible alignment and length combinations to catch
+     bugs due to unrolled loops (assuming unrolling is limited to no
+     more than 128 byte chunks: */
+  {
+    char buf[128 + sizeof(long)];
+    long align, len, i, pos;
+
+    for (align = 0; align < (long) sizeof(long); ++align) {
+      for (len = 0; len < (long) (sizeof(buf) - align); ++len) {
+	for (i = 0; i < len; ++i)
+	  buf[align + i] = 'x';		/* don't depend on memset... */
+
+	for (pos = len - 1; pos >= 0; --pos) {
+#if 0
+	  printf("align %d, len %d, pos %d\n", align, len, pos);
+#endif
+	  check(memrchr(buf + align, 'x', len) == buf + align + pos, 9);
+	  check(memrchr(buf + align + pos + 1, 'x', len - (pos + 1)) == NULL,
+		10);
+	  buf[align + pos] = '-';
+	}
+      }
+    }
+  }
+}
+
+static void
+test_rindex (void)
+{
+#ifdef __TEST_SUSV3_LEGACY__
+  it = "rindex";
+  check (rindex ("abcd", 'z') == NULL, 1);	/* Not found. */
+  (void) strcpy (one, "abcd");
+  check (rindex (one, 'c') == one+2, 2);	/* Basic test. */
+  check (rindex (one, 'd') == one+3, 3);	/* End of string. */
+  check (rindex (one, 'a') == one, 4);	/* Beginning. */
+  check (rindex (one, '\0') == one+4, 5);	/* Finding NUL. */
+  (void) strcpy (one, "ababa");
+  check (rindex (one, 'b') == one+3, 6);	/* Finding last. */
+  (void) strcpy (one, "");
+  check (rindex (one, 'b') == NULL, 7);	/* Empty string. */
+  check (rindex (one, '\0') == one, 8);	/* NUL in empty string. */
+#endif
+}
+
+static void
+test_strpbrk (void)
+{
+  it = "strpbrk";
+  check(strpbrk("abcd", "z") == NULL, 1);	/* Not found. */
+  (void) strcpy(one, "abcd");
+  check(strpbrk(one, "c") == one+2, 2);	/* Basic test. */
+  check(strpbrk(one, "d") == one+3, 3);	/* End of string. */
+  check(strpbrk(one, "a") == one, 4);	/* Beginning. */
+  check(strpbrk(one, "") == NULL, 5);	/* Empty search list. */
+  check(strpbrk(one, "cb") == one+1, 6);	/* Multiple search. */
+  (void) strcpy(one, "abcabdea");
+  check(strpbrk(one, "b") == one+1, 7);	/* Finding first. */
+  check(strpbrk(one, "cb") == one+1, 8);	/* With multiple search. */
+  check(strpbrk(one, "db") == one+1, 9);	/* Another variant. */
+  (void) strcpy(one, "");
+  check(strpbrk(one, "bc") == NULL, 10);	/* Empty string. */
+  (void) strcpy(one, "");
+  check(strpbrk(one, "bcd") == NULL, 11);	/* Empty string. */
+  (void) strcpy(one, "");
+  check(strpbrk(one, "bcde") == NULL, 12);	/* Empty string. */
+  check(strpbrk(one, "") == NULL, 13);	/* Both strings empty. */
+  (void) strcpy(one, "abcabdea");
+  check(strpbrk(one, "befg") == one+1, 14);	/* Finding first. */
+  check(strpbrk(one, "cbr") == one+1, 15);	/* With multiple search. */
+  check(strpbrk(one, "db") == one+1, 16);	/* Another variant. */
+  check(strpbrk(one, "efgh") == one+6, 17);	/* And yet another. */
+}
+
+static void
+test_strstr (void)
+{
+  it = "strstr";
+  check(strstr("abcd", "z") == NULL, 1);	/* Not found. */
+  check(strstr("abcd", "abx") == NULL, 2);	/* Dead end. */
+  (void) strcpy(one, "abcd");
+  check(strstr(one, "c") == one+2, 3);	/* Basic test. */
+  check(strstr(one, "bc") == one+1, 4);	/* Multichar. */
+  check(strstr(one, "d") == one+3, 5);	/* End of string. */
+  check(strstr(one, "cd") == one+2, 6);	/* Tail of string. */
+  check(strstr(one, "abc") == one, 7);	/* Beginning. */
+  check(strstr(one, "abcd") == one, 8);	/* Exact match. */
+  check(strstr(one, "abcde") == NULL, 9);	/* Too long. */
+  check(strstr(one, "de") == NULL, 10);	/* Past end. */
+  check(strstr(one, "") == one, 11);	/* Finding empty. */
+  (void) strcpy(one, "ababa");
+  check(strstr(one, "ba") == one+1, 12);	/* Finding first. */
+  (void) strcpy(one, "");
+  check(strstr(one, "b") == NULL, 13);	/* Empty string. */
+  check(strstr(one, "") == one, 14);	/* Empty in empty string. */
+  (void) strcpy(one, "bcbca");
+  check(strstr(one, "bca") == one+2, 15);	/* False start. */
+  (void) strcpy(one, "bbbcabbca");
+  check(strstr(one, "bbca") == one+1, 16);	/* With overlap. */
+}
+
+static void
+test_strspn (void)
+{
+  it = "strspn";
+  check(strspn("abcba", "abc") == 5, 1);	/* Whole string. */
+  check(strspn("abcba", "ab") == 2, 2);	/* Partial. */
+  check(strspn("abc", "qx") == 0, 3);	/* None. */
+  check(strspn("", "ab") == 0, 4);	/* Null string. */
+  check(strspn("abc", "") == 0, 5);	/* Null search list. */
+}
+
+static void
+test_strcspn (void)
+{
+  it = "strcspn";
+  check(strcspn("abcba", "qx") == 5, 1);	/* Whole string. */
+  check(strcspn("abcba", "cx") == 2, 2);	/* Partial. */
+  check(strcspn("abc", "abc") == 0, 3);	/* None. */
+  check(strcspn("", "ab") == 0, 4);	/* Null string. */
+  check(strcspn("abc", "") == 3, 5);	/* Null search list. */
+}
+
+static void
+test_strtok (void)
+{
+  it = "strtok";
+  (void) strcpy(one, "first, second, third");
+  equal(strtok(one, ", "), "first", 1);	/* Basic test. */
+  equal(one, "first", 2);
+  equal(strtok((char *)NULL, ", "), "second", 3);
+  equal(strtok((char *)NULL, ", "), "third", 4);
+  check(strtok((char *)NULL, ", ") == NULL, 5);
+  (void) strcpy(one, ", first, ");
+  equal(strtok(one, ", "), "first", 6);	/* Extra delims, 1 tok. */
+  check(strtok((char *)NULL, ", ") == NULL, 7);
+  (void) strcpy(one, "1a, 1b; 2a, 2b");
+  equal(strtok(one, ", "), "1a", 8);	/* Changing delim lists. */
+  equal(strtok((char *)NULL, "; "), "1b", 9);
+  equal(strtok((char *)NULL, ", "), "2a", 10);
+  (void) strcpy(two, "x-y");
+  equal(strtok(two, "-"), "x", 11);	/* New string before done. */
+  equal(strtok((char *)NULL, "-"), "y", 12);
+  check(strtok((char *)NULL, "-") == NULL, 13);
+  (void) strcpy(one, "a,b, c,, ,d");
+  equal(strtok(one, ", "), "a", 14);	/* Different separators. */
+  equal(strtok((char *)NULL, ", "), "b", 15);
+  equal(strtok((char *)NULL, " ,"), "c", 16);	/* Permute list too. */
+  equal(strtok((char *)NULL, " ,"), "d", 17);
+  check(strtok((char *)NULL, ", ") == NULL, 18);
+  check(strtok((char *)NULL, ", ") == NULL, 19);	/* Persistence. */
+  (void) strcpy(one, ", ");
+  check(strtok(one, ", ") == NULL, 20);	/* No tokens. */
+  (void) strcpy(one, "");
+  check(strtok(one, ", ") == NULL, 21);	/* Empty string. */
+  (void) strcpy(one, "abc");
+  equal(strtok(one, ", "), "abc", 22);	/* No delimiters. */
+  check(strtok((char *)NULL, ", ") == NULL, 23);
+  (void) strcpy(one, "abc");
+  equal(strtok(one, ""), "abc", 24);	/* Empty delimiter list. */
+  check(strtok((char *)NULL, "") == NULL, 25);
+  (void) strcpy(one, "abcdefgh");
+  (void) strcpy(one, "a,b,c");
+  equal(strtok(one, ","), "a", 26);	/* Basics again... */
+  equal(strtok((char *)NULL, ","), "b", 27);
+  equal(strtok((char *)NULL, ","), "c", 28);
+  check(strtok((char *)NULL, ",") == NULL, 29);
+  equal(one+6, "gh", 30);			/* Stomped past end? */
+  equal(one, "a", 31);			/* Stomped old tokens? */
+  equal(one+2, "b", 32);
+  equal(one+4, "c", 33);
+}
+
+static void
+test_strtok_r (void)
+{
+  it = "strtok_r";
+  (void) strcpy(one, "first, second, third");
+  cp = NULL;	/* Always initialize cp to make sure it doesn't point to some old data.  */
+  equal(strtok_r(one, ", ", &cp), "first", 1);	/* Basic test. */
+  equal(one, "first", 2);
+  equal(strtok_r((char *)NULL, ", ", &cp), "second", 3);
+  equal(strtok_r((char *)NULL, ", ", &cp), "third", 4);
+  check(strtok_r((char *)NULL, ", ", &cp) == NULL, 5);
+  (void) strcpy(one, ", first, ");
+  cp = NULL;
+  equal(strtok_r(one, ", ", &cp), "first", 6);	/* Extra delims, 1 tok. */
+  check(strtok_r((char *)NULL, ", ", &cp) == NULL, 7);
+  (void) strcpy(one, "1a, 1b; 2a, 2b");
+  cp = NULL;
+  equal(strtok_r(one, ", ", &cp), "1a", 8);	/* Changing delim lists. */
+  equal(strtok_r((char *)NULL, "; ", &cp), "1b", 9);
+  equal(strtok_r((char *)NULL, ", ", &cp), "2a", 10);
+  (void) strcpy(two, "x-y");
+  cp = NULL;
+  equal(strtok_r(two, "-", &cp), "x", 11);	/* New string before done. */
+  equal(strtok_r((char *)NULL, "-", &cp), "y", 12);
+  check(strtok_r((char *)NULL, "-", &cp) == NULL, 13);
+  (void) strcpy(one, "a,b, c,, ,d");
+  cp = NULL;
+  equal(strtok_r(one, ", ", &cp), "a", 14);	/* Different separators. */
+  equal(strtok_r((char *)NULL, ", ", &cp), "b", 15);
+  equal(strtok_r((char *)NULL, " ,", &cp), "c", 16);	/* Permute list too. */
+  equal(strtok_r((char *)NULL, " ,", &cp), "d", 17);
+  check(strtok_r((char *)NULL, ", ", &cp) == NULL, 18);
+  check(strtok_r((char *)NULL, ", ", &cp) == NULL, 19);	/* Persistence. */
+  (void) strcpy(one, ", ");
+  cp = NULL;
+  check(strtok_r(one, ", ", &cp) == NULL, 20);	/* No tokens. */
+  (void) strcpy(one, "");
+  cp = NULL;
+  check(strtok_r(one, ", ", &cp) == NULL, 21);	/* Empty string. */
+  check(strtok_r((char *)NULL, ", ", &cp) == NULL, 22);	/* Persistence. */
+  (void) strcpy(one, "abc");
+  cp = NULL;
+  equal(strtok_r(one, ", ", &cp), "abc", 23);	/* No delimiters. */
+  check(strtok_r((char *)NULL, ", ", &cp) == NULL, 24);
+  (void) strcpy(one, "abc");
+  cp = NULL;
+  equal(strtok_r(one, "", &cp), "abc", 25);	/* Empty delimiter list. */
+  check(strtok_r((char *)NULL, "", &cp) == NULL, 26);
+  (void) strcpy(one, "abcdefgh");
+  (void) strcpy(one, "a,b,c");
+  cp = NULL;
+  equal(strtok_r(one, ",", &cp), "a", 27);	/* Basics again... */
+  equal(strtok_r((char *)NULL, ",", &cp), "b", 28);
+  equal(strtok_r((char *)NULL, ",", &cp), "c", 29);
+  check(strtok_r((char *)NULL, ",", &cp) == NULL, 30);
+  equal(one+6, "gh", 31);			/* Stomped past end? */
+  equal(one, "a", 32);			/* Stomped old tokens? */
+  equal(one+2, "b", 33);
+  equal(one+4, "c", 34);
+}
+
+static void
+test_strsep (void)
+{
+  char *ptr;
+  it = "strsep";
+  cp = strcpy(one, "first, second, third");
+  equal(strsep(&cp, ", "), "first", 1);	/* Basic test. */
+  equal(one, "first", 2);
+  equal(strsep(&cp, ", "), "", 3);
+  equal(strsep(&cp, ", "), "second", 4);
+  equal(strsep(&cp, ", "), "", 5);
+  equal(strsep(&cp, ", "), "third", 6);
+  check(strsep(&cp, ", ") == NULL, 7);
+  cp = strcpy(one, ", first, ");
+  equal(strsep(&cp, ", "), "", 8);
+  equal(strsep(&cp, ", "), "", 9);
+  equal(strsep(&cp, ", "), "first", 10);	/* Extra delims, 1 tok. */
+  equal(strsep(&cp, ", "), "", 11);
+  equal(strsep(&cp, ", "), "", 12);
+  check(strsep(&cp, ", ") == NULL, 13);
+  cp = strcpy(one, "1a, 1b; 2a, 2b");
+  equal(strsep(&cp, ", "), "1a", 14);	/* Changing delim lists. */
+  equal(strsep(&cp, ", "), "", 15);
+  equal(strsep(&cp, "; "), "1b", 16);
+  equal(strsep(&cp, ", "), "", 17);
+  equal(strsep(&cp, ", "), "2a", 18);
+  cp = strcpy(two, "x-y");
+  equal(strsep(&cp, "-"), "x", 19);	/* New string before done. */
+  equal(strsep(&cp, "-"), "y", 20);
+  check(strsep(&cp, "-") == NULL, 21);
+  cp = strcpy(one, "a,b, c,, ,d ");
+  equal(strsep(&cp, ", "), "a", 22);	/* Different separators. */
+  equal(strsep(&cp, ", "), "b", 23);
+  equal(strsep(&cp, " ,"), "", 24);
+  equal(strsep(&cp, " ,"), "c", 25);	/* Permute list too. */
+  equal(strsep(&cp, " ,"), "", 26);
+  equal(strsep(&cp, " ,"), "", 27);
+  equal(strsep(&cp, " ,"), "", 28);
+  equal(strsep(&cp, " ,"), "d", 29);
+  equal(strsep(&cp, " ,"), "", 30);
+  check(strsep(&cp, ", ") == NULL, 31);
+  check(strsep(&cp, ", ") == NULL, 32);	/* Persistence. */
+  cp = strcpy(one, ", ");
+  equal(strsep(&cp, ", "), "", 33);
+  equal(strsep(&cp, ", "), "", 34);
+  equal(strsep(&cp, ", "), "", 35);
+  check(strsep(&cp, ", ") == NULL, 36);	/* No tokens. */
+  cp = strcpy(one, "");
+  equal(strsep(&cp, ", "), "", 37);
+  check(strsep(&cp, ", ") == NULL, 38);	/* Empty string. */
+  cp = strcpy(one, "abc");
+  equal(strsep(&cp, ", "), "abc", 39);	/* No delimiters. */
+  check(strsep(&cp, ", ") == NULL, 40);
+  cp = strcpy(one, "abc");
+  equal(strsep(&cp, ""), "abc", 41);	/* Empty delimiter list. */
+  check(strsep(&cp, "") == NULL, 42);
+  (void) strcpy(one, "abcdefgh");
+  cp = strcpy(one, "a,b,c");
+  equal(strsep(&cp, ","), "a", 43);	/* Basics again... */
+  equal(strsep(&cp, ","), "b", 44);
+  equal(strsep(&cp, ","), "c", 45);
+  check(strsep(&cp, ",") == NULL, 46);
+  equal(one+6, "gh", 47);		/* Stomped past end? */
+  equal(one, "a", 48);			/* Stomped old tokens? */
+  equal(one+2, "b", 49);
+  equal(one+4, "c", 50);
+
+  {
+    char text[] = "This,is,a,test";
+    char *list = strdupa (text);
+    equal (strsep (&list, ","), "This", 51);
+    equal (strsep (&list, ","), "is", 52);
+    equal (strsep (&list, ","), "a", 53);
+    equal (strsep (&list, ","), "test", 54);
+    check (strsep (&list, ",") == NULL, 55);
+  }
+
+  cp = strcpy(one, "a,b, c,, ,d,");
+  equal(strsep(&cp, ","), "a", 56);	/* Different separators. */
+  equal(strsep(&cp, ","), "b", 57);
+  equal(strsep(&cp, ","), " c", 58);	/* Permute list too. */
+  equal(strsep(&cp, ","), "", 59);
+  equal(strsep(&cp, ","), " ", 60);
+  equal(strsep(&cp, ","), "d", 61);
+  equal(strsep(&cp, ","), "", 62);
+  check(strsep(&cp, ",") == NULL, 63);
+  check(strsep(&cp, ",") == NULL, 64);	/* Persistence. */
+
+  cp = strcpy(one, "a,b, c,, ,d,");
+  equal(strsep(&cp, "xy,"), "a", 65);	/* Different separators. */
+  equal(strsep(&cp, "x,y"), "b", 66);
+  equal(strsep(&cp, ",xy"), " c", 67);	/* Permute list too. */
+  equal(strsep(&cp, "xy,"), "", 68);
+  equal(strsep(&cp, "x,y"), " ", 69);
+  equal(strsep(&cp, ",xy"), "d", 70);
+  equal(strsep(&cp, "xy,"), "", 71);
+  check(strsep(&cp, "x,y") == NULL, 72);
+  check(strsep(&cp, ",xy") == NULL, 73);	/* Persistence. */
+
+  cp = strcpy(one, "ABC");
+  one[4] = ':';
+  equal(strsep(&cp, "C"), "AB", 74);	/* Access beyond NUL.  */
+  ptr = strsep(&cp, ":");
+  equal(ptr, "", 75);
+  check(ptr == one + 3, 76);
+  check(cp == NULL, 77);
+
+  cp = strcpy(one, "ABC");
+  one[4] = ':';
+  equal(strsep(&cp, "CD"), "AB", 78);	/* Access beyond NUL.  */
+  ptr = strsep(&cp, ":.");
+  equal(ptr, "", 79);
+  check(ptr == one + 3, 80);
+
+  cp = strcpy(one, "ABC");		/* No token in string.  */
+  equal(strsep(&cp, ","), "ABC", 81);
+  check(cp == NULL, 82);
+
+  *one = '\0';				/* Empty string. */
+  cp = one;
+  ptr = strsep(&cp, ",");
+  equal(ptr, "", 83);
+  check(ptr == one, 84);
+  check(cp == NULL, 85);
+
+  *one = '\0';				/* Empty string and no token. */
+  cp = one;
+  ptr = strsep(&cp, "");
+  equal(ptr, "", 86);
+  check(ptr == one , 87);
+  check(cp == NULL, 88);
+}
+
+static void
+test_memcmp (void)
+{
+  int i, cnt = 1;
+  char one[21], two[21];
+
+  it = "memcmp";
+  check(memcmp("a", "a", 1) == 0, cnt++);	/* Identity. */
+  check(memcmp("abc", "abc", 3) == 0, cnt++);	/* Multicharacter. */
+  check(memcmp("abcd", "abcf", 4) < 0, cnt++);	/* Honestly unequal. */
+  check(memcmp("abcf", "abcd", 4) > 0, cnt++);
+  check(memcmp("alph", "cold", 4) < 0, cnt++);
+  check(memcmp("a\203", "a\003", 2) > 0, cnt++);
+  check(memcmp("a\003", "a\203", 2) < 0, cnt++);
+  check(memcmp("a\003bc", "a\203bc", 2) < 0, cnt++);
+  check(memcmp("abc\203", "abc\003", 4) > 0, cnt++);
+  check(memcmp("abc\003", "abc\203", 4) < 0, cnt++);
+  check(memcmp("abcf", "abcd", 3) == 0, cnt++);	/* Count limited. */
+  check(memcmp("abc", "def", 0) == 0, cnt++);	/* Zero count. */
+  /* Comparisons with shifting 4-byte boundaries. */
+  for (i=0; i<4; i++)
+  {
+    char *a = one + i, *b = two + i;
+    strncpy( a, "--------11112222", 16);
+    strncpy( b, "--------33334444", 16);
+    check( memcmp(b, a, 16) > 0, cnt++);
+    check( memcmp(a, b, 16) < 0, cnt++);
+  }
+}
+
+static void
+test_memchr (void)
+{
+  it = "memchr";
+  check(memchr("abcd", 'z', 4) == NULL, 1);	/* Not found. */
+  (void) strcpy(one, "abcd");
+  check(memchr(one, 'c', 4) == one+2, 2);	/* Basic test. */
+  check(memchr(one, ~0xff|'c', 4) == one+2, 2);	/* ignore highorder bits. */
+  check(memchr(one, 'd', 4) == one+3, 3);	/* End of string. */
+  check(memchr(one, 'a', 4) == one, 4);	/* Beginning. */
+  check(memchr(one, '\0', 5) == one+4, 5);	/* Finding NUL. */
+  (void) strcpy(one, "ababa");
+  check(memchr(one, 'b', 5) == one+1, 6);	/* Finding first. */
+  check(memchr(one, 'b', 0) == NULL, 7);	/* Zero count. */
+  check(memchr(one, 'a', 1) == one, 8);	/* Singleton case. */
+  (void) strcpy(one, "a\203b");
+  check(memchr(one, 0203, 3) == one+1, 9);	/* Unsignedness. */
+
+  /* now test all possible alignment and length combinations to catch
+     bugs due to unrolled loops (assuming unrolling is limited to no
+     more than 128 byte chunks: */
+  {
+    char buf[128 + sizeof(long)];
+    long align, len, i, pos;
+
+    for (align = 0; align < (long) sizeof(long); ++align) {
+      for (len = 0; len < (long) (sizeof(buf) - align); ++len) {
+	for (i = 0; i < len; ++i) {
+	  buf[align + i] = 'x';		/* don't depend on memset... */
+	}
+	for (pos = 0; pos < len; ++pos) {
+#if 0
+	  printf("align %d, len %d, pos %d\n", align, len, pos);
+#endif
+	  check(memchr(buf + align, 'x', len) == buf + align + pos, 10);
+	  check(memchr(buf + align, 'x', pos) == NULL, 11);
+	  buf[align + pos] = '-';
+	}
+      }
+    }
+  }
+}
+
+static void
+test_memcpy (void)
+{
+  int i;
+  it = "memcpy";
+  check(memcpy(one, "abc", 4) == one, 1);	/* Returned value. */
+  equal(one, "abc", 2);			/* Did the copy go right? */
+
+  (void) strcpy(one, "abcdefgh");
+  (void) memcpy(one+1, "xyz", 2);
+  equal(one, "axydefgh", 3);		/* Basic test. */
+
+  (void) strcpy(one, "abc");
+  (void) memcpy(one, "xyz", 0);
+  equal(one, "abc", 4);			/* Zero-length copy. */
+
+  (void) strcpy(one, "hi there");
+  (void) strcpy(two, "foo");
+  (void) memcpy(two, one, 9);
+  equal(two, "hi there", 5);		/* Just paranoia. */
+  equal(one, "hi there", 6);		/* Stomped on source? */
+
+  for (i = 0; i < 16; i++)
+    {
+      const char *x = "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx";
+      strcpy (one, x);
+      check (memcpy (one + i, "hi there", 9) == one + i,
+	     7 + (i * 6));		/* Unaligned destination. */
+      check (memcmp (one, x, i) == 0, 8 + (i * 6));  /* Wrote under? */
+      equal (one + i, "hi there", 9 + (i * 6));
+      check (one[i + 9] == 'x', 10 + (i * 6));       /* Wrote over? */
+      check (memcpy (two, one + i, 9) == two,
+	     11 + (i * 6));		/* Unaligned source. */
+      equal (two, "hi there", 12 + (i * 6));
+    }
+}
+
+static void
+test_mempcpy (void)
+{
+  int i;
+  it = "mempcpy";
+  check(mempcpy(one, "abc", 4) == one + 4, 1);	/* Returned value. */
+  equal(one, "abc", 2);			/* Did the copy go right? */
+
+  (void) strcpy(one, "abcdefgh");
+  (void) mempcpy(one+1, "xyz", 2);
+  equal(one, "axydefgh", 3);		/* Basic test. */
+
+  (void) strcpy(one, "abc");
+  (void) mempcpy(one, "xyz", 0);
+  equal(one, "abc", 4);			/* Zero-length copy. */
+
+  (void) strcpy(one, "hi there");
+  (void) strcpy(two, "foo");
+  (void) mempcpy(two, one, 9);
+  equal(two, "hi there", 5);		/* Just paranoia. */
+  equal(one, "hi there", 6);		/* Stomped on source? */
+
+  for (i = 0; i < 16; i++)
+    {
+      const char *x = "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx";
+      strcpy (one, x);
+      check (mempcpy (one + i, "hi there", 9) == one + i + 9,
+	     7 + (i * 6));		/* Unaligned destination. */
+      check (memcmp (one, x, i) == 0, 8 + (i * 6));  /* Wrote under? */
+      equal (one + i, "hi there", 9 + (i * 6));
+      check (one[i + 9] == 'x', 10 + (i * 6));       /* Wrote over? */
+      check (mempcpy (two, one + i, 9) == two + 9,
+	     11 + (i * 6));		/* Unaligned source. */
+      equal (two, "hi there", 12 + (i * 6));
+    }
+}
+
+static void
+test_memmove (void)
+{
+  it = "memmove";
+  check(memmove(one, "abc", 4) == one, 1);	/* Returned value. */
+  equal(one, "abc", 2);			/* Did the copy go right? */
+
+  (void) strcpy(one, "abcdefgh");
+  (void) memmove(one+1, "xyz", 2);
+  equal(one, "axydefgh", 3);		/* Basic test. */
+
+  (void) strcpy(one, "abc");
+  (void) memmove(one, "xyz", 0);
+  equal(one, "abc", 4);			/* Zero-length copy. */
+
+  (void) strcpy(one, "hi there");
+  (void) strcpy(two, "foo");
+  (void) memmove(two, one, 9);
+  equal(two, "hi there", 5);		/* Just paranoia. */
+  equal(one, "hi there", 6);		/* Stomped on source? */
+
+  (void) strcpy(one, "abcdefgh");
+  (void) memmove(one+1, one, 9);
+  equal(one, "aabcdefgh", 7);		/* Overlap, right-to-left. */
+
+  (void) strcpy(one, "abcdefgh");
+  (void) memmove(one+1, one+2, 7);
+  equal(one, "acdefgh", 8);		/* Overlap, left-to-right. */
+
+  (void) strcpy(one, "abcdefgh");
+  (void) memmove(one, one, 9);
+  equal(one, "abcdefgh", 9);		/* 100% overlap. */
+}
+
+static void
+test_memccpy (void)
+{
+  /* First test like memcpy, then the search part The SVID, the only
+     place where memccpy is mentioned, says overlap might fail, so we
+     don't try it.  Besides, it's hard to see the rationale for a
+     non-left-to-right memccpy.  */
+  it = "memccpy";
+  check(memccpy(one, "abc", 'q', 4) == NULL, 1);	/* Returned value. */
+  equal(one, "abc", 2);			/* Did the copy go right? */
+
+  (void) strcpy(one, "abcdefgh");
+  (void) memccpy(one+1, "xyz", 'q', 2);
+  equal(one, "axydefgh", 3);		/* Basic test. */
+
+  (void) strcpy(one, "abc");
+  (void) memccpy(one, "xyz", 'q', 0);
+  equal(one, "abc", 4);			/* Zero-length copy. */
+
+  (void) strcpy(one, "hi there");
+  (void) strcpy(two, "foo");
+  (void) memccpy(two, one, 'q', 9);
+  equal(two, "hi there", 5);		/* Just paranoia. */
+  equal(one, "hi there", 6);		/* Stomped on source? */
+
+  (void) strcpy(one, "abcdefgh");
+  (void) strcpy(two, "horsefeathers");
+  check(memccpy(two, one, 'f', 9) == two+6, 7);	/* Returned value. */
+  equal(one, "abcdefgh", 8);		/* Source intact? */
+  equal(two, "abcdefeathers", 9);		/* Copy correct? */
+
+  (void) strcpy(one, "abcd");
+  (void) strcpy(two, "bumblebee");
+  check(memccpy(two, one, 'a', 4) == two+1, 10);	/* First char. */
+  equal(two, "aumblebee", 11);
+  check(memccpy(two, one, 'd', 4) == two+4, 12);	/* Last char. */
+  equal(two, "abcdlebee", 13);
+  (void) strcpy(one, "xyz");
+  check(memccpy(two, one, 'x', 1) == two+1, 14);	/* Singleton. */
+  equal(two, "xbcdlebee", 15);
+}
+
+static void
+test_memset (void)
+{
+  int i;
+
+  it = "memset";
+  (void) strcpy(one, "abcdefgh");
+  check(memset(one+1, 'x', 3) == one+1, 1);	/* Return value. */
+  equal(one, "axxxefgh", 2);		/* Basic test. */
+
+  (void) memset(one+2, 'y', 0);
+  equal(one, "axxxefgh", 3);		/* Zero-length set. */
+
+  (void) memset(one+5, 0, 1);
+  equal(one, "axxxe", 4);			/* Zero fill. */
+  equal(one+6, "gh", 5);			/* And the leftover. */
+
+  (void) memset(one+2, 010045, 1);
+  equal(one, "ax\045xe", 6);		/* Unsigned char convert. */
+
+  /* Non-8bit fill character.  */
+  memset (one, 0x101, sizeof (one));
+  for (i = 0; i < (int) sizeof (one); ++i)
+    check (one[i] == '\01', 7);
+
+  /* Test for more complex versions of memset, for all alignments and
+     lengths up to 256. This test takes a little while, perhaps it should
+     be made weaker?  */
+  {
+    char data[512];
+    int j;
+    int k;
+    int c;
+
+    for (i = 0; i < 512; i++)
+      data[i] = 'x';
+    for (c = 0; c <= 'y'; c += 'y')  /* check for memset(,0,) and
+					memset(,'y',) */
+      for (j = 0; j < 256; j++)
+	for (i = 0; i < 256; i++)
+	  {
+	    memset (data + i, c, j);
+	    for (k = 0; k < i; k++)
+	      if (data[k] != 'x')
+		goto fail;
+	    for (k = i; k < i+j; k++)
+	      {
+		if (data[k] != c)
+		  goto fail;
+		data[k] = 'x';
+	      }
+	    for (k = i+j; k < 512; k++)
+	      if (data[k] != 'x')
+		goto fail;
+	    continue;
+
+	  fail:
+	    check (0, 8 + i + j * 256 + (c != 0) * 256 * 256);
+	  }
+  }
+}
+
+static void
+test_bcopy (void)
+{
+#ifdef __TEST_SUSV3_LEGACY__
+  /* Much like memcpy.  Berklix manual is silent about overlap, so
+     don't test it.  */
+  it = "bcopy";
+  (void) bcopy("abc", one, 4);
+  equal(one, "abc", 1);			/* Simple copy. */
+
+  (void) strcpy(one, "abcdefgh");
+  (void) bcopy("xyz", one+1, 2);
+  equal(one, "axydefgh", 2);		/* Basic test. */
+
+  (void) strcpy(one, "abc");
+  (void) bcopy("xyz", one, 0);
+  equal(one, "abc", 3);			/* Zero-length copy. */
+
+  (void) strcpy(one, "hi there");
+  (void) strcpy(two, "foo");
+  (void) bcopy(one, two, 9);
+  equal(two, "hi there", 4);		/* Just paranoia. */
+  equal(one, "hi there", 5);		/* Stomped on source? */
+#endif
+}
+
+static void
+test_bzero (void)
+{
+#ifdef __TEST_SUSV3_LEGACY__
+  it = "bzero";
+  (void) strcpy(one, "abcdef");
+  bzero(one+2, 2);
+  equal(one, "ab", 1);			/* Basic test. */
+  equal(one+3, "", 2);
+  equal(one+4, "ef", 3);
+
+  (void) strcpy(one, "abcdef");
+  bzero(one+2, 0);
+  equal(one, "abcdef", 4);		/* Zero-length copy. */
+#endif
+}
+
+static void
+test_strndup (void)
+{
+  char *p, *q;
+  it = "strndup";
+  p = strndup("abcdef", 12);
+  check(p != NULL, 1);
+  if (p != NULL)
+    {
+      equal(p, "abcdef", 2);
+      q = strndup(p + 1, 2);
+      check(q != NULL, 3);
+      if (q != NULL)
+	equal(q, "bc", 4);
+      free (q);
+    }
+  free (p);
+  p = strndup("abc def", 3);
+  check(p != NULL, 5);
+  if (p != NULL)
+    equal(p, "abc", 6);
+  free (p);
+}
+
+static void
+test_bcmp (void)
+{
+#ifdef __TEST_SUSV3_LEGACY__
+  it = "bcmp";
+  check(bcmp("a", "a", 1) == 0, 1);	/* Identity. */
+  check(bcmp("abc", "abc", 3) == 0, 2);	/* Multicharacter. */
+  check(bcmp("abcd", "abce", 4) != 0, 3);	/* Honestly unequal. */
+  check(bcmp("abce", "abcd", 4) != 0, 4);
+  check(bcmp("alph", "beta", 4) != 0, 5);
+  check(bcmp("abce", "abcd", 3) == 0, 6);	/* Count limited. */
+  check(bcmp("abc", "def", 0) == 0, 8);	/* Zero count. */
+#endif
+}
+
+static void
+test_strerror (void)
+{
+  it = "strerror";
+  check(strerror(EDOM) != 0, 1);
+  check(strerror(ERANGE) != 0, 2);
+  check(strerror(ENOENT) != 0, 3);
+}
+
+static void
+test_strcasecmp (void)
+{
+  it = "strcasecmp";
+  /* Note that the locale is "C".  */
+  check(strcasecmp("a", "a") == 0, 1);
+  check(strcasecmp("a", "A") == 0, 2);
+  check(strcasecmp("A", "a") == 0, 3);
+  check(strcasecmp("a", "b") < 0, 4);
+  check(strcasecmp("c", "b") > 0, 5);
+  check(strcasecmp("abc", "AbC") == 0, 6);
+  check(strcasecmp("0123456789", "0123456789") == 0, 7);
+  check(strcasecmp("", "0123456789") < 0, 8);
+  check(strcasecmp("AbC", "") > 0, 9);
+  check(strcasecmp("AbC", "A") > 0, 10);
+  check(strcasecmp("AbC", "Ab") > 0, 11);
+  check(strcasecmp("AbC", "ab") > 0, 12);
+}
+
+static void
+test_strncasecmp (void)
+{
+  it = "strncasecmp";
+  /* Note that the locale is "C".  */
+  check(strncasecmp("a", "a", 5) == 0, 1);
+  check(strncasecmp("a", "A", 5) == 0, 2);
+  check(strncasecmp("A", "a", 5) == 0, 3);
+  check(strncasecmp("a", "b", 5) < 0, 4);
+  check(strncasecmp("c", "b", 5) > 0, 5);
+  check(strncasecmp("abc", "AbC", 5) == 0, 6);
+  check(strncasecmp("0123456789", "0123456789", 10) == 0, 7);
+  check(strncasecmp("", "0123456789", 10) < 0, 8);
+  check(strncasecmp("AbC", "", 5) > 0, 9);
+  check(strncasecmp("AbC", "A", 5) > 0, 10);
+  check(strncasecmp("AbC", "Ab", 5) > 0, 11);
+  check(strncasecmp("AbC", "ab", 5) > 0, 12);
+  check(strncasecmp("0123456789", "AbC", 0) == 0, 13);
+  check(strncasecmp("AbC", "abc", 1) == 0, 14);
+  check(strncasecmp("AbC", "abc", 2) == 0, 15);
+  check(strncasecmp("AbC", "abc", 3) == 0, 16);
+  check(strncasecmp("AbC", "abcd", 3) == 0, 17);
+  check(strncasecmp("AbC", "abcd", 4) < 0, 18);
+  check(strncasecmp("ADC", "abcd", 1) == 0, 19);
+  check(strncasecmp("ADC", "abcd", 2) > 0, 20);
+}
+
+int
+main (void)
+{
+  int status;
+
+  /* Test strcmp first because we use it to test other things.  */
+  test_strcmp ();
+
+  /* Test strcpy next because we need it to set up other tests.  */
+  test_strcpy ();
+
+  /* A closely related function is stpcpy.  */
+  test_stpcpy ();
+
+  /* stpncpy.  */
+  test_stpncpy ();
+
+  /* strcat.  */
+  test_strcat ();
+
+  /* strncat.  */
+  test_strncat ();
+
+  /* strlcat.  */
+  test_strlcat ();
+
+  /* strncmp.  */
+  test_strncmp ();
+
+  /* strncpy.  */
+  test_strncpy ();
+
+  /* strlcpy.  */
+  test_strlcpy ();
+
+  /* strlen.  */
+  test_strlen ();
+
+  /* strnlen.  */
+  test_strnlen ();
+
+  /* strchr.  */
+  test_strchr ();
+
+  /* strchrnul.  */
+  test_strchrnul ();
+
+  /* rawmemchr.  */
+  test_rawmemchr ();
+
+  /* index - just like strchr.  */
+  test_index ();
+
+  /* strrchr.  */
+  test_strrchr ();
+
+  /* memrchr.  */
+  test_memrchr ();
+
+  /* rindex - just like strrchr.  */
+  test_rindex ();
+
+  /* strpbrk - somewhat like strchr.  */
+  test_strpbrk ();
+
+  /* strstr - somewhat like strchr.  */
+  test_strstr ();
+
+  /* strspn.  */
+  test_strspn ();
+
+  /* strcspn.  */
+  test_strcspn ();
+
+  /* strtok - the hard one.  */
+  test_strtok ();
+
+  /* strtok_r.  */
+  test_strtok_r ();
+
+  /* strsep.  */
+  test_strsep ();
+
+  /* memcmp.  */
+  test_memcmp ();
+
+  /* memchr.  */
+  test_memchr ();
+
+  /* memcpy - need not work for overlap.  */
+  test_memcpy ();
+
+  /* memmove - must work on overlap.  */
+  test_memmove ();
+
+  /* mempcpy */
+  test_mempcpy ();
+
+  /* memccpy.  */
+  test_memccpy ();
+
+  /* memset.  */
+  test_memset ();
+
+  /* bcopy.  */
+  test_bcopy ();
+
+  /* bzero.  */
+  test_bzero ();
+
+  /* bcmp - somewhat like memcmp.  */
+  test_bcmp ();
+
+  /* strndup.  */
+  test_strndup ();
+
+  /* strerror - VERY system-dependent.  */
+  test_strerror ();
+
+  /* strcasecmp.  Without locale dependencies.  */
+  test_strcasecmp ();
+
+  /* strncasecmp.  Without locale dependencies.  */
+  test_strncasecmp ();
+
+  if (errors == 0)
+    {
+      status = EXIT_SUCCESS;
+      puts("No errors.");
+    }
+  else
+    {
+      status = EXIT_FAILURE;
+      printf("%Zd errors.\n", errors);
+    }
+
+  return status;
+}
diff --git a/ap/build/uClibc/test/string/tst-bswap.c b/ap/build/uClibc/test/string/tst-bswap.c
new file mode 100644
index 0000000..b2b4ef0
--- /dev/null
+++ b/ap/build/uClibc/test/string/tst-bswap.c
@@ -0,0 +1,74 @@
+/* Copyright (C) 2000 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+   Contributed by Ulrich Drepper <drepper@cygnus.com>.
+
+   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 <byteswap.h>
+#include <stdio.h>
+
+extern unsigned long long int wash (unsigned long long int a);
+
+int
+main (void)
+{
+  int result = 0;
+
+  /* Test the functions with constant arguments.  */
+  if (bswap_16 (0x1234) != 0x3412)
+    {
+      puts ("bswap_16 (constant) flunked");
+      result = 1;
+    }
+  if (bswap_32 (0x12345678) != 0x78563412)
+    {
+      puts ("bswap_32 (constant) flunked");
+      result = 1;
+    }
+  if (bswap_64 (0x1234567890abcdefULL) != 0xefcdab9078563412ULL)
+    {
+      puts ("bswap_64 (constant) flunked");
+      result = 1;
+    }
+
+  /* Test the functions with non-constant arguments.  */
+  if (bswap_16 (wash (0x1234)) != 0x3412)
+    {
+      puts ("bswap_16 (non-constant) flunked");
+      result = 1;
+    }
+  if (bswap_32 (wash (0x12345678)) != 0x78563412)
+    {
+      puts ("bswap_32 (non-constant) flunked");
+      result = 1;
+    }
+  if (bswap_64 (wash (0x1234567890abcdefULL)) != 0xefcdab9078563412ULL)
+    {
+      puts ("bswap_64 (non-constant) flunked");
+      result = 1;
+    }
+
+  return result;
+}
+
+
+unsigned long long int
+wash (unsigned long long int a)
+{
+  /* Do nothing.  This function simply exists to avoid that the compiler
+     regards the argument to the bswap_*() functions as constant.  */
+  return a + 0;
+}
diff --git a/ap/build/uClibc/test/string/tst-inlcall.c b/ap/build/uClibc/test/string/tst-inlcall.c
new file mode 100644
index 0000000..2a4124e
--- /dev/null
+++ b/ap/build/uClibc/test/string/tst-inlcall.c
@@ -0,0 +1,83 @@
+/* Tester for calling inline string functions.
+   Copyright (C) 1998, 2000, 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 _GNU_SOURCE
+#define _GNU_SOURCE
+#endif
+
+/* Make sure we test the optimized inline functions.  */
+#define __USE_STRING_INLINES	1
+
+#include <errno.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <strings.h>
+#include <fcntl.h>
+
+
+int
+main (void)
+{
+  int status;
+  int errors = 0;
+  char buf1[1000];
+  char *cp;
+  char ch;
+
+  cp = strcpy (buf1, "hello world");
+  if (strcmp ("hello world", cp++) != 0)
+    {
+      puts ("strcmp test 1 failed");
+      ++errors;
+    }
+
+  cp = buf1;
+  if (strcmp (cp++, "hello world") != 0)
+    {
+      puts ("strcmp test 2 failed");
+      ++errors;
+    }
+
+  ch = 'h';
+  if (strchr ("hello world", ch++) == NULL)
+    {
+      puts ("strchr test 1 failed");
+      ++errors;
+    }
+
+  const char * const hw = "hello world";
+  if (strpbrk (hw, "o") - hw != 4)
+    {
+      puts ("strpbrk test 1 failed");
+      ++errors;
+    }
+
+  if (errors == 0)
+    {
+      status = EXIT_SUCCESS;
+      puts ("No errors.");
+    }
+  else
+    {
+      status = EXIT_FAILURE;
+      printf ("%d errors.\n", errors);
+    }
+  return status;
+}
diff --git a/ap/build/uClibc/test/string/tst-strlen.c b/ap/build/uClibc/test/string/tst-strlen.c
new file mode 100644
index 0000000..a1e1159
--- /dev/null
+++ b/ap/build/uClibc/test/string/tst-strlen.c
@@ -0,0 +1,45 @@
+/* Make sure we don't test the optimized inline functions if we want to
+   test the real implementation.  */
+#undef __USE_STRING_INLINES
+
+#include <stdio.h>
+#include <string.h>
+
+int
+main(int argc, char *argv[])
+{
+  static const size_t lens[] = { 0, 1, 0, 2, 0, 1, 0, 3,
+				 0, 1, 0, 2, 0, 1, 0, 4 };
+  char basebuf[24 + 32];
+  size_t base;
+
+  for (base = 0; base < 32; ++base)
+    {
+      char *buf = basebuf + base;
+      size_t words;
+
+      for (words = 0; words < 4; ++words)
+	{
+	  size_t last;
+	  memset (buf, 'a', words * 4);
+
+	  for (last = 0; last < 16; ++last)
+	    {
+	      buf[words * 4 + 0] = (last & 1) != 0 ? 'b' : '\0';
+	      buf[words * 4 + 1] = (last & 2) != 0 ? 'c' : '\0';
+	      buf[words * 4 + 2] = (last & 4) != 0 ? 'd' : '\0';
+	      buf[words * 4 + 3] = (last & 8) != 0 ? 'e' : '\0';
+	      buf[words * 4 + 4] = '\0';
+
+	      if (strlen (buf) != words * 4 + lens[last]
+		  || strnlen (buf, -1) != words * 4 + lens[last])
+		{
+		  printf ("failed for base=%Zu, words=%Zu, and last=%Zu\n",
+			  base, words, last);
+		  return 1;
+		}
+	    }
+	}
+    }
+  return 0;
+}
diff --git a/ap/build/uClibc/test/string/tst-strtok.c b/ap/build/uClibc/test/string/tst-strtok.c
new file mode 100644
index 0000000..7e34aee
--- /dev/null
+++ b/ap/build/uClibc/test/string/tst-strtok.c
@@ -0,0 +1,23 @@
+/* Testcase for strtok reported by Andrew Church <achurch@achurch.org>.  */
+#include <stdio.h>
+#include <string.h>
+
+int
+main (void)
+{
+  char buf[1] = { 0 };
+  int result = 0;
+
+  if (strtok (buf, " ") != NULL)
+    {
+      puts ("first strtok call did not return NULL");
+      result = 1;
+    }
+  else if (strtok (NULL, " ") != NULL)
+    {
+      puts ("second strtok call did not return NULL");
+      result = 1;
+    }
+
+  return result;
+}
diff --git a/ap/build/uClibc/test/string/tst-strxfrm.c b/ap/build/uClibc/test/string/tst-strxfrm.c
new file mode 100644
index 0000000..ff1b396
--- /dev/null
+++ b/ap/build/uClibc/test/string/tst-strxfrm.c
@@ -0,0 +1,80 @@
+/* Based on a test case by Paul Eggert.  */
+#include <features.h>
+#ifdef __UCLIBC_HAS_XLOCALE__
+#include <locale.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+
+
+char const string[] = "";
+
+
+static int
+test (const char *locale)
+{
+  size_t bufsize;
+  size_t r;
+  size_t l;
+  char *buf;
+  locale_t loc;
+  int result = 0;
+
+  if (setlocale (LC_COLLATE, locale) == NULL)
+    {
+      printf ("cannot set locale \"%s\"\n", locale);
+      return 1;
+    }
+  bufsize = strxfrm (NULL, string, 0) + 1;
+  buf = malloc (bufsize);
+  if (buf == NULL)
+    {
+      printf ("cannot allocate %zd bytes\n", bufsize);
+      return 1;
+    }
+  r = strxfrm (buf, string, bufsize);
+  l = strlen (buf);
+  if (r != l)
+    {
+       printf ("locale \"%s\": strxfrm returned %zu, strlen returned %zu\n",
+	       locale, r, l);
+       result = 1;
+    }
+
+  loc = newlocale (1 << LC_ALL, locale, NULL);
+
+  r = strxfrm_l (buf, string, bufsize, loc);
+  l = strlen (buf);
+  if (r != l)
+    {
+       printf ("locale \"%s\": strxfrm_l returned %zu, strlen returned %zu\n",
+	       locale, r, l);
+       result = 1;
+    }
+
+  freelocale (loc);
+
+  free (buf);
+
+  return result;
+}
+
+
+int
+main (void)
+{
+  int result = 0;
+
+  result |= test ("C");
+  result |= test ("en_US.ISO-8859-1");
+  result |= test ("de_DE.UTF-8");
+
+  return result;
+}
+
+#else
+int main(void)
+{
+  return 0;
+}
+#endif
diff --git a/ap/build/uClibc/test/termios/Makefile b/ap/build/uClibc/test/termios/Makefile
new file mode 100644
index 0000000..926e052
--- /dev/null
+++ b/ap/build/uClibc/test/termios/Makefile
@@ -0,0 +1,7 @@
+# uClibc termios tests
+# Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
+
+top_builddir=../../
+include ../Rules.mak
+-include Makefile.in
+include ../Test.mak
diff --git a/ap/build/uClibc/test/termios/termios.c b/ap/build/uClibc/test/termios/termios.c
new file mode 100644
index 0000000..5fbc344
--- /dev/null
+++ b/ap/build/uClibc/test/termios/termios.c
@@ -0,0 +1,25 @@
+#include <stdio.h>
+#include <stdlib.h>
+#include <termios.h>
+#include <unistd.h>
+#include <asm/ioctls.h>
+#include <sys/ioctl.h>
+
+int main(int argc,char *argv[])
+{
+	struct termios t;
+	int ret;
+
+	printf("TCGETS = 0x%08x\n",TCGETS);
+	printf("sizeof(struct termios) = %ld\n",(long)sizeof(struct termios));
+
+	ret = ioctl(fileno(stdout),TCGETS,&t);
+
+	if(ret<0){
+		perror("ioctl");
+	}else{
+		printf("ioctl returned %d\n",ret);
+	}
+
+	return 0;
+}
diff --git a/ap/build/uClibc/test/test-skeleton.c b/ap/build/uClibc/test/test-skeleton.c
new file mode 100644
index 0000000..7521584
--- /dev/null
+++ b/ap/build/uClibc/test/test-skeleton.c
@@ -0,0 +1,411 @@
+/* Skeleton for test programs.
+   Copyright (C) 1998,2000-2004, 2005 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+   Contributed by Ulrich Drepper <drepper@cygnus.com>, 1998.
+
+   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 <errno.h>
+#include <getopt.h>
+#include <malloc.h>
+#include <search.h>
+#include <signal.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <unistd.h>
+#include <sys/resource.h>
+#include <sys/wait.h>
+#include <sys/param.h>
+#include <time.h>
+#include <features.h>
+
+/* The test function is normally called `do_test' and it is called
+   with argc and argv as the arguments.  We nevertheless provide the
+   possibility to overwrite this name.  */
+#ifndef TEST_FUNCTION
+# define TEST_FUNCTION do_test (argc, argv)
+#endif
+
+#ifndef TEST_DATA_LIMIT
+# define TEST_DATA_LIMIT (64 << 20) /* Data limit (bytes) to run with.  */
+#endif
+
+#define OPT_DIRECT 1000
+#define OPT_TESTDIR 1001
+
+static struct option options[] =
+{
+#ifdef CMDLINE_OPTIONS
+  CMDLINE_OPTIONS
+#endif
+  { "direct", no_argument, NULL, OPT_DIRECT },
+  { "test-dir", required_argument, NULL, OPT_TESTDIR },
+  { NULL, 0, NULL, 0 }
+};
+
+/* PID of the test itself.  */
+static pid_t pid;
+
+/* Directory to place temporary files in.  */
+static const char *test_dir;
+
+/* List of temporary files.  */
+struct temp_name_list
+{
+  struct qelem q;
+  const char *name;
+} *temp_name_list;
+
+/* Add temporary files in list.  */
+static void
+__attribute__ ((unused))
+add_temp_file (const char *name)
+{
+  struct temp_name_list *newp
+    = (struct temp_name_list *) calloc (sizeof (*newp), 1);
+  if (newp != NULL)
+    {
+      newp->name = name;
+      if (temp_name_list == NULL)
+	temp_name_list = (struct temp_name_list *) &newp->q;
+      else
+	insque (newp, temp_name_list);
+    }
+}
+
+/* Delete all temporary files.  */
+static void
+delete_temp_files (void)
+{
+  while (temp_name_list != NULL)
+    {
+      remove (temp_name_list->name);
+      temp_name_list = (struct temp_name_list *) temp_name_list->q.q_forw;
+    }
+}
+
+/* Create a temporary file.  */
+static int
+__attribute__ ((unused))
+create_temp_file (const char *base, char **filename)
+{
+  char *fname;
+  int fd;
+
+  fname = (char *) malloc (strlen (test_dir) + 1 + strlen (base)
+			   + sizeof ("XXXXXX"));
+  if (fname == NULL)
+    {
+      puts ("out of memory");
+      return -1;
+    }
+  strcpy (stpcpy (stpcpy (stpcpy (fname, test_dir), "/"), base), "XXXXXX");
+
+  fd = mkstemp (fname);
+  if (fd == -1)
+    {
+      printf ("cannot open temporary file '%s': %s\n", fname, strerror(errno));
+      free (fname);
+      return -1;
+    }
+
+  add_temp_file (fname);
+  if (filename != NULL)
+    *filename = fname;
+
+  return fd;
+}
+
+/* Timeout handler.  We kill the child and exit with an error.  */
+static void
+__attribute__ ((noreturn))
+timeout_handler (int sig __attribute__ ((unused)))
+{
+  int killed = 0;
+  int status;
+  int i;
+
+  /* Send signal.  */
+  kill (pid, SIGKILL);
+
+  /* Wait for it to terminate.  */
+  for (i = 0; i < 5; ++i)
+    {
+      struct timespec ts;
+      killed = waitpid (pid, &status, WNOHANG|WUNTRACED);
+      if (killed != 0)
+	break;
+
+      /* Delay, give the system time to process the kill.  If the
+	 nanosleep() call return prematurely, all the better.  We
+	 won't restart it since this probably means the child process
+	 finally died.  */
+      ts.tv_sec = 0;
+      ts.tv_nsec = 100000000;
+      nanosleep (&ts, NULL);
+    }
+  if (killed != 0 && killed != pid)
+    {
+      perror ("Failed to kill test process");
+      exit (1);
+    }
+
+#ifdef CLEANUP_HANDLER
+  CLEANUP_HANDLER;
+#endif
+
+  /* If we expected this signal: good!  */
+#ifdef EXPECTED_SIGNAL
+  if (EXPECTED_SIGNAL == SIGALRM)
+    exit (0);
+#endif
+
+  if (killed == 0 || (WIFSIGNALED (status) && WTERMSIG (status) == SIGKILL))
+    fputs ("Timed out: killed the child process\n", stderr);
+  else if (WIFSTOPPED (status))
+    fprintf (stderr, "Timed out: the child process was %s\n",
+	     strsignal (WSTOPSIG (status)));
+  else if (WIFSIGNALED (status))
+    fprintf (stderr, "Timed out: the child process got signal %s\n",
+	     strsignal (WTERMSIG (status)));
+  else
+    fprintf (stderr, "Timed out: killed the child process but it exited %d\n",
+	     WEXITSTATUS (status));
+
+  /* Exit with an error.  */
+  exit (1);
+}
+
+static void
+__attribute__ ((noreturn))
+handler_killpid(int sig)
+{
+	kill(pid, SIGKILL); /* kill test */
+	signal(sig, SIG_DFL);
+	raise(sig); /* kill ourself */
+	_exit(128 + sig); /* paranoia */
+}
+
+/* We provide the entry point here.  */
+int
+main (int argc, char *argv[])
+{
+#ifdef __ARCH_USE_MMU__
+  int direct = 0;	/* Directly call the test function?  */
+#else
+  int direct = 1;
+#endif
+  int status;
+  int opt;
+  unsigned int timeoutfactor = 1;
+  pid_t termpid;
+  char *envstr_timeoutfactor;
+
+  /* Make uses of freed and uninitialized memory known.  */
+#ifdef __MALLOC_STANDARD__
+#ifndef M_PERTURB
+# define M_PERTURB -6
+#endif
+  mallopt (M_PERTURB, 42);
+#endif
+
+#ifdef STDOUT_UNBUFFERED
+  setbuf (stdout, NULL);
+#endif
+
+  while ((opt = getopt_long (argc, argv, "+", options, NULL)) != -1)
+    switch (opt)
+      {
+      case '?':
+	exit (1);
+      case OPT_DIRECT:
+	direct = 1;
+	break;
+      case OPT_TESTDIR:
+	test_dir = optarg;
+	break;
+#ifdef CMDLINE_PROCESS
+	CMDLINE_PROCESS
+#endif
+      }
+
+  /* If set, read the test TIMEOUTFACTOR value from the environment.
+     This value is used to scale the default test timeout values. */
+  envstr_timeoutfactor = getenv ("TIMEOUTFACTOR");
+  if (envstr_timeoutfactor != NULL)
+    {
+      char *envstr_conv = envstr_timeoutfactor;
+      unsigned long int env_fact;
+
+      env_fact = strtoul (envstr_timeoutfactor, &envstr_conv, 0);
+      if (*envstr_conv == '\0' && envstr_conv != envstr_timeoutfactor)
+	timeoutfactor = MAX (env_fact, 1);
+    }
+
+  /* Set TMPDIR to specified test directory.  */
+  if (test_dir != NULL)
+    {
+      setenv ("TMPDIR", test_dir, 1);
+
+      if (chdir (test_dir) < 0)
+	{
+	  perror ("chdir");
+	  exit (1);
+	}
+    }
+  else
+    {
+      test_dir = getenv ("TMPDIR");
+      if (test_dir == NULL || test_dir[0] == '\0')
+	test_dir = "/tmp";
+    }
+
+  /* Make sure we see all message, even those on stdout.  */
+  setvbuf (stdout, NULL, _IONBF, 0);
+
+  /* make sure temporary files are deleted.  */
+  atexit (delete_temp_files);
+
+  /* Correct for the possible parameters.  */
+  argv[optind - 1] = argv[0];
+  argv += optind - 1;
+  argc -= optind - 1;
+
+  /* Call the initializing function, if one is available.  */
+#ifdef PREPARE
+  PREPARE (argc, argv);
+#endif
+
+  /* If we are not expected to fork run the function immediately.  */
+  if (direct)
+    return TEST_FUNCTION;
+
+  /* Set up the test environment:
+     - prevent core dumps
+     - set up the timer
+     - fork and execute the function.  */
+
+#if defined __ARCH_USE_MMU__ || ! defined __UCLIBC__
+  pid = fork ();
+  if (pid == 0)
+    {
+      /* This is the child.  */
+#ifdef RLIMIT_DATA
+      struct rlimit data_limit;
+#endif
+#ifdef RLIMIT_CORE
+      /* Try to avoid dumping core.  */
+      struct rlimit core_limit;
+      core_limit.rlim_cur = 0;
+      core_limit.rlim_max = 0;
+      setrlimit (RLIMIT_CORE, &core_limit);
+#endif
+
+#ifdef RLIMIT_DATA
+      /* Try to avoid eating all memory if a test leaks.  */
+      if (getrlimit (RLIMIT_DATA, &data_limit) == 0)
+	{
+	  if (TEST_DATA_LIMIT == RLIM_INFINITY)
+	    data_limit.rlim_cur = data_limit.rlim_max;
+	  else if (data_limit.rlim_cur > (rlim_t) TEST_DATA_LIMIT)
+	    data_limit.rlim_cur = MIN ((rlim_t) TEST_DATA_LIMIT,
+				       data_limit.rlim_max);
+	  if (setrlimit (RLIMIT_DATA, &data_limit) < 0)
+	    perror ("setrlimit: RLIMIT_DATA");
+	}
+      else
+	perror ("getrlimit: RLIMIT_DATA");
+#endif
+
+      /* We put the test process in its own pgrp so that if it bogusly
+	 generates any job control signals, they won't hit the whole build.  */
+      setpgid (0, 0);
+
+      /* Execute the test function and exit with the return value.   */
+      exit (TEST_FUNCTION);
+    }
+  else if (pid < 0)
+#endif
+    {
+      perror ("Cannot fork test program");
+      exit (1);
+    }
+
+  signal (SIGTERM, handler_killpid);
+  signal (SIGINT, handler_killpid);
+  signal (SIGQUIT, handler_killpid);
+
+  /* Set timeout.  */
+#ifndef TIMEOUT
+  /* Default timeout is two seconds.  */
+# define TIMEOUT 2
+#endif
+  signal (SIGALRM, timeout_handler);
+  alarm (TIMEOUT * timeoutfactor);
+
+  /* Wait for the regular termination.  */
+  termpid = TEMP_FAILURE_RETRY (waitpid (pid, &status, 0));
+  if (termpid == -1)
+    {
+      printf ("Waiting for test program failed: %s\n", strerror(errno));
+      exit (1);
+    }
+  if (termpid != pid)
+    {
+      printf ("Oops, wrong test program terminated: expected %ld, got %ld\n",
+	      (long int) pid, (long int) termpid);
+      exit (1);
+    }
+
+#ifndef EXPECTED_SIGNAL
+  /* We don't expect any signal.  */
+# define EXPECTED_SIGNAL 0
+#endif
+  if (WTERMSIG (status) != EXPECTED_SIGNAL)
+    {
+      if (EXPECTED_SIGNAL != 0)
+	{
+	  if (WTERMSIG (status) == 0)
+	    fprintf (stderr,
+		     "Expected signal '%s' from child, got none\n",
+		     strsignal (EXPECTED_SIGNAL));
+	  else
+	    fprintf (stderr,
+		     "Incorrect signal from child: got `%s', need `%s'\n",
+		     strsignal (WTERMSIG (status)),
+		     strsignal (EXPECTED_SIGNAL));
+	}
+      else
+	fprintf (stderr, "Didn't expect signal from child: got `%s'\n",
+		 strsignal (WTERMSIG (status)));
+      exit (1);
+    }
+
+  /* Simply exit with the return value of the test.  */
+#ifndef EXPECTED_STATUS
+  return WEXITSTATUS (status);
+#else
+  if (WEXITSTATUS (status) != EXPECTED_STATUS)
+    {
+      fprintf (stderr, "Expected status %d, got %d\n",
+	       EXPECTED_STATUS, WEXITSTATUS (status));
+      exit (1);
+    }
+
+  return 0;
+#endif
+}
diff --git a/ap/build/uClibc/test/testsuite.h b/ap/build/uClibc/test/testsuite.h
new file mode 100644
index 0000000..afc45b0
--- /dev/null
+++ b/ap/build/uClibc/test/testsuite.h
@@ -0,0 +1,100 @@
+/* vi: set sw=4 ts=4: */
+/*
+ * Some simple macros for use in test applications.
+ * Copyright (C) 2000-2006 by Erik Andersen <andersen@uclibc.org>
+ *
+ * Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
+ */
+
+#ifndef TESTSUITE_H
+#define TESTSUITE_H
+
+#ifdef __NO_TESTCODE__
+extern size_t test_number;
+#endif
+
+extern void init_testsuite(const char* testname);
+extern void done_testing(void) __attribute__((noreturn));
+extern void success_msg(int result, const char* command);
+extern void error_msg(int result, int line, const char* file, const char* command);
+
+#ifndef __NO_TESTCODE__
+
+size_t test_number = 0;
+static int failures = 0;
+
+void error_msg(int result, int line, const char* file, const char* command)
+{
+	failures++;
+
+	printf("\nFAILED TEST %lu: \n\t%s\n", (unsigned long)test_number, command);
+	printf("AT LINE: %d, FILE: %s\n\n", line, file);
+}
+
+void success_msg(int result, const char* command)
+{
+#if 0
+	printf("passed test: %s == 0\n", command);
+#endif
+}
+
+void done_testing(void)
+{
+    if (0 < failures) {
+		printf("Failed %d tests\n", failures);
+		exit(EXIT_FAILURE);
+	} else {
+		printf("All functions tested sucessfully\n");
+		exit(EXIT_SUCCESS);
+	}
+}
+
+void init_testsuite(const char* testname)
+{
+	printf("%s", testname);
+	test_number = 0;
+	failures = 0;
+#if !defined(__UCLIBC__) || defined(__UCLIBC_DYNAMIC_ATEXIT__)
+	atexit(done_testing);
+#endif
+}
+
+#endif /* __NO_TESTCODE__ */
+
+
+#define TEST_STRING_OUTPUT(command, expected_result) \
+	do { \
+		int result = strcmp(command, expected_result); \
+		test_number++; \
+		if (result == expected_result) { \
+			success_msg(result, "command"); \
+		} else { \
+			error_msg(result, __LINE__, __FILE__, command); \
+		}; \
+	} while (0)
+
+#define TEST_NUMERIC(command, expected_result) \
+	do { \
+		int result = (command); \
+		test_number++; \
+		if (result == expected_result) { \
+			success_msg(result, # command); \
+		} else { \
+			error_msg(result, __LINE__, __FILE__, # command); \
+		}; \
+	} while (0)
+
+#define TEST(command) \
+	do { \
+		int result = (command); \
+		test_number++; \
+		if (result == 1) { \
+			success_msg(result, # command); \
+		} else { \
+			error_msg(result, __LINE__, __FILE__,  # command); \
+		}; \
+	} while (0)
+
+#define STR_CMD(cmd) cmd
+
+#endif	/* TESTSUITE_H */
diff --git a/ap/build/uClibc/test/time/Makefile b/ap/build/uClibc/test/time/Makefile
new file mode 100644
index 0000000..103acb8
--- /dev/null
+++ b/ap/build/uClibc/test/time/Makefile
@@ -0,0 +1,7 @@
+# uClibc time tests
+# Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
+
+top_builddir=../../
+include ../Rules.mak
+-include Makefile.in
+include ../Test.mak
diff --git a/ap/build/uClibc/test/time/Makefile.in b/ap/build/uClibc/test/time/Makefile.in
new file mode 100644
index 0000000..05f73a4
--- /dev/null
+++ b/ap/build/uClibc/test/time/Makefile.in
@@ -0,0 +1,12 @@
+# uClibc time tests
+# Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
+
+TESTS_DISABLED := bug-asctime bug-asctime_r time tst-mktime2 tst-posixtz \
+	tst-strftime tst-strptime tst-timezone
+
+ifneq ($(UCLIBC_HAS_XLOCALE),y)
+TESTS_DISABLED += tst-ftime_l
+endif
+
+CFLAGS_tst-strptime2 := -std=c99
+DODIFF_futimens1 := 1
diff --git a/ap/build/uClibc/test/time/bug-asctime.c b/ap/build/uClibc/test/time/bug-asctime.c
new file mode 100644
index 0000000..149e4e0
--- /dev/null
+++ b/ap/build/uClibc/test/time/bug-asctime.c
@@ -0,0 +1,40 @@
+/* Note: we disable this on uClibc because we dont bother
+ * verifying if the year is sane ... we just return ????
+ * for the year value ...
+ */
+
+#include <errno.h>
+#include <limits.h>
+#include <stdio.h>
+#include <time.h>
+
+
+static int
+do_test (void)
+{
+  int result = 0;
+  time_t t = time (NULL);
+  struct tm *tp = localtime (&t);
+  tp->tm_year = INT_MAX;
+  errno = 0;
+  char *s = asctime (tp);
+  if (s != NULL || errno != EOVERFLOW)
+    {
+      printf ("asctime did not fail correctly: s=%p, wanted %p; errno=%i, wanted %i\n",
+              s, NULL, errno, EOVERFLOW);
+      result = 1;
+    }
+  char buf[1000];
+  errno = 0;
+  s = asctime_r (tp, buf);
+  if (s != NULL || errno != EOVERFLOW)
+    {
+      printf ("asctime_r did not fail correctly: s=%p, wanted %p; errno=%i, wanted %i\n",
+              s, NULL, errno, EOVERFLOW);
+      result = 1;
+    }
+  return result;
+}
+
+#define TEST_FUNCTION do_test ()
+#include "../test-skeleton.c"
diff --git a/ap/build/uClibc/test/time/bug-asctime_r.c b/ap/build/uClibc/test/time/bug-asctime_r.c
new file mode 100644
index 0000000..1fcc465
--- /dev/null
+++ b/ap/build/uClibc/test/time/bug-asctime_r.c
@@ -0,0 +1,37 @@
+/* Note: we disable this on uClibc because we dont bother
+ * verifying if the year is sane ... we just return ????
+ * for the year value ...
+ */
+
+#include <errno.h>
+#include <limits.h>
+#include <stdio.h>
+#include <time.h>
+
+
+static int
+do_test (void)
+{
+  int result = 0;
+  time_t t = time (NULL);
+  struct tm *tp = localtime (&t);
+  tp->tm_year = 10000 - 1900;
+  char buf[1000];
+  errno = 0;
+  buf[26] = '\xff';
+  char *s = asctime_r (tp, buf);
+  if (s != NULL || errno != EOVERFLOW)
+    {
+      puts ("asctime_r did not fail correctly");
+      result = 1;
+    }
+  if (buf[26] != '\xff')
+    {
+      puts ("asctime_r overwrote 27th byte in buffer");
+      result = 1;
+    }
+  return result;
+}
+
+#define TEST_FUNCTION do_test ()
+#include "../test-skeleton.c"
diff --git a/ap/build/uClibc/test/time/clocktest.c b/ap/build/uClibc/test/time/clocktest.c
new file mode 100644
index 0000000..a5b2c09
--- /dev/null
+++ b/ap/build/uClibc/test/time/clocktest.c
@@ -0,0 +1,36 @@
+#include <signal.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <time.h>
+#include <unistd.h>
+
+volatile int gotit = 0;
+
+static void
+alarm_handler (int signum)
+{
+    gotit = 1;
+}
+
+
+int
+main (int argc, char ** argv)
+{
+  clock_t start, stop;
+
+  if (signal(SIGALRM, alarm_handler) == SIG_ERR)
+    {
+      perror ("signal");
+      exit (1);
+    }
+  alarm(1);
+  start = clock ();
+  while (!gotit);
+  stop = clock ();
+
+  printf ("%ld clock ticks per second (start=%ld,stop=%ld)\n",
+	  stop - start, start, stop);
+  printf ("CLOCKS_PER_SEC=%ld, sysconf(_SC_CLK_TCK)=%ld\n",
+	  CLOCKS_PER_SEC, sysconf(_SC_CLK_TCK));
+  return 0;
+}
diff --git a/ap/build/uClibc/test/time/test_time.c b/ap/build/uClibc/test/time/test_time.c
new file mode 100644
index 0000000..2ce819a
--- /dev/null
+++ b/ap/build/uClibc/test/time/test_time.c
@@ -0,0 +1,116 @@
+/* Copyright (C) 1991, 1992, 1994, 1997 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 <stdio.h>
+#include <stdlib.h>
+#include <time.h>
+
+
+int
+main (int argc, char **argv)
+{
+  time_t t;
+  register struct tm *tp;
+  struct tm tbuf;
+  int lose = 0;
+
+  --argc;
+  ++argv;
+
+  do
+    {
+      char buf[BUFSIZ];
+      if (argc > 0)
+	{
+	  static char tzenvbuf[BUFSIZ];
+	  sprintf(tzenvbuf, "TZ=%s", *argv);
+	  if (putenv(tzenvbuf))
+	    {
+	      puts("putenv failed.");
+	      lose = 1;
+	    }
+	  else
+	    puts (tzenvbuf);
+	}
+      tzset();
+      tbuf.tm_year = 72;
+      tbuf.tm_mon = 0;
+      tbuf.tm_mday = 31;
+      tbuf.tm_hour = 6;
+      tbuf.tm_min = 14;
+      tbuf.tm_sec = 50;
+      tbuf.tm_isdst = -1;
+    doit:;
+      t = mktime(&tbuf);
+      if (t == (time_t) -1)
+	{
+	  puts("mktime() failed?");
+	  lose = 1;
+	}
+      tp = localtime(&t);
+      if (tp == NULL)
+	{
+	  puts("localtime() failed.");
+	  lose = 1;
+	}
+      else if (strftime(buf, sizeof(buf), "%a %b %d %X %Z %Y", tp) == 0)
+	{
+	  puts("strftime() failed.");
+	  lose = 1;
+	}
+      else
+	puts(buf);
+      if (tbuf.tm_year == 101)
+	{
+	  tbuf.tm_year = 97;
+	  tbuf.tm_mon = 0;
+	  goto doit;
+	}
+      ++argv;
+    } while (--argc > 0);
+
+  {
+#define	SIZE	256
+    char buffer[SIZE];
+    time_t curtime;
+    struct tm *loctime;
+
+    curtime = time (NULL);
+
+    loctime = localtime (&curtime);
+
+    fputs (asctime (loctime), stdout);
+
+    strftime (buffer, SIZE, "Today is %A, %B %d.\n", loctime);
+    fputs (buffer, stdout);
+    strftime (buffer, SIZE, "The time is %I:%M %p.\n", loctime);
+    fputs (buffer, stdout);
+
+    loctime->tm_year = 72;
+    loctime->tm_mon = 8;
+    loctime->tm_mday = 12;
+    loctime->tm_hour = 20;
+    loctime->tm_min = 49;
+    loctime->tm_sec = 05;
+    curtime = mktime (loctime);
+    strftime (buffer, SIZE, "%D %T was %w the %jth.\n", loctime);
+    fputs (buffer, stdout);
+  }
+
+  return (lose ? EXIT_FAILURE : EXIT_SUCCESS);
+}
diff --git a/ap/build/uClibc/test/time/time.c b/ap/build/uClibc/test/time/time.c
new file mode 100644
index 0000000..a4d68d5
--- /dev/null
+++ b/ap/build/uClibc/test/time/time.c
@@ -0,0 +1,76 @@
+#include <stdlib.h>
+#include <stdio.h>
+#include <time.h>
+
+/* We use this instead of memcmp because some broken C libraries
+ * add additional nonstandard fields to struct tm... */
+
+int tm_cmp(struct tm tm1, struct tm tm2)
+{
+	return  tm1.tm_sec  != tm2.tm_sec  ||
+		tm1.tm_min  != tm2.tm_min  ||
+		tm1.tm_hour != tm2.tm_hour ||
+		tm1.tm_mday != tm2.tm_mday ||
+		tm1.tm_mon  != tm2.tm_mon  ||
+		tm1.tm_year != tm2.tm_year ||
+		tm1.tm_wday != tm2.tm_wday ||
+		tm1.tm_yday != tm2.tm_yday ||
+		tm1.tm_isdst!= tm2.tm_isdst;
+}
+
+char *tm_str(struct tm tm)
+{
+	static int i;
+	static char b[4][64];
+	i = (i+1)%4;
+	snprintf(b[i], sizeof b[i],
+		"s=%.2d m=%.2d h=%.2d mday=%.2d mon=%.2d year=%.4d wday=%d yday=%d isdst=%d",
+		tm.tm_sec, tm.tm_min, tm.tm_hour,
+		tm.tm_mday, tm.tm_mon, tm.tm_year,
+		tm.tm_wday, tm.tm_yday, tm.tm_isdst);
+	return b[i];
+}
+
+#define TM(ss,mm,hh,md,mo,yr,wd,yd,dst) (struct tm){ \
+	.tm_sec = ss, .tm_min = mm, .tm_hour = hh,    \
+	.tm_mday = md, .tm_mon = mo, .tm_year = yr,    \
+	.tm_wday = wd, .tm_yday = yd, .tm_isdst = dst }
+
+#define TM_EPOCH    TM(0,0,0,1,0,70,4,0,0)
+#define TM_Y2038_1S TM(7,14,3,19,0,138,2,18,0)
+#define TM_Y2038    TM(8,14,3,19,0,138,2,18,0)
+
+#define TEST_TM(r,x,m) (!tm_cmp((r),(x)) || \
+(printf(__FILE__ ":%d: %s failed:\n\tresult: %s\n\texpect: %s\n", __LINE__, \
+m, tm_str((r)), tm_str((x))), err++, 0) )
+
+#define TEST(r, f, x, m) ( \
+((r) = (f)) == (x) || \
+(printf(__FILE__ ":%d: %s failed (" m ")\n", __LINE__, #f, r, x), err++, 0) )
+
+int main(void)
+{
+	struct tm tm, *tm_p;
+	time_t t;
+	int err=0;
+
+	putenv("TZ=GMT");
+	tzset();
+
+	t=0; tm_p = gmtime(&t);
+	TEST_TM(*tm_p, TM_EPOCH, "gmtime(0)");
+
+	tm = TM_Y2038_1S;
+	t = mktime(&tm);
+	tm = *(gmtime(&t));
+	TEST_TM(*tm_p, TM_Y2038_1S, "mktime/gmtime(Y2038-1)");
+
+	tm = TM_Y2038;
+	t = mktime(&tm);
+	tm = *(gmtime(&t));
+	TEST_TM(*tm_p, TM_Y2038, "mktime/gmtime(Y2038)");
+
+	/* FIXME: set a TZ var and check DST boundary conditions */
+
+	return err;
+}
diff --git a/ap/build/uClibc/test/time/tst-ctime.c b/ap/build/uClibc/test/time/tst-ctime.c
new file mode 100644
index 0000000..91d827a
--- /dev/null
+++ b/ap/build/uClibc/test/time/tst-ctime.c
@@ -0,0 +1,44 @@
+/* vi: set sw=4 ts=4: */
+/* testcase for ctime(3) with large time
+ * Copyright (C) 2010 David A Ramos <daramos@gustav.stanford.edu>
+ * Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
+ */
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <time.h>
+
+#define MAX_POSITIVE(type)  (~0 & ~((type) 1 << (sizeof(type)*8 - 1)))
+
+int do_test(int argc, char **argv) {
+	char *correct = 0, *s;
+	int status;
+
+	/* need a very high positive number (e.g., max - 1024) */
+	time_t test = MAX_POSITIVE(time_t) - 1024;
+
+	s = asctime(localtime(&test));
+
+	if (s) {
+		// copy static buffer to heap
+		correct = malloc(strlen(s)+1);
+		strcpy(correct, s);
+	}
+
+	s = ctime(&test);
+
+	printf("ANSI:\t%suClibc:\t%s", correct, s);
+
+	if (s != correct && strcmp(correct, s))
+		status = EXIT_FAILURE;
+	else
+		status = EXIT_SUCCESS;
+
+	if (correct)
+		free(correct);
+
+    return status;
+}
+
+#include <test-skeleton.c>
diff --git a/ap/build/uClibc/test/time/tst-ftime_l.c b/ap/build/uClibc/test/time/tst-ftime_l.c
new file mode 100644
index 0000000..95017f1
--- /dev/null
+++ b/ap/build/uClibc/test/time/tst-ftime_l.c
@@ -0,0 +1,136 @@
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <time.h>
+#include <features.h>
+#ifdef __UCLIBC_HAS_XLOCALE__
+#include <locale.h>
+#include <wchar.h>
+
+
+int
+main (void)
+{
+  locale_t l;
+  locale_t old;
+  struct tm tm;
+  char buf[1000];
+  wchar_t wbuf[1000];
+  int result = 0;
+  size_t n;
+
+  l = newlocale (LC_ALL_MASK, "de_DE.ISO-8859-1", NULL);
+  if (l == NULL)
+    {
+      puts ("newlocale failed");
+      exit (1);
+    }
+
+  memset (&tm, '\0', sizeof (tm));
+
+  tm.tm_year = 102;
+  tm.tm_mon = 2;
+  tm.tm_mday = 1;
+
+  if (strftime (buf, sizeof (buf), "%e %^B %Y", &tm) == 0)
+    {
+      puts ("initial strftime failed");
+      exit (1);
+    }
+  if (strcmp (buf, " 1 MARCH 2002") != 0)
+    {
+      printf ("initial strftime: expected \"%s\", got \"%s\"\n",
+	      " 1 MARCH 2002", buf);
+      result = 1;
+    }
+  else
+    printf ("got \"%s\"\n", buf);
+
+  /* Now using the extended locale model.  */
+  if (strftime_l (buf, sizeof (buf), "%e %^B %Y", &tm, l) == 0)
+    {
+      puts ("strftime_l failed");
+      result = 1;
+    }
+  else if (strcmp (buf, " 1 M\xc4RZ 2002") != 0)
+    {
+      printf ("strftime_l: expected \"%s\", got \"%s\"\n",
+	      " 1 M\xc4RZ 2002", buf);
+      result = 1;
+    }
+  else
+    {
+      setlocale (LC_ALL, "de_DE.ISO-8859-1");
+      printf ("got \"%s\"\n", buf);
+      setlocale (LC_ALL, "C");
+    }
+
+  /* And the wide character version.  */
+  if (wcsftime_l (wbuf, sizeof (wbuf) / sizeof (wbuf[0]), L"%e %^B %Y", &tm, l)
+      == 0)
+    {
+      puts ("wcsftime_l failed");
+      result = 1;
+    }
+  else if (wcscmp (wbuf, L" 1 M\x00c4RZ 2002") != 0)
+    {
+      printf ("wcsftime_l: expected \"%ls\", got \"%ls\"\n",
+	      L" 1 M\x00c4RZ 2002", wbuf);
+      result = 1;
+    }
+  else
+    {
+      setlocale (LC_ALL, "de_DE.ISO-8859-1");
+      printf ("got \"%ls\"\n", wbuf);
+      setlocale (LC_ALL, "C");
+    }
+
+  old = uselocale (l);
+
+  n = strftime (buf, sizeof (buf), "%e %^B %Y", &tm);
+
+  /* Switch back.  */
+  (void) uselocale (old);
+
+  if (n == 0)
+    {
+      puts ("strftime after first uselocale failed");
+      result = 1;
+    }
+  else if (strcmp (buf, " 1 M\xc4RZ 2002") != 0)
+    {
+      printf ("strftime in non-C locale: expected \"%s\", got \"%s\"\n",
+	      " 1 M\xc4RZ 2002", buf);
+      result = 1;
+    }
+  else
+    {
+      setlocale (LC_ALL, "de_DE.ISO-8859-1");
+      printf ("got \"%s\"\n", buf);
+      setlocale (LC_ALL, "C");
+    }
+
+  if (strftime (buf, sizeof (buf), "%e %^B %Y", &tm) == 0)
+    {
+      puts ("strftime after second uselocale failed");
+      result = 1;
+    }
+  else if (strcmp (buf, " 1 MARCH 2002") != 0)
+    {
+      printf ("initial strftime: expected \"%s\", got \"%s\"\n",
+	      " 1 MARCH 2002", buf);
+      result = 1;
+    }
+  else
+    printf ("got \"%s\"\n", buf);
+
+  return result;
+}
+
+#else
+int main(void)
+{
+	puts("Test requires WCHAR support; skipping");
+	return 0;
+}
+#endif
diff --git a/ap/build/uClibc/test/time/tst-futimens1.c b/ap/build/uClibc/test/time/tst-futimens1.c
new file mode 100644
index 0000000..2c25bd4
--- /dev/null
+++ b/ap/build/uClibc/test/time/tst-futimens1.c
@@ -0,0 +1,105 @@
+/* vi: set sw=4 ts=4: */
+/* testcase for futimens(2)
+ * Copyright (C) 2009 Bernhard Reutner-Fischer <uClibc@uClibc.org>
+ * Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
+ */
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <errno.h>
+#include <stdlib.h>
+#include <fcntl.h>
+#include <stdio.h>
+#include <unistd.h>
+
+struct
+{
+	char *name; /* name of file to open */
+	int flags; /* flags for file descriptor */
+	const struct timespec ts[2];
+	int err; /* expected errno */
+} tests [] =
+{
+	{"futimens.tst", (O_CREAT|O_TRUNC), {{0,0},{0,0}}, 0},
+	{"futimens.tst", (O_CREAT|O_TRUNC), {{99,0},{0,0}}, 0},
+	{"futimens.tst", (O_CREAT|O_TRUNC), {{0,99},{0,0}}, 0},
+	{"futimens.tst", (O_CREAT|O_TRUNC), {{0,0},{99,0}}, 0},
+	{"futimens.tst", (O_CREAT|O_TRUNC), {{0,0},{0,99}}, 0},
+	{"futimens.tst", (O_CREAT|O_TRUNC), {{11,2},{3,4}}, 0},
+};
+int do_test(int argc, char **argv) {
+	char *name;
+	int i, errors;
+	errors = argc - argc + 0;
+	unsigned has_stat_nsec = 0;
+	{
+		struct stat probe;
+		/* Let's attempt an educated guess if this filesystem supports
+		 * nanosecond mtime.  */
+		if ((!stat(".", &probe)) && probe.st_mtim.tv_nsec)
+			has_stat_nsec = 1;
+		else if ((!stat(argv[0], &probe)) && probe.st_mtim.tv_nsec)
+			has_stat_nsec = 1;
+	}
+	for (i=0; i < (int) (sizeof(tests)/sizeof(tests[0])); ++i) {
+		int err, fd;
+		struct stat sb;
+		name = tests[i].name;
+		if (*name != '.')
+			unlink(name);
+		fd = open(name, tests[i].flags, 0660);
+		if (fd < 0)
+			abort();
+		errno = 0;
+		err = futimens(fd, tests[i].ts);
+		if ((errno && !err) || (!errno && err)) {
+			err = errno;
+			printf("FAILED test %d (errno and return value disagree)\n", i);
+			++errors;
+		} else
+			err = errno;
+		if (err != tests[i].err) {
+			printf("FAILED test %d (expected errno %d, got %d)\n",
+				i, tests[i].err, err);
+			++errors;
+			continue;
+		}
+		if (stat(name, &sb) < 0) {
+			printf("FAILED test %d (verification)\n", i);
+			++errors;
+			continue;
+		} else {
+			unsigned wrong = tests[i].ts[0].tv_sec != sb.st_atim.tv_sec ||
+						tests[i].ts[0].tv_nsec != sb.st_atim.tv_nsec ||
+						tests[i].ts[1].tv_sec != sb.st_mtim.tv_sec ||
+						tests[i].ts[1].tv_nsec != sb.st_mtim.tv_nsec;
+			if (wrong) {
+				if (tests[i].ts[0].tv_sec != sb.st_atim.tv_sec) {
+					printf("FAILED test %d (access time, sec: expected %ld, got %ld)\n",
+						i, tests[i].ts[0].tv_sec, sb.st_atim.tv_sec);
+						++errors;
+				}
+				if (tests[i].ts[0].tv_nsec != sb.st_atim.tv_nsec) {
+					printf("FAILED test %d (access time, nsec: expected %ld, got %ld)\n",
+						i, tests[i].ts[0].tv_nsec, sb.st_atim.tv_nsec);
+					errors += has_stat_nsec;
+				}
+
+				if (tests[i].ts[1].tv_sec != sb.st_mtim.tv_sec) {
+					printf("FAILED test %d (modification time, sec: expected %ld, got %ld)\n",
+						i, tests[i].ts[1].tv_sec, sb.st_mtim.tv_sec);
+						++errors;
+				}
+				if (tests[i].ts[1].tv_nsec != sb.st_mtim.tv_nsec) {
+					printf("FAILED test %d (modification time, nsec: expected %ld, got %ld)\n",
+						i, tests[i].ts[1].tv_nsec, sb.st_mtim.tv_nsec);
+					errors += has_stat_nsec;
+				}
+			}
+		}
+	}
+	if (*name != '.')
+		unlink(name);
+	printf("%d errors.\n", errors);
+	return (!errors) ? EXIT_SUCCESS : EXIT_FAILURE;
+}
+#include <test-skeleton.c>
diff --git a/ap/build/uClibc/test/time/tst-mktime.c b/ap/build/uClibc/test/time/tst-mktime.c
new file mode 100644
index 0000000..416a856
--- /dev/null
+++ b/ap/build/uClibc/test/time/tst-mktime.c
@@ -0,0 +1,70 @@
+#include <stdlib.h>
+#include <stdio.h>
+#include <string.h>
+#include <time.h>
+
+int
+main (void)
+{
+  struct tm time_str, *tm;
+  time_t t;
+  char daybuf[20];
+  int result;
+
+  time_str.tm_year = 2001 - 1900;
+  time_str.tm_mon = 7 - 1;
+  time_str.tm_mday = 4;
+  time_str.tm_hour = 0;
+  time_str.tm_min = 0;
+  time_str.tm_sec = 1;
+  time_str.tm_isdst = -1;
+
+  if (mktime (&time_str) == -1)
+    {
+      (void) puts ("-unknown-");
+      result = 1;
+    }
+  else
+    {
+      (void) strftime (daybuf, sizeof (daybuf), "%A", &time_str);
+      (void) puts (daybuf);
+      result = strcmp (daybuf, "Wednesday") != 0;
+    }
+
+  setenv ("TZ", "EST+5", 1);
+#define EVENING69 1 * 60 * 60 + 2 * 60 + 29
+  t = EVENING69;
+  tm = localtime (&t);
+  if (tm == NULL)
+    {
+      (void) puts ("localtime returned NULL");
+      result = 1;
+    }
+  else
+    {
+      time_str = *tm;
+      t = mktime (&time_str);
+      if (t != EVENING69)
+        {
+          printf ("mktime returned %ld, expected %d\n",
+		  (long) t, EVENING69);
+	  result = 1;
+        }
+      else
+        (void) puts ("Dec 31 1969 EST test passed");
+
+      setenv ("TZ", "CET-1", 1);
+      t = mktime (&time_str);
+#define EVENING69_CET (EVENING69 - (5 - -1) * 60 * 60)
+      if (t != EVENING69_CET)
+        {
+	  printf ("mktime returned %ld, expected %ld\n",
+		  (long) t, (long) EVENING69_CET);
+	  result = 1;
+        }
+      else
+        (void) puts ("Dec 31 1969 CET test passed");
+    }
+
+  return result;
+}
diff --git a/ap/build/uClibc/test/time/tst-mktime2.c b/ap/build/uClibc/test/time/tst-mktime2.c
new file mode 100644
index 0000000..6279218
--- /dev/null
+++ b/ap/build/uClibc/test/time/tst-mktime2.c
@@ -0,0 +1,141 @@
+/* Test program from Paul Eggert and Tony Leneis.  */
+#include <time.h>
+#include <stdlib.h>
+#include <unistd.h>
+
+static time_t time_t_max;
+static time_t time_t_min;
+
+/* Values we'll use to set the TZ environment variable.  */
+static const char *tz_strings[] =
+  {
+    (const char *) 0, "GMT0", "JST-9",
+    "EST+3EDT+2,M10.1.0/00:00:00,M2.3.0/00:00:00"
+  };
+#define N_STRINGS ((int) (sizeof (tz_strings) / sizeof (tz_strings[0])))
+
+/* Fail if mktime fails to convert a date in the spring-forward gap.
+   Based on a problem report from Andreas Jaeger.  */
+static void
+spring_forward_gap (void)
+{
+  /* glibc (up to about 1998-10-07) failed this test. */
+  struct tm tm;
+
+  /* Use the portable POSIX.1 specification "TZ=PST8PDT,M4.1.0,M10.5.0"
+     instead of "TZ=America/Vancouver" in order to detect the bug even
+     on systems that don't support the Olson extension, or don't have the
+     full zoneinfo tables installed.  */
+  setenv ("TZ", "PST8PDT,M4.1.0,M10.5.0", 1);
+
+  tm.tm_year = 98;
+  tm.tm_mon = 3;
+  tm.tm_mday = 5;
+  tm.tm_hour = 2;
+  tm.tm_min = 0;
+  tm.tm_sec = 0;
+  tm.tm_isdst = -1;
+  if (mktime (&tm) == (time_t)-1)
+    exit (1);
+}
+
+static void
+mktime_test1 (time_t now)
+{
+  struct tm *lt = localtime (&now);
+  if (lt && mktime (lt) != now)
+    exit (2);
+}
+
+static void
+mktime_test (time_t now)
+{
+  mktime_test1 (now);
+  mktime_test1 ((time_t) (time_t_max - now));
+  mktime_test1 ((time_t) (time_t_min + now));
+}
+
+static void
+irix_6_4_bug (void)
+{
+  /* Based on code from Ariel Faigon.  */
+  struct tm tm;
+  tm.tm_year = 96;
+  tm.tm_mon = 3;
+  tm.tm_mday = 0;
+  tm.tm_hour = 0;
+  tm.tm_min = 0;
+  tm.tm_sec = 0;
+  tm.tm_isdst = -1;
+  mktime (&tm);
+  if (tm.tm_mon != 2 || tm.tm_mday != 31)
+    exit (3);
+}
+
+static void
+bigtime_test (int j)
+{
+  struct tm tm;
+  time_t now;
+  tm.tm_year = tm.tm_mon = tm.tm_mday = tm.tm_hour = tm.tm_min = tm.tm_sec = j;
+  tm.tm_isdst = -1;
+  now = mktime (&tm);
+  if (now != (time_t) -1)
+    {
+      struct tm *lt = localtime (&now);
+      if (! (lt
+	     && lt->tm_year == tm.tm_year
+	     && lt->tm_mon == tm.tm_mon
+	     && lt->tm_mday == tm.tm_mday
+	     && lt->tm_hour == tm.tm_hour
+	     && lt->tm_min == tm.tm_min
+	     && lt->tm_sec == tm.tm_sec
+	     && lt->tm_yday == tm.tm_yday
+	     && lt->tm_wday == tm.tm_wday
+	     && ((lt->tm_isdst < 0 ? -1 : 0 < lt->tm_isdst)
+		  == (tm.tm_isdst < 0 ? -1 : 0 < tm.tm_isdst))))
+	exit (4);
+    }
+}
+
+static int
+do_test (void)
+{
+  time_t t, delta;
+  int i, j;
+
+  setenv ("TZ", "America/Sao_Paulo", 1);
+  /* This test makes some buggy mktime implementations loop.
+     Give up after 60 seconds; a mktime slower than that
+     isn't worth using anyway.  */
+  alarm (60);
+
+  for (time_t_max = 1; 0 < time_t_max; time_t_max *= 2)
+    continue;
+  time_t_max--;
+  if ((time_t) -1 < 0)
+    for (time_t_min = -1; (time_t) (time_t_min * 2) < 0; time_t_min *= 2)
+      continue;
+  delta = time_t_max / 997; /* a suitable prime number */
+  for (i = 0; i < N_STRINGS; i++)
+    {
+      if (tz_strings[i])
+	setenv ("TZ", tz_strings[i], 1);
+
+      for (t = 0; t <= time_t_max - delta; t += delta)
+	mktime_test (t);
+      mktime_test ((time_t) 1);
+      mktime_test ((time_t) (60 * 60));
+      mktime_test ((time_t) (60 * 60 * 24));
+
+      for (j = 1; 0 < j; j *= 2)
+	bigtime_test (j);
+      bigtime_test (j - 1);
+    }
+  irix_6_4_bug ();
+  spring_forward_gap ();
+  return 0;
+}
+
+#define TEST_FUNCTION do_test ()
+#include "../test-skeleton.c"
diff --git a/ap/build/uClibc/test/time/tst-mktime3.c b/ap/build/uClibc/test/time/tst-mktime3.c
new file mode 100644
index 0000000..60d0e0b
--- /dev/null
+++ b/ap/build/uClibc/test/time/tst-mktime3.c
@@ -0,0 +1,50 @@
+/* Test program for mktime bugs with out-of-range tm_sec values.  */
+
+#include <stdlib.h>
+#include <stdio.h>
+#include <time.h>
+
+struct tm tests[] =
+{
+  { .tm_sec = -1, .tm_mday = 1, .tm_year = 104 },
+  { .tm_sec = 65, .tm_min = 59, .tm_hour = 23, .tm_mday = 31,
+    .tm_mon = 11, .tm_year = 101 }
+};
+struct tm expected[] =
+{
+  { .tm_sec = 59, .tm_min = 59, .tm_hour = 23, .tm_mday = 31,
+    .tm_mon = 11, .tm_year = 103, .tm_wday = 3, .tm_yday = 364 },
+  { .tm_sec = 5, .tm_mday = 1, .tm_year = 102, .tm_wday = 2 }
+};
+
+int
+main (void)
+{
+  setenv ("TZ", "UTC", 1);
+  int i;
+  for (i = 0; i < sizeof (tests) / sizeof (tests[0]); ++i)
+    {
+      if (mktime (&tests[i]) < 0)
+	{
+	  printf ("mktime %d failed\n", i);
+	  return 1;
+	}
+#define CHECK(name) \
+      if (tests[i].name != expected[i].name)			\
+	{							\
+	  printf ("test %d " #name " got %d expected %d\n",	\
+		  i, tests[i].name, expected[i].name);		\
+	  return 1;						\
+	}
+      CHECK (tm_sec)
+      CHECK (tm_min)
+      CHECK (tm_hour)
+      CHECK (tm_mday)
+      CHECK (tm_mon)
+      CHECK (tm_year)
+      CHECK (tm_wday)
+      CHECK (tm_yday)
+      CHECK (tm_isdst)
+    }
+  return 0;
+}
diff --git a/ap/build/uClibc/test/time/tst-posixtz.c b/ap/build/uClibc/test/time/tst-posixtz.c
new file mode 100644
index 0000000..ccba63e
--- /dev/null
+++ b/ap/build/uClibc/test/time/tst-posixtz.c
@@ -0,0 +1,88 @@
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <time.h>
+
+struct
+{
+  time_t when;
+  const char *tz;
+  const char *result;
+} tests[] =
+{
+  { 909312849L, "AEST-10AEDST-11,M10.5.0,M3.5.0",
+    "1998/10/25 21:54:09 dst=1 zone=AEDST" },
+  { 924864849L, "AEST-10AEDST-11,M10.5.0,M3.5.0",
+    "1999/04/23 20:54:09 dst=0 zone=AEST" },
+  { 919973892L, "AEST-10AEDST-11,M10.5.0,M3.5.0",
+    "1999/02/26 07:18:12 dst=1 zone=AEDST" },
+  { 909312849L, "EST+5EDT,M4.1.0/2,M10.5.0/2",
+    "1998/10/25 05:54:09 dst=0 zone=EST" },
+  { 924864849L, "EST+5EDT,M4.1.0/2,M10.5.0/2",
+    "1999/04/23 06:54:09 dst=1 zone=EDT" },
+  { 919973892L, "EST+5EDT,M4.1.0/2,M10.5.0/2",
+    "1999/02/25 15:18:12 dst=0 zone=EST" },
+};
+
+int
+main (void)
+{
+  int result = 0;
+  size_t cnt;
+
+  for (cnt = 0; cnt < sizeof (tests) / sizeof (tests[0]); ++cnt)
+    {
+      char buf[100];
+      struct tm *tmp;
+
+      printf ("TZ = \"%s\", time = %ld => ", tests[cnt].tz, tests[cnt].when);
+      fflush (stdout);
+
+      setenv ("TZ", tests[cnt].tz, 1);
+
+      tmp = localtime (&tests[cnt].when);
+
+      snprintf (buf, sizeof (buf),
+		"%04d/%02d/%02d %02d:%02d:%02d dst=%d zone=%s",
+		tmp->tm_year + 1900, tmp->tm_mon + 1, tmp->tm_mday,
+		tmp->tm_hour, tmp->tm_min, tmp->tm_sec, tmp->tm_isdst,
+		tzname[tmp->tm_isdst ? 1 : 0]);
+
+      fputs (buf, stdout);
+
+      if (strcmp (buf, tests[cnt].result) == 0)
+	puts (", OK");
+      else
+	{
+	  result = 1;
+	  puts (", FAIL");
+	}
+    }
+
+  setenv ("TZ", "Universal", 1);
+  localtime (&tests[0].when);
+  printf ("TZ = \"Universal\" daylight %d tzname = { \"%s\", \"%s\" }",
+	  daylight, tzname[0], tzname[1]);
+  if (! daylight)
+    puts (", OK");
+  else
+    {
+      result = 1;
+      puts (", FAIL");
+    }
+
+  setenv ("TZ", "AEST-10AEDST-11,M10.5.0,M3.5.0", 1);
+  tzset ();
+  printf ("TZ = \"AEST-10AEDST-11,M10.5.0,M3.5.0\" daylight %d"
+	  " tzname = { \"%s\", \"%s\" }", daylight, tzname[0], tzname[1]);
+  if (daylight
+      && strcmp (tzname[0], "AEST") == 0 && strcmp (tzname[1], "AEDST") == 0)
+    puts (", OK");
+  else
+    {
+      result = 1;
+      puts (", FAIL");
+    }
+
+  return result;
+}
diff --git a/ap/build/uClibc/test/time/tst-strftime.c b/ap/build/uClibc/test/time/tst-strftime.c
new file mode 100644
index 0000000..374fba4
--- /dev/null
+++ b/ap/build/uClibc/test/time/tst-strftime.c
@@ -0,0 +1,111 @@
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <time.h>
+
+
+static struct
+{
+  const char *fmt;
+  size_t min;
+  size_t max;
+} tests[] =
+  {
+    { "%2000Y", 2000, 4000 },
+    { "%02000Y", 2000, 4000 },
+    { "%_2000Y", 2000, 4000 },
+    { "%-2000Y", 2000, 4000 },
+  };
+#define ntests (sizeof (tests) / sizeof (tests[0]))
+
+
+static int
+do_test (void)
+{
+  size_t cnt;
+  int result = 0;
+
+  time_t tnow = time (NULL);
+  struct tm *now = localtime (&tnow);
+
+  for (cnt = 0; cnt < ntests; ++cnt)
+    {
+      size_t size = 0;
+      int res;
+      char *buf = NULL;
+
+      do
+	{
+	  size += 500;
+	  buf = (char *) realloc (buf, size);
+	  if (buf == NULL)
+	    {
+	      puts ("out of memory");
+	      exit (1);
+	    }
+
+	  res = strftime (buf, size, tests[cnt].fmt, now);
+	  if (res != 0)
+	    break;
+	}
+      while (size < tests[cnt].max);
+
+      if (res == 0)
+	{
+	  printf ("%Zu: %s: res == 0 despite size == %Zu\n",
+		  cnt, tests[cnt].fmt, size);
+	  result = 1;
+	}
+      else if (size < tests[cnt].min)
+	{
+	  printf ("%Zu: %s: size == %Zu was enough\n",
+		  cnt, tests[cnt].fmt, size);
+	  result = 1;
+	}
+      else
+	printf ("%Zu: %s: size == %Zu: OK\n", cnt, tests[cnt].fmt, size);
+
+      free (buf);
+    }
+
+  struct tm ttm =
+    {
+      /* Initialize the fields which are needed in the tests.  */
+      .tm_mday = 1,
+      .tm_hour = 2
+    };
+  const struct
+  {
+    const char *fmt;
+    const char *exp;
+    size_t n;
+  } ftests[] =
+    {
+      { "%-e", "1", 1 },
+      { "%-k", "2", 1 },
+      { "%-l", "2", 1 },
+    };
+#define nftests (sizeof (ftests) / sizeof (ftests[0]))
+  for (cnt = 0; cnt < nftests; ++cnt)
+    {
+      char buf[100];
+      size_t r = strftime (buf, sizeof (buf), ftests[cnt].fmt, &ttm);
+      if (r != ftests[cnt].n)
+	{
+	  printf ("strftime(\"%s\") returned %zu not %zu\n",
+		  ftests[cnt].fmt, r, ftests[cnt].n);
+	  result = 1;
+	}
+      if (strcmp (buf, ftests[cnt].exp) != 0)
+	{
+	  printf ("strftime(\"%s\") produced \"%s\" not \"%s\"\n",
+		  ftests[cnt].fmt, buf, ftests[cnt].exp);
+	  result = 1;
+	}
+    }
+
+  return result;
+}
+
+#define TEST_FUNCTION do_test ()
+#include "../test-skeleton.c"
diff --git a/ap/build/uClibc/test/time/tst-strptime.c b/ap/build/uClibc/test/time/tst-strptime.c
new file mode 100644
index 0000000..6356aa0
--- /dev/null
+++ b/ap/build/uClibc/test/time/tst-strptime.c
@@ -0,0 +1,193 @@
+/* Test for strptime.
+   Copyright (C) 1998, 1999, 2000, 2001, 2002 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+   Contributed by Ulrich Drepper <drepper@cygnus.com>, 1998.
+
+   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 <locale.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <time.h>
+
+
+static const struct
+{
+  const char *locale;
+  const char *input;
+  const char *format;
+  int wday;
+  int yday;
+  int mon;
+  int mday;
+} day_tests[] =
+{
+  { "C", "2000-01-01", "%Y-%m-%d", 6, 0, 0, 1 },
+  { "C", "03/03/00", "%D", 5, 62, 2, 3 },
+  { "C", "9/9/99", "%x", 4, 251, 8, 9 },
+  { "C", "19990502123412", "%Y%m%d%H%M%S", 0, 121, 4, 2 },
+  { "C", "2001 20 Mon", "%Y %U %a", 1, 140, 4, 21 },
+  { "C", "2001 21 Mon", "%Y %W %a", 1, 140, 4, 21 },
+  { "ja_JP.EUC-JP", "2000-01-01 08:12:21 AM", "%Y-%m-%d %I:%M:%S %p",
+    6, 0, 0, 1 },
+  { "en_US.ISO-8859-1", "2000-01-01 08:12:21 PM", "%Y-%m-%d %I:%M:%S %p",
+    6, 0, 0, 1 },
+  { "ja_JP.EUC-JP", "2001 20 \xb7\xee", "%Y %U %a", 1, 140, 4, 21 },
+  { "ja_JP.EUC-JP", "2001 21 \xb7\xee", "%Y %W %a", 1, 140, 4, 21 },
+};
+
+
+static const struct
+{
+  const char *input;
+  const char *format;
+  const char *output;
+  int wday;
+  int yday;
+} tm_tests [] =
+{
+  {"17410105012000", "%H%M%S%d%m%Y", "2000-01-05 17:41:01", 3, 4}
+};
+
+
+
+static int
+test_tm (void)
+{
+  struct tm tm;
+  size_t i;
+  int result = 0;
+  char buf[100];
+
+  for (i = 0; i < sizeof (tm_tests) / sizeof (tm_tests[0]); ++i)
+    {
+      memset (&tm, '\0', sizeof (tm));
+
+      char *ret = strptime (tm_tests[i].input, tm_tests[i].format, &tm);
+      if (ret == NULL)
+	{
+	  printf ("strptime returned NULL for `%s'\n", tm_tests[i].input);
+	  result = 1;
+	  continue;
+	}
+      else if (*ret != '\0')
+	{
+	  printf ("not all of `%s' read\n", tm_tests[i].input);
+	  result = 1;
+	}
+      strftime (buf, sizeof (buf), "%F %T", &tm);
+      printf ("strptime (\"%s\", \"%s\", ...)\n"
+	      "\tshould be: %s, wday = %d, yday = %3d\n"
+	      "\t       is: %s, wday = %d, yday = %3d\n",
+	      tm_tests[i].input, tm_tests[i].format,
+	      tm_tests[i].output,
+	      tm_tests[i].wday, tm_tests[i].yday,
+	      buf, tm.tm_wday, tm.tm_yday);
+
+      if (strcmp (buf, tm_tests[i].output) != 0)
+	{
+	  printf ("Time and date are not correct.\n");
+	  result = 1;
+	}
+      if (tm.tm_wday != tm_tests[i].wday)
+	{
+	  printf ("weekday for `%s' incorrect: %d instead of %d\n",
+		  tm_tests[i].input, tm.tm_wday, tm_tests[i].wday);
+	  result = 1;
+	}
+      if (tm.tm_yday != tm_tests[i].yday)
+	{
+	  printf ("yearday for `%s' incorrect: %d instead of %d\n",
+		  tm_tests[i].input, tm.tm_yday, tm_tests[i].yday);
+	  result = 1;
+	}
+    }
+
+  return result;
+}
+
+
+int
+main (int argc, char *argv[])
+{
+  struct tm tm;
+  size_t i;
+  int result = 0;
+
+  for (i = 0; i < sizeof (day_tests) / sizeof (day_tests[0]); ++i)
+    {
+      memset (&tm, '\0', sizeof (tm));
+
+      if (setlocale (LC_ALL, day_tests[i].locale) == NULL)
+	{
+	  printf ("cannot set locale %s: %m\n", day_tests[i].locale);
+	  exit (EXIT_FAILURE);
+	}
+
+      char *ret = strptime (day_tests[i].input, day_tests[i].format, &tm);
+      if (ret == NULL)
+	{
+	  printf ("strptime returned NULL for `%s'\n", day_tests[i].input);
+	  result = 1;
+	  continue;
+	}
+      else if (*ret != '\0')
+	{
+	  printf ("not all of `%s' read\n", day_tests[i].input);
+	  result = 1;
+	}
+
+      printf ("strptime (\"%s\", \"%s\", ...)\n"
+	      "\tshould be: wday = %d, yday = %3d, mon = %2d, mday = %2d\n"
+	      "\t       is: wday = %d, yday = %3d, mon = %2d, mday = %2d\n",
+	      day_tests[i].input, day_tests[i].format,
+	      day_tests[i].wday, day_tests[i].yday,
+	      day_tests[i].mon, day_tests[i].mday,
+	      tm.tm_wday, tm.tm_yday, tm.tm_mon, tm.tm_mday);
+
+      if (tm.tm_wday != day_tests[i].wday)
+	{
+	  printf ("weekday for `%s' incorrect: %d instead of %d\n",
+		  day_tests[i].input, tm.tm_wday, day_tests[i].wday);
+	  result = 1;
+	}
+      if (tm.tm_yday != day_tests[i].yday)
+	{
+	  printf ("yearday for `%s' incorrect: %d instead of %d\n",
+		  day_tests[i].input, tm.tm_yday, day_tests[i].yday);
+	  result = 1;
+	}
+      if (tm.tm_mon != day_tests[i].mon)
+	{
+	  printf ("month for `%s' incorrect: %d instead of %d\n",
+		  day_tests[i].input, tm.tm_mon, day_tests[i].mon);
+	  result = 1;
+	}
+      if (tm.tm_mday != day_tests[i].mday)
+	{
+	  printf ("monthday for `%s' incorrect: %d instead of %d\n",
+		  day_tests[i].input, tm.tm_mday, day_tests[i].mday);
+	  result = 1;
+	}
+    }
+
+  setlocale (LC_ALL, "C");
+
+  result |= test_tm ();
+
+  return result;
+}
diff --git a/ap/build/uClibc/test/time/tst-strptime2.c b/ap/build/uClibc/test/time/tst-strptime2.c
new file mode 100644
index 0000000..73552bb
--- /dev/null
+++ b/ap/build/uClibc/test/time/tst-strptime2.c
@@ -0,0 +1,59 @@
+#include <limits.h>
+#include <stdio.h>
+#include <time.h>
+
+
+static const struct
+{
+  const char *fmt;
+  long int gmtoff;
+} tests[] =
+  {
+    { "1113472456 +1000", 36000 },
+    { "1113472456 -1000", -36000 },
+    { "1113472456 +10", 36000 },
+    { "1113472456 -10", -36000 },
+    { "1113472456 +1030", 37800 },
+    { "1113472456 -1030", -37800 },
+    { "1113472456 +0030", 1800 },
+    { "1113472456 -0030", -1800 },
+    { "1113472456 -1330", LONG_MAX },
+    { "1113472456 +1330", LONG_MAX },
+    { "1113472456 -1060", LONG_MAX },
+    { "1113472456 +1060", LONG_MAX },
+    { "1113472456  1030", LONG_MAX },
+  };
+#define ntests (sizeof (tests) / sizeof (tests[0]))
+
+
+int
+main (void)
+{
+  int result = 0;
+
+  for (int i = 0; i < ntests; ++i)
+    {
+      struct tm tm;
+
+      if (strptime (tests[i].fmt, "%s %z", &tm) == NULL)
+	{
+	  if (tests[i].gmtoff != LONG_MAX)
+	    {
+	      printf ("round %d: strptime unexpectedly failed\n", i);
+	      result = 1;
+	    }
+	  continue;
+	}
+
+      if (tm.tm_gmtoff != tests[i].gmtoff)
+	{
+	  printf ("round %d: tm_gmtoff is %ld\n", i, (long int) tm.tm_gmtoff);
+	  result = 1;
+	}
+    }
+
+  if (result == 0)
+    puts ("all OK");
+
+  return 0;
+}
diff --git a/ap/build/uClibc/test/time/tst-timezone.c b/ap/build/uClibc/test/time/tst-timezone.c
new file mode 100644
index 0000000..4c87916
--- /dev/null
+++ b/ap/build/uClibc/test/time/tst-timezone.c
@@ -0,0 +1,170 @@
+/* Copyright (C) 1998, 1999, 2000, 2005 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+   Contributed by Andreas Jaeger <aj@suse.de>, 1998.
+
+   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 <time.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <unistd.h>
+
+int failed = 0;
+
+struct test_times
+{
+  const char *name;
+  int daylight;
+  int timezone;
+  const char *tzname[2];
+};
+
+static const struct test_times tests[] =
+{
+  { "Europe/Amsterdam", 1, -3600, { "CET", "CEST" }},
+  { "Europe/Berlin", 1, -3600, { "CET", "CEST" }},
+  { "Europe/London", 1, 0, { "GMT", "BST" }},
+  { "Universal", 0, 0, {"UTC", "UTC" }},
+  { "Australia/Melbourne", 1, -36000, { "EST", "EST" }},
+  { "America/Sao_Paulo", 1, 10800, {"BRT", "BRST" }},
+  { "America/Chicago", 1, 21600, {"CST", "CDT" }},
+  { "America/Indiana/Indianapolis", 1, 18000, {"EST", "EDT" }},
+  { "America/Los_Angeles", 1, 28800, {"PST", "PDT" }},
+  { "Asia/Tokyo", 1, -32400, {"JST", "JDT" }},
+  { "Pacific/Auckland", 1, -43200, { "NZST", "NZDT" }},
+  { NULL, 0, 0 }
+};
+
+/* This string will be used for `putenv' calls.  */
+char envstring[100];
+
+static void
+print_tzvars (void)
+{
+  printf ("tzname[0]: %s\n", tzname[0]);
+  printf ("tzname[1]: %s\n", tzname[1]);
+  printf ("daylight: %d\n", daylight);
+  printf ("timezone: %ld\n", timezone);
+}
+
+
+static void
+check_tzvars (const char *name, int dayl, int timez, const char *const tznam[])
+{
+  int i;
+
+  if (daylight != dayl)
+    {
+      printf ("*** Timezone: %s, daylight is: %d but should be: %d\n",
+	      name, daylight, dayl);
+      ++failed;
+    }
+  if (timezone != timez)
+    {
+      printf ("*** Timezone: %s, timezone is: %ld but should be: %d\n",
+	      name, timezone, timez);
+      ++failed;
+    }
+  for (i = 0; i <= 1; ++i)
+    if (strcmp (tzname[i], tznam[i]) != 0)
+      {
+	printf ("*** Timezone: %s, tzname[%d] is: %s but should be: %s\n",
+		name, i, tzname[i], tznam[i]);
+	++failed;
+      }
+}
+
+
+int
+main (int argc, char ** argv)
+{
+  time_t t;
+  const struct test_times *pt;
+  char buf[BUFSIZ];
+
+  /* This should be: Fri May 15 01:02:16 1998 (UTC).  */
+  t = 895194136;
+  printf ("We use this date: %s\n", asctime (gmtime (&t)));
+
+  for (pt = tests; pt->name != NULL; ++pt)
+    {
+      /* Start with a known state */
+      printf ("Checking timezone %s\n", pt->name);
+      sprintf (buf, "TZ=%s", pt->name);
+      if (putenv (buf))
+	{
+	  puts ("putenv failed.");
+	  failed = 1;
+	}
+      tzset ();
+      print_tzvars ();
+      check_tzvars (pt->name, pt->daylight, pt->timezone, pt->tzname);
+
+      /* calling localtime shouldn't make a difference */
+      localtime (&t);
+      print_tzvars ();
+      check_tzvars (pt->name, pt->daylight, pt->timezone, pt->tzname);
+    }
+
+  /* From a post of Scott Harrington <seh4@ix.netcom.com> to the timezone
+     mailing list.  */
+  {
+    struct tm tmBuf = {0, 0, 0, 10, 3, 98, 0, 0, -1};
+    char buf[200];
+    strcpy (envstring, "TZ=Europe/London");
+    putenv (envstring);
+    t = mktime (&tmBuf);
+    snprintf (buf, sizeof (buf), "TZ=%s %ld %d %d %d %d %d %d %d %d %d",
+	      getenv ("TZ"), t,
+	      tmBuf.tm_sec, tmBuf.tm_min, tmBuf.tm_hour,
+	      tmBuf.tm_mday, tmBuf.tm_mon, tmBuf.tm_year,
+	      tmBuf.tm_wday, tmBuf.tm_yday, tmBuf.tm_isdst);
+    fputs (buf, stdout);
+    puts (" should be");
+    puts ("TZ=Europe/London 892162800 0 0 0 10 3 98 5 99 1");
+    if (strcmp (buf, "TZ=Europe/London 892162800 0 0 0 10 3 98 5 99 1") != 0)
+      {
+	failed = 1;
+	fputs (" FAILED ***", stdout);
+      }
+  }
+
+  printf("\n");
+
+  {
+    struct tm tmBuf = {0, 0, 0, 10, 3, 98, 0, 0, -1};
+    char buf[200];
+    strcpy (envstring, "TZ=GMT");
+    /* No putenv call needed!  */
+    t = mktime (&tmBuf);
+    snprintf (buf, sizeof (buf), "TZ=%s %ld %d %d %d %d %d %d %d %d %d",
+	      getenv ("TZ"), t,
+	      tmBuf.tm_sec, tmBuf.tm_min, tmBuf.tm_hour,
+	      tmBuf.tm_mday, tmBuf.tm_mon, tmBuf.tm_year,
+	      tmBuf.tm_wday, tmBuf.tm_yday, tmBuf.tm_isdst);
+    fputs (buf, stdout);
+    puts (" should be");
+    puts ("TZ=GMT 892166400 0 0 0 10 3 98 5 99 0");
+    if (strcmp (buf, "TZ=GMT 892166400 0 0 0 10 3 98 5 99 0") != 0)
+      {
+	failed = 1;
+	fputs (" FAILED ***", stdout);
+      }
+  }
+
+  return failed ? EXIT_FAILURE : EXIT_SUCCESS;
+}
diff --git a/ap/build/uClibc/test/time/tst_wcsftime.c b/ap/build/uClibc/test/time/tst_wcsftime.c
new file mode 100644
index 0000000..6e35f1e
--- /dev/null
+++ b/ap/build/uClibc/test/time/tst_wcsftime.c
@@ -0,0 +1,39 @@
+#include <stdio.h>
+#include <time.h>
+#include <features.h>
+#ifdef __UCLIBC_HAS_WCHAR__
+#include <wchar.h>
+
+int
+main (int argc, char *argv[])
+{
+  wchar_t buf[200];
+  time_t t;
+  struct tm *tp;
+  int result = 0;
+  size_t n;
+
+  time (&t);
+  tp = gmtime (&t);
+
+  n = wcsftime (buf, sizeof (buf) / sizeof (buf[0]),
+		L"%H:%M:%S  %Y-%m-%d\n", tp);
+  if (n != 21)
+    result = 1;
+
+  wprintf (L"It is now %ls", buf);
+
+  wcsftime (buf, sizeof (buf) / sizeof (buf[0]), L"%A\n", tp);
+
+  wprintf (L"The weekday is %ls", buf);
+
+  return result;
+}
+
+#else
+int main(void)
+{
+	puts("Test requires WCHAR support; skipping");
+	return 0;
+}
+#endif
diff --git a/ap/build/uClibc/test/tls/Makefile b/ap/build/uClibc/test/tls/Makefile
new file mode 100644
index 0000000..607fec2
--- /dev/null
+++ b/ap/build/uClibc/test/tls/Makefile
@@ -0,0 +1,8 @@
+# uClibc TLS tests
+# Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
+
+top_builddir=../../
+top_srcdir=../../
+include ../Rules.mak
+-include Makefile.in
+include ../Test.mak
diff --git a/ap/build/uClibc/test/tls/Makefile.in b/ap/build/uClibc/test/tls/Makefile.in
new file mode 100644
index 0000000..875c607
--- /dev/null
+++ b/ap/build/uClibc/test/tls/Makefile.in
@@ -0,0 +1,147 @@
+# uClibc TLS tests
+# Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
+
+TESTS := tst-tls1 tst-tls2 tst-tls3 tst-tls4 tst-tls5 tst-tls6 tst-tls7	\
+	tst-tls8 tst-tls9 tst-tls10 tst-tls11 tst-tls12 tst-tls13	\
+	tst-tls14 tst-tls15 tst-tls16 tst-tls17 tst-tls18 tst-tls-at-ctor \
+	tst-tls1-static tst-tls2-static tst-tls9-static
+TESTS_DISABLED := tst-tls1-static tst-tls2-static tst-tls9-static
+
+#all these tests require shared libraries
+ifeq ($(HAVE_SHARED),)
+TESTS_DISABLED := $(TESTS)
+endif
+
+# All these tests need tls.h, which is not installed with glibc
+GLIBC_TESTS_DISABLED := $(addsuffix _glibc,$(filter-out $(TESTS_DISABLED),$(TESTS)))
+
+
+
+PTDIR := $(top_builddir)libpthread/nptl
+SYSDEPS_DIR := $(top_srcdir)libc/sysdeps
+
+EXTRA_CFLAGS := -DNOT_IN_libc=1 \
+	-std=gnu99 -I. \
+	-I$(SYSDEPS_DIR)/linux \
+	-I$(SYSDEPS_DIR)/linux/$(TARGET_ARCH) \
+	-I$(PTDIR)	\
+	-I$(PTDIR)/sysdeps/unix/sysv/linux/$(TARGET_ARCH)	\
+	-I$(PTDIR)/sysdeps/$(TARGET_ARCH)			\
+	-I$(PTDIR)/sysdeps/unix/sysv/linux			\
+	-I$(PTDIR)/sysdeps/pthread				\
+	-I$(PTDIR)/sysdeps/pthread/bits				\
+	-I$(PTDIR)/sysdeps/generic				\
+	-I$(top_builddir)ldso/include				\
+	-I$(top_builddir)ldso/ldso/$(TARGET_ARCH)		\
+	-I$(top_builddir)include				\
+	-include $(top_builddir)include/libc-symbols.h
+
+tlsmod17a-suffixes := 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19
+tlsmod18a-suffixes := 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19
+CFLAGS_tst-tlsmod1.so := -fPIC -DSHARED -shared
+CFLAGS_tst-tlsmod2.so := -fPIC -DSHARED -shared
+CFLAGS_tst-tlsmod3.so := -fPIC -DSHARED -shared
+CFLAGS_tst-tlsmod4.so := -fPIC -DSHARED -shared
+CFLAGS_tst-tlsmod5.so := -fPIC -DSHARED -shared
+CFLAGS_tst-tlsmod6.so := -fPIC -DSHARED -shared
+CFLAGS_tst-tlsmod7.so := -fPIC -DSHARED -shared
+CFLAGS_tst-tlsmod8.so := -fPIC -DSHARED -shared
+CFLAGS_tst-tlsmod9.so := -fPIC -DSHARED -shared
+CFLAGS_tst-tlsmod10.so := -fPIC -DSHARED -shared
+CFLAGS_tst-tlsmod11.so := -fPIC -DSHARED -shared
+CFLAGS_tst-tlsmod12.so := -fPIC -DSHARED -shared
+CFLAGS_tst-tlsmod13.so := -fPIC -DSHARED -shared
+CFLAGS_tst-tlsmod13a.so := -fPIC -DSHARED -shared
+CFLAGS_tst-tlsmod14a.so := -fPIC -DSHARED -shared
+CFLAGS_tst-tlsmod14b.so := -fPIC -DSHARED -shared
+CFLAGS_tst-tlsmod15a.so := -fPIC -DSHARED -shared
+CFLAGS_tst-tlsmod15b.so := -fPIC -DSHARED -shared
+CFLAGS_tst-tlsmod16a.so := -fPIC -DSHARED -shared
+CFLAGS_tst-tlsmod16b.so := -fPIC -DSHARED -shared
+CFLAGS_tst-tlsmod17a.so := -fPIC -DSHARED -shared
+CFLAGS_tst-tlsmod17b.so := -fPIC -DSHARED -shared
+CFLAGS_tst-tlsmod18a.so := -fPIC -DSHARED -shared
+CFLAGS_tst-tlsmod-at-ctor.so := -fPIC -DSHARED -shared
+
+LDFLAGS_tst-tlsmod1.so := -shared -static-libgcc -L$(top_builddir)lib
+LDFLAGS_tst-tlsmod2.so := -shared -static-libgcc -L$(top_builddir)lib
+LDFLAGS_tst-tlsmod3.so := -shared -static-libgcc -L$(top_builddir)lib	\
+	tst-tlsmod2.so
+LDFLAGS_tst-tlsmod4.so := -shared -static-libgcc -L$(top_builddir)lib
+LDFLAGS_tst-tlsmod5.so := -shared -static-libgcc -L$(top_builddir)lib
+LDFLAGS_tst-tlsmod6.so := -shared -static-libgcc -L$(top_builddir)lib
+LDFLAGS_tst-tlsmod7.so := -shared -static-libgcc -L$(top_builddir)lib
+LDFLAGS_tst-tlsmod8.so := -shared -static-libgcc -L$(top_builddir)lib	\
+	tst-tlsmod7.so
+LDFLAGS_tst-tlsmod9.so := -shared -static-libgcc -L$(top_builddir)lib	\
+	tst-tlsmod8.so
+LDFLAGS_tst-tlsmod10.so := -shared -static-libgcc -L$(top_builddir)lib	\
+	tst-tlsmod9.so
+LDFLAGS_tst-tlsmod11.so := -shared -static-libgcc -L$(top_builddir)lib
+LDFLAGS_tst-tlsmod12.so := -shared -static-libgcc -L$(top_builddir)lib	\
+	tst-tlsmod11.so
+LDFLAGS_tst-tlsmod13.so := -shared -static-libgcc -L$(top_builddir)lib
+LDFLAGS_tst-tlsmod13a.so := -shared -static-libgcc -L$(top_builddir)lib	\
+	tst-tlsmod13.so
+LDFLAGS_tst-tlsmod14a.so := -shared -static-libgcc -L$(top_builddir)lib
+LDFLAGS_tst-tlsmod14b.so := -shared -static-libgcc -L$(top_builddir)lib
+LDFLAGS_tst-tlsmod15a.so := -shared -static-libgcc -L$(top_builddir)lib
+LDFLAGS_tst-tlsmod15b.so := -shared -static-libgcc -L$(top_builddir)lib
+LDFLAGS_tst-tlsmod16a.so := -shared -static-libgcc -L$(top_builddir)lib
+LDFLAGS_tst-tlsmod16b.so := -shared -static-libgcc -L$(top_builddir)lib
+LDFLAGS_tst-tlsmod17a.so := -shared -static-libgcc -L$(top_builddir)lib
+LDFLAGS_tst-tlsmod17b.so := -shared -static-libgcc -L$(top_builddir)lib \
+	$(patsubst %,tst-tlsmod17a%.so,$(tlsmod17a-suffixes))
+LDFLAGS_tst-tlsmod18a.so := -shared -static-libgcc -L$(top_builddir)lib
+LDFLAGS_tst-tlsmod-at-ctor.so := -shared -static-libgcc -L$(top_builddir)lib
+
+LDFLAGS_tst-tls3 := tst-tlsmod1.so tst-tlsmod4.so
+LDFLAGS_tst-tls4 := -ldl
+LDFLAGS_tst-tls5 := -ldl
+LDFLAGS_tst-tls6 := -ldl
+LDFLAGS_tst-tls7 := -ldl
+LDFLAGS_tst-tls8 := -ldl
+LDFLAGS_tst-tls9 := -ldl
+LDFLAGS_tst-tls10 := -Wl,-rpath-link=. tst-tlsmod8.so
+LDFLAGS_tst-tls11 := -Wl,-rpath-link=. tst-tlsmod10.so
+LDFLAGS_tst-tls12 := -Wl,-rpath-link=. tst-tlsmod12.so
+LDFLAGS_tst-tls13 := -ldl -Wl,-rpath-link=.
+LDFLAGS_tst-tls14 := -ldl -Wl,-rpath-link=. tst-tlsmod14a.so
+LDFLAGS_tst-tls15 := -ldl -Wl,-rpath-link=.
+LDFLAGS_tst-tls16 := -ldl -Wl,-rpath-link=.
+LDFLAGS_tst-tls17 := -ldl -Wl,-rpath-link=.
+LDFLAGS_tst-tls18 := -ldl -Wl,-rpath-link=.
+LDFLAGS_tst-tls-at-ctor := tst-tlsmod-at-ctor.so
+
+tst-tls3: tst-tlsmod1.so tst-tlsmod4.so
+tst-tls4: tst-tlsmod2.so
+tst-tls5: tst-tlsmod2.so
+tst-tls6: tst-tlsmod2.so
+tst-tls7: tst-tlsmod2.so tst-tlsmod3.so
+tst-tls8: tst-tlsmod2.so tst-tlsmod3.so tst-tlsmod4.so
+tst-tls9: tst-tlsmod5.so tst-tlsmod6.so
+tst-tls10: tst-tlsmod7.so tst-tlsmod8.so
+tst-tls11: tst-tlsmod9.so tst-tlsmod10.so
+tst-tls12: tst-tlsmod11.so tst-tlsmod12.so
+tst-tls13: tst-tlsmod13.so tst-tlsmod13a.so
+tst-tls14: tst-tlsmod14a.so tst-tlsmod14b.so
+tst-tls15: tst-tlsmod15b.so
+tst-tls16: tst-tlsmod16a.so tst-tlsmod16b.so
+tst-tls17: tst-tlsmod17b.so
+tst-tlsmod17b.so: $(patsubst %,tst-tlsmod17a%.so,$(tlsmod17a-suffixes))
+tst-tlsmod17a%.so: tst-tlsmod17a.c
+	$(Q)$(CC) $(CFLAGS) $(EXTRA_CFLAGS) $(CFLAGS_tst-tlsmod17a.so) $< -o $@ \
+	-DN=$* -Wl,-soname,$@ $(LDFLAGS) $(EXTRA_LIBS) \
+	$(LDFLAGS_tst-tlsmod17a.so)
+tst-tls18: $(patsubst %,tst-tlsmod18a%.so,$(tlsmod18a-suffixes))
+tst-tlsmod18a%.so: tst-tlsmod18a.c
+	$(Q)$(CC) $(CFLAGS) $(EXTRA_CFLAGS) $(CFLAGS_tst-tlsmod18a.so) $< -o $@ \
+	-DN=$* -Wl,-soname,$@ $(LDFLAGS) $(EXTRA_LIBS) \
+	$(LDFLAGS_tst-tlsmod18a.so)
+tst-tls-at-ctor: tst-tlsmod-at-ctor.so
+
+ifeq ($(TARGET_ARCH),mips)
+RET_tst-tls15 := 1
+endif
+
+WRAPPER := env LD_LIBRARY_PATH="$$PWD:.:$(LD_LIBRARY_PATH)"
diff --git a/ap/build/uClibc/test/tls/README b/ap/build/uClibc/test/tls/README
new file mode 100644
index 0000000..06c9eb7
--- /dev/null
+++ b/ap/build/uClibc/test/tls/README
@@ -0,0 +1,8 @@
+These tests were imported from 'glibc/elf' and are responsible for testing
+the TLS functionality of the dynamic loader. The file 'tls-macros-mips.h'
+is a copy of 'glibc/sysdeps/mips/tls-macros.h'. Dependency and link orders
+are critical and should NOT be changed. Even if you think you know what
+you are doing, do not touch the Makefile without posting to the uClibc
+development mailing list.
+
+-Steve <sjhill@uclibc.org>
diff --git a/ap/build/uClibc/test/tls/tls-macros-arm.h b/ap/build/uClibc/test/tls/tls-macros-arm.h
new file mode 100644
index 0000000..13d0f97
--- /dev/null
+++ b/ap/build/uClibc/test/tls/tls-macros-arm.h
@@ -0,0 +1,51 @@
+#define TLS_LE(x)					\
+  ({ int *__result;					\
+     void *tp = __builtin_thread_pointer ();		\
+     __asm__ ("ldr %0, 1f; "				\
+	  "add %0, %1, %0; "				\
+	  "b 2f; "					\
+	  "1: .word " #x "(tpoff); "			\
+	  "2: "						\
+	  : "=&r" (__result) : "r" (tp));		\
+     __result; })
+
+#define TLS_IE(x)					\
+  ({ int *__result;					\
+     void *tp = __builtin_thread_pointer ();		\
+     __asm__ ("ldr %0, 1f; "				\
+	  "3: ldr %0, [pc, %0];"			\
+	  "add %0, %1, %0; "				\
+	  "b 2f; "					\
+	  "1: .word " #x "(gottpoff) + (. - 3b - 8); "	\
+	  "2: "						\
+	  : "=&r" (__result) : "r" (tp));		\
+     __result; })
+
+#define TLS_LD(x)					\
+  ({ char *__result;					\
+     int __offset;					\
+     extern void *__tls_get_addr (void *);		\
+     __asm__ ("ldr %0, 2f; "				\
+	  "1: add %0, pc, %0; "				\
+	  "b 3f; "					\
+	  "2: .word " #x "(tlsldm) + (. - 1b - 8); "	\
+	  "3: "						\
+	  : "=r" (__result));				\
+     __result = (char *)__tls_get_addr (__result);	\
+     __asm__ ("ldr %0, 1f; "				\
+	  "b 2f; "					\
+	  "1: .word " #x "(tlsldo); "			\
+	  "2: "						\
+	  : "=r" (__offset));				\
+     (int *) (__result + __offset); })
+
+#define TLS_GD(x)					\
+  ({ int *__result;					\
+     extern void *__tls_get_addr (void *);		\
+     __asm__ ("ldr %0, 2f; "				\
+	  "1: add %0, pc, %0; "				\
+	  "b 3f; "					\
+	  "2: .word " #x "(tlsgd) + (. - 1b - 8); "	\
+	  "3: "						\
+	  : "=r" (__result));				\
+     (int *)__tls_get_addr (__result); })
diff --git a/ap/build/uClibc/test/tls/tls-macros-mips.h b/ap/build/uClibc/test/tls/tls-macros-mips.h
new file mode 100644
index 0000000..0db3830
--- /dev/null
+++ b/ap/build/uClibc/test/tls/tls-macros-mips.h
@@ -0,0 +1,88 @@
+/* Macros to support TLS testing in times of missing compiler support.  */
+
+#if _MIPS_SIM != _ABI64
+
+/* These versions are for o32 and n32.  */
+
+# define TLS_GD(x)					\
+  ({ void *__result;					\
+     extern void *__tls_get_addr (void *);		\
+     __asm__ ("addiu %0, $28, %%tlsgd(" #x ")"		\
+	  : "=r" (__result));				\
+     (int *)__tls_get_addr (__result); })
+#else
+# define TLS_GD(x)					\
+  ({ void *__result;					\
+     extern void *__tls_get_addr (void *);		\
+     __asm__ ("daddiu %0, $28, %%tlsgd(" #x ")"		\
+	  : "=r" (__result));				\
+     (int *)__tls_get_addr (__result); })
+#endif
+
+#if _MIPS_SIM != _ABI64
+# define TLS_LD(x)					\
+  ({ void *__result;					\
+     extern void *__tls_get_addr (void *);		\
+     __asm__ ("addiu %0, $28, %%tlsldm(" #x ")"		\
+	  : "=r" (__result));				\
+     __result = __tls_get_addr (__result);		\
+     __asm__ ("lui $3,%%dtprel_hi(" #x ")\n\t"		\
+	  "addiu $3,$3,%%dtprel_lo(" #x ")\n\t"		\
+	  "addu %0,%0,$3"				\
+	  : "+r" (__result) : : "$3");			\
+     __result; })
+# define TLS_IE(x)					\
+  ({ void *__result;					\
+     __asm__ (".set push\n\t.set mips32r2\n\t"		\
+	  "rdhwr\t%0,$29\n\t.set pop"			\
+	  : "=v" (__result));				\
+     __asm__ ("lw $3,%%gottprel(" #x ")($28)\n\t"		\
+	  "addu %0,%0,$3"				\
+	  : "+r" (__result) : : "$3");			\
+     __result; })
+# define TLS_LE(x)					\
+  ({ void *__result;					\
+     __asm__ (".set push\n\t.set mips32r2\n\t"		\
+	  "rdhwr\t%0,$29\n\t.set pop"			\
+	  : "=v" (__result));				\
+     __asm__ ("lui $3,%%tprel_hi(" #x ")\n\t"		\
+	  "addiu $3,$3,%%tprel_lo(" #x ")\n\t"		\
+	  "addu %0,%0,$3"				\
+	  : "+r" (__result) : : "$3");			\
+     __result; })
+
+#else
+
+/* These versions are for n64.  */
+
+# define TLS_LD(x)					\
+  ({ void *__result;					\
+     extern void *__tls_get_addr (void *);		\
+     __asm__ ("daddiu %0, $28, %%tlsldm(" #x ")"		\
+	  : "=r" (__result));				\
+     __result = __tls_get_addr (__result);		\
+     __asm__ ("lui $3,%%dtprel_hi(" #x ")\n\t"		\
+	  "daddiu $3,$3,%%dtprel_lo(" #x ")\n\t"	\
+	  "daddu %0,%0,$3"				\
+	  : "+r" (__result) : : "$3");			\
+     __result; })
+# define TLS_IE(x)					\
+  ({ void *__result;					\
+     __asm__ (".set push\n\t.set mips32r2\n\t"		\
+	  "rdhwr\t%0,$29\n\t.set pop"			\
+	  : "=v" (__result));				\
+     __asm__ ("ld $3,%%gottprel(" #x ")($28)\n\t"		\
+	  "daddu %0,%0,$3"				\
+	  : "+r" (__result) : : "$3");			\
+     __result; })
+# define TLS_LE(x)					\
+  ({ void *__result;					\
+     __asm__ (".set push\n\t.set mips32r2\n\t"		\
+	  "rdhwr\t%0,$29\n\t.set pop"			\
+	  : "=v" (__result));				\
+     __asm__ ("lui $3,%%tprel_hi(" #x ")\n\t"		\
+	  "daddiu $3,$3,%%tprel_lo(" #x ")\n\t"		\
+	  "daddu %0,%0,$3"				\
+	  : "+r" (__result) : : "$3");			\
+     __result; })
+#endif
diff --git a/ap/build/uClibc/test/tls/tls-macros-thumb.h b/ap/build/uClibc/test/tls/tls-macros-thumb.h
new file mode 100644
index 0000000..dfa6582
--- /dev/null
+++ b/ap/build/uClibc/test/tls/tls-macros-thumb.h
@@ -0,0 +1,57 @@
+#define TLS_LE(x)					\
+  ({ int *__result;					\
+     void *tp = __builtin_thread_pointer ();		\
+     __asm__ ("ldr %0, 1f; "				\
+	  "add %0, %1, %0; "				\
+	  "b 2f; "					\
+	  ".align 2; "					\
+	  "1: .word " #x "(tpoff); "			\
+	  "2: "						\
+	  : "=&r" (__result) : "r" (tp));		\
+     __result; })
+
+#define TLS_IE(x)					\
+  ({ int *__result;					\
+     int tmp;						\
+     void *tp = __builtin_thread_pointer ();		\
+     __asm__ ("ldr %0, 1f; "				\
+	  "adr %1, 1f; "				\
+	  "ldr %0, [%1, %0]; "				\
+	  "add %0, %2, %0; "				\
+	  "b 2f; "					\
+	  ".align 2; "					\
+	  "1: .word " #x "(gottpoff); "			\
+	  "2: "						\
+	  : "=&r" (__result), "=&r"(tmp) : "r" (tp));	\
+     __result; })
+
+#define TLS_LD(x)					\
+  ({ char *__result;					\
+     int __offset;					\
+     extern void *__tls_get_addr (void *);		\
+     __asm__ ("ldr %0, 2f; "				\
+	  ".align 2; "					\
+	  "1: add %0, pc, %0; "				\
+	  "b 3f; "					\
+	  "2: .word " #x "(tlsldm) + (. - 1b - 4); "	\
+	  "3: "						\
+	  : "=r" (__result));				\
+     __result = (char *)__tls_get_addr (__result);	\
+     __asm__ ("ldr %0, 1f; "				\
+	  "b 2f; "					\
+	  "1: .word " #x "(tlsldo); "			\
+	  "2: "						\
+	  : "=r" (__offset));				\
+     (int *) (__result + __offset); })
+
+#define TLS_GD(x)					\
+  ({ int *__result;					\
+     extern void *__tls_get_addr (void *);		\
+     __asm__ ("ldr %0, 2f; "				\
+	  ".align 2; "					\
+	  "1: add %0, pc, %0; "				\
+	  "b 3f; "					\
+	  "2: .word " #x "(tlsgd) + (. - 1b - 4); "	\
+	  "3: "						\
+	  : "=r" (__result));				\
+     (int *)__tls_get_addr (__result); })
diff --git a/ap/build/uClibc/test/tls/tls-macros.h b/ap/build/uClibc/test/tls/tls-macros.h
new file mode 100644
index 0000000..3a9a21a
--- /dev/null
+++ b/ap/build/uClibc/test/tls/tls-macros.h
@@ -0,0 +1,861 @@
+/* Macros to support TLS testing in times of missing compiler support.  */
+
+#define COMMON_INT_DEF(x) \
+  __asm__ (".tls_common " #x ",4,4")
+/* XXX Until we get compiler support we don't need declarations.  */
+#define COMMON_INT_DECL(x)
+
+/* XXX This definition will probably be machine specific, too.  */
+#define VAR_INT_DEF(x) \
+  __asm__ (".section .tdata\n\t"						      \
+       ".globl " #x "\n"						      \
+       ".balign 4\n"							      \
+       #x ":\t.long 0\n\t"						      \
+       ".size " #x ",4\n\t"						      \
+       ".previous")
+/* XXX Until we get compiler support we don't need declarations.  */
+#define VAR_INT_DECL(x)
+
+#ifdef __mips__
+#include <tls-macros-mips.h>
+#endif
+
+#ifdef __arm__
+#ifdef __thumb__
+#include <tls-macros-thumb.h>
+#else
+#include <tls-macros-arm.h>
+#endif
+#endif
+
+  /* XXX Each architecture must have its own asm for now.  */
+#ifdef __i386__
+# define TLS_LE(x) \
+  ({ int *__l;								      \
+     __asm__ ("movl %%gs:0,%0\n\t"						      \
+	  "subl $" #x "@tpoff,%0"					      \
+	  : "=r" (__l));						      \
+     __l; })
+
+# ifdef __PIC__
+#  define TLS_IE(x) \
+  ({ int *__l;								      \
+     __asm__ ("movl %%gs:0,%0\n\t"						      \
+	  "subl " #x "@gottpoff(%%ebx),%0"				      \
+	  : "=r" (__l));						      \
+     __l; })
+# else
+#  define TLS_IE(x) \
+  ({ int *__l;                                                               \
+     __asm__ ("call 1f\n\t"							      \
+	  ".subsection 1\n"						      \
+	  "1:\tmovl (%%esp), %%ebx\n\t"					      \
+	  "ret\n\t"							      \
+	  ".previous\n\t"						      \
+	  "addl $_GLOBAL_OFFSET_TABLE_, %%ebx\n\t"			      \
+	  "movl %%gs:0,%0\n\t"						      \
+	  "subl " #x "@gottpoff(%%ebx),%0"				      \
+	  : "=r" (__l));					              \
+     __l; })
+# endif
+
+# ifdef __PIC__
+#  define TLS_LD(x) \
+  ({ int *__l, __c, __d;						      \
+     __asm__ ("leal " #x "@tlsldm(%%ebx),%%eax\n\t"				      \
+	  "call ___tls_get_addr@plt\n\t"				      \
+	  "leal " #x "@dtpoff(%%eax), %%eax"				      \
+	  : "=a" (__l), "=&c" (__c), "=&d" (__d));			      \
+     __l; })
+# else
+#  define TLS_LD(x) \
+  ({ int *__l, __b, __c, __d;						      \
+     __asm__ ("call 1f\n\t"							      \
+	  ".subsection 1\n"						      \
+	  "1:\tmovl (%%esp), %%ebx\n\t"					      \
+	  "ret\n\t"							      \
+	  ".previous\n\t"						      \
+	  "addl $_GLOBAL_OFFSET_TABLE_, %%ebx\n\t"			      \
+	  "leal " #x "@tlsldm(%%ebx),%%eax\n\t"				      \
+	  "call ___tls_get_addr@plt\n\t"				      \
+	  "leal " #x "@dtpoff(%%eax), %%eax"				      \
+	  : "=a" (__l), "=&b" (__b), "=&c" (__c), "=&d" (__d));		      \
+     __l; })
+# endif
+
+# ifdef __PIC__
+#  define TLS_GD(x) \
+  ({ int *__l, __c, __d;						      \
+     __asm__ ("leal " #x "@tlsgd(%%ebx),%%eax\n\t"				      \
+	  "call ___tls_get_addr@plt\n\t"				      \
+	  "nop"								      \
+	  : "=a" (__l), "=&c" (__c), "=&d" (__d));			      \
+     __l; })
+# else
+#  define TLS_GD(x) \
+  ({ int *__l, __c, __d;						      \
+     __asm__ ("call 1f\n\t"							      \
+	  ".subsection 1\n"						      \
+	  "1:\tmovl (%%esp), %%ebx\n\t"					      \
+	  "ret\n\t"							      \
+	  ".previous\n\t"						      \
+	  "addl $_GLOBAL_OFFSET_TABLE_, %%ebx\n\t"			      \
+	  "leal " #x "@tlsgd(%%ebx),%%eax\n\t"				      \
+	  "call ___tls_get_addr@plt\n\t"				      \
+	  "nop"								      \
+	  : "=a" (__l), "=&c" (__c), "=&d" (__d));		              \
+     __l; })
+# endif
+
+#elif defined __x86_64__
+
+# define TLS_LE(x) \
+  ({ int *__l;								      \
+     __asm__ ("movq %%fs:0,%0\n\t"						      \
+	  "leaq " #x "@tpoff(%0), %0"					      \
+	  : "=r" (__l));						      \
+     __l; })
+
+# define TLS_IE(x) \
+  ({ int *__l;								      \
+     __asm__ ("movq %%fs:0,%0\n\t"						      \
+	  "addq " #x "@gottpoff(%%rip),%0"				      \
+	  : "=r" (__l));						      \
+     __l; })
+
+# define TLS_LD(x) \
+  ({ int *__l, __c, __d;						      \
+     __asm__ ("leaq " #x "@tlsld(%%rip),%%rdi\n\t"				      \
+	  "call __tls_get_addr@plt\n\t"					      \
+	  "leaq " #x "@dtpoff(%%rax), %%rax"				      \
+	  : "=a" (__l), "=&c" (__c), "=&d" (__d)			      \
+	  : : "rdi", "rsi", "r8", "r9", "r10", "r11"); 			      \
+     __l; })
+
+# define TLS_GD(x) \
+  ({ int *__l, __c, __d;						      \
+     __asm__ (".byte 0x66\n\t"						      \
+	  "leaq " #x "@tlsgd(%%rip),%%rdi\n\t"				      \
+	  ".word 0x6666\n\t"						      \
+	  "rex64\n\t"							      \
+	  "call __tls_get_addr@plt"					      \
+	  : "=a" (__l), "=&c" (__c), "=&d" (__d)			      \
+	  : : "rdi", "rsi", "r8", "r9", "r10", "r11"); 			      \
+     __l; })
+
+#elif defined __sh__
+
+# define TLS_LE(x) \
+  ({ int *__l; void *__tp;						      \
+     __asm__ ("stc gbr,%1\n\t"						      \
+	  "mov.l 1f,%0\n\t"						      \
+	  "bra 2f\n\t"							      \
+	  " add %1,%0\n\t"						      \
+	  ".align 2\n\t"						      \
+	  "1: .long " #x "@tpoff\n\t"					      \
+	  "2:"								      \
+	  : "=r" (__l), "=r" (__tp));					      \
+     __l; })
+
+# ifdef __PIC__
+#  define TLS_IE(x) \
+  ({ int *__l; void *__tp;						      \
+     register void *__gp __asm__("r12");				      \
+     __asm__ ("mov.l 1f,r0\n\t"						      \
+	  "stc gbr,%1\n\t"						      \
+	  "mov.l @(r0,r12),%0\n\t"					      \
+	  "bra 2f\n\t"							      \
+	  " add %1,%0\n\t"						      \
+	  ".align 2\n\t"						      \
+	  "1: .long " #x "@gottpoff\n\t"				      \
+	  "2:"								      \
+	  : "=r" (__l), "=r" (__tp) : "r" (__gp) : "r0");		      \
+     __l; })
+# else
+#  define TLS_IE(x) \
+  ({ int *__l; void *__tp;						      \
+     __asm__ ("mov.l r12,@-r15\n\t"						      \
+	  "mova 0f,r0\n\t"						      \
+	  "mov.l 0f,r12\n\t"						      \
+	  "add r0,r12\n\t"						      \
+	  "mov.l 1f,r0\n\t"						      \
+	  "stc gbr,%1\n\t"						      \
+	  "mov.l @(r0,r12),%0\n\t"					      \
+	  "bra 2f\n\t"							      \
+	  " add %1,%0\n\t"						      \
+	  ".align 2\n\t"						      \
+	  "1: .long " #x "@gottpoff\n\t"				      \
+	  "0: .long _GLOBAL_OFFSET_TABLE_\n\t"				      \
+	  "2: mov.l @r15+,r12"						      \
+	  : "=r" (__l), "=r" (__tp) : : "r0");				      \
+     __l; })
+#endif
+
+# ifdef __PIC__
+#  define TLS_LD(x) \
+  ({ int *__l;								      \
+     register void *__gp __asm__("r12");				      \
+     __asm__ ("mov.l 1f,r4\n\t"						      \
+	  "mova 2f,r0\n\t"						      \
+	  "mov.l 2f,r1\n\t"						      \
+	  "add r0,r1\n\t"						      \
+	  "jsr @r1\n\t"							      \
+	  " add r12,r4\n\t"						      \
+	  "bra 4f\n\t"							      \
+	  " nop\n\t"							      \
+	  ".align 2\n\t"						      \
+	  "1: .long " #x "@tlsldm\n\t"					      \
+	  "2: .long __tls_get_addr@plt\n\t"				      \
+	  "4: mov.l 3f,%0\n\t"						      \
+	  "bra 5f\n\t"							      \
+	  " add r0,%0\n\t"						      \
+	  ".align 2\n\t"						      \
+	  "3: .long " #x "@dtpoff\n\t"					      \
+	  "5:"								      \
+	  : "=r" (__l) : "r" (__gp) : "r0", "r1", "r2", "r3", "r4", "r5",     \
+				      "r6", "r7", "pr", "t");		      \
+     __l; })
+# else
+#  define TLS_LD(x) \
+  ({ int *__l;								      \
+     __asm__ ("mov.l r12,@-r15\n\t"						      \
+	  "mova 0f,r0\n\t"						      \
+	  "mov.l 0f,r12\n\t"						      \
+	  "add r0,r12\n\t"						      \
+	  "mov.l 1f,r4\n\t"						      \
+	  "mova 2f,r0\n\t"						      \
+	  "mov.l 2f,r1\n\t"						      \
+	  "add r0,r1\n\t"						      \
+	  "jsr @r1\n\t"							      \
+	  " add r12,r4\n\t"						      \
+	  "bra 4f\n\t"							      \
+	  " nop\n\t"							      \
+	  ".align 2\n\t"						      \
+	  "1: .long " #x "@tlsldm\n\t"					      \
+	  "2: .long __tls_get_addr@plt\n\t"				      \
+	  "0: .long _GLOBAL_OFFSET_TABLE_\n\t"				      \
+	  "4: mov.l 3f,%0\n\t"						      \
+	  "bra 5f\n\t"							      \
+	  " add r0,%0\n\t"						      \
+	  ".align 2\n\t"						      \
+	  "3: .long " #x "@dtpoff\n\t"					      \
+	  "5: mov.l @r15+,r12"						      \
+	  : "=r" (__l) : : "r0", "r1", "r2", "r3", "r4", "r5", "r6", "r7",    \
+			   "pr", "t");					      \
+     __l; })
+#endif
+
+# ifdef __PIC__
+#  define TLS_GD(x) \
+  ({ int *__l;								      \
+     register void *__gp __asm__("r12");				      \
+     __asm__ ("mov.l 1f,r4\n\t"						      \
+	  "mova 2f,r0\n\t"						      \
+	  "mov.l 2f,r1\n\t"						      \
+	  "add r0,r1\n\t"						      \
+	  "jsr @r1\n\t"							      \
+	  " add r12,r4\n\t"						      \
+	  "bra 3f\n\t"							      \
+	  " mov r0,%0\n\t"						      \
+	  ".align 2\n\t"						      \
+	  "1: .long " #x "@tlsgd\n\t"					      \
+	  "2: .long __tls_get_addr@plt\n\t"				      \
+	  "3:"								      \
+	  : "=r" (__l) : "r" (__gp) : "r0", "r1", "r2", "r3", "r4", "r5",     \
+				      "r6", "r7", "pr", "t");		      \
+     __l; })
+# else
+#  define TLS_GD(x) \
+  ({ int *__l;								      \
+     __asm__ ("mov.l r12,@-r15\n\t"						      \
+	  "mova 0f,r0\n\t"						      \
+	  "mov.l 0f,r12\n\t"						      \
+	  "add r0,r12\n\t"						      \
+	  "mov.l 1f,r4\n\t"						      \
+	  "mova 2f,r0\n\t"						      \
+	  "mov.l 2f,r1\n\t"						      \
+	  "add r0,r1\n\t"						      \
+	  "jsr @r1\n\t"							      \
+	  " add r12,r4\n\t"						      \
+	  "bra 3f\n\t"							      \
+	  " mov r0,%0\n\t"						      \
+	  ".align 2\n\t"						      \
+	  "1: .long " #x "@tlsgd\n\t"					      \
+	  "2: .long __tls_get_addr@plt\n\t"				      \
+	  "0: .long _GLOBAL_OFFSET_TABLE_\n\t"				      \
+	  "3: mov.l @r15+,r12"						      \
+	  : "=r" (__l) : : "r0", "r1", "r2", "r3", "r4", "r5", "r6", "r7",    \
+			   "pr", "t");					      \
+     __l; })
+#endif
+
+#elif defined __alpha__
+
+register void *__gp __asm__("$29");
+
+# define TLS_LE(x) \
+  ({ int *__l;								      \
+     __asm__ ("call_pal 158\n\tlda $0," #x "($0)\t\t!tprel" : "=v"(__l));	      \
+     __l; })
+
+# define TLS_IE(x) \
+  ({ char *__tp; unsigned long __o;					      \
+     __asm__ ("call_pal 158\n\tldq %1," #x "($gp)\t\t!gottprel"		      \
+	  : "=v"(__tp), "=r"(__o) : "r"(__gp));				      \
+     (int *)(__tp + __o); })
+
+# define TLS_LD(x) \
+  ({ extern void *__tls_get_addr(void *); int *__l; void *__i;		      \
+     __asm__ ("lda %0," #x "($gp)\t\t!tlsldm" : "=r" (__i) : "r"(__gp));	      \
+     __i = __tls_get_addr(__i);						      \
+     __asm__ ("lda %0, " #x "(%1)\t\t!dtprel" : "=r"(__l) : "r"(__i));	      \
+     __l; })
+
+# define TLS_GD(x) \
+  ({ extern void *__tls_get_addr(void *); void *__i;			      \
+     __asm__ ("lda %0," #x "($gp)\t\t!tlsgd" : "=r" (__i) : "r"(__gp));	      \
+     (int *) __tls_get_addr(__i); })
+
+
+#elif defined __ia64__
+
+# define TLS_LE(x) \
+  ({ void *__l;								      \
+     __asm__ ("mov r2=r13\n\t"						      \
+         ";;\n\t"							      \
+         "addl %0=@tprel(" #x "),r2\n\t"				      \
+         : "=r" (__l) : : "r2"  ); __l; })
+
+# define TLS_IE(x) \
+  ({ void *__l;								      \
+     register long __gp __asm__ ("gp");					      \
+     __asm__ (";;\n\t"							      \
+	 "addl r16=@ltoff(@tprel(" #x ")),gp\n\t"			      \
+         ";;\n\t"							      \
+         "ld8 r17=[r16]\n\t"						      \
+         ";;\n\t"							      \
+         "add %0=r13,r17\n\t"						      \
+         ";;\n\t"							      \
+         : "=r" (__l) : "r" (__gp) : "r16", "r17" ); __l; })
+
+# define __TLS_CALL_CLOBBERS \
+  "r2", "r3", "r8", "r9", "r10", "r11", "r14", "r15", "r16", "r17",	      \
+  "r18", "r19", "r20", "r21", "r22", "r23", "r24", "r25", "r26",	      \
+  "r27", "r28", "r29", "r30", "r31",					      \
+  "p6", "p7", "p8", "p9", "p10", "p11", "p12", "p13", "p14", "p15",	      \
+  "f6", "f7", "f8", "f9", "f10", "f11", "f12", "f13", "f14", "f15",	      \
+  "b6", "b7",								      \
+  "out0", "out1", "out2", "out3", "out4", "out5", "out6", "out7"
+
+# define TLS_LD(x) \
+  ({ void *__l;								      \
+     register long __gp __asm__ ("gp");					      \
+     __asm__ (";;\n\t"							      \
+	 "mov loc0=gp\n\t"						      \
+         "addl r16=@ltoff(@dtpmod(" #x ")),gp\n\t"			      \
+         "addl out1=@dtprel(" #x "),r0\n\t"				      \
+         ";;\n\t"							      \
+         "ld8 out0=[r16]\n\t"						      \
+         "br.call.sptk.many b0=__tls_get_addr"				      \
+         ";;\n\t"							      \
+         "mov gp=loc0\n\t"						      \
+         "mov %0=r8\n\t"						      \
+         ";;\n\t"							      \
+         : "=r" (__l) : "r" (__gp) : "loc0", __TLS_CALL_CLOBBERS);	      \
+     __l; })
+
+# define TLS_GD(x) \
+  ({ void *__l;								      \
+     register long __gp __asm__ ("gp");					      \
+     __asm__ (";;\n\t"							      \
+	 "mov loc0=gp\n\t"						      \
+         "addl r16=@ltoff(@dtpmod(" #x ")),gp\n\t"			      \
+         "addl r17=@ltoff(@dtprel(" #x ")),gp\n\t"			      \
+         ";;\n\t"							      \
+         "ld8 out0=[r16]\n\t"						      \
+         "ld8 out1=[r17]\n\t"						      \
+         "br.call.sptk.many b0=__tls_get_addr"				      \
+         ";;\n\t"							      \
+         "mov gp=loc0\n\t"						      \
+         "mov %0=r8\n\t"						      \
+         ";;\n\t"							      \
+          : "=r" (__l) : "r" (__gp) : "loc0", __TLS_CALL_CLOBBERS);	      \
+     __l; })
+
+#elif defined __sparc__ && !defined __arch64__
+
+# define TLS_LE(x) \
+  ({ int *__l;								      \
+     __asm__ ("sethi %%tle_hix22(" #x "), %0" : "=r" (__l));		      \
+     __asm__ ("xor %1, %%tle_lox10(" #x "), %0" : "=r" (__l) : "r" (__l));	      \
+     __asm__ ("add %%g7, %1, %0" : "=r" (__l) : "r" (__l));			      \
+     __l; })
+
+# ifdef __PIC__
+#  define TLS_LOAD_PIC \
+  ({ register long pc __asm__ ("%o7");					      \
+     long got;								      \
+     __asm__ ("sethi %%hi(_GLOBAL_OFFSET_TABLE_-4), %1\n\t"			      \
+	  "call .+8\n\t"						      \
+	  "add %1, %%lo(_GLOBAL_OFFSET_TABLE_+4), %1\n\t"		      \
+	  "add %1, %0, %1\n\t"						      \
+	  : "=r" (pc), "=r" (got));					      \
+     got; })
+# else
+#  define TLS_LOAD_PIC \
+   ({ long got;								      \
+      __asm__ (".hidden _GLOBAL_OFFSET_TABLE_\n\t"				      \
+	   "sethi %%hi(_GLOBAL_OFFSET_TABLE_), %0\n\t"			      \
+	   "or %0, %%lo(_GLOBAL_OFFSET_TABLE_), %0"			      \
+	   : "=r" (got));						      \
+      got; })
+# endif
+
+# define TLS_IE(x) \
+  ({ int *__l;								      \
+     __asm__ ("sethi %%tie_hi22(" #x "), %0" : "=r" (__l));			      \
+     __asm__ ("add %1, %%tie_lo10(" #x "), %0" : "=r" (__l) : "r" (__l));	      \
+     __asm__ ("ld [%1 + %2], %0, %%tie_ld(" #x ")"				      \
+	  : "=r" (__l) : "r" (TLS_LOAD_PIC), "r" (__l));		      \
+     __asm__ ("add %%g7, %1, %0, %%tie_add(" #x ")" : "=r" (__l) : "r" (__l));    \
+     __l; })
+
+# define TLS_LD(x) \
+  ({ int *__l; register void *__o0 __asm__ ("%o0");				      \
+     long __o;								      \
+     __asm__ ("sethi %%tldm_hi22(" #x "), %0" : "=r" (__l));		      \
+     __asm__ ("add %1, %%tldm_lo10(" #x "), %0" : "=r" (__l) : "r" (__l));	      \
+     __asm__ ("add %1, %2, %0, %%tldm_add(" #x ")"				      \
+	  : "=r" (__o0) : "r" (TLS_LOAD_PIC), "r" (__l));		      \
+     __asm__ ("call __tls_get_addr, %%tgd_call(" #x ")\n\t"			      \
+	  " nop"							      \
+	  : "=r" (__o0) : "0" (__o0)					      \
+	  : "g1", "g2", "g3", "g4", "g5", "g6", "o1", "o2", "o3", "o4",	      \
+	    "o5", "o7", "cc");						      \
+     __asm__ ("sethi %%tldo_hix22(" #x "), %0" : "=r" (__o));		      \
+     __asm__ ("xor %1, %%tldo_lox10(" #x "), %0" : "=r" (__o) : "r" (__o));	      \
+     __asm__ ("add %1, %2, %0, %%tldo_add(" #x ")" : "=r" (__l)		      \
+	  : "r" (__o0), "r" (__o));					      \
+     __l; })
+
+# define TLS_GD(x) \
+  ({ int *__l; register void *__o0 __asm__ ("%o0");				      \
+     __asm__ ("sethi %%tgd_hi22(" #x "), %0" : "=r" (__l));			      \
+     __asm__ ("add %1, %%tgd_lo10(" #x "), %0" : "=r" (__l) : "r" (__l));	      \
+     __asm__ ("add %1, %2, %0, %%tgd_add(" #x ")"				      \
+	  : "=r" (__o0) : "r" (TLS_LOAD_PIC), "r" (__l));		      \
+     __asm__ ("call __tls_get_addr, %%tgd_call(" #x ")\n\t"			      \
+	  " nop"							      \
+	  : "=r" (__o0) : "0" (__o0)					      \
+	  : "g1", "g2", "g3", "g4", "g5", "g6", "o1", "o2", "o3", "o4",	      \
+	    "o5", "o7", "cc");						      \
+     __o0; })
+
+#elif defined __sparc__ && defined __arch64__
+
+# define TLS_LE(x) \
+  ({ int *__l;								      \
+     __asm__ ("sethi %%tle_hix22(" #x "), %0" : "=r" (__l));		      \
+     __asm__ ("xor %1, %%tle_lox10(" #x "), %0" : "=r" (__l) : "r" (__l));	      \
+     __asm__ ("add %%g7, %1, %0" : "=r" (__l) : "r" (__l));			      \
+     __l; })
+
+# ifdef __PIC__
+#  define TLS_LOAD_PIC \
+  ({ long pc, got;							      \
+     __asm__ ("sethi %%hi(_GLOBAL_OFFSET_TABLE_-4), %1\n\t"			      \
+	  "rd %%pc, %0\n\t"						      \
+	  "add %1, %%lo(_GLOBAL_OFFSET_TABLE_+4), %1\n\t"		      \
+	  "add %1, %0, %1\n\t"						      \
+	  : "=r" (pc), "=r" (got));					      \
+     got; })
+# else
+#  define TLS_LOAD_PIC \
+   ({ long got;								      \
+      __asm__ (".hidden _GLOBAL_OFFSET_TABLE_\n\t"				      \
+	   "sethi %%hi(_GLOBAL_OFFSET_TABLE_), %0\n\t"			      \
+	   "or %0, %%lo(_GLOBAL_OFFSET_TABLE_), %0"			      \
+	   : "=r" (got));						      \
+      got; })
+# endif
+
+# define TLS_IE(x) \
+  ({ int *__l;								      \
+     __asm__ ("sethi %%tie_hi22(" #x "), %0" : "=r" (__l));			      \
+     __asm__ ("add %1, %%tie_lo10(" #x "), %0" : "=r" (__l) : "r" (__l));	      \
+     __asm__ ("ldx [%1 + %2], %0, %%tie_ldx(" #x ")"			      \
+	  : "=r" (__l) : "r" (TLS_LOAD_PIC), "r" (__l));		      \
+     __asm__ ("add %%g7, %1, %0, %%tie_add(" #x ")" : "=r" (__l) : "r" (__l));    \
+     __l; })
+
+# define TLS_LD(x) \
+  ({ int *__l; register void *__o0 __asm__ ("%o0");				      \
+     long __o;								      \
+     __asm__ ("sethi %%tldm_hi22(" #x "), %0" : "=r" (__l));		      \
+     __asm__ ("add %1, %%tldm_lo10(" #x "), %0" : "=r" (__l) : "r" (__l));	      \
+     __asm__ ("add %1, %2, %0, %%tldm_add(" #x ")"				      \
+	  : "=r" (__o0) : "r" (TLS_LOAD_PIC), "r" (__l));		      \
+     __asm__ ("call __tls_get_addr, %%tgd_call(" #x ")\n\t"			      \
+	  " nop"							      \
+	  : "=r" (__o0) : "0" (__o0)					      \
+	  : "g1", "g2", "g3", "g4", "g5", "g6", "o1", "o2", "o3", "o4",	      \
+	    "o5", "o7", "cc");						      \
+     __asm__ ("sethi %%tldo_hix22(" #x "), %0" : "=r" (__o));		      \
+     __asm__ ("xor %1, %%tldo_lox10(" #x "), %0" : "=r" (__o) : "r" (__o));	      \
+     __asm__ ("add %1, %2, %0, %%tldo_add(" #x ")" : "=r" (__l)		      \
+	  : "r" (__o0), "r" (__o));					      \
+     __l; })
+
+# define TLS_GD(x) \
+  ({ int *__l; register void *__o0 __asm__ ("%o0");				      \
+     __asm__ ("sethi %%tgd_hi22(" #x "), %0" : "=r" (__l));			      \
+     __asm__ ("add %1, %%tgd_lo10(" #x "), %0" : "=r" (__l) : "r" (__l));	      \
+     __asm__ ("add %1, %2, %0, %%tgd_add(" #x ")"				      \
+	  : "=r" (__o0) : "r" (TLS_LOAD_PIC), "r" (__l));		      \
+     __asm__ ("call __tls_get_addr, %%tgd_call(" #x ")\n\t"			      \
+	  " nop"							      \
+	  : "=r" (__o0) : "0" (__o0)					      \
+	  : "g1", "g2", "g3", "g4", "g5", "g6", "o1", "o2", "o3", "o4",	      \
+	    "o5", "o7", "cc");						      \
+     __o0; })
+
+#elif defined __s390x__
+
+# define TLS_LE(x) \
+  ({ unsigned long __offset;						      \
+     __asm__ ("bras %0,1f\n"						      \
+	  "0:\t.quad " #x "@ntpoff\n"					      \
+	  "1:\tlg %0,0(%0)"						      \
+	  : "=a" (__offset) : : "cc" );					      \
+     (int *) (__builtin_thread_pointer() + __offset); })
+
+# ifdef __PIC__
+#  define TLS_IE(x) \
+  ({ unsigned long __offset;						      \
+     __asm__ ("bras %0,1f\n"						      \
+	  "0:\t.quad " #x "@gotntpoff\n"				      \
+	  "1:\tlg %0,0(%0)\n\t"						      \
+	  "lg %0,0(%0,%%r12):tls_load:" #x				      \
+	  : "=&a" (__offset) : : "cc" );				      \
+     (int *) (__builtin_thread_pointer() + __offset); })
+# else
+#  define TLS_IE(x) \
+  ({ unsigned long  __offset;						      \
+     __asm__ ("bras %0,1f\n"						      \
+	  "0:\t.quad " #x "@indntpoff\n"				      \
+	  "1:\t lg %0,0(%0)\n\t"					      \
+	  "lg %0,0(%0):tls_load:" #x					      \
+	  : "=&a" (__offset) : : "cc" );				      \
+     (int *) (__builtin_thread_pointer() + __offset); })
+# endif
+
+# ifdef __PIC__
+#  define TLS_LD(x) \
+  ({ unsigned long __offset, __save12;					      \
+     __asm__ ("bras %0,1f\n"						      \
+	  "0:\t.quad " #x "@tlsldm\n\t"					      \
+	  ".quad " #x "@dtpoff\n"					      \
+	  "1:\tlgr %1,%%r12\n\t"					      \
+          "larl %%r12,_GLOBAL_OFFSET_TABLE_\n\t"			      \
+          "lg %%r2,0(%0)\n\t"						      \
+	  "brasl %%r14,__tls_get_offset@plt:tls_ldcall:" #x "\n\t"	      \
+	  "lg %0,8(%0)\n\t"						      \
+	  "algr %0,%%r2\n\t"						      \
+          "lgr %%r12,%1"						      \
+	  : "=&a" (__offset), "=&a" (__save12)				      \
+          : : "cc", "0", "1", "2", "3", "4", "5", "14" );		      \
+     (int *) (__builtin_thread_pointer() + __offset); })
+# else
+#  define TLS_LD(x) \
+  ({ unsigned long __offset;						      \
+     __asm__ ("bras %0,1f\n"						      \
+	  "0:\t.quad " #x "@tlsldm\n\t"					      \
+	  ".quad " #x "@dtpoff\n"					      \
+	  "1:\tlarl %%r12,_GLOBAL_OFFSET_TABLE_\n\t"			      \
+          "lg %%r2,0(%0)\n\t"						      \
+	  "brasl %%r14,__tls_get_offset@plt:tls_ldcall:" #x "\n\t"	      \
+	  "lg %0,8(%0)\n\t"						      \
+	  "algr %0,%%r2"						      \
+	  : "=&a" (__offset)						      \
+	  : : "cc", "0", "1", "2", "3", "4", "5", "12", "14" );		      \
+     (int *) (__builtin_thread_pointer() + __offset); })
+# endif
+
+# ifdef __PIC__
+#  define TLS_GD(x) \
+  ({ unsigned long __offset, __save12;					      \
+     __asm__ ("bras %0,1f\n"						      \
+	  "0:\t.quad " #x "@tlsgd\n"					      \
+	  "1:\tlgr %1,%%r12\n\t"					      \
+	  "larl %%r12,_GLOBAL_OFFSET_TABLE_\n\t"			      \
+          "lg %%r2,0(%0)\n\t"						      \
+	  "brasl %%r14,__tls_get_offset@plt:tls_gdcall:" #x "\n\t"	      \
+          "lgr %0,%%r2\n\t"						      \
+          "lgr %%r12,%1"						      \
+	  : "=&a" (__offset), "=&a" (__save12)				      \
+          : : "cc", "0", "1", "2", "3", "4", "5", "14" );		      \
+     (int *) (__builtin_thread_pointer() + __offset); })
+# else
+#  define TLS_GD(x) \
+  ({ unsigned long __offset;						      \
+     __asm__ ("bras %0,1f\n"						      \
+	  "0:\t.quad " #x "@tlsgd\n"					      \
+	  "1:\tlarl %%r12,_GLOBAL_OFFSET_TABLE_\n\t"			      \
+	  "lg %%r2,0(%0)\n\t"						      \
+	  "brasl %%r14,__tls_get_offset@plt:tls_gdcall:" #x "\n\t"	      \
+          "lgr %0,%%r2"							      \
+	  : "=&a" (__offset)						      \
+	  : : "cc", "0", "1", "2", "3", "4", "5", "12", "14" );		      \
+     (int *) (__builtin_thread_pointer() + __offset); })
+# endif
+
+#elif defined __s390__
+
+# define TLS_LE(x) \
+  ({ unsigned long __offset;						      \
+     __asm__ ("bras %0,1f\n"						      \
+	  "0:\t.long " #x "@ntpoff\n"					      \
+	  "1:\tl %0,0(%0)"						      \
+	  : "=a" (__offset) : : "cc" );					      \
+     (int *) (__builtin_thread_pointer() + __offset); })
+
+# ifdef __PIC__
+#  define TLS_IE(x) \
+  ({ unsigned long __offset;						      \
+     __asm__ ("bras %0,1f\n"						      \
+	  "0:\t.long " #x "@gotntpoff\n"				      \
+	  "1:\tl %0,0(%0)\n\t"						      \
+	  "l %0,0(%0,%%r12):tls_load:" #x				      \
+	  : "=&a" (__offset) : : "cc" );				      \
+     (int *) (__builtin_thread_pointer() + __offset); })
+# else
+#  define TLS_IE(x) \
+  ({ unsigned long  __offset;						      \
+     __asm__ ("bras %0,1f\n"						      \
+	  "0:\t.long " #x "@indntpoff\n"				      \
+	  "1:\t l %0,0(%0)\n\t"						      \
+	  "l %0,0(%0):tls_load:" #x					      \
+	  : "=&a" (__offset) : : "cc" );				      \
+     (int *) (__builtin_thread_pointer() + __offset); })
+# endif
+
+# ifdef __PIC__
+#  define TLS_LD(x) \
+  ({ unsigned long __offset, __save12;					      \
+     __asm__ ("bras %0,1f\n"						      \
+	  "0:\t.long _GLOBAL_OFFSET_TABLE_-0b\n\t"			      \
+	  ".long __tls_get_offset@plt-0b\n\t"				      \
+	  ".long " #x "@tlsldm\n\t"					      \
+	  ".long " #x "@dtpoff\n"					      \
+	  "1:\tlr %1,%%r12\n\t"						      \
+          "l %%r12,0(%0)\n\t"						      \
+          "la %%r12,0(%%r12,%0)\n\t"					      \
+	  "l %%r1,4(%0)\n\t"						      \
+	  "l %%r2,8(%0)\n\t"						      \
+	  "bas %%r14,0(%%r1,%0):tls_ldcall:" #x "\n\t"			      \
+	  "l %0,12(%0)\n\t"						      \
+	  "alr %0,%%r2\n\t"						      \
+          "lr %%r12,%1"							      \
+	  : "=&a" (__offset), "=&a" (__save12)				      \
+          : : "cc", "0", "1", "2", "3", "4", "5" );			      \
+     (int *) (__builtin_thread_pointer() + __offset); })
+# else
+#  define TLS_LD(x) \
+  ({ unsigned long __offset;						      \
+     __asm__ ("bras %0,1f\n"						      \
+	  "0:\t.long _GLOBAL_OFFSET_TABLE_\n\t"				      \
+	  ".long __tls_get_offset@plt\n\t"				      \
+	  ".long " #x "@tlsldm\n\t"					      \
+	  ".long " #x "@dtpoff\n"					      \
+	  "1:\tl %%r12,0(%0)\n\t"					      \
+	  "l %%r1,4(%0)\n\t"						      \
+	  "l %%r2,8(%0)\n\t"						      \
+	  "bas %%r14,0(%%r1):tls_ldcall:" #x "\n\t"			      \
+	  "l %0,12(%0)\n\t"						      \
+	  "alr %0,%%r2"							      \
+	  : "=&a" (__offset) : : "cc", "0", "1", "2", "3", "4", "5", "12" );  \
+     (int *) (__builtin_thread_pointer() + __offset); })
+# endif
+
+# ifdef __PIC__
+#  define TLS_GD(x) \
+  ({ unsigned long __offset, __save12;					      \
+     __asm__ ("bras %0,1f\n"						      \
+	  "0:\t.long _GLOBAL_OFFSET_TABLE_-0b\n\t"			      \
+	  ".long __tls_get_offset@plt-0b\n\t"				      \
+	  ".long " #x "@tlsgd\n"					      \
+	  "1:\tlr %1,%%r12\n\t"						      \
+          "l %%r12,0(%0)\n\t"						      \
+          "la %%r12,0(%%r12,%0)\n\t"					      \
+	  "l %%r1,4(%0)\n\t"						      \
+	  "l %%r2,8(%0)\n\t"						      \
+	  "bas %%r14,0(%%r1,%0):tls_gdcall:" #x "\n\t"			      \
+          "lr %0,%%r2\n\t"						      \
+          "lr %%r12,%1"							      \
+	  : "=&a" (__offset), "=&a" (__save12)				      \
+          : : "cc", "0", "1", "2", "3", "4", "5" );			      \
+     (int *) (__builtin_thread_pointer() + __offset); })
+# else
+#  define TLS_GD(x) \
+  ({ unsigned long __offset;						      \
+     __asm__ ("bras %0,1f\n"						      \
+	  "0:\t.long _GLOBAL_OFFSET_TABLE_\n\t"				      \
+	  ".long __tls_get_offset@plt\n\t"				      \
+	  ".long " #x "@tlsgd\n"					      \
+	  "1:\tl %%r12,0(%0)\n\t"					      \
+	  "l %%r1,4(%0)\n\t"						      \
+	  "l %%r2,8(%0)\n\t"						      \
+	  "bas %%r14,0(%%r1):tls_gdcall:" #x "\n\t"			      \
+          "lr %0,%%r2"							      \
+	  : "=&a" (__offset) : : "cc", "0", "1", "2", "3", "4", "5", "12" );  \
+     (int *) (__builtin_thread_pointer() + __offset); })
+# endif
+
+#elif defined __powerpc__ && !defined __powerpc64__
+
+/*#include "config.h"*/
+
+# define __TLS_CALL_CLOBBERS						\
+	"0", "3", "4", "5", "6", "7", "8", "9", "10", "11", "12",	\
+	"lr", "ctr", "cr0", "cr1", "cr5", "cr6", "cr7"
+
+/* PowerPC32 Local Exec TLS access.  */
+# define TLS_LE(x)				\
+  ({ int *__result;				\
+     __asm__ ("addi %0,2," #x "@tprel"		\
+	  : "=r" (__result));			\
+     __result; })
+
+/* PowerPC32 Initial Exec TLS access.  */
+# ifdef HAVE_ASM_PPC_REL16
+#  define TLS_IE(x)					\
+  ({ int *__result;					\
+     __asm__ ("bcl 20,31,1f\n1:\t"				\
+	  "mflr %0\n\t"					\
+	  "addis %0,%0,_GLOBAL_OFFSET_TABLE_-1b@ha\n\t"	\
+	  "addi %0,%0,_GLOBAL_OFFSET_TABLE_-1b@l\n\t"	\
+	  "lwz %0," #x "@got@tprel(%0)\n\t"		\
+	  "add %0,%0," #x "@tls"			\
+	  : "=b" (__result) :				\
+	  : "lr");					\
+     __result; })
+# else
+#  define TLS_IE(x)					\
+  ({ int *__result;					\
+     __asm__ ("bl _GLOBAL_OFFSET_TABLE_@local-4\n\t"	\
+	  "mflr %0\n\t"					\
+	  "lwz %0," #x "@got@tprel(%0)\n\t"		\
+	  "add %0,%0," #x "@tls"			\
+	  : "=b" (__result) :				\
+	  : "lr");					\
+     __result; })
+# endif
+
+/* PowerPC32 Local Dynamic TLS access.  */
+# ifdef HAVE_ASM_PPC_REL16
+#  define TLS_LD(x)					\
+  ({ int *__result;					\
+     __asm__ ("bcl 20,31,1f\n1:\t"				\
+	  "mflr 3\n\t"					\
+	  "addis 3,3,_GLOBAL_OFFSET_TABLE_-1b@ha\n\t"	\
+	  "addi 3,3,_GLOBAL_OFFSET_TABLE_-1b@l\n\t"	\
+	  "addi 3,3," #x "@got@tlsld\n\t"		\
+	  "bl __tls_get_addr@plt\n\t"			\
+	  "addi %0,3," #x "@dtprel"			\
+	  : "=r" (__result) :				\
+	  : __TLS_CALL_CLOBBERS);			\
+     __result; })
+# else
+#  define TLS_LD(x)					\
+  ({ int *__result;					\
+     __asm__ ("bl _GLOBAL_OFFSET_TABLE_@local-4\n\t"	\
+	  "mflr 3\n\t"					\
+	  "addi 3,3," #x "@got@tlsld\n\t"		\
+	  "bl __tls_get_addr@plt\n\t"			\
+	  "addi %0,3," #x "@dtprel"			\
+	  : "=r" (__result) :				\
+	  : __TLS_CALL_CLOBBERS);			\
+     __result; })
+# endif
+
+/* PowerPC32 General Dynamic TLS access.  */
+# ifdef HAVE_ASM_PPC_REL16
+#  define TLS_GD(x)					\
+  ({ register int *__result __asm__ ("r3");		\
+     __asm__ ("bcl 20,31,1f\n1:\t"				\
+	  "mflr 3\n\t"					\
+	  "addis 3,3,_GLOBAL_OFFSET_TABLE_-1b@ha\n\t"	\
+	  "addi 3,3,_GLOBAL_OFFSET_TABLE_-1b@l\n\t"	\
+	  "addi 3,3," #x "@got@tlsgd\n\t"		\
+	  "bl __tls_get_addr@plt"			\
+	  : :						\
+	  : __TLS_CALL_CLOBBERS);			\
+     __result; })
+# else
+#  define TLS_GD(x)					\
+  ({ register int *__result __asm__ ("r3");		\
+     __asm__ ("bl _GLOBAL_OFFSET_TABLE_@local-4\n\t"	\
+	  "mflr 3\n\t"					\
+	  "addi 3,3," #x "@got@tlsgd\n\t"		\
+	  "bl __tls_get_addr@plt"			\
+	  : :						\
+	  : __TLS_CALL_CLOBBERS);			\
+     __result; })
+# endif
+
+#elif defined __powerpc__ && defined __powerpc64__
+
+/* PowerPC64 Local Exec TLS access.  */
+# define TLS_LE(x) \
+  ({  int * __result;  \
+      __asm__ ( \
+        "  addis %0,13," #x "@tprel@ha\n"  \
+        "  addi  %0,%0," #x "@tprel@l\n"   \
+        : "=b" (__result) );  \
+      __result;  \
+  })
+/* PowerPC64 Initial Exec TLS access.  */
+#  define TLS_IE(x) \
+  ({  int * __result;  \
+      __asm__ (  \
+        "  ld  %0," #x "@got@tprel(2)\n"  \
+        "  add %0,%0," #x "@tls\n"   \
+        : "=b" (__result) );  \
+      __result;  \
+  })
+/* PowerPC64 Local Dynamic TLS access.  */
+#  define TLS_LD(x) \
+  ({  int * __result;  \
+      __asm__ (  \
+        "  addi  3,2," #x "@got@tlsld\n"  \
+        "  bl    .__tls_get_addr\n"  \
+        "  nop   \n"  \
+        "  addis %0,3," #x "@dtprel@ha\n"  \
+        "  addi  %0,%0," #x "@dtprel@l\n"  \
+        : "=b" (__result) :  \
+        : "0", "3", "4", "5", "6", "7",    \
+          "8", "9", "10", "11", "12",      \
+          "lr", "ctr",  \
+          "cr0", "cr1", "cr5", "cr6", "cr7");  \
+      __result;  \
+  })
+/* PowerPC64 General Dynamic TLS access.  */
+#  define TLS_GD(x) \
+  ({  int * __result;  \
+      __asm__ (  \
+        "  addi  3,2," #x "@got@tlsgd\n"  \
+        "  bl    .__tls_get_addr\n"  \
+        "  nop   \n"  \
+        "  mr    %0,3\n"  \
+        : "=b" (__result) :  \
+        : "0", "3", "4", "5", "6", "7",    \
+          "8", "9", "10", "11", "12",      \
+          "lr", "ctr",  \
+          "cr0", "cr1", "cr5", "cr6", "cr7");  \
+      __result;  \
+  })
+
+#elif !defined TLS_LE || !defined TLS_IE \
+      || !defined TLS_LD || !defined TLS_GD
+# error "No support for this architecture so far."
+#endif
diff --git a/ap/build/uClibc/test/tls/tst-tls-at-ctor.c b/ap/build/uClibc/test/tls/tst-tls-at-ctor.c
new file mode 100644
index 0000000..53aece1
--- /dev/null
+++ b/ap/build/uClibc/test/tls/tst-tls-at-ctor.c
@@ -0,0 +1,21 @@
+#include <stdio.h>
+#include <stdlib.h>
+#include <tls.h>
+
+#define TLS_VAR_INIT_VALUE 99
+
+#ifdef USE_TLS
+extern __thread int tls_var;
+#endif
+
+int main(void)
+{
+	int ret = EXIT_SUCCESS;
+#ifdef USE_TLS
+	if (tls_var != TLS_VAR_INIT_VALUE) {
+		printf("tls_var = %d - Expected value = %d\n", tls_var, TLS_VAR_INIT_VALUE);
+		ret = EXIT_FAILURE;
+	}
+#endif
+	return ret;
+}
diff --git a/ap/build/uClibc/test/tls/tst-tls1-static.c b/ap/build/uClibc/test/tls/tst-tls1-static.c
new file mode 100644
index 0000000..a010080
--- /dev/null
+++ b/ap/build/uClibc/test/tls/tst-tls1-static.c
@@ -0,0 +1 @@
+#include "tst-tls1.c"
diff --git a/ap/build/uClibc/test/tls/tst-tls1.c b/ap/build/uClibc/test/tls/tst-tls1.c
new file mode 100644
index 0000000..f5ac6d2
--- /dev/null
+++ b/ap/build/uClibc/test/tls/tst-tls1.c
@@ -0,0 +1,92 @@
+/* glibc test for TLS in ld.so.  */
+#undef _LIBC
+#include <stdio.h>
+
+#include <tls.h>
+
+#ifdef USE_TLS
+# include "tls-macros.h"
+
+
+/* Two common 'int' variables in TLS.  */
+COMMON_INT_DEF(foo);
+COMMON_INT_DEF(bar);
+#endif
+
+
+#define TEST_FUNCTION do_test ()
+static int
+do_test (void)
+{
+#ifdef USE_TLS
+  int result = 0;
+  int *ap, *bp;
+
+
+  /* Set the variable using the local exec model.  */
+  puts ("set bar to 1 (LE)");
+  ap = TLS_LE (bar);
+  *ap = 1;
+
+
+  /* Get variables using initial exec model.  */
+  fputs ("get sum of foo and bar (IE)", stdout);
+  ap = TLS_IE (foo);
+  bp = TLS_IE (bar);
+  printf (" = %d\n", *ap + *bp);
+  result |= *ap + *bp != 1;
+  if (*ap != 0)
+    {
+      printf ("foo = %d\n", *ap);
+      result = 1;
+    }
+  if (*bp != 1)
+    {
+      printf ("bar = %d\n", *bp);
+      result = 1;
+    }
+
+
+  /* Get variables using local dynamic model.  */
+  fputs ("get sum of foo and bar (LD)", stdout);
+  ap = TLS_LD (foo);
+  bp = TLS_LD (bar);
+  printf (" = %d\n", *ap + *bp);
+  result |= *ap + *bp != 1;
+  if (*ap != 0)
+    {
+      printf ("foo = %d\n", *ap);
+      result = 1;
+    }
+  if (*bp != 1)
+    {
+      printf ("bar = %d\n", *bp);
+      result = 1;
+    }
+
+
+  /* Get variables using generic dynamic model.  */
+  fputs ("get sum of foo and bar (GD)", stdout);
+  ap = TLS_GD (foo);
+  bp = TLS_GD (bar);
+  printf (" = %d\n", *ap + *bp);
+  result |= *ap + *bp != 1;
+  if (*ap != 0)
+    {
+      printf ("foo = %d\n", *ap);
+      result = 1;
+    }
+  if (*bp != 1)
+    {
+      printf ("bar = %d\n", *bp);
+      result = 1;
+    }
+
+  return result;
+#else
+  return 0;
+#endif
+}
+
+
+#include "../test-skeleton.c"
diff --git a/ap/build/uClibc/test/tls/tst-tls10.c b/ap/build/uClibc/test/tls/tst-tls10.c
new file mode 100644
index 0000000..fc06770
--- /dev/null
+++ b/ap/build/uClibc/test/tls/tst-tls10.c
@@ -0,0 +1,40 @@
+#include "tst-tls10.h"
+
+#ifdef USE_TLS__THREAD
+__thread int dummy __attribute__((visibility ("hidden"))) = 12;
+__thread struct A local = { 1, 2, 3 };
+#endif
+
+#define CHECK(N, S)					\
+  p = f##N##a ();					\
+  if (p->a != S || p->b != S + 1 || p->c != S + 2)	\
+    abort ()
+
+int
+main (void)
+{
+  struct A *p;
+  if (local.a != 1 || local.b != 2 || local.c != 3)
+    abort ();
+#ifdef USE_TLS__THREAD
+  if (a1.a != 4 || a1.b != 5 || a1.c != 6)
+    abort ();
+  if (a2.a != 22 || a2.b != 23 || a2.c != 24)
+    abort ();
+  if (a3.a != 10 || a3.b != 11 || a3.c != 12)
+    abort ();
+  if (a4.a != 25 || a4.b != 26 || a4.c != 27)
+    abort ();
+  check1 ();
+  check2 ();
+  if (f1a () != &a1 || f2a () != &a2 || f3a () != &a3 || f4a () != &a4)
+    abort ();
+  CHECK (5, 16);
+  CHECK (6, 19);
+  if (f7a () != &a2 || f8a () != &a4)
+    abort ();
+  CHECK (9, 28);
+  CHECK (10, 31);
+#endif
+  exit (0);
+}
diff --git a/ap/build/uClibc/test/tls/tst-tls10.h b/ap/build/uClibc/test/tls/tst-tls10.h
new file mode 100644
index 0000000..1be6adc
--- /dev/null
+++ b/ap/build/uClibc/test/tls/tst-tls10.h
@@ -0,0 +1,38 @@
+#include <tls.h>
+#include <stdlib.h>
+
+#if defined USE_TLS && defined HAVE___THREAD \
+    && defined HAVE_TLS_MODEL_ATTRIBUTE
+# define USE_TLS__THREAD
+
+struct A
+{
+  char a;
+  int b;
+  long long c;
+};
+
+extern __thread struct A a1, a2, a3, a4;
+extern struct A *f1a (void);
+extern struct A *f2a (void);
+extern struct A *f3a (void);
+extern struct A *f4a (void);
+extern struct A *f5a (void);
+extern struct A *f6a (void);
+extern struct A *f7a (void);
+extern struct A *f8a (void);
+extern struct A *f9a (void);
+extern struct A *f10a (void);
+extern int f1b (void);
+extern int f2b (void);
+extern int f3b (void);
+extern int f4b (void);
+extern int f5b (void);
+extern int f6b (void);
+extern int f7b (void);
+extern int f8b (void);
+extern int f9b (void);
+extern int f10b (void);
+extern void check1 (void);
+extern void check2 (void);
+#endif
diff --git a/ap/build/uClibc/test/tls/tst-tls11.c b/ap/build/uClibc/test/tls/tst-tls11.c
new file mode 100644
index 0000000..816cf5c
--- /dev/null
+++ b/ap/build/uClibc/test/tls/tst-tls11.c
@@ -0,0 +1,27 @@
+#include "tst-tls10.h"
+
+#define CHECK(N, S)					\
+  p = f##N##a ();					\
+  if (p->a != S || p->b != S + 1 || p->c != S + 2)	\
+    abort ()
+
+int
+main (void)
+{
+#ifdef USE_TLS__THREAD
+  struct A *p;
+  check1 ();
+  check2 ();
+  CHECK (1, 4);
+  CHECK (2, 22);
+  CHECK (3, 10);
+  CHECK (4, 25);
+  CHECK (5, 16);
+  CHECK (6, 19);
+  CHECK (7, 22);
+  CHECK (8, 25);
+  CHECK (9, 28);
+  CHECK (10, 31);
+#endif
+  exit (0);
+}
diff --git a/ap/build/uClibc/test/tls/tst-tls12.c b/ap/build/uClibc/test/tls/tst-tls12.c
new file mode 100644
index 0000000..84aa7d3
--- /dev/null
+++ b/ap/build/uClibc/test/tls/tst-tls12.c
@@ -0,0 +1,18 @@
+#include "tst-tls10.h"
+
+#define CHECK(N, S)					\
+  p = &a##N;						\
+  if (p->a != S || p->b != S + 1 || p->c != S + 2)	\
+    abort ()
+
+int
+main (void)
+{
+#ifdef USE_TLS__THREAD
+  struct A *p;
+  check1 ();
+  CHECK (1, 4);
+  CHECK (2, 7);
+#endif
+  exit (0);
+}
diff --git a/ap/build/uClibc/test/tls/tst-tls13.c b/ap/build/uClibc/test/tls/tst-tls13.c
new file mode 100644
index 0000000..beee91b
--- /dev/null
+++ b/ap/build/uClibc/test/tls/tst-tls13.c
@@ -0,0 +1,30 @@
+/* Check unloading modules with data in static TLS block.  */
+#include <dlfcn.h>
+#include <stdio.h>
+#include <stdlib.h>
+
+
+static int
+do_test (void)
+{
+  int i;
+  for (i = 0; i < 1000;)
+    {
+      printf ("round %d\n",++i);
+
+      void *h = dlopen ("tst-tlsmod13a.so", RTLD_LAZY);
+      if (h == NULL)
+	{
+	  printf ("cannot load: %s\n", dlerror ());
+	  exit (1);
+	}
+
+      dlclose (h);
+    }
+
+  return 0;
+}
+
+#define TEST_FUNCTION do_test ()
+#define TIMEOUT 20
+#include "../test-skeleton.c"
diff --git a/ap/build/uClibc/test/tls/tst-tls14.c b/ap/build/uClibc/test/tls/tst-tls14.c
new file mode 100644
index 0000000..428fd52
--- /dev/null
+++ b/ap/build/uClibc/test/tls/tst-tls14.c
@@ -0,0 +1,66 @@
+/* Check alignment of TLS variable.  */
+#include <dlfcn.h>
+#include <stdint.h>
+#include <stdio.h>
+#include <stdlib.h>
+
+#include <tls.h>
+
+#if USE_TLS && HAVE___THREAD
+
+#define AL 4096
+struct foo
+{
+  int i;
+} __attribute ((aligned (AL)));
+
+static __thread struct foo f;
+static struct foo g;
+
+
+extern int in_dso1 (void);
+
+
+static int
+do_test (void)
+{
+  int result = 0;
+
+  int fail = (((uintptr_t) &f) & (AL - 1)) != 0;
+  printf ("&f = %p %s\n", &f, fail ? "FAIL" : "OK");
+  result |= fail;
+
+  fail = (((uintptr_t) &g) & (AL - 1)) != 0;
+  printf ("&g = %p %s\n", &g, fail ? "FAIL" : "OK");
+  result |= fail;
+
+  result |= in_dso1 ();
+
+  void *h = dlopen ("tst-tlsmod14b.so", RTLD_LAZY);
+  if (h == NULL)
+    {
+      printf ("cannot open tst-tlsmod14b.so: %m\n");
+      exit (1);
+    }
+
+  int (*fp) (void) = (int (*) (void)) dlsym (h, "in_dso2");
+  if (fp == NULL)
+    {
+      puts ("cannot find in_dso2");
+      exit (1);
+    }
+
+  result |= fp ();
+
+  return result;
+}
+
+#define TEST_FUNCTION do_test ()
+
+#else
+
+#define TEST_FUNCTION 0
+
+#endif
+
+#include "../test-skeleton.c"
diff --git a/ap/build/uClibc/test/tls/tst-tls15.c b/ap/build/uClibc/test/tls/tst-tls15.c
new file mode 100644
index 0000000..2c2df25
--- /dev/null
+++ b/ap/build/uClibc/test/tls/tst-tls15.c
@@ -0,0 +1,33 @@
+#include <dlfcn.h>
+#include <stdio.h>
+#include <stdlib.h>
+
+static int
+do_test (void)
+{
+  void *h = dlopen ("tst-tlsmod15a.so", RTLD_NOW);
+  if (h != NULL)
+    {
+      puts ("unexpectedly succeeded to open tst-tlsmod15a.so");
+      exit (1);
+    }
+
+  h = dlopen ("tst-tlsmod15b.so", RTLD_NOW);
+  if (h == NULL)
+    {
+      puts ("failed to open tst-tlsmod15b.so");
+      exit (1);
+    }
+
+  int (*fp) (void) = (int (*) (void)) dlsym (h, "in_dso");
+  if (fp == NULL)
+    {
+      puts ("cannot find in_dso");
+      exit (1);
+    }
+
+  return fp ();
+}
+
+#define TEST_FUNCTION do_test ()
+#include "../test-skeleton.c"
diff --git a/ap/build/uClibc/test/tls/tst-tls16.c b/ap/build/uClibc/test/tls/tst-tls16.c
new file mode 100644
index 0000000..17912dc
--- /dev/null
+++ b/ap/build/uClibc/test/tls/tst-tls16.c
@@ -0,0 +1,53 @@
+#include <dlfcn.h>
+#include <stdio.h>
+#include <stdlib.h>
+
+static int
+do_test (void)
+{
+  void *h = dlopen ("tst-tlsmod16a.so", RTLD_LAZY | RTLD_GLOBAL);
+  if (h == NULL)
+    {
+      puts ("unexpectedly failed to open tst-tlsmod16a.so");
+      exit (1);
+    }
+
+  void *p = dlsym (h, "tlsvar");
+
+  /* This dlopen should indeed fail, because tlsvar was assigned to
+     dynamic TLS, and the new module requests it to be in static TLS.
+     However, there's a possibility that dlopen succeeds if the
+     variable is, for whatever reason, assigned to static TLS, or if
+     the module fails to require static TLS, or even if TLS is not
+     supported.  */
+  h = dlopen ("tst-tlsmod16b.so", RTLD_NOW | RTLD_GLOBAL);
+  if (h == NULL)
+    {
+      return 0;
+    }
+
+  puts ("unexpectedly succeeded to open tst-tlsmod16b.so");
+
+
+  void *(*fp) (void) = (void *(*) (void)) dlsym (h, "in_dso");
+  if (fp == NULL)
+    {
+      puts ("cannot find in_dso");
+      exit (1);
+    }
+
+  /* If the dlopen passes, at least make sure the address returned by
+     dlsym is the same as that returned by the initial-exec access.
+     If the variable was assigned to dynamic TLS during dlsym, this
+     portion will fail.  */
+  if (fp () != p)
+    {
+      puts ("returned values do not match");
+      exit (1);
+    }
+
+  return 0;
+}
+
+#define TEST_FUNCTION do_test ()
+#include "../test-skeleton.c"
diff --git a/ap/build/uClibc/test/tls/tst-tls17.c b/ap/build/uClibc/test/tls/tst-tls17.c
new file mode 100644
index 0000000..c1bc7d8
--- /dev/null
+++ b/ap/build/uClibc/test/tls/tst-tls17.c
@@ -0,0 +1,29 @@
+#include <dlfcn.h>
+#include <stdio.h>
+#include <stdlib.h>
+
+static int
+do_test (void)
+{
+  void *h = dlopen ("tst-tlsmod17b.so", RTLD_LAZY);
+  if (h == NULL)
+    {
+      puts ("unexpectedly failed to open tst-tlsmod17b.so");
+      exit (1);
+    }
+
+  int (*fp) (void) = (int (*) (void)) dlsym (h, "tlsmod17b");
+  if (fp == NULL)
+    {
+      puts ("cannot find tlsmod17b");
+      exit (1);
+    }
+
+  if (fp ())
+    exit (1);
+
+  return 0;
+}
+
+#define TEST_FUNCTION do_test ()
+#include "../test-skeleton.c"
diff --git a/ap/build/uClibc/test/tls/tst-tls18.c b/ap/build/uClibc/test/tls/tst-tls18.c
new file mode 100644
index 0000000..00dcdff
--- /dev/null
+++ b/ap/build/uClibc/test/tls/tst-tls18.c
@@ -0,0 +1,38 @@
+#include <dlfcn.h>
+#include <stdio.h>
+#include <stdlib.h>
+
+static int
+do_test (void)
+{
+  char modname[sizeof "tst-tlsmod18aXX.so"];
+  void *h[20];
+  for (int i = 0; i < 20; i++)
+    {
+      snprintf (modname, sizeof modname, "tst-tlsmod18a%d.so", i);
+      h[i] = dlopen (modname, RTLD_LAZY);
+      if (h[i] == NULL)
+	{
+	  printf ("unexpectedly failed to open %s", modname);
+	  exit (1);
+	}
+    }
+
+  for (int i = 0; i < 20; i++)
+    {
+      int (*fp) (void) = (int (*) (void)) dlsym (h[i], "test");
+      if (fp == NULL)
+	{
+	  printf ("cannot find test in tst-tlsmod18a%d.so", i);
+	  exit (1);
+	}
+
+      if (fp ())
+	exit (1);
+    }
+
+  return 0;
+}
+
+#define TEST_FUNCTION do_test ()
+#include "../test-skeleton.c"
diff --git a/ap/build/uClibc/test/tls/tst-tls2-static.c b/ap/build/uClibc/test/tls/tst-tls2-static.c
new file mode 100644
index 0000000..55ffa57
--- /dev/null
+++ b/ap/build/uClibc/test/tls/tst-tls2-static.c
@@ -0,0 +1 @@
+#include "tst-tls2.c"
diff --git a/ap/build/uClibc/test/tls/tst-tls2.c b/ap/build/uClibc/test/tls/tst-tls2.c
new file mode 100644
index 0000000..4174899
--- /dev/null
+++ b/ap/build/uClibc/test/tls/tst-tls2.c
@@ -0,0 +1,91 @@
+/* glibc test for TLS in ld.so.  */
+#include <stdio.h>
+
+#include <tls.h>
+
+#ifdef USE_TLS
+# include "tls-macros.h"
+
+
+/* Two 'int' variables in TLS.  */
+VAR_INT_DEF(foo);
+VAR_INT_DEF(bar);
+#endif
+
+
+#define TEST_FUNCTION do_test ()
+static int
+do_test (void)
+{
+#ifdef USE_TLS
+  int result = 0;
+  int *ap, *bp;
+
+
+  /* Set the variable using the local exec model.  */
+  puts ("set bar to 1 (LE)");
+  ap = TLS_LE (bar);
+  *ap = 1;
+
+
+  /* Get variables using initial exec model.  */
+  fputs ("get sum of foo and bar (IE)", stdout);
+  ap = TLS_IE (foo);
+  bp = TLS_IE (bar);
+  printf (" = %d\n", *ap + *bp);
+  result |= *ap + *bp != 1;
+  if (*ap != 0)
+    {
+      printf ("foo = %d\n", *ap);
+      result = 1;
+    }
+  if (*bp != 1)
+    {
+      printf ("bar = %d\n", *bp);
+      result = 1;
+    }
+
+
+  /* Get variables using local dynamic model.  */
+  fputs ("get sum of foo and bar (LD)", stdout);
+  ap = TLS_LD (foo);
+  bp = TLS_LD (bar);
+  printf (" = %d\n", *ap + *bp);
+  result |= *ap + *bp != 1;
+  if (*ap != 0)
+    {
+      printf ("foo = %d\n", *ap);
+      result = 1;
+    }
+  if (*bp != 1)
+    {
+      printf ("bar = %d\n", *bp);
+      result = 1;
+    }
+
+
+  /* Get variables using generic dynamic model.  */
+  fputs ("get sum of foo and bar (GD)", stdout);
+  ap = TLS_GD (foo);
+  bp = TLS_GD (bar);
+  printf (" = %d\n", *ap + *bp);
+  result |= *ap + *bp != 1;
+  if (*ap != 0)
+    {
+      printf ("foo = %d\n", *ap);
+      result = 1;
+    }
+  if (*bp != 1)
+    {
+      printf ("bar = %d\n", *bp);
+      result = 1;
+    }
+
+  return result;
+#else
+  return 0;
+#endif
+}
+
+
+#include "../test-skeleton.c"
diff --git a/ap/build/uClibc/test/tls/tst-tls3.c b/ap/build/uClibc/test/tls/tst-tls3.c
new file mode 100644
index 0000000..84be435
--- /dev/null
+++ b/ap/build/uClibc/test/tls/tst-tls3.c
@@ -0,0 +1,76 @@
+/* glibc test for TLS in ld.so.  */
+#include <stdio.h>
+
+#include <tls.h>
+
+#ifdef USE_TLS
+# include "tls-macros.h"
+
+
+/* One define int variable, two externs.  */
+COMMON_INT_DECL(foo);
+VAR_INT_DECL(bar);
+VAR_INT_DEF(baz);
+#endif
+
+
+extern int in_dso (void);
+
+
+#define TEST_FUNCTION do_test ()
+static int
+do_test (void)
+{
+#ifdef USE_TLS
+  int result = 0;
+  int *ap, *bp, *cp;
+
+
+  /* Set the variable using the local exec model.  */
+  puts ("set baz to 3 (LE)");
+  ap = TLS_LE (baz);
+  *ap = 3;
+
+
+  /* Get variables using initial exec model.  */
+  puts ("set variables foo and bar (IE)");
+  ap = TLS_IE (foo);
+  *ap = 1;
+  bp = TLS_IE (bar);
+  *bp = 2;
+
+
+  /* Get variables using local dynamic model.  */
+  fputs ("get sum of foo, bar (GD) and baz (LD)", stdout);
+  ap = TLS_GD (foo);
+  bp = TLS_GD (bar);
+  cp = TLS_LD (baz);
+  printf (" = %d\n", *ap + *bp + *cp);
+  result |= *ap + *bp + *cp != 6;
+  if (*ap != 1)
+    {
+      printf ("foo = %d\n", *ap);
+      result = 1;
+    }
+  if (*bp != 2)
+    {
+      printf ("bar = %d\n", *bp);
+      result = 1;
+    }
+  if (*cp != 3)
+    {
+      printf ("baz = %d\n", *cp);
+      result = 1;
+    }
+
+
+  result |= in_dso ();
+
+  return result;
+#else
+  return 0;
+#endif
+}
+
+
+#include "../test-skeleton.c"
diff --git a/ap/build/uClibc/test/tls/tst-tls4.c b/ap/build/uClibc/test/tls/tst-tls4.c
new file mode 100644
index 0000000..f92ee53
--- /dev/null
+++ b/ap/build/uClibc/test/tls/tst-tls4.c
@@ -0,0 +1,56 @@
+#include <dlfcn.h>
+#include <stdio.h>
+#include <stdlib.h>
+
+#include <tls.h>
+
+
+#define TEST_FUNCTION do_test ()
+static int
+do_test (void)
+{
+#ifdef USE_TLS
+  static const char modname[] = "tst-tlsmod2.so";
+  int result = 0;
+  int *foop;
+  int (*fp) (int, int *);
+  void *h;
+
+  h = dlopen (modname, RTLD_LAZY);
+  if (h == NULL)
+    {
+      printf ("cannot open '%s': %s\n", modname, dlerror ());
+      exit (1);
+    }
+
+  fp = dlsym (h, "in_dso");
+  if (fp == NULL)
+    {
+      printf ("cannot get symbol 'in_dso': %s\n", dlerror ());
+      exit (1);
+    }
+
+  result |= fp (0, NULL);
+
+  foop = dlsym (h, "foo");
+  if (foop == NULL)
+    {
+      printf ("cannot get symbol 'foo' the second time: %s\n", dlerror ());
+      exit (1);
+    }
+  if (*foop != 16)
+    {
+      puts ("foo != 16");
+      result = 1;
+    }
+
+  dlclose (h);
+
+  return result;
+#else
+  return 0;
+#endif
+}
+
+
+#include "../test-skeleton.c"
diff --git a/ap/build/uClibc/test/tls/tst-tls5.c b/ap/build/uClibc/test/tls/tst-tls5.c
new file mode 100644
index 0000000..a571d2c
--- /dev/null
+++ b/ap/build/uClibc/test/tls/tst-tls5.c
@@ -0,0 +1,72 @@
+#include <dlfcn.h>
+#include <stdio.h>
+#include <stdlib.h>
+
+#include <tls.h>
+
+
+#define TEST_FUNCTION do_test ()
+static int
+do_test (void)
+{
+#ifdef USE_TLS
+  static const char modname[] = "tst-tlsmod2.so";
+  int result = 0;
+  int *foop;
+  int *foop2;
+  int (*fp) (int, int *);
+  void *h;
+
+  h = dlopen (modname, RTLD_LAZY);
+  if (h == NULL)
+    {
+      printf ("cannot open '%s': %s\n", modname, dlerror ());
+      exit (1);
+    }
+
+  foop = dlsym (h, "foo");
+  if (foop == NULL)
+    {
+      printf ("cannot get symbol 'foo': %s\n", dlerror ());
+      exit (1);
+    }
+
+  *foop = 42;
+
+  fp = dlsym (h, "in_dso");
+  if (fp == NULL)
+    {
+      printf ("cannot get symbol 'in_dso': %s\n", dlerror ());
+      exit (1);
+    }
+
+  result |= fp (42, foop);
+
+  foop2 = dlsym (h, "foo");
+  if (foop2 == NULL)
+    {
+      printf ("cannot get symbol 'foo' the second time: %s\n", dlerror ());
+      exit (1);
+    }
+
+  if (foop != foop2)
+    {
+      puts ("address of 'foo' different the second time");
+      result = 1;
+    }
+  else if (*foop != 16)
+    {
+      puts ("foo != 16");
+      result = 1;
+    }
+
+  dlclose (h);
+
+  return result;
+#else
+  return 0;
+#endif
+}
+
+
+#include "../test-skeleton.c"
diff --git a/ap/build/uClibc/test/tls/tst-tls6.c b/ap/build/uClibc/test/tls/tst-tls6.c
new file mode 100644
index 0000000..e692aca
--- /dev/null
+++ b/ap/build/uClibc/test/tls/tst-tls6.c
@@ -0,0 +1,108 @@
+#include <dlfcn.h>
+#include <stdio.h>
+#include <stdlib.h>
+
+#include <tls.h>
+#include <link.h>
+#ifdef __UCLIBC__
+#include "dl-elf.h"
+#include "dl-hash.h"
+#endif
+
+
+#define TEST_FUNCTION do_test ()
+static int
+do_test (void)
+{
+#ifdef USE_TLS
+  static const char modname[] = "tst-tlsmod2.so";
+  int result = 0;
+  int *foop;
+  int *foop2;
+  int (*fp) (int, int *);
+  void *h;
+  int i;
+  int modid = -1;
+
+  for (i = 0; i < 10; ++i)
+    {
+      h = dlopen (modname, RTLD_LAZY);
+      if (h == NULL)
+	{
+	  printf ("cannot open '%s': %s\n", modname, dlerror ());
+	  exit (1);
+	}
+
+      /* Dirty test code here: we peek into a private data structure.
+	 We make sure that the module gets assigned the same ID every
+	 time.  The value of the first round is used.  */
+#ifdef __UCLIBC__
+      if (modid == -1)
+	modid = ((struct link_map *)((struct dyn_elf *)h)->dyn)->l_tls_modid;
+      else if (((struct link_map *)((struct dyn_elf *)h)->dyn)->l_tls_modid
+        != (size_t) modid)
+	{
+	  printf ("round %d: modid now %zu, initially %d\n",
+		  i,
+		  ((struct link_map *)((struct dyn_elf *)h)->dyn)->l_tls_modid,
+		  modid);
+	  result = 1;
+	}
+#else
+      if (modid == -1)
+	modid = ((struct link_map *) h)->l_tls_modid;
+      else if (((struct link_map *) h)->l_tls_modid != modid)
+	{
+	  printf ("round %d: modid now %zd, initially %d\n",
+		  i, ((struct link_map *) h)->l_tls_modid, modid);
+	  result = 1;
+	}
+#endif
+
+      foop = dlsym (h, "foo");
+      if (foop == NULL)
+	{
+	  printf ("cannot get symbol 'foo': %s\n", dlerror ());
+	  exit (1);
+	}
+
+      *foop = 42 + i;
+
+      fp = dlsym (h, "in_dso");
+      if (fp == NULL)
+	{
+	  printf ("cannot get symbol 'in_dso': %s\n", dlerror ());
+	  exit (1);
+	}
+
+      result |= fp (42 + i, foop);
+
+      foop2 = dlsym (h, "foo");
+      if (foop2 == NULL)
+	{
+	  printf ("cannot get symbol 'foo' the second time: %s\n", dlerror ());
+	  exit (1);
+	}
+
+      if (foop != foop2)
+	{
+	  puts ("address of 'foo' different the second time");
+	  result = 1;
+	}
+      else if (*foop != 16)
+	{
+	  puts ("foo != 16");
+	  result = 1;
+	}
+
+      dlclose (h);
+    }
+
+  return result;
+#else
+  return 0;
+#endif
+}
+
+
+#include "../test-skeleton.c"
diff --git a/ap/build/uClibc/test/tls/tst-tls7.c b/ap/build/uClibc/test/tls/tst-tls7.c
new file mode 100644
index 0000000..41da270
--- /dev/null
+++ b/ap/build/uClibc/test/tls/tst-tls7.c
@@ -0,0 +1,79 @@
+#include <dlfcn.h>
+#include <stdio.h>
+#include <stdlib.h>
+
+#include <tls.h>
+#include <link.h>
+#ifdef __UCLIBC__
+#include "dl-elf.h"
+#include "dl-hash.h"
+#endif
+
+
+#define TEST_FUNCTION do_test ()
+static int
+do_test (void)
+{
+#ifdef USE_TLS
+  static const char modname[] = "tst-tlsmod3.so";
+  int result = 0;
+  int (*fp) (void);
+  void *h;
+  int i;
+  int modid = -1;
+
+  for (i = 0; i < 10; ++i)
+    {
+      h = dlopen (modname, RTLD_LAZY);
+      if (h == NULL)
+	{
+	  printf ("cannot open '%s': %s\n", modname, dlerror ());
+	  exit (1);
+	}
+
+      /* Dirty test code here: we peek into a private data structure.
+	 We make sure that the module gets assigned the same ID every
+	 time.  The value of the first round is used.  */
+#ifdef __UCLIBC__
+      if (modid == -1)
+	modid = ((struct link_map *)((struct dyn_elf *)h)->dyn)->l_tls_modid;
+      else if (((struct link_map *)((struct dyn_elf *)h)->dyn)->l_tls_modid
+        != (size_t) modid)
+	{
+	  printf ("round %d: modid now %zu, initially %d\n",
+		  i,
+		  ((struct link_map *)((struct dyn_elf *)h)->dyn)->l_tls_modid,
+		  modid);
+	  result = 1;
+	}
+#else
+      if (modid == -1)
+	modid = ((struct link_map *) h)->l_tls_modid;
+      else if (((struct link_map *) h)->l_tls_modid != (size_t) modid)
+	{
+	  printf ("round %d: modid now %zu, initially %d\n",
+		  i, ((struct link_map *) h)->l_tls_modid, modid);
+	  result = 1;
+	}
+#endif
+
+      fp = dlsym (h, "in_dso2");
+      if (fp == NULL)
+	{
+	  printf ("cannot get symbol 'in_dso2': %s\n", dlerror ());
+	  exit (1);
+	}
+
+      result |= fp ();
+
+      dlclose (h);
+    }
+
+  return result;
+#else
+  return 0;
+#endif
+}
+
+
+#include "../test-skeleton.c"
diff --git a/ap/build/uClibc/test/tls/tst-tls8.c b/ap/build/uClibc/test/tls/tst-tls8.c
new file mode 100644
index 0000000..2541609
--- /dev/null
+++ b/ap/build/uClibc/test/tls/tst-tls8.c
@@ -0,0 +1,230 @@
+#include <dlfcn.h>
+#include <stdio.h>
+#include <stdlib.h>
+
+#include <tls.h>
+#include <link.h>
+#ifdef __UCLIBC__
+#include "dl-elf.h"
+#include "dl-hash.h"
+#endif
+
+
+#define TEST_FUNCTION do_test ()
+static int
+do_test (void)
+{
+#ifdef USE_TLS
+  static const char modname1[] = "tst-tlsmod3.so";
+  static const char modname2[] = "tst-tlsmod4.so";
+  int result = 0;
+  int (*fp1) (void);
+  int (*fp2) (int, int *);
+  void *h1;
+  void *h2;
+  int i;
+  size_t modid1 = (size_t) -1;
+  size_t modid2 = (size_t) -1;
+  int *bazp;
+
+  for (i = 0; i < 10; ++i)
+    {
+      h1 = dlopen (modname1, RTLD_LAZY);
+      if (h1 == NULL)
+	{
+	  printf ("cannot open '%s': %s\n", modname1, dlerror ());
+	  exit (1);
+	}
+
+      /* Dirty test code here: we peek into a private data structure.
+	 We make sure that the module gets assigned the same ID every
+	 time.  The value of the first round is used.  */
+#ifdef __UCLIBC__
+      if (modid1 == (size_t) -1)
+	modid1 = ((struct link_map *)((struct dyn_elf *)h1)->dyn)->l_tls_modid;
+      else if (((struct link_map *)((struct dyn_elf *)h1)->dyn)->l_tls_modid
+        != (size_t) modid1)
+	{
+	  printf ("round %d: modid now %zd, initially %zd\n",
+		  i,
+		  ((struct link_map *)((struct dyn_elf *)h1)->dyn)->l_tls_modid,
+		  modid1);
+	  result = 1;
+	}
+#else
+      if (modid1 == (size_t) -1)
+	modid1 = ((struct link_map *) h1)->l_tls_modid;
+      else if (((struct link_map *) h1)->l_tls_modid != modid1)
+	{
+	  printf ("round %d: modid now %zd, initially %zd\n",
+		  i, ((struct link_map *) h1)->l_tls_modid, modid1);
+	  result = 1;
+	}
+#endif
+
+      fp1 = dlsym (h1, "in_dso2");
+      if (fp1 == NULL)
+	{
+	  printf ("cannot get symbol 'in_dso2' in %s\n", modname1);
+	  exit (1);
+	}
+
+      result |= fp1 ();
+
+
+
+      h2 = dlopen (modname2, RTLD_LAZY);
+      if (h2 == NULL)
+	{
+	  printf ("cannot open '%s': %s\n", modname2, dlerror ());
+	  exit (1);
+	}
+
+      /* Dirty test code here: we peek into a private data structure.
+	 We make sure that the module gets assigned the same ID every
+	 time.  The value of the first round is used.  */
+#ifdef __UCLIBC__
+      if (modid2 == (size_t) -1)
+	modid2 = ((struct link_map *)((struct dyn_elf *)h1)->dyn)->l_tls_modid;
+      else if (((struct link_map *)((struct dyn_elf *)h1)->dyn)->l_tls_modid
+        != (size_t) modid2)
+	{
+	  printf ("round %d: modid now %zd, initially %zd\n",
+		  i,
+		  ((struct link_map *)((struct dyn_elf *)h1)->dyn)->l_tls_modid,
+		  modid2);
+	  result = 1;
+	}
+#else
+      if (modid2 == (size_t) -1)
+	modid2 = ((struct link_map *) h1)->l_tls_modid;
+      else if (((struct link_map *) h1)->l_tls_modid != modid2)
+	{
+	  printf ("round %d: modid now %zd, initially %zd\n",
+		  i, ((struct link_map *) h1)->l_tls_modid, modid2);
+	  result = 1;
+	}
+#endif
+
+      bazp = dlsym (h2, "baz");
+      if (bazp == NULL)
+	{
+	  printf ("cannot get symbol 'baz' in %s\n", modname2);
+	  exit (1);
+	}
+
+      *bazp = 42 + i;
+
+      fp2 = dlsym (h2, "in_dso");
+      if (fp2 == NULL)
+	{
+	  printf ("cannot get symbol 'in_dso' in %s\n", modname2);
+	  exit (1);
+	}
+
+      result |= fp2 (42 + i, bazp);
+
+      dlclose (h1);
+      dlclose (h2);
+
+
+      h1 = dlopen (modname1, RTLD_LAZY);
+      if (h1 == NULL)
+	{
+	  printf ("cannot open '%s': %s\n", modname1, dlerror ());
+	  exit (1);
+	}
+
+      /* Dirty test code here: we peek into a private data structure.
+	 We make sure that the module gets assigned the same ID every
+	 time.  The value of the first round is used.  */
+#ifdef __UCLIBC__
+      if (((struct link_map *)((struct dyn_elf *)h1)->dyn)->l_tls_modid
+        != modid1)
+	{
+	  printf ("round %d: modid now %zd, initially %zd\n",
+		  i,
+		  ((struct link_map *)((struct dyn_elf *)h1)->dyn)->l_tls_modid,
+		  modid1);
+	  result = 1;
+	}
+#else
+      if (((struct link_map *) h1)->l_tls_modid != modid1)
+	{
+	  printf ("round %d: modid now %zd, initially %zd\n",
+		  i, ((struct link_map *) h1)->l_tls_modid, modid1);
+	  result = 1;
+	}
+#endif
+
+      fp1 = dlsym (h1, "in_dso2");
+      if (fp1 == NULL)
+	{
+	  printf ("cannot get symbol 'in_dso2' in %s\n", modname1);
+	  exit (1);
+	}
+
+      result |= fp1 ();
+
+
+
+      h2 = dlopen (modname2, RTLD_LAZY);
+      if (h2 == NULL)
+	{
+	  printf ("cannot open '%s': %s\n", modname2, dlerror ());
+	  exit (1);
+	}
+
+      /* Dirty test code here: we peek into a private data structure.
+	 We make sure that the module gets assigned the same ID every
+	 time.  The value of the first round is used.  */
+#ifdef __UCLIBC__
+      if (((struct link_map *)((struct dyn_elf *)h1)->dyn)->l_tls_modid
+        != modid2)
+	{
+	  printf ("round %d: modid now %zd, initially %zd\n",
+		  i,
+		  ((struct link_map *)((struct dyn_elf *)h1)->dyn)->l_tls_modid,
+		  modid2);
+	  result = 1;
+	}
+#else
+      if (((struct link_map *) h1)->l_tls_modid != modid2)
+	{
+	  printf ("round %d: modid now %zd, initially %zd\n",
+		  i, ((struct link_map *) h1)->l_tls_modid, modid2);
+	  result = 1;
+	}
+#endif
+
+      bazp = dlsym (h2, "baz");
+      if (bazp == NULL)
+	{
+	  printf ("cannot get symbol 'baz' in %s\n", modname2);
+	  exit (1);
+	}
+
+      *bazp = 62 + i;
+
+      fp2 = dlsym (h2, "in_dso");
+      if (fp2 == NULL)
+	{
+	  printf ("cannot get symbol 'in_dso' in %s\n", modname2);
+	  exit (1);
+	}
+
+      result |= fp2 (62 + i, bazp);
+
+      /* This time the dlclose calls are in reverse order.  */
+      dlclose (h2);
+      dlclose (h1);
+    }
+
+  return result;
+#else
+  return 0;
+#endif
+}
+
+
+#include "../test-skeleton.c"
diff --git a/ap/build/uClibc/test/tls/tst-tls9-static.c b/ap/build/uClibc/test/tls/tst-tls9-static.c
new file mode 100644
index 0000000..51812cc
--- /dev/null
+++ b/ap/build/uClibc/test/tls/tst-tls9-static.c
@@ -0,0 +1 @@
+#include "tst-tls9.c"
diff --git a/ap/build/uClibc/test/tls/tst-tls9.c b/ap/build/uClibc/test/tls/tst-tls9.c
new file mode 100644
index 0000000..e317696
--- /dev/null
+++ b/ap/build/uClibc/test/tls/tst-tls9.c
@@ -0,0 +1,42 @@
+#include <dlfcn.h>
+#include <stdio.h>
+#include <stdlib.h>
+
+#include <link.h>
+#include <tls.h>
+
+#define TEST_FUNCTION do_test ()
+static int
+do_test (void)
+{
+#ifdef USE_TLS
+  static const char modname1[] = "tst-tlsmod5.so";
+  static const char modname2[] = "tst-tlsmod6.so";
+  int result = 0;
+
+  void *h1 = dlopen (modname1, RTLD_LAZY);
+  if (h1 == NULL)
+    {
+      printf ("cannot open '%s': %s\n", modname1, dlerror ());
+      result = 1;
+    }
+  void *h2 = dlopen (modname2, RTLD_LAZY);
+  if (h2 == NULL)
+    {
+      printf ("cannot open '%s': %s\n", modname2, dlerror ());
+      result = 1;
+    }
+
+  if (h1 != NULL)
+    dlclose (h1);
+  if (h2 != NULL)
+    dlclose (h2);
+
+  return result;
+#else
+  return 0;
+#endif
+}
+
+
+#include "../test-skeleton.c"
diff --git a/ap/build/uClibc/test/tls/tst-tlsmod-at-ctor.c b/ap/build/uClibc/test/tls/tst-tlsmod-at-ctor.c
new file mode 100644
index 0000000..bd04b50
--- /dev/null
+++ b/ap/build/uClibc/test/tls/tst-tlsmod-at-ctor.c
@@ -0,0 +1,25 @@
+#include <stdio.h>
+#include <tls.h>
+
+#define TLS_VAR_INIT_VALUE 99
+
+#ifdef USE_TLS
+__thread int tls_var  __attribute__((tls_model("global-dynamic")));
+static __thread int local_tls_var __attribute__((tls_model("local-dynamic")));
+#endif
+
+void __attribute__((constructor)) libtls_ctor(void);
+void libtls_ctor(void)
+{
+	printf("libtls: constructor!\n");
+#ifdef USE_TLS
+	local_tls_var = TLS_VAR_INIT_VALUE;
+	tls_var = local_tls_var;
+#endif
+}
+
+void __attribute__((destructor)) libtls_dtor(void);
+void libtls_dtor(void)
+{
+	printf("libtls: destructor!\n");
+}
diff --git a/ap/build/uClibc/test/tls/tst-tlsmod1.c b/ap/build/uClibc/test/tls/tst-tlsmod1.c
new file mode 100644
index 0000000..b4954ca
--- /dev/null
+++ b/ap/build/uClibc/test/tls/tst-tlsmod1.c
@@ -0,0 +1,68 @@
+#include <stdio.h>
+
+#include <tls.h>
+
+#ifdef USE_TLS
+#include "tls-macros.h"
+
+
+/* One define int variable, two externs.  */
+COMMON_INT_DEF(foo);
+VAR_INT_DEF(bar);
+VAR_INT_DECL(baz);
+#endif
+
+extern int in_dso (void);
+
+int
+in_dso (void)
+{
+  int result = 0;
+#ifdef USE_TLS
+  int *ap, *bp, *cp;
+
+  /* Get variables using initial exec model.  */
+  fputs ("get sum of foo and bar (IE)", stdout);
+  __asm__ ("" ::: "memory");
+  ap = TLS_IE (foo);
+  bp = TLS_IE (bar);
+  printf (" = %d\n", *ap + *bp);
+  result |= *ap + *bp != 3;
+  if (*ap != 1)
+    {
+      printf ("foo = %d\n", *ap);
+      result = 1;
+    }
+  if (*bp != 2)
+    {
+      printf ("bar = %d\n", *bp);
+      result = 1;
+    }
+
+
+  /* Get variables using generic dynamic model.  */
+  fputs ("get sum of foo and bar and baz (GD)", stdout);
+  ap = TLS_GD (foo);
+  bp = TLS_GD (bar);
+  cp = TLS_GD (baz);
+  printf (" = %d\n", *ap + *bp + *cp);
+  result |= *ap + *bp + *cp != 6;
+  if (*ap != 1)
+    {
+      printf ("foo = %d\n", *ap);
+      result = 1;
+    }
+  if (*bp != 2)
+    {
+      printf ("bar = %d\n", *bp);
+      result = 1;
+    }
+  if (*cp != 3)
+    {
+      printf ("baz = %d\n", *cp);
+      result = 1;
+    }
+#endif
+
+  return result;
+}
diff --git a/ap/build/uClibc/test/tls/tst-tlsmod10.c b/ap/build/uClibc/test/tls/tst-tlsmod10.c
new file mode 100644
index 0000000..32e54f3
--- /dev/null
+++ b/ap/build/uClibc/test/tls/tst-tlsmod10.c
@@ -0,0 +1 @@
+#include "tst-tlsmod8.c"
diff --git a/ap/build/uClibc/test/tls/tst-tlsmod11.c b/ap/build/uClibc/test/tls/tst-tlsmod11.c
new file mode 100644
index 0000000..9938b57
--- /dev/null
+++ b/ap/build/uClibc/test/tls/tst-tlsmod11.c
@@ -0,0 +1,6 @@
+#include "tst-tls10.h"
+
+#ifdef USE_TLS__THREAD
+__thread struct A a1 = { 4, 5, 6 };
+__thread struct A a2 = { 7, 8, 9 };
+#endif
diff --git a/ap/build/uClibc/test/tls/tst-tlsmod12.c b/ap/build/uClibc/test/tls/tst-tlsmod12.c
new file mode 100644
index 0000000..4602709
--- /dev/null
+++ b/ap/build/uClibc/test/tls/tst-tlsmod12.c
@@ -0,0 +1,14 @@
+#include "tst-tls10.h"
+
+#ifdef USE_TLS__THREAD
+extern __thread struct A a2 __attribute__((tls_model("initial-exec")));
+
+void
+check1 (void)
+{
+  if (a1.a != 4 || a1.b != 5 || a1.c != 6)
+    abort ();
+  if (a2.a != 7 || a2.b != 8 || a2.c != 9)
+    abort ();
+}
+#endif
diff --git a/ap/build/uClibc/test/tls/tst-tlsmod13.c b/ap/build/uClibc/test/tls/tst-tlsmod13.c
new file mode 100644
index 0000000..beca89f
--- /dev/null
+++ b/ap/build/uClibc/test/tls/tst-tlsmod13.c
@@ -0,0 +1,14 @@
+#include <tls.h>
+
+#if defined USE_TLS && defined HAVE___THREAD \
+    && defined HAVE_TLS_MODEL_ATTRIBUTE
+__thread int a[2] __attribute__ ((tls_model ("initial-exec")));
+#else
+int a[2];
+#endif
+
+int
+foo (void)
+{
+  return a[0];
+}
diff --git a/ap/build/uClibc/test/tls/tst-tlsmod13a.c b/ap/build/uClibc/test/tls/tst-tlsmod13a.c
new file mode 100644
index 0000000..14b12b0
--- /dev/null
+++ b/ap/build/uClibc/test/tls/tst-tlsmod13a.c
@@ -0,0 +1,16 @@
+#include <tls.h>
+
+#if defined USE_TLS && defined HAVE___THREAD \
+    && defined HAVE_TLS_MODEL_ATTRIBUTE
+__thread int b[2] __attribute__ ((tls_model ("initial-exec")));
+#else
+int b[2];
+#endif
+
+extern int foo (void);
+
+int
+bar (void)
+{
+  return foo () + b[0];
+}
diff --git a/ap/build/uClibc/test/tls/tst-tlsmod14a.c b/ap/build/uClibc/test/tls/tst-tlsmod14a.c
new file mode 100644
index 0000000..0bb393d
--- /dev/null
+++ b/ap/build/uClibc/test/tls/tst-tlsmod14a.c
@@ -0,0 +1,41 @@
+#include <stdint.h>
+#include <stdio.h>
+
+#include <tls.h>
+
+#if USE_TLS && HAVE___THREAD
+
+#define AL 4096
+struct foo
+{
+  int i;
+} __attribute ((aligned (AL)));
+
+static __thread struct foo f;
+static struct foo g;
+
+
+#ifndef FCT
+# define FCT in_dso1
+#endif
+
+
+int
+FCT (void)
+{
+  puts (__func__);
+
+  int result = 0;
+
+  int fail = (((uintptr_t) &f) & (AL - 1)) != 0;
+  printf ("&f = %p %s\n", &f, fail ? "FAIL" : "OK");
+  result |= fail;
+
+  fail = (((uintptr_t) &g) & (AL - 1)) != 0;
+  printf ("&g = %p %s\n", &g, fail ? "FAIL" : "OK");
+  result |= fail;
+
+  return result;
+}
+
+#endif
diff --git a/ap/build/uClibc/test/tls/tst-tlsmod14b.c b/ap/build/uClibc/test/tls/tst-tlsmod14b.c
new file mode 100644
index 0000000..24d9cea
--- /dev/null
+++ b/ap/build/uClibc/test/tls/tst-tlsmod14b.c
@@ -0,0 +1,2 @@
+#define FCT in_dso2
+#include "tst-tlsmod14a.c"
diff --git a/ap/build/uClibc/test/tls/tst-tlsmod15a.c b/ap/build/uClibc/test/tls/tst-tlsmod15a.c
new file mode 100644
index 0000000..66c7071
--- /dev/null
+++ b/ap/build/uClibc/test/tls/tst-tlsmod15a.c
@@ -0,0 +1,6 @@
+extern int nonexistent_dummy_var;
+int *
+foo (void)
+{
+  return &nonexistent_dummy_var;
+}
diff --git a/ap/build/uClibc/test/tls/tst-tlsmod15b.c b/ap/build/uClibc/test/tls/tst-tlsmod15b.c
new file mode 100644
index 0000000..4f63eab
--- /dev/null
+++ b/ap/build/uClibc/test/tls/tst-tlsmod15b.c
@@ -0,0 +1,17 @@
+#include "tst-tls10.h"
+
+#ifdef USE_TLS__THREAD
+__thread int mod15b_var __attribute__((tls_model("initial-exec")));
+
+int
+in_dso (void)
+{
+  return mod15b_var;
+}
+#else
+int
+in_dso (void)
+{
+  return 0;
+}
+#endif
diff --git a/ap/build/uClibc/test/tls/tst-tlsmod16a.c b/ap/build/uClibc/test/tls/tst-tlsmod16a.c
new file mode 100644
index 0000000..847c809
--- /dev/null
+++ b/ap/build/uClibc/test/tls/tst-tlsmod16a.c
@@ -0,0 +1,7 @@
+#include <tls.h>
+
+#if defined HAVE___THREAD && defined HAVE_TLS_MODEL_ATTRIBUTE
+int __thread tlsvar;
+#else
+int tlsvar;
+#endif
diff --git a/ap/build/uClibc/test/tls/tst-tlsmod16b.c b/ap/build/uClibc/test/tls/tst-tlsmod16b.c
new file mode 100644
index 0000000..308e6ba
--- /dev/null
+++ b/ap/build/uClibc/test/tls/tst-tlsmod16b.c
@@ -0,0 +1,13 @@
+#include <tls.h>
+
+#if defined HAVE___THREAD && defined HAVE_TLS_MODEL_ATTRIBUTE
+extern __thread int tlsvar __attribute__((tls_model("initial-exec")));
+#else
+extern int tlsvar;
+#endif
+
+void *
+in_dso (void)
+{
+  return &tlsvar;
+}
diff --git a/ap/build/uClibc/test/tls/tst-tlsmod17a.c b/ap/build/uClibc/test/tls/tst-tlsmod17a.c
new file mode 100644
index 0000000..4d39650
--- /dev/null
+++ b/ap/build/uClibc/test/tls/tst-tlsmod17a.c
@@ -0,0 +1,23 @@
+#include <stdio.h>
+
+#ifndef N
+#define N 0
+#endif
+#define CONCAT1(s, n) s##n
+#define CONCAT(s, n) CONCAT1(s, n)
+
+__thread int CONCAT (v, N) = 4;
+
+int
+CONCAT (tlsmod17a, N) (void)
+{
+  int *p = &CONCAT (v, N);
+  /* GCC assumes &var is never NULL, add optimization barrier.  */
+  __asm__ __volatile__ ("" : "+r" (p));
+  if (p == NULL || *p != 4)
+    {
+      printf ("fail %d %p\n", N, p);
+      return 1;
+    }
+  return 0;
+}
diff --git a/ap/build/uClibc/test/tls/tst-tlsmod17b.c b/ap/build/uClibc/test/tls/tst-tlsmod17b.c
new file mode 100644
index 0000000..6178828
--- /dev/null
+++ b/ap/build/uClibc/test/tls/tst-tlsmod17b.c
@@ -0,0 +1,15 @@
+#define P(N) extern int tlsmod17a##N (void);
+#define PS P(0) P(1) P(2) P(3) P(4) P(5) P(6) P(7) P(8) P(9) \
+	   P(10) P(12) P(13) P(14) P(15) P(16) P(17) P(18) P(19)
+PS
+#undef P
+
+int
+tlsmod17b (void)
+{
+  int res = 0;
+#define P(N) res |= tlsmod17a##N ();
+  PS
+#undef P
+  return res;
+}
diff --git a/ap/build/uClibc/test/tls/tst-tlsmod18a.c b/ap/build/uClibc/test/tls/tst-tlsmod18a.c
new file mode 100644
index 0000000..e0ae65a
--- /dev/null
+++ b/ap/build/uClibc/test/tls/tst-tlsmod18a.c
@@ -0,0 +1,21 @@
+#include <stdio.h>
+
+#ifndef N
+# define N 0
+#endif
+
+static __thread int var = 4;
+
+int
+test (void)
+{
+  int *p = &var;
+  /* GCC assumes &var is never NULL, add optimization barrier.  */
+  __asm__ __volatile__ ("" : "+r" (p));
+  if (p == NULL || *p != 4)
+    {
+      printf ("fail %d %p\n", N, p);
+      return 1;
+    }
+  return 0;
+}
diff --git a/ap/build/uClibc/test/tls/tst-tlsmod2.c b/ap/build/uClibc/test/tls/tst-tlsmod2.c
new file mode 100644
index 0000000..4547c97
--- /dev/null
+++ b/ap/build/uClibc/test/tls/tst-tlsmod2.c
@@ -0,0 +1,38 @@
+#include <stdio.h>
+
+#include <tls.h>
+
+#ifdef USE_TLS
+#include "tls-macros.h"
+
+
+COMMON_INT_DEF(foo);
+
+
+int
+in_dso (int n, int *caller_foop)
+{
+  int *foop;
+  int result = 0;
+
+  puts ("foo");			/* Make sure PLT is used before macros.  */
+  __asm__ ("" ::: "memory");
+
+  foop = TLS_GD (foo);
+
+  if (caller_foop != NULL && foop != caller_foop)
+    {
+      printf ("callers address of foo differs: %p vs %p\n", caller_foop, foop);
+      result = 1;
+    }
+  else if (*foop != n)
+    {
+      printf ("foo != %d\n", n);
+      result = 1;
+    }
+
+  *foop = 16;
+
+  return result;
+}
+#endif
diff --git a/ap/build/uClibc/test/tls/tst-tlsmod3.c b/ap/build/uClibc/test/tls/tst-tlsmod3.c
new file mode 100644
index 0000000..12505f6
--- /dev/null
+++ b/ap/build/uClibc/test/tls/tst-tlsmod3.c
@@ -0,0 +1,41 @@
+#include <stdio.h>
+
+#include <tls.h>
+
+#ifdef USE_TLS
+# include "tls-macros.h"
+
+extern int in_dso (int n, int *caller_foop);
+
+COMMON_INT_DEF(comm_n);
+
+
+
+
+int
+in_dso2 (void)
+{
+  int *foop;
+  int result = 0;
+  static int n;
+  int *np;
+
+  puts ("foo");			/* Make sure PLT is used before macros.  */
+  __asm__ ("" ::: "memory");
+
+  foop = TLS_GD (foo);
+  np = TLS_GD (comm_n);
+
+  if (n != *np)
+    {
+      printf ("n = %d != comm_n = %d\n", n, *np);
+      result = 1;
+    }
+
+  result |= in_dso (*foop = 42 + n++, foop);
+
+  *foop = 16;
+
+  return result;
+}
+#endif
diff --git a/ap/build/uClibc/test/tls/tst-tlsmod4.c b/ap/build/uClibc/test/tls/tst-tlsmod4.c
new file mode 100644
index 0000000..4893cda
--- /dev/null
+++ b/ap/build/uClibc/test/tls/tst-tlsmod4.c
@@ -0,0 +1,38 @@
+#include <stdio.h>
+
+#include <tls.h>
+
+#ifdef USE_TLS
+# include "tls-macros.h"
+
+
+COMMON_INT_DEF(baz);
+
+
+int
+in_dso (int n, int *caller_bazp)
+{
+  int *bazp;
+  int result = 0;
+
+  puts ("foo");			/* Make sure PLT is used before macros.  */
+  __asm__ ("" ::: "memory");
+
+  bazp = TLS_GD (baz);
+
+  if (caller_bazp != NULL && bazp != caller_bazp)
+    {
+      printf ("callers address of baz differs: %p vs %p\n", caller_bazp, bazp);
+      result = 1;
+    }
+  else if (*bazp != n)
+    {
+      printf ("baz != %d\n", n);
+      result = 1;
+    }
+
+  *bazp = 16;
+
+  return result;
+}
+#endif
diff --git a/ap/build/uClibc/test/tls/tst-tlsmod5.c b/ap/build/uClibc/test/tls/tst-tlsmod5.c
new file mode 100644
index 0000000..2ec69e1
--- /dev/null
+++ b/ap/build/uClibc/test/tls/tst-tlsmod5.c
@@ -0,0 +1,7 @@
+#include <tls.h>
+
+#ifdef USE_TLS
+#include "tls-macros.h"
+
+COMMON_INT_DEF(foo);
+#endif
diff --git a/ap/build/uClibc/test/tls/tst-tlsmod6.c b/ap/build/uClibc/test/tls/tst-tlsmod6.c
new file mode 100644
index 0000000..0fda51b
--- /dev/null
+++ b/ap/build/uClibc/test/tls/tst-tlsmod6.c
@@ -0,0 +1,7 @@
+#include <tls.h>
+
+#ifdef USE_TLS
+#include "tls-macros.h"
+
+COMMON_INT_DEF(bar);
+#endif
diff --git a/ap/build/uClibc/test/tls/tst-tlsmod7.c b/ap/build/uClibc/test/tls/tst-tlsmod7.c
new file mode 100644
index 0000000..944b97f
--- /dev/null
+++ b/ap/build/uClibc/test/tls/tst-tlsmod7.c
@@ -0,0 +1,103 @@
+#include "tst-tls10.h"
+
+#ifdef USE_TLS__THREAD
+__thread int dummy __attribute__((visibility ("hidden"))) = 12;
+__thread struct A a1 = { 4, 5, 6 };
+__thread struct A a2 = { 7, 8, 9 };
+__thread struct A a3 __attribute__((tls_model("initial-exec")))
+  = { 10, 11, 12 };
+__thread struct A a4 __attribute__((tls_model("initial-exec")))
+  = { 13, 14, 15 };
+static __thread struct A local1 = { 16, 17, 18 };
+static __thread struct A local2 __attribute__((tls_model("initial-exec")))
+  = { 19, 20, 21 };
+
+void
+check1 (void)
+{
+  if (a1.a != 4 || a1.b != 5 || a1.c != 6)
+    abort ();
+  if (a2.a != 22 || a2.b != 23 || a2.c != 24)
+    abort ();
+  if (a3.a != 10 || a3.b != 11 || a3.c != 12)
+    abort ();
+  if (a4.a != 25 || a4.b != 26 || a4.c != 27)
+    abort ();
+  if (local1.a != 16 || local1.b != 17 || local1.c != 18)
+    abort ();
+  if (local2.a != 19 || local2.b != 20 || local2.c != 21)
+    abort ();
+}
+
+struct A *
+f1a (void)
+{
+  return &a1;
+}
+
+struct A *
+f2a (void)
+{
+  return &a2;
+}
+
+struct A *
+f3a (void)
+{
+  return &a3;
+}
+
+struct A *
+f4a (void)
+{
+  return &a4;
+}
+
+struct A *
+f5a (void)
+{
+  return &local1;
+}
+
+struct A *
+f6a (void)
+{
+  return &local2;
+}
+
+int
+f1b (void)
+{
+  return a1.a;
+}
+
+int
+f2b (void)
+{
+  return a2.b;
+}
+
+int
+f3b (void)
+{
+  return a3.c;
+}
+
+int
+f4b (void)
+{
+  return a4.a;
+}
+
+int
+f5b (void)
+{
+  return local1.b;
+}
+
+int
+f6b (void)
+{
+  return local2.c;
+}
+#endif
diff --git a/ap/build/uClibc/test/tls/tst-tlsmod8.c b/ap/build/uClibc/test/tls/tst-tlsmod8.c
new file mode 100644
index 0000000..c1822fc
--- /dev/null
+++ b/ap/build/uClibc/test/tls/tst-tlsmod8.c
@@ -0,0 +1,72 @@
+#include "tst-tls10.h"
+
+#ifdef USE_TLS__THREAD
+__thread long long dummy __attribute__((visibility ("hidden"))) = 12;
+__thread struct A a2 = { 22, 23, 24 };
+__thread struct A a4 __attribute__((tls_model("initial-exec")))
+  = { 25, 26, 27 };
+static __thread struct A local1 = { 28, 29, 30 };
+static __thread struct A local2 __attribute__((tls_model("initial-exec")))
+  = { 31, 32, 33 };
+
+void
+check2 (void)
+{
+  if (a2.a != 22 || a2.b != 23 || a2.c != 24)
+    abort ();
+  if (a4.a != 25 || a4.b != 26 || a4.c != 27)
+    abort ();
+  if (local1.a != 28 || local1.b != 29 || local1.c != 30)
+    abort ();
+  if (local2.a != 31 || local2.b != 32 || local2.c != 33)
+    abort ();
+}
+
+struct A *
+f7a (void)
+{
+  return &a2;
+}
+
+struct A *
+f8a (void)
+{
+  return &a4;
+}
+
+struct A *
+f9a (void)
+{
+  return &local1;
+}
+
+struct A *
+f10a (void)
+{
+  return &local2;
+}
+
+int
+f7b (void)
+{
+  return a2.b;
+}
+
+int
+f8b (void)
+{
+  return a4.a;
+}
+
+int
+f9b (void)
+{
+  return local1.b;
+}
+
+int
+f10b (void)
+{
+  return local2.c;
+}
+#endif
diff --git a/ap/build/uClibc/test/tls/tst-tlsmod9.c b/ap/build/uClibc/test/tls/tst-tlsmod9.c
new file mode 100644
index 0000000..e124144
--- /dev/null
+++ b/ap/build/uClibc/test/tls/tst-tlsmod9.c
@@ -0,0 +1,101 @@
+#include "tst-tls10.h"
+
+#ifdef USE_TLS__THREAD
+__thread int dummy __attribute__((visibility ("hidden"))) = 12;
+__thread struct A a1 = { 4, 5, 6 };
+__thread struct A a3 __attribute__((tls_model("initial-exec")))
+  = { 10, 11, 12 };
+extern __thread struct A a4 __attribute__((tls_model("initial-exec")));
+static __thread struct A local1 = { 16, 17, 18 };
+static __thread struct A local2 __attribute__((tls_model("initial-exec")))
+  = { 19, 20, 21 };
+
+void
+check1 (void)
+{
+  if (a1.a != 4 || a1.b != 5 || a1.c != 6)
+    abort ();
+  if (a2.a != 22 || a2.b != 23 || a2.c != 24)
+    abort ();
+  if (a3.a != 10 || a3.b != 11 || a3.c != 12)
+    abort ();
+  if (a4.a != 25 || a4.b != 26 || a4.c != 27)
+    abort ();
+  if (local1.a != 16 || local1.b != 17 || local1.c != 18)
+    abort ();
+  if (local2.a != 19 || local2.b != 20 || local2.c != 21)
+    abort ();
+}
+
+struct A *
+f1a (void)
+{
+  return &a1;
+}
+
+struct A *
+f2a (void)
+{
+  return &a2;
+}
+
+struct A *
+f3a (void)
+{
+  return &a3;
+}
+
+struct A *
+f4a (void)
+{
+  return &a4;
+}
+
+struct A *
+f5a (void)
+{
+  return &local1;
+}
+
+struct A *
+f6a (void)
+{
+  return &local2;
+}
+
+int
+f1b (void)
+{
+  return a1.a;
+}
+
+int
+f2b (void)
+{
+  return a2.b;
+}
+
+int
+f3b (void)
+{
+  return a3.c;
+}
+
+int
+f4b (void)
+{
+  return a4.a;
+}
+
+int
+f5b (void)
+{
+  return local1.b;
+}
+
+int
+f6b (void)
+{
+  return local2.c;
+}
+#endif
diff --git a/ap/build/uClibc/test/unistd/Makefile b/ap/build/uClibc/test/unistd/Makefile
new file mode 100644
index 0000000..0dbd52e
--- /dev/null
+++ b/ap/build/uClibc/test/unistd/Makefile
@@ -0,0 +1,7 @@
+# uClibc unistd tests
+# Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
+
+top_builddir=../../
+include ../Rules.mak
+-include Makefile.in
+include ../Test.mak
diff --git a/ap/build/uClibc/test/unistd/Makefile.in b/ap/build/uClibc/test/unistd/Makefile.in
new file mode 100644
index 0000000..c542f98
--- /dev/null
+++ b/ap/build/uClibc/test/unistd/Makefile.in
@@ -0,0 +1,23 @@
+# uClibc unistd tests
+# Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
+
+ifeq ($(UCLIBC_HAS_LFS),)
+TESTS_DISABLED := tst-preadwrite64
+endif
+OPTS_getopt      := -abcXXX -9
+OPTS_getopt_long := --add XXX --delete YYY --verbose
+ifeq ($(UCLIBC_HAS_GNU_GETOPT),y)
+OPTS_tstgetopt   := -a -b -cfoobar --required foobar --optional=bazbug --none random --col --color --colour
+else
+# reordering is not supported, behaves as if POSIXLY_CORRECT would be set
+OPTS_tstgetopt   := -a -b -cfoobar --required foobar --optional=bazbug --none --colou --color --colour random
+endif
+
+# getconf.c lives in utils/
+# Testsuite cannot currently be built with O= anyway, so hardcode path here
+getconf.c:
+	$(LN_S) ../../utils/$(@F) .
+EXTRA_CLEAN    += getconf.c
+TESTS_DISABLED += getconf
+CFLAGS_getconf = -DGETCONF_DIR='"$(CURDIR)"'
+shell_tst-getconf: getconf getconf_glibc
diff --git a/ap/build/uClibc/test/unistd/clone.c b/ap/build/uClibc/test/unistd/clone.c
new file mode 100644
index 0000000..ea7e6ac
--- /dev/null
+++ b/ap/build/uClibc/test/unistd/clone.c
@@ -0,0 +1,101 @@
+/* vi: set sw=4 ts=4: */
+/*
+ * clone test for uClibc
+ * Copyright (C) 2000-2006 by Erik Andersen <andersen@uclibc.org>
+ *
+ * Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
+ */
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <unistd.h>
+#include <signal.h>
+#include <sched.h>
+#include <sys/wait.h>
+#include "clone_cruft.h"
+
+#define GOT1     (1 << 1)
+#define GOT2     (1 << 2)
+#define GOT3     (1 << 3)
+#define ALLGOT   (GOT1|GOT2|GOT3)
+
+static void child_handler(int sig)
+{
+	printf("I got a SIGCHLD\n");
+}
+
+static int clone_main(void *arg)
+{
+	unsigned long input = (unsigned long)arg;
+	int secs = (input / 10) * 4;
+	printf("Clone got %lu, sleeping for %i secs\n", input, secs);
+	sleep(secs);
+	return input + 20;
+}
+
+int main(void)
+{
+	int clone1, clone2, clone3;
+	char clone1_stack[8192], clone2_stack[8192], clone3_stack[8192];
+	int status, nostatus, result, wpid;
+
+	signal(SIGCHLD, child_handler);
+
+	if ((clone1 = do_clone(clone_main, clone1_stack, 0, (void*)11)) == -1) {
+		perror("Clone 1 failed");
+		exit(-1);
+	}
+	if ((clone2 = do_clone(clone_main, clone2_stack, 0, (void*)22)) == -1) {
+		perror("Clone 2 failed");
+		exit(-2);
+	}
+	if ((clone3 = do_clone(clone_main, clone3_stack, 0, (void*)33)) == -1) {
+		perror("Clone 3 failed");
+		exit(-3);
+	}
+
+	sleep(1);
+	printf("Parent: waiting for the clones to die.\n");
+	nostatus = status = 0;
+	while (1) {
+		if ((wpid = waitpid(clone1, &result, WNOHANG|__WCLONE)) == -1)
+			nostatus |= GOT1;
+		if (wpid == clone1) {
+			status |= GOT1;
+			printf("Clone1 gave back %i\n", WEXITSTATUS(result));
+		}
+
+		if ((wpid = waitpid(clone2, &result, WNOHANG|__WCLONE)) == -1)
+			nostatus |= GOT2;
+		if (wpid == clone2) {
+			status |= GOT2;
+			printf("Clone2 gave back %i\n", WEXITSTATUS(result));
+		}
+
+		if ((wpid = waitpid(clone3, &result, WNOHANG|__WCLONE)) == -1)
+			nostatus |= GOT3;
+		if (wpid == clone3) {
+			status |= GOT3;
+			printf("Clone3 gave back %i\n", WEXITSTATUS(result));
+		}
+
+		if (status == ALLGOT || nostatus == ALLGOT)
+			break;
+	}
+
+	if (status == ALLGOT) {
+		printf("Clones exited.\nGoodbye.\n");
+		return EXIT_SUCCESS;
+	} else {
+		perror("Waiting for clones failed");
+		return EXIT_FAILURE;
+	}
+}
+
+/*
+Local Variables:
+c-file-style: "linux"
+c-basic-offset: 4
+tab-width: 4
+End:
+*/
diff --git a/ap/build/uClibc/test/unistd/clone_cruft.h b/ap/build/uClibc/test/unistd/clone_cruft.h
new file mode 100644
index 0000000..b6a395d
--- /dev/null
+++ b/ap/build/uClibc/test/unistd/clone_cruft.h
@@ -0,0 +1,24 @@
+/* because people like to make things difficult */
+
+#undef do_clone
+
+#define crappy_sizeof(s) (s == NULL ? 0 : sizeof(s))
+
+#if defined __ia64__
+
+extern int __clone2 (int (*__fn) (void *__arg), void *__child_stack_base,
+                     size_t __child_stack_size, int __flags, void *__arg, ...);
+# define do_clone(fn, stack, flags, arg) \
+	__clone2(fn, stack, crappy_sizeof(stack), flags, arg, NULL, NULL, NULL)
+
+#elif defined __hppa__
+
+# define do_clone(fn, stack, flags, arg) \
+	clone(fn, stack, flags, arg)
+
+#else
+
+# define do_clone(fn, stack, flags, arg) \
+	clone(fn, stack+crappy_sizeof(stack), flags, arg)
+
+#endif
diff --git a/ap/build/uClibc/test/unistd/errno.c b/ap/build/uClibc/test/unistd/errno.c
new file mode 100644
index 0000000..5d4fc72
--- /dev/null
+++ b/ap/build/uClibc/test/unistd/errno.c
@@ -0,0 +1,29 @@
+/* based originally on one the clone tests in the LTP */
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <errno.h>
+#include <sched.h>
+#include "clone_cruft.h"
+
+__attribute__ ((__noreturn__))
+static int child_fn(void *arg)
+{
+	fprintf(stderr, "in child_fn\n");
+	exit(1);
+}
+
+int main(void)
+{
+	int r_clone, ret_errno;
+
+	r_clone = do_clone(child_fn, NULL, 0, NULL);
+	ret_errno = errno;
+	if (ret_errno != EINVAL || r_clone != -1) {
+		fprintf(stderr, "clone: res=%d (wanted -1) errno=%d (wanted %d)\n",
+			r_clone, errno, EINVAL);
+		return 1;
+	}
+
+	return 0;
+}
diff --git a/ap/build/uClibc/test/unistd/exec-null.c b/ap/build/uClibc/test/unistd/exec-null.c
new file mode 100644
index 0000000..3df99f3
--- /dev/null
+++ b/ap/build/uClibc/test/unistd/exec-null.c
@@ -0,0 +1,13 @@
+/* make sure we handle argv[0] == NULL */
+
+#include <unistd.h>
+
+int main(int argc, char *argv[])
+{
+	if (argc == 0)
+		return 0;
+
+	char *exec_argv[1], *exec_envp[1];
+	exec_argv[0] = exec_envp[0] = NULL;
+	return execve("./exec-null", exec_argv, exec_envp);
+}
diff --git a/ap/build/uClibc/test/unistd/fork.c b/ap/build/uClibc/test/unistd/fork.c
new file mode 100644
index 0000000..6d132d6
--- /dev/null
+++ b/ap/build/uClibc/test/unistd/fork.c
@@ -0,0 +1,91 @@
+/* vi: set sw=4 ts=4: */
+/*
+ * fork test for uClibc
+ * Copyright (C) 2000-2006 by Erik Andersen <andersen@uclibc.org>
+ *
+ * Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
+ */
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <unistd.h>
+#include <signal.h>
+#include <sys/wait.h>
+
+#define GOT1	(1 << 1)
+#define GOT2	(1 << 2)
+#define GOT3	(1 << 3)
+
+#ifdef __ARCH_USE_MMU__
+
+static void child_handler(int sig)
+{
+	fprintf(stderr, "I got a SIGCHLD\n");
+}
+
+int main(void)
+{
+	pid_t pid1, pid2, pid3;
+	int status, result, wpid;
+
+	signal(SIGCHLD, child_handler);
+
+	if ((pid1 = fork()) == 0) {
+		fprintf(stderr, "The child process sleeps 2 seconds...\n");
+		sleep(4);
+		fprintf(stderr, "Child exiting.\n");
+		exit(-1);
+	}
+	if ((pid2 = fork()) == 0) {
+		fprintf(stderr, "The child process sleeps 3 seconds...\n");
+		sleep(3);
+		fprintf(stderr, "Child exiting.\n");
+		exit(-1);
+	}
+	if ((pid3 = fork()) == 0) {
+		fprintf(stderr, "The child process sleeps 4 seconds...\n");
+		sleep(2);
+		fprintf(stderr, "Child exiting.\n");
+		exit(-1);
+	}
+
+	fprintf(stderr, "Parent: waiting for the child to die.\n");
+	status = 0;
+	while (1) {
+		wpid = waitpid(pid1, &result, WNOHANG);
+		if (wpid == pid1)
+			status |= GOT1;
+
+		wpid = waitpid(pid2, &result, WNOHANG);
+		if (wpid == pid2)
+			status |= GOT2;
+
+		wpid = waitpid(pid3, &result, WNOHANG);
+		if (wpid == pid3)
+			status |= GOT3;
+
+		if (status == (GOT1 | GOT2 | GOT3))
+			break;
+	}
+
+	fprintf(stderr, "Child process exited.\nGoodbye.\n");
+	return EXIT_SUCCESS;
+}
+
+#else
+
+int main(void)
+{
+	printf("Skipping test on non-mmu host!\n");
+	return EXIT_SUCCESS;
+}
+
+#endif
+
+/*
+Local Variables:
+c-file-style: "linux"
+c-basic-offset: 4
+tab-width: 4
+End:
+*/
diff --git a/ap/build/uClibc/test/unistd/getcwd.c b/ap/build/uClibc/test/unistd/getcwd.c
new file mode 100644
index 0000000..bcecec7
--- /dev/null
+++ b/ap/build/uClibc/test/unistd/getcwd.c
@@ -0,0 +1,39 @@
+/* vi: set sw=4 ts=4: */
+/*
+ * fork test for uClibc
+ * Copyright (C) 2000-2006 by Erik Andersen <andersen@uclibc.org>
+ *
+ * Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
+ */
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <unistd.h>
+
+int main(void)
+{
+	char *foo;
+	char junk[12];
+	char crap[100];
+	foo = getcwd(NULL, 0);
+	printf("getcwd(NULL, 0)='%s'\n", foo);
+	if (foo) { free(foo); }
+	foo = getcwd(NULL, 100);
+	printf("\ngetcwd(NULL, 100)='%s'\n", foo);
+	if (foo) { free(foo); }
+	foo = getcwd(junk, sizeof(junk));
+	printf("\nchar junk[12];\n");
+	printf("getcwd(junk, sizeof(junk))='%s'\n", foo);
+	foo = getcwd(crap, sizeof(crap));
+	printf("\nchar crap[100];\n");
+	printf("getcwd(crap, sizeof(crap))='%s'\n", foo);
+	return EXIT_SUCCESS;
+}
+
+/*
+Local Variables:
+c-file-style: "linux"
+c-basic-offset: 4
+tab-width: 4
+End:
+*/
diff --git a/ap/build/uClibc/test/unistd/getopt.c b/ap/build/uClibc/test/unistd/getopt.c
new file mode 100644
index 0000000..401765c
--- /dev/null
+++ b/ap/build/uClibc/test/unistd/getopt.c
@@ -0,0 +1,69 @@
+/* Getopt tests */
+
+#include <stdio.h>
+#include <string.h>
+#include <stdlib.h>
+#include <getopt.h>
+
+
+int main (int argc, char **argv)
+{
+  int c;
+  int digit_optind = 0;
+
+  while (1)
+    {
+      int this_option_optind = optind ? optind : 1;
+
+      c = getopt (argc, argv, "abc:d:0123456789");
+      if (c == EOF)
+	break;
+
+      switch (c)
+	{
+	case '0':
+	case '1':
+	case '2':
+	case '3':
+	case '4':
+	case '5':
+	case '6':
+	case '7':
+	case '8':
+	case '9':
+	  if (digit_optind != 0 && digit_optind != this_option_optind)
+	    printf ("digits occur in two different argv-elements.\n");
+	  digit_optind = this_option_optind;
+	  printf ("option %c\n", c);
+	  break;
+
+	case 'a':
+	  printf ("option a\n");
+	  break;
+
+	case 'b':
+	  printf ("option b\n");
+	  break;
+
+	case 'c':
+	  printf ("option c with value `%s'\n", optarg);
+	  break;
+
+	case '?':
+	  break;
+
+	default:
+	  printf ("?? getopt returned character code 0%o ??\n", c);
+	}
+    }
+
+  if (optind < argc)
+    {
+      printf ("non-option ARGV-elements: ");
+      while (optind < argc)
+	printf ("%s ", argv[optind++]);
+      printf ("\n");
+    }
+  exit (0);
+}
+
diff --git a/ap/build/uClibc/test/unistd/getopt_long.c b/ap/build/uClibc/test/unistd/getopt_long.c
new file mode 100644
index 0000000..4064e22
--- /dev/null
+++ b/ap/build/uClibc/test/unistd/getopt_long.c
@@ -0,0 +1,93 @@
+/* Getopt tests */
+
+#include <stdio.h>
+#include <string.h>
+#include <stdlib.h>
+#include <getopt.h>
+
+
+int main (int argc, char **argv)
+{
+  int c;
+  int digit_optind = 0;
+
+  while (1)
+    {
+      int this_option_optind = optind ? optind : 1;
+      int option_index = 0;
+      static struct option long_options[] =
+      {
+	{"add", 1, 0, 0},
+	{"append", 0, 0, 0},
+	{"delete", 1, 0, 0},
+	{"verbose", 0, 0, 0},
+	{"create", 0, 0, 0},
+	{"file", 1, 0, 0},
+	{0, 0, 0, 0}
+      };
+
+      c = getopt_long (argc, argv, "abc:d:0123456789",
+		       long_options, &option_index);
+      if (c == EOF)
+	break;
+
+      switch (c)
+	{
+	case 0:
+	  printf ("option %s", long_options[option_index].name);
+	  if (optarg)
+	    printf (" with arg %s", optarg);
+	  printf ("\n");
+	  break;
+
+	case '0':
+	case '1':
+	case '2':
+	case '3':
+	case '4':
+	case '5':
+	case '6':
+	case '7':
+	case '8':
+	case '9':
+	  if (digit_optind != 0 && digit_optind != this_option_optind)
+	    printf ("digits occur in two different argv-elements.\n");
+	  digit_optind = this_option_optind;
+	  printf ("option %c\n", c);
+	  break;
+
+	case 'a':
+	  printf ("option a\n");
+	  break;
+
+	case 'b':
+	  printf ("option b\n");
+	  break;
+
+	case 'c':
+	  printf ("option c with value `%s'\n", optarg);
+	  break;
+
+	case 'd':
+	  printf ("option d with value `%s'\n", optarg);
+	  break;
+
+	case '?':
+	  break;
+
+	default:
+	  printf ("?? getopt returned character code 0%o ??\n", c);
+	}
+    }
+
+  if (optind < argc)
+    {
+      printf ("non-option ARGV-elements: ");
+      while (optind < argc)
+	printf ("%s ", argv[optind++]);
+      printf ("\n");
+    }
+
+  exit (0);
+}
+
diff --git a/ap/build/uClibc/test/unistd/tst-getconf.sh b/ap/build/uClibc/test/unistd/tst-getconf.sh
new file mode 100755
index 0000000..3a2aa4e
--- /dev/null
+++ b/ap/build/uClibc/test/unistd/tst-getconf.sh
@@ -0,0 +1,240 @@
+#! /bin/sh
+
+basedir="."
+
+# make sure to use the same locale everywhere.
+LC_ALL=C
+export LC_ALL
+LANG=C
+export LANG
+
+for suffix in _glibc ''
+do
+binary=$basedir/getconf$suffix
+logfile=$basedir/tst-getconf$suffix.out
+rm -f $logfile
+
+result=0
+while read name; do
+  case "$name" in
+  "#"*) continue;;
+  esac
+  echo -n "getconf $name: " >> $logfile
+  $binary "$name" 2>> $logfile >> $logfile
+  if test $? -ne 0; then
+    echo "*** $name FAILED" >> $logfile
+    result=1
+  fi
+done <<EOF
+AIO_LISTIO_MAX
+AIO_MAX
+AIO_PRIO_DELTA_MAX
+ARG_MAX
+ATEXIT_MAX
+BC_BASE_MAX
+BC_DIM_MAX
+BC_SCALE_MAX
+BC_STRING_MAX
+CHILD_MAX
+COLL_WEIGHTS_MAX
+DELAYTIMER_MAX
+EXPR_NEST_MAX
+HOST_NAME_MAX
+IOV_MAX
+LINE_MAX
+LOGIN_NAME_MAX
+NGROUPS_MAX
+MQ_OPEN_MAX
+MQ_PRIO_MAX
+OPEN_MAX
+_POSIX_ADVISORY_INFO
+_POSIX_BARRIERS
+_POSIX_ASYNCHRONOUS_IO
+_POSIX_BASE
+_POSIX_C_LANG_SUPPORT
+_POSIX_C_LANG_SUPPORT_R
+_POSIX_CLOCK_SELECTION
+_POSIX_CPUTIME
+_POSIX_DEVICE_IO
+_POSIX_DEVICE_SPECIFIC
+_POSIX_DEVICE_SPECIFIC_R
+_POSIX_FD_MGMT
+_POSIX_FIFO
+_POSIX_FILE_ATTRIBUTES
+_POSIX_FILE_LOCKING
+_POSIX_FILE_SYSTEM
+_POSIX_FSYNC
+_POSIX_JOB_CONTROL
+_POSIX_MAPPED_FILES
+_POSIX_MEMLOCK
+_POSIX_MEMLOCK_RANGE
+_POSIX_MEMORY_PROTECTION
+_POSIX_MESSAGE_PASSING
+_POSIX_MONOTONIC_CLOCK
+_POSIX_MULTI_PROCESS
+_POSIX_NETWORKING
+_POSIX_PIPE
+_POSIX_PRIORITIZED_IO
+_POSIX_PRIORITY_SCHEDULING
+_POSIX_READER_WRITER_LOCKS
+_POSIX_REALTIME_SIGNALS
+_POSIX_REGEXP
+_POSIX_SAVED_IDS
+_POSIX_SEMAPHORES
+_POSIX_SHARED_MEMORY_OBJECTS
+_POSIX_SHELL
+_POSIX_SIGNALS
+_POSIX_SINGLE_PROCESS
+_POSIX_SPAWN
+_POSIX_SPIN_LOCKS
+_POSIX_SPORADIC_SERVER
+_POSIX_SYNCHRONIZED_IO
+_POSIX_SYSTEM_DATABASE
+_POSIX_SYSTEM_DATABASE_R
+_POSIX_THREAD_ATTR_STACKADDR
+_POSIX_THREAD_ATTR_STACKSIZE
+_POSIX_THREAD_CPUTIME
+_POSIX_THREAD_PRIO_INHERIT
+_POSIX_THREAD_PRIO_PROTECT
+_POSIX_THREAD_PRIORITY_SCHEDULING
+_POSIX_THREAD_PROCESS_SHARED
+_POSIX_THREAD_SAFE_FUNCTIONS
+_POSIX_THREAD_SPORADIC_SERVER
+_POSIX_THREADS
+_POSIX_TIMEOUTS
+_POSIX_TIMERS
+_POSIX_TRACE
+_POSIX_TRACE_EVENT_FILTER
+_POSIX_TRACE_INHERIT
+_POSIX_TRACE_LOG
+_POSIX_TYPED_MEMORY_OBJECTS
+_POSIX_USER_GROUPS
+_POSIX_USER_GROUPS_R
+_POSIX_VERSION
+_POSIX_V7_ILP32_OFF32
+_POSIX_V7_ILP32_OFFBIG
+_POSIX_V7_LP64_OFF64
+_POSIX_V7_LPBIG_OFFBIG
+#_POSIX_V7_WIDTH_RESTRICTED_ENVS
+POSIX2_C_BIND
+POSIX2_C_DEV
+POSIX2_C_VERSION
+POSIX2_CHAR_TERM
+POSIX2_FORT_DEV
+POSIX2_FORT_RUN
+POSIX2_LOCALEDEF
+POSIX2_PBS
+POSIX2_PBS_ACCOUNTING
+POSIX2_PBS_LOCATE
+POSIX2_PBS_MESSAGE
+POSIX2_PBS_TRACK
+POSIX2_SW_DEV
+POSIX2_UPE
+POSIX2_VERSION
+_REGEX_VERSION
+PAGE_SIZE
+PAGESIZE
+PTHREAD_DESTRUCTOR_ITERATIONS
+PTHREAD_KEYS_MAX
+PTHREAD_STACK_MIN
+PTHREAD_THREADS_MAX
+RE_DUP_MAX
+RTSIG_MAX
+SEM_NSEMS_MAX
+SEM_VALUE_MAX
+SIGQUEUE_MAX
+STREAM_MAX
+SYMLOOP_MAX
+TIMER_MAX
+TTY_NAME_MAX
+TZNAME_MAX
+#_XBS5_ILP32_OFF32
+#_XBS5_ILP32_OFFBIG
+#_XBS5_LP64_OFF64
+#_XBS5_LPBIG_OFFBIG
+_XOPEN_CRYPT
+_XOPEN_ENH_I18N
+_XOPEN_LEGACY
+_XOPEN_REALTIME
+_XOPEN_REALTIME_THREADS
+_XOPEN_SHM
+_XOPEN_UNIX
+_XOPEN_VERSION
+_XOPEN_XCU_VERSION
+PATH
+#POSIX_V7_ILP32_OFF32_CFLAGS
+#POSIX_V7_ILP32_OFF32_LDFLAGS
+#POSIX_V7_ILP32_OFF32_LIBS
+#POSIX_V7_ILP32_OFF32_LINTFLAGS
+#POSIX_V7_ILP32_OFFBIG_CFLAGS
+#POSIX_V7_ILP32_OFFBIG_LDFLAGS
+#POSIX_V7_ILP32_OFFBIG_LIBS
+#POSIX_V7_ILP32_OFFBIG_LINTFLAGS
+#POSIX_V7_LP64_OFF64_CFLAGS
+#POSIX_V7_LP64_OFF64_LDFLAGS
+#POSIX_V7_LP64_OFF64_LIBS
+#POSIX_V7_LP64_OFF64_LINTFLAGS
+#POSIX_V7_LPBIG_OFFBIG_CFLAGS
+#POSIX_V7_LPBIG_OFFBIG_LDFLAGS
+#POSIX_V7_LPBIG_OFFBIG_LIBS
+#POSIX_V7_LPBIG_OFFBIG_LINTFLAGS
+#XBS5_ILP32_OFF32_CFLAGS
+#XBS5_ILP32_OFF32_LDFLAGS
+#XBS5_ILP32_OFF32_LIBS
+#XBS5_ILP32_OFF32_LINTFLAGS
+#XBS5_ILP32_OFFBIG_CFLAGS
+#XBS5_ILP32_OFFBIG_LDFLAGS
+#XBS5_ILP32_OFFBIG_LIBS
+#XBS5_ILP32_OFFBIG_LINTFLAGS
+#XBS5_LP64_OFF64_CFLAGS
+#XBS5_LP64_OFF64_LDFLAGS
+#XBS5_LP64_OFF64_LIBS
+#XBS5_LP64_OFF64_LINTFLAGS
+#XBS5_LPBIG_OFFBIG_CFLAGS
+#XBS5_LPBIG_OFFBIG_LDFLAGS
+#XBS5_LPBIG_OFFBIG_LIBS
+#XBS5_LPBIG_OFFBIG_LINTFLAGS
+_NPROCESSORS_ONLN
+_NPROCESSORS_CONF
+EOF
+
+while read name; do
+  echo -n "getconf $name /: " >> $logfile
+  $binary "$name" / 2>> $logfile >> $logfile
+  if test $? -ne 0; then
+    echo "*** $name FAILED" >> $logfile
+    result=1
+  fi
+done <<EOF
+FILESIZEBITS
+LINK_MAX
+MAX_CANON
+MAX_INPUT
+NAME_MAX
+PATH_MAX
+PIPE_BUF
+POSIX_ALLOC_SIZE_MIN
+POSIX_REC_INCR_XFER_SIZE
+POSIX_REC_MAX_XFER_SIZE
+POSIX_REC_MIN_XFER_SIZE
+POSIX_REC_XFER_ALIGN
+SYMLINK_MAX
+_POSIX_CHOWN_RESTRICTED
+_POSIX_NO_TRUNC
+_POSIX_VDISABLE
+_POSIX_ASYNC_IO
+_POSIX_PRIO_IO
+_POSIX_SYNC_IO
+EOF
+
+done
+exit $result
+
+# Preserve executable bits for this shell script.
+Local Variables:
+eval:(defun frobme () (set-file-modes buffer-file-name file-mode))
+eval:(make-local-variable 'file-mode)
+eval:(setq file-mode (file-modes (buffer-file-name)))
+eval:(make-local-variable 'after-save-hook)
+eval:(add-hook 'after-save-hook 'frobme)
+End:
diff --git a/ap/build/uClibc/test/unistd/tst-preadwrite.c b/ap/build/uClibc/test/unistd/tst-preadwrite.c
new file mode 100644
index 0000000..4aca98a
--- /dev/null
+++ b/ap/build/uClibc/test/unistd/tst-preadwrite.c
@@ -0,0 +1,105 @@
+/* Tests for pread and pwrite.
+   Copyright (C) 1998, 2000 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+   Contributed by Ulrich Drepper <drepper@cygnus.com>, 1998.
+
+   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 <errno.h>
+#include <error.h>
+#include <string.h>
+#include <unistd.h>
+
+
+/* Allow testing of the 64-bit versions as well.  */
+#ifndef PREAD
+# define PREAD pread
+# define PWRITE pwrite
+#endif
+
+#define STRINGIFY(s) STRINGIFY2 (s)
+#define STRINGIFY2(s) #s
+
+/* Prototype for our test function.  */
+extern void do_prepare (int argc, char *argv[]);
+extern int do_test (int argc, char *argv[]);
+
+/* We have a preparation function.  */
+#define PREPARE do_prepare
+
+/* We might need a bit longer timeout.  */
+#define TIMEOUT 20 /* sec */
+
+/* This defines the `main' function and some more.  */
+#include "../test-skeleton.c"
+
+/* These are for the temporary file we generate.  */
+char *name;
+int fd;
+
+void
+do_prepare (int argc, char *argv[])
+{
+   char name_len;
+
+#define FNAME FNAME2(TRUNCATE)
+#define FNAME2(s) "/" STRINGIFY(s) "XXXXXX"
+
+   name_len = strlen (test_dir);
+   name = malloc (name_len + sizeof (FNAME));
+   if (name == NULL)
+     error (EXIT_FAILURE, errno, "cannot allocate file name");
+   mempcpy (mempcpy (name, test_dir, name_len), FNAME, sizeof (FNAME));
+   add_temp_file (name);
+
+   /* Open our test file.   */
+   fd = mkstemp (name);
+   if (fd == -1)
+     error (EXIT_FAILURE, errno, "cannot open test file `%s'", name);
+}
+
+
+int
+do_test (int argc, char *argv[])
+{
+  char buf[1000];
+  char res[1000];
+  int i;
+
+  memset (buf, '\0', sizeof (buf));
+  memset (res, '\xff', sizeof (res));
+
+  if (write (fd, buf, sizeof (buf)) != sizeof (buf))
+    error (EXIT_FAILURE, errno, "during write");
+
+  for (i = 100; i < 200; ++i)
+    buf[i] = i;
+  if (PWRITE (fd, buf + 100, 100, 100) != 100)
+    error (EXIT_FAILURE, errno, "during %s", STRINGIFY (PWRITE));
+
+  for (i = 450; i < 600; ++i)
+    buf[i] = i;
+  if (PWRITE (fd, buf + 450, 150, 450) != 150)
+    error (EXIT_FAILURE, errno, "during %s", STRINGIFY (PWRITE));
+
+  if (PREAD (fd, res, sizeof (buf) - 50, 50) != sizeof (buf) - 50)
+    error (EXIT_FAILURE, errno, "during %s", STRINGIFY (PREAD));
+
+  close (fd);
+  unlink (name);
+
+  return memcmp (buf + 50, res, sizeof (buf) - 50);
+}
diff --git a/ap/build/uClibc/test/unistd/tst-preadwrite64.c b/ap/build/uClibc/test/unistd/tst-preadwrite64.c
new file mode 100644
index 0000000..57098e8
--- /dev/null
+++ b/ap/build/uClibc/test/unistd/tst-preadwrite64.c
@@ -0,0 +1,24 @@
+/* Tests for pread64 and pwrite64.
+   Copyright (C) 2000 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+   Contributed by Ulrich Drepper <drepper@cygnus.com>, 1998.
+
+   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.  */
+
+#define PREAD pread64
+#define PWRITE pwrite64
+
+#include "tst-preadwrite.c"
diff --git a/ap/build/uClibc/test/unistd/tstgetopt.c b/ap/build/uClibc/test/unistd/tstgetopt.c
new file mode 100644
index 0000000..1c1263e
--- /dev/null
+++ b/ap/build/uClibc/test/unistd/tstgetopt.c
@@ -0,0 +1,76 @@
+#include <getopt.h>
+#include <stdio.h>
+#include <string.h>
+#include <unistd.h>
+
+int
+main (int argc, char **argv)
+{
+  static const struct option options[] =
+    {
+      {"required", required_argument, NULL, 'r'},
+      {"optional", optional_argument, NULL, 'o'},
+      {"none",     no_argument,       NULL, 'n'},
+      {"color",    no_argument,       NULL, 'C'},
+      {"colour",   no_argument,       NULL, 'C'},
+      {NULL,       0,                 NULL, 0 }
+    };
+
+  int aflag = 0;
+  int bflag = 0;
+  char *cvalue = NULL;
+  int Cflag = 0;
+  int nflag = 0;
+  int idx;
+  int c;
+  int result = 0;
+
+  while ((c = getopt_long (argc, argv, "abc:", options, NULL)) >= 0)
+    switch (c)
+      {
+      case 'a':
+	aflag = 1;
+	break;
+      case 'b':
+	bflag = 1;
+	break;
+      case 'c':
+	cvalue = optarg;
+	break;
+      case 'C':
+	++Cflag;
+	break;
+      case '?':
+	fputs ("Unknown option.\n", stderr);
+	return 1;
+      default:
+	fprintf (stderr, "This should never happen!\n");
+	return 1;
+
+      case 'r':
+	printf ("--required %s\n", optarg);
+	result |= strcmp (optarg, "foobar") != 0;
+	break;
+      case 'o':
+	printf ("--optional %s\n", optarg);
+	result |= optarg == NULL || strcmp (optarg, "bazbug") != 0;
+	break;
+      case 'n':
+	puts ("--none");
+	nflag = 1;
+	break;
+      }
+
+  printf ("aflag = %d, bflag = %d, cvalue = %s, Cflags = %d, nflag = %d\n",
+	  aflag, bflag, cvalue, Cflag, nflag);
+
+  result |= (aflag != 1 || bflag != 1 || cvalue == NULL
+	     || strcmp (cvalue, "foobar") != 0 || Cflag != 3 || nflag != 1);
+
+  for (idx = optind; idx < argc; idx++)
+    printf ("Non-option argument %s\n", argv[idx]);
+
+  result |= optind + 1 != argc || strcmp (argv[optind], "random") != 0;
+
+  return result;
+}
diff --git a/ap/build/uClibc/test/unistd/vfork.c b/ap/build/uClibc/test/unistd/vfork.c
new file mode 100644
index 0000000..2955839
--- /dev/null
+++ b/ap/build/uClibc/test/unistd/vfork.c
@@ -0,0 +1,53 @@
+/* vi: set sw=4 ts=4: */
+/*
+ * vfork test for uClibc
+ * Copyright (C) 2000-2006 by Erik Andersen <andersen@uclibc.org>
+ *
+ * Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
+ */
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <unistd.h>
+#include <sys/wait.h>
+#include <sys/types.h>
+
+
+int main(void)
+{
+	pid_t pid;
+	int status, wpid;
+	char *argv[] = {
+		"/bin/ls",
+		"-laF",
+		NULL,
+	};
+
+	clearenv();
+	if ((pid = vfork()) == 0) {
+		printf("Hi.  I'm the child process...\n");
+		execvp(argv[0], argv);
+		_exit(0);
+	}
+
+	printf("Hello.  I'm the parent process.\n");
+	while (1) {
+		wpid = wait(&status);
+		if (wpid > 0 && wpid != pid) {
+			continue;
+		}
+		if (wpid == pid)
+			break;
+	}
+
+	printf("Child process exited.\nGoodbye.\n");
+	return EXIT_SUCCESS;
+}
+
+/*
+Local Variables:
+c-file-style: "linux"
+c-basic-offset: 4
+tab-width: 4
+End:
+*/