diff options
author | Stefano Brivio <sbrivio@redhat.com> | 2024-02-02 00:22:16 +0100 |
---|---|---|
committer | Stefano Brivio <sbrivio@redhat.com> | 2024-02-14 01:10:11 +0100 |
commit | 7ee4e172679029e54f44f096d2e0ec85905c79de (patch) | |
tree | d33e57ae2000ea1cee68b1db8a4c21055bfdd043 /pasta.h | |
parent | 78901eeae3b37c0e15f34512e5ea0c1b7acc4642 (diff) | |
download | passt-7ee4e172679029e54f44f096d2e0ec85905c79de.tar passt-7ee4e172679029e54f44f096d2e0ec85905c79de.tar.gz passt-7ee4e172679029e54f44f096d2e0ec85905c79de.tar.bz2 passt-7ee4e172679029e54f44f096d2e0ec85905c79de.tar.lz passt-7ee4e172679029e54f44f096d2e0ec85905c79de.tar.xz passt-7ee4e172679029e54f44f096d2e0ec85905c79de.tar.zst passt-7ee4e172679029e54f44f096d2e0ec85905c79de.zip |
log: setlogmask(0) can actually result in a system call, don't use it
Before commit 32d07f5e59f2 ("passt, pasta: Completely avoid dynamic
memory allocation"), we didn't store the current log mask in a
variable, and we fetched it using setlogmask(0) wherever needed.
But after that commit, we can use our log_mask copy instead. And we
should: with recent glibc versions, setlogmask(0) actually results in
a system call, which causes a substantial overhead with high transfer
rates: we use setlogmask(0) even to decide we don't want to print
debug messages.
Now that we rely on log_mask in early stages, before setlogmask() is
called, we need to initialise that variable to the special LOG_EMERG
mask value right away: define LOG_EARLY to make this clearer, and,
while at it, group conditions in vlogmsg() into something more terse.
Signed-off-by: Stefano Brivio <sbrivio@redhat.com>
Reviewed-by: David Gibson <david@gibson.dropbear.id.au>
Diffstat (limited to 'pasta.h')
0 files changed, 0 insertions, 0 deletions