mirror of
https://github.com/matrix-construct/construct
synced 2024-11-25 16:22:35 +01:00
ircd::db: Add some arbitrary sanity checks on port structures.
This commit is contained in:
parent
926a125303
commit
e2c17d2595
1 changed files with 21 additions and 0 deletions
21
ircd/db.cc
21
ircd/db.cc
|
@ -3190,6 +3190,13 @@ noexcept
|
|||
// Mutex
|
||||
//
|
||||
|
||||
static_assert
|
||||
(
|
||||
sizeof(rocksdb::port::Mutex) <= sizeof(pthread_mutex_t) + 1,
|
||||
"link-time punning of our structure won't work if the structure is larger "
|
||||
"than the one rocksdb has assumed space for."
|
||||
);
|
||||
|
||||
rocksdb::port::Mutex::Mutex()
|
||||
{
|
||||
#ifdef RB_DEBUG_DB_PORT_
|
||||
|
@ -3267,6 +3274,13 @@ rocksdb::port::Mutex::AssertHeld()
|
|||
// RWMutex
|
||||
//
|
||||
|
||||
static_assert
|
||||
(
|
||||
sizeof(rocksdb::port::RWMutex) <= sizeof(pthread_rwlock_t),
|
||||
"link-time punning of our structure won't work if the structure is larger "
|
||||
"than the one rocksdb has assumed space for."
|
||||
);
|
||||
|
||||
rocksdb::port::RWMutex::RWMutex()
|
||||
{
|
||||
#ifdef RB_DEBUG_DB_PORT_
|
||||
|
@ -3347,6 +3361,13 @@ rocksdb::port::RWMutex::WriteUnlock()
|
|||
// CondVar
|
||||
//
|
||||
|
||||
static_assert
|
||||
(
|
||||
sizeof(rocksdb::port::CondVar) <= sizeof(pthread_cond_t) + sizeof(void *),
|
||||
"link-time punning of our structure won't work if the structure is larger "
|
||||
"than the one rocksdb has assumed space for."
|
||||
);
|
||||
|
||||
rocksdb::port::CondVar::CondVar(Mutex *mu)
|
||||
:mu{mu}
|
||||
{
|
||||
|
|
Loading…
Reference in a new issue