aboutsummaryrefslogtreecommitdiff
path: root/src/xz/file_io.h
diff options
context:
space:
mode:
authorLasse Collin <lasse.collin@tukaani.org>2013-06-28 23:48:05 +0300
committerLasse Collin <lasse.collin@tukaani.org>2013-06-28 23:48:05 +0300
commit9dc319eabb34a826f4945f91c71620f14a60e9e2 (patch)
tree7f92afc9d6f9031d9dcfded0f8231fd5ee7f16d6 /src/xz/file_io.h
parentxz: Use non-blocking I/O for the input file. (diff)
downloadxz-9dc319eabb34a826f4945f91c71620f14a60e9e2.tar.xz
xz: Use the self-pipe trick to avoid a race condition with signals.
It is possible that a signal to set user_abort arrives right before a blocking system call is made. In this case the call may block until another signal arrives, while the wanted behavior is to make xz clean up and exit as soon as possible. After this commit, the race condition is avoided with the input side which already uses non-blocking I/O. The output side still uses blocking I/O and thus has the race condition.
Diffstat (limited to 'src/xz/file_io.h')
-rw-r--r--src/xz/file_io.h8
1 files changed, 8 insertions, 0 deletions
diff --git a/src/xz/file_io.h b/src/xz/file_io.h
index ef639324..2de33792 100644
--- a/src/xz/file_io.h
+++ b/src/xz/file_io.h
@@ -68,6 +68,14 @@ typedef struct {
extern void io_init(void);
+#ifndef TUKLIB_DOSLIKE
+/// \brief Write a byte to user_abort_pipe[1]
+///
+/// This is called from a signal handler.
+extern void io_write_to_user_abort_pipe(void);
+#endif
+
+
/// \brief Disable creation of sparse files when decompressing
extern void io_no_sparse(void);