|
|
2441b5 |
From 5396b6b77d0248678f716038dc747d6898acb0b3 Mon Sep 17 00:00:00 2001
|
|
|
2441b5 |
From: Stephen Gallagher <sgallagh@redhat.com>
|
|
|
2441b5 |
Date: Fri, 22 Jan 2021 09:49:13 -0500
|
|
|
2441b5 |
Subject: [PATCH] Test for fsync on tty
|
|
|
2441b5 |
|
|
|
2441b5 |
Signed-off-by: Stephen Gallagher <sgallagh@redhat.com>
|
|
|
2441b5 |
---
|
|
|
2441b5 |
configure.ac | 14 +++++++++++++-
|
|
|
2441b5 |
1 file changed, 13 insertions(+), 1 deletion(-)
|
|
|
2441b5 |
|
|
|
2441b5 |
diff --git a/configure.ac b/configure.ac
|
|
|
2441b5 |
index 918807967473e01af6c5d78b1737c2d06f96b426..ce478adc1ea2d37c2b22eb46fc2b55d2ba49244e 100644
|
|
|
2441b5 |
--- a/configure.ac
|
|
|
2441b5 |
+++ b/configure.ac
|
|
|
2441b5 |
@@ -219,10 +219,12 @@ AH_TEMPLATE([HAVE_STAT_INO],
|
|
|
2441b5 |
[Define HAVE_STAT_INO if your struct stat has st_ino and st_dev.])
|
|
|
2441b5 |
AH_TEMPLATE([HAVE_TIME_T],
|
|
|
2441b5 |
[Define HAVE_TIME_T if your system supports the "time_t" type.])
|
|
|
2441b5 |
AH_TEMPLATE([HAVE_STRERROR],
|
|
|
2441b5 |
[Define HAVE_STRERROR if you have the strerror() function.])
|
|
|
2441b5 |
+AH_TEMPLATE([HAVE_FSYNC],
|
|
|
2441b5 |
+ [Define HAVE_FSYNC if fsync() on a tty works.])
|
|
|
2441b5 |
AH_TEMPLATE([HAVE_FILENO],
|
|
|
2441b5 |
[Define HAVE_FILENO if you have the fileno() macro.])
|
|
|
2441b5 |
AH_TEMPLATE([HAVE_ERRNO],
|
|
|
2441b5 |
[Define HAVE_ERRNO if you have the errno variable.])
|
|
|
2441b5 |
AH_TEMPLATE([MUST_DEFINE_ERRNO],
|
|
|
2441b5 |
@@ -272,11 +274,11 @@ AC_MSG_CHECKING(for ANSI function prototypes)
|
|
|
2441b5 |
AC_TRY_COMPILE([], [int f(int a) { return a; }],
|
|
|
2441b5 |
[AC_MSG_RESULT(yes); AC_DEFINE(HAVE_ANSI_PROTOS)], [AC_MSG_RESULT(no)])
|
|
|
2441b5 |
|
|
|
2441b5 |
# Checks for library functions.
|
|
|
2441b5 |
AC_TYPE_SIGNAL
|
|
|
2441b5 |
-AC_CHECK_FUNCS([fchmod fsync nanosleep poll popen realpath _setjmp sigprocmask sigsetmask snprintf stat system usleep])
|
|
|
2441b5 |
+AC_CHECK_FUNCS([fchmod nanosleep poll popen realpath _setjmp sigprocmask sigsetmask snprintf stat system usleep])
|
|
|
2441b5 |
|
|
|
2441b5 |
# AC_CHECK_FUNCS may not work for inline functions, so test these separately.
|
|
|
2441b5 |
AC_MSG_CHECKING(for memcpy)
|
|
|
2441b5 |
AC_TRY_LINK([
|
|
|
2441b5 |
#if HAVE_STRING_H
|
|
|
2441b5 |
@@ -319,10 +321,20 @@ AC_TRY_LINK([
|
|
|
2441b5 |
#if HAVE_ERRNO_H
|
|
|
2441b5 |
#include <errno.h>
|
|
|
2441b5 |
#endif], [static char *x; x = strerror(0);],
|
|
|
2441b5 |
[AC_MSG_RESULT(yes); AC_DEFINE(HAVE_STRERROR)], [AC_MSG_RESULT(no)])
|
|
|
2441b5 |
|
|
|
2441b5 |
+AC_MSG_CHECKING(for fsync)
|
|
|
2441b5 |
+AC_TRY_RUN([
|
|
|
2441b5 |
+#include <fcntl.h>
|
|
|
2441b5 |
+#include <unistd.h>
|
|
|
2441b5 |
+int main(void)
|
|
|
2441b5 |
+{
|
|
|
2441b5 |
+ int fd = open("/dev/tty", O_RDWR);
|
|
|
2441b5 |
+ return fsync(fd);
|
|
|
2441b5 |
+}], [AC_MSG_RESULT(yes); AC_DEFINE(HAVE_FSYNC)], [AC_MSG_RESULT(no)])
|
|
|
2441b5 |
+
|
|
|
2441b5 |
AC_MSG_CHECKING(for sys_errlist)
|
|
|
2441b5 |
AC_TRY_LINK(, [extern char *sys_errlist[]; static char **x; x = sys_errlist;],
|
|
|
2441b5 |
[AC_MSG_RESULT(yes); AC_DEFINE(HAVE_SYS_ERRLIST)], [AC_MSG_RESULT(no)])
|
|
|
2441b5 |
|
|
|
2441b5 |
AC_CHECK_TYPES([sigset_t],,,[#include <signal.h>])
|
|
|
2441b5 |
--
|
|
|
2441b5 |
2.29.2
|
|
|
2441b5 |
|