]> git.tuebingen.mpg.de Git - paraslash.git/blobdiff - ipc.c
fix the plm database tool
[paraslash.git] / ipc.c
diff --git a/ipc.c b/ipc.c
index 9ae2b3a09d1e1d98617e4502c16f7af2f0f54742..ae9ad574bbd5840be8cee0c034c8f9e0e48cc7cc 100644 (file)
--- a/ipc.c
+++ b/ipc.c
@@ -11,7 +11,7 @@ int mutex_new(void)
        return ret < 0?  -E_SEM_GET : ret;
 }
 
-int mutex_remove(int id)
+int mutex_destroy(int id)
 {
        int ret = semctl(id, 0, IPC_RMID);
        return ret < 0? -E_SEM_REMOVE : 1;
@@ -92,12 +92,16 @@ int shm_destroy(int id)
  *
  * \sa semop(2)
  */
-void *shm_attach(int id, enum shm_attach_mode mode)
+int shm_attach(int id, enum shm_attach_mode mode, void **result)
 {
-       if (mode == ATTACH_RW)
-               return shmat(id, NULL, 0);
-       return shmat(id, NULL, SHM_RDONLY);
+       if (mode == ATTACH_RW) {
+               *result = shmat(id, NULL, 0);
+               return *result? 1 : -E_SHM_ATTACH;
+       }
+       *result = shmat(id, NULL, SHM_RDONLY);
+       return *result? 1 : -E_SHM_ATTACH;
 }
+
 int shm_detach(void *addr)
 {
        int ret = shmdt(addr);