You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@trafficserver.apache.org by so...@apache.org on 2015/01/31 02:23:50 UTC

[1/3] trafficserver git commit: Merge libck master (0.4.5-5-g1df6df0)

Repository: trafficserver
Updated Branches:
  refs/heads/master f83d6f2d7 -> 0da17e968


http://git-wip-us.apache.org/repos/asf/trafficserver/blob/0da17e96/lib/ck/regressions/ck_hs/benchmark/apply.c
----------------------------------------------------------------------
diff --git a/lib/ck/regressions/ck_hs/benchmark/apply.c b/lib/ck/regressions/ck_hs/benchmark/apply.c
new file mode 100644
index 0000000..ca4a3da
--- /dev/null
+++ b/lib/ck/regressions/ck_hs/benchmark/apply.c
@@ -0,0 +1,260 @@
+/*
+ * Copyright 2014 Samy Al Bahra.
+ * Copyright 2014 Backtrace I/O, Inc.
+ * 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 copyrighs
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyrighs
+ *    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.
+ */
+
+#include <ck_hs.h>
+
+#include <assert.h>
+#include <ck_malloc.h>
+#include <errno.h>
+#include <inttypes.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <time.h>
+
+#include "../../common.h"
+#include "../../../src/ck_ht_hash.h"
+
+static ck_hs_t hs;
+static char **keys;
+static size_t keys_length = 0;
+static size_t keys_capacity = 128;
+static unsigned long global_seed;
+
+static void *
+hs_malloc(size_t r)
+{
+
+	return malloc(r);
+}
+
+static void
+hs_free(void *p, size_t b, bool r)
+{
+
+	(void)b;
+	(void)r;
+
+	free(p);
+
+	return;
+}
+
+static struct ck_malloc my_allocator = {
+	.malloc = hs_malloc,
+	.free = hs_free
+};
+
+static unsigned long
+hs_hash(const void *object, unsigned long seed)
+{
+	const char *c = object;
+	unsigned long h;
+
+	h = (unsigned long)MurmurHash64A(c, strlen(c), seed);
+	return h;
+}
+
+static bool
+hs_compare(const void *previous, const void *compare)
+{
+
+	return strcmp(previous, compare) == 0;
+}
+
+static void
+set_destroy(void)
+{
+
+	ck_hs_destroy(&hs);
+	return;
+}
+
+static void
+set_init(unsigned int size, unsigned int mode)
+{
+
+	if (ck_hs_init(&hs, CK_HS_MODE_OBJECT | CK_HS_MODE_SPMC | mode, hs_hash, hs_compare,
+	    &my_allocator, size, global_seed) == false) {
+		perror("ck_hs_init");
+		exit(EXIT_FAILURE);
+	}
+
+	return;
+}
+
+static size_t
+set_count(void)
+{
+
+	return ck_hs_count(&hs);
+}
+
+static bool
+set_reset(void)
+{
+
+	return ck_hs_reset(&hs);
+}
+
+static void *
+test_apply(void *key, void *closure)
+{
+
+	(void)key;
+
+	return closure;
+}
+
+static void
+run_test(const char *file, size_t r, unsigned int size, unsigned int mode)
+{
+	FILE *fp;
+	char buffer[512];
+	size_t i, j;
+	unsigned int d = 0;
+	uint64_t s, e, a, gp, agp;
+	struct ck_hs_stat st;
+	char **t;
+
+	keys = malloc(sizeof(char *) * keys_capacity);
+	assert(keys != NULL);
+
+	fp = fopen(file, "r");
+	assert(fp != NULL);
+
+	while (fgets(buffer, sizeof(buffer), fp) != NULL) {
+		buffer[strlen(buffer) - 1] = '\0';
+		keys[keys_length++] = strdup(buffer);
+		assert(keys[keys_length - 1] != NULL);
+
+		if (keys_length == keys_capacity) {
+			t = realloc(keys, sizeof(char *) * (keys_capacity *= 2));
+			assert(t != NULL);
+			keys = t;
+		}
+	}
+
+	t = realloc(keys, sizeof(char *) * keys_length);
+	assert(t != NULL);
+	keys = t;
+
+	set_init(size, mode);
+	for (i = 0; i < keys_length; i++) {
+		unsigned long h = CK_HS_HASH(&hs, hs_hash, keys[i]);
+
+		if (ck_hs_get(&hs, h, keys[i]) == false) {
+			if (ck_hs_put(&hs, h, keys[i]) == false)
+				ck_error("ERROR: Failed get to put workload.\n");
+		} else {
+			d++;
+		}
+	}
+	ck_hs_stat(&hs, &st);
+
+	fprintf(stderr, "# %zu entries stored, %u duplicates, %u probe.\n",
+	    set_count(), d, st.probe_maximum);
+
+	a = 0;
+	for (j = 0; j < r; j++) {
+		if (set_reset() == false)
+			ck_error("ERROR: Failed to reset hash table.\n");
+
+		s = rdtsc();
+		for (i = 0; i < keys_length; i++) {
+			unsigned long h = CK_HS_HASH(&hs, hs_hash, keys[i]);
+
+			if (ck_hs_get(&hs, h, keys[i]) == false &&
+			    ck_hs_put(&hs, h, keys[i]) == false) {
+				ck_error("ERROR: Failed get to put workload.\n");
+			}
+		}
+		e = rdtsc();
+		a += e - s;
+	}
+	gp = a / (r * keys_length);
+
+	a = 0;
+	for (j = 0; j < r; j++) {
+		if (set_reset() == false)
+			ck_error("ERROR: Failed to reset hash table.\n");
+
+		s = rdtsc();
+		for (i = 0; i < keys_length; i++) {
+			unsigned long h = CK_HS_HASH(&hs, hs_hash, keys[i]);
+
+			if (ck_hs_apply(&hs, h, keys[i], test_apply, (void *)keys[i]) == false)
+				ck_error("ERROR: Failed in apply workload.\n");
+		}
+		e = rdtsc();
+		a += e - s;
+	}
+	agp = a / (r * keys_length);
+
+	fclose(fp);
+
+	for (i = 0; i < keys_length; i++) {
+		free(keys[i]);
+	}
+
+	printf("Get to put: %" PRIu64 " ticks\n", gp);
+	printf("     Apply: %" PRIu64 " ticks\n", agp);
+
+	free(keys);
+	keys_length = 0;
+	set_destroy();
+	return;
+}
+
+int
+main(int argc, char *argv[])
+{
+	unsigned int r, size;
+
+	common_srand48((long int)time(NULL));
+	if (argc < 2) {
+		ck_error("Usage: ck_hs <dictionary> [<repetitions> <initial size>]\n");
+	}
+
+	r = 16;
+	if (argc >= 3)
+		r = atoi(argv[2]);
+
+	size = 8;
+	if (argc >= 4)
+		size = atoi(argv[3]);
+
+	global_seed = common_lrand48();
+	run_test(argv[1], r, size, 0);
+
+	printf("\n==============================================\n"
+	    "Delete mode\n"
+	    "==============================================\n");
+	run_test(argv[1], r, size, CK_HS_MODE_DELETE);
+	return 0;
+}
+

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/0da17e96/lib/ck/regressions/ck_hs/benchmark/parallel_bytestring.c
----------------------------------------------------------------------
diff --git a/lib/ck/regressions/ck_hs/benchmark/parallel_bytestring.c b/lib/ck/regressions/ck_hs/benchmark/parallel_bytestring.c
index ea2eaec..e2e15c9 100644
--- a/lib/ck/regressions/ck_hs/benchmark/parallel_bytestring.c
+++ b/lib/ck/regressions/ck_hs/benchmark/parallel_bytestring.c
@@ -144,7 +144,7 @@ set_init(void)
 
 #ifdef HS_DELETE
 	mode |= CK_HS_MODE_DELETE;
-#endif 
+#endif
 
 	ck_epoch_init(&epoch_hs);
 	ck_epoch_register(&epoch_hs, &epoch_wr);

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/0da17e96/lib/ck/regressions/ck_hs/benchmark/serial.c
----------------------------------------------------------------------
diff --git a/lib/ck/regressions/ck_hs/benchmark/serial.c b/lib/ck/regressions/ck_hs/benchmark/serial.c
index 995ef1c..ac4caff 100644
--- a/lib/ck/regressions/ck_hs/benchmark/serial.c
+++ b/lib/ck/regressions/ck_hs/benchmark/serial.c
@@ -133,7 +133,7 @@ set_replace(const char *value)
 
 	h = CK_HS_HASH(&hs, hs_hash, value);
 	ck_hs_set(&hs, h, value, &previous);
-	return previous != NULL;
+	return previous == value;
 }
 
 static void *

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/0da17e96/lib/ck/regressions/ck_hs/validate/serial.c
----------------------------------------------------------------------
diff --git a/lib/ck/regressions/ck_hs/validate/serial.c b/lib/ck/regressions/ck_hs/validate/serial.c
index 93a375b..d6f6c0a 100644
--- a/lib/ck/regressions/ck_hs/validate/serial.c
+++ b/lib/ck/regressions/ck_hs/validate/serial.c
@@ -85,6 +85,49 @@ hs_compare(const void *previous, const void *compare)
 	return strcmp(previous, compare) == 0;
 }
 
+static void *
+test_ip(void *key, void *closure)
+{
+	const char *a = key;
+	const char *b = closure;
+
+	if (strcmp(a, b) != 0)
+		ck_error("Mismatch: %s != %s\n", a, b);
+
+	return closure;
+}
+
+static void *
+test_negative(void *key, void *closure)
+{
+
+	(void)closure;
+	if (key != NULL)
+		ck_error("ERROR: Apply callback expects NULL argument instead of [%s]\n", key);
+
+	return NULL;
+}
+
+static void *
+test_unique(void *key, void *closure)
+{
+
+	if (key != NULL)
+		ck_error("ERROR: Apply callback expects NULL argument instead of [%s]\n", key);
+
+	return closure;
+}
+
+static void *
+test_remove(void *key, void *closure)
+{
+
+	(void)key;
+	(void)closure;
+
+	return NULL;
+}
+
 static void
 run_test(unsigned int is, unsigned int ad)
 {
@@ -104,11 +147,22 @@ run_test(unsigned int is, unsigned int ad)
 				continue;
 			}
 
-			if (ck_hs_put_unique(&hs[j], h, test[i]) == false)
-				ck_error("ERROR [%zu]: Failed to insert unique (%s)\n", j, test[i]);
+			if (i & 1) {
+				if (ck_hs_put_unique(&hs[j], h, test[i]) == false)
+					ck_error("ERROR [%zu]: Failed to insert unique (%s)\n", j, test[i]);
+			} else if (ck_hs_apply(&hs[j], h, test[i], test_unique, (char *)test[i]) == false) {
+				ck_error("ERROR: Failed to apply for insertion.\n");
+			}
+
+			if (i & 1) {
+				if (ck_hs_remove(&hs[j], h, test[i]) == false)
+					ck_error("ERROR [%zu]: Failed to remove unique (%s)\n", j, test[i]);
+			} else if (ck_hs_apply(&hs[j], h, test[i], test_remove, NULL) == false) {
+				ck_error("ERROR: Failed to remove apply.\n");
+			}
 
-			if (ck_hs_remove(&hs[j], h, test[i]) == false)
-				ck_error("ERROR [%zu]: Failed to remove unique (%s)\n", j, test[i]);
+			if (ck_hs_apply(&hs[j], h, test[i], test_negative, (char *)test[i]) == false)
+				ck_error("ERROR: Failed to apply.\n");
 
 			break;
 		}
@@ -214,8 +268,16 @@ run_test(unsigned int is, unsigned int ad)
 			}
 
 			if (strcmp(r, test[i]) != 0) {
-				ck_error("ERROR [%u]: Invalid &hs[j]: %s != %s\n", (char *)r, test[i], is);
+				ck_error("ERROR [%u]: Invalid &hs[j]: %s != %s\n", is, test[i], (char *)r);
 			}
+
+			/* Attempt in-place mutation. */
+			if (ck_hs_apply(&hs[j], h, test[i], test_ip, (void *)test[i]) == false)
+				ck_error("ERROR [%u]: Failed to apply: %s != %s\n", is, (char *)r, test[i]);
+
+			d = ck_hs_get(&hs[j], h, test[i]) != NULL;
+			if (d == false)
+				ck_error("ERROR [%u]: Expected [%s] to exist.\n", is, test[i]);
 		}
 
 		if (j == size - 1)

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/0da17e96/lib/ck/regressions/ck_rhs/validate/serial.c
----------------------------------------------------------------------
diff --git a/lib/ck/regressions/ck_rhs/validate/serial.c b/lib/ck/regressions/ck_rhs/validate/serial.c
index 1dc4db1..d11b4e4 100644
--- a/lib/ck/regressions/ck_rhs/validate/serial.c
+++ b/lib/ck/regressions/ck_rhs/validate/serial.c
@@ -85,6 +85,49 @@ hs_compare(const void *previous, const void *compare)
 	return strcmp(previous, compare) == 0;
 }
 
+static void *
+test_ip(void *key, void *closure)
+{
+	const char *a = key;
+	const char *b = closure;
+
+	if (strcmp(a, b) != 0)
+		ck_error("Mismatch: %s != %s\n", a, b);
+
+	return closure;
+}
+
+static void *
+test_negative(void *key, void *closure)
+{
+
+	(void)closure;
+	if (key != NULL)
+		ck_error("ERROR: Apply callback expects NULL argument instead of [%s]\n", key);
+
+	return NULL;
+}
+
+static void *
+test_unique(void *key, void *closure)
+{
+
+	if (key != NULL)
+		ck_error("ERROR: Apply callback expects NULL argument instead of [%s]\n", key);
+
+	return closure;
+}
+
+static void *
+test_remove(void *key, void *closure)
+{
+
+	(void)key;
+	(void)closure;
+
+	return NULL;
+}
+
 static void
 run_test(unsigned int is, unsigned int ad)
 {
@@ -104,11 +147,22 @@ run_test(unsigned int is, unsigned int ad)
 				continue;
 			}
 
-			if (ck_rhs_put_unique(&hs[j], h, test[i]) == false)
-				ck_error("ERROR [%zu]: Failed to insert unique (%s)\n", j, test[i]);
+			if (i & 1) {
+				if (ck_rhs_put_unique(&hs[j], h, test[i]) == false)
+					ck_error("ERROR [%zu]: Failed to insert unique (%s)\n", j, test[i]);
+			} else if (ck_rhs_apply(&hs[j], h, test[i], test_unique, (char *)test[i]) == false) {
+				ck_error("ERROR: Failed to apply for insertion.\n");
+			}
 
-			if (ck_rhs_remove(&hs[j], h, test[i]) == false)
-				ck_error("ERROR [%zu]: Failed to remove unique (%s)\n", j, test[i]);
+			if (i & 1) {
+				if (ck_rhs_remove(&hs[j], h, test[i]) == false)
+					ck_error("ERROR [%zu]: Failed to remove unique (%s)\n", j, test[i]);
+			} else if (ck_rhs_apply(&hs[j], h, test[i], test_remove, NULL) == false) {
+				ck_error("ERROR: Failed to remove apply.\n");
+			}
+
+			if (ck_rhs_apply(&hs[j], h, test[i], test_negative, (char *)test[i]) == false)
+				ck_error("ERROR: Failed to apply.\n");
 
 			break;
 		}
@@ -213,6 +267,13 @@ run_test(unsigned int is, unsigned int ad)
 			if (strcmp(r, test[i]) != 0) {
 				ck_error("ERROR [%u]: Invalid &hs[j]: %s != %s\n", (char *)r, test[i], is);
 			}
+			/* Attempt in-place mutation. */
+			if (ck_rhs_apply(&hs[j], h, test[i], test_ip, (void *)test[i]) == false)
+				ck_error("ERROR [%u]: Failed to apply: %s != %s\n", is, (char *)r, test[i]);
+
+			d = ck_rhs_get(&hs[j], h, test[i]) != NULL;
+			if (d == false)
+				ck_error("ERROR [%u]: Expected [%s] to exist.\n", is, test[i]);
 		}
 
 		if (j == size - 1)

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/0da17e96/lib/ck/regressions/ck_ring/validate/Makefile
----------------------------------------------------------------------
diff --git a/lib/ck/regressions/ck_ring/validate/Makefile b/lib/ck/regressions/ck_ring/validate/Makefile
index 8c00d80..d8beb77 100644
--- a/lib/ck/regressions/ck_ring/validate/Makefile
+++ b/lib/ck/regressions/ck_ring/validate/Makefile
@@ -2,7 +2,6 @@
 
 OBJECTS=ck_ring_spsc ck_ring_spmc ck_ring_spmc_template
 SIZE=16384
-CFLAGS += -g2
 
 all: $(OBJECTS)
 
@@ -15,11 +14,11 @@ ck_ring_spsc: ck_ring_spsc.c ../../../include/ck_ring.h
 		../../../src/ck_barrier_centralized.c
 
 ck_ring_spmc: ck_ring_spmc.c ../../../include/ck_ring.h
-	$(CC) $(CFLAGS) -g2  -o ck_ring_spmc ck_ring_spmc.c \
+	$(CC) $(CFLAGS) -o ck_ring_spmc ck_ring_spmc.c \
 		../../../src/ck_barrier_centralized.c
 
 ck_ring_spmc_template: ck_ring_spmc_template.c ../../../include/ck_ring.h
-	$(CC) $(CFLAGS) -g2  -o ck_ring_spmc_template ck_ring_spmc.c \
+	$(CC) $(CFLAGS) -o ck_ring_spmc_template ck_ring_spmc_template.c \
 		../../../src/ck_barrier_centralized.c
 
 clean:

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/0da17e96/lib/ck/regressions/ck_ring/validate/ck_ring_spmc.c
----------------------------------------------------------------------
diff --git a/lib/ck/regressions/ck_ring/validate/ck_ring_spmc.c b/lib/ck/regressions/ck_ring/validate/ck_ring_spmc.c
index 23fe0fa..9563a8f 100644
--- a/lib/ck/regressions/ck_ring/validate/ck_ring_spmc.c
+++ b/lib/ck/regressions/ck_ring/validate/ck_ring_spmc.c
@@ -197,7 +197,7 @@ test(void *c)
 	for (i = 0; i < ITERATIONS; i++) {
 		for (j = 0; j < size; j++) {
 			buffer = _context[context->previous].buffer;
-			while (ck_ring_dequeue_spmc(ring + context->previous, 
+			while (ck_ring_dequeue_spmc(ring + context->previous,
 			    buffer, &entry) == false);
 
 			if (context->previous != (unsigned int)entry->tid) {
@@ -315,7 +315,7 @@ main(int argc, char *argv[])
 		/* Wait until queue is not full. */
 		if (l & 1) {
 			while (ck_ring_enqueue_spmc(&ring_spmc,
-			    buffer, 
+			    buffer,
 			    entry) == false)
 				ck_pr_stall();
 		} else {

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/0da17e96/lib/ck/regressions/ck_ring/validate/ck_ring_spmc_template.c
----------------------------------------------------------------------
diff --git a/lib/ck/regressions/ck_ring/validate/ck_ring_spmc_template.c b/lib/ck/regressions/ck_ring/validate/ck_ring_spmc_template.c
index 9facbc7..8840653 100644
--- a/lib/ck/regressions/ck_ring/validate/ck_ring_spmc_template.c
+++ b/lib/ck/regressions/ck_ring/validate/ck_ring_spmc_template.c
@@ -43,7 +43,7 @@ struct context {
 	unsigned int tid;
 	unsigned int previous;
 	unsigned int next;
-	struct entry *buffer;
+	struct entry **buffer;
 };
 
 struct entry {
@@ -54,7 +54,7 @@ struct entry {
 	int value;
 };
 
-CK_RING_PROTOTYPE(entry, entry)
+CK_RING_PROTOTYPE(entry, entry *)
 
 static int nthr;
 static ck_ring_t *ring;
@@ -73,7 +73,7 @@ test_spmc(void *c)
 	unsigned int seed;
 	int i, k, j, tid;
 	struct context *context = c;
-	struct entry *buffer;
+	struct entry **buffer;
 
 	buffer = context->buffer;
         if (aff_iterate(&a)) {
@@ -136,11 +136,11 @@ static void *
 test(void *c)
 {
 	struct context *context = c;
-	struct entry entry;
+	struct entry *entry;
 	unsigned int s;
 	int i, j;
 	bool r;
-	ck_ring_buffer_t *buffer = context->buffer;
+	struct entry **buffer = context->buffer;
 	ck_barrier_centralized_state_t sense =
 	    CK_BARRIER_CENTRALIZED_STATE_INITIALIZER;
 
@@ -150,9 +150,9 @@ test(void *c)
         }
 
 	if (context->tid == 0) {
-		struct entry *entries;
+		struct entry **entries;
 
-		entries = malloc(sizeof(struct entry) * size);
+		entries = malloc(sizeof(struct entry *) * size);
 		assert(entries != NULL);
 
 		if (ck_ring_size(ring) != 0) {
@@ -161,15 +161,18 @@ test(void *c)
 		}
 
 		for (i = 0; i < size; i++) {
-			entries[i].value = i;
-			entries[i].tid = 0;
+			entries[i] = malloc(sizeof(struct entry));
+			assert(entries[i] != NULL);
+
+			entries[i]->value = i;
+			entries[i]->tid = 0;
 
 			if (i & 1) {
 				r = CK_RING_ENQUEUE_SPMC(entry, ring, buffer,
-				    entries + i);
+				    &entries[i]);
 			} else {
 				r = CK_RING_ENQUEUE_SPMC_SIZE(entry, ring,
-					buffer, entries + i, &s);
+					buffer, &entries[i], &s);
 
 				if ((int)s != i) {
 					ck_error("Size is %u, expected %d.\n",
@@ -200,7 +203,7 @@ test(void *c)
 		for (j = 0; j < size; j++) {
 			buffer = _context[context->previous].buffer;
 			while (CK_RING_DEQUEUE_SPMC(entry,
-			    ring + context->previous, 
+			    ring + context->previous,
 			    buffer, &entry) == false);
 
 			if (context->previous != (unsigned int)entry->tid) {
@@ -245,7 +248,7 @@ main(int argc, char *argv[])
 	int i, r;
 	unsigned long l;
 	pthread_t *thread;
-	struct entry *buffer;
+	struct entry **buffer;
 
 	if (argc != 4) {
 		ck_error("Usage: validate <threads> <affinity delta> <size>\n");
@@ -284,9 +287,9 @@ main(int argc, char *argv[])
 			_context[i].previous = i - 1;
 		}
 
-		buffer = malloc(sizeof(struct entry) * (size + 1));
+		buffer = malloc(sizeof(struct entry *) * (size + 1));
 		assert(buffer);
-		memset(buffer, 0, sizeof(struct entry) * (size + 1));
+		memset(buffer, 0, sizeof(struct entry *) * (size + 1));
 		_context[i].buffer = buffer;
 		ck_ring_init(ring + i, size + 1);
 		r = pthread_create(thread + i, NULL, test, _context + i);
@@ -299,9 +302,9 @@ main(int argc, char *argv[])
 	fprintf(stderr, " done\n");
 
 	fprintf(stderr, "SPMC test:\n");
-	buffer = malloc(sizeof(ck_ring_buffer_t) * (size + 1));
+	buffer = malloc(sizeof(struct entry *) * (size + 1));
 	assert(buffer);
-	memset(buffer, 0, sizeof(void *) * (size + 1));
+	memset(buffer, 0, sizeof(struct entry *) * (size + 1));
 	ck_ring_init(&ring_spmc, size + 1);
 	for (i = 0; i < nthr - 1; i++) {
 		_context[i].buffer = buffer;
@@ -322,14 +325,14 @@ main(int argc, char *argv[])
 		/* Wait until queue is not full. */
 		if (l & 1) {
 			while (CK_RING_ENQUEUE_SPMC(entry, &ring_spmc,
-			    buffer, entry) == false) {
+			    buffer, &entry) == false) {
 				ck_pr_stall();
 			}
 		} else {
 			unsigned int s;
 
 			while (CK_RING_ENQUEUE_SPMC_SIZE(entry, &ring_spmc,
-			    buffer, entry, &s) == false) {
+			    buffer, &entry, &s) == false) {
 				ck_pr_stall();
 			}
 
@@ -342,6 +345,6 @@ main(int argc, char *argv[])
 	for (i = 0; i < nthr - 1; i++)
 		pthread_join(thread[i], NULL);
 
-	return (0);
+	return 0;
 }
 

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/0da17e96/lib/ck/regressions/ck_spinlock/validate/Makefile
----------------------------------------------------------------------
diff --git a/lib/ck/regressions/ck_spinlock/validate/Makefile b/lib/ck/regressions/ck_spinlock/validate/Makefile
index 731b68b..0d78e09 100644
--- a/lib/ck/regressions/ck_spinlock/validate/Makefile
+++ b/lib/ck/regressions/ck_spinlock/validate/Makefile
@@ -50,7 +50,7 @@ ck_dec: ck_dec.c
 
 clean:
 	rm -rf ck_ticket ck_mcs ck_dec ck_cas ck_fas ck_clh linux_spinlock ck_ticket_pb \
-		ck_anderson ck_spinlock *.dSYM *.exe
+		ck_anderson ck_spinlock ck_hclh *.dSYM *.exe
 
 include ../../../build/regressions.build
 CFLAGS+=$(PTHREAD_CFLAGS) -D_GNU_SOURCE -lm

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/0da17e96/lib/ck/regressions/common.h
----------------------------------------------------------------------
diff --git a/lib/ck/regressions/common.h b/lib/ck/regressions/common.h
index f100e89..4322a07 100644
--- a/lib/ck/regressions/common.h
+++ b/lib/ck/regressions/common.h
@@ -289,7 +289,7 @@ CK_CC_UNUSED static int
 aff_iterate_core(struct affinity *acb, unsigned int *core)
 {
 	cpu_set_t s;
-	
+
 	*core = ck_pr_faa_uint(&acb->request, acb->delta);
 	CPU_ZERO(&s);
 	CPU_SET((*core) % CORES, &s);
@@ -454,4 +454,3 @@ ck_error(const char *message, ...)
 	va_end(ap);
 	exit(EXIT_FAILURE);
 }
-

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/0da17e96/lib/ck/src/ck_array.c
----------------------------------------------------------------------
diff --git a/lib/ck/src/ck_array.c b/lib/ck/src/ck_array.c
index 238ce0b..f7bb87a 100644
--- a/lib/ck/src/ck_array.c
+++ b/lib/ck/src/ck_array.c
@@ -238,4 +238,3 @@ ck_array_deinit(struct ck_array *array, bool defer)
 	array->transaction = array->active = NULL;
 	return;
 }
-

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/0da17e96/lib/ck/src/ck_barrier_centralized.c
----------------------------------------------------------------------
diff --git a/lib/ck/src/ck_barrier_centralized.c b/lib/ck/src/ck_barrier_centralized.c
index f0604a0..a21ef3e 100644
--- a/lib/ck/src/ck_barrier_centralized.c
+++ b/lib/ck/src/ck_barrier_centralized.c
@@ -57,4 +57,3 @@ ck_barrier_centralized(struct ck_barrier_centralized *barrier,
 	ck_pr_fence_memory();
 	return;
 }
-

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/0da17e96/lib/ck/src/ck_barrier_combining.c
----------------------------------------------------------------------
diff --git a/lib/ck/src/ck_barrier_combining.c b/lib/ck/src/ck_barrier_combining.c
index b9df1d4..41291bb 100644
--- a/lib/ck/src/ck_barrier_combining.c
+++ b/lib/ck/src/ck_barrier_combining.c
@@ -205,4 +205,3 @@ ck_barrier_combining(struct ck_barrier_combining *barrier,
 	state->sense = ~state->sense;
 	return;
 }
-

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/0da17e96/lib/ck/src/ck_barrier_dissemination.c
----------------------------------------------------------------------
diff --git a/lib/ck/src/ck_barrier_dissemination.c b/lib/ck/src/ck_barrier_dissemination.c
index 867e224..dd08923 100644
--- a/lib/ck/src/ck_barrier_dissemination.c
+++ b/lib/ck/src/ck_barrier_dissemination.c
@@ -121,4 +121,3 @@ ck_barrier_dissemination(struct ck_barrier_dissemination *barrier,
 	state->parity = 1 - state->parity;
 	return;
 }
-

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/0da17e96/lib/ck/src/ck_barrier_mcs.c
----------------------------------------------------------------------
diff --git a/lib/ck/src/ck_barrier_mcs.c b/lib/ck/src/ck_barrier_mcs.c
index ed5959c..4dc8502 100644
--- a/lib/ck/src/ck_barrier_mcs.c
+++ b/lib/ck/src/ck_barrier_mcs.c
@@ -138,4 +138,3 @@ ck_barrier_mcs(struct ck_barrier_mcs *barrier,
 	state->sense = ~state->sense;
 	return;
 }
-

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/0da17e96/lib/ck/src/ck_barrier_tournament.c
----------------------------------------------------------------------
diff --git a/lib/ck/src/ck_barrier_tournament.c b/lib/ck/src/ck_barrier_tournament.c
index e505890..0f76c6f 100644
--- a/lib/ck/src/ck_barrier_tournament.c
+++ b/lib/ck/src/ck_barrier_tournament.c
@@ -181,4 +181,3 @@ leave:
 	state->sense = ~state->sense;
 	return;
 }
-

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/0da17e96/lib/ck/src/ck_epoch.c
----------------------------------------------------------------------
diff --git a/lib/ck/src/ck_epoch.c b/lib/ck/src/ck_epoch.c
index 343667c..01320ee 100644
--- a/lib/ck/src/ck_epoch.c
+++ b/lib/ck/src/ck_epoch.c
@@ -87,7 +87,7 @@
  * at e_g - 1 to still be accessed at e_g as threads are "active"
  * at the same time (real-world time) mutating shared objects.
  *
- * Now, if the epoch counter is ticked to e_g + 1, then no new 
+ * Now, if the epoch counter is ticked to e_g + 1, then no new
  * hazardous references could exist to objects logically deleted at
  * e_g - 1. The reason for this is that at e_g + 1, all epoch read-side
  * critical sections started at e_g - 1 must have been completed. If
@@ -118,7 +118,7 @@
  * sufficient to represent e_g using only the values 0, 1 or 2. Every time
  * a thread re-visits a e_g (which can be determined with a non-empty deferral
  * list) it can assume objects in the e_g deferral list involved at least
- * three e_g transitions and are thus, safe, for physical deletion. 
+ * three e_g transitions and are thus, safe, for physical deletion.
  *
  * Blocking semantics for epoch reclamation have additional restrictions.
  * Though we only require three deferral lists, reasonable blocking semantics
@@ -257,12 +257,16 @@ static void
 ck_epoch_dispatch(struct ck_epoch_record *record, unsigned int e)
 {
 	unsigned int epoch = e & (CK_EPOCH_LENGTH - 1);
-	ck_stack_entry_t *next, *cursor;
+	ck_stack_entry_t *head, *next, *cursor;
 	unsigned int i = 0;
 
-	CK_STACK_FOREACH_SAFE(&record->pending[epoch], cursor, next) {
+	head = CK_STACK_FIRST(&record->pending[epoch]);
+	ck_stack_init(&record->pending[epoch]);
+
+	for (cursor = head; cursor != NULL; cursor = next) {
 		struct ck_epoch_entry *entry = ck_epoch_entry_container(cursor);
 
+		next = CK_STACK_NEXT(cursor);
 		entry->function(entry);
 		i++;
 	}
@@ -272,7 +276,6 @@ ck_epoch_dispatch(struct ck_epoch_record *record, unsigned int e)
 
 	record->n_dispatch += i;
 	record->n_pending -= i;
-	ck_stack_init(&record->pending[epoch]);
 	return;
 }
 
@@ -426,4 +429,3 @@ ck_epoch_poll(struct ck_epoch *global, struct ck_epoch_record *record)
 	ck_epoch_dispatch(record, epoch + 1);
 	return true;
 }
-

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/0da17e96/lib/ck/src/ck_hp.c
----------------------------------------------------------------------
diff --git a/lib/ck/src/ck_hp.c b/lib/ck/src/ck_hp.c
index 634d94d..a39ff58 100644
--- a/lib/ck/src/ck_hp.c
+++ b/lib/ck/src/ck_hp.c
@@ -321,4 +321,3 @@ ck_hp_purge(struct ck_hp_record *thread)
 
 	return;
 }
-

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/0da17e96/lib/ck/src/ck_hs.c
----------------------------------------------------------------------
diff --git a/lib/ck/src/ck_hs.c b/lib/ck/src/ck_hs.c
index 6769dad..5808876 100644
--- a/lib/ck/src/ck_hs.c
+++ b/lib/ck/src/ck_hs.c
@@ -369,6 +369,17 @@ restart:
 	return true;
 }
 
+static void
+ck_hs_map_postinsert(struct ck_hs *hs, struct ck_hs_map *map)
+{
+
+	map->n_entries++;
+	if ((map->n_entries << 1) > map->capacity)
+		ck_hs_grow(hs, map->capacity << 1);
+
+	return;
+}
+
 bool
 ck_hs_rebuild(struct ck_hs *hs)
 {
@@ -587,7 +598,7 @@ ck_hs_gc(struct ck_hs *hs, unsigned long cycles, unsigned long seed)
 	if (maximum != map->probe_maximum)
 		ck_pr_store_uint(&map->probe_maximum, maximum);
 
-	if (bounds != NULL) { 
+	if (bounds != NULL) {
 		for (i = 0; i < map->capacity; i++)
 			CK_HS_STORE(&map->probe_bound[i], bounds[i]);
 
@@ -630,6 +641,90 @@ ck_hs_fas(struct ck_hs *hs,
 	return true;
 }
 
+/*
+ * An apply function takes two arguments. The first argument is a pointer to a
+ * pre-existing object. The second argument is a pointer to the fifth argument
+ * passed to ck_hs_apply. If a non-NULL pointer is passed to the first argument
+ * and the return value of the apply function is NULL, then the pre-existing
+ * value is deleted. If the return pointer is the same as the one passed to the
+ * apply function then no changes are made to the hash table.  If the first
+ * argument is non-NULL and the return pointer is different than that passed to
+ * the apply function, then the pre-existing value is replaced. For
+ * replacement, it is required that the value itself is identical to the
+ * previous value.
+ */
+bool
+ck_hs_apply(struct ck_hs *hs,
+    unsigned long h,
+    const void *key,
+    ck_hs_apply_fn_t *fn,
+    void *cl)
+{
+	void **slot, **first, *object, *insert, *delta;
+	unsigned long n_probes;
+	struct ck_hs_map *map;
+
+restart:
+	map = hs->map;
+
+	slot = ck_hs_map_probe(hs, map, &n_probes, &first, h, key, &object, map->probe_limit, CK_HS_PROBE_INSERT);
+	if (slot == NULL && first == NULL) {
+		if (ck_hs_grow(hs, map->capacity << 1) == false)
+			return false;
+
+		goto restart;
+	}
+
+	delta = fn(object, cl);
+	if (delta == NULL) {
+		/*
+		 * The apply function has requested deletion. If the object doesn't exist,
+		 * then exit early.
+		 */
+		if (CK_CC_UNLIKELY(object == NULL))
+			return true;
+
+		/* Otherwise, mark slot as deleted. */
+		ck_pr_store_ptr(slot, CK_HS_TOMBSTONE);
+		map->n_entries--;
+		map->tombstones++;
+		return true;
+	}
+
+	/* The apply function has not requested hash set modification so exit early. */
+	if (delta == object)
+		return true;
+
+	/* A modification or insertion has been requested. */
+	ck_hs_map_bound_set(map, h, n_probes);
+
+	insert = ck_hs_marshal(hs->mode, delta, h);
+	if (first != NULL) {
+		/*
+		 * This follows the same semantics as ck_hs_set, please refer to that
+		 * function for documentation.
+		 */
+		ck_pr_store_ptr(first, insert);
+
+		if (object != NULL) {
+			ck_pr_inc_uint(&map->generation[h & CK_HS_G_MASK]);
+			ck_pr_fence_atomic_store();
+			ck_pr_store_ptr(slot, CK_HS_TOMBSTONE);
+		}
+	} else {
+		/*
+		 * If we are storing into same slot, then atomic store is sufficient
+		 * for replacement.
+		 */
+		ck_pr_store_ptr(slot, insert);
+	}
+
+	if (object == NULL)
+		ck_hs_map_postinsert(hs, map);
+
+	return true;
+}
+
 bool
 ck_hs_set(struct ck_hs *hs,
     unsigned long h,
@@ -680,11 +775,8 @@ restart:
 		ck_pr_store_ptr(slot, insert);
 	}
 
-	if (object == NULL) {
-		map->n_entries++;
-		if ((map->n_entries << 1) > map->capacity)
-			ck_hs_grow(hs, map->capacity << 1);
-	}
+	if (object == NULL)
+		ck_hs_map_postinsert(hs, map);
 
 	*previous = object;
 	return true;
@@ -728,10 +820,7 @@ restart:
 		ck_pr_store_ptr(slot, insert);
 	}
 
-	map->n_entries++;
-	if ((map->n_entries << 1) > map->capacity)
-		ck_hs_grow(hs, map->capacity << 1);
-
+	ck_hs_map_postinsert(hs, map);
 	return true;
 }
 
@@ -764,7 +853,7 @@ ck_hs_get(struct ck_hs *hs,
 	unsigned int g, g_p, probe;
 	unsigned int *generation;
 
-	do { 
+	do {
 		map = ck_pr_load_ptr(&hs->map);
 		generation = &map->generation[h & CK_HS_G_MASK];
 		g = ck_pr_load_uint(generation);
@@ -842,4 +931,3 @@ ck_hs_init(struct ck_hs *hs,
 	hs->map = ck_hs_map_create(hs, n_entries);
 	return hs->map != NULL;
 }
-

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/0da17e96/lib/ck/src/ck_ht.c
----------------------------------------------------------------------
diff --git a/lib/ck/src/ck_ht.c b/lib/ck/src/ck_ht.c
index ea9de1e..324a03d 100644
--- a/lib/ck/src/ck_ht.c
+++ b/lib/ck/src/ck_ht.c
@@ -395,7 +395,7 @@ ck_ht_gc(struct ck_ht *ht, unsigned long cycles, unsigned long seed)
 
 		return true;
 	}
-	
+
 	if (cycles == 0) {
 		maximum = 0;
 
@@ -1027,4 +1027,3 @@ ck_ht_destroy(struct ck_ht *table)
 }
 
 #endif /* CK_F_HT */
-

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/0da17e96/lib/ck/src/ck_ht_hash.h
----------------------------------------------------------------------
diff --git a/lib/ck/src/ck_ht_hash.h b/lib/ck/src/ck_ht_hash.h
index 254e3b8..075c2c1 100644
--- a/lib/ck/src/ck_ht_hash.h
+++ b/lib/ck/src/ck_ht_hash.h
@@ -175,7 +175,7 @@ static inline uint64_t MurmurHash64A ( const void * key, int len, uint64_t seed
   while(data != end)
   {
     uint64_t k;
- 
+
     if (!((uintptr_t)data & 0x7))
 	    k = *data++;
     else {

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/0da17e96/lib/ck/src/ck_rhs.c
----------------------------------------------------------------------
diff --git a/lib/ck/src/ck_rhs.c b/lib/ck/src/ck_rhs.c
index 962a94c..76043ea 100644
--- a/lib/ck/src/ck_rhs.c
+++ b/lib/ck/src/ck_rhs.c
@@ -327,11 +327,11 @@ ck_rhs_map_create(struct ck_rhs *hs, unsigned long entries)
 	if (hs->mode & CK_RHS_MODE_READ_MOSTLY)
 		size = sizeof(struct ck_rhs_map) +
 		    (sizeof(void *) * n_entries +
-		     sizeof(struct ck_rhs_no_entry_desc) * n_entries + 
+		     sizeof(struct ck_rhs_no_entry_desc) * n_entries +
 		     2 * CK_MD_CACHELINE - 1);
 	else
 		size = sizeof(struct ck_rhs_map) +
-		    (sizeof(struct ck_rhs_entry_desc) * n_entries + 
+		    (sizeof(struct ck_rhs_entry_desc) * n_entries +
 		     CK_MD_CACHELINE - 1);
 	map = hs->m->malloc(size);
 	if (map == NULL)
@@ -408,7 +408,7 @@ ck_rhs_map_probe_next(struct ck_rhs_map *map,
 {
 
 	if (probes & map->offset_mask) {
-		offset = (offset &~ map->offset_mask) + 
+		offset = (offset &~ map->offset_mask) +
 		    ((offset + 1) & map->offset_mask);
 		return offset;
 	} else
@@ -421,10 +421,10 @@ ck_rhs_map_probe_prev(struct ck_rhs_map *map, unsigned long offset,
 {
 
 	if (probes & map->offset_mask) {
-		offset = (offset &~ map->offset_mask) + ((offset - 1) & 
+		offset = (offset &~ map->offset_mask) + ((offset - 1) &
 		    map->offset_mask);
 		return offset;
-	} else 
+	} else
 		return ((offset - probes) & map->mask);
 }
 
@@ -616,7 +616,7 @@ ck_rhs_map_probe_rm(struct ck_rhs *hs,
 		if (behavior != CK_RHS_PROBE_NO_RH) {
 			struct ck_rhs_entry_desc *desc = (void *)&map->entries.no_entries.descs[offset];
 
-			if (pr == -1 && 
+			if (pr == -1 &&
 			    desc->in_rh == false && desc->probes < probes) {
 				pr = offset;
 				*n_probes = probes;
@@ -730,7 +730,7 @@ ck_rhs_map_probe(struct ck_rhs *hs,
 		if ((behavior != CK_RHS_PROBE_NO_RH)) {
 			struct ck_rhs_entry_desc *desc = &map->entries.descs[offset];
 
-			if (pr == -1 && 
+			if (pr == -1 &&
 			    desc->in_rh == false && desc->probes < probes) {
 				pr = offset;
 				*n_probes = probes;
@@ -818,7 +818,7 @@ ck_rhs_gc(struct ck_rhs *hs)
 }
 
 static void
-ck_rhs_add_wanted(struct ck_rhs *hs, long end_offset, long old_slot, 
+ck_rhs_add_wanted(struct ck_rhs *hs, long end_offset, long old_slot,
 	unsigned long h)
 {
 	struct ck_rhs_map *map = hs->map;
@@ -872,7 +872,7 @@ ck_rhs_get_first_offset(struct ck_rhs_map *map, unsigned long offset, unsigned i
 	while (probes > (unsigned long)map->offset_mask + 1) {
 		offset -= ((probes - 1) &~ map->offset_mask);
 		offset &= map->mask;
-		offset = (offset &~ map->offset_mask) + 
+		offset = (offset &~ map->offset_mask) +
 		    ((offset - map->offset_mask) & map->offset_mask);
 		probes -= map->offset_mask + 1;
 	}
@@ -892,7 +892,7 @@ ck_rhs_put_robin_hood(struct ck_rhs *hs,
 	unsigned long h = 0;
 	long prev;
 	void *key;
-	long prevs[512];
+	long prevs[CK_RHS_MAX_RH];
 	unsigned int prevs_nb = 0;
 
 	map = hs->map;
@@ -948,7 +948,7 @@ restart:
 		prev = prevs[--prevs_nb];
 		ck_pr_store_ptr(ck_rhs_entry_addr(map, orig_slot),
 		    ck_rhs_entry(map, prev));
-		h = ck_rhs_get_first_offset(map, orig_slot, 
+		h = ck_rhs_get_first_offset(map, orig_slot,
 		    desc->probes);
 		ck_rhs_add_wanted(hs, orig_slot, prev, h);
 		ck_pr_inc_uint(&map->generation[h & CK_RHS_G_MASK]);
@@ -966,7 +966,7 @@ ck_rhs_do_backward_shift_delete(struct ck_rhs *hs, long slot)
 	struct ck_rhs_map *map = hs->map;
 	struct ck_rhs_entry_desc *desc, *new_desc = NULL;
 	unsigned long h;
-	
+
 	desc = ck_rhs_desc(map, slot);
 	h = ck_rhs_remove_wanted(hs, slot, -1);
 	while (desc->wanted > 0) {
@@ -1089,6 +1089,121 @@ restart:
 	return true;
 }
 
+/*
+ * An apply function takes two arguments. The first argument is a pointer to a
+ * pre-existing object. The second argument is a pointer to the fifth argument
+ * passed to ck_hs_apply. If a non-NULL pointer is passed to the first argument
+ * and the return value of the apply function is NULL, then the pre-existing
+ * value is deleted. If the return pointer is the same as the one passed to the
+ * apply function then no changes are made to the hash table.  If the first
+ * argument is non-NULL and the return pointer is different than that passed to
+ * the apply function, then the pre-existing value is replaced. For
+ * replacement, it is required that the value itself is identical to the
+ * previous value.
+ */
+bool
+ck_rhs_apply(struct ck_rhs *hs,
+    unsigned long h,
+    const void *key,
+    ck_rhs_apply_fn_t *fn,
+    void *cl)
+{
+	void  *object, *insert, *delta = false;
+	unsigned long n_probes;
+	long slot, first;
+	struct ck_rhs_map *map;
+	bool delta_set = false;
+
+restart:
+	map = hs->map;
+
+	slot = map->probe_func(hs, map, &n_probes, &first, h, key, &object, map->probe_limit, CK_RHS_PROBE_INSERT);
+	if (slot == -1 && first == -1) {
+		if (ck_rhs_grow(hs, map->capacity << 1) == false)
+			return false;
+
+		goto restart;
+	}
+	if (!delta_set) {
+		delta = fn(object, cl);
+		delta_set = true;
+	}
+
+	if (delta == NULL) {
+		/*
+		 * The apply function has requested deletion. If the object doesn't exist,
+		 * then exit early.
+		 */
+		if (CK_CC_UNLIKELY(object == NULL))
+			return true;
+
+		/* Otherwise, delete it. */
+		ck_rhs_do_backward_shift_delete(hs, slot);
+		return true;
+	}
+
+	/* The apply function has not requested hash set modification so exit early. */
+	if (delta == object)
+		return true;
+
+	/* A modification or insertion has been requested. */
+	ck_rhs_map_bound_set(map, h, n_probes);
+
+	insert = ck_rhs_marshal(hs->mode, delta, h);
+	if (first != -1) {
+		/*
+		 * This follows the same semantics as ck_hs_set, please refer to that
+		 * function for documentation.
+		 */
+		struct ck_rhs_entry_desc *desc = NULL, *desc2;
+		if (slot != -1) {
+			desc = ck_rhs_desc(map, slot);
+			desc->in_rh = true;
+		}
+		desc2 = ck_rhs_desc(map, first);
+		int ret = ck_rhs_put_robin_hood(hs, first, desc2);
+		if (slot != -1)
+			desc->in_rh = false;
+
+		if (CK_CC_UNLIKELY(ret == 1))
+			goto restart;
+		if (CK_CC_UNLIKELY(ret == -1))
+			return false;
+		/* If an earlier bucket was found, then store entry there. */
+		ck_pr_store_ptr(ck_rhs_entry_addr(map, first), insert);
+		desc2->probes = n_probes;
+		/*
+		 * If a duplicate key was found, then delete it after
+		 * signaling concurrent probes to restart. Optionally,
+		 * it is possible to install tombstone after grace
+		 * period if we can guarantee earlier position of
+		 * duplicate key.
+		 */
+		ck_rhs_add_wanted(hs, first, -1, h);
+		if (object != NULL) {
+			ck_pr_inc_uint(&map->generation[h & CK_RHS_G_MASK]);
+			ck_pr_fence_atomic_store();
+			ck_rhs_do_backward_shift_delete(hs, slot);
+		}
+	} else {
+		/*
+		 * If we are storing into same slot, then atomic store is sufficient
+		 * for replacement.
+		 */
+		ck_pr_store_ptr(ck_rhs_entry_addr(map, slot), insert);
+		ck_rhs_set_probes(map, slot, n_probes);
+		if (object == NULL)
+			ck_rhs_add_wanted(hs, slot, -1, h);
+	}
+
+	if (object == NULL) {
+		map->n_entries++;
+		if ((map->n_entries ) > ((map->capacity * CK_RHS_LOAD_FACTOR) / 100))
+			ck_rhs_grow(hs, map->capacity << 1);
+	}
+	return true;
+}
+
 bool
 ck_rhs_set(struct ck_rhs *hs,
     unsigned long h,
@@ -1140,7 +1255,7 @@ restart:
 		 * period if we can guarantee earlier position of
 		 * duplicate key.
 		 */
-		ck_rhs_add_wanted(hs, first, -1, h); 
+		ck_rhs_add_wanted(hs, first, -1, h);
 		if (object != NULL) {
 			ck_pr_inc_uint(&map->generation[h & CK_RHS_G_MASK]);
 			ck_pr_fence_atomic_store();
@@ -1155,7 +1270,7 @@ restart:
 		ck_pr_store_ptr(ck_rhs_entry_addr(map, slot), insert);
 		ck_rhs_set_probes(map, slot, n_probes);
 		if (object == NULL)
-			ck_rhs_add_wanted(hs, slot, -1, h); 
+			ck_rhs_add_wanted(hs, slot, -1, h);
 	}
 
 	if (object == NULL) {
@@ -1209,12 +1324,12 @@ restart:
 		/* Insert key into first bucket in probe sequence. */
 		ck_pr_store_ptr(ck_rhs_entry_addr(map, first), insert);
 		desc->probes = n_probes;
-		ck_rhs_add_wanted(hs, first, -1, h); 
+		ck_rhs_add_wanted(hs, first, -1, h);
 	} else {
 		/* An empty slot was found. */
 		ck_pr_store_ptr(ck_rhs_entry_addr(map, slot), insert);
 		ck_rhs_set_probes(map, slot, n_probes);
-		ck_rhs_add_wanted(hs, slot, -1, h); 
+		ck_rhs_add_wanted(hs, slot, -1, h);
 	}
 
 	map->n_entries++;
@@ -1253,7 +1368,7 @@ ck_rhs_get(struct ck_rhs *hs,
 	unsigned int g, g_p, probe;
 	unsigned int *generation;
 
-	do { 
+	do {
 		map = ck_pr_load_ptr(&hs->map);
 		generation = &map->generation[h & CK_RHS_G_MASK];
 		g = ck_pr_load_uint(generation);
@@ -1332,4 +1447,3 @@ ck_rhs_init(struct ck_rhs *hs,
 	hs->map = ck_rhs_map_create(hs, n_entries);
 	return hs->map != NULL;
 }
-


[3/3] trafficserver git commit: Merge libck master (0.4.5-5-g1df6df0)

Posted by so...@apache.org.
Merge libck master (0.4.5-5-g1df6df0)


Project: http://git-wip-us.apache.org/repos/asf/trafficserver/repo
Commit: http://git-wip-us.apache.org/repos/asf/trafficserver/commit/0da17e96
Tree: http://git-wip-us.apache.org/repos/asf/trafficserver/tree/0da17e96
Diff: http://git-wip-us.apache.org/repos/asf/trafficserver/diff/0da17e96

Branch: refs/heads/master
Commit: 0da17e968edc9d51d4d509661f2ae38907b4acb2
Parents: f83d6f2
Author: Phil Sorber <so...@apache.org>
Authored: Fri Jan 30 18:15:59 2015 -0700
Committer: Phil Sorber <so...@apache.org>
Committed: Fri Jan 30 18:18:23 2015 -0700

----------------------------------------------------------------------
 lib/ck/build/ck.build.in                        |   4 +-
 lib/ck/build/ck.build.ppc64                     |   1 +
 lib/ck/build/ck.build.x86                       |   1 +
 lib/ck/build/ck.build.x86_64                    |   1 +
 lib/ck/configure                                |   4 +-
 lib/ck/doc/CK_COHORT_INIT                       |   6 +-
 lib/ck/doc/CK_COHORT_LOCK                       |   6 +-
 lib/ck/doc/CK_COHORT_PROTOTYPE                  |   2 +-
 lib/ck/doc/CK_COHORT_TRYLOCK                    |  10 +-
 lib/ck/doc/CK_COHORT_TRYLOCK_PROTOTYPE          |   4 +-
 lib/ck/doc/CK_COHORT_UNLOCK                     |   6 +-
 lib/ck/doc/CK_RWCOHORT_INIT                     |   4 +-
 lib/ck/doc/CK_RWCOHORT_INSTANCE                 |   4 +-
 lib/ck/doc/CK_RWCOHORT_PROTOTYPE                |   4 +-
 lib/ck/doc/CK_RWCOHORT_READ_LOCK                |  18 +-
 lib/ck/doc/CK_RWCOHORT_READ_UNLOCK              |  16 +-
 lib/ck/doc/CK_RWCOHORT_WRITE_LOCK               |  18 +-
 lib/ck/doc/CK_RWCOHORT_WRITE_UNLOCK             |  16 +-
 lib/ck/doc/Makefile.in                          |  21 ++
 lib/ck/doc/ck_bitmap_bts                        |  61 +++++
 lib/ck/doc/ck_cohort                            |   6 +-
 lib/ck/doc/ck_elide                             |   4 +-
 lib/ck/doc/ck_epoch_call                        |   2 +-
 lib/ck/doc/ck_epoch_init                        |   2 +-
 lib/ck/doc/ck_hs_apply                          |  86 ++++++
 lib/ck/doc/ck_hs_fas                            |   4 +-
 lib/ck/doc/ck_hs_move                           |   2 +-
 lib/ck/doc/ck_hs_next                           |   2 +-
 lib/ck/doc/ck_hs_set                            |   2 +-
 lib/ck/doc/ck_pr                                |   4 +-
 lib/ck/doc/ck_pr_add                            |   4 +-
 lib/ck/doc/ck_pr_and                            |   6 +-
 lib/ck/doc/ck_pr_barrier                        |   4 +-
 lib/ck/doc/ck_pr_btc                            |   6 +-
 lib/ck/doc/ck_pr_btr                            |   6 +-
 lib/ck/doc/ck_pr_bts                            |   6 +-
 lib/ck/doc/ck_pr_cas                            |   6 +-
 lib/ck/doc/ck_pr_dec                            |   4 +-
 lib/ck/doc/ck_pr_faa                            |   4 +-
 lib/ck/doc/ck_pr_fas                            |   4 +-
 lib/ck/doc/ck_pr_fence_acquire                  |   2 +-
 lib/ck/doc/ck_pr_fence_atomic                   |   8 +-
 lib/ck/doc/ck_pr_fence_atomic_load              |   8 +-
 lib/ck/doc/ck_pr_fence_atomic_store             |   8 +-
 lib/ck/doc/ck_pr_fence_load                     |   2 +-
 lib/ck/doc/ck_pr_fence_load_atomic              |   2 +-
 lib/ck/doc/ck_pr_fence_load_depends             |   4 +-
 lib/ck/doc/ck_pr_fence_load_store               |   2 +-
 lib/ck/doc/ck_pr_fence_memory                   |   4 +-
 lib/ck/doc/ck_pr_fence_release                  |   2 +-
 lib/ck/doc/ck_pr_fence_store                    |   4 +-
 lib/ck/doc/ck_pr_fence_store_atomic             |   6 +-
 lib/ck/doc/ck_pr_fence_store_load               |   6 +-
 lib/ck/doc/ck_pr_inc                            |   4 +-
 lib/ck/doc/ck_pr_load                           |   4 +-
 lib/ck/doc/ck_pr_neg                            |   4 +-
 lib/ck/doc/ck_pr_not                            |   4 +-
 lib/ck/doc/ck_pr_or                             |   6 +-
 lib/ck/doc/ck_pr_rtm                            |   2 +-
 lib/ck/doc/ck_pr_stall                          |   6 +-
 lib/ck/doc/ck_pr_store                          |   4 +-
 lib/ck/doc/ck_pr_sub                            |   4 +-
 lib/ck/doc/ck_pr_xor                            |   6 +-
 lib/ck/doc/ck_rhs_apply                         |  86 ++++++
 lib/ck/doc/ck_rhs_count                         |  70 +++++
 lib/ck/doc/ck_rhs_destroy                       |  77 ++++++
 lib/ck/doc/ck_rhs_fas                           |  98 +++++++
 lib/ck/doc/ck_rhs_gc                            |  73 ++++++
 lib/ck/doc/ck_rhs_get                           |  88 +++++++
 lib/ck/doc/ck_rhs_grow                          |  81 ++++++
 lib/ck/doc/ck_rhs_init                          | 166 ++++++++++++
 lib/ck/doc/ck_rhs_iterator_init                 |  78 ++++++
 lib/ck/doc/ck_rhs_move                          |  90 +++++++
 lib/ck/doc/ck_rhs_next                          |  92 +++++++
 lib/ck/doc/ck_rhs_put                           |  98 +++++++
 lib/ck/doc/ck_rhs_put_unique                    |  98 +++++++
 lib/ck/doc/ck_rhs_rebuild                       |  76 ++++++
 lib/ck/doc/ck_rhs_remove                        |  92 +++++++
 lib/ck/doc/ck_rhs_reset                         |  77 ++++++
 lib/ck/doc/ck_rhs_reset_size                    |  80 ++++++
 lib/ck/doc/ck_rhs_set                           | 102 ++++++++
 lib/ck/doc/ck_rhs_stat                          |  80 ++++++
 lib/ck/doc/ck_ring_dequeue_spmc                 |   2 +-
 lib/ck/doc/ck_ring_dequeue_spsc                 |   2 +-
 lib/ck/doc/ck_ring_enqueue_spmc                 |   6 +-
 lib/ck/doc/ck_ring_enqueue_spmc_size            |   6 +-
 lib/ck/doc/ck_ring_enqueue_spsc                 |   6 +-
 lib/ck/doc/ck_ring_enqueue_spsc_size            |   6 +-
 lib/ck/doc/ck_ring_trydequeue_spmc              |   4 +-
 lib/ck/doc/ck_rwcohort                          |   4 +-
 lib/ck/doc/ck_sequence                          |   4 +-
 lib/ck/doc/ck_spinlock                          |   2 +-
 lib/ck/include/ck_array.h                       |   1 -
 lib/ck/include/ck_backoff.h                     |  13 +-
 lib/ck/include/ck_barrier.h                     |   1 -
 lib/ck/include/ck_bitmap.h                      |  30 ++-
 lib/ck/include/ck_brlock.h                      |   1 -
 lib/ck/include/ck_bytelock.h                    |   1 -
 lib/ck/include/ck_cohort.h                      |   1 -
 lib/ck/include/ck_elide.h                       |   3 +-
 lib/ck/include/ck_epoch.h                       |   1 -
 lib/ck/include/ck_fifo.h                        |   1 -
 lib/ck/include/ck_hp.h                          |   1 -
 lib/ck/include/ck_hp_fifo.h                     |   1 -
 lib/ck/include/ck_hp_stack.h                    |   1 -
 lib/ck/include/ck_hs.h                          |   5 +-
 lib/ck/include/ck_ht.h                          |   1 -
 lib/ck/include/ck_limits.h                      |   1 -
 lib/ck/include/ck_malloc.h                      |   1 -
 lib/ck/include/ck_pflock.h                      |   1 -
 lib/ck/include/ck_pr.h                          |   1 -
 lib/ck/include/ck_queue.h                       |   1 -
 lib/ck/include/ck_rhs.h                         |   4 +-
 lib/ck/include/ck_ring.h                        |   3 +-
 lib/ck/include/ck_rwcohort.h                    |   1 -
 lib/ck/include/ck_rwlock.h                      |   1 -
 lib/ck/include/ck_sequence.h                    |   5 +-
 lib/ck/include/ck_spinlock.h                    |   1 -
 lib/ck/include/ck_stack.h                       |   1 -
 lib/ck/include/ck_stdint.h                      |   1 -
 lib/ck/include/ck_swlock.h                      |   1 -
 lib/ck/include/ck_tflock.h                      |   4 +-
 lib/ck/include/gcc/arm/ck_pr.h                  |  46 ++--
 lib/ck/include/spinlock/hclh.h                  |   2 +-
 lib/ck/regressions/ck_bitmap/validate/serial.c  |  28 +-
 lib/ck/regressions/ck_epoch/validate/Makefile   |   5 +-
 .../ck_epoch/validate/ck_epoch_call.c           |  64 +++++
 .../ck_hp/validate/ck_hp_fifo_donner.c          |   8 +-
 lib/ck/regressions/ck_hs/benchmark/Makefile     |   5 +-
 lib/ck/regressions/ck_hs/benchmark/apply.c      | 260 +++++++++++++++++++
 .../ck_hs/benchmark/parallel_bytestring.c       |   2 +-
 lib/ck/regressions/ck_hs/benchmark/serial.c     |   2 +-
 lib/ck/regressions/ck_hs/validate/serial.c      |  72 ++++-
 lib/ck/regressions/ck_rhs/validate/serial.c     |  69 ++++-
 lib/ck/regressions/ck_ring/validate/Makefile    |   5 +-
 .../regressions/ck_ring/validate/ck_ring_spmc.c |   4 +-
 .../ck_ring/validate/ck_ring_spmc_template.c    |  43 +--
 .../regressions/ck_spinlock/validate/Makefile   |   2 +-
 lib/ck/regressions/common.h                     |   3 +-
 lib/ck/src/ck_array.c                           |   1 -
 lib/ck/src/ck_barrier_centralized.c             |   1 -
 lib/ck/src/ck_barrier_combining.c               |   1 -
 lib/ck/src/ck_barrier_dissemination.c           |   1 -
 lib/ck/src/ck_barrier_mcs.c                     |   1 -
 lib/ck/src/ck_barrier_tournament.c              |   1 -
 lib/ck/src/ck_epoch.c                           |  14 +-
 lib/ck/src/ck_hp.c                              |   1 -
 lib/ck/src/ck_hs.c                              | 112 +++++++-
 lib/ck/src/ck_ht.c                              |   3 +-
 lib/ck/src/ck_ht_hash.h                         |   2 +-
 lib/ck/src/ck_rhs.c                             | 150 +++++++++--
 151 files changed, 2878 insertions(+), 336 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/trafficserver/blob/0da17e96/lib/ck/build/ck.build.in
----------------------------------------------------------------------
diff --git a/lib/ck/build/ck.build.in b/lib/ck/build/ck.build.in
index 6bcd044..1d6bfe3 100644
--- a/lib/ck/build/ck.build.in
+++ b/lib/ck/build/ck.build.in
@@ -2,8 +2,8 @@ CC=@CC@
 MAKE=make
 SRC_DIR=@SRC_DIR@
 BUILD_DIR=@BUILD_DIR@
-CFLAGS=@CFLAGS@ -I$(SRC_DIR)/include -I$(BUILD_DIR)/include
-LDFLAGS=@LDFLAGS@
+CFLAGS+=@CFLAGS@ -I$(SRC_DIR)/include -I$(BUILD_DIR)/include
+LDFLAGS+=@LDFLAGS@
 ALL_LIBS=@ALL_LIBS@
 LD=@LD@
 

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/0da17e96/lib/ck/build/ck.build.ppc64
----------------------------------------------------------------------
diff --git a/lib/ck/build/ck.build.ppc64 b/lib/ck/build/ck.build.ppc64
index 7dcb4f4..51003f4 100644
--- a/lib/ck/build/ck.build.ppc64
+++ b/lib/ck/build/ck.build.ppc64
@@ -1 +1,2 @@
 CFLAGS+=-m64 -D__ppc64__
+LDFLAGS+=-m64

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/0da17e96/lib/ck/build/ck.build.x86
----------------------------------------------------------------------
diff --git a/lib/ck/build/ck.build.x86 b/lib/ck/build/ck.build.x86
index 2758c8a..6e12783 100644
--- a/lib/ck/build/ck.build.x86
+++ b/lib/ck/build/ck.build.x86
@@ -1 +1,2 @@
 CFLAGS+=-m32 -D__x86__ -msse -msse2
+LDFLAGS+=-m32

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/0da17e96/lib/ck/build/ck.build.x86_64
----------------------------------------------------------------------
diff --git a/lib/ck/build/ck.build.x86_64 b/lib/ck/build/ck.build.x86_64
index 54643ef..81b378a 100644
--- a/lib/ck/build/ck.build.x86_64
+++ b/lib/ck/build/ck.build.x86_64
@@ -1 +1,2 @@
 CFLAGS+=-m64 -D__x86_64__
+LDFLAGS+=-m64

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/0da17e96/lib/ck/configure
----------------------------------------------------------------------
diff --git a/lib/ck/configure b/lib/ck/configure
index 1b31294..57da1bb 100755
--- a/lib/ck/configure
+++ b/lib/ck/configure
@@ -34,7 +34,7 @@ WANT_PIC=yes
 
 P_PWD=`pwd`
 MAINTAINER='sbahra@repnop.org'
-VERSION=${VERSION:-'0.4.3'}
+VERSION=${VERSION:-'0.4.5'}
 VERSION_MAJOR='0'
 BUILD="$PWD/build/ck.build"
 PREFIX=${PREFIX:-"/usr/local"}
@@ -599,7 +599,7 @@ elif test "$COMPILER" = "gcc" || test "$COMPILER" = "clang" || test "$COMPILER"
 		INSTALL_LIBS="install-lib"
 	fi
 
-	CFLAGS="-D_XOPEN_SOURCE=600 -D_BSD_SOURCE -std=gnu99 -pedantic -Wall -W -Wundef -Wendif-labels -Wshadow -Wpointer-arith -Wcast-align -Wwrite-strings -Wstrict-prototypes -Wmissing-prototypes -Wnested-externs -Winline -Wdisabled-optimization -fstrict-aliasing -O2 -pipe -Wno-parentheses $CFLAGS"
+	CFLAGS="-D_XOPEN_SOURCE=600 -D_BSD_SOURCE -D_DEFAULT_SOURCE -std=gnu99 -pedantic -Wall -W -Wundef -Wendif-labels -Wshadow -Wpointer-arith -Wcast-align -Wwrite-strings -Wstrict-prototypes -Wmissing-prototypes -Wnested-externs -Winline -Wdisabled-optimization -fstrict-aliasing -O2 -pipe -Wno-parentheses $CFLAGS"
 	PTHREAD_CFLAGS="-pthread"
 	if test "$COMPILER" = "mingw64"; then
 		ENVIRONMENT=64

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/0da17e96/lib/ck/doc/CK_COHORT_INIT
----------------------------------------------------------------------
diff --git a/lib/ck/doc/CK_COHORT_INIT b/lib/ck/doc/CK_COHORT_INIT
index 42a2294..94454d9 100644
--- a/lib/ck/doc/CK_COHORT_INIT
+++ b/lib/ck/doc/CK_COHORT_INIT
@@ -38,7 +38,7 @@ Concurrency Kit (libck, \-lck)
 .Sh DESCRIPTION
 Until a cohort instance is initialized using the CK_COHORT_INIT macro, any operations
 involving it will have undefined behavior.  After this macro has been called, the cohort
-pointed to by the 
+pointed to by the
 .Fa cohort
 argument will use the lock pointed to by
 .Fa global_lock
@@ -48,8 +48,8 @@ as its local lock.
 .Pp
 The cohort will relinquish its global lock after
 .Fa pass_limit
-consecutive acquisitions of its local lock, even if there are other threads waiting.  
-If you are unsure of a value to use for the 
+consecutive acquisitions of its local lock, even if there are other threads waiting.
+If you are unsure of a value to use for the
 .Fa pass_limit
 argument, you should use CK_COHORT_DEFAULT_LOCAL_PASS_LIMIT.
 .Sh SEE ALSO

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/0da17e96/lib/ck/doc/CK_COHORT_LOCK
----------------------------------------------------------------------
diff --git a/lib/ck/doc/CK_COHORT_LOCK b/lib/ck/doc/CK_COHORT_LOCK
index df39ad4..22475f8 100644
--- a/lib/ck/doc/CK_COHORT_LOCK
+++ b/lib/ck/doc/CK_COHORT_LOCK
@@ -38,11 +38,11 @@ Concurrency Kit (libck, \-lck)
 .Sh DESCRIPTION
 This call attempts to acquire both the local and global (if necessary) locks from
 .Fa cohort .
-The call will block until both locks have been acquired.  
+The call will block until both locks have been acquired.
 .Fa global_context
-will be passed as the second argument to the function that was provided as the 
+will be passed as the second argument to the function that was provided as the
 .Fa global_lock_method
-argument to CK_COHORT_PROTOTYPE if that method is called, and 
+argument to CK_COHORT_PROTOTYPE if that method is called, and
 .Fa local_context
 will be passed to the function specified by
 .Fa local_lock_method

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/0da17e96/lib/ck/doc/CK_COHORT_PROTOTYPE
----------------------------------------------------------------------
diff --git a/lib/ck/doc/CK_COHORT_PROTOTYPE b/lib/ck/doc/CK_COHORT_PROTOTYPE
index f058fb8..7a7b1a7 100644
--- a/lib/ck/doc/CK_COHORT_PROTOTYPE
+++ b/lib/ck/doc/CK_COHORT_PROTOTYPE
@@ -37,7 +37,7 @@ Concurrency Kit (libck, \-lck)
 "LOCK_FXN global_unlock_method" "LOCK_FXN local_lock_method" "LOCK_FXN local_unlock_method"
 .Sh DESCRIPTION
 The ck_cohort.h header file does not define any cohort types.  Instead, the user must use
-the CK_COHORT_PROTOTYPE or 
+the CK_COHORT_PROTOTYPE or
 .Xr CK_COHORT_TRYLOCK_PROTOTYPE 3
 macros to define any types they want to use.  They must use CK_COHORT_TRYLOCK_PROTOTYPE
 if they want their cohort type to support trylock operations.

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/0da17e96/lib/ck/doc/CK_COHORT_TRYLOCK
----------------------------------------------------------------------
diff --git a/lib/ck/doc/CK_COHORT_TRYLOCK b/lib/ck/doc/CK_COHORT_TRYLOCK
index fd9306e..22bb4b5 100644
--- a/lib/ck/doc/CK_COHORT_TRYLOCK
+++ b/lib/ck/doc/CK_COHORT_TRYLOCK
@@ -38,18 +38,18 @@ Concurrency Kit (libck, \-lck)
 .Sh DESCRIPTION
 This call attempts to acquire both the local and global (if necessary) locks from
 .Fa cohort .
-It can only be used with cohort types that were defined using the 
+It can only be used with cohort types that were defined using the
 .Xr CK_COHORT_TRYLOCK_PROTOTYPE 3
 macro.  The call will not block and will return a bool that will evaluate to true iff
-the cohort was successfully acquired.  
+the cohort was successfully acquired.
 .Fa global_trylock_context
-will be passed as the second argument to the function that was provided as the 
+will be passed as the second argument to the function that was provided as the
 .Fa global_trylock_method
-argument to CK_COHORT_TRYLOCK_PROTOTYPE if that method is called, and 
+argument to CK_COHORT_TRYLOCK_PROTOTYPE if that method is called, and
 .Fa local_trylock_context
 will be passed to the function specified by
 .Fa local_trylock_method .
-If the global lock acquisition fails, then the cohort will immediately release its 
+If the global lock acquisition fails, then the cohort will immediately release its
 local lock as well, and
 .Fa local_unlock_context
 will be passed to the function specified by

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/0da17e96/lib/ck/doc/CK_COHORT_TRYLOCK_PROTOTYPE
----------------------------------------------------------------------
diff --git a/lib/ck/doc/CK_COHORT_TRYLOCK_PROTOTYPE b/lib/ck/doc/CK_COHORT_TRYLOCK_PROTOTYPE
index 7edc032..dd97ad4 100644
--- a/lib/ck/doc/CK_COHORT_TRYLOCK_PROTOTYPE
+++ b/lib/ck/doc/CK_COHORT_TRYLOCK_PROTOTYPE
@@ -57,7 +57,7 @@ of the other CK_COHORT macros.
 : This method should return true iff the global lock is acquired by a thread.
 .br
 .Fa global_trylock_method
-: The method that should be called to try to acquire the global lock.  
+: The method that should be called to try to acquire the global lock.
 It should not block and return true iff the lock was successfully acquired.
 .br
 .Fa local_lock_method
@@ -70,7 +70,7 @@ It should not block and return true iff the lock was successfully acquired.
 : This method should return true iff the global lock is acquired by a thread.
 .br
 .Fa local_trylock_method
-: The method that should be called to try to acquire the local lock.  
+: The method that should be called to try to acquire the local lock.
 It should not block and return true iff the lock was successfully acquired.
 .Pp
 Instances of the defined cohort type can be declared as:

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/0da17e96/lib/ck/doc/CK_COHORT_UNLOCK
----------------------------------------------------------------------
diff --git a/lib/ck/doc/CK_COHORT_UNLOCK b/lib/ck/doc/CK_COHORT_UNLOCK
index 6c5440a..a9f302f 100644
--- a/lib/ck/doc/CK_COHORT_UNLOCK
+++ b/lib/ck/doc/CK_COHORT_UNLOCK
@@ -38,11 +38,11 @@ Concurrency Kit (libck, \-lck)
 .Sh DESCRIPTION
 This call instructs
 .Fa cohort
-to relinquish its local lock and potentially its global lock as well.  
+to relinquish its local lock and potentially its global lock as well.
 .Fa global_context
-will be passed as the second argument to the function that was provided as the 
+will be passed as the second argument to the function that was provided as the
 .Fa global_lock_method
-argument to CK_COHORT_PROTOTYPE if that method is called, and 
+argument to CK_COHORT_PROTOTYPE if that method is called, and
 .Fa local_context
 will be passed to the function specified by
 .Fa local_lock_method

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/0da17e96/lib/ck/doc/CK_RWCOHORT_INIT
----------------------------------------------------------------------
diff --git a/lib/ck/doc/CK_RWCOHORT_INIT b/lib/ck/doc/CK_RWCOHORT_INIT
index e097039..18d1b33 100644
--- a/lib/ck/doc/CK_RWCOHORT_INIT
+++ b/lib/ck/doc/CK_RWCOHORT_INIT
@@ -40,11 +40,11 @@ Concurrency Kit (libck, \-lck)
 This macro initializes the lock instance pointed to by the
 .Fa lock
 argument.  Until a lock instance is initialized using the CK_RWCOHORT_INIT macro, any operations
-involving it will have undefined behavior.  Note that the 
+involving it will have undefined behavior.  Note that the
 .Fa wait_limit
 argument should only be used with reader-preference or writer-preference locks.  For neutral
 locks, this argument should be excluded.
-If you are unsure of a value to use for the 
+If you are unsure of a value to use for the
 .Fa wait_limit
 argument, you should use CK_RWCOHORT_STRATEGY_DEFAULT_LOCAL_WAIT_LIMIT.
 .Sh SEE ALSO

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/0da17e96/lib/ck/doc/CK_RWCOHORT_INSTANCE
----------------------------------------------------------------------
diff --git a/lib/ck/doc/CK_RWCOHORT_INSTANCE b/lib/ck/doc/CK_RWCOHORT_INSTANCE
index fcdfeea..10251a3 100644
--- a/lib/ck/doc/CK_RWCOHORT_INSTANCE
+++ b/lib/ck/doc/CK_RWCOHORT_INSTANCE
@@ -38,9 +38,9 @@ Concurrency Kit (libck, \-lck)
 .Fn CK_RWCOHORT_WP_INSTANCE "COHORT_NAME cohort_name"
 .Sh DESCRIPTION
 The user must use this macro to declare instances of lock types that they have
-defined using the 
+defined using the
 .Xr CK_RWCOHORT_PROTOTYPE 3
-macro.  The cohort_name must be the same as the one used in the prototype macro.  
+macro.  The cohort_name must be the same as the one used in the prototype macro.
 For instance, if CK_RWCOHORT_PROTOTYPE was called with the name "foo", the
 CK_RWCOHORT_INSTANCE macro should be called as
 .br

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/0da17e96/lib/ck/doc/CK_RWCOHORT_PROTOTYPE
----------------------------------------------------------------------
diff --git a/lib/ck/doc/CK_RWCOHORT_PROTOTYPE b/lib/ck/doc/CK_RWCOHORT_PROTOTYPE
index fb4d25a..a2705b6 100644
--- a/lib/ck/doc/CK_RWCOHORT_PROTOTYPE
+++ b/lib/ck/doc/CK_RWCOHORT_PROTOTYPE
@@ -41,9 +41,9 @@ The ck_rwcohort.h header file does not define any cohort types.  Instead, the us
 the CK_RWCOHORT_PROTOTYPE macro to define any types they want to use.
 This macro takes a single argument which corresponds to the type of the cohort lock that
 the reader-writer lock should use.  A cohort type must have already been defined with that name
-using the 
+using the
 .Xr CK_COHORT_PROTOTYPE 3
-or 
+or
 .Xr CK_COHORT_TRYLOCK_PROTOTYPE 3
 macros.
 .Pp

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/0da17e96/lib/ck/doc/CK_RWCOHORT_READ_LOCK
----------------------------------------------------------------------
diff --git a/lib/ck/doc/CK_RWCOHORT_READ_LOCK b/lib/ck/doc/CK_RWCOHORT_READ_LOCK
index bf65853..62831ea 100644
--- a/lib/ck/doc/CK_RWCOHORT_READ_LOCK
+++ b/lib/ck/doc/CK_RWCOHORT_READ_LOCK
@@ -33,24 +33,24 @@
 Concurrency Kit (libck, \-lck)
 .Sh SYNOPSIS
 .In ck_cohort.h
-.Fn CK_RWCOHORT_NEUTRAL_READ_LOCK "COHORT_NAME cohort_name" "LOCK *lock" "COHORT *cohort"\ 
+.Fn CK_RWCOHORT_NEUTRAL_READ_LOCK "COHORT_NAME cohort_name" "LOCK *lock" "COHORT *cohort"\
 "void *global_context" "void *local_context"
-.Fn CK_RWCOHORT_RP_READ_LOCK "COHORT_NAME cohort_name" "LOCK *lock" "COHORT *cohort"\ 
+.Fn CK_RWCOHORT_RP_READ_LOCK "COHORT_NAME cohort_name" "LOCK *lock" "COHORT *cohort"\
 "void *global_context" "void *local_context"
-.Fn CK_RWCOHORT_WP_READ_LOCK "COHORT_NAME cohort_name" "LOCK *lock" "COHORT *cohort"\ 
+.Fn CK_RWCOHORT_WP_READ_LOCK "COHORT_NAME cohort_name" "LOCK *lock" "COHORT *cohort"\
 "void *global_context" "void *local_context"
 .Sh DESCRIPTION
 This call will acquire read-only permission from
 .Fa lock .
-The call will block until this permission has been acquired.  
-.Fa cohort 
-must point to a cohort whose global lock is the same as all other cohorts used with 
+The call will block until this permission has been acquired.
+.Fa cohort
+must point to a cohort whose global lock is the same as all other cohorts used with
 .Fa lock .
 The
-.Fa global_context 
+.Fa global_context
 and
-.Fa local_context 
-arguments will be passed along as the context arguments to any calls to 
+.Fa local_context
+arguments will be passed along as the context arguments to any calls to
 .Fa cohort .
 .
 .Sh SEE ALSO

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/0da17e96/lib/ck/doc/CK_RWCOHORT_READ_UNLOCK
----------------------------------------------------------------------
diff --git a/lib/ck/doc/CK_RWCOHORT_READ_UNLOCK b/lib/ck/doc/CK_RWCOHORT_READ_UNLOCK
index 4dd26e1..1c81801 100644
--- a/lib/ck/doc/CK_RWCOHORT_READ_UNLOCK
+++ b/lib/ck/doc/CK_RWCOHORT_READ_UNLOCK
@@ -33,23 +33,23 @@
 Concurrency Kit (libck, \-lck)
 .Sh SYNOPSIS
 .In ck_cohort.h
-.Fn CK_RWCOHORT_NEUTRAL_READ_UNLOCK "COHORT_NAME cohort_name" "LOCK *lock" "COHORT *cohort"\ 
+.Fn CK_RWCOHORT_NEUTRAL_READ_UNLOCK "COHORT_NAME cohort_name" "LOCK *lock" "COHORT *cohort"\
 "void *global_context" "void *local_context"
-.Fn CK_RWCOHORT_RP_READ_UNLOCK "COHORT_NAME cohort_name" "LOCK *lock" "COHORT *cohort"\ 
+.Fn CK_RWCOHORT_RP_READ_UNLOCK "COHORT_NAME cohort_name" "LOCK *lock" "COHORT *cohort"\
 "void *global_context" "void *local_context"
-.Fn CK_RWCOHORT_WP_READ_UNLOCK "COHORT_NAME cohort_name" "LOCK *lock" "COHORT *cohort"\ 
+.Fn CK_RWCOHORT_WP_READ_UNLOCK "COHORT_NAME cohort_name" "LOCK *lock" "COHORT *cohort"\
 "void *global_context" "void *local_context"
 .Sh DESCRIPTION
 This call will relinquish read-only permission to
 .Fa lock .
-.Fa cohort 
-must point to a cohort whose global lock is the same as all other cohorts used with 
+.Fa cohort
+must point to a cohort whose global lock is the same as all other cohorts used with
 .Fa lock .
 The
-.Fa global_context 
+.Fa global_context
 and
-.Fa local_context 
-arguments will be passed along as the context arguments to any calls to 
+.Fa local_context
+arguments will be passed along as the context arguments to any calls to
 .Fa cohort .
 .
 .Sh SEE ALSO

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/0da17e96/lib/ck/doc/CK_RWCOHORT_WRITE_LOCK
----------------------------------------------------------------------
diff --git a/lib/ck/doc/CK_RWCOHORT_WRITE_LOCK b/lib/ck/doc/CK_RWCOHORT_WRITE_LOCK
index 0977cb7..161c7bb 100644
--- a/lib/ck/doc/CK_RWCOHORT_WRITE_LOCK
+++ b/lib/ck/doc/CK_RWCOHORT_WRITE_LOCK
@@ -33,24 +33,24 @@
 Concurrency Kit (libck, \-lck)
 .Sh SYNOPSIS
 .In ck_cohort.h
-.Fn CK_RWCOHORT_NEUTRAL_WRITE_LOCK "COHORT_NAME cohort_name" "LOCK *lock" "COHORT *cohort"\ 
+.Fn CK_RWCOHORT_NEUTRAL_WRITE_LOCK "COHORT_NAME cohort_name" "LOCK *lock" "COHORT *cohort"\
 "void *global_context" "void *local_context"
-.Fn CK_RWCOHORT_RP_WRITE_LOCK "COHORT_NAME cohort_name" "LOCK *lock" "COHORT *cohort"\ 
+.Fn CK_RWCOHORT_RP_WRITE_LOCK "COHORT_NAME cohort_name" "LOCK *lock" "COHORT *cohort"\
 "void *global_context" "void *local_context"
-.Fn CK_RWCOHORT_WP_WRITE_LOCK "COHORT_NAME cohort_name" "LOCK *lock" "COHORT *cohort"\ 
+.Fn CK_RWCOHORT_WP_WRITE_LOCK "COHORT_NAME cohort_name" "LOCK *lock" "COHORT *cohort"\
 "void *global_context" "void *local_context"
 .Sh DESCRIPTION
 This call will acquire write permission for
 .Fa lock .
-The call will block until this permission has been acquired.  
-.Fa cohort 
-must point to a cohort whose global lock is the same as all other cohorts used with 
+The call will block until this permission has been acquired.
+.Fa cohort
+must point to a cohort whose global lock is the same as all other cohorts used with
 .Fa lock .
 The
-.Fa global_context 
+.Fa global_context
 and
-.Fa local_context 
-arguments will be passed along as the context arguments to any calls to 
+.Fa local_context
+arguments will be passed along as the context arguments to any calls to
 .Fa cohort .
 .
 .Sh SEE ALSO

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/0da17e96/lib/ck/doc/CK_RWCOHORT_WRITE_UNLOCK
----------------------------------------------------------------------
diff --git a/lib/ck/doc/CK_RWCOHORT_WRITE_UNLOCK b/lib/ck/doc/CK_RWCOHORT_WRITE_UNLOCK
index c3537bf..5772a9f 100644
--- a/lib/ck/doc/CK_RWCOHORT_WRITE_UNLOCK
+++ b/lib/ck/doc/CK_RWCOHORT_WRITE_UNLOCK
@@ -33,23 +33,23 @@
 Concurrency Kit (libck, \-lck)
 .Sh SYNOPSIS
 .In ck_cohort.h
-.Fn CK_RWCOHORT_NEUTRAL_WRITE_UNLOCK "COHORT_NAME cohort_name" "LOCK *lock" "COHORT *cohort"\ 
+.Fn CK_RWCOHORT_NEUTRAL_WRITE_UNLOCK "COHORT_NAME cohort_name" "LOCK *lock" "COHORT *cohort"\
 "void *global_context" "void *local_context"
-.Fn CK_RWCOHORT_RP_WRITE_UNLOCK "COHORT_NAME cohort_name" "LOCK *lock" "COHORT *cohort"\ 
+.Fn CK_RWCOHORT_RP_WRITE_UNLOCK "COHORT_NAME cohort_name" "LOCK *lock" "COHORT *cohort"\
 "void *global_context" "void *local_context"
-.Fn CK_RWCOHORT_WP_WRITE_UNLOCK "COHORT_NAME cohort_name" "LOCK *lock" "COHORT *cohort"\ 
+.Fn CK_RWCOHORT_WP_WRITE_UNLOCK "COHORT_NAME cohort_name" "LOCK *lock" "COHORT *cohort"\
 "void *global_context" "void *local_context"
 .Sh DESCRIPTION
 This call will relinquish write permission for
 .Fa lock .
-.Fa cohort 
-must point to a cohort whose global lock is the same as all other cohorts used with 
+.Fa cohort
+must point to a cohort whose global lock is the same as all other cohorts used with
 .Fa lock .
 The
-.Fa global_context 
+.Fa global_context
 and
-.Fa local_context 
-arguments will be passed along as the context arguments to any calls to 
+.Fa local_context
+arguments will be passed along as the context arguments to any calls to
 .Fa cohort .
 .
 .Sh SEE ALSO

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/0da17e96/lib/ck/doc/Makefile.in
----------------------------------------------------------------------
diff --git a/lib/ck/doc/Makefile.in b/lib/ck/doc/Makefile.in
index ff24a91..dbd9daa 100644
--- a/lib/ck/doc/Makefile.in
+++ b/lib/ck/doc/Makefile.in
@@ -48,6 +48,7 @@ OBJECTS=CK_ARRAY_FOREACH		\
 	ck_bitmap_init			\
 	ck_bitmap_reset			\
 	ck_bitmap_set			\
+	ck_bitmap_bts			\
 	ck_bitmap_test			\
 	ck_bitmap_base			\
 	ck_bitmap_union			\
@@ -73,6 +74,7 @@ OBJECTS=CK_ARRAY_FOREACH		\
 	ck_hs_init			\
 	ck_hs_destroy			\
 	CK_HS_HASH			\
+	ck_hs_apply			\
 	ck_hs_iterator_init		\
 	ck_hs_next			\
 	ck_hs_get			\
@@ -87,6 +89,25 @@ OBJECTS=CK_ARRAY_FOREACH		\
 	ck_hs_reset			\
 	ck_hs_reset_size		\
 	ck_hs_stat			\
+	ck_rhs_gc			\
+	ck_rhs_init			\
+	ck_rhs_destroy			\
+	CK_RHS_HASH			\
+	ck_rhs_apply			\
+	ck_rhs_iterator_init		\
+	ck_rhs_next			\
+	ck_rhs_get			\
+	ck_rhs_put			\
+	ck_rhs_set			\
+	ck_rhs_fas			\
+	ck_rhs_remove			\
+	ck_rhs_move			\
+	ck_rhs_grow			\
+	ck_rhs_rebuild			\
+	ck_rhs_count			\
+	ck_rhs_reset			\
+	ck_rhs_reset_size		\
+	ck_rhs_stat			\
 	ck_rwcohort			\
 	CK_RWCOHORT_INIT		\
 	CK_RWCOHORT_INSTANCE		\

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/0da17e96/lib/ck/doc/ck_bitmap_bts
----------------------------------------------------------------------
diff --git a/lib/ck/doc/ck_bitmap_bts b/lib/ck/doc/ck_bitmap_bts
new file mode 100644
index 0000000..872284c
--- /dev/null
+++ b/lib/ck/doc/ck_bitmap_bts
@@ -0,0 +1,61 @@
+.\"
+.\" Copyright 2014 David Joseph.
+.\" 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 REGENTS 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 REGENTS 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.
+.\"
+.\"
+.Dd August 22, 2014
+.Dt CK_BITMAP_BTS 3
+.Sh NAME
+.Nm ck_bitmap_bts
+.Nd set the bit at the specified index and fetch its original value
+.Sh LIBRARY
+Concurrency Kit (libck, \-lck)
+.Sh SYNOPSIS
+.In ck_bitmap.h
+.Ft bool
+.Fn ck_bitmap_bts "ck_bitmap_t *bitmap" "unsigned int n"
+.Sh DESCRIPTION
+.Fn ck_bitmap_bts
+sets the bit at the offset specified by the argument
+.Fa n
+to
+.Dv 1
+and fetches its original value.
+.Sh RETURN VALUES
+This function returns the original value of the bit at offset
+.Fa n
+in
+.Fa bitmap .
+.Sh SEE ALSO
+.Xr ck_bitmap_base 3 ,
+.Xr ck_bitmap_size 3 ,
+.Xr ck_bitmap_init 3 ,
+.Xr ck_bitmap_reset 3 ,
+.Xr ck_bitmap_clear 3 ,
+.Xr ck_bitmap_set 3 ,
+.Xr ck_bitmap_test 3 ,
+.Xr ck_bitmap_bits 3 ,
+.Xr ck_bitmap_buffer 3
+.Pp
+Additional information available at http://concurrencykit.org/

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/0da17e96/lib/ck/doc/ck_cohort
----------------------------------------------------------------------
diff --git a/lib/ck/doc/ck_cohort b/lib/ck/doc/ck_cohort
index b033c91..4905418 100644
--- a/lib/ck/doc/ck_cohort
+++ b/lib/ck/doc/ck_cohort
@@ -57,7 +57,7 @@ BOOL_LOCK_FXN refers to a method with the signature
 bool(void *lock, void *context)
 .Pp
 The
-.Fa context 
+.Fa context
 argument in each signature is used to pass along any additional information that
 the lock might need for its lock, unlock and trylock methods.  The values for this
 argument are provided to each call to
@@ -94,7 +94,7 @@ man pages for more details.
 #include <ck_cohort.h>
 #include <ck_spinlock.h>
 
-/* 
+/*
  * Create cohort methods with signatures that match
  * the required signature
  */
@@ -169,7 +169,7 @@ main(void)
 	    calloc(n_cohorts, sizeof(CK_COHORT_INSTANCE(test_cohort)));
 
 	/* create local locks to use with each cohort */
-	ck_spinlock_t *local_locks = 
+	ck_spinlock_t *local_locks =
 		calloc(n_cohorts, sizeof(ck_spinlock_t));
 
 	pthread_t *threads =

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/0da17e96/lib/ck/doc/ck_elide
----------------------------------------------------------------------
diff --git a/lib/ck/doc/ck_elide b/lib/ck/doc/ck_elide
index 3a63e74..c068567 100644
--- a/lib/ck/doc/ck_elide
+++ b/lib/ck/doc/ck_elide
@@ -100,7 +100,7 @@ returns true, then the
 .Fa UNLOCK_FUNCTION
 is executed. If RTM is unsupported (no CK_F_PR_RTM macro) then
 .Fn CK_ELIDE_LOCK
-and 
+and
 .Fn CK_ELIDE_LOCK_ADAPTIVE
 will immediately call
 .Fn LOCK_FUNCTION .
@@ -118,7 +118,7 @@ Elision is attempted if the
 .Fa LOCK_PREDICATE
 function returns false. If
 .Fa LOCK_PREDICATE
-returns true or if elision fails then the 
+returns true or if elision fails then the
 operation is aborted. If RTM is unsupported
 (no CK_F_PR_RTM macro) then
 .Fn CK_ELIDE_TRYLOCK

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/0da17e96/lib/ck/doc/ck_epoch_call
----------------------------------------------------------------------
diff --git a/lib/ck/doc/ck_epoch_call b/lib/ck/doc/ck_epoch_call
index 4f6286e..288814e 100644
--- a/lib/ck/doc/ck_epoch_call
+++ b/lib/ck/doc/ck_epoch_call
@@ -46,7 +46,7 @@ function will defer the execution of the function pointed to by
 until a grace-period has been detected in
 .Fa epoch .
 The function will be provided
-the pointer specified by 
+the pointer specified by
 .Fa entry .
 The function will execute at some time in the future via calls to
 .Fn ck_epoch_reclaim 3 ,

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/0da17e96/lib/ck/doc/ck_epoch_init
----------------------------------------------------------------------
diff --git a/lib/ck/doc/ck_epoch_init b/lib/ck/doc/ck_epoch_init
index e22294d..51a3e2a 100644
--- a/lib/ck/doc/ck_epoch_init
+++ b/lib/ck/doc/ck_epoch_init
@@ -52,7 +52,7 @@ is undefined if
 .Fa epoch
 is not a pointer to a
 .Tn ck_epoch_t
-object. 
+object.
 .El
 .Sh SEE ALSO
 .Xr ck_epoch_register 3 ,

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/0da17e96/lib/ck/doc/ck_hs_apply
----------------------------------------------------------------------
diff --git a/lib/ck/doc/ck_hs_apply b/lib/ck/doc/ck_hs_apply
new file mode 100644
index 0000000..5664f73
--- /dev/null
+++ b/lib/ck/doc/ck_hs_apply
@@ -0,0 +1,86 @@
+.\"
+.\" Copyright 2014 Samy Al Bahra.
+.\" Copyright 2014 Backtrace I/O, Inc.
+.\" 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 REGENTS 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 REGENTS 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.
+.\"
+.\"
+.Dd September 1, 2014
+.Dt CK_HS_APPLY 3
+.Sh NAME
+.Nm ck_hs_apply
+.Nd apply a function to hash set value
+.Sh LIBRARY
+Concurrency Kit (libck, \-lck)
+.Sh SYNOPSIS
+.In ck_hs.h
+.Ft void *
+.Fn ck_hs_apply_fn_t "void *key" "void *closure"
+.Ft bool
+.Fn ck_hs_apply "ck_hs_t *hs" "unsigned long hash" "const void *key" "ck_hs_apply_fn_t *function" "void *argument"
+.Sh DESCRIPTION
+The
+.Fn ck_hs_apply 3
+function will lookup the hash set slot associated with
+.Fa key
+and pass it to function pointed to by
+.Fa function
+for further action. This callback may remove or replace
+the value by respectively returning NULL or a pointer to
+another object with an identical key. The first argument
+passed to
+.Fa function
+is a pointer to the object found in the hash set and
+the second argument is the
+.Fa argument
+pointer passed to
+.Fn ck_hs_apply 3 .
+If the pointer returned by
+.Fa function
+is equivalent to the first argument then no modification
+is made to the hash set.
+.Sh RETURN VALUES
+Upon successful completion,
+.Fn ck_hs_apply 3
+returns true and otherwise returns false on failure.
+.Sh SEE ALSO
+.Xr ck_hs_init 3 ,
+.Xr ck_hs_move 3 ,
+.Xr ck_hs_destroy 3 ,
+.Xr ck_hs_fas 3 ,
+.Xr CK_HS_HASH 3 ,
+.Xr ck_hs_iterator_init 3 ,
+.Xr ck_hs_next 3 ,
+.Xr ck_hs_get 3 ,
+.Xr ck_hs_put 3 ,
+.Xr ck_hs_put_unique 3 ,
+.Xr ck_hs_remove 3 ,
+.Xr ck_hs_grow 3 ,
+.Xr ck_hs_rebuild 3 ,
+.Xr ck_hs_gc 3 ,
+.Xr ck_hs_count 3 ,
+.Xr ck_hs_reset 3 ,
+.Xr ck_hs_reset_size 3 ,
+.Xr ck_hs_stat 3
+.Pp
+Additional information available at http://concurrencykit.org/

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/0da17e96/lib/ck/doc/ck_hs_fas
----------------------------------------------------------------------
diff --git a/lib/ck/doc/ck_hs_fas b/lib/ck/doc/ck_hs_fas
index 213cef6..69760b5 100644
--- a/lib/ck/doc/ck_hs_fas
+++ b/lib/ck/doc/ck_hs_fas
@@ -57,7 +57,7 @@ was successful then the key specified by
 was successfully stored in the hash set pointed to by
 .Fa hs .
 The key must already exist in the hash set, and is
-replaced by 
+replaced by
 .Fa key
 and the previous value is stored into the void pointer
 pointed to by the
@@ -75,7 +75,7 @@ Behavior is undefined if
 .Fa key
 or
 .Fa hs
-are uninitialized. 
+are uninitialized.
 .Sh SEE ALSO
 .Xr ck_hs_init 3 ,
 .Xr ck_hs_move 3 ,

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/0da17e96/lib/ck/doc/ck_hs_move
----------------------------------------------------------------------
diff --git a/lib/ck/doc/ck_hs_move b/lib/ck/doc/ck_hs_move
index e843ea7..1d30195 100644
--- a/lib/ck/doc/ck_hs_move
+++ b/lib/ck/doc/ck_hs_move
@@ -38,7 +38,7 @@ Concurrency Kit (libck, \-lck)
 .Sh DESCRIPTION
 The
 .Fn ck_hs_move 3
-function will initialize 
+function will initialize
 .Fa source
 from
 .Fa destination .

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/0da17e96/lib/ck/doc/ck_hs_next
----------------------------------------------------------------------
diff --git a/lib/ck/doc/ck_hs_next b/lib/ck/doc/ck_hs_next
index 1e41301..67e083e 100644
--- a/lib/ck/doc/ck_hs_next
+++ b/lib/ck/doc/ck_hs_next
@@ -33,7 +33,7 @@
 Concurrency Kit (libck, \-lck)
 .Sh SYNOPSIS
 .In ck_hs.h
-.Ft bool 
+.Ft bool
 .Fn ck_hs_next "ck_hs_t *hs" "ck_hs_iterator_t *iterator" "void **entry"
 .Sh DESCRIPTION
 The

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/0da17e96/lib/ck/doc/ck_hs_set
----------------------------------------------------------------------
diff --git a/lib/ck/doc/ck_hs_set b/lib/ck/doc/ck_hs_set
index 0df792a..e9ba9f1 100644
--- a/lib/ck/doc/ck_hs_set
+++ b/lib/ck/doc/ck_hs_set
@@ -57,7 +57,7 @@ was successful then the key specified by
 was successfully stored in the hash set pointed to by
 .Fa hs .
 If the key already exists in the hash set, then it is
-replaced by 
+replaced by
 .Fa key
 and the previous value is stored into the void pointer
 pointed to by the

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/0da17e96/lib/ck/doc/ck_pr
----------------------------------------------------------------------
diff --git a/lib/ck/doc/ck_pr b/lib/ck/doc/ck_pr
index df7ce91..67c726f 100644
--- a/lib/ck/doc/ck_pr
+++ b/lib/ck/doc/ck_pr
@@ -38,7 +38,7 @@ ck_pr.h provides an interface to volatile atomic instructions,
 memory barriers and busy-wait facilities as provided by the
 underlying processor. The presence of an atomic operation
 is detected by the presence of a corresponding CK_F_PR macro.
-For example, the availability of 
+For example, the availability of
 .Xr ck_pr_add_16 3
 would be determined by the presence of CK_F_PR_ADD_16.
 .Sh SEE ALSO
@@ -56,7 +56,7 @@ would be determined by the presence of CK_F_PR_ADD_16.
 .Xr ck_pr_faa 3 ,
 .Xr ck_pr_inc 3 ,
 .Xr ck_pr_dec 3 ,
-.Xr ck_pr_neg 3 , 
+.Xr ck_pr_neg 3 ,
 .Xr ck_pr_not 3 ,
 .Xr ck_pr_add 3 ,
 .Xr ck_pr_sub 3 ,

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/0da17e96/lib/ck/doc/ck_pr_add
----------------------------------------------------------------------
diff --git a/lib/ck/doc/ck_pr_add b/lib/ck/doc/ck_pr_add
index 77a3ad2..b4d394a 100644
--- a/lib/ck/doc/ck_pr_add
+++ b/lib/ck/doc/ck_pr_add
@@ -60,7 +60,7 @@ Concurrency Kit (libck, \-lck)
 .Ft void
 .Fn ck_pr_add_8 "uint8_t *target" "uint8_t delta"
 .Sh DESCRIPTION
-The 
+The
 .Fn ck_pr_add 3
 family of functions atomically add the value specified by
 .Fa delta
@@ -79,7 +79,7 @@ This family of functions does not have a return value.
 .Xr ck_pr_faa 3 ,
 .Xr ck_pr_inc 3 ,
 .Xr ck_pr_dec 3 ,
-.Xr ck_pr_neg 3 , 
+.Xr ck_pr_neg 3 ,
 .Xr ck_pr_not 3 ,
 .Xr ck_pr_sub 3 ,
 .Xr ck_pr_and 3 ,

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/0da17e96/lib/ck/doc/ck_pr_and
----------------------------------------------------------------------
diff --git a/lib/ck/doc/ck_pr_and b/lib/ck/doc/ck_pr_and
index bd40252..56ce5af 100644
--- a/lib/ck/doc/ck_pr_and
+++ b/lib/ck/doc/ck_pr_and
@@ -57,9 +57,9 @@ Concurrency Kit (libck, \-lck)
 .Ft void
 .Fn ck_pr_and_8 "uint8_t *target" "uint8_t delta"
 .Sh DESCRIPTION
-The 
+The
 .Fn ck_pr_and 3
-family of functions atomically compute and store the 
+family of functions atomically compute and store the
 result of a bitwise-and of the value pointed to by
 .Fa target
 and
@@ -79,7 +79,7 @@ This family of functions does not have a return value.
 .Xr ck_pr_faa 3 ,
 .Xr ck_pr_inc 3 ,
 .Xr ck_pr_dec 3 ,
-.Xr ck_pr_neg 3 , 
+.Xr ck_pr_neg 3 ,
 .Xr ck_pr_not 3 ,
 .Xr ck_pr_add 3 ,
 .Xr ck_pr_sub 3 ,

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/0da17e96/lib/ck/doc/ck_pr_barrier
----------------------------------------------------------------------
diff --git a/lib/ck/doc/ck_pr_barrier b/lib/ck/doc/ck_pr_barrier
index 128bf38..3886729 100644
--- a/lib/ck/doc/ck_pr_barrier
+++ b/lib/ck/doc/ck_pr_barrier
@@ -36,7 +36,7 @@ Concurrency Kit (libck, \-lck)
 .Ft void
 .Fn ck_pr_barrier void
 .Sh DESCRIPTION
-The 
+The
 .Fn ck_pr_barrier 3
 function is used to disable code movement optimizations
 across the invocation of the function.
@@ -51,7 +51,7 @@ across the invocation of the function.
 .Xr ck_pr_faa 3 ,
 .Xr ck_pr_inc 3 ,
 .Xr ck_pr_dec 3 ,
-.Xr ck_pr_neg 3 , 
+.Xr ck_pr_neg 3 ,
 .Xr ck_pr_not 3 ,
 .Xr ck_pr_add 3 ,
 .Xr ck_pr_sub 3 ,

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/0da17e96/lib/ck/doc/ck_pr_btc
----------------------------------------------------------------------
diff --git a/lib/ck/doc/ck_pr_btc b/lib/ck/doc/ck_pr_btc
index bbf226f..5956221 100644
--- a/lib/ck/doc/ck_pr_btc
+++ b/lib/ck/doc/ck_pr_btc
@@ -51,13 +51,13 @@ Concurrency Kit (libck, \-lck)
 .Ft bool
 .Fn ck_pr_btc_16 "uint16_t *target" "unsigned int bit_index"
 .Sh DESCRIPTION
-The 
+The
 .Fn ck_pr_btc 3
 family of functions atomically fetch the value
 of the bit in
 .Fa target
 at index
-.Fa bit_index 
+.Fa bit_index
 and set that bit to its complement.
 .Sh RETURN VALUES
 These family of functions return the original value of
@@ -76,7 +76,7 @@ that is in the value pointed to by
 .Xr ck_pr_faa 3 ,
 .Xr ck_pr_inc 3 ,
 .Xr ck_pr_dec 3 ,
-.Xr ck_pr_neg 3 , 
+.Xr ck_pr_neg 3 ,
 .Xr ck_pr_not 3 ,
 .Xr ck_pr_sub 3 ,
 .Xr ck_pr_and 3 ,

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/0da17e96/lib/ck/doc/ck_pr_btr
----------------------------------------------------------------------
diff --git a/lib/ck/doc/ck_pr_btr b/lib/ck/doc/ck_pr_btr
index 1c7760b..d5e03fd 100644
--- a/lib/ck/doc/ck_pr_btr
+++ b/lib/ck/doc/ck_pr_btr
@@ -51,13 +51,13 @@ Concurrency Kit (libck, \-lck)
 .Ft bool
 .Fn ck_pr_btr_16 "uint16_t *target" "unsigned int bit_index"
 .Sh DESCRIPTION
-The 
+The
 .Fn ck_pr_btr 3
 family of functions atomically fetch the value
 of the bit in
 .Fa target
 at index
-.Fa bit_index 
+.Fa bit_index
 and set that bit to 0.
 .Sh RETURN VALUES
 This family of functions returns the original value of
@@ -76,7 +76,7 @@ that is in the value pointed to by
 .Xr ck_pr_faa 3 ,
 .Xr ck_pr_inc 3 ,
 .Xr ck_pr_dec 3 ,
-.Xr ck_pr_neg 3 , 
+.Xr ck_pr_neg 3 ,
 .Xr ck_pr_not 3 ,
 .Xr ck_pr_sub 3 ,
 .Xr ck_pr_and 3 ,

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/0da17e96/lib/ck/doc/ck_pr_bts
----------------------------------------------------------------------
diff --git a/lib/ck/doc/ck_pr_bts b/lib/ck/doc/ck_pr_bts
index 4ee6163..955855d 100644
--- a/lib/ck/doc/ck_pr_bts
+++ b/lib/ck/doc/ck_pr_bts
@@ -51,13 +51,13 @@ Concurrency Kit (libck, \-lck)
 .Ft bool
 .Fn ck_pr_bts_16 "uint16_t *target" "unsigned int bit_index"
 .Sh DESCRIPTION
-The 
+The
 .Fn ck_pr_bts 3
 family of functions atomically fetch the value
 of the bit in
 .Fa target
 at index
-.Fa bit_index 
+.Fa bit_index
 and set that bit to 1.
 .Sh RETURN VALUES
 This family of functions returns the original value of
@@ -76,7 +76,7 @@ that is in the value pointed to by
 .Xr ck_pr_faa 3 ,
 .Xr ck_pr_inc 3 ,
 .Xr ck_pr_dec 3 ,
-.Xr ck_pr_neg 3 , 
+.Xr ck_pr_neg 3 ,
 .Xr ck_pr_not 3 ,
 .Xr ck_pr_sub 3 ,
 .Xr ck_pr_and 3 ,

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/0da17e96/lib/ck/doc/ck_pr_cas
----------------------------------------------------------------------
diff --git a/lib/ck/doc/ck_pr_cas b/lib/ck/doc/ck_pr_cas
index e0b4674..1fa3a88 100644
--- a/lib/ck/doc/ck_pr_cas
+++ b/lib/ck/doc/ck_pr_cas
@@ -99,9 +99,9 @@ Concurrency Kit (libck, \-lck)
 .Ft bool
 .Fn ck_pr_cas_8_value "uint8_t *target" "uint8_t old_value" "uint8_t new_value" "uint8_t *original_value"
 .Sh DESCRIPTION
-The 
+The
 .Fn ck_pr_cas 3
-family of functions atomically compare the value in 
+family of functions atomically compare the value in
 .Fa target
 for equality with
 .Fa old_value
@@ -133,7 +133,7 @@ return false.
 .Xr ck_pr_faa 3 ,
 .Xr ck_pr_inc 3 ,
 .Xr ck_pr_dec 3 ,
-.Xr ck_pr_neg 3 , 
+.Xr ck_pr_neg 3 ,
 .Xr ck_pr_not 3 ,
 .Xr ck_pr_sub 3 ,
 .Xr ck_pr_and 3 ,

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/0da17e96/lib/ck/doc/ck_pr_dec
----------------------------------------------------------------------
diff --git a/lib/ck/doc/ck_pr_dec b/lib/ck/doc/ck_pr_dec
index c3bc7b4..f3d34dd 100644
--- a/lib/ck/doc/ck_pr_dec
+++ b/lib/ck/doc/ck_pr_dec
@@ -87,7 +87,7 @@ Concurrency Kit (libck, \-lck)
 .Ft void
 .Fn ck_pr_dec_8_zero "uint8_t *target" "bool *z"
 .Sh DESCRIPTION
-The 
+The
 .Fn ck_pr_dec 3
 family of functions atomically decrement the value pointed to
 by
@@ -109,7 +109,7 @@ to false otherwise.
 .Xr ck_pr_fas 3 ,
 .Xr ck_pr_faa 3 ,
 .Xr ck_pr_inc 3 ,
-.Xr ck_pr_neg 3 , 
+.Xr ck_pr_neg 3 ,
 .Xr ck_pr_not 3 ,
 .Xr ck_pr_add 3 ,
 .Xr ck_pr_sub 3 ,

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/0da17e96/lib/ck/doc/ck_pr_faa
----------------------------------------------------------------------
diff --git a/lib/ck/doc/ck_pr_faa b/lib/ck/doc/ck_pr_faa
index 06e0761..fbeff01 100644
--- a/lib/ck/doc/ck_pr_faa
+++ b/lib/ck/doc/ck_pr_faa
@@ -60,7 +60,7 @@ Concurrency Kit (libck, \-lck)
 .Ft uint8_t
 .Fn ck_pr_faa_8 "uint8_t *target" "uint8_t delta"
 .Sh DESCRIPTION
-The 
+The
 .Fn ck_pr_faa 3
 family of functions atomically fetch the value pointed to
 by
@@ -84,7 +84,7 @@ addition operation is applied.
 .Xr ck_pr_fas 3 ,
 .Xr ck_pr_inc 3 ,
 .Xr ck_pr_dec 3 ,
-.Xr ck_pr_neg 3 , 
+.Xr ck_pr_neg 3 ,
 .Xr ck_pr_not 3 ,
 .Xr ck_pr_add 3 ,
 .Xr ck_pr_sub 3 ,

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/0da17e96/lib/ck/doc/ck_pr_fas
----------------------------------------------------------------------
diff --git a/lib/ck/doc/ck_pr_fas b/lib/ck/doc/ck_pr_fas
index 5059151..037b104 100644
--- a/lib/ck/doc/ck_pr_fas
+++ b/lib/ck/doc/ck_pr_fas
@@ -60,7 +60,7 @@ Concurrency Kit (libck, \-lck)
 .Ft uint8_t
 .Fn ck_pr_fas_8 "uint8_t *target" "uint8_t new_value"
 .Sh DESCRIPTION
-The 
+The
 .Fn ck_pr_fas 3
 family of functions atomically fetch the value pointed to
 by
@@ -85,7 +85,7 @@ atomically replaced with
 .Xr ck_pr_faa 3 ,
 .Xr ck_pr_inc 3 ,
 .Xr ck_pr_dec 3 ,
-.Xr ck_pr_neg 3 , 
+.Xr ck_pr_neg 3 ,
 .Xr ck_pr_not 3 ,
 .Xr ck_pr_add 3 ,
 .Xr ck_pr_sub 3 ,

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/0da17e96/lib/ck/doc/ck_pr_fence_acquire
----------------------------------------------------------------------
diff --git a/lib/ck/doc/ck_pr_fence_acquire b/lib/ck/doc/ck_pr_fence_acquire
index 9da53c0..2d6b997 100644
--- a/lib/ck/doc/ck_pr_fence_acquire
+++ b/lib/ck/doc/ck_pr_fence_acquire
@@ -57,7 +57,7 @@ This function has no return value.
 .Xr ck_pr_faa 3 ,
 .Xr ck_pr_inc 3 ,
 .Xr ck_pr_dec 3 ,
-.Xr ck_pr_neg 3 , 
+.Xr ck_pr_neg 3 ,
 .Xr ck_pr_not 3 ,
 .Xr ck_pr_add 3 ,
 .Xr ck_pr_sub 3 ,

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/0da17e96/lib/ck/doc/ck_pr_fence_atomic
----------------------------------------------------------------------
diff --git a/lib/ck/doc/ck_pr_fence_atomic b/lib/ck/doc/ck_pr_fence_atomic
index 452606b..65ed270 100644
--- a/lib/ck/doc/ck_pr_fence_atomic
+++ b/lib/ck/doc/ck_pr_fence_atomic
@@ -25,7 +25,7 @@
 .\"
 .\"
 .Dd May 16, 2013
-.Dt CK_PR_FENCE_ATOMIC 3 
+.Dt CK_PR_FENCE_ATOMIC 3
 .Sh NAME
 .Nm ck_pr_fence_atomic
 .Nd enforce partial ordering of atomic read-modify-write operations
@@ -38,9 +38,9 @@ Concurrency Kit (libck, \-lck)
 .Ft void
 .Fn ck_pr_fence_strict_atomic void
 .Sh DESCRIPTION
-The 
+The
 .Fn ck_pr_fence_atomic
-function enfores the ordering of any 
+function enfores the ordering of any
 atomic read-modify-write operations relative to
 the invocation of the function. This function
 always serve as an implicit compiler barrier. On
@@ -96,7 +96,7 @@ This function has no return value.
 .Xr ck_pr_faa 3 ,
 .Xr ck_pr_inc 3 ,
 .Xr ck_pr_dec 3 ,
-.Xr ck_pr_neg 3 , 
+.Xr ck_pr_neg 3 ,
 .Xr ck_pr_not 3 ,
 .Xr ck_pr_add 3 ,
 .Xr ck_pr_sub 3 ,

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/0da17e96/lib/ck/doc/ck_pr_fence_atomic_load
----------------------------------------------------------------------
diff --git a/lib/ck/doc/ck_pr_fence_atomic_load b/lib/ck/doc/ck_pr_fence_atomic_load
index cbefdaa..22925ea 100644
--- a/lib/ck/doc/ck_pr_fence_atomic_load
+++ b/lib/ck/doc/ck_pr_fence_atomic_load
@@ -25,7 +25,7 @@
 .\"
 .\"
 .Dd May 16, 2013
-.Dt CK_PR_FENCE_ATOMIC_LOAD 3 
+.Dt CK_PR_FENCE_ATOMIC_LOAD 3
 .Sh NAME
 .Nm ck_pr_fence_atomic_load
 .Nd enforce ordering of atomic read-modify-write operations to load operations
@@ -38,9 +38,9 @@ Concurrency Kit (libck, \-lck)
 .Ft void
 .Fn ck_pr_fence_strict_atomic_load void
 .Sh DESCRIPTION
-The 
+The
 .Fn ck_pr_fence_atomic_load
-function enfores the ordering of any 
+function enfores the ordering of any
 atomic read-modify-write operations relative to
 any load operations following the function invocation. This function
 always serve as an implicit compiler barrier. On
@@ -93,7 +93,7 @@ This function has no return value.
 .Xr ck_pr_faa 3 ,
 .Xr ck_pr_inc 3 ,
 .Xr ck_pr_dec 3 ,
-.Xr ck_pr_neg 3 , 
+.Xr ck_pr_neg 3 ,
 .Xr ck_pr_not 3 ,
 .Xr ck_pr_add 3 ,
 .Xr ck_pr_sub 3 ,

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/0da17e96/lib/ck/doc/ck_pr_fence_atomic_store
----------------------------------------------------------------------
diff --git a/lib/ck/doc/ck_pr_fence_atomic_store b/lib/ck/doc/ck_pr_fence_atomic_store
index a14867c..ad1735b 100644
--- a/lib/ck/doc/ck_pr_fence_atomic_store
+++ b/lib/ck/doc/ck_pr_fence_atomic_store
@@ -25,7 +25,7 @@
 .\"
 .\"
 .Dd May 16, 2013
-.Dt CK_PR_FENCE_ATOMIC_STORE 3 
+.Dt CK_PR_FENCE_ATOMIC_STORE 3
 .Sh NAME
 .Nm ck_pr_fence_atomic_store
 .Nd enforce ordering of atomic read-modify-write operations to store operations
@@ -38,9 +38,9 @@ Concurrency Kit (libck, \-lck)
 .Ft void
 .Fn ck_pr_fence_strict_atomic_store void
 .Sh DESCRIPTION
-The 
+The
 .Fn ck_pr_fence_atomic_store
-function enfores the ordering of any 
+function enfores the ordering of any
 atomic read-modify-write operations relative to
 any load operations following the function invocation. This function
 always serve as an implicit compiler barrier. On
@@ -94,7 +94,7 @@ This function has no return value.
 .Xr ck_pr_faa 3 ,
 .Xr ck_pr_inc 3 ,
 .Xr ck_pr_dec 3 ,
-.Xr ck_pr_neg 3 , 
+.Xr ck_pr_neg 3 ,
 .Xr ck_pr_not 3 ,
 .Xr ck_pr_add 3 ,
 .Xr ck_pr_sub 3 ,

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/0da17e96/lib/ck/doc/ck_pr_fence_load
----------------------------------------------------------------------
diff --git a/lib/ck/doc/ck_pr_fence_load b/lib/ck/doc/ck_pr_fence_load
index da8e6d4..b6e778d 100644
--- a/lib/ck/doc/ck_pr_fence_load
+++ b/lib/ck/doc/ck_pr_fence_load
@@ -98,7 +98,7 @@ This function has no return value.
 .Xr ck_pr_faa 3 ,
 .Xr ck_pr_inc 3 ,
 .Xr ck_pr_dec 3 ,
-.Xr ck_pr_neg 3 , 
+.Xr ck_pr_neg 3 ,
 .Xr ck_pr_not 3 ,
 .Xr ck_pr_add 3 ,
 .Xr ck_pr_sub 3 ,

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/0da17e96/lib/ck/doc/ck_pr_fence_load_atomic
----------------------------------------------------------------------
diff --git a/lib/ck/doc/ck_pr_fence_load_atomic b/lib/ck/doc/ck_pr_fence_load_atomic
index 774a263..c935491 100644
--- a/lib/ck/doc/ck_pr_fence_load_atomic
+++ b/lib/ck/doc/ck_pr_fence_load_atomic
@@ -98,7 +98,7 @@ This function has no return value.
 .Xr ck_pr_faa 3 ,
 .Xr ck_pr_inc 3 ,
 .Xr ck_pr_dec 3 ,
-.Xr ck_pr_neg 3 , 
+.Xr ck_pr_neg 3 ,
 .Xr ck_pr_not 3 ,
 .Xr ck_pr_add 3 ,
 .Xr ck_pr_sub 3 ,

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/0da17e96/lib/ck/doc/ck_pr_fence_load_depends
----------------------------------------------------------------------
diff --git a/lib/ck/doc/ck_pr_fence_load_depends b/lib/ck/doc/ck_pr_fence_load_depends
index 38718ec..0c0ecfa 100644
--- a/lib/ck/doc/ck_pr_fence_load_depends
+++ b/lib/ck/doc/ck_pr_fence_load_depends
@@ -36,7 +36,7 @@ Concurrency Kit (libck, \-lck)
 .Ft void
 .Fn ck_pr_fence_load_depends void
 .Sh DESCRIPTION
-The 
+The
 .Fn ck_pr_fence_load_depends 3
 emits necessary fences for pure data-dependent loads. It currently only serves as a compiler
 barrier for Concurrency Kit's supported platforms. Unless you're on architecture
@@ -60,7 +60,7 @@ This function has no return value.
 .Xr ck_pr_faa 3 ,
 .Xr ck_pr_inc 3 ,
 .Xr ck_pr_dec 3 ,
-.Xr ck_pr_neg 3 , 
+.Xr ck_pr_neg 3 ,
 .Xr ck_pr_not 3 ,
 .Xr ck_pr_add 3 ,
 .Xr ck_pr_sub 3 ,

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/0da17e96/lib/ck/doc/ck_pr_fence_load_store
----------------------------------------------------------------------
diff --git a/lib/ck/doc/ck_pr_fence_load_store b/lib/ck/doc/ck_pr_fence_load_store
index 378903e..4abce99 100644
--- a/lib/ck/doc/ck_pr_fence_load_store
+++ b/lib/ck/doc/ck_pr_fence_load_store
@@ -98,7 +98,7 @@ This function has no return value.
 .Xr ck_pr_faa 3 ,
 .Xr ck_pr_inc 3 ,
 .Xr ck_pr_dec 3 ,
-.Xr ck_pr_neg 3 , 
+.Xr ck_pr_neg 3 ,
 .Xr ck_pr_not 3 ,
 .Xr ck_pr_add 3 ,
 .Xr ck_pr_sub 3 ,

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/0da17e96/lib/ck/doc/ck_pr_fence_memory
----------------------------------------------------------------------
diff --git a/lib/ck/doc/ck_pr_fence_memory b/lib/ck/doc/ck_pr_fence_memory
index f223527..0dfc81b 100644
--- a/lib/ck/doc/ck_pr_fence_memory
+++ b/lib/ck/doc/ck_pr_fence_memory
@@ -38,7 +38,7 @@ Concurrency Kit (libck, \-lck)
 .Ft void
 .Fn ck_pr_fence_strict_memory
 .Sh DESCRIPTION
-The 
+The
 .Fn ck_pr_fence_memory 3
 function enforces the ordering of any memory operations
 with respect to the invocation of the function. This function
@@ -98,7 +98,7 @@ This function has no return value.
 .Xr ck_pr_faa 3 ,
 .Xr ck_pr_inc 3 ,
 .Xr ck_pr_dec 3 ,
-.Xr ck_pr_neg 3 , 
+.Xr ck_pr_neg 3 ,
 .Xr ck_pr_not 3 ,
 .Xr ck_pr_add 3 ,
 .Xr ck_pr_sub 3 ,

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/0da17e96/lib/ck/doc/ck_pr_fence_release
----------------------------------------------------------------------
diff --git a/lib/ck/doc/ck_pr_fence_release b/lib/ck/doc/ck_pr_fence_release
index 6794bbf..214917c 100644
--- a/lib/ck/doc/ck_pr_fence_release
+++ b/lib/ck/doc/ck_pr_fence_release
@@ -56,7 +56,7 @@ This function has no return value.
 .Xr ck_pr_faa 3 ,
 .Xr ck_pr_inc 3 ,
 .Xr ck_pr_dec 3 ,
-.Xr ck_pr_neg 3 , 
+.Xr ck_pr_neg 3 ,
 .Xr ck_pr_not 3 ,
 .Xr ck_pr_add 3 ,
 .Xr ck_pr_sub 3 ,

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/0da17e96/lib/ck/doc/ck_pr_fence_store
----------------------------------------------------------------------
diff --git a/lib/ck/doc/ck_pr_fence_store b/lib/ck/doc/ck_pr_fence_store
index 5bb8f00..c5c5223 100644
--- a/lib/ck/doc/ck_pr_fence_store
+++ b/lib/ck/doc/ck_pr_fence_store
@@ -38,7 +38,7 @@ Concurrency Kit (libck, \-lck)
 .Ft void
 .Fn ck_pr_fence_strict_store void
 .Sh DESCRIPTION
-The 
+The
 .Fn ck_pr_fence_store
 function enfores the ordering of any memory store,
 .Fn ck_pr_store
@@ -97,7 +97,7 @@ This function has no return value.
 .Xr ck_pr_faa 3 ,
 .Xr ck_pr_inc 3 ,
 .Xr ck_pr_dec 3 ,
-.Xr ck_pr_neg 3 , 
+.Xr ck_pr_neg 3 ,
 .Xr ck_pr_not 3 ,
 .Xr ck_pr_add 3 ,
 .Xr ck_pr_sub 3 ,

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/0da17e96/lib/ck/doc/ck_pr_fence_store_atomic
----------------------------------------------------------------------
diff --git a/lib/ck/doc/ck_pr_fence_store_atomic b/lib/ck/doc/ck_pr_fence_store_atomic
index a559f22..d53d2ae 100644
--- a/lib/ck/doc/ck_pr_fence_store_atomic
+++ b/lib/ck/doc/ck_pr_fence_store_atomic
@@ -38,13 +38,13 @@ Concurrency Kit (libck, \-lck)
 .Ft void
 .Fn ck_pr_fence_strict_store_atomic void
 .Sh DESCRIPTION
-The 
+The
 .Fn ck_pr_fence_store_atomic
 function enfores the ordering of any memory store,
 .Fn ck_pr_store
 and atomic read-modify-write operations to atomic read-modify-write
 operations relative to the invocation of the function. This function
-always serve as an implicit compiler barrier. 
+always serve as an implicit compiler barrier.
 This functions will emit a fence for PSO and RMO
 targets. In order to force the emission of a fence use the
 .Fn ck_pr_fence_strict_store_atomic
@@ -93,7 +93,7 @@ This function has no return value.
 .Xr ck_pr_faa 3 ,
 .Xr ck_pr_inc 3 ,
 .Xr ck_pr_dec 3 ,
-.Xr ck_pr_neg 3 , 
+.Xr ck_pr_neg 3 ,
 .Xr ck_pr_not 3 ,
 .Xr ck_pr_add 3 ,
 .Xr ck_pr_sub 3 ,

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/0da17e96/lib/ck/doc/ck_pr_fence_store_load
----------------------------------------------------------------------
diff --git a/lib/ck/doc/ck_pr_fence_store_load b/lib/ck/doc/ck_pr_fence_store_load
index 40d1875..485bbcf 100644
--- a/lib/ck/doc/ck_pr_fence_store_load
+++ b/lib/ck/doc/ck_pr_fence_store_load
@@ -38,13 +38,13 @@ Concurrency Kit (libck, \-lck)
 .Ft void
 .Fn ck_pr_fence_strict_store_load void
 .Sh DESCRIPTION
-The 
+The
 .Fn ck_pr_fence_store_load
 function enfores the ordering of any memory store,
 .Fn ck_pr_store
 and atomic read-modify-write operations to load
 operations relative to the invocation of the function. This function
-always serve as an implicit compiler barrier. 
+always serve as an implicit compiler barrier.
 A fence will currently always be emitted for this
 operation, including for TSO memory model targets.
 .Sh EXAMPLE
@@ -92,7 +92,7 @@ This function has no return value.
 .Xr ck_pr_faa 3 ,
 .Xr ck_pr_inc 3 ,
 .Xr ck_pr_dec 3 ,
-.Xr ck_pr_neg 3 , 
+.Xr ck_pr_neg 3 ,
 .Xr ck_pr_not 3 ,
 .Xr ck_pr_add 3 ,
 .Xr ck_pr_sub 3 ,

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/0da17e96/lib/ck/doc/ck_pr_inc
----------------------------------------------------------------------
diff --git a/lib/ck/doc/ck_pr_inc b/lib/ck/doc/ck_pr_inc
index 0b8f449..72a3e70 100644
--- a/lib/ck/doc/ck_pr_inc
+++ b/lib/ck/doc/ck_pr_inc
@@ -87,7 +87,7 @@ Concurrency Kit (libck, \-lck)
 .Ft void
 .Fn ck_pr_inc_8_zero "uint8_t *target" "bool *z"
 .Sh DESCRIPTION
-The 
+The
 .Fn ck_pr_inc 3
 family of functions atomically increment the value pointed to
 by
@@ -109,7 +109,7 @@ false otherwise.
 .Xr ck_pr_fas 3 ,
 .Xr ck_pr_faa 3 ,
 .Xr ck_pr_dec 3 ,
-.Xr ck_pr_neg 3 , 
+.Xr ck_pr_neg 3 ,
 .Xr ck_pr_not 3 ,
 .Xr ck_pr_add 3 ,
 .Xr ck_pr_sub 3 ,

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/0da17e96/lib/ck/doc/ck_pr_load
----------------------------------------------------------------------
diff --git a/lib/ck/doc/ck_pr_load b/lib/ck/doc/ck_pr_load
index f0ab96d..ed615d3 100644
--- a/lib/ck/doc/ck_pr_load
+++ b/lib/ck/doc/ck_pr_load
@@ -60,7 +60,7 @@ Concurrency Kit (libck, \-lck)
 .Ft uint8_t
 .Fn ck_pr_load_8 "const uint8_t *target"
 .Sh DESCRIPTION
-The 
+The
 .Fn ck_pr_load 3
 family of functions atomically loads the value
 pointed to by
@@ -82,7 +82,7 @@ in the location pointed to by the first argument.
 .Xr ck_pr_faa 3 ,
 .Xr ck_pr_inc 3 ,
 .Xr ck_pr_dec 3 ,
-.Xr ck_pr_neg 3 , 
+.Xr ck_pr_neg 3 ,
 .Xr ck_pr_not 3 ,
 .Xr ck_pr_sub 3 ,
 .Xr ck_pr_and 3 ,

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/0da17e96/lib/ck/doc/ck_pr_neg
----------------------------------------------------------------------
diff --git a/lib/ck/doc/ck_pr_neg b/lib/ck/doc/ck_pr_neg
index 6654856..38f9a0a 100644
--- a/lib/ck/doc/ck_pr_neg
+++ b/lib/ck/doc/ck_pr_neg
@@ -87,7 +87,7 @@ Concurrency Kit (libck, \-lck)
 .Ft void
 .Fn ck_pr_neg_8_zero "uint8_t *target" "bool *z"
 .Sh DESCRIPTION
-The 
+The
 .Fn ck_pr_neg 3
 family of functions atomically negate the value pointed to
 by
@@ -107,7 +107,7 @@ pointed to value to false otherwise.
 .Xr ck_pr_fas 3 ,
 .Xr ck_pr_faa 3 ,
 .Xr ck_pr_inc 3 ,
-.Xr ck_pr_dec 3 , 
+.Xr ck_pr_dec 3 ,
 .Xr ck_pr_not 3 ,
 .Xr ck_pr_add 3 ,
 .Xr ck_pr_sub 3 ,

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/0da17e96/lib/ck/doc/ck_pr_not
----------------------------------------------------------------------
diff --git a/lib/ck/doc/ck_pr_not b/lib/ck/doc/ck_pr_not
index d6eb51c..b0a38b2 100644
--- a/lib/ck/doc/ck_pr_not
+++ b/lib/ck/doc/ck_pr_not
@@ -60,7 +60,7 @@ Concurrency Kit (libck, \-lck)
 .Ft void
 .Fn ck_pr_not_8 "uint8_t *target"
 .Sh DESCRIPTION
-The 
+The
 .Fn ck_pr_not 3
 family of functions atomically complement the value pointed to
 by
@@ -78,7 +78,7 @@ These functions have no return value.
 .Xr ck_pr_faa 3 ,
 .Xr ck_pr_inc 3 ,
 .Xr ck_pr_not 3 ,
-.Xr ck_pr_neg 3 , 
+.Xr ck_pr_neg 3 ,
 .Xr ck_pr_add 3 ,
 .Xr ck_pr_sub 3 ,
 .Xr ck_pr_and 3 ,

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/0da17e96/lib/ck/doc/ck_pr_or
----------------------------------------------------------------------
diff --git a/lib/ck/doc/ck_pr_or b/lib/ck/doc/ck_pr_or
index 9ceddc5..2a68330 100644
--- a/lib/ck/doc/ck_pr_or
+++ b/lib/ck/doc/ck_pr_or
@@ -57,9 +57,9 @@ Concurrency Kit (libck, \-lck)
 .Ft void
 .Fn ck_pr_or_8 "uint8_t *target" "uint8_t delta"
 .Sh DESCRIPTION
-The 
+The
 .Fn ck_pr_or 3
-family of functions atomically compute and store the 
+family of functions atomically compute and store the
 result of a bitwise-or of the value pointed to by
 .Fa target
 and
@@ -79,7 +79,7 @@ This family of functions does not have a return value.
 .Xr ck_pr_faa 3 ,
 .Xr ck_pr_inc 3 ,
 .Xr ck_pr_dec 3 ,
-.Xr ck_pr_neg 3 , 
+.Xr ck_pr_neg 3 ,
 .Xr ck_pr_not 3 ,
 .Xr ck_pr_add 3 ,
 .Xr ck_pr_sub 3 ,

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/0da17e96/lib/ck/doc/ck_pr_rtm
----------------------------------------------------------------------
diff --git a/lib/ck/doc/ck_pr_rtm b/lib/ck/doc/ck_pr_rtm
index a15aa91..53c31b6 100644
--- a/lib/ck/doc/ck_pr_rtm
+++ b/lib/ck/doc/ck_pr_rtm
@@ -98,7 +98,7 @@ set manuals.
 .Xr ck_pr_faa 3 ,
 .Xr ck_pr_inc 3 ,
 .Xr ck_pr_dec 3 ,
-.Xr ck_pr_neg 3 , 
+.Xr ck_pr_neg 3 ,
 .Xr ck_pr_not 3 ,
 .Xr ck_pr_sub 3 ,
 .Xr ck_pr_and 3 ,

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/0da17e96/lib/ck/doc/ck_pr_stall
----------------------------------------------------------------------
diff --git a/lib/ck/doc/ck_pr_stall b/lib/ck/doc/ck_pr_stall
index 762a739..bc46647 100644
--- a/lib/ck/doc/ck_pr_stall
+++ b/lib/ck/doc/ck_pr_stall
@@ -36,9 +36,9 @@ Concurrency Kit (libck, \-lck)
 .Ft void
 .Fn ck_pr_stall void
 .Sh DESCRIPTION
-The 
+The
 .Fn ck_pr_stall 3
-function should be used inside retry paths of busy-wait loops. 
+function should be used inside retry paths of busy-wait loops.
 It not only serves as a compiler barrier, but on some architectures
 it emits cycle-saving instructions.
 .Sh EXAMPLE
@@ -71,7 +71,7 @@ function(void)
 .Xr ck_pr_faa 3 ,
 .Xr ck_pr_inc 3 ,
 .Xr ck_pr_dec 3 ,
-.Xr ck_pr_neg 3 , 
+.Xr ck_pr_neg 3 ,
 .Xr ck_pr_not 3 ,
 .Xr ck_pr_add 3 ,
 .Xr ck_pr_sub 3 ,

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/0da17e96/lib/ck/doc/ck_pr_store
----------------------------------------------------------------------
diff --git a/lib/ck/doc/ck_pr_store b/lib/ck/doc/ck_pr_store
index 5cc7053..462cf7b 100644
--- a/lib/ck/doc/ck_pr_store
+++ b/lib/ck/doc/ck_pr_store
@@ -60,7 +60,7 @@ Concurrency Kit (libck, \-lck)
 .Ft void
 .Fn ck_pr_store_8 "uint8_t *target" "uint8_t value"
 .Sh DESCRIPTION
-The 
+The
 .Fn ck_pr_store 3
 family of functions atomically stores the value specified
 by
@@ -82,7 +82,7 @@ This family of functions has no return value.
 .Xr ck_pr_faa 3 ,
 .Xr ck_pr_inc 3 ,
 .Xr ck_pr_dec 3 ,
-.Xr ck_pr_neg 3 , 
+.Xr ck_pr_neg 3 ,
 .Xr ck_pr_not 3 ,
 .Xr ck_pr_sub 3 ,
 .Xr ck_pr_and 3 ,

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/0da17e96/lib/ck/doc/ck_pr_sub
----------------------------------------------------------------------
diff --git a/lib/ck/doc/ck_pr_sub b/lib/ck/doc/ck_pr_sub
index 697ea1b..5eee170 100644
--- a/lib/ck/doc/ck_pr_sub
+++ b/lib/ck/doc/ck_pr_sub
@@ -60,7 +60,7 @@ Concurrency Kit (libck, \-lck)
 .Ft void
 .Fn ck_pr_sub_8 "uint8_t *target" "uint8_t delta"
 .Sh DESCRIPTION
-The 
+The
 .Fn ck_pr_sub 3
 family of functions atomically subtract the value specified by
 .Fa delta
@@ -79,7 +79,7 @@ This family of functions does not have a return value.
 .Xr ck_pr_faa 3 ,
 .Xr ck_pr_inc 3 ,
 .Xr ck_pr_dec 3 ,
-.Xr ck_pr_neg 3 , 
+.Xr ck_pr_neg 3 ,
 .Xr ck_pr_not 3 ,
 .Xr ck_pr_add 3 ,
 .Xr ck_pr_and 3 ,

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/0da17e96/lib/ck/doc/ck_pr_xor
----------------------------------------------------------------------
diff --git a/lib/ck/doc/ck_pr_xor b/lib/ck/doc/ck_pr_xor
index cda38cb..509f60d 100644
--- a/lib/ck/doc/ck_pr_xor
+++ b/lib/ck/doc/ck_pr_xor
@@ -57,9 +57,9 @@ Concurrency Kit (libck, \-lck)
 .Ft void
 .Fn ck_pr_xor_8 "uint8_t *target" "uint8_t delta"
 .Sh DESCRIPTION
-The 
+The
 .Fn ck_pr_xor 3
-family of functions atomically compute and store the 
+family of functions atomically compute and store the
 result of a bitwise-xor of the value pointed to by
 .Fa target
 and
@@ -79,7 +79,7 @@ This family of functions does not have a return value.
 .Xr ck_pr_faa 3 ,
 .Xr ck_pr_inc 3 ,
 .Xr ck_pr_dec 3 ,
-.Xr ck_pr_neg 3 , 
+.Xr ck_pr_neg 3 ,
 .Xr ck_pr_not 3 ,
 .Xr ck_pr_add 3 ,
 .Xr ck_pr_sub 3 ,

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/0da17e96/lib/ck/doc/ck_rhs_apply
----------------------------------------------------------------------
diff --git a/lib/ck/doc/ck_rhs_apply b/lib/ck/doc/ck_rhs_apply
new file mode 100644
index 0000000..80b1da7
--- /dev/null
+++ b/lib/ck/doc/ck_rhs_apply
@@ -0,0 +1,86 @@
+.\"
+.\" Copyright 2014 Samy Al Bahra.
+.\" Copyright 2014 Backtrace I/O, Inc.
+.\" 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 REGENTS 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 REGENTS 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.
+.\"
+.\"
+.Dd September 1, 2014
+.Dt CK_RHS_APPLY 3
+.Sh NAME
+.Nm ck_rhs_apply
+.Nd apply a function to hash set value
+.Sh LIBRARY
+Concurrency Kit (libck, \-lck)
+.Sh SYNOPSIS
+.In ck_rhs.h
+.Ft void *
+.Fn ck_rhs_apply_fn_t "void *key" "void *closure"
+.Ft bool
+.Fn ck_rhs_apply "ck_rhs_t *hs" "unsigned long hash" "const void *key" "ck_rhs_apply_fn_t *function" "void *argument"
+.Sh DESCRIPTION
+The
+.Fn ck_rhs_apply 3
+function will lookup the hash set slot associated with
+.Fa key
+and pass it to function pointed to by
+.Fa function
+for further action. This callback may remove or replace
+the value by respectively returning NULL or a pointer to
+another object with an identical key. The first argument
+passed to
+.Fa function
+is a pointer to the object found in the hash set and
+the second argument is the
+.Fa argument
+pointer passed to
+.Fn ck_rhs_apply 3 .
+If the pointer returned by
+.Fa function
+is equivalent to the first argument then no modification
+is made to the hash set.
+.Sh RETURN VALUES
+Upon successful completion,
+.Fn ck_rhs_apply 3
+returns true and otherwise returns false on failure.
+.Sh SEE ALSO
+.Xr ck_rhs_init 3 ,
+.Xr ck_rhs_move 3 ,
+.Xr ck_rhs_destroy 3 ,
+.Xr ck_rhs_fas 3 ,
+.Xr CK_RHS_HASH 3 ,
+.Xr ck_rhs_iterator_init 3 ,
+.Xr ck_rhs_next 3 ,
+.Xr ck_rhs_get 3 ,
+.Xr ck_rhs_put 3 ,
+.Xr ck_rhs_put_unique 3 ,
+.Xr ck_rhs_remove 3 ,
+.Xr ck_rhs_grow 3 ,
+.Xr ck_rhs_rebuild 3 ,
+.Xr ck_rhs_gc 3 ,
+.Xr ck_rhs_count 3 ,
+.Xr ck_rhs_reset 3 ,
+.Xr ck_rhs_reset_size 3 ,
+.Xr ck_rhs_stat 3
+.Pp
+Additional information available at http://concurrencykit.org/

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/0da17e96/lib/ck/doc/ck_rhs_count
----------------------------------------------------------------------
diff --git a/lib/ck/doc/ck_rhs_count b/lib/ck/doc/ck_rhs_count
new file mode 100644
index 0000000..3a42b12
--- /dev/null
+++ b/lib/ck/doc/ck_rhs_count
@@ -0,0 +1,70 @@
+.\"
+.\" Copyright 2012-2013 Samy Al Bahra.
+.\" 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 REGENTS 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 REGENTS 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.
+.\"
+.\"
+.Dd September 17, 2012
+.Dt CK_RHS_COUNT 3
+.Sh NAME
+.Nm ck_rhs_count
+.Nd returns number of entries in hash set
+.Sh LIBRARY
+Concurrency Kit (libck, \-lck)
+.Sh SYNOPSIS
+.In ck_rhs.h
+.Ft unsigned long
+.Fn ck_rhs_count "ck_rhs_t *hs"
+.Sh DESCRIPTION
+The
+.Fn ck_rhs_count 3
+function returns the number of keys currently
+stored in
+.Fa hs .
+.Sh ERRORS
+Behavior is undefined if
+.Fa hs
+is uninitialized. Behavior is
+undefined if this function is called by a non-writer
+thread.
+.Sh SEE ALSO
+.Xr ck_rhs_init 3 ,
+.Xr ck_rhs_move 3 ,
+.Xr ck_rhs_destroy 3 ,
+.Xr CK_RHS_HASH 3 ,
+.Xr ck_rhs_iterator_init 3 ,
+.Xr ck_rhs_next 3 ,
+.Xr ck_rhs_get 3 ,
+.Xr ck_rhs_put 3 ,
+.Xr ck_rhs_put_unique 3 ,
+.Xr ck_rhs_set 3 ,
+.Xr ck_rhs_fas 3 ,
+.Xr ck_rhs_remove 3 ,
+.Xr ck_rhs_grow 3 ,
+.Xr ck_rhs_rebuild 3 ,
+.Xr ck_rhs_gc 3 ,
+.Xr ck_rhs_reset 3 ,
+.Xr ck_rhs_reset_size 3 ,
+.Xr ck_rhs_stat 3
+.Pp
+Additional information available at http://concurrencykit.org/

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/0da17e96/lib/ck/doc/ck_rhs_destroy
----------------------------------------------------------------------
diff --git a/lib/ck/doc/ck_rhs_destroy b/lib/ck/doc/ck_rhs_destroy
new file mode 100644
index 0000000..68de27e
--- /dev/null
+++ b/lib/ck/doc/ck_rhs_destroy
@@ -0,0 +1,77 @@
+.\"
+.\" Copyright 2012-2013 Samy Al Bahra.
+.\" 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 REGENTS 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 REGENTS 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.
+.\"
+.\"
+.Dd September 17, 2012
+.Dt CK_RHS_DESTROY 3
+.Sh NAME
+.Nm ck_rhs_destroy
+.Nd destroy hash set
+.Sh LIBRARY
+Concurrency Kit (libck, \-lck)
+.Sh SYNOPSIS
+.In ck_rhs.h
+.Ft void
+.Fn ck_rhs_destroy "ck_rhs_t *hs"
+.Sh DESCRIPTION
+The
+.Fn ck_rhs_destroy 3
+function will request that the underlying allocator, as specified by the
+.Xr ck_rhs_init 3
+function, immediately destroy the object pointed to by the
+.Fa hs
+argument.
+The user must guarantee that no threads are accessing the object pointed to
+by
+.Fa hs
+when
+.Fn ck_rhs_destroy 3
+is called.
+.Sh RETURN VALUES
+.Fn ck_rhs_destroy 3
+has no return value.
+.Sh ERRORS
+This function is guaranteed not to fail.
+.Sh SEE ALSO
+.Xr ck_rhs_init 3 ,
+.Xr ck_rhs_move 3 ,
+.Xr CK_RHS_HASH 3 ,
+.Xr ck_rhs_iterator_init 3 ,
+.Xr ck_rhs_next 3 ,
+.Xr ck_rhs_get 3 ,
+.Xr ck_rhs_put 3 ,
+.Xr ck_rhs_put_unique 3 ,
+.Xr ck_rhs_set 3 ,
+.Xr ck_rhs_fas 3 ,
+.Xr ck_rhs_remove 3 ,
+.Xr ck_rhs_grow 3 ,
+.Xr ck_rhs_rebuild 3 ,
+.Xr ck_rhs_gc 3 ,
+.Xr ck_rhs_count 3 ,
+.Xr ck_rhs_reset 3 ,
+.Xr ck_rhs_reset_size 3 ,
+.Xr ck_rhs_stat 3
+.Pp
+Additional information available at http://concurrencykit.org/

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/0da17e96/lib/ck/doc/ck_rhs_fas
----------------------------------------------------------------------
diff --git a/lib/ck/doc/ck_rhs_fas b/lib/ck/doc/ck_rhs_fas
new file mode 100644
index 0000000..453c40b
--- /dev/null
+++ b/lib/ck/doc/ck_rhs_fas
@@ -0,0 +1,98 @@
+.\"
+.\" Copyright 2013 Samy Al Bahra.
+.\" 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 REGENTS 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 REGENTS 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.
+.\"
+.\"
+.Dd June 20, 2013
+.Dt CK_RHS_FAS 3
+.Sh NAME
+.Nm ck_rhs_fas
+.Nd fetch and store key in hash set
+.Sh LIBRARY
+Concurrency Kit (libck, \-lck)
+.Sh SYNOPSIS
+.In ck_rhs.h
+.Ft bool
+.Fn ck_rhs_fas "ck_rhs_t *hs" "unsigned long hash" "const void *key" "void **previous"
+.Sh DESCRIPTION
+The
+.Fn ck_rhs_fas 3
+function will fetch and store the key specified by the
+.Fa key
+argument in the hash set pointed to by the
+.Fa hs
+argument. The key specified by
+.Fa key
+is expected to have the hash value specified by the
+.Fa hash
+argument (which was previously generated using the
+.Xr CK_RHS_HASH 3
+macro).
+.Pp
+If the call to
+.Fn ck_rhs_fas 3
+was successful then the key specified by
+.Fa key
+was successfully stored in the hash set pointed to by
+.Fa hs .
+The key must already exist in the hash set, and is
+replaced by
+.Fa key
+and the previous value is stored into the void pointer
+pointed to by the
+.Fa previous
+argument. If the key does not exist in the hash set
+then the function will return false and the hash set
+is unchanged. This function
+is guaranteed to be stable with respect to memory usage.
+.Sh RETURN VALUES
+Upon successful completion,
+.Fn ck_rhs_fas 3
+returns true and otherwise returns false on failure.
+.Sh ERRORS
+Behavior is undefined if
+.Fa key
+or
+.Fa hs
+are uninitialized.
+.Sh SEE ALSO
+.Xr ck_rhs_init 3 ,
+.Xr ck_rhs_move 3 ,
+.Xr ck_rhs_destroy 3 ,
+.Xr CK_RHS_HASH 3 ,
+.Xr ck_rhs_iterator_init 3 ,
+.Xr ck_rhs_next 3 ,
+.Xr ck_rhs_get 3 ,
+.Xr ck_rhs_put 3 ,
+.Xr ck_rhs_put_unique 3 ,
+.Xr ck_rhs_remove 3 ,
+.Xr ck_rhs_grow 3 ,
+.Xr ck_rhs_rebuild 3 ,
+.Xr ck_rhs_gc 3 ,
+.Xr ck_rhs_count 3 ,
+.Xr ck_rhs_reset 3 ,
+.Xr ck_rhs_reset_size 3 ,
+.Xr ck_rhs_stat 3
+.Pp
+Additional information available at http://concurrencykit.org/

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/0da17e96/lib/ck/doc/ck_rhs_gc
----------------------------------------------------------------------
diff --git a/lib/ck/doc/ck_rhs_gc b/lib/ck/doc/ck_rhs_gc
new file mode 100644
index 0000000..0ad5324
--- /dev/null
+++ b/lib/ck/doc/ck_rhs_gc
@@ -0,0 +1,73 @@
+.\"
+.\" Copyright 2013 Samy Al Bahra.
+.\" 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 REGENTS 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 REGENTS 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.
+.\"
+.\"
+.Dd December 17, 2013
+.Dt CK_RHS_GC 3
+.Sh NAME
+.Nm ck_rhs_gc
+.Nd perform maintenance on a hash set
+.Sh LIBRARY
+Concurrency Kit (libck, \-lck)
+.Sh SYNOPSIS
+.In ck_rhs.h
+.Ft bool
+.Fn ck_rhs_gc "ck_rhs_t *hs"
+.Sh DESCRIPTION
+The
+.Fn ck_rhs_gc 3
+function will perform various maintenance routines on the hash set
+pointed to by
+.Fa hs ,
+including recalculating the maximum number of probes.
+.Sh RETURN VALUES
+Upon successful completion,
+.Fn ck_rhs_gc 3
+returns true and otherwise returns false on failure due to memory allocation
+failure.
+.Sh ERRORS
+This function will only return false if there are internal memory allocation
+failures.
+.Sh SEE ALSO
+.Xr ck_rhs_init 3 ,
+.Xr ck_rhs_move 3 ,
+.Xr ck_rhs_destroy 3 ,
+.Xr CK_RHS_HASH 3 ,
+.Xr ck_rhs_iterator_init 3 ,
+.Xr ck_rhs_next 3 ,
+.Xr ck_rhs_get 3 ,
+.Xr ck_rhs_put 3 ,
+.Xr ck_rhs_put_unique 3 ,
+.Xr ck_rhs_grow 3 ,
+.Xr ck_rhs_rebuild 3 ,
+.Xr ck_rhs_set 3 ,
+.Xr ck_rhs_fas 3 ,
+.Xr ck_rhs_remove 3 ,
+.Xr ck_rhs_count 3 ,
+.Xr ck_rhs_reset 3 ,
+.Xr ck_rhs_reset_size 3 ,
+.Xr ck_rhs_stat 3
+.Pp
+Additional information available at http://concurrencykit.org/

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/0da17e96/lib/ck/doc/ck_rhs_get
----------------------------------------------------------------------
diff --git a/lib/ck/doc/ck_rhs_get b/lib/ck/doc/ck_rhs_get
new file mode 100644
index 0000000..51c6e2f
--- /dev/null
+++ b/lib/ck/doc/ck_rhs_get
@@ -0,0 +1,88 @@
+.\"
+.\" Copyright 2012-2013 Samy Al Bahra.
+.\" 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 REGENTS 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 REGENTS 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.
+.\"
+.\"
+.Dd September 17, 2012
+.Dt CK_RHS_GET 3
+.Sh NAME
+.Nm ck_rhs_get
+.Nd load a key from a hash set
+.Sh LIBRARY
+Concurrency Kit (libck, \-lck)
+.Sh SYNOPSIS
+.In ck_rhs.h
+.Ft void *
+.Fn ck_rhs_get "ck_rhs_t *hs" "unsigned long hash" "const void *key"
+.Sh DESCRIPTION
+The
+.Fn ck_rhs_get 3
+function will return a pointer to a key in the hash set
+.Fa hs
+that is of equivalent value to the object pointed to by
+.Fa key .
+The key specified by
+.Fa key
+is expected to have the hash value specified by the
+.Fa hash
+argument (which is to have been previously generated using the
+.Xr CK_RHS_HASH 3
+macro).
+.Sh RETURN VALUES
+If the provided key is a member of
+.Fa hs
+then a pointer to the key as stored in
+.Fa hs
+is returned. If the key was not found in
+.Fa hs
+then a value of
+.Dv NULL
+is returned.
+.Sh ERRORS
+Behavior is undefined if
+.Fa entry
+or
+.Fa hs
+are uninitialized.
+.Sh SEE ALSO
+.Xr ck_rhs_init 3 ,
+.Xr ck_rhs_move 3 ,
+.Xr ck_rhs_destroy 3 ,
+.Xr CK_RHS_HASH 3 ,
+.Xr ck_rhs_iterator_init 3 ,
+.Xr ck_rhs_next 3 ,
+.Xr ck_rhs_put 3 ,
+.Xr ck_rhs_put_unique 3 ,
+.Xr ck_rhs_set 3 ,
+.Xr ck_rhs_fas 3 ,
+.Xr ck_rhs_remove 3 ,
+.Xr ck_rhs_grow 3 ,
+.Xr ck_rhs_rebuild 3 ,
+.Xr ck_rhs_gc 3 ,
+.Xr ck_rhs_count 3 ,
+.Xr ck_rhs_reset 3 ,
+.Xr ck_rhs_reset_size 3 ,
+.Xr ck_rhs_stat 3
+.Pp
+Additional information available at http://concurrencykit.org/


[2/3] trafficserver git commit: Merge libck master (0.4.5-5-g1df6df0)

Posted by so...@apache.org.
http://git-wip-us.apache.org/repos/asf/trafficserver/blob/0da17e96/lib/ck/doc/ck_rhs_grow
----------------------------------------------------------------------
diff --git a/lib/ck/doc/ck_rhs_grow b/lib/ck/doc/ck_rhs_grow
new file mode 100644
index 0000000..f1cac26
--- /dev/null
+++ b/lib/ck/doc/ck_rhs_grow
@@ -0,0 +1,81 @@
+.\"
+.\" Copyright 2012-2013 Samy Al Bahra.
+.\" 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 REGENTS 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 REGENTS 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.
+.\"
+.\"
+.Dd September 17, 2012
+.Dt CK_RHS_GROW 3
+.Sh NAME
+.Nm ck_rhs_grow
+.Nd enlarge hash set capacity
+.Sh LIBRARY
+Concurrency Kit (libck, \-lck)
+.Sh SYNOPSIS
+.In ck_rhs.h
+.Ft bool
+.Fn ck_rhs_grow "ck_rhs_t *hs" "unsigned long capacity"
+.Sh DESCRIPTION
+The
+.Fn ck_rhs_grow 3
+function will resize the hash set in order to be
+able to store at least the number of entries specified by
+.Fa capacity
+at a load factor of one. The default hash set load factor
+is 0.5. If you wish to minimize the likelihood of memory allocations
+for a hash set meant to store n entries, then specify a
+.Fa capacity
+of 2n. The default behavior of ck_rhs is to round
+.Fa capacity
+to the next power of two if it is not already a power of two.
+.Sh RETURN VALUES
+Upon successful completion,
+.Fn ck_rhs_grow 3
+returns true and otherwise returns false on failure.
+.Sh ERRORS
+Behavior is undefined if
+.Fa hs
+is uninitialized. This function will only
+return false if there are internal memory allocation
+failures.
+.Sh SEE ALSO
+.Xr ck_rhs_init 3 ,
+.Xr ck_rhs_move 3 ,
+.Xr ck_rhs_destroy 3 ,
+.Xr CK_RHS_HASH 3 ,
+.Xr ck_rhs_iterator_init 3 ,
+.Xr ck_rhs_next 3 ,
+.Xr ck_rhs_get 3 ,
+.Xr ck_rhs_put 3 ,
+.Xr ck_rhs_put_unique 3 ,
+.Xr ck_rhs_set 3 ,
+.Xr ck_rhs_fas 3 ,
+.Xr ck_rhs_remove 3 ,
+.Xr ck_rhs_rebuild 3 ,
+.Xr ck_rhs_gc 3 ,
+.Xr ck_rhs_count 3 ,
+.Xr ck_rhs_reset 3 ,
+.Xr ck_rhs_reset_size 3 ,
+.Xr ck_rhs_stat 3
+.Pp
+Additional information available at http://concurrencykit.org/

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/0da17e96/lib/ck/doc/ck_rhs_init
----------------------------------------------------------------------
diff --git a/lib/ck/doc/ck_rhs_init b/lib/ck/doc/ck_rhs_init
new file mode 100644
index 0000000..17c5097
--- /dev/null
+++ b/lib/ck/doc/ck_rhs_init
@@ -0,0 +1,166 @@
+.\"
+.\" Copyright 2012-2013 Samy Al Bahra.
+.\" 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 REGENTS 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 REGENTS 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.
+.\"
+.\"
+.Dd September 17, 2012
+.Dt CK_RHS_INIT 3
+.Sh NAME
+.Nm ck_rhs_init
+.Nd initialize a hash set
+.Sh LIBRARY
+Concurrency Kit (libck, \-lck)
+.Sh SYNOPSIS
+.In ck_rhs.h
+.Ft typedef unsigned long
+.Fn ck_rhs_hash_cb_t "const void *key" "unsigned long seed"
+.Ft typedef bool
+.Fn ck_rhs_compare_cb_t "const void *c1" "const void *c2"
+.Ft bool
+.Fn ck_rhs_init "ck_rhs_t *hs" "unsigned int mode" "ck_rhs_hash_cb_t *hash_function" "ck_rhs_compare_cb_t *compare" "struct ck_malloc *allocator" "unsigned long capacity" "unsigned long seed"
+.Sh DESCRIPTION
+The
+.Fn ck_rhs_init
+function initializes the hash set pointed to by the
+.Fa hs
+pointer.
+.Pp
+The argument
+.Fa mode
+specifies the type of key-value pairs to be stored in the
+hash set as well as the expected concurrent access model.
+The value of
+.Fa mode
+consists of a bitfield of one of the following:
+.Bl -tag -width indent
+.It CK_RHS_MODE_OBJECT
+The hash set is meant to store pointers to objects. This provides
+a hint that only CK_MD_VMA_BITS are necessary to encode the key
+argument. Any unused pointer bits are leveraged for internal
+optimizations.
+.It CK_RHS_MODE_DIRECT
+The hash set is meant to directly store key values and that all
+bits of the key are used to encode values.
+.It CK_RHS_MODE_READ_MOSTLY
+Optimize read operations over put/delete.
+.El
+.Pp
+The concurrent access model is specified by:
+.Bl -tag -width indent
+.It CK_RHS_MODE_SPMC
+The hash set should allow for concurrent readers in the
+presence of a single writer.
+.It CK_RHS_MODE_MPMC
+The hash set should allow for concurrent readers in the
+presence of concurrent writers. This is currently unsupported.
+.El
+.Pp
+The developer is free to specify additional workload hints.
+These hints are one of:
+.Bl -tag -width indent
+.El
+.Pp
+The argument
+.Fa hash_function
+is a mandatory pointer to a user-specified hash function.
+A user-specified hash function takes two arguments. The
+.Fa key
+argument is a pointer to a key. The
+.Fa seed
+argument is the initial seed associated with the hash set.
+This initial seed is specified by the user in
+.Xr ck_rhs_init 3 .
+.Pp
+The
+.Fa compare
+argument is an optional pointer to a user-specified
+key comparison function. If NULL is specified in this
+argument, then pointer equality will be used to determine
+key equality. A user-specified comparison function takes
+two arguments representing pointers to the objects being
+compared for equality. It is expected to return true
+if the keys are of equal value and false otherwise.
+.Pp
+The
+.Fa allocator
+argument is a pointer to a structure containing
+.Fa malloc
+and
+.Fa free
+function pointers which respectively define the memory allocation and
+destruction functions to be used by the hash set being initialized.
+.Pp
+The argument
+.Fa capacity
+represents the initial number of keys the hash
+set is expected to contain. This argument is simply a hint
+and the underlying implementation is free to allocate more
+or less memory than necessary to contain the number of entries
+.Fa capacity
+specifies.
+.Pp
+The argument
+.Fa seed
+specifies the initial seed used by the underlying hash function.
+The user is free to choose a value of their choice.
+.Sh RETURN VALUES
+Upon successful completion
+.Fn ck_rhs_init
+returns a value of
+.Dv true
+and otherwise returns a value of
+.Dv false
+to indicate an error.
+.Sh ERRORS
+.Bl -tag -width Er
+.Pp
+The behavior of
+.Fn ck_rhs_init
+is undefined if
+.Fa hs
+is not a pointer to a
+.Tn ck_rhs_t
+object.
+.El
+.Sh SEE ALSO
+.Xr ck_rhs_move 3 ,
+.Xr ck_rhs_destroy 3 ,
+.Xr CK_RHS_HASH 3 ,
+.Xr ck_rhs_iterator_init 3 ,
+.Xr ck_rhs_next 3 ,
+.Xr ck_rhs_get 3 ,
+.Xr ck_rhs_put 3 ,
+.Xr ck_rhs_put_unique 3 ,
+.Xr ck_rhs_set 3 ,
+.Xr ck_rhs_fas 3 ,
+.Xr ck_rhs_remove 3 ,
+.Xr ck_rhs_grow 3 ,
+.Xr ck_rhs_rebuild 3 ,
+.Xr ck_rhs_gc 3 ,
+.Xr ck_rhs_count 3 ,
+.Xr ck_rhs_reset 3 ,
+.Xr ck_rhs_reset_size 3 ,
+.Xr ck_rhs_stat 3
+.Pp
+Additional information available at http://concurrencykit.org/

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/0da17e96/lib/ck/doc/ck_rhs_iterator_init
----------------------------------------------------------------------
diff --git a/lib/ck/doc/ck_rhs_iterator_init b/lib/ck/doc/ck_rhs_iterator_init
new file mode 100644
index 0000000..4cfd083
--- /dev/null
+++ b/lib/ck/doc/ck_rhs_iterator_init
@@ -0,0 +1,78 @@
+.\"
+.\" Copyright 2012-2013 Samy Al Bahra.
+.\" 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 REGENTS 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 REGENTS 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.
+.\"
+.\"
+.Dd September 17, 2012
+.Dt CK_RHS_ITERATOR_INIT 3
+.Sh NAME
+.Nm ck_rhs_iterator_init
+.Nd initialize hash set iterator
+.Sh LIBRARY
+Concurrency Kit (libck, \-lck)
+.Sh SYNOPSIS
+.In ck_rhs.h
+.Pp
+.Dv ck_rhs_iterator_t iterator = CK_RHS_ITERATOR_INITIALIZER
+.Pp
+.Ft void
+.Fn ck_rhs_iterator_init "ck_rhs_iterator_t *iterator"
+.Sh DESCRIPTION
+The
+.Fn ck_rhs_iterator_init 3
+function will initialize the object pointed to
+by the
+.Fa iterator
+argument. Alternatively, an iterator may be statically
+initialized by assigning it to the CK_RHS_ITERATOR_INITIALIZER value.
+.Pp
+An iterator is used to iterate through hash set entries with the
+.Xr ck_rhs_next 3
+function.
+.Sh RETURN VALUES
+.Fn ck_rhs_iterator_init 3
+has no return value.
+.Sh ERRORS
+This function will not fail.
+.Sh SEE ALSO
+.Xr ck_rhs_init 3 ,
+.Xr ck_rhs_move 3 ,
+.Xr ck_rhs_destroy 3 ,
+.Xr CK_RHS_HASH 3 ,
+.Xr ck_rhs_next 3 ,
+.Xr ck_rhs_get 3 ,
+.Xr ck_rhs_put 3 ,
+.Xr ck_rhs_put_unique 3 ,
+.Xr ck_rhs_set 3 ,
+.Xr ck_rhs_fas 3 ,
+.Xr ck_rhs_remove 3 ,
+.Xr ck_rhs_grow 3 ,
+.Xr ck_rhs_rebuild 3 ,
+.Xr ck_rhs_gc 3 ,
+.Xr ck_rhs_count 3 ,
+.Xr ck_rhs_reset 3 ,
+.Xr ck_rhs_reset_size 3 ,
+.Xr ck_rhs_stat 3
+.Pp
+Additional information available at http://concurrencykit.org/

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/0da17e96/lib/ck/doc/ck_rhs_move
----------------------------------------------------------------------
diff --git a/lib/ck/doc/ck_rhs_move b/lib/ck/doc/ck_rhs_move
new file mode 100644
index 0000000..45e38e7
--- /dev/null
+++ b/lib/ck/doc/ck_rhs_move
@@ -0,0 +1,90 @@
+.\"
+.\" Copyright 2013 Samy Al Bahra.
+.\" 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 REGENTS 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 REGENTS 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.
+.\"
+.\"
+.Dd July 18, 2013
+.Dt CK_RHS_MOVE 3
+.Sh NAME
+.Nm ck_rhs_move
+.Nd move one from hash set to another
+.Sh LIBRARY
+Concurrency Kit (libck, \-lck)
+.Sh SYNOPSIS
+.In ck_rhs.h
+.Ft bool
+.Fn ck_rhs_move "ck_rhs_t *destination" "ck_rhs_t *source" "ck_rhs_hash_cb_t *hash_cb" "ck_rhs_compare_cb_t *compare_cb" "struct ck_malloc *m"
+.Sh DESCRIPTION
+The
+.Fn ck_rhs_move 3
+function will initialize
+.Fa source
+from
+.Fa destination .
+The hash function is set to
+.Fa hash_cb ,
+comparison function to
+.Fa compare_cb
+and the allocator callbacks to
+.Fa m .
+Further modifications to
+.Fa source
+will result in undefined behavior. Concurrent
+.Xr ck_rhs_get 3
+and
+.Xr ck_rhs_fas 3
+operations to
+.Fa source
+are legal until the next write operation to
+.Fa destination .
+.Pp
+This operation moves ownership from one hash set object
+to another and re-assigns callback functions to developer-specified
+values. This allows for dynamic configuration of allocation
+callbacks and is necessary for use-cases involving executable code
+which may be unmapped underneath the hash set.
+.Sh RETURN VALUES
+Upon successful completion
+.Fn ck_rhs_move 3
+returns true and otherwise returns false to indicate an error.
+.Sh SEE ALSO
+.Xr ck_rhs_init 3 ,
+.Xr ck_rhs_destroy 3 ,
+.Xr CK_RHS_HASH 3 ,
+.Xr ck_rhs_iterator_init 3 ,
+.Xr ck_rhs_next 3 ,
+.Xr ck_rhs_put 3 ,
+.Xr ck_rhs_put_unique 3 ,
+.Xr ck_rhs_set 3 ,
+.Xr ck_rhs_fas 3 ,
+.Xr ck_rhs_remove 3 ,
+.Xr ck_rhs_grow 3 ,
+.Xr ck_rhs_rebuild 3 ,
+.Xr ck_rhs_gc 3 ,
+.Xr ck_rhs_count 3 ,
+.Xr ck_rhs_reset 3 ,
+.Xr ck_rhs_reset_size 3 ,
+.Xr ck_rhs_stat 3
+.Pp
+Additional information available at http://concurrencykit.org/

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/0da17e96/lib/ck/doc/ck_rhs_next
----------------------------------------------------------------------
diff --git a/lib/ck/doc/ck_rhs_next b/lib/ck/doc/ck_rhs_next
new file mode 100644
index 0000000..c90a7d6
--- /dev/null
+++ b/lib/ck/doc/ck_rhs_next
@@ -0,0 +1,92 @@
+.\"
+.\" Copyright 2012-2013 Samy Al Bahra.
+.\" 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 REGENTS 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 REGENTS 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.
+.\"
+.\"
+.Dd September 17, 2012
+.Dt CK_RHS_NEXT 3
+.Sh NAME
+.Nm ck_rhs_next
+.Nd iterate to next entry in hash set
+.Sh LIBRARY
+Concurrency Kit (libck, \-lck)
+.Sh SYNOPSIS
+.In ck_rhs.h
+.Ft bool
+.Fn ck_rhs_next "ck_rhs_t *hs" "ck_rhs_iterator_t *iterator" "void **entry"
+.Sh DESCRIPTION
+The
+.Fn ck_rhs_next 3
+function will increment the iterator object pointed to by
+.Fa iterator
+to point to the next non-empty hash set entry. If
+.Fn ck_rhs_next 3
+returns true then the pointer pointed to by
+.Fa entry
+is initialized to the current hash set key pointed to by the
+.Fa iterator
+object.
+.Pp
+It is expected that
+.Fa iterator
+has been initialized using the
+.Xr ck_rhs_iterator_init 3
+function or statically initialized using CK_RHS_ITERATOR_INITIALIZER.
+.Sh RETURN VALUES
+If
+.Fn ck_rhs_next 3
+returns true then the object pointed to by
+.Fa entry
+points to a valid hash set key. If
+.Fn ck_rhs_next 3
+returns false then the value of the object pointed to by
+.Fa entry
+is undefined.
+.Sh ERRORS
+Behavior is undefined if
+.Fa iterator
+or
+.Fa hs
+are uninitialized.
+.Sh SEE ALSO
+.Xr ck_rhs_init 3 ,
+.Xr ck_rhs_move 3 ,
+.Xr ck_rhs_destroy 3 ,
+.Xr CK_RHS_HASH 3 ,
+.Xr ck_rhs_iterator_init 3 ,
+.Xr ck_rhs_get 3 ,
+.Xr ck_rhs_put 3 ,
+.Xr ck_rhs_put_unique 3 ,
+.Xr ck_rhs_set 3 ,
+.Xr ck_rhs_fas 3 ,
+.Xr ck_rhs_remove 3 ,
+.Xr ck_rhs_grow 3 ,
+.Xr ck_rhs_rebuild 3 ,
+.Xr ck_rhs_gc 3 ,
+.Xr ck_rhs_count 3 ,
+.Xr ck_rhs_reset 3 ,
+.Xr ck_rhs_reset_size 3 ,
+.Xr ck_rhs_stat 3
+.Pp
+Additional information available at http://concurrencykit.org/

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/0da17e96/lib/ck/doc/ck_rhs_put
----------------------------------------------------------------------
diff --git a/lib/ck/doc/ck_rhs_put b/lib/ck/doc/ck_rhs_put
new file mode 100644
index 0000000..8df9b65
--- /dev/null
+++ b/lib/ck/doc/ck_rhs_put
@@ -0,0 +1,98 @@
+.\"
+.\" Copyright 2012-2013 Samy Al Bahra.
+.\" 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 REGENTS 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 REGENTS 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.
+.\"
+.\"
+.Dd September 17, 2012
+.Dt CK_RHS_PUT 3
+.Sh NAME
+.Nm ck_rhs_put
+.Nd store unique key into a hash set
+.Sh LIBRARY
+Concurrency Kit (libck, \-lck)
+.Sh SYNOPSIS
+.In ck_rhs.h
+.Ft bool
+.Fn ck_rhs_put "ck_rhs_t *hs" "unsigned long hash" "const void *key"
+.Sh DESCRIPTION
+The
+.Fn ck_rhs_put 3
+function will store the key specified by the
+.Fa key
+argument in the hash set pointed to by the
+.Fa hs
+argument. The key specified by
+.Fa key
+is expected to have the hash value specified by the
+.Fa hash
+argument (which was previously generated using the
+.Xr CK_RHS_HASH 3
+macro).
+.Pp
+If the call to
+.Fn ck_rhs_put 3
+was successful then the key specified by
+.Fa key
+was successfully stored in the hash set pointed to by
+.Fa hs .
+The function will fail if a key with an
+equivalent value to
+.Fa key
+is already present in the hash set. For replacement
+semantics, please see the
+.Xr ck_rhs_set 3
+function.
+.Sh RETURN VALUES
+Upon successful completion,
+.Fn ck_rhs_put 3
+returns true and otherwise returns false on failure.
+.Sh ERRORS
+Behavior is undefined if
+.Fa key
+or
+.Fa hs
+are uninitialized. The function will also
+return false if the hash set could not be enlarged
+to accomodate key insertion.
+.Sh SEE ALSO
+.Xr ck_rhs_init 3 ,
+.Xr ck_rhs_move 3 ,
+.Xr ck_rhs_destroy 3 ,
+.Xr CK_RHS_HASH 3 ,
+.Xr ck_rhs_iterator_init 3 ,
+.Xr ck_rhs_next 3 ,
+.Xr ck_rhs_put_unique 3 ,
+.Xr ck_rhs_get 3 ,
+.Xr ck_rhs_set 3 ,
+.Xr ck_rhs_fas 3 ,
+.Xr ck_rhs_remove 3 ,
+.Xr ck_rhs_grow 3 ,
+.Xr ck_rhs_rebuild 3 ,
+.Xr ck_rhs_gc 3 ,
+.Xr ck_rhs_count 3 ,
+.Xr ck_rhs_reset 3 ,
+.Xr ck_rhs_reset_size 3 ,
+.Xr ck_rhs_stat 3
+.Pp
+Additional information available at http://concurrencykit.org/

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/0da17e96/lib/ck/doc/ck_rhs_put_unique
----------------------------------------------------------------------
diff --git a/lib/ck/doc/ck_rhs_put_unique b/lib/ck/doc/ck_rhs_put_unique
new file mode 100644
index 0000000..4f941ab
--- /dev/null
+++ b/lib/ck/doc/ck_rhs_put_unique
@@ -0,0 +1,98 @@
+.\"
+.\" Copyright 2013 Samy Al Bahra.
+.\" 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 REGENTS 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 REGENTS 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.
+.\"
+.\"
+.Dd December 7, 2013
+.Dt CK_RHS_PUT_UNIQUE 3
+.Sh NAME
+.Nm ck_rhs_put_unique
+.Nd unconditionally store unique key into a hash set
+.Sh LIBRARY
+Concurrency Kit (libck, \-lck)
+.Sh SYNOPSIS
+.In ck_rhs.h
+.Ft bool
+.Fn ck_rhs_put_unique "ck_rhs_t *hs" "unsigned long hash" "const void *key"
+.Sh DESCRIPTION
+The
+.Fn ck_rhs_put_unique 3
+function will store the key specified by the
+.Fa key
+argument in the hash set pointed to by the
+.Fa hs
+argument. The key specified by
+.Fa key
+is expected to have the hash value specified by the
+.Fa hash
+argument (which was previously generated using the
+.Xr CK_RHS_HASH 3
+macro).
+.Pp
+If the call to
+.Fn ck_rhs_put 3
+was successful then the key specified by
+.Fa key
+was successfully stored in the hash set pointed to by
+.Fa hs .
+The function will cause undefined behavior if a key with an
+equivalent value is already present in the hash set. For replacement
+semantics, please see the
+.Xr ck_rhs_set 3
+function.
+.Sh RETURN VALUES
+Upon successful completion,
+.Fn ck_rhs_put_unique 3
+returns true and otherwise returns false on failure.
+.Sh ERRORS
+Behavior is undefined if
+.Fa key
+or
+.Fa hs
+are uninitialized. The function will also
+return false if the hash set could not be enlarged
+to accomodate key insertion. The function will
+result in undefined behavior if called for an
+already inserted key value.
+.Sh SEE ALSO
+.Xr ck_rhs_init 3 ,
+.Xr ck_rhs_move 3 ,
+.Xr ck_rhs_destroy 3 ,
+.Xr CK_RHS_HASH 3 ,
+.Xr ck_rhs_iterator_init 3 ,
+.Xr ck_rhs_next 3 ,
+.Xr ck_rhs_get 3 ,
+.Xr ck_rhs_put 3 ,
+.Xr ck_rhs_set 3 ,
+.Xr ck_rhs_fas 3 ,
+.Xr ck_rhs_remove 3 ,
+.Xr ck_rhs_grow 3 ,
+.Xr ck_rhs_rebuild 3 ,
+.Xr ck_rhs_gc 3 ,
+.Xr ck_rhs_count 3 ,
+.Xr ck_rhs_reset 3 ,
+.Xr ck_rhs_reset_size 3 ,
+.Xr ck_rhs_stat 3
+.Pp
+Additional information available at http://concurrencykit.org/

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/0da17e96/lib/ck/doc/ck_rhs_rebuild
----------------------------------------------------------------------
diff --git a/lib/ck/doc/ck_rhs_rebuild b/lib/ck/doc/ck_rhs_rebuild
new file mode 100644
index 0000000..8ab9b50
--- /dev/null
+++ b/lib/ck/doc/ck_rhs_rebuild
@@ -0,0 +1,76 @@
+.\"
+.\" Copyright 2013 Samy Al Bahra.
+.\" 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 REGENTS 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 REGENTS 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.
+.\"
+.\"
+.Dd December 7, 2013
+.Dt CK_RHS_REBUILD 3
+.Sh NAME
+.Nm ck_rhs_rebuild
+.Nd rebuild a hash set
+.Sh LIBRARY
+Concurrency Kit (libck, \-lck)
+.Sh SYNOPSIS
+.In ck_rhs.h
+.Ft bool
+.Fn ck_rhs_rebuild "ck_rhs_t *hs"
+.Sh DESCRIPTION
+The
+.Fn ck_rhs_rebuild 3
+function will regenerate the hash set pointed to by
+.Fa hs .
+This has the side-effect of pruning degradatory side-effects
+of workloads that are delete heavy. The regenerated hash
+set should have shorter probe sequences on average. This
+operation will require a significant amount of memory
+and is free to allocate a duplicate hash set in the
+rebuild process.
+.Sh RETURN VALUES
+Upon successful completion,
+.Fn ck_rhs_rebuild 3
+returns true and otherwise returns false on failure.
+.Sh ERRORS
+This function will only return false if there are internal memory allocation
+failures.
+.Sh SEE ALSO
+.Xr ck_rhs_init 3 ,
+.Xr ck_rhs_move 3 ,
+.Xr ck_rhs_destroy 3 ,
+.Xr CK_RHS_HASH 3 ,
+.Xr ck_rhs_iterator_init 3 ,
+.Xr ck_rhs_next 3 ,
+.Xr ck_rhs_get 3 ,
+.Xr ck_rhs_put 3 ,
+.Xr ck_rhs_put_unique 3 ,
+.Xr ck_rhs_set 3 ,
+.Xr ck_rhs_fas 3 ,
+.Xr ck_rhs_gc 3 ,
+.Xr ck_rhs_grow 3 ,
+.Xr ck_rhs_remove 3 ,
+.Xr ck_rhs_count 3 ,
+.Xr ck_rhs_reset 3 ,
+.Xr ck_rhs_reset_size 3 ,
+.Xr ck_rhs_stat 3
+.Pp
+Additional information available at http://concurrencykit.org/

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/0da17e96/lib/ck/doc/ck_rhs_remove
----------------------------------------------------------------------
diff --git a/lib/ck/doc/ck_rhs_remove b/lib/ck/doc/ck_rhs_remove
new file mode 100644
index 0000000..c83bf38
--- /dev/null
+++ b/lib/ck/doc/ck_rhs_remove
@@ -0,0 +1,92 @@
+.\"
+.\" Copyright 2012-2013 Samy Al Bahra.
+.\" 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 REGENTS 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 REGENTS 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.
+.\"
+.\"
+.Dd September 17, 2012
+.Dt CK_RHS_REMOVE 3
+.Sh NAME
+.Nm ck_rhs_remove
+.Nd remove key from a hash set
+.Sh LIBRARY
+Concurrency Kit (libck, \-lck)
+.Sh SYNOPSIS
+.In ck_rhs.h
+.Ft void *
+.Fn ck_rhs_remove "ck_rhs_t *hs" "unsigned long hash" "const void *key"
+.Sh DESCRIPTION
+The
+.Fn ck_rhs_remove 3
+function will attempt to remove the key specified by the
+.Fa key
+argument in the hash set pointed to by the
+.Fa hs
+argument. The key specified by
+.Fa key
+is expected to have the hash value specified by the
+.Fa hash
+argument (which was previously generated using the
+.Xr CK_RHS_HASH 3
+macro).
+.Pp
+If the call to
+.Fn ck_rhs_remove 3
+was successful then the key contained in the hash
+set is returned. If the key was not a member of the hash
+set then
+.Dv  NULL
+is returned.
+.Sh RETURN VALUES
+Upon successful completion,
+.Fn ck_rhs_remove 3
+returns a pointer to a key and otherwise returns
+.Dv NULL
+on failure.
+.Sh ERRORS
+Behavior is undefined if
+.Fa key
+or
+.Fa hs
+are uninitialized.
+.Sh SEE ALSO
+.Xr ck_rhs_init 3 ,
+.Xr ck_rhs_move 3 ,
+.Xr ck_rhs_destroy 3 ,
+.Xr CK_RHS_HASH 3 ,
+.Xr ck_rhs_iterator_init 3 ,
+.Xr ck_rhs_next 3 ,
+.Xr ck_rhs_get 3 ,
+.Xr ck_rhs_put 3 ,
+.Xr ck_rhs_put_unique 3 ,
+.Xr ck_rhs_set 3 ,
+.Xr ck_rhs_fas 3 ,
+.Xr ck_rhs_grow 3 ,
+.Xr ck_rhs_gc 3 ,
+.Xr ck_rhs_rebuild 3 ,
+.Xr ck_rhs_count 3 ,
+.Xr ck_rhs_reset 3 ,
+.Xr ck_rhs_reset_size 3 ,
+.Xr ck_rhs_stat 3
+.Pp
+Additional information available at http://concurrencykit.org/

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/0da17e96/lib/ck/doc/ck_rhs_reset
----------------------------------------------------------------------
diff --git a/lib/ck/doc/ck_rhs_reset b/lib/ck/doc/ck_rhs_reset
new file mode 100644
index 0000000..a750d85
--- /dev/null
+++ b/lib/ck/doc/ck_rhs_reset
@@ -0,0 +1,77 @@
+.\"
+.\" Copyright 2012-2013 Samy Al Bahra.
+.\" 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 REGENTS 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 REGENTS 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.
+.\"
+.\"
+.Dd September 17, 2012
+.Dt CK_RHS_RESET 3
+.Sh NAME
+.Nm ck_rhs_reset
+.Nd remove all keys from a hash set
+.Sh LIBRARY
+Concurrency Kit (libck, \-lck)
+.Sh SYNOPSIS
+.In ck_rhs.h
+.Ft bool
+.Fn ck_rhs_reset "ck_rhs_t *hs"
+.Sh DESCRIPTION
+The
+.Fn ck_rhs_reset 3
+function will remove all keys stored in the hash
+set pointed to by the
+.Fa hs
+argument.
+.Sh RETURN VALUES
+If successful,
+.Fn ck_rhs_reset 3
+will return true and will otherwise return false on failure. This
+function will only fail if a replacement hash set could not be
+allocated internally.
+.Sh ERRORS
+Behavior is undefined if
+.Fa hs
+is uninitialized. Behavior is
+undefined if this function is called by a non-writer
+thread.
+.Sh SEE ALSO
+.Xr ck_rhs_init 3 ,
+.Xr ck_rhs_move 3 ,
+.Xr ck_rhs_destroy 3 ,
+.Xr CK_RHS_HASH 3 ,
+.Xr ck_rhs_iterator_init 3 ,
+.Xr ck_rhs_next 3 ,
+.Xr ck_rhs_get 3 ,
+.Xr ck_rhs_put 3 ,
+.Xr ck_rhs_put_unique 3 ,
+.Xr ck_rhs_set 3 ,
+.Xr ck_rhs_fas 3 ,
+.Xr ck_rhs_remove 3 ,
+.Xr ck_rhs_reset_size 3 ,
+.Xr ck_rhs_grow 3 ,
+.Xr ck_rhs_gc 3 ,
+.Xr ck_rhs_rebuild 3 ,
+.Xr ck_rhs_count 3 ,
+.Xr ck_rhs_stat 3
+.Pp
+Additional information available at http://concurrencykit.org/

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/0da17e96/lib/ck/doc/ck_rhs_reset_size
----------------------------------------------------------------------
diff --git a/lib/ck/doc/ck_rhs_reset_size b/lib/ck/doc/ck_rhs_reset_size
new file mode 100644
index 0000000..6e9913e
--- /dev/null
+++ b/lib/ck/doc/ck_rhs_reset_size
@@ -0,0 +1,80 @@
+.\"
+.\" Copyright 2012-2013 Samy Al Bahra.
+.\" 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 REGENTS 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 REGENTS 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.
+.\"
+.\"
+.Dd May 5, 2013
+.Dt CK_RHS_RESET_SIZE 3
+.Sh NAME
+.Nm ck_rhs_reset_size
+.Nd remove all keys from a hash set
+.Sh LIBRARY
+Concurrency Kit (libck, \-lck)
+.Sh SYNOPSIS
+.In ck_rhs.h
+.Ft bool
+.Fn ck_rhs_reset_size "ck_rhs_t *hs" "unsigned long size"
+.Sh DESCRIPTION
+The
+.Fn ck_rhs_reset_size 3
+function will remove all keys stored in the hash
+set pointed to by the
+.Fa hs
+argument and create a new generation of the hash set that
+is preallocated for
+.Fa size
+entries.
+.Sh RETURN VALUES
+If successful,
+.Fn ck_rhs_reset_size 3
+will return true and will otherwise return false on failure. This
+function will only fail if a replacement hash set could not be
+allocated internally.
+.Sh ERRORS
+Behavior is undefined if
+.Fa hs
+is uninitialized. Behavior is
+undefined if this function is called by a non-writer
+thread.
+.Sh SEE ALSO
+.Xr ck_rhs_init 3 ,
+.Xr ck_rhs_move 3 ,
+.Xr ck_rhs_destroy 3 ,
+.Xr CK_RHS_HASH 3 ,
+.Xr ck_rhs_iterator_init 3 ,
+.Xr ck_rhs_next 3 ,
+.Xr ck_rhs_get 3 ,
+.Xr ck_rhs_put 3 ,
+.Xr ck_rhs_put_unique 3 ,
+.Xr ck_rhs_set 3 ,
+.Xr ck_rhs_fas 3 ,
+.Xr ck_rhs_remove 3 ,
+.Xr ck_rhs_grow 3 ,
+.Xr ck_rhs_gc 3 ,
+.Xr ck_rhs_rebuild 3 ,
+.Xr ck_rhs_count 3 ,
+.Xr ck_rhs_reset 3 ,
+.Xr ck_rhs_stat 3
+.Pp
+Additional information available at http://concurrencykit.org/

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/0da17e96/lib/ck/doc/ck_rhs_set
----------------------------------------------------------------------
diff --git a/lib/ck/doc/ck_rhs_set b/lib/ck/doc/ck_rhs_set
new file mode 100644
index 0000000..6f3e280
--- /dev/null
+++ b/lib/ck/doc/ck_rhs_set
@@ -0,0 +1,102 @@
+.\"
+.\" Copyright 2012-2013 Samy Al Bahra.
+.\" 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 REGENTS 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 REGENTS 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.
+.\"
+.\"
+.Dd September 17, 2012
+.Dt CK_RHS_SET 3
+.Sh NAME
+.Nm ck_rhs_set
+.Nd store key into a hash set
+.Sh LIBRARY
+Concurrency Kit (libck, \-lck)
+.Sh SYNOPSIS
+.In ck_rhs.h
+.Ft bool
+.Fn ck_rhs_set "ck_rhs_t *hs" "unsigned long hash" "const void *key" "void **previous"
+.Sh DESCRIPTION
+The
+.Fn ck_rhs_set 3
+function will store the key specified by the
+.Fa key
+argument in the hash set pointed to by the
+.Fa hs
+argument. The key specified by
+.Fa key
+is expected to have the hash value specified by the
+.Fa hash
+argument (which was previously generated using the
+.Xr CK_RHS_HASH 3
+macro).
+.Pp
+If the call to
+.Fn ck_rhs_set 3
+was successful then the key specified by
+.Fa key
+was successfully stored in the hash set pointed to by
+.Fa hs .
+If the key already exists in the hash set, then it is
+replaced by
+.Fa key
+and the previous value is stored into the void pointer
+pointed to by the
+.Fa previous
+argument. If previous is set to
+.Dv NULL
+then
+.Fa key
+was not a replacement for an existing entry in the hash set.
+.Sh RETURN VALUES
+Upon successful completion,
+.Fn ck_rhs_set 3
+returns true and otherwise returns false on failure.
+.Sh ERRORS
+Behavior is undefined if
+.Fa key
+or
+.Fa hs
+are uninitialized. The function will also
+return false if the hash set could not be enlarged
+to accomodate key insertion.
+.Sh SEE ALSO
+.Xr ck_rhs_init 3 ,
+.Xr ck_rhs_move 3 ,
+.Xr ck_rhs_destroy 3 ,
+.Xr CK_RHS_HASH 3 ,
+.Xr ck_rhs_iterator_init 3 ,
+.Xr ck_rhs_next 3 ,
+.Xr ck_rhs_get 3 ,
+.Xr ck_rhs_put 3 ,
+.Xr ck_rhs_put_unique 3 ,
+.Xr ck_rhs_fas 3 ,
+.Xr ck_rhs_remove 3 ,
+.Xr ck_rhs_grow 3 ,
+.Xr ck_rhs_gc 3 ,
+.Xr ck_rhs_rebuild 3 ,
+.Xr ck_rhs_count 3 ,
+.Xr ck_rhs_reset 3 ,
+.Xr ck_rhs_reset_size 3 ,
+.Xr ck_rhs_stat 3
+.Pp
+Additional information available at http://concurrencykit.org/

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/0da17e96/lib/ck/doc/ck_rhs_stat
----------------------------------------------------------------------
diff --git a/lib/ck/doc/ck_rhs_stat b/lib/ck/doc/ck_rhs_stat
new file mode 100644
index 0000000..df45672
--- /dev/null
+++ b/lib/ck/doc/ck_rhs_stat
@@ -0,0 +1,80 @@
+.\"
+.\" Copyright 2012-2013 Samy Al Bahra.
+.\" 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 REGENTS 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 REGENTS 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.
+.\"
+.\"
+.Dd September 17, 2012
+.Dt CK_RHS_STAT 3
+.Sh NAME
+.Nm ck_rhs_stat
+.Nd get hash set status
+.Sh LIBRARY
+Concurrency Kit (libck, \-lck)
+.Sh SYNOPSIS
+.In ck_rhs.h
+.Ft void
+.Fn ck_rhs_stat "ck_rhs_t *hs" "struct ck_rhs_stat *st"
+.Sh DESCRIPTION
+The
+.Fn ck_rhs_stat 3
+function will store various hash set statistics in
+the object pointed to by
+.Fa st .
+The ck_rhs_stat structure is defined as follows:
+.Bd -literal -offset indent
+struct ck_rhs_stat {
+	unsigned long n_entries;    /* Current number of keys in hash set. */
+	unsigned int probe_maximum; /* Longest read-side probe sequence. */
+};
+.Ed
+.Sh RETURN VALUES
+.Fn ck_rhs_stat 3
+has no return value.
+.Sh ERRORS
+Behavior is undefined if
+.Fa hs
+is uninitialized. Behavior is
+undefined if this function is called by a non-writer
+thread.
+.Sh SEE ALSO
+.Xr ck_rhs_init 3 ,
+.Xr ck_rhs_move 3 ,
+.Xr ck_rhs_destroy 3 ,
+.Xr CK_RHS_HASH 3 ,
+.Xr ck_rhs_iterator_init 3 ,
+.Xr ck_rhs_next 3 ,
+.Xr ck_rhs_get 3 ,
+.Xr ck_rhs_put 3 ,
+.Xr ck_rhs_put_unique 3 ,
+.Xr ck_rhs_set 3 ,
+.Xr ck_rhs_fas 3 ,
+.Xr ck_rhs_remove 3 ,
+.Xr ck_rhs_grow 3 ,
+.Xr ck_rhs_gc 3 ,
+.Xr ck_rhs_rebuild 3 ,
+.Xr ck_rhs_count 3 ,
+.Xr ck_rhs_reset 3 ,
+.Xr ck_rhs_reset_size 3
+.Pp
+Additional information available at http://concurrencykit.org/

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/0da17e96/lib/ck/doc/ck_ring_dequeue_spmc
----------------------------------------------------------------------
diff --git a/lib/ck/doc/ck_ring_dequeue_spmc b/lib/ck/doc/ck_ring_dequeue_spmc
index 82fc2fb..7fd7d9b 100644
--- a/lib/ck/doc/ck_ring_dequeue_spmc
+++ b/lib/ck/doc/ck_ring_dequeue_spmc
@@ -91,7 +91,7 @@ dequeue(void)
 	}
 
 	/* An empty ring was encountered, leave. */
-	return; 
+	return;
 }
 .Ed
 .Sh RETURN VALUES

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/0da17e96/lib/ck/doc/ck_ring_dequeue_spsc
----------------------------------------------------------------------
diff --git a/lib/ck/doc/ck_ring_dequeue_spsc b/lib/ck/doc/ck_ring_dequeue_spsc
index 75b36ac..069dc7f 100644
--- a/lib/ck/doc/ck_ring_dequeue_spsc
+++ b/lib/ck/doc/ck_ring_dequeue_spsc
@@ -89,7 +89,7 @@ dequeue(void)
 	}
 
 	/* An empty ring was encountered, leave. */
-	return; 
+	return;
 }
 .Ed
 .Sh RETURN VALUES

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/0da17e96/lib/ck/doc/ck_ring_enqueue_spmc
----------------------------------------------------------------------
diff --git a/lib/ck/doc/ck_ring_enqueue_spmc b/lib/ck/doc/ck_ring_enqueue_spmc
index 20fd6a8..ba99199 100644
--- a/lib/ck/doc/ck_ring_enqueue_spmc
+++ b/lib/ck/doc/ck_ring_enqueue_spmc
@@ -42,7 +42,7 @@ function enqueues the pointer
 .Fa entry
 into the bounded buffer pointed to by
 .Fa ring
-in FIFO fashion. 
+in FIFO fashion.
 The buffer pointed to by
 .Fa buffer
 must be unique to
@@ -88,11 +88,11 @@ enqueue(void)
 	}
 
 	/* Enqueue operation completed successfully. */
-	return; 
+	return;
 }
 .Ed
 .Sh RETURN VALUES
-The function returns true if the value of 
+The function returns true if the value of
 .Fa entry
 was successfully enqueued into
 .Fa ring .

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/0da17e96/lib/ck/doc/ck_ring_enqueue_spmc_size
----------------------------------------------------------------------
diff --git a/lib/ck/doc/ck_ring_enqueue_spmc_size b/lib/ck/doc/ck_ring_enqueue_spmc_size
index 900bd28..eb30cab 100644
--- a/lib/ck/doc/ck_ring_enqueue_spmc_size
+++ b/lib/ck/doc/ck_ring_enqueue_spmc_size
@@ -42,7 +42,7 @@ function enqueues the pointer
 .Fa entry
 into the bounded buffer pointed to by
 .Fa ring
-in FIFO fashion. 
+in FIFO fashion.
 The buffer pointed to by
 .Fa buffer
 must be unique to
@@ -96,11 +96,11 @@ enqueue(void)
 		do_something;
 	}
 
-	return; 
+	return;
 }
 .Ed
 .Sh RETURN VALUES
-The function returns true if the value of 
+The function returns true if the value of
 .Fa entry
 was successfully enqueued into
 .Fa ring .

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/0da17e96/lib/ck/doc/ck_ring_enqueue_spsc
----------------------------------------------------------------------
diff --git a/lib/ck/doc/ck_ring_enqueue_spsc b/lib/ck/doc/ck_ring_enqueue_spsc
index e5fbbec..2493059 100644
--- a/lib/ck/doc/ck_ring_enqueue_spsc
+++ b/lib/ck/doc/ck_ring_enqueue_spsc
@@ -42,7 +42,7 @@ function enqueues the pointer
 .Fa entry
 into the bounded buffer pointed to by
 .Fa ring
-in FIFO fashion. 
+in FIFO fashion.
 The buffer pointed to by
 .Fa buffer
 must be unique to
@@ -86,11 +86,11 @@ enqueue(void)
 	}
 
 	/* Enqueue operation completed successfully. */
-	return; 
+	return;
 }
 .Ed
 .Sh RETURN VALUES
-The function returns true if the value of 
+The function returns true if the value of
 .Fa entry
 was successfully enqueued into
 .Fa ring .

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/0da17e96/lib/ck/doc/ck_ring_enqueue_spsc_size
----------------------------------------------------------------------
diff --git a/lib/ck/doc/ck_ring_enqueue_spsc_size b/lib/ck/doc/ck_ring_enqueue_spsc_size
index 90bdf12..7048ea1 100644
--- a/lib/ck/doc/ck_ring_enqueue_spsc_size
+++ b/lib/ck/doc/ck_ring_enqueue_spsc_size
@@ -42,7 +42,7 @@ function enqueues the pointer
 .Fa entry
 into the bounded buffer pointed to by
 .Fa ring
-in FIFO fashion. 
+in FIFO fashion.
 The buffer pointed to by
 .Fa buffer
 must be unique to
@@ -94,11 +94,11 @@ enqueue(void)
 		do_something;
 	}
 
-	return; 
+	return;
 }
 .Ed
 .Sh RETURN VALUES
-The function returns true if the value of 
+The function returns true if the value of
 .Fa entry
 was successfully enqueued into
 .Fa ring .

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/0da17e96/lib/ck/doc/ck_ring_trydequeue_spmc
----------------------------------------------------------------------
diff --git a/lib/ck/doc/ck_ring_trydequeue_spmc b/lib/ck/doc/ck_ring_trydequeue_spmc
index 52a92b6..16f83ee 100644
--- a/lib/ck/doc/ck_ring_trydequeue_spmc
+++ b/lib/ck/doc/ck_ring_trydequeue_spmc
@@ -71,7 +71,7 @@ in a bounded number of steps. It is
 possible for the function to return false even
 if
 .Fa ring
-is non-empty. This 
+is non-empty. This
 .Sh EXAMPLE
 .Bd -literal -offset indent
 #include <ck_ring.h>
@@ -97,7 +97,7 @@ dequeue(void)
 	}
 
 	/* An empty ring was encountered, leave. */
-	return; 
+	return;
 }
 .Ed
 .Sh RETURN VALUES

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/0da17e96/lib/ck/doc/ck_rwcohort
----------------------------------------------------------------------
diff --git a/lib/ck/doc/ck_rwcohort b/lib/ck/doc/ck_rwcohort
index 673261d..ba2b5f9 100644
--- a/lib/ck/doc/ck_rwcohort
+++ b/lib/ck/doc/ck_rwcohort
@@ -69,7 +69,7 @@ either the
 .Xr CK_COHORT_PROTOTYPE 3
 or the
 .Xr CK_COHORT_TRYLOCK_PROTOTYPE 3
-macros, and define a reader-writer lock type using the 
+macros, and define a reader-writer lock type using the
 .Xr CK_RWCOHORT_PROTOTYPE 3
 macro.
 .Pp
@@ -161,7 +161,7 @@ main(void)
 	    calloc(n_cohorts, sizeof(CK_COHORT_INSTANCE(test_cohort)));
 
 	/* create local locks to use with each cohort */
-	ck_spinlock_t *local_locks = 
+	ck_spinlock_t *local_locks =
 		calloc(n_cohorts, sizeof(ck_spinlock_t));
 
 	pthread_t *threads =

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/0da17e96/lib/ck/doc/ck_sequence
----------------------------------------------------------------------
diff --git a/lib/ck/doc/ck_sequence b/lib/ck/doc/ck_sequence
index ad06dbe..faa1631 100644
--- a/lib/ck/doc/ck_sequence
+++ b/lib/ck/doc/ck_sequence
@@ -43,9 +43,9 @@ Concurrency Kit (libck, \-lck)
 .Ft void
 .Fn ck_sequence_init "ck_sequence_t *sq"
 .Ft unsigned int
-.Fn ck_sequence_read_begin "ck_sequence_t *sq"
+.Fn ck_sequence_read_begin "const ck_sequence_t *sq"
 .Ft bool
-.Fn ck_sequence_read_retry "ck_sequence_t *sq" "unsigned int version"
+.Fn ck_sequence_read_retry "const ck_sequence_t *sq" "unsigned int version"
 .Ft void
 .Fn ck_sequence_write_begin "ck_sequence_t *sq"
 .Ft void

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/0da17e96/lib/ck/doc/ck_spinlock
----------------------------------------------------------------------
diff --git a/lib/ck/doc/ck_spinlock b/lib/ck/doc/ck_spinlock
index 67d4555..564d185 100644
--- a/lib/ck/doc/ck_spinlock
+++ b/lib/ck/doc/ck_spinlock
@@ -200,7 +200,7 @@ provides a summary of the current implementations.
     ck_spinlock_ticket   Ticket                        Centralized     None                      Yes
 .Ed
 .Pp
-* Hierarchical CLH only offers weak fairness for threads accross cluster 
+* Hierarchical CLH only offers weak fairness for threads accross cluster
 nodes.
 .Pp
 If contention is low and there is no hard requirement for starvation-freedom

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/0da17e96/lib/ck/include/ck_array.h
----------------------------------------------------------------------
diff --git a/lib/ck/include/ck_array.h b/lib/ck/include/ck_array.h
index e8e366b..dcde6bc 100644
--- a/lib/ck/include/ck_array.h
+++ b/lib/ck/include/ck_array.h
@@ -98,4 +98,3 @@ ck_array_initialized(struct ck_array *array)
 	    _ck_i++)
 
 #endif /* _CK_ARRAY_H */
-

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/0da17e96/lib/ck/include/ck_backoff.h
----------------------------------------------------------------------
diff --git a/lib/ck/include/ck_backoff.h b/lib/ck/include/ck_backoff.h
index f43c564..cf3045c 100644
--- a/lib/ck/include/ck_backoff.h
+++ b/lib/ck/include/ck_backoff.h
@@ -28,6 +28,7 @@
 #define _CK_BACKOFF_H
 
 #include <ck_cc.h>
+#include <ck_pr.h>
 
 #ifndef CK_BACKOFF_CEILING
 #define CK_BACKOFF_CEILING ((1 << 20) - 1)
@@ -35,24 +36,22 @@
 
 #define CK_BACKOFF_INITIALIZER (1 << 9)
 
-typedef volatile unsigned int ck_backoff_t;
+typedef unsigned int ck_backoff_t;
 
 /*
  * This is a exponential back-off implementation.
  */
 CK_CC_INLINE static void
-ck_backoff_eb(volatile unsigned int *c)
+ck_backoff_eb(unsigned int *c)
 {
-	volatile unsigned int i;
-	unsigned int ceiling;
+	unsigned int i, ceiling;
 
 	ceiling = *c;
-
-	for (i = 0; i < ceiling; i++);
+	for (i = 0; i < ceiling; i++)
+		ck_pr_barrier();
 
 	*c = ceiling <<= ceiling < CK_BACKOFF_CEILING;
 	return;
 }
 
 #endif /* _CK_BACKOFF_H */
-

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/0da17e96/lib/ck/include/ck_barrier.h
----------------------------------------------------------------------
diff --git a/lib/ck/include/ck_barrier.h b/lib/ck/include/ck_barrier.h
index 52d3973..2f7acdd 100644
--- a/lib/ck/include/ck_barrier.h
+++ b/lib/ck/include/ck_barrier.h
@@ -162,4 +162,3 @@ void ck_barrier_mcs_subscribe(ck_barrier_mcs_t *, ck_barrier_mcs_state_t *);
 void ck_barrier_mcs(ck_barrier_mcs_t *, ck_barrier_mcs_state_t *);
 
 #endif /* _CK_BARRIER_H */
-

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/0da17e96/lib/ck/include/ck_bitmap.h
----------------------------------------------------------------------
diff --git a/lib/ck/include/ck_bitmap.h b/lib/ck/include/ck_bitmap.h
index 3c0105e..96a8fe9 100644
--- a/lib/ck/include/ck_bitmap.h
+++ b/lib/ck/include/ck_bitmap.h
@@ -44,6 +44,7 @@
 #endif
 
 #define CK_BITMAP_BLOCK 	(sizeof(unsigned int) * CHAR_BIT)
+#define CK_BITMAP_OFFSET(i)	((i) % CK_BITMAP_BLOCK)
 #define CK_BITMAP_BIT(i)	(1U << ((i) % CK_BITMAP_BLOCK))
 #define CK_BITMAP_PTR(x, i)	((x) + ((i) / CK_BITMAP_BLOCK))
 #define CK_BITMAP_BLOCKS(n)	(((n) + CK_BITMAP_BLOCK - 1) / CK_BITMAP_BLOCK)
@@ -69,6 +70,9 @@
 #define CK_BITMAP_SET(a, b) \
 	ck_bitmap_set(&(a)->bitmap, (b))
 
+#define CK_BITMAP_BTS(a, b) \
+	ck_bitmap_bts(&(a)->bitmap, (b))
+
 #define CK_BITMAP_RESET(a, b) \
 	ck_bitmap_reset(&(a)->bitmap, (b))
 
@@ -172,6 +176,20 @@ ck_bitmap_set(struct ck_bitmap *bitmap, unsigned int n)
 }
 
 /*
+ * Performs a test-and-set operation at the offset specified in the
+ * second argument.
+ * Returns true if the bit at the specified offset was already set,
+ * false otherwise.
+ */
+CK_CC_INLINE static bool
+ck_bitmap_bts(struct ck_bitmap *bitmap, unsigned int n)
+{
+
+	return ck_pr_bts_uint(CK_BITMAP_PTR(bitmap->map, n),
+	    CK_BITMAP_OFFSET(n));
+}
+
+/*
  * Resets the bit at the offset specified in the second argument.
  */
 CK_CC_INLINE static void
@@ -251,7 +269,8 @@ ck_bitmap_intersection(struct ck_bitmap *dst, const struct ck_bitmap *src)
  * complete bitmap.  Any trailing bit in dst is left as is.
  */
 CK_CC_INLINE static void
-ck_bitmap_intersection_negate(struct ck_bitmap *dst, const struct ck_bitmap *src)
+ck_bitmap_intersection_negate(struct ck_bitmap *dst,
+    const struct ck_bitmap *src)
 {
 	unsigned int n;
 	unsigned int n_intersect = dst->n_bits;
@@ -275,8 +294,9 @@ ck_bitmap_intersection_negate(struct ck_bitmap *dst, const struct ck_bitmap *src
 CK_CC_INLINE static void
 ck_bitmap_clear(struct ck_bitmap *bitmap)
 {
-	unsigned int n_buckets = ck_bitmap_base(bitmap->n_bits) / sizeof(unsigned int);
 	unsigned int i;
+	unsigned int n_buckets = ck_bitmap_base(bitmap->n_bits) /
+	    sizeof(unsigned int);
 
 	for (i = 0; i < n_buckets; i++)
 		ck_pr_store_uint(&bitmap->map[i], 0);
@@ -379,7 +399,8 @@ ck_bitmap_count(const ck_bitmap_t *bitmap, unsigned int limit)
  * size, it is truncated to the smallest.
  */
 CK_CC_INLINE static unsigned int
-ck_bitmap_count_intersect(const ck_bitmap_t *x, const ck_bitmap_t *y, unsigned int limit)
+ck_bitmap_count_intersect(const ck_bitmap_t *x, const ck_bitmap_t *y,
+    unsigned int limit)
 {
 	unsigned int count, i, slop, words;
 
@@ -441,7 +462,8 @@ ck_bitmap_init(struct ck_bitmap *bitmap,
  * Initialize iterator for use with provided bitmap.
  */
 CK_CC_INLINE static void
-ck_bitmap_iterator_init(struct ck_bitmap_iterator *i, const struct ck_bitmap *bitmap)
+ck_bitmap_iterator_init(struct ck_bitmap_iterator *i,
+    const struct ck_bitmap *bitmap)
 {
 
 	i->n_block = 0;

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/0da17e96/lib/ck/include/ck_brlock.h
----------------------------------------------------------------------
diff --git a/lib/ck/include/ck_brlock.h b/lib/ck/include/ck_brlock.h
index d59f0e9..b45e1b8 100644
--- a/lib/ck/include/ck_brlock.h
+++ b/lib/ck/include/ck_brlock.h
@@ -277,4 +277,3 @@ ck_brlock_read_unlock(struct ck_brlock_reader *reader)
 }
 
 #endif /* _CK_BRLOCK_H */
-

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/0da17e96/lib/ck/include/ck_bytelock.h
----------------------------------------------------------------------
diff --git a/lib/ck/include/ck_bytelock.h b/lib/ck/include/ck_bytelock.h
index cd855cf..6755762 100644
--- a/lib/ck/include/ck_bytelock.h
+++ b/lib/ck/include/ck_bytelock.h
@@ -184,4 +184,3 @@ ck_bytelock_read_unlock(struct ck_bytelock *bytelock, unsigned int slot)
 }
 
 #endif /* _CK_BYTELOCK_H */
-

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/0da17e96/lib/ck/include/ck_cohort.h
----------------------------------------------------------------------
diff --git a/lib/ck/include/ck_cohort.h b/lib/ck/include/ck_cohort.h
index 5bc8baa..4bfcfe2 100644
--- a/lib/ck/include/ck_cohort.h
+++ b/lib/ck/include/ck_cohort.h
@@ -159,4 +159,3 @@ enum ck_cohort_state {
 }
 
 #endif /* _CK_COHORT_H */
-

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/0da17e96/lib/ck/include/ck_elide.h
----------------------------------------------------------------------
diff --git a/lib/ck/include/ck_elide.h b/lib/ck/include/ck_elide.h
index 8ffff40..59d17c5 100644
--- a/lib/ck/include/ck_elide.h
+++ b/lib/ck/include/ck_elide.h
@@ -303,7 +303,7 @@ _ck_elide_fallback(int *retry,
  * semantics. In environments where jitter is low, this may yield a tighter
  * fast path.
  */
-#define CK_ELIDE_LOCK(NAME, LOCK)	ck_elide_##NAME##_lock(LOCK)	
+#define CK_ELIDE_LOCK(NAME, LOCK)	ck_elide_##NAME##_lock(LOCK)
 #define CK_ELIDE_UNLOCK(NAME, LOCK)	ck_elide_##NAME##_unlock(LOCK)
 #define CK_ELIDE_TRYLOCK(NAME, LOCK)	ck_elide_##NAME##_trylock(LOCK)
 
@@ -319,4 +319,3 @@ _ck_elide_fallback(int *retry,
 	ck_elide_##NAME##_unlock_adaptive(STAT, LOCK)
 
 #endif /* _CK_ELIDE_H */
-

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/0da17e96/lib/ck/include/ck_epoch.h
----------------------------------------------------------------------
diff --git a/lib/ck/include/ck_epoch.h b/lib/ck/include/ck_epoch.h
index 2e71599..ecfd173 100644
--- a/lib/ck/include/ck_epoch.h
+++ b/lib/ck/include/ck_epoch.h
@@ -160,4 +160,3 @@ void ck_epoch_barrier(ck_epoch_t *, ck_epoch_record_t *);
 void ck_epoch_reclaim(ck_epoch_record_t *);
 
 #endif /* _CK_EPOCH_H */
-

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/0da17e96/lib/ck/include/ck_fifo.h
----------------------------------------------------------------------
diff --git a/lib/ck/include/ck_fifo.h b/lib/ck/include/ck_fifo.h
index a65bcfc..a09a80d 100644
--- a/lib/ck/include/ck_fifo.h
+++ b/lib/ck/include/ck_fifo.h
@@ -472,4 +472,3 @@ ck_fifo_mpmc_trydequeue(struct ck_fifo_mpmc *fifo,
 #endif /* CK_F_PR_CAS_PTR_2 */
 
 #endif /* _CK_FIFO_H */
-

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/0da17e96/lib/ck/include/ck_hp.h
----------------------------------------------------------------------
diff --git a/lib/ck/include/ck_hp.h b/lib/ck/include/ck_hp.h
index 505de5b..7f503de 100644
--- a/lib/ck/include/ck_hp.h
+++ b/lib/ck/include/ck_hp.h
@@ -104,4 +104,3 @@ void ck_hp_retire(ck_hp_record_t *, ck_hp_hazard_t *, void *, void *);
 void ck_hp_purge(ck_hp_record_t *);
 
 #endif /* _CK_HP_H */
-

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/0da17e96/lib/ck/include/ck_hp_fifo.h
----------------------------------------------------------------------
diff --git a/lib/ck/include/ck_hp_fifo.h b/lib/ck/include/ck_hp_fifo.h
index 59bf0e4..96ffa5e 100644
--- a/lib/ck/include/ck_hp_fifo.h
+++ b/lib/ck/include/ck_hp_fifo.h
@@ -219,4 +219,3 @@ ck_hp_fifo_trydequeue_mpmc(ck_hp_record_t *record,
              (entry) = (T))
 
 #endif /* _CK_HP_FIFO_H */
-

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/0da17e96/lib/ck/include/ck_hp_stack.h
----------------------------------------------------------------------
diff --git a/lib/ck/include/ck_hp_stack.h b/lib/ck/include/ck_hp_stack.h
index 3b67fc4..3a14faa 100644
--- a/lib/ck/include/ck_hp_stack.h
+++ b/lib/ck/include/ck_hp_stack.h
@@ -111,4 +111,3 @@ leave:
 }
 
 #endif /* _CK_HP_STACK_H */
-

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/0da17e96/lib/ck/include/ck_hs.h
----------------------------------------------------------------------
diff --git a/lib/ck/include/ck_hs.h b/lib/ck/include/ck_hs.h
index 91f990b..e37918c 100644
--- a/lib/ck/include/ck_hs.h
+++ b/lib/ck/include/ck_hs.h
@@ -48,7 +48,7 @@
  */
 #define CK_HS_MODE_DIRECT	2
 
-/* 
+/*
  * Indicates that the values to be stored are pointers.
  * Allows for space optimizations in the presence of pointer
  * packing. Mutually exclusive with CK_HS_MODE_DIRECT.
@@ -108,6 +108,8 @@ typedef struct ck_hs_iterator ck_hs_iterator_t;
 /* Convenience wrapper to table hash function. */
 #define CK_HS_HASH(T, F, K) F((K), (T)->seed)
 
+typedef void *ck_hs_apply_fn_t(void *, void *);
+bool ck_hs_apply(ck_hs_t *, unsigned long, const void *, ck_hs_apply_fn_t *, void *);
 void ck_hs_iterator_init(ck_hs_iterator_t *);
 bool ck_hs_next(ck_hs_t *, ck_hs_iterator_t *, void **);
 bool ck_hs_move(ck_hs_t *, ck_hs_t *, ck_hs_hash_cb_t *,
@@ -130,4 +132,3 @@ bool ck_hs_reset_size(ck_hs_t *, unsigned long);
 void ck_hs_stat(ck_hs_t *, struct ck_hs_stat *);
 
 #endif /* _CK_HS_H */
-

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/0da17e96/lib/ck/include/ck_ht.h
----------------------------------------------------------------------
diff --git a/lib/ck/include/ck_ht.h b/lib/ck/include/ck_ht.h
index 86fb7f0..cb8e67d 100644
--- a/lib/ck/include/ck_ht.h
+++ b/lib/ck/include/ck_ht.h
@@ -259,4 +259,3 @@ uint64_t ck_ht_count(ck_ht_t *);
 
 #endif /* CK_F_PR_LOAD_64 && CK_F_PR_STORE_64 */
 #endif /* _CK_HT_H */
-

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/0da17e96/lib/ck/include/ck_limits.h
----------------------------------------------------------------------
diff --git a/lib/ck/include/ck_limits.h b/lib/ck/include/ck_limits.h
index c597763..b08e4a7 100644
--- a/lib/ck/include/ck_limits.h
+++ b/lib/ck/include/ck_limits.h
@@ -29,4 +29,3 @@
 #else
 #include <limits.h>
 #endif /* __linux__ && __KERNEL__ */
-

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/0da17e96/lib/ck/include/ck_malloc.h
----------------------------------------------------------------------
diff --git a/lib/ck/include/ck_malloc.h b/lib/ck/include/ck_malloc.h
index 40f1898..a623e1a 100644
--- a/lib/ck/include/ck_malloc.h
+++ b/lib/ck/include/ck_malloc.h
@@ -37,4 +37,3 @@ struct ck_malloc {
 };
 
 #endif /* _CK_MALLOC_H */
-

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/0da17e96/lib/ck/include/ck_pflock.h
----------------------------------------------------------------------
diff --git a/lib/ck/include/ck_pflock.h b/lib/ck/include/ck_pflock.h
index 58963e8..52c232a 100644
--- a/lib/ck/include/ck_pflock.h
+++ b/lib/ck/include/ck_pflock.h
@@ -140,4 +140,3 @@ leave:
 }
 
 #endif /* _CK_PFLOCK_H */
-

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/0da17e96/lib/ck/include/ck_pr.h
----------------------------------------------------------------------
diff --git a/lib/ck/include/ck_pr.h b/lib/ck/include/ck_pr.h
index eb198f5..af4159e 100644
--- a/lib/ck/include/ck_pr.h
+++ b/lib/ck/include/ck_pr.h
@@ -1149,4 +1149,3 @@ CK_PR_FAS_S(8, uint8_t)
 #undef CK_PR_FAS
 
 #endif /* _CK_PR_H */
-

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/0da17e96/lib/ck/include/ck_queue.h
----------------------------------------------------------------------
diff --git a/lib/ck/include/ck_queue.h b/lib/ck/include/ck_queue.h
index 3d8824f..f617b97 100644
--- a/lib/ck/include/ck_queue.h
+++ b/lib/ck/include/ck_queue.h
@@ -415,4 +415,3 @@ struct {									\
 } while (0)
 
 #endif /* _CK_QUEUE_H */
-

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/0da17e96/lib/ck/include/ck_rhs.h
----------------------------------------------------------------------
diff --git a/lib/ck/include/ck_rhs.h b/lib/ck/include/ck_rhs.h
index 7a28f7d..4754da6 100644
--- a/lib/ck/include/ck_rhs.h
+++ b/lib/ck/include/ck_rhs.h
@@ -48,7 +48,7 @@
  */
 #define CK_RHS_MODE_DIRECT	2
 
-/* 
+/*
  * Indicates that the values to be stored are pointers.
  * Allows for space optimizations in the presence of pointer
  * packing. Mutually exclusive with CK_RHS_MODE_DIRECT.
@@ -106,6 +106,8 @@ typedef struct ck_rhs_iterator ck_rhs_iterator_t;
 /* Convenience wrapper to table hash function. */
 #define CK_RHS_HASH(T, F, K) F((K), (T)->seed)
 
+typedef void *ck_rhs_apply_fn_t(void *, void *);
+bool ck_rhs_apply(ck_rhs_t *, unsigned long, const void *, ck_rhs_apply_fn_t *, void *);
 void ck_rhs_iterator_init(ck_rhs_iterator_t *);
 bool ck_rhs_next(ck_rhs_t *, ck_rhs_iterator_t *, void **);
 bool ck_rhs_move(ck_rhs_t *, ck_rhs_t *, ck_rhs_hash_cb_t *,

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/0da17e96/lib/ck/include/ck_ring.h
----------------------------------------------------------------------
diff --git a/lib/ck/include/ck_ring.h b/lib/ck/include/ck_ring.h
index 88bb837..c70915c 100644
--- a/lib/ck/include/ck_ring.h
+++ b/lib/ck/include/ck_ring.h
@@ -307,7 +307,7 @@ _ck_ring_dequeue_spmc(struct ck_ring *ring,
 			return false;
 
 		ck_pr_fence_load();
-		
+
 		target = (char *)buffer + size * (consumer & mask);
 		memcpy(data, target, size);
 
@@ -432,4 +432,3 @@ ck_ring_dequeue_spmc_##name(struct ck_ring *a,		\
 	ck_ring_dequeue_spmc_##name(a, b, c)
 
 #endif /* _CK_RING_H */
-

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/0da17e96/lib/ck/include/ck_rwcohort.h
----------------------------------------------------------------------
diff --git a/lib/ck/include/ck_rwcohort.h b/lib/ck/include/ck_rwcohort.h
index e8e014e..c9b5d2a 100644
--- a/lib/ck/include/ck_rwcohort.h
+++ b/lib/ck/include/ck_rwcohort.h
@@ -315,4 +315,3 @@
 }
 
 #endif /* _CK_RWCOHORT_H */
-

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/0da17e96/lib/ck/include/ck_rwlock.h
----------------------------------------------------------------------
diff --git a/lib/ck/include/ck_rwlock.h b/lib/ck/include/ck_rwlock.h
index 63cb549..89a006a 100644
--- a/lib/ck/include/ck_rwlock.h
+++ b/lib/ck/include/ck_rwlock.h
@@ -295,4 +295,3 @@ ck_rwlock_recursive_read_unlock(ck_rwlock_recursive_t *rw)
 }
 
 #endif /* _CK_RWLOCK_H */
-

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/0da17e96/lib/ck/include/ck_sequence.h
----------------------------------------------------------------------
diff --git a/lib/ck/include/ck_sequence.h b/lib/ck/include/ck_sequence.h
index 14138ff..c5ca193 100644
--- a/lib/ck/include/ck_sequence.h
+++ b/lib/ck/include/ck_sequence.h
@@ -47,7 +47,7 @@ ck_sequence_init(struct ck_sequence *sq)
 }
 
 CK_CC_INLINE static unsigned int
-ck_sequence_read_begin(struct ck_sequence *sq)
+ck_sequence_read_begin(const struct ck_sequence *sq)
 {
 	unsigned int version;
 
@@ -74,7 +74,7 @@ ck_sequence_read_begin(struct ck_sequence *sq)
 }
 
 CK_CC_INLINE static bool
-ck_sequence_read_retry(struct ck_sequence *sq, unsigned int version)
+ck_sequence_read_retry(const struct ck_sequence *sq, unsigned int version)
 {
 
 	/*
@@ -123,4 +123,3 @@ ck_sequence_write_end(struct ck_sequence *sq)
 }
 
 #endif /* _CK_SEQUENCE_H */
-

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/0da17e96/lib/ck/include/ck_spinlock.h
----------------------------------------------------------------------
diff --git a/lib/ck/include/ck_spinlock.h b/lib/ck/include/ck_spinlock.h
index 03f9900..3e07b77 100644
--- a/lib/ck/include/ck_spinlock.h
+++ b/lib/ck/include/ck_spinlock.h
@@ -59,4 +59,3 @@ CK_ELIDE_TRYLOCK_PROTOTYPE(ck_spinlock, ck_spinlock_t,
     ck_spinlock_locked, ck_spinlock_trylock)
 
 #endif /* _CK_SPINLOCK_H */
-

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/0da17e96/lib/ck/include/ck_stack.h
----------------------------------------------------------------------
diff --git a/lib/ck/include/ck_stack.h b/lib/ck/include/ck_stack.h
index ac89a95..21d3f0f 100644
--- a/lib/ck/include/ck_stack.h
+++ b/lib/ck/include/ck_stack.h
@@ -352,4 +352,3 @@ ck_stack_init(struct ck_stack *stack)
 	     (entry) = (T))
 
 #endif /* _CK_STACK_H */
-

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/0da17e96/lib/ck/include/ck_stdint.h
----------------------------------------------------------------------
diff --git a/lib/ck/include/ck_stdint.h b/lib/ck/include/ck_stdint.h
index 1dfd373..e62cafa 100644
--- a/lib/ck/include/ck_stdint.h
+++ b/lib/ck/include/ck_stdint.h
@@ -30,4 +30,3 @@
 #else
 #include <stdint.h>
 #endif /* __linux__ && __KERNEL__ */
-

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/0da17e96/lib/ck/include/ck_swlock.h
----------------------------------------------------------------------
diff --git a/lib/ck/include/ck_swlock.h b/lib/ck/include/ck_swlock.h
index 134df6c..d880aaf 100644
--- a/lib/ck/include/ck_swlock.h
+++ b/lib/ck/include/ck_swlock.h
@@ -215,4 +215,3 @@ CK_ELIDE_PROTOTYPE(ck_swlock_read, ck_swlock_t,
     ck_swlock_locked_reader, ck_swlock_read_unlock)
 
 #endif /* _CK_SWLOCK_H */
-

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/0da17e96/lib/ck/include/ck_tflock.h
----------------------------------------------------------------------
diff --git a/lib/ck/include/ck_tflock.h b/lib/ck/include/ck_tflock.h
index 391fb73..3bb43d5 100644
--- a/lib/ck/include/ck_tflock.h
+++ b/lib/ck/include/ck_tflock.h
@@ -32,7 +32,7 @@
  * described in:
  *	John M. Mellor-Crummey and Michael L. Scott. 1991.
  *	Scalable reader-writer synchronization for shared-memory
- *	multiprocessors. SIGPLAN Not. 26, 7 (April 1991), 106-113. 
+ *	multiprocessors. SIGPLAN Not. 26, 7 (April 1991), 106-113.
  */
 
 #include <ck_cc.h>
@@ -65,7 +65,7 @@ ck_tflock_ticket_fca_32(uint32_t *target, uint32_t mask, uint32_t delta)
 
 		ck_pr_stall();
 	}
-	
+
 	return snapshot;
 }
 

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/0da17e96/lib/ck/include/gcc/arm/ck_pr.h
----------------------------------------------------------------------
diff --git a/lib/ck/include/gcc/arm/ck_pr.h b/lib/ck/include/gcc/arm/ck_pr.h
index 0c2400c..d2a34e1 100644
--- a/lib/ck/include/gcc/arm/ck_pr.h
+++ b/lib/ck/include/gcc/arm/ck_pr.h
@@ -135,7 +135,7 @@ ck_pr_load_64(const uint64_t *target)
 	register uint64_t ret asm("r0");
 
 	__asm __volatile("ldrd %0, [%1]" : "+r" (ret)
-	    				 : "r" (target) 
+	    				 : "r" (target)
 					 : "memory", "cc");
 	return (ret);
 }
@@ -170,33 +170,32 @@ CK_PR_STORE_S(char, char, "strb")
 CK_CC_INLINE static void
 ck_pr_store_64(const uint64_t *target, uint64_t value)
 {
-	register uint64_t tmp asm("r0") = value;
 
 	__asm __volatile("strd %0, [%1]"
 				:
-				: "r" (tmp), "r" (target)
+				: "r" (value), "r" (target)
 				: "memory", "cc");
 }
 
 CK_CC_INLINE static bool
 ck_pr_cas_64_value(uint64_t *target, uint64_t compare, uint64_t set, uint64_t *value)
 {
-	register uint64_t __compare asm("r0") = compare;
-	register uint64_t __set asm("r2") = set;
+        uint64_t previous;
+        int tmp;
 
 	__asm__ __volatile__("1:"
-			     "ldrexd r4, [%3];"
-			     "cmp    r4, r0;"
+			     "ldrexd %0, [%4];"
+			     "cmp    %Q0, %Q2;"
 			     "ittt eq;"
-			     "cmpeq  r5, r1;"
-			     "strexdeq r6, r2, [%3];"
-			     "cmpeq  r6, #1;"
+			     "cmpeq  %R0, %R2;"
+			     "strexdeq %1, %3, [%4];"
+			     "cmpeq  %1, #1;"
 			     "beq 1b;"
-			     "strd r4, [%0];"
-				: "+r" (value)
-				: "r" (__compare), "r" (__set) ,
+				:"=&r" (previous), "=&r" (tmp)
+				: "r" (compare), "r" (set) ,
 				  "r"(target)
 				: "memory", "cc", "r4", "r5", "r6");
+        *value = previous;
 	return (*value == compare);
 }
 
@@ -215,22 +214,21 @@ ck_pr_cas_ptr_2_value(void *target, void *compare, void *set, void *value)
 CK_CC_INLINE static bool
 ck_pr_cas_64(uint64_t *target, uint64_t compare, uint64_t set)
 {
-	register uint64_t __compare asm("r0") = compare;
-	register uint64_t __set asm("r2") = set;
 	int ret;
+        uint64_t tmp;
 
 	__asm__ __volatile__("1:"
 			     "mov %0, #0;"
-			     "ldrexd r4, [%3];"
-			     "cmp    r4, r0;"
+			     "ldrexd %1, [%4];"
+			     "cmp    %Q1, %Q2;"
 			     "itttt eq;"
-			     "cmpeq  r5, r1;"
-			     "strexdeq r6, r2, [%3];"
+			     "cmpeq  %R1, %R2;"
+			     "strexdeq %1, %3, [%4];"
 			     "moveq %0, #1;"
-			     "cmpeq  r6, #1;"
+			     "cmpeq  %1, #1;"
 			     "beq 1b;"
-			     : "=&r" (ret)
-			     : "r" (__compare), "r" (__set) ,
+			     : "=&r" (ret), "=&r" (tmp)
+			     : "r" (compare), "r" (set) ,
 			       "r"(target)
 			     : "memory", "cc", "r4", "r5", "r6");
 
@@ -262,7 +260,7 @@ ck_pr_cas_ptr_value(void *target, void *compare, void *set, void *value)
 				  "=&r" (tmp)
 		  		: "r"   (target),
 				  "r"   (set),
-				  "r"   (compare)	
+				  "r"   (compare)
 				: "memory", "cc");
 	*(void **)value = previous;
 	return (previous == compare);
@@ -283,7 +281,7 @@ ck_pr_cas_ptr(void *target, void *compare, void *set)
 				  "=&r" (tmp)
 		  		: "r"   (target),
 				  "r"   (set),
-				  "r"   (compare)	
+				  "r"   (compare)
 				: "memory", "cc");
 	return (previous == compare);
 }

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/0da17e96/lib/ck/include/spinlock/hclh.h
----------------------------------------------------------------------
diff --git a/lib/ck/include/spinlock/hclh.h b/lib/ck/include/spinlock/hclh.h
index edaeaca..0eac6b9 100644
--- a/lib/ck/include/spinlock/hclh.h
+++ b/lib/ck/include/spinlock/hclh.h
@@ -98,7 +98,7 @@ ck_spinlock_hclh_lock(struct ck_spinlock_hclh **glob_queue,
 		/* We're head of the global queue, we're done */
 		if (ck_pr_load_uint(&previous->splice) == false)
 			return;
-	} 
+	}
 
 	/* Now we need to splice the local queue into the global queue. */
 	local_tail = ck_pr_load_ptr(local_queue);

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/0da17e96/lib/ck/regressions/ck_bitmap/validate/serial.c
----------------------------------------------------------------------
diff --git a/lib/ck/regressions/ck_bitmap/validate/serial.c b/lib/ck/regressions/ck_bitmap/validate/serial.c
index 79aca8d..ecc5258 100644
--- a/lib/ck/regressions/ck_bitmap/validate/serial.c
+++ b/lib/ck/regressions/ck_bitmap/validate/serial.c
@@ -73,6 +73,7 @@ check_iteration(ck_bitmap_t *bits, unsigned int len, bool initial)
 static void
 test(ck_bitmap_t *bits, unsigned int n_length, bool initial)
 {
+	bool r;
 	unsigned int i;
 	CK_BITMAP_INSTANCE(8) u;
 
@@ -92,14 +93,35 @@ test(ck_bitmap_t *bits, unsigned int n_length, bool initial)
 		if (ck_bitmap_test(bits, i) == false) {
 			ck_error("[1] ERROR: Expected bit to be set: %u\n", i);
 		}
+
 		ck_bitmap_reset(bits, i);
 		if (ck_bitmap_test(bits, i) == true) {
 			ck_error("[2] ERROR: Expected bit to be cleared: %u\n", i);
 		}
 
+		r = ck_bitmap_bts(bits, i);
+		if (r == true) {
+			ck_error("[3] ERROR: Expected bit to be cleared before 1st bts: %u\n", i);
+		}
+		if (ck_bitmap_test(bits, i) == false) {
+			ck_error("[4] ERROR: Expected bit to be set: %u\n", i);
+		}
+		r = ck_bitmap_bts(bits, i);
+		if (r == false) {
+			ck_error("[5] ERROR: Expected bit to be set before 2nd bts: %u\n", i);
+		}
+		if (ck_bitmap_test(bits, i) == false) {
+			ck_error("[6] ERROR: Expected bit to be set: %u\n", i);
+		}
+
+		ck_bitmap_reset(bits, i);
+		if (ck_bitmap_test(bits, i) == true) {
+			ck_error("[7] ERROR: Expected bit to be cleared: %u\n", i);
+		}
+
 		ck_bitmap_set(bits, i);
 		if (ck_bitmap_test(bits, i) == false) {
-			ck_error("[3] ERROR: Expected bit to be set: %u\n", i);
+			ck_error("[8] ERROR: Expected bit to be set: %u\n", i);
 		}
 
 		check_iteration(bits, i, initial);
@@ -107,7 +129,7 @@ test(ck_bitmap_t *bits, unsigned int n_length, bool initial)
 
 	for (i = 0; i < n_length; i++) {
 		if (ck_bitmap_test(bits, i) == false) {
-			ck_error("[4] ERROR: Expected bit to be set: %u\n", i);
+			ck_error("[9] ERROR: Expected bit to be set: %u\n", i);
 		}
 	}
 
@@ -115,7 +137,7 @@ test(ck_bitmap_t *bits, unsigned int n_length, bool initial)
 
 	for (i = 0; i < n_length; i++) {
 		if (ck_bitmap_test(bits, i) == true) {
-			ck_error("[4] ERROR: Expected bit to be reset: %u\n", i);
+			ck_error("[10] ERROR: Expected bit to be reset: %u\n", i);
 		}
 	}
 

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/0da17e96/lib/ck/regressions/ck_epoch/validate/Makefile
----------------------------------------------------------------------
diff --git a/lib/ck/regressions/ck_epoch/validate/Makefile b/lib/ck/regressions/ck_epoch/validate/Makefile
index 73f8e5d..c053d22 100644
--- a/lib/ck/regressions/ck_epoch/validate/Makefile
+++ b/lib/ck/regressions/ck_epoch/validate/Makefile
@@ -1,6 +1,6 @@
 .PHONY: check clean distribution
 
-OBJECTS=ck_stack ck_epoch_synchronize ck_epoch_poll
+OBJECTS=ck_stack ck_epoch_synchronize ck_epoch_poll ck_epoch_call
 HALF=`expr $(CORES) / 2`
 
 all: $(OBJECTS)
@@ -16,6 +16,9 @@ ck_epoch_synchronize: ck_epoch_synchronize.c ../../../include/ck_stack.h ../../.
 ck_epoch_poll: ck_epoch_poll.c ../../../include/ck_stack.h ../../../include/ck_epoch.h ../../../src/ck_epoch.c
 	$(CC) $(CFLAGS) -o ck_epoch_poll ck_epoch_poll.c ../../../src/ck_epoch.c
 
+ck_epoch_call: ck_epoch_call.c ../../../include/ck_stack.h ../../../include/ck_epoch.h ../../../src/ck_epoch.c
+	$(CC) $(CFLAGS) -o ck_epoch_call ck_epoch_call.c ../../../src/ck_epoch.c
+
 ck_stack: ck_stack.c ../../../include/ck_stack.h ../../../include/ck_epoch.h ../../../src/ck_epoch.c
 	$(CC) $(CFLAGS) -o ck_stack ck_stack.c ../../../src/ck_epoch.c
 

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/0da17e96/lib/ck/regressions/ck_epoch/validate/ck_epoch_call.c
----------------------------------------------------------------------
diff --git a/lib/ck/regressions/ck_epoch/validate/ck_epoch_call.c b/lib/ck/regressions/ck_epoch/validate/ck_epoch_call.c
new file mode 100644
index 0000000..dc501fd
--- /dev/null
+++ b/lib/ck/regressions/ck_epoch/validate/ck_epoch_call.c
@@ -0,0 +1,64 @@
+/*
+ * Copyright 2014 Samy Al Bahra.
+ * 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.
+ */
+
+#include <stdio.h>
+#include <ck_epoch.h>
+
+#include "../../common.h"
+
+static ck_epoch_t epoch;
+static unsigned int counter;
+static ck_epoch_record_t record[2];
+
+static void
+cb(ck_epoch_entry_t *p)
+{
+
+	if (counter == 0)
+		ck_epoch_call(&epoch, &record[1], p, cb);
+
+	printf("Counter value: %u -> %u\n",
+	    counter, counter + 1);
+	counter++;
+	return;
+}
+
+int
+main(void)
+{
+	ck_epoch_entry_t entry;
+
+	ck_epoch_register(&epoch, &record[0]);
+	ck_epoch_register(&epoch, &record[1]);
+
+	ck_epoch_call(&epoch, &record[1], &entry, cb);
+	ck_epoch_barrier(&epoch, &record[1]);
+	ck_epoch_barrier(&epoch, &record[1]);
+	if (counter != 2)
+		ck_error("Expected counter value 2, read %u.\n", counter);
+
+	return 0;
+}

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/0da17e96/lib/ck/regressions/ck_hp/validate/ck_hp_fifo_donner.c
----------------------------------------------------------------------
diff --git a/lib/ck/regressions/ck_hp/validate/ck_hp_fifo_donner.c b/lib/ck/regressions/ck_hp/validate/ck_hp_fifo_donner.c
index 43e00ae..a2f31c9 100644
--- a/lib/ck/regressions/ck_hp/validate/ck_hp_fifo_donner.c
+++ b/lib/ck/regressions/ck_hp/validate/ck_hp_fifo_donner.c
@@ -43,7 +43,7 @@ static ck_hp_fifo_t fifo;
 static ck_hp_t fifo_hp;
 
 /* thread local element count */
-static unsigned long *count; 
+static unsigned long *count;
 
 static unsigned long thread_count;
 
@@ -77,10 +77,10 @@ queue_50_50(void *elements)
 
 	record = malloc(sizeof(ck_hp_record_t));
 	assert(record);
-	
+
 	slots = malloc(CK_HP_FIFO_SLOTS_SIZE);
 	assert(slots);
-	
+
         /* different seed for each thread */
 	seed = 1337; /*(unsigned int) pthread_self(); */
 
@@ -166,7 +166,7 @@ main(int argc, char** argv)
 
 	/* array for local operation count */
 	count = malloc(sizeof(unsigned long *) * thread_count);
-	
+
         /*
          * Initialize global hazard pointer safe memory reclamation to execute free()
          * when a fifo_entry is safe to be deleted.

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/0da17e96/lib/ck/regressions/ck_hs/benchmark/Makefile
----------------------------------------------------------------------
diff --git a/lib/ck/regressions/ck_hs/benchmark/Makefile b/lib/ck/regressions/ck_hs/benchmark/Makefile
index ca20809..23b6745 100644
--- a/lib/ck/regressions/ck_hs/benchmark/Makefile
+++ b/lib/ck/regressions/ck_hs/benchmark/Makefile
@@ -1,12 +1,15 @@
 .PHONY: clean distribution
 
-OBJECTS=serial parallel_bytestring parallel_bytestring.delete
+OBJECTS=serial parallel_bytestring parallel_bytestring.delete apply
 
 all: $(OBJECTS)
 
 serial: serial.c ../../../include/ck_hs.h ../../../src/ck_hs.c
 	$(CC) $(CFLAGS) -o serial serial.c ../../../src/ck_hs.c
 
+apply: apply.c ../../../include/ck_hs.h ../../../src/ck_hs.c
+	$(CC) $(CFLAGS) -o apply apply.c ../../../src/ck_hs.c
+
 parallel_bytestring: parallel_bytestring.c ../../../include/ck_hs.h ../../../src/ck_hs.c ../../../src/ck_epoch.c
 	$(CC) $(PTHREAD_CFLAGS) $(CFLAGS) -o parallel_bytestring parallel_bytestring.c ../../../src/ck_hs.c ../../../src/ck_epoch.c