diff options
author | Robert Foley | 2019-11-18 22:15:26 +0100 |
---|---|---|
committer | Alex Bennée | 2019-12-18 21:18:02 +0100 |
commit | fc59d2d870caddf5cd9c85836ee4a8c59ffe7617 (patch) | |
tree | bb6cf999b19d14bac59b5d789e7e0969c4dea091 /include/qemu/log.h | |
parent | Add a mutex to guarantee single writer to qemu_logfile handle. (diff) | |
download | qemu-fc59d2d870caddf5cd9c85836ee4a8c59ffe7617.tar.gz qemu-fc59d2d870caddf5cd9c85836ee4a8c59ffe7617.tar.xz qemu-fc59d2d870caddf5cd9c85836ee4a8c59ffe7617.zip |
qemu_log_lock/unlock now preserves the qemu_logfile handle.
qemu_log_lock() now returns a handle and qemu_log_unlock() receives a
handle to unlock. This allows for changing the handle during logging
and ensures the lock() and unlock() are for the same file.
Also in target/tilegx/translate.c removed the qemu_log_lock()/unlock()
calls (and the log("\n")), since the translator can longjmp out of the
loop if it attempts to translate an instruction in an inaccessible page.
Signed-off-by: Robert Foley <robert.foley@linaro.org>
Reviewed-by: Alex Bennée <alex.bennee@linaro.org>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
Message-Id: <20191118211528.3221-5-robert.foley@linaro.org>
Diffstat (limited to 'include/qemu/log.h')
-rw-r--r-- | include/qemu/log.h | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/include/qemu/log.h b/include/qemu/log.h index a91105b2ad..a7c5b01571 100644 --- a/include/qemu/log.h +++ b/include/qemu/log.h @@ -53,14 +53,17 @@ static inline bool qemu_log_separate(void) * qemu_loglevel is never set when qemu_logfile is unset. */ -static inline void qemu_log_lock(void) +static inline FILE *qemu_log_lock(void) { qemu_flockfile(qemu_logfile); + return logfile->fd; } -static inline void qemu_log_unlock(void) +static inline void qemu_log_unlock(FILE *fd) { - qemu_funlockfile(qemu_logfile); + if (fd) { + qemu_funlockfile(fd); + } } /* Logging functions: */ |