ck: Reimplement a few libc headers, to make CK build when compiling in the

FreeBSD kernel.
ck_pring
Olivier Houchard 9 years ago
parent 4677de8473
commit 27fb1bc00f

@ -31,8 +31,8 @@
#include <ck_cc.h>
#include <ck_malloc.h>
#include <ck_pr.h>
#include <stdbool.h>
#include <stddef.h>
#include <ck_stdbool.h>
#include <ck_stddef.h>
struct _ck_array {
unsigned int n_committed;

@ -33,9 +33,11 @@
#include <ck_limits.h>
#include <ck_pr.h>
#include <ck_stdint.h>
#include <stdbool.h>
#include <stddef.h>
#include <string.h>
#include <ck_stdbool.h>
#include <ck_stddef.h>
#include <ck_stdbool.h>
#include <ck_stddef.h>
#include <ck_string.h>
#if !defined(CK_F_PR_LOAD_UINT) || !defined(CK_F_PR_STORE_UINT) || \
!defined(CK_F_PR_AND_UINT) || !defined(CK_F_PR_OR_UINT) || \

@ -41,8 +41,8 @@
*/
#include <ck_pr.h>
#include <stdbool.h>
#include <stddef.h>
#include <ck_stdbool.h>
#include <ck_stddef.h>
struct ck_brlock_reader {
unsigned int n_readers;

@ -38,8 +38,8 @@
#include <ck_cc.h>
#include <ck_md.h>
#include <ck_pr.h>
#include <stdbool.h>
#include <stddef.h>
#include <ck_stdbool.h>
#include <ck_stddef.h>
#include <ck_limits.h>
struct ck_bytelock {

@ -36,7 +36,7 @@
#include <ck_cc.h>
#include <ck_pr.h>
#include <stddef.h>
#include <ck_stddef.h>
enum ck_cohort_state {
CK_COHORT_STATE_GLOBAL = 0,

@ -35,7 +35,7 @@
#include <ck_cc.h>
#include <ck_pr.h>
#include <string.h>
#include <ck_string.h>
/*
* skip_-prefixed counters represent the number of consecutive

@ -37,7 +37,7 @@
#include <ck_md.h>
#include <ck_pr.h>
#include <ck_stack.h>
#include <stdbool.h>
#include <ck_stdbool.h>
#ifndef CK_EPOCH_LENGTH
#define CK_EPOCH_LENGTH 4

@ -32,7 +32,7 @@
#include <ck_md.h>
#include <ck_pr.h>
#include <ck_spinlock.h>
#include <stddef.h>
#include <ck_stddef.h>
#ifndef CK_F_FIFO_SPSC
#define CK_F_FIFO_SPSC

@ -31,7 +31,7 @@
#include <ck_cc.h>
#include <ck_hp.h>
#include <ck_pr.h>
#include <stddef.h>
#include <ck_stddef.h>
#define CK_HP_FIFO_SLOTS_COUNT (2)
#define CK_HP_FIFO_SLOTS_SIZE (sizeof(void *) * CK_HP_FIFO_SLOTS_COUNT)

@ -31,7 +31,7 @@
#include <ck_hp.h>
#include <ck_pr.h>
#include <ck_stack.h>
#include <stddef.h>
#include <ck_stddef.h>
#define CK_HP_STACK_SLOTS_COUNT 1
#define CK_HP_STACK_SLOTS_SIZE sizeof(void *)

@ -32,8 +32,8 @@
#include <ck_md.h>
#include <ck_pr.h>
#include <ck_stdint.h>
#include <stdbool.h>
#include <stddef.h>
#include <ck_stdbool.h>
#include <ck_stddef.h>
/*
* Indicates a single-writer many-reader workload. Mutually

@ -51,8 +51,8 @@
#include <ck_malloc.h>
#include <ck_md.h>
#include <ck_stdint.h>
#include <stdbool.h>
#include <stddef.h>
#include <ck_stdbool.h>
#include <ck_stddef.h>
struct ck_ht_hash {
uint64_t value;

@ -40,6 +40,9 @@
#define UINT64_MAX ULLONG_MAX
#endif
#elif defined(__FreeBSD__) && defined(_KERNEL)
#include <sys/stdint.h>
#include <sys/limits.h>
#else
#include <limits.h>
#endif /* __linux__ && __KERNEL__ */

@ -27,7 +27,7 @@
#ifndef CK_MALLOC_H
#define CK_MALLOC_H
#include <stdbool.h>
#include <ck_stdbool.h>
#include <sys/types.h>
struct ck_malloc {

@ -32,7 +32,7 @@
#include <ck_limits.h>
#include <ck_md.h>
#include <ck_stdint.h>
#include <stdbool.h>
#include <ck_stdbool.h>
#ifndef CK_USE_CC_BUILTINS
#if defined(__x86_64__)

@ -32,8 +32,8 @@
#include <ck_md.h>
#include <ck_pr.h>
#include <ck_stdint.h>
#include <stdbool.h>
#include <stddef.h>
#include <ck_stdbool.h>
#include <ck_stddef.h>
/*
* Indicates a single-writer many-reader workload. Mutually

@ -30,8 +30,8 @@
#include <ck_cc.h>
#include <ck_md.h>
#include <ck_pr.h>
#include <stdbool.h>
#include <string.h>
#include <ck_stdbool.h>
#include <ck_string.h>
/*
* Concurrent ring buffer.

@ -36,7 +36,7 @@
#include <ck_cc.h>
#include <ck_pr.h>
#include <stddef.h>
#include <ck_stddef.h>
#include <ck_cohort.h>
#define CK_RWCOHORT_WP_NAME(N) ck_rwcohort_wp_##N

@ -29,8 +29,8 @@
#include <ck_elide.h>
#include <ck_pr.h>
#include <stdbool.h>
#include <stddef.h>
#include <ck_stdbool.h>
#include <ck_stddef.h>
struct ck_rwlock {
unsigned int writer;

@ -29,7 +29,7 @@
#include <ck_cc.h>
#include <ck_pr.h>
#include <stdbool.h>
#include <ck_stdbool.h>
struct ck_sequence {
unsigned int sequence;

@ -29,8 +29,8 @@
#include <ck_cc.h>
#include <ck_pr.h>
#include <stdbool.h>
#include <stddef.h>
#include <ck_stdbool.h>
#include <ck_stddef.h>
struct ck_stack_entry {
struct ck_stack_entry *next;

@ -0,0 +1,31 @@
/*
* Copyright 2015 Olivier Houchard.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*/
#if defined(__FreeBSD__) && defined(_KERNEL)
#include <sys/types.h>
#else
#include <stdbool.h>
#endif

@ -0,0 +1,31 @@
/*
* Copyright 2015 Olivier Houchard.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*/
#if defined(__FreeBSD__) && defined(_KERNEL)
#include <sys/stddef.h>
#else
#include <stddef.h>
#endif

@ -27,6 +27,8 @@
#if defined(__linux__) && defined(__KERNEL__)
#include <linux/kernel.h>
#include <linux/types.h>
#elif defined(__FreeBSD__) && defined(_KERNEL)
#include <sys/stdint.h>
#else
#include <stdint.h>
#endif /* __linux__ && __KERNEL__ */

@ -0,0 +1,31 @@
/*
* Copyright 2015 Olivier Houchard.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*/
#if defined(__FreeBSD__) && defined(_KERNEL)
#include <sys/systm.h>
#else
#include <stdlib.h>
#endif

@ -0,0 +1,31 @@
/*
* Copyright 2015 Olivier Houchard.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*/
#if defined(__FreeBSD__) && defined(_KERNEL)
#include <sys/systm.h>
#else
#include <string.h>
#endif

@ -31,8 +31,8 @@
#include <ck_elide.h>
#include <ck_limits.h>
#include <ck_pr.h>
#include <stdbool.h>
#include <stddef.h>
#include <ck_stdbool.h>
#include <ck_stddef.h>
struct ck_swlock {
uint32_t value;

@ -35,7 +35,6 @@
#include <ck_cc.h>
#include <ck_md.h>
#include <ck_stdint.h>
#include <stdbool.h>
/*
* The following represent supported atomic operations.

@ -34,7 +34,6 @@
#include <ck_cc.h>
#include <ck_md.h>
#include <ck_stdint.h>
#include <stdbool.h>
/*
* The following represent supported atomic operations.

@ -31,7 +31,7 @@
#include <ck_limits.h>
#include <ck_md.h>
#include <ck_pr.h>
#include <stdbool.h>
#include <ck_stdbool.h>
#ifndef CK_F_SPINLOCK_ANDERSON
#define CK_F_SPINLOCK_ANDERSON

@ -31,7 +31,7 @@
#include <ck_cc.h>
#include <ck_elide.h>
#include <ck_pr.h>
#include <stdbool.h>
#include <ck_stdbool.h>
#ifndef CK_F_SPINLOCK_CAS
#define CK_F_SPINLOCK_CAS

@ -30,8 +30,8 @@
#include <ck_cc.h>
#include <ck_limits.h>
#include <ck_pr.h>
#include <stdbool.h>
#include <stddef.h>
#include <ck_stdbool.h>
#include <ck_stddef.h>
#ifndef CK_F_SPINLOCK_CLH
#define CK_F_SPINLOCK_CLH

@ -31,7 +31,7 @@
#include <ck_cc.h>
#include <ck_elide.h>
#include <ck_pr.h>
#include <stdbool.h>
#include <ck_stdbool.h>
#ifndef CK_F_SPINLOCK_DEC
#define CK_F_SPINLOCK_DEC

@ -31,7 +31,7 @@
#include <ck_cc.h>
#include <ck_elide.h>
#include <ck_pr.h>
#include <stdbool.h>
#include <ck_stdbool.h>
#ifndef CK_F_SPINLOCK_FAS
#define CK_F_SPINLOCK_FAS

@ -30,8 +30,8 @@
#include <ck_cc.h>
#include <ck_pr.h>
#include <stdbool.h>
#include <stddef.h>
#include <ck_stdbool.h>
#include <ck_stddef.h>
#ifndef CK_F_SPINLOCK_HCLH
#define CK_F_SPINLOCK_HCLH

@ -29,8 +29,8 @@
#include <ck_cc.h>
#include <ck_pr.h>
#include <stdbool.h>
#include <stddef.h>
#include <ck_stdbool.h>
#include <ck_stddef.h>
#ifndef CK_F_SPINLOCK_MCS
#define CK_F_SPINLOCK_MCS

@ -32,7 +32,7 @@
#include <ck_elide.h>
#include <ck_md.h>
#include <ck_pr.h>
#include <stdbool.h>
#include <ck_stdbool.h>
#ifndef CK_F_SPINLOCK_TICKET
#define CK_F_SPINLOCK_TICKET

@ -28,8 +28,8 @@
#include <ck_array.h>
#include <ck_cc.h>
#include <ck_pr.h>
#include <stdbool.h>
#include <string.h>
#include <ck_stdbool.h>
#include <ck_string.h>
static struct _ck_array *
ck_array_create(struct ck_malloc *allocator, unsigned int length)

@ -28,7 +28,7 @@
#include <ck_barrier.h>
#include <ck_cc.h>
#include <ck_pr.h>
#include <stdbool.h>
#include <ck_stdbool.h>
void
ck_barrier_mcs_init(struct ck_barrier_mcs *barrier, unsigned int nthr)

@ -35,7 +35,7 @@
#include <ck_epoch.h>
#include <ck_pr.h>
#include <ck_stack.h>
#include <stdbool.h>
#include <ck_stdbool.h>
/*
* Only three distinct values are used for reclamation, but reclamation occurs

@ -56,10 +56,10 @@
#include <ck_hp.h>
#include <ck_pr.h>
#include <ck_stack.h>
#include <stdbool.h>
#include <stddef.h>
#include <stdlib.h>
#include <string.h>
#include <ck_stdbool.h>
#include <ck_stddef.h>
#include <ck_stdlib.h>
#include <ck_string.h>
CK_STACK_CONTAINER(struct ck_hp_record, global_entry, ck_hp_record_container)
CK_STACK_CONTAINER(struct ck_hp_hazard, pending_entry, ck_hp_hazard_container)

@ -30,8 +30,8 @@
#include <ck_md.h>
#include <ck_pr.h>
#include <ck_stdint.h>
#include <stdbool.h>
#include <string.h>
#include <ck_stdbool.h>
#include <ck_string.h>
#include "ck_internal.h"

@ -38,8 +38,8 @@
#include <ck_md.h>
#include <ck_pr.h>
#include <ck_stdint.h>
#include <stdbool.h>
#include <string.h>
#include <ck_stdbool.h>
#include <ck_string.h>
#include "ck_ht_hash.h"
#include "ck_internal.h"

@ -32,7 +32,7 @@
*/
#include <ck_stdint.h>
#include <string.h>
#include <ck_string.h>
//-----------------------------------------------------------------------------
// MurmurHash3 was written by Austin Appleby, and is placed in the public

@ -31,8 +31,8 @@
#include <ck_md.h>
#include <ck_pr.h>
#include <ck_stdint.h>
#include <stdbool.h>
#include <string.h>
#include <ck_stdbool.h>
#include <ck_string.h>
#include "ck_internal.h"

Loading…
Cancel
Save