],
[AC_MSG_FAILURE([stdatomic.h header found, but compilation failed, please fix your toolchain.])])
-AC_CHECK_HEADERS([stdalign.h stdnoreturn.h],
+AC_CHECK_HEADERS([stdnoreturn.h],
[],
[AC_MSG_ERROR([C11 standard headers not found, update your toolchain.])])
libisc_ladir = $(includedir)/isc
libisc_la_HEADERS = \
- include/isc/align.h \
include/isc/ascii.h \
include/isc/assertions.h \
include/isc/async.h \
+++ /dev/null
-/*
- * Copyright (C) Internet Systems Consortium, Inc. ("ISC")
- *
- * SPDX-License-Identifier: MPL-2.0
- *
- * This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, you can obtain one at https://mozilla.org/MPL/2.0/.
- *
- * See the COPYRIGHT file distributed with this work for additional
- * information regarding copyright ownership.
- */
-
-#pragma once
-
-#ifdef HAVE_STDALIGN_H
-#include <stdalign.h>
-#else /* ifdef HAVE_STDALIGN_H */
-#define alignas(x) __attribute__((__aligned__(x)))
-#endif /* ifdef HAVE_STDALIGN_H */
*** Imports.
***/
-#include <isc/align.h>
#include <isc/atomic.h>
#include <isc/job.h>
#include <isc/lang.h>
* synchronization between multiple threads (see urcu/wfcqueue.h for
* detailed description).
*/
+STATIC_ASSERT(ISC_OS_CACHELINE_SIZE >= sizeof(struct __cds_wfcq_head),
+ "ISC_OS_CACHELINE_SIZE smaller than "
+ "sizeof(struct __cds_wfcq_head)");
struct isc_quota {
int magic;
atomic_uint_fast32_t max;
atomic_uint_fast32_t used;
atomic_uint_fast32_t soft;
struct {
- alignas(ISC_OS_CACHELINE_SIZE) struct cds_wfcq_head head;
- alignas(ISC_OS_CACHELINE_SIZE) struct cds_wfcq_tail tail;
+ struct cds_wfcq_head head;
+ uint8_t __padding[ISC_OS_CACHELINE_SIZE -
+ sizeof(struct __cds_wfcq_head)];
+ struct cds_wfcq_tail tail;
} jobs;
ISC_LINK(isc_quota_t) link;
};
#else /* USE_PTHREAD_RWLOCK */
-#include <isc/align.h>
#include <isc/atomic.h>
#include <isc/os.h>
+STATIC_ASSERT(ISC_OS_CACHELINE_SIZE >= sizeof(atomic_uint_fast32_t),
+ "ISC_OS_CACHELINE_SIZE smaller than "
+ "sizeof(atomic_uint_fast32_t)");
+STATIC_ASSERT(ISC_OS_CACHELINE_SIZE >= sizeof(atomic_int_fast32_t),
+ "ISC_OS_CACHELINE_SIZE smaller than sizeof(atomic_int_fast32_t)");
+
struct isc_rwlock {
- alignas(ISC_OS_CACHELINE_SIZE) atomic_uint_fast32_t readers_ingress;
- alignas(ISC_OS_CACHELINE_SIZE) atomic_uint_fast32_t readers_egress;
- alignas(ISC_OS_CACHELINE_SIZE) atomic_int_fast32_t writers_barrier;
- alignas(ISC_OS_CACHELINE_SIZE) atomic_bool writers_lock;
+ atomic_uint_fast32_t readers_ingress;
+ uint8_t __padding1[ISC_OS_CACHELINE_SIZE - sizeof(atomic_uint_fast32_t)];
+ atomic_uint_fast32_t readers_egress;
+ uint8_t __padding2[ISC_OS_CACHELINE_SIZE - sizeof(atomic_uint_fast32_t)];
+ atomic_int_fast32_t writers_barrier;
+ uint8_t __padding3[ISC_OS_CACHELINE_SIZE - sizeof(atomic_int_fast32_t)];
+ atomic_bool writers_lock;
};
typedef struct isc_rwlock isc_rwlock_t;
#pragma once
-#include <isc/align.h>
#include <isc/job.h>
#include <isc/loop.h>
#include <isc/os.h>
* mutex, because we are only using enqueue and splice, and those don't need
* any synchronization (see urcu/wfcqueue.h for detailed description).
*/
+STATIC_ASSERT(ISC_OS_CACHELINE_SIZE >= sizeof(struct __cds_wfcq_head),
+ "ISC_OS_CACHELINE_SIZE smaller than "
+ "sizeof(struct __cds_wfcq_head)");
+
typedef struct isc_jobqueue {
- alignas(ISC_OS_CACHELINE_SIZE) struct __cds_wfcq_head head;
- alignas(ISC_OS_CACHELINE_SIZE) struct cds_wfcq_tail tail;
+ struct __cds_wfcq_head head;
+ uint8_t __padding[ISC_OS_CACHELINE_SIZE -
+ sizeof(struct __cds_wfcq_head)];
+ struct cds_wfcq_tail tail;
} isc_jobqueue_t;
typedef ISC_LIST(isc_job_t) isc_joblist_t;
#include <stdio.h>
#include <stdlib.h>
-#include <isc/align.h>
#include <isc/hash.h>
#include <isc/magic.h>
#include <isc/mem.h>