Mercurial > emacs
diff src/sysdep.c @ 82988:f82e3a6f5ccb
A few more bugfixes and new features.
(Sigh.) I obviously need to remember to separate individual changes
to multiple commits.
src/emacsclient.c: Improved error handling.
(decode_options): Changed frame option (again) from -f to -t.
(print_help_and_exit): Ditto.
(copy_from_to): Check EINTR after write, not EAGAIN. Removed SIGIO hack.
(pty_conversation): Handle errors transmitted through the socket.
Handle pty errors by not reading from it anymore.
(main): Restore correct errno after socket_status failed. Send -tty
on -t, not -pty.
lisp/server.el (server-process-filter): Watch -tty, not -pty.
Use make-frame-on-tty instead of make-terminal-frame.
Don't set newframe to t if make-frame-on-tty failed.
Don't delete frames here. Print correct message when there are no
files to edit, but a new frame was requested.
(server-sentinel): Delete the frame after the process.
(server-handle-delete-frame): New function for delete-frame-functions.
(server-start): Add server-handle-delete-frame to delete-frame-functions.
(server-buffer-done): Don't delete frames here.
src/alloc.c (mark_ttys): Add prototype.
(Fgarbage_collect): Call mark_ttys.
src/emacs.c: (shut_down_emacs): Don't flush stdout before
reset_sys_modes().
src/process.c (add_keyboard_wait_descriptor_called_flag): Removed.
(add_keyboard_wait_descriptor): Removed stdin hack.
src/sysdep.c: Unconditionally include sysselect.h.
(old_fcntl_flags): Changed to an array.
(init_sigio, reset_sigio): Use it.
(narrow_foreground_group, widen_foreground_group): Use setpgid, not
setpgrp.
(old_fcntl_owner): Changed to an array.
(init_sys_modes, reset_sys_modes): Use it. Fix fsync() and reset_sigio() calls.
src/term.c (Qframe_tty_name, Qframe_tty_type): New variables.
(syms_of_term): Initialize them.
(Fframe_tty_name, Fframe_tty_type): New functions.
(term_init): Call add_keyboard_wait_descriptor().
(Fdelete_tty): New function.
(delete_tty): Call delete_keyboard_wait_descriptor().
(get_current_tty): Removed.
(mark_ttys): New function.
git-archimport-id: lorentey@elte.hu--2004/emacs--multi-tty--0--patch-28
author | Karoly Lorentey <lorentey@elte.hu> |
---|---|
date | Wed, 31 Dec 2003 05:09:29 +0000 |
parents | 1682917e56b4 |
children | f3845715a5f6 |
line wrap: on
line diff
--- a/src/sysdep.c Tue Dec 30 19:27:57 2003 +0000 +++ b/src/sysdep.c Wed Dec 31 05:09:29 2003 +0000 @@ -45,6 +45,8 @@ #endif #endif +#include "sysselect.h" + #include "blockinput.h" #undef NULL @@ -913,16 +915,15 @@ #ifdef F_SETFL -int old_fcntl_flags; +int old_fcntl_flags[MAXDESC]; void init_sigio (fd) int fd; { #ifdef FASYNC - /* XXX What if we get called with more than one fds? */ - old_fcntl_flags = fcntl (fd, F_GETFL, 0) & ~FASYNC; - fcntl (fd, F_SETFL, old_fcntl_flags | FASYNC); + old_fcntl_flags[fd] = fcntl (fd, F_GETFL, 0) & ~FASYNC; + fcntl (fd, F_SETFL, old_fcntl_flags[fd] | FASYNC); #endif interrupts_deferred = 0; } @@ -931,7 +932,7 @@ reset_sigio (fd) int fd; { - fcntl (fd, F_SETFL, old_fcntl_flags); + fcntl (fd, F_SETFL, old_fcntl_flags[fd]); } #ifdef FASYNC /* F_SETFL does not imply existence of FASYNC */ @@ -1086,11 +1087,12 @@ { int me = getpid (); - setpgrp (0, inherited_pgroup); + if (! inherited_pgroup) + inherited_pgroup = getpgid (0); /* XXX This only works on the controlling tty. */ if (inherited_pgroup != me) EMACS_SET_TTY_PGRP (fd, &me); - setpgrp (0, me); + setpgid (0, me); } /* Set the tty to our original foreground group. */ @@ -1099,7 +1101,7 @@ { if (inherited_pgroup != getpid ()) EMACS_SET_TTY_PGRP (fd, &inherited_pgroup); - setpgrp (0, inherited_pgroup); + setpgid (0, inherited_pgroup); } #endif /* BSD_PGRPS */ @@ -1265,7 +1267,7 @@ #ifndef F_SETOWN_BUG #ifdef F_SETOWN -int old_fcntl_owner; +int old_fcntl_owner[MAXDESC]; #endif /* F_SETOWN */ #endif /* F_SETOWN_BUG */ @@ -1614,7 +1616,8 @@ if (interrupt_input && ! read_socket_hook && EQ (Vwindow_system, Qnil)) { - old_fcntl_owner = fcntl (fileno (TTY_INPUT (tty_out)), F_GETOWN, 0); + old_fcntl_owner[fileno (TTY_INPUT (tty_out))] = + fcntl (fileno (TTY_INPUT (tty_out)), F_GETOWN, 0); fcntl (fileno (TTY_INPUT (tty_out)), F_SETOWN, getpid ()); init_sigio (fileno (TTY_INPUT (tty_out))); } @@ -1823,9 +1826,12 @@ ) return; #endif + cmgoto (tty_out, FrameRows (tty_out) - 1, 0); tty_clear_end_of_line (tty_out, FrameCols (tty_out)); cmgoto (tty_out, FrameRows (tty_out) - 1, 0); + fflush (tty_out->output); + #if defined (IBMR2AIX) && defined (AIXHFT) { /* HFT devices normally use ^J as a LF/CR. We forced it to @@ -1842,7 +1848,7 @@ #ifdef BSD_SYSTEM #ifndef BSD4_1 /* Avoid possible loss of output when changing terminal modes. */ - fsync (TTY_OUTPUT (tty_out)); + fsync (fileno (TTY_OUTPUT (tty_out))); #endif #endif @@ -1851,8 +1857,9 @@ #ifdef F_SETOWN /* F_SETFL does not imply existence of F_SETOWN */ if (interrupt_input) { - reset_sigio (tty_out); - fcntl (fileno (TTY_INPUT (tty_out)), F_SETOWN, old_fcntl_owner); + reset_sigio (fileno (TTY_INPUT (tty_out))); + fcntl (fileno (TTY_INPUT (tty_out)), F_SETOWN, + old_fcntl_owner[fileno (TTY_INPUT (tty_out))]); } #endif /* F_SETOWN */ #endif /* F_SETOWN_BUG */ @@ -1863,7 +1870,7 @@ #endif /* F_SETFL */ #ifdef BSD4_1 if (interrupt_input) - reset_sigio (tty_out); + reset_sigio (fileno (TTY_INPUT (tty_out))); #endif /* BSD4_1 */ if (tty_out->old_tty) @@ -2704,6 +2711,10 @@ } } +#if !defined (HAVE_SELECT) || defined (BROKEN_SELECT_NON_X) +#define select sys_select +#endif + #endif /* not HAVE_SELECT */ #endif /* not VMS */ #endif /* not MSDOS */