aboutsummaryrefslogtreecommitdiff
path: root/src/xz/private.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/xz/private.h')
-rw-r--r--src/xz/private.h26
1 files changed, 20 insertions, 6 deletions
diff --git a/src/xz/private.h b/src/xz/private.h
index 6414bdb5081c..b370472e32c8 100644
--- a/src/xz/private.h
+++ b/src/xz/private.h
@@ -1,3 +1,5 @@
+// SPDX-License-Identifier: 0BSD
+
///////////////////////////////////////////////////////////////////////////////
//
/// \file private.h
@@ -5,9 +7,6 @@
//
// Author: Lasse Collin
//
-// This file has been put into the public domain.
-// You can do whatever you want with this file.
-//
///////////////////////////////////////////////////////////////////////////////
#include "sysdefs.h"
@@ -21,7 +20,10 @@
#include <signal.h>
#include <locale.h>
#include <stdio.h>
-#include <unistd.h>
+
+#ifndef _MSC_VER
+# include <unistd.h>
+#endif
#include "tuklib_gettext.h"
#include "tuklib_progname.h"
@@ -33,6 +35,10 @@
# include <windows.h>
#endif
+#ifdef _MSC_VER
+# define fileno _fileno
+#endif
+
#ifndef STDIN_FILENO
# define STDIN_FILENO (fileno(stdin))
#endif
@@ -45,8 +51,15 @@
# define STDERR_FILENO (fileno(stderr))
#endif
-#if defined(HAVE_CAPSICUM) || defined(HAVE_PLEDGE)
-# define ENABLE_SANDBOX 1
+// Handling SIGTSTP keeps time-keeping for progress indicator correct
+// if xz is stopped. It requires use of clock_gettime() as that is
+// async-signal safe in POSIX. Require also SIGALRM support since
+// on systems where SIGALRM isn't available, progress indicator code
+// polls the time and the SIGTSTP handling adds slight overhead to
+// that code. Most (all?) systems that have SIGTSTP also have SIGALRM
+// so this requirement won't exclude many systems.
+#if defined(HAVE_CLOCK_GETTIME) && defined(SIGTSTP) && defined(SIGALRM)
+# define USE_SIGTSTP_HANDLER 1
#endif
#include "main.h"
@@ -57,6 +70,7 @@
#include "hardware.h"
#include "file_io.h"
#include "options.h"
+#include "sandbox.h"
#include "signals.h"
#include "suffix.h"
#include "util.h"