8
0
mirror of https://github.com/FirebirdSQL/firebird.git synced 2025-01-30 19:23:03 +01:00
firebird-mirror/src/jrd/isc.h

190 lines
3.7 KiB
C
Raw Normal View History

2001-05-23 15:26:42 +02:00
/*
* PROGRAM: JRD access method
* MODULE: isc.h
* DESCRIPTION: Common descriptions for general-purpose but non-user routines
*
* The contents of this file are subject to the Interbase Public
* License Version 1.0 (the "License"); you may not use this file
* except in compliance with the License. You may obtain a copy
* of the License at http://www.Inprise.com/IPL.html
*
* Software distributed under the License is distributed on an
* "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, either express
* or implied. See the License for the specific language governing
* rights and limitations under the License.
*
* The Original Code was created by Inprise Corporation
* and its predecessors. Portions created by Inprise Corporation are
* Copyright (C) Inprise Corporation.
*
* All Rights Reserved.
* Contributor(s): ______________________________________.
*
2002-06-29 15:03:13 +02:00
* 26-Sept-2001 Paul Beach - External File Directory Config. Parameter
* 17-Oct-2001 Mike Nordell - CPU affinity
2002-10-30 07:40:58 +01:00
* 2002.10.29 Sean Leyne - Removed obsolete "Netware" port
*
* 2002.10.30 Sean Leyne - Removed support for obsolete "PC_PLATFORM" define
*
2001-05-23 15:26:42 +02:00
*/
#ifndef JRD_ISC_H
#define JRD_ISC_H
2001-05-23 15:26:42 +02:00
// Firebird platform-specific synchronization data structures
2001-05-23 15:26:42 +02:00
#if defined(DARWIN)
#define USE_SYS5SEMAPHORE
#endif
2009-04-10 10:51:48 +02:00
2001-05-23 15:26:42 +02:00
#ifdef UNIX
#if defined(USE_POSIX_THREADS)
#if defined(HAVE_PTHREAD_MUTEXATTR_SETROBUST_NP) && defined(HAVE_PTHREAD_MUTEX_CONSISTENT_NP)
#define USE_ROBUST_MUTEX
#if defined(LINUX) && (!defined(__USE_GNU))
#define __USE_GNU 1 // required on this OS to have this stuff declared
#endif // LINUX // should be defined before include <pthread.h> - AP 2009
#endif // ROBUST mutex
#include <pthread.h>
2001-05-23 15:26:42 +02:00
#ifdef USE_SYS5SEMAPHORE
2001-05-23 15:26:42 +02:00
struct Sys5Semaphore
{
int semSet; // index in shared memory table
unsigned short semNum; // number in semset
int getId();
};
struct mtx : public Sys5Semaphore
{
};
struct event_t : public Sys5Semaphore
{
SLONG event_count;
};
#else
struct mtx
{
pthread_mutex_t mtx_mutex[1];
2004-05-24 19:31:47 +02:00
};
2004-02-02 12:02:12 +01:00
struct event_t
2001-05-23 15:26:42 +02:00
{
SLONG event_count;
int pid;
pthread_mutex_t event_mutex[1];
pthread_cond_t event_cond[1];
2004-02-02 12:02:12 +01:00
};
2001-05-23 15:26:42 +02:00
2008-10-11 04:42:01 +02:00
#endif // USE_SYS5SEMAPHORE
2009-04-10 10:51:48 +02:00
#else
#error: Do not know how to declare shared mutex and event on this system.
#endif
2001-05-23 15:26:42 +02:00
#define SH_MEM_STRUCTURE_DEFINED
2009-04-10 10:51:48 +02:00
2004-05-24 19:31:47 +02:00
struct sh_mem
2001-05-23 15:26:42 +02:00
{
UCHAR *sh_mem_address;
ULONG sh_mem_length_mapped;
2001-05-23 15:26:42 +02:00
SLONG sh_mem_handle;
2004-05-24 19:31:47 +02:00
};
2009-04-10 10:51:48 +02:00
#endif // UNIX
2001-05-23 15:26:42 +02:00
#ifdef WIN_NT
#include <windows.h>
2008-12-20 09:12:19 +01:00
struct FAST_MUTEX_SHARED_SECTION
{
SLONG fInitialized;
SLONG lSpinLock;
SLONG lThreadsWaiting;
SLONG lAvailable;
#ifdef _DEBUG
DWORD dwThreadId;
#endif
2008-12-20 09:12:19 +01:00
};
2008-12-20 09:12:19 +01:00
struct FAST_MUTEX
{
HANDLE hEvent;
HANDLE hFileMap;
SLONG lSpinCount;
volatile FAST_MUTEX_SHARED_SECTION* lpSharedInfo;
2008-12-20 09:12:19 +01:00
};
2004-05-24 19:31:47 +02:00
struct mtx
2001-05-23 15:26:42 +02:00
{
FAST_MUTEX mtx_fast;
2004-05-24 19:31:47 +02:00
};
2004-02-02 12:02:12 +01:00
struct event_t
2001-05-23 15:26:42 +02:00
{
SLONG event_pid;
SLONG event_id;
2008-01-16 10:07:24 +01:00
SLONG event_count;
void* event_handle;
2004-02-02 12:02:12 +01:00
};
2001-05-23 15:26:42 +02:00
#define SH_MEM_STRUCTURE_DEFINED
2004-05-24 19:31:47 +02:00
struct sh_mem
2001-05-23 15:26:42 +02:00
{
UCHAR* sh_mem_address;
ULONG sh_mem_length_mapped;
2001-05-23 15:26:42 +02:00
void* sh_mem_handle;
void* sh_mem_object;
void* sh_mem_interest;
void* sh_mem_hdr_object;
ULONG* sh_mem_hdr_address;
TEXT sh_mem_name[MAXPATHLEN];
2004-05-24 19:31:47 +02:00
};
2009-04-10 10:51:48 +02:00
#endif // WIN_NT
2001-05-23 15:26:42 +02:00
#ifndef SH_MEM_STRUCTURE_DEFINED
2009-04-10 10:51:48 +02:00
2001-05-23 15:26:42 +02:00
#define SH_MEM_STRUCTURE_DEFINED
2004-05-24 19:31:47 +02:00
struct sh_mem
2001-05-23 15:26:42 +02:00
{
UCHAR* sh_mem_address;
ULONG sh_mem_length_mapped;
2001-05-23 15:26:42 +02:00
SLONG sh_mem_handle;
2004-05-24 19:31:47 +02:00
};
2001-05-23 15:26:42 +02:00
#endif
2009-04-10 10:51:48 +02:00
#undef SH_MEM_STRUCTURE_DEFINED
2001-05-23 15:26:42 +02:00
// Interprocess communication configuration structure
// This was used to read to and write from the Config dialog when the server
2008-01-16 10:07:24 +01:00
// or the guardian is showing an icon in the tray.
2001-05-23 15:26:42 +02:00
/*
2004-05-24 19:31:47 +02:00
struct ipccfg
2001-05-23 15:26:42 +02:00
{
const char* ipccfg_keyword;
SCHAR ipccfg_key;
SLONG* ipccfg_variable;
SSHORT ipccfg_parent_offset; // Relative offset of parent keyword
USHORT ipccfg_found; // TRUE when keyword has been set
2004-05-24 19:31:47 +02:00
};
typedef ipccfg *IPCCFG;
*/
2001-05-23 15:26:42 +02:00
2007-02-23 02:42:10 +01:00
#endif // JRD_ISC_H