-
Notifications
You must be signed in to change notification settings - Fork 49
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
libczmqcontainers: Add internal czmq lib
Problem: A bug in the czmq zhashx library would incorrectly resize the hash. See: zeromq/czmq#2173 This would lead to significant performance issues as the hash would take up far more memory than it should and iteration of the hash would take an excess amount of time. A solution to this problem was fixed in: zeromq/czmq#2174 however the fix will not exist in most OS distributions for some time. Solution: We have copied in the zhashx implementation into a new convenience library libczmqcontainers. Code was copied from the master branch at commit d4b1a1d884532e43e82b9055ceb0b84d1db5915c. The library is copied in verbatim with only minor changes to headers and header guards. To avoid excess copying in from czmq, add a file czmq_internal.h that copies in macros, headers, and typdefs needed by the localized zhashx. To avoid symbol collisions, add a file zhashx_map.h that will convert all internal uses of "zhashx" to "fzhashx". Add a generic czmq_containers.h, that callers can include to use the internal zhashx over the shared library version. All files containing copied in code maintain their czmq license (Mozilla Public License Version 2.0). All modifications to czmq files and code were isolated to those files, no code from other parts of flux-core were copied in. See: https://www.mozilla.org/en-US/MPL/2.0/combining-mpl-and-gpl/
- Loading branch information
Showing
9 changed files
with
2,172 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
AM_CFLAGS = \ | ||
$(WARNING_CFLAGS) \ | ||
$(CODE_COVERAGE_CFLAGS) | ||
|
||
AM_LDFLAGS = \ | ||
$(CODE_COVERAGE_LDFLAGS) | ||
|
||
AM_CPPFLAGS = \ | ||
-I$(top_srcdir) \ | ||
-I$(top_srcdir)/src/include \ | ||
$(ZMQ_CFLAGS) | ||
|
||
noinst_LTLIBRARIES = \ | ||
libczmqcontainers.la | ||
|
||
libczmqcontainers_la_SOURCES = \ | ||
czmq_containers.h \ | ||
czmq_internal.h \ | ||
zhashx.h \ | ||
zhashx.c \ | ||
zhash_primes.inc \ | ||
zhashx_map.h |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
/************************************************************\ | ||
* Copyright 2021 Lawrence Livermore National Security, LLC | ||
* (c.f. AUTHORS, NOTICE.LLNS, COPYING) | ||
* | ||
* This file is part of the Flux resource manager framework. | ||
* For details, see https://github.com/flux-framework. | ||
* | ||
* SPDX-License-Identifier: LGPL-3.0 | ||
\************************************************************/ | ||
|
||
#ifndef _CZMQ_CONTAINERS_H | ||
#define _CZMQ_CONTAINERS_H | ||
|
||
#ifdef __cplusplus | ||
extern "C" { | ||
#endif | ||
|
||
#include "zhashx.h" | ||
|
||
#ifdef __cplusplus | ||
} | ||
#endif | ||
|
||
#endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
/* ========================================================================= | ||
Copyright (c) the Contributors as noted in the AUTHORS file. | ||
This file is part of CZMQ, the high-level C binding for 0MQ: | ||
http://czmq.zeromq.org. | ||
This Source Code Form is subject to the terms of the Mozilla Public | ||
License, v. 2.0. If a copy of the MPL was not distributed with this | ||
file, You can obtain one at http://mozilla.org/MPL/2.0/. | ||
========================================================================= | ||
*/ | ||
|
||
/* To avoid copying in an excess amount of code from czmq, the | ||
* following have been manually cut and pasted in | ||
*/ | ||
|
||
#ifndef __CZMQ_INTERNAL__ | ||
#define __CZMQ_INTERNAL__ | ||
|
||
#if HAVE_CONFIG_H | ||
# include "config.h" | ||
#endif | ||
|
||
#include <stdlib.h> | ||
|
||
#ifdef NDEBUG | ||
#undef NDEBUG | ||
#include <assert.h> | ||
#define NDEBUG | ||
#else | ||
#include <assert.h> | ||
#endif | ||
|
||
#define freen(x) do {free(x); x = NULL;} while(0) | ||
|
||
#ifndef CZMQ_EXPORT | ||
#define CZMQ_EXPORT | ||
#endif | ||
|
||
typedef struct _zhashx_t fzhashx_t; | ||
|
||
#endif | ||
|
Oops, something went wrong.