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 38 39 40 41 42 43 44 45 46
|
/****************************************************************
* *
* Copyright (c) 2011-2021 Fidelity National Information *
* Services, Inc. and/or its subsidiaries. All rights reserved. *
* *
* This source code contains the intellectual property *
* of its copyright holder(s), and is made available *
* under a license. If you do not know the terms of *
* the license, please stop and do not read further. *
* *
****************************************************************/
#ifndef EINTR_WRP_SEMOP_INCLUDED
#define EINTR_WRP_SEMOP_INCLUDED
#define NO_WAIT 0
#define FORCED_WAIT 1
#include <sys/types.h>
#include <errno.h>
#include "gtm_c_stack_trace_semop.h"
#ifdef DEBUG
#define SEMVALMAX 32767
#endif
/* maintain in parallel with do_semop.c */
#define SEMOP(SEMID, SOPS, NSOPS, RC, TO_WAIT) \
{ \
int numsems; \
\
assert(sizeof(SOPS) >= NSOPS); \
for (numsems = NSOPS - 1; numsems >= 0; --numsems) \
CHECK_SEMVAL_GRT_SEMOP(SEMID, SOPS[numsems].sem_num, SOPS[numsems].sem_op); \
if (FORCED_WAIT == TO_WAIT) \
{ \
RC = try_semop_get_c_stack(SEMID, SOPS, NSOPS); /* try with patience */ \
if (0 != RC) \
{ \
errno = RC; \
RC = -1; \
} \
} else \
{ \
assert(NO_WAIT == TO_WAIT); \
while (-1 == (RC = semop(SEMID, SOPS, NSOPS)) && ((EINTR == errno))) \
; \
} \
}
#endif
|