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
This commit is contained in:
parent
310e60d945
commit
49cdacdad3
21 changed files with 101 additions and 146 deletions
|
@ -1,3 +1,9 @@
|
|||
2012-11-17 Paul Eggert <eggert@cs.ucla.edu>
|
||||
|
||||
Assume POSIX 1003.1-1988 or later for fcntl.h (Bug#12881).
|
||||
* configure.ac: Do not check for fcntl.h.
|
||||
* lib/gnulib.mk: Regenerate.
|
||||
|
||||
2012-11-16 Paul Eggert <eggert@cs.ucla.edu>
|
||||
|
||||
Remove no-longer-used pty_max_bytes variable.
|
||||
|
|
|
@ -150,7 +150,6 @@ HAVE_ENDGRENT
|
|||
HAVE_ENDPWENT
|
||||
HAVE_ENVIRON_DECL
|
||||
HAVE_EUIDACCESS
|
||||
HAVE_FCNTL_H
|
||||
HAVE_FORK
|
||||
HAVE_FREEIFADDRS
|
||||
HAVE_FREETYPE
|
||||
|
@ -419,8 +418,6 @@ NSIG
|
|||
NSIG_MINIMUM
|
||||
NULL_DEVICE
|
||||
ORDINARY_LINK
|
||||
O_RDONLY
|
||||
O_RDWR
|
||||
PAGESIZE
|
||||
PREFER_VSUSP
|
||||
PTY_ITERATION
|
||||
|
|
|
@ -1,3 +1,9 @@
|
|||
2012-11-17 Paul Eggert <eggert@cs.ucla.edu>
|
||||
|
||||
Assume POSIX 1003.1-1988 or later for fcntl.h (Bug#12881).
|
||||
* CPP-DEFINES (O_RDONLY, O_RDWR, HAVE_FCNTL_H): Remove.
|
||||
* merge-gnulib (GNULIB_MODULES): Add fcntl-h.
|
||||
|
||||
2012-11-16 Paul Eggert <eggert@cs.ucla.edu>
|
||||
|
||||
Remove no-longer-used pty_max_bytes variable.
|
||||
|
|
|
@ -29,7 +29,7 @@ GNULIB_MODULES='
|
|||
alloca-opt c-ctype c-strcase
|
||||
careadlinkat close-stream crypto/md5 crypto/sha1 crypto/sha256 crypto/sha512
|
||||
dtoastr dtotimespec dup2 environ execinfo faccessat
|
||||
filemode getloadavg getopt-gnu gettime gettimeofday
|
||||
fcntl-h filemode getloadavg getopt-gnu gettime gettimeofday
|
||||
ignore-value intprops largefile lstat
|
||||
manywarnings mktime pselect pthread_sigmask readlink
|
||||
socklen stat-time stdalign stdarg stdbool stdio
|
||||
|
|
|
@ -1268,7 +1268,7 @@ fi
|
|||
dnl checks for header files
|
||||
AC_CHECK_HEADERS_ONCE(
|
||||
linux/version.h sys/systeminfo.h
|
||||
fcntl.h coff.h pty.h
|
||||
coff.h pty.h
|
||||
sys/vlimit.h sys/resource.h
|
||||
sys/utsname.h pwd.h utmp.h dirent.h util.h)
|
||||
|
||||
|
|
|
@ -1,3 +1,8 @@
|
|||
2012-11-17 Paul Eggert <eggert@cs.ucla.edu>
|
||||
|
||||
Assume POSIX 1003.1-1988 or later for fcntl.h (Bug#12881).
|
||||
* movemail.c, update-game-score.c: Assume <fcntl.h> exists.
|
||||
|
||||
2012-10-26 Glenn Morris <rgm@gnu.org>
|
||||
|
||||
* Makefile.in (uninstall): No INSTALLABLES live in archlibdir.
|
||||
|
|
|
@ -65,9 +65,7 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
|
|||
|
||||
#include <getopt.h>
|
||||
#include <unistd.h>
|
||||
#ifdef HAVE_FCNTL_H
|
||||
#include <fcntl.h>
|
||||
#endif
|
||||
#include <string.h>
|
||||
#include "syswait.h"
|
||||
#ifdef MAIL_USE_POP
|
||||
|
|
|
@ -42,9 +42,7 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
|
|||
#include <time.h>
|
||||
#include <pwd.h>
|
||||
#include <ctype.h>
|
||||
#ifdef HAVE_FCNTL_H
|
||||
#include <fcntl.h>
|
||||
#endif
|
||||
#include <sys/stat.h>
|
||||
#include <getopt.h>
|
||||
|
||||
|
|
|
@ -21,7 +21,7 @@
|
|||
# the same distribution terms as the rest of that program.
|
||||
#
|
||||
# Generated by gnulib-tool.
|
||||
# Reproduce by: gnulib-tool --import --dir=. --lib=libgnu --source-base=lib --m4-base=m4 --doc-base=doc --tests-base=tests --aux-dir=build-aux --avoid=at-internal --avoid=errno --avoid=fchdir --avoid=fcntl --avoid=fstat --avoid=malloc-posix --avoid=msvc-inval --avoid=msvc-nothrow --avoid=openat-die --avoid=openat-h --avoid=raise --avoid=save-cwd --avoid=select --avoid=sigprocmask --avoid=sys_types --avoid=threadlib --makefile-name=gnulib.mk --conditional-dependencies --no-libtool --macro-prefix=gl --no-vc-files alloca-opt c-ctype c-strcase careadlinkat close-stream crypto/md5 crypto/sha1 crypto/sha256 crypto/sha512 dtoastr dtotimespec dup2 environ execinfo faccessat filemode getloadavg getopt-gnu gettime gettimeofday ignore-value intprops largefile lstat manywarnings mktime pselect pthread_sigmask readlink socklen stat-time stdalign stdarg stdbool stdio strftime strtoimax strtoumax symlink sys_stat sys_time time timer-time timespec-add timespec-sub utimens warnings
|
||||
# Reproduce by: gnulib-tool --import --dir=. --lib=libgnu --source-base=lib --m4-base=m4 --doc-base=doc --tests-base=tests --aux-dir=build-aux --avoid=at-internal --avoid=errno --avoid=fchdir --avoid=fcntl --avoid=fstat --avoid=malloc-posix --avoid=msvc-inval --avoid=msvc-nothrow --avoid=openat-die --avoid=openat-h --avoid=raise --avoid=save-cwd --avoid=select --avoid=sigprocmask --avoid=sys_types --avoid=threadlib --makefile-name=gnulib.mk --conditional-dependencies --no-libtool --macro-prefix=gl --no-vc-files alloca-opt c-ctype c-strcase careadlinkat close-stream crypto/md5 crypto/sha1 crypto/sha256 crypto/sha512 dtoastr dtotimespec dup2 environ execinfo faccessat fcntl-h filemode getloadavg getopt-gnu gettime gettimeofday ignore-value intprops largefile lstat manywarnings mktime pselect pthread_sigmask readlink socklen stat-time stdalign stdarg stdbool stdio strftime strtoimax strtoumax symlink sys_stat sys_time time timer-time timespec-add timespec-sub utimens warnings
|
||||
|
||||
|
||||
MOSTLYCLEANFILES += core *.stackdump
|
||||
|
|
10
nt/ChangeLog
10
nt/ChangeLog
|
@ -1,3 +1,13 @@
|
|||
2012-11-17 Paul Eggert <eggert@cs.ucla.edu>
|
||||
|
||||
Assume POSIX 1003.1-1988 or later for fcntl.h (Bug#12881).
|
||||
* inc/sys/socket.h (O_NONBLOCK): Rename from O_NDELAY, since the
|
||||
POSIX name for this flag is O_NONBLOCK. All uses changed.
|
||||
* 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.
|
||||
|
||||
2012-11-17 Eli Zaretskii <eliz@gnu.org>
|
||||
|
||||
* inc/sys/wait.h: New file, with prototype of waitpid and
|
||||
|
|
|
@ -119,7 +119,7 @@ int sys_sendto (int s, const char * buf, int len, int flags,
|
|||
an fcntl function, for setting sockets to non-blocking mode. */
|
||||
int fcntl (int s, int cmd, int options);
|
||||
#define F_SETFL 4
|
||||
#define O_NDELAY 04000
|
||||
#define O_NONBLOCK 04000
|
||||
|
||||
/* we are providing a real h_errno variable */
|
||||
#undef h_errno
|
||||
|
|
|
@ -26,4 +26,17 @@ extern int faccessat (int, char const *, int, int);
|
|||
#define AT_EACCESS 4
|
||||
#define AT_SYMLINK_NOFOLLOW 4096
|
||||
|
||||
/* Here are some more fcntl.h macros that default to gnulib-compatible
|
||||
values. Include <fcntl.h> first, to make sure we don't override
|
||||
its values if any. FIXME: If we know <fcntl.h> does not define
|
||||
O_NOCTTY and O_RDWR, this can be replaced with a simple "#define
|
||||
O_NOCTTY 0" and "#define O_RDWR 2". */
|
||||
#include <fcntl.h>
|
||||
#ifndef O_NOCTTY
|
||||
#define O_NOCTTY 0
|
||||
#endif
|
||||
#ifndef O_RDWR
|
||||
#define O_RDWR 2
|
||||
#endif
|
||||
|
||||
#endif /* _UNISTD_H */
|
||||
|
|
|
@ -1,3 +1,30 @@
|
|||
2012-11-17 Paul Eggert <eggert@cs.ucla.edu>
|
||||
|
||||
Assume POSIX 1003.1-1988 or later for fcntl.h (Bug#12881).
|
||||
* callproc.c (relocate_fd): Assume F_DUPFD.
|
||||
* emacs.c, term.c (O_RDWR): Remove.
|
||||
* keyboard.c (tty_read_avail_input): Use O_NONBLOCK rather than
|
||||
O_NDELAY, since O_NONBLOCK is the standard name for this flag.
|
||||
* nsterm.m: Assume <fcntl.h> exists.
|
||||
* 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.
|
||||
* 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.
|
||||
* 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.
|
||||
* w32.c (fcntl): Test for O_NONBLOCK rather than O_NDELAY.
|
||||
|
||||
2012-11-17 Eli Zaretskii <eliz@gnu.org>
|
||||
|
||||
* w32.c (faccessat): Pretend that directories have the execute bit
|
||||
|
|
|
@ -1317,16 +1317,7 @@ relocate_fd (int fd, int minfd)
|
|||
return fd;
|
||||
else
|
||||
{
|
||||
int new;
|
||||
#ifdef F_DUPFD
|
||||
new = fcntl (fd, F_DUPFD, minfd);
|
||||
#else
|
||||
new = dup (fd);
|
||||
if (new != -1)
|
||||
/* Note that we hold the original FD open while we recurse,
|
||||
to guarantee we'll get a new FD if we need it. */
|
||||
new = relocate_fd (new, minfd);
|
||||
#endif
|
||||
int new = fcntl (fd, F_DUPFD, minfd);
|
||||
if (new == -1)
|
||||
{
|
||||
const char *message_1 = "Error while setting up child: ";
|
||||
|
|
|
@ -95,10 +95,6 @@ extern void moncontrol (int mode);
|
|||
#include <sys/personality.h>
|
||||
#endif
|
||||
|
||||
#ifndef O_RDWR
|
||||
#define O_RDWR 2
|
||||
#endif
|
||||
|
||||
static const char emacs_version[] = VERSION;
|
||||
static const char emacs_copyright[] = COPYRIGHT;
|
||||
|
||||
|
|
|
@ -6948,7 +6948,7 @@ tty_read_avail_input (struct terminal *terminal,
|
|||
#elif defined USG || defined CYGWIN
|
||||
/* Read some input if available, but don't wait. */
|
||||
n_to_read = sizeof cbuf;
|
||||
fcntl (fileno (tty->input), F_SETFL, O_NDELAY);
|
||||
fcntl (fileno (tty->input), F_SETFL, O_NONBLOCK);
|
||||
#else
|
||||
# error "Cannot read without possibly delaying"
|
||||
#endif
|
||||
|
@ -6982,7 +6982,7 @@ tty_read_avail_input (struct terminal *terminal,
|
|||
}
|
||||
while (
|
||||
/* We used to retry the read if it was interrupted.
|
||||
But this does the wrong thing when O_NDELAY causes
|
||||
But this does the wrong thing when O_NONBLOCK causes
|
||||
an EAGAIN error. Does anybody know of a situation
|
||||
where a retry is actually needed? */
|
||||
#if 0
|
||||
|
|
|
@ -30,6 +30,7 @@ Updated by Christian Limpach (chris@nice.ch)
|
|||
interpretation of even the system includes. */
|
||||
#include <config.h>
|
||||
|
||||
#include <fcntl.h>
|
||||
#include <math.h>
|
||||
#include <pthread.h>
|
||||
#include <sys/types.h>
|
||||
|
@ -41,10 +42,6 @@ Updated by Christian Limpach (chris@nice.ch)
|
|||
#include <c-strcase.h>
|
||||
#include <ftoastr.h>
|
||||
|
||||
#ifdef HAVE_FCNTL_H
|
||||
#include <fcntl.h>
|
||||
#endif
|
||||
|
||||
#include "lisp.h"
|
||||
#include "blockinput.h"
|
||||
#include "sysselect.h"
|
||||
|
|
|
@ -196,11 +196,9 @@ static EMACS_INT update_tick;
|
|||
#ifndef NON_BLOCKING_CONNECT
|
||||
#ifdef HAVE_SELECT
|
||||
#if defined (HAVE_GETPEERNAME) || defined (GNU_LINUX)
|
||||
#if O_NONBLOCK || O_NDELAY
|
||||
#if defined (EWOULDBLOCK) || defined (EINPROGRESS)
|
||||
#define NON_BLOCKING_CONNECT
|
||||
#endif /* EWOULDBLOCK || EINPROGRESS */
|
||||
#endif /* O_NONBLOCK || O_NDELAY */
|
||||
#endif /* HAVE_GETPEERNAME || GNU_LINUX */
|
||||
#endif /* HAVE_SELECT */
|
||||
#endif /* NON_BLOCKING_CONNECT */
|
||||
|
@ -639,13 +637,7 @@ allocate_pty (void)
|
|||
#ifdef PTY_OPEN
|
||||
PTY_OPEN;
|
||||
#else /* no PTY_OPEN */
|
||||
{
|
||||
# if O_NONBLOCK
|
||||
fd = emacs_open (pty_name, O_RDWR | O_NONBLOCK, 0);
|
||||
# else
|
||||
fd = emacs_open (pty_name, O_RDWR | O_NDELAY, 0);
|
||||
# endif
|
||||
}
|
||||
fd = emacs_open (pty_name, O_RDWR | O_NONBLOCK, 0);
|
||||
#endif /* no PTY_OPEN */
|
||||
|
||||
if (fd >= 0)
|
||||
|
@ -1583,7 +1575,7 @@ create_process (Lisp_Object process, char **new_argv, Lisp_Object current_dir)
|
|||
int inchannel, outchannel;
|
||||
pid_t pid;
|
||||
int sv[2];
|
||||
#if !defined (WINDOWSNT) && defined (FD_CLOEXEC)
|
||||
#ifndef WINDOWSNT
|
||||
int wait_child_setup[2];
|
||||
#endif
|
||||
#ifdef SIGCHLD
|
||||
|
@ -1609,13 +1601,9 @@ create_process (Lisp_Object process, char **new_argv, Lisp_Object current_dir)
|
|||
#if ! defined (USG) || defined (USG_SUBTTY_WORKS)
|
||||
/* On most USG systems it does not work to open the pty's tty here,
|
||||
then close it and reopen it in the child. */
|
||||
#if O_NOCTTY
|
||||
/* Don't let this terminal become our controlling terminal
|
||||
(in case we don't have one). */
|
||||
forkout = forkin = emacs_open (pty_name, O_RDWR | O_NOCTTY, 0);
|
||||
#else
|
||||
forkout = forkin = emacs_open (pty_name, O_RDWR, 0);
|
||||
#endif
|
||||
if (forkin < 0)
|
||||
report_file_error ("Opening pty", Qnil);
|
||||
#else
|
||||
|
@ -1644,7 +1632,7 @@ create_process (Lisp_Object process, char **new_argv, Lisp_Object current_dir)
|
|||
forkin = sv[0];
|
||||
}
|
||||
|
||||
#if !defined (WINDOWSNT) && defined (FD_CLOEXEC)
|
||||
#ifndef WINDOWSNT
|
||||
{
|
||||
int tem;
|
||||
|
||||
|
@ -1663,15 +1651,8 @@ create_process (Lisp_Object process, char **new_argv, Lisp_Object current_dir)
|
|||
}
|
||||
#endif
|
||||
|
||||
#if O_NONBLOCK
|
||||
fcntl (inchannel, F_SETFL, O_NONBLOCK);
|
||||
fcntl (outchannel, F_SETFL, O_NONBLOCK);
|
||||
#else
|
||||
#if O_NDELAY
|
||||
fcntl (inchannel, F_SETFL, O_NDELAY);
|
||||
fcntl (outchannel, F_SETFL, O_NDELAY);
|
||||
#endif
|
||||
#endif
|
||||
|
||||
/* Record this as an active process, with its channels.
|
||||
As a result, child_setup will close Emacs's side of the pipes. */
|
||||
|
@ -1830,9 +1811,7 @@ create_process (Lisp_Object process, char **new_argv, Lisp_Object current_dir)
|
|||
pid = child_setup (xforkin, xforkout, xforkout,
|
||||
new_argv, 1, encoded_current_dir);
|
||||
#else /* not WINDOWSNT */
|
||||
#ifdef FD_CLOEXEC
|
||||
emacs_close (wait_child_setup[0]);
|
||||
#endif
|
||||
child_setup (xforkin, xforkout, xforkout,
|
||||
new_argv, 1, encoded_current_dir);
|
||||
#endif /* not WINDOWSNT */
|
||||
|
@ -1891,7 +1870,7 @@ create_process (Lisp_Object process, char **new_argv, Lisp_Object current_dir)
|
|||
|
||||
pset_tty_name (XPROCESS (process), lisp_pty_name);
|
||||
|
||||
#if !defined (WINDOWSNT) && defined (FD_CLOEXEC)
|
||||
#ifndef WINDOWSNT
|
||||
/* Wait for child_setup to complete in case that vfork is
|
||||
actually defined as fork. The descriptor wait_child_setup[1]
|
||||
of a pipe is closed at the child side either by close-on-exec
|
||||
|
@ -1928,13 +1907,9 @@ create_pty (Lisp_Object process)
|
|||
#if ! defined (USG) || defined (USG_SUBTTY_WORKS)
|
||||
/* On most USG systems it does not work to open the pty's tty here,
|
||||
then close it and reopen it in the child. */
|
||||
#if O_NOCTTY
|
||||
/* Don't let this terminal become our controlling terminal
|
||||
(in case we don't have one). */
|
||||
int forkout = emacs_open (pty_name, O_RDWR | O_NOCTTY, 0);
|
||||
#else
|
||||
int forkout = emacs_open (pty_name, O_RDWR, 0);
|
||||
#endif
|
||||
if (forkout < 0)
|
||||
report_file_error ("Opening pty", Qnil);
|
||||
#if defined (DONT_REOPEN_PTY)
|
||||
|
@ -1948,15 +1923,8 @@ create_pty (Lisp_Object process)
|
|||
}
|
||||
#endif /* HAVE_PTYS */
|
||||
|
||||
#if O_NONBLOCK
|
||||
fcntl (inchannel, F_SETFL, O_NONBLOCK);
|
||||
fcntl (outchannel, F_SETFL, O_NONBLOCK);
|
||||
#else
|
||||
#if O_NDELAY
|
||||
fcntl (inchannel, F_SETFL, O_NDELAY);
|
||||
fcntl (outchannel, F_SETFL, O_NDELAY);
|
||||
#endif
|
||||
#endif
|
||||
|
||||
/* Record this as an active process, with its channels.
|
||||
As a result, child_setup will close Emacs's side of the pipes. */
|
||||
|
@ -2912,13 +2880,9 @@ usage: (make-network-process &rest ARGS) */)
|
|||
{
|
||||
/* Don't support network sockets when non-blocking mode is
|
||||
not available, since a blocked Emacs is not useful. */
|
||||
#if !O_NONBLOCK && !O_NDELAY
|
||||
error ("Network servers not supported");
|
||||
#else
|
||||
is_server = 1;
|
||||
if (TYPE_RANGED_INTEGERP (int, tem))
|
||||
backlog = XINT (tem);
|
||||
#endif
|
||||
}
|
||||
|
||||
/* Make QCaddress an alias for :local (server) or :remote (client). */
|
||||
|
@ -3178,11 +3142,7 @@ usage: (make-network-process &rest ARGS) */)
|
|||
#ifdef NON_BLOCKING_CONNECT
|
||||
if (is_non_blocking_client)
|
||||
{
|
||||
#if O_NONBLOCK
|
||||
ret = fcntl (s, F_SETFL, O_NONBLOCK);
|
||||
#else
|
||||
ret = fcntl (s, F_SETFL, O_NDELAY);
|
||||
#endif
|
||||
if (ret < 0)
|
||||
{
|
||||
xerrno = errno;
|
||||
|
@ -3395,13 +3355,7 @@ usage: (make-network-process &rest ARGS) */)
|
|||
|
||||
chan_process[inch] = proc;
|
||||
|
||||
#if O_NONBLOCK
|
||||
fcntl (inch, F_SETFL, O_NONBLOCK);
|
||||
#else
|
||||
#if O_NDELAY
|
||||
fcntl (inch, F_SETFL, O_NDELAY);
|
||||
#endif
|
||||
#endif
|
||||
|
||||
p = XPROCESS (proc);
|
||||
|
||||
|
@ -4130,13 +4084,7 @@ server_accept_connection (Lisp_Object server, int channel)
|
|||
|
||||
chan_process[s] = proc;
|
||||
|
||||
#if O_NONBLOCK
|
||||
fcntl (s, F_SETFL, O_NONBLOCK);
|
||||
#else
|
||||
#if O_NDELAY
|
||||
fcntl (s, F_SETFL, O_NDELAY);
|
||||
#endif
|
||||
#endif
|
||||
|
||||
p = XPROCESS (proc);
|
||||
|
||||
|
@ -4832,23 +4780,17 @@ wait_reading_process_output (intmax_t time_limit, int nsecs, int read_kbd,
|
|||
else if (nread == -1 && errno == EWOULDBLOCK)
|
||||
;
|
||||
#endif
|
||||
/* ISC 4.1 defines both EWOULDBLOCK and O_NONBLOCK,
|
||||
and Emacs uses O_NONBLOCK, so what we get is EAGAIN. */
|
||||
#if O_NONBLOCK
|
||||
else if (nread == -1 && errno == EAGAIN)
|
||||
;
|
||||
#else
|
||||
#if O_NDELAY
|
||||
else if (nread == -1 && errno == EAGAIN)
|
||||
;
|
||||
#ifdef WINDOWSNT
|
||||
/* FIXME: Is this special case still needed? */
|
||||
/* Note that we cannot distinguish between no input
|
||||
available now and a closed pipe.
|
||||
With luck, a closed pipe will be accompanied by
|
||||
subprocess termination and SIGCHLD. */
|
||||
else if (nread == 0 && !NETCONN_P (proc) && !SERIALCONN_P (proc))
|
||||
;
|
||||
#endif /* O_NDELAY */
|
||||
#endif /* O_NONBLOCK */
|
||||
#endif
|
||||
#ifdef HAVE_PTYS
|
||||
/* On some OSs with ptys, when the process on one end of
|
||||
a pty exits, the other end gets an error reading with
|
||||
|
@ -7312,9 +7254,7 @@ init_process_emacs (void)
|
|||
#ifdef HAVE_GETSOCKNAME
|
||||
ADD_SUBFEATURE (QCservice, Qt);
|
||||
#endif
|
||||
#if O_NONBLOCK || O_NDELAY
|
||||
ADD_SUBFEATURE (QCserver, Qt);
|
||||
#endif
|
||||
|
||||
for (sopt = socket_options; sopt->name; sopt++)
|
||||
subfeatures = pure_cons (intern_c_string (sopt->name), subfeatures);
|
||||
|
|
26
src/sysdep.c
26
src/sysdep.c
|
@ -1036,8 +1036,7 @@ init_sys_modes (struct tty_display_info *tty_out)
|
|||
#endif
|
||||
#endif
|
||||
|
||||
#ifdef F_SETFL
|
||||
#ifdef F_GETOWN /* F_SETFL does not imply existence of F_GETOWN */
|
||||
#ifdef F_GETOWN
|
||||
if (interrupt_input)
|
||||
{
|
||||
old_fcntl_owner[fileno (tty_out->input)] =
|
||||
|
@ -1055,7 +1054,6 @@ init_sys_modes (struct tty_display_info *tty_out)
|
|||
#endif /* HAVE_GPM */
|
||||
}
|
||||
#endif /* F_GETOWN */
|
||||
#endif /* F_SETFL */
|
||||
|
||||
#ifdef _IOFBF
|
||||
/* This symbol is defined on recent USG systems.
|
||||
|
@ -1275,8 +1273,8 @@ reset_sys_modes (struct tty_display_info *tty_out)
|
|||
fsync (fileno (tty_out->output));
|
||||
#endif
|
||||
|
||||
#ifdef F_SETFL
|
||||
#ifdef F_SETOWN /* F_SETFL does not imply existence of F_SETOWN */
|
||||
#ifndef DOS_NT
|
||||
#ifdef F_SETOWN
|
||||
if (interrupt_input)
|
||||
{
|
||||
reset_sigio (fileno (tty_out->input));
|
||||
|
@ -1284,11 +1282,9 @@ reset_sys_modes (struct tty_display_info *tty_out)
|
|||
old_fcntl_owner[fileno (tty_out->input)]);
|
||||
}
|
||||
#endif /* F_SETOWN */
|
||||
#if O_NDELAY
|
||||
fcntl (fileno (tty_out->input), F_SETFL,
|
||||
fcntl (fileno (tty_out->input), F_GETFL, 0) & ~O_NDELAY);
|
||||
fcntl (fileno (tty_out->input), F_GETFL, 0) & ~O_NONBLOCK);
|
||||
#endif
|
||||
#endif /* F_SETFL */
|
||||
|
||||
if (tty_out->old_tty)
|
||||
while (emacs_set_tty (fileno (tty_out->input),
|
||||
|
@ -2377,19 +2373,7 @@ safe_strsignal (int code)
|
|||
int
|
||||
serial_open (char *port)
|
||||
{
|
||||
int fd = -1;
|
||||
|
||||
fd = emacs_open ((char*) port,
|
||||
O_RDWR
|
||||
#if O_NONBLOCK
|
||||
| O_NONBLOCK
|
||||
#else
|
||||
| O_NDELAY
|
||||
#endif
|
||||
#if O_NOCTTY
|
||||
| O_NOCTTY
|
||||
#endif
|
||||
, 0);
|
||||
int fd = emacs_open (port, O_RDWR | O_NOCTTY | O_NONBLOCK, 0);
|
||||
if (fd < 0)
|
||||
{
|
||||
error ("Could not open %s: %s",
|
||||
|
|
39
src/term.c
39
src/term.c
|
@ -20,8 +20,9 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
|
|||
/* New redisplay, TTY faces by Gerd Moellmann <gerd@gnu.org>. */
|
||||
|
||||
#include <config.h>
|
||||
#include <stdio.h>
|
||||
#include <errno.h>
|
||||
#include <fcntl.h>
|
||||
#include <stdio.h>
|
||||
#include <sys/file.h>
|
||||
#include <sys/time.h>
|
||||
#include <unistd.h>
|
||||
|
@ -55,14 +56,6 @@ static int been_here = -1;
|
|||
#include "xterm.h"
|
||||
#endif
|
||||
|
||||
#ifndef O_RDWR
|
||||
#define O_RDWR 2
|
||||
#endif
|
||||
|
||||
#ifndef O_NOCTTY
|
||||
#define O_NOCTTY 0
|
||||
#endif
|
||||
|
||||
/* The name of the default console device. */
|
||||
#ifdef WINDOWSNT
|
||||
#define DEV_TTY "CONOUT$"
|
||||
|
@ -2989,22 +2982,18 @@ init_tty (const char *name, const char *terminal_type, int must_succeed)
|
|||
set_tty_hooks (terminal);
|
||||
|
||||
{
|
||||
int fd;
|
||||
/* Open the terminal device. */
|
||||
FILE *file;
|
||||
|
||||
#if O_IGNORE_CTTY
|
||||
if (!ctty)
|
||||
/* Open the terminal device. Don't recognize it as our
|
||||
controlling terminal, and don't make it the controlling tty
|
||||
if we don't have one at the moment. */
|
||||
fd = emacs_open (name, O_RDWR | O_IGNORE_CTTY | O_NOCTTY, 0);
|
||||
else
|
||||
#endif /* O_IGNORE_CTTY */
|
||||
/* Alas, O_IGNORE_CTTY is a GNU extension that seems to be only
|
||||
defined on Hurd. On other systems, we need to explicitly
|
||||
dissociate ourselves from the controlling tty when we want to
|
||||
open a frame on the same terminal. */
|
||||
fd = emacs_open (name, O_RDWR | O_NOCTTY, 0);
|
||||
/* If !ctty, don't recognize it as our controlling terminal, and
|
||||
don't make it the controlling tty if we don't have one now.
|
||||
|
||||
Alas, O_IGNORE_CTTY is a GNU extension that seems to be only
|
||||
defined on Hurd. On other systems, we need to explicitly
|
||||
dissociate ourselves from the controlling tty when we want to
|
||||
open a frame on the same terminal. */
|
||||
int flags = O_RDWR | O_NOCTTY | (ctty ? 0 : O_IGNORE_CTTY);
|
||||
int fd = emacs_open (name, flags, 0);
|
||||
|
||||
tty->name = xstrdup (name);
|
||||
terminal->name = xstrdup (name);
|
||||
|
@ -3023,10 +3012,8 @@ init_tty (const char *name, const char *terminal_type, int must_succeed)
|
|||
name);
|
||||
}
|
||||
|
||||
#if !O_IGNORE_CTTY
|
||||
if (!ctty)
|
||||
if (!O_IGNORE_CTTY && !ctty)
|
||||
dissociate_if_controlling_tty (fd);
|
||||
#endif
|
||||
|
||||
file = fdopen (fd, "w+");
|
||||
tty->input = file;
|
||||
|
|
|
@ -5854,7 +5854,7 @@ fcntl (int s, int cmd, int options)
|
|||
check_errno ();
|
||||
if (fd_info[s].flags & FILE_SOCKET)
|
||||
{
|
||||
if (cmd == F_SETFL && options == O_NDELAY)
|
||||
if (cmd == F_SETFL && options == O_NONBLOCK)
|
||||
{
|
||||
unsigned long nblock = 1;
|
||||
int rc = pfn_ioctlsocket (SOCK_HANDLE (s), FIONBIO, &nblock);
|
||||
|
|
Loading…
Add table
Reference in a new issue