aboutsummaryrefslogtreecommitdiffstats
path: root/src/sysdep.c
diff options
context:
space:
mode:
authorPaul Eggert2012-11-17 14:12:47 -0800
committerPaul Eggert2012-11-17 14:12:47 -0800
commit49cdacdad393e2b9282a19a963030dfbe1a738ab (patch)
tree40b11ac721a6a64102dae1a4f227fbc4d1eff0bc /src/sysdep.c
parent310e60d9454fe2d7e6920cf51f20d438e57f7b28 (diff)
downloademacs-49cdacdad393e2b9282a19a963030dfbe1a738ab.tar.gz
emacs-49cdacdad393e2b9282a19a963030dfbe1a738ab.zip
Assume POSIX 1003.1-1988 or later for fcntl.h.
* admin/CPP-DEFINES (O_RDONLY, O_RDWR, HAVE_FCNTL_H): Remove. * admin/merge-gnulib (GNULIB_MODULES): Add fcntl-h. * configure.ac: Do not check for fcntl.h. * lib/gnulib.mk: Regenerate. * lib-src/movemail.c, lib-src/update-game-score.c: Assume <fcntl.h> exists. * nt/inc/sys/socket.h (O_NONBLOCK): Rename from O_NDELAY, since the POSIX name for this flag is O_NONBLOCK. All uses changed. * nt/inc/unistd.h (O_RDWR, O_NOCTTY): New macros. Like AT_FDCWD etc. these really should be moved to a replacement <fcntl.h> if and when that gets implemented. In the meantime, include <fcntl.h> to make sure we don't override its definitions. * src/callproc.c (relocate_fd): Assume F_DUPFD. * src/emacs.c, src/term.c (O_RDWR): Remove. * src/keyboard.c (tty_read_avail_input): Use O_NONBLOCK rather than O_NDELAY, since O_NONBLOCK is the standard name for this flag. * src/nsterm.m: Assume <fcntl.h> exists. * src/process.c (NON_BLOCKING_CONNECT, allocate_pty, create_process) (create_pty, Fmake_network_process, server_accept_connection) (wait_reading_process_output, init_process_emacs): Assume O_NONBLOCK. (wait_reading_process_output): Put in a special case for WINDOWSNT to mimick the older behavior where it had O_NDELAY but not O_NONBLOCK. It's not clear this is needed, but it's a more-conservative change. (create_process): Assume FD_CLOEXEC. (create_process, create_pty): Assume O_NOCTTY. * src/sysdep.c (init_sys_modes, reset_sys_modes): Assume F_SETFL. (reset_sys_modes): Use O_NONBLOCK rather than O_NDELAY. Omit if not DOS_NT, since F_GETFL is not defined there. (serial_open): Assume O_NONBLOCK and O_NOCTTY. * src/term.c: Include <fcntl.h>, for flags like O_NOCTTY. (O_NOCTTY): Remove. (init_tty): Assume O_IGNORE_CTTY is defined to 0 on platforms that lack it, since gnulib guarantees this. * src/w32.c (fcntl): Test for O_NONBLOCK rather than O_NDELAY. Fixes: debbugs:12881
Diffstat (limited to 'src/sysdep.c')
-rw-r--r--src/sysdep.c26
1 files changed, 5 insertions, 21 deletions
diff --git a/src/sysdep.c b/src/sysdep.c
index 06dc41b511e..7c5c144fa8c 100644
--- a/src/sysdep.c
+++ b/src/sysdep.c
@@ -1036,8 +1036,7 @@ init_sys_modes (struct tty_display_info *tty_out)
1036#endif 1036#endif
1037#endif 1037#endif
1038 1038
1039#ifdef F_SETFL 1039#ifdef F_GETOWN
1040#ifdef F_GETOWN /* F_SETFL does not imply existence of F_GETOWN */
1041 if (interrupt_input) 1040 if (interrupt_input)
1042 { 1041 {
1043 old_fcntl_owner[fileno (tty_out->input)] = 1042 old_fcntl_owner[fileno (tty_out->input)] =
@@ -1055,7 +1054,6 @@ init_sys_modes (struct tty_display_info *tty_out)
1055#endif /* HAVE_GPM */ 1054#endif /* HAVE_GPM */
1056 } 1055 }
1057#endif /* F_GETOWN */ 1056#endif /* F_GETOWN */
1058#endif /* F_SETFL */
1059 1057
1060#ifdef _IOFBF 1058#ifdef _IOFBF
1061 /* This symbol is defined on recent USG systems. 1059 /* This symbol is defined on recent USG systems.
@@ -1275,8 +1273,8 @@ reset_sys_modes (struct tty_display_info *tty_out)
1275 fsync (fileno (tty_out->output)); 1273 fsync (fileno (tty_out->output));
1276#endif 1274#endif
1277 1275
1278#ifdef F_SETFL 1276#ifndef DOS_NT
1279#ifdef F_SETOWN /* F_SETFL does not imply existence of F_SETOWN */ 1277#ifdef F_SETOWN
1280 if (interrupt_input) 1278 if (interrupt_input)
1281 { 1279 {
1282 reset_sigio (fileno (tty_out->input)); 1280 reset_sigio (fileno (tty_out->input));
@@ -1284,11 +1282,9 @@ reset_sys_modes (struct tty_display_info *tty_out)
1284 old_fcntl_owner[fileno (tty_out->input)]); 1282 old_fcntl_owner[fileno (tty_out->input)]);
1285 } 1283 }
1286#endif /* F_SETOWN */ 1284#endif /* F_SETOWN */
1287#if O_NDELAY
1288 fcntl (fileno (tty_out->input), F_SETFL, 1285 fcntl (fileno (tty_out->input), F_SETFL,
1289 fcntl (fileno (tty_out->input), F_GETFL, 0) & ~O_NDELAY); 1286 fcntl (fileno (tty_out->input), F_GETFL, 0) & ~O_NONBLOCK);
1290#endif 1287#endif
1291#endif /* F_SETFL */
1292 1288
1293 if (tty_out->old_tty) 1289 if (tty_out->old_tty)
1294 while (emacs_set_tty (fileno (tty_out->input), 1290 while (emacs_set_tty (fileno (tty_out->input),
@@ -2377,19 +2373,7 @@ safe_strsignal (int code)
2377int 2373int
2378serial_open (char *port) 2374serial_open (char *port)
2379{ 2375{
2380 int fd = -1; 2376 int fd = emacs_open (port, O_RDWR | O_NOCTTY | O_NONBLOCK, 0);
2381
2382 fd = emacs_open ((char*) port,
2383 O_RDWR
2384#if O_NONBLOCK
2385 | O_NONBLOCK
2386#else
2387 | O_NDELAY
2388#endif
2389#if O_NOCTTY
2390 | O_NOCTTY
2391#endif
2392 , 0);
2393 if (fd < 0) 2377 if (fd < 0)
2394 { 2378 {
2395 error ("Could not open %s: %s", 2379 error ("Could not open %s: %s",