-const char trbnet_version[] = "$Revision: 4.14 $ Local";
+const char trbnet_version[] = "$Revision: 4.15 $ Local";
#include <stdlib.h>
#include <signal.h>
/* Wait for semaphore and lock it */
if (semop(semid, &sops, 1) == -1) {
- trb_errno = TRB_SEMAPHORE;
-
/* Unblock signals */
sigprocmask(SIG_SETMASK, &blockSetOld, NULL);
+
+ trb_errno = TRB_SEMAPHORE;
return -1;
}
#ifdef ETRAX
1, /* sem_op: increment semaphore by 1, i.e. unlock it */
SEM_UNDO /* sem_flg: remove lock if process gets killed */
};
- int ret = 0;
if ((master_lock == 1) && (masterLock == 0)) {
return 0;
/* Release semaphore */
if (semop(semid, &sops, 1) == -1) {
trb_errno = TRB_SEMAPHORE;
- ret = -1;
return -1;
}
/* Unblock Signals */
if (sigprocmask(SIG_SETMASK, &blockSetOld, NULL) == -1) {
trb_errno = TRB_SEMAPHORE;
- ret = -1;
+ return -1;
}
- return ret;
+ return 0;
}
static int init_semaphore()
{
- trb_errno = TRB_NONE;
-
/* Set signal mask to block ALL signals */
sigfillset(&blockSet);
sigemptyset(&blockSetOld);
int memfd;
uint32_t *mem = NULL;
+ trb_errno = TRB_NONE;
+
/* Init semaphore and signal handling */
if (init_semaphore() == -1) return -1;
int init_ports()
{
+ trb_errno = TRB_NONE;
+
if (trb_debug > 0) {
fprintf(stderr, "init_ports: called\n");
}