zte's code,first commit

Change-Id: I9a04da59e459a9bc0d67f101f700d9d7dc8d681b
diff --git a/ap/build/uClibc/libc/signal/Makefile b/ap/build/uClibc/libc/signal/Makefile
new file mode 100644
index 0000000..11f362a
--- /dev/null
+++ b/ap/build/uClibc/libc/signal/Makefile
@@ -0,0 +1,13 @@
+# 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_srcdir=../../
+top_builddir=../../
+all: objs
+include $(top_builddir)Rules.mak
+include Makefile.in
+include $(top_srcdir)Makerules
diff --git a/ap/build/uClibc/libc/signal/Makefile.in b/ap/build/uClibc/libc/signal/Makefile.in
new file mode 100644
index 0000000..1eaa9f0
--- /dev/null
+++ b/ap/build/uClibc/libc/signal/Makefile.in
@@ -0,0 +1,42 @@
+# Makefile for uClibc
+#
+# Copyright (C) 2000-2008 Erik Andersen <andersen@uclibc.org>
+#
+# Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
+#
+
+subdirs += libc/signal
+
+CSRC-y := allocrtsig.c killpg.c raise.c sigaction.c sigaddset.c sigandset.c \
+	sigblock.c sigdelset.c sigempty.c sigfillset.c siggetmask.c \
+	sigisempty.c sigismem.c sigjmp.c signal.c \
+	sigorset.c sigsetmask.c sigsetops.c sigwait.c
+CSRC-$(UCLIBC_HAS_OBSOLETE_BSD_SIGNAL) += \
+	sighold.c sigignore.c sigrelse.c sigset.c
+CSRC-$(UCLIBC_HAS_OBSOLETE_SYSV_SIGNAL) += sysv_signal.c
+CSRC-$(UCLIBC_SUSV4_LEGACY) += sigintr.c sigpause.c
+
+ifeq ($(UCLIBC_HAS_THREADS_NATIVE),y)
+CSRC-y:=$(filter-out raise.c,$(CSRC-y))
+endif
+
+ifneq ($(strip $(ARCH_OBJS)),)
+CSRC-y := $(filter-out $(notdir $(ARCH_OBJS:.o=.c)),$(CSRC-y))
+endif
+
+ifneq ($(UCLIBC_HAS_BACKTRACE),)
+CFLAGS-raise.c = -fasynchronous-unwind-tables
+endif
+
+SIGNAL_DIR := $(top_srcdir)libc/signal
+SIGNAL_OUT := $(top_builddir)libc/signal
+
+SIGNAL_SRC := $(patsubst %.c,$(SIGNAL_DIR)/%.c,$(CSRC-y))
+SIGNAL_OBJ := $(patsubst %.c,$(SIGNAL_OUT)/%.o,$(CSRC-y))
+
+libc-y += $(SIGNAL_OBJ)
+
+objclean-y += CLEAN_libc/signal
+
+CLEAN_libc/signal:
+	$(do_rm) $(addprefix $(SIGNAL_OUT)/*., o os)
diff --git a/ap/build/uClibc/libc/signal/allocrtsig.c b/ap/build/uClibc/libc/signal/allocrtsig.c
new file mode 100644
index 0000000..3c7d621
--- /dev/null
+++ b/ap/build/uClibc/libc/signal/allocrtsig.c
@@ -0,0 +1,66 @@
+/* Handle real-time signal allocation.
+   Copyright (C) 1997, 1998, 1999 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 <features.h>
+#include <signal.h>
+#include <sys/types.h>
+#include <sys/syscall.h>
+
+/* Only enable rt signals when it is supported at compile time */
+#ifndef __NR_rt_sigaction
+/* In these variables we keep track of the used variables.  If the
+   platform does not support any real-time signals we will define the
+   values to some unreasonable value which will signal failing of all
+   the functions below.  */
+static int current_rtmin = -1;
+static int current_rtmax = -1;
+#else
+# ifdef __UCLIBC_HAS_THREADS_NATIVE__
+static int current_rtmin = __SIGRTMIN + 2;
+# else
+static int current_rtmin = __SIGRTMIN;
+# endif
+static int current_rtmax = __SIGRTMAX;
+#endif
+
+/* Return number of available real-time signal with highest priority.  */
+int __libc_current_sigrtmin (void)
+{
+  return current_rtmin;
+}
+
+/* Return number of available real-time signal with lowest priority.  */
+int __libc_current_sigrtmax (void)
+{
+  return current_rtmax;
+}
+
+/* Allocate real-time signal with highest/lowest available
+   priority.  Please note that we don't use a lock since we assume
+   this function to be called at program start.  */
+int __libc_allocate_rtsig (int high);
+int __libc_allocate_rtsig (int high)
+{
+  if (current_rtmin == -1 || current_rtmin > current_rtmax)
+    /* We don't have anymore signal available.  */
+    return -1;
+
+  return high ? current_rtmin++ : current_rtmax--;
+}
diff --git a/ap/build/uClibc/libc/signal/killpg.c b/ap/build/uClibc/libc/signal/killpg.c
new file mode 100644
index 0000000..c2dc713
--- /dev/null
+++ b/ap/build/uClibc/libc/signal/killpg.c
@@ -0,0 +1,36 @@
+/* Copyright (C) 1991, 1993, 1996, 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 <errno.h>
+#include <signal.h>
+
+
+/* Send SIG to all processes in process group PGRP.
+   If PGRP is zero, send SIG to all processes in
+   the current process's process group.  */
+int
+killpg (__pid_t pgrp, int sig)
+{
+  if (pgrp < 0)
+    {
+      __set_errno (EINVAL);
+      return -1;
+    }
+
+  return kill (- pgrp, sig);
+}
diff --git a/ap/build/uClibc/libc/signal/raise.c b/ap/build/uClibc/libc/signal/raise.c
new file mode 100644
index 0000000..aed9b46
--- /dev/null
+++ b/ap/build/uClibc/libc/signal/raise.c
@@ -0,0 +1,14 @@
+/* Copyright (C) 1995,1996 Robert de Bath <rdebath@cix.compulink.co.uk>
+ * Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
+ */
+
+#include <unistd.h>
+#include <string.h>
+#include <signal.h>
+#include <sys/types.h>
+
+int raise(int signo)
+{
+	return kill(getpid(), signo);
+}
+libc_hidden_def(raise)
diff --git a/ap/build/uClibc/libc/signal/sigaction.c b/ap/build/uClibc/libc/signal/sigaction.c
new file mode 100644
index 0000000..c725c61
--- /dev/null
+++ b/ap/build/uClibc/libc/signal/sigaction.c
@@ -0,0 +1,92 @@
+/* Copyright (C) 1997-2000,2002,2003,2005,2006 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 <features.h>
+#include <errno.h>
+#include <signal.h>
+#include <string.h>
+#include <sys/syscall.h>
+
+#include <bits/kernel_sigaction.h>
+
+#ifndef LIBC_SIGACTION
+extern __typeof(sigaction) __libc_sigaction;
+#endif
+
+
+#if defined __NR_rt_sigaction
+
+/* If ACT is not NULL, change the action for SIG to *ACT.
+   If OACT is not NULL, put the old action for SIG in *OACT.  */
+int
+__libc_sigaction(int sig, const struct sigaction *act, struct sigaction *oact)
+{
+	/* NB: kernel (as of 2.6.25) will return EINVAL
+	 * if sizeof(act->sa_mask) does not match kernel's sizeof(sigset_t).
+	 * Try to catch this problem at uclibc build time:  */
+	struct BUG_sigset_size {
+		int BUG_sigset_size
+			[sizeof(act->sa_mask) == _NSIG / 8 ? 1 : -1];
+	};
+	return __syscall_rt_sigaction(sig, act, oact, sizeof(act->sa_mask));
+}
+
+#else
+
+/* If ACT is not NULL, change the action for SIG to *ACT.
+   If OACT is not NULL, put the old action for SIG in *OACT.  */
+int
+__libc_sigaction(int sig, const struct sigaction *act, struct sigaction *oact)
+{
+	int result;
+	struct old_kernel_sigaction kact, koact;
+
+	if (act) {
+		kact.k_sa_handler = act->sa_handler;
+		kact.sa_mask = act->sa_mask.__val[0];
+		kact.sa_flags = act->sa_flags;
+# ifdef HAVE_SA_RESTORER
+		kact.sa_restorer = act->sa_restorer;
+# endif
+	}
+	result = __syscall_sigaction(sig,
+			act ? &kact : NULL,
+			oact ? &koact : NULL);
+	if (oact && result >= 0) {
+		oact->sa_handler = koact.k_sa_handler;
+		oact->sa_mask.__val[0] = koact.sa_mask;
+		oact->sa_flags = koact.sa_flags;
+# ifdef HAVE_SA_RESTORER
+		oact->sa_restorer = koact.sa_restorer;
+# endif
+	}
+	return result;
+}
+
+#endif
+
+
+#ifndef LIBC_SIGACTION
+# ifndef __UCLIBC_HAS_THREADS__
+strong_alias(__libc_sigaction,sigaction)
+libc_hidden_def(sigaction)
+# else
+weak_alias(__libc_sigaction,sigaction)
+libc_hidden_weak(sigaction)
+# endif
+#endif
diff --git a/ap/build/uClibc/libc/signal/sigaddset.c b/ap/build/uClibc/libc/signal/sigaddset.c
new file mode 100644
index 0000000..7577d37
--- /dev/null
+++ b/ap/build/uClibc/libc/signal/sigaddset.c
@@ -0,0 +1,33 @@
+/* Copyright (C) 1991, 1996, 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 "sigsetops.h"
+
+/* Add SIGNO to SET.  */
+int
+sigaddset (sigset_t *set, int signo)
+{
+  if (set == NULL || signo <= 0 || signo >= NSIG)
+    {
+      __set_errno (EINVAL);
+      return -1;
+    }
+
+  return __sigaddset (set, signo);
+}
+libc_hidden_def(sigaddset)
diff --git a/ap/build/uClibc/libc/signal/sigandset.c b/ap/build/uClibc/libc/signal/sigandset.c
new file mode 100644
index 0000000..dcc37da
--- /dev/null
+++ b/ap/build/uClibc/libc/signal/sigandset.c
@@ -0,0 +1,34 @@
+/* Copyright (C) 1991, 1996, 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 <errno.h>
+#include <signal.h>
+#define __need_NULL
+#include <stddef.h>
+
+/* Combine sets LEFT and RIGHT by logical AND and place result in DEST.  */
+int sigandset (sigset_t *dest, const sigset_t *left, const sigset_t *right)
+{
+  if (dest == NULL || left == NULL || right == NULL)
+    {
+      __set_errno (EINVAL);
+      return -1;
+    }
+
+  return __sigandset (dest, left, right);
+}
diff --git a/ap/build/uClibc/libc/signal/sigblock.c b/ap/build/uClibc/libc/signal/sigblock.c
new file mode 100644
index 0000000..ad3acb0
--- /dev/null
+++ b/ap/build/uClibc/libc/signal/sigblock.c
@@ -0,0 +1,34 @@
+/* Copyright (C) 1991, 1994-1998, 2001-2002 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 of the License, or (at your option) any later version.
+
+   The GNU C Library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library; if not, write to the Free
+   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+   02111-1307 USA.  */
+
+#define __UCLIBC_HIDE_DEPRECATED__
+#include <errno.h>
+#include <signal.h>
+
+#include "sigset-cvt-mask.h"
+
+/* Block signals in MASK, returning the old mask.  */
+int sigblock (int mask)
+{
+  sigset_t set, oset;
+
+  sigset_set_old_mask (&set, mask);
+  sigprocmask (SIG_BLOCK, &set, &oset); /* can't fail */
+  return sigset_get_old_mask (&oset);
+}
+libc_hidden_def(sigblock)
diff --git a/ap/build/uClibc/libc/signal/sigdelset.c b/ap/build/uClibc/libc/signal/sigdelset.c
new file mode 100644
index 0000000..ff30303
--- /dev/null
+++ b/ap/build/uClibc/libc/signal/sigdelset.c
@@ -0,0 +1,32 @@
+/* Copyright (C) 1991, 1996, 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 "sigsetops.h"
+
+/* Add SIGNO to SET.  */
+int sigdelset (sigset_t *set, int signo)
+{
+  if (set == NULL || signo <= 0 || signo >= NSIG)
+    {
+      __set_errno (EINVAL);
+      return -1;
+    }
+
+  return __sigdelset (set, signo);
+}
+libc_hidden_def(sigdelset)
diff --git a/ap/build/uClibc/libc/signal/sigempty.c b/ap/build/uClibc/libc/signal/sigempty.c
new file mode 100644
index 0000000..b4f180b
--- /dev/null
+++ b/ap/build/uClibc/libc/signal/sigempty.c
@@ -0,0 +1,39 @@
+/* Copyright (C) 1991,96,97,2002 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 of the License, or (at your option) any later version.
+
+   The GNU C Library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library; if not, write to the Free
+   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+   02111-1307 USA.  */
+
+#include <errno.h>
+#include <signal.h>
+#include <string.h>
+
+
+/* Clear all signals from SET.  */
+int sigemptyset (sigset_t *set)
+{
+#if 0 /* is it really required by standards?! */
+  if (set == NULL)
+    {
+      __set_errno (EINVAL);
+      return -1;
+    }
+#endif
+
+  __sigemptyset (set);
+
+  return 0;
+}
+libc_hidden_def(sigemptyset)
diff --git a/ap/build/uClibc/libc/signal/sigfillset.c b/ap/build/uClibc/libc/signal/sigfillset.c
new file mode 100644
index 0000000..bebd5a6
--- /dev/null
+++ b/ap/build/uClibc/libc/signal/sigfillset.c
@@ -0,0 +1,52 @@
+/* Copyright (C) 1991,96,97,2002,2003,2004 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 of the License, or (at your option) any later version.
+
+   The GNU C Library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library; if not, write to the Free
+   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+   02111-1307 USA.  */
+
+#include <errno.h>
+#include <signal.h>
+#include <string.h>
+#ifdef __UCLIBC_HAS_THREADS_NATIVE__
+# include <pthreadP.h>	/* SIGCANCEL */
+#endif
+
+
+/* Set all signals in SET.  */
+int
+sigfillset (sigset_t *set)
+{
+#if 0 /* is it really required by standards?! */
+  if (set == NULL)
+    {
+      __set_errno (EINVAL);
+      return -1;
+    }
+#endif
+
+  __sigfillset (set);
+
+  /* If the implementation uses a cancellation signal don't set the bit.  */
+#ifdef SIGCANCEL
+  __sigdelset (set, SIGCANCEL);
+#endif
+  /* Likewise for the signal to implement setxid.  */
+#ifdef SIGSETXID
+  __sigdelset (set, SIGSETXID);
+#endif
+
+  return 0;
+}
+libc_hidden_def(sigfillset)
diff --git a/ap/build/uClibc/libc/signal/siggetmask.c b/ap/build/uClibc/libc/signal/siggetmask.c
new file mode 100644
index 0000000..3992a7a
--- /dev/null
+++ b/ap/build/uClibc/libc/signal/siggetmask.c
@@ -0,0 +1,31 @@
+/* siggetmask -- useless alias for `sigblock (0)' for old Linux compatibility.
+   Copyright (C) 1996 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.  */
+
+#define __UCLIBC_HIDE_DEPRECATED__
+#include <signal.h>
+
+
+int
+siggetmask (void)
+{
+  return sigblock (0);
+}
+
+link_warning (siggetmask,
+	      "warning: `siggetmask' is obsolete; `sigprocmask' is best")
diff --git a/ap/build/uClibc/libc/signal/sighold.c b/ap/build/uClibc/libc/signal/sighold.c
new file mode 100644
index 0000000..6a2e718
--- /dev/null
+++ b/ap/build/uClibc/libc/signal/sighold.c
@@ -0,0 +1,39 @@
+/* Add SIG to the calling process' signal mask.
+   Copyright (C) 1998, 2000, 2003 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 __need_NULL
+#include <stddef.h>
+#include <signal.h>
+
+
+int sighold (int sig)
+{
+  sigset_t set;
+
+  /* Retrieve current signal set.  */
+  sigprocmask (SIG_SETMASK, NULL, &set); /* can't fail */
+
+  /* Bound-check sig, add it to the set.  */
+  if (sigaddset (&set, sig) < 0)
+    return -1;
+
+  /* Set the new mask.  */
+  return sigprocmask (SIG_SETMASK, &set, NULL);
+}
diff --git a/ap/build/uClibc/libc/signal/sigignore.c b/ap/build/uClibc/libc/signal/sigignore.c
new file mode 100644
index 0000000..a74c105
--- /dev/null
+++ b/ap/build/uClibc/libc/signal/sigignore.c
@@ -0,0 +1,36 @@
+/* Set the disposition of SIG to SIG_IGN.
+   Copyright (C) 1998, 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>
+#define __need_NULL
+#include <stddef.h>
+#include <signal.h>
+#include <string.h>	/* For the real memset prototype.  */
+
+
+int sigignore (int sig)
+{
+  struct sigaction act;
+
+  memset(&act, 0, sizeof(act));
+  act.sa_handler = SIG_IGN;
+
+  return sigaction (sig, &act, NULL);
+}
diff --git a/ap/build/uClibc/libc/signal/sigintr.c b/ap/build/uClibc/libc/signal/sigintr.c
new file mode 100644
index 0000000..10567e9
--- /dev/null
+++ b/ap/build/uClibc/libc/signal/sigintr.c
@@ -0,0 +1,56 @@
+/* Copyright (C) 1992, 1994, 1996, 2002 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 of the License, or (at your option) any later version.
+
+   The GNU C Library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along 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 <stddef.h>
+#include <signal.h>
+#include <errno.h>
+
+
+/* If INTERRUPT is nonzero, make signal SIG interrupt system calls
+   (causing them to fail with EINTR); if INTERRUPT is zero, make system
+   calls be restarted after signal SIG.  */
+#ifdef SA_RESTART
+extern sigset_t _sigintr attribute_hidden;	/* Defined in signal.c.  */
+#endif
+
+int siginterrupt (int sig, int interrupt)
+{
+#ifdef	SA_RESTART
+  struct sigaction action;
+
+  /* Fails if sig is bad.  */
+  if (sigaction (sig, NULL, &action) < 0)
+    return -1;
+
+  if (interrupt)
+    {
+      __sigaddset (&_sigintr, sig);
+      action.sa_flags &= ~SA_RESTART;
+    }
+  else
+    {
+      __sigdelset (&_sigintr, sig);
+      action.sa_flags |= SA_RESTART;
+    }
+
+  return sigaction (sig, &action, NULL);
+#else
+  __set_errno (ENOSYS);
+  return -1;
+#endif
+}
diff --git a/ap/build/uClibc/libc/signal/sigisempty.c b/ap/build/uClibc/libc/signal/sigisempty.c
new file mode 100644
index 0000000..a25bb47
--- /dev/null
+++ b/ap/build/uClibc/libc/signal/sigisempty.c
@@ -0,0 +1,34 @@
+/* Copyright (C) 1991, 1996, 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 <errno.h>
+#include <signal.h>
+#define __need_NULL
+#include <stddef.h>
+
+/* Test whether SET is empty.  */
+int sigisemptyset (const sigset_t *set)
+{
+  if (set == NULL)
+    {
+      __set_errno (EINVAL);
+      return -1;
+    }
+
+    return __sigisemptyset (set);
+}
diff --git a/ap/build/uClibc/libc/signal/sigismem.c b/ap/build/uClibc/libc/signal/sigismem.c
new file mode 100644
index 0000000..b546f62
--- /dev/null
+++ b/ap/build/uClibc/libc/signal/sigismem.c
@@ -0,0 +1,31 @@
+/* Copyright (C) 1991,96,2002 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 of the License, or (at your option) any later version.
+
+   The GNU C Library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library; if not, write to the Free
+   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+   02111-1307 USA.  */
+
+#include "sigsetops.h"
+
+/* Return 1 if SIGNO is in SET, 0 if not.  */
+int sigismember (const sigset_t *set, int signo)
+{
+  if (set == NULL || signo <= 0 || signo >= NSIG)
+    {
+      __set_errno (EINVAL);
+      return -1;
+    }
+
+  return __sigismember (set, signo);
+}
diff --git a/ap/build/uClibc/libc/signal/sigjmp.c b/ap/build/uClibc/libc/signal/sigjmp.c
new file mode 100644
index 0000000..0dcbc8b
--- /dev/null
+++ b/ap/build/uClibc/libc/signal/sigjmp.c
@@ -0,0 +1,36 @@
+/* Copyright (C) 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 <stddef.h>
+#include <setjmp.h>
+#include <signal.h>
+#include <libc-internal.h>
+
+
+/* This function is called by the `sigsetjmp' macro
+   before doing a `__setjmp' on ENV[0].__jmpbuf.
+   Always return zero.  */
+
+int __sigjmp_save (sigjmp_buf env, int savemask) attribute_hidden;
+int __sigjmp_save (sigjmp_buf env, int savemask)
+{
+    env[0].__mask_was_saved = (savemask &&
+	    sigprocmask (SIG_BLOCK, NULL, &env[0].__saved_mask) == 0);
+
+    return 0;
+}
diff --git a/ap/build/uClibc/libc/signal/signal.c b/ap/build/uClibc/libc/signal/signal.c
new file mode 100644
index 0000000..644617c
--- /dev/null
+++ b/ap/build/uClibc/libc/signal/signal.c
@@ -0,0 +1,54 @@
+/* BSD-like signal function.
+   Copyright (C) 1991,1992,1996,1997,2000,2002,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 <errno.h>
+#include <signal.h>
+#include <string.h>	/* For the real memset prototype.  */
+
+sigset_t _sigintr attribute_hidden;		/* Set by siginterrupt.  */
+
+/* Set the handler for the signal SIG to HANDLER,
+   returning the old handler, or SIG_ERR on error.  */
+__sighandler_t
+signal (int sig, __sighandler_t handler)
+{
+  struct sigaction act, oact;
+
+  /* Check signal extents to protect __sigismember.  */
+  if (handler == SIG_ERR || sig < 1 || sig >= NSIG)
+    {
+      __set_errno (EINVAL);
+      return SIG_ERR;
+    }
+
+  act.sa_handler = handler;
+  __sigemptyset (&act.sa_mask);
+  __sigaddset (&act.sa_mask, sig);
+  act.sa_flags = __sigismember (&_sigintr, sig) ? 0 : SA_RESTART;
+  /* In Linux (as of 2.6.25), fails only if sig is SIGKILL or SIGSTOP */
+  if (sigaction (sig, &act, &oact) < 0)
+    return SIG_ERR;
+
+  return oact.sa_handler;
+}
+libc_hidden_def(signal)
+#ifdef __UCLIBC_SUSV3_LEGACY__
+strong_alias(signal,bsd_signal)
+#endif
diff --git a/ap/build/uClibc/libc/signal/sigorset.c b/ap/build/uClibc/libc/signal/sigorset.c
new file mode 100644
index 0000000..3588cc4
--- /dev/null
+++ b/ap/build/uClibc/libc/signal/sigorset.c
@@ -0,0 +1,34 @@
+/* Copyright (C) 1991, 1996, 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 <errno.h>
+#include <signal.h>
+#define __need_NULL
+#include <stddef.h>
+
+/* Combine sets LEFT and RIGHT by logical OR and place result in DEST.  */
+int sigorset (sigset_t *dest, const sigset_t *left, const sigset_t *right)
+{
+  if (dest == NULL || left == NULL || right == NULL)
+    {
+      __set_errno (EINVAL);
+      return -1;
+    }
+
+  return __sigorset (dest, left, right);
+}
diff --git a/ap/build/uClibc/libc/signal/sigpause.c b/ap/build/uClibc/libc/signal/sigpause.c
new file mode 100644
index 0000000..0856ba2
--- /dev/null
+++ b/ap/build/uClibc/libc/signal/sigpause.c
@@ -0,0 +1,77 @@
+/* Copyright (C) 1991,92,94-98,2000,2002,2003,2004
+   Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 of the License, or (at your option) any later version.
+
+   The GNU C Library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library; if not, write to the Free
+   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+   02111-1307 USA.  */
+
+#define __UCLIBC_HIDE_DEPRECATED__
+/* psm: need the BSD version of sigpause here */
+#include <errno.h>
+#define __FAVOR_BSD
+#include <signal.h>
+#include <stddef.h>		/* For NULL.  */
+#ifdef __UCLIBC_HAS_THREADS_NATIVE__
+#include <sysdep-cancel.h>
+#endif
+
+#include "sigset-cvt-mask.h"
+
+/* Set the mask of blocked signals to MASK,
+   wait for a signal to arrive, and then restore the mask.  */
+int __sigpause (int sig_or_mask, int is_sig)
+{
+  sigset_t set;
+
+  if (is_sig)
+    {
+      /* The modern X/Open implementation is requested.  */
+      sigprocmask (SIG_BLOCK, NULL, &set);
+      /* Bound-check sig_or_mask, remove it from the set.  */
+      if (sigdelset (&set, sig_or_mask) < 0)
+	return -1;
+    }
+  else
+    sigset_set_old_mask (&set, sig_or_mask);
+
+  /* Note the sigpause() is a cancellation point.  But since we call
+     sigsuspend() which itself is a cancellation point we do not have
+     to do anything here.  */
+  return sigsuspend (&set);
+}
+libc_hidden_def(__sigpause)
+
+#undef sigpause
+
+/* We have to provide a default version of this function since the
+   standards demand it.  The version which is a bit more reasonable is
+   the BSD version.  So make this the default.  */
+int sigpause (int mask)
+{
+#ifdef __UCLIBC_HAS_THREADS_NATIVE__
+  if (SINGLE_THREAD_P)
+    return __sigpause (mask, 0);
+
+  int oldtype = LIBC_CANCEL_ASYNC ();
+
+  int result = __sigpause (mask, 0);
+
+  LIBC_CANCEL_RESET (oldtype);
+
+  return result;
+#else
+  return __sigpause (mask, 0);
+#endif
+}
diff --git a/ap/build/uClibc/libc/signal/sigrelse.c b/ap/build/uClibc/libc/signal/sigrelse.c
new file mode 100644
index 0000000..07e7fdd
--- /dev/null
+++ b/ap/build/uClibc/libc/signal/sigrelse.c
@@ -0,0 +1,39 @@
+/* Remove SIG from the calling process' signal mask.
+   Copyright (C) 1998, 2000, 2003 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 __need_NULL
+#include <stddef.h>
+#include <signal.h>
+
+
+int sigrelse (int sig)
+{
+  sigset_t set;
+
+  /* Retrieve current signal set.  */
+  sigprocmask (SIG_SETMASK, NULL, &set); /* can't fail */
+
+  /* Bound-check sig, remove it from the set.  */
+  if (sigdelset (&set, sig) < 0)
+    return -1;
+
+  /* Set the new mask.  */
+  return sigprocmask (SIG_SETMASK, &set, NULL);
+}
diff --git a/ap/build/uClibc/libc/signal/sigset-cvt-mask.h b/ap/build/uClibc/libc/signal/sigset-cvt-mask.h
new file mode 100644
index 0000000..d4c2dc7
--- /dev/null
+++ b/ap/build/uClibc/libc/signal/sigset-cvt-mask.h
@@ -0,0 +1,38 @@
+/* Convert between lowlevel sigmask and libc representation of sigset_t.
+   Linux version.
+   Copyright (C) 1998, 2002 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+   Contributed by Joe Keane <jgk@jgk.org>.
+
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 of the License, or (at your option) any later version.
+
+   The GNU C Library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along 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 <string.h>
+
+static __inline__ void __attribute__ ((unused))
+sigset_set_old_mask (sigset_t *set, int mask)
+{
+  if (_SIGSET_NWORDS == 2) /* typical */
+    set->__val[1] = 0;
+  if (_SIGSET_NWORDS > 2)
+    memset(set, 0, sizeof(*set));
+  set->__val[0] = (unsigned int) mask;
+}
+
+static __inline__ int __attribute__ ((unused))
+sigset_get_old_mask (const sigset_t *set)
+{
+  return (unsigned int) set->__val[0];
+}
diff --git a/ap/build/uClibc/libc/signal/sigset.c b/ap/build/uClibc/libc/signal/sigset.c
new file mode 100644
index 0000000..b91ce80
--- /dev/null
+++ b/ap/build/uClibc/libc/signal/sigset.c
@@ -0,0 +1,67 @@
+/* Copyright (C) 1998, 2000, 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 <errno.h>
+#define __need_NULL
+#include <stddef.h>
+#include <signal.h>
+#include <string.h>	/* For the real memset prototype.  */
+
+
+/* Set the disposition for SIG.  */
+__sighandler_t sigset (int sig, __sighandler_t disp)
+{
+  struct sigaction act, oact;
+  sigset_t set;
+
+  /* Check signal extents to protect __sigismember.  */
+  if (disp == SIG_ERR || sig < 1 || sig >= NSIG)
+    {
+      __set_errno (EINVAL);
+      return SIG_ERR;
+    }
+
+#ifdef SIG_HOLD
+  /* Handle SIG_HOLD first.  */
+  if (disp == SIG_HOLD)
+    {
+      __sigemptyset (&set);
+      __sigaddset (&set, sig);
+
+      /* Add the signal set to the current signal mask.  */
+      sigprocmask (SIG_BLOCK, &set, NULL); /* can't fail */
+
+      return SIG_HOLD;
+    }
+#endif	/* SIG_HOLD */
+
+  memset(&act, 0, sizeof(act));
+  act.sa_handler = disp;
+  /* In Linux (as of 2.6.25), fails only if sig is SIGKILL or SIGSTOP */
+  if (sigaction (sig, &act, &oact) < 0)
+    return SIG_ERR;
+
+  /* Create an empty signal set. Add the specified signal.  */
+  __sigemptyset (&set);
+  __sigaddset (&set, sig);
+
+  /* Remove the signal set from the current signal mask.  */
+  sigprocmask (SIG_UNBLOCK, &set, NULL); /* can't fail */
+
+  return oact.sa_handler;
+}
diff --git a/ap/build/uClibc/libc/signal/sigsetmask.c b/ap/build/uClibc/libc/signal/sigsetmask.c
new file mode 100644
index 0000000..64c8ad6
--- /dev/null
+++ b/ap/build/uClibc/libc/signal/sigsetmask.c
@@ -0,0 +1,35 @@
+/* Copyright (C) 1991,1994-1997,2001-2002 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 of the License, or (at your option) any later version.
+
+   The GNU C Library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library; if not, write to the Free
+   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+   02111-1307 USA.  */
+
+#define __UCLIBC_HIDE_DEPRECATED__
+#include <errno.h>
+#include <signal.h>
+
+#include "sigset-cvt-mask.h"
+
+/* Set the mask of blocked signals to MASK, returning the old mask.  */
+int
+sigsetmask (int mask)
+{
+  sigset_t set, oset;
+
+  sigset_set_old_mask (&set, mask);
+  sigprocmask (SIG_SETMASK, &set, &oset); /* can't fail */
+  return sigset_get_old_mask (&oset);
+}
+libc_hidden_def(sigsetmask)
diff --git a/ap/build/uClibc/libc/signal/sigsetops.c b/ap/build/uClibc/libc/signal/sigsetops.c
new file mode 100644
index 0000000..fa5fe6a
--- /dev/null
+++ b/ap/build/uClibc/libc/signal/sigsetops.c
@@ -0,0 +1,20 @@
+/* Define the real-function versions of all inline functions
+   defined in signal.h (or bits/sigset.h).  */
+
+#include <features.h>
+
+#define __PROVIDE_OUT_OF_LINE_SIGSETFN
+#ifndef __USE_EXTERN_INLINES
+# define __USE_EXTERN_INLINES	1
+#endif
+
+#include <signal.h>
+
+/* Since we massaged signal.h into emitting non-inline function
+ * definitions, we need to finish PLT avoidance trick: */
+#undef __sigismember
+#undef __sigaddset
+#undef __sigdelset
+libc_hidden_def(__sigismember)
+libc_hidden_def(__sigaddset)
+libc_hidden_def(__sigdelset)
diff --git a/ap/build/uClibc/libc/signal/sigsetops.h b/ap/build/uClibc/libc/signal/sigsetops.h
new file mode 100644
index 0000000..52081c2
--- /dev/null
+++ b/ap/build/uClibc/libc/signal/sigsetops.h
@@ -0,0 +1,33 @@
+/* Copyright (C) 1991, 1995, 1996 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.  */
+
+/* Definitions relevant to functions that operate on `sigset_t's.  */
+
+#include <errno.h>
+#include <signal.h>
+#include <string.h>
+
+#define	BITS		(_NSIG - 1)
+#define	ELT(signo)	(((signo) - 1) / BITS)
+#define	MASK(signo)	(1 << (((signo) - 1) % BITS))
+
+#undef	sigemptyset
+#undef	sigfillset
+#undef	sigaddset
+#undef	sigdelset
+#undef	sigismember
diff --git a/ap/build/uClibc/libc/signal/sigwait.c b/ap/build/uClibc/libc/signal/sigwait.c
new file mode 100644
index 0000000..8fd7ea8
--- /dev/null
+++ b/ap/build/uClibc/libc/signal/sigwait.c
@@ -0,0 +1,167 @@
+/* vi: set sw=4 ts=4: */
+/* sigwait
+ *
+ * Copyright (C) 2006 by Steven J. Hill <sjhill@realitydiluted.com>
+ * Copyright (C) 2003-2005 by Erik Andersen <andersen@uclibc.org>
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * The GNU C Library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along 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 <string.h>
+#include <unistd.h>
+
+#ifdef __UCLIBC_HAS_THREADS_NATIVE__
+# include <sysdep-cancel.h>
+
+# ifdef __NR_rt_sigtimedwait
+
+/* Return any pending signal or wait for one for the given time.  */
+static int do_sigwait(const sigset_t *set, int *sig)
+{
+	int ret;
+
+#  ifdef SIGCANCEL
+	sigset_t tmpset;
+	if (set != NULL
+		&& (__builtin_expect (__sigismember (set, SIGCANCEL), 0)
+#   ifdef SIGSETXID
+		|| __builtin_expect (__sigismember (set, SIGSETXID), 0)
+#   endif
+		))
+	{
+		/* Create a temporary mask without the bit for SIGCANCEL set.  */
+		// We are not copying more than we have to.
+		memcpy(&tmpset, set, _NSIG / 8);
+		__sigdelset(&tmpset, SIGCANCEL);
+#   ifdef SIGSETXID
+		__sigdelset(&tmpset, SIGSETXID);
+#   endif
+		set = &tmpset;
+	}
+#  endif
+
+	/* XXX The size argument hopefully will have to be changed to the
+	   real size of the user-level sigset_t.  */
+	INTERNAL_SYSCALL_DECL(err);
+	do
+		ret = INTERNAL_SYSCALL (rt_sigtimedwait, err, 4, set, NULL,
+			NULL, _NSIG / 8);
+	while (INTERNAL_SYSCALL_ERROR_P (ret, err)
+		&& INTERNAL_SYSCALL_ERRNO (ret, err) == EINTR);
+	if (! INTERNAL_SYSCALL_ERROR_P (ret, err))
+	{
+		*sig = ret;
+		ret = 0;
+	}
+else
+	ret = INTERNAL_SYSCALL_ERRNO (ret, err);
+
+	return ret;
+}
+
+int sigwait (const sigset_t *set, int *sig)
+{
+	if(SINGLE_THREAD_P)
+		return do_sigwait(set, sig);
+
+	int oldtype = LIBC_CANCEL_ASYNC();
+
+	int result = do_sigwait(set, sig);
+
+	LIBC_CANCEL_RESET(oldtype);
+
+	return result;
+}
+# else /* __NR_rt_sigtimedwait */
+#  error We must have rt_sigtimedwait defined!!!
+# endif
+#else /* __UCLIBC_HAS_THREADS_NATIVE__ */
+
+# if defined __UCLIBC_HAS_REALTIME__
+
+int sigwait (const sigset_t *set, int *sig)
+{
+	int ret = 1;
+	if ((ret = sigwaitinfo(set, NULL)) != -1) {
+		*sig = ret;
+		return 0;
+	}
+	return 1;
+}
+
+# else /* __UCLIBC_HAS_REALTIME__ */
+/* variant without REALTIME extensions */
+
+static smallint was_sig; /* obviously not thread-safe */
+
+static void ignore_signal(int sig)
+{
+	was_sig = sig;
+}
+
+int sigwait (const sigset_t *set, int *sig)
+{
+  sigset_t tmp_mask;
+  struct sigaction saved[NSIG];
+  struct sigaction action;
+  int save_errno;
+  int this;
+
+  /* Prepare set.  */
+  __sigfillset (&tmp_mask);
+
+  /* Unblock all signals in the SET and register our nice handler.  */
+  action.sa_handler = ignore_signal;
+  action.sa_flags = 0;
+  __sigfillset (&action.sa_mask);       /* Block all signals for handler.  */
+
+  /* Make sure we recognize error conditions by setting WAS_SIG to a
+     value which does not describe a legal signal number.  */
+  was_sig = -1;
+
+  for (this = 1; this < NSIG; ++this)
+    if (__sigismember (set, this))
+      {
+        /* Unblock this signal.  */
+        __sigdelset (&tmp_mask, this);
+
+        /* Register temporary action handler.  */
+        /* In Linux (as of 2.6.25), fails only if sig is SIGKILL or SIGSTOP */
+        /* (so, will it work correctly if set has, say, SIGSTOP?) */
+        if (sigaction (this, &action, &saved[this]) != 0)
+          goto restore_handler;
+      }
+
+  /* Now we can wait for signals.  */
+  sigsuspend (&tmp_mask);
+
+ restore_handler:
+  save_errno = errno;
+
+  while (--this >= 1)
+    if (__sigismember (set, this))
+      /* We ignore errors here since we must restore all handlers.  */
+      sigaction (this, &saved[this], NULL);
+
+  __set_errno (save_errno);
+
+  /* Store the result and return.  */
+  *sig = was_sig;
+  return was_sig == -1 ? -1 : 0;
+}
+# endif /* __UCLIBC_HAS_REALTIME__ */
+#endif /* __UCLIBC_HAS_THREADS_NATIVE__ */
diff --git a/ap/build/uClibc/libc/signal/sysv_signal.c b/ap/build/uClibc/libc/signal/sysv_signal.c
new file mode 100644
index 0000000..a696a54
--- /dev/null
+++ b/ap/build/uClibc/libc/signal/sysv_signal.c
@@ -0,0 +1,57 @@
+/* Copyright (C) 1991, 1992, 1996, 1997, 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 <errno.h>
+#include <signal.h>
+#include <string.h>	/* For the real memset prototype.  */
+
+
+/* Tolerate non-threads versions of Posix */
+#ifndef SA_ONESHOT
+#define SA_ONESHOT 0
+#endif
+#ifndef SA_NOMASK
+#define SA_NOMASK 0
+#endif
+#ifndef SA_INTERRUPT
+#define SA_INTERRUPT 0
+#endif
+
+/* Set the handler for the signal SIG to HANDLER,
+   returning the old handler, or SIG_ERR on error.  */
+__sighandler_t __sysv_signal (int sig, __sighandler_t handler)
+{
+  struct sigaction act, oact;
+
+  /* Check signal extents to protect __sigismember.  */
+  if (handler == SIG_ERR || sig < 1 || sig >= NSIG)
+    {
+      __set_errno (EINVAL);
+      return SIG_ERR;
+    }
+
+  act.sa_handler = handler;
+  __sigemptyset (&act.sa_mask);
+  act.sa_flags = (SA_ONESHOT | SA_NOMASK | SA_INTERRUPT) & ~SA_RESTART;
+  /* In Linux (as of 2.6.25), fails only if sig is SIGKILL or SIGSTOP */
+  if (sigaction (sig, &act, &oact) < 0)
+    return SIG_ERR;
+
+  return oact.sa_handler;
+}
+strong_alias(__sysv_signal,sysv_signal)