]> sourceware.org Git - systemtap.git/commit
staprun: fix warning/error/dbug eprintf() races causing garbled output
authorSultan Alsawaf <sultan@openresty.com>
Mon, 4 Oct 2021 19:09:32 +0000 (12:09 -0700)
committerSultan Alsawaf <sultan@openresty.com>
Mon, 4 Oct 2021 19:09:32 +0000 (12:09 -0700)
commit3df93d4af3b67800cdbdfe9ff71b6bb366401d92
tree492447f206b7a8a6d19965abed64e9ab2dfc4520
parent18d6395f5f0df87cbb5603e0ab2ac3aa1795f0f1
staprun: fix warning/error/dbug eprintf() races causing garbled output

There are lots of races when printing warnings/errors/dbugs in staprun
because multiple eprintf() calls are used to print a single message and
stderr is not line-buffered. As a result, warnings/errors/dbugs race with
the relayfs reader threads printing to stdout and with other stap scripts
running concurrently in the same PTY. This causes the messages printed to
stderr and stdout to be garbled.

Fix all of this by using a single eprintf() for each warning/error/dbug
message, and by making stderr line-buffered so that we don't need to worry
about differing libc implementations potentially flushing a single message
in chunks rather than flushing the whole message in one go.
staprun/common.c
staprun/stapio.c
staprun/staprun.c
staprun/staprun.h
This page took 0.025788 seconds and 5 git commands to generate.