Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
make sure that if semaphore are not usable, we detect it and complain as we should
[simgrid.git] / buildtools / Cmake / test_prog / prog_sem_open.c
diff --git a/buildtools/Cmake/test_prog/prog_sem_open.c b/buildtools/Cmake/test_prog/prog_sem_open.c
new file mode 100644 (file)
index 0000000..4679c32
--- /dev/null
@@ -0,0 +1,23 @@
+/* Copyright (c) 2010. The SimGrid Team.
+ * All rights reserved.                                                     */
+
+/* This program is free software; you can redistribute it and/or modify it
+ * under the terms of the license (GNU LGPL) which comes with this package. */
+
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <fcntl.h>
+#include <semaphore.h>
+#include <stdio.h>
+
+int main(void) {   
+   sem_t * s;
+   
+   s = sem_open("/0", O_CREAT, 0644, 10);
+   if (s == SEM_FAILED){
+//     printf("sem_open failed\n");
+     return 1;
+   }
+//   printf("sem_open succeeded\n");   
+   return 0;
+}