Commit rewrite of semaphore handling to avoid having a fixed upper
limit. Patch courtesy of Aleksander Salwa <A.Salwa@osmosys.tv>.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@2336 a5019735-40e9-0310-863c-91ae7b9d1cf9
diff --git a/none/tests/Makefile.am b/none/tests/Makefile.am
index e8715e0..9bcfaea 100644
--- a/none/tests/Makefile.am
+++ b/none/tests/Makefile.am
@@ -45,6 +45,7 @@
 	resolv.stderr.exp resolv.stdout.exp resolv.vgtest \
 	seg_override.stderr.exp \
 	seg_override.stdout.exp seg_override.vgtest \
+	semlimit.stderr.exp semlimit.stdout.exp semlimit.vgtest \
 	susphello.stdout.exp susphello.stderr.exp susphello.vgtest \
 	sha1_test.stderr.exp sha1_test.vgtest \
 	shortpush.stderr.exp shortpush.vgtest \
@@ -61,8 +62,8 @@
 	cpuid dastest discard exec-sigmask floored fork fpu_lazy_eflags \
 	fucomip $(INSN_TESTS) \
 	int munmap_exe map_unmap mremap rcl_assert \
-	rcrl readline1 resolv seg_override sha1_test shortpush shorts smc1 \
-	susphello pth_blockedsig pushpopseg \
+	rcrl readline1 resolv seg_override semlimit sha1_test \
+	shortpush shorts smc1 susphello pth_blockedsig pushpopseg \
 	syscall-restart1 syscall-restart2 system \
 	coolo_sigaction gxx304 yield
 
@@ -108,6 +109,8 @@
 readline1_SOURCES 	= readline1.c
 resolv_SOURCES 		= resolv.c
 seg_override_SOURCES 	= seg_override.c
+semlimit_SOURCES	= semlimit.c
+semlimit_LDADD		= -lpthread
 smc1_SOURCES 		= smc1.c
 sha1_test_SOURCES 	= sha1_test.c
 shortpush_SOURCES 	= shortpush.c
diff --git a/none/tests/semlimit.c b/none/tests/semlimit.c
new file mode 100644
index 0000000..5bf3d3f
--- /dev/null
+++ b/none/tests/semlimit.c
@@ -0,0 +1,16 @@
+#include <semaphore.h>
+#include <stdlib.h>
+
+#define SEM_LIMIT 100
+
+int main(int argc, char **argv)
+{
+  sem_t s[SEM_LIMIT];
+  int i;
+  
+  for (i = 0; i < SEM_LIMIT; i++) {
+    sem_init(&s[i], 0, 0);
+  }
+
+  exit(0);
+}
diff --git a/none/tests/semlimit.stderr.exp b/none/tests/semlimit.stderr.exp
new file mode 100644
index 0000000..139597f
--- /dev/null
+++ b/none/tests/semlimit.stderr.exp
@@ -0,0 +1,2 @@
+
+
diff --git a/none/tests/semlimit.stdout.exp b/none/tests/semlimit.stdout.exp
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/none/tests/semlimit.stdout.exp
diff --git a/none/tests/semlimit.vgtest b/none/tests/semlimit.vgtest
new file mode 100644
index 0000000..f034a65
--- /dev/null
+++ b/none/tests/semlimit.vgtest
@@ -0,0 +1 @@
+prog: semlimit