If there are no more tokens, instead of returning a null string as
remainder, set the remainder to the end of the original string with a
zero length.
Update two places in the code where this makes a difference.
Change-Id: I137fbce3e7d88ccba65f6b23a36aa1dfbbd3867e
Fixes:
/bin/ld: dynamic STT_GNU_IFUNC symbol `s16_mix_in.lto_priv.234' with pointer equality in `/tmp/ccDfEly2.ltrans2.ltrans.o' can not be used when making an executable; recompile with -fPIE and relink with -pie
closes#1846
Change-Id: Ic31f2e064e88bc931f3438eff7b362ad611b7d84
Use str_cmp() to implement str_eq()
Use str_shift_cmp() in place of str_prefix()
Update return types to bool
Change-Id: If7927d957e20780408e77da1d04baffa082a6914
This should give slightly better performance due to not having to look
for the terminator byte twice. Not benchmarked. No-op.
Change-Id: I458a06b492393fcf5b186a61b69acabdf63a216e
Obsolete str_init(), rename STR_INIT() to just STR(), and replace all
instances of str_init() with STR().
no-op
Change-Id: I981529063ad2ea26089add467f7a84b638dbf423
These helper functions were largely unused or inconsistently used.
Create a new type and streamline usage.
Change-Id: I5cd9756a26994d027dd4ff6a2d01a8c6c3cffe30
This is a placeholder to keep the const-qualified type of the contained
type within the struct, so that it can be used via __typeof__ if
necessary.
Change-Id: Ib40c55daa2225b7f9a9a926a6fa74f9b1471b6de
For typed hash tables, enforce the correct type in the arguments to the
hashing and equality functions.
Adapt existing affected callback functions and change their arguments
from void* to the respective types.
Add reverse casts to GHashFunc and GEqualFunc in instances where these
functions are used in non-typed hash tables (that should be converted at
a later point).
Add convenience macro to create typed wrapper functions for hash tables
that use "direct" hashing (i.e. the pointer value).
Add wrappers for existing GLib functions that have generic arguments so
that they can be used in typed hash tables.
Change-Id: I43bb32969208f4aae49584d95c0df8353df6e2a0
Revert of 128e84e and implement for io_uring poller
Turns out that this function is necessary to prevent out-of-order writes
to a streambuf once the connection is open.
Use a simple array to keep track of blocked fds under uring.
Change-Id: I4af2a64071030fd4892dde88547705230aec59fd
Don't just check for the existence of liburing during compilation, but
also check for the version, as we require at least version 2.3 and
builds fail with an older version.
Change-Id: If04d532a847c717fd80f326e46376cbbdc663086
Use the kernel/user shared memory to keep track of interface stats. This
eliminates the need to update the userspace stats counters with the
values from the kernel, and vice versa when updating the kernel streams.
Add a function to reverse map userspace mapped memory address to kernel
space addresses.
Change-Id: Iaa5f9488061a12103e57faf27b3979521778cea8
Switch all memory buffers used for RTP I/O from generic stack or heap
allocated memory to the bufferpool implementation. Use a per-thread
bufferpool to minimise lock contention.
This commit is just a one-for-one swap and doesn't use the bufferpool's
reference counting semantics yet.
Change-Id: I9cba4ec97bd0afcd374bf6c0be2b608a46e73e57
To support asynchronous pollers which may hold references on underlying
sockets, let the poller close the socket after it has released its
references. This prevents cases of file descriptor re-use while an
underlying socket is still open.
Add reset_socket() to be used in place of close_socket() which does the
same thing except the actual closing of the socket.
Add poller_del_item_callback() for cases where more action than just
closing the file descriptor is needed.
Change-Id: Iefda1487ecb89263729120ecb964436dd79b2a0e
With hf-only=0 set and cmr=1 also set, we send a blank CMR with each
packet, which forces use of HF format packets. This in turn can lead to
size collisions (e.g. mode 1 = 18 bytes, + CMR + TOC = 20 bytes, which
is the same as mode 2) which can confuse the decoder. Add the required
size collision logic.
Change-Id: Icd540cfb321b4eaf77a0ed7d08be06d8681b6214
This allows usage of refcounted objects using custom allocators or
static storage. Use the magic size of -1 to indicate that the internal
free function should not be called.
Change-Id: I64b7581d15c120d030c13d6cb03e8ada26f46bdf
The poller-per-thread feature was broken with a division by zero. Take
the opportunity to rework it and eliminate the poller_map object. Use a
simple array of pollers for media sockets, plus one global poller for
control sockets. In the regular case only one poller is created and
everything points to that poller. In the poller-per-thread case, one
poller per thread is created, plus one poller (also with its own single
thread) for control connections. All control sockets use the single
control poller, while all media sockets get assigned one poller from the
pool in a round-robin fashion.
closes#1801
Change-Id: Iae91a3e10b7206455c6df33b1a472254c700ce21
As per [1], quote:
It’s very important that you recognize the limited scope in which
automatic variable values are available: they only have values within
the recipe. In particular, you cannot use them anywhere within the
target list of a rule; they have no value there and will expand to the
empty string. Also, they cannot be accessed directly within the
prerequisite list of a rule. A common mistake is attempting to use $@
within the prerequisites list; this will not work.
Based on the patch by S-P Chan <shihping.chan@gmail.com>
[1] https://www.gnu.org/software/make/manual/html_node/Automatic-Variables.htmlcloses#1754
Thanks: S-P Chan <shihping.chan@gmail.com>
Change-Id: Ia5f9d7a75f04d9533afaace8ed49cc222e4307a8
Ref: https://github.com/sipwise/rtpengine/issues/1754
Try open an IPv4 socket if IPv6 fails with EAFNOSUPPORT in order to
support kernels without IPv6 support.
closes#1784
Change-Id: I2cf4065450a8b19b738c572e7d9ad6f8548ecc04
As we don't directly append to an existing GString any more anyway,
simplify the function signature by just returning a new GString if the
format string is known.
Change-Id: I9f8e6fbd93ea063eecb519cd57366effd4022f75
Some source strings are `const char *` and we don't have an alternative
`str` type pointing to a const buffer. Strictly speaking some buffers
aren't even char buffers, yet we use the `str` type to manage them. This
eliminates the need to explicitly cast every usage.
Change-Id: Ifd3cdd3d400fc483e6c488a95e9381938e63cc7f
gcc <12 propagates the const-ness of the given value to the newly
declared variable with __auto_type, leading to silly "can't assign to
const variable" errors. Work around this with an ugly macro.
Change-Id: Ic952c094c24bd802379fc10ad19d559613b2c1d0
Simple wrappers around glib's GHashTable functions that add type
information, instead of just using void* for everything.
Change-Id: I3e7c0f095f1f58b943ba80d1e14e763707ee1698
We rely on dpkg-buildflags to set -O2, but that may not be available on
the target system. Explicitly set -O3, and also enable LTO.
Change-Id: I593ec7ead08cb0a47922ba4db684b0292647f2bc
Fix all instances of argument-less function signatures.
Fix all instances of auto-cleanup variables declared after they need to
be in scope.
Change-Id: I3a005df03ede971e08d4f62d7c7711a1913fda5e
Whilst working on the Reproducible Builds effort [0], we noticed that
rtpengine could not be built reproducibly.
This is because the manpages generated by pandoc contained the current
build date.
An (upstreamable) patch is attached that uses the value from the
SOURCE_DATE_EPOCH environment variable if available.
[0] https://reproducible-builds.org/
Change-Id: I2eb22dc5f57af69d217fb06c1c126e7e40dbd451
*) Remove packaging for -gpu packages
*) Remove build profile restrictions, except for the build dependency
itself
*) Remove script to generate dh fragments for -gpu packages
*) Convert --cudecs switch to a path argument pointing to the .so
*) Don't link against libcudecs during build
*) Only include the single types.h header needed for usage as a plugin
*) Resolve all symbols during startup after loading the .so
Change-Id: Ide99eec2156d5d3be8c40594391cb1603add4b16
Consider errors from dlopen() or dlsym() as hard errors. Don't just log
an error message and continue startup. If we were instructed to load a
plugin, make sure that we could actually load it.
Change-Id: I1fcfa149a0eae277ef528fd3cef249ea7882e781
Evaluating the __VA_ARGS__ twice for printing a critical error can have
side effects. Avoid these by using an intermediate buffer.
Change-Id: I8ddace6ad06f47d6827f3f3ba3c5b882cbfb0140
Older glibc uses a strange (and seemingly broken) approach to verifying
the cmsg structures by inspecting the *next* cmsg header and using its
length to see if there is enough space in the buffer. Since we're
constructing the cmsg list, at this point there is no next cmsg yet,
therefore causing spurious failures of CMSG_NXTHDR.
Work around this by initialising the entire buffer first.
See 9c443ac455closes#1720
Change-Id: I00ce9bc5686ab0c1612aff51f1b3e75d8cbd8a69
Some gcc targets report ifunc as a supported attribute, while at the
same time actually trying to build the object fails with "ifunc not
supported on this target". Be more prejudicial with ifunc usage.
Change-Id: I5820338476938bf581d6d9e38fe0e6fd48f0b874