0
0
Fork 0
mirror of https://github.com/matrix-construct/construct synced 2024-11-17 15:30:52 +01:00

ircd::db: Add some arbitrary sanity checks on port structures.

This commit is contained in:
Jason Volk 2018-08-18 18:20:38 -07:00
parent 926a125303
commit e2c17d2595

View file

@ -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}
{