summaryrefslogtreecommitdiff
path: root/lang/mono/files/patch-mono_handles_semdel.c
blob: 7ef7f2927b203a6c6d33d426147d67039f6cc473 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
--- /dev/null	Thu Jul  7 01:22:00 2005
+++ mono/handles/semdel.c	Thu Jul  7 01:27:26 2005
@@ -0,0 +1,34 @@
+#include <config.h>
+#include <glib.h>
+#include <errno.h>
+#include <sys/types.h>
+#include <sys/ipc.h>
+#include <sys/sem.h>
+
+#include <mono/io-layer/io-layer.h>
+
+/* We're digging into handle internals here... */
+#include <mono/io-layer/handles-private.h>
+#include <mono/io-layer/wapi-private.h>
+#include <mono/io-layer/shared.h>
+
+int main (int argc, char **argv)
+{
+	int sem_id, ret;
+	
+	_wapi_shared_layout = _wapi_shm_attach(WAPI_SHM_DATA);
+	if (_wapi_shared_layout == FALSE) {
+		exit (0);
+	}
+
+	sem_id = semget (_wapi_shared_layout->sem_key, _WAPI_SHARED_SEM_COUNT, 0600);
+	if (sem_id != -1) {
+		ret = semctl (sem_id, IPC_RMID, 0);
+		if (ret == -1) {
+			g_message ("Error deleting semaphore: %s",
+				   g_strerror (errno));
+		}
+	}
+	
+	exit (0);
+}