Source
zbx_error("[file:'%s',line:%d] read-write lock unlock failed: %s", filename, line, zbx_strerror(errno));
/*
** Zabbix
** Copyright (C) 2001-2023 Zabbix SIA
**
** This program is free software; you can redistribute it and/or modify
** it under the terms of the GNU General Public License as published by
** the Free Software Foundation; either version 2 of the License, or
** (at your option) any later version.
**
** This program is distributed in the hope that it will be useful,
** but WITHOUT ANY WARRANTY; without even the implied warranty of
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
** GNU General Public License for more details.
**
** You should have received a copy of the GNU General Public License
** along with this program; if not, write to the Free Software
** Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
**/
typedef struct
{
pthread_mutex_t mutexes[ZBX_MUTEX_COUNT];
pthread_rwlock_t rwlocks[ZBX_RWLOCK_COUNT];
}
zbx_shared_lock_t;
static zbx_shared_lock_t *shared_lock;
static int shm_id, locks_disabled;
union semun
{
int val; /* value for SETVAL */
struct semid_ds *buf; /* buffer for IPC_STAT & IPC_SET */
unsigned short int *array; /* array for GETALL & SETALL */
struct seminfo *__buf; /* buffer for IPC_INFO */
};
/* HAVE_SEMUN */
static int ZBX_SEM_LIST_ID = -1;
static unsigned char mutexes;
/******************************************************************************
* *
* Purpose: if pthread mutexes and read-write locks can be shared between *
* processes then create them, otherwise fallback to System V *
* semaphore operations *
* *
* Parameters: error - [OUT] dynamically allocated memory with error message. *