mirror of
https://github.com/FirebirdSQL/firebird.git
synced 2025-01-23 22:03:03 +01:00
Misc
This commit is contained in:
parent
82e3505af8
commit
5baf890a21
@ -98,12 +98,14 @@ private:
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* static void init_shmem(void* arg, sh_mem* shmem, bool init)
|
||||
/*
|
||||
static void init_shmem(void* arg, sh_mem* shmem, bool init)
|
||||
{
|
||||
EventManager* const eventMgr = static_cast<EventManager*>(arg);
|
||||
eventMgr->init_shmem(shmem, init);
|
||||
}
|
||||
*/
|
||||
*/
|
||||
|
||||
static void mutex_bugcheck(const TEXT*, int);
|
||||
static void punt(const TEXT*);
|
||||
|
||||
|
@ -113,12 +113,12 @@ struct event_t
|
||||
|
||||
struct FAST_MUTEX_SHARED_SECTION
|
||||
{
|
||||
SLONG fInitialized;
|
||||
SLONG lSpinLock;
|
||||
SLONG lThreadsWaiting;
|
||||
SLONG lAvailable;
|
||||
SLONG fInitialized;
|
||||
SLONG lSpinLock;
|
||||
SLONG lThreadsWaiting;
|
||||
SLONG lAvailable;
|
||||
#ifdef _DEBUG
|
||||
DWORD dwThreadId;
|
||||
DWORD dwThreadId;
|
||||
#endif
|
||||
};
|
||||
|
||||
@ -126,7 +126,7 @@ struct FAST_MUTEX
|
||||
{
|
||||
HANDLE hEvent;
|
||||
HANDLE hFileMap;
|
||||
SLONG lSpinCount;
|
||||
SLONG lSpinCount;
|
||||
volatile FAST_MUTEX_SHARED_SECTION* lpSharedInfo;
|
||||
};
|
||||
|
||||
@ -137,10 +137,10 @@ struct mtx
|
||||
|
||||
struct event_t
|
||||
{
|
||||
SLONG event_pid;
|
||||
SLONG event_id;
|
||||
SLONG event_count;
|
||||
void* event_handle;
|
||||
SLONG event_pid;
|
||||
SLONG event_id;
|
||||
SLONG event_count;
|
||||
void* event_handle;
|
||||
};
|
||||
|
||||
#endif // WIN_NT
|
||||
@ -182,7 +182,7 @@ public:
|
||||
USHORT mhb_version;
|
||||
#ifndef WIN_NT
|
||||
struct mtx mhb_mutex;
|
||||
#endif
|
||||
#endif
|
||||
};
|
||||
|
||||
class SharedMemoryBase
|
||||
@ -232,7 +232,7 @@ public:
|
||||
enum MemoryTypes
|
||||
{
|
||||
SRAM_LOCK_MANAGER = 0xFF, // To avoid mixing with old files no matter of endianness
|
||||
SRAM_DATABASE_SNAPSHOT = 0xFE, // use downcount for shared memeory types
|
||||
SRAM_DATABASE_SNAPSHOT = 0xFE, // use downcount for shared memory types
|
||||
SRAM_EVENT_MANAGER = 0xFD,
|
||||
SRAM_TRACE_CONFIG = 0xFC,
|
||||
SRAM_TRACE_LOG = 0xFB
|
||||
@ -247,7 +247,9 @@ class SharedMemory : public SharedMemoryBase
|
||||
{
|
||||
public:
|
||||
SharedMemory()
|
||||
: SharedMemoryBase(), sh_mem_header(NULL) { }
|
||||
: SharedMemoryBase(), sh_mem_header(NULL)
|
||||
{ }
|
||||
|
||||
~SharedMemory()
|
||||
{
|
||||
if (sh_mem_header)
|
||||
|
@ -1617,7 +1617,7 @@ ULONG ISC_exception_post(ULONG except_code, const TEXT* err_msg)
|
||||
"\tto terminate abnormally.", err_msg);
|
||||
break;
|
||||
case EXCEPTION_STACK_OVERFLOW:
|
||||
Firebird::status_exception::raise(Firebird::Arg::Gds(isc_exception_stack_overflow));
|
||||
status_exception::raise(Arg::Gds(isc_exception_stack_overflow));
|
||||
// This will never be called, but to be safe it's here
|
||||
result = (ULONG) EXCEPTION_CONTINUE_EXECUTION;
|
||||
is_critical = false;
|
||||
@ -1693,7 +1693,7 @@ void SharedMemoryBase::removeMapFile()
|
||||
|
||||
#ifdef UNIX
|
||||
|
||||
bool SharedMemoryBase::mapFile(Firebird::Arg::StatusVector& statusVector,
|
||||
bool SharedMemoryBase::mapFile(Arg::StatusVector& statusVector,
|
||||
const TEXT* filename, ULONG length)
|
||||
{
|
||||
/**************************************
|
||||
@ -1926,7 +1926,7 @@ bool SharedMemoryBase::mapFile(Firebird::Arg::StatusVector& statusVector,
|
||||
|
||||
|
||||
#ifdef WIN_NT
|
||||
bool SharedMemoryBase::mapFile(Firebird::Arg::StatusVector& statusVector,
|
||||
bool SharedMemoryBase::mapFile(Arg::StatusVector& statusVector,
|
||||
const TEXT* filename, ULONG length)
|
||||
{
|
||||
/**************************************
|
||||
@ -2337,8 +2337,8 @@ void SharedMemoryBase::unmapObject(Arg::StatusVector& statusVector, UCHAR** obje
|
||||
|
||||
#ifdef WIN_NT
|
||||
|
||||
UCHAR* SharedMemoryBase::mapObject(Arg::StatusVector& statusVector,
|
||||
ULONG object_offset,
|
||||
UCHAR* SharedMemoryBase::mapObject(Arg::StatusVector& statusVector,
|
||||
ULONG object_offset,
|
||||
ULONG object_length)
|
||||
{
|
||||
/**************************************
|
||||
@ -2378,7 +2378,7 @@ UCHAR* SharedMemoryBase::mapObject(Arg::StatusVector& statusVector,
|
||||
}
|
||||
|
||||
|
||||
void SharedMemoryBase::unmapObject(Arg::StatusVector& statusVector,
|
||||
void SharedMemoryBase::unmapObject(Arg::StatusVector& statusVector,
|
||||
UCHAR** object_pointer, ULONG object_length)
|
||||
{
|
||||
/**************************************
|
||||
@ -3140,7 +3140,7 @@ bool SharedMemoryBase::remapFile(Arg::StatusVector& statusVector, ULONG new_leng
|
||||
return false;
|
||||
}
|
||||
|
||||
munmap((char *) getHeader(), sh_mem_length_mapped);
|
||||
munmap((char*) getHeader(), sh_mem_length_mapped);
|
||||
|
||||
#ifdef USE_SYS5SEMAPHORE
|
||||
SharedFile::remap(getHeader(), address, new_length);
|
||||
@ -3162,7 +3162,7 @@ bool SharedMemoryBase::remapFile(Arg::StatusVector& statusVector, ULONG new_leng
|
||||
|
||||
#ifdef WIN_NT
|
||||
#define ISC_REMAP_FILE_DEFINED
|
||||
bool SharedMemoryBase::remapFile(Arg::StatusVector& statusVector,
|
||||
bool SharedMemoryBase::remapFile(Arg::StatusVector& statusVector,
|
||||
ULONG new_length, bool flag)
|
||||
{
|
||||
/**************************************
|
||||
@ -3263,7 +3263,7 @@ bool SharedMemoryBase::remapFile(Arg::StatusVector& statusVector,
|
||||
|
||||
|
||||
#ifndef ISC_REMAP_FILE_DEFINED
|
||||
bool SharedMemoryBase::remapFile(Firebird::Arg::StatusVector& statusVector, ULONG, bool)
|
||||
bool SharedMemoryBase::remapFile(Arg::StatusVector& statusVector, ULONG, bool)
|
||||
{
|
||||
/**************************************
|
||||
*
|
||||
@ -3276,7 +3276,7 @@ bool SharedMemoryBase::remapFile(Firebird::Arg::StatusVector& statusVector, ULON
|
||||
*
|
||||
**************************************/
|
||||
|
||||
statusVector << Arg::Gds(isc_unavailable) <<
|
||||
statusVector << Arg::Gds(isc_unavailable) <<
|
||||
Arg::Gds(isc_random) << "SharedMemory::remapFile";
|
||||
|
||||
return NULL;
|
||||
@ -3628,7 +3628,7 @@ void SharedMemoryBase::mutexUnlock()
|
||||
}
|
||||
|
||||
SharedMemoryBase::SharedMemoryBase()
|
||||
: sh_mem_mutex(0), sh_mem_length_mapped(0),
|
||||
: sh_mem_mutex(0), sh_mem_length_mapped(0),
|
||||
#ifdef WIN_NT
|
||||
sh_mem_handle(0), sh_mem_object(0), sh_mem_interest(0), sh_mem_hdr_object(0),
|
||||
sh_mem_hdr_address(0)
|
||||
@ -3643,7 +3643,7 @@ SharedMemoryBase::~SharedMemoryBase()
|
||||
{
|
||||
}
|
||||
|
||||
void SharedMemoryBase::logError(const char* text, const Firebird::Arg::StatusVector& status)
|
||||
void SharedMemoryBase::logError(const char* text, const Arg::StatusVector& status)
|
||||
{
|
||||
iscLogStatus(text, status.value());
|
||||
}
|
||||
|
@ -41,7 +41,7 @@ struct TraceCSHeader : public MemoryHeader
|
||||
volatile ULONG change_number;
|
||||
volatile ULONG session_number;
|
||||
ULONG cnt_uses;
|
||||
char cfg_file_name[MAXPATHLEN];
|
||||
char cfg_file_name[MAXPATHLEN];
|
||||
};
|
||||
|
||||
class ConfigStorage : public Firebird::GlobalStorage, public SharedMemory<TraceCSHeader>
|
||||
|
@ -1061,7 +1061,7 @@ void LockManager::acquire_shmem(SRQ_PTR owner_offset)
|
||||
ULONG spins = 0;
|
||||
while (spins++ < m_acquireSpins)
|
||||
{
|
||||
if (mutexLockCond())
|
||||
if (mutexLockCond())
|
||||
{
|
||||
status = FB_SUCCESS;
|
||||
break;
|
||||
@ -1199,7 +1199,7 @@ void LockManager::acquire_shmem(SRQ_PTR owner_offset)
|
||||
|
||||
|
||||
#ifdef USE_SHMEM_EXT
|
||||
bool LockManager::Extent::initialize(bool)
|
||||
bool LockManager::Extent::initialize(bool)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
@ -2310,7 +2310,7 @@ bool LockManager::initialize(bool initializeMemory)
|
||||
}
|
||||
#endif
|
||||
|
||||
if (!initializeMemory)
|
||||
if (!initializeMemory)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
@ -311,8 +311,8 @@ namespace Jrd {
|
||||
|
||||
class Database;
|
||||
|
||||
class LockManager : public Firebird::RefCounted,
|
||||
public Firebird::GlobalStorage,
|
||||
class LockManager : public Firebird::RefCounted,
|
||||
public Firebird::GlobalStorage,
|
||||
public SharedMemory<lhb>
|
||||
{
|
||||
typedef Firebird::GenericMap<Firebird::Pair<Firebird::Left<Firebird::string, LockManager*> > > DbLockMgrMap;
|
||||
@ -446,30 +446,34 @@ private:
|
||||
public:
|
||||
Extent() { }
|
||||
Extent(Firebird::MemoryPool&) { }
|
||||
Extent(const SharedMemoryBase& p)
|
||||
{
|
||||
|
||||
Extent(const SharedMemoryBase& p)
|
||||
{
|
||||
assign(p);
|
||||
}
|
||||
Extent(Firebird::MemoryPool&, const SharedMemoryBase& p)
|
||||
{
|
||||
|
||||
Extent(Firebird::MemoryPool&, const SharedMemoryBase& p)
|
||||
{
|
||||
assign(p);
|
||||
}
|
||||
Extent& operator=(const SharedMemoryBase& p)
|
||||
{
|
||||
assign(p);
|
||||
return *this;
|
||||
}
|
||||
|
||||
~Extent()
|
||||
{
|
||||
sh_mem_header = NULL; // avoid unmapping in dtor
|
||||
}
|
||||
|
||||
Extent& operator=(const SharedMemoryBase& p)
|
||||
{
|
||||
assign(p);
|
||||
return *this;
|
||||
}
|
||||
|
||||
void assign(const SharedMemoryBase& p);
|
||||
|
||||
bool initialize(bool init);
|
||||
void mutexBug(int osErrorCode, const char* text);
|
||||
};
|
||||
|
||||
Firebird::ObjectsArray<Extent> m_extents;
|
||||
|
||||
ULONG getTotalMapped() const
|
||||
|
@ -86,7 +86,8 @@ struct waitque
|
||||
SRQ_PTR waitque_entry[30];
|
||||
};
|
||||
|
||||
namespace {
|
||||
namespace
|
||||
{
|
||||
class sh_mem : public Jrd::SharedMemory<lhb>
|
||||
{
|
||||
public:
|
||||
@ -94,7 +95,7 @@ namespace {
|
||||
: sh_mem_consistency(p_consistency)
|
||||
{ }
|
||||
|
||||
bool initialize(bool)
|
||||
bool initialize(bool)
|
||||
{
|
||||
// Initialize a lock table to looking -- i.e. don't do nuthin.
|
||||
return sh_mem_consistency;
|
||||
|
Loading…
Reference in New Issue
Block a user