merge 99630:99762
[mono.git] / mono / handles / semdel.c
1 #include <config.h>
2 #include <glib.h>
3 #include <errno.h>
4 #include <sys/types.h>
5 #include <sys/ipc.h>
6 #include <sys/sem.h>
7
8 #include <mono/io-layer/io-layer.h>
9
10 /* We're digging into handle internals here... */
11 #include <mono/io-layer/handles-private.h>
12 #include <mono/io-layer/wapi-private.h>
13 #include <mono/io-layer/shared.h>
14
15 int main (int argc, char **argv)
16 {
17         int sem_id, ret;
18         
19         _wapi_shared_layout = _wapi_shm_attach(WAPI_SHM_DATA);
20         if (_wapi_shared_layout == FALSE) {
21                 exit (0);
22         }
23
24         sem_id = semget (_wapi_shared_layout->sem_key, _WAPI_SHARED_SEM_COUNT, 0600);
25         if (sem_id != -1) {
26                 ret = semctl (sem_id, 0, IPC_RMID);
27                 if (ret == -1) {
28                         g_message ("Error deleting semaphore: %s",
29                                    g_strerror (errno));
30                 }
31         }
32         
33         exit (0);
34 }