[PATCH 0/4] Use static buffers to log from driver signal handlers
Daniel Kurtz
djkurtz at chromium.org
Tue Jul 26 21:03:32 PDT 2011
Back in the bad old days, using xf86Msg() from a signal handler was a
big no-no, as it would deadlock the system on malloc when the prefix is
prepended. Thus, only X_NONE messages could be used to bypass this.
However, LogVWrite limits to 1024 bytes anyway, so a patch was made to
eliminate malloc in LogVMessageVerb().
However, input driver messages these days go through xf86VIDrvMsgVerb(),
which does its own asprintf()/mallocs() to prefix the driver and device
names, reintroducing the same old no-no.
This patchset fixes this by introducing LogVHdrMessageVerb() and friends,
which allow a caller to specify a custom header as a variable string,
between the verb and the actually message.
In addition, by passing the header to the log layer, the verbosity checks
happen before any string processing, potentially speeding up processing
for production systems.
Daniel Kurtz (4):
os/log: Pull LogMessageTypeVerbString out of LogVMessageVerb
os/log: Add LogVHdrMessageVerb and friends
xf86Helper: use LogHdrMessageVerb in xf86VIDrvMsgVerb
xf86Helper: use LogHdrMessageVerb in xf86VDrvMsgVerb
hw/xfree86/common/xf86Helper.c | 50 +++++-------
include/os.h | 13 +++
os/log.c | 166 ++++++++++++++++++++++++++++------------
3 files changed, 150 insertions(+), 79 deletions(-)
--
1.7.3.1
More information about the xorg-devel
mailing list