fdatasync is for storage devices, not ttys.
* admin/merge-gnulib (GNULIB_MODULES): Remove fdatasync.
* lib/fdatasync.c, m4/fdatasync.m4: Remove.
* lib-src/Makefile.in (LIB_FDATASYNC):
* src/Makefile.in (LIB_FDATASYNC):
Remove. All uses removed.
* lib-src/emacsclient.c [!DOS_NT]:
Include <termios.h>, for tcdrain.
* lib-src/emacsclient.c (flush_stdout):
* src/sysdep.c (reset_sys_modes): On ttys, use tcdrain instead
of fdatasync (except don’t use either function if DOS_NT).
* lib/gnulib.mk.in, m4/gnulib-comp.m4: Regenerate.
crypto/md5-buffer crypto/sha1-buffer crypto/sha256-buffer crypto/sha512-buffer
d-type diffseq dosname dtoastr dtotimespec dup2
environ execinfo explicit_bzero faccessat
- fcntl fcntl-h fdatasync fdopendir
+ fcntl fcntl-h fdopendir
filemode filevercmp flexmember fpieee fstatat fsusage fsync
getloadavg getopt-gnu gettime gettimeofday gitlog-to-changelog
ieee754-h ignore-value intprops largefile lstat
LIBS_MAIL=@LIBS_MAIL@
## empty or -lrt or -lposix4 if HAVE_CLOCK_GETTIME
LIB_CLOCK_GETTIME = @LIB_CLOCK_GETTIME@
-## empty or -lrt or -lposix4 if HAVE_FDATASYNC
-LIB_FDATASYNC = @LIB_FDATASYNC@
## empty or -lwsock2 for MinGW
LIB_WSOCK32=@LIB_WSOCK32@
emacsclient${EXEEXT}: ${srcdir}/emacsclient.c $(NTLIB) $(config_h)
$(AM_V_CCLD)$(CC) ${ALL_CFLAGS} $< \
- -DVERSION="\"${version}\"" $(NTLIB) $(LOADLIBES) $(LIB_FDATASYNC) \
+ -DVERSION="\"${version}\"" $(NTLIB) $(LOADLIBES) \
$(LIB_WSOCK32) $(LIBS_ECLIENT) -o $@
emacsclientw${EXEEXT}: ${srcdir}/emacsclient.c $(NTLIB) $(CLIENTRES) $(config_h)
$(AM_V_CCLD)$(CC) ${ALL_CFLAGS} $(CLIENTRES) -mwindows $< \
- -DVERSION="\"${version}\"" $(LOADLIBES) $(LIB_FDATASYNC) \
+ -DVERSION="\"${version}\"" $(LOADLIBES) \
$(LIB_WSOCK32) $(LIBS_ECLIENT) -o $@
NTINC = ${srcdir}/../nt/inc
#endif /* !WINDOWSNT */
+#ifndef DOS_NT
+# include <termios.h>
+#endif
+
#include <ctype.h>
#include <errno.h>
#include <getopt.h>
flush_stdout (HSOCKET emacs_socket)
{
fflush (stdout);
- while (fdatasync (STDOUT_FILENO) != 0 && errno == EINTR)
+#ifndef DOS_NT
+ while (tcdrain (STDOUT_FILENO) != 0 && errno == EINTR)
act_on_signals (emacs_socket);
+#endif
}
int
+++ /dev/null
-/* Emulate fdatasync on platforms that lack it.
-
- Copyright (C) 2011-2018 Free Software Foundation, Inc.
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU General Public
- License as published by the Free Software Foundation; either
- version 3 of the License, or (at your option) any later version.
-
- This library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program. If not, see <https://www.gnu.org/licenses/>. */
-
-#include <config.h>
-#include <unistd.h>
-
-int
-fdatasync (int fd)
-{
- /* This does more work than strictly necessary, but is the best we
- can do portably. */
- return fsync (fd);
-}
# faccessat \
# fcntl \
# fcntl-h \
-# fdatasync \
# fdopendir \
# filemode \
# filevercmp \
LIB_CLOCK_GETTIME = @LIB_CLOCK_GETTIME@
LIB_EACCESS = @LIB_EACCESS@
LIB_EXECINFO = @LIB_EXECINFO@
-LIB_FDATASYNC = @LIB_FDATASYNC@
LIB_MATH = @LIB_MATH@
LIB_PTHREAD = @LIB_PTHREAD@
LIB_PTHREAD_SIGMASK = @LIB_PTHREAD_SIGMASK@
endif
## end gnulib module fcntl-h
-## begin gnulib module fdatasync
-ifeq (,$(OMIT_GNULIB_MODULE_fdatasync))
-
-
-EXTRA_DIST += fdatasync.c
-
-EXTRA_libgnu_a_SOURCES += fdatasync.c
-
-endif
-## end gnulib module fdatasync
-
## begin gnulib module fdopendir
ifeq (,$(OMIT_GNULIB_MODULE_fdopendir))
+++ /dev/null
-# fdatasync.m4 serial 4
-dnl Copyright (C) 2008-2018 Free Software Foundation, Inc.
-dnl This file is free software; the Free Software Foundation
-dnl gives unlimited permission to copy and/or distribute it,
-dnl with or without modifications, as long as this notice is preserved.
-
-AC_DEFUN([gl_FUNC_FDATASYNC],
-[
- AC_REQUIRE([gl_UNISTD_H_DEFAULTS])
-
- dnl Using AC_CHECK_FUNCS_ONCE would break our subsequent AC_SEARCH_LIBS
- AC_CHECK_DECLS_ONCE([fdatasync])
- LIB_FDATASYNC=
- AC_SUBST([LIB_FDATASYNC])
-
- if test $ac_cv_have_decl_fdatasync = no; then
- HAVE_DECL_FDATASYNC=0
- dnl Mac OS X 10.7 has fdatasync but does not declare it.
- AC_CHECK_FUNCS([fdatasync])
- if test $ac_cv_func_fdatasync = no; then
- HAVE_FDATASYNC=0
- fi
- else
- dnl Solaris <= 2.6 has fdatasync() in libposix4.
- dnl Solaris 7..10 has it in librt.
- gl_saved_libs=$LIBS
- AC_SEARCH_LIBS([fdatasync], [rt posix4],
- [test "$ac_cv_search_fdatasync" = "none required" ||
- LIB_FDATASYNC=$ac_cv_search_fdatasync])
- LIBS=$gl_saved_libs
- fi
-])
# Code from module faccessat:
# Code from module fcntl:
# Code from module fcntl-h:
- # Code from module fdatasync:
# Code from module fdopendir:
# Code from module filemode:
# Code from module filevercmp:
fi
gl_FCNTL_MODULE_INDICATOR([fcntl])
gl_FCNTL_H
- gl_FUNC_FDATASYNC
- if test $HAVE_FDATASYNC = 0; then
- AC_LIBOBJ([fdatasync])
- fi
- gl_UNISTD_MODULE_INDICATOR([fdatasync])
gl_FUNC_FDOPENDIR
if test $HAVE_FDOPENDIR = 0 || test $REPLACE_FDOPENDIR = 1; then
AC_LIBOBJ([fdopendir])
lib/faccessat.c
lib/fcntl.c
lib/fcntl.in.h
- lib/fdatasync.c
lib/fdopendir.c
lib/filemode.c
lib/filemode.h
m4/fcntl-o.m4
m4/fcntl.m4
m4/fcntl_h.m4
- m4/fdatasync.m4
m4/fdopendir.m4
m4/filemode.m4
m4/flexmember.m4
LIB_ACL=@LIB_ACL@
LIB_CLOCK_GETTIME=@LIB_CLOCK_GETTIME@
LIB_EACCESS=@LIB_EACCESS@
-LIB_FDATASYNC=@LIB_FDATASYNC@
LIB_TIMER_TIME=@LIB_TIMER_TIME@
DBUS_CFLAGS = @DBUS_CFLAGS@
$(LIBX_OTHER) $(LIBSOUND) \
$(RSVG_LIBS) $(IMAGEMAGICK_LIBS) $(LIB_ACL) $(LIB_CLOCK_GETTIME) \
$(WEBKIT_LIBS) \
- $(LIB_EACCESS) $(LIB_FDATASYNC) $(LIB_TIMER_TIME) $(DBUS_LIBS) \
+ $(LIB_EACCESS) $(LIB_TIMER_TIME) $(DBUS_LIBS) \
$(LIB_EXECINFO) $(XRANDR_LIBS) $(XINERAMA_LIBS) $(XFIXES_LIBS) \
$(XDBE_LIBS) \
$(LIBXML2_LIBS) $(LIBGPM) $(LIBS_SYSTEM) $(CAIRO_LIBS) \
if (tty_out->terminal->reset_terminal_modes_hook)
tty_out->terminal->reset_terminal_modes_hook (tty_out->terminal);
+#ifndef DOS_NT
/* Avoid possible loss of output when changing terminal modes. */
- while (fdatasync (fileno (tty_out->output)) != 0 && errno == EINTR)
+ while (tcdrain (fileno (tty_out->output)) != 0 && errno == EINTR)
continue;
-#ifndef DOS_NT
-#ifdef F_SETOWN
+# ifdef F_SETOWN
if (interrupt_input)
{
reset_sigio (fileno (tty_out->input));
fcntl (fileno (tty_out->input), F_SETOWN,
old_fcntl_owner[fileno (tty_out->input)]);
}
-#endif /* F_SETOWN */
+# endif /* F_SETOWN */
fcntl (fileno (tty_out->input), F_SETFL,
fcntl (fileno (tty_out->input), F_GETFL, 0) & ~O_NONBLOCK);
#endif