Currently, rx_GetStatistics assumes that struct rx_statistics and
rx_statisticsAtomic have the same size (we just memcpy between them).
However, this is never checked, and rx_statistics contains many 'int'
fields where rx_statisticsAtomic has rx_atomic_t fields.
If these are not the same size, our rx stats will silently break, so
add a static assert to make sure they are the same size.
Change-Id: I889867f4a85530c30dd15d32d1822144ea128a95
Reviewed-on: https://gerrit.openafs.org/13414
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>
#if !defined(KERNEL)
#include <roken.h>
-#include <afs/opr.h>
#endif
+#include <afs/opr.h>
#ifdef KERNEL
/* no kmutex, no atomic emulation...*/
struct rx_statistics *
rx_GetStatistics(void) {
struct rx_statistics *stats = rxi_Alloc(sizeof(struct rx_statistics));
+
MUTEX_ENTER(&rx_stats_mutex);
+ opr_StaticAssert(sizeof(*stats) == sizeof(rx_stats));
memcpy(stats, &rx_stats, sizeof(struct rx_statistics));
MUTEX_EXIT(&rx_stats_mutex);