diff --git a/ircd/db.cc b/ircd/db.cc index eabe4d0e9..a39f4ec32 100644 --- a/ircd/db.cc +++ b/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} {