projects
/
paraslash.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Simplify vss_preselect().
[paraslash.git]
/
ipc.c
diff --git
a/ipc.c
b/ipc.c
index
833ba1a
..
40a9057
100644
(file)
--- a/
ipc.c
+++ b/
ipc.c
@@
-1,5
+1,5
@@
/*
/*
- * Copyright (C) 2006-200
7
Andre Noll <maan@systemlinux.org>
+ * Copyright (C) 2006-200
8
Andre Noll <maan@systemlinux.org>
*
* Licensed under the GPL v2. For licencing details see COPYING.
*/
*
* Licensed under the GPL v2. For licencing details see COPYING.
*/
@@
-13,9
+13,6
@@
#include <sys/shm.h>
#include <sys/sem.h>
#include <sys/shm.h>
#include <sys/sem.h>
-/** abort if semget() failed that many times */
-#define MAX_SEMOP_RETRIES 500
-
/**
* define a new mutex
*
/**
* define a new mutex
*
@@
-45,14
+42,18
@@
int mutex_destroy(int id)
return ret < 0? -E_SEM_REMOVE : 1;
}
return ret < 0? -E_SEM_REMOVE : 1;
}
-static void para_semop(int id, struct sembuf *sops,
unsigned
num)
+static void para_semop(int id, struct sembuf *sops,
int
num)
{
{
- int i;
-
- for (i = 0; i < MAX_SEMOP_RETRIES; i++)
+ do {
if (semop(id, sops, num) >= 0)
return;
if (semop(id, sops, num) >= 0)
return;
- PARA_EMERG_LOG("semop failed %d times, aborting\n", MAX_SEMOP_RETRIES);
+ } while (errno == EINTR);
+ if (errno == EIDRM) {
+ PARA_NOTICE_LOG("semaphore set %d was removed\n", id);
+ return;
+ }
+ PARA_EMERG_LOG("fatal semop error %s: pid %d\n", strerror(errno),
+ (int)getpid());
exit(EXIT_FAILURE);
}
exit(EXIT_FAILURE);
}