diff options
| author | Paul Eggert | 2019-06-06 08:56:03 -0700 |
|---|---|---|
| committer | Paul Eggert | 2019-06-07 00:44:45 -0700 |
| commit | 111408a0e9eb3a9492c4057ac7d6ddbb8b365aa9 (patch) | |
| tree | 9b3928219a0a3f0ff4c8fd123bb5b1a2f23df0e2 /lib | |
| parent | a14eb43215b5cbb99175d2b23f582011948b2eaa (diff) | |
| download | emacs-111408a0e9eb3a9492c4057ac7d6ddbb8b365aa9.tar.gz emacs-111408a0e9eb3a9492c4057ac7d6ddbb8b365aa9.zip | |
Update from Gnulib
This incorporates:
2019-06-04 copy-file-range: new module
2019-05-28 binaty-io: O_BINARY on consoles no longer fails
* doc/misc/texinfo.tex, lib/binary-io.c, lib/binary-io.h:
* lib/unistd.in.h, m4/unistd_h.m4: Copy from Gnulib.
* lib/gnulib.mk.in: Regenerate.
Diffstat (limited to 'lib')
| -rw-r--r-- | lib/binary-io.c | 16 | ||||
| -rw-r--r-- | lib/binary-io.h | 14 | ||||
| -rw-r--r-- | lib/gnulib.mk.in | 4 | ||||
| -rw-r--r-- | lib/unistd.in.h | 18 |
4 files changed, 36 insertions, 16 deletions
diff --git a/lib/binary-io.c b/lib/binary-io.c index 01e0bf64765..77490e68e3b 100644 --- a/lib/binary-io.c +++ b/lib/binary-io.c | |||
| @@ -20,18 +20,20 @@ | |||
| 20 | #include "binary-io.h" | 20 | #include "binary-io.h" |
| 21 | 21 | ||
| 22 | #if defined __DJGPP__ || defined __EMX__ | 22 | #if defined __DJGPP__ || defined __EMX__ |
| 23 | # include <errno.h> | ||
| 24 | # include <unistd.h> | 23 | # include <unistd.h> |
| 25 | 24 | ||
| 26 | int | 25 | int |
| 27 | __gl_setmode_check (int fd) | 26 | set_binary_mode (int fd, int mode) |
| 28 | { | 27 | { |
| 29 | if (isatty (fd)) | 28 | if (isatty (fd)) |
| 30 | { | 29 | /* If FD refers to a console (not a pipe, not a regular file), |
| 31 | errno = EINVAL; | 30 | O_TEXT is the only reasonable mode, both on input and on output. |
| 32 | return -1; | 31 | Silently ignore the request. If we were to return -1 here, |
| 33 | } | 32 | all programs that use xset_binary_mode would fail when run |
| 33 | with console input or console output. */ | ||
| 34 | return O_TEXT; | ||
| 34 | else | 35 | else |
| 35 | return 0; | 36 | return __gl_setmode (fd, mode); |
| 36 | } | 37 | } |
| 38 | |||
| 37 | #endif | 39 | #endif |
diff --git a/lib/binary-io.h b/lib/binary-io.h index 720b08c7551..8d4133b0f38 100644 --- a/lib/binary-io.h +++ b/lib/binary-io.h | |||
| @@ -53,25 +53,21 @@ __gl_setmode (int fd _GL_UNUSED, int mode _GL_UNUSED) | |||
| 53 | } | 53 | } |
| 54 | #endif | 54 | #endif |
| 55 | 55 | ||
| 56 | #if defined __DJGPP__ || defined __EMX__ | ||
| 57 | extern int __gl_setmode_check (int); | ||
| 58 | #else | ||
| 59 | BINARY_IO_INLINE int | ||
| 60 | __gl_setmode_check (int fd _GL_UNUSED) { return 0; } | ||
| 61 | #endif | ||
| 62 | |||
| 63 | /* Set FD's mode to MODE, which should be either O_TEXT or O_BINARY. | 56 | /* Set FD's mode to MODE, which should be either O_TEXT or O_BINARY. |
| 64 | Return the old mode if successful, -1 (setting errno) on failure. | 57 | Return the old mode if successful, -1 (setting errno) on failure. |
| 65 | Ordinarily this function would be called 'setmode', since that is | 58 | Ordinarily this function would be called 'setmode', since that is |
| 66 | its name on MS-Windows, but it is called 'set_binary_mode' here | 59 | its name on MS-Windows, but it is called 'set_binary_mode' here |
| 67 | to avoid colliding with a BSD function of another name. */ | 60 | to avoid colliding with a BSD function of another name. */ |
| 68 | 61 | ||
| 62 | #if defined __DJGPP__ || defined __EMX__ | ||
| 63 | extern int set_binary_mode (int fd, int mode); | ||
| 64 | #else | ||
| 69 | BINARY_IO_INLINE int | 65 | BINARY_IO_INLINE int |
| 70 | set_binary_mode (int fd, int mode) | 66 | set_binary_mode (int fd, int mode) |
| 71 | { | 67 | { |
| 72 | int r = __gl_setmode_check (fd); | 68 | return __gl_setmode (fd, mode); |
| 73 | return r != 0 ? r : __gl_setmode (fd, mode); | ||
| 74 | } | 69 | } |
| 70 | #endif | ||
| 75 | 71 | ||
| 76 | /* This macro is obsolescent. */ | 72 | /* This macro is obsolescent. */ |
| 77 | #define SET_BINARY(fd) ((void) set_binary_mode (fd, O_BINARY)) | 73 | #define SET_BINARY(fd) ((void) set_binary_mode (fd, O_BINARY)) |
diff --git a/lib/gnulib.mk.in b/lib/gnulib.mk.in index 1cbbff212bb..403d83829cd 100644 --- a/lib/gnulib.mk.in +++ b/lib/gnulib.mk.in | |||
| @@ -252,6 +252,7 @@ GNULIB_CHDIR = @GNULIB_CHDIR@ | |||
| 252 | GNULIB_CHOWN = @GNULIB_CHOWN@ | 252 | GNULIB_CHOWN = @GNULIB_CHOWN@ |
| 253 | GNULIB_CLOSE = @GNULIB_CLOSE@ | 253 | GNULIB_CLOSE = @GNULIB_CLOSE@ |
| 254 | GNULIB_CLOSEDIR = @GNULIB_CLOSEDIR@ | 254 | GNULIB_CLOSEDIR = @GNULIB_CLOSEDIR@ |
| 255 | GNULIB_COPY_FILE_RANGE = @GNULIB_COPY_FILE_RANGE@ | ||
| 255 | GNULIB_CTIME = @GNULIB_CTIME@ | 256 | GNULIB_CTIME = @GNULIB_CTIME@ |
| 256 | GNULIB_DIRFD = @GNULIB_DIRFD@ | 257 | GNULIB_DIRFD = @GNULIB_DIRFD@ |
| 257 | GNULIB_DPRINTF = @GNULIB_DPRINTF@ | 258 | GNULIB_DPRINTF = @GNULIB_DPRINTF@ |
| @@ -489,6 +490,7 @@ HAVE_C99_STDINT_H = @HAVE_C99_STDINT_H@ | |||
| 489 | HAVE_CANONICALIZE_FILE_NAME = @HAVE_CANONICALIZE_FILE_NAME@ | 490 | HAVE_CANONICALIZE_FILE_NAME = @HAVE_CANONICALIZE_FILE_NAME@ |
| 490 | HAVE_CHOWN = @HAVE_CHOWN@ | 491 | HAVE_CHOWN = @HAVE_CHOWN@ |
| 491 | HAVE_CLOSEDIR = @HAVE_CLOSEDIR@ | 492 | HAVE_CLOSEDIR = @HAVE_CLOSEDIR@ |
| 493 | HAVE_COPY_FILE_RANGE = @HAVE_COPY_FILE_RANGE@ | ||
| 492 | HAVE_DECL_DIRFD = @HAVE_DECL_DIRFD@ | 494 | HAVE_DECL_DIRFD = @HAVE_DECL_DIRFD@ |
| 493 | HAVE_DECL_ENVIRON = @HAVE_DECL_ENVIRON@ | 495 | HAVE_DECL_ENVIRON = @HAVE_DECL_ENVIRON@ |
| 494 | HAVE_DECL_FCHDIR = @HAVE_DECL_FCHDIR@ | 496 | HAVE_DECL_FCHDIR = @HAVE_DECL_FCHDIR@ |
| @@ -3115,6 +3117,7 @@ unistd.h: unistd.in.h $(top_builddir)/config.status $(CXXDEFS_H) $(ARG_NONNULL_H | |||
| 3115 | -e 's/@''GNULIB_CHDIR''@/$(GNULIB_CHDIR)/g' \ | 3117 | -e 's/@''GNULIB_CHDIR''@/$(GNULIB_CHDIR)/g' \ |
| 3116 | -e 's/@''GNULIB_CHOWN''@/$(GNULIB_CHOWN)/g' \ | 3118 | -e 's/@''GNULIB_CHOWN''@/$(GNULIB_CHOWN)/g' \ |
| 3117 | -e 's/@''GNULIB_CLOSE''@/$(GNULIB_CLOSE)/g' \ | 3119 | -e 's/@''GNULIB_CLOSE''@/$(GNULIB_CLOSE)/g' \ |
| 3120 | -e 's/@''GNULIB_COPY_FILE_RANGE''@/$(GNULIB_COPY_FILE_RANGE)/g' \ | ||
| 3118 | -e 's/@''GNULIB_DUP''@/$(GNULIB_DUP)/g' \ | 3121 | -e 's/@''GNULIB_DUP''@/$(GNULIB_DUP)/g' \ |
| 3119 | -e 's/@''GNULIB_DUP2''@/$(GNULIB_DUP2)/g' \ | 3122 | -e 's/@''GNULIB_DUP2''@/$(GNULIB_DUP2)/g' \ |
| 3120 | -e 's/@''GNULIB_DUP3''@/$(GNULIB_DUP3)/g' \ | 3123 | -e 's/@''GNULIB_DUP3''@/$(GNULIB_DUP3)/g' \ |
| @@ -3165,6 +3168,7 @@ unistd.h: unistd.in.h $(top_builddir)/config.status $(CXXDEFS_H) $(ARG_NONNULL_H | |||
| 3165 | -e 's/@''GNULIB_WRITE''@/$(GNULIB_WRITE)/g' \ | 3168 | -e 's/@''GNULIB_WRITE''@/$(GNULIB_WRITE)/g' \ |
| 3166 | < $(srcdir)/unistd.in.h | \ | 3169 | < $(srcdir)/unistd.in.h | \ |
| 3167 | sed -e 's|@''HAVE_CHOWN''@|$(HAVE_CHOWN)|g' \ | 3170 | sed -e 's|@''HAVE_CHOWN''@|$(HAVE_CHOWN)|g' \ |
| 3171 | -e 's|@''HAVE_COPY_FILE_RANGE''@|$(HAVE_COPY_FILE_RANGE)|g' \ | ||
| 3168 | -e 's|@''HAVE_DUP2''@|$(HAVE_DUP2)|g' \ | 3172 | -e 's|@''HAVE_DUP2''@|$(HAVE_DUP2)|g' \ |
| 3169 | -e 's|@''HAVE_DUP3''@|$(HAVE_DUP3)|g' \ | 3173 | -e 's|@''HAVE_DUP3''@|$(HAVE_DUP3)|g' \ |
| 3170 | -e 's|@''HAVE_EUIDACCESS''@|$(HAVE_EUIDACCESS)|g' \ | 3174 | -e 's|@''HAVE_EUIDACCESS''@|$(HAVE_EUIDACCESS)|g' \ |
diff --git a/lib/unistd.in.h b/lib/unistd.in.h index 7778d25dc7e..94a8f383c99 100644 --- a/lib/unistd.in.h +++ b/lib/unistd.in.h | |||
| @@ -331,6 +331,24 @@ _GL_WARN_ON_USE (close, "close does not portably work on sockets - " | |||
| 331 | #endif | 331 | #endif |
| 332 | 332 | ||
| 333 | 333 | ||
| 334 | #if @GNULIB_COPY_FILE_RANGE@ | ||
| 335 | # if !@HAVE_COPY_FILE_RANGE@ | ||
| 336 | _GL_FUNCDECL_SYS (copy_file_range, ssize_t, (int ifd, off_t *ipos, | ||
| 337 | int ofd, off_t *opos, | ||
| 338 | size_t len, unsigned flags)); | ||
| 339 | _GL_CXXALIAS_SYS (copy_file_range, ssize_t, (int ifd, off_t *ipos, | ||
| 340 | int ofd, off_t *opos, | ||
| 341 | size_t len, unsigned flags)); | ||
| 342 | # endif | ||
| 343 | _GL_CXXALIASWARN (copy_file_range); | ||
| 344 | #elif defined GNULIB_POSIXCHECK | ||
| 345 | /* Assume copy_file_range is always declared. */ | ||
| 346 | _GL_WARN_ON_USE (copy_file_range, | ||
| 347 | "copy_file_range is unportable - " | ||
| 348 | "use gnulib module copy_file_range for portability"); | ||
| 349 | #endif | ||
| 350 | |||
| 351 | |||
| 334 | #if @GNULIB_DUP@ | 352 | #if @GNULIB_DUP@ |
| 335 | # if @REPLACE_DUP@ | 353 | # if @REPLACE_DUP@ |
| 336 | # if !(defined __cplusplus && defined GNULIB_NAMESPACE) | 354 | # if !(defined __cplusplus && defined GNULIB_NAMESPACE) |