In accordance with "build one to throw away, you will anyway (tm)",
throw away the old signals simulation and more or less start again
from scratch.  vg_signals.c is nearly a complete rewrite.  In fact
this is now the third generation of the signals simulation.

The purpose of this is to properly support signals in threads -- a
nightmare combination.  pthread_sigmask, pthread_kill and sigwait
are now alledged to work as POSIX requires.

In the process, throw away confusing and conceptually muddled old
implementation and replace with something which is more verbose but
conceptually cleaner, simpler and easier to argue is correct.

* When the client does sigaction/sigprocmask et al, the resulting
  changes are stored verbatim in SCSS -- the Static Client Signal State.
  So SCSS is the state the client believes the kernel is in.

* Every time SCSS changes, we recalculate the state the kernel
  *should* be in so that our signal simulation works.  This is the
  SKSS -- Static Kernel Signal State.  The kernel state is then
  updated accordingly.  By diffing the new and old SKSSs, the
  number of real system calls made is minimised.

* The dynamic state of the client's signals is stored in DCSS
  -- Dynamic Client Signal State.  This just records which signals
  are pending for which threads.

The big advantage of this scheme over the previous is that the SCSS ->
SKSS mapping is made explicit and gathered all in one place, rather
than spread out in a confusing way and done implicitly.  That makes it
all lot easier to decide if the mapping, which is really the heart of
the signals simulation, is correct or not.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@271 a5019735-40e9-0310-863c-91ae7b9d1cf9
diff --git a/coregrind/vg_kerneliface.h b/coregrind/vg_kerneliface.h
index b42ab44..45f8028 100644
--- a/coregrind/vg_kerneliface.h
+++ b/coregrind/vg_kerneliface.h
@@ -102,14 +102,14 @@
 
 #define VKI_SA_ONSTACK      0x08000000
 #define VKI_SA_RESTART      0x10000000
-#if 0
 #define VKI_SA_NOCLDSTOP    0x00000001
+#define VKI_SA_RESETHAND    0x80000000
+#define VKI_SA_ONESHOT      VKI_SA_RESETHAND
+#define VKI_SA_NODEFER      0x40000000
+#define VKI_SA_NOMASK       VKI_SA_NODEFER
+#if 0
 #define VKI_SA_NOCLDWAIT    0x00000002 /* not supported yet */
 #define VKI_SA_SIGINFO      0x00000004
-#define VKI_SA_NODEFER      0x40000000
-#define VKI_SA_RESETHAND    0x80000000
-#define VKI_SA_NOMASK       SA_NODEFER
-#define VKI_SA_ONESHOT      SA_RESETHAND
 #define VKI_SA_INTERRUPT    0x20000000 /* dummy -- ignored */
 #define VKI_SA_RESTORER     0x04000000
 #endif
@@ -138,6 +138,8 @@
 #define VKI_EINTR            4      /* Interrupted system call */
 #define VKI_EINVAL          22      /* Invalid argument */
 #define VKI_ENOMEM          12      /* Out of memory */
+#define	VKI_EFAULT          14      /* Bad address */
+#define VKI_ESRCH            3      /* No such process */
 
 #define VKI_EWOULDBLOCK     VKI_EAGAIN  /* Operation would block */
 #define VKI_EAGAIN          11      /* Try again */