Skip to content

Commit

Permalink
Build with liburcu, Userspace RCU
Browse files Browse the repository at this point in the history
BIND needs a collection of standard lock-free data structures,
which we can find in liburcu, along with its RCU safe memory
reclamation machinery. We will use liburcu's QSBR variant instead
of the home-grown isc_qsbr.
  • Loading branch information
oerdnj committed Mar 10, 2023
1 parent d96ff69 commit 2532b55
Show file tree
Hide file tree
Showing 5 changed files with 45 additions and 15 deletions.
9 changes: 7 additions & 2 deletions .clang-format
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,10 @@ PointerAlignment: Right
PointerBindsToType: false
IncludeBlocks: Regroup
IncludeCategories:
- Regex: '^<(urcu\.h|urcu/urcu-|urcu-)'
Priority: 2
- Regex: '^<urcu/'
Priority: 3
- Regex: '^<isc/'
Priority: 5
- Regex: '^<(pk11|pkcs11)/'
Expand All @@ -59,9 +63,9 @@ IncludeCategories:
- Regex: '^<tests/'
Priority: 100
- Regex: '<openssl/'
Priority: 1
Priority: 4
- Regex: '<(mysql|protobuf-c)/'
Priority: 1
Priority: 4
- Regex: '.*'
Priority: 0
IndentExternBlock: NoIndent
Expand All @@ -74,3 +78,4 @@ PenaltyBreakString: 80
PenaltyExcessCharacter: 100
Standard: Cpp11
ContinuationIndentWidth: 8
ForEachMacros: [ 'cds_lfs_for_each', 'cds_lfs_for_each_safe', 'cds_list_for_each_entry_safe' ]
42 changes: 29 additions & 13 deletions .clang-format.headers
Original file line number Diff line number Diff line change
Expand Up @@ -34,24 +34,40 @@ PointerAlignment: Right
PointerBindsToType: false
IncludeBlocks: Regroup
IncludeCategories:
- Regex: '^<isc/'
- Regex: '^<(urcu/urcu-|urcu-)'
Priority: 2
- Regex: '^<dns/'
- Regex: '^<urcu/'
Priority: 3
- Regex: '^<iscccc/'
Priority: 4
- Regex: '^<isccfg/'
- Regex: '^<isc/'
Priority: 5
- Regex: '^<(pk11|pkcs11)/'
Priority: 10
- Regex: '^<dns/'
Priority: 15
- Regex: '^<dst/'
Priority: 20
- Regex: '^<isccc/'
Priority: 25
- Regex: '^<isccfg/'
Priority: 30
- Regex: '^<ns/'
Priority: 6
- Regex: '^(<[^/]*)/)'
Priority: 8
Priority: 35
- Regex: '^<irs/'
Priority: 40
- Regex: '^<(dig|named|rndc|confgen|dlz)/'
Priority: 50
- Regex: '^<dlz_'
Priority: 55
- Regex: '^".*"'
Priority: 99
- Regex: '^<tests/'
Priority: 10
- Regex: '<[[:alnum:].]+>'
Priority: 1
- Regex: '".*"'
Priority: 9
Priority: 100
- Regex: '<openssl/'
Priority: 4
- Regex: '<(mysql|protobuf-c)/'
Priority: 4
- Regex: '.*'
Priority: 0
IndentExternBlock: NoIndent
KeepEmptyLinesAtTheStartOfBlocks: false
MaxEmptyLinesToKeep: 1
Expand Down
3 changes: 3 additions & 0 deletions configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -611,6 +611,9 @@ AC_CHECK_DECLS([UV_UDP_LINUX_RECVERR], [], [], [[#include <uv.h>]])

AX_RESTORE_FLAGS([libuv])

# userspace-rcu (QSBR variant)
PKG_CHECK_MODULES([LIBURCU], [liburcu-qsbr liburcu-cds])

# [pairwise: --enable-doh --with-libnghttp2=auto, --enable-doh --with-libnghttp2=yes, --disable-doh]
AC_ARG_ENABLE([doh],
[AS_HELP_STRING([--disable-doh], [disable DNS over HTTPS, removes dependency on libnghttp2 (default is --enable-doh)])],
Expand Down
4 changes: 4 additions & 0 deletions doc/arm/build.inc.rst
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ Required Libraries
To build BIND 9, the following packages must be installed:

- ``libcrypto``, ``libssl``
- ``liburcu``
- ``libuv``
- ``perl``
- ``pkg-config`` / ``pkgconfig`` / ``pkgconf``
Expand All @@ -73,6 +74,9 @@ in a nonstandard location, specify the prefix using
PKCS#11 hardware service module for cryptographic operations,
``engine_pkcs11`` from the OpenSC project must be compiled and used.

The Userspace RCU library ``liburcu`` (https://liburcu.org/) is used
for lock-free data structures and concurrent safe memory reclamation.

On Linux, process capabilities are managed in user space using the
``libcap`` library
(https://git.kernel.org/pub/scm/libs/libcap/libcap.git/), which can be
Expand Down
2 changes: 2 additions & 0 deletions lib/isc/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -212,6 +212,7 @@ endif USE_ISC_RWLOCK
libisc_la_CPPFLAGS = \
$(AM_CPPFLAGS) \
$(LIBISC_CFLAGS) \
$(LIBURCU_CFLAGS) \
$(LIBUV_CFLAGS) \
$(OPENSSL_CFLAGS) \
$(ZLIB_CFLAGS)
Expand All @@ -221,6 +222,7 @@ libisc_la_LDFLAGS = \
-release "$(PACKAGE_VERSION)"

libisc_la_LIBADD = \
$(LIBURCU_LIBS) \
$(LIBUV_LIBS) \
$(OPENSSL_LIBS) \
$(ZLIB_LIBS)
Expand Down

0 comments on commit 2532b55

Please sign in to comment.