1992-03-14 20:40:04 +00:00
|
|
|
|
/* Asynchronous subprocess control for GNU Emacs.
|
2005-08-07 12:33:19 +00:00
|
|
|
|
Copyright (C) 1985, 1986, 1987, 1988, 1993, 1994, 1995,
|
2009-01-01 15:58:38 +00:00
|
|
|
|
1996, 1998, 1999, 2001, 2002, 2003, 2004,
|
2010-01-13 00:35:10 -08:00
|
|
|
|
2005, 2006, 2007, 2008, 2009, 2010 Free Software Foundation, Inc.
|
1992-03-14 20:40:04 +00:00
|
|
|
|
|
|
|
|
|
This file is part of GNU Emacs.
|
|
|
|
|
|
2008-05-14 07:50:26 +00:00
|
|
|
|
GNU Emacs is free software: you can redistribute it and/or modify
|
1992-03-14 20:40:04 +00:00
|
|
|
|
it under the terms of the GNU General Public License as published by
|
2008-05-14 07:50:26 +00:00
|
|
|
|
the Free Software Foundation, either version 3 of the License, or
|
|
|
|
|
(at your option) any later version.
|
1992-03-14 20:40:04 +00:00
|
|
|
|
|
|
|
|
|
GNU Emacs 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
|
2008-05-14 07:50:26 +00:00
|
|
|
|
along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
|
1992-03-14 20:40:04 +00:00
|
|
|
|
|
|
|
|
|
|
1993-09-10 06:15:46 +00:00
|
|
|
|
#include <config.h>
|
Add support for large files, 64-bit Solaris, system locale codings.
* Makefile.in (emacs): Set the LC_ALL environment variable to "C"
when dumping, so that the dumped Emacs doesn't have stray locale info.
(dired.o): Depend on systime.h.
(editfns.o): Depend on coding.h.
* alloc.c, buffer.c, callproc.c, ccl.c, charset.c, coding.c, data.c,
dispnew.c, editfns.c, emacs.c, filelock.c, floatfns.c, hftctl.c,
keyboard.c, process.c, sysdep.c, unexelf.c, unexhp9k800.c,
unexsunos4.c, vmsfns.c, vmsgmalloc.c, w32faces.c, w32menu.c, w32term.c,
w32xfns.c, xfaces.c, xfns.c, xmenu.c, xterm.c:
Include <config.h> before any system include files.
* alloc.c, buffer.c, ccl.c, data.c, editfns.c, emacs.c, eval.c,
fileio.c, filelock.c, frame.c, insdel.c, keymap.c, lread.c,
m/alpha.h, print.c, search.c, sysdep.c, xdisp.c, xfaces.c, xfns.c,
xmenu.c, xterm.c:
Do not include <stdlib.h>, as <config.h> does this now.
* callproc.c (Fcall_process):
Synchronize messages locale before invoking strerror.
Decode resulting string with locale-coding-system.
* coding.c (Vlocale_coding_system): New var.
(syms_of_coding): Adjust to above change.
(emacs_strerror): New function.
* coding.h (emacs_strerror, Vlocale_coding_system): New decls.
* config.in (HAVE_STDIO_EXT_H, HAVE_TM_GMTOFF, HAVE___FPENDING,
HAVE_FTELLO, HAVE_GETLOADAVG, HAVE_MBLEN, HAVE_MBRLEN,
HAVE_STRSIGNAL): New macros.
(BITS_PER_LONG): Default to 64 if _LP64 is defined.
<stdlib.h>: Include if HAVE_STDLIB_H is defined and NOT_C_CODE isn't.
* dired.c: Include "systime.h".
(Ffile_attributes): Do not cast s.st_size to int; this loses
information if int is 32 bits but st_size and EMACS_INT are larger.
Treat large device numbers like large inode numbers.
* dispnew.c (PENDING_OUTPUT_COUNT): Use __fpending if available.
* editfns.c: Include coding.h.
(emacs_strftime): Remove decl.
(emacs_strftimeu): New decl.
(emacs_memftimeu): Renamed from emacs_memftime; new arg UT.
Use emacs_strftimeu instead of emacs_strftime.
(Fformat_time_string): Convert format string using
Vlocale_coding_system, and convert result back. Synchronize time
locale before invoking lower level function. Invoke
emacs_memftimeu, passing ut, instead of emacs_memftime.
* emacs.c: Include <locale.h> if HAVE_SETLOCALE is defined.
(Vmessages_locale, Vprevious_messages_locale, Vtime_locale,
Vprevious_time_locale): New variables.
(main): Invoke setlocale early, so that initial error messages are
localized properly. But skip locale-setting if LC_ALL is "C".
Fix up locale when it's safe to do so.
(fixup_locale): Moved here from xterm.c.
(synchronize_locale, synchronize_time_locale,
synchronize_messages_locale): New functions.
(syms_of_emacs): Accommodate above changes.
* fileio.c (report_file_error): Convert strerror output according
to Vlocale_coding_system.
(Finsert_file_contents): Check for arithmetic overflow in
computations that depend on file size. Report IO errors
with emacs_strerror, not strerror.
* fns.c (Fgethash): Declare dflt parameter.
* gmalloc.c: Do not define const to nothing if HAVE_CONFIG_H
is defined; that's config.h's job.
* lisp.h (EMACS_INT, BITS_PER_EMACS_INT, EMACS_UINT): If _LP64,
default these values to long, BITS_PER_LONG, and unsigned long.
(VALBITS, MARKBIT, XINT): Do not assume 32-bit EMACS_INT.
(PNTR_COMPARISON_TYPE): Default to EMACS_UINT, not to unsigned int.
(code_convert_string_norecord, fixup_locale,
synchronize_messages_locale, synchronize_time_locale,
emacs_open, emacs_close, emacs_read, emacs_write): New decls.
All Emacs callers of open, close, read, write changed to use
emacs_open, emacs_close, emacs_read, emacs_write.
* lread.c (file_offset, file_tell): New macros. All uses of ftell
changed to file_tell.
(saved_doc_string_position, prev_saved_doc_string_position): Now
of type file_offset.
(init_lread): Do not fix locale here; fixup_locale now does this.
* m/amdahl.h, s/usg5-4.h:
(NSIG): Remove.
(NSIG_MINIMUM): New macro.
* m/cydra5.h, m/dpx2.h, m/mips.h, m/pfa50.h, m/sps7.h, m/stride.h,
m/ustation.h, s/gnu-linux.h, s/hpux.h, s/iris3-5.h, s/iris3-6.h,
s/umips.h, s/usg5-4.h:
(SIGIO): Do not undef.
(BROKEN_SIGIO): New macro.
* m/ustation.h:
(SIGTSTP): Do not undef.
(BROKEN_SIGTSTP): New macro.
* s/gnu-linux.h:
(SIGPOLL, SIGURG): Do not undef.
(BROKEN_SIGPOLL, BROKEN_SIGURG): New macros.
* s/ptx4.h:
(SIGINFO): Do not undef.
(BROKEN_SIGINFO): New macros.
* m/delta.h, s/ptx.h, s/template.h: Doc fix.
* mktime.c, strftime.c: Update to glibc 2.1.2 version, with
some Emacs-related changes merged.
* print.c (float_to_string): Prepend "-" to representation of a
NaN if the NaN is negative.
* process.c (sys_siglist): Omit if HAVE_STRSIGNAL.
(wait_reading_process_input): Use emacs_strerror, not strerror.
* process.c (status_message, sigchld_handler): Synchronize locale,
then use strsignal istead of sys_siglist.
* w32proc.c (sys_wait): Likewise.
* s/aix3-1.h, s/bsd4-1.h, s/dgux.h, s/gnu-linux.h, s/hiuxmpp.h,
s/hpux.h, s/iris3-5.h, s/iris3-6.h, s/irix3-3.h, s/osf1.h, s/rtu.h,
s/sunos4-1.h, s/unipl5-0.h, s/unipl5-2.h, s/usg5-0.h, s/usg5-2-2.h,
s/usg5-2.h, s/usg5-3.h, s/xenix.h:
(open, close, read, write, INTERRUPTIBLE_OPEN,
INTERRUPTIBLE_CLOSE, INTERRUPTIBLE_IO): Remove.
* s/sol2-5.h (_LARGEFILE_SOURCE, _FILE_OFFSET_BITS): New macros.
* sysdep.c (sys_read, sys_write, read, write, sys_close, close,
sys_open, open): Remove.
(emacs_open, emacs_close, emacs_read, emacs_write): Always define;
the old INTERRUPTIBLE_OPEN, INTERRUPTIBLE_CLOSE, and INTERRUPTIBLE_IO
macros are no longer used.
(emacs_open): Renamed from sys_open. Merge BSD4_1 version.
(emacs_close): Renamed from sys_close.
(emacs_read): Renamed from sys_read.
(emacs_write): Renamed from sys_write.
(sys_siglist): Do not declare if HAVE_STRSIGNAL.
(dup2): Do not print error on failure; the real dup2 doesn't.
(strsignal): New function, defined if !HAVE_STRSIGNAL.
* syssignal.h (SIGINFO): Undef if defined and if BROKEN_SIGINFO
is defined.
(SIGIO, SIGPOLL, SIGTSTP, SIGURG): Likewise.
(NSIG): If less than NSIG_MINIMUM, define to NSIG_MINIMUM.
(strsignal): Declare if !HAVE_STRSIGNAL.
* unexelf.c (ElfBitsW, ELFSIZE, ElfExpandBitsW): New macros.
(ElfW): Define in terms of ElfExpandBitsW.
* w32proc.c (sys_siglist): Remove decl.
* xdisp.c (decode_mode_spec): 3rd arg is int, not char, to comply
with ANSI C.
(display_string): Declare face_string_pos arg.
* xfns.c (Fx_show_tip): Declare timeout param.
* xterm.c: No need to include locale.h.
(x_alloc_lighter_color, x_setup_relief_color):
Pass arg as double, not float, for compatibility with ANSI C.
(fixup_locale): Move to emacs.c.
(x_term_init): Do not setlocale or fixup locale; the main program
does this now.
1999-10-19 07:25:11 +00:00
|
|
|
|
#include <signal.h>
|
1992-03-14 20:40:04 +00:00
|
|
|
|
#include <stdio.h>
|
|
|
|
|
#include <errno.h>
|
|
|
|
|
#include <setjmp.h>
|
|
|
|
|
#include <sys/types.h> /* some typedefs are used in sys/file.h */
|
|
|
|
|
#include <sys/file.h>
|
|
|
|
|
#include <sys/stat.h>
|
2009-10-19 04:27:09 +00:00
|
|
|
|
#include <setjmp.h>
|
2006-01-12 08:16:12 +00:00
|
|
|
|
#ifdef HAVE_INTTYPES_H
|
|
|
|
|
#include <inttypes.h>
|
|
|
|
|
#endif
|
2009-01-01 15:58:38 +00:00
|
|
|
|
#ifdef STDC_HEADERS
|
|
|
|
|
#include <stdlib.h>
|
|
|
|
|
#endif
|
2008-08-02 16:27:44 +00:00
|
|
|
|
|
1994-03-02 22:50:31 +00:00
|
|
|
|
#ifdef HAVE_UNISTD_H
|
|
|
|
|
#include <unistd.h>
|
|
|
|
|
#endif
|
1994-11-01 08:31:31 +00:00
|
|
|
|
#include <fcntl.h>
|
|
|
|
|
|
2010-07-10 16:26:44 +03:00
|
|
|
|
/* Only MS-DOS does not define `subprocesses'. */
|
|
|
|
|
#ifdef subprocesses
|
|
|
|
|
|
1992-03-14 20:40:04 +00:00
|
|
|
|
#include <sys/socket.h>
|
|
|
|
|
#include <netdb.h>
|
|
|
|
|
#include <netinet/in.h>
|
|
|
|
|
#include <arpa/inet.h>
|
(Qlocal, QCname, QCbuffer, QChost, QCservice, QCfamily)
(QClocal, QCremote, QCserver, QCdatagram, QCnowait, QCnoquery,QCstop)
(QCcoding, QCoptions, QCfilter, QCsentinel, QClog, QCfeature):
New variables.
(NETCONN1_P): New macro.
(DATAGRAM_SOCKETS): New conditional symbol.
(datagram_address): New array.
(DATAGRAM_CONN_P, DATAGRAM_CHAN_P): New macros.
(status_message): Use concat3.
(Fprocess_status): Add `listen' status to doc string. Return `stop'
for a stopped network process.
(Fset_process_buffer): Update contact plist for network process.
(Fset_process_filter): Ditto. Don't enable input for stopped
network processes. Server must listen, even if filter is t.
(Fset_process_query_on_exit_flag, Fprocess_query_on_exit_flag):
New functions.
(Fprocess_kill_without_query): Removed. Now defined in simple.el.
(Fprocess_contact): Added KEY argument. Handle datagrams.
(list_processes_1): Optionally show only processes with the query
on exit flag set. Dynamically adjust column widths. Omit tty
column if not needed. Report stopped network processes.
Identify server and datagram network processes.
(Flist_processes): New optional arg `query-only'.
(conv_sockaddr_to_lisp, get_lisp_to_sockaddr_size)
(conv_lisp_to_sockaddr, set_socket_options)
(network_process_featurep, unwind_request_sigio): New helper functions.
(Fprocess_datagram_address, Fset_process_datagram_address):
(Fset_network_process_options): New lisp functions.
(Fopen_network_stream): Removed. Now defined in simple.el.
(Fmake_network_process): New lisp function. Code is based on previous
Fopen_network_stream, but heavily reworked with new property list based
argument list, support for datagrams, server processes, and local
sockets in addition to old client-only functionality.
(server_accept_connection): New function.
(wait_reading_process_input): Use it to handle incoming connects.
Do not enable input on a new connection if process is stopped.
(read_process_output): Handle datagram sockets. Use 2k buffer for them.
(send_process): Handle datagram sockets.
(Fstop_process, Fcontinue_process): Apply to network processes. A stopped
network process is indicated by setting command field to t .
(Fprocess_send_eof): No-op if datagram connection.
(Fstatus_notify): Don't read input for a stream server socket or a
stopped network process.
(init_process): Initialize datagram_address array.
(syms_of_process): Intern and staticpro new variables, defsubr new
functions.
2002-03-17 20:20:33 +00:00
|
|
|
|
|
|
|
|
|
/* Are local (unix) sockets supported? */
|
2008-02-09 18:03:10 +00:00
|
|
|
|
#if defined (HAVE_SYS_UN_H)
|
(Qlocal, QCname, QCbuffer, QChost, QCservice, QCfamily)
(QClocal, QCremote, QCserver, QCdatagram, QCnowait, QCnoquery,QCstop)
(QCcoding, QCoptions, QCfilter, QCsentinel, QClog, QCfeature):
New variables.
(NETCONN1_P): New macro.
(DATAGRAM_SOCKETS): New conditional symbol.
(datagram_address): New array.
(DATAGRAM_CONN_P, DATAGRAM_CHAN_P): New macros.
(status_message): Use concat3.
(Fprocess_status): Add `listen' status to doc string. Return `stop'
for a stopped network process.
(Fset_process_buffer): Update contact plist for network process.
(Fset_process_filter): Ditto. Don't enable input for stopped
network processes. Server must listen, even if filter is t.
(Fset_process_query_on_exit_flag, Fprocess_query_on_exit_flag):
New functions.
(Fprocess_kill_without_query): Removed. Now defined in simple.el.
(Fprocess_contact): Added KEY argument. Handle datagrams.
(list_processes_1): Optionally show only processes with the query
on exit flag set. Dynamically adjust column widths. Omit tty
column if not needed. Report stopped network processes.
Identify server and datagram network processes.
(Flist_processes): New optional arg `query-only'.
(conv_sockaddr_to_lisp, get_lisp_to_sockaddr_size)
(conv_lisp_to_sockaddr, set_socket_options)
(network_process_featurep, unwind_request_sigio): New helper functions.
(Fprocess_datagram_address, Fset_process_datagram_address):
(Fset_network_process_options): New lisp functions.
(Fopen_network_stream): Removed. Now defined in simple.el.
(Fmake_network_process): New lisp function. Code is based on previous
Fopen_network_stream, but heavily reworked with new property list based
argument list, support for datagrams, server processes, and local
sockets in addition to old client-only functionality.
(server_accept_connection): New function.
(wait_reading_process_input): Use it to handle incoming connects.
Do not enable input on a new connection if process is stopped.
(read_process_output): Handle datagram sockets. Use 2k buffer for them.
(send_process): Handle datagram sockets.
(Fstop_process, Fcontinue_process): Apply to network processes. A stopped
network process is indicated by setting command field to t .
(Fprocess_send_eof): No-op if datagram connection.
(Fstatus_notify): Don't read input for a stream server socket or a
stopped network process.
(init_process): Initialize datagram_address array.
(syms_of_process): Intern and staticpro new variables, defsubr new
functions.
2002-03-17 20:20:33 +00:00
|
|
|
|
#if !defined (AF_LOCAL) && defined (AF_UNIX)
|
|
|
|
|
#define AF_LOCAL AF_UNIX
|
|
|
|
|
#endif
|
|
|
|
|
#ifdef AF_LOCAL
|
|
|
|
|
#define HAVE_LOCAL_SOCKETS
|
|
|
|
|
#include <sys/un.h>
|
|
|
|
|
#endif
|
|
|
|
|
#endif
|
1992-03-14 20:40:04 +00:00
|
|
|
|
|
2010-03-31 13:39:03 -07:00
|
|
|
|
#if defined(HAVE_SYS_IOCTL_H)
|
1992-03-14 20:40:04 +00:00
|
|
|
|
#include <sys/ioctl.h>
|
1992-08-19 06:35:23 +00:00
|
|
|
|
#if !defined (O_NDELAY) && defined (HAVE_PTYS) && !defined(USG5)
|
1992-03-14 20:40:04 +00:00
|
|
|
|
#include <fcntl.h>
|
|
|
|
|
#endif /* HAVE_PTYS and no O_NDELAY */
|
2010-03-31 13:39:03 -07:00
|
|
|
|
#endif /* HAVE_SYS_IOCTL_H */
|
1992-03-14 20:40:04 +00:00
|
|
|
|
|
|
|
|
|
#ifdef NEED_BSDTTY
|
|
|
|
|
#include <bsdtty.h>
|
|
|
|
|
#endif
|
|
|
|
|
|
2004-04-16 12:51:06 +00:00
|
|
|
|
/* Can we use SIOCGIFCONF and/or SIOCGIFADDR */
|
|
|
|
|
#if defined(HAVE_SYS_IOCTL_H) && defined(HAVE_NET_IF_H)
|
|
|
|
|
/* sys/ioctl.h may have been included already */
|
|
|
|
|
#ifndef SIOCGIFADDR
|
|
|
|
|
#include <sys/ioctl.h>
|
|
|
|
|
#endif
|
|
|
|
|
#include <net/if.h>
|
|
|
|
|
#endif
|
|
|
|
|
|
2002-10-30 19:16:32 +00:00
|
|
|
|
#ifdef HAVE_SYS_WAIT
|
|
|
|
|
#include <sys/wait.h>
|
|
|
|
|
#endif
|
1992-03-14 20:40:04 +00:00
|
|
|
|
|
2007-10-17 15:57:30 +00:00
|
|
|
|
#ifdef HAVE_RES_INIT
|
|
|
|
|
#include <netinet/in.h>
|
|
|
|
|
#include <arpa/nameser.h>
|
|
|
|
|
#include <resolv.h>
|
|
|
|
|
#endif
|
|
|
|
|
|
Fix missing prototypes for HAVE_NS (caused crash) and vrious warnings.
* configure.in: Check for util.h.
* src/bidi.c (bidi_dump_cached_states): Fix fprintf warning.
* src/emacs.c: Include src/nsterm.h if HAVE_NS.
* src/image.c (xpm_scan, xpm_make_color_table_v)
(xpm_put_color_table_v, xpm_get_color_table_v)
(xpm_make_color_table_h, xpm_put_color_table_h)
(xpm_get_color_table_h, xpm_str_to_color_key, xpm_load_image)
(xpm_load): Convert to ANSI C prototypes.
* src/lisp.h (fmod_float): Declare.
* src/menu.h (x_set_menu_bar_line): Declare.
(free_menubar_widget_value_tree et.al): Add HAVE_NS for these functions.
* src/window.c: Include menu.h.
* src/nsfns.m (have_menus_p, ns_display_info_for_name)
(x_set_cursor_type, ns_appkit_version_str)
(ns_appkit_version_int, ns_do_applescript)
(x_set_scroll_bar_default_width, x_sync, compute_tip_xy)
(syms_of_nsfns): Convert to ANSI C prototypes.
* src/nsfont.m (ns_fallback_entity, syms_of_nsfont): Convert to ANSI C
prototypes.
* src/nsimage.m (ns_load_image): Move NSTRACE after declarations.
* src/nsmenu.m (popup_activated, name_is_separator)
(syms_of_nsmenu): Convert to ANSI C prototypes.
(runMenuAt): Prototypes and move declarations before code.
* src/nsterm.h : Include sysselect.h.
(x_sync, x_get_focus_frame, x_set_mouse_position)
(x_set_mouse_pixel_position, x_make_frame_visible)
(x_make_frame_invisible, x_iconify_frame, x_char_width, x_char_height)
(x_pixel_width, x_pixel_height, x_set_frame_alpha, x_set_tool_bar_lines)
(x_activate_menubar, free_frame_menubar, ns_init_paths, ns_select)
(syms_of_nsterm, syms_of_nsfns, syms_of_nsmenu, syms_of_nsselect):
Declare
* src/process.c: Check HAVE_UTIL_H. Include src/nsterm.h if HAVE_NS.
* src/nsterm.m (ns_init_paths, ns_alloc_autorelease_pool)
(ns_ring_bell, ns_defined_color, hide_hourglass)
(x_display_pixel_height, x_display_pixel_width, syms_of_nsterm):
Convert to ANSI C prototypes.
(x_set_window_size, ns_draw_fringe_bitmap, judge): Move declarations
before code.
* src/sysdep.c: Check HAVE_TERM_H
* src/term.c: Check HAVE_SYS_IOCTL_H.
* src/unexmacosx.c (print_region_list, print_regions)
(build_region_list, find_emacs_zone_regions)
(unexec_regions_merge, read_load_commands, dump_it)
(unexec_init_emacs_zone): Convert to ANSI C prototypes.
* src/xfaces.c (x_create_gc, x_free_gc): Convert to ANSI C prototypes.
2010-08-06 12:12:41 +02:00
|
|
|
|
#ifdef HAVE_UTIL_H
|
|
|
|
|
#include <util.h>
|
|
|
|
|
#endif
|
|
|
|
|
|
2010-07-10 16:26:44 +03:00
|
|
|
|
#endif /* subprocesses */
|
|
|
|
|
|
2005-09-30 22:38:16 +00:00
|
|
|
|
#include "lisp.h"
|
1992-03-14 20:40:04 +00:00
|
|
|
|
#include "systime.h"
|
1992-08-29 03:05:43 +00:00
|
|
|
|
#include "systty.h"
|
1992-03-14 20:40:04 +00:00
|
|
|
|
|
|
|
|
|
#include "window.h"
|
|
|
|
|
#include "buffer.h"
|
2002-03-01 01:45:23 +00:00
|
|
|
|
#include "character.h"
|
1997-02-20 06:53:55 +00:00
|
|
|
|
#include "coding.h"
|
1992-03-14 20:40:04 +00:00
|
|
|
|
#include "process.h"
|
Converted display hooks to be display-local. Plus many bugfixes.
lib-src/emacsclient.c (window_change_signal): Renamed to pass_signal_to_emacs.
(init_signal): Pass SIGINT and SIGQUIT to the emacs process.
lisp/faces.el (face-valid-attribute-values): Use the window-system
function, not the variable.
(read-face-attribute, face-spec-set-match-display, frame-set-background-mode)
(face-set-after-frame-default): Ditto.
lisp/frame.el (make-frame-on-tty): Added interactive declaration
(suggested by Robert J. Chassell). Use tty-create-frame-with-faces,
not make-terminal-frame.
src/termhooks.h (struct display_method): Renamed to display for brevity.
(struct display): Added all display hook variables as members of this structure.
Added next_display, reference_count, type and display_info components.
(FRAME_MUST_WRITE_SPACES, FRAME_FAST_CLEAR_END_OF_LINE, FRAME_LINE_INS_DEL_OK)
(FRAME_CHAR_INS_DEL_OK, FRAME_SCROLL_REGION_OK, FRAME_SCROLL_REGION_COST)
(FRAME_MEMORY_BELOW_FRAME, FRAME_RIF): Updated for struct display.
(FRAME_DISPLAY): New macro.
(create_display, delete_display): New prototypes.
src/frame.h (struct frame): Added `display' member, removed display_method.
(FRAME_LIVE_P): Look at f->display, not f->output_data.
src/termchar.h (struct tty_display_info): Removed display_method component.
(FRAME_TTY): Use the display structure, not output_data.
src/term.c (display_list): New variable.
(cursor_to_hook, raw_cursor_to_hook, clear_to_end_hook, clear_frame_hook)
(clear_end_of_line_hook, ins_del_lines_hook, delete_glyphs_hook)
(ring_bell_hook, reset_terminal_modes_hook, set_terminal_modes_hook)
(update_begin_hook, update_end_hook, set_terminal_window_hook)
(insert_glyphs_hook, write_glyphs_hook, delete_glyphs_hoo, read_socket_hook)
(frame_up_to_date_hook, mouse_position_hook, frame_rehighlight_hook)
(frame_raise_lower_hook, set_vertical_scroll_bar_hook, condemn_scroll_bars_hook)
(redeem_scroll_bar_hook, judge_scroll_bars_hook): Moved to struct display.
(tty_display_method_template): Removed.
(syms_of_term): Don't initialize tty_display_method_template.
(ring_bell, set_terminal_modes, reset_terminal_modes, update_begin)
(update_end, set_terminal_window, cursor_to, raw_cursor_to, clear_to_end)
(clear_frame, clear_end_of_line, write_glyphs, insert_glyphs)
(delete_glyphs, ins_del_lines): Access display hooks through the frame pointer.
(Ftty_display_color_p): Use the frame given as a parameter, or else return nil.
(Ftty_display_color_cells): Ditto.
(get_named_tty): Renamed to get_named_tty_display, changed return type to struct display.
(term_dummy_init): Renamed to initial_term_init. Create and return an initial display.
(term_init): Initialize a new struct display and return a pointer to
it instead of tty_display_info. Removed frame initialization kludge.
(Fdelete_tty): Updated for struct display.
(delete_tty): The parameter type is now struct display, not tty_display_info.
Delete the display, too.
(create_tty_output): New function for creating tty_output structures.
(delete_tty_output): New function for deleting tty_output structures.
(create_display): New function for creating and registering display structures.
(delete_display): New function for deleting and unregistering display structures.
src/dispextern.h: Updated prototypes.
src/dispnew.c: Include frame.h before termhooks.h.
(init_display): Updated term_init call to new signature.
src/emacs.c: Include frame.h (for termhooks.h).
src/keymap.c: Ditto.
src/lread.c: Ditto.
src/xsmfns.c: Ditto.
src/process.c: Include frame.h before termhooks.h.
src/frame.c (Fwindow_system): New function.
(syms_of_frame): Initialize it.
(make_terminal_frame): Open the terminal device before creating the new frame.
Disable scrollbars here, term_init cannot do that anymore.
(Fdelete_frame): Use the new delete_frame_hook, don't do display-specific
frame deletion here. Ditto for delete_display_hook.
(Fmouse_position, Fmouse_pixel_position, Fraise_frame, Flower_frame)
(Fredirect_frame_focus): Access display hooks through the frame pointer.
src/keyboard.c: Include frame.h before termhooks.h.
(start_polling, input_polling_used, stop_polling, gobble_input): Ignore read_socket_hook.
(kbd_buffer_get_event, Fset_input_mode): Access display hooks through the frame pointer.
(read_avail_input): Loop through all display devices for and call all read_socket_hook functions. Check ttys even if read_socket_hook returned an error.
src/sysdep.c (discard_tty_input): Ignore read_socket_hook.
(stuff_char): Don't do anything if the current frame is not on a termcap display.
(request_sigio, unrequest_sigio): Ignore read_socket_hook.
(init_sys_modes): Always call narrow_foreground_group. Set up terminal modes and sigio even under X.
src/xdisp.c (message2_nolog, message3_nolog, redisplay_internal)
(set_vertical_scroll_bar, redisplay_window): Access display hooks through the frame pointer.
(echo_area_display): Don't be afraid of termcap frames during an X+tty combo session.
src/xfaces.c: Include termhooks.h.
(Ftty_supports_face_attributes_p): Use the given frame, not selected_frame.
src/xfns.c (x_set_scroll_bar_foreground, x_set_scroll_bar_background): Access display hooks through the frame pointer.
(Fx_create_frame, x_create_tip_frame): Initialize the frame's display structure.
src/xmenu.c: Include termhooks.h after frame.h.
src/xselect.c (x_own_selection, some_frame_on_display, x_get_foreign_selection)
(Fx_disown_selection_internal, Fx_get_cut_buffer_internal)
(Fx_store_cut_buffer_internal, Fx_rotate_cut_buffers_internal): Don't do anything
if the selected frame is not an X frame.
src/xterm.c (x_display_method): Removed.
(x_create_frame_display, x_delete_frame_display): New functions for handling struct display objects.
(x_term_init): Set up a new struct display object, too.
(x_delete_display): Delete the struct display corresponding to the X display.
(x_initialize): Moved hook initialization to x_create_frame_display.
src/xterm.h (x_display_method): Removed.
(struct x_display_info): Added frame_display component.
git-archimport-id: lorentey@elte.hu--2004/emacs--multi-tty--0--patch-44
2004-01-05 05:54:35 +00:00
|
|
|
|
#include "frame.h"
|
1992-03-14 20:40:04 +00:00
|
|
|
|
#include "termhooks.h"
|
|
|
|
|
#include "termopts.h"
|
|
|
|
|
#include "commands.h"
|
2000-08-22 22:36:52 +00:00
|
|
|
|
#include "keyboard.h"
|
1996-12-30 01:26:08 +00:00
|
|
|
|
#include "blockinput.h"
|
1998-04-14 12:25:56 +00:00
|
|
|
|
#include "dispextern.h"
|
1999-12-15 00:17:54 +00:00
|
|
|
|
#include "composite.h"
|
2000-01-25 15:56:42 +00:00
|
|
|
|
#include "atimer.h"
|
2010-07-10 16:26:44 +03:00
|
|
|
|
#include "sysselect.h"
|
|
|
|
|
#include "syssignal.h"
|
|
|
|
|
#include "syswait.h"
|
1992-03-14 20:40:04 +00:00
|
|
|
|
|
2009-11-21 15:28:59 +00:00
|
|
|
|
#if defined (USE_GTK) || defined (HAVE_GCONF)
|
|
|
|
|
#include "xgselect.h"
|
|
|
|
|
#endif /* defined (USE_GTK) || defined (HAVE_GCONF) */
|
Fix missing prototypes for HAVE_NS (caused crash) and vrious warnings.
* configure.in: Check for util.h.
* src/bidi.c (bidi_dump_cached_states): Fix fprintf warning.
* src/emacs.c: Include src/nsterm.h if HAVE_NS.
* src/image.c (xpm_scan, xpm_make_color_table_v)
(xpm_put_color_table_v, xpm_get_color_table_v)
(xpm_make_color_table_h, xpm_put_color_table_h)
(xpm_get_color_table_h, xpm_str_to_color_key, xpm_load_image)
(xpm_load): Convert to ANSI C prototypes.
* src/lisp.h (fmod_float): Declare.
* src/menu.h (x_set_menu_bar_line): Declare.
(free_menubar_widget_value_tree et.al): Add HAVE_NS for these functions.
* src/window.c: Include menu.h.
* src/nsfns.m (have_menus_p, ns_display_info_for_name)
(x_set_cursor_type, ns_appkit_version_str)
(ns_appkit_version_int, ns_do_applescript)
(x_set_scroll_bar_default_width, x_sync, compute_tip_xy)
(syms_of_nsfns): Convert to ANSI C prototypes.
* src/nsfont.m (ns_fallback_entity, syms_of_nsfont): Convert to ANSI C
prototypes.
* src/nsimage.m (ns_load_image): Move NSTRACE after declarations.
* src/nsmenu.m (popup_activated, name_is_separator)
(syms_of_nsmenu): Convert to ANSI C prototypes.
(runMenuAt): Prototypes and move declarations before code.
* src/nsterm.h : Include sysselect.h.
(x_sync, x_get_focus_frame, x_set_mouse_position)
(x_set_mouse_pixel_position, x_make_frame_visible)
(x_make_frame_invisible, x_iconify_frame, x_char_width, x_char_height)
(x_pixel_width, x_pixel_height, x_set_frame_alpha, x_set_tool_bar_lines)
(x_activate_menubar, free_frame_menubar, ns_init_paths, ns_select)
(syms_of_nsterm, syms_of_nsfns, syms_of_nsmenu, syms_of_nsselect):
Declare
* src/process.c: Check HAVE_UTIL_H. Include src/nsterm.h if HAVE_NS.
* src/nsterm.m (ns_init_paths, ns_alloc_autorelease_pool)
(ns_ring_bell, ns_defined_color, hide_hourglass)
(x_display_pixel_height, x_display_pixel_width, syms_of_nsterm):
Convert to ANSI C prototypes.
(x_set_window_size, ns_draw_fringe_bitmap, judge): Move declarations
before code.
* src/sysdep.c: Check HAVE_TERM_H
* src/term.c: Check HAVE_SYS_IOCTL_H.
* src/unexmacosx.c (print_region_list, print_regions)
(build_region_list, find_emacs_zone_regions)
(unexec_regions_merge, read_load_commands, dump_it)
(unexec_init_emacs_zone): Convert to ANSI C prototypes.
* src/xfaces.c (x_create_gc, x_free_gc): Convert to ANSI C prototypes.
2010-08-06 12:12:41 +02:00
|
|
|
|
#ifdef HAVE_NS
|
|
|
|
|
#include "nsterm.h"
|
|
|
|
|
#endif
|
2010-07-26 20:59:42 -07:00
|
|
|
|
extern int timers_run;
|
|
|
|
|
|
|
|
|
|
Lisp_Object Qeuid, Qegid, Qcomm, Qstate, Qppid, Qpgrp, Qsess, Qttname, Qtpgid;
|
|
|
|
|
Lisp_Object Qminflt, Qmajflt, Qcminflt, Qcmajflt, Qutime, Qstime, Qcstime;
|
|
|
|
|
Lisp_Object Qcutime, Qpri, Qnice, Qthcount, Qstart, Qvsize, Qrss, Qargs;
|
|
|
|
|
Lisp_Object Quser, Qgroup, Qetime, Qpcpu, Qpmem, Qtime, Qctime;
|
|
|
|
|
Lisp_Object QCname, QCtype;
|
|
|
|
|
|
|
|
|
|
/* Non-zero if keyboard input is on hold, zero otherwise. */
|
|
|
|
|
|
|
|
|
|
static int kbd_is_on_hold;
|
|
|
|
|
|
|
|
|
|
/* Nonzero means delete a process right away if it exits. */
|
|
|
|
|
static int delete_exited_processes;
|
|
|
|
|
|
|
|
|
|
/* Nonzero means don't run process sentinels. This is used
|
|
|
|
|
when exiting. */
|
|
|
|
|
int inhibit_sentinels;
|
|
|
|
|
|
2010-07-10 16:26:44 +03:00
|
|
|
|
#ifdef subprocesses
|
|
|
|
|
|
1993-09-08 17:53:11 +00:00
|
|
|
|
Lisp_Object Qprocessp;
|
2006-12-19 15:37:34 +00:00
|
|
|
|
Lisp_Object Qrun, Qstop, Qsignal;
|
(Qlocal, QCname, QCbuffer, QChost, QCservice, QCfamily)
(QClocal, QCremote, QCserver, QCdatagram, QCnowait, QCnoquery,QCstop)
(QCcoding, QCoptions, QCfilter, QCsentinel, QClog, QCfeature):
New variables.
(NETCONN1_P): New macro.
(DATAGRAM_SOCKETS): New conditional symbol.
(datagram_address): New array.
(DATAGRAM_CONN_P, DATAGRAM_CHAN_P): New macros.
(status_message): Use concat3.
(Fprocess_status): Add `listen' status to doc string. Return `stop'
for a stopped network process.
(Fset_process_buffer): Update contact plist for network process.
(Fset_process_filter): Ditto. Don't enable input for stopped
network processes. Server must listen, even if filter is t.
(Fset_process_query_on_exit_flag, Fprocess_query_on_exit_flag):
New functions.
(Fprocess_kill_without_query): Removed. Now defined in simple.el.
(Fprocess_contact): Added KEY argument. Handle datagrams.
(list_processes_1): Optionally show only processes with the query
on exit flag set. Dynamically adjust column widths. Omit tty
column if not needed. Report stopped network processes.
Identify server and datagram network processes.
(Flist_processes): New optional arg `query-only'.
(conv_sockaddr_to_lisp, get_lisp_to_sockaddr_size)
(conv_lisp_to_sockaddr, set_socket_options)
(network_process_featurep, unwind_request_sigio): New helper functions.
(Fprocess_datagram_address, Fset_process_datagram_address):
(Fset_network_process_options): New lisp functions.
(Fopen_network_stream): Removed. Now defined in simple.el.
(Fmake_network_process): New lisp function. Code is based on previous
Fopen_network_stream, but heavily reworked with new property list based
argument list, support for datagrams, server processes, and local
sockets in addition to old client-only functionality.
(server_accept_connection): New function.
(wait_reading_process_input): Use it to handle incoming connects.
Do not enable input on a new connection if process is stopped.
(read_process_output): Handle datagram sockets. Use 2k buffer for them.
(send_process): Handle datagram sockets.
(Fstop_process, Fcontinue_process): Apply to network processes. A stopped
network process is indicated by setting command field to t .
(Fprocess_send_eof): No-op if datagram connection.
(Fstatus_notify): Don't read input for a stream server socket or a
stopped network process.
(init_process): Initialize datagram_address array.
(syms_of_process): Intern and staticpro new variables, defsubr new
functions.
2002-03-17 20:20:33 +00:00
|
|
|
|
Lisp_Object Qopen, Qclosed, Qconnect, Qfailed, Qlisten;
|
2009-12-03 18:51:32 +00:00
|
|
|
|
Lisp_Object Qlocal, Qipv4, Qdatagram, Qseqpacket;
|
Daniel Engeler <engeler at gmail.com>
These changes add serial port access.
* process.c: Add HAVE_SERIAL.
(Fdelete_process, Fprocess_status, Fset_process_buffer)
(Fset_process_filter, Fset_process_sentinel, Fprocess_contact)
(list_processes_1, select_wrapper, Fstop_process)
(Fcontinue_process, Fprocess_send_eof, kill_buffer_processes)
(status_notify): Modify to handle serial processes.
[HAVE_SERIAL] (Fserial_process_configure)
[HAVE_SERIAL] (make_serial_process_unwind, Fmake_serial_process):
New functions.
* process.h (struct Lisp_Process): Add `type'.
* sysdep.c [HAVE_TERMIOS] (serial_open, serial_configure):
New functions.
* w32.c (_sys_read_ahead, sys_read, sys_write): Modify to handle serial ports.
(serial_open, serial_configure) New functions.
* w32.h: Add FILE_SERIAL.
(struct _child_process): Add ovl_read, ovl_write.
2008-06-13 08:08:20 +00:00
|
|
|
|
Lisp_Object Qreal, Qnetwork, Qserial;
|
2006-01-04 00:16:54 +00:00
|
|
|
|
#ifdef AF_INET6
|
|
|
|
|
Lisp_Object Qipv6;
|
|
|
|
|
#endif
|
Daniel Engeler <engeler at gmail.com>
These changes add serial port access.
* process.c: Add HAVE_SERIAL.
(Fdelete_process, Fprocess_status, Fset_process_buffer)
(Fset_process_filter, Fset_process_sentinel, Fprocess_contact)
(list_processes_1, select_wrapper, Fstop_process)
(Fcontinue_process, Fprocess_send_eof, kill_buffer_processes)
(status_notify): Modify to handle serial processes.
[HAVE_SERIAL] (Fserial_process_configure)
[HAVE_SERIAL] (make_serial_process_unwind, Fmake_serial_process):
New functions.
* process.h (struct Lisp_Process): Add `type'.
* sysdep.c [HAVE_TERMIOS] (serial_open, serial_configure):
New functions.
* w32.c (_sys_read_ahead, sys_read, sys_write): Modify to handle serial ports.
(serial_open, serial_configure) New functions.
* w32.h: Add FILE_SERIAL.
(struct _child_process): Add ovl_read, ovl_write.
2008-06-13 08:08:20 +00:00
|
|
|
|
Lisp_Object QCport, QCspeed, QCprocess;
|
|
|
|
|
Lisp_Object QCbytesize, QCstopbits, QCparity, Qodd, Qeven;
|
|
|
|
|
Lisp_Object QCflowcontrol, Qhw, Qsw, QCsummary;
|
2010-07-10 16:26:44 +03:00
|
|
|
|
Lisp_Object QCbuffer, QChost, QCservice;
|
(Qlocal, QCname, QCbuffer, QChost, QCservice, QCfamily)
(QClocal, QCremote, QCserver, QCdatagram, QCnowait, QCnoquery,QCstop)
(QCcoding, QCoptions, QCfilter, QCsentinel, QClog, QCfeature):
New variables.
(NETCONN1_P): New macro.
(DATAGRAM_SOCKETS): New conditional symbol.
(datagram_address): New array.
(DATAGRAM_CONN_P, DATAGRAM_CHAN_P): New macros.
(status_message): Use concat3.
(Fprocess_status): Add `listen' status to doc string. Return `stop'
for a stopped network process.
(Fset_process_buffer): Update contact plist for network process.
(Fset_process_filter): Ditto. Don't enable input for stopped
network processes. Server must listen, even if filter is t.
(Fset_process_query_on_exit_flag, Fprocess_query_on_exit_flag):
New functions.
(Fprocess_kill_without_query): Removed. Now defined in simple.el.
(Fprocess_contact): Added KEY argument. Handle datagrams.
(list_processes_1): Optionally show only processes with the query
on exit flag set. Dynamically adjust column widths. Omit tty
column if not needed. Report stopped network processes.
Identify server and datagram network processes.
(Flist_processes): New optional arg `query-only'.
(conv_sockaddr_to_lisp, get_lisp_to_sockaddr_size)
(conv_lisp_to_sockaddr, set_socket_options)
(network_process_featurep, unwind_request_sigio): New helper functions.
(Fprocess_datagram_address, Fset_process_datagram_address):
(Fset_network_process_options): New lisp functions.
(Fopen_network_stream): Removed. Now defined in simple.el.
(Fmake_network_process): New lisp function. Code is based on previous
Fopen_network_stream, but heavily reworked with new property list based
argument list, support for datagrams, server processes, and local
sockets in addition to old client-only functionality.
(server_accept_connection): New function.
(wait_reading_process_input): Use it to handle incoming connects.
Do not enable input on a new connection if process is stopped.
(read_process_output): Handle datagram sockets. Use 2k buffer for them.
(send_process): Handle datagram sockets.
(Fstop_process, Fcontinue_process): Apply to network processes. A stopped
network process is indicated by setting command field to t .
(Fprocess_send_eof): No-op if datagram connection.
(Fstatus_notify): Don't read input for a stream server socket or a
stopped network process.
(init_process): Initialize datagram_address array.
(syms_of_process): Intern and staticpro new variables, defsubr new
functions.
2002-03-17 20:20:33 +00:00
|
|
|
|
Lisp_Object QClocal, QCremote, QCcoding;
|
2002-03-21 12:20:24 +00:00
|
|
|
|
Lisp_Object QCserver, QCnowait, QCnoquery, QCstop;
|
2003-01-14 09:55:50 +00:00
|
|
|
|
Lisp_Object QCsentinel, QClog, QCoptions, QCplist;
|
1994-07-13 03:52:05 +00:00
|
|
|
|
Lisp_Object Qlast_nonmenu_event;
|
2002-03-20 20:37:41 +00:00
|
|
|
|
/* QCfamily is declared and initialized in xfaces.c,
|
|
|
|
|
QCfilter in keyboard.c. */
|
|
|
|
|
extern Lisp_Object QCfamily, QCfilter;
|
|
|
|
|
|
1992-03-14 20:40:04 +00:00
|
|
|
|
/* Qexit is declared and initialized in eval.c. */
|
|
|
|
|
|
2002-04-26 23:39:06 +00:00
|
|
|
|
/* QCfamily is defined in xfaces.c. */
|
|
|
|
|
extern Lisp_Object QCfamily;
|
|
|
|
|
/* QCfilter is defined in keyboard.c. */
|
|
|
|
|
extern Lisp_Object QCfilter;
|
|
|
|
|
|
Daniel Engeler <engeler at gmail.com>
These changes add serial port access.
* process.c: Add HAVE_SERIAL.
(Fdelete_process, Fprocess_status, Fset_process_buffer)
(Fset_process_filter, Fset_process_sentinel, Fprocess_contact)
(list_processes_1, select_wrapper, Fstop_process)
(Fcontinue_process, Fprocess_send_eof, kill_buffer_processes)
(status_notify): Modify to handle serial processes.
[HAVE_SERIAL] (Fserial_process_configure)
[HAVE_SERIAL] (make_serial_process_unwind, Fmake_serial_process):
New functions.
* process.h (struct Lisp_Process): Add `type'.
* sysdep.c [HAVE_TERMIOS] (serial_open, serial_configure):
New functions.
* w32.c (_sys_read_ahead, sys_read, sys_write): Modify to handle serial ports.
(serial_open, serial_configure) New functions.
* w32.h: Add FILE_SERIAL.
(struct _child_process): Add ovl_read, ovl_write.
2008-06-13 08:08:20 +00:00
|
|
|
|
#define NETCONN_P(p) (EQ (XPROCESS (p)->type, Qnetwork))
|
|
|
|
|
#define NETCONN1_P(p) (EQ ((p)->type, Qnetwork))
|
|
|
|
|
#define SERIALCONN_P(p) (EQ (XPROCESS (p)->type, Qserial))
|
|
|
|
|
#define SERIALCONN1_P(p) (EQ ((p)->type, Qserial))
|
1992-03-14 20:40:04 +00:00
|
|
|
|
|
|
|
|
|
/* Define first descriptor number available for subprocesses. */
|
|
|
|
|
#define FIRST_PROC_DESC 3
|
|
|
|
|
|
|
|
|
|
/* Define SIGCHLD as an alias for SIGCLD. There are many conditionals
|
|
|
|
|
testing SIGCHLD. */
|
|
|
|
|
|
|
|
|
|
#if !defined (SIGCHLD) && defined (SIGCLD)
|
|
|
|
|
#define SIGCHLD SIGCLD
|
|
|
|
|
#endif /* SIGCLD */
|
|
|
|
|
|
2010-07-05 09:29:35 -07:00
|
|
|
|
extern char *get_operating_system_release (void);
|
1999-09-20 00:34:43 +00:00
|
|
|
|
|
Daniel Engeler <engeler at gmail.com>
These changes add serial port access.
* process.c: Add HAVE_SERIAL.
(Fdelete_process, Fprocess_status, Fset_process_buffer)
(Fset_process_filter, Fset_process_sentinel, Fprocess_contact)
(list_processes_1, select_wrapper, Fstop_process)
(Fcontinue_process, Fprocess_send_eof, kill_buffer_processes)
(status_notify): Modify to handle serial processes.
[HAVE_SERIAL] (Fserial_process_configure)
[HAVE_SERIAL] (make_serial_process_unwind, Fmake_serial_process):
New functions.
* process.h (struct Lisp_Process): Add `type'.
* sysdep.c [HAVE_TERMIOS] (serial_open, serial_configure):
New functions.
* w32.c (_sys_read_ahead, sys_read, sys_write): Modify to handle serial ports.
(serial_open, serial_configure) New functions.
* w32.h: Add FILE_SERIAL.
(struct _child_process): Add ovl_read, ovl_write.
2008-06-13 08:08:20 +00:00
|
|
|
|
/* Serial processes require termios or Windows. */
|
|
|
|
|
#if defined (HAVE_TERMIOS) || defined (WINDOWSNT)
|
|
|
|
|
#define HAVE_SERIAL
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
#ifdef HAVE_SERIAL
|
|
|
|
|
/* From sysdep.c or w32.c */
|
|
|
|
|
extern int serial_open (char *port);
|
|
|
|
|
extern void serial_configure (struct Lisp_Process *p, Lisp_Object contact);
|
|
|
|
|
#endif
|
|
|
|
|
|
1994-07-25 20:47:57 +00:00
|
|
|
|
#ifndef HAVE_H_ERRNO
|
|
|
|
|
extern int h_errno;
|
|
|
|
|
#endif
|
|
|
|
|
|
1992-03-14 20:40:04 +00:00
|
|
|
|
/* t means use pty, nil means use a pipe,
|
|
|
|
|
maybe other values to come. */
|
1993-09-08 17:53:11 +00:00
|
|
|
|
static Lisp_Object Vprocess_connection_type;
|
1992-03-14 20:40:04 +00:00
|
|
|
|
|
1995-01-25 02:02:37 +00:00
|
|
|
|
/* These next two vars are non-static since sysdep.c uses them in the
|
|
|
|
|
emulation of `select'. */
|
1992-03-14 20:40:04 +00:00
|
|
|
|
/* Number of events of change of status of a process. */
|
1995-01-25 02:02:37 +00:00
|
|
|
|
int process_tick;
|
1992-03-14 20:40:04 +00:00
|
|
|
|
/* Number of events for which the user or sentinel has been notified. */
|
1995-01-25 02:02:37 +00:00
|
|
|
|
int update_tick;
|
1992-03-14 20:40:04 +00:00
|
|
|
|
|
2002-02-28 23:53:59 +00:00
|
|
|
|
/* Define NON_BLOCKING_CONNECT if we can support non-blocking connects. */
|
|
|
|
|
|
|
|
|
|
#ifdef BROKEN_NON_BLOCKING_CONNECT
|
|
|
|
|
#undef NON_BLOCKING_CONNECT
|
|
|
|
|
#else
|
|
|
|
|
#ifndef NON_BLOCKING_CONNECT
|
|
|
|
|
#ifdef HAVE_SELECT
|
|
|
|
|
#if defined (HAVE_GETPEERNAME) || defined (GNU_LINUX)
|
|
|
|
|
#if defined (O_NONBLOCK) || defined (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 */
|
|
|
|
|
#endif /* BROKEN_NON_BLOCKING_CONNECT */
|
|
|
|
|
|
(Qlocal, QCname, QCbuffer, QChost, QCservice, QCfamily)
(QClocal, QCremote, QCserver, QCdatagram, QCnowait, QCnoquery,QCstop)
(QCcoding, QCoptions, QCfilter, QCsentinel, QClog, QCfeature):
New variables.
(NETCONN1_P): New macro.
(DATAGRAM_SOCKETS): New conditional symbol.
(datagram_address): New array.
(DATAGRAM_CONN_P, DATAGRAM_CHAN_P): New macros.
(status_message): Use concat3.
(Fprocess_status): Add `listen' status to doc string. Return `stop'
for a stopped network process.
(Fset_process_buffer): Update contact plist for network process.
(Fset_process_filter): Ditto. Don't enable input for stopped
network processes. Server must listen, even if filter is t.
(Fset_process_query_on_exit_flag, Fprocess_query_on_exit_flag):
New functions.
(Fprocess_kill_without_query): Removed. Now defined in simple.el.
(Fprocess_contact): Added KEY argument. Handle datagrams.
(list_processes_1): Optionally show only processes with the query
on exit flag set. Dynamically adjust column widths. Omit tty
column if not needed. Report stopped network processes.
Identify server and datagram network processes.
(Flist_processes): New optional arg `query-only'.
(conv_sockaddr_to_lisp, get_lisp_to_sockaddr_size)
(conv_lisp_to_sockaddr, set_socket_options)
(network_process_featurep, unwind_request_sigio): New helper functions.
(Fprocess_datagram_address, Fset_process_datagram_address):
(Fset_network_process_options): New lisp functions.
(Fopen_network_stream): Removed. Now defined in simple.el.
(Fmake_network_process): New lisp function. Code is based on previous
Fopen_network_stream, but heavily reworked with new property list based
argument list, support for datagrams, server processes, and local
sockets in addition to old client-only functionality.
(server_accept_connection): New function.
(wait_reading_process_input): Use it to handle incoming connects.
Do not enable input on a new connection if process is stopped.
(read_process_output): Handle datagram sockets. Use 2k buffer for them.
(send_process): Handle datagram sockets.
(Fstop_process, Fcontinue_process): Apply to network processes. A stopped
network process is indicated by setting command field to t .
(Fprocess_send_eof): No-op if datagram connection.
(Fstatus_notify): Don't read input for a stream server socket or a
stopped network process.
(init_process): Initialize datagram_address array.
(syms_of_process): Intern and staticpro new variables, defsubr new
functions.
2002-03-17 20:20:33 +00:00
|
|
|
|
/* Define DATAGRAM_SOCKETS if datagrams can be used safely on
|
|
|
|
|
this system. We need to read full packets, so we need a
|
|
|
|
|
"non-destructive" select. So we require either native select,
|
|
|
|
|
or emulation of select using FIONREAD. */
|
|
|
|
|
|
|
|
|
|
#ifdef BROKEN_DATAGRAM_SOCKETS
|
|
|
|
|
#undef DATAGRAM_SOCKETS
|
|
|
|
|
#else
|
|
|
|
|
#ifndef DATAGRAM_SOCKETS
|
|
|
|
|
#if defined (HAVE_SELECT) || defined (FIONREAD)
|
|
|
|
|
#if defined (HAVE_SENDTO) && defined (HAVE_RECVFROM) && defined (EMSGSIZE)
|
|
|
|
|
#define DATAGRAM_SOCKETS
|
|
|
|
|
#endif /* HAVE_SENDTO && HAVE_RECVFROM && EMSGSIZE */
|
|
|
|
|
#endif /* HAVE_SELECT || FIONREAD */
|
|
|
|
|
#endif /* DATAGRAM_SOCKETS */
|
|
|
|
|
#endif /* BROKEN_DATAGRAM_SOCKETS */
|
|
|
|
|
|
2009-12-03 18:51:32 +00:00
|
|
|
|
#if defined HAVE_LOCAL_SOCKETS && defined DATAGRAM_SOCKETS
|
|
|
|
|
# define HAVE_SEQPACKET
|
|
|
|
|
#endif
|
|
|
|
|
|
2004-04-16 12:51:06 +00:00
|
|
|
|
#if !defined (ADAPTIVE_READ_BUFFERING) && !defined (NO_ADAPTIVE_READ_BUFFERING)
|
|
|
|
|
#ifdef EMACS_HAS_USECS
|
|
|
|
|
#define ADAPTIVE_READ_BUFFERING
|
|
|
|
|
#endif
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
#ifdef ADAPTIVE_READ_BUFFERING
|
|
|
|
|
#define READ_OUTPUT_DELAY_INCREMENT 10000
|
|
|
|
|
#define READ_OUTPUT_DELAY_MAX (READ_OUTPUT_DELAY_INCREMENT * 5)
|
|
|
|
|
#define READ_OUTPUT_DELAY_MAX_MAX (READ_OUTPUT_DELAY_INCREMENT * 7)
|
|
|
|
|
|
2005-06-07 13:19:25 +00:00
|
|
|
|
/* Number of processes which have a non-zero read_output_delay,
|
|
|
|
|
and therefore might be delayed for adaptive read buffering. */
|
2004-04-16 12:51:06 +00:00
|
|
|
|
|
|
|
|
|
static int process_output_delay_count;
|
|
|
|
|
|
2005-06-07 13:19:25 +00:00
|
|
|
|
/* Non-zero if any process has non-nil read_output_skip. */
|
2004-04-16 12:51:06 +00:00
|
|
|
|
|
|
|
|
|
static int process_output_skip;
|
|
|
|
|
|
|
|
|
|
/* Non-nil means to delay reading process output to improve buffering.
|
|
|
|
|
A value of t means that delay is reset after each send, any other
|
2005-06-07 13:19:25 +00:00
|
|
|
|
non-nil value does not reset the delay. A value of nil disables
|
|
|
|
|
adaptive read buffering completely. */
|
2004-04-16 12:51:06 +00:00
|
|
|
|
static Lisp_Object Vprocess_adaptive_read_buffering;
|
|
|
|
|
#else
|
|
|
|
|
#define process_output_delay_count 0
|
|
|
|
|
#endif
|
|
|
|
|
|
2010-07-02 14:19:53 +02:00
|
|
|
|
static int keyboard_bit_set (SELECT_TYPE *);
|
|
|
|
|
static void deactivate_process (Lisp_Object);
|
|
|
|
|
static void status_notify (struct Lisp_Process *);
|
|
|
|
|
static int read_process_output (Lisp_Object, int);
|
|
|
|
|
static void create_pty (Lisp_Object);
|
1999-09-20 00:34:43 +00:00
|
|
|
|
|
1995-11-07 07:23:14 +00:00
|
|
|
|
/* If we support a window system, turn on the code to poll periodically
|
1994-05-13 08:31:05 +00:00
|
|
|
|
to detect C-g. It isn't actually used when doing interrupt input. */
|
1995-11-07 07:23:14 +00:00
|
|
|
|
#ifdef HAVE_WINDOW_SYSTEM
|
1994-05-13 08:31:05 +00:00
|
|
|
|
#define POLL_FOR_INPUT
|
|
|
|
|
#endif
|
|
|
|
|
|
2010-07-05 12:36:06 +02:00
|
|
|
|
static Lisp_Object get_process (register Lisp_Object name);
|
|
|
|
|
static void exec_sentinel (Lisp_Object proc, Lisp_Object reason);
|
2006-09-08 12:08:54 +00:00
|
|
|
|
|
2010-07-10 16:26:44 +03:00
|
|
|
|
/* Mask of bits indicating the descriptors that we wait for input on. */
|
|
|
|
|
|
|
|
|
|
static SELECT_TYPE input_wait_mask;
|
|
|
|
|
|
2007-05-20 02:41:19 +00:00
|
|
|
|
/* Mask that excludes keyboard input descriptor(s). */
|
1994-10-25 09:48:44 +00:00
|
|
|
|
|
|
|
|
|
static SELECT_TYPE non_keyboard_wait_mask;
|
|
|
|
|
|
2007-05-20 02:41:19 +00:00
|
|
|
|
/* Mask that excludes process input descriptor(s). */
|
1997-03-22 04:13:50 +00:00
|
|
|
|
|
|
|
|
|
static SELECT_TYPE non_process_wait_mask;
|
|
|
|
|
|
2007-05-20 02:41:19 +00:00
|
|
|
|
/* Mask for the gpm mouse input descriptor. */
|
|
|
|
|
|
|
|
|
|
static SELECT_TYPE gpm_wait_mask;
|
|
|
|
|
|
2004-11-01 11:04:37 +00:00
|
|
|
|
#ifdef NON_BLOCKING_CONNECT
|
2002-02-28 23:53:59 +00:00
|
|
|
|
/* Mask of bits indicating the descriptors that we wait for connect to
|
|
|
|
|
complete on. Once they complete, they are removed from this mask
|
|
|
|
|
and added to the input_wait_mask and non_keyboard_wait_mask. */
|
|
|
|
|
|
|
|
|
|
static SELECT_TYPE connect_wait_mask;
|
|
|
|
|
|
|
|
|
|
/* Number of bits set in connect_wait_mask. */
|
|
|
|
|
static int num_pending_connects;
|
|
|
|
|
|
2004-11-01 11:04:37 +00:00
|
|
|
|
#define IF_NON_BLOCKING_CONNECT(s) s
|
2010-07-10 16:26:44 +03:00
|
|
|
|
#else /* NON_BLOCKING_CONNECT */
|
2004-11-01 11:04:37 +00:00
|
|
|
|
#define IF_NON_BLOCKING_CONNECT(s)
|
2010-07-10 16:26:44 +03:00
|
|
|
|
#endif /* NON_BLOCKING_CONNECT */
|
2004-11-01 11:04:37 +00:00
|
|
|
|
|
1994-04-23 05:18:09 +00:00
|
|
|
|
/* The largest descriptor currently in use for a process object. */
|
|
|
|
|
static int max_process_desc;
|
|
|
|
|
|
1994-10-25 09:48:44 +00:00
|
|
|
|
/* The largest descriptor currently in use for keyboard input. */
|
|
|
|
|
static int max_keyboard_desc;
|
1992-03-14 20:40:04 +00:00
|
|
|
|
|
2007-05-20 02:41:19 +00:00
|
|
|
|
/* The largest descriptor currently in use for gpm mouse input. */
|
|
|
|
|
static int max_gpm_desc;
|
|
|
|
|
|
1992-03-14 20:40:04 +00:00
|
|
|
|
/* Indexed by descriptor, gives the process (if any) for that descriptor */
|
1994-03-02 23:35:11 +00:00
|
|
|
|
Lisp_Object chan_process[MAXDESC];
|
1992-03-14 20:40:04 +00:00
|
|
|
|
|
|
|
|
|
/* Alist of elements (NAME . PROCESS) */
|
1994-03-02 23:35:11 +00:00
|
|
|
|
Lisp_Object Vprocess_alist;
|
1992-03-14 20:40:04 +00:00
|
|
|
|
|
|
|
|
|
/* Buffered-ahead input char from process, indexed by channel.
|
|
|
|
|
-1 means empty (no char is buffered).
|
|
|
|
|
Used on sys V where the only way to tell if there is any
|
|
|
|
|
output from the process is to read at least one char.
|
|
|
|
|
Always -1 on systems that support FIONREAD. */
|
|
|
|
|
|
1994-11-01 08:31:31 +00:00
|
|
|
|
/* Don't make static; need to access externally. */
|
|
|
|
|
int proc_buffered_char[MAXDESC];
|
1993-09-08 17:53:11 +00:00
|
|
|
|
|
1997-02-20 06:53:55 +00:00
|
|
|
|
/* Table of `struct coding-system' for each process. */
|
1997-02-27 07:48:21 +00:00
|
|
|
|
static struct coding_system *proc_decode_coding_system[MAXDESC];
|
|
|
|
|
static struct coding_system *proc_encode_coding_system[MAXDESC];
|
1997-02-20 06:53:55 +00:00
|
|
|
|
|
(Qlocal, QCname, QCbuffer, QChost, QCservice, QCfamily)
(QClocal, QCremote, QCserver, QCdatagram, QCnowait, QCnoquery,QCstop)
(QCcoding, QCoptions, QCfilter, QCsentinel, QClog, QCfeature):
New variables.
(NETCONN1_P): New macro.
(DATAGRAM_SOCKETS): New conditional symbol.
(datagram_address): New array.
(DATAGRAM_CONN_P, DATAGRAM_CHAN_P): New macros.
(status_message): Use concat3.
(Fprocess_status): Add `listen' status to doc string. Return `stop'
for a stopped network process.
(Fset_process_buffer): Update contact plist for network process.
(Fset_process_filter): Ditto. Don't enable input for stopped
network processes. Server must listen, even if filter is t.
(Fset_process_query_on_exit_flag, Fprocess_query_on_exit_flag):
New functions.
(Fprocess_kill_without_query): Removed. Now defined in simple.el.
(Fprocess_contact): Added KEY argument. Handle datagrams.
(list_processes_1): Optionally show only processes with the query
on exit flag set. Dynamically adjust column widths. Omit tty
column if not needed. Report stopped network processes.
Identify server and datagram network processes.
(Flist_processes): New optional arg `query-only'.
(conv_sockaddr_to_lisp, get_lisp_to_sockaddr_size)
(conv_lisp_to_sockaddr, set_socket_options)
(network_process_featurep, unwind_request_sigio): New helper functions.
(Fprocess_datagram_address, Fset_process_datagram_address):
(Fset_network_process_options): New lisp functions.
(Fopen_network_stream): Removed. Now defined in simple.el.
(Fmake_network_process): New lisp function. Code is based on previous
Fopen_network_stream, but heavily reworked with new property list based
argument list, support for datagrams, server processes, and local
sockets in addition to old client-only functionality.
(server_accept_connection): New function.
(wait_reading_process_input): Use it to handle incoming connects.
Do not enable input on a new connection if process is stopped.
(read_process_output): Handle datagram sockets. Use 2k buffer for them.
(send_process): Handle datagram sockets.
(Fstop_process, Fcontinue_process): Apply to network processes. A stopped
network process is indicated by setting command field to t .
(Fprocess_send_eof): No-op if datagram connection.
(Fstatus_notify): Don't read input for a stream server socket or a
stopped network process.
(init_process): Initialize datagram_address array.
(syms_of_process): Intern and staticpro new variables, defsubr new
functions.
2002-03-17 20:20:33 +00:00
|
|
|
|
#ifdef DATAGRAM_SOCKETS
|
|
|
|
|
/* Table of `partner address' for datagram sockets. */
|
|
|
|
|
struct sockaddr_and_len {
|
|
|
|
|
struct sockaddr *sa;
|
|
|
|
|
int len;
|
|
|
|
|
} datagram_address[MAXDESC];
|
|
|
|
|
#define DATAGRAM_CHAN_P(chan) (datagram_address[chan].sa != 0)
|
(struct Lisp_Process): Turn slots infd, outfd, kill_without_query, pty_flag,
tick, update_tick, decoding_carryover, inherit_coding_system_flag,
filter_multibyte, adaptive_read_buffering, read_output_delay, and
read_output_skip from Lisp_Objects to ints. Remove unused
encoding_carryover.
2007-07-12 06:36:57 +00:00
|
|
|
|
#define DATAGRAM_CONN_P(proc) (PROCESSP (proc) && datagram_address[XPROCESS (proc)->infd].sa != 0)
|
(Qlocal, QCname, QCbuffer, QChost, QCservice, QCfamily)
(QClocal, QCremote, QCserver, QCdatagram, QCnowait, QCnoquery,QCstop)
(QCcoding, QCoptions, QCfilter, QCsentinel, QClog, QCfeature):
New variables.
(NETCONN1_P): New macro.
(DATAGRAM_SOCKETS): New conditional symbol.
(datagram_address): New array.
(DATAGRAM_CONN_P, DATAGRAM_CHAN_P): New macros.
(status_message): Use concat3.
(Fprocess_status): Add `listen' status to doc string. Return `stop'
for a stopped network process.
(Fset_process_buffer): Update contact plist for network process.
(Fset_process_filter): Ditto. Don't enable input for stopped
network processes. Server must listen, even if filter is t.
(Fset_process_query_on_exit_flag, Fprocess_query_on_exit_flag):
New functions.
(Fprocess_kill_without_query): Removed. Now defined in simple.el.
(Fprocess_contact): Added KEY argument. Handle datagrams.
(list_processes_1): Optionally show only processes with the query
on exit flag set. Dynamically adjust column widths. Omit tty
column if not needed. Report stopped network processes.
Identify server and datagram network processes.
(Flist_processes): New optional arg `query-only'.
(conv_sockaddr_to_lisp, get_lisp_to_sockaddr_size)
(conv_lisp_to_sockaddr, set_socket_options)
(network_process_featurep, unwind_request_sigio): New helper functions.
(Fprocess_datagram_address, Fset_process_datagram_address):
(Fset_network_process_options): New lisp functions.
(Fopen_network_stream): Removed. Now defined in simple.el.
(Fmake_network_process): New lisp function. Code is based on previous
Fopen_network_stream, but heavily reworked with new property list based
argument list, support for datagrams, server processes, and local
sockets in addition to old client-only functionality.
(server_accept_connection): New function.
(wait_reading_process_input): Use it to handle incoming connects.
Do not enable input on a new connection if process is stopped.
(read_process_output): Handle datagram sockets. Use 2k buffer for them.
(send_process): Handle datagram sockets.
(Fstop_process, Fcontinue_process): Apply to network processes. A stopped
network process is indicated by setting command field to t .
(Fprocess_send_eof): No-op if datagram connection.
(Fstatus_notify): Don't read input for a stream server socket or a
stopped network process.
(init_process): Initialize datagram_address array.
(syms_of_process): Intern and staticpro new variables, defsubr new
functions.
2002-03-17 20:20:33 +00:00
|
|
|
|
#else
|
|
|
|
|
#define DATAGRAM_CHAN_P(chan) (0)
|
|
|
|
|
#define DATAGRAM_CONN_P(proc) (0)
|
|
|
|
|
#endif
|
|
|
|
|
|
1994-03-02 22:50:31 +00:00
|
|
|
|
/* Maximum number of bytes to send to a pty without an eof. */
|
|
|
|
|
static int pty_max_bytes;
|
1994-09-23 22:28:08 +00:00
|
|
|
|
|
1995-04-28 01:43:02 +00:00
|
|
|
|
#ifdef HAVE_PTYS
|
2002-10-30 19:16:32 +00:00
|
|
|
|
#ifdef HAVE_PTY_H
|
|
|
|
|
#include <pty.h>
|
|
|
|
|
#endif
|
1995-04-28 01:43:02 +00:00
|
|
|
|
/* The file name of the pty opened by allocate_pty. */
|
1994-09-23 22:28:08 +00:00
|
|
|
|
|
|
|
|
|
static char pty_name[24];
|
1995-04-28 01:43:02 +00:00
|
|
|
|
#endif
|
1992-03-14 20:40:04 +00:00
|
|
|
|
|
|
|
|
|
/* Compute the Lisp form of the process status, p->status, from
|
|
|
|
|
the numeric status that was returned by `wait'. */
|
|
|
|
|
|
2008-07-12 05:31:23 +00:00
|
|
|
|
static Lisp_Object status_convert (int);
|
1992-10-31 05:27:42 +00:00
|
|
|
|
|
(deactivate_process, status_notify, read_process_output)
(update_status, status_convert, decode_status, allocate_pty)
(make_process, remove_process, list_processes_1)
(create_process_1, unwind_request_sigio, read_process_output)
(send_process, keyboard_bit_set): Declare static.
(Fdelete_process): Simplify. Pass process to status_notify, so we
don't try to read output from it.
(status_notify): New arg deleting_process--don't try to read
output from that process.
2005-08-15 08:44:53 +00:00
|
|
|
|
static void
|
2010-07-05 12:36:06 +02:00
|
|
|
|
update_status (struct Lisp_Process *p)
|
1992-03-14 20:40:04 +00:00
|
|
|
|
{
|
* process.h (struct Lisp_Process): Replace Lisp_Objects `pid',
`raw_status_high', and `raw_status_low' with plain integers, and move
them to the end of the structure.
* alloc.c (allocate_process): Use PSEUDOVECSIZE to initialize the
pseudovector's size field so only the Lisp_Object fields get GC'd.
* process.c (update_status, make_process, Fdelete_process)
(Fprocess_status, list_processes_1, start_process_unwind)
(create_process, Fmake_network_process, server_accept_connection)
(wait_reading_process_output, send_process, Fprocess_running_child_p)
(process_send_signal, proc_encode_coding_system, Fprocess_send_eof)
(sigchld_handler, status_notify): Adjust to new non-Lisp fields for
`pid' and `raw_status'.
(Fprocess_id, Fsignal_process): Same, and additionally use floats when
representing PIDs that are larger than most-positive-fixnum.
2006-04-08 15:07:35 +00:00
|
|
|
|
eassert (p->raw_status_new);
|
2008-07-12 05:31:23 +00:00
|
|
|
|
p->status = status_convert (p->raw_status);
|
* process.h (struct Lisp_Process): Replace Lisp_Objects `pid',
`raw_status_high', and `raw_status_low' with plain integers, and move
them to the end of the structure.
* alloc.c (allocate_process): Use PSEUDOVECSIZE to initialize the
pseudovector's size field so only the Lisp_Object fields get GC'd.
* process.c (update_status, make_process, Fdelete_process)
(Fprocess_status, list_processes_1, start_process_unwind)
(create_process, Fmake_network_process, server_accept_connection)
(wait_reading_process_output, send_process, Fprocess_running_child_p)
(process_send_signal, proc_encode_coding_system, Fprocess_send_eof)
(sigchld_handler, status_notify): Adjust to new non-Lisp fields for
`pid' and `raw_status'.
(Fprocess_id, Fsignal_process): Same, and additionally use floats when
representing PIDs that are larger than most-positive-fixnum.
2006-04-08 15:07:35 +00:00
|
|
|
|
p->raw_status_new = 0;
|
1992-03-14 20:40:04 +00:00
|
|
|
|
}
|
|
|
|
|
|
2003-02-04 14:56:31 +00:00
|
|
|
|
/* Convert a process status word in Unix format to
|
1992-03-14 20:40:04 +00:00
|
|
|
|
the list that we use internally. */
|
|
|
|
|
|
(deactivate_process, status_notify, read_process_output)
(update_status, status_convert, decode_status, allocate_pty)
(make_process, remove_process, list_processes_1)
(create_process_1, unwind_request_sigio, read_process_output)
(send_process, keyboard_bit_set): Declare static.
(Fdelete_process): Simplify. Pass process to status_notify, so we
don't try to read output from it.
(status_notify): New arg deleting_process--don't try to read
output from that process.
2005-08-15 08:44:53 +00:00
|
|
|
|
static Lisp_Object
|
2008-07-12 05:31:23 +00:00
|
|
|
|
status_convert (int w)
|
1992-03-14 20:40:04 +00:00
|
|
|
|
{
|
|
|
|
|
if (WIFSTOPPED (w))
|
|
|
|
|
return Fcons (Qstop, Fcons (make_number (WSTOPSIG (w)), Qnil));
|
|
|
|
|
else if (WIFEXITED (w))
|
|
|
|
|
return Fcons (Qexit, Fcons (make_number (WRETCODE (w)),
|
|
|
|
|
WCOREDUMP (w) ? Qt : Qnil));
|
|
|
|
|
else if (WIFSIGNALED (w))
|
|
|
|
|
return Fcons (Qsignal, Fcons (make_number (WTERMSIG (w)),
|
|
|
|
|
WCOREDUMP (w) ? Qt : Qnil));
|
|
|
|
|
else
|
|
|
|
|
return Qrun;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Given a status-list, extract the three pieces of information
|
|
|
|
|
and store them individually through the three pointers. */
|
|
|
|
|
|
(deactivate_process, status_notify, read_process_output)
(update_status, status_convert, decode_status, allocate_pty)
(make_process, remove_process, list_processes_1)
(create_process_1, unwind_request_sigio, read_process_output)
(send_process, keyboard_bit_set): Declare static.
(Fdelete_process): Simplify. Pass process to status_notify, so we
don't try to read output from it.
(status_notify): New arg deleting_process--don't try to read
output from that process.
2005-08-15 08:44:53 +00:00
|
|
|
|
static void
|
2010-07-05 12:36:06 +02:00
|
|
|
|
decode_status (Lisp_Object l, Lisp_Object *symbol, int *code, int *coredump)
|
1992-03-14 20:40:04 +00:00
|
|
|
|
{
|
|
|
|
|
Lisp_Object tem;
|
|
|
|
|
|
(decode_status, Fprocessp, Fget_process, Fget_buffer_process, Fprocess_status,
Fprocess_exit_status, list_processes_1, Fstart_process, Fopen_network_stream,
Faccept_process_output, wait_reading_process_input, sigchld_handler,
status_notify): Use type test macros.
1994-09-27 01:53:42 +00:00
|
|
|
|
if (SYMBOLP (l))
|
1992-03-14 20:40:04 +00:00
|
|
|
|
{
|
|
|
|
|
*symbol = l;
|
|
|
|
|
*code = 0;
|
|
|
|
|
*coredump = 0;
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
1999-09-12 05:07:01 +00:00
|
|
|
|
*symbol = XCAR (l);
|
|
|
|
|
tem = XCDR (l);
|
|
|
|
|
*code = XFASTINT (XCAR (tem));
|
|
|
|
|
tem = XCDR (tem);
|
1992-03-14 20:40:04 +00:00
|
|
|
|
*coredump = !NILP (tem);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Return a string describing a process status list. */
|
|
|
|
|
|
2004-06-06 22:17:53 +00:00
|
|
|
|
static Lisp_Object
|
2010-07-05 12:36:06 +02:00
|
|
|
|
status_message (struct Lisp_Process *p)
|
1992-03-14 20:40:04 +00:00
|
|
|
|
{
|
2004-06-06 22:17:53 +00:00
|
|
|
|
Lisp_Object status = p->status;
|
1992-03-14 20:40:04 +00:00
|
|
|
|
Lisp_Object symbol;
|
|
|
|
|
int code, coredump;
|
|
|
|
|
Lisp_Object string, string2;
|
|
|
|
|
|
|
|
|
|
decode_status (status, &symbol, &code, &coredump);
|
|
|
|
|
|
|
|
|
|
if (EQ (symbol, Qsignal) || EQ (symbol, Qstop))
|
|
|
|
|
{
|
Add support for large files, 64-bit Solaris, system locale codings.
* Makefile.in (emacs): Set the LC_ALL environment variable to "C"
when dumping, so that the dumped Emacs doesn't have stray locale info.
(dired.o): Depend on systime.h.
(editfns.o): Depend on coding.h.
* alloc.c, buffer.c, callproc.c, ccl.c, charset.c, coding.c, data.c,
dispnew.c, editfns.c, emacs.c, filelock.c, floatfns.c, hftctl.c,
keyboard.c, process.c, sysdep.c, unexelf.c, unexhp9k800.c,
unexsunos4.c, vmsfns.c, vmsgmalloc.c, w32faces.c, w32menu.c, w32term.c,
w32xfns.c, xfaces.c, xfns.c, xmenu.c, xterm.c:
Include <config.h> before any system include files.
* alloc.c, buffer.c, ccl.c, data.c, editfns.c, emacs.c, eval.c,
fileio.c, filelock.c, frame.c, insdel.c, keymap.c, lread.c,
m/alpha.h, print.c, search.c, sysdep.c, xdisp.c, xfaces.c, xfns.c,
xmenu.c, xterm.c:
Do not include <stdlib.h>, as <config.h> does this now.
* callproc.c (Fcall_process):
Synchronize messages locale before invoking strerror.
Decode resulting string with locale-coding-system.
* coding.c (Vlocale_coding_system): New var.
(syms_of_coding): Adjust to above change.
(emacs_strerror): New function.
* coding.h (emacs_strerror, Vlocale_coding_system): New decls.
* config.in (HAVE_STDIO_EXT_H, HAVE_TM_GMTOFF, HAVE___FPENDING,
HAVE_FTELLO, HAVE_GETLOADAVG, HAVE_MBLEN, HAVE_MBRLEN,
HAVE_STRSIGNAL): New macros.
(BITS_PER_LONG): Default to 64 if _LP64 is defined.
<stdlib.h>: Include if HAVE_STDLIB_H is defined and NOT_C_CODE isn't.
* dired.c: Include "systime.h".
(Ffile_attributes): Do not cast s.st_size to int; this loses
information if int is 32 bits but st_size and EMACS_INT are larger.
Treat large device numbers like large inode numbers.
* dispnew.c (PENDING_OUTPUT_COUNT): Use __fpending if available.
* editfns.c: Include coding.h.
(emacs_strftime): Remove decl.
(emacs_strftimeu): New decl.
(emacs_memftimeu): Renamed from emacs_memftime; new arg UT.
Use emacs_strftimeu instead of emacs_strftime.
(Fformat_time_string): Convert format string using
Vlocale_coding_system, and convert result back. Synchronize time
locale before invoking lower level function. Invoke
emacs_memftimeu, passing ut, instead of emacs_memftime.
* emacs.c: Include <locale.h> if HAVE_SETLOCALE is defined.
(Vmessages_locale, Vprevious_messages_locale, Vtime_locale,
Vprevious_time_locale): New variables.
(main): Invoke setlocale early, so that initial error messages are
localized properly. But skip locale-setting if LC_ALL is "C".
Fix up locale when it's safe to do so.
(fixup_locale): Moved here from xterm.c.
(synchronize_locale, synchronize_time_locale,
synchronize_messages_locale): New functions.
(syms_of_emacs): Accommodate above changes.
* fileio.c (report_file_error): Convert strerror output according
to Vlocale_coding_system.
(Finsert_file_contents): Check for arithmetic overflow in
computations that depend on file size. Report IO errors
with emacs_strerror, not strerror.
* fns.c (Fgethash): Declare dflt parameter.
* gmalloc.c: Do not define const to nothing if HAVE_CONFIG_H
is defined; that's config.h's job.
* lisp.h (EMACS_INT, BITS_PER_EMACS_INT, EMACS_UINT): If _LP64,
default these values to long, BITS_PER_LONG, and unsigned long.
(VALBITS, MARKBIT, XINT): Do not assume 32-bit EMACS_INT.
(PNTR_COMPARISON_TYPE): Default to EMACS_UINT, not to unsigned int.
(code_convert_string_norecord, fixup_locale,
synchronize_messages_locale, synchronize_time_locale,
emacs_open, emacs_close, emacs_read, emacs_write): New decls.
All Emacs callers of open, close, read, write changed to use
emacs_open, emacs_close, emacs_read, emacs_write.
* lread.c (file_offset, file_tell): New macros. All uses of ftell
changed to file_tell.
(saved_doc_string_position, prev_saved_doc_string_position): Now
of type file_offset.
(init_lread): Do not fix locale here; fixup_locale now does this.
* m/amdahl.h, s/usg5-4.h:
(NSIG): Remove.
(NSIG_MINIMUM): New macro.
* m/cydra5.h, m/dpx2.h, m/mips.h, m/pfa50.h, m/sps7.h, m/stride.h,
m/ustation.h, s/gnu-linux.h, s/hpux.h, s/iris3-5.h, s/iris3-6.h,
s/umips.h, s/usg5-4.h:
(SIGIO): Do not undef.
(BROKEN_SIGIO): New macro.
* m/ustation.h:
(SIGTSTP): Do not undef.
(BROKEN_SIGTSTP): New macro.
* s/gnu-linux.h:
(SIGPOLL, SIGURG): Do not undef.
(BROKEN_SIGPOLL, BROKEN_SIGURG): New macros.
* s/ptx4.h:
(SIGINFO): Do not undef.
(BROKEN_SIGINFO): New macros.
* m/delta.h, s/ptx.h, s/template.h: Doc fix.
* mktime.c, strftime.c: Update to glibc 2.1.2 version, with
some Emacs-related changes merged.
* print.c (float_to_string): Prepend "-" to representation of a
NaN if the NaN is negative.
* process.c (sys_siglist): Omit if HAVE_STRSIGNAL.
(wait_reading_process_input): Use emacs_strerror, not strerror.
* process.c (status_message, sigchld_handler): Synchronize locale,
then use strsignal istead of sys_siglist.
* w32proc.c (sys_wait): Likewise.
* s/aix3-1.h, s/bsd4-1.h, s/dgux.h, s/gnu-linux.h, s/hiuxmpp.h,
s/hpux.h, s/iris3-5.h, s/iris3-6.h, s/irix3-3.h, s/osf1.h, s/rtu.h,
s/sunos4-1.h, s/unipl5-0.h, s/unipl5-2.h, s/usg5-0.h, s/usg5-2-2.h,
s/usg5-2.h, s/usg5-3.h, s/xenix.h:
(open, close, read, write, INTERRUPTIBLE_OPEN,
INTERRUPTIBLE_CLOSE, INTERRUPTIBLE_IO): Remove.
* s/sol2-5.h (_LARGEFILE_SOURCE, _FILE_OFFSET_BITS): New macros.
* sysdep.c (sys_read, sys_write, read, write, sys_close, close,
sys_open, open): Remove.
(emacs_open, emacs_close, emacs_read, emacs_write): Always define;
the old INTERRUPTIBLE_OPEN, INTERRUPTIBLE_CLOSE, and INTERRUPTIBLE_IO
macros are no longer used.
(emacs_open): Renamed from sys_open. Merge BSD4_1 version.
(emacs_close): Renamed from sys_close.
(emacs_read): Renamed from sys_read.
(emacs_write): Renamed from sys_write.
(sys_siglist): Do not declare if HAVE_STRSIGNAL.
(dup2): Do not print error on failure; the real dup2 doesn't.
(strsignal): New function, defined if !HAVE_STRSIGNAL.
* syssignal.h (SIGINFO): Undef if defined and if BROKEN_SIGINFO
is defined.
(SIGIO, SIGPOLL, SIGTSTP, SIGURG): Likewise.
(NSIG): If less than NSIG_MINIMUM, define to NSIG_MINIMUM.
(strsignal): Declare if !HAVE_STRSIGNAL.
* unexelf.c (ElfBitsW, ELFSIZE, ElfExpandBitsW): New macros.
(ElfW): Define in terms of ElfExpandBitsW.
* w32proc.c (sys_siglist): Remove decl.
* xdisp.c (decode_mode_spec): 3rd arg is int, not char, to comply
with ANSI C.
(display_string): Declare face_string_pos arg.
* xfns.c (Fx_show_tip): Declare timeout param.
* xterm.c: No need to include locale.h.
(x_alloc_lighter_color, x_setup_relief_color):
Pass arg as double, not float, for compatibility with ANSI C.
(fixup_locale): Move to emacs.c.
(x_term_init): Do not setlocale or fixup locale; the main program
does this now.
1999-10-19 07:25:11 +00:00
|
|
|
|
char *signame;
|
* callproc.c (strerror): Remove decl.
* fileio.c (strerror): Likewise.
* process.c (strerror): Likewise.
* emacs.c (strerror): Likewise.
(Vsystem_messages_locale): Renamed from Vmessages_locale.
All uses changed.
(Vprevious_system_messages_locale): Likewise, from
Vprevious_messages_locale.
(Vsystem_time_locale): Likewise, from Vtime_locale.
(Vprevious_system_time_locale): Likewise, from Vprevious_time_locale.
(ABORT_RETURN_TYPE): New macro.
(abort): Return type is now ABORT_RETURN_TYPE.
(main): Always invoke init_signals, even if POSIX_SIGNALS is not
defined.
(syms_of_emacs): messages-locale -> system-messages-locale,
previous-messages-locale -> previous-system-messages-locale,
time-locale -> system-time-locale,
previous-time-locale -> previous-system-time-locale.
* gmalloc.c (PP, __ptr_t): Assume ANSI C if STDC_HEADERS is defined.
(const): Do not define; that's config.h's job.
(<limits.h>): Include if HAVE_LIMITS_H is defined.
(CHAR_BIT): Move test for definedness outside of limits.h condition.
(<stddef.h>): Include if STDC_HEADERS is defined.
(FREE_RETURN_TYPE): New macro.
(free): Return type is now FREE_RETURN_TYPE.
* lisp.h (synchronize_system_time_locale): Renamed from
synchronize_time_locale. All uses changed.
(synchronize_system_messages_locale): Likewise, from
synchronize_messages_locale.
* process.c (sys_siglist): Remove.
* syntax.c (scan_sexps_forward): Use abort, not assert.
* sysdep.c (my_sys_siglist): New var.
(sys_siglist): New macro. Remove old initialized vars of same name.
(init_signals): Initialize sys_siglist.
* xfns.c (abort): Remove decl; stdlib.h now does this.
1999-11-22 08:19:51 +00:00
|
|
|
|
synchronize_system_messages_locale ();
|
Add support for large files, 64-bit Solaris, system locale codings.
* Makefile.in (emacs): Set the LC_ALL environment variable to "C"
when dumping, so that the dumped Emacs doesn't have stray locale info.
(dired.o): Depend on systime.h.
(editfns.o): Depend on coding.h.
* alloc.c, buffer.c, callproc.c, ccl.c, charset.c, coding.c, data.c,
dispnew.c, editfns.c, emacs.c, filelock.c, floatfns.c, hftctl.c,
keyboard.c, process.c, sysdep.c, unexelf.c, unexhp9k800.c,
unexsunos4.c, vmsfns.c, vmsgmalloc.c, w32faces.c, w32menu.c, w32term.c,
w32xfns.c, xfaces.c, xfns.c, xmenu.c, xterm.c:
Include <config.h> before any system include files.
* alloc.c, buffer.c, ccl.c, data.c, editfns.c, emacs.c, eval.c,
fileio.c, filelock.c, frame.c, insdel.c, keymap.c, lread.c,
m/alpha.h, print.c, search.c, sysdep.c, xdisp.c, xfaces.c, xfns.c,
xmenu.c, xterm.c:
Do not include <stdlib.h>, as <config.h> does this now.
* callproc.c (Fcall_process):
Synchronize messages locale before invoking strerror.
Decode resulting string with locale-coding-system.
* coding.c (Vlocale_coding_system): New var.
(syms_of_coding): Adjust to above change.
(emacs_strerror): New function.
* coding.h (emacs_strerror, Vlocale_coding_system): New decls.
* config.in (HAVE_STDIO_EXT_H, HAVE_TM_GMTOFF, HAVE___FPENDING,
HAVE_FTELLO, HAVE_GETLOADAVG, HAVE_MBLEN, HAVE_MBRLEN,
HAVE_STRSIGNAL): New macros.
(BITS_PER_LONG): Default to 64 if _LP64 is defined.
<stdlib.h>: Include if HAVE_STDLIB_H is defined and NOT_C_CODE isn't.
* dired.c: Include "systime.h".
(Ffile_attributes): Do not cast s.st_size to int; this loses
information if int is 32 bits but st_size and EMACS_INT are larger.
Treat large device numbers like large inode numbers.
* dispnew.c (PENDING_OUTPUT_COUNT): Use __fpending if available.
* editfns.c: Include coding.h.
(emacs_strftime): Remove decl.
(emacs_strftimeu): New decl.
(emacs_memftimeu): Renamed from emacs_memftime; new arg UT.
Use emacs_strftimeu instead of emacs_strftime.
(Fformat_time_string): Convert format string using
Vlocale_coding_system, and convert result back. Synchronize time
locale before invoking lower level function. Invoke
emacs_memftimeu, passing ut, instead of emacs_memftime.
* emacs.c: Include <locale.h> if HAVE_SETLOCALE is defined.
(Vmessages_locale, Vprevious_messages_locale, Vtime_locale,
Vprevious_time_locale): New variables.
(main): Invoke setlocale early, so that initial error messages are
localized properly. But skip locale-setting if LC_ALL is "C".
Fix up locale when it's safe to do so.
(fixup_locale): Moved here from xterm.c.
(synchronize_locale, synchronize_time_locale,
synchronize_messages_locale): New functions.
(syms_of_emacs): Accommodate above changes.
* fileio.c (report_file_error): Convert strerror output according
to Vlocale_coding_system.
(Finsert_file_contents): Check for arithmetic overflow in
computations that depend on file size. Report IO errors
with emacs_strerror, not strerror.
* fns.c (Fgethash): Declare dflt parameter.
* gmalloc.c: Do not define const to nothing if HAVE_CONFIG_H
is defined; that's config.h's job.
* lisp.h (EMACS_INT, BITS_PER_EMACS_INT, EMACS_UINT): If _LP64,
default these values to long, BITS_PER_LONG, and unsigned long.
(VALBITS, MARKBIT, XINT): Do not assume 32-bit EMACS_INT.
(PNTR_COMPARISON_TYPE): Default to EMACS_UINT, not to unsigned int.
(code_convert_string_norecord, fixup_locale,
synchronize_messages_locale, synchronize_time_locale,
emacs_open, emacs_close, emacs_read, emacs_write): New decls.
All Emacs callers of open, close, read, write changed to use
emacs_open, emacs_close, emacs_read, emacs_write.
* lread.c (file_offset, file_tell): New macros. All uses of ftell
changed to file_tell.
(saved_doc_string_position, prev_saved_doc_string_position): Now
of type file_offset.
(init_lread): Do not fix locale here; fixup_locale now does this.
* m/amdahl.h, s/usg5-4.h:
(NSIG): Remove.
(NSIG_MINIMUM): New macro.
* m/cydra5.h, m/dpx2.h, m/mips.h, m/pfa50.h, m/sps7.h, m/stride.h,
m/ustation.h, s/gnu-linux.h, s/hpux.h, s/iris3-5.h, s/iris3-6.h,
s/umips.h, s/usg5-4.h:
(SIGIO): Do not undef.
(BROKEN_SIGIO): New macro.
* m/ustation.h:
(SIGTSTP): Do not undef.
(BROKEN_SIGTSTP): New macro.
* s/gnu-linux.h:
(SIGPOLL, SIGURG): Do not undef.
(BROKEN_SIGPOLL, BROKEN_SIGURG): New macros.
* s/ptx4.h:
(SIGINFO): Do not undef.
(BROKEN_SIGINFO): New macros.
* m/delta.h, s/ptx.h, s/template.h: Doc fix.
* mktime.c, strftime.c: Update to glibc 2.1.2 version, with
some Emacs-related changes merged.
* print.c (float_to_string): Prepend "-" to representation of a
NaN if the NaN is negative.
* process.c (sys_siglist): Omit if HAVE_STRSIGNAL.
(wait_reading_process_input): Use emacs_strerror, not strerror.
* process.c (status_message, sigchld_handler): Synchronize locale,
then use strsignal istead of sys_siglist.
* w32proc.c (sys_wait): Likewise.
* s/aix3-1.h, s/bsd4-1.h, s/dgux.h, s/gnu-linux.h, s/hiuxmpp.h,
s/hpux.h, s/iris3-5.h, s/iris3-6.h, s/irix3-3.h, s/osf1.h, s/rtu.h,
s/sunos4-1.h, s/unipl5-0.h, s/unipl5-2.h, s/usg5-0.h, s/usg5-2-2.h,
s/usg5-2.h, s/usg5-3.h, s/xenix.h:
(open, close, read, write, INTERRUPTIBLE_OPEN,
INTERRUPTIBLE_CLOSE, INTERRUPTIBLE_IO): Remove.
* s/sol2-5.h (_LARGEFILE_SOURCE, _FILE_OFFSET_BITS): New macros.
* sysdep.c (sys_read, sys_write, read, write, sys_close, close,
sys_open, open): Remove.
(emacs_open, emacs_close, emacs_read, emacs_write): Always define;
the old INTERRUPTIBLE_OPEN, INTERRUPTIBLE_CLOSE, and INTERRUPTIBLE_IO
macros are no longer used.
(emacs_open): Renamed from sys_open. Merge BSD4_1 version.
(emacs_close): Renamed from sys_close.
(emacs_read): Renamed from sys_read.
(emacs_write): Renamed from sys_write.
(sys_siglist): Do not declare if HAVE_STRSIGNAL.
(dup2): Do not print error on failure; the real dup2 doesn't.
(strsignal): New function, defined if !HAVE_STRSIGNAL.
* syssignal.h (SIGINFO): Undef if defined and if BROKEN_SIGINFO
is defined.
(SIGIO, SIGPOLL, SIGTSTP, SIGURG): Likewise.
(NSIG): If less than NSIG_MINIMUM, define to NSIG_MINIMUM.
(strsignal): Declare if !HAVE_STRSIGNAL.
* unexelf.c (ElfBitsW, ELFSIZE, ElfExpandBitsW): New macros.
(ElfW): Define in terms of ElfExpandBitsW.
* w32proc.c (sys_siglist): Remove decl.
* xdisp.c (decode_mode_spec): 3rd arg is int, not char, to comply
with ANSI C.
(display_string): Declare face_string_pos arg.
* xfns.c (Fx_show_tip): Declare timeout param.
* xterm.c: No need to include locale.h.
(x_alloc_lighter_color, x_setup_relief_color):
Pass arg as double, not float, for compatibility with ANSI C.
(fixup_locale): Move to emacs.c.
(x_term_init): Do not setlocale or fixup locale; the main program
does this now.
1999-10-19 07:25:11 +00:00
|
|
|
|
signame = strsignal (code);
|
1994-01-14 14:17:12 +00:00
|
|
|
|
if (signame == 0)
|
2009-06-15 13:21:14 +00:00
|
|
|
|
string = build_string ("unknown");
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
int c1, c2;
|
|
|
|
|
|
|
|
|
|
string = make_unibyte_string (signame, strlen (signame));
|
|
|
|
|
if (! NILP (Vlocale_coding_system))
|
|
|
|
|
string = (code_convert_string_norecord
|
|
|
|
|
(string, Vlocale_coding_system, 0));
|
2009-11-21 11:52:23 +00:00
|
|
|
|
c1 = STRING_CHAR ((char *) SDATA (string));
|
2009-06-15 13:21:14 +00:00
|
|
|
|
c2 = DOWNCASE (c1);
|
|
|
|
|
if (c1 != c2)
|
2009-06-20 23:23:55 +00:00
|
|
|
|
Faset (string, make_number (0), make_number (c2));
|
2009-06-15 13:21:14 +00:00
|
|
|
|
}
|
1992-03-14 20:40:04 +00:00
|
|
|
|
string2 = build_string (coredump ? " (core dumped)\n" : "\n");
|
|
|
|
|
return concat2 (string, string2);
|
|
|
|
|
}
|
|
|
|
|
else if (EQ (symbol, Qexit))
|
|
|
|
|
{
|
2004-06-06 22:17:53 +00:00
|
|
|
|
if (NETCONN1_P (p))
|
|
|
|
|
return build_string (code == 0 ? "deleted\n" : "connection broken by remote peer\n");
|
1992-03-14 20:40:04 +00:00
|
|
|
|
if (code == 0)
|
|
|
|
|
return build_string ("finished\n");
|
1993-03-30 21:21:49 +00:00
|
|
|
|
string = Fnumber_to_string (make_number (code));
|
1992-03-14 20:40:04 +00:00
|
|
|
|
string2 = build_string (coredump ? " (core dumped)\n" : "\n");
|
(Qlocal, QCname, QCbuffer, QChost, QCservice, QCfamily)
(QClocal, QCremote, QCserver, QCdatagram, QCnowait, QCnoquery,QCstop)
(QCcoding, QCoptions, QCfilter, QCsentinel, QClog, QCfeature):
New variables.
(NETCONN1_P): New macro.
(DATAGRAM_SOCKETS): New conditional symbol.
(datagram_address): New array.
(DATAGRAM_CONN_P, DATAGRAM_CHAN_P): New macros.
(status_message): Use concat3.
(Fprocess_status): Add `listen' status to doc string. Return `stop'
for a stopped network process.
(Fset_process_buffer): Update contact plist for network process.
(Fset_process_filter): Ditto. Don't enable input for stopped
network processes. Server must listen, even if filter is t.
(Fset_process_query_on_exit_flag, Fprocess_query_on_exit_flag):
New functions.
(Fprocess_kill_without_query): Removed. Now defined in simple.el.
(Fprocess_contact): Added KEY argument. Handle datagrams.
(list_processes_1): Optionally show only processes with the query
on exit flag set. Dynamically adjust column widths. Omit tty
column if not needed. Report stopped network processes.
Identify server and datagram network processes.
(Flist_processes): New optional arg `query-only'.
(conv_sockaddr_to_lisp, get_lisp_to_sockaddr_size)
(conv_lisp_to_sockaddr, set_socket_options)
(network_process_featurep, unwind_request_sigio): New helper functions.
(Fprocess_datagram_address, Fset_process_datagram_address):
(Fset_network_process_options): New lisp functions.
(Fopen_network_stream): Removed. Now defined in simple.el.
(Fmake_network_process): New lisp function. Code is based on previous
Fopen_network_stream, but heavily reworked with new property list based
argument list, support for datagrams, server processes, and local
sockets in addition to old client-only functionality.
(server_accept_connection): New function.
(wait_reading_process_input): Use it to handle incoming connects.
Do not enable input on a new connection if process is stopped.
(read_process_output): Handle datagram sockets. Use 2k buffer for them.
(send_process): Handle datagram sockets.
(Fstop_process, Fcontinue_process): Apply to network processes. A stopped
network process is indicated by setting command field to t .
(Fprocess_send_eof): No-op if datagram connection.
(Fstatus_notify): Don't read input for a stream server socket or a
stopped network process.
(init_process): Initialize datagram_address array.
(syms_of_process): Intern and staticpro new variables, defsubr new
functions.
2002-03-17 20:20:33 +00:00
|
|
|
|
return concat3 (build_string ("exited abnormally with code "),
|
|
|
|
|
string, string2);
|
1992-03-14 20:40:04 +00:00
|
|
|
|
}
|
2002-02-28 23:53:59 +00:00
|
|
|
|
else if (EQ (symbol, Qfailed))
|
|
|
|
|
{
|
|
|
|
|
string = Fnumber_to_string (make_number (code));
|
|
|
|
|
string2 = build_string ("\n");
|
(Qlocal, QCname, QCbuffer, QChost, QCservice, QCfamily)
(QClocal, QCremote, QCserver, QCdatagram, QCnowait, QCnoquery,QCstop)
(QCcoding, QCoptions, QCfilter, QCsentinel, QClog, QCfeature):
New variables.
(NETCONN1_P): New macro.
(DATAGRAM_SOCKETS): New conditional symbol.
(datagram_address): New array.
(DATAGRAM_CONN_P, DATAGRAM_CHAN_P): New macros.
(status_message): Use concat3.
(Fprocess_status): Add `listen' status to doc string. Return `stop'
for a stopped network process.
(Fset_process_buffer): Update contact plist for network process.
(Fset_process_filter): Ditto. Don't enable input for stopped
network processes. Server must listen, even if filter is t.
(Fset_process_query_on_exit_flag, Fprocess_query_on_exit_flag):
New functions.
(Fprocess_kill_without_query): Removed. Now defined in simple.el.
(Fprocess_contact): Added KEY argument. Handle datagrams.
(list_processes_1): Optionally show only processes with the query
on exit flag set. Dynamically adjust column widths. Omit tty
column if not needed. Report stopped network processes.
Identify server and datagram network processes.
(Flist_processes): New optional arg `query-only'.
(conv_sockaddr_to_lisp, get_lisp_to_sockaddr_size)
(conv_lisp_to_sockaddr, set_socket_options)
(network_process_featurep, unwind_request_sigio): New helper functions.
(Fprocess_datagram_address, Fset_process_datagram_address):
(Fset_network_process_options): New lisp functions.
(Fopen_network_stream): Removed. Now defined in simple.el.
(Fmake_network_process): New lisp function. Code is based on previous
Fopen_network_stream, but heavily reworked with new property list based
argument list, support for datagrams, server processes, and local
sockets in addition to old client-only functionality.
(server_accept_connection): New function.
(wait_reading_process_input): Use it to handle incoming connects.
Do not enable input on a new connection if process is stopped.
(read_process_output): Handle datagram sockets. Use 2k buffer for them.
(send_process): Handle datagram sockets.
(Fstop_process, Fcontinue_process): Apply to network processes. A stopped
network process is indicated by setting command field to t .
(Fprocess_send_eof): No-op if datagram connection.
(Fstatus_notify): Don't read input for a stream server socket or a
stopped network process.
(init_process): Initialize datagram_address array.
(syms_of_process): Intern and staticpro new variables, defsubr new
functions.
2002-03-17 20:20:33 +00:00
|
|
|
|
return concat3 (build_string ("failed with code "),
|
|
|
|
|
string, string2);
|
2002-02-28 23:53:59 +00:00
|
|
|
|
}
|
1992-03-14 20:40:04 +00:00
|
|
|
|
else
|
|
|
|
|
return Fcopy_sequence (Fsymbol_name (symbol));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
#ifdef HAVE_PTYS
|
|
|
|
|
|
1995-04-28 01:43:02 +00:00
|
|
|
|
/* Open an available pty, returning a file descriptor.
|
|
|
|
|
Return -1 on failure.
|
|
|
|
|
The file name of the terminal corresponding to the pty
|
|
|
|
|
is left in the variable pty_name. */
|
|
|
|
|
|
(deactivate_process, status_notify, read_process_output)
(update_status, status_convert, decode_status, allocate_pty)
(make_process, remove_process, list_processes_1)
(create_process_1, unwind_request_sigio, read_process_output)
(send_process, keyboard_bit_set): Declare static.
(Fdelete_process): Simplify. Pass process to status_notify, so we
don't try to read output from it.
(status_notify): New arg deleting_process--don't try to read
output from that process.
2005-08-15 08:44:53 +00:00
|
|
|
|
static int
|
2010-07-05 12:36:06 +02:00
|
|
|
|
allocate_pty (void)
|
1992-03-14 20:40:04 +00:00
|
|
|
|
{
|
1998-04-14 12:25:56 +00:00
|
|
|
|
register int c, i;
|
1992-03-14 20:40:04 +00:00
|
|
|
|
int fd;
|
|
|
|
|
|
|
|
|
|
#ifdef PTY_ITERATION
|
|
|
|
|
PTY_ITERATION
|
|
|
|
|
#else
|
|
|
|
|
for (c = FIRST_PTY_LETTER; c <= 'z'; c++)
|
|
|
|
|
for (i = 0; i < 16; i++)
|
|
|
|
|
#endif
|
|
|
|
|
{
|
2003-06-04 23:21:11 +00:00
|
|
|
|
struct stat stb; /* Used in some PTY_OPEN. */
|
1992-03-14 20:40:04 +00:00
|
|
|
|
#ifdef PTY_NAME_SPRINTF
|
|
|
|
|
PTY_NAME_SPRINTF
|
|
|
|
|
#else
|
|
|
|
|
sprintf (pty_name, "/dev/pty%c%x", c, i);
|
|
|
|
|
#endif /* no PTY_NAME_SPRINTF */
|
|
|
|
|
|
1992-07-19 17:48:44 +00:00
|
|
|
|
#ifdef PTY_OPEN
|
|
|
|
|
PTY_OPEN;
|
|
|
|
|
#else /* no PTY_OPEN */
|
2003-05-25 17:43:20 +00:00
|
|
|
|
{
|
|
|
|
|
{ /* Some systems name their pseudoterminals so that there are gaps in
|
|
|
|
|
the usual sequence - for example, on HP9000/S700 systems, there
|
|
|
|
|
are no pseudoterminals with names ending in 'f'. So we wait for
|
|
|
|
|
three failures in a row before deciding that we've reached the
|
|
|
|
|
end of the ptys. */
|
|
|
|
|
int failed_count = 0;
|
2004-05-08 16:11:42 +00:00
|
|
|
|
|
2003-05-25 17:43:20 +00:00
|
|
|
|
if (stat (pty_name, &stb) < 0)
|
|
|
|
|
{
|
|
|
|
|
failed_count++;
|
|
|
|
|
if (failed_count >= 3)
|
|
|
|
|
return -1;
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
failed_count = 0;
|
1992-05-01 06:20:46 +00:00
|
|
|
|
}
|
2003-05-25 17:43:20 +00:00
|
|
|
|
# ifdef O_NONBLOCK
|
|
|
|
|
fd = emacs_open (pty_name, O_RDWR | O_NONBLOCK, 0);
|
|
|
|
|
# else
|
|
|
|
|
fd = emacs_open (pty_name, O_RDWR | O_NDELAY, 0);
|
|
|
|
|
# endif
|
|
|
|
|
}
|
1992-07-19 17:48:44 +00:00
|
|
|
|
#endif /* no PTY_OPEN */
|
1992-03-14 20:40:04 +00:00
|
|
|
|
|
|
|
|
|
if (fd >= 0)
|
|
|
|
|
{
|
|
|
|
|
/* check to make certain that both sides are available
|
|
|
|
|
this avoids a nasty yet stupid bug in rlogins */
|
|
|
|
|
#ifdef PTY_TTY_NAME_SPRINTF
|
|
|
|
|
PTY_TTY_NAME_SPRINTF
|
|
|
|
|
#else
|
2009-01-01 15:58:38 +00:00
|
|
|
|
sprintf (pty_name, "/dev/tty%c%x", c, i);
|
1992-03-14 20:40:04 +00:00
|
|
|
|
#endif /* no PTY_TTY_NAME_SPRINTF */
|
|
|
|
|
if (access (pty_name, 6) != 0)
|
|
|
|
|
{
|
Add support for large files, 64-bit Solaris, system locale codings.
* Makefile.in (emacs): Set the LC_ALL environment variable to "C"
when dumping, so that the dumped Emacs doesn't have stray locale info.
(dired.o): Depend on systime.h.
(editfns.o): Depend on coding.h.
* alloc.c, buffer.c, callproc.c, ccl.c, charset.c, coding.c, data.c,
dispnew.c, editfns.c, emacs.c, filelock.c, floatfns.c, hftctl.c,
keyboard.c, process.c, sysdep.c, unexelf.c, unexhp9k800.c,
unexsunos4.c, vmsfns.c, vmsgmalloc.c, w32faces.c, w32menu.c, w32term.c,
w32xfns.c, xfaces.c, xfns.c, xmenu.c, xterm.c:
Include <config.h> before any system include files.
* alloc.c, buffer.c, ccl.c, data.c, editfns.c, emacs.c, eval.c,
fileio.c, filelock.c, frame.c, insdel.c, keymap.c, lread.c,
m/alpha.h, print.c, search.c, sysdep.c, xdisp.c, xfaces.c, xfns.c,
xmenu.c, xterm.c:
Do not include <stdlib.h>, as <config.h> does this now.
* callproc.c (Fcall_process):
Synchronize messages locale before invoking strerror.
Decode resulting string with locale-coding-system.
* coding.c (Vlocale_coding_system): New var.
(syms_of_coding): Adjust to above change.
(emacs_strerror): New function.
* coding.h (emacs_strerror, Vlocale_coding_system): New decls.
* config.in (HAVE_STDIO_EXT_H, HAVE_TM_GMTOFF, HAVE___FPENDING,
HAVE_FTELLO, HAVE_GETLOADAVG, HAVE_MBLEN, HAVE_MBRLEN,
HAVE_STRSIGNAL): New macros.
(BITS_PER_LONG): Default to 64 if _LP64 is defined.
<stdlib.h>: Include if HAVE_STDLIB_H is defined and NOT_C_CODE isn't.
* dired.c: Include "systime.h".
(Ffile_attributes): Do not cast s.st_size to int; this loses
information if int is 32 bits but st_size and EMACS_INT are larger.
Treat large device numbers like large inode numbers.
* dispnew.c (PENDING_OUTPUT_COUNT): Use __fpending if available.
* editfns.c: Include coding.h.
(emacs_strftime): Remove decl.
(emacs_strftimeu): New decl.
(emacs_memftimeu): Renamed from emacs_memftime; new arg UT.
Use emacs_strftimeu instead of emacs_strftime.
(Fformat_time_string): Convert format string using
Vlocale_coding_system, and convert result back. Synchronize time
locale before invoking lower level function. Invoke
emacs_memftimeu, passing ut, instead of emacs_memftime.
* emacs.c: Include <locale.h> if HAVE_SETLOCALE is defined.
(Vmessages_locale, Vprevious_messages_locale, Vtime_locale,
Vprevious_time_locale): New variables.
(main): Invoke setlocale early, so that initial error messages are
localized properly. But skip locale-setting if LC_ALL is "C".
Fix up locale when it's safe to do so.
(fixup_locale): Moved here from xterm.c.
(synchronize_locale, synchronize_time_locale,
synchronize_messages_locale): New functions.
(syms_of_emacs): Accommodate above changes.
* fileio.c (report_file_error): Convert strerror output according
to Vlocale_coding_system.
(Finsert_file_contents): Check for arithmetic overflow in
computations that depend on file size. Report IO errors
with emacs_strerror, not strerror.
* fns.c (Fgethash): Declare dflt parameter.
* gmalloc.c: Do not define const to nothing if HAVE_CONFIG_H
is defined; that's config.h's job.
* lisp.h (EMACS_INT, BITS_PER_EMACS_INT, EMACS_UINT): If _LP64,
default these values to long, BITS_PER_LONG, and unsigned long.
(VALBITS, MARKBIT, XINT): Do not assume 32-bit EMACS_INT.
(PNTR_COMPARISON_TYPE): Default to EMACS_UINT, not to unsigned int.
(code_convert_string_norecord, fixup_locale,
synchronize_messages_locale, synchronize_time_locale,
emacs_open, emacs_close, emacs_read, emacs_write): New decls.
All Emacs callers of open, close, read, write changed to use
emacs_open, emacs_close, emacs_read, emacs_write.
* lread.c (file_offset, file_tell): New macros. All uses of ftell
changed to file_tell.
(saved_doc_string_position, prev_saved_doc_string_position): Now
of type file_offset.
(init_lread): Do not fix locale here; fixup_locale now does this.
* m/amdahl.h, s/usg5-4.h:
(NSIG): Remove.
(NSIG_MINIMUM): New macro.
* m/cydra5.h, m/dpx2.h, m/mips.h, m/pfa50.h, m/sps7.h, m/stride.h,
m/ustation.h, s/gnu-linux.h, s/hpux.h, s/iris3-5.h, s/iris3-6.h,
s/umips.h, s/usg5-4.h:
(SIGIO): Do not undef.
(BROKEN_SIGIO): New macro.
* m/ustation.h:
(SIGTSTP): Do not undef.
(BROKEN_SIGTSTP): New macro.
* s/gnu-linux.h:
(SIGPOLL, SIGURG): Do not undef.
(BROKEN_SIGPOLL, BROKEN_SIGURG): New macros.
* s/ptx4.h:
(SIGINFO): Do not undef.
(BROKEN_SIGINFO): New macros.
* m/delta.h, s/ptx.h, s/template.h: Doc fix.
* mktime.c, strftime.c: Update to glibc 2.1.2 version, with
some Emacs-related changes merged.
* print.c (float_to_string): Prepend "-" to representation of a
NaN if the NaN is negative.
* process.c (sys_siglist): Omit if HAVE_STRSIGNAL.
(wait_reading_process_input): Use emacs_strerror, not strerror.
* process.c (status_message, sigchld_handler): Synchronize locale,
then use strsignal istead of sys_siglist.
* w32proc.c (sys_wait): Likewise.
* s/aix3-1.h, s/bsd4-1.h, s/dgux.h, s/gnu-linux.h, s/hiuxmpp.h,
s/hpux.h, s/iris3-5.h, s/iris3-6.h, s/irix3-3.h, s/osf1.h, s/rtu.h,
s/sunos4-1.h, s/unipl5-0.h, s/unipl5-2.h, s/usg5-0.h, s/usg5-2-2.h,
s/usg5-2.h, s/usg5-3.h, s/xenix.h:
(open, close, read, write, INTERRUPTIBLE_OPEN,
INTERRUPTIBLE_CLOSE, INTERRUPTIBLE_IO): Remove.
* s/sol2-5.h (_LARGEFILE_SOURCE, _FILE_OFFSET_BITS): New macros.
* sysdep.c (sys_read, sys_write, read, write, sys_close, close,
sys_open, open): Remove.
(emacs_open, emacs_close, emacs_read, emacs_write): Always define;
the old INTERRUPTIBLE_OPEN, INTERRUPTIBLE_CLOSE, and INTERRUPTIBLE_IO
macros are no longer used.
(emacs_open): Renamed from sys_open. Merge BSD4_1 version.
(emacs_close): Renamed from sys_close.
(emacs_read): Renamed from sys_read.
(emacs_write): Renamed from sys_write.
(sys_siglist): Do not declare if HAVE_STRSIGNAL.
(dup2): Do not print error on failure; the real dup2 doesn't.
(strsignal): New function, defined if !HAVE_STRSIGNAL.
* syssignal.h (SIGINFO): Undef if defined and if BROKEN_SIGINFO
is defined.
(SIGIO, SIGPOLL, SIGTSTP, SIGURG): Likewise.
(NSIG): If less than NSIG_MINIMUM, define to NSIG_MINIMUM.
(strsignal): Declare if !HAVE_STRSIGNAL.
* unexelf.c (ElfBitsW, ELFSIZE, ElfExpandBitsW): New macros.
(ElfW): Define in terms of ElfExpandBitsW.
* w32proc.c (sys_siglist): Remove decl.
* xdisp.c (decode_mode_spec): 3rd arg is int, not char, to comply
with ANSI C.
(display_string): Declare face_string_pos arg.
* xfns.c (Fx_show_tip): Declare timeout param.
* xterm.c: No need to include locale.h.
(x_alloc_lighter_color, x_setup_relief_color):
Pass arg as double, not float, for compatibility with ANSI C.
(fixup_locale): Move to emacs.c.
(x_term_init): Do not setlocale or fixup locale; the main program
does this now.
1999-10-19 07:25:11 +00:00
|
|
|
|
emacs_close (fd);
|
* systty.h: Remove code for Aix on 386, unsupported platform.
* s/ms-w32.h: Remove boilerplate comments.
(fcloseall, fgetchar, flushall, fputchar, getw, putw): Remove, unused.
* s/gnu-linux.h (TERM): Remove support.
(HAVE_SYSVIPC): Remove, unused.
(A_TEXT_OFFSET, A_TEXT_SEEK, ADJUST_EXEC_HEADER): Remove, not used
for this system.
* process.c: Remove support for IRIS, unused.
Remove support for TERM, not relevant anymore.
* unexalpha.c (DEFAULT_ENTRY_ADDRESS): Remove, replace the only
used with the definition.
* s/aix4-2.h (static): Do not undef.
* m/ibmrs6000.h: Remove code depending on USG5_4, this file is
only used on Aix.
(HAVE_SYSVIPC): Remove, unused.
* m/hp800.h (CANNOT_DUMP): Do not undef.
* m/alpha.h: Fix comment.
* s/usg5-4.h (HAVE_SYSVIPC): Remove, unused.
(USG_SHARED_LIBRARIES): Remove, only used in unexec.c which is not
used by this configuration.
* emacs.c: Remove code depending on USG_SHARED_LIBRARIES.
* unexec.c: Remove code depending on HPUX and
USG_SHARED_LIBRARIES, not used with this file. Remove code
depending on IRIS, unused. Remove if 0-ed code.
2008-07-16 08:06:18 +00:00
|
|
|
|
# ifndef __sgi
|
1992-03-14 20:40:04 +00:00
|
|
|
|
continue;
|
2003-05-25 17:43:20 +00:00
|
|
|
|
# else
|
1992-03-14 20:40:04 +00:00
|
|
|
|
return -1;
|
* systty.h: Remove code for Aix on 386, unsupported platform.
* s/ms-w32.h: Remove boilerplate comments.
(fcloseall, fgetchar, flushall, fputchar, getw, putw): Remove, unused.
* s/gnu-linux.h (TERM): Remove support.
(HAVE_SYSVIPC): Remove, unused.
(A_TEXT_OFFSET, A_TEXT_SEEK, ADJUST_EXEC_HEADER): Remove, not used
for this system.
* process.c: Remove support for IRIS, unused.
Remove support for TERM, not relevant anymore.
* unexalpha.c (DEFAULT_ENTRY_ADDRESS): Remove, replace the only
used with the definition.
* s/aix4-2.h (static): Do not undef.
* m/ibmrs6000.h: Remove code depending on USG5_4, this file is
only used on Aix.
(HAVE_SYSVIPC): Remove, unused.
* m/hp800.h (CANNOT_DUMP): Do not undef.
* m/alpha.h: Fix comment.
* s/usg5-4.h (HAVE_SYSVIPC): Remove, unused.
(USG_SHARED_LIBRARIES): Remove, only used in unexec.c which is not
used by this configuration.
* emacs.c: Remove code depending on USG_SHARED_LIBRARIES.
* unexec.c: Remove code depending on HPUX and
USG_SHARED_LIBRARIES, not used with this file. Remove code
depending on IRIS, unused. Remove if 0-ed code.
2008-07-16 08:06:18 +00:00
|
|
|
|
# endif /* __sgi */
|
1992-03-14 20:40:04 +00:00
|
|
|
|
}
|
|
|
|
|
setup_pty (fd);
|
|
|
|
|
return fd;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
return -1;
|
|
|
|
|
}
|
|
|
|
|
#endif /* HAVE_PTYS */
|
|
|
|
|
|
(deactivate_process, status_notify, read_process_output)
(update_status, status_convert, decode_status, allocate_pty)
(make_process, remove_process, list_processes_1)
(create_process_1, unwind_request_sigio, read_process_output)
(send_process, keyboard_bit_set): Declare static.
(Fdelete_process): Simplify. Pass process to status_notify, so we
don't try to read output from it.
(status_notify): New arg deleting_process--don't try to read
output from that process.
2005-08-15 08:44:53 +00:00
|
|
|
|
static Lisp_Object
|
2010-07-05 12:36:06 +02:00
|
|
|
|
make_process (Lisp_Object name)
|
1992-03-14 20:40:04 +00:00
|
|
|
|
{
|
|
|
|
|
register Lisp_Object val, tem, name1;
|
|
|
|
|
register struct Lisp_Process *p;
|
|
|
|
|
char suffix[10];
|
|
|
|
|
register int i;
|
|
|
|
|
|
2001-02-28 13:29:03 +00:00
|
|
|
|
p = allocate_process ();
|
1994-11-16 05:03:02 +00:00
|
|
|
|
|
(struct Lisp_Process): Turn slots infd, outfd, kill_without_query, pty_flag,
tick, update_tick, decoding_carryover, inherit_coding_system_flag,
filter_multibyte, adaptive_read_buffering, read_output_delay, and
read_output_skip from Lisp_Objects to ints. Remove unused
encoding_carryover.
2007-07-12 06:36:57 +00:00
|
|
|
|
p->infd = -1;
|
|
|
|
|
p->outfd = -1;
|
|
|
|
|
p->tick = 0;
|
|
|
|
|
p->update_tick = 0;
|
* process.h (struct Lisp_Process): Replace Lisp_Objects `pid',
`raw_status_high', and `raw_status_low' with plain integers, and move
them to the end of the structure.
* alloc.c (allocate_process): Use PSEUDOVECSIZE to initialize the
pseudovector's size field so only the Lisp_Object fields get GC'd.
* process.c (update_status, make_process, Fdelete_process)
(Fprocess_status, list_processes_1, start_process_unwind)
(create_process, Fmake_network_process, server_accept_connection)
(wait_reading_process_output, send_process, Fprocess_running_child_p)
(process_send_signal, proc_encode_coding_system, Fprocess_send_eof)
(sigchld_handler, status_notify): Adjust to new non-Lisp fields for
`pid' and `raw_status'.
(Fprocess_id, Fsignal_process): Same, and additionally use floats when
representing PIDs that are larger than most-positive-fixnum.
2006-04-08 15:07:35 +00:00
|
|
|
|
p->pid = 0;
|
2007-12-29 02:44:34 +00:00
|
|
|
|
p->pty_flag = 0;
|
* process.h (struct Lisp_Process): Replace Lisp_Objects `pid',
`raw_status_high', and `raw_status_low' with plain integers, and move
them to the end of the structure.
* alloc.c (allocate_process): Use PSEUDOVECSIZE to initialize the
pseudovector's size field so only the Lisp_Object fields get GC'd.
* process.c (update_status, make_process, Fdelete_process)
(Fprocess_status, list_processes_1, start_process_unwind)
(create_process, Fmake_network_process, server_accept_connection)
(wait_reading_process_output, send_process, Fprocess_running_child_p)
(process_send_signal, proc_encode_coding_system, Fprocess_send_eof)
(sigchld_handler, status_notify): Adjust to new non-Lisp fields for
`pid' and `raw_status'.
(Fprocess_id, Fsignal_process): Same, and additionally use floats when
representing PIDs that are larger than most-positive-fixnum.
2006-04-08 15:07:35 +00:00
|
|
|
|
p->raw_status_new = 0;
|
1992-03-14 20:40:04 +00:00
|
|
|
|
p->status = Qrun;
|
|
|
|
|
p->mark = Fmake_marker ();
|
2008-08-15 20:09:32 +00:00
|
|
|
|
p->kill_without_query = 0;
|
1992-03-14 20:40:04 +00:00
|
|
|
|
|
2004-04-16 12:51:06 +00:00
|
|
|
|
#ifdef ADAPTIVE_READ_BUFFERING
|
(struct Lisp_Process): Turn slots infd, outfd, kill_without_query, pty_flag,
tick, update_tick, decoding_carryover, inherit_coding_system_flag,
filter_multibyte, adaptive_read_buffering, read_output_delay, and
read_output_skip from Lisp_Objects to ints. Remove unused
encoding_carryover.
2007-07-12 06:36:57 +00:00
|
|
|
|
p->adaptive_read_buffering = 0;
|
|
|
|
|
p->read_output_delay = 0;
|
|
|
|
|
p->read_output_skip = 0;
|
2004-04-16 12:51:06 +00:00
|
|
|
|
#endif
|
|
|
|
|
|
1992-03-14 20:40:04 +00:00
|
|
|
|
/* If name is already in use, modify it until it is unused. */
|
|
|
|
|
|
|
|
|
|
name1 = name;
|
|
|
|
|
for (i = 1; ; i++)
|
|
|
|
|
{
|
|
|
|
|
tem = Fget_process (name1);
|
|
|
|
|
if (NILP (tem)) break;
|
|
|
|
|
sprintf (suffix, "<%d>", i);
|
|
|
|
|
name1 = concat2 (name, build_string (suffix));
|
|
|
|
|
}
|
|
|
|
|
name = name1;
|
|
|
|
|
p->name = name;
|
1994-11-16 05:03:02 +00:00
|
|
|
|
XSETPROCESS (val, p);
|
1992-03-14 20:40:04 +00:00
|
|
|
|
Vprocess_alist = Fcons (Fcons (name, val), Vprocess_alist);
|
|
|
|
|
return val;
|
|
|
|
|
}
|
|
|
|
|
|
(deactivate_process, status_notify, read_process_output)
(update_status, status_convert, decode_status, allocate_pty)
(make_process, remove_process, list_processes_1)
(create_process_1, unwind_request_sigio, read_process_output)
(send_process, keyboard_bit_set): Declare static.
(Fdelete_process): Simplify. Pass process to status_notify, so we
don't try to read output from it.
(status_notify): New arg deleting_process--don't try to read
output from that process.
2005-08-15 08:44:53 +00:00
|
|
|
|
static void
|
2010-07-05 12:36:06 +02:00
|
|
|
|
remove_process (register Lisp_Object proc)
|
1992-03-14 20:40:04 +00:00
|
|
|
|
{
|
|
|
|
|
register Lisp_Object pair;
|
|
|
|
|
|
|
|
|
|
pair = Frassq (proc, Vprocess_alist);
|
|
|
|
|
Vprocess_alist = Fdelq (pair, Vprocess_alist);
|
|
|
|
|
|
|
|
|
|
deactivate_process (proc);
|
|
|
|
|
}
|
2003-02-10 07:58:29 +00:00
|
|
|
|
|
1992-03-14 20:40:04 +00:00
|
|
|
|
|
|
|
|
|
DEFUN ("processp", Fprocessp, Sprocessp, 1, 1, 0,
|
2001-10-20 20:56:10 +00:00
|
|
|
|
doc: /* Return t if OBJECT is a process. */)
|
2010-07-08 14:25:08 -07:00
|
|
|
|
(Lisp_Object object)
|
1992-03-14 20:40:04 +00:00
|
|
|
|
{
|
(Fprocessp, Fget_buffer_process, Fdelete_process, Fprocess_status,
Fprocess_exit_status, Fprocess_id, Fprocess_name, Fprocess_command,
Fprocess_tty_name, Fset_process_buffer, Fprocess_buffer, Fprocess_mark,
Fset_process_filter, Fprocess_filter, Fset_process_sentinel,
Fprocess_sentinel, Fset_process_window_size, Fprocess_kill_without_query,
Faccept_process_output): Harmonize arguments with documentation.
1996-01-09 00:33:39 +00:00
|
|
|
|
return PROCESSP (object) ? Qt : Qnil;
|
1992-03-14 20:40:04 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
DEFUN ("get-process", Fget_process, Sget_process, 1, 1, 0,
|
2001-10-20 20:56:10 +00:00
|
|
|
|
doc: /* Return the process named NAME, or nil if there is none. */)
|
2010-07-08 14:25:08 -07:00
|
|
|
|
(register Lisp_Object name)
|
1992-03-14 20:40:04 +00:00
|
|
|
|
{
|
(decode_status, Fprocessp, Fget_process, Fget_buffer_process, Fprocess_status,
Fprocess_exit_status, list_processes_1, Fstart_process, Fopen_network_stream,
Faccept_process_output, wait_reading_process_input, sigchld_handler,
status_notify): Use type test macros.
1994-09-27 01:53:42 +00:00
|
|
|
|
if (PROCESSP (name))
|
1992-03-14 20:40:04 +00:00
|
|
|
|
return name;
|
2001-11-02 20:46:55 +00:00
|
|
|
|
CHECK_STRING (name);
|
1992-03-14 20:40:04 +00:00
|
|
|
|
return Fcdr (Fassoc (name, Vprocess_alist));
|
|
|
|
|
}
|
|
|
|
|
|
1992-07-16 22:56:42 +00:00
|
|
|
|
/* This is how commands for the user decode process arguments. It
|
|
|
|
|
accepts a process, a process name, a buffer, a buffer name, or nil.
|
|
|
|
|
Buffers denote the first process in the buffer, and nil denotes the
|
|
|
|
|
current buffer. */
|
1992-03-14 20:40:04 +00:00
|
|
|
|
|
1993-11-13 02:37:58 +00:00
|
|
|
|
static Lisp_Object
|
2010-07-05 12:36:06 +02:00
|
|
|
|
get_process (register Lisp_Object name)
|
1992-03-14 20:40:04 +00:00
|
|
|
|
{
|
1994-03-12 03:13:20 +00:00
|
|
|
|
register Lisp_Object proc, obj;
|
|
|
|
|
if (STRINGP (name))
|
|
|
|
|
{
|
|
|
|
|
obj = Fget_process (name);
|
|
|
|
|
if (NILP (obj))
|
|
|
|
|
obj = Fget_buffer (name);
|
|
|
|
|
if (NILP (obj))
|
2002-07-15 00:01:34 +00:00
|
|
|
|
error ("Process %s does not exist", SDATA (name));
|
1994-03-12 03:13:20 +00:00
|
|
|
|
}
|
|
|
|
|
else if (NILP (name))
|
|
|
|
|
obj = Fcurrent_buffer ();
|
1992-03-14 20:40:04 +00:00
|
|
|
|
else
|
1994-03-12 03:13:20 +00:00
|
|
|
|
obj = name;
|
|
|
|
|
|
|
|
|
|
/* Now obj should be either a buffer object or a process object.
|
|
|
|
|
*/
|
|
|
|
|
if (BUFFERP (obj))
|
1992-03-14 20:40:04 +00:00
|
|
|
|
{
|
1994-03-12 03:13:20 +00:00
|
|
|
|
proc = Fget_buffer_process (obj);
|
1992-03-14 20:40:04 +00:00
|
|
|
|
if (NILP (proc))
|
2002-07-15 00:01:34 +00:00
|
|
|
|
error ("Buffer %s has no process", SDATA (XBUFFER (obj)->name));
|
1992-03-14 20:40:04 +00:00
|
|
|
|
}
|
|
|
|
|
else
|
1994-03-12 03:13:20 +00:00
|
|
|
|
{
|
2001-11-02 20:46:55 +00:00
|
|
|
|
CHECK_PROCESS (obj);
|
1994-03-12 03:13:20 +00:00
|
|
|
|
proc = obj;
|
|
|
|
|
}
|
|
|
|
|
return proc;
|
1992-03-14 20:40:04 +00:00
|
|
|
|
}
|
|
|
|
|
|
2006-06-01 14:08:25 +00:00
|
|
|
|
|
|
|
|
|
#ifdef SIGCHLD
|
|
|
|
|
/* Fdelete_process promises to immediately forget about the process, but in
|
|
|
|
|
reality, Emacs needs to remember those processes until they have been
|
|
|
|
|
treated by sigchld_handler; otherwise this handler would consider the
|
|
|
|
|
process as being synchronous and say that the synchronous process is
|
|
|
|
|
dead. */
|
|
|
|
|
static Lisp_Object deleted_pid_list;
|
|
|
|
|
#endif
|
|
|
|
|
|
1992-03-14 20:40:04 +00:00
|
|
|
|
DEFUN ("delete-process", Fdelete_process, Sdelete_process, 1, 1, 0,
|
2001-10-20 20:56:10 +00:00
|
|
|
|
doc: /* Delete PROCESS: kill it and forget about it immediately.
|
|
|
|
|
PROCESS may be a process, a buffer, the name of a process or buffer, or
|
|
|
|
|
nil, indicating the current buffer's process. */)
|
2010-07-08 14:25:08 -07:00
|
|
|
|
(register Lisp_Object process)
|
1992-03-14 20:40:04 +00:00
|
|
|
|
{
|
(deactivate_process, status_notify, read_process_output)
(update_status, status_convert, decode_status, allocate_pty)
(make_process, remove_process, list_processes_1)
(create_process_1, unwind_request_sigio, read_process_output)
(send_process, keyboard_bit_set): Declare static.
(Fdelete_process): Simplify. Pass process to status_notify, so we
don't try to read output from it.
(status_notify): New arg deleting_process--don't try to read
output from that process.
2005-08-15 08:44:53 +00:00
|
|
|
|
register struct Lisp_Process *p;
|
|
|
|
|
|
(Fprocessp, Fget_buffer_process, Fdelete_process, Fprocess_status,
Fprocess_exit_status, Fprocess_id, Fprocess_name, Fprocess_command,
Fprocess_tty_name, Fset_process_buffer, Fprocess_buffer, Fprocess_mark,
Fset_process_filter, Fprocess_filter, Fset_process_sentinel,
Fprocess_sentinel, Fset_process_window_size, Fprocess_kill_without_query,
Faccept_process_output): Harmonize arguments with documentation.
1996-01-09 00:33:39 +00:00
|
|
|
|
process = get_process (process);
|
(deactivate_process, status_notify, read_process_output)
(update_status, status_convert, decode_status, allocate_pty)
(make_process, remove_process, list_processes_1)
(create_process_1, unwind_request_sigio, read_process_output)
(send_process, keyboard_bit_set): Declare static.
(Fdelete_process): Simplify. Pass process to status_notify, so we
don't try to read output from it.
(status_notify): New arg deleting_process--don't try to read
output from that process.
2005-08-15 08:44:53 +00:00
|
|
|
|
p = XPROCESS (process);
|
|
|
|
|
|
* process.h (struct Lisp_Process): Replace Lisp_Objects `pid',
`raw_status_high', and `raw_status_low' with plain integers, and move
them to the end of the structure.
* alloc.c (allocate_process): Use PSEUDOVECSIZE to initialize the
pseudovector's size field so only the Lisp_Object fields get GC'd.
* process.c (update_status, make_process, Fdelete_process)
(Fprocess_status, list_processes_1, start_process_unwind)
(create_process, Fmake_network_process, server_accept_connection)
(wait_reading_process_output, send_process, Fprocess_running_child_p)
(process_send_signal, proc_encode_coding_system, Fprocess_send_eof)
(sigchld_handler, status_notify): Adjust to new non-Lisp fields for
`pid' and `raw_status'.
(Fprocess_id, Fsignal_process): Same, and additionally use floats when
representing PIDs that are larger than most-positive-fixnum.
2006-04-08 15:07:35 +00:00
|
|
|
|
p->raw_status_new = 0;
|
Daniel Engeler <engeler at gmail.com>
These changes add serial port access.
* process.c: Add HAVE_SERIAL.
(Fdelete_process, Fprocess_status, Fset_process_buffer)
(Fset_process_filter, Fset_process_sentinel, Fprocess_contact)
(list_processes_1, select_wrapper, Fstop_process)
(Fcontinue_process, Fprocess_send_eof, kill_buffer_processes)
(status_notify): Modify to handle serial processes.
[HAVE_SERIAL] (Fserial_process_configure)
[HAVE_SERIAL] (make_serial_process_unwind, Fmake_serial_process):
New functions.
* process.h (struct Lisp_Process): Add `type'.
* sysdep.c [HAVE_TERMIOS] (serial_open, serial_configure):
New functions.
* w32.c (_sys_read_ahead, sys_read, sys_write): Modify to handle serial ports.
(serial_open, serial_configure) New functions.
* w32.h: Add FILE_SERIAL.
(struct _child_process): Add ovl_read, ovl_write.
2008-06-13 08:08:20 +00:00
|
|
|
|
if (NETCONN1_P (p) || SERIALCONN1_P (p))
|
1992-03-14 20:40:04 +00:00
|
|
|
|
{
|
(deactivate_process, status_notify, read_process_output)
(update_status, status_convert, decode_status, allocate_pty)
(make_process, remove_process, list_processes_1)
(create_process_1, unwind_request_sigio, read_process_output)
(send_process, keyboard_bit_set): Declare static.
(Fdelete_process): Simplify. Pass process to status_notify, so we
don't try to read output from it.
(status_notify): New arg deleting_process--don't try to read
output from that process.
2005-08-15 08:44:53 +00:00
|
|
|
|
p->status = Fcons (Qexit, Fcons (make_number (0), Qnil));
|
(struct Lisp_Process): Turn slots infd, outfd, kill_without_query, pty_flag,
tick, update_tick, decoding_carryover, inherit_coding_system_flag,
filter_multibyte, adaptive_read_buffering, read_output_delay, and
read_output_skip from Lisp_Objects to ints. Remove unused
encoding_carryover.
2007-07-12 06:36:57 +00:00
|
|
|
|
p->tick = ++process_tick;
|
(deactivate_process, status_notify, read_process_output)
(update_status, status_convert, decode_status, allocate_pty)
(make_process, remove_process, list_processes_1)
(create_process_1, unwind_request_sigio, read_process_output)
(send_process, keyboard_bit_set): Declare static.
(Fdelete_process): Simplify. Pass process to status_notify, so we
don't try to read output from it.
(status_notify): New arg deleting_process--don't try to read
output from that process.
2005-08-15 08:44:53 +00:00
|
|
|
|
status_notify (p);
|
2009-08-17 21:04:05 +00:00
|
|
|
|
redisplay_preserve_echo_area (13);
|
1992-03-14 20:40:04 +00:00
|
|
|
|
}
|
(struct Lisp_Process): Turn slots infd, outfd, kill_without_query, pty_flag,
tick, update_tick, decoding_carryover, inherit_coding_system_flag,
filter_multibyte, adaptive_read_buffering, read_output_delay, and
read_output_skip from Lisp_Objects to ints. Remove unused
encoding_carryover.
2007-07-12 06:36:57 +00:00
|
|
|
|
else if (p->infd >= 0)
|
1992-03-14 20:40:04 +00:00
|
|
|
|
{
|
2006-06-01 14:08:25 +00:00
|
|
|
|
#ifdef SIGCHLD
|
|
|
|
|
Lisp_Object symbol;
|
2007-01-13 21:58:23 +00:00
|
|
|
|
/* Assignment to EMACS_INT stops GCC whining about limited range
|
|
|
|
|
of data type. */
|
2007-03-17 18:24:46 +00:00
|
|
|
|
EMACS_INT pid = p->pid;
|
2006-06-01 14:08:25 +00:00
|
|
|
|
|
|
|
|
|
/* No problem storing the pid here, as it is still in Vprocess_alist. */
|
2007-01-13 21:58:23 +00:00
|
|
|
|
deleted_pid_list = Fcons (make_fixnum_or_float (pid),
|
2006-06-01 14:08:25 +00:00
|
|
|
|
/* GC treated elements set to nil. */
|
|
|
|
|
Fdelq (Qnil, deleted_pid_list));
|
|
|
|
|
/* If the process has already signaled, remove it from the list. */
|
|
|
|
|
if (p->raw_status_new)
|
|
|
|
|
update_status (p);
|
|
|
|
|
symbol = p->status;
|
|
|
|
|
if (CONSP (p->status))
|
|
|
|
|
symbol = XCAR (p->status);
|
|
|
|
|
if (EQ (symbol, Qsignal) || EQ (symbol, Qexit))
|
2007-03-17 18:24:46 +00:00
|
|
|
|
deleted_pid_list
|
|
|
|
|
= Fdelete (make_fixnum_or_float (pid), deleted_pid_list);
|
2006-06-01 14:08:25 +00:00
|
|
|
|
else
|
|
|
|
|
#endif
|
|
|
|
|
{
|
|
|
|
|
Fkill_process (process, Qnil);
|
|
|
|
|
/* Do this now, since remove_process will make sigchld_handler do nothing. */
|
|
|
|
|
p->status
|
|
|
|
|
= Fcons (Qsignal, Fcons (make_number (SIGKILL), Qnil));
|
(struct Lisp_Process): Turn slots infd, outfd, kill_without_query, pty_flag,
tick, update_tick, decoding_carryover, inherit_coding_system_flag,
filter_multibyte, adaptive_read_buffering, read_output_delay, and
read_output_skip from Lisp_Objects to ints. Remove unused
encoding_carryover.
2007-07-12 06:36:57 +00:00
|
|
|
|
p->tick = ++process_tick;
|
2006-06-01 14:08:25 +00:00
|
|
|
|
status_notify (p);
|
2009-08-17 21:04:05 +00:00
|
|
|
|
redisplay_preserve_echo_area (13);
|
2006-06-01 14:08:25 +00:00
|
|
|
|
}
|
1992-03-14 20:40:04 +00:00
|
|
|
|
}
|
(Fprocessp, Fget_buffer_process, Fdelete_process, Fprocess_status,
Fprocess_exit_status, Fprocess_id, Fprocess_name, Fprocess_command,
Fprocess_tty_name, Fset_process_buffer, Fprocess_buffer, Fprocess_mark,
Fset_process_filter, Fprocess_filter, Fset_process_sentinel,
Fprocess_sentinel, Fset_process_window_size, Fprocess_kill_without_query,
Faccept_process_output): Harmonize arguments with documentation.
1996-01-09 00:33:39 +00:00
|
|
|
|
remove_process (process);
|
1992-03-14 20:40:04 +00:00
|
|
|
|
return Qnil;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
DEFUN ("process-status", Fprocess_status, Sprocess_status, 1, 1, 0,
|
2001-10-20 20:56:10 +00:00
|
|
|
|
doc: /* Return the status of PROCESS.
|
|
|
|
|
The returned value is one of the following symbols:
|
|
|
|
|
run -- for a process that is running.
|
|
|
|
|
stop -- for a process stopped but continuable.
|
|
|
|
|
exit -- for a process that has exited.
|
|
|
|
|
signal -- for a process that has got a fatal signal.
|
|
|
|
|
open -- for a network stream connection that is open.
|
(Qlocal, QCname, QCbuffer, QChost, QCservice, QCfamily)
(QClocal, QCremote, QCserver, QCdatagram, QCnowait, QCnoquery,QCstop)
(QCcoding, QCoptions, QCfilter, QCsentinel, QClog, QCfeature):
New variables.
(NETCONN1_P): New macro.
(DATAGRAM_SOCKETS): New conditional symbol.
(datagram_address): New array.
(DATAGRAM_CONN_P, DATAGRAM_CHAN_P): New macros.
(status_message): Use concat3.
(Fprocess_status): Add `listen' status to doc string. Return `stop'
for a stopped network process.
(Fset_process_buffer): Update contact plist for network process.
(Fset_process_filter): Ditto. Don't enable input for stopped
network processes. Server must listen, even if filter is t.
(Fset_process_query_on_exit_flag, Fprocess_query_on_exit_flag):
New functions.
(Fprocess_kill_without_query): Removed. Now defined in simple.el.
(Fprocess_contact): Added KEY argument. Handle datagrams.
(list_processes_1): Optionally show only processes with the query
on exit flag set. Dynamically adjust column widths. Omit tty
column if not needed. Report stopped network processes.
Identify server and datagram network processes.
(Flist_processes): New optional arg `query-only'.
(conv_sockaddr_to_lisp, get_lisp_to_sockaddr_size)
(conv_lisp_to_sockaddr, set_socket_options)
(network_process_featurep, unwind_request_sigio): New helper functions.
(Fprocess_datagram_address, Fset_process_datagram_address):
(Fset_network_process_options): New lisp functions.
(Fopen_network_stream): Removed. Now defined in simple.el.
(Fmake_network_process): New lisp function. Code is based on previous
Fopen_network_stream, but heavily reworked with new property list based
argument list, support for datagrams, server processes, and local
sockets in addition to old client-only functionality.
(server_accept_connection): New function.
(wait_reading_process_input): Use it to handle incoming connects.
Do not enable input on a new connection if process is stopped.
(read_process_output): Handle datagram sockets. Use 2k buffer for them.
(send_process): Handle datagram sockets.
(Fstop_process, Fcontinue_process): Apply to network processes. A stopped
network process is indicated by setting command field to t .
(Fprocess_send_eof): No-op if datagram connection.
(Fstatus_notify): Don't read input for a stream server socket or a
stopped network process.
(init_process): Initialize datagram_address array.
(syms_of_process): Intern and staticpro new variables, defsubr new
functions.
2002-03-17 20:20:33 +00:00
|
|
|
|
listen -- for a network stream server that is listening.
|
2001-10-20 20:56:10 +00:00
|
|
|
|
closed -- for a network stream connection that is closed.
|
2002-03-01 00:00:21 +00:00
|
|
|
|
connect -- when waiting for a non-blocking connection to complete.
|
|
|
|
|
failed -- when a non-blocking connection has failed.
|
2001-10-20 20:56:10 +00:00
|
|
|
|
nil -- if arg is a process name and no such process exists.
|
|
|
|
|
PROCESS may be a process, a buffer, the name of a process, or
|
|
|
|
|
nil, indicating the current buffer's process. */)
|
2010-07-08 14:25:08 -07:00
|
|
|
|
(register Lisp_Object process)
|
1992-03-14 20:40:04 +00:00
|
|
|
|
{
|
|
|
|
|
register struct Lisp_Process *p;
|
|
|
|
|
register Lisp_Object status;
|
1994-06-17 13:40:33 +00:00
|
|
|
|
|
(Fprocessp, Fget_buffer_process, Fdelete_process, Fprocess_status,
Fprocess_exit_status, Fprocess_id, Fprocess_name, Fprocess_command,
Fprocess_tty_name, Fset_process_buffer, Fprocess_buffer, Fprocess_mark,
Fset_process_filter, Fprocess_filter, Fset_process_sentinel,
Fprocess_sentinel, Fset_process_window_size, Fprocess_kill_without_query,
Faccept_process_output): Harmonize arguments with documentation.
1996-01-09 00:33:39 +00:00
|
|
|
|
if (STRINGP (process))
|
|
|
|
|
process = Fget_process (process);
|
1994-06-17 13:40:33 +00:00
|
|
|
|
else
|
(Fprocessp, Fget_buffer_process, Fdelete_process, Fprocess_status,
Fprocess_exit_status, Fprocess_id, Fprocess_name, Fprocess_command,
Fprocess_tty_name, Fset_process_buffer, Fprocess_buffer, Fprocess_mark,
Fset_process_filter, Fprocess_filter, Fset_process_sentinel,
Fprocess_sentinel, Fset_process_window_size, Fprocess_kill_without_query,
Faccept_process_output): Harmonize arguments with documentation.
1996-01-09 00:33:39 +00:00
|
|
|
|
process = get_process (process);
|
1994-06-17 13:40:33 +00:00
|
|
|
|
|
(Fprocessp, Fget_buffer_process, Fdelete_process, Fprocess_status,
Fprocess_exit_status, Fprocess_id, Fprocess_name, Fprocess_command,
Fprocess_tty_name, Fset_process_buffer, Fprocess_buffer, Fprocess_mark,
Fset_process_filter, Fprocess_filter, Fset_process_sentinel,
Fprocess_sentinel, Fset_process_window_size, Fprocess_kill_without_query,
Faccept_process_output): Harmonize arguments with documentation.
1996-01-09 00:33:39 +00:00
|
|
|
|
if (NILP (process))
|
|
|
|
|
return process;
|
1994-06-17 13:40:33 +00:00
|
|
|
|
|
(Fprocessp, Fget_buffer_process, Fdelete_process, Fprocess_status,
Fprocess_exit_status, Fprocess_id, Fprocess_name, Fprocess_command,
Fprocess_tty_name, Fset_process_buffer, Fprocess_buffer, Fprocess_mark,
Fset_process_filter, Fprocess_filter, Fset_process_sentinel,
Fprocess_sentinel, Fset_process_window_size, Fprocess_kill_without_query,
Faccept_process_output): Harmonize arguments with documentation.
1996-01-09 00:33:39 +00:00
|
|
|
|
p = XPROCESS (process);
|
* process.h (struct Lisp_Process): Replace Lisp_Objects `pid',
`raw_status_high', and `raw_status_low' with plain integers, and move
them to the end of the structure.
* alloc.c (allocate_process): Use PSEUDOVECSIZE to initialize the
pseudovector's size field so only the Lisp_Object fields get GC'd.
* process.c (update_status, make_process, Fdelete_process)
(Fprocess_status, list_processes_1, start_process_unwind)
(create_process, Fmake_network_process, server_accept_connection)
(wait_reading_process_output, send_process, Fprocess_running_child_p)
(process_send_signal, proc_encode_coding_system, Fprocess_send_eof)
(sigchld_handler, status_notify): Adjust to new non-Lisp fields for
`pid' and `raw_status'.
(Fprocess_id, Fsignal_process): Same, and additionally use floats when
representing PIDs that are larger than most-positive-fixnum.
2006-04-08 15:07:35 +00:00
|
|
|
|
if (p->raw_status_new)
|
1992-03-14 20:40:04 +00:00
|
|
|
|
update_status (p);
|
|
|
|
|
status = p->status;
|
(decode_status, Fprocessp, Fget_process, Fget_buffer_process, Fprocess_status,
Fprocess_exit_status, list_processes_1, Fstart_process, Fopen_network_stream,
Faccept_process_output, wait_reading_process_input, sigchld_handler,
status_notify): Use type test macros.
1994-09-27 01:53:42 +00:00
|
|
|
|
if (CONSP (status))
|
1999-09-12 05:07:01 +00:00
|
|
|
|
status = XCAR (status);
|
Daniel Engeler <engeler at gmail.com>
These changes add serial port access.
* process.c: Add HAVE_SERIAL.
(Fdelete_process, Fprocess_status, Fset_process_buffer)
(Fset_process_filter, Fset_process_sentinel, Fprocess_contact)
(list_processes_1, select_wrapper, Fstop_process)
(Fcontinue_process, Fprocess_send_eof, kill_buffer_processes)
(status_notify): Modify to handle serial processes.
[HAVE_SERIAL] (Fserial_process_configure)
[HAVE_SERIAL] (make_serial_process_unwind, Fmake_serial_process):
New functions.
* process.h (struct Lisp_Process): Add `type'.
* sysdep.c [HAVE_TERMIOS] (serial_open, serial_configure):
New functions.
* w32.c (_sys_read_ahead, sys_read, sys_write): Modify to handle serial ports.
(serial_open, serial_configure) New functions.
* w32.h: Add FILE_SERIAL.
(struct _child_process): Add ovl_read, ovl_write.
2008-06-13 08:08:20 +00:00
|
|
|
|
if (NETCONN1_P (p) || SERIALCONN1_P (p))
|
1992-03-14 20:40:04 +00:00
|
|
|
|
{
|
(Qlocal, QCname, QCbuffer, QChost, QCservice, QCfamily)
(QClocal, QCremote, QCserver, QCdatagram, QCnowait, QCnoquery,QCstop)
(QCcoding, QCoptions, QCfilter, QCsentinel, QClog, QCfeature):
New variables.
(NETCONN1_P): New macro.
(DATAGRAM_SOCKETS): New conditional symbol.
(datagram_address): New array.
(DATAGRAM_CONN_P, DATAGRAM_CHAN_P): New macros.
(status_message): Use concat3.
(Fprocess_status): Add `listen' status to doc string. Return `stop'
for a stopped network process.
(Fset_process_buffer): Update contact plist for network process.
(Fset_process_filter): Ditto. Don't enable input for stopped
network processes. Server must listen, even if filter is t.
(Fset_process_query_on_exit_flag, Fprocess_query_on_exit_flag):
New functions.
(Fprocess_kill_without_query): Removed. Now defined in simple.el.
(Fprocess_contact): Added KEY argument. Handle datagrams.
(list_processes_1): Optionally show only processes with the query
on exit flag set. Dynamically adjust column widths. Omit tty
column if not needed. Report stopped network processes.
Identify server and datagram network processes.
(Flist_processes): New optional arg `query-only'.
(conv_sockaddr_to_lisp, get_lisp_to_sockaddr_size)
(conv_lisp_to_sockaddr, set_socket_options)
(network_process_featurep, unwind_request_sigio): New helper functions.
(Fprocess_datagram_address, Fset_process_datagram_address):
(Fset_network_process_options): New lisp functions.
(Fopen_network_stream): Removed. Now defined in simple.el.
(Fmake_network_process): New lisp function. Code is based on previous
Fopen_network_stream, but heavily reworked with new property list based
argument list, support for datagrams, server processes, and local
sockets in addition to old client-only functionality.
(server_accept_connection): New function.
(wait_reading_process_input): Use it to handle incoming connects.
Do not enable input on a new connection if process is stopped.
(read_process_output): Handle datagram sockets. Use 2k buffer for them.
(send_process): Handle datagram sockets.
(Fstop_process, Fcontinue_process): Apply to network processes. A stopped
network process is indicated by setting command field to t .
(Fprocess_send_eof): No-op if datagram connection.
(Fstatus_notify): Don't read input for a stream server socket or a
stopped network process.
(init_process): Initialize datagram_address array.
(syms_of_process): Intern and staticpro new variables, defsubr new
functions.
2002-03-17 20:20:33 +00:00
|
|
|
|
if (EQ (status, Qexit))
|
1992-03-14 20:40:04 +00:00
|
|
|
|
status = Qclosed;
|
(Qlocal, QCname, QCbuffer, QChost, QCservice, QCfamily)
(QClocal, QCremote, QCserver, QCdatagram, QCnowait, QCnoquery,QCstop)
(QCcoding, QCoptions, QCfilter, QCsentinel, QClog, QCfeature):
New variables.
(NETCONN1_P): New macro.
(DATAGRAM_SOCKETS): New conditional symbol.
(datagram_address): New array.
(DATAGRAM_CONN_P, DATAGRAM_CHAN_P): New macros.
(status_message): Use concat3.
(Fprocess_status): Add `listen' status to doc string. Return `stop'
for a stopped network process.
(Fset_process_buffer): Update contact plist for network process.
(Fset_process_filter): Ditto. Don't enable input for stopped
network processes. Server must listen, even if filter is t.
(Fset_process_query_on_exit_flag, Fprocess_query_on_exit_flag):
New functions.
(Fprocess_kill_without_query): Removed. Now defined in simple.el.
(Fprocess_contact): Added KEY argument. Handle datagrams.
(list_processes_1): Optionally show only processes with the query
on exit flag set. Dynamically adjust column widths. Omit tty
column if not needed. Report stopped network processes.
Identify server and datagram network processes.
(Flist_processes): New optional arg `query-only'.
(conv_sockaddr_to_lisp, get_lisp_to_sockaddr_size)
(conv_lisp_to_sockaddr, set_socket_options)
(network_process_featurep, unwind_request_sigio): New helper functions.
(Fprocess_datagram_address, Fset_process_datagram_address):
(Fset_network_process_options): New lisp functions.
(Fopen_network_stream): Removed. Now defined in simple.el.
(Fmake_network_process): New lisp function. Code is based on previous
Fopen_network_stream, but heavily reworked with new property list based
argument list, support for datagrams, server processes, and local
sockets in addition to old client-only functionality.
(server_accept_connection): New function.
(wait_reading_process_input): Use it to handle incoming connects.
Do not enable input on a new connection if process is stopped.
(read_process_output): Handle datagram sockets. Use 2k buffer for them.
(send_process): Handle datagram sockets.
(Fstop_process, Fcontinue_process): Apply to network processes. A stopped
network process is indicated by setting command field to t .
(Fprocess_send_eof): No-op if datagram connection.
(Fstatus_notify): Don't read input for a stream server socket or a
stopped network process.
(init_process): Initialize datagram_address array.
(syms_of_process): Intern and staticpro new variables, defsubr new
functions.
2002-03-17 20:20:33 +00:00
|
|
|
|
else if (EQ (p->command, Qt))
|
|
|
|
|
status = Qstop;
|
|
|
|
|
else if (EQ (status, Qrun))
|
|
|
|
|
status = Qopen;
|
1992-03-14 20:40:04 +00:00
|
|
|
|
}
|
|
|
|
|
return status;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
DEFUN ("process-exit-status", Fprocess_exit_status, Sprocess_exit_status,
|
|
|
|
|
1, 1, 0,
|
2001-10-20 20:56:10 +00:00
|
|
|
|
doc: /* Return the exit status of PROCESS or the signal number that killed it.
|
|
|
|
|
If PROCESS has not yet exited or died, return 0. */)
|
2010-07-08 14:25:08 -07:00
|
|
|
|
(register Lisp_Object process)
|
1992-03-14 20:40:04 +00:00
|
|
|
|
{
|
2001-11-02 20:46:55 +00:00
|
|
|
|
CHECK_PROCESS (process);
|
* process.h (struct Lisp_Process): Replace Lisp_Objects `pid',
`raw_status_high', and `raw_status_low' with plain integers, and move
them to the end of the structure.
* alloc.c (allocate_process): Use PSEUDOVECSIZE to initialize the
pseudovector's size field so only the Lisp_Object fields get GC'd.
* process.c (update_status, make_process, Fdelete_process)
(Fprocess_status, list_processes_1, start_process_unwind)
(create_process, Fmake_network_process, server_accept_connection)
(wait_reading_process_output, send_process, Fprocess_running_child_p)
(process_send_signal, proc_encode_coding_system, Fprocess_send_eof)
(sigchld_handler, status_notify): Adjust to new non-Lisp fields for
`pid' and `raw_status'.
(Fprocess_id, Fsignal_process): Same, and additionally use floats when
representing PIDs that are larger than most-positive-fixnum.
2006-04-08 15:07:35 +00:00
|
|
|
|
if (XPROCESS (process)->raw_status_new)
|
(Fprocessp, Fget_buffer_process, Fdelete_process, Fprocess_status,
Fprocess_exit_status, Fprocess_id, Fprocess_name, Fprocess_command,
Fprocess_tty_name, Fset_process_buffer, Fprocess_buffer, Fprocess_mark,
Fset_process_filter, Fprocess_filter, Fset_process_sentinel,
Fprocess_sentinel, Fset_process_window_size, Fprocess_kill_without_query,
Faccept_process_output): Harmonize arguments with documentation.
1996-01-09 00:33:39 +00:00
|
|
|
|
update_status (XPROCESS (process));
|
|
|
|
|
if (CONSP (XPROCESS (process)->status))
|
1999-09-12 05:07:01 +00:00
|
|
|
|
return XCAR (XCDR (XPROCESS (process)->status));
|
1992-03-14 20:40:04 +00:00
|
|
|
|
return make_number (0);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
DEFUN ("process-id", Fprocess_id, Sprocess_id, 1, 1, 0,
|
2001-10-20 20:56:10 +00:00
|
|
|
|
doc: /* Return the process id of PROCESS.
|
2004-05-08 16:11:42 +00:00
|
|
|
|
This is the pid of the external process which PROCESS uses or talks to.
|
2001-10-20 20:56:10 +00:00
|
|
|
|
For a network connection, this value is nil. */)
|
2010-07-08 14:25:08 -07:00
|
|
|
|
(register Lisp_Object process)
|
1992-03-14 20:40:04 +00:00
|
|
|
|
{
|
2007-01-13 21:58:23 +00:00
|
|
|
|
/* Assignment to EMACS_INT stops GCC whining about limited range of
|
|
|
|
|
data type. */
|
|
|
|
|
EMACS_INT pid;
|
|
|
|
|
|
2001-11-02 20:46:55 +00:00
|
|
|
|
CHECK_PROCESS (process);
|
2007-01-13 21:58:23 +00:00
|
|
|
|
pid = XPROCESS (process)->pid;
|
|
|
|
|
return (pid ? make_fixnum_or_float (pid) : Qnil);
|
1992-03-14 20:40:04 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
DEFUN ("process-name", Fprocess_name, Sprocess_name, 1, 1, 0,
|
2001-10-20 20:56:10 +00:00
|
|
|
|
doc: /* Return the name of PROCESS, as a string.
|
|
|
|
|
This is the name of the program invoked in PROCESS,
|
|
|
|
|
possibly modified to make it unique among process names. */)
|
2010-07-08 14:25:08 -07:00
|
|
|
|
(register Lisp_Object process)
|
1992-03-14 20:40:04 +00:00
|
|
|
|
{
|
2001-11-02 20:46:55 +00:00
|
|
|
|
CHECK_PROCESS (process);
|
(Fprocessp, Fget_buffer_process, Fdelete_process, Fprocess_status,
Fprocess_exit_status, Fprocess_id, Fprocess_name, Fprocess_command,
Fprocess_tty_name, Fset_process_buffer, Fprocess_buffer, Fprocess_mark,
Fset_process_filter, Fprocess_filter, Fset_process_sentinel,
Fprocess_sentinel, Fset_process_window_size, Fprocess_kill_without_query,
Faccept_process_output): Harmonize arguments with documentation.
1996-01-09 00:33:39 +00:00
|
|
|
|
return XPROCESS (process)->name;
|
1992-03-14 20:40:04 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
DEFUN ("process-command", Fprocess_command, Sprocess_command, 1, 1, 0,
|
2001-10-20 20:56:10 +00:00
|
|
|
|
doc: /* Return the command that was executed to start PROCESS.
|
|
|
|
|
This is a list of strings, the first string being the program executed
|
|
|
|
|
and the rest of the strings being the arguments given to it.
|
Daniel Engeler <engeler at gmail.com>
These changes add serial port access.
* process.c: Add HAVE_SERIAL.
(Fdelete_process, Fprocess_status, Fset_process_buffer)
(Fset_process_filter, Fset_process_sentinel, Fprocess_contact)
(list_processes_1, select_wrapper, Fstop_process)
(Fcontinue_process, Fprocess_send_eof, kill_buffer_processes)
(status_notify): Modify to handle serial processes.
[HAVE_SERIAL] (Fserial_process_configure)
[HAVE_SERIAL] (make_serial_process_unwind, Fmake_serial_process):
New functions.
* process.h (struct Lisp_Process): Add `type'.
* sysdep.c [HAVE_TERMIOS] (serial_open, serial_configure):
New functions.
* w32.c (_sys_read_ahead, sys_read, sys_write): Modify to handle serial ports.
(serial_open, serial_configure) New functions.
* w32.h: Add FILE_SERIAL.
(struct _child_process): Add ovl_read, ovl_write.
2008-06-13 08:08:20 +00:00
|
|
|
|
For a network or serial process, this is nil (process is running) or t
|
|
|
|
|
\(process is stopped). */)
|
2010-07-08 14:25:08 -07:00
|
|
|
|
(register Lisp_Object process)
|
1992-03-14 20:40:04 +00:00
|
|
|
|
{
|
2001-11-02 20:46:55 +00:00
|
|
|
|
CHECK_PROCESS (process);
|
(Fprocessp, Fget_buffer_process, Fdelete_process, Fprocess_status,
Fprocess_exit_status, Fprocess_id, Fprocess_name, Fprocess_command,
Fprocess_tty_name, Fset_process_buffer, Fprocess_buffer, Fprocess_mark,
Fset_process_filter, Fprocess_filter, Fset_process_sentinel,
Fprocess_sentinel, Fset_process_window_size, Fprocess_kill_without_query,
Faccept_process_output): Harmonize arguments with documentation.
1996-01-09 00:33:39 +00:00
|
|
|
|
return XPROCESS (process)->command;
|
1992-03-14 20:40:04 +00:00
|
|
|
|
}
|
|
|
|
|
|
1994-09-23 22:28:08 +00:00
|
|
|
|
DEFUN ("process-tty-name", Fprocess_tty_name, Sprocess_tty_name, 1, 1, 0,
|
2001-10-20 20:56:10 +00:00
|
|
|
|
doc: /* Return the name of the terminal PROCESS uses, or nil if none.
|
|
|
|
|
This is the terminal that the process itself reads and writes on,
|
|
|
|
|
not the name of the pty that Emacs uses to talk with that terminal. */)
|
2010-07-08 14:25:08 -07:00
|
|
|
|
(register Lisp_Object process)
|
1994-09-23 22:28:08 +00:00
|
|
|
|
{
|
2001-11-02 20:46:55 +00:00
|
|
|
|
CHECK_PROCESS (process);
|
(Fprocessp, Fget_buffer_process, Fdelete_process, Fprocess_status,
Fprocess_exit_status, Fprocess_id, Fprocess_name, Fprocess_command,
Fprocess_tty_name, Fset_process_buffer, Fprocess_buffer, Fprocess_mark,
Fset_process_filter, Fprocess_filter, Fset_process_sentinel,
Fprocess_sentinel, Fset_process_window_size, Fprocess_kill_without_query,
Faccept_process_output): Harmonize arguments with documentation.
1996-01-09 00:33:39 +00:00
|
|
|
|
return XPROCESS (process)->tty_name;
|
1994-09-23 22:28:08 +00:00
|
|
|
|
}
|
|
|
|
|
|
1992-03-14 20:40:04 +00:00
|
|
|
|
DEFUN ("set-process-buffer", Fset_process_buffer, Sset_process_buffer,
|
2001-10-20 20:56:10 +00:00
|
|
|
|
2, 2, 0,
|
|
|
|
|
doc: /* Set buffer associated with PROCESS to BUFFER (a buffer, or nil). */)
|
2010-07-08 14:25:08 -07:00
|
|
|
|
(register Lisp_Object process, Lisp_Object buffer)
|
1992-03-14 20:40:04 +00:00
|
|
|
|
{
|
(Qlocal, QCname, QCbuffer, QChost, QCservice, QCfamily)
(QClocal, QCremote, QCserver, QCdatagram, QCnowait, QCnoquery,QCstop)
(QCcoding, QCoptions, QCfilter, QCsentinel, QClog, QCfeature):
New variables.
(NETCONN1_P): New macro.
(DATAGRAM_SOCKETS): New conditional symbol.
(datagram_address): New array.
(DATAGRAM_CONN_P, DATAGRAM_CHAN_P): New macros.
(status_message): Use concat3.
(Fprocess_status): Add `listen' status to doc string. Return `stop'
for a stopped network process.
(Fset_process_buffer): Update contact plist for network process.
(Fset_process_filter): Ditto. Don't enable input for stopped
network processes. Server must listen, even if filter is t.
(Fset_process_query_on_exit_flag, Fprocess_query_on_exit_flag):
New functions.
(Fprocess_kill_without_query): Removed. Now defined in simple.el.
(Fprocess_contact): Added KEY argument. Handle datagrams.
(list_processes_1): Optionally show only processes with the query
on exit flag set. Dynamically adjust column widths. Omit tty
column if not needed. Report stopped network processes.
Identify server and datagram network processes.
(Flist_processes): New optional arg `query-only'.
(conv_sockaddr_to_lisp, get_lisp_to_sockaddr_size)
(conv_lisp_to_sockaddr, set_socket_options)
(network_process_featurep, unwind_request_sigio): New helper functions.
(Fprocess_datagram_address, Fset_process_datagram_address):
(Fset_network_process_options): New lisp functions.
(Fopen_network_stream): Removed. Now defined in simple.el.
(Fmake_network_process): New lisp function. Code is based on previous
Fopen_network_stream, but heavily reworked with new property list based
argument list, support for datagrams, server processes, and local
sockets in addition to old client-only functionality.
(server_accept_connection): New function.
(wait_reading_process_input): Use it to handle incoming connects.
Do not enable input on a new connection if process is stopped.
(read_process_output): Handle datagram sockets. Use 2k buffer for them.
(send_process): Handle datagram sockets.
(Fstop_process, Fcontinue_process): Apply to network processes. A stopped
network process is indicated by setting command field to t .
(Fprocess_send_eof): No-op if datagram connection.
(Fstatus_notify): Don't read input for a stream server socket or a
stopped network process.
(init_process): Initialize datagram_address array.
(syms_of_process): Intern and staticpro new variables, defsubr new
functions.
2002-03-17 20:20:33 +00:00
|
|
|
|
struct Lisp_Process *p;
|
|
|
|
|
|
2001-11-02 20:46:55 +00:00
|
|
|
|
CHECK_PROCESS (process);
|
1992-03-14 20:40:04 +00:00
|
|
|
|
if (!NILP (buffer))
|
2001-11-02 20:46:55 +00:00
|
|
|
|
CHECK_BUFFER (buffer);
|
(Qlocal, QCname, QCbuffer, QChost, QCservice, QCfamily)
(QClocal, QCremote, QCserver, QCdatagram, QCnowait, QCnoquery,QCstop)
(QCcoding, QCoptions, QCfilter, QCsentinel, QClog, QCfeature):
New variables.
(NETCONN1_P): New macro.
(DATAGRAM_SOCKETS): New conditional symbol.
(datagram_address): New array.
(DATAGRAM_CONN_P, DATAGRAM_CHAN_P): New macros.
(status_message): Use concat3.
(Fprocess_status): Add `listen' status to doc string. Return `stop'
for a stopped network process.
(Fset_process_buffer): Update contact plist for network process.
(Fset_process_filter): Ditto. Don't enable input for stopped
network processes. Server must listen, even if filter is t.
(Fset_process_query_on_exit_flag, Fprocess_query_on_exit_flag):
New functions.
(Fprocess_kill_without_query): Removed. Now defined in simple.el.
(Fprocess_contact): Added KEY argument. Handle datagrams.
(list_processes_1): Optionally show only processes with the query
on exit flag set. Dynamically adjust column widths. Omit tty
column if not needed. Report stopped network processes.
Identify server and datagram network processes.
(Flist_processes): New optional arg `query-only'.
(conv_sockaddr_to_lisp, get_lisp_to_sockaddr_size)
(conv_lisp_to_sockaddr, set_socket_options)
(network_process_featurep, unwind_request_sigio): New helper functions.
(Fprocess_datagram_address, Fset_process_datagram_address):
(Fset_network_process_options): New lisp functions.
(Fopen_network_stream): Removed. Now defined in simple.el.
(Fmake_network_process): New lisp function. Code is based on previous
Fopen_network_stream, but heavily reworked with new property list based
argument list, support for datagrams, server processes, and local
sockets in addition to old client-only functionality.
(server_accept_connection): New function.
(wait_reading_process_input): Use it to handle incoming connects.
Do not enable input on a new connection if process is stopped.
(read_process_output): Handle datagram sockets. Use 2k buffer for them.
(send_process): Handle datagram sockets.
(Fstop_process, Fcontinue_process): Apply to network processes. A stopped
network process is indicated by setting command field to t .
(Fprocess_send_eof): No-op if datagram connection.
(Fstatus_notify): Don't read input for a stream server socket or a
stopped network process.
(init_process): Initialize datagram_address array.
(syms_of_process): Intern and staticpro new variables, defsubr new
functions.
2002-03-17 20:20:33 +00:00
|
|
|
|
p = XPROCESS (process);
|
|
|
|
|
p->buffer = buffer;
|
Daniel Engeler <engeler at gmail.com>
These changes add serial port access.
* process.c: Add HAVE_SERIAL.
(Fdelete_process, Fprocess_status, Fset_process_buffer)
(Fset_process_filter, Fset_process_sentinel, Fprocess_contact)
(list_processes_1, select_wrapper, Fstop_process)
(Fcontinue_process, Fprocess_send_eof, kill_buffer_processes)
(status_notify): Modify to handle serial processes.
[HAVE_SERIAL] (Fserial_process_configure)
[HAVE_SERIAL] (make_serial_process_unwind, Fmake_serial_process):
New functions.
* process.h (struct Lisp_Process): Add `type'.
* sysdep.c [HAVE_TERMIOS] (serial_open, serial_configure):
New functions.
* w32.c (_sys_read_ahead, sys_read, sys_write): Modify to handle serial ports.
(serial_open, serial_configure) New functions.
* w32.h: Add FILE_SERIAL.
(struct _child_process): Add ovl_read, ovl_write.
2008-06-13 08:08:20 +00:00
|
|
|
|
if (NETCONN1_P (p) || SERIALCONN1_P (p))
|
(Qlocal, QCname, QCbuffer, QChost, QCservice, QCfamily)
(QClocal, QCremote, QCserver, QCdatagram, QCnowait, QCnoquery,QCstop)
(QCcoding, QCoptions, QCfilter, QCsentinel, QClog, QCfeature):
New variables.
(NETCONN1_P): New macro.
(DATAGRAM_SOCKETS): New conditional symbol.
(datagram_address): New array.
(DATAGRAM_CONN_P, DATAGRAM_CHAN_P): New macros.
(status_message): Use concat3.
(Fprocess_status): Add `listen' status to doc string. Return `stop'
for a stopped network process.
(Fset_process_buffer): Update contact plist for network process.
(Fset_process_filter): Ditto. Don't enable input for stopped
network processes. Server must listen, even if filter is t.
(Fset_process_query_on_exit_flag, Fprocess_query_on_exit_flag):
New functions.
(Fprocess_kill_without_query): Removed. Now defined in simple.el.
(Fprocess_contact): Added KEY argument. Handle datagrams.
(list_processes_1): Optionally show only processes with the query
on exit flag set. Dynamically adjust column widths. Omit tty
column if not needed. Report stopped network processes.
Identify server and datagram network processes.
(Flist_processes): New optional arg `query-only'.
(conv_sockaddr_to_lisp, get_lisp_to_sockaddr_size)
(conv_lisp_to_sockaddr, set_socket_options)
(network_process_featurep, unwind_request_sigio): New helper functions.
(Fprocess_datagram_address, Fset_process_datagram_address):
(Fset_network_process_options): New lisp functions.
(Fopen_network_stream): Removed. Now defined in simple.el.
(Fmake_network_process): New lisp function. Code is based on previous
Fopen_network_stream, but heavily reworked with new property list based
argument list, support for datagrams, server processes, and local
sockets in addition to old client-only functionality.
(server_accept_connection): New function.
(wait_reading_process_input): Use it to handle incoming connects.
Do not enable input on a new connection if process is stopped.
(read_process_output): Handle datagram sockets. Use 2k buffer for them.
(send_process): Handle datagram sockets.
(Fstop_process, Fcontinue_process): Apply to network processes. A stopped
network process is indicated by setting command field to t .
(Fprocess_send_eof): No-op if datagram connection.
(Fstatus_notify): Don't read input for a stream server socket or a
stopped network process.
(init_process): Initialize datagram_address array.
(syms_of_process): Intern and staticpro new variables, defsubr new
functions.
2002-03-17 20:20:33 +00:00
|
|
|
|
p->childp = Fplist_put (p->childp, QCbuffer, buffer);
|
2003-02-10 07:58:29 +00:00
|
|
|
|
setup_process_coding_systems (process);
|
1992-03-14 20:40:04 +00:00
|
|
|
|
return buffer;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
DEFUN ("process-buffer", Fprocess_buffer, Sprocess_buffer,
|
2001-10-20 20:56:10 +00:00
|
|
|
|
1, 1, 0,
|
|
|
|
|
doc: /* Return the buffer PROCESS is associated with.
|
|
|
|
|
Output from PROCESS is inserted in this buffer unless PROCESS has a filter. */)
|
2010-07-08 14:25:08 -07:00
|
|
|
|
(register Lisp_Object process)
|
1992-03-14 20:40:04 +00:00
|
|
|
|
{
|
2001-11-02 20:46:55 +00:00
|
|
|
|
CHECK_PROCESS (process);
|
(Fprocessp, Fget_buffer_process, Fdelete_process, Fprocess_status,
Fprocess_exit_status, Fprocess_id, Fprocess_name, Fprocess_command,
Fprocess_tty_name, Fset_process_buffer, Fprocess_buffer, Fprocess_mark,
Fset_process_filter, Fprocess_filter, Fset_process_sentinel,
Fprocess_sentinel, Fset_process_window_size, Fprocess_kill_without_query,
Faccept_process_output): Harmonize arguments with documentation.
1996-01-09 00:33:39 +00:00
|
|
|
|
return XPROCESS (process)->buffer;
|
1992-03-14 20:40:04 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
DEFUN ("process-mark", Fprocess_mark, Sprocess_mark,
|
2001-10-20 20:56:10 +00:00
|
|
|
|
1, 1, 0,
|
|
|
|
|
doc: /* Return the marker for the end of the last output from PROCESS. */)
|
2010-07-08 14:25:08 -07:00
|
|
|
|
(register Lisp_Object process)
|
1992-03-14 20:40:04 +00:00
|
|
|
|
{
|
2001-11-02 20:46:55 +00:00
|
|
|
|
CHECK_PROCESS (process);
|
(Fprocessp, Fget_buffer_process, Fdelete_process, Fprocess_status,
Fprocess_exit_status, Fprocess_id, Fprocess_name, Fprocess_command,
Fprocess_tty_name, Fset_process_buffer, Fprocess_buffer, Fprocess_mark,
Fset_process_filter, Fprocess_filter, Fset_process_sentinel,
Fprocess_sentinel, Fset_process_window_size, Fprocess_kill_without_query,
Faccept_process_output): Harmonize arguments with documentation.
1996-01-09 00:33:39 +00:00
|
|
|
|
return XPROCESS (process)->mark;
|
1992-03-14 20:40:04 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
DEFUN ("set-process-filter", Fset_process_filter, Sset_process_filter,
|
2001-10-20 20:56:10 +00:00
|
|
|
|
2, 2, 0,
|
|
|
|
|
doc: /* Give PROCESS the filter function FILTER; nil means no filter.
|
2007-10-19 10:30:05 +00:00
|
|
|
|
A value of t means stop accepting output from the process.
|
2003-01-16 12:59:18 +00:00
|
|
|
|
|
|
|
|
|
When a process has a filter, its buffer is not used for output.
|
|
|
|
|
Instead, each time it does output, the entire string of output is
|
2003-02-04 14:56:31 +00:00
|
|
|
|
passed to the filter.
|
2003-01-16 12:59:18 +00:00
|
|
|
|
|
2001-10-20 20:56:10 +00:00
|
|
|
|
The filter gets two arguments: the process and the string of output.
|
2003-01-16 12:59:18 +00:00
|
|
|
|
The string argument is normally a multibyte string, except:
|
|
|
|
|
- if the process' input coding system is no-conversion or raw-text,
|
|
|
|
|
it is a unibyte string (the non-converted input), or else
|
|
|
|
|
- if `default-enable-multibyte-characters' is nil, it is a unibyte
|
|
|
|
|
string (the result of converting the decoded input multibyte
|
|
|
|
|
string to unibyte with `string-make-unibyte'). */)
|
2010-07-08 14:25:08 -07:00
|
|
|
|
(register Lisp_Object process, Lisp_Object filter)
|
1992-03-14 20:40:04 +00:00
|
|
|
|
{
|
2001-03-07 12:55:29 +00:00
|
|
|
|
struct Lisp_Process *p;
|
2003-02-04 14:56:31 +00:00
|
|
|
|
|
2001-11-02 20:46:55 +00:00
|
|
|
|
CHECK_PROCESS (process);
|
2001-03-07 12:55:29 +00:00
|
|
|
|
p = XPROCESS (process);
|
|
|
|
|
|
|
|
|
|
/* Don't signal an error if the process' input file descriptor
|
|
|
|
|
is closed. This could make debugging Lisp more difficult,
|
|
|
|
|
for example when doing something like
|
|
|
|
|
|
|
|
|
|
(setq process (start-process ...))
|
|
|
|
|
(debug)
|
|
|
|
|
(set-process-filter process ...) */
|
2003-02-04 14:56:31 +00:00
|
|
|
|
|
(struct Lisp_Process): Turn slots infd, outfd, kill_without_query, pty_flag,
tick, update_tick, decoding_carryover, inherit_coding_system_flag,
filter_multibyte, adaptive_read_buffering, read_output_delay, and
read_output_skip from Lisp_Objects to ints. Remove unused
encoding_carryover.
2007-07-12 06:36:57 +00:00
|
|
|
|
if (p->infd >= 0)
|
1994-10-25 09:48:44 +00:00
|
|
|
|
{
|
(Qlocal, QCname, QCbuffer, QChost, QCservice, QCfamily)
(QClocal, QCremote, QCserver, QCdatagram, QCnowait, QCnoquery,QCstop)
(QCcoding, QCoptions, QCfilter, QCsentinel, QClog, QCfeature):
New variables.
(NETCONN1_P): New macro.
(DATAGRAM_SOCKETS): New conditional symbol.
(datagram_address): New array.
(DATAGRAM_CONN_P, DATAGRAM_CHAN_P): New macros.
(status_message): Use concat3.
(Fprocess_status): Add `listen' status to doc string. Return `stop'
for a stopped network process.
(Fset_process_buffer): Update contact plist for network process.
(Fset_process_filter): Ditto. Don't enable input for stopped
network processes. Server must listen, even if filter is t.
(Fset_process_query_on_exit_flag, Fprocess_query_on_exit_flag):
New functions.
(Fprocess_kill_without_query): Removed. Now defined in simple.el.
(Fprocess_contact): Added KEY argument. Handle datagrams.
(list_processes_1): Optionally show only processes with the query
on exit flag set. Dynamically adjust column widths. Omit tty
column if not needed. Report stopped network processes.
Identify server and datagram network processes.
(Flist_processes): New optional arg `query-only'.
(conv_sockaddr_to_lisp, get_lisp_to_sockaddr_size)
(conv_lisp_to_sockaddr, set_socket_options)
(network_process_featurep, unwind_request_sigio): New helper functions.
(Fprocess_datagram_address, Fset_process_datagram_address):
(Fset_network_process_options): New lisp functions.
(Fopen_network_stream): Removed. Now defined in simple.el.
(Fmake_network_process): New lisp function. Code is based on previous
Fopen_network_stream, but heavily reworked with new property list based
argument list, support for datagrams, server processes, and local
sockets in addition to old client-only functionality.
(server_accept_connection): New function.
(wait_reading_process_input): Use it to handle incoming connects.
Do not enable input on a new connection if process is stopped.
(read_process_output): Handle datagram sockets. Use 2k buffer for them.
(send_process): Handle datagram sockets.
(Fstop_process, Fcontinue_process): Apply to network processes. A stopped
network process is indicated by setting command field to t .
(Fprocess_send_eof): No-op if datagram connection.
(Fstatus_notify): Don't read input for a stream server socket or a
stopped network process.
(init_process): Initialize datagram_address array.
(syms_of_process): Intern and staticpro new variables, defsubr new
functions.
2002-03-17 20:20:33 +00:00
|
|
|
|
if (EQ (filter, Qt) && !EQ (p->status, Qlisten))
|
2001-03-07 12:55:29 +00:00
|
|
|
|
{
|
(struct Lisp_Process): Turn slots infd, outfd, kill_without_query, pty_flag,
tick, update_tick, decoding_carryover, inherit_coding_system_flag,
filter_multibyte, adaptive_read_buffering, read_output_delay, and
read_output_skip from Lisp_Objects to ints. Remove unused
encoding_carryover.
2007-07-12 06:36:57 +00:00
|
|
|
|
FD_CLR (p->infd, &input_wait_mask);
|
|
|
|
|
FD_CLR (p->infd, &non_keyboard_wait_mask);
|
2001-03-07 12:55:29 +00:00
|
|
|
|
}
|
(Qlocal, QCname, QCbuffer, QChost, QCservice, QCfamily)
(QClocal, QCremote, QCserver, QCdatagram, QCnowait, QCnoquery,QCstop)
(QCcoding, QCoptions, QCfilter, QCsentinel, QClog, QCfeature):
New variables.
(NETCONN1_P): New macro.
(DATAGRAM_SOCKETS): New conditional symbol.
(datagram_address): New array.
(DATAGRAM_CONN_P, DATAGRAM_CHAN_P): New macros.
(status_message): Use concat3.
(Fprocess_status): Add `listen' status to doc string. Return `stop'
for a stopped network process.
(Fset_process_buffer): Update contact plist for network process.
(Fset_process_filter): Ditto. Don't enable input for stopped
network processes. Server must listen, even if filter is t.
(Fset_process_query_on_exit_flag, Fprocess_query_on_exit_flag):
New functions.
(Fprocess_kill_without_query): Removed. Now defined in simple.el.
(Fprocess_contact): Added KEY argument. Handle datagrams.
(list_processes_1): Optionally show only processes with the query
on exit flag set. Dynamically adjust column widths. Omit tty
column if not needed. Report stopped network processes.
Identify server and datagram network processes.
(Flist_processes): New optional arg `query-only'.
(conv_sockaddr_to_lisp, get_lisp_to_sockaddr_size)
(conv_lisp_to_sockaddr, set_socket_options)
(network_process_featurep, unwind_request_sigio): New helper functions.
(Fprocess_datagram_address, Fset_process_datagram_address):
(Fset_network_process_options): New lisp functions.
(Fopen_network_stream): Removed. Now defined in simple.el.
(Fmake_network_process): New lisp function. Code is based on previous
Fopen_network_stream, but heavily reworked with new property list based
argument list, support for datagrams, server processes, and local
sockets in addition to old client-only functionality.
(server_accept_connection): New function.
(wait_reading_process_input): Use it to handle incoming connects.
Do not enable input on a new connection if process is stopped.
(read_process_output): Handle datagram sockets. Use 2k buffer for them.
(send_process): Handle datagram sockets.
(Fstop_process, Fcontinue_process): Apply to network processes. A stopped
network process is indicated by setting command field to t .
(Fprocess_send_eof): No-op if datagram connection.
(Fstatus_notify): Don't read input for a stream server socket or a
stopped network process.
(init_process): Initialize datagram_address array.
(syms_of_process): Intern and staticpro new variables, defsubr new
functions.
2002-03-17 20:20:33 +00:00
|
|
|
|
else if (EQ (p->filter, Qt)
|
Daniel Engeler <engeler at gmail.com>
These changes add serial port access.
* process.c: Add HAVE_SERIAL.
(Fdelete_process, Fprocess_status, Fset_process_buffer)
(Fset_process_filter, Fset_process_sentinel, Fprocess_contact)
(list_processes_1, select_wrapper, Fstop_process)
(Fcontinue_process, Fprocess_send_eof, kill_buffer_processes)
(status_notify): Modify to handle serial processes.
[HAVE_SERIAL] (Fserial_process_configure)
[HAVE_SERIAL] (make_serial_process_unwind, Fmake_serial_process):
New functions.
* process.h (struct Lisp_Process): Add `type'.
* sysdep.c [HAVE_TERMIOS] (serial_open, serial_configure):
New functions.
* w32.c (_sys_read_ahead, sys_read, sys_write): Modify to handle serial ports.
(serial_open, serial_configure) New functions.
* w32.h: Add FILE_SERIAL.
(struct _child_process): Add ovl_read, ovl_write.
2008-06-13 08:08:20 +00:00
|
|
|
|
/* Network or serial process not stopped: */
|
|
|
|
|
&& !EQ (p->command, Qt))
|
2001-03-07 12:55:29 +00:00
|
|
|
|
{
|
(struct Lisp_Process): Turn slots infd, outfd, kill_without_query, pty_flag,
tick, update_tick, decoding_carryover, inherit_coding_system_flag,
filter_multibyte, adaptive_read_buffering, read_output_delay, and
read_output_skip from Lisp_Objects to ints. Remove unused
encoding_carryover.
2007-07-12 06:36:57 +00:00
|
|
|
|
FD_SET (p->infd, &input_wait_mask);
|
|
|
|
|
FD_SET (p->infd, &non_keyboard_wait_mask);
|
2001-03-07 12:55:29 +00:00
|
|
|
|
}
|
1994-10-25 09:48:44 +00:00
|
|
|
|
}
|
2003-02-04 14:56:31 +00:00
|
|
|
|
|
2001-03-07 12:55:29 +00:00
|
|
|
|
p->filter = filter;
|
Daniel Engeler <engeler at gmail.com>
These changes add serial port access.
* process.c: Add HAVE_SERIAL.
(Fdelete_process, Fprocess_status, Fset_process_buffer)
(Fset_process_filter, Fset_process_sentinel, Fprocess_contact)
(list_processes_1, select_wrapper, Fstop_process)
(Fcontinue_process, Fprocess_send_eof, kill_buffer_processes)
(status_notify): Modify to handle serial processes.
[HAVE_SERIAL] (Fserial_process_configure)
[HAVE_SERIAL] (make_serial_process_unwind, Fmake_serial_process):
New functions.
* process.h (struct Lisp_Process): Add `type'.
* sysdep.c [HAVE_TERMIOS] (serial_open, serial_configure):
New functions.
* w32.c (_sys_read_ahead, sys_read, sys_write): Modify to handle serial ports.
(serial_open, serial_configure) New functions.
* w32.h: Add FILE_SERIAL.
(struct _child_process): Add ovl_read, ovl_write.
2008-06-13 08:08:20 +00:00
|
|
|
|
if (NETCONN1_P (p) || SERIALCONN1_P (p))
|
(Qlocal, QCname, QCbuffer, QChost, QCservice, QCfamily)
(QClocal, QCremote, QCserver, QCdatagram, QCnowait, QCnoquery,QCstop)
(QCcoding, QCoptions, QCfilter, QCsentinel, QClog, QCfeature):
New variables.
(NETCONN1_P): New macro.
(DATAGRAM_SOCKETS): New conditional symbol.
(datagram_address): New array.
(DATAGRAM_CONN_P, DATAGRAM_CHAN_P): New macros.
(status_message): Use concat3.
(Fprocess_status): Add `listen' status to doc string. Return `stop'
for a stopped network process.
(Fset_process_buffer): Update contact plist for network process.
(Fset_process_filter): Ditto. Don't enable input for stopped
network processes. Server must listen, even if filter is t.
(Fset_process_query_on_exit_flag, Fprocess_query_on_exit_flag):
New functions.
(Fprocess_kill_without_query): Removed. Now defined in simple.el.
(Fprocess_contact): Added KEY argument. Handle datagrams.
(list_processes_1): Optionally show only processes with the query
on exit flag set. Dynamically adjust column widths. Omit tty
column if not needed. Report stopped network processes.
Identify server and datagram network processes.
(Flist_processes): New optional arg `query-only'.
(conv_sockaddr_to_lisp, get_lisp_to_sockaddr_size)
(conv_lisp_to_sockaddr, set_socket_options)
(network_process_featurep, unwind_request_sigio): New helper functions.
(Fprocess_datagram_address, Fset_process_datagram_address):
(Fset_network_process_options): New lisp functions.
(Fopen_network_stream): Removed. Now defined in simple.el.
(Fmake_network_process): New lisp function. Code is based on previous
Fopen_network_stream, but heavily reworked with new property list based
argument list, support for datagrams, server processes, and local
sockets in addition to old client-only functionality.
(server_accept_connection): New function.
(wait_reading_process_input): Use it to handle incoming connects.
Do not enable input on a new connection if process is stopped.
(read_process_output): Handle datagram sockets. Use 2k buffer for them.
(send_process): Handle datagram sockets.
(Fstop_process, Fcontinue_process): Apply to network processes. A stopped
network process is indicated by setting command field to t .
(Fprocess_send_eof): No-op if datagram connection.
(Fstatus_notify): Don't read input for a stream server socket or a
stopped network process.
(init_process): Initialize datagram_address array.
(syms_of_process): Intern and staticpro new variables, defsubr new
functions.
2002-03-17 20:20:33 +00:00
|
|
|
|
p->childp = Fplist_put (p->childp, QCfilter, filter);
|
2003-02-10 07:58:29 +00:00
|
|
|
|
setup_process_coding_systems (process);
|
1992-03-14 20:40:04 +00:00
|
|
|
|
return filter;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
DEFUN ("process-filter", Fprocess_filter, Sprocess_filter,
|
2001-10-20 20:56:10 +00:00
|
|
|
|
1, 1, 0,
|
|
|
|
|
doc: /* Returns the filter function of PROCESS; nil if none.
|
|
|
|
|
See `set-process-filter' for more info on filter functions. */)
|
2010-07-08 14:25:08 -07:00
|
|
|
|
(register Lisp_Object process)
|
1992-03-14 20:40:04 +00:00
|
|
|
|
{
|
2001-11-02 20:46:55 +00:00
|
|
|
|
CHECK_PROCESS (process);
|
(Fprocessp, Fget_buffer_process, Fdelete_process, Fprocess_status,
Fprocess_exit_status, Fprocess_id, Fprocess_name, Fprocess_command,
Fprocess_tty_name, Fset_process_buffer, Fprocess_buffer, Fprocess_mark,
Fset_process_filter, Fprocess_filter, Fset_process_sentinel,
Fprocess_sentinel, Fset_process_window_size, Fprocess_kill_without_query,
Faccept_process_output): Harmonize arguments with documentation.
1996-01-09 00:33:39 +00:00
|
|
|
|
return XPROCESS (process)->filter;
|
1992-03-14 20:40:04 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
DEFUN ("set-process-sentinel", Fset_process_sentinel, Sset_process_sentinel,
|
2001-10-20 20:56:10 +00:00
|
|
|
|
2, 2, 0,
|
|
|
|
|
doc: /* Give PROCESS the sentinel SENTINEL; nil for none.
|
|
|
|
|
The sentinel is called as a function when the process changes state.
|
|
|
|
|
It gets two arguments: the process, and a string describing the change. */)
|
2010-07-08 14:25:08 -07:00
|
|
|
|
(register Lisp_Object process, Lisp_Object sentinel)
|
1992-03-14 20:40:04 +00:00
|
|
|
|
{
|
2004-04-16 12:51:06 +00:00
|
|
|
|
struct Lisp_Process *p;
|
|
|
|
|
|
2001-11-02 20:46:55 +00:00
|
|
|
|
CHECK_PROCESS (process);
|
2004-04-16 12:51:06 +00:00
|
|
|
|
p = XPROCESS (process);
|
|
|
|
|
|
|
|
|
|
p->sentinel = sentinel;
|
Daniel Engeler <engeler at gmail.com>
These changes add serial port access.
* process.c: Add HAVE_SERIAL.
(Fdelete_process, Fprocess_status, Fset_process_buffer)
(Fset_process_filter, Fset_process_sentinel, Fprocess_contact)
(list_processes_1, select_wrapper, Fstop_process)
(Fcontinue_process, Fprocess_send_eof, kill_buffer_processes)
(status_notify): Modify to handle serial processes.
[HAVE_SERIAL] (Fserial_process_configure)
[HAVE_SERIAL] (make_serial_process_unwind, Fmake_serial_process):
New functions.
* process.h (struct Lisp_Process): Add `type'.
* sysdep.c [HAVE_TERMIOS] (serial_open, serial_configure):
New functions.
* w32.c (_sys_read_ahead, sys_read, sys_write): Modify to handle serial ports.
(serial_open, serial_configure) New functions.
* w32.h: Add FILE_SERIAL.
(struct _child_process): Add ovl_read, ovl_write.
2008-06-13 08:08:20 +00:00
|
|
|
|
if (NETCONN1_P (p) || SERIALCONN1_P (p))
|
2004-04-16 12:51:06 +00:00
|
|
|
|
p->childp = Fplist_put (p->childp, QCsentinel, sentinel);
|
1992-03-14 20:40:04 +00:00
|
|
|
|
return sentinel;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
DEFUN ("process-sentinel", Fprocess_sentinel, Sprocess_sentinel,
|
2001-10-20 20:56:10 +00:00
|
|
|
|
1, 1, 0,
|
|
|
|
|
doc: /* Return the sentinel of PROCESS; nil if none.
|
|
|
|
|
See `set-process-sentinel' for more info on sentinels. */)
|
2010-07-08 14:25:08 -07:00
|
|
|
|
(register Lisp_Object process)
|
1992-03-14 20:40:04 +00:00
|
|
|
|
{
|
2001-11-02 20:46:55 +00:00
|
|
|
|
CHECK_PROCESS (process);
|
(Fprocessp, Fget_buffer_process, Fdelete_process, Fprocess_status,
Fprocess_exit_status, Fprocess_id, Fprocess_name, Fprocess_command,
Fprocess_tty_name, Fset_process_buffer, Fprocess_buffer, Fprocess_mark,
Fset_process_filter, Fprocess_filter, Fset_process_sentinel,
Fprocess_sentinel, Fset_process_window_size, Fprocess_kill_without_query,
Faccept_process_output): Harmonize arguments with documentation.
1996-01-09 00:33:39 +00:00
|
|
|
|
return XPROCESS (process)->sentinel;
|
1992-03-14 20:40:04 +00:00
|
|
|
|
}
|
|
|
|
|
|
1994-04-12 15:11:58 +00:00
|
|
|
|
DEFUN ("set-process-window-size", Fset_process_window_size,
|
2001-10-20 20:56:10 +00:00
|
|
|
|
Sset_process_window_size, 3, 3, 0,
|
|
|
|
|
doc: /* Tell PROCESS that it has logical window size HEIGHT and WIDTH. */)
|
2010-07-08 14:25:08 -07:00
|
|
|
|
(register Lisp_Object process, Lisp_Object height, Lisp_Object width)
|
1994-04-12 15:11:58 +00:00
|
|
|
|
{
|
2001-11-02 20:46:55 +00:00
|
|
|
|
CHECK_PROCESS (process);
|
|
|
|
|
CHECK_NATNUM (height);
|
|
|
|
|
CHECK_NATNUM (width);
|
2003-02-04 14:56:31 +00:00
|
|
|
|
|
(struct Lisp_Process): Turn slots infd, outfd, kill_without_query, pty_flag,
tick, update_tick, decoding_carryover, inherit_coding_system_flag,
filter_multibyte, adaptive_read_buffering, read_output_delay, and
read_output_skip from Lisp_Objects to ints. Remove unused
encoding_carryover.
2007-07-12 06:36:57 +00:00
|
|
|
|
if (XPROCESS (process)->infd < 0
|
|
|
|
|
|| set_window_size (XPROCESS (process)->infd,
|
2001-03-07 12:55:29 +00:00
|
|
|
|
XINT (height), XINT (width)) <= 0)
|
1994-04-12 15:11:58 +00:00
|
|
|
|
return Qnil;
|
|
|
|
|
else
|
|
|
|
|
return Qt;
|
|
|
|
|
}
|
|
|
|
|
|
1998-04-19 14:13:47 +00:00
|
|
|
|
DEFUN ("set-process-inherit-coding-system-flag",
|
2001-10-20 20:56:10 +00:00
|
|
|
|
Fset_process_inherit_coding_system_flag,
|
|
|
|
|
Sset_process_inherit_coding_system_flag, 2, 2, 0,
|
|
|
|
|
doc: /* Determine whether buffer of PROCESS will inherit coding-system.
|
|
|
|
|
If the second argument FLAG is non-nil, then the variable
|
|
|
|
|
`buffer-file-coding-system' of the buffer associated with PROCESS
|
|
|
|
|
will be bound to the value of the coding system used to decode
|
|
|
|
|
the process output.
|
|
|
|
|
|
|
|
|
|
This is useful when the coding system specified for the process buffer
|
|
|
|
|
leaves either the character code conversion or the end-of-line conversion
|
|
|
|
|
unspecified, or if the coding system used to decode the process output
|
|
|
|
|
is more appropriate for saving the process buffer.
|
|
|
|
|
|
|
|
|
|
Binding the variable `inherit-process-coding-system' to non-nil before
|
|
|
|
|
starting the process is an alternative way of setting the inherit flag
|
|
|
|
|
for the process which will run. */)
|
2010-07-08 14:25:08 -07:00
|
|
|
|
(register Lisp_Object process, Lisp_Object flag)
|
1998-04-19 14:13:47 +00:00
|
|
|
|
{
|
2001-11-02 20:46:55 +00:00
|
|
|
|
CHECK_PROCESS (process);
|
(struct Lisp_Process): Turn slots infd, outfd, kill_without_query, pty_flag,
tick, update_tick, decoding_carryover, inherit_coding_system_flag,
filter_multibyte, adaptive_read_buffering, read_output_delay, and
read_output_skip from Lisp_Objects to ints. Remove unused
encoding_carryover.
2007-07-12 06:36:57 +00:00
|
|
|
|
XPROCESS (process)->inherit_coding_system_flag = !NILP (flag);
|
1998-04-19 14:13:47 +00:00
|
|
|
|
return flag;
|
|
|
|
|
}
|
|
|
|
|
|
(Qlocal, QCname, QCbuffer, QChost, QCservice, QCfamily)
(QClocal, QCremote, QCserver, QCdatagram, QCnowait, QCnoquery,QCstop)
(QCcoding, QCoptions, QCfilter, QCsentinel, QClog, QCfeature):
New variables.
(NETCONN1_P): New macro.
(DATAGRAM_SOCKETS): New conditional symbol.
(datagram_address): New array.
(DATAGRAM_CONN_P, DATAGRAM_CHAN_P): New macros.
(status_message): Use concat3.
(Fprocess_status): Add `listen' status to doc string. Return `stop'
for a stopped network process.
(Fset_process_buffer): Update contact plist for network process.
(Fset_process_filter): Ditto. Don't enable input for stopped
network processes. Server must listen, even if filter is t.
(Fset_process_query_on_exit_flag, Fprocess_query_on_exit_flag):
New functions.
(Fprocess_kill_without_query): Removed. Now defined in simple.el.
(Fprocess_contact): Added KEY argument. Handle datagrams.
(list_processes_1): Optionally show only processes with the query
on exit flag set. Dynamically adjust column widths. Omit tty
column if not needed. Report stopped network processes.
Identify server and datagram network processes.
(Flist_processes): New optional arg `query-only'.
(conv_sockaddr_to_lisp, get_lisp_to_sockaddr_size)
(conv_lisp_to_sockaddr, set_socket_options)
(network_process_featurep, unwind_request_sigio): New helper functions.
(Fprocess_datagram_address, Fset_process_datagram_address):
(Fset_network_process_options): New lisp functions.
(Fopen_network_stream): Removed. Now defined in simple.el.
(Fmake_network_process): New lisp function. Code is based on previous
Fopen_network_stream, but heavily reworked with new property list based
argument list, support for datagrams, server processes, and local
sockets in addition to old client-only functionality.
(server_accept_connection): New function.
(wait_reading_process_input): Use it to handle incoming connects.
Do not enable input on a new connection if process is stopped.
(read_process_output): Handle datagram sockets. Use 2k buffer for them.
(send_process): Handle datagram sockets.
(Fstop_process, Fcontinue_process): Apply to network processes. A stopped
network process is indicated by setting command field to t .
(Fprocess_send_eof): No-op if datagram connection.
(Fstatus_notify): Don't read input for a stream server socket or a
stopped network process.
(init_process): Initialize datagram_address array.
(syms_of_process): Intern and staticpro new variables, defsubr new
functions.
2002-03-17 20:20:33 +00:00
|
|
|
|
DEFUN ("set-process-query-on-exit-flag",
|
|
|
|
|
Fset_process_query_on_exit_flag, Sset_process_query_on_exit_flag,
|
|
|
|
|
2, 2, 0,
|
|
|
|
|
doc: /* Specify if query is needed for PROCESS when Emacs is exited.
|
2004-05-08 16:11:42 +00:00
|
|
|
|
If the second argument FLAG is non-nil, Emacs will query the user before
|
2009-07-18 21:07:12 +00:00
|
|
|
|
exiting or killing a buffer if PROCESS is running. */)
|
2010-07-08 14:25:08 -07:00
|
|
|
|
(register Lisp_Object process, Lisp_Object flag)
|
1992-03-14 20:40:04 +00:00
|
|
|
|
{
|
2001-11-02 20:46:55 +00:00
|
|
|
|
CHECK_PROCESS (process);
|
(struct Lisp_Process): Turn slots infd, outfd, kill_without_query, pty_flag,
tick, update_tick, decoding_carryover, inherit_coding_system_flag,
filter_multibyte, adaptive_read_buffering, read_output_delay, and
read_output_skip from Lisp_Objects to ints. Remove unused
encoding_carryover.
2007-07-12 06:36:57 +00:00
|
|
|
|
XPROCESS (process)->kill_without_query = NILP (flag);
|
(Qlocal, QCname, QCbuffer, QChost, QCservice, QCfamily)
(QClocal, QCremote, QCserver, QCdatagram, QCnowait, QCnoquery,QCstop)
(QCcoding, QCoptions, QCfilter, QCsentinel, QClog, QCfeature):
New variables.
(NETCONN1_P): New macro.
(DATAGRAM_SOCKETS): New conditional symbol.
(datagram_address): New array.
(DATAGRAM_CONN_P, DATAGRAM_CHAN_P): New macros.
(status_message): Use concat3.
(Fprocess_status): Add `listen' status to doc string. Return `stop'
for a stopped network process.
(Fset_process_buffer): Update contact plist for network process.
(Fset_process_filter): Ditto. Don't enable input for stopped
network processes. Server must listen, even if filter is t.
(Fset_process_query_on_exit_flag, Fprocess_query_on_exit_flag):
New functions.
(Fprocess_kill_without_query): Removed. Now defined in simple.el.
(Fprocess_contact): Added KEY argument. Handle datagrams.
(list_processes_1): Optionally show only processes with the query
on exit flag set. Dynamically adjust column widths. Omit tty
column if not needed. Report stopped network processes.
Identify server and datagram network processes.
(Flist_processes): New optional arg `query-only'.
(conv_sockaddr_to_lisp, get_lisp_to_sockaddr_size)
(conv_lisp_to_sockaddr, set_socket_options)
(network_process_featurep, unwind_request_sigio): New helper functions.
(Fprocess_datagram_address, Fset_process_datagram_address):
(Fset_network_process_options): New lisp functions.
(Fopen_network_stream): Removed. Now defined in simple.el.
(Fmake_network_process): New lisp function. Code is based on previous
Fopen_network_stream, but heavily reworked with new property list based
argument list, support for datagrams, server processes, and local
sockets in addition to old client-only functionality.
(server_accept_connection): New function.
(wait_reading_process_input): Use it to handle incoming connects.
Do not enable input on a new connection if process is stopped.
(read_process_output): Handle datagram sockets. Use 2k buffer for them.
(send_process): Handle datagram sockets.
(Fstop_process, Fcontinue_process): Apply to network processes. A stopped
network process is indicated by setting command field to t .
(Fprocess_send_eof): No-op if datagram connection.
(Fstatus_notify): Don't read input for a stream server socket or a
stopped network process.
(init_process): Initialize datagram_address array.
(syms_of_process): Intern and staticpro new variables, defsubr new
functions.
2002-03-17 20:20:33 +00:00
|
|
|
|
return flag;
|
1992-03-14 20:40:04 +00:00
|
|
|
|
}
|
1993-07-22 19:38:51 +00:00
|
|
|
|
|
(Qlocal, QCname, QCbuffer, QChost, QCservice, QCfamily)
(QClocal, QCremote, QCserver, QCdatagram, QCnowait, QCnoquery,QCstop)
(QCcoding, QCoptions, QCfilter, QCsentinel, QClog, QCfeature):
New variables.
(NETCONN1_P): New macro.
(DATAGRAM_SOCKETS): New conditional symbol.
(datagram_address): New array.
(DATAGRAM_CONN_P, DATAGRAM_CHAN_P): New macros.
(status_message): Use concat3.
(Fprocess_status): Add `listen' status to doc string. Return `stop'
for a stopped network process.
(Fset_process_buffer): Update contact plist for network process.
(Fset_process_filter): Ditto. Don't enable input for stopped
network processes. Server must listen, even if filter is t.
(Fset_process_query_on_exit_flag, Fprocess_query_on_exit_flag):
New functions.
(Fprocess_kill_without_query): Removed. Now defined in simple.el.
(Fprocess_contact): Added KEY argument. Handle datagrams.
(list_processes_1): Optionally show only processes with the query
on exit flag set. Dynamically adjust column widths. Omit tty
column if not needed. Report stopped network processes.
Identify server and datagram network processes.
(Flist_processes): New optional arg `query-only'.
(conv_sockaddr_to_lisp, get_lisp_to_sockaddr_size)
(conv_lisp_to_sockaddr, set_socket_options)
(network_process_featurep, unwind_request_sigio): New helper functions.
(Fprocess_datagram_address, Fset_process_datagram_address):
(Fset_network_process_options): New lisp functions.
(Fopen_network_stream): Removed. Now defined in simple.el.
(Fmake_network_process): New lisp function. Code is based on previous
Fopen_network_stream, but heavily reworked with new property list based
argument list, support for datagrams, server processes, and local
sockets in addition to old client-only functionality.
(server_accept_connection): New function.
(wait_reading_process_input): Use it to handle incoming connects.
Do not enable input on a new connection if process is stopped.
(read_process_output): Handle datagram sockets. Use 2k buffer for them.
(send_process): Handle datagram sockets.
(Fstop_process, Fcontinue_process): Apply to network processes. A stopped
network process is indicated by setting command field to t .
(Fprocess_send_eof): No-op if datagram connection.
(Fstatus_notify): Don't read input for a stream server socket or a
stopped network process.
(init_process): Initialize datagram_address array.
(syms_of_process): Intern and staticpro new variables, defsubr new
functions.
2002-03-17 20:20:33 +00:00
|
|
|
|
DEFUN ("process-query-on-exit-flag",
|
|
|
|
|
Fprocess_query_on_exit_flag, Sprocess_query_on_exit_flag,
|
2001-10-20 20:56:10 +00:00
|
|
|
|
1, 1, 0,
|
2004-05-08 16:11:42 +00:00
|
|
|
|
doc: /* Return the current value of query-on-exit flag for PROCESS. */)
|
2010-07-08 14:25:08 -07:00
|
|
|
|
(register Lisp_Object process)
|
1996-09-01 23:18:03 +00:00
|
|
|
|
{
|
2001-11-02 20:46:55 +00:00
|
|
|
|
CHECK_PROCESS (process);
|
(struct Lisp_Process): Turn slots infd, outfd, kill_without_query, pty_flag,
tick, update_tick, decoding_carryover, inherit_coding_system_flag,
filter_multibyte, adaptive_read_buffering, read_output_delay, and
read_output_skip from Lisp_Objects to ints. Remove unused
encoding_carryover.
2007-07-12 06:36:57 +00:00
|
|
|
|
return (XPROCESS (process)->kill_without_query ? Qnil : Qt);
|
(Qlocal, QCname, QCbuffer, QChost, QCservice, QCfamily)
(QClocal, QCremote, QCserver, QCdatagram, QCnowait, QCnoquery,QCstop)
(QCcoding, QCoptions, QCfilter, QCsentinel, QClog, QCfeature):
New variables.
(NETCONN1_P): New macro.
(DATAGRAM_SOCKETS): New conditional symbol.
(datagram_address): New array.
(DATAGRAM_CONN_P, DATAGRAM_CHAN_P): New macros.
(status_message): Use concat3.
(Fprocess_status): Add `listen' status to doc string. Return `stop'
for a stopped network process.
(Fset_process_buffer): Update contact plist for network process.
(Fset_process_filter): Ditto. Don't enable input for stopped
network processes. Server must listen, even if filter is t.
(Fset_process_query_on_exit_flag, Fprocess_query_on_exit_flag):
New functions.
(Fprocess_kill_without_query): Removed. Now defined in simple.el.
(Fprocess_contact): Added KEY argument. Handle datagrams.
(list_processes_1): Optionally show only processes with the query
on exit flag set. Dynamically adjust column widths. Omit tty
column if not needed. Report stopped network processes.
Identify server and datagram network processes.
(Flist_processes): New optional arg `query-only'.
(conv_sockaddr_to_lisp, get_lisp_to_sockaddr_size)
(conv_lisp_to_sockaddr, set_socket_options)
(network_process_featurep, unwind_request_sigio): New helper functions.
(Fprocess_datagram_address, Fset_process_datagram_address):
(Fset_network_process_options): New lisp functions.
(Fopen_network_stream): Removed. Now defined in simple.el.
(Fmake_network_process): New lisp function. Code is based on previous
Fopen_network_stream, but heavily reworked with new property list based
argument list, support for datagrams, server processes, and local
sockets in addition to old client-only functionality.
(server_accept_connection): New function.
(wait_reading_process_input): Use it to handle incoming connects.
Do not enable input on a new connection if process is stopped.
(read_process_output): Handle datagram sockets. Use 2k buffer for them.
(send_process): Handle datagram sockets.
(Fstop_process, Fcontinue_process): Apply to network processes. A stopped
network process is indicated by setting command field to t .
(Fprocess_send_eof): No-op if datagram connection.
(Fstatus_notify): Don't read input for a stream server socket or a
stopped network process.
(init_process): Initialize datagram_address array.
(syms_of_process): Intern and staticpro new variables, defsubr new
functions.
2002-03-17 20:20:33 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
#ifdef DATAGRAM_SOCKETS
|
2010-07-05 12:36:06 +02:00
|
|
|
|
Lisp_Object Fprocess_datagram_address (Lisp_Object process);
|
(Qlocal, QCname, QCbuffer, QChost, QCservice, QCfamily)
(QClocal, QCremote, QCserver, QCdatagram, QCnowait, QCnoquery,QCstop)
(QCcoding, QCoptions, QCfilter, QCsentinel, QClog, QCfeature):
New variables.
(NETCONN1_P): New macro.
(DATAGRAM_SOCKETS): New conditional symbol.
(datagram_address): New array.
(DATAGRAM_CONN_P, DATAGRAM_CHAN_P): New macros.
(status_message): Use concat3.
(Fprocess_status): Add `listen' status to doc string. Return `stop'
for a stopped network process.
(Fset_process_buffer): Update contact plist for network process.
(Fset_process_filter): Ditto. Don't enable input for stopped
network processes. Server must listen, even if filter is t.
(Fset_process_query_on_exit_flag, Fprocess_query_on_exit_flag):
New functions.
(Fprocess_kill_without_query): Removed. Now defined in simple.el.
(Fprocess_contact): Added KEY argument. Handle datagrams.
(list_processes_1): Optionally show only processes with the query
on exit flag set. Dynamically adjust column widths. Omit tty
column if not needed. Report stopped network processes.
Identify server and datagram network processes.
(Flist_processes): New optional arg `query-only'.
(conv_sockaddr_to_lisp, get_lisp_to_sockaddr_size)
(conv_lisp_to_sockaddr, set_socket_options)
(network_process_featurep, unwind_request_sigio): New helper functions.
(Fprocess_datagram_address, Fset_process_datagram_address):
(Fset_network_process_options): New lisp functions.
(Fopen_network_stream): Removed. Now defined in simple.el.
(Fmake_network_process): New lisp function. Code is based on previous
Fopen_network_stream, but heavily reworked with new property list based
argument list, support for datagrams, server processes, and local
sockets in addition to old client-only functionality.
(server_accept_connection): New function.
(wait_reading_process_input): Use it to handle incoming connects.
Do not enable input on a new connection if process is stopped.
(read_process_output): Handle datagram sockets. Use 2k buffer for them.
(send_process): Handle datagram sockets.
(Fstop_process, Fcontinue_process): Apply to network processes. A stopped
network process is indicated by setting command field to t .
(Fprocess_send_eof): No-op if datagram connection.
(Fstatus_notify): Don't read input for a stream server socket or a
stopped network process.
(init_process): Initialize datagram_address array.
(syms_of_process): Intern and staticpro new variables, defsubr new
functions.
2002-03-17 20:20:33 +00:00
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
DEFUN ("process-contact", Fprocess_contact, Sprocess_contact,
|
|
|
|
|
1, 2, 0,
|
|
|
|
|
doc: /* Return the contact info of PROCESS; t for a real child.
|
Daniel Engeler <engeler at gmail.com>
These changes add serial port access.
* process.c: Add HAVE_SERIAL.
(Fdelete_process, Fprocess_status, Fset_process_buffer)
(Fset_process_filter, Fset_process_sentinel, Fprocess_contact)
(list_processes_1, select_wrapper, Fstop_process)
(Fcontinue_process, Fprocess_send_eof, kill_buffer_processes)
(status_notify): Modify to handle serial processes.
[HAVE_SERIAL] (Fserial_process_configure)
[HAVE_SERIAL] (make_serial_process_unwind, Fmake_serial_process):
New functions.
* process.h (struct Lisp_Process): Add `type'.
* sysdep.c [HAVE_TERMIOS] (serial_open, serial_configure):
New functions.
* w32.c (_sys_read_ahead, sys_read, sys_write): Modify to handle serial ports.
(serial_open, serial_configure) New functions.
* w32.h: Add FILE_SERIAL.
(struct _child_process): Add ovl_read, ovl_write.
2008-06-13 08:08:20 +00:00
|
|
|
|
For a network or serial connection, the value depends on the optional
|
|
|
|
|
KEY arg. If KEY is nil, value is a cons cell of the form (HOST
|
|
|
|
|
SERVICE) for a network connection or (PORT SPEED) for a serial
|
|
|
|
|
connection. If KEY is t, the complete contact information for the
|
|
|
|
|
connection is returned, else the specific value for the keyword KEY is
|
|
|
|
|
returned. See `make-network-process' or `make-serial-process' for a
|
|
|
|
|
list of keywords. */)
|
2010-07-08 14:25:08 -07:00
|
|
|
|
(register Lisp_Object process, Lisp_Object key)
|
(Qlocal, QCname, QCbuffer, QChost, QCservice, QCfamily)
(QClocal, QCremote, QCserver, QCdatagram, QCnowait, QCnoquery,QCstop)
(QCcoding, QCoptions, QCfilter, QCsentinel, QClog, QCfeature):
New variables.
(NETCONN1_P): New macro.
(DATAGRAM_SOCKETS): New conditional symbol.
(datagram_address): New array.
(DATAGRAM_CONN_P, DATAGRAM_CHAN_P): New macros.
(status_message): Use concat3.
(Fprocess_status): Add `listen' status to doc string. Return `stop'
for a stopped network process.
(Fset_process_buffer): Update contact plist for network process.
(Fset_process_filter): Ditto. Don't enable input for stopped
network processes. Server must listen, even if filter is t.
(Fset_process_query_on_exit_flag, Fprocess_query_on_exit_flag):
New functions.
(Fprocess_kill_without_query): Removed. Now defined in simple.el.
(Fprocess_contact): Added KEY argument. Handle datagrams.
(list_processes_1): Optionally show only processes with the query
on exit flag set. Dynamically adjust column widths. Omit tty
column if not needed. Report stopped network processes.
Identify server and datagram network processes.
(Flist_processes): New optional arg `query-only'.
(conv_sockaddr_to_lisp, get_lisp_to_sockaddr_size)
(conv_lisp_to_sockaddr, set_socket_options)
(network_process_featurep, unwind_request_sigio): New helper functions.
(Fprocess_datagram_address, Fset_process_datagram_address):
(Fset_network_process_options): New lisp functions.
(Fopen_network_stream): Removed. Now defined in simple.el.
(Fmake_network_process): New lisp function. Code is based on previous
Fopen_network_stream, but heavily reworked with new property list based
argument list, support for datagrams, server processes, and local
sockets in addition to old client-only functionality.
(server_accept_connection): New function.
(wait_reading_process_input): Use it to handle incoming connects.
Do not enable input on a new connection if process is stopped.
(read_process_output): Handle datagram sockets. Use 2k buffer for them.
(send_process): Handle datagram sockets.
(Fstop_process, Fcontinue_process): Apply to network processes. A stopped
network process is indicated by setting command field to t .
(Fprocess_send_eof): No-op if datagram connection.
(Fstatus_notify): Don't read input for a stream server socket or a
stopped network process.
(init_process): Initialize datagram_address array.
(syms_of_process): Intern and staticpro new variables, defsubr new
functions.
2002-03-17 20:20:33 +00:00
|
|
|
|
{
|
|
|
|
|
Lisp_Object contact;
|
|
|
|
|
|
|
|
|
|
CHECK_PROCESS (process);
|
|
|
|
|
contact = XPROCESS (process)->childp;
|
|
|
|
|
|
|
|
|
|
#ifdef DATAGRAM_SOCKETS
|
|
|
|
|
if (DATAGRAM_CONN_P (process)
|
|
|
|
|
&& (EQ (key, Qt) || EQ (key, QCremote)))
|
2003-02-04 14:56:31 +00:00
|
|
|
|
contact = Fplist_put (contact, QCremote,
|
(Qlocal, QCname, QCbuffer, QChost, QCservice, QCfamily)
(QClocal, QCremote, QCserver, QCdatagram, QCnowait, QCnoquery,QCstop)
(QCcoding, QCoptions, QCfilter, QCsentinel, QClog, QCfeature):
New variables.
(NETCONN1_P): New macro.
(DATAGRAM_SOCKETS): New conditional symbol.
(datagram_address): New array.
(DATAGRAM_CONN_P, DATAGRAM_CHAN_P): New macros.
(status_message): Use concat3.
(Fprocess_status): Add `listen' status to doc string. Return `stop'
for a stopped network process.
(Fset_process_buffer): Update contact plist for network process.
(Fset_process_filter): Ditto. Don't enable input for stopped
network processes. Server must listen, even if filter is t.
(Fset_process_query_on_exit_flag, Fprocess_query_on_exit_flag):
New functions.
(Fprocess_kill_without_query): Removed. Now defined in simple.el.
(Fprocess_contact): Added KEY argument. Handle datagrams.
(list_processes_1): Optionally show only processes with the query
on exit flag set. Dynamically adjust column widths. Omit tty
column if not needed. Report stopped network processes.
Identify server and datagram network processes.
(Flist_processes): New optional arg `query-only'.
(conv_sockaddr_to_lisp, get_lisp_to_sockaddr_size)
(conv_lisp_to_sockaddr, set_socket_options)
(network_process_featurep, unwind_request_sigio): New helper functions.
(Fprocess_datagram_address, Fset_process_datagram_address):
(Fset_network_process_options): New lisp functions.
(Fopen_network_stream): Removed. Now defined in simple.el.
(Fmake_network_process): New lisp function. Code is based on previous
Fopen_network_stream, but heavily reworked with new property list based
argument list, support for datagrams, server processes, and local
sockets in addition to old client-only functionality.
(server_accept_connection): New function.
(wait_reading_process_input): Use it to handle incoming connects.
Do not enable input on a new connection if process is stopped.
(read_process_output): Handle datagram sockets. Use 2k buffer for them.
(send_process): Handle datagram sockets.
(Fstop_process, Fcontinue_process): Apply to network processes. A stopped
network process is indicated by setting command field to t .
(Fprocess_send_eof): No-op if datagram connection.
(Fstatus_notify): Don't read input for a stream server socket or a
stopped network process.
(init_process): Initialize datagram_address array.
(syms_of_process): Intern and staticpro new variables, defsubr new
functions.
2002-03-17 20:20:33 +00:00
|
|
|
|
Fprocess_datagram_address (process));
|
|
|
|
|
#endif
|
|
|
|
|
|
Daniel Engeler <engeler at gmail.com>
These changes add serial port access.
* process.c: Add HAVE_SERIAL.
(Fdelete_process, Fprocess_status, Fset_process_buffer)
(Fset_process_filter, Fset_process_sentinel, Fprocess_contact)
(list_processes_1, select_wrapper, Fstop_process)
(Fcontinue_process, Fprocess_send_eof, kill_buffer_processes)
(status_notify): Modify to handle serial processes.
[HAVE_SERIAL] (Fserial_process_configure)
[HAVE_SERIAL] (make_serial_process_unwind, Fmake_serial_process):
New functions.
* process.h (struct Lisp_Process): Add `type'.
* sysdep.c [HAVE_TERMIOS] (serial_open, serial_configure):
New functions.
* w32.c (_sys_read_ahead, sys_read, sys_write): Modify to handle serial ports.
(serial_open, serial_configure) New functions.
* w32.h: Add FILE_SERIAL.
(struct _child_process): Add ovl_read, ovl_write.
2008-06-13 08:08:20 +00:00
|
|
|
|
if ((!NETCONN_P (process) && !SERIALCONN_P (process)) || EQ (key, Qt))
|
(Qlocal, QCname, QCbuffer, QChost, QCservice, QCfamily)
(QClocal, QCremote, QCserver, QCdatagram, QCnowait, QCnoquery,QCstop)
(QCcoding, QCoptions, QCfilter, QCsentinel, QClog, QCfeature):
New variables.
(NETCONN1_P): New macro.
(DATAGRAM_SOCKETS): New conditional symbol.
(datagram_address): New array.
(DATAGRAM_CONN_P, DATAGRAM_CHAN_P): New macros.
(status_message): Use concat3.
(Fprocess_status): Add `listen' status to doc string. Return `stop'
for a stopped network process.
(Fset_process_buffer): Update contact plist for network process.
(Fset_process_filter): Ditto. Don't enable input for stopped
network processes. Server must listen, even if filter is t.
(Fset_process_query_on_exit_flag, Fprocess_query_on_exit_flag):
New functions.
(Fprocess_kill_without_query): Removed. Now defined in simple.el.
(Fprocess_contact): Added KEY argument. Handle datagrams.
(list_processes_1): Optionally show only processes with the query
on exit flag set. Dynamically adjust column widths. Omit tty
column if not needed. Report stopped network processes.
Identify server and datagram network processes.
(Flist_processes): New optional arg `query-only'.
(conv_sockaddr_to_lisp, get_lisp_to_sockaddr_size)
(conv_lisp_to_sockaddr, set_socket_options)
(network_process_featurep, unwind_request_sigio): New helper functions.
(Fprocess_datagram_address, Fset_process_datagram_address):
(Fset_network_process_options): New lisp functions.
(Fopen_network_stream): Removed. Now defined in simple.el.
(Fmake_network_process): New lisp function. Code is based on previous
Fopen_network_stream, but heavily reworked with new property list based
argument list, support for datagrams, server processes, and local
sockets in addition to old client-only functionality.
(server_accept_connection): New function.
(wait_reading_process_input): Use it to handle incoming connects.
Do not enable input on a new connection if process is stopped.
(read_process_output): Handle datagram sockets. Use 2k buffer for them.
(send_process): Handle datagram sockets.
(Fstop_process, Fcontinue_process): Apply to network processes. A stopped
network process is indicated by setting command field to t .
(Fprocess_send_eof): No-op if datagram connection.
(Fstatus_notify): Don't read input for a stream server socket or a
stopped network process.
(init_process): Initialize datagram_address array.
(syms_of_process): Intern and staticpro new variables, defsubr new
functions.
2002-03-17 20:20:33 +00:00
|
|
|
|
return contact;
|
Daniel Engeler <engeler at gmail.com>
These changes add serial port access.
* process.c: Add HAVE_SERIAL.
(Fdelete_process, Fprocess_status, Fset_process_buffer)
(Fset_process_filter, Fset_process_sentinel, Fprocess_contact)
(list_processes_1, select_wrapper, Fstop_process)
(Fcontinue_process, Fprocess_send_eof, kill_buffer_processes)
(status_notify): Modify to handle serial processes.
[HAVE_SERIAL] (Fserial_process_configure)
[HAVE_SERIAL] (make_serial_process_unwind, Fmake_serial_process):
New functions.
* process.h (struct Lisp_Process): Add `type'.
* sysdep.c [HAVE_TERMIOS] (serial_open, serial_configure):
New functions.
* w32.c (_sys_read_ahead, sys_read, sys_write): Modify to handle serial ports.
(serial_open, serial_configure) New functions.
* w32.h: Add FILE_SERIAL.
(struct _child_process): Add ovl_read, ovl_write.
2008-06-13 08:08:20 +00:00
|
|
|
|
if (NILP (key) && NETCONN_P (process))
|
(Qlocal, QCname, QCbuffer, QChost, QCservice, QCfamily)
(QClocal, QCremote, QCserver, QCdatagram, QCnowait, QCnoquery,QCstop)
(QCcoding, QCoptions, QCfilter, QCsentinel, QClog, QCfeature):
New variables.
(NETCONN1_P): New macro.
(DATAGRAM_SOCKETS): New conditional symbol.
(datagram_address): New array.
(DATAGRAM_CONN_P, DATAGRAM_CHAN_P): New macros.
(status_message): Use concat3.
(Fprocess_status): Add `listen' status to doc string. Return `stop'
for a stopped network process.
(Fset_process_buffer): Update contact plist for network process.
(Fset_process_filter): Ditto. Don't enable input for stopped
network processes. Server must listen, even if filter is t.
(Fset_process_query_on_exit_flag, Fprocess_query_on_exit_flag):
New functions.
(Fprocess_kill_without_query): Removed. Now defined in simple.el.
(Fprocess_contact): Added KEY argument. Handle datagrams.
(list_processes_1): Optionally show only processes with the query
on exit flag set. Dynamically adjust column widths. Omit tty
column if not needed. Report stopped network processes.
Identify server and datagram network processes.
(Flist_processes): New optional arg `query-only'.
(conv_sockaddr_to_lisp, get_lisp_to_sockaddr_size)
(conv_lisp_to_sockaddr, set_socket_options)
(network_process_featurep, unwind_request_sigio): New helper functions.
(Fprocess_datagram_address, Fset_process_datagram_address):
(Fset_network_process_options): New lisp functions.
(Fopen_network_stream): Removed. Now defined in simple.el.
(Fmake_network_process): New lisp function. Code is based on previous
Fopen_network_stream, but heavily reworked with new property list based
argument list, support for datagrams, server processes, and local
sockets in addition to old client-only functionality.
(server_accept_connection): New function.
(wait_reading_process_input): Use it to handle incoming connects.
Do not enable input on a new connection if process is stopped.
(read_process_output): Handle datagram sockets. Use 2k buffer for them.
(send_process): Handle datagram sockets.
(Fstop_process, Fcontinue_process): Apply to network processes. A stopped
network process is indicated by setting command field to t .
(Fprocess_send_eof): No-op if datagram connection.
(Fstatus_notify): Don't read input for a stream server socket or a
stopped network process.
(init_process): Initialize datagram_address array.
(syms_of_process): Intern and staticpro new variables, defsubr new
functions.
2002-03-17 20:20:33 +00:00
|
|
|
|
return Fcons (Fplist_get (contact, QChost),
|
|
|
|
|
Fcons (Fplist_get (contact, QCservice), Qnil));
|
Daniel Engeler <engeler at gmail.com>
These changes add serial port access.
* process.c: Add HAVE_SERIAL.
(Fdelete_process, Fprocess_status, Fset_process_buffer)
(Fset_process_filter, Fset_process_sentinel, Fprocess_contact)
(list_processes_1, select_wrapper, Fstop_process)
(Fcontinue_process, Fprocess_send_eof, kill_buffer_processes)
(status_notify): Modify to handle serial processes.
[HAVE_SERIAL] (Fserial_process_configure)
[HAVE_SERIAL] (make_serial_process_unwind, Fmake_serial_process):
New functions.
* process.h (struct Lisp_Process): Add `type'.
* sysdep.c [HAVE_TERMIOS] (serial_open, serial_configure):
New functions.
* w32.c (_sys_read_ahead, sys_read, sys_write): Modify to handle serial ports.
(serial_open, serial_configure) New functions.
* w32.h: Add FILE_SERIAL.
(struct _child_process): Add ovl_read, ovl_write.
2008-06-13 08:08:20 +00:00
|
|
|
|
if (NILP (key) && SERIALCONN_P (process))
|
|
|
|
|
return Fcons (Fplist_get (contact, QCport),
|
|
|
|
|
Fcons (Fplist_get (contact, QCspeed), Qnil));
|
(Qlocal, QCname, QCbuffer, QChost, QCservice, QCfamily)
(QClocal, QCremote, QCserver, QCdatagram, QCnowait, QCnoquery,QCstop)
(QCcoding, QCoptions, QCfilter, QCsentinel, QClog, QCfeature):
New variables.
(NETCONN1_P): New macro.
(DATAGRAM_SOCKETS): New conditional symbol.
(datagram_address): New array.
(DATAGRAM_CONN_P, DATAGRAM_CHAN_P): New macros.
(status_message): Use concat3.
(Fprocess_status): Add `listen' status to doc string. Return `stop'
for a stopped network process.
(Fset_process_buffer): Update contact plist for network process.
(Fset_process_filter): Ditto. Don't enable input for stopped
network processes. Server must listen, even if filter is t.
(Fset_process_query_on_exit_flag, Fprocess_query_on_exit_flag):
New functions.
(Fprocess_kill_without_query): Removed. Now defined in simple.el.
(Fprocess_contact): Added KEY argument. Handle datagrams.
(list_processes_1): Optionally show only processes with the query
on exit flag set. Dynamically adjust column widths. Omit tty
column if not needed. Report stopped network processes.
Identify server and datagram network processes.
(Flist_processes): New optional arg `query-only'.
(conv_sockaddr_to_lisp, get_lisp_to_sockaddr_size)
(conv_lisp_to_sockaddr, set_socket_options)
(network_process_featurep, unwind_request_sigio): New helper functions.
(Fprocess_datagram_address, Fset_process_datagram_address):
(Fset_network_process_options): New lisp functions.
(Fopen_network_stream): Removed. Now defined in simple.el.
(Fmake_network_process): New lisp function. Code is based on previous
Fopen_network_stream, but heavily reworked with new property list based
argument list, support for datagrams, server processes, and local
sockets in addition to old client-only functionality.
(server_accept_connection): New function.
(wait_reading_process_input): Use it to handle incoming connects.
Do not enable input on a new connection if process is stopped.
(read_process_output): Handle datagram sockets. Use 2k buffer for them.
(send_process): Handle datagram sockets.
(Fstop_process, Fcontinue_process): Apply to network processes. A stopped
network process is indicated by setting command field to t .
(Fprocess_send_eof): No-op if datagram connection.
(Fstatus_notify): Don't read input for a stream server socket or a
stopped network process.
(init_process): Initialize datagram_address array.
(syms_of_process): Intern and staticpro new variables, defsubr new
functions.
2002-03-17 20:20:33 +00:00
|
|
|
|
return Fplist_get (contact, key);
|
1996-09-01 23:18:03 +00:00
|
|
|
|
}
|
|
|
|
|
|
2003-01-14 09:55:50 +00:00
|
|
|
|
DEFUN ("process-plist", Fprocess_plist, Sprocess_plist,
|
|
|
|
|
1, 1, 0,
|
|
|
|
|
doc: /* Return the plist of PROCESS. */)
|
2010-07-08 14:25:08 -07:00
|
|
|
|
(register Lisp_Object process)
|
2003-01-10 22:24:41 +00:00
|
|
|
|
{
|
2003-01-12 20:24:06 +00:00
|
|
|
|
CHECK_PROCESS (process);
|
2003-01-14 09:55:50 +00:00
|
|
|
|
return XPROCESS (process)->plist;
|
2003-01-12 20:24:06 +00:00
|
|
|
|
}
|
2003-01-10 22:24:41 +00:00
|
|
|
|
|
2003-01-14 09:55:50 +00:00
|
|
|
|
DEFUN ("set-process-plist", Fset_process_plist, Sset_process_plist,
|
|
|
|
|
2, 2, 0,
|
2003-01-14 13:36:14 +00:00
|
|
|
|
doc: /* Replace the plist of PROCESS with PLIST. Returns PLIST. */)
|
2010-07-08 14:25:08 -07:00
|
|
|
|
(register Lisp_Object process, Lisp_Object plist)
|
2003-01-12 20:24:06 +00:00
|
|
|
|
{
|
2003-01-10 22:24:41 +00:00
|
|
|
|
CHECK_PROCESS (process);
|
2003-01-14 09:55:50 +00:00
|
|
|
|
CHECK_LIST (plist);
|
2003-01-10 22:24:41 +00:00
|
|
|
|
|
2003-01-14 09:55:50 +00:00
|
|
|
|
XPROCESS (process)->plist = plist;
|
2003-01-14 13:36:14 +00:00
|
|
|
|
return plist;
|
2003-01-10 22:24:41 +00:00
|
|
|
|
}
|
|
|
|
|
|
1993-07-22 19:38:51 +00:00
|
|
|
|
#if 0 /* Turned off because we don't currently record this info
|
|
|
|
|
in the process. Perhaps add it. */
|
|
|
|
|
DEFUN ("process-connection", Fprocess_connection, Sprocess_connection, 1, 1, 0,
|
2001-10-20 20:56:10 +00:00
|
|
|
|
doc: /* Return the connection type of PROCESS.
|
|
|
|
|
The value is nil for a pipe, t or `pty' for a pty, or `stream' for
|
|
|
|
|
a socket connection. */)
|
2010-07-08 14:25:08 -07:00
|
|
|
|
(Lisp_Object process)
|
1993-07-22 19:38:51 +00:00
|
|
|
|
{
|
|
|
|
|
return XPROCESS (process)->type;
|
|
|
|
|
}
|
|
|
|
|
#endif
|
2008-10-02 08:04:54 +00:00
|
|
|
|
|
Daniel Engeler <engeler at gmail.com>
These changes add serial port access.
* process.c: Add HAVE_SERIAL.
(Fdelete_process, Fprocess_status, Fset_process_buffer)
(Fset_process_filter, Fset_process_sentinel, Fprocess_contact)
(list_processes_1, select_wrapper, Fstop_process)
(Fcontinue_process, Fprocess_send_eof, kill_buffer_processes)
(status_notify): Modify to handle serial processes.
[HAVE_SERIAL] (Fserial_process_configure)
[HAVE_SERIAL] (make_serial_process_unwind, Fmake_serial_process):
New functions.
* process.h (struct Lisp_Process): Add `type'.
* sysdep.c [HAVE_TERMIOS] (serial_open, serial_configure):
New functions.
* w32.c (_sys_read_ahead, sys_read, sys_write): Modify to handle serial ports.
(serial_open, serial_configure) New functions.
* w32.h: Add FILE_SERIAL.
(struct _child_process): Add ovl_read, ovl_write.
2008-06-13 08:08:20 +00:00
|
|
|
|
DEFUN ("process-type", Fprocess_type, Sprocess_type, 1, 1, 0,
|
|
|
|
|
doc: /* Return the connection type of PROCESS.
|
|
|
|
|
The value is either the symbol `real', `network', or `serial'.
|
|
|
|
|
PROCESS may be a process, a buffer, the name of a process or buffer, or
|
|
|
|
|
nil, indicating the current buffer's process. */)
|
2010-07-08 14:25:08 -07:00
|
|
|
|
(Lisp_Object process)
|
Daniel Engeler <engeler at gmail.com>
These changes add serial port access.
* process.c: Add HAVE_SERIAL.
(Fdelete_process, Fprocess_status, Fset_process_buffer)
(Fset_process_filter, Fset_process_sentinel, Fprocess_contact)
(list_processes_1, select_wrapper, Fstop_process)
(Fcontinue_process, Fprocess_send_eof, kill_buffer_processes)
(status_notify): Modify to handle serial processes.
[HAVE_SERIAL] (Fserial_process_configure)
[HAVE_SERIAL] (make_serial_process_unwind, Fmake_serial_process):
New functions.
* process.h (struct Lisp_Process): Add `type'.
* sysdep.c [HAVE_TERMIOS] (serial_open, serial_configure):
New functions.
* w32.c (_sys_read_ahead, sys_read, sys_write): Modify to handle serial ports.
(serial_open, serial_configure) New functions.
* w32.h: Add FILE_SERIAL.
(struct _child_process): Add ovl_read, ovl_write.
2008-06-13 08:08:20 +00:00
|
|
|
|
{
|
|
|
|
|
Lisp_Object proc;
|
|
|
|
|
proc = get_process (process);
|
|
|
|
|
return XPROCESS (proc)->type;
|
|
|
|
|
}
|
2002-10-24 08:03:41 +00:00
|
|
|
|
|
|
|
|
|
DEFUN ("format-network-address", Fformat_network_address, Sformat_network_address,
|
2003-01-08 15:35:03 +00:00
|
|
|
|
1, 2, 0,
|
2002-10-24 08:03:41 +00:00
|
|
|
|
doc: /* Convert network ADDRESS from internal format to a string.
|
2006-01-04 00:16:54 +00:00
|
|
|
|
A 4 or 5 element vector represents an IPv4 address (with port number).
|
|
|
|
|
An 8 or 9 element vector represents an IPv6 address (with port number).
|
2003-01-08 15:35:03 +00:00
|
|
|
|
If optional second argument OMIT-PORT is non-nil, don't include a port
|
2006-01-04 00:16:54 +00:00
|
|
|
|
number in the string, even when present in ADDRESS.
|
|
|
|
|
Returns nil if format of ADDRESS is invalid. */)
|
2010-07-08 14:25:08 -07:00
|
|
|
|
(Lisp_Object address, Lisp_Object omit_port)
|
2002-10-24 08:03:41 +00:00
|
|
|
|
{
|
|
|
|
|
if (NILP (address))
|
|
|
|
|
return Qnil;
|
|
|
|
|
|
|
|
|
|
if (STRINGP (address)) /* AF_LOCAL */
|
|
|
|
|
return address;
|
|
|
|
|
|
2006-01-04 00:16:54 +00:00
|
|
|
|
if (VECTORP (address)) /* AF_INET or AF_INET6 */
|
2002-10-24 08:03:41 +00:00
|
|
|
|
{
|
|
|
|
|
register struct Lisp_Vector *p = XVECTOR (address);
|
2007-03-27 15:19:33 +00:00
|
|
|
|
Lisp_Object args[10];
|
2003-01-08 15:35:03 +00:00
|
|
|
|
int nargs, i;
|
2002-10-24 08:03:41 +00:00
|
|
|
|
|
2006-01-04 00:16:54 +00:00
|
|
|
|
if (p->size == 4 || (p->size == 5 && !NILP (omit_port)))
|
2003-01-08 15:35:03 +00:00
|
|
|
|
{
|
|
|
|
|
args[0] = build_string ("%d.%d.%d.%d");
|
|
|
|
|
nargs = 4;
|
|
|
|
|
}
|
|
|
|
|
else if (p->size == 5)
|
|
|
|
|
{
|
|
|
|
|
args[0] = build_string ("%d.%d.%d.%d:%d");
|
|
|
|
|
nargs = 5;
|
|
|
|
|
}
|
2006-01-04 00:16:54 +00:00
|
|
|
|
else if (p->size == 8 || (p->size == 9 && !NILP (omit_port)))
|
|
|
|
|
{
|
|
|
|
|
args[0] = build_string ("%x:%x:%x:%x:%x:%x:%x:%x");
|
|
|
|
|
nargs = 8;
|
|
|
|
|
}
|
|
|
|
|
else if (p->size == 9)
|
|
|
|
|
{
|
|
|
|
|
args[0] = build_string ("[%x:%x:%x:%x:%x:%x:%x:%x]:%d");
|
|
|
|
|
nargs = 9;
|
|
|
|
|
}
|
2003-01-08 15:35:03 +00:00
|
|
|
|
else
|
2002-10-24 08:03:41 +00:00
|
|
|
|
return Qnil;
|
|
|
|
|
|
2003-01-08 15:35:03 +00:00
|
|
|
|
for (i = 0; i < nargs; i++)
|
2007-03-29 13:58:40 +00:00
|
|
|
|
{
|
|
|
|
|
EMACS_INT element = XINT (p->contents[i]);
|
|
|
|
|
|
|
|
|
|
if (element < 0 || element > 65535)
|
|
|
|
|
return Qnil;
|
|
|
|
|
|
|
|
|
|
if (nargs <= 5 /* IPv4 */
|
|
|
|
|
&& i < 4 /* host, not port */
|
|
|
|
|
&& element > 255)
|
|
|
|
|
return Qnil;
|
|
|
|
|
|
|
|
|
|
args[i+1] = p->contents[i];
|
|
|
|
|
}
|
|
|
|
|
|
2003-01-08 15:35:03 +00:00
|
|
|
|
return Fformat (nargs+1, args);
|
2002-10-24 08:03:41 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (CONSP (address))
|
|
|
|
|
{
|
|
|
|
|
Lisp_Object args[2];
|
|
|
|
|
args[0] = build_string ("<Family %d>");
|
2002-10-31 16:22:07 +00:00
|
|
|
|
args[1] = Fcar (address);
|
2002-10-24 08:03:41 +00:00
|
|
|
|
return Fformat (2, args);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return Qnil;
|
|
|
|
|
}
|
1992-03-14 20:40:04 +00:00
|
|
|
|
|
(deactivate_process, status_notify, read_process_output)
(update_status, status_convert, decode_status, allocate_pty)
(make_process, remove_process, list_processes_1)
(create_process_1, unwind_request_sigio, read_process_output)
(send_process, keyboard_bit_set): Declare static.
(Fdelete_process): Simplify. Pass process to status_notify, so we
don't try to read output from it.
(status_notify): New arg deleting_process--don't try to read
output from that process.
2005-08-15 08:44:53 +00:00
|
|
|
|
static Lisp_Object
|
2010-07-05 12:36:06 +02:00
|
|
|
|
list_processes_1 (Lisp_Object query_only)
|
1992-03-14 20:40:04 +00:00
|
|
|
|
{
|
|
|
|
|
register Lisp_Object tail, tem;
|
|
|
|
|
Lisp_Object proc, minspace, tem1;
|
|
|
|
|
register struct Lisp_Process *p;
|
(Qlocal, QCname, QCbuffer, QChost, QCservice, QCfamily)
(QClocal, QCremote, QCserver, QCdatagram, QCnowait, QCnoquery,QCstop)
(QCcoding, QCoptions, QCfilter, QCsentinel, QClog, QCfeature):
New variables.
(NETCONN1_P): New macro.
(DATAGRAM_SOCKETS): New conditional symbol.
(datagram_address): New array.
(DATAGRAM_CONN_P, DATAGRAM_CHAN_P): New macros.
(status_message): Use concat3.
(Fprocess_status): Add `listen' status to doc string. Return `stop'
for a stopped network process.
(Fset_process_buffer): Update contact plist for network process.
(Fset_process_filter): Ditto. Don't enable input for stopped
network processes. Server must listen, even if filter is t.
(Fset_process_query_on_exit_flag, Fprocess_query_on_exit_flag):
New functions.
(Fprocess_kill_without_query): Removed. Now defined in simple.el.
(Fprocess_contact): Added KEY argument. Handle datagrams.
(list_processes_1): Optionally show only processes with the query
on exit flag set. Dynamically adjust column widths. Omit tty
column if not needed. Report stopped network processes.
Identify server and datagram network processes.
(Flist_processes): New optional arg `query-only'.
(conv_sockaddr_to_lisp, get_lisp_to_sockaddr_size)
(conv_lisp_to_sockaddr, set_socket_options)
(network_process_featurep, unwind_request_sigio): New helper functions.
(Fprocess_datagram_address, Fset_process_datagram_address):
(Fset_network_process_options): New lisp functions.
(Fopen_network_stream): Removed. Now defined in simple.el.
(Fmake_network_process): New lisp function. Code is based on previous
Fopen_network_stream, but heavily reworked with new property list based
argument list, support for datagrams, server processes, and local
sockets in addition to old client-only functionality.
(server_accept_connection): New function.
(wait_reading_process_input): Use it to handle incoming connects.
Do not enable input on a new connection if process is stopped.
(read_process_output): Handle datagram sockets. Use 2k buffer for them.
(send_process): Handle datagram sockets.
(Fstop_process, Fcontinue_process): Apply to network processes. A stopped
network process is indicated by setting command field to t .
(Fprocess_send_eof): No-op if datagram connection.
(Fstatus_notify): Don't read input for a stream server socket or a
stopped network process.
(init_process): Initialize datagram_address array.
(syms_of_process): Intern and staticpro new variables, defsubr new
functions.
2002-03-17 20:20:33 +00:00
|
|
|
|
char tembuf[300];
|
|
|
|
|
int w_proc, w_buffer, w_tty;
|
2006-10-03 09:14:40 +00:00
|
|
|
|
int exited = 0;
|
(Qlocal, QCname, QCbuffer, QChost, QCservice, QCfamily)
(QClocal, QCremote, QCserver, QCdatagram, QCnowait, QCnoquery,QCstop)
(QCcoding, QCoptions, QCfilter, QCsentinel, QClog, QCfeature):
New variables.
(NETCONN1_P): New macro.
(DATAGRAM_SOCKETS): New conditional symbol.
(datagram_address): New array.
(DATAGRAM_CONN_P, DATAGRAM_CHAN_P): New macros.
(status_message): Use concat3.
(Fprocess_status): Add `listen' status to doc string. Return `stop'
for a stopped network process.
(Fset_process_buffer): Update contact plist for network process.
(Fset_process_filter): Ditto. Don't enable input for stopped
network processes. Server must listen, even if filter is t.
(Fset_process_query_on_exit_flag, Fprocess_query_on_exit_flag):
New functions.
(Fprocess_kill_without_query): Removed. Now defined in simple.el.
(Fprocess_contact): Added KEY argument. Handle datagrams.
(list_processes_1): Optionally show only processes with the query
on exit flag set. Dynamically adjust column widths. Omit tty
column if not needed. Report stopped network processes.
Identify server and datagram network processes.
(Flist_processes): New optional arg `query-only'.
(conv_sockaddr_to_lisp, get_lisp_to_sockaddr_size)
(conv_lisp_to_sockaddr, set_socket_options)
(network_process_featurep, unwind_request_sigio): New helper functions.
(Fprocess_datagram_address, Fset_process_datagram_address):
(Fset_network_process_options): New lisp functions.
(Fopen_network_stream): Removed. Now defined in simple.el.
(Fmake_network_process): New lisp function. Code is based on previous
Fopen_network_stream, but heavily reworked with new property list based
argument list, support for datagrams, server processes, and local
sockets in addition to old client-only functionality.
(server_accept_connection): New function.
(wait_reading_process_input): Use it to handle incoming connects.
Do not enable input on a new connection if process is stopped.
(read_process_output): Handle datagram sockets. Use 2k buffer for them.
(send_process): Handle datagram sockets.
(Fstop_process, Fcontinue_process): Apply to network processes. A stopped
network process is indicated by setting command field to t .
(Fprocess_send_eof): No-op if datagram connection.
(Fstatus_notify): Don't read input for a stream server socket or a
stopped network process.
(init_process): Initialize datagram_address array.
(syms_of_process): Intern and staticpro new variables, defsubr new
functions.
2002-03-17 20:20:33 +00:00
|
|
|
|
Lisp_Object i_status, i_buffer, i_tty, i_command;
|
|
|
|
|
|
|
|
|
|
w_proc = 4; /* Proc */
|
|
|
|
|
w_buffer = 6; /* Buffer */
|
|
|
|
|
w_tty = 0; /* Omit if no ttys */
|
|
|
|
|
|
* xselect.c (x_own_selection, x_handle_selection_clear)
(x_clear_frame_selections):
* w32menu.c (list_of_panes, list_of_items):
* w32fns.c (w32_color_map_lookup, Fx_create_frame, Fx_display_list):
* textprop.c (validate_plist, interval_has_all_properties)
(interval_has_some_properties, interval_has_some_properties_list)
(add_properties, text_property_list):
* process.c (Fget_buffer_process, list_processes_1, status_notify):
* minibuf.c (Fassoc_string):
* macselect.c (x_own_selection, x_clear_frame_selections)
(Fx_disown_selection_internal):
* keymap.c (Fcommand_remapping, where_is_internal, describe_map_tree):
Use CONSP rather than !NILP and XC[AD]R rather than Fc[ad]r.
2007-10-17 23:43:52 +00:00
|
|
|
|
for (tail = Vprocess_alist; CONSP (tail); tail = XCDR (tail))
|
(Qlocal, QCname, QCbuffer, QChost, QCservice, QCfamily)
(QClocal, QCremote, QCserver, QCdatagram, QCnowait, QCnoquery,QCstop)
(QCcoding, QCoptions, QCfilter, QCsentinel, QClog, QCfeature):
New variables.
(NETCONN1_P): New macro.
(DATAGRAM_SOCKETS): New conditional symbol.
(datagram_address): New array.
(DATAGRAM_CONN_P, DATAGRAM_CHAN_P): New macros.
(status_message): Use concat3.
(Fprocess_status): Add `listen' status to doc string. Return `stop'
for a stopped network process.
(Fset_process_buffer): Update contact plist for network process.
(Fset_process_filter): Ditto. Don't enable input for stopped
network processes. Server must listen, even if filter is t.
(Fset_process_query_on_exit_flag, Fprocess_query_on_exit_flag):
New functions.
(Fprocess_kill_without_query): Removed. Now defined in simple.el.
(Fprocess_contact): Added KEY argument. Handle datagrams.
(list_processes_1): Optionally show only processes with the query
on exit flag set. Dynamically adjust column widths. Omit tty
column if not needed. Report stopped network processes.
Identify server and datagram network processes.
(Flist_processes): New optional arg `query-only'.
(conv_sockaddr_to_lisp, get_lisp_to_sockaddr_size)
(conv_lisp_to_sockaddr, set_socket_options)
(network_process_featurep, unwind_request_sigio): New helper functions.
(Fprocess_datagram_address, Fset_process_datagram_address):
(Fset_network_process_options): New lisp functions.
(Fopen_network_stream): Removed. Now defined in simple.el.
(Fmake_network_process): New lisp function. Code is based on previous
Fopen_network_stream, but heavily reworked with new property list based
argument list, support for datagrams, server processes, and local
sockets in addition to old client-only functionality.
(server_accept_connection): New function.
(wait_reading_process_input): Use it to handle incoming connects.
Do not enable input on a new connection if process is stopped.
(read_process_output): Handle datagram sockets. Use 2k buffer for them.
(send_process): Handle datagram sockets.
(Fstop_process, Fcontinue_process): Apply to network processes. A stopped
network process is indicated by setting command field to t .
(Fprocess_send_eof): No-op if datagram connection.
(Fstatus_notify): Don't read input for a stream server socket or a
stopped network process.
(init_process): Initialize datagram_address array.
(syms_of_process): Intern and staticpro new variables, defsubr new
functions.
2002-03-17 20:20:33 +00:00
|
|
|
|
{
|
|
|
|
|
int i;
|
|
|
|
|
|
* xselect.c (x_own_selection, x_handle_selection_clear)
(x_clear_frame_selections):
* w32menu.c (list_of_panes, list_of_items):
* w32fns.c (w32_color_map_lookup, Fx_create_frame, Fx_display_list):
* textprop.c (validate_plist, interval_has_all_properties)
(interval_has_some_properties, interval_has_some_properties_list)
(add_properties, text_property_list):
* process.c (Fget_buffer_process, list_processes_1, status_notify):
* minibuf.c (Fassoc_string):
* macselect.c (x_own_selection, x_clear_frame_selections)
(Fx_disown_selection_internal):
* keymap.c (Fcommand_remapping, where_is_internal, describe_map_tree):
Use CONSP rather than !NILP and XC[AD]R rather than Fc[ad]r.
2007-10-17 23:43:52 +00:00
|
|
|
|
proc = Fcdr (XCAR (tail));
|
(Qlocal, QCname, QCbuffer, QChost, QCservice, QCfamily)
(QClocal, QCremote, QCserver, QCdatagram, QCnowait, QCnoquery,QCstop)
(QCcoding, QCoptions, QCfilter, QCsentinel, QClog, QCfeature):
New variables.
(NETCONN1_P): New macro.
(DATAGRAM_SOCKETS): New conditional symbol.
(datagram_address): New array.
(DATAGRAM_CONN_P, DATAGRAM_CHAN_P): New macros.
(status_message): Use concat3.
(Fprocess_status): Add `listen' status to doc string. Return `stop'
for a stopped network process.
(Fset_process_buffer): Update contact plist for network process.
(Fset_process_filter): Ditto. Don't enable input for stopped
network processes. Server must listen, even if filter is t.
(Fset_process_query_on_exit_flag, Fprocess_query_on_exit_flag):
New functions.
(Fprocess_kill_without_query): Removed. Now defined in simple.el.
(Fprocess_contact): Added KEY argument. Handle datagrams.
(list_processes_1): Optionally show only processes with the query
on exit flag set. Dynamically adjust column widths. Omit tty
column if not needed. Report stopped network processes.
Identify server and datagram network processes.
(Flist_processes): New optional arg `query-only'.
(conv_sockaddr_to_lisp, get_lisp_to_sockaddr_size)
(conv_lisp_to_sockaddr, set_socket_options)
(network_process_featurep, unwind_request_sigio): New helper functions.
(Fprocess_datagram_address, Fset_process_datagram_address):
(Fset_network_process_options): New lisp functions.
(Fopen_network_stream): Removed. Now defined in simple.el.
(Fmake_network_process): New lisp function. Code is based on previous
Fopen_network_stream, but heavily reworked with new property list based
argument list, support for datagrams, server processes, and local
sockets in addition to old client-only functionality.
(server_accept_connection): New function.
(wait_reading_process_input): Use it to handle incoming connects.
Do not enable input on a new connection if process is stopped.
(read_process_output): Handle datagram sockets. Use 2k buffer for them.
(send_process): Handle datagram sockets.
(Fstop_process, Fcontinue_process): Apply to network processes. A stopped
network process is indicated by setting command field to t .
(Fprocess_send_eof): No-op if datagram connection.
(Fstatus_notify): Don't read input for a stream server socket or a
stopped network process.
(init_process): Initialize datagram_address array.
(syms_of_process): Intern and staticpro new variables, defsubr new
functions.
2002-03-17 20:20:33 +00:00
|
|
|
|
p = XPROCESS (proc);
|
Daniel Engeler <engeler at gmail.com>
These changes add serial port access.
* process.c: Add HAVE_SERIAL.
(Fdelete_process, Fprocess_status, Fset_process_buffer)
(Fset_process_filter, Fset_process_sentinel, Fprocess_contact)
(list_processes_1, select_wrapper, Fstop_process)
(Fcontinue_process, Fprocess_send_eof, kill_buffer_processes)
(status_notify): Modify to handle serial processes.
[HAVE_SERIAL] (Fserial_process_configure)
[HAVE_SERIAL] (make_serial_process_unwind, Fmake_serial_process):
New functions.
* process.h (struct Lisp_Process): Add `type'.
* sysdep.c [HAVE_TERMIOS] (serial_open, serial_configure):
New functions.
* w32.c (_sys_read_ahead, sys_read, sys_write): Modify to handle serial ports.
(serial_open, serial_configure) New functions.
* w32.h: Add FILE_SERIAL.
(struct _child_process): Add ovl_read, ovl_write.
2008-06-13 08:08:20 +00:00
|
|
|
|
if (NILP (p->type))
|
(Qlocal, QCname, QCbuffer, QChost, QCservice, QCfamily)
(QClocal, QCremote, QCserver, QCdatagram, QCnowait, QCnoquery,QCstop)
(QCcoding, QCoptions, QCfilter, QCsentinel, QClog, QCfeature):
New variables.
(NETCONN1_P): New macro.
(DATAGRAM_SOCKETS): New conditional symbol.
(datagram_address): New array.
(DATAGRAM_CONN_P, DATAGRAM_CHAN_P): New macros.
(status_message): Use concat3.
(Fprocess_status): Add `listen' status to doc string. Return `stop'
for a stopped network process.
(Fset_process_buffer): Update contact plist for network process.
(Fset_process_filter): Ditto. Don't enable input for stopped
network processes. Server must listen, even if filter is t.
(Fset_process_query_on_exit_flag, Fprocess_query_on_exit_flag):
New functions.
(Fprocess_kill_without_query): Removed. Now defined in simple.el.
(Fprocess_contact): Added KEY argument. Handle datagrams.
(list_processes_1): Optionally show only processes with the query
on exit flag set. Dynamically adjust column widths. Omit tty
column if not needed. Report stopped network processes.
Identify server and datagram network processes.
(Flist_processes): New optional arg `query-only'.
(conv_sockaddr_to_lisp, get_lisp_to_sockaddr_size)
(conv_lisp_to_sockaddr, set_socket_options)
(network_process_featurep, unwind_request_sigio): New helper functions.
(Fprocess_datagram_address, Fset_process_datagram_address):
(Fset_network_process_options): New lisp functions.
(Fopen_network_stream): Removed. Now defined in simple.el.
(Fmake_network_process): New lisp function. Code is based on previous
Fopen_network_stream, but heavily reworked with new property list based
argument list, support for datagrams, server processes, and local
sockets in addition to old client-only functionality.
(server_accept_connection): New function.
(wait_reading_process_input): Use it to handle incoming connects.
Do not enable input on a new connection if process is stopped.
(read_process_output): Handle datagram sockets. Use 2k buffer for them.
(send_process): Handle datagram sockets.
(Fstop_process, Fcontinue_process): Apply to network processes. A stopped
network process is indicated by setting command field to t .
(Fprocess_send_eof): No-op if datagram connection.
(Fstatus_notify): Don't read input for a stream server socket or a
stopped network process.
(init_process): Initialize datagram_address array.
(syms_of_process): Intern and staticpro new variables, defsubr new
functions.
2002-03-17 20:20:33 +00:00
|
|
|
|
continue;
|
(struct Lisp_Process): Turn slots infd, outfd, kill_without_query, pty_flag,
tick, update_tick, decoding_carryover, inherit_coding_system_flag,
filter_multibyte, adaptive_read_buffering, read_output_delay, and
read_output_skip from Lisp_Objects to ints. Remove unused
encoding_carryover.
2007-07-12 06:36:57 +00:00
|
|
|
|
if (!NILP (query_only) && p->kill_without_query)
|
(Qlocal, QCname, QCbuffer, QChost, QCservice, QCfamily)
(QClocal, QCremote, QCserver, QCdatagram, QCnowait, QCnoquery,QCstop)
(QCcoding, QCoptions, QCfilter, QCsentinel, QClog, QCfeature):
New variables.
(NETCONN1_P): New macro.
(DATAGRAM_SOCKETS): New conditional symbol.
(datagram_address): New array.
(DATAGRAM_CONN_P, DATAGRAM_CHAN_P): New macros.
(status_message): Use concat3.
(Fprocess_status): Add `listen' status to doc string. Return `stop'
for a stopped network process.
(Fset_process_buffer): Update contact plist for network process.
(Fset_process_filter): Ditto. Don't enable input for stopped
network processes. Server must listen, even if filter is t.
(Fset_process_query_on_exit_flag, Fprocess_query_on_exit_flag):
New functions.
(Fprocess_kill_without_query): Removed. Now defined in simple.el.
(Fprocess_contact): Added KEY argument. Handle datagrams.
(list_processes_1): Optionally show only processes with the query
on exit flag set. Dynamically adjust column widths. Omit tty
column if not needed. Report stopped network processes.
Identify server and datagram network processes.
(Flist_processes): New optional arg `query-only'.
(conv_sockaddr_to_lisp, get_lisp_to_sockaddr_size)
(conv_lisp_to_sockaddr, set_socket_options)
(network_process_featurep, unwind_request_sigio): New helper functions.
(Fprocess_datagram_address, Fset_process_datagram_address):
(Fset_network_process_options): New lisp functions.
(Fopen_network_stream): Removed. Now defined in simple.el.
(Fmake_network_process): New lisp function. Code is based on previous
Fopen_network_stream, but heavily reworked with new property list based
argument list, support for datagrams, server processes, and local
sockets in addition to old client-only functionality.
(server_accept_connection): New function.
(wait_reading_process_input): Use it to handle incoming connects.
Do not enable input on a new connection if process is stopped.
(read_process_output): Handle datagram sockets. Use 2k buffer for them.
(send_process): Handle datagram sockets.
(Fstop_process, Fcontinue_process): Apply to network processes. A stopped
network process is indicated by setting command field to t .
(Fprocess_send_eof): No-op if datagram connection.
(Fstatus_notify): Don't read input for a stream server socket or a
stopped network process.
(init_process): Initialize datagram_address array.
(syms_of_process): Intern and staticpro new variables, defsubr new
functions.
2002-03-17 20:20:33 +00:00
|
|
|
|
continue;
|
|
|
|
|
if (STRINGP (p->name)
|
2002-07-15 00:01:34 +00:00
|
|
|
|
&& ( i = SCHARS (p->name), (i > w_proc)))
|
(Qlocal, QCname, QCbuffer, QChost, QCservice, QCfamily)
(QClocal, QCremote, QCserver, QCdatagram, QCnowait, QCnoquery,QCstop)
(QCcoding, QCoptions, QCfilter, QCsentinel, QClog, QCfeature):
New variables.
(NETCONN1_P): New macro.
(DATAGRAM_SOCKETS): New conditional symbol.
(datagram_address): New array.
(DATAGRAM_CONN_P, DATAGRAM_CHAN_P): New macros.
(status_message): Use concat3.
(Fprocess_status): Add `listen' status to doc string. Return `stop'
for a stopped network process.
(Fset_process_buffer): Update contact plist for network process.
(Fset_process_filter): Ditto. Don't enable input for stopped
network processes. Server must listen, even if filter is t.
(Fset_process_query_on_exit_flag, Fprocess_query_on_exit_flag):
New functions.
(Fprocess_kill_without_query): Removed. Now defined in simple.el.
(Fprocess_contact): Added KEY argument. Handle datagrams.
(list_processes_1): Optionally show only processes with the query
on exit flag set. Dynamically adjust column widths. Omit tty
column if not needed. Report stopped network processes.
Identify server and datagram network processes.
(Flist_processes): New optional arg `query-only'.
(conv_sockaddr_to_lisp, get_lisp_to_sockaddr_size)
(conv_lisp_to_sockaddr, set_socket_options)
(network_process_featurep, unwind_request_sigio): New helper functions.
(Fprocess_datagram_address, Fset_process_datagram_address):
(Fset_network_process_options): New lisp functions.
(Fopen_network_stream): Removed. Now defined in simple.el.
(Fmake_network_process): New lisp function. Code is based on previous
Fopen_network_stream, but heavily reworked with new property list based
argument list, support for datagrams, server processes, and local
sockets in addition to old client-only functionality.
(server_accept_connection): New function.
(wait_reading_process_input): Use it to handle incoming connects.
Do not enable input on a new connection if process is stopped.
(read_process_output): Handle datagram sockets. Use 2k buffer for them.
(send_process): Handle datagram sockets.
(Fstop_process, Fcontinue_process): Apply to network processes. A stopped
network process is indicated by setting command field to t .
(Fprocess_send_eof): No-op if datagram connection.
(Fstatus_notify): Don't read input for a stream server socket or a
stopped network process.
(init_process): Initialize datagram_address array.
(syms_of_process): Intern and staticpro new variables, defsubr new
functions.
2002-03-17 20:20:33 +00:00
|
|
|
|
w_proc = i;
|
|
|
|
|
if (!NILP (p->buffer))
|
|
|
|
|
{
|
2008-01-19 05:27:20 +00:00
|
|
|
|
if (NILP (XBUFFER (p->buffer)->name))
|
|
|
|
|
{
|
|
|
|
|
if (w_buffer < 8)
|
|
|
|
|
w_buffer = 8; /* (Killed) */
|
|
|
|
|
}
|
2002-07-15 00:01:34 +00:00
|
|
|
|
else if ((i = SCHARS (XBUFFER (p->buffer)->name), (i > w_buffer)))
|
(Qlocal, QCname, QCbuffer, QChost, QCservice, QCfamily)
(QClocal, QCremote, QCserver, QCdatagram, QCnowait, QCnoquery,QCstop)
(QCcoding, QCoptions, QCfilter, QCsentinel, QClog, QCfeature):
New variables.
(NETCONN1_P): New macro.
(DATAGRAM_SOCKETS): New conditional symbol.
(datagram_address): New array.
(DATAGRAM_CONN_P, DATAGRAM_CHAN_P): New macros.
(status_message): Use concat3.
(Fprocess_status): Add `listen' status to doc string. Return `stop'
for a stopped network process.
(Fset_process_buffer): Update contact plist for network process.
(Fset_process_filter): Ditto. Don't enable input for stopped
network processes. Server must listen, even if filter is t.
(Fset_process_query_on_exit_flag, Fprocess_query_on_exit_flag):
New functions.
(Fprocess_kill_without_query): Removed. Now defined in simple.el.
(Fprocess_contact): Added KEY argument. Handle datagrams.
(list_processes_1): Optionally show only processes with the query
on exit flag set. Dynamically adjust column widths. Omit tty
column if not needed. Report stopped network processes.
Identify server and datagram network processes.
(Flist_processes): New optional arg `query-only'.
(conv_sockaddr_to_lisp, get_lisp_to_sockaddr_size)
(conv_lisp_to_sockaddr, set_socket_options)
(network_process_featurep, unwind_request_sigio): New helper functions.
(Fprocess_datagram_address, Fset_process_datagram_address):
(Fset_network_process_options): New lisp functions.
(Fopen_network_stream): Removed. Now defined in simple.el.
(Fmake_network_process): New lisp function. Code is based on previous
Fopen_network_stream, but heavily reworked with new property list based
argument list, support for datagrams, server processes, and local
sockets in addition to old client-only functionality.
(server_accept_connection): New function.
(wait_reading_process_input): Use it to handle incoming connects.
Do not enable input on a new connection if process is stopped.
(read_process_output): Handle datagram sockets. Use 2k buffer for them.
(send_process): Handle datagram sockets.
(Fstop_process, Fcontinue_process): Apply to network processes. A stopped
network process is indicated by setting command field to t .
(Fprocess_send_eof): No-op if datagram connection.
(Fstatus_notify): Don't read input for a stream server socket or a
stopped network process.
(init_process): Initialize datagram_address array.
(syms_of_process): Intern and staticpro new variables, defsubr new
functions.
2002-03-17 20:20:33 +00:00
|
|
|
|
w_buffer = i;
|
|
|
|
|
}
|
|
|
|
|
if (STRINGP (p->tty_name)
|
2002-07-15 00:01:34 +00:00
|
|
|
|
&& (i = SCHARS (p->tty_name), (i > w_tty)))
|
(Qlocal, QCname, QCbuffer, QChost, QCservice, QCfamily)
(QClocal, QCremote, QCserver, QCdatagram, QCnowait, QCnoquery,QCstop)
(QCcoding, QCoptions, QCfilter, QCsentinel, QClog, QCfeature):
New variables.
(NETCONN1_P): New macro.
(DATAGRAM_SOCKETS): New conditional symbol.
(datagram_address): New array.
(DATAGRAM_CONN_P, DATAGRAM_CHAN_P): New macros.
(status_message): Use concat3.
(Fprocess_status): Add `listen' status to doc string. Return `stop'
for a stopped network process.
(Fset_process_buffer): Update contact plist for network process.
(Fset_process_filter): Ditto. Don't enable input for stopped
network processes. Server must listen, even if filter is t.
(Fset_process_query_on_exit_flag, Fprocess_query_on_exit_flag):
New functions.
(Fprocess_kill_without_query): Removed. Now defined in simple.el.
(Fprocess_contact): Added KEY argument. Handle datagrams.
(list_processes_1): Optionally show only processes with the query
on exit flag set. Dynamically adjust column widths. Omit tty
column if not needed. Report stopped network processes.
Identify server and datagram network processes.
(Flist_processes): New optional arg `query-only'.
(conv_sockaddr_to_lisp, get_lisp_to_sockaddr_size)
(conv_lisp_to_sockaddr, set_socket_options)
(network_process_featurep, unwind_request_sigio): New helper functions.
(Fprocess_datagram_address, Fset_process_datagram_address):
(Fset_network_process_options): New lisp functions.
(Fopen_network_stream): Removed. Now defined in simple.el.
(Fmake_network_process): New lisp function. Code is based on previous
Fopen_network_stream, but heavily reworked with new property list based
argument list, support for datagrams, server processes, and local
sockets in addition to old client-only functionality.
(server_accept_connection): New function.
(wait_reading_process_input): Use it to handle incoming connects.
Do not enable input on a new connection if process is stopped.
(read_process_output): Handle datagram sockets. Use 2k buffer for them.
(send_process): Handle datagram sockets.
(Fstop_process, Fcontinue_process): Apply to network processes. A stopped
network process is indicated by setting command field to t .
(Fprocess_send_eof): No-op if datagram connection.
(Fstatus_notify): Don't read input for a stream server socket or a
stopped network process.
(init_process): Initialize datagram_address array.
(syms_of_process): Intern and staticpro new variables, defsubr new
functions.
2002-03-17 20:20:33 +00:00
|
|
|
|
w_tty = i;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
XSETFASTINT (i_status, w_proc + 1);
|
|
|
|
|
XSETFASTINT (i_buffer, XFASTINT (i_status) + 9);
|
|
|
|
|
if (w_tty)
|
|
|
|
|
{
|
|
|
|
|
XSETFASTINT (i_tty, XFASTINT (i_buffer) + w_buffer + 1);
|
2007-11-26 09:56:47 +00:00
|
|
|
|
XSETFASTINT (i_command, XFASTINT (i_tty) + w_tty + 1);
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
(Qlocal, QCname, QCbuffer, QChost, QCservice, QCfamily)
(QClocal, QCremote, QCserver, QCdatagram, QCnowait, QCnoquery,QCstop)
(QCcoding, QCoptions, QCfilter, QCsentinel, QClog, QCfeature):
New variables.
(NETCONN1_P): New macro.
(DATAGRAM_SOCKETS): New conditional symbol.
(datagram_address): New array.
(DATAGRAM_CONN_P, DATAGRAM_CHAN_P): New macros.
(status_message): Use concat3.
(Fprocess_status): Add `listen' status to doc string. Return `stop'
for a stopped network process.
(Fset_process_buffer): Update contact plist for network process.
(Fset_process_filter): Ditto. Don't enable input for stopped
network processes. Server must listen, even if filter is t.
(Fset_process_query_on_exit_flag, Fprocess_query_on_exit_flag):
New functions.
(Fprocess_kill_without_query): Removed. Now defined in simple.el.
(Fprocess_contact): Added KEY argument. Handle datagrams.
(list_processes_1): Optionally show only processes with the query
on exit flag set. Dynamically adjust column widths. Omit tty
column if not needed. Report stopped network processes.
Identify server and datagram network processes.
(Flist_processes): New optional arg `query-only'.
(conv_sockaddr_to_lisp, get_lisp_to_sockaddr_size)
(conv_lisp_to_sockaddr, set_socket_options)
(network_process_featurep, unwind_request_sigio): New helper functions.
(Fprocess_datagram_address, Fset_process_datagram_address):
(Fset_network_process_options): New lisp functions.
(Fopen_network_stream): Removed. Now defined in simple.el.
(Fmake_network_process): New lisp function. Code is based on previous
Fopen_network_stream, but heavily reworked with new property list based
argument list, support for datagrams, server processes, and local
sockets in addition to old client-only functionality.
(server_accept_connection): New function.
(wait_reading_process_input): Use it to handle incoming connects.
Do not enable input on a new connection if process is stopped.
(read_process_output): Handle datagram sockets. Use 2k buffer for them.
(send_process): Handle datagram sockets.
(Fstop_process, Fcontinue_process): Apply to network processes. A stopped
network process is indicated by setting command field to t .
(Fprocess_send_eof): No-op if datagram connection.
(Fstatus_notify): Don't read input for a stream server socket or a
stopped network process.
(init_process): Initialize datagram_address array.
(syms_of_process): Intern and staticpro new variables, defsubr new
functions.
2002-03-17 20:20:33 +00:00
|
|
|
|
i_tty = Qnil;
|
|
|
|
|
XSETFASTINT (i_command, XFASTINT (i_buffer) + w_buffer + 1);
|
|
|
|
|
}
|
1992-03-14 20:40:04 +00:00
|
|
|
|
|
1994-10-04 16:10:39 +00:00
|
|
|
|
XSETFASTINT (minspace, 1);
|
1992-03-14 20:40:04 +00:00
|
|
|
|
|
|
|
|
|
set_buffer_internal (XBUFFER (Vstandard_output));
|
2004-12-27 16:06:43 +00:00
|
|
|
|
current_buffer->undo_list = Qt;
|
1992-03-14 20:40:04 +00:00
|
|
|
|
|
|
|
|
|
current_buffer->truncate_lines = Qt;
|
|
|
|
|
|
(Qlocal, QCname, QCbuffer, QChost, QCservice, QCfamily)
(QClocal, QCremote, QCserver, QCdatagram, QCnowait, QCnoquery,QCstop)
(QCcoding, QCoptions, QCfilter, QCsentinel, QClog, QCfeature):
New variables.
(NETCONN1_P): New macro.
(DATAGRAM_SOCKETS): New conditional symbol.
(datagram_address): New array.
(DATAGRAM_CONN_P, DATAGRAM_CHAN_P): New macros.
(status_message): Use concat3.
(Fprocess_status): Add `listen' status to doc string. Return `stop'
for a stopped network process.
(Fset_process_buffer): Update contact plist for network process.
(Fset_process_filter): Ditto. Don't enable input for stopped
network processes. Server must listen, even if filter is t.
(Fset_process_query_on_exit_flag, Fprocess_query_on_exit_flag):
New functions.
(Fprocess_kill_without_query): Removed. Now defined in simple.el.
(Fprocess_contact): Added KEY argument. Handle datagrams.
(list_processes_1): Optionally show only processes with the query
on exit flag set. Dynamically adjust column widths. Omit tty
column if not needed. Report stopped network processes.
Identify server and datagram network processes.
(Flist_processes): New optional arg `query-only'.
(conv_sockaddr_to_lisp, get_lisp_to_sockaddr_size)
(conv_lisp_to_sockaddr, set_socket_options)
(network_process_featurep, unwind_request_sigio): New helper functions.
(Fprocess_datagram_address, Fset_process_datagram_address):
(Fset_network_process_options): New lisp functions.
(Fopen_network_stream): Removed. Now defined in simple.el.
(Fmake_network_process): New lisp function. Code is based on previous
Fopen_network_stream, but heavily reworked with new property list based
argument list, support for datagrams, server processes, and local
sockets in addition to old client-only functionality.
(server_accept_connection): New function.
(wait_reading_process_input): Use it to handle incoming connects.
Do not enable input on a new connection if process is stopped.
(read_process_output): Handle datagram sockets. Use 2k buffer for them.
(send_process): Handle datagram sockets.
(Fstop_process, Fcontinue_process): Apply to network processes. A stopped
network process is indicated by setting command field to t .
(Fprocess_send_eof): No-op if datagram connection.
(Fstatus_notify): Don't read input for a stream server socket or a
stopped network process.
(init_process): Initialize datagram_address array.
(syms_of_process): Intern and staticpro new variables, defsubr new
functions.
2002-03-17 20:20:33 +00:00
|
|
|
|
write_string ("Proc", -1);
|
|
|
|
|
Findent_to (i_status, minspace); write_string ("Status", -1);
|
|
|
|
|
Findent_to (i_buffer, minspace); write_string ("Buffer", -1);
|
|
|
|
|
if (!NILP (i_tty))
|
|
|
|
|
{
|
|
|
|
|
Findent_to (i_tty, minspace); write_string ("Tty", -1);
|
|
|
|
|
}
|
|
|
|
|
Findent_to (i_command, minspace); write_string ("Command", -1);
|
|
|
|
|
write_string ("\n", -1);
|
|
|
|
|
|
|
|
|
|
write_string ("----", -1);
|
|
|
|
|
Findent_to (i_status, minspace); write_string ("------", -1);
|
|
|
|
|
Findent_to (i_buffer, minspace); write_string ("------", -1);
|
|
|
|
|
if (!NILP (i_tty))
|
|
|
|
|
{
|
|
|
|
|
Findent_to (i_tty, minspace); write_string ("---", -1);
|
|
|
|
|
}
|
|
|
|
|
Findent_to (i_command, minspace); write_string ("-------", -1);
|
|
|
|
|
write_string ("\n", -1);
|
1992-03-14 20:40:04 +00:00
|
|
|
|
|
* xselect.c (x_own_selection, x_handle_selection_clear)
(x_clear_frame_selections):
* w32menu.c (list_of_panes, list_of_items):
* w32fns.c (w32_color_map_lookup, Fx_create_frame, Fx_display_list):
* textprop.c (validate_plist, interval_has_all_properties)
(interval_has_some_properties, interval_has_some_properties_list)
(add_properties, text_property_list):
* process.c (Fget_buffer_process, list_processes_1, status_notify):
* minibuf.c (Fassoc_string):
* macselect.c (x_own_selection, x_clear_frame_selections)
(Fx_disown_selection_internal):
* keymap.c (Fcommand_remapping, where_is_internal, describe_map_tree):
Use CONSP rather than !NILP and XC[AD]R rather than Fc[ad]r.
2007-10-17 23:43:52 +00:00
|
|
|
|
for (tail = Vprocess_alist; CONSP (tail); tail = XCDR (tail))
|
1992-03-14 20:40:04 +00:00
|
|
|
|
{
|
|
|
|
|
Lisp_Object symbol;
|
|
|
|
|
|
* xselect.c (x_own_selection, x_handle_selection_clear)
(x_clear_frame_selections):
* w32menu.c (list_of_panes, list_of_items):
* w32fns.c (w32_color_map_lookup, Fx_create_frame, Fx_display_list):
* textprop.c (validate_plist, interval_has_all_properties)
(interval_has_some_properties, interval_has_some_properties_list)
(add_properties, text_property_list):
* process.c (Fget_buffer_process, list_processes_1, status_notify):
* minibuf.c (Fassoc_string):
* macselect.c (x_own_selection, x_clear_frame_selections)
(Fx_disown_selection_internal):
* keymap.c (Fcommand_remapping, where_is_internal, describe_map_tree):
Use CONSP rather than !NILP and XC[AD]R rather than Fc[ad]r.
2007-10-17 23:43:52 +00:00
|
|
|
|
proc = Fcdr (XCAR (tail));
|
1992-03-14 20:40:04 +00:00
|
|
|
|
p = XPROCESS (proc);
|
Daniel Engeler <engeler at gmail.com>
These changes add serial port access.
* process.c: Add HAVE_SERIAL.
(Fdelete_process, Fprocess_status, Fset_process_buffer)
(Fset_process_filter, Fset_process_sentinel, Fprocess_contact)
(list_processes_1, select_wrapper, Fstop_process)
(Fcontinue_process, Fprocess_send_eof, kill_buffer_processes)
(status_notify): Modify to handle serial processes.
[HAVE_SERIAL] (Fserial_process_configure)
[HAVE_SERIAL] (make_serial_process_unwind, Fmake_serial_process):
New functions.
* process.h (struct Lisp_Process): Add `type'.
* sysdep.c [HAVE_TERMIOS] (serial_open, serial_configure):
New functions.
* w32.c (_sys_read_ahead, sys_read, sys_write): Modify to handle serial ports.
(serial_open, serial_configure) New functions.
* w32.h: Add FILE_SERIAL.
(struct _child_process): Add ovl_read, ovl_write.
2008-06-13 08:08:20 +00:00
|
|
|
|
if (NILP (p->type))
|
1992-03-14 20:40:04 +00:00
|
|
|
|
continue;
|
(struct Lisp_Process): Turn slots infd, outfd, kill_without_query, pty_flag,
tick, update_tick, decoding_carryover, inherit_coding_system_flag,
filter_multibyte, adaptive_read_buffering, read_output_delay, and
read_output_skip from Lisp_Objects to ints. Remove unused
encoding_carryover.
2007-07-12 06:36:57 +00:00
|
|
|
|
if (!NILP (query_only) && p->kill_without_query)
|
(Qlocal, QCname, QCbuffer, QChost, QCservice, QCfamily)
(QClocal, QCremote, QCserver, QCdatagram, QCnowait, QCnoquery,QCstop)
(QCcoding, QCoptions, QCfilter, QCsentinel, QClog, QCfeature):
New variables.
(NETCONN1_P): New macro.
(DATAGRAM_SOCKETS): New conditional symbol.
(datagram_address): New array.
(DATAGRAM_CONN_P, DATAGRAM_CHAN_P): New macros.
(status_message): Use concat3.
(Fprocess_status): Add `listen' status to doc string. Return `stop'
for a stopped network process.
(Fset_process_buffer): Update contact plist for network process.
(Fset_process_filter): Ditto. Don't enable input for stopped
network processes. Server must listen, even if filter is t.
(Fset_process_query_on_exit_flag, Fprocess_query_on_exit_flag):
New functions.
(Fprocess_kill_without_query): Removed. Now defined in simple.el.
(Fprocess_contact): Added KEY argument. Handle datagrams.
(list_processes_1): Optionally show only processes with the query
on exit flag set. Dynamically adjust column widths. Omit tty
column if not needed. Report stopped network processes.
Identify server and datagram network processes.
(Flist_processes): New optional arg `query-only'.
(conv_sockaddr_to_lisp, get_lisp_to_sockaddr_size)
(conv_lisp_to_sockaddr, set_socket_options)
(network_process_featurep, unwind_request_sigio): New helper functions.
(Fprocess_datagram_address, Fset_process_datagram_address):
(Fset_network_process_options): New lisp functions.
(Fopen_network_stream): Removed. Now defined in simple.el.
(Fmake_network_process): New lisp function. Code is based on previous
Fopen_network_stream, but heavily reworked with new property list based
argument list, support for datagrams, server processes, and local
sockets in addition to old client-only functionality.
(server_accept_connection): New function.
(wait_reading_process_input): Use it to handle incoming connects.
Do not enable input on a new connection if process is stopped.
(read_process_output): Handle datagram sockets. Use 2k buffer for them.
(send_process): Handle datagram sockets.
(Fstop_process, Fcontinue_process): Apply to network processes. A stopped
network process is indicated by setting command field to t .
(Fprocess_send_eof): No-op if datagram connection.
(Fstatus_notify): Don't read input for a stream server socket or a
stopped network process.
(init_process): Initialize datagram_address array.
(syms_of_process): Intern and staticpro new variables, defsubr new
functions.
2002-03-17 20:20:33 +00:00
|
|
|
|
continue;
|
1992-03-14 20:40:04 +00:00
|
|
|
|
|
|
|
|
|
Finsert (1, &p->name);
|
(Qlocal, QCname, QCbuffer, QChost, QCservice, QCfamily)
(QClocal, QCremote, QCserver, QCdatagram, QCnowait, QCnoquery,QCstop)
(QCcoding, QCoptions, QCfilter, QCsentinel, QClog, QCfeature):
New variables.
(NETCONN1_P): New macro.
(DATAGRAM_SOCKETS): New conditional symbol.
(datagram_address): New array.
(DATAGRAM_CONN_P, DATAGRAM_CHAN_P): New macros.
(status_message): Use concat3.
(Fprocess_status): Add `listen' status to doc string. Return `stop'
for a stopped network process.
(Fset_process_buffer): Update contact plist for network process.
(Fset_process_filter): Ditto. Don't enable input for stopped
network processes. Server must listen, even if filter is t.
(Fset_process_query_on_exit_flag, Fprocess_query_on_exit_flag):
New functions.
(Fprocess_kill_without_query): Removed. Now defined in simple.el.
(Fprocess_contact): Added KEY argument. Handle datagrams.
(list_processes_1): Optionally show only processes with the query
on exit flag set. Dynamically adjust column widths. Omit tty
column if not needed. Report stopped network processes.
Identify server and datagram network processes.
(Flist_processes): New optional arg `query-only'.
(conv_sockaddr_to_lisp, get_lisp_to_sockaddr_size)
(conv_lisp_to_sockaddr, set_socket_options)
(network_process_featurep, unwind_request_sigio): New helper functions.
(Fprocess_datagram_address, Fset_process_datagram_address):
(Fset_network_process_options): New lisp functions.
(Fopen_network_stream): Removed. Now defined in simple.el.
(Fmake_network_process): New lisp function. Code is based on previous
Fopen_network_stream, but heavily reworked with new property list based
argument list, support for datagrams, server processes, and local
sockets in addition to old client-only functionality.
(server_accept_connection): New function.
(wait_reading_process_input): Use it to handle incoming connects.
Do not enable input on a new connection if process is stopped.
(read_process_output): Handle datagram sockets. Use 2k buffer for them.
(send_process): Handle datagram sockets.
(Fstop_process, Fcontinue_process): Apply to network processes. A stopped
network process is indicated by setting command field to t .
(Fprocess_send_eof): No-op if datagram connection.
(Fstatus_notify): Don't read input for a stream server socket or a
stopped network process.
(init_process): Initialize datagram_address array.
(syms_of_process): Intern and staticpro new variables, defsubr new
functions.
2002-03-17 20:20:33 +00:00
|
|
|
|
Findent_to (i_status, minspace);
|
1992-03-14 20:40:04 +00:00
|
|
|
|
|
* process.h (struct Lisp_Process): Replace Lisp_Objects `pid',
`raw_status_high', and `raw_status_low' with plain integers, and move
them to the end of the structure.
* alloc.c (allocate_process): Use PSEUDOVECSIZE to initialize the
pseudovector's size field so only the Lisp_Object fields get GC'd.
* process.c (update_status, make_process, Fdelete_process)
(Fprocess_status, list_processes_1, start_process_unwind)
(create_process, Fmake_network_process, server_accept_connection)
(wait_reading_process_output, send_process, Fprocess_running_child_p)
(process_send_signal, proc_encode_coding_system, Fprocess_send_eof)
(sigchld_handler, status_notify): Adjust to new non-Lisp fields for
`pid' and `raw_status'.
(Fprocess_id, Fsignal_process): Same, and additionally use floats when
representing PIDs that are larger than most-positive-fixnum.
2006-04-08 15:07:35 +00:00
|
|
|
|
if (p->raw_status_new)
|
1992-03-14 20:40:04 +00:00
|
|
|
|
update_status (p);
|
|
|
|
|
symbol = p->status;
|
(decode_status, Fprocessp, Fget_process, Fget_buffer_process, Fprocess_status,
Fprocess_exit_status, list_processes_1, Fstart_process, Fopen_network_stream,
Faccept_process_output, wait_reading_process_input, sigchld_handler,
status_notify): Use type test macros.
1994-09-27 01:53:42 +00:00
|
|
|
|
if (CONSP (p->status))
|
1999-09-12 05:07:01 +00:00
|
|
|
|
symbol = XCAR (p->status);
|
1992-03-14 20:40:04 +00:00
|
|
|
|
|
|
|
|
|
if (EQ (symbol, Qsignal))
|
|
|
|
|
{
|
|
|
|
|
Lisp_Object tem;
|
|
|
|
|
tem = Fcar (Fcdr (p->status));
|
2008-07-31 05:33:56 +00:00
|
|
|
|
Fprinc (symbol, Qnil);
|
1992-03-14 20:40:04 +00:00
|
|
|
|
}
|
Daniel Engeler <engeler at gmail.com>
These changes add serial port access.
* process.c: Add HAVE_SERIAL.
(Fdelete_process, Fprocess_status, Fset_process_buffer)
(Fset_process_filter, Fset_process_sentinel, Fprocess_contact)
(list_processes_1, select_wrapper, Fstop_process)
(Fcontinue_process, Fprocess_send_eof, kill_buffer_processes)
(status_notify): Modify to handle serial processes.
[HAVE_SERIAL] (Fserial_process_configure)
[HAVE_SERIAL] (make_serial_process_unwind, Fmake_serial_process):
New functions.
* process.h (struct Lisp_Process): Add `type'.
* sysdep.c [HAVE_TERMIOS] (serial_open, serial_configure):
New functions.
* w32.c (_sys_read_ahead, sys_read, sys_write): Modify to handle serial ports.
(serial_open, serial_configure) New functions.
* w32.h: Add FILE_SERIAL.
(struct _child_process): Add ovl_read, ovl_write.
2008-06-13 08:08:20 +00:00
|
|
|
|
else if (NETCONN1_P (p) || SERIALCONN1_P (p))
|
1992-03-14 20:40:04 +00:00
|
|
|
|
{
|
(Qlocal, QCname, QCbuffer, QChost, QCservice, QCfamily)
(QClocal, QCremote, QCserver, QCdatagram, QCnowait, QCnoquery,QCstop)
(QCcoding, QCoptions, QCfilter, QCsentinel, QClog, QCfeature):
New variables.
(NETCONN1_P): New macro.
(DATAGRAM_SOCKETS): New conditional symbol.
(datagram_address): New array.
(DATAGRAM_CONN_P, DATAGRAM_CHAN_P): New macros.
(status_message): Use concat3.
(Fprocess_status): Add `listen' status to doc string. Return `stop'
for a stopped network process.
(Fset_process_buffer): Update contact plist for network process.
(Fset_process_filter): Ditto. Don't enable input for stopped
network processes. Server must listen, even if filter is t.
(Fset_process_query_on_exit_flag, Fprocess_query_on_exit_flag):
New functions.
(Fprocess_kill_without_query): Removed. Now defined in simple.el.
(Fprocess_contact): Added KEY argument. Handle datagrams.
(list_processes_1): Optionally show only processes with the query
on exit flag set. Dynamically adjust column widths. Omit tty
column if not needed. Report stopped network processes.
Identify server and datagram network processes.
(Flist_processes): New optional arg `query-only'.
(conv_sockaddr_to_lisp, get_lisp_to_sockaddr_size)
(conv_lisp_to_sockaddr, set_socket_options)
(network_process_featurep, unwind_request_sigio): New helper functions.
(Fprocess_datagram_address, Fset_process_datagram_address):
(Fset_network_process_options): New lisp functions.
(Fopen_network_stream): Removed. Now defined in simple.el.
(Fmake_network_process): New lisp function. Code is based on previous
Fopen_network_stream, but heavily reworked with new property list based
argument list, support for datagrams, server processes, and local
sockets in addition to old client-only functionality.
(server_accept_connection): New function.
(wait_reading_process_input): Use it to handle incoming connects.
Do not enable input on a new connection if process is stopped.
(read_process_output): Handle datagram sockets. Use 2k buffer for them.
(send_process): Handle datagram sockets.
(Fstop_process, Fcontinue_process): Apply to network processes. A stopped
network process is indicated by setting command field to t .
(Fprocess_send_eof): No-op if datagram connection.
(Fstatus_notify): Don't read input for a stream server socket or a
stopped network process.
(init_process): Initialize datagram_address array.
(syms_of_process): Intern and staticpro new variables, defsubr new
functions.
2002-03-17 20:20:33 +00:00
|
|
|
|
if (EQ (symbol, Qexit))
|
1992-03-14 20:40:04 +00:00
|
|
|
|
write_string ("closed", -1);
|
(Qlocal, QCname, QCbuffer, QChost, QCservice, QCfamily)
(QClocal, QCremote, QCserver, QCdatagram, QCnowait, QCnoquery,QCstop)
(QCcoding, QCoptions, QCfilter, QCsentinel, QClog, QCfeature):
New variables.
(NETCONN1_P): New macro.
(DATAGRAM_SOCKETS): New conditional symbol.
(datagram_address): New array.
(DATAGRAM_CONN_P, DATAGRAM_CHAN_P): New macros.
(status_message): Use concat3.
(Fprocess_status): Add `listen' status to doc string. Return `stop'
for a stopped network process.
(Fset_process_buffer): Update contact plist for network process.
(Fset_process_filter): Ditto. Don't enable input for stopped
network processes. Server must listen, even if filter is t.
(Fset_process_query_on_exit_flag, Fprocess_query_on_exit_flag):
New functions.
(Fprocess_kill_without_query): Removed. Now defined in simple.el.
(Fprocess_contact): Added KEY argument. Handle datagrams.
(list_processes_1): Optionally show only processes with the query
on exit flag set. Dynamically adjust column widths. Omit tty
column if not needed. Report stopped network processes.
Identify server and datagram network processes.
(Flist_processes): New optional arg `query-only'.
(conv_sockaddr_to_lisp, get_lisp_to_sockaddr_size)
(conv_lisp_to_sockaddr, set_socket_options)
(network_process_featurep, unwind_request_sigio): New helper functions.
(Fprocess_datagram_address, Fset_process_datagram_address):
(Fset_network_process_options): New lisp functions.
(Fopen_network_stream): Removed. Now defined in simple.el.
(Fmake_network_process): New lisp function. Code is based on previous
Fopen_network_stream, but heavily reworked with new property list based
argument list, support for datagrams, server processes, and local
sockets in addition to old client-only functionality.
(server_accept_connection): New function.
(wait_reading_process_input): Use it to handle incoming connects.
Do not enable input on a new connection if process is stopped.
(read_process_output): Handle datagram sockets. Use 2k buffer for them.
(send_process): Handle datagram sockets.
(Fstop_process, Fcontinue_process): Apply to network processes. A stopped
network process is indicated by setting command field to t .
(Fprocess_send_eof): No-op if datagram connection.
(Fstatus_notify): Don't read input for a stream server socket or a
stopped network process.
(init_process): Initialize datagram_address array.
(syms_of_process): Intern and staticpro new variables, defsubr new
functions.
2002-03-17 20:20:33 +00:00
|
|
|
|
else if (EQ (p->command, Qt))
|
|
|
|
|
write_string ("stopped", -1);
|
|
|
|
|
else if (EQ (symbol, Qrun))
|
|
|
|
|
write_string ("open", -1);
|
1992-03-14 20:40:04 +00:00
|
|
|
|
else
|
|
|
|
|
Fprinc (symbol, Qnil);
|
|
|
|
|
}
|
Daniel Engeler <engeler at gmail.com>
These changes add serial port access.
* process.c: Add HAVE_SERIAL.
(Fdelete_process, Fprocess_status, Fset_process_buffer)
(Fset_process_filter, Fset_process_sentinel, Fprocess_contact)
(list_processes_1, select_wrapper, Fstop_process)
(Fcontinue_process, Fprocess_send_eof, kill_buffer_processes)
(status_notify): Modify to handle serial processes.
[HAVE_SERIAL] (Fserial_process_configure)
[HAVE_SERIAL] (make_serial_process_unwind, Fmake_serial_process):
New functions.
* process.h (struct Lisp_Process): Add `type'.
* sysdep.c [HAVE_TERMIOS] (serial_open, serial_configure):
New functions.
* w32.c (_sys_read_ahead, sys_read, sys_write): Modify to handle serial ports.
(serial_open, serial_configure) New functions.
* w32.h: Add FILE_SERIAL.
(struct _child_process): Add ovl_read, ovl_write.
2008-06-13 08:08:20 +00:00
|
|
|
|
else if (SERIALCONN1_P (p))
|
|
|
|
|
{
|
|
|
|
|
write_string ("running", -1);
|
|
|
|
|
}
|
1992-03-14 20:40:04 +00:00
|
|
|
|
else
|
|
|
|
|
Fprinc (symbol, Qnil);
|
|
|
|
|
|
|
|
|
|
if (EQ (symbol, Qexit))
|
|
|
|
|
{
|
|
|
|
|
Lisp_Object tem;
|
|
|
|
|
tem = Fcar (Fcdr (p->status));
|
|
|
|
|
if (XFASTINT (tem))
|
|
|
|
|
{
|
1995-05-05 02:16:54 +00:00
|
|
|
|
sprintf (tembuf, " %d", (int) XFASTINT (tem));
|
1992-03-14 20:40:04 +00:00
|
|
|
|
write_string (tembuf, -1);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2006-10-03 09:14:40 +00:00
|
|
|
|
if (EQ (symbol, Qsignal) || EQ (symbol, Qexit) || EQ (symbol, Qclosed))
|
|
|
|
|
exited++;
|
1992-03-14 20:40:04 +00:00
|
|
|
|
|
(Qlocal, QCname, QCbuffer, QChost, QCservice, QCfamily)
(QClocal, QCremote, QCserver, QCdatagram, QCnowait, QCnoquery,QCstop)
(QCcoding, QCoptions, QCfilter, QCsentinel, QClog, QCfeature):
New variables.
(NETCONN1_P): New macro.
(DATAGRAM_SOCKETS): New conditional symbol.
(datagram_address): New array.
(DATAGRAM_CONN_P, DATAGRAM_CHAN_P): New macros.
(status_message): Use concat3.
(Fprocess_status): Add `listen' status to doc string. Return `stop'
for a stopped network process.
(Fset_process_buffer): Update contact plist for network process.
(Fset_process_filter): Ditto. Don't enable input for stopped
network processes. Server must listen, even if filter is t.
(Fset_process_query_on_exit_flag, Fprocess_query_on_exit_flag):
New functions.
(Fprocess_kill_without_query): Removed. Now defined in simple.el.
(Fprocess_contact): Added KEY argument. Handle datagrams.
(list_processes_1): Optionally show only processes with the query
on exit flag set. Dynamically adjust column widths. Omit tty
column if not needed. Report stopped network processes.
Identify server and datagram network processes.
(Flist_processes): New optional arg `query-only'.
(conv_sockaddr_to_lisp, get_lisp_to_sockaddr_size)
(conv_lisp_to_sockaddr, set_socket_options)
(network_process_featurep, unwind_request_sigio): New helper functions.
(Fprocess_datagram_address, Fset_process_datagram_address):
(Fset_network_process_options): New lisp functions.
(Fopen_network_stream): Removed. Now defined in simple.el.
(Fmake_network_process): New lisp function. Code is based on previous
Fopen_network_stream, but heavily reworked with new property list based
argument list, support for datagrams, server processes, and local
sockets in addition to old client-only functionality.
(server_accept_connection): New function.
(wait_reading_process_input): Use it to handle incoming connects.
Do not enable input on a new connection if process is stopped.
(read_process_output): Handle datagram sockets. Use 2k buffer for them.
(send_process): Handle datagram sockets.
(Fstop_process, Fcontinue_process): Apply to network processes. A stopped
network process is indicated by setting command field to t .
(Fprocess_send_eof): No-op if datagram connection.
(Fstatus_notify): Don't read input for a stream server socket or a
stopped network process.
(init_process): Initialize datagram_address array.
(syms_of_process): Intern and staticpro new variables, defsubr new
functions.
2002-03-17 20:20:33 +00:00
|
|
|
|
Findent_to (i_buffer, minspace);
|
1992-03-14 20:40:04 +00:00
|
|
|
|
if (NILP (p->buffer))
|
|
|
|
|
insert_string ("(none)");
|
|
|
|
|
else if (NILP (XBUFFER (p->buffer)->name))
|
|
|
|
|
insert_string ("(Killed)");
|
|
|
|
|
else
|
|
|
|
|
Finsert (1, &XBUFFER (p->buffer)->name);
|
|
|
|
|
|
(Qlocal, QCname, QCbuffer, QChost, QCservice, QCfamily)
(QClocal, QCremote, QCserver, QCdatagram, QCnowait, QCnoquery,QCstop)
(QCcoding, QCoptions, QCfilter, QCsentinel, QClog, QCfeature):
New variables.
(NETCONN1_P): New macro.
(DATAGRAM_SOCKETS): New conditional symbol.
(datagram_address): New array.
(DATAGRAM_CONN_P, DATAGRAM_CHAN_P): New macros.
(status_message): Use concat3.
(Fprocess_status): Add `listen' status to doc string. Return `stop'
for a stopped network process.
(Fset_process_buffer): Update contact plist for network process.
(Fset_process_filter): Ditto. Don't enable input for stopped
network processes. Server must listen, even if filter is t.
(Fset_process_query_on_exit_flag, Fprocess_query_on_exit_flag):
New functions.
(Fprocess_kill_without_query): Removed. Now defined in simple.el.
(Fprocess_contact): Added KEY argument. Handle datagrams.
(list_processes_1): Optionally show only processes with the query
on exit flag set. Dynamically adjust column widths. Omit tty
column if not needed. Report stopped network processes.
Identify server and datagram network processes.
(Flist_processes): New optional arg `query-only'.
(conv_sockaddr_to_lisp, get_lisp_to_sockaddr_size)
(conv_lisp_to_sockaddr, set_socket_options)
(network_process_featurep, unwind_request_sigio): New helper functions.
(Fprocess_datagram_address, Fset_process_datagram_address):
(Fset_network_process_options): New lisp functions.
(Fopen_network_stream): Removed. Now defined in simple.el.
(Fmake_network_process): New lisp function. Code is based on previous
Fopen_network_stream, but heavily reworked with new property list based
argument list, support for datagrams, server processes, and local
sockets in addition to old client-only functionality.
(server_accept_connection): New function.
(wait_reading_process_input): Use it to handle incoming connects.
Do not enable input on a new connection if process is stopped.
(read_process_output): Handle datagram sockets. Use 2k buffer for them.
(send_process): Handle datagram sockets.
(Fstop_process, Fcontinue_process): Apply to network processes. A stopped
network process is indicated by setting command field to t .
(Fprocess_send_eof): No-op if datagram connection.
(Fstatus_notify): Don't read input for a stream server socket or a
stopped network process.
(init_process): Initialize datagram_address array.
(syms_of_process): Intern and staticpro new variables, defsubr new
functions.
2002-03-17 20:20:33 +00:00
|
|
|
|
if (!NILP (i_tty))
|
|
|
|
|
{
|
|
|
|
|
Findent_to (i_tty, minspace);
|
|
|
|
|
if (STRINGP (p->tty_name))
|
|
|
|
|
Finsert (1, &p->tty_name);
|
|
|
|
|
}
|
1994-10-26 00:21:05 +00:00
|
|
|
|
|
(Qlocal, QCname, QCbuffer, QChost, QCservice, QCfamily)
(QClocal, QCremote, QCserver, QCdatagram, QCnowait, QCnoquery,QCstop)
(QCcoding, QCoptions, QCfilter, QCsentinel, QClog, QCfeature):
New variables.
(NETCONN1_P): New macro.
(DATAGRAM_SOCKETS): New conditional symbol.
(datagram_address): New array.
(DATAGRAM_CONN_P, DATAGRAM_CHAN_P): New macros.
(status_message): Use concat3.
(Fprocess_status): Add `listen' status to doc string. Return `stop'
for a stopped network process.
(Fset_process_buffer): Update contact plist for network process.
(Fset_process_filter): Ditto. Don't enable input for stopped
network processes. Server must listen, even if filter is t.
(Fset_process_query_on_exit_flag, Fprocess_query_on_exit_flag):
New functions.
(Fprocess_kill_without_query): Removed. Now defined in simple.el.
(Fprocess_contact): Added KEY argument. Handle datagrams.
(list_processes_1): Optionally show only processes with the query
on exit flag set. Dynamically adjust column widths. Omit tty
column if not needed. Report stopped network processes.
Identify server and datagram network processes.
(Flist_processes): New optional arg `query-only'.
(conv_sockaddr_to_lisp, get_lisp_to_sockaddr_size)
(conv_lisp_to_sockaddr, set_socket_options)
(network_process_featurep, unwind_request_sigio): New helper functions.
(Fprocess_datagram_address, Fset_process_datagram_address):
(Fset_network_process_options): New lisp functions.
(Fopen_network_stream): Removed. Now defined in simple.el.
(Fmake_network_process): New lisp function. Code is based on previous
Fopen_network_stream, but heavily reworked with new property list based
argument list, support for datagrams, server processes, and local
sockets in addition to old client-only functionality.
(server_accept_connection): New function.
(wait_reading_process_input): Use it to handle incoming connects.
Do not enable input on a new connection if process is stopped.
(read_process_output): Handle datagram sockets. Use 2k buffer for them.
(send_process): Handle datagram sockets.
(Fstop_process, Fcontinue_process): Apply to network processes. A stopped
network process is indicated by setting command field to t .
(Fprocess_send_eof): No-op if datagram connection.
(Fstatus_notify): Don't read input for a stream server socket or a
stopped network process.
(init_process): Initialize datagram_address array.
(syms_of_process): Intern and staticpro new variables, defsubr new
functions.
2002-03-17 20:20:33 +00:00
|
|
|
|
Findent_to (i_command, minspace);
|
1994-10-26 00:21:05 +00:00
|
|
|
|
|
(Qlocal, QCname, QCbuffer, QChost, QCservice, QCfamily)
(QClocal, QCremote, QCserver, QCdatagram, QCnowait, QCnoquery,QCstop)
(QCcoding, QCoptions, QCfilter, QCsentinel, QClog, QCfeature):
New variables.
(NETCONN1_P): New macro.
(DATAGRAM_SOCKETS): New conditional symbol.
(datagram_address): New array.
(DATAGRAM_CONN_P, DATAGRAM_CHAN_P): New macros.
(status_message): Use concat3.
(Fprocess_status): Add `listen' status to doc string. Return `stop'
for a stopped network process.
(Fset_process_buffer): Update contact plist for network process.
(Fset_process_filter): Ditto. Don't enable input for stopped
network processes. Server must listen, even if filter is t.
(Fset_process_query_on_exit_flag, Fprocess_query_on_exit_flag):
New functions.
(Fprocess_kill_without_query): Removed. Now defined in simple.el.
(Fprocess_contact): Added KEY argument. Handle datagrams.
(list_processes_1): Optionally show only processes with the query
on exit flag set. Dynamically adjust column widths. Omit tty
column if not needed. Report stopped network processes.
Identify server and datagram network processes.
(Flist_processes): New optional arg `query-only'.
(conv_sockaddr_to_lisp, get_lisp_to_sockaddr_size)
(conv_lisp_to_sockaddr, set_socket_options)
(network_process_featurep, unwind_request_sigio): New helper functions.
(Fprocess_datagram_address, Fset_process_datagram_address):
(Fset_network_process_options): New lisp functions.
(Fopen_network_stream): Removed. Now defined in simple.el.
(Fmake_network_process): New lisp function. Code is based on previous
Fopen_network_stream, but heavily reworked with new property list based
argument list, support for datagrams, server processes, and local
sockets in addition to old client-only functionality.
(server_accept_connection): New function.
(wait_reading_process_input): Use it to handle incoming connects.
Do not enable input on a new connection if process is stopped.
(read_process_output): Handle datagram sockets. Use 2k buffer for them.
(send_process): Handle datagram sockets.
(Fstop_process, Fcontinue_process): Apply to network processes. A stopped
network process is indicated by setting command field to t .
(Fprocess_send_eof): No-op if datagram connection.
(Fstatus_notify): Don't read input for a stream server socket or a
stopped network process.
(init_process): Initialize datagram_address array.
(syms_of_process): Intern and staticpro new variables, defsubr new
functions.
2002-03-17 20:20:33 +00:00
|
|
|
|
if (EQ (p->status, Qlisten))
|
|
|
|
|
{
|
|
|
|
|
Lisp_Object port = Fplist_get (p->childp, QCservice);
|
|
|
|
|
if (INTEGERP (port))
|
|
|
|
|
port = Fnumber_to_string (port);
|
2002-10-24 08:03:41 +00:00
|
|
|
|
if (NILP (port))
|
2003-01-08 15:35:03 +00:00
|
|
|
|
port = Fformat_network_address (Fplist_get (p->childp, QClocal), Qnil);
|
(Qlocal, QCname, QCbuffer, QChost, QCservice, QCfamily)
(QClocal, QCremote, QCserver, QCdatagram, QCnowait, QCnoquery,QCstop)
(QCcoding, QCoptions, QCfilter, QCsentinel, QClog, QCfeature):
New variables.
(NETCONN1_P): New macro.
(DATAGRAM_SOCKETS): New conditional symbol.
(datagram_address): New array.
(DATAGRAM_CONN_P, DATAGRAM_CHAN_P): New macros.
(status_message): Use concat3.
(Fprocess_status): Add `listen' status to doc string. Return `stop'
for a stopped network process.
(Fset_process_buffer): Update contact plist for network process.
(Fset_process_filter): Ditto. Don't enable input for stopped
network processes. Server must listen, even if filter is t.
(Fset_process_query_on_exit_flag, Fprocess_query_on_exit_flag):
New functions.
(Fprocess_kill_without_query): Removed. Now defined in simple.el.
(Fprocess_contact): Added KEY argument. Handle datagrams.
(list_processes_1): Optionally show only processes with the query
on exit flag set. Dynamically adjust column widths. Omit tty
column if not needed. Report stopped network processes.
Identify server and datagram network processes.
(Flist_processes): New optional arg `query-only'.
(conv_sockaddr_to_lisp, get_lisp_to_sockaddr_size)
(conv_lisp_to_sockaddr, set_socket_options)
(network_process_featurep, unwind_request_sigio): New helper functions.
(Fprocess_datagram_address, Fset_process_datagram_address):
(Fset_network_process_options): New lisp functions.
(Fopen_network_stream): Removed. Now defined in simple.el.
(Fmake_network_process): New lisp function. Code is based on previous
Fopen_network_stream, but heavily reworked with new property list based
argument list, support for datagrams, server processes, and local
sockets in addition to old client-only functionality.
(server_accept_connection): New function.
(wait_reading_process_input): Use it to handle incoming connects.
Do not enable input on a new connection if process is stopped.
(read_process_output): Handle datagram sockets. Use 2k buffer for them.
(send_process): Handle datagram sockets.
(Fstop_process, Fcontinue_process): Apply to network processes. A stopped
network process is indicated by setting command field to t .
(Fprocess_send_eof): No-op if datagram connection.
(Fstatus_notify): Don't read input for a stream server socket or a
stopped network process.
(init_process): Initialize datagram_address array.
(syms_of_process): Intern and staticpro new variables, defsubr new
functions.
2002-03-17 20:20:33 +00:00
|
|
|
|
sprintf (tembuf, "(network %s server on %s)\n",
|
(struct Lisp_Process): Turn slots infd, outfd, kill_without_query, pty_flag,
tick, update_tick, decoding_carryover, inherit_coding_system_flag,
filter_multibyte, adaptive_read_buffering, read_output_delay, and
read_output_skip from Lisp_Objects to ints. Remove unused
encoding_carryover.
2007-07-12 06:36:57 +00:00
|
|
|
|
(DATAGRAM_CHAN_P (p->infd) ? "datagram" : "stream"),
|
2002-10-24 08:03:41 +00:00
|
|
|
|
(STRINGP (port) ? (char *)SDATA (port) : "?"));
|
(Qlocal, QCname, QCbuffer, QChost, QCservice, QCfamily)
(QClocal, QCremote, QCserver, QCdatagram, QCnowait, QCnoquery,QCstop)
(QCcoding, QCoptions, QCfilter, QCsentinel, QClog, QCfeature):
New variables.
(NETCONN1_P): New macro.
(DATAGRAM_SOCKETS): New conditional symbol.
(datagram_address): New array.
(DATAGRAM_CONN_P, DATAGRAM_CHAN_P): New macros.
(status_message): Use concat3.
(Fprocess_status): Add `listen' status to doc string. Return `stop'
for a stopped network process.
(Fset_process_buffer): Update contact plist for network process.
(Fset_process_filter): Ditto. Don't enable input for stopped
network processes. Server must listen, even if filter is t.
(Fset_process_query_on_exit_flag, Fprocess_query_on_exit_flag):
New functions.
(Fprocess_kill_without_query): Removed. Now defined in simple.el.
(Fprocess_contact): Added KEY argument. Handle datagrams.
(list_processes_1): Optionally show only processes with the query
on exit flag set. Dynamically adjust column widths. Omit tty
column if not needed. Report stopped network processes.
Identify server and datagram network processes.
(Flist_processes): New optional arg `query-only'.
(conv_sockaddr_to_lisp, get_lisp_to_sockaddr_size)
(conv_lisp_to_sockaddr, set_socket_options)
(network_process_featurep, unwind_request_sigio): New helper functions.
(Fprocess_datagram_address, Fset_process_datagram_address):
(Fset_network_process_options): New lisp functions.
(Fopen_network_stream): Removed. Now defined in simple.el.
(Fmake_network_process): New lisp function. Code is based on previous
Fopen_network_stream, but heavily reworked with new property list based
argument list, support for datagrams, server processes, and local
sockets in addition to old client-only functionality.
(server_accept_connection): New function.
(wait_reading_process_input): Use it to handle incoming connects.
Do not enable input on a new connection if process is stopped.
(read_process_output): Handle datagram sockets. Use 2k buffer for them.
(send_process): Handle datagram sockets.
(Fstop_process, Fcontinue_process): Apply to network processes. A stopped
network process is indicated by setting command field to t .
(Fprocess_send_eof): No-op if datagram connection.
(Fstatus_notify): Don't read input for a stream server socket or a
stopped network process.
(init_process): Initialize datagram_address array.
(syms_of_process): Intern and staticpro new variables, defsubr new
functions.
2002-03-17 20:20:33 +00:00
|
|
|
|
insert_string (tembuf);
|
|
|
|
|
}
|
|
|
|
|
else if (NETCONN1_P (p))
|
2009-01-01 15:58:38 +00:00
|
|
|
|
{
|
(Qlocal, QCname, QCbuffer, QChost, QCservice, QCfamily)
(QClocal, QCremote, QCserver, QCdatagram, QCnowait, QCnoquery,QCstop)
(QCcoding, QCoptions, QCfilter, QCsentinel, QClog, QCfeature):
New variables.
(NETCONN1_P): New macro.
(DATAGRAM_SOCKETS): New conditional symbol.
(datagram_address): New array.
(DATAGRAM_CONN_P, DATAGRAM_CHAN_P): New macros.
(status_message): Use concat3.
(Fprocess_status): Add `listen' status to doc string. Return `stop'
for a stopped network process.
(Fset_process_buffer): Update contact plist for network process.
(Fset_process_filter): Ditto. Don't enable input for stopped
network processes. Server must listen, even if filter is t.
(Fset_process_query_on_exit_flag, Fprocess_query_on_exit_flag):
New functions.
(Fprocess_kill_without_query): Removed. Now defined in simple.el.
(Fprocess_contact): Added KEY argument. Handle datagrams.
(list_processes_1): Optionally show only processes with the query
on exit flag set. Dynamically adjust column widths. Omit tty
column if not needed. Report stopped network processes.
Identify server and datagram network processes.
(Flist_processes): New optional arg `query-only'.
(conv_sockaddr_to_lisp, get_lisp_to_sockaddr_size)
(conv_lisp_to_sockaddr, set_socket_options)
(network_process_featurep, unwind_request_sigio): New helper functions.
(Fprocess_datagram_address, Fset_process_datagram_address):
(Fset_network_process_options): New lisp functions.
(Fopen_network_stream): Removed. Now defined in simple.el.
(Fmake_network_process): New lisp function. Code is based on previous
Fopen_network_stream, but heavily reworked with new property list based
argument list, support for datagrams, server processes, and local
sockets in addition to old client-only functionality.
(server_accept_connection): New function.
(wait_reading_process_input): Use it to handle incoming connects.
Do not enable input on a new connection if process is stopped.
(read_process_output): Handle datagram sockets. Use 2k buffer for them.
(send_process): Handle datagram sockets.
(Fstop_process, Fcontinue_process): Apply to network processes. A stopped
network process is indicated by setting command field to t .
(Fprocess_send_eof): No-op if datagram connection.
(Fstatus_notify): Don't read input for a stream server socket or a
stopped network process.
(init_process): Initialize datagram_address array.
(syms_of_process): Intern and staticpro new variables, defsubr new
functions.
2002-03-17 20:20:33 +00:00
|
|
|
|
/* For a local socket, there is no host name,
|
|
|
|
|
so display service instead. */
|
|
|
|
|
Lisp_Object host = Fplist_get (p->childp, QChost);
|
|
|
|
|
if (!STRINGP (host))
|
|
|
|
|
{
|
|
|
|
|
host = Fplist_get (p->childp, QCservice);
|
|
|
|
|
if (INTEGERP (host))
|
|
|
|
|
host = Fnumber_to_string (host);
|
|
|
|
|
}
|
2002-10-24 08:03:41 +00:00
|
|
|
|
if (NILP (host))
|
2003-01-08 15:35:03 +00:00
|
|
|
|
host = Fformat_network_address (Fplist_get (p->childp, QCremote), Qnil);
|
(Qlocal, QCname, QCbuffer, QChost, QCservice, QCfamily)
(QClocal, QCremote, QCserver, QCdatagram, QCnowait, QCnoquery,QCstop)
(QCcoding, QCoptions, QCfilter, QCsentinel, QClog, QCfeature):
New variables.
(NETCONN1_P): New macro.
(DATAGRAM_SOCKETS): New conditional symbol.
(datagram_address): New array.
(DATAGRAM_CONN_P, DATAGRAM_CHAN_P): New macros.
(status_message): Use concat3.
(Fprocess_status): Add `listen' status to doc string. Return `stop'
for a stopped network process.
(Fset_process_buffer): Update contact plist for network process.
(Fset_process_filter): Ditto. Don't enable input for stopped
network processes. Server must listen, even if filter is t.
(Fset_process_query_on_exit_flag, Fprocess_query_on_exit_flag):
New functions.
(Fprocess_kill_without_query): Removed. Now defined in simple.el.
(Fprocess_contact): Added KEY argument. Handle datagrams.
(list_processes_1): Optionally show only processes with the query
on exit flag set. Dynamically adjust column widths. Omit tty
column if not needed. Report stopped network processes.
Identify server and datagram network processes.
(Flist_processes): New optional arg `query-only'.
(conv_sockaddr_to_lisp, get_lisp_to_sockaddr_size)
(conv_lisp_to_sockaddr, set_socket_options)
(network_process_featurep, unwind_request_sigio): New helper functions.
(Fprocess_datagram_address, Fset_process_datagram_address):
(Fset_network_process_options): New lisp functions.
(Fopen_network_stream): Removed. Now defined in simple.el.
(Fmake_network_process): New lisp function. Code is based on previous
Fopen_network_stream, but heavily reworked with new property list based
argument list, support for datagrams, server processes, and local
sockets in addition to old client-only functionality.
(server_accept_connection): New function.
(wait_reading_process_input): Use it to handle incoming connects.
Do not enable input on a new connection if process is stopped.
(read_process_output): Handle datagram sockets. Use 2k buffer for them.
(send_process): Handle datagram sockets.
(Fstop_process, Fcontinue_process): Apply to network processes. A stopped
network process is indicated by setting command field to t .
(Fprocess_send_eof): No-op if datagram connection.
(Fstatus_notify): Don't read input for a stream server socket or a
stopped network process.
(init_process): Initialize datagram_address array.
(syms_of_process): Intern and staticpro new variables, defsubr new
functions.
2002-03-17 20:20:33 +00:00
|
|
|
|
sprintf (tembuf, "(network %s connection to %s)\n",
|
(struct Lisp_Process): Turn slots infd, outfd, kill_without_query, pty_flag,
tick, update_tick, decoding_carryover, inherit_coding_system_flag,
filter_multibyte, adaptive_read_buffering, read_output_delay, and
read_output_skip from Lisp_Objects to ints. Remove unused
encoding_carryover.
2007-07-12 06:36:57 +00:00
|
|
|
|
(DATAGRAM_CHAN_P (p->infd) ? "datagram" : "stream"),
|
2002-10-24 08:03:41 +00:00
|
|
|
|
(STRINGP (host) ? (char *)SDATA (host) : "?"));
|
1992-03-14 20:40:04 +00:00
|
|
|
|
insert_string (tembuf);
|
2009-01-01 15:58:38 +00:00
|
|
|
|
}
|
Daniel Engeler <engeler at gmail.com>
These changes add serial port access.
* process.c: Add HAVE_SERIAL.
(Fdelete_process, Fprocess_status, Fset_process_buffer)
(Fset_process_filter, Fset_process_sentinel, Fprocess_contact)
(list_processes_1, select_wrapper, Fstop_process)
(Fcontinue_process, Fprocess_send_eof, kill_buffer_processes)
(status_notify): Modify to handle serial processes.
[HAVE_SERIAL] (Fserial_process_configure)
[HAVE_SERIAL] (make_serial_process_unwind, Fmake_serial_process):
New functions.
* process.h (struct Lisp_Process): Add `type'.
* sysdep.c [HAVE_TERMIOS] (serial_open, serial_configure):
New functions.
* w32.c (_sys_read_ahead, sys_read, sys_write): Modify to handle serial ports.
(serial_open, serial_configure) New functions.
* w32.h: Add FILE_SERIAL.
(struct _child_process): Add ovl_read, ovl_write.
2008-06-13 08:08:20 +00:00
|
|
|
|
else if (SERIALCONN1_P (p))
|
|
|
|
|
{
|
|
|
|
|
Lisp_Object port = Fplist_get (p->childp, QCport);
|
|
|
|
|
Lisp_Object speed = Fplist_get (p->childp, QCspeed);
|
|
|
|
|
insert_string ("(serial port ");
|
|
|
|
|
if (STRINGP (port))
|
|
|
|
|
insert_string (SDATA (port));
|
|
|
|
|
else
|
|
|
|
|
insert_string ("?");
|
|
|
|
|
if (INTEGERP (speed))
|
|
|
|
|
{
|
2009-10-13 01:03:46 +00:00
|
|
|
|
sprintf (tembuf, " at %ld b/s", (long) XINT (speed));
|
Daniel Engeler <engeler at gmail.com>
These changes add serial port access.
* process.c: Add HAVE_SERIAL.
(Fdelete_process, Fprocess_status, Fset_process_buffer)
(Fset_process_filter, Fset_process_sentinel, Fprocess_contact)
(list_processes_1, select_wrapper, Fstop_process)
(Fcontinue_process, Fprocess_send_eof, kill_buffer_processes)
(status_notify): Modify to handle serial processes.
[HAVE_SERIAL] (Fserial_process_configure)
[HAVE_SERIAL] (make_serial_process_unwind, Fmake_serial_process):
New functions.
* process.h (struct Lisp_Process): Add `type'.
* sysdep.c [HAVE_TERMIOS] (serial_open, serial_configure):
New functions.
* w32.c (_sys_read_ahead, sys_read, sys_write): Modify to handle serial ports.
(serial_open, serial_configure) New functions.
* w32.h: Add FILE_SERIAL.
(struct _child_process): Add ovl_read, ovl_write.
2008-06-13 08:08:20 +00:00
|
|
|
|
insert_string (tembuf);
|
|
|
|
|
}
|
|
|
|
|
insert_string (")\n");
|
|
|
|
|
}
|
2003-02-04 14:56:31 +00:00
|
|
|
|
else
|
1992-03-14 20:40:04 +00:00
|
|
|
|
{
|
|
|
|
|
tem = p->command;
|
|
|
|
|
while (1)
|
|
|
|
|
{
|
|
|
|
|
tem1 = Fcar (tem);
|
2009-08-13 13:22:55 +00:00
|
|
|
|
if (NILP (tem1))
|
|
|
|
|
break;
|
1992-03-14 20:40:04 +00:00
|
|
|
|
Finsert (1, &tem1);
|
|
|
|
|
tem = Fcdr (tem);
|
|
|
|
|
if (NILP (tem))
|
|
|
|
|
break;
|
|
|
|
|
insert_string (" ");
|
|
|
|
|
}
|
|
|
|
|
insert_string ("\n");
|
|
|
|
|
}
|
|
|
|
|
}
|
2006-10-03 09:14:40 +00:00
|
|
|
|
if (exited)
|
2009-08-17 21:04:05 +00:00
|
|
|
|
{
|
|
|
|
|
status_notify (NULL);
|
|
|
|
|
redisplay_preserve_echo_area (13);
|
|
|
|
|
}
|
1992-03-14 20:40:04 +00:00
|
|
|
|
return Qnil;
|
|
|
|
|
}
|
|
|
|
|
|
(Qlocal, QCname, QCbuffer, QChost, QCservice, QCfamily)
(QClocal, QCremote, QCserver, QCdatagram, QCnowait, QCnoquery,QCstop)
(QCcoding, QCoptions, QCfilter, QCsentinel, QClog, QCfeature):
New variables.
(NETCONN1_P): New macro.
(DATAGRAM_SOCKETS): New conditional symbol.
(datagram_address): New array.
(DATAGRAM_CONN_P, DATAGRAM_CHAN_P): New macros.
(status_message): Use concat3.
(Fprocess_status): Add `listen' status to doc string. Return `stop'
for a stopped network process.
(Fset_process_buffer): Update contact plist for network process.
(Fset_process_filter): Ditto. Don't enable input for stopped
network processes. Server must listen, even if filter is t.
(Fset_process_query_on_exit_flag, Fprocess_query_on_exit_flag):
New functions.
(Fprocess_kill_without_query): Removed. Now defined in simple.el.
(Fprocess_contact): Added KEY argument. Handle datagrams.
(list_processes_1): Optionally show only processes with the query
on exit flag set. Dynamically adjust column widths. Omit tty
column if not needed. Report stopped network processes.
Identify server and datagram network processes.
(Flist_processes): New optional arg `query-only'.
(conv_sockaddr_to_lisp, get_lisp_to_sockaddr_size)
(conv_lisp_to_sockaddr, set_socket_options)
(network_process_featurep, unwind_request_sigio): New helper functions.
(Fprocess_datagram_address, Fset_process_datagram_address):
(Fset_network_process_options): New lisp functions.
(Fopen_network_stream): Removed. Now defined in simple.el.
(Fmake_network_process): New lisp function. Code is based on previous
Fopen_network_stream, but heavily reworked with new property list based
argument list, support for datagrams, server processes, and local
sockets in addition to old client-only functionality.
(server_accept_connection): New function.
(wait_reading_process_input): Use it to handle incoming connects.
Do not enable input on a new connection if process is stopped.
(read_process_output): Handle datagram sockets. Use 2k buffer for them.
(send_process): Handle datagram sockets.
(Fstop_process, Fcontinue_process): Apply to network processes. A stopped
network process is indicated by setting command field to t .
(Fprocess_send_eof): No-op if datagram connection.
(Fstatus_notify): Don't read input for a stream server socket or a
stopped network process.
(init_process): Initialize datagram_address array.
(syms_of_process): Intern and staticpro new variables, defsubr new
functions.
2002-03-17 20:20:33 +00:00
|
|
|
|
DEFUN ("list-processes", Flist_processes, Slist_processes, 0, 1, "P",
|
2001-10-20 20:56:10 +00:00
|
|
|
|
doc: /* Display a list of all processes.
|
(Qlocal, QCname, QCbuffer, QChost, QCservice, QCfamily)
(QClocal, QCremote, QCserver, QCdatagram, QCnowait, QCnoquery,QCstop)
(QCcoding, QCoptions, QCfilter, QCsentinel, QClog, QCfeature):
New variables.
(NETCONN1_P): New macro.
(DATAGRAM_SOCKETS): New conditional symbol.
(datagram_address): New array.
(DATAGRAM_CONN_P, DATAGRAM_CHAN_P): New macros.
(status_message): Use concat3.
(Fprocess_status): Add `listen' status to doc string. Return `stop'
for a stopped network process.
(Fset_process_buffer): Update contact plist for network process.
(Fset_process_filter): Ditto. Don't enable input for stopped
network processes. Server must listen, even if filter is t.
(Fset_process_query_on_exit_flag, Fprocess_query_on_exit_flag):
New functions.
(Fprocess_kill_without_query): Removed. Now defined in simple.el.
(Fprocess_contact): Added KEY argument. Handle datagrams.
(list_processes_1): Optionally show only processes with the query
on exit flag set. Dynamically adjust column widths. Omit tty
column if not needed. Report stopped network processes.
Identify server and datagram network processes.
(Flist_processes): New optional arg `query-only'.
(conv_sockaddr_to_lisp, get_lisp_to_sockaddr_size)
(conv_lisp_to_sockaddr, set_socket_options)
(network_process_featurep, unwind_request_sigio): New helper functions.
(Fprocess_datagram_address, Fset_process_datagram_address):
(Fset_network_process_options): New lisp functions.
(Fopen_network_stream): Removed. Now defined in simple.el.
(Fmake_network_process): New lisp function. Code is based on previous
Fopen_network_stream, but heavily reworked with new property list based
argument list, support for datagrams, server processes, and local
sockets in addition to old client-only functionality.
(server_accept_connection): New function.
(wait_reading_process_input): Use it to handle incoming connects.
Do not enable input on a new connection if process is stopped.
(read_process_output): Handle datagram sockets. Use 2k buffer for them.
(send_process): Handle datagram sockets.
(Fstop_process, Fcontinue_process): Apply to network processes. A stopped
network process is indicated by setting command field to t .
(Fprocess_send_eof): No-op if datagram connection.
(Fstatus_notify): Don't read input for a stream server socket or a
stopped network process.
(init_process): Initialize datagram_address array.
(syms_of_process): Intern and staticpro new variables, defsubr new
functions.
2002-03-17 20:20:33 +00:00
|
|
|
|
If optional argument QUERY-ONLY is non-nil, only processes with
|
|
|
|
|
the query-on-exit flag set will be listed.
|
2001-10-20 20:56:10 +00:00
|
|
|
|
Any process listed as exited or signaled is actually eliminated
|
|
|
|
|
after the listing is made. */)
|
2010-07-08 14:25:08 -07:00
|
|
|
|
(Lisp_Object query_only)
|
1992-03-14 20:40:04 +00:00
|
|
|
|
{
|
|
|
|
|
internal_with_output_to_temp_buffer ("*Process List*",
|
(Qlocal, QCname, QCbuffer, QChost, QCservice, QCfamily)
(QClocal, QCremote, QCserver, QCdatagram, QCnowait, QCnoquery,QCstop)
(QCcoding, QCoptions, QCfilter, QCsentinel, QClog, QCfeature):
New variables.
(NETCONN1_P): New macro.
(DATAGRAM_SOCKETS): New conditional symbol.
(datagram_address): New array.
(DATAGRAM_CONN_P, DATAGRAM_CHAN_P): New macros.
(status_message): Use concat3.
(Fprocess_status): Add `listen' status to doc string. Return `stop'
for a stopped network process.
(Fset_process_buffer): Update contact plist for network process.
(Fset_process_filter): Ditto. Don't enable input for stopped
network processes. Server must listen, even if filter is t.
(Fset_process_query_on_exit_flag, Fprocess_query_on_exit_flag):
New functions.
(Fprocess_kill_without_query): Removed. Now defined in simple.el.
(Fprocess_contact): Added KEY argument. Handle datagrams.
(list_processes_1): Optionally show only processes with the query
on exit flag set. Dynamically adjust column widths. Omit tty
column if not needed. Report stopped network processes.
Identify server and datagram network processes.
(Flist_processes): New optional arg `query-only'.
(conv_sockaddr_to_lisp, get_lisp_to_sockaddr_size)
(conv_lisp_to_sockaddr, set_socket_options)
(network_process_featurep, unwind_request_sigio): New helper functions.
(Fprocess_datagram_address, Fset_process_datagram_address):
(Fset_network_process_options): New lisp functions.
(Fopen_network_stream): Removed. Now defined in simple.el.
(Fmake_network_process): New lisp function. Code is based on previous
Fopen_network_stream, but heavily reworked with new property list based
argument list, support for datagrams, server processes, and local
sockets in addition to old client-only functionality.
(server_accept_connection): New function.
(wait_reading_process_input): Use it to handle incoming connects.
Do not enable input on a new connection if process is stopped.
(read_process_output): Handle datagram sockets. Use 2k buffer for them.
(send_process): Handle datagram sockets.
(Fstop_process, Fcontinue_process): Apply to network processes. A stopped
network process is indicated by setting command field to t .
(Fprocess_send_eof): No-op if datagram connection.
(Fstatus_notify): Don't read input for a stream server socket or a
stopped network process.
(init_process): Initialize datagram_address array.
(syms_of_process): Intern and staticpro new variables, defsubr new
functions.
2002-03-17 20:20:33 +00:00
|
|
|
|
list_processes_1, query_only);
|
1992-03-14 20:40:04 +00:00
|
|
|
|
return Qnil;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
DEFUN ("process-list", Fprocess_list, Sprocess_list, 0, 0, 0,
|
2001-10-20 20:56:10 +00:00
|
|
|
|
doc: /* Return a list of all processes. */)
|
2010-07-08 14:25:08 -07:00
|
|
|
|
(void)
|
1992-03-14 20:40:04 +00:00
|
|
|
|
{
|
|
|
|
|
return Fmapcar (Qcdr, Vprocess_alist);
|
|
|
|
|
}
|
|
|
|
|
|
* systty.h, process.c, buffer.h, callproc.c, sysdep.c, dired.c:
Added VMS changes from Roland Roberts.
* process.c (read_process_output): Save, widen, insert the process
output, and then restore the restriction if inserting text outside
the visible region.
* process.c (Fstart_process): Establish an unwind-protect to
remove PROC from the process list if an error occurs while
starting it.
(start_process_unwind): New function to help with that.
(create_process): There's no need to explicitly call
remove_process if the fork fails; the record_unwind_protect in
Fstart_process will take care of it.
* process.c (wait_reading_process_input): Test the C preprocessor
symbol "ultrix", not "__ultrix__" to see if we should ignore
ENOMEM errors from select.
* process.c (process_send_signal): On systems which have both
the TIOCGETC and TCGETA ioctls, just use the former.
* s/bsd4-2.h, s/bsd4-3.h: #define SIGNALS_VIA_CHARACTERS.
* process.c (process_send_signal): Put all the code for sending
signals via characters in a #ifdef SIGNALS_VIA_CHARACTERS. Decide
whether to use the Berkeley-style or SYSV-style ioctls by seeing
which ioctl commands are #defined.
* process.c (process_send_signal): Doc fix.
1992-11-16 00:53:26 +00:00
|
|
|
|
/* Starting asynchronous inferior processes. */
|
|
|
|
|
|
2010-07-05 12:36:06 +02:00
|
|
|
|
static Lisp_Object start_process_unwind (Lisp_Object proc);
|
* systty.h, process.c, buffer.h, callproc.c, sysdep.c, dired.c:
Added VMS changes from Roland Roberts.
* process.c (read_process_output): Save, widen, insert the process
output, and then restore the restriction if inserting text outside
the visible region.
* process.c (Fstart_process): Establish an unwind-protect to
remove PROC from the process list if an error occurs while
starting it.
(start_process_unwind): New function to help with that.
(create_process): There's no need to explicitly call
remove_process if the fork fails; the record_unwind_protect in
Fstart_process will take care of it.
* process.c (wait_reading_process_input): Test the C preprocessor
symbol "ultrix", not "__ultrix__" to see if we should ignore
ENOMEM errors from select.
* process.c (process_send_signal): On systems which have both
the TIOCGETC and TCGETA ioctls, just use the former.
* s/bsd4-2.h, s/bsd4-3.h: #define SIGNALS_VIA_CHARACTERS.
* process.c (process_send_signal): Put all the code for sending
signals via characters in a #ifdef SIGNALS_VIA_CHARACTERS. Decide
whether to use the Berkeley-style or SYSV-style ioctls by seeing
which ioctl commands are #defined.
* process.c (process_send_signal): Doc fix.
1992-11-16 00:53:26 +00:00
|
|
|
|
|
1992-03-14 20:40:04 +00:00
|
|
|
|
DEFUN ("start-process", Fstart_process, Sstart_process, 3, MANY, 0,
|
2001-10-20 20:56:10 +00:00
|
|
|
|
doc: /* Start a program in a subprocess. Return the process object for it.
|
|
|
|
|
NAME is name for process. It is modified if necessary to make it unique.
|
2004-05-10 17:47:38 +00:00
|
|
|
|
BUFFER is the buffer (or buffer name) to associate with the process.
|
2007-04-23 09:02:08 +00:00
|
|
|
|
|
|
|
|
|
Process output (both standard output and standard error streams) goes
|
|
|
|
|
at end of BUFFER, unless you specify an output stream or filter
|
|
|
|
|
function to handle the output. BUFFER may also be nil, meaning that
|
2007-04-23 21:27:40 +00:00
|
|
|
|
this process is not associated with any buffer.
|
|
|
|
|
|
2009-08-13 13:22:55 +00:00
|
|
|
|
PROGRAM is the program file name. It is searched for in PATH. If
|
|
|
|
|
nil, just associate a pty with the buffer. Remaining arguments are
|
|
|
|
|
strings to give program as arguments.
|
2002-03-27 07:56:19 +00:00
|
|
|
|
|
2007-04-23 09:02:08 +00:00
|
|
|
|
If you want to separate standard output from standard error, invoke
|
|
|
|
|
the command through a shell and redirect one of them using the shell
|
|
|
|
|
syntax.
|
2002-03-27 07:56:19 +00:00
|
|
|
|
|
2001-11-02 07:01:10 +00:00
|
|
|
|
usage: (start-process NAME BUFFER PROGRAM &rest PROGRAM-ARGS) */)
|
2010-07-08 14:25:08 -07:00
|
|
|
|
(int nargs, register Lisp_Object *args)
|
1992-03-14 20:40:04 +00:00
|
|
|
|
{
|
1992-12-12 15:36:50 +00:00
|
|
|
|
Lisp_Object buffer, name, program, proc, current_dir, tem;
|
1992-03-14 20:40:04 +00:00
|
|
|
|
register unsigned char **new_argv;
|
|
|
|
|
register int i;
|
2002-07-11 14:18:02 +00:00
|
|
|
|
int count = SPECPDL_INDEX ();
|
1992-03-14 20:40:04 +00:00
|
|
|
|
|
|
|
|
|
buffer = args[1];
|
|
|
|
|
if (!NILP (buffer))
|
|
|
|
|
buffer = Fget_buffer_create (buffer);
|
|
|
|
|
|
1992-12-12 15:36:50 +00:00
|
|
|
|
/* Make sure that the child will be able to chdir to the current
|
|
|
|
|
buffer's current directory, or its unhandled equivalent. We
|
|
|
|
|
can't just have the child check for an error when it does the
|
|
|
|
|
chdir, since it's in a vfork.
|
|
|
|
|
|
|
|
|
|
We have to GCPRO around this because Fexpand_file_name and
|
|
|
|
|
Funhandled_file_name_directory might call a file name handling
|
|
|
|
|
function. The argument list is protected by the caller, so all
|
|
|
|
|
we really have to worry about is buffer. */
|
|
|
|
|
{
|
|
|
|
|
struct gcpro gcpro1, gcpro2;
|
|
|
|
|
|
|
|
|
|
current_dir = current_buffer->directory;
|
|
|
|
|
|
|
|
|
|
GCPRO2 (buffer, current_dir);
|
|
|
|
|
|
2008-02-06 03:16:10 +00:00
|
|
|
|
current_dir = Funhandled_file_name_directory (current_dir);
|
|
|
|
|
if (NILP (current_dir))
|
|
|
|
|
/* If the file name handler says that current_dir is unreachable, use
|
|
|
|
|
a sensible default. */
|
|
|
|
|
current_dir = build_string ("~/");
|
|
|
|
|
current_dir = expand_and_dir_to_file (current_dir, Qnil);
|
1992-12-12 15:36:50 +00:00
|
|
|
|
if (NILP (Ffile_accessible_directory_p (current_dir)))
|
|
|
|
|
report_file_error ("Setting current directory",
|
|
|
|
|
Fcons (current_buffer->directory, Qnil));
|
|
|
|
|
|
|
|
|
|
UNGCPRO;
|
|
|
|
|
}
|
|
|
|
|
|
1992-03-14 20:40:04 +00:00
|
|
|
|
name = args[0];
|
2001-11-02 20:46:55 +00:00
|
|
|
|
CHECK_STRING (name);
|
1992-03-14 20:40:04 +00:00
|
|
|
|
|
|
|
|
|
program = args[2];
|
|
|
|
|
|
2009-08-13 13:22:55 +00:00
|
|
|
|
if (!NILP (program))
|
|
|
|
|
CHECK_STRING (program);
|
1992-03-14 20:40:04 +00:00
|
|
|
|
|
|
|
|
|
proc = make_process (name);
|
* systty.h, process.c, buffer.h, callproc.c, sysdep.c, dired.c:
Added VMS changes from Roland Roberts.
* process.c (read_process_output): Save, widen, insert the process
output, and then restore the restriction if inserting text outside
the visible region.
* process.c (Fstart_process): Establish an unwind-protect to
remove PROC from the process list if an error occurs while
starting it.
(start_process_unwind): New function to help with that.
(create_process): There's no need to explicitly call
remove_process if the fork fails; the record_unwind_protect in
Fstart_process will take care of it.
* process.c (wait_reading_process_input): Test the C preprocessor
symbol "ultrix", not "__ultrix__" to see if we should ignore
ENOMEM errors from select.
* process.c (process_send_signal): On systems which have both
the TIOCGETC and TCGETA ioctls, just use the former.
* s/bsd4-2.h, s/bsd4-3.h: #define SIGNALS_VIA_CHARACTERS.
* process.c (process_send_signal): Put all the code for sending
signals via characters in a #ifdef SIGNALS_VIA_CHARACTERS. Decide
whether to use the Berkeley-style or SYSV-style ioctls by seeing
which ioctl commands are #defined.
* process.c (process_send_signal): Doc fix.
1992-11-16 00:53:26 +00:00
|
|
|
|
/* If an error occurs and we can't start the process, we want to
|
|
|
|
|
remove it from the process list. This means that each error
|
|
|
|
|
check in create_process doesn't need to call remove_process
|
|
|
|
|
itself; it's all taken care of here. */
|
|
|
|
|
record_unwind_protect (start_process_unwind, proc);
|
1992-03-14 20:40:04 +00:00
|
|
|
|
|
|
|
|
|
XPROCESS (proc)->childp = Qt;
|
2003-01-14 09:55:50 +00:00
|
|
|
|
XPROCESS (proc)->plist = Qnil;
|
Daniel Engeler <engeler at gmail.com>
These changes add serial port access.
* process.c: Add HAVE_SERIAL.
(Fdelete_process, Fprocess_status, Fset_process_buffer)
(Fset_process_filter, Fset_process_sentinel, Fprocess_contact)
(list_processes_1, select_wrapper, Fstop_process)
(Fcontinue_process, Fprocess_send_eof, kill_buffer_processes)
(status_notify): Modify to handle serial processes.
[HAVE_SERIAL] (Fserial_process_configure)
[HAVE_SERIAL] (make_serial_process_unwind, Fmake_serial_process):
New functions.
* process.h (struct Lisp_Process): Add `type'.
* sysdep.c [HAVE_TERMIOS] (serial_open, serial_configure):
New functions.
* w32.c (_sys_read_ahead, sys_read, sys_write): Modify to handle serial ports.
(serial_open, serial_configure) New functions.
* w32.h: Add FILE_SERIAL.
(struct _child_process): Add ovl_read, ovl_write.
2008-06-13 08:08:20 +00:00
|
|
|
|
XPROCESS (proc)->type = Qreal;
|
1992-03-14 20:40:04 +00:00
|
|
|
|
XPROCESS (proc)->buffer = buffer;
|
|
|
|
|
XPROCESS (proc)->sentinel = Qnil;
|
|
|
|
|
XPROCESS (proc)->filter = Qnil;
|
|
|
|
|
XPROCESS (proc)->command = Flist (nargs - 2, args + 2);
|
|
|
|
|
|
2004-04-16 12:51:06 +00:00
|
|
|
|
#ifdef ADAPTIVE_READ_BUFFERING
|
(struct Lisp_Process): Turn slots infd, outfd, kill_without_query, pty_flag,
tick, update_tick, decoding_carryover, inherit_coding_system_flag,
filter_multibyte, adaptive_read_buffering, read_output_delay, and
read_output_skip from Lisp_Objects to ints. Remove unused
encoding_carryover.
2007-07-12 06:36:57 +00:00
|
|
|
|
XPROCESS (proc)->adaptive_read_buffering
|
|
|
|
|
= (NILP (Vprocess_adaptive_read_buffering) ? 0
|
|
|
|
|
: EQ (Vprocess_adaptive_read_buffering, Qt) ? 1 : 2);
|
2004-04-16 12:51:06 +00:00
|
|
|
|
#endif
|
|
|
|
|
|
1995-02-14 14:23:49 +00:00
|
|
|
|
/* Make the process marker point into the process buffer (if any). */
|
2006-02-25 16:49:00 +00:00
|
|
|
|
if (BUFFERP (buffer))
|
1998-01-01 06:45:08 +00:00
|
|
|
|
set_marker_both (XPROCESS (proc)->mark, buffer,
|
|
|
|
|
BUF_ZV (XBUFFER (buffer)),
|
|
|
|
|
BUF_ZV_BYTE (XBUFFER (buffer)));
|
1995-02-14 14:23:49 +00:00
|
|
|
|
|
1998-05-10 19:21:05 +00:00
|
|
|
|
{
|
1998-06-26 03:29:15 +00:00
|
|
|
|
/* Decide coding systems for communicating with the process. Here
|
|
|
|
|
we don't setup the structure coding_system nor pay attention to
|
|
|
|
|
unibyte mode. They are done in create_process. */
|
|
|
|
|
|
1998-05-10 19:21:05 +00:00
|
|
|
|
/* Qt denotes we have not yet called Ffind_operation_coding_system. */
|
|
|
|
|
Lisp_Object coding_systems = Qt;
|
|
|
|
|
Lisp_Object val, *args2;
|
2000-05-20 00:04:37 +00:00
|
|
|
|
struct gcpro gcpro1, gcpro2;
|
1998-05-10 19:21:05 +00:00
|
|
|
|
|
1998-06-26 03:29:15 +00:00
|
|
|
|
val = Vcoding_system_for_read;
|
|
|
|
|
if (NILP (val))
|
1998-05-10 19:21:05 +00:00
|
|
|
|
{
|
|
|
|
|
args2 = (Lisp_Object *) alloca ((nargs + 1) * sizeof *args2);
|
|
|
|
|
args2[0] = Qstart_process;
|
|
|
|
|
for (i = 0; i < nargs; i++) args2[i + 1] = args[i];
|
2000-05-20 00:04:37 +00:00
|
|
|
|
GCPRO2 (proc, current_dir);
|
2009-08-13 13:22:55 +00:00
|
|
|
|
if (!NILP (program))
|
|
|
|
|
coding_systems = Ffind_operation_coding_system (nargs + 1, args2);
|
1998-05-10 19:21:05 +00:00
|
|
|
|
UNGCPRO;
|
|
|
|
|
if (CONSP (coding_systems))
|
1999-09-12 05:07:01 +00:00
|
|
|
|
val = XCAR (coding_systems);
|
1998-05-10 19:21:05 +00:00
|
|
|
|
else if (CONSP (Vdefault_process_coding_system))
|
1999-09-12 05:07:01 +00:00
|
|
|
|
val = XCAR (Vdefault_process_coding_system);
|
1998-05-10 19:21:05 +00:00
|
|
|
|
}
|
|
|
|
|
XPROCESS (proc)->decode_coding_system = val;
|
|
|
|
|
|
1998-06-26 03:29:15 +00:00
|
|
|
|
val = Vcoding_system_for_write;
|
|
|
|
|
if (NILP (val))
|
1998-05-10 19:21:05 +00:00
|
|
|
|
{
|
|
|
|
|
if (EQ (coding_systems, Qt))
|
|
|
|
|
{
|
|
|
|
|
args2 = (Lisp_Object *) alloca ((nargs + 1) * sizeof args2);
|
|
|
|
|
args2[0] = Qstart_process;
|
|
|
|
|
for (i = 0; i < nargs; i++) args2[i + 1] = args[i];
|
2000-05-20 00:04:37 +00:00
|
|
|
|
GCPRO2 (proc, current_dir);
|
2009-08-13 13:22:55 +00:00
|
|
|
|
if (!NILP (program))
|
|
|
|
|
coding_systems = Ffind_operation_coding_system (nargs + 1, args2);
|
1998-05-10 19:21:05 +00:00
|
|
|
|
UNGCPRO;
|
|
|
|
|
}
|
|
|
|
|
if (CONSP (coding_systems))
|
1999-09-12 05:07:01 +00:00
|
|
|
|
val = XCDR (coding_systems);
|
1998-05-10 19:21:05 +00:00
|
|
|
|
else if (CONSP (Vdefault_process_coding_system))
|
1999-09-12 05:07:01 +00:00
|
|
|
|
val = XCDR (Vdefault_process_coding_system);
|
1998-05-10 19:21:05 +00:00
|
|
|
|
}
|
|
|
|
|
XPROCESS (proc)->encode_coding_system = val;
|
|
|
|
|
}
|
1997-02-20 06:53:55 +00:00
|
|
|
|
|
2000-05-20 00:04:37 +00:00
|
|
|
|
|
2009-08-13 13:22:55 +00:00
|
|
|
|
XPROCESS (proc)->decoding_buf = make_uninit_string (0);
|
|
|
|
|
XPROCESS (proc)->decoding_carryover = 0;
|
|
|
|
|
XPROCESS (proc)->encoding_buf = make_uninit_string (0);
|
2002-08-24 03:16:03 +00:00
|
|
|
|
|
2009-08-13 13:22:55 +00:00
|
|
|
|
XPROCESS (proc)->inherit_coding_system_flag
|
|
|
|
|
= !(NILP (buffer) || !inherit_process_coding_system);
|
2009-04-28 19:02:26 +00:00
|
|
|
|
|
2009-08-13 13:22:55 +00:00
|
|
|
|
if (!NILP (program))
|
|
|
|
|
{
|
|
|
|
|
/* If program file name is not absolute, search our path for it.
|
|
|
|
|
Put the name we will really use in TEM. */
|
|
|
|
|
if (!IS_DIRECTORY_SEP (SREF (program, 0))
|
|
|
|
|
&& !(SCHARS (program) > 1
|
|
|
|
|
&& IS_DEVICE_SEP (SREF (program, 1))))
|
|
|
|
|
{
|
|
|
|
|
struct gcpro gcpro1, gcpro2, gcpro3, gcpro4;
|
|
|
|
|
|
|
|
|
|
tem = Qnil;
|
|
|
|
|
GCPRO4 (name, program, buffer, current_dir);
|
|
|
|
|
openp (Vexec_path, program, Vexec_suffixes, &tem, make_number (X_OK));
|
|
|
|
|
UNGCPRO;
|
|
|
|
|
if (NILP (tem))
|
|
|
|
|
report_file_error ("Searching for program", Fcons (program, Qnil));
|
|
|
|
|
tem = Fexpand_file_name (tem, Qnil);
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
if (!NILP (Ffile_directory_p (program)))
|
|
|
|
|
error ("Specified program for new process is a directory");
|
|
|
|
|
tem = program;
|
|
|
|
|
}
|
2002-08-24 03:16:03 +00:00
|
|
|
|
|
2009-08-13 13:22:55 +00:00
|
|
|
|
/* If program file name starts with /: for quoting a magic name,
|
|
|
|
|
discard that. */
|
|
|
|
|
if (SBYTES (tem) > 2 && SREF (tem, 0) == '/'
|
|
|
|
|
&& SREF (tem, 1) == ':')
|
|
|
|
|
tem = Fsubstring (tem, make_number (2), Qnil);
|
2009-04-28 19:02:26 +00:00
|
|
|
|
|
|
|
|
|
{
|
2009-08-13 13:22:55 +00:00
|
|
|
|
struct gcpro gcpro1;
|
|
|
|
|
GCPRO1 (tem);
|
2000-05-20 00:04:37 +00:00
|
|
|
|
|
2009-08-13 13:22:55 +00:00
|
|
|
|
/* Encode the file name and put it in NEW_ARGV.
|
|
|
|
|
That's where the child will use it to execute the program. */
|
|
|
|
|
tem = Fcons (ENCODE_FILE (tem), Qnil);
|
2009-04-28 19:02:26 +00:00
|
|
|
|
|
2009-08-13 13:22:55 +00:00
|
|
|
|
/* Here we encode arguments by the coding system used for sending
|
|
|
|
|
data to the process. We don't support using different coding
|
|
|
|
|
systems for encoding arguments and for encoding data sent to the
|
|
|
|
|
process. */
|
2009-04-28 19:02:26 +00:00
|
|
|
|
|
2009-08-13 13:22:55 +00:00
|
|
|
|
for (i = 3; i < nargs; i++)
|
|
|
|
|
{
|
|
|
|
|
tem = Fcons (args[i], tem);
|
|
|
|
|
CHECK_STRING (XCAR (tem));
|
|
|
|
|
if (STRING_MULTIBYTE (XCAR (tem)))
|
|
|
|
|
XSETCAR (tem,
|
|
|
|
|
code_convert_string_norecord
|
|
|
|
|
(XCAR (tem), XPROCESS (proc)->encode_coding_system, 1));
|
|
|
|
|
}
|
2000-05-20 00:04:37 +00:00
|
|
|
|
|
2009-08-13 13:22:55 +00:00
|
|
|
|
UNGCPRO;
|
|
|
|
|
}
|
1997-02-20 06:53:55 +00:00
|
|
|
|
|
2009-08-13 13:22:55 +00:00
|
|
|
|
/* Now that everything is encoded we can collect the strings into
|
|
|
|
|
NEW_ARGV. */
|
|
|
|
|
new_argv = (unsigned char **) alloca ((nargs - 1) * sizeof (char *));
|
|
|
|
|
new_argv[nargs - 2] = 0;
|
1998-04-19 14:13:47 +00:00
|
|
|
|
|
2009-08-13 13:22:55 +00:00
|
|
|
|
for (i = nargs - 3; i >= 0; i--)
|
|
|
|
|
{
|
|
|
|
|
new_argv[i] = SDATA (XCAR (tem));
|
|
|
|
|
tem = XCDR (tem);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
create_process (proc, (char **) new_argv, current_dir);
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
create_pty (proc);
|
1992-03-14 20:40:04 +00:00
|
|
|
|
|
* systty.h, process.c, buffer.h, callproc.c, sysdep.c, dired.c:
Added VMS changes from Roland Roberts.
* process.c (read_process_output): Save, widen, insert the process
output, and then restore the restriction if inserting text outside
the visible region.
* process.c (Fstart_process): Establish an unwind-protect to
remove PROC from the process list if an error occurs while
starting it.
(start_process_unwind): New function to help with that.
(create_process): There's no need to explicitly call
remove_process if the fork fails; the record_unwind_protect in
Fstart_process will take care of it.
* process.c (wait_reading_process_input): Test the C preprocessor
symbol "ultrix", not "__ultrix__" to see if we should ignore
ENOMEM errors from select.
* process.c (process_send_signal): On systems which have both
the TIOCGETC and TCGETA ioctls, just use the former.
* s/bsd4-2.h, s/bsd4-3.h: #define SIGNALS_VIA_CHARACTERS.
* process.c (process_send_signal): Put all the code for sending
signals via characters in a #ifdef SIGNALS_VIA_CHARACTERS. Decide
whether to use the Berkeley-style or SYSV-style ioctls by seeing
which ioctl commands are #defined.
* process.c (process_send_signal): Doc fix.
1992-11-16 00:53:26 +00:00
|
|
|
|
return unbind_to (count, proc);
|
1992-03-14 20:40:04 +00:00
|
|
|
|
}
|
|
|
|
|
|
* systty.h, process.c, buffer.h, callproc.c, sysdep.c, dired.c:
Added VMS changes from Roland Roberts.
* process.c (read_process_output): Save, widen, insert the process
output, and then restore the restriction if inserting text outside
the visible region.
* process.c (Fstart_process): Establish an unwind-protect to
remove PROC from the process list if an error occurs while
starting it.
(start_process_unwind): New function to help with that.
(create_process): There's no need to explicitly call
remove_process if the fork fails; the record_unwind_protect in
Fstart_process will take care of it.
* process.c (wait_reading_process_input): Test the C preprocessor
symbol "ultrix", not "__ultrix__" to see if we should ignore
ENOMEM errors from select.
* process.c (process_send_signal): On systems which have both
the TIOCGETC and TCGETA ioctls, just use the former.
* s/bsd4-2.h, s/bsd4-3.h: #define SIGNALS_VIA_CHARACTERS.
* process.c (process_send_signal): Put all the code for sending
signals via characters in a #ifdef SIGNALS_VIA_CHARACTERS. Decide
whether to use the Berkeley-style or SYSV-style ioctls by seeing
which ioctl commands are #defined.
* process.c (process_send_signal): Doc fix.
1992-11-16 00:53:26 +00:00
|
|
|
|
/* This function is the unwind_protect form for Fstart_process. If
|
1996-01-05 10:03:17 +00:00
|
|
|
|
PROC doesn't have its pid set, then we know someone has signaled
|
* systty.h, process.c, buffer.h, callproc.c, sysdep.c, dired.c:
Added VMS changes from Roland Roberts.
* process.c (read_process_output): Save, widen, insert the process
output, and then restore the restriction if inserting text outside
the visible region.
* process.c (Fstart_process): Establish an unwind-protect to
remove PROC from the process list if an error occurs while
starting it.
(start_process_unwind): New function to help with that.
(create_process): There's no need to explicitly call
remove_process if the fork fails; the record_unwind_protect in
Fstart_process will take care of it.
* process.c (wait_reading_process_input): Test the C preprocessor
symbol "ultrix", not "__ultrix__" to see if we should ignore
ENOMEM errors from select.
* process.c (process_send_signal): On systems which have both
the TIOCGETC and TCGETA ioctls, just use the former.
* s/bsd4-2.h, s/bsd4-3.h: #define SIGNALS_VIA_CHARACTERS.
* process.c (process_send_signal): Put all the code for sending
signals via characters in a #ifdef SIGNALS_VIA_CHARACTERS. Decide
whether to use the Berkeley-style or SYSV-style ioctls by seeing
which ioctl commands are #defined.
* process.c (process_send_signal): Doc fix.
1992-11-16 00:53:26 +00:00
|
|
|
|
an error and the process wasn't started successfully, so we should
|
|
|
|
|
remove it from the process list. */
|
|
|
|
|
static Lisp_Object
|
2010-07-05 12:36:06 +02:00
|
|
|
|
start_process_unwind (Lisp_Object proc)
|
* systty.h, process.c, buffer.h, callproc.c, sysdep.c, dired.c:
Added VMS changes from Roland Roberts.
* process.c (read_process_output): Save, widen, insert the process
output, and then restore the restriction if inserting text outside
the visible region.
* process.c (Fstart_process): Establish an unwind-protect to
remove PROC from the process list if an error occurs while
starting it.
(start_process_unwind): New function to help with that.
(create_process): There's no need to explicitly call
remove_process if the fork fails; the record_unwind_protect in
Fstart_process will take care of it.
* process.c (wait_reading_process_input): Test the C preprocessor
symbol "ultrix", not "__ultrix__" to see if we should ignore
ENOMEM errors from select.
* process.c (process_send_signal): On systems which have both
the TIOCGETC and TCGETA ioctls, just use the former.
* s/bsd4-2.h, s/bsd4-3.h: #define SIGNALS_VIA_CHARACTERS.
* process.c (process_send_signal): Put all the code for sending
signals via characters in a #ifdef SIGNALS_VIA_CHARACTERS. Decide
whether to use the Berkeley-style or SYSV-style ioctls by seeing
which ioctl commands are #defined.
* process.c (process_send_signal): Doc fix.
1992-11-16 00:53:26 +00:00
|
|
|
|
{
|
(decode_status, Fprocessp, Fget_process, Fget_buffer_process, Fprocess_status,
Fprocess_exit_status, list_processes_1, Fstart_process, Fopen_network_stream,
Faccept_process_output, wait_reading_process_input, sigchld_handler,
status_notify): Use type test macros.
1994-09-27 01:53:42 +00:00
|
|
|
|
if (!PROCESSP (proc))
|
* systty.h, process.c, buffer.h, callproc.c, sysdep.c, dired.c:
Added VMS changes from Roland Roberts.
* process.c (read_process_output): Save, widen, insert the process
output, and then restore the restriction if inserting text outside
the visible region.
* process.c (Fstart_process): Establish an unwind-protect to
remove PROC from the process list if an error occurs while
starting it.
(start_process_unwind): New function to help with that.
(create_process): There's no need to explicitly call
remove_process if the fork fails; the record_unwind_protect in
Fstart_process will take care of it.
* process.c (wait_reading_process_input): Test the C preprocessor
symbol "ultrix", not "__ultrix__" to see if we should ignore
ENOMEM errors from select.
* process.c (process_send_signal): On systems which have both
the TIOCGETC and TCGETA ioctls, just use the former.
* s/bsd4-2.h, s/bsd4-3.h: #define SIGNALS_VIA_CHARACTERS.
* process.c (process_send_signal): Put all the code for sending
signals via characters in a #ifdef SIGNALS_VIA_CHARACTERS. Decide
whether to use the Berkeley-style or SYSV-style ioctls by seeing
which ioctl commands are #defined.
* process.c (process_send_signal): Doc fix.
1992-11-16 00:53:26 +00:00
|
|
|
|
abort ();
|
|
|
|
|
|
|
|
|
|
/* Was PROC started successfully? */
|
2009-08-13 13:22:55 +00:00
|
|
|
|
if (XPROCESS (proc)->pid == -1)
|
* systty.h, process.c, buffer.h, callproc.c, sysdep.c, dired.c:
Added VMS changes from Roland Roberts.
* process.c (read_process_output): Save, widen, insert the process
output, and then restore the restriction if inserting text outside
the visible region.
* process.c (Fstart_process): Establish an unwind-protect to
remove PROC from the process list if an error occurs while
starting it.
(start_process_unwind): New function to help with that.
(create_process): There's no need to explicitly call
remove_process if the fork fails; the record_unwind_protect in
Fstart_process will take care of it.
* process.c (wait_reading_process_input): Test the C preprocessor
symbol "ultrix", not "__ultrix__" to see if we should ignore
ENOMEM errors from select.
* process.c (process_send_signal): On systems which have both
the TIOCGETC and TCGETA ioctls, just use the former.
* s/bsd4-2.h, s/bsd4-3.h: #define SIGNALS_VIA_CHARACTERS.
* process.c (process_send_signal): Put all the code for sending
signals via characters in a #ifdef SIGNALS_VIA_CHARACTERS. Decide
whether to use the Berkeley-style or SYSV-style ioctls by seeing
which ioctl commands are #defined.
* process.c (process_send_signal): Doc fix.
1992-11-16 00:53:26 +00:00
|
|
|
|
remove_process (proc);
|
|
|
|
|
|
|
|
|
|
return Qnil;
|
|
|
|
|
}
|
|
|
|
|
|
(deactivate_process, status_notify, read_process_output)
(update_status, status_convert, decode_status, allocate_pty)
(make_process, remove_process, list_processes_1)
(create_process_1, unwind_request_sigio, read_process_output)
(send_process, keyboard_bit_set): Declare static.
(Fdelete_process): Simplify. Pass process to status_notify, so we
don't try to read output from it.
(status_notify): New arg deleting_process--don't try to read
output from that process.
2005-08-15 08:44:53 +00:00
|
|
|
|
static void
|
2010-07-05 12:36:06 +02:00
|
|
|
|
create_process_1 (struct atimer *timer)
|
1992-03-14 20:40:04 +00:00
|
|
|
|
{
|
2000-01-25 15:56:42 +00:00
|
|
|
|
/* Nothing to do. */
|
1992-03-14 20:40:04 +00:00
|
|
|
|
}
|
|
|
|
|
|
2000-01-25 15:56:42 +00:00
|
|
|
|
|
1997-11-28 14:53:09 +00:00
|
|
|
|
void
|
2010-07-05 12:36:06 +02:00
|
|
|
|
create_process (Lisp_Object process, char **new_argv, Lisp_Object current_dir)
|
1992-03-14 20:40:04 +00:00
|
|
|
|
{
|
2007-03-17 18:24:46 +00:00
|
|
|
|
int inchannel, outchannel;
|
|
|
|
|
pid_t pid;
|
1992-03-14 20:40:04 +00:00
|
|
|
|
int sv[2];
|
2008-07-17 09:06:58 +00:00
|
|
|
|
#if !defined (WINDOWSNT) && defined (FD_CLOEXEC)
|
|
|
|
|
int wait_child_setup[2];
|
|
|
|
|
#endif
|
1995-12-13 01:52:07 +00:00
|
|
|
|
sigset_t procmask;
|
|
|
|
|
sigset_t blocked;
|
|
|
|
|
struct sigaction sigint_action;
|
|
|
|
|
struct sigaction sigquit_action;
|
|
|
|
|
#ifdef AIX
|
|
|
|
|
struct sigaction sighup_action;
|
|
|
|
|
#endif
|
1995-05-26 03:21:30 +00:00
|
|
|
|
/* Use volatile to protect variables from being clobbered by longjmp. */
|
|
|
|
|
volatile int forkin, forkout;
|
|
|
|
|
volatile int pty_flag = 0;
|
2000-08-22 22:36:52 +00:00
|
|
|
|
#ifndef USE_CRT_DLL
|
1992-03-14 20:40:04 +00:00
|
|
|
|
extern char **environ;
|
2000-08-22 22:36:52 +00:00
|
|
|
|
#endif
|
1992-03-14 20:40:04 +00:00
|
|
|
|
|
|
|
|
|
inchannel = outchannel = -1;
|
|
|
|
|
|
|
|
|
|
#ifdef HAVE_PTYS
|
1994-05-30 10:19:16 +00:00
|
|
|
|
if (!NILP (Vprocess_connection_type))
|
1992-03-14 20:40:04 +00:00
|
|
|
|
outchannel = inchannel = allocate_pty ();
|
|
|
|
|
|
|
|
|
|
if (inchannel >= 0)
|
|
|
|
|
{
|
2002-07-16 13:41:16 +00:00
|
|
|
|
#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. */
|
1992-03-14 20:40:04 +00:00
|
|
|
|
#ifdef O_NOCTTY
|
|
|
|
|
/* Don't let this terminal become our controlling terminal
|
|
|
|
|
(in case we don't have one). */
|
Add support for large files, 64-bit Solaris, system locale codings.
* Makefile.in (emacs): Set the LC_ALL environment variable to "C"
when dumping, so that the dumped Emacs doesn't have stray locale info.
(dired.o): Depend on systime.h.
(editfns.o): Depend on coding.h.
* alloc.c, buffer.c, callproc.c, ccl.c, charset.c, coding.c, data.c,
dispnew.c, editfns.c, emacs.c, filelock.c, floatfns.c, hftctl.c,
keyboard.c, process.c, sysdep.c, unexelf.c, unexhp9k800.c,
unexsunos4.c, vmsfns.c, vmsgmalloc.c, w32faces.c, w32menu.c, w32term.c,
w32xfns.c, xfaces.c, xfns.c, xmenu.c, xterm.c:
Include <config.h> before any system include files.
* alloc.c, buffer.c, ccl.c, data.c, editfns.c, emacs.c, eval.c,
fileio.c, filelock.c, frame.c, insdel.c, keymap.c, lread.c,
m/alpha.h, print.c, search.c, sysdep.c, xdisp.c, xfaces.c, xfns.c,
xmenu.c, xterm.c:
Do not include <stdlib.h>, as <config.h> does this now.
* callproc.c (Fcall_process):
Synchronize messages locale before invoking strerror.
Decode resulting string with locale-coding-system.
* coding.c (Vlocale_coding_system): New var.
(syms_of_coding): Adjust to above change.
(emacs_strerror): New function.
* coding.h (emacs_strerror, Vlocale_coding_system): New decls.
* config.in (HAVE_STDIO_EXT_H, HAVE_TM_GMTOFF, HAVE___FPENDING,
HAVE_FTELLO, HAVE_GETLOADAVG, HAVE_MBLEN, HAVE_MBRLEN,
HAVE_STRSIGNAL): New macros.
(BITS_PER_LONG): Default to 64 if _LP64 is defined.
<stdlib.h>: Include if HAVE_STDLIB_H is defined and NOT_C_CODE isn't.
* dired.c: Include "systime.h".
(Ffile_attributes): Do not cast s.st_size to int; this loses
information if int is 32 bits but st_size and EMACS_INT are larger.
Treat large device numbers like large inode numbers.
* dispnew.c (PENDING_OUTPUT_COUNT): Use __fpending if available.
* editfns.c: Include coding.h.
(emacs_strftime): Remove decl.
(emacs_strftimeu): New decl.
(emacs_memftimeu): Renamed from emacs_memftime; new arg UT.
Use emacs_strftimeu instead of emacs_strftime.
(Fformat_time_string): Convert format string using
Vlocale_coding_system, and convert result back. Synchronize time
locale before invoking lower level function. Invoke
emacs_memftimeu, passing ut, instead of emacs_memftime.
* emacs.c: Include <locale.h> if HAVE_SETLOCALE is defined.
(Vmessages_locale, Vprevious_messages_locale, Vtime_locale,
Vprevious_time_locale): New variables.
(main): Invoke setlocale early, so that initial error messages are
localized properly. But skip locale-setting if LC_ALL is "C".
Fix up locale when it's safe to do so.
(fixup_locale): Moved here from xterm.c.
(synchronize_locale, synchronize_time_locale,
synchronize_messages_locale): New functions.
(syms_of_emacs): Accommodate above changes.
* fileio.c (report_file_error): Convert strerror output according
to Vlocale_coding_system.
(Finsert_file_contents): Check for arithmetic overflow in
computations that depend on file size. Report IO errors
with emacs_strerror, not strerror.
* fns.c (Fgethash): Declare dflt parameter.
* gmalloc.c: Do not define const to nothing if HAVE_CONFIG_H
is defined; that's config.h's job.
* lisp.h (EMACS_INT, BITS_PER_EMACS_INT, EMACS_UINT): If _LP64,
default these values to long, BITS_PER_LONG, and unsigned long.
(VALBITS, MARKBIT, XINT): Do not assume 32-bit EMACS_INT.
(PNTR_COMPARISON_TYPE): Default to EMACS_UINT, not to unsigned int.
(code_convert_string_norecord, fixup_locale,
synchronize_messages_locale, synchronize_time_locale,
emacs_open, emacs_close, emacs_read, emacs_write): New decls.
All Emacs callers of open, close, read, write changed to use
emacs_open, emacs_close, emacs_read, emacs_write.
* lread.c (file_offset, file_tell): New macros. All uses of ftell
changed to file_tell.
(saved_doc_string_position, prev_saved_doc_string_position): Now
of type file_offset.
(init_lread): Do not fix locale here; fixup_locale now does this.
* m/amdahl.h, s/usg5-4.h:
(NSIG): Remove.
(NSIG_MINIMUM): New macro.
* m/cydra5.h, m/dpx2.h, m/mips.h, m/pfa50.h, m/sps7.h, m/stride.h,
m/ustation.h, s/gnu-linux.h, s/hpux.h, s/iris3-5.h, s/iris3-6.h,
s/umips.h, s/usg5-4.h:
(SIGIO): Do not undef.
(BROKEN_SIGIO): New macro.
* m/ustation.h:
(SIGTSTP): Do not undef.
(BROKEN_SIGTSTP): New macro.
* s/gnu-linux.h:
(SIGPOLL, SIGURG): Do not undef.
(BROKEN_SIGPOLL, BROKEN_SIGURG): New macros.
* s/ptx4.h:
(SIGINFO): Do not undef.
(BROKEN_SIGINFO): New macros.
* m/delta.h, s/ptx.h, s/template.h: Doc fix.
* mktime.c, strftime.c: Update to glibc 2.1.2 version, with
some Emacs-related changes merged.
* print.c (float_to_string): Prepend "-" to representation of a
NaN if the NaN is negative.
* process.c (sys_siglist): Omit if HAVE_STRSIGNAL.
(wait_reading_process_input): Use emacs_strerror, not strerror.
* process.c (status_message, sigchld_handler): Synchronize locale,
then use strsignal istead of sys_siglist.
* w32proc.c (sys_wait): Likewise.
* s/aix3-1.h, s/bsd4-1.h, s/dgux.h, s/gnu-linux.h, s/hiuxmpp.h,
s/hpux.h, s/iris3-5.h, s/iris3-6.h, s/irix3-3.h, s/osf1.h, s/rtu.h,
s/sunos4-1.h, s/unipl5-0.h, s/unipl5-2.h, s/usg5-0.h, s/usg5-2-2.h,
s/usg5-2.h, s/usg5-3.h, s/xenix.h:
(open, close, read, write, INTERRUPTIBLE_OPEN,
INTERRUPTIBLE_CLOSE, INTERRUPTIBLE_IO): Remove.
* s/sol2-5.h (_LARGEFILE_SOURCE, _FILE_OFFSET_BITS): New macros.
* sysdep.c (sys_read, sys_write, read, write, sys_close, close,
sys_open, open): Remove.
(emacs_open, emacs_close, emacs_read, emacs_write): Always define;
the old INTERRUPTIBLE_OPEN, INTERRUPTIBLE_CLOSE, and INTERRUPTIBLE_IO
macros are no longer used.
(emacs_open): Renamed from sys_open. Merge BSD4_1 version.
(emacs_close): Renamed from sys_close.
(emacs_read): Renamed from sys_read.
(emacs_write): Renamed from sys_write.
(sys_siglist): Do not declare if HAVE_STRSIGNAL.
(dup2): Do not print error on failure; the real dup2 doesn't.
(strsignal): New function, defined if !HAVE_STRSIGNAL.
* syssignal.h (SIGINFO): Undef if defined and if BROKEN_SIGINFO
is defined.
(SIGIO, SIGPOLL, SIGTSTP, SIGURG): Likewise.
(NSIG): If less than NSIG_MINIMUM, define to NSIG_MINIMUM.
(strsignal): Declare if !HAVE_STRSIGNAL.
* unexelf.c (ElfBitsW, ELFSIZE, ElfExpandBitsW): New macros.
(ElfW): Define in terms of ElfExpandBitsW.
* w32proc.c (sys_siglist): Remove decl.
* xdisp.c (decode_mode_spec): 3rd arg is int, not char, to comply
with ANSI C.
(display_string): Declare face_string_pos arg.
* xfns.c (Fx_show_tip): Declare timeout param.
* xterm.c: No need to include locale.h.
(x_alloc_lighter_color, x_setup_relief_color):
Pass arg as double, not float, for compatibility with ANSI C.
(fixup_locale): Move to emacs.c.
(x_term_init): Do not setlocale or fixup locale; the main program
does this now.
1999-10-19 07:25:11 +00:00
|
|
|
|
forkout = forkin = emacs_open (pty_name, O_RDWR | O_NOCTTY, 0);
|
1992-03-14 20:40:04 +00:00
|
|
|
|
#else
|
Add support for large files, 64-bit Solaris, system locale codings.
* Makefile.in (emacs): Set the LC_ALL environment variable to "C"
when dumping, so that the dumped Emacs doesn't have stray locale info.
(dired.o): Depend on systime.h.
(editfns.o): Depend on coding.h.
* alloc.c, buffer.c, callproc.c, ccl.c, charset.c, coding.c, data.c,
dispnew.c, editfns.c, emacs.c, filelock.c, floatfns.c, hftctl.c,
keyboard.c, process.c, sysdep.c, unexelf.c, unexhp9k800.c,
unexsunos4.c, vmsfns.c, vmsgmalloc.c, w32faces.c, w32menu.c, w32term.c,
w32xfns.c, xfaces.c, xfns.c, xmenu.c, xterm.c:
Include <config.h> before any system include files.
* alloc.c, buffer.c, ccl.c, data.c, editfns.c, emacs.c, eval.c,
fileio.c, filelock.c, frame.c, insdel.c, keymap.c, lread.c,
m/alpha.h, print.c, search.c, sysdep.c, xdisp.c, xfaces.c, xfns.c,
xmenu.c, xterm.c:
Do not include <stdlib.h>, as <config.h> does this now.
* callproc.c (Fcall_process):
Synchronize messages locale before invoking strerror.
Decode resulting string with locale-coding-system.
* coding.c (Vlocale_coding_system): New var.
(syms_of_coding): Adjust to above change.
(emacs_strerror): New function.
* coding.h (emacs_strerror, Vlocale_coding_system): New decls.
* config.in (HAVE_STDIO_EXT_H, HAVE_TM_GMTOFF, HAVE___FPENDING,
HAVE_FTELLO, HAVE_GETLOADAVG, HAVE_MBLEN, HAVE_MBRLEN,
HAVE_STRSIGNAL): New macros.
(BITS_PER_LONG): Default to 64 if _LP64 is defined.
<stdlib.h>: Include if HAVE_STDLIB_H is defined and NOT_C_CODE isn't.
* dired.c: Include "systime.h".
(Ffile_attributes): Do not cast s.st_size to int; this loses
information if int is 32 bits but st_size and EMACS_INT are larger.
Treat large device numbers like large inode numbers.
* dispnew.c (PENDING_OUTPUT_COUNT): Use __fpending if available.
* editfns.c: Include coding.h.
(emacs_strftime): Remove decl.
(emacs_strftimeu): New decl.
(emacs_memftimeu): Renamed from emacs_memftime; new arg UT.
Use emacs_strftimeu instead of emacs_strftime.
(Fformat_time_string): Convert format string using
Vlocale_coding_system, and convert result back. Synchronize time
locale before invoking lower level function. Invoke
emacs_memftimeu, passing ut, instead of emacs_memftime.
* emacs.c: Include <locale.h> if HAVE_SETLOCALE is defined.
(Vmessages_locale, Vprevious_messages_locale, Vtime_locale,
Vprevious_time_locale): New variables.
(main): Invoke setlocale early, so that initial error messages are
localized properly. But skip locale-setting if LC_ALL is "C".
Fix up locale when it's safe to do so.
(fixup_locale): Moved here from xterm.c.
(synchronize_locale, synchronize_time_locale,
synchronize_messages_locale): New functions.
(syms_of_emacs): Accommodate above changes.
* fileio.c (report_file_error): Convert strerror output according
to Vlocale_coding_system.
(Finsert_file_contents): Check for arithmetic overflow in
computations that depend on file size. Report IO errors
with emacs_strerror, not strerror.
* fns.c (Fgethash): Declare dflt parameter.
* gmalloc.c: Do not define const to nothing if HAVE_CONFIG_H
is defined; that's config.h's job.
* lisp.h (EMACS_INT, BITS_PER_EMACS_INT, EMACS_UINT): If _LP64,
default these values to long, BITS_PER_LONG, and unsigned long.
(VALBITS, MARKBIT, XINT): Do not assume 32-bit EMACS_INT.
(PNTR_COMPARISON_TYPE): Default to EMACS_UINT, not to unsigned int.
(code_convert_string_norecord, fixup_locale,
synchronize_messages_locale, synchronize_time_locale,
emacs_open, emacs_close, emacs_read, emacs_write): New decls.
All Emacs callers of open, close, read, write changed to use
emacs_open, emacs_close, emacs_read, emacs_write.
* lread.c (file_offset, file_tell): New macros. All uses of ftell
changed to file_tell.
(saved_doc_string_position, prev_saved_doc_string_position): Now
of type file_offset.
(init_lread): Do not fix locale here; fixup_locale now does this.
* m/amdahl.h, s/usg5-4.h:
(NSIG): Remove.
(NSIG_MINIMUM): New macro.
* m/cydra5.h, m/dpx2.h, m/mips.h, m/pfa50.h, m/sps7.h, m/stride.h,
m/ustation.h, s/gnu-linux.h, s/hpux.h, s/iris3-5.h, s/iris3-6.h,
s/umips.h, s/usg5-4.h:
(SIGIO): Do not undef.
(BROKEN_SIGIO): New macro.
* m/ustation.h:
(SIGTSTP): Do not undef.
(BROKEN_SIGTSTP): New macro.
* s/gnu-linux.h:
(SIGPOLL, SIGURG): Do not undef.
(BROKEN_SIGPOLL, BROKEN_SIGURG): New macros.
* s/ptx4.h:
(SIGINFO): Do not undef.
(BROKEN_SIGINFO): New macros.
* m/delta.h, s/ptx.h, s/template.h: Doc fix.
* mktime.c, strftime.c: Update to glibc 2.1.2 version, with
some Emacs-related changes merged.
* print.c (float_to_string): Prepend "-" to representation of a
NaN if the NaN is negative.
* process.c (sys_siglist): Omit if HAVE_STRSIGNAL.
(wait_reading_process_input): Use emacs_strerror, not strerror.
* process.c (status_message, sigchld_handler): Synchronize locale,
then use strsignal istead of sys_siglist.
* w32proc.c (sys_wait): Likewise.
* s/aix3-1.h, s/bsd4-1.h, s/dgux.h, s/gnu-linux.h, s/hiuxmpp.h,
s/hpux.h, s/iris3-5.h, s/iris3-6.h, s/irix3-3.h, s/osf1.h, s/rtu.h,
s/sunos4-1.h, s/unipl5-0.h, s/unipl5-2.h, s/usg5-0.h, s/usg5-2-2.h,
s/usg5-2.h, s/usg5-3.h, s/xenix.h:
(open, close, read, write, INTERRUPTIBLE_OPEN,
INTERRUPTIBLE_CLOSE, INTERRUPTIBLE_IO): Remove.
* s/sol2-5.h (_LARGEFILE_SOURCE, _FILE_OFFSET_BITS): New macros.
* sysdep.c (sys_read, sys_write, read, write, sys_close, close,
sys_open, open): Remove.
(emacs_open, emacs_close, emacs_read, emacs_write): Always define;
the old INTERRUPTIBLE_OPEN, INTERRUPTIBLE_CLOSE, and INTERRUPTIBLE_IO
macros are no longer used.
(emacs_open): Renamed from sys_open. Merge BSD4_1 version.
(emacs_close): Renamed from sys_close.
(emacs_read): Renamed from sys_read.
(emacs_write): Renamed from sys_write.
(sys_siglist): Do not declare if HAVE_STRSIGNAL.
(dup2): Do not print error on failure; the real dup2 doesn't.
(strsignal): New function, defined if !HAVE_STRSIGNAL.
* syssignal.h (SIGINFO): Undef if defined and if BROKEN_SIGINFO
is defined.
(SIGIO, SIGPOLL, SIGTSTP, SIGURG): Likewise.
(NSIG): If less than NSIG_MINIMUM, define to NSIG_MINIMUM.
(strsignal): Declare if !HAVE_STRSIGNAL.
* unexelf.c (ElfBitsW, ELFSIZE, ElfExpandBitsW): New macros.
(ElfW): Define in terms of ElfExpandBitsW.
* w32proc.c (sys_siglist): Remove decl.
* xdisp.c (decode_mode_spec): 3rd arg is int, not char, to comply
with ANSI C.
(display_string): Declare face_string_pos arg.
* xfns.c (Fx_show_tip): Declare timeout param.
* xterm.c: No need to include locale.h.
(x_alloc_lighter_color, x_setup_relief_color):
Pass arg as double, not float, for compatibility with ANSI C.
(fixup_locale): Move to emacs.c.
(x_term_init): Do not setlocale or fixup locale; the main program
does this now.
1999-10-19 07:25:11 +00:00
|
|
|
|
forkout = forkin = emacs_open (pty_name, O_RDWR, 0);
|
1992-03-14 20:40:04 +00:00
|
|
|
|
#endif
|
|
|
|
|
if (forkin < 0)
|
|
|
|
|
report_file_error ("Opening pty", Qnil);
|
|
|
|
|
#else
|
|
|
|
|
forkin = forkout = -1;
|
2002-07-16 13:41:16 +00:00
|
|
|
|
#endif /* not USG, or USG_SUBTTY_WORKS */
|
1992-03-14 20:40:04 +00:00
|
|
|
|
pty_flag = 1;
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
#endif /* HAVE_PTYS */
|
|
|
|
|
{
|
1999-07-30 14:39:27 +00:00
|
|
|
|
int tem;
|
|
|
|
|
tem = pipe (sv);
|
|
|
|
|
if (tem < 0)
|
|
|
|
|
report_file_error ("Creating pipe", Qnil);
|
1992-03-14 20:40:04 +00:00
|
|
|
|
inchannel = sv[0];
|
|
|
|
|
forkout = sv[1];
|
1999-07-30 14:39:27 +00:00
|
|
|
|
tem = pipe (sv);
|
|
|
|
|
if (tem < 0)
|
|
|
|
|
{
|
Add support for large files, 64-bit Solaris, system locale codings.
* Makefile.in (emacs): Set the LC_ALL environment variable to "C"
when dumping, so that the dumped Emacs doesn't have stray locale info.
(dired.o): Depend on systime.h.
(editfns.o): Depend on coding.h.
* alloc.c, buffer.c, callproc.c, ccl.c, charset.c, coding.c, data.c,
dispnew.c, editfns.c, emacs.c, filelock.c, floatfns.c, hftctl.c,
keyboard.c, process.c, sysdep.c, unexelf.c, unexhp9k800.c,
unexsunos4.c, vmsfns.c, vmsgmalloc.c, w32faces.c, w32menu.c, w32term.c,
w32xfns.c, xfaces.c, xfns.c, xmenu.c, xterm.c:
Include <config.h> before any system include files.
* alloc.c, buffer.c, ccl.c, data.c, editfns.c, emacs.c, eval.c,
fileio.c, filelock.c, frame.c, insdel.c, keymap.c, lread.c,
m/alpha.h, print.c, search.c, sysdep.c, xdisp.c, xfaces.c, xfns.c,
xmenu.c, xterm.c:
Do not include <stdlib.h>, as <config.h> does this now.
* callproc.c (Fcall_process):
Synchronize messages locale before invoking strerror.
Decode resulting string with locale-coding-system.
* coding.c (Vlocale_coding_system): New var.
(syms_of_coding): Adjust to above change.
(emacs_strerror): New function.
* coding.h (emacs_strerror, Vlocale_coding_system): New decls.
* config.in (HAVE_STDIO_EXT_H, HAVE_TM_GMTOFF, HAVE___FPENDING,
HAVE_FTELLO, HAVE_GETLOADAVG, HAVE_MBLEN, HAVE_MBRLEN,
HAVE_STRSIGNAL): New macros.
(BITS_PER_LONG): Default to 64 if _LP64 is defined.
<stdlib.h>: Include if HAVE_STDLIB_H is defined and NOT_C_CODE isn't.
* dired.c: Include "systime.h".
(Ffile_attributes): Do not cast s.st_size to int; this loses
information if int is 32 bits but st_size and EMACS_INT are larger.
Treat large device numbers like large inode numbers.
* dispnew.c (PENDING_OUTPUT_COUNT): Use __fpending if available.
* editfns.c: Include coding.h.
(emacs_strftime): Remove decl.
(emacs_strftimeu): New decl.
(emacs_memftimeu): Renamed from emacs_memftime; new arg UT.
Use emacs_strftimeu instead of emacs_strftime.
(Fformat_time_string): Convert format string using
Vlocale_coding_system, and convert result back. Synchronize time
locale before invoking lower level function. Invoke
emacs_memftimeu, passing ut, instead of emacs_memftime.
* emacs.c: Include <locale.h> if HAVE_SETLOCALE is defined.
(Vmessages_locale, Vprevious_messages_locale, Vtime_locale,
Vprevious_time_locale): New variables.
(main): Invoke setlocale early, so that initial error messages are
localized properly. But skip locale-setting if LC_ALL is "C".
Fix up locale when it's safe to do so.
(fixup_locale): Moved here from xterm.c.
(synchronize_locale, synchronize_time_locale,
synchronize_messages_locale): New functions.
(syms_of_emacs): Accommodate above changes.
* fileio.c (report_file_error): Convert strerror output according
to Vlocale_coding_system.
(Finsert_file_contents): Check for arithmetic overflow in
computations that depend on file size. Report IO errors
with emacs_strerror, not strerror.
* fns.c (Fgethash): Declare dflt parameter.
* gmalloc.c: Do not define const to nothing if HAVE_CONFIG_H
is defined; that's config.h's job.
* lisp.h (EMACS_INT, BITS_PER_EMACS_INT, EMACS_UINT): If _LP64,
default these values to long, BITS_PER_LONG, and unsigned long.
(VALBITS, MARKBIT, XINT): Do not assume 32-bit EMACS_INT.
(PNTR_COMPARISON_TYPE): Default to EMACS_UINT, not to unsigned int.
(code_convert_string_norecord, fixup_locale,
synchronize_messages_locale, synchronize_time_locale,
emacs_open, emacs_close, emacs_read, emacs_write): New decls.
All Emacs callers of open, close, read, write changed to use
emacs_open, emacs_close, emacs_read, emacs_write.
* lread.c (file_offset, file_tell): New macros. All uses of ftell
changed to file_tell.
(saved_doc_string_position, prev_saved_doc_string_position): Now
of type file_offset.
(init_lread): Do not fix locale here; fixup_locale now does this.
* m/amdahl.h, s/usg5-4.h:
(NSIG): Remove.
(NSIG_MINIMUM): New macro.
* m/cydra5.h, m/dpx2.h, m/mips.h, m/pfa50.h, m/sps7.h, m/stride.h,
m/ustation.h, s/gnu-linux.h, s/hpux.h, s/iris3-5.h, s/iris3-6.h,
s/umips.h, s/usg5-4.h:
(SIGIO): Do not undef.
(BROKEN_SIGIO): New macro.
* m/ustation.h:
(SIGTSTP): Do not undef.
(BROKEN_SIGTSTP): New macro.
* s/gnu-linux.h:
(SIGPOLL, SIGURG): Do not undef.
(BROKEN_SIGPOLL, BROKEN_SIGURG): New macros.
* s/ptx4.h:
(SIGINFO): Do not undef.
(BROKEN_SIGINFO): New macros.
* m/delta.h, s/ptx.h, s/template.h: Doc fix.
* mktime.c, strftime.c: Update to glibc 2.1.2 version, with
some Emacs-related changes merged.
* print.c (float_to_string): Prepend "-" to representation of a
NaN if the NaN is negative.
* process.c (sys_siglist): Omit if HAVE_STRSIGNAL.
(wait_reading_process_input): Use emacs_strerror, not strerror.
* process.c (status_message, sigchld_handler): Synchronize locale,
then use strsignal istead of sys_siglist.
* w32proc.c (sys_wait): Likewise.
* s/aix3-1.h, s/bsd4-1.h, s/dgux.h, s/gnu-linux.h, s/hiuxmpp.h,
s/hpux.h, s/iris3-5.h, s/iris3-6.h, s/irix3-3.h, s/osf1.h, s/rtu.h,
s/sunos4-1.h, s/unipl5-0.h, s/unipl5-2.h, s/usg5-0.h, s/usg5-2-2.h,
s/usg5-2.h, s/usg5-3.h, s/xenix.h:
(open, close, read, write, INTERRUPTIBLE_OPEN,
INTERRUPTIBLE_CLOSE, INTERRUPTIBLE_IO): Remove.
* s/sol2-5.h (_LARGEFILE_SOURCE, _FILE_OFFSET_BITS): New macros.
* sysdep.c (sys_read, sys_write, read, write, sys_close, close,
sys_open, open): Remove.
(emacs_open, emacs_close, emacs_read, emacs_write): Always define;
the old INTERRUPTIBLE_OPEN, INTERRUPTIBLE_CLOSE, and INTERRUPTIBLE_IO
macros are no longer used.
(emacs_open): Renamed from sys_open. Merge BSD4_1 version.
(emacs_close): Renamed from sys_close.
(emacs_read): Renamed from sys_read.
(emacs_write): Renamed from sys_write.
(sys_siglist): Do not declare if HAVE_STRSIGNAL.
(dup2): Do not print error on failure; the real dup2 doesn't.
(strsignal): New function, defined if !HAVE_STRSIGNAL.
* syssignal.h (SIGINFO): Undef if defined and if BROKEN_SIGINFO
is defined.
(SIGIO, SIGPOLL, SIGTSTP, SIGURG): Likewise.
(NSIG): If less than NSIG_MINIMUM, define to NSIG_MINIMUM.
(strsignal): Declare if !HAVE_STRSIGNAL.
* unexelf.c (ElfBitsW, ELFSIZE, ElfExpandBitsW): New macros.
(ElfW): Define in terms of ElfExpandBitsW.
* w32proc.c (sys_siglist): Remove decl.
* xdisp.c (decode_mode_spec): 3rd arg is int, not char, to comply
with ANSI C.
(display_string): Declare face_string_pos arg.
* xfns.c (Fx_show_tip): Declare timeout param.
* xterm.c: No need to include locale.h.
(x_alloc_lighter_color, x_setup_relief_color):
Pass arg as double, not float, for compatibility with ANSI C.
(fixup_locale): Move to emacs.c.
(x_term_init): Do not setlocale or fixup locale; the main program
does this now.
1999-10-19 07:25:11 +00:00
|
|
|
|
emacs_close (inchannel);
|
|
|
|
|
emacs_close (forkout);
|
1999-07-30 14:39:27 +00:00
|
|
|
|
report_file_error ("Creating pipe", Qnil);
|
|
|
|
|
}
|
1992-03-14 20:40:04 +00:00
|
|
|
|
outchannel = sv[1];
|
|
|
|
|
forkin = sv[0];
|
|
|
|
|
}
|
|
|
|
|
|
2008-07-17 09:06:58 +00:00
|
|
|
|
#if !defined (WINDOWSNT) && defined (FD_CLOEXEC)
|
|
|
|
|
{
|
|
|
|
|
int tem;
|
|
|
|
|
|
|
|
|
|
tem = pipe (wait_child_setup);
|
|
|
|
|
if (tem < 0)
|
|
|
|
|
report_file_error ("Creating pipe", Qnil);
|
|
|
|
|
tem = fcntl (wait_child_setup[1], F_GETFD, 0);
|
|
|
|
|
if (tem >= 0)
|
|
|
|
|
tem = fcntl (wait_child_setup[1], F_SETFD, tem | FD_CLOEXEC);
|
|
|
|
|
if (tem < 0)
|
|
|
|
|
{
|
|
|
|
|
emacs_close (wait_child_setup[0]);
|
|
|
|
|
emacs_close (wait_child_setup[1]);
|
|
|
|
|
report_file_error ("Setting file descriptor flags", Qnil);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
#endif
|
|
|
|
|
|
1992-03-14 20:40:04 +00:00
|
|
|
|
#if 0
|
|
|
|
|
/* Replaced by close_process_descs */
|
|
|
|
|
set_exclusive_use (inchannel);
|
|
|
|
|
set_exclusive_use (outchannel);
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
#ifdef O_NONBLOCK
|
|
|
|
|
fcntl (inchannel, F_SETFL, O_NONBLOCK);
|
1996-01-29 04:52:15 +00:00
|
|
|
|
fcntl (outchannel, F_SETFL, O_NONBLOCK);
|
1992-03-14 20:40:04 +00:00
|
|
|
|
#else
|
|
|
|
|
#ifdef O_NDELAY
|
|
|
|
|
fcntl (inchannel, F_SETFL, O_NDELAY);
|
1996-01-29 04:52:15 +00:00
|
|
|
|
fcntl (outchannel, F_SETFL, O_NDELAY);
|
1992-03-14 20:40:04 +00:00
|
|
|
|
#endif
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
/* Record this as an active process, with its channels.
|
|
|
|
|
As a result, child_setup will close Emacs's side of the pipes. */
|
|
|
|
|
chan_process[inchannel] = process;
|
(struct Lisp_Process): Turn slots infd, outfd, kill_without_query, pty_flag,
tick, update_tick, decoding_carryover, inherit_coding_system_flag,
filter_multibyte, adaptive_read_buffering, read_output_delay, and
read_output_skip from Lisp_Objects to ints. Remove unused
encoding_carryover.
2007-07-12 06:36:57 +00:00
|
|
|
|
XPROCESS (process)->infd = inchannel;
|
|
|
|
|
XPROCESS (process)->outfd = outchannel;
|
2003-02-21 18:13:53 +00:00
|
|
|
|
|
|
|
|
|
/* Previously we recorded the tty descriptor used in the subprocess.
|
|
|
|
|
It was only used for getting the foreground tty process, so now
|
|
|
|
|
we just reopen the device (see emacs_get_tty_pgrp) as this is
|
|
|
|
|
more portable (see USG_SUBTTY_WORKS above). */
|
|
|
|
|
|
(struct Lisp_Process): Turn slots infd, outfd, kill_without_query, pty_flag,
tick, update_tick, decoding_carryover, inherit_coding_system_flag,
filter_multibyte, adaptive_read_buffering, read_output_delay, and
read_output_skip from Lisp_Objects to ints. Remove unused
encoding_carryover.
2007-07-12 06:36:57 +00:00
|
|
|
|
XPROCESS (process)->pty_flag = pty_flag;
|
1992-03-14 20:40:04 +00:00
|
|
|
|
XPROCESS (process)->status = Qrun;
|
2003-02-10 07:58:29 +00:00
|
|
|
|
setup_process_coding_systems (process);
|
1992-03-14 20:40:04 +00:00
|
|
|
|
|
|
|
|
|
/* Delay interrupts until we have a chance to store
|
|
|
|
|
the new fork's pid in its process structure */
|
1995-12-13 01:52:07 +00:00
|
|
|
|
sigemptyset (&blocked);
|
|
|
|
|
#ifdef SIGCHLD
|
|
|
|
|
sigaddset (&blocked, SIGCHLD);
|
|
|
|
|
#endif
|
2001-12-07 05:52:35 +00:00
|
|
|
|
#ifdef HAVE_WORKING_VFORK
|
1995-12-13 01:52:07 +00:00
|
|
|
|
/* On many hosts (e.g. Solaris 2.4), if a vforked child calls `signal',
|
|
|
|
|
this sets the parent's signal handlers as well as the child's.
|
|
|
|
|
So delay all interrupts whose handlers the child might munge,
|
|
|
|
|
and record the current handlers so they can be restored later. */
|
|
|
|
|
sigaddset (&blocked, SIGINT ); sigaction (SIGINT , 0, &sigint_action );
|
|
|
|
|
sigaddset (&blocked, SIGQUIT); sigaction (SIGQUIT, 0, &sigquit_action);
|
|
|
|
|
#ifdef AIX
|
|
|
|
|
sigaddset (&blocked, SIGHUP ); sigaction (SIGHUP , 0, &sighup_action );
|
|
|
|
|
#endif
|
2001-12-07 05:52:35 +00:00
|
|
|
|
#endif /* HAVE_WORKING_VFORK */
|
1995-12-13 01:52:07 +00:00
|
|
|
|
sigprocmask (SIG_BLOCK, &blocked, &procmask);
|
1992-03-14 20:40:04 +00:00
|
|
|
|
|
1994-06-15 00:24:54 +00:00
|
|
|
|
FD_SET (inchannel, &input_wait_mask);
|
1994-10-25 09:48:44 +00:00
|
|
|
|
FD_SET (inchannel, &non_keyboard_wait_mask);
|
1994-06-15 00:24:54 +00:00
|
|
|
|
if (inchannel > max_process_desc)
|
|
|
|
|
max_process_desc = inchannel;
|
|
|
|
|
|
1992-03-14 20:40:04 +00:00
|
|
|
|
/* Until we store the proper pid, enable sigchld_handler
|
|
|
|
|
to recognize an unknown pid as standing for this process.
|
|
|
|
|
It is very important not to let this `marker' value stay
|
|
|
|
|
in the table after this function has returned; if it does
|
|
|
|
|
it might cause call-process to hang and subsequent asynchronous
|
|
|
|
|
processes to get their return values scrambled. */
|
* process.h (struct Lisp_Process): Replace Lisp_Objects `pid',
`raw_status_high', and `raw_status_low' with plain integers, and move
them to the end of the structure.
* alloc.c (allocate_process): Use PSEUDOVECSIZE to initialize the
pseudovector's size field so only the Lisp_Object fields get GC'd.
* process.c (update_status, make_process, Fdelete_process)
(Fprocess_status, list_processes_1, start_process_unwind)
(create_process, Fmake_network_process, server_accept_connection)
(wait_reading_process_output, send_process, Fprocess_running_child_p)
(process_send_signal, proc_encode_coding_system, Fprocess_send_eof)
(sigchld_handler, status_notify): Adjust to new non-Lisp fields for
`pid' and `raw_status'.
(Fprocess_id, Fsignal_process): Same, and additionally use floats when
representing PIDs that are larger than most-positive-fixnum.
2006-04-08 15:07:35 +00:00
|
|
|
|
XPROCESS (process)->pid = -1;
|
1992-03-14 20:40:04 +00:00
|
|
|
|
|
1996-12-30 01:26:08 +00:00
|
|
|
|
BLOCK_INPUT;
|
2003-02-04 14:56:31 +00:00
|
|
|
|
|
1992-03-14 20:40:04 +00:00
|
|
|
|
{
|
|
|
|
|
/* child_setup must clobber environ on systems with true vfork.
|
|
|
|
|
Protect it from permanent change. */
|
|
|
|
|
char **save_environ = environ;
|
|
|
|
|
|
1998-03-03 07:18:46 +00:00
|
|
|
|
current_dir = ENCODE_FILE (current_dir);
|
1997-09-09 05:30:58 +00:00
|
|
|
|
|
1994-11-01 08:31:31 +00:00
|
|
|
|
#ifndef WINDOWSNT
|
1992-03-14 20:40:04 +00:00
|
|
|
|
pid = vfork ();
|
|
|
|
|
if (pid == 0)
|
1994-11-01 08:31:31 +00:00
|
|
|
|
#endif /* not WINDOWSNT */
|
1992-03-14 20:40:04 +00:00
|
|
|
|
{
|
|
|
|
|
int xforkin = forkin;
|
|
|
|
|
int xforkout = forkout;
|
|
|
|
|
|
|
|
|
|
#if 0 /* This was probably a mistake--it duplicates code later on,
|
|
|
|
|
but fails to handle all the cases. */
|
|
|
|
|
/* Make sure SIGCHLD is not blocked in the child. */
|
|
|
|
|
sigsetmask (SIGEMPTYMASK);
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
/* Make the pty be the controlling terminal of the process. */
|
|
|
|
|
#ifdef HAVE_PTYS
|
|
|
|
|
/* First, disconnect its current controlling terminal. */
|
|
|
|
|
#ifdef HAVE_SETSID
|
1994-05-02 04:07:06 +00:00
|
|
|
|
/* We tried doing setsid only if pty_flag, but it caused
|
|
|
|
|
process_set_signal to fail on SGI when using a pipe. */
|
|
|
|
|
setsid ();
|
1992-08-22 02:53:24 +00:00
|
|
|
|
/* Make the pty's terminal the controlling terminal. */
|
2010-07-01 01:07:11 +02:00
|
|
|
|
if (pty_flag && xforkin >= 0)
|
1994-04-20 03:49:47 +00:00
|
|
|
|
{
|
|
|
|
|
#ifdef TIOCSCTTY
|
|
|
|
|
/* We ignore the return value
|
|
|
|
|
because faith@cs.unc.edu says that is necessary on Linux. */
|
|
|
|
|
ioctl (xforkin, TIOCSCTTY, 0);
|
1992-08-22 02:53:24 +00:00
|
|
|
|
#endif
|
1994-04-20 03:49:47 +00:00
|
|
|
|
}
|
1992-03-14 20:40:04 +00:00
|
|
|
|
#else /* not HAVE_SETSID */
|
1993-11-25 21:36:51 +00:00
|
|
|
|
#ifdef USG
|
1993-12-25 01:44:47 +00:00
|
|
|
|
/* It's very important to call setpgrp here and no time
|
1992-03-14 20:40:04 +00:00
|
|
|
|
afterwards. Otherwise, we lose our controlling tty which
|
|
|
|
|
is set when we open the pty. */
|
|
|
|
|
setpgrp ();
|
|
|
|
|
#endif /* USG */
|
|
|
|
|
#endif /* not HAVE_SETSID */
|
1994-04-26 21:17:19 +00:00
|
|
|
|
#if defined (HAVE_TERMIOS) && defined (LDISC1)
|
|
|
|
|
if (pty_flag && xforkin >= 0)
|
|
|
|
|
{
|
|
|
|
|
struct termios t;
|
|
|
|
|
tcgetattr (xforkin, &t);
|
|
|
|
|
t.c_lflag = LDISC1;
|
|
|
|
|
if (tcsetattr (xforkin, TCSANOW, &t) < 0)
|
Add support for large files, 64-bit Solaris, system locale codings.
* Makefile.in (emacs): Set the LC_ALL environment variable to "C"
when dumping, so that the dumped Emacs doesn't have stray locale info.
(dired.o): Depend on systime.h.
(editfns.o): Depend on coding.h.
* alloc.c, buffer.c, callproc.c, ccl.c, charset.c, coding.c, data.c,
dispnew.c, editfns.c, emacs.c, filelock.c, floatfns.c, hftctl.c,
keyboard.c, process.c, sysdep.c, unexelf.c, unexhp9k800.c,
unexsunos4.c, vmsfns.c, vmsgmalloc.c, w32faces.c, w32menu.c, w32term.c,
w32xfns.c, xfaces.c, xfns.c, xmenu.c, xterm.c:
Include <config.h> before any system include files.
* alloc.c, buffer.c, ccl.c, data.c, editfns.c, emacs.c, eval.c,
fileio.c, filelock.c, frame.c, insdel.c, keymap.c, lread.c,
m/alpha.h, print.c, search.c, sysdep.c, xdisp.c, xfaces.c, xfns.c,
xmenu.c, xterm.c:
Do not include <stdlib.h>, as <config.h> does this now.
* callproc.c (Fcall_process):
Synchronize messages locale before invoking strerror.
Decode resulting string with locale-coding-system.
* coding.c (Vlocale_coding_system): New var.
(syms_of_coding): Adjust to above change.
(emacs_strerror): New function.
* coding.h (emacs_strerror, Vlocale_coding_system): New decls.
* config.in (HAVE_STDIO_EXT_H, HAVE_TM_GMTOFF, HAVE___FPENDING,
HAVE_FTELLO, HAVE_GETLOADAVG, HAVE_MBLEN, HAVE_MBRLEN,
HAVE_STRSIGNAL): New macros.
(BITS_PER_LONG): Default to 64 if _LP64 is defined.
<stdlib.h>: Include if HAVE_STDLIB_H is defined and NOT_C_CODE isn't.
* dired.c: Include "systime.h".
(Ffile_attributes): Do not cast s.st_size to int; this loses
information if int is 32 bits but st_size and EMACS_INT are larger.
Treat large device numbers like large inode numbers.
* dispnew.c (PENDING_OUTPUT_COUNT): Use __fpending if available.
* editfns.c: Include coding.h.
(emacs_strftime): Remove decl.
(emacs_strftimeu): New decl.
(emacs_memftimeu): Renamed from emacs_memftime; new arg UT.
Use emacs_strftimeu instead of emacs_strftime.
(Fformat_time_string): Convert format string using
Vlocale_coding_system, and convert result back. Synchronize time
locale before invoking lower level function. Invoke
emacs_memftimeu, passing ut, instead of emacs_memftime.
* emacs.c: Include <locale.h> if HAVE_SETLOCALE is defined.
(Vmessages_locale, Vprevious_messages_locale, Vtime_locale,
Vprevious_time_locale): New variables.
(main): Invoke setlocale early, so that initial error messages are
localized properly. But skip locale-setting if LC_ALL is "C".
Fix up locale when it's safe to do so.
(fixup_locale): Moved here from xterm.c.
(synchronize_locale, synchronize_time_locale,
synchronize_messages_locale): New functions.
(syms_of_emacs): Accommodate above changes.
* fileio.c (report_file_error): Convert strerror output according
to Vlocale_coding_system.
(Finsert_file_contents): Check for arithmetic overflow in
computations that depend on file size. Report IO errors
with emacs_strerror, not strerror.
* fns.c (Fgethash): Declare dflt parameter.
* gmalloc.c: Do not define const to nothing if HAVE_CONFIG_H
is defined; that's config.h's job.
* lisp.h (EMACS_INT, BITS_PER_EMACS_INT, EMACS_UINT): If _LP64,
default these values to long, BITS_PER_LONG, and unsigned long.
(VALBITS, MARKBIT, XINT): Do not assume 32-bit EMACS_INT.
(PNTR_COMPARISON_TYPE): Default to EMACS_UINT, not to unsigned int.
(code_convert_string_norecord, fixup_locale,
synchronize_messages_locale, synchronize_time_locale,
emacs_open, emacs_close, emacs_read, emacs_write): New decls.
All Emacs callers of open, close, read, write changed to use
emacs_open, emacs_close, emacs_read, emacs_write.
* lread.c (file_offset, file_tell): New macros. All uses of ftell
changed to file_tell.
(saved_doc_string_position, prev_saved_doc_string_position): Now
of type file_offset.
(init_lread): Do not fix locale here; fixup_locale now does this.
* m/amdahl.h, s/usg5-4.h:
(NSIG): Remove.
(NSIG_MINIMUM): New macro.
* m/cydra5.h, m/dpx2.h, m/mips.h, m/pfa50.h, m/sps7.h, m/stride.h,
m/ustation.h, s/gnu-linux.h, s/hpux.h, s/iris3-5.h, s/iris3-6.h,
s/umips.h, s/usg5-4.h:
(SIGIO): Do not undef.
(BROKEN_SIGIO): New macro.
* m/ustation.h:
(SIGTSTP): Do not undef.
(BROKEN_SIGTSTP): New macro.
* s/gnu-linux.h:
(SIGPOLL, SIGURG): Do not undef.
(BROKEN_SIGPOLL, BROKEN_SIGURG): New macros.
* s/ptx4.h:
(SIGINFO): Do not undef.
(BROKEN_SIGINFO): New macros.
* m/delta.h, s/ptx.h, s/template.h: Doc fix.
* mktime.c, strftime.c: Update to glibc 2.1.2 version, with
some Emacs-related changes merged.
* print.c (float_to_string): Prepend "-" to representation of a
NaN if the NaN is negative.
* process.c (sys_siglist): Omit if HAVE_STRSIGNAL.
(wait_reading_process_input): Use emacs_strerror, not strerror.
* process.c (status_message, sigchld_handler): Synchronize locale,
then use strsignal istead of sys_siglist.
* w32proc.c (sys_wait): Likewise.
* s/aix3-1.h, s/bsd4-1.h, s/dgux.h, s/gnu-linux.h, s/hiuxmpp.h,
s/hpux.h, s/iris3-5.h, s/iris3-6.h, s/irix3-3.h, s/osf1.h, s/rtu.h,
s/sunos4-1.h, s/unipl5-0.h, s/unipl5-2.h, s/usg5-0.h, s/usg5-2-2.h,
s/usg5-2.h, s/usg5-3.h, s/xenix.h:
(open, close, read, write, INTERRUPTIBLE_OPEN,
INTERRUPTIBLE_CLOSE, INTERRUPTIBLE_IO): Remove.
* s/sol2-5.h (_LARGEFILE_SOURCE, _FILE_OFFSET_BITS): New macros.
* sysdep.c (sys_read, sys_write, read, write, sys_close, close,
sys_open, open): Remove.
(emacs_open, emacs_close, emacs_read, emacs_write): Always define;
the old INTERRUPTIBLE_OPEN, INTERRUPTIBLE_CLOSE, and INTERRUPTIBLE_IO
macros are no longer used.
(emacs_open): Renamed from sys_open. Merge BSD4_1 version.
(emacs_close): Renamed from sys_close.
(emacs_read): Renamed from sys_read.
(emacs_write): Renamed from sys_write.
(sys_siglist): Do not declare if HAVE_STRSIGNAL.
(dup2): Do not print error on failure; the real dup2 doesn't.
(strsignal): New function, defined if !HAVE_STRSIGNAL.
* syssignal.h (SIGINFO): Undef if defined and if BROKEN_SIGINFO
is defined.
(SIGIO, SIGPOLL, SIGTSTP, SIGURG): Likewise.
(NSIG): If less than NSIG_MINIMUM, define to NSIG_MINIMUM.
(strsignal): Declare if !HAVE_STRSIGNAL.
* unexelf.c (ElfBitsW, ELFSIZE, ElfExpandBitsW): New macros.
(ElfW): Define in terms of ElfExpandBitsW.
* w32proc.c (sys_siglist): Remove decl.
* xdisp.c (decode_mode_spec): 3rd arg is int, not char, to comply
with ANSI C.
(display_string): Declare face_string_pos arg.
* xfns.c (Fx_show_tip): Declare timeout param.
* xterm.c: No need to include locale.h.
(x_alloc_lighter_color, x_setup_relief_color):
Pass arg as double, not float, for compatibility with ANSI C.
(fixup_locale): Move to emacs.c.
(x_term_init): Do not setlocale or fixup locale; the main program
does this now.
1999-10-19 07:25:11 +00:00
|
|
|
|
emacs_write (1, "create_process/tcsetattr LDISC1 failed\n", 39);
|
1994-04-26 21:17:19 +00:00
|
|
|
|
}
|
|
|
|
|
#else
|
1994-04-18 17:40:25 +00:00
|
|
|
|
#if defined (NTTYDISC) && defined (TIOCSETD)
|
1994-03-18 00:23:47 +00:00
|
|
|
|
if (pty_flag && xforkin >= 0)
|
1994-01-10 18:13:39 +00:00
|
|
|
|
{
|
|
|
|
|
/* Use new line discipline. */
|
|
|
|
|
int ldisc = NTTYDISC;
|
1994-05-21 07:28:57 +00:00
|
|
|
|
ioctl (xforkin, TIOCSETD, &ldisc);
|
1994-01-10 18:13:39 +00:00
|
|
|
|
}
|
1993-12-25 01:44:47 +00:00
|
|
|
|
#endif
|
1994-04-26 21:17:19 +00:00
|
|
|
|
#endif
|
2003-02-04 14:56:31 +00:00
|
|
|
|
#ifdef TIOCNOTTY
|
1992-03-14 20:40:04 +00:00
|
|
|
|
/* In 4.3BSD, the TIOCSPGRP bug has been fixed, and now you
|
|
|
|
|
can do TIOCSPGRP only to the process's controlling tty. */
|
|
|
|
|
if (pty_flag)
|
|
|
|
|
{
|
2003-02-04 14:56:31 +00:00
|
|
|
|
/* I wonder: would just ioctl (0, TIOCNOTTY, 0) work here?
|
1992-03-14 20:40:04 +00:00
|
|
|
|
I can't test it since I don't have 4.3. */
|
Add support for large files, 64-bit Solaris, system locale codings.
* Makefile.in (emacs): Set the LC_ALL environment variable to "C"
when dumping, so that the dumped Emacs doesn't have stray locale info.
(dired.o): Depend on systime.h.
(editfns.o): Depend on coding.h.
* alloc.c, buffer.c, callproc.c, ccl.c, charset.c, coding.c, data.c,
dispnew.c, editfns.c, emacs.c, filelock.c, floatfns.c, hftctl.c,
keyboard.c, process.c, sysdep.c, unexelf.c, unexhp9k800.c,
unexsunos4.c, vmsfns.c, vmsgmalloc.c, w32faces.c, w32menu.c, w32term.c,
w32xfns.c, xfaces.c, xfns.c, xmenu.c, xterm.c:
Include <config.h> before any system include files.
* alloc.c, buffer.c, ccl.c, data.c, editfns.c, emacs.c, eval.c,
fileio.c, filelock.c, frame.c, insdel.c, keymap.c, lread.c,
m/alpha.h, print.c, search.c, sysdep.c, xdisp.c, xfaces.c, xfns.c,
xmenu.c, xterm.c:
Do not include <stdlib.h>, as <config.h> does this now.
* callproc.c (Fcall_process):
Synchronize messages locale before invoking strerror.
Decode resulting string with locale-coding-system.
* coding.c (Vlocale_coding_system): New var.
(syms_of_coding): Adjust to above change.
(emacs_strerror): New function.
* coding.h (emacs_strerror, Vlocale_coding_system): New decls.
* config.in (HAVE_STDIO_EXT_H, HAVE_TM_GMTOFF, HAVE___FPENDING,
HAVE_FTELLO, HAVE_GETLOADAVG, HAVE_MBLEN, HAVE_MBRLEN,
HAVE_STRSIGNAL): New macros.
(BITS_PER_LONG): Default to 64 if _LP64 is defined.
<stdlib.h>: Include if HAVE_STDLIB_H is defined and NOT_C_CODE isn't.
* dired.c: Include "systime.h".
(Ffile_attributes): Do not cast s.st_size to int; this loses
information if int is 32 bits but st_size and EMACS_INT are larger.
Treat large device numbers like large inode numbers.
* dispnew.c (PENDING_OUTPUT_COUNT): Use __fpending if available.
* editfns.c: Include coding.h.
(emacs_strftime): Remove decl.
(emacs_strftimeu): New decl.
(emacs_memftimeu): Renamed from emacs_memftime; new arg UT.
Use emacs_strftimeu instead of emacs_strftime.
(Fformat_time_string): Convert format string using
Vlocale_coding_system, and convert result back. Synchronize time
locale before invoking lower level function. Invoke
emacs_memftimeu, passing ut, instead of emacs_memftime.
* emacs.c: Include <locale.h> if HAVE_SETLOCALE is defined.
(Vmessages_locale, Vprevious_messages_locale, Vtime_locale,
Vprevious_time_locale): New variables.
(main): Invoke setlocale early, so that initial error messages are
localized properly. But skip locale-setting if LC_ALL is "C".
Fix up locale when it's safe to do so.
(fixup_locale): Moved here from xterm.c.
(synchronize_locale, synchronize_time_locale,
synchronize_messages_locale): New functions.
(syms_of_emacs): Accommodate above changes.
* fileio.c (report_file_error): Convert strerror output according
to Vlocale_coding_system.
(Finsert_file_contents): Check for arithmetic overflow in
computations that depend on file size. Report IO errors
with emacs_strerror, not strerror.
* fns.c (Fgethash): Declare dflt parameter.
* gmalloc.c: Do not define const to nothing if HAVE_CONFIG_H
is defined; that's config.h's job.
* lisp.h (EMACS_INT, BITS_PER_EMACS_INT, EMACS_UINT): If _LP64,
default these values to long, BITS_PER_LONG, and unsigned long.
(VALBITS, MARKBIT, XINT): Do not assume 32-bit EMACS_INT.
(PNTR_COMPARISON_TYPE): Default to EMACS_UINT, not to unsigned int.
(code_convert_string_norecord, fixup_locale,
synchronize_messages_locale, synchronize_time_locale,
emacs_open, emacs_close, emacs_read, emacs_write): New decls.
All Emacs callers of open, close, read, write changed to use
emacs_open, emacs_close, emacs_read, emacs_write.
* lread.c (file_offset, file_tell): New macros. All uses of ftell
changed to file_tell.
(saved_doc_string_position, prev_saved_doc_string_position): Now
of type file_offset.
(init_lread): Do not fix locale here; fixup_locale now does this.
* m/amdahl.h, s/usg5-4.h:
(NSIG): Remove.
(NSIG_MINIMUM): New macro.
* m/cydra5.h, m/dpx2.h, m/mips.h, m/pfa50.h, m/sps7.h, m/stride.h,
m/ustation.h, s/gnu-linux.h, s/hpux.h, s/iris3-5.h, s/iris3-6.h,
s/umips.h, s/usg5-4.h:
(SIGIO): Do not undef.
(BROKEN_SIGIO): New macro.
* m/ustation.h:
(SIGTSTP): Do not undef.
(BROKEN_SIGTSTP): New macro.
* s/gnu-linux.h:
(SIGPOLL, SIGURG): Do not undef.
(BROKEN_SIGPOLL, BROKEN_SIGURG): New macros.
* s/ptx4.h:
(SIGINFO): Do not undef.
(BROKEN_SIGINFO): New macros.
* m/delta.h, s/ptx.h, s/template.h: Doc fix.
* mktime.c, strftime.c: Update to glibc 2.1.2 version, with
some Emacs-related changes merged.
* print.c (float_to_string): Prepend "-" to representation of a
NaN if the NaN is negative.
* process.c (sys_siglist): Omit if HAVE_STRSIGNAL.
(wait_reading_process_input): Use emacs_strerror, not strerror.
* process.c (status_message, sigchld_handler): Synchronize locale,
then use strsignal istead of sys_siglist.
* w32proc.c (sys_wait): Likewise.
* s/aix3-1.h, s/bsd4-1.h, s/dgux.h, s/gnu-linux.h, s/hiuxmpp.h,
s/hpux.h, s/iris3-5.h, s/iris3-6.h, s/irix3-3.h, s/osf1.h, s/rtu.h,
s/sunos4-1.h, s/unipl5-0.h, s/unipl5-2.h, s/usg5-0.h, s/usg5-2-2.h,
s/usg5-2.h, s/usg5-3.h, s/xenix.h:
(open, close, read, write, INTERRUPTIBLE_OPEN,
INTERRUPTIBLE_CLOSE, INTERRUPTIBLE_IO): Remove.
* s/sol2-5.h (_LARGEFILE_SOURCE, _FILE_OFFSET_BITS): New macros.
* sysdep.c (sys_read, sys_write, read, write, sys_close, close,
sys_open, open): Remove.
(emacs_open, emacs_close, emacs_read, emacs_write): Always define;
the old INTERRUPTIBLE_OPEN, INTERRUPTIBLE_CLOSE, and INTERRUPTIBLE_IO
macros are no longer used.
(emacs_open): Renamed from sys_open. Merge BSD4_1 version.
(emacs_close): Renamed from sys_close.
(emacs_read): Renamed from sys_read.
(emacs_write): Renamed from sys_write.
(sys_siglist): Do not declare if HAVE_STRSIGNAL.
(dup2): Do not print error on failure; the real dup2 doesn't.
(strsignal): New function, defined if !HAVE_STRSIGNAL.
* syssignal.h (SIGINFO): Undef if defined and if BROKEN_SIGINFO
is defined.
(SIGIO, SIGPOLL, SIGTSTP, SIGURG): Likewise.
(NSIG): If less than NSIG_MINIMUM, define to NSIG_MINIMUM.
(strsignal): Declare if !HAVE_STRSIGNAL.
* unexelf.c (ElfBitsW, ELFSIZE, ElfExpandBitsW): New macros.
(ElfW): Define in terms of ElfExpandBitsW.
* w32proc.c (sys_siglist): Remove decl.
* xdisp.c (decode_mode_spec): 3rd arg is int, not char, to comply
with ANSI C.
(display_string): Declare face_string_pos arg.
* xfns.c (Fx_show_tip): Declare timeout param.
* xterm.c: No need to include locale.h.
(x_alloc_lighter_color, x_setup_relief_color):
Pass arg as double, not float, for compatibility with ANSI C.
(fixup_locale): Move to emacs.c.
(x_term_init): Do not setlocale or fixup locale; the main program
does this now.
1999-10-19 07:25:11 +00:00
|
|
|
|
int j = emacs_open ("/dev/tty", O_RDWR, 0);
|
2010-07-01 01:07:11 +02:00
|
|
|
|
if (j >= 0)
|
|
|
|
|
{
|
|
|
|
|
ioctl (j, TIOCNOTTY, 0);
|
|
|
|
|
emacs_close (j);
|
|
|
|
|
}
|
1993-06-18 23:33:20 +00:00
|
|
|
|
#ifndef USG
|
1992-03-14 20:40:04 +00:00
|
|
|
|
/* In order to get a controlling terminal on some versions
|
|
|
|
|
of BSD, it is necessary to put the process in pgrp 0
|
|
|
|
|
before it opens the terminal. */
|
1996-09-04 16:27:55 +00:00
|
|
|
|
#ifdef HAVE_SETPGID
|
1994-11-10 08:12:48 +00:00
|
|
|
|
setpgid (0, 0);
|
|
|
|
|
#else
|
1992-03-14 20:40:04 +00:00
|
|
|
|
setpgrp (0, 0);
|
1994-11-10 08:12:48 +00:00
|
|
|
|
#endif
|
1992-03-14 20:40:04 +00:00
|
|
|
|
#endif
|
|
|
|
|
}
|
|
|
|
|
#endif /* TIOCNOTTY */
|
|
|
|
|
|
2008-01-13 00:43:55 +00:00
|
|
|
|
#if !defined (DONT_REOPEN_PTY)
|
1992-03-14 20:40:04 +00:00
|
|
|
|
/*** There is a suggestion that this ought to be a
|
1996-09-03 04:13:20 +00:00
|
|
|
|
conditional on TIOCSPGRP,
|
|
|
|
|
or !(defined (HAVE_SETSID) && defined (TIOCSCTTY)).
|
|
|
|
|
Trying the latter gave the wrong results on Debian GNU/Linux 1.1;
|
|
|
|
|
that system does seem to need this code, even though
|
|
|
|
|
both HAVE_SETSID and TIOCSCTTY are defined. */
|
1992-03-14 20:40:04 +00:00
|
|
|
|
/* Now close the pty (if we had it open) and reopen it.
|
|
|
|
|
This makes the pty the controlling terminal of the subprocess. */
|
|
|
|
|
if (pty_flag)
|
|
|
|
|
{
|
1993-12-23 01:24:18 +00:00
|
|
|
|
|
Add support for large files, 64-bit Solaris, system locale codings.
* Makefile.in (emacs): Set the LC_ALL environment variable to "C"
when dumping, so that the dumped Emacs doesn't have stray locale info.
(dired.o): Depend on systime.h.
(editfns.o): Depend on coding.h.
* alloc.c, buffer.c, callproc.c, ccl.c, charset.c, coding.c, data.c,
dispnew.c, editfns.c, emacs.c, filelock.c, floatfns.c, hftctl.c,
keyboard.c, process.c, sysdep.c, unexelf.c, unexhp9k800.c,
unexsunos4.c, vmsfns.c, vmsgmalloc.c, w32faces.c, w32menu.c, w32term.c,
w32xfns.c, xfaces.c, xfns.c, xmenu.c, xterm.c:
Include <config.h> before any system include files.
* alloc.c, buffer.c, ccl.c, data.c, editfns.c, emacs.c, eval.c,
fileio.c, filelock.c, frame.c, insdel.c, keymap.c, lread.c,
m/alpha.h, print.c, search.c, sysdep.c, xdisp.c, xfaces.c, xfns.c,
xmenu.c, xterm.c:
Do not include <stdlib.h>, as <config.h> does this now.
* callproc.c (Fcall_process):
Synchronize messages locale before invoking strerror.
Decode resulting string with locale-coding-system.
* coding.c (Vlocale_coding_system): New var.
(syms_of_coding): Adjust to above change.
(emacs_strerror): New function.
* coding.h (emacs_strerror, Vlocale_coding_system): New decls.
* config.in (HAVE_STDIO_EXT_H, HAVE_TM_GMTOFF, HAVE___FPENDING,
HAVE_FTELLO, HAVE_GETLOADAVG, HAVE_MBLEN, HAVE_MBRLEN,
HAVE_STRSIGNAL): New macros.
(BITS_PER_LONG): Default to 64 if _LP64 is defined.
<stdlib.h>: Include if HAVE_STDLIB_H is defined and NOT_C_CODE isn't.
* dired.c: Include "systime.h".
(Ffile_attributes): Do not cast s.st_size to int; this loses
information if int is 32 bits but st_size and EMACS_INT are larger.
Treat large device numbers like large inode numbers.
* dispnew.c (PENDING_OUTPUT_COUNT): Use __fpending if available.
* editfns.c: Include coding.h.
(emacs_strftime): Remove decl.
(emacs_strftimeu): New decl.
(emacs_memftimeu): Renamed from emacs_memftime; new arg UT.
Use emacs_strftimeu instead of emacs_strftime.
(Fformat_time_string): Convert format string using
Vlocale_coding_system, and convert result back. Synchronize time
locale before invoking lower level function. Invoke
emacs_memftimeu, passing ut, instead of emacs_memftime.
* emacs.c: Include <locale.h> if HAVE_SETLOCALE is defined.
(Vmessages_locale, Vprevious_messages_locale, Vtime_locale,
Vprevious_time_locale): New variables.
(main): Invoke setlocale early, so that initial error messages are
localized properly. But skip locale-setting if LC_ALL is "C".
Fix up locale when it's safe to do so.
(fixup_locale): Moved here from xterm.c.
(synchronize_locale, synchronize_time_locale,
synchronize_messages_locale): New functions.
(syms_of_emacs): Accommodate above changes.
* fileio.c (report_file_error): Convert strerror output according
to Vlocale_coding_system.
(Finsert_file_contents): Check for arithmetic overflow in
computations that depend on file size. Report IO errors
with emacs_strerror, not strerror.
* fns.c (Fgethash): Declare dflt parameter.
* gmalloc.c: Do not define const to nothing if HAVE_CONFIG_H
is defined; that's config.h's job.
* lisp.h (EMACS_INT, BITS_PER_EMACS_INT, EMACS_UINT): If _LP64,
default these values to long, BITS_PER_LONG, and unsigned long.
(VALBITS, MARKBIT, XINT): Do not assume 32-bit EMACS_INT.
(PNTR_COMPARISON_TYPE): Default to EMACS_UINT, not to unsigned int.
(code_convert_string_norecord, fixup_locale,
synchronize_messages_locale, synchronize_time_locale,
emacs_open, emacs_close, emacs_read, emacs_write): New decls.
All Emacs callers of open, close, read, write changed to use
emacs_open, emacs_close, emacs_read, emacs_write.
* lread.c (file_offset, file_tell): New macros. All uses of ftell
changed to file_tell.
(saved_doc_string_position, prev_saved_doc_string_position): Now
of type file_offset.
(init_lread): Do not fix locale here; fixup_locale now does this.
* m/amdahl.h, s/usg5-4.h:
(NSIG): Remove.
(NSIG_MINIMUM): New macro.
* m/cydra5.h, m/dpx2.h, m/mips.h, m/pfa50.h, m/sps7.h, m/stride.h,
m/ustation.h, s/gnu-linux.h, s/hpux.h, s/iris3-5.h, s/iris3-6.h,
s/umips.h, s/usg5-4.h:
(SIGIO): Do not undef.
(BROKEN_SIGIO): New macro.
* m/ustation.h:
(SIGTSTP): Do not undef.
(BROKEN_SIGTSTP): New macro.
* s/gnu-linux.h:
(SIGPOLL, SIGURG): Do not undef.
(BROKEN_SIGPOLL, BROKEN_SIGURG): New macros.
* s/ptx4.h:
(SIGINFO): Do not undef.
(BROKEN_SIGINFO): New macros.
* m/delta.h, s/ptx.h, s/template.h: Doc fix.
* mktime.c, strftime.c: Update to glibc 2.1.2 version, with
some Emacs-related changes merged.
* print.c (float_to_string): Prepend "-" to representation of a
NaN if the NaN is negative.
* process.c (sys_siglist): Omit if HAVE_STRSIGNAL.
(wait_reading_process_input): Use emacs_strerror, not strerror.
* process.c (status_message, sigchld_handler): Synchronize locale,
then use strsignal istead of sys_siglist.
* w32proc.c (sys_wait): Likewise.
* s/aix3-1.h, s/bsd4-1.h, s/dgux.h, s/gnu-linux.h, s/hiuxmpp.h,
s/hpux.h, s/iris3-5.h, s/iris3-6.h, s/irix3-3.h, s/osf1.h, s/rtu.h,
s/sunos4-1.h, s/unipl5-0.h, s/unipl5-2.h, s/usg5-0.h, s/usg5-2-2.h,
s/usg5-2.h, s/usg5-3.h, s/xenix.h:
(open, close, read, write, INTERRUPTIBLE_OPEN,
INTERRUPTIBLE_CLOSE, INTERRUPTIBLE_IO): Remove.
* s/sol2-5.h (_LARGEFILE_SOURCE, _FILE_OFFSET_BITS): New macros.
* sysdep.c (sys_read, sys_write, read, write, sys_close, close,
sys_open, open): Remove.
(emacs_open, emacs_close, emacs_read, emacs_write): Always define;
the old INTERRUPTIBLE_OPEN, INTERRUPTIBLE_CLOSE, and INTERRUPTIBLE_IO
macros are no longer used.
(emacs_open): Renamed from sys_open. Merge BSD4_1 version.
(emacs_close): Renamed from sys_close.
(emacs_read): Renamed from sys_read.
(emacs_write): Renamed from sys_write.
(sys_siglist): Do not declare if HAVE_STRSIGNAL.
(dup2): Do not print error on failure; the real dup2 doesn't.
(strsignal): New function, defined if !HAVE_STRSIGNAL.
* syssignal.h (SIGINFO): Undef if defined and if BROKEN_SIGINFO
is defined.
(SIGIO, SIGPOLL, SIGTSTP, SIGURG): Likewise.
(NSIG): If less than NSIG_MINIMUM, define to NSIG_MINIMUM.
(strsignal): Declare if !HAVE_STRSIGNAL.
* unexelf.c (ElfBitsW, ELFSIZE, ElfExpandBitsW): New macros.
(ElfW): Define in terms of ElfExpandBitsW.
* w32proc.c (sys_siglist): Remove decl.
* xdisp.c (decode_mode_spec): 3rd arg is int, not char, to comply
with ANSI C.
(display_string): Declare face_string_pos arg.
* xfns.c (Fx_show_tip): Declare timeout param.
* xterm.c: No need to include locale.h.
(x_alloc_lighter_color, x_setup_relief_color):
Pass arg as double, not float, for compatibility with ANSI C.
(fixup_locale): Move to emacs.c.
(x_term_init): Do not setlocale or fixup locale; the main program
does this now.
1999-10-19 07:25:11 +00:00
|
|
|
|
/* I wonder if emacs_close (emacs_open (pty_name, ...))
|
|
|
|
|
would work? */
|
1992-03-14 20:40:04 +00:00
|
|
|
|
if (xforkin >= 0)
|
Add support for large files, 64-bit Solaris, system locale codings.
* Makefile.in (emacs): Set the LC_ALL environment variable to "C"
when dumping, so that the dumped Emacs doesn't have stray locale info.
(dired.o): Depend on systime.h.
(editfns.o): Depend on coding.h.
* alloc.c, buffer.c, callproc.c, ccl.c, charset.c, coding.c, data.c,
dispnew.c, editfns.c, emacs.c, filelock.c, floatfns.c, hftctl.c,
keyboard.c, process.c, sysdep.c, unexelf.c, unexhp9k800.c,
unexsunos4.c, vmsfns.c, vmsgmalloc.c, w32faces.c, w32menu.c, w32term.c,
w32xfns.c, xfaces.c, xfns.c, xmenu.c, xterm.c:
Include <config.h> before any system include files.
* alloc.c, buffer.c, ccl.c, data.c, editfns.c, emacs.c, eval.c,
fileio.c, filelock.c, frame.c, insdel.c, keymap.c, lread.c,
m/alpha.h, print.c, search.c, sysdep.c, xdisp.c, xfaces.c, xfns.c,
xmenu.c, xterm.c:
Do not include <stdlib.h>, as <config.h> does this now.
* callproc.c (Fcall_process):
Synchronize messages locale before invoking strerror.
Decode resulting string with locale-coding-system.
* coding.c (Vlocale_coding_system): New var.
(syms_of_coding): Adjust to above change.
(emacs_strerror): New function.
* coding.h (emacs_strerror, Vlocale_coding_system): New decls.
* config.in (HAVE_STDIO_EXT_H, HAVE_TM_GMTOFF, HAVE___FPENDING,
HAVE_FTELLO, HAVE_GETLOADAVG, HAVE_MBLEN, HAVE_MBRLEN,
HAVE_STRSIGNAL): New macros.
(BITS_PER_LONG): Default to 64 if _LP64 is defined.
<stdlib.h>: Include if HAVE_STDLIB_H is defined and NOT_C_CODE isn't.
* dired.c: Include "systime.h".
(Ffile_attributes): Do not cast s.st_size to int; this loses
information if int is 32 bits but st_size and EMACS_INT are larger.
Treat large device numbers like large inode numbers.
* dispnew.c (PENDING_OUTPUT_COUNT): Use __fpending if available.
* editfns.c: Include coding.h.
(emacs_strftime): Remove decl.
(emacs_strftimeu): New decl.
(emacs_memftimeu): Renamed from emacs_memftime; new arg UT.
Use emacs_strftimeu instead of emacs_strftime.
(Fformat_time_string): Convert format string using
Vlocale_coding_system, and convert result back. Synchronize time
locale before invoking lower level function. Invoke
emacs_memftimeu, passing ut, instead of emacs_memftime.
* emacs.c: Include <locale.h> if HAVE_SETLOCALE is defined.
(Vmessages_locale, Vprevious_messages_locale, Vtime_locale,
Vprevious_time_locale): New variables.
(main): Invoke setlocale early, so that initial error messages are
localized properly. But skip locale-setting if LC_ALL is "C".
Fix up locale when it's safe to do so.
(fixup_locale): Moved here from xterm.c.
(synchronize_locale, synchronize_time_locale,
synchronize_messages_locale): New functions.
(syms_of_emacs): Accommodate above changes.
* fileio.c (report_file_error): Convert strerror output according
to Vlocale_coding_system.
(Finsert_file_contents): Check for arithmetic overflow in
computations that depend on file size. Report IO errors
with emacs_strerror, not strerror.
* fns.c (Fgethash): Declare dflt parameter.
* gmalloc.c: Do not define const to nothing if HAVE_CONFIG_H
is defined; that's config.h's job.
* lisp.h (EMACS_INT, BITS_PER_EMACS_INT, EMACS_UINT): If _LP64,
default these values to long, BITS_PER_LONG, and unsigned long.
(VALBITS, MARKBIT, XINT): Do not assume 32-bit EMACS_INT.
(PNTR_COMPARISON_TYPE): Default to EMACS_UINT, not to unsigned int.
(code_convert_string_norecord, fixup_locale,
synchronize_messages_locale, synchronize_time_locale,
emacs_open, emacs_close, emacs_read, emacs_write): New decls.
All Emacs callers of open, close, read, write changed to use
emacs_open, emacs_close, emacs_read, emacs_write.
* lread.c (file_offset, file_tell): New macros. All uses of ftell
changed to file_tell.
(saved_doc_string_position, prev_saved_doc_string_position): Now
of type file_offset.
(init_lread): Do not fix locale here; fixup_locale now does this.
* m/amdahl.h, s/usg5-4.h:
(NSIG): Remove.
(NSIG_MINIMUM): New macro.
* m/cydra5.h, m/dpx2.h, m/mips.h, m/pfa50.h, m/sps7.h, m/stride.h,
m/ustation.h, s/gnu-linux.h, s/hpux.h, s/iris3-5.h, s/iris3-6.h,
s/umips.h, s/usg5-4.h:
(SIGIO): Do not undef.
(BROKEN_SIGIO): New macro.
* m/ustation.h:
(SIGTSTP): Do not undef.
(BROKEN_SIGTSTP): New macro.
* s/gnu-linux.h:
(SIGPOLL, SIGURG): Do not undef.
(BROKEN_SIGPOLL, BROKEN_SIGURG): New macros.
* s/ptx4.h:
(SIGINFO): Do not undef.
(BROKEN_SIGINFO): New macros.
* m/delta.h, s/ptx.h, s/template.h: Doc fix.
* mktime.c, strftime.c: Update to glibc 2.1.2 version, with
some Emacs-related changes merged.
* print.c (float_to_string): Prepend "-" to representation of a
NaN if the NaN is negative.
* process.c (sys_siglist): Omit if HAVE_STRSIGNAL.
(wait_reading_process_input): Use emacs_strerror, not strerror.
* process.c (status_message, sigchld_handler): Synchronize locale,
then use strsignal istead of sys_siglist.
* w32proc.c (sys_wait): Likewise.
* s/aix3-1.h, s/bsd4-1.h, s/dgux.h, s/gnu-linux.h, s/hiuxmpp.h,
s/hpux.h, s/iris3-5.h, s/iris3-6.h, s/irix3-3.h, s/osf1.h, s/rtu.h,
s/sunos4-1.h, s/unipl5-0.h, s/unipl5-2.h, s/usg5-0.h, s/usg5-2-2.h,
s/usg5-2.h, s/usg5-3.h, s/xenix.h:
(open, close, read, write, INTERRUPTIBLE_OPEN,
INTERRUPTIBLE_CLOSE, INTERRUPTIBLE_IO): Remove.
* s/sol2-5.h (_LARGEFILE_SOURCE, _FILE_OFFSET_BITS): New macros.
* sysdep.c (sys_read, sys_write, read, write, sys_close, close,
sys_open, open): Remove.
(emacs_open, emacs_close, emacs_read, emacs_write): Always define;
the old INTERRUPTIBLE_OPEN, INTERRUPTIBLE_CLOSE, and INTERRUPTIBLE_IO
macros are no longer used.
(emacs_open): Renamed from sys_open. Merge BSD4_1 version.
(emacs_close): Renamed from sys_close.
(emacs_read): Renamed from sys_read.
(emacs_write): Renamed from sys_write.
(sys_siglist): Do not declare if HAVE_STRSIGNAL.
(dup2): Do not print error on failure; the real dup2 doesn't.
(strsignal): New function, defined if !HAVE_STRSIGNAL.
* syssignal.h (SIGINFO): Undef if defined and if BROKEN_SIGINFO
is defined.
(SIGIO, SIGPOLL, SIGTSTP, SIGURG): Likewise.
(NSIG): If less than NSIG_MINIMUM, define to NSIG_MINIMUM.
(strsignal): Declare if !HAVE_STRSIGNAL.
* unexelf.c (ElfBitsW, ELFSIZE, ElfExpandBitsW): New macros.
(ElfW): Define in terms of ElfExpandBitsW.
* w32proc.c (sys_siglist): Remove decl.
* xdisp.c (decode_mode_spec): 3rd arg is int, not char, to comply
with ANSI C.
(display_string): Declare face_string_pos arg.
* xfns.c (Fx_show_tip): Declare timeout param.
* xterm.c: No need to include locale.h.
(x_alloc_lighter_color, x_setup_relief_color):
Pass arg as double, not float, for compatibility with ANSI C.
(fixup_locale): Move to emacs.c.
(x_term_init): Do not setlocale or fixup locale; the main program
does this now.
1999-10-19 07:25:11 +00:00
|
|
|
|
emacs_close (xforkin);
|
|
|
|
|
xforkout = xforkin = emacs_open (pty_name, O_RDWR, 0);
|
1992-03-14 20:40:04 +00:00
|
|
|
|
|
1995-04-24 05:52:11 +00:00
|
|
|
|
if (xforkin < 0)
|
|
|
|
|
{
|
Add support for large files, 64-bit Solaris, system locale codings.
* Makefile.in (emacs): Set the LC_ALL environment variable to "C"
when dumping, so that the dumped Emacs doesn't have stray locale info.
(dired.o): Depend on systime.h.
(editfns.o): Depend on coding.h.
* alloc.c, buffer.c, callproc.c, ccl.c, charset.c, coding.c, data.c,
dispnew.c, editfns.c, emacs.c, filelock.c, floatfns.c, hftctl.c,
keyboard.c, process.c, sysdep.c, unexelf.c, unexhp9k800.c,
unexsunos4.c, vmsfns.c, vmsgmalloc.c, w32faces.c, w32menu.c, w32term.c,
w32xfns.c, xfaces.c, xfns.c, xmenu.c, xterm.c:
Include <config.h> before any system include files.
* alloc.c, buffer.c, ccl.c, data.c, editfns.c, emacs.c, eval.c,
fileio.c, filelock.c, frame.c, insdel.c, keymap.c, lread.c,
m/alpha.h, print.c, search.c, sysdep.c, xdisp.c, xfaces.c, xfns.c,
xmenu.c, xterm.c:
Do not include <stdlib.h>, as <config.h> does this now.
* callproc.c (Fcall_process):
Synchronize messages locale before invoking strerror.
Decode resulting string with locale-coding-system.
* coding.c (Vlocale_coding_system): New var.
(syms_of_coding): Adjust to above change.
(emacs_strerror): New function.
* coding.h (emacs_strerror, Vlocale_coding_system): New decls.
* config.in (HAVE_STDIO_EXT_H, HAVE_TM_GMTOFF, HAVE___FPENDING,
HAVE_FTELLO, HAVE_GETLOADAVG, HAVE_MBLEN, HAVE_MBRLEN,
HAVE_STRSIGNAL): New macros.
(BITS_PER_LONG): Default to 64 if _LP64 is defined.
<stdlib.h>: Include if HAVE_STDLIB_H is defined and NOT_C_CODE isn't.
* dired.c: Include "systime.h".
(Ffile_attributes): Do not cast s.st_size to int; this loses
information if int is 32 bits but st_size and EMACS_INT are larger.
Treat large device numbers like large inode numbers.
* dispnew.c (PENDING_OUTPUT_COUNT): Use __fpending if available.
* editfns.c: Include coding.h.
(emacs_strftime): Remove decl.
(emacs_strftimeu): New decl.
(emacs_memftimeu): Renamed from emacs_memftime; new arg UT.
Use emacs_strftimeu instead of emacs_strftime.
(Fformat_time_string): Convert format string using
Vlocale_coding_system, and convert result back. Synchronize time
locale before invoking lower level function. Invoke
emacs_memftimeu, passing ut, instead of emacs_memftime.
* emacs.c: Include <locale.h> if HAVE_SETLOCALE is defined.
(Vmessages_locale, Vprevious_messages_locale, Vtime_locale,
Vprevious_time_locale): New variables.
(main): Invoke setlocale early, so that initial error messages are
localized properly. But skip locale-setting if LC_ALL is "C".
Fix up locale when it's safe to do so.
(fixup_locale): Moved here from xterm.c.
(synchronize_locale, synchronize_time_locale,
synchronize_messages_locale): New functions.
(syms_of_emacs): Accommodate above changes.
* fileio.c (report_file_error): Convert strerror output according
to Vlocale_coding_system.
(Finsert_file_contents): Check for arithmetic overflow in
computations that depend on file size. Report IO errors
with emacs_strerror, not strerror.
* fns.c (Fgethash): Declare dflt parameter.
* gmalloc.c: Do not define const to nothing if HAVE_CONFIG_H
is defined; that's config.h's job.
* lisp.h (EMACS_INT, BITS_PER_EMACS_INT, EMACS_UINT): If _LP64,
default these values to long, BITS_PER_LONG, and unsigned long.
(VALBITS, MARKBIT, XINT): Do not assume 32-bit EMACS_INT.
(PNTR_COMPARISON_TYPE): Default to EMACS_UINT, not to unsigned int.
(code_convert_string_norecord, fixup_locale,
synchronize_messages_locale, synchronize_time_locale,
emacs_open, emacs_close, emacs_read, emacs_write): New decls.
All Emacs callers of open, close, read, write changed to use
emacs_open, emacs_close, emacs_read, emacs_write.
* lread.c (file_offset, file_tell): New macros. All uses of ftell
changed to file_tell.
(saved_doc_string_position, prev_saved_doc_string_position): Now
of type file_offset.
(init_lread): Do not fix locale here; fixup_locale now does this.
* m/amdahl.h, s/usg5-4.h:
(NSIG): Remove.
(NSIG_MINIMUM): New macro.
* m/cydra5.h, m/dpx2.h, m/mips.h, m/pfa50.h, m/sps7.h, m/stride.h,
m/ustation.h, s/gnu-linux.h, s/hpux.h, s/iris3-5.h, s/iris3-6.h,
s/umips.h, s/usg5-4.h:
(SIGIO): Do not undef.
(BROKEN_SIGIO): New macro.
* m/ustation.h:
(SIGTSTP): Do not undef.
(BROKEN_SIGTSTP): New macro.
* s/gnu-linux.h:
(SIGPOLL, SIGURG): Do not undef.
(BROKEN_SIGPOLL, BROKEN_SIGURG): New macros.
* s/ptx4.h:
(SIGINFO): Do not undef.
(BROKEN_SIGINFO): New macros.
* m/delta.h, s/ptx.h, s/template.h: Doc fix.
* mktime.c, strftime.c: Update to glibc 2.1.2 version, with
some Emacs-related changes merged.
* print.c (float_to_string): Prepend "-" to representation of a
NaN if the NaN is negative.
* process.c (sys_siglist): Omit if HAVE_STRSIGNAL.
(wait_reading_process_input): Use emacs_strerror, not strerror.
* process.c (status_message, sigchld_handler): Synchronize locale,
then use strsignal istead of sys_siglist.
* w32proc.c (sys_wait): Likewise.
* s/aix3-1.h, s/bsd4-1.h, s/dgux.h, s/gnu-linux.h, s/hiuxmpp.h,
s/hpux.h, s/iris3-5.h, s/iris3-6.h, s/irix3-3.h, s/osf1.h, s/rtu.h,
s/sunos4-1.h, s/unipl5-0.h, s/unipl5-2.h, s/usg5-0.h, s/usg5-2-2.h,
s/usg5-2.h, s/usg5-3.h, s/xenix.h:
(open, close, read, write, INTERRUPTIBLE_OPEN,
INTERRUPTIBLE_CLOSE, INTERRUPTIBLE_IO): Remove.
* s/sol2-5.h (_LARGEFILE_SOURCE, _FILE_OFFSET_BITS): New macros.
* sysdep.c (sys_read, sys_write, read, write, sys_close, close,
sys_open, open): Remove.
(emacs_open, emacs_close, emacs_read, emacs_write): Always define;
the old INTERRUPTIBLE_OPEN, INTERRUPTIBLE_CLOSE, and INTERRUPTIBLE_IO
macros are no longer used.
(emacs_open): Renamed from sys_open. Merge BSD4_1 version.
(emacs_close): Renamed from sys_close.
(emacs_read): Renamed from sys_read.
(emacs_write): Renamed from sys_write.
(sys_siglist): Do not declare if HAVE_STRSIGNAL.
(dup2): Do not print error on failure; the real dup2 doesn't.
(strsignal): New function, defined if !HAVE_STRSIGNAL.
* syssignal.h (SIGINFO): Undef if defined and if BROKEN_SIGINFO
is defined.
(SIGIO, SIGPOLL, SIGTSTP, SIGURG): Likewise.
(NSIG): If less than NSIG_MINIMUM, define to NSIG_MINIMUM.
(strsignal): Declare if !HAVE_STRSIGNAL.
* unexelf.c (ElfBitsW, ELFSIZE, ElfExpandBitsW): New macros.
(ElfW): Define in terms of ElfExpandBitsW.
* w32proc.c (sys_siglist): Remove decl.
* xdisp.c (decode_mode_spec): 3rd arg is int, not char, to comply
with ANSI C.
(display_string): Declare face_string_pos arg.
* xfns.c (Fx_show_tip): Declare timeout param.
* xterm.c: No need to include locale.h.
(x_alloc_lighter_color, x_setup_relief_color):
Pass arg as double, not float, for compatibility with ANSI C.
(fixup_locale): Move to emacs.c.
(x_term_init): Do not setlocale or fixup locale; the main program
does this now.
1999-10-19 07:25:11 +00:00
|
|
|
|
emacs_write (1, "Couldn't open the pty terminal ", 31);
|
|
|
|
|
emacs_write (1, pty_name, strlen (pty_name));
|
|
|
|
|
emacs_write (1, "\n", 1);
|
1995-04-24 05:52:11 +00:00
|
|
|
|
_exit (1);
|
|
|
|
|
}
|
|
|
|
|
|
1992-03-14 20:40:04 +00:00
|
|
|
|
}
|
2008-01-13 00:43:55 +00:00
|
|
|
|
#endif /* not DONT_REOPEN_PTY */
|
1996-06-09 20:15:20 +00:00
|
|
|
|
|
1992-03-14 20:40:04 +00:00
|
|
|
|
#ifdef SETUP_SLAVE_PTY
|
1994-04-24 03:06:55 +00:00
|
|
|
|
if (pty_flag)
|
|
|
|
|
{
|
|
|
|
|
SETUP_SLAVE_PTY;
|
|
|
|
|
}
|
1992-03-14 20:40:04 +00:00
|
|
|
|
#endif /* SETUP_SLAVE_PTY */
|
|
|
|
|
#ifdef AIX
|
|
|
|
|
/* On AIX, we've disabled SIGHUP above once we start a child on a pty.
|
|
|
|
|
Now reenable it in the child, so it will die when we want it to. */
|
|
|
|
|
if (pty_flag)
|
|
|
|
|
signal (SIGHUP, SIG_DFL);
|
|
|
|
|
#endif
|
|
|
|
|
#endif /* HAVE_PTYS */
|
|
|
|
|
|
1995-12-13 01:52:07 +00:00
|
|
|
|
signal (SIGINT, SIG_DFL);
|
|
|
|
|
signal (SIGQUIT, SIG_DFL);
|
|
|
|
|
|
|
|
|
|
/* Stop blocking signals in the child. */
|
|
|
|
|
sigprocmask (SIG_SETMASK, &procmask, 0);
|
1994-07-31 00:00:24 +00:00
|
|
|
|
|
1994-04-24 03:10:24 +00:00
|
|
|
|
if (pty_flag)
|
|
|
|
|
child_setup_tty (xforkout);
|
1994-11-01 08:31:31 +00:00
|
|
|
|
#ifdef WINDOWSNT
|
|
|
|
|
pid = child_setup (xforkin, xforkout, xforkout,
|
|
|
|
|
new_argv, 1, current_dir);
|
2003-02-04 14:56:31 +00:00
|
|
|
|
#else /* not WINDOWSNT */
|
2008-07-17 09:06:58 +00:00
|
|
|
|
#ifdef FD_CLOEXEC
|
|
|
|
|
emacs_close (wait_child_setup[0]);
|
|
|
|
|
#endif
|
1992-03-14 20:40:04 +00:00
|
|
|
|
child_setup (xforkin, xforkout, xforkout,
|
1992-05-10 18:15:10 +00:00
|
|
|
|
new_argv, 1, current_dir);
|
1994-11-01 08:31:31 +00:00
|
|
|
|
#endif /* not WINDOWSNT */
|
1992-03-14 20:40:04 +00:00
|
|
|
|
}
|
|
|
|
|
environ = save_environ;
|
|
|
|
|
}
|
|
|
|
|
|
1996-12-30 01:26:08 +00:00
|
|
|
|
UNBLOCK_INPUT;
|
|
|
|
|
|
1996-01-09 23:40:33 +00:00
|
|
|
|
/* This runs in the Emacs process. */
|
1992-03-14 20:40:04 +00:00
|
|
|
|
if (pid < 0)
|
1994-04-28 04:35:39 +00:00
|
|
|
|
{
|
|
|
|
|
if (forkin >= 0)
|
Add support for large files, 64-bit Solaris, system locale codings.
* Makefile.in (emacs): Set the LC_ALL environment variable to "C"
when dumping, so that the dumped Emacs doesn't have stray locale info.
(dired.o): Depend on systime.h.
(editfns.o): Depend on coding.h.
* alloc.c, buffer.c, callproc.c, ccl.c, charset.c, coding.c, data.c,
dispnew.c, editfns.c, emacs.c, filelock.c, floatfns.c, hftctl.c,
keyboard.c, process.c, sysdep.c, unexelf.c, unexhp9k800.c,
unexsunos4.c, vmsfns.c, vmsgmalloc.c, w32faces.c, w32menu.c, w32term.c,
w32xfns.c, xfaces.c, xfns.c, xmenu.c, xterm.c:
Include <config.h> before any system include files.
* alloc.c, buffer.c, ccl.c, data.c, editfns.c, emacs.c, eval.c,
fileio.c, filelock.c, frame.c, insdel.c, keymap.c, lread.c,
m/alpha.h, print.c, search.c, sysdep.c, xdisp.c, xfaces.c, xfns.c,
xmenu.c, xterm.c:
Do not include <stdlib.h>, as <config.h> does this now.
* callproc.c (Fcall_process):
Synchronize messages locale before invoking strerror.
Decode resulting string with locale-coding-system.
* coding.c (Vlocale_coding_system): New var.
(syms_of_coding): Adjust to above change.
(emacs_strerror): New function.
* coding.h (emacs_strerror, Vlocale_coding_system): New decls.
* config.in (HAVE_STDIO_EXT_H, HAVE_TM_GMTOFF, HAVE___FPENDING,
HAVE_FTELLO, HAVE_GETLOADAVG, HAVE_MBLEN, HAVE_MBRLEN,
HAVE_STRSIGNAL): New macros.
(BITS_PER_LONG): Default to 64 if _LP64 is defined.
<stdlib.h>: Include if HAVE_STDLIB_H is defined and NOT_C_CODE isn't.
* dired.c: Include "systime.h".
(Ffile_attributes): Do not cast s.st_size to int; this loses
information if int is 32 bits but st_size and EMACS_INT are larger.
Treat large device numbers like large inode numbers.
* dispnew.c (PENDING_OUTPUT_COUNT): Use __fpending if available.
* editfns.c: Include coding.h.
(emacs_strftime): Remove decl.
(emacs_strftimeu): New decl.
(emacs_memftimeu): Renamed from emacs_memftime; new arg UT.
Use emacs_strftimeu instead of emacs_strftime.
(Fformat_time_string): Convert format string using
Vlocale_coding_system, and convert result back. Synchronize time
locale before invoking lower level function. Invoke
emacs_memftimeu, passing ut, instead of emacs_memftime.
* emacs.c: Include <locale.h> if HAVE_SETLOCALE is defined.
(Vmessages_locale, Vprevious_messages_locale, Vtime_locale,
Vprevious_time_locale): New variables.
(main): Invoke setlocale early, so that initial error messages are
localized properly. But skip locale-setting if LC_ALL is "C".
Fix up locale when it's safe to do so.
(fixup_locale): Moved here from xterm.c.
(synchronize_locale, synchronize_time_locale,
synchronize_messages_locale): New functions.
(syms_of_emacs): Accommodate above changes.
* fileio.c (report_file_error): Convert strerror output according
to Vlocale_coding_system.
(Finsert_file_contents): Check for arithmetic overflow in
computations that depend on file size. Report IO errors
with emacs_strerror, not strerror.
* fns.c (Fgethash): Declare dflt parameter.
* gmalloc.c: Do not define const to nothing if HAVE_CONFIG_H
is defined; that's config.h's job.
* lisp.h (EMACS_INT, BITS_PER_EMACS_INT, EMACS_UINT): If _LP64,
default these values to long, BITS_PER_LONG, and unsigned long.
(VALBITS, MARKBIT, XINT): Do not assume 32-bit EMACS_INT.
(PNTR_COMPARISON_TYPE): Default to EMACS_UINT, not to unsigned int.
(code_convert_string_norecord, fixup_locale,
synchronize_messages_locale, synchronize_time_locale,
emacs_open, emacs_close, emacs_read, emacs_write): New decls.
All Emacs callers of open, close, read, write changed to use
emacs_open, emacs_close, emacs_read, emacs_write.
* lread.c (file_offset, file_tell): New macros. All uses of ftell
changed to file_tell.
(saved_doc_string_position, prev_saved_doc_string_position): Now
of type file_offset.
(init_lread): Do not fix locale here; fixup_locale now does this.
* m/amdahl.h, s/usg5-4.h:
(NSIG): Remove.
(NSIG_MINIMUM): New macro.
* m/cydra5.h, m/dpx2.h, m/mips.h, m/pfa50.h, m/sps7.h, m/stride.h,
m/ustation.h, s/gnu-linux.h, s/hpux.h, s/iris3-5.h, s/iris3-6.h,
s/umips.h, s/usg5-4.h:
(SIGIO): Do not undef.
(BROKEN_SIGIO): New macro.
* m/ustation.h:
(SIGTSTP): Do not undef.
(BROKEN_SIGTSTP): New macro.
* s/gnu-linux.h:
(SIGPOLL, SIGURG): Do not undef.
(BROKEN_SIGPOLL, BROKEN_SIGURG): New macros.
* s/ptx4.h:
(SIGINFO): Do not undef.
(BROKEN_SIGINFO): New macros.
* m/delta.h, s/ptx.h, s/template.h: Doc fix.
* mktime.c, strftime.c: Update to glibc 2.1.2 version, with
some Emacs-related changes merged.
* print.c (float_to_string): Prepend "-" to representation of a
NaN if the NaN is negative.
* process.c (sys_siglist): Omit if HAVE_STRSIGNAL.
(wait_reading_process_input): Use emacs_strerror, not strerror.
* process.c (status_message, sigchld_handler): Synchronize locale,
then use strsignal istead of sys_siglist.
* w32proc.c (sys_wait): Likewise.
* s/aix3-1.h, s/bsd4-1.h, s/dgux.h, s/gnu-linux.h, s/hiuxmpp.h,
s/hpux.h, s/iris3-5.h, s/iris3-6.h, s/irix3-3.h, s/osf1.h, s/rtu.h,
s/sunos4-1.h, s/unipl5-0.h, s/unipl5-2.h, s/usg5-0.h, s/usg5-2-2.h,
s/usg5-2.h, s/usg5-3.h, s/xenix.h:
(open, close, read, write, INTERRUPTIBLE_OPEN,
INTERRUPTIBLE_CLOSE, INTERRUPTIBLE_IO): Remove.
* s/sol2-5.h (_LARGEFILE_SOURCE, _FILE_OFFSET_BITS): New macros.
* sysdep.c (sys_read, sys_write, read, write, sys_close, close,
sys_open, open): Remove.
(emacs_open, emacs_close, emacs_read, emacs_write): Always define;
the old INTERRUPTIBLE_OPEN, INTERRUPTIBLE_CLOSE, and INTERRUPTIBLE_IO
macros are no longer used.
(emacs_open): Renamed from sys_open. Merge BSD4_1 version.
(emacs_close): Renamed from sys_close.
(emacs_read): Renamed from sys_read.
(emacs_write): Renamed from sys_write.
(sys_siglist): Do not declare if HAVE_STRSIGNAL.
(dup2): Do not print error on failure; the real dup2 doesn't.
(strsignal): New function, defined if !HAVE_STRSIGNAL.
* syssignal.h (SIGINFO): Undef if defined and if BROKEN_SIGINFO
is defined.
(SIGIO, SIGPOLL, SIGTSTP, SIGURG): Likewise.
(NSIG): If less than NSIG_MINIMUM, define to NSIG_MINIMUM.
(strsignal): Declare if !HAVE_STRSIGNAL.
* unexelf.c (ElfBitsW, ELFSIZE, ElfExpandBitsW): New macros.
(ElfW): Define in terms of ElfExpandBitsW.
* w32proc.c (sys_siglist): Remove decl.
* xdisp.c (decode_mode_spec): 3rd arg is int, not char, to comply
with ANSI C.
(display_string): Declare face_string_pos arg.
* xfns.c (Fx_show_tip): Declare timeout param.
* xterm.c: No need to include locale.h.
(x_alloc_lighter_color, x_setup_relief_color):
Pass arg as double, not float, for compatibility with ANSI C.
(fixup_locale): Move to emacs.c.
(x_term_init): Do not setlocale or fixup locale; the main program
does this now.
1999-10-19 07:25:11 +00:00
|
|
|
|
emacs_close (forkin);
|
1994-04-28 04:35:39 +00:00
|
|
|
|
if (forkin != forkout && forkout >= 0)
|
Add support for large files, 64-bit Solaris, system locale codings.
* Makefile.in (emacs): Set the LC_ALL environment variable to "C"
when dumping, so that the dumped Emacs doesn't have stray locale info.
(dired.o): Depend on systime.h.
(editfns.o): Depend on coding.h.
* alloc.c, buffer.c, callproc.c, ccl.c, charset.c, coding.c, data.c,
dispnew.c, editfns.c, emacs.c, filelock.c, floatfns.c, hftctl.c,
keyboard.c, process.c, sysdep.c, unexelf.c, unexhp9k800.c,
unexsunos4.c, vmsfns.c, vmsgmalloc.c, w32faces.c, w32menu.c, w32term.c,
w32xfns.c, xfaces.c, xfns.c, xmenu.c, xterm.c:
Include <config.h> before any system include files.
* alloc.c, buffer.c, ccl.c, data.c, editfns.c, emacs.c, eval.c,
fileio.c, filelock.c, frame.c, insdel.c, keymap.c, lread.c,
m/alpha.h, print.c, search.c, sysdep.c, xdisp.c, xfaces.c, xfns.c,
xmenu.c, xterm.c:
Do not include <stdlib.h>, as <config.h> does this now.
* callproc.c (Fcall_process):
Synchronize messages locale before invoking strerror.
Decode resulting string with locale-coding-system.
* coding.c (Vlocale_coding_system): New var.
(syms_of_coding): Adjust to above change.
(emacs_strerror): New function.
* coding.h (emacs_strerror, Vlocale_coding_system): New decls.
* config.in (HAVE_STDIO_EXT_H, HAVE_TM_GMTOFF, HAVE___FPENDING,
HAVE_FTELLO, HAVE_GETLOADAVG, HAVE_MBLEN, HAVE_MBRLEN,
HAVE_STRSIGNAL): New macros.
(BITS_PER_LONG): Default to 64 if _LP64 is defined.
<stdlib.h>: Include if HAVE_STDLIB_H is defined and NOT_C_CODE isn't.
* dired.c: Include "systime.h".
(Ffile_attributes): Do not cast s.st_size to int; this loses
information if int is 32 bits but st_size and EMACS_INT are larger.
Treat large device numbers like large inode numbers.
* dispnew.c (PENDING_OUTPUT_COUNT): Use __fpending if available.
* editfns.c: Include coding.h.
(emacs_strftime): Remove decl.
(emacs_strftimeu): New decl.
(emacs_memftimeu): Renamed from emacs_memftime; new arg UT.
Use emacs_strftimeu instead of emacs_strftime.
(Fformat_time_string): Convert format string using
Vlocale_coding_system, and convert result back. Synchronize time
locale before invoking lower level function. Invoke
emacs_memftimeu, passing ut, instead of emacs_memftime.
* emacs.c: Include <locale.h> if HAVE_SETLOCALE is defined.
(Vmessages_locale, Vprevious_messages_locale, Vtime_locale,
Vprevious_time_locale): New variables.
(main): Invoke setlocale early, so that initial error messages are
localized properly. But skip locale-setting if LC_ALL is "C".
Fix up locale when it's safe to do so.
(fixup_locale): Moved here from xterm.c.
(synchronize_locale, synchronize_time_locale,
synchronize_messages_locale): New functions.
(syms_of_emacs): Accommodate above changes.
* fileio.c (report_file_error): Convert strerror output according
to Vlocale_coding_system.
(Finsert_file_contents): Check for arithmetic overflow in
computations that depend on file size. Report IO errors
with emacs_strerror, not strerror.
* fns.c (Fgethash): Declare dflt parameter.
* gmalloc.c: Do not define const to nothing if HAVE_CONFIG_H
is defined; that's config.h's job.
* lisp.h (EMACS_INT, BITS_PER_EMACS_INT, EMACS_UINT): If _LP64,
default these values to long, BITS_PER_LONG, and unsigned long.
(VALBITS, MARKBIT, XINT): Do not assume 32-bit EMACS_INT.
(PNTR_COMPARISON_TYPE): Default to EMACS_UINT, not to unsigned int.
(code_convert_string_norecord, fixup_locale,
synchronize_messages_locale, synchronize_time_locale,
emacs_open, emacs_close, emacs_read, emacs_write): New decls.
All Emacs callers of open, close, read, write changed to use
emacs_open, emacs_close, emacs_read, emacs_write.
* lread.c (file_offset, file_tell): New macros. All uses of ftell
changed to file_tell.
(saved_doc_string_position, prev_saved_doc_string_position): Now
of type file_offset.
(init_lread): Do not fix locale here; fixup_locale now does this.
* m/amdahl.h, s/usg5-4.h:
(NSIG): Remove.
(NSIG_MINIMUM): New macro.
* m/cydra5.h, m/dpx2.h, m/mips.h, m/pfa50.h, m/sps7.h, m/stride.h,
m/ustation.h, s/gnu-linux.h, s/hpux.h, s/iris3-5.h, s/iris3-6.h,
s/umips.h, s/usg5-4.h:
(SIGIO): Do not undef.
(BROKEN_SIGIO): New macro.
* m/ustation.h:
(SIGTSTP): Do not undef.
(BROKEN_SIGTSTP): New macro.
* s/gnu-linux.h:
(SIGPOLL, SIGURG): Do not undef.
(BROKEN_SIGPOLL, BROKEN_SIGURG): New macros.
* s/ptx4.h:
(SIGINFO): Do not undef.
(BROKEN_SIGINFO): New macros.
* m/delta.h, s/ptx.h, s/template.h: Doc fix.
* mktime.c, strftime.c: Update to glibc 2.1.2 version, with
some Emacs-related changes merged.
* print.c (float_to_string): Prepend "-" to representation of a
NaN if the NaN is negative.
* process.c (sys_siglist): Omit if HAVE_STRSIGNAL.
(wait_reading_process_input): Use emacs_strerror, not strerror.
* process.c (status_message, sigchld_handler): Synchronize locale,
then use strsignal istead of sys_siglist.
* w32proc.c (sys_wait): Likewise.
* s/aix3-1.h, s/bsd4-1.h, s/dgux.h, s/gnu-linux.h, s/hiuxmpp.h,
s/hpux.h, s/iris3-5.h, s/iris3-6.h, s/irix3-3.h, s/osf1.h, s/rtu.h,
s/sunos4-1.h, s/unipl5-0.h, s/unipl5-2.h, s/usg5-0.h, s/usg5-2-2.h,
s/usg5-2.h, s/usg5-3.h, s/xenix.h:
(open, close, read, write, INTERRUPTIBLE_OPEN,
INTERRUPTIBLE_CLOSE, INTERRUPTIBLE_IO): Remove.
* s/sol2-5.h (_LARGEFILE_SOURCE, _FILE_OFFSET_BITS): New macros.
* sysdep.c (sys_read, sys_write, read, write, sys_close, close,
sys_open, open): Remove.
(emacs_open, emacs_close, emacs_read, emacs_write): Always define;
the old INTERRUPTIBLE_OPEN, INTERRUPTIBLE_CLOSE, and INTERRUPTIBLE_IO
macros are no longer used.
(emacs_open): Renamed from sys_open. Merge BSD4_1 version.
(emacs_close): Renamed from sys_close.
(emacs_read): Renamed from sys_read.
(emacs_write): Renamed from sys_write.
(sys_siglist): Do not declare if HAVE_STRSIGNAL.
(dup2): Do not print error on failure; the real dup2 doesn't.
(strsignal): New function, defined if !HAVE_STRSIGNAL.
* syssignal.h (SIGINFO): Undef if defined and if BROKEN_SIGINFO
is defined.
(SIGIO, SIGPOLL, SIGTSTP, SIGURG): Likewise.
(NSIG): If less than NSIG_MINIMUM, define to NSIG_MINIMUM.
(strsignal): Declare if !HAVE_STRSIGNAL.
* unexelf.c (ElfBitsW, ELFSIZE, ElfExpandBitsW): New macros.
(ElfW): Define in terms of ElfExpandBitsW.
* w32proc.c (sys_siglist): Remove decl.
* xdisp.c (decode_mode_spec): 3rd arg is int, not char, to comply
with ANSI C.
(display_string): Declare face_string_pos arg.
* xfns.c (Fx_show_tip): Declare timeout param.
* xterm.c: No need to include locale.h.
(x_alloc_lighter_color, x_setup_relief_color):
Pass arg as double, not float, for compatibility with ANSI C.
(fixup_locale): Move to emacs.c.
(x_term_init): Do not setlocale or fixup locale; the main program
does this now.
1999-10-19 07:25:11 +00:00
|
|
|
|
emacs_close (forkout);
|
1994-04-28 04:35:39 +00:00
|
|
|
|
}
|
1996-01-09 23:40:33 +00:00
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
/* vfork succeeded. */
|
* process.h (struct Lisp_Process): Replace Lisp_Objects `pid',
`raw_status_high', and `raw_status_low' with plain integers, and move
them to the end of the structure.
* alloc.c (allocate_process): Use PSEUDOVECSIZE to initialize the
pseudovector's size field so only the Lisp_Object fields get GC'd.
* process.c (update_status, make_process, Fdelete_process)
(Fprocess_status, list_processes_1, start_process_unwind)
(create_process, Fmake_network_process, server_accept_connection)
(wait_reading_process_output, send_process, Fprocess_running_child_p)
(process_send_signal, proc_encode_coding_system, Fprocess_send_eof)
(sigchld_handler, status_notify): Adjust to new non-Lisp fields for
`pid' and `raw_status'.
(Fprocess_id, Fsignal_process): Same, and additionally use floats when
representing PIDs that are larger than most-positive-fixnum.
2006-04-08 15:07:35 +00:00
|
|
|
|
XPROCESS (process)->pid = pid;
|
1992-03-14 20:40:04 +00:00
|
|
|
|
|
1994-11-01 08:31:31 +00:00
|
|
|
|
#ifdef WINDOWSNT
|
1996-01-09 23:40:33 +00:00
|
|
|
|
register_child (pid, inchannel);
|
1994-11-01 08:31:31 +00:00
|
|
|
|
#endif /* WINDOWSNT */
|
|
|
|
|
|
1996-01-09 23:40:33 +00:00
|
|
|
|
/* If the subfork execv fails, and it exits,
|
|
|
|
|
this close hangs. I don't know why.
|
|
|
|
|
So have an interrupt jar it loose. */
|
2000-01-25 15:56:42 +00:00
|
|
|
|
{
|
|
|
|
|
struct atimer *timer;
|
|
|
|
|
EMACS_TIME offset;
|
2003-02-04 14:56:31 +00:00
|
|
|
|
|
2000-01-25 15:56:42 +00:00
|
|
|
|
stop_polling ();
|
|
|
|
|
EMACS_SET_SECS_USECS (offset, 1, 0);
|
|
|
|
|
timer = start_atimer (ATIMER_RELATIVE, offset, create_process_1, 0);
|
2003-02-04 14:56:31 +00:00
|
|
|
|
|
2000-01-25 15:56:42 +00:00
|
|
|
|
if (forkin >= 0)
|
|
|
|
|
emacs_close (forkin);
|
|
|
|
|
|
|
|
|
|
cancel_atimer (timer);
|
|
|
|
|
start_polling ();
|
|
|
|
|
}
|
2003-02-04 14:56:31 +00:00
|
|
|
|
|
1996-01-09 23:40:33 +00:00
|
|
|
|
if (forkin != forkout && forkout >= 0)
|
Add support for large files, 64-bit Solaris, system locale codings.
* Makefile.in (emacs): Set the LC_ALL environment variable to "C"
when dumping, so that the dumped Emacs doesn't have stray locale info.
(dired.o): Depend on systime.h.
(editfns.o): Depend on coding.h.
* alloc.c, buffer.c, callproc.c, ccl.c, charset.c, coding.c, data.c,
dispnew.c, editfns.c, emacs.c, filelock.c, floatfns.c, hftctl.c,
keyboard.c, process.c, sysdep.c, unexelf.c, unexhp9k800.c,
unexsunos4.c, vmsfns.c, vmsgmalloc.c, w32faces.c, w32menu.c, w32term.c,
w32xfns.c, xfaces.c, xfns.c, xmenu.c, xterm.c:
Include <config.h> before any system include files.
* alloc.c, buffer.c, ccl.c, data.c, editfns.c, emacs.c, eval.c,
fileio.c, filelock.c, frame.c, insdel.c, keymap.c, lread.c,
m/alpha.h, print.c, search.c, sysdep.c, xdisp.c, xfaces.c, xfns.c,
xmenu.c, xterm.c:
Do not include <stdlib.h>, as <config.h> does this now.
* callproc.c (Fcall_process):
Synchronize messages locale before invoking strerror.
Decode resulting string with locale-coding-system.
* coding.c (Vlocale_coding_system): New var.
(syms_of_coding): Adjust to above change.
(emacs_strerror): New function.
* coding.h (emacs_strerror, Vlocale_coding_system): New decls.
* config.in (HAVE_STDIO_EXT_H, HAVE_TM_GMTOFF, HAVE___FPENDING,
HAVE_FTELLO, HAVE_GETLOADAVG, HAVE_MBLEN, HAVE_MBRLEN,
HAVE_STRSIGNAL): New macros.
(BITS_PER_LONG): Default to 64 if _LP64 is defined.
<stdlib.h>: Include if HAVE_STDLIB_H is defined and NOT_C_CODE isn't.
* dired.c: Include "systime.h".
(Ffile_attributes): Do not cast s.st_size to int; this loses
information if int is 32 bits but st_size and EMACS_INT are larger.
Treat large device numbers like large inode numbers.
* dispnew.c (PENDING_OUTPUT_COUNT): Use __fpending if available.
* editfns.c: Include coding.h.
(emacs_strftime): Remove decl.
(emacs_strftimeu): New decl.
(emacs_memftimeu): Renamed from emacs_memftime; new arg UT.
Use emacs_strftimeu instead of emacs_strftime.
(Fformat_time_string): Convert format string using
Vlocale_coding_system, and convert result back. Synchronize time
locale before invoking lower level function. Invoke
emacs_memftimeu, passing ut, instead of emacs_memftime.
* emacs.c: Include <locale.h> if HAVE_SETLOCALE is defined.
(Vmessages_locale, Vprevious_messages_locale, Vtime_locale,
Vprevious_time_locale): New variables.
(main): Invoke setlocale early, so that initial error messages are
localized properly. But skip locale-setting if LC_ALL is "C".
Fix up locale when it's safe to do so.
(fixup_locale): Moved here from xterm.c.
(synchronize_locale, synchronize_time_locale,
synchronize_messages_locale): New functions.
(syms_of_emacs): Accommodate above changes.
* fileio.c (report_file_error): Convert strerror output according
to Vlocale_coding_system.
(Finsert_file_contents): Check for arithmetic overflow in
computations that depend on file size. Report IO errors
with emacs_strerror, not strerror.
* fns.c (Fgethash): Declare dflt parameter.
* gmalloc.c: Do not define const to nothing if HAVE_CONFIG_H
is defined; that's config.h's job.
* lisp.h (EMACS_INT, BITS_PER_EMACS_INT, EMACS_UINT): If _LP64,
default these values to long, BITS_PER_LONG, and unsigned long.
(VALBITS, MARKBIT, XINT): Do not assume 32-bit EMACS_INT.
(PNTR_COMPARISON_TYPE): Default to EMACS_UINT, not to unsigned int.
(code_convert_string_norecord, fixup_locale,
synchronize_messages_locale, synchronize_time_locale,
emacs_open, emacs_close, emacs_read, emacs_write): New decls.
All Emacs callers of open, close, read, write changed to use
emacs_open, emacs_close, emacs_read, emacs_write.
* lread.c (file_offset, file_tell): New macros. All uses of ftell
changed to file_tell.
(saved_doc_string_position, prev_saved_doc_string_position): Now
of type file_offset.
(init_lread): Do not fix locale here; fixup_locale now does this.
* m/amdahl.h, s/usg5-4.h:
(NSIG): Remove.
(NSIG_MINIMUM): New macro.
* m/cydra5.h, m/dpx2.h, m/mips.h, m/pfa50.h, m/sps7.h, m/stride.h,
m/ustation.h, s/gnu-linux.h, s/hpux.h, s/iris3-5.h, s/iris3-6.h,
s/umips.h, s/usg5-4.h:
(SIGIO): Do not undef.
(BROKEN_SIGIO): New macro.
* m/ustation.h:
(SIGTSTP): Do not undef.
(BROKEN_SIGTSTP): New macro.
* s/gnu-linux.h:
(SIGPOLL, SIGURG): Do not undef.
(BROKEN_SIGPOLL, BROKEN_SIGURG): New macros.
* s/ptx4.h:
(SIGINFO): Do not undef.
(BROKEN_SIGINFO): New macros.
* m/delta.h, s/ptx.h, s/template.h: Doc fix.
* mktime.c, strftime.c: Update to glibc 2.1.2 version, with
some Emacs-related changes merged.
* print.c (float_to_string): Prepend "-" to representation of a
NaN if the NaN is negative.
* process.c (sys_siglist): Omit if HAVE_STRSIGNAL.
(wait_reading_process_input): Use emacs_strerror, not strerror.
* process.c (status_message, sigchld_handler): Synchronize locale,
then use strsignal istead of sys_siglist.
* w32proc.c (sys_wait): Likewise.
* s/aix3-1.h, s/bsd4-1.h, s/dgux.h, s/gnu-linux.h, s/hiuxmpp.h,
s/hpux.h, s/iris3-5.h, s/iris3-6.h, s/irix3-3.h, s/osf1.h, s/rtu.h,
s/sunos4-1.h, s/unipl5-0.h, s/unipl5-2.h, s/usg5-0.h, s/usg5-2-2.h,
s/usg5-2.h, s/usg5-3.h, s/xenix.h:
(open, close, read, write, INTERRUPTIBLE_OPEN,
INTERRUPTIBLE_CLOSE, INTERRUPTIBLE_IO): Remove.
* s/sol2-5.h (_LARGEFILE_SOURCE, _FILE_OFFSET_BITS): New macros.
* sysdep.c (sys_read, sys_write, read, write, sys_close, close,
sys_open, open): Remove.
(emacs_open, emacs_close, emacs_read, emacs_write): Always define;
the old INTERRUPTIBLE_OPEN, INTERRUPTIBLE_CLOSE, and INTERRUPTIBLE_IO
macros are no longer used.
(emacs_open): Renamed from sys_open. Merge BSD4_1 version.
(emacs_close): Renamed from sys_close.
(emacs_read): Renamed from sys_read.
(emacs_write): Renamed from sys_write.
(sys_siglist): Do not declare if HAVE_STRSIGNAL.
(dup2): Do not print error on failure; the real dup2 doesn't.
(strsignal): New function, defined if !HAVE_STRSIGNAL.
* syssignal.h (SIGINFO): Undef if defined and if BROKEN_SIGINFO
is defined.
(SIGIO, SIGPOLL, SIGTSTP, SIGURG): Likewise.
(NSIG): If less than NSIG_MINIMUM, define to NSIG_MINIMUM.
(strsignal): Declare if !HAVE_STRSIGNAL.
* unexelf.c (ElfBitsW, ELFSIZE, ElfExpandBitsW): New macros.
(ElfW): Define in terms of ElfExpandBitsW.
* w32proc.c (sys_siglist): Remove decl.
* xdisp.c (decode_mode_spec): 3rd arg is int, not char, to comply
with ANSI C.
(display_string): Declare face_string_pos arg.
* xfns.c (Fx_show_tip): Declare timeout param.
* xterm.c: No need to include locale.h.
(x_alloc_lighter_color, x_setup_relief_color):
Pass arg as double, not float, for compatibility with ANSI C.
(fixup_locale): Move to emacs.c.
(x_term_init): Do not setlocale or fixup locale; the main program
does this now.
1999-10-19 07:25:11 +00:00
|
|
|
|
emacs_close (forkout);
|
1992-03-14 20:40:04 +00:00
|
|
|
|
|
1995-04-28 01:43:02 +00:00
|
|
|
|
#ifdef HAVE_PTYS
|
1996-01-09 23:40:33 +00:00
|
|
|
|
if (pty_flag)
|
|
|
|
|
XPROCESS (process)->tty_name = build_string (pty_name);
|
|
|
|
|
else
|
1995-04-28 01:43:02 +00:00
|
|
|
|
#endif
|
1996-01-09 23:40:33 +00:00
|
|
|
|
XPROCESS (process)->tty_name = Qnil;
|
2008-07-17 09:06:58 +00:00
|
|
|
|
|
|
|
|
|
#if !defined (WINDOWSNT) && defined (FD_CLOEXEC)
|
|
|
|
|
/* 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
|
|
|
|
|
on successful execvp or the _exit call in child_setup. */
|
|
|
|
|
{
|
|
|
|
|
char dummy;
|
|
|
|
|
|
|
|
|
|
emacs_close (wait_child_setup[1]);
|
|
|
|
|
emacs_read (wait_child_setup[0], &dummy, 1);
|
|
|
|
|
emacs_close (wait_child_setup[0]);
|
|
|
|
|
}
|
|
|
|
|
#endif
|
1996-01-09 23:40:33 +00:00
|
|
|
|
}
|
1994-09-23 22:28:08 +00:00
|
|
|
|
|
1996-01-09 23:40:33 +00:00
|
|
|
|
/* Restore the signal state whether vfork succeeded or not.
|
|
|
|
|
(We will signal an error, below, if it failed.) */
|
2001-12-07 05:52:35 +00:00
|
|
|
|
#ifdef HAVE_WORKING_VFORK
|
1995-12-13 01:52:07 +00:00
|
|
|
|
/* Restore the parent's signal handlers. */
|
|
|
|
|
sigaction (SIGINT, &sigint_action, 0);
|
|
|
|
|
sigaction (SIGQUIT, &sigquit_action, 0);
|
|
|
|
|
#ifdef AIX
|
|
|
|
|
sigaction (SIGHUP, &sighup_action, 0);
|
|
|
|
|
#endif
|
2001-12-07 05:52:35 +00:00
|
|
|
|
#endif /* HAVE_WORKING_VFORK */
|
1995-12-13 01:52:07 +00:00
|
|
|
|
/* Stop blocking signals in the parent. */
|
|
|
|
|
sigprocmask (SIG_SETMASK, &procmask, 0);
|
1996-01-09 23:40:33 +00:00
|
|
|
|
|
|
|
|
|
/* Now generate the error if vfork failed. */
|
|
|
|
|
if (pid < 0)
|
|
|
|
|
report_file_error ("Doing vfork", Qnil);
|
1992-03-14 20:40:04 +00:00
|
|
|
|
}
|
|
|
|
|
|
2009-08-13 13:22:55 +00:00
|
|
|
|
void
|
2010-07-05 12:36:06 +02:00
|
|
|
|
create_pty (Lisp_Object process)
|
2009-08-13 13:22:55 +00:00
|
|
|
|
{
|
|
|
|
|
int inchannel, outchannel;
|
|
|
|
|
|
|
|
|
|
/* Use volatile to protect variables from being clobbered by longjmp. */
|
|
|
|
|
volatile int forkin, forkout;
|
|
|
|
|
volatile int pty_flag = 0;
|
|
|
|
|
|
|
|
|
|
inchannel = outchannel = -1;
|
|
|
|
|
|
|
|
|
|
#ifdef HAVE_PTYS
|
|
|
|
|
if (!NILP (Vprocess_connection_type))
|
|
|
|
|
outchannel = inchannel = allocate_pty ();
|
|
|
|
|
|
|
|
|
|
if (inchannel >= 0)
|
|
|
|
|
{
|
|
|
|
|
#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. */
|
|
|
|
|
#ifdef 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);
|
2009-10-19 05:13:31 +00:00
|
|
|
|
#if defined (DONT_REOPEN_PTY)
|
2009-08-13 13:22:55 +00:00
|
|
|
|
/* In the case that vfork is defined as fork, the parent process
|
|
|
|
|
(Emacs) may send some data before the child process completes
|
|
|
|
|
tty options setup. So we setup tty before forking. */
|
|
|
|
|
child_setup_tty (forkout);
|
2009-10-19 05:13:31 +00:00
|
|
|
|
#endif /* DONT_REOPEN_PTY */
|
2009-08-13 13:22:55 +00:00
|
|
|
|
#else
|
|
|
|
|
forkin = forkout = -1;
|
|
|
|
|
#endif /* not USG, or USG_SUBTTY_WORKS */
|
|
|
|
|
pty_flag = 1;
|
|
|
|
|
}
|
|
|
|
|
#endif /* HAVE_PTYS */
|
|
|
|
|
|
|
|
|
|
#ifdef O_NONBLOCK
|
|
|
|
|
fcntl (inchannel, F_SETFL, O_NONBLOCK);
|
|
|
|
|
fcntl (outchannel, F_SETFL, O_NONBLOCK);
|
|
|
|
|
#else
|
|
|
|
|
#ifdef 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. */
|
|
|
|
|
chan_process[inchannel] = process;
|
|
|
|
|
XPROCESS (process)->infd = inchannel;
|
|
|
|
|
XPROCESS (process)->outfd = outchannel;
|
|
|
|
|
|
|
|
|
|
/* Previously we recorded the tty descriptor used in the subprocess.
|
|
|
|
|
It was only used for getting the foreground tty process, so now
|
|
|
|
|
we just reopen the device (see emacs_get_tty_pgrp) as this is
|
|
|
|
|
more portable (see USG_SUBTTY_WORKS above). */
|
|
|
|
|
|
|
|
|
|
XPROCESS (process)->pty_flag = pty_flag;
|
|
|
|
|
XPROCESS (process)->status = Qrun;
|
|
|
|
|
setup_process_coding_systems (process);
|
|
|
|
|
|
|
|
|
|
FD_SET (inchannel, &input_wait_mask);
|
|
|
|
|
FD_SET (inchannel, &non_keyboard_wait_mask);
|
|
|
|
|
if (inchannel > max_process_desc)
|
|
|
|
|
max_process_desc = inchannel;
|
|
|
|
|
|
|
|
|
|
XPROCESS (process)->pid = -2;
|
2009-08-14 09:17:11 +00:00
|
|
|
|
#ifdef HAVE_PTYS
|
|
|
|
|
if (pty_flag)
|
|
|
|
|
XPROCESS (process)->tty_name = build_string (pty_name);
|
|
|
|
|
else
|
|
|
|
|
#endif
|
|
|
|
|
XPROCESS (process)->tty_name = Qnil;
|
2009-08-13 13:22:55 +00:00
|
|
|
|
}
|
|
|
|
|
|
(Qlocal, QCname, QCbuffer, QChost, QCservice, QCfamily)
(QClocal, QCremote, QCserver, QCdatagram, QCnowait, QCnoquery,QCstop)
(QCcoding, QCoptions, QCfilter, QCsentinel, QClog, QCfeature):
New variables.
(NETCONN1_P): New macro.
(DATAGRAM_SOCKETS): New conditional symbol.
(datagram_address): New array.
(DATAGRAM_CONN_P, DATAGRAM_CHAN_P): New macros.
(status_message): Use concat3.
(Fprocess_status): Add `listen' status to doc string. Return `stop'
for a stopped network process.
(Fset_process_buffer): Update contact plist for network process.
(Fset_process_filter): Ditto. Don't enable input for stopped
network processes. Server must listen, even if filter is t.
(Fset_process_query_on_exit_flag, Fprocess_query_on_exit_flag):
New functions.
(Fprocess_kill_without_query): Removed. Now defined in simple.el.
(Fprocess_contact): Added KEY argument. Handle datagrams.
(list_processes_1): Optionally show only processes with the query
on exit flag set. Dynamically adjust column widths. Omit tty
column if not needed. Report stopped network processes.
Identify server and datagram network processes.
(Flist_processes): New optional arg `query-only'.
(conv_sockaddr_to_lisp, get_lisp_to_sockaddr_size)
(conv_lisp_to_sockaddr, set_socket_options)
(network_process_featurep, unwind_request_sigio): New helper functions.
(Fprocess_datagram_address, Fset_process_datagram_address):
(Fset_network_process_options): New lisp functions.
(Fopen_network_stream): Removed. Now defined in simple.el.
(Fmake_network_process): New lisp function. Code is based on previous
Fopen_network_stream, but heavily reworked with new property list based
argument list, support for datagrams, server processes, and local
sockets in addition to old client-only functionality.
(server_accept_connection): New function.
(wait_reading_process_input): Use it to handle incoming connects.
Do not enable input on a new connection if process is stopped.
(read_process_output): Handle datagram sockets. Use 2k buffer for them.
(send_process): Handle datagram sockets.
(Fstop_process, Fcontinue_process): Apply to network processes. A stopped
network process is indicated by setting command field to t .
(Fprocess_send_eof): No-op if datagram connection.
(Fstatus_notify): Don't read input for a stream server socket or a
stopped network process.
(init_process): Initialize datagram_address array.
(syms_of_process): Intern and staticpro new variables, defsubr new
functions.
2002-03-17 20:20:33 +00:00
|
|
|
|
|
|
|
|
|
/* Convert an internal struct sockaddr to a lisp object (vector or string).
|
|
|
|
|
The address family of sa is not included in the result. */
|
|
|
|
|
|
|
|
|
|
static Lisp_Object
|
2010-07-05 12:36:06 +02:00
|
|
|
|
conv_sockaddr_to_lisp (struct sockaddr *sa, int len)
|
(Qlocal, QCname, QCbuffer, QChost, QCservice, QCfamily)
(QClocal, QCremote, QCserver, QCdatagram, QCnowait, QCnoquery,QCstop)
(QCcoding, QCoptions, QCfilter, QCsentinel, QClog, QCfeature):
New variables.
(NETCONN1_P): New macro.
(DATAGRAM_SOCKETS): New conditional symbol.
(datagram_address): New array.
(DATAGRAM_CONN_P, DATAGRAM_CHAN_P): New macros.
(status_message): Use concat3.
(Fprocess_status): Add `listen' status to doc string. Return `stop'
for a stopped network process.
(Fset_process_buffer): Update contact plist for network process.
(Fset_process_filter): Ditto. Don't enable input for stopped
network processes. Server must listen, even if filter is t.
(Fset_process_query_on_exit_flag, Fprocess_query_on_exit_flag):
New functions.
(Fprocess_kill_without_query): Removed. Now defined in simple.el.
(Fprocess_contact): Added KEY argument. Handle datagrams.
(list_processes_1): Optionally show only processes with the query
on exit flag set. Dynamically adjust column widths. Omit tty
column if not needed. Report stopped network processes.
Identify server and datagram network processes.
(Flist_processes): New optional arg `query-only'.
(conv_sockaddr_to_lisp, get_lisp_to_sockaddr_size)
(conv_lisp_to_sockaddr, set_socket_options)
(network_process_featurep, unwind_request_sigio): New helper functions.
(Fprocess_datagram_address, Fset_process_datagram_address):
(Fset_network_process_options): New lisp functions.
(Fopen_network_stream): Removed. Now defined in simple.el.
(Fmake_network_process): New lisp function. Code is based on previous
Fopen_network_stream, but heavily reworked with new property list based
argument list, support for datagrams, server processes, and local
sockets in addition to old client-only functionality.
(server_accept_connection): New function.
(wait_reading_process_input): Use it to handle incoming connects.
Do not enable input on a new connection if process is stopped.
(read_process_output): Handle datagram sockets. Use 2k buffer for them.
(send_process): Handle datagram sockets.
(Fstop_process, Fcontinue_process): Apply to network processes. A stopped
network process is indicated by setting command field to t .
(Fprocess_send_eof): No-op if datagram connection.
(Fstatus_notify): Don't read input for a stream server socket or a
stopped network process.
(init_process): Initialize datagram_address array.
(syms_of_process): Intern and staticpro new variables, defsubr new
functions.
2002-03-17 20:20:33 +00:00
|
|
|
|
{
|
|
|
|
|
Lisp_Object address;
|
|
|
|
|
int i;
|
|
|
|
|
unsigned char *cp;
|
|
|
|
|
register struct Lisp_Vector *p;
|
|
|
|
|
|
2009-01-01 15:58:38 +00:00
|
|
|
|
/* Workaround for a bug in getsockname on BSD: Names bound to
|
|
|
|
|
sockets in the UNIX domain are inaccessible; getsockname returns
|
|
|
|
|
a zero length name. */
|
2010-07-11 20:34:43 +02:00
|
|
|
|
if (len < offsetof (struct sockaddr, sa_family) + sizeof (sa->sa_family))
|
2009-01-18 03:58:09 +00:00
|
|
|
|
return empty_unibyte_string;
|
2009-01-01 15:58:38 +00:00
|
|
|
|
|
(Qlocal, QCname, QCbuffer, QChost, QCservice, QCfamily)
(QClocal, QCremote, QCserver, QCdatagram, QCnowait, QCnoquery,QCstop)
(QCcoding, QCoptions, QCfilter, QCsentinel, QClog, QCfeature):
New variables.
(NETCONN1_P): New macro.
(DATAGRAM_SOCKETS): New conditional symbol.
(datagram_address): New array.
(DATAGRAM_CONN_P, DATAGRAM_CHAN_P): New macros.
(status_message): Use concat3.
(Fprocess_status): Add `listen' status to doc string. Return `stop'
for a stopped network process.
(Fset_process_buffer): Update contact plist for network process.
(Fset_process_filter): Ditto. Don't enable input for stopped
network processes. Server must listen, even if filter is t.
(Fset_process_query_on_exit_flag, Fprocess_query_on_exit_flag):
New functions.
(Fprocess_kill_without_query): Removed. Now defined in simple.el.
(Fprocess_contact): Added KEY argument. Handle datagrams.
(list_processes_1): Optionally show only processes with the query
on exit flag set. Dynamically adjust column widths. Omit tty
column if not needed. Report stopped network processes.
Identify server and datagram network processes.
(Flist_processes): New optional arg `query-only'.
(conv_sockaddr_to_lisp, get_lisp_to_sockaddr_size)
(conv_lisp_to_sockaddr, set_socket_options)
(network_process_featurep, unwind_request_sigio): New helper functions.
(Fprocess_datagram_address, Fset_process_datagram_address):
(Fset_network_process_options): New lisp functions.
(Fopen_network_stream): Removed. Now defined in simple.el.
(Fmake_network_process): New lisp function. Code is based on previous
Fopen_network_stream, but heavily reworked with new property list based
argument list, support for datagrams, server processes, and local
sockets in addition to old client-only functionality.
(server_accept_connection): New function.
(wait_reading_process_input): Use it to handle incoming connects.
Do not enable input on a new connection if process is stopped.
(read_process_output): Handle datagram sockets. Use 2k buffer for them.
(send_process): Handle datagram sockets.
(Fstop_process, Fcontinue_process): Apply to network processes. A stopped
network process is indicated by setting command field to t .
(Fprocess_send_eof): No-op if datagram connection.
(Fstatus_notify): Don't read input for a stream server socket or a
stopped network process.
(init_process): Initialize datagram_address array.
(syms_of_process): Intern and staticpro new variables, defsubr new
functions.
2002-03-17 20:20:33 +00:00
|
|
|
|
switch (sa->sa_family)
|
|
|
|
|
{
|
|
|
|
|
case AF_INET:
|
|
|
|
|
{
|
|
|
|
|
struct sockaddr_in *sin = (struct sockaddr_in *) sa;
|
|
|
|
|
len = sizeof (sin->sin_addr) + 1;
|
|
|
|
|
address = Fmake_vector (make_number (len), Qnil);
|
|
|
|
|
p = XVECTOR (address);
|
|
|
|
|
p->contents[--len] = make_number (ntohs (sin->sin_port));
|
2009-01-01 15:58:38 +00:00
|
|
|
|
cp = (unsigned char *) &sin->sin_addr;
|
(Qlocal, QCname, QCbuffer, QChost, QCservice, QCfamily)
(QClocal, QCremote, QCserver, QCdatagram, QCnowait, QCnoquery,QCstop)
(QCcoding, QCoptions, QCfilter, QCsentinel, QClog, QCfeature):
New variables.
(NETCONN1_P): New macro.
(DATAGRAM_SOCKETS): New conditional symbol.
(datagram_address): New array.
(DATAGRAM_CONN_P, DATAGRAM_CHAN_P): New macros.
(status_message): Use concat3.
(Fprocess_status): Add `listen' status to doc string. Return `stop'
for a stopped network process.
(Fset_process_buffer): Update contact plist for network process.
(Fset_process_filter): Ditto. Don't enable input for stopped
network processes. Server must listen, even if filter is t.
(Fset_process_query_on_exit_flag, Fprocess_query_on_exit_flag):
New functions.
(Fprocess_kill_without_query): Removed. Now defined in simple.el.
(Fprocess_contact): Added KEY argument. Handle datagrams.
(list_processes_1): Optionally show only processes with the query
on exit flag set. Dynamically adjust column widths. Omit tty
column if not needed. Report stopped network processes.
Identify server and datagram network processes.
(Flist_processes): New optional arg `query-only'.
(conv_sockaddr_to_lisp, get_lisp_to_sockaddr_size)
(conv_lisp_to_sockaddr, set_socket_options)
(network_process_featurep, unwind_request_sigio): New helper functions.
(Fprocess_datagram_address, Fset_process_datagram_address):
(Fset_network_process_options): New lisp functions.
(Fopen_network_stream): Removed. Now defined in simple.el.
(Fmake_network_process): New lisp function. Code is based on previous
Fopen_network_stream, but heavily reworked with new property list based
argument list, support for datagrams, server processes, and local
sockets in addition to old client-only functionality.
(server_accept_connection): New function.
(wait_reading_process_input): Use it to handle incoming connects.
Do not enable input on a new connection if process is stopped.
(read_process_output): Handle datagram sockets. Use 2k buffer for them.
(send_process): Handle datagram sockets.
(Fstop_process, Fcontinue_process): Apply to network processes. A stopped
network process is indicated by setting command field to t .
(Fprocess_send_eof): No-op if datagram connection.
(Fstatus_notify): Don't read input for a stream server socket or a
stopped network process.
(init_process): Initialize datagram_address array.
(syms_of_process): Intern and staticpro new variables, defsubr new
functions.
2002-03-17 20:20:33 +00:00
|
|
|
|
break;
|
|
|
|
|
}
|
2006-01-04 00:16:54 +00:00
|
|
|
|
#ifdef AF_INET6
|
|
|
|
|
case AF_INET6:
|
|
|
|
|
{
|
|
|
|
|
struct sockaddr_in6 *sin6 = (struct sockaddr_in6 *) sa;
|
2009-01-01 15:58:38 +00:00
|
|
|
|
uint16_t *ip6 = (uint16_t *) &sin6->sin6_addr;
|
2006-01-04 00:16:54 +00:00
|
|
|
|
len = sizeof (sin6->sin6_addr)/2 + 1;
|
|
|
|
|
address = Fmake_vector (make_number (len), Qnil);
|
|
|
|
|
p = XVECTOR (address);
|
|
|
|
|
p->contents[--len] = make_number (ntohs (sin6->sin6_port));
|
|
|
|
|
for (i = 0; i < len; i++)
|
|
|
|
|
p->contents[i] = make_number (ntohs (ip6[i]));
|
|
|
|
|
return address;
|
|
|
|
|
}
|
|
|
|
|
#endif
|
(Qlocal, QCname, QCbuffer, QChost, QCservice, QCfamily)
(QClocal, QCremote, QCserver, QCdatagram, QCnowait, QCnoquery,QCstop)
(QCcoding, QCoptions, QCfilter, QCsentinel, QClog, QCfeature):
New variables.
(NETCONN1_P): New macro.
(DATAGRAM_SOCKETS): New conditional symbol.
(datagram_address): New array.
(DATAGRAM_CONN_P, DATAGRAM_CHAN_P): New macros.
(status_message): Use concat3.
(Fprocess_status): Add `listen' status to doc string. Return `stop'
for a stopped network process.
(Fset_process_buffer): Update contact plist for network process.
(Fset_process_filter): Ditto. Don't enable input for stopped
network processes. Server must listen, even if filter is t.
(Fset_process_query_on_exit_flag, Fprocess_query_on_exit_flag):
New functions.
(Fprocess_kill_without_query): Removed. Now defined in simple.el.
(Fprocess_contact): Added KEY argument. Handle datagrams.
(list_processes_1): Optionally show only processes with the query
on exit flag set. Dynamically adjust column widths. Omit tty
column if not needed. Report stopped network processes.
Identify server and datagram network processes.
(Flist_processes): New optional arg `query-only'.
(conv_sockaddr_to_lisp, get_lisp_to_sockaddr_size)
(conv_lisp_to_sockaddr, set_socket_options)
(network_process_featurep, unwind_request_sigio): New helper functions.
(Fprocess_datagram_address, Fset_process_datagram_address):
(Fset_network_process_options): New lisp functions.
(Fopen_network_stream): Removed. Now defined in simple.el.
(Fmake_network_process): New lisp function. Code is based on previous
Fopen_network_stream, but heavily reworked with new property list based
argument list, support for datagrams, server processes, and local
sockets in addition to old client-only functionality.
(server_accept_connection): New function.
(wait_reading_process_input): Use it to handle incoming connects.
Do not enable input on a new connection if process is stopped.
(read_process_output): Handle datagram sockets. Use 2k buffer for them.
(send_process): Handle datagram sockets.
(Fstop_process, Fcontinue_process): Apply to network processes. A stopped
network process is indicated by setting command field to t .
(Fprocess_send_eof): No-op if datagram connection.
(Fstatus_notify): Don't read input for a stream server socket or a
stopped network process.
(init_process): Initialize datagram_address array.
(syms_of_process): Intern and staticpro new variables, defsubr new
functions.
2002-03-17 20:20:33 +00:00
|
|
|
|
#ifdef HAVE_LOCAL_SOCKETS
|
|
|
|
|
case AF_LOCAL:
|
|
|
|
|
{
|
2002-03-20 18:10:01 +00:00
|
|
|
|
struct sockaddr_un *sockun = (struct sockaddr_un *) sa;
|
|
|
|
|
for (i = 0; i < sizeof (sockun->sun_path); i++)
|
|
|
|
|
if (sockun->sun_path[i] == 0)
|
(Qlocal, QCname, QCbuffer, QChost, QCservice, QCfamily)
(QClocal, QCremote, QCserver, QCdatagram, QCnowait, QCnoquery,QCstop)
(QCcoding, QCoptions, QCfilter, QCsentinel, QClog, QCfeature):
New variables.
(NETCONN1_P): New macro.
(DATAGRAM_SOCKETS): New conditional symbol.
(datagram_address): New array.
(DATAGRAM_CONN_P, DATAGRAM_CHAN_P): New macros.
(status_message): Use concat3.
(Fprocess_status): Add `listen' status to doc string. Return `stop'
for a stopped network process.
(Fset_process_buffer): Update contact plist for network process.
(Fset_process_filter): Ditto. Don't enable input for stopped
network processes. Server must listen, even if filter is t.
(Fset_process_query_on_exit_flag, Fprocess_query_on_exit_flag):
New functions.
(Fprocess_kill_without_query): Removed. Now defined in simple.el.
(Fprocess_contact): Added KEY argument. Handle datagrams.
(list_processes_1): Optionally show only processes with the query
on exit flag set. Dynamically adjust column widths. Omit tty
column if not needed. Report stopped network processes.
Identify server and datagram network processes.
(Flist_processes): New optional arg `query-only'.
(conv_sockaddr_to_lisp, get_lisp_to_sockaddr_size)
(conv_lisp_to_sockaddr, set_socket_options)
(network_process_featurep, unwind_request_sigio): New helper functions.
(Fprocess_datagram_address, Fset_process_datagram_address):
(Fset_network_process_options): New lisp functions.
(Fopen_network_stream): Removed. Now defined in simple.el.
(Fmake_network_process): New lisp function. Code is based on previous
Fopen_network_stream, but heavily reworked with new property list based
argument list, support for datagrams, server processes, and local
sockets in addition to old client-only functionality.
(server_accept_connection): New function.
(wait_reading_process_input): Use it to handle incoming connects.
Do not enable input on a new connection if process is stopped.
(read_process_output): Handle datagram sockets. Use 2k buffer for them.
(send_process): Handle datagram sockets.
(Fstop_process, Fcontinue_process): Apply to network processes. A stopped
network process is indicated by setting command field to t .
(Fprocess_send_eof): No-op if datagram connection.
(Fstatus_notify): Don't read input for a stream server socket or a
stopped network process.
(init_process): Initialize datagram_address array.
(syms_of_process): Intern and staticpro new variables, defsubr new
functions.
2002-03-17 20:20:33 +00:00
|
|
|
|
break;
|
2002-03-20 18:10:01 +00:00
|
|
|
|
return make_unibyte_string (sockun->sun_path, i);
|
(Qlocal, QCname, QCbuffer, QChost, QCservice, QCfamily)
(QClocal, QCremote, QCserver, QCdatagram, QCnowait, QCnoquery,QCstop)
(QCcoding, QCoptions, QCfilter, QCsentinel, QClog, QCfeature):
New variables.
(NETCONN1_P): New macro.
(DATAGRAM_SOCKETS): New conditional symbol.
(datagram_address): New array.
(DATAGRAM_CONN_P, DATAGRAM_CHAN_P): New macros.
(status_message): Use concat3.
(Fprocess_status): Add `listen' status to doc string. Return `stop'
for a stopped network process.
(Fset_process_buffer): Update contact plist for network process.
(Fset_process_filter): Ditto. Don't enable input for stopped
network processes. Server must listen, even if filter is t.
(Fset_process_query_on_exit_flag, Fprocess_query_on_exit_flag):
New functions.
(Fprocess_kill_without_query): Removed. Now defined in simple.el.
(Fprocess_contact): Added KEY argument. Handle datagrams.
(list_processes_1): Optionally show only processes with the query
on exit flag set. Dynamically adjust column widths. Omit tty
column if not needed. Report stopped network processes.
Identify server and datagram network processes.
(Flist_processes): New optional arg `query-only'.
(conv_sockaddr_to_lisp, get_lisp_to_sockaddr_size)
(conv_lisp_to_sockaddr, set_socket_options)
(network_process_featurep, unwind_request_sigio): New helper functions.
(Fprocess_datagram_address, Fset_process_datagram_address):
(Fset_network_process_options): New lisp functions.
(Fopen_network_stream): Removed. Now defined in simple.el.
(Fmake_network_process): New lisp function. Code is based on previous
Fopen_network_stream, but heavily reworked with new property list based
argument list, support for datagrams, server processes, and local
sockets in addition to old client-only functionality.
(server_accept_connection): New function.
(wait_reading_process_input): Use it to handle incoming connects.
Do not enable input on a new connection if process is stopped.
(read_process_output): Handle datagram sockets. Use 2k buffer for them.
(send_process): Handle datagram sockets.
(Fstop_process, Fcontinue_process): Apply to network processes. A stopped
network process is indicated by setting command field to t .
(Fprocess_send_eof): No-op if datagram connection.
(Fstatus_notify): Don't read input for a stream server socket or a
stopped network process.
(init_process): Initialize datagram_address array.
(syms_of_process): Intern and staticpro new variables, defsubr new
functions.
2002-03-17 20:20:33 +00:00
|
|
|
|
}
|
|
|
|
|
#endif
|
|
|
|
|
default:
|
2010-07-11 20:34:43 +02:00
|
|
|
|
len -= offsetof (struct sockaddr, sa_family) + sizeof (sa->sa_family);
|
(Qlocal, QCname, QCbuffer, QChost, QCservice, QCfamily)
(QClocal, QCremote, QCserver, QCdatagram, QCnowait, QCnoquery,QCstop)
(QCcoding, QCoptions, QCfilter, QCsentinel, QClog, QCfeature):
New variables.
(NETCONN1_P): New macro.
(DATAGRAM_SOCKETS): New conditional symbol.
(datagram_address): New array.
(DATAGRAM_CONN_P, DATAGRAM_CHAN_P): New macros.
(status_message): Use concat3.
(Fprocess_status): Add `listen' status to doc string. Return `stop'
for a stopped network process.
(Fset_process_buffer): Update contact plist for network process.
(Fset_process_filter): Ditto. Don't enable input for stopped
network processes. Server must listen, even if filter is t.
(Fset_process_query_on_exit_flag, Fprocess_query_on_exit_flag):
New functions.
(Fprocess_kill_without_query): Removed. Now defined in simple.el.
(Fprocess_contact): Added KEY argument. Handle datagrams.
(list_processes_1): Optionally show only processes with the query
on exit flag set. Dynamically adjust column widths. Omit tty
column if not needed. Report stopped network processes.
Identify server and datagram network processes.
(Flist_processes): New optional arg `query-only'.
(conv_sockaddr_to_lisp, get_lisp_to_sockaddr_size)
(conv_lisp_to_sockaddr, set_socket_options)
(network_process_featurep, unwind_request_sigio): New helper functions.
(Fprocess_datagram_address, Fset_process_datagram_address):
(Fset_network_process_options): New lisp functions.
(Fopen_network_stream): Removed. Now defined in simple.el.
(Fmake_network_process): New lisp function. Code is based on previous
Fopen_network_stream, but heavily reworked with new property list based
argument list, support for datagrams, server processes, and local
sockets in addition to old client-only functionality.
(server_accept_connection): New function.
(wait_reading_process_input): Use it to handle incoming connects.
Do not enable input on a new connection if process is stopped.
(read_process_output): Handle datagram sockets. Use 2k buffer for them.
(send_process): Handle datagram sockets.
(Fstop_process, Fcontinue_process): Apply to network processes. A stopped
network process is indicated by setting command field to t .
(Fprocess_send_eof): No-op if datagram connection.
(Fstatus_notify): Don't read input for a stream server socket or a
stopped network process.
(init_process): Initialize datagram_address array.
(syms_of_process): Intern and staticpro new variables, defsubr new
functions.
2002-03-17 20:20:33 +00:00
|
|
|
|
address = Fcons (make_number (sa->sa_family),
|
|
|
|
|
Fmake_vector (make_number (len), Qnil));
|
|
|
|
|
p = XVECTOR (XCDR (address));
|
2009-01-01 15:58:38 +00:00
|
|
|
|
cp = (unsigned char *) &sa->sa_family + sizeof (sa->sa_family);
|
(Qlocal, QCname, QCbuffer, QChost, QCservice, QCfamily)
(QClocal, QCremote, QCserver, QCdatagram, QCnowait, QCnoquery,QCstop)
(QCcoding, QCoptions, QCfilter, QCsentinel, QClog, QCfeature):
New variables.
(NETCONN1_P): New macro.
(DATAGRAM_SOCKETS): New conditional symbol.
(datagram_address): New array.
(DATAGRAM_CONN_P, DATAGRAM_CHAN_P): New macros.
(status_message): Use concat3.
(Fprocess_status): Add `listen' status to doc string. Return `stop'
for a stopped network process.
(Fset_process_buffer): Update contact plist for network process.
(Fset_process_filter): Ditto. Don't enable input for stopped
network processes. Server must listen, even if filter is t.
(Fset_process_query_on_exit_flag, Fprocess_query_on_exit_flag):
New functions.
(Fprocess_kill_without_query): Removed. Now defined in simple.el.
(Fprocess_contact): Added KEY argument. Handle datagrams.
(list_processes_1): Optionally show only processes with the query
on exit flag set. Dynamically adjust column widths. Omit tty
column if not needed. Report stopped network processes.
Identify server and datagram network processes.
(Flist_processes): New optional arg `query-only'.
(conv_sockaddr_to_lisp, get_lisp_to_sockaddr_size)
(conv_lisp_to_sockaddr, set_socket_options)
(network_process_featurep, unwind_request_sigio): New helper functions.
(Fprocess_datagram_address, Fset_process_datagram_address):
(Fset_network_process_options): New lisp functions.
(Fopen_network_stream): Removed. Now defined in simple.el.
(Fmake_network_process): New lisp function. Code is based on previous
Fopen_network_stream, but heavily reworked with new property list based
argument list, support for datagrams, server processes, and local
sockets in addition to old client-only functionality.
(server_accept_connection): New function.
(wait_reading_process_input): Use it to handle incoming connects.
Do not enable input on a new connection if process is stopped.
(read_process_output): Handle datagram sockets. Use 2k buffer for them.
(send_process): Handle datagram sockets.
(Fstop_process, Fcontinue_process): Apply to network processes. A stopped
network process is indicated by setting command field to t .
(Fprocess_send_eof): No-op if datagram connection.
(Fstatus_notify): Don't read input for a stream server socket or a
stopped network process.
(init_process): Initialize datagram_address array.
(syms_of_process): Intern and staticpro new variables, defsubr new
functions.
2002-03-17 20:20:33 +00:00
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
i = 0;
|
|
|
|
|
while (i < len)
|
|
|
|
|
p->contents[i++] = make_number (*cp++);
|
|
|
|
|
|
|
|
|
|
return address;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/* Get family and required size for sockaddr structure to hold ADDRESS. */
|
|
|
|
|
|
|
|
|
|
static int
|
2010-07-05 12:36:06 +02:00
|
|
|
|
get_lisp_to_sockaddr_size (Lisp_Object address, int *familyp)
|
(Qlocal, QCname, QCbuffer, QChost, QCservice, QCfamily)
(QClocal, QCremote, QCserver, QCdatagram, QCnowait, QCnoquery,QCstop)
(QCcoding, QCoptions, QCfilter, QCsentinel, QClog, QCfeature):
New variables.
(NETCONN1_P): New macro.
(DATAGRAM_SOCKETS): New conditional symbol.
(datagram_address): New array.
(DATAGRAM_CONN_P, DATAGRAM_CHAN_P): New macros.
(status_message): Use concat3.
(Fprocess_status): Add `listen' status to doc string. Return `stop'
for a stopped network process.
(Fset_process_buffer): Update contact plist for network process.
(Fset_process_filter): Ditto. Don't enable input for stopped
network processes. Server must listen, even if filter is t.
(Fset_process_query_on_exit_flag, Fprocess_query_on_exit_flag):
New functions.
(Fprocess_kill_without_query): Removed. Now defined in simple.el.
(Fprocess_contact): Added KEY argument. Handle datagrams.
(list_processes_1): Optionally show only processes with the query
on exit flag set. Dynamically adjust column widths. Omit tty
column if not needed. Report stopped network processes.
Identify server and datagram network processes.
(Flist_processes): New optional arg `query-only'.
(conv_sockaddr_to_lisp, get_lisp_to_sockaddr_size)
(conv_lisp_to_sockaddr, set_socket_options)
(network_process_featurep, unwind_request_sigio): New helper functions.
(Fprocess_datagram_address, Fset_process_datagram_address):
(Fset_network_process_options): New lisp functions.
(Fopen_network_stream): Removed. Now defined in simple.el.
(Fmake_network_process): New lisp function. Code is based on previous
Fopen_network_stream, but heavily reworked with new property list based
argument list, support for datagrams, server processes, and local
sockets in addition to old client-only functionality.
(server_accept_connection): New function.
(wait_reading_process_input): Use it to handle incoming connects.
Do not enable input on a new connection if process is stopped.
(read_process_output): Handle datagram sockets. Use 2k buffer for them.
(send_process): Handle datagram sockets.
(Fstop_process, Fcontinue_process): Apply to network processes. A stopped
network process is indicated by setting command field to t .
(Fprocess_send_eof): No-op if datagram connection.
(Fstatus_notify): Don't read input for a stream server socket or a
stopped network process.
(init_process): Initialize datagram_address array.
(syms_of_process): Intern and staticpro new variables, defsubr new
functions.
2002-03-17 20:20:33 +00:00
|
|
|
|
{
|
|
|
|
|
register struct Lisp_Vector *p;
|
|
|
|
|
|
|
|
|
|
if (VECTORP (address))
|
|
|
|
|
{
|
|
|
|
|
p = XVECTOR (address);
|
|
|
|
|
if (p->size == 5)
|
|
|
|
|
{
|
|
|
|
|
*familyp = AF_INET;
|
|
|
|
|
return sizeof (struct sockaddr_in);
|
|
|
|
|
}
|
2006-01-04 00:16:54 +00:00
|
|
|
|
#ifdef AF_INET6
|
|
|
|
|
else if (p->size == 9)
|
|
|
|
|
{
|
|
|
|
|
*familyp = AF_INET6;
|
|
|
|
|
return sizeof (struct sockaddr_in6);
|
|
|
|
|
}
|
|
|
|
|
#endif
|
(Qlocal, QCname, QCbuffer, QChost, QCservice, QCfamily)
(QClocal, QCremote, QCserver, QCdatagram, QCnowait, QCnoquery,QCstop)
(QCcoding, QCoptions, QCfilter, QCsentinel, QClog, QCfeature):
New variables.
(NETCONN1_P): New macro.
(DATAGRAM_SOCKETS): New conditional symbol.
(datagram_address): New array.
(DATAGRAM_CONN_P, DATAGRAM_CHAN_P): New macros.
(status_message): Use concat3.
(Fprocess_status): Add `listen' status to doc string. Return `stop'
for a stopped network process.
(Fset_process_buffer): Update contact plist for network process.
(Fset_process_filter): Ditto. Don't enable input for stopped
network processes. Server must listen, even if filter is t.
(Fset_process_query_on_exit_flag, Fprocess_query_on_exit_flag):
New functions.
(Fprocess_kill_without_query): Removed. Now defined in simple.el.
(Fprocess_contact): Added KEY argument. Handle datagrams.
(list_processes_1): Optionally show only processes with the query
on exit flag set. Dynamically adjust column widths. Omit tty
column if not needed. Report stopped network processes.
Identify server and datagram network processes.
(Flist_processes): New optional arg `query-only'.
(conv_sockaddr_to_lisp, get_lisp_to_sockaddr_size)
(conv_lisp_to_sockaddr, set_socket_options)
(network_process_featurep, unwind_request_sigio): New helper functions.
(Fprocess_datagram_address, Fset_process_datagram_address):
(Fset_network_process_options): New lisp functions.
(Fopen_network_stream): Removed. Now defined in simple.el.
(Fmake_network_process): New lisp function. Code is based on previous
Fopen_network_stream, but heavily reworked with new property list based
argument list, support for datagrams, server processes, and local
sockets in addition to old client-only functionality.
(server_accept_connection): New function.
(wait_reading_process_input): Use it to handle incoming connects.
Do not enable input on a new connection if process is stopped.
(read_process_output): Handle datagram sockets. Use 2k buffer for them.
(send_process): Handle datagram sockets.
(Fstop_process, Fcontinue_process): Apply to network processes. A stopped
network process is indicated by setting command field to t .
(Fprocess_send_eof): No-op if datagram connection.
(Fstatus_notify): Don't read input for a stream server socket or a
stopped network process.
(init_process): Initialize datagram_address array.
(syms_of_process): Intern and staticpro new variables, defsubr new
functions.
2002-03-17 20:20:33 +00:00
|
|
|
|
}
|
|
|
|
|
#ifdef HAVE_LOCAL_SOCKETS
|
|
|
|
|
else if (STRINGP (address))
|
|
|
|
|
{
|
|
|
|
|
*familyp = AF_LOCAL;
|
|
|
|
|
return sizeof (struct sockaddr_un);
|
|
|
|
|
}
|
|
|
|
|
#endif
|
|
|
|
|
else if (CONSP (address) && INTEGERP (XCAR (address)) && VECTORP (XCDR (address)))
|
|
|
|
|
{
|
|
|
|
|
struct sockaddr *sa;
|
|
|
|
|
*familyp = XINT (XCAR (address));
|
|
|
|
|
p = XVECTOR (XCDR (address));
|
|
|
|
|
return p->size + sizeof (sa->sa_family);
|
|
|
|
|
}
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Convert an address object (vector or string) to an internal sockaddr.
|
2006-04-13 01:08:27 +00:00
|
|
|
|
|
|
|
|
|
The address format has been basically validated by
|
|
|
|
|
get_lisp_to_sockaddr_size, but this does not mean FAMILY is valid;
|
|
|
|
|
it could have come from user data. So if FAMILY is not valid,
|
|
|
|
|
we return after zeroing *SA. */
|
(Qlocal, QCname, QCbuffer, QChost, QCservice, QCfamily)
(QClocal, QCremote, QCserver, QCdatagram, QCnowait, QCnoquery,QCstop)
(QCcoding, QCoptions, QCfilter, QCsentinel, QClog, QCfeature):
New variables.
(NETCONN1_P): New macro.
(DATAGRAM_SOCKETS): New conditional symbol.
(datagram_address): New array.
(DATAGRAM_CONN_P, DATAGRAM_CHAN_P): New macros.
(status_message): Use concat3.
(Fprocess_status): Add `listen' status to doc string. Return `stop'
for a stopped network process.
(Fset_process_buffer): Update contact plist for network process.
(Fset_process_filter): Ditto. Don't enable input for stopped
network processes. Server must listen, even if filter is t.
(Fset_process_query_on_exit_flag, Fprocess_query_on_exit_flag):
New functions.
(Fprocess_kill_without_query): Removed. Now defined in simple.el.
(Fprocess_contact): Added KEY argument. Handle datagrams.
(list_processes_1): Optionally show only processes with the query
on exit flag set. Dynamically adjust column widths. Omit tty
column if not needed. Report stopped network processes.
Identify server and datagram network processes.
(Flist_processes): New optional arg `query-only'.
(conv_sockaddr_to_lisp, get_lisp_to_sockaddr_size)
(conv_lisp_to_sockaddr, set_socket_options)
(network_process_featurep, unwind_request_sigio): New helper functions.
(Fprocess_datagram_address, Fset_process_datagram_address):
(Fset_network_process_options): New lisp functions.
(Fopen_network_stream): Removed. Now defined in simple.el.
(Fmake_network_process): New lisp function. Code is based on previous
Fopen_network_stream, but heavily reworked with new property list based
argument list, support for datagrams, server processes, and local
sockets in addition to old client-only functionality.
(server_accept_connection): New function.
(wait_reading_process_input): Use it to handle incoming connects.
Do not enable input on a new connection if process is stopped.
(read_process_output): Handle datagram sockets. Use 2k buffer for them.
(send_process): Handle datagram sockets.
(Fstop_process, Fcontinue_process): Apply to network processes. A stopped
network process is indicated by setting command field to t .
(Fprocess_send_eof): No-op if datagram connection.
(Fstatus_notify): Don't read input for a stream server socket or a
stopped network process.
(init_process): Initialize datagram_address array.
(syms_of_process): Intern and staticpro new variables, defsubr new
functions.
2002-03-17 20:20:33 +00:00
|
|
|
|
|
|
|
|
|
static void
|
2010-07-05 12:36:06 +02:00
|
|
|
|
conv_lisp_to_sockaddr (int family, Lisp_Object address, struct sockaddr *sa, int len)
|
(Qlocal, QCname, QCbuffer, QChost, QCservice, QCfamily)
(QClocal, QCremote, QCserver, QCdatagram, QCnowait, QCnoquery,QCstop)
(QCcoding, QCoptions, QCfilter, QCsentinel, QClog, QCfeature):
New variables.
(NETCONN1_P): New macro.
(DATAGRAM_SOCKETS): New conditional symbol.
(datagram_address): New array.
(DATAGRAM_CONN_P, DATAGRAM_CHAN_P): New macros.
(status_message): Use concat3.
(Fprocess_status): Add `listen' status to doc string. Return `stop'
for a stopped network process.
(Fset_process_buffer): Update contact plist for network process.
(Fset_process_filter): Ditto. Don't enable input for stopped
network processes. Server must listen, even if filter is t.
(Fset_process_query_on_exit_flag, Fprocess_query_on_exit_flag):
New functions.
(Fprocess_kill_without_query): Removed. Now defined in simple.el.
(Fprocess_contact): Added KEY argument. Handle datagrams.
(list_processes_1): Optionally show only processes with the query
on exit flag set. Dynamically adjust column widths. Omit tty
column if not needed. Report stopped network processes.
Identify server and datagram network processes.
(Flist_processes): New optional arg `query-only'.
(conv_sockaddr_to_lisp, get_lisp_to_sockaddr_size)
(conv_lisp_to_sockaddr, set_socket_options)
(network_process_featurep, unwind_request_sigio): New helper functions.
(Fprocess_datagram_address, Fset_process_datagram_address):
(Fset_network_process_options): New lisp functions.
(Fopen_network_stream): Removed. Now defined in simple.el.
(Fmake_network_process): New lisp function. Code is based on previous
Fopen_network_stream, but heavily reworked with new property list based
argument list, support for datagrams, server processes, and local
sockets in addition to old client-only functionality.
(server_accept_connection): New function.
(wait_reading_process_input): Use it to handle incoming connects.
Do not enable input on a new connection if process is stopped.
(read_process_output): Handle datagram sockets. Use 2k buffer for them.
(send_process): Handle datagram sockets.
(Fstop_process, Fcontinue_process): Apply to network processes. A stopped
network process is indicated by setting command field to t .
(Fprocess_send_eof): No-op if datagram connection.
(Fstatus_notify): Don't read input for a stream server socket or a
stopped network process.
(init_process): Initialize datagram_address array.
(syms_of_process): Intern and staticpro new variables, defsubr new
functions.
2002-03-17 20:20:33 +00:00
|
|
|
|
{
|
|
|
|
|
register struct Lisp_Vector *p;
|
2003-05-25 17:43:20 +00:00
|
|
|
|
register unsigned char *cp = NULL;
|
(Qlocal, QCname, QCbuffer, QChost, QCservice, QCfamily)
(QClocal, QCremote, QCserver, QCdatagram, QCnowait, QCnoquery,QCstop)
(QCcoding, QCoptions, QCfilter, QCsentinel, QClog, QCfeature):
New variables.
(NETCONN1_P): New macro.
(DATAGRAM_SOCKETS): New conditional symbol.
(datagram_address): New array.
(DATAGRAM_CONN_P, DATAGRAM_CHAN_P): New macros.
(status_message): Use concat3.
(Fprocess_status): Add `listen' status to doc string. Return `stop'
for a stopped network process.
(Fset_process_buffer): Update contact plist for network process.
(Fset_process_filter): Ditto. Don't enable input for stopped
network processes. Server must listen, even if filter is t.
(Fset_process_query_on_exit_flag, Fprocess_query_on_exit_flag):
New functions.
(Fprocess_kill_without_query): Removed. Now defined in simple.el.
(Fprocess_contact): Added KEY argument. Handle datagrams.
(list_processes_1): Optionally show only processes with the query
on exit flag set. Dynamically adjust column widths. Omit tty
column if not needed. Report stopped network processes.
Identify server and datagram network processes.
(Flist_processes): New optional arg `query-only'.
(conv_sockaddr_to_lisp, get_lisp_to_sockaddr_size)
(conv_lisp_to_sockaddr, set_socket_options)
(network_process_featurep, unwind_request_sigio): New helper functions.
(Fprocess_datagram_address, Fset_process_datagram_address):
(Fset_network_process_options): New lisp functions.
(Fopen_network_stream): Removed. Now defined in simple.el.
(Fmake_network_process): New lisp function. Code is based on previous
Fopen_network_stream, but heavily reworked with new property list based
argument list, support for datagrams, server processes, and local
sockets in addition to old client-only functionality.
(server_accept_connection): New function.
(wait_reading_process_input): Use it to handle incoming connects.
Do not enable input on a new connection if process is stopped.
(read_process_output): Handle datagram sockets. Use 2k buffer for them.
(send_process): Handle datagram sockets.
(Fstop_process, Fcontinue_process): Apply to network processes. A stopped
network process is indicated by setting command field to t .
(Fprocess_send_eof): No-op if datagram connection.
(Fstatus_notify): Don't read input for a stream server socket or a
stopped network process.
(init_process): Initialize datagram_address array.
(syms_of_process): Intern and staticpro new variables, defsubr new
functions.
2002-03-17 20:20:33 +00:00
|
|
|
|
register int i;
|
|
|
|
|
|
Replace bcopy, bzero, bcmp by memcpy, memmove, memset, memcmp
* alloc.c (overrun_check_malloc, overrun_check_realloc)
(overrun_check_free, xstrdup, allocate_string)
(allocate_string_data, compact_small_strings, Fmake_string)
(make_unibyte_string, make_multibyte_string)
(make_string_from_bytes, make_specified_string, make_float)
(Fcons, allocate_terminal, allocate_frame, make_pure_string)
(Fgarbage_collect): Replace bcopy, safe_bcopy, bzero, bcmp by
memcpy, memmove, memset, memcmp.
* atimer.c (start_atimer, set_alarm): Likewise.
* buffer.c (clone_per_buffer_values, report_overlay_modification)
(mmap_realloc, init_buffer_once): Likewise.
* callint.c (Fcall_interactively): Likewise.
* callproc.c (Fcall_process, Fcall_process_region, child_setup)
(getenv_internal_1): Likewise.
* casefiddle.c (casify_object): Likewise.
* ccl.c (ccl_driver): Likewise.
* character.c (str_as_multibyte, str_to_multibyte): Likewise.
* charset.c (load_charset_map_from_file)
(load_charset_map_from_file, load_charset_map_from_vector)
(Fdefine_charset_internal): Likewise.
* cm.c (Wcm_clear): Likewise.
* coding.c (decode_eol, decode_coding_object)
(Fset_coding_system_priority, make_subsidiaries): Likewise.
* data.c (Faset): Likewise.
* dired.c (directory_files_internal, file_name_completion_stat):
Likewise.
* dispnew.c (new_glyph_matrix, adjust_glyph_matrix)
(clear_glyph_row, copy_row_except_pointers)
(copy_glyph_row_contents, new_glyph_pool, realloc_glyph_pool)
(save_current_matrix, restore_current_matrix)
(build_frame_matrix_from_leaf_window, mirrored_line_dance)
(mirror_line_dance, scrolling_window): Likewise.
* doc.c (Fsnarf_documentation, Fsubstitute_command_keys):
Likewise.
* doprnt.c (doprnt): Likewise.
* editfns.c (Fuser_full_name, make_buffer_string_both)
(Fmessage_box, Fformat, Ftranspose_regions): Likewise.
* emacs.c (sort_args): Likewise.
* eval.c (Fapply, Ffuncall): Likewise.
* fileio.c (Ffile_name_directory, make_temp_name)
(Fexpand_file_name, search_embedded_absfilename)
(Fsubstitute_in_file_name, Ffile_symlink_p, Finsert_file_contents)
(auto_save_error): Likewise.
* fns.c (Fstring_equal, Fcopy_sequence, concat)
(string_to_multibyte, Fstring_as_unibyte, Fstring_as_multibyte)
(internal_equal, Fclear_string, larger_vector, copy_hash_table)
(Fmake_hash_table): Likewise.
* fringe.c (Fdefine_fringe_bitmap): Likewise.
* ftfont.c (ftfont_text_extents): Likewise.
* getloadavg.c (getloadavg): Likewise.
* image.c (define_image_type, make_image, make_image_cache)
(x_create_x_image_and_pixmap, xbm_image_p)
(w32_create_pixmap_from_bitmap_data, xbm_load, xpm_lookup_color)
(xpm_image_p, x_create_bitmap_from_xpm_data, xpm_load)
(init_color_table, x_build_heuristic_mask, pbm_image_p, pbm_load)
(png_image_p, png_read_from_memory, png_load, jpeg_image_p)
(tiff_image_p, tiff_read_from_memory, gif_image_p)
(gif_read_from_memory, gif_load, svg_image_p, gs_image_p):
Likewise.
* indent.c (scan_for_column, compute_motion): Likewise.
* insdel.c (gap_left, gap_right, make_gap_smaller, copy_text)
(insert_1_both, insert_from_gap, replace_range_2): Likewise.
* intervals.c (reproduce_tree, reproduce_tree_obj): Likewise.
* keyboard.c (echo_char, save_getcjmp, restore_getcjmp)
(kbd_buffer_store_event_hold, apply_modifiers_uncached)
(store_user_signal_events, menu_bar_items, tool_bar_items)
(process_tool_bar_item, append_tool_bar_item)
(read_char_minibuf_menu_prompt, read_key_sequence)
(Fread_key_sequence, Fread_key_sequence_vector, Frecent_keys):
Likewise.
* keymap.c (current_minor_maps, Fdescribe_buffer_bindings):
Likewise.
* lisp.h (STRING_COPYIN): Likewise.
* lread.c (Fload, read1, oblookup): Likewise.
* msdos.c (Frecent_doskeys): Likewise.
* nsfns.m (Fx_create_frame): Likewise.
* nsfont.m (nsfont_open, nsfont_text_extents, ns_glyph_metrics):
Likewise.
* nsimage.m (EmacsImage-initFromSkipXBM:width:height:)
(EmacsImage-initForXPMWithDepth:width:height:flip:length:):
Likewise.
* nsmenu.m (ns_update_menubar): Likewise.
* nsterm.m (ns_draw_fringe_bitmap, ns_term_init): Likewise.
* print.c (print_unwind, printchar, strout, print_string)
(print_error_message): Likewise.
* process.c (conv_lisp_to_sockaddr, set_socket_option)
(Fmake_network_process, Fnetwork_interface_list)
(Fnetwork_interface_info, read_process_output, Fprocess_send_eof)
(init_process): Likewise.
* ralloc.c (resize_bloc, r_alloc_sbrk, r_alloc_init): Likewise.
* regex.c (init_syntax_once, regex_compile, re_compile_fastmap):
Likewise.
* scroll.c (do_scrolling, do_direct_scrolling)
(scrolling_max_lines_saved): Likewise.
* search.c (search_buffer, wordify, Freplace_match): Likewise.
* sound.c (wav_init, au_init, Fplay_sound_internal): Likewise.
* syntax.c (skip_chars, skip_syntaxes): Likewise.
* sysdep.c (child_setup_tty, sys_subshell, emacs_get_tty)
(emacs_set_tty): Likewise.
* term.c (encode_terminal_code, calculate_costs)
(produce_special_glyphs, create_tty_output, init_tty, delete_tty):
Likewise.
* termcap.c (tgetst1, gobble_line): Likewise.
* termhooks.h (EVENT_INIT): Likewise.
* tparam.c (tparam1): Likewise.
* unexalpha.c (unexec): Likewise.
* unexec.c (write_segment): Likewise.
* unexmacosx.c (unexec_write_zero): Likewise.
* w32fns.c (w32_wnd_proc, Fx_create_frame, x_create_tip_frame)
(Fx_file_dialog, Fsystem_move_file_to_trash): Likewise.
* w32font.c (w32font_list_family, w32font_text_extents)
(w32font_list_internal, w32font_match_internal)
(w32font_open_internal, compute_metrics, Fx_select_font):
Likewise.
* w32menu.c (set_frame_menubar, add_menu_item)
(w32_menu_display_help, w32_free_submenu_strings): Likewise.
* w32term.c (XCreateGC, w32_initialize_display_info): Likewise.
* w32uniscribe.c (uniscribe_list_family): Likewise.
* w32xfns.c (get_next_msg, post_msg, prepend_msg): Likewise.
* window.c (make_window, replace_window, set_window_buffer)
(Fsplit_window): Likewise.
* xdisp.c (init_iterator, RECORD_OVERLAY_STRING, reseat_to_string)
(add_to_log, message3, x_consider_frame_title)
(append_space_for_newline, extend_face_to_end_of_line)
(decode_mode_spec_coding, init_glyph_string): Likewise.
* xfaces.c (x_create_gc, get_lface_attributes_no_remap)
(Finternal_copy_lisp_face, Finternal_merge_in_global_face)
(face_attr_equal_p, make_realized_face, make_face_cache)
(free_realized_faces, lookup_named_face, smaller_face)
(face_with_height, lookup_derived_face)
(x_supports_face_attributes_p, Finternal_set_font_selection_order)
(Finternal_set_font_selection_order, realize_default_face)
(compute_char_face, face_at_buffer_position)
(face_for_overlay_string, face_at_string_position, merge_faces):
Likewise.
* xfns.c (xic_create_fontsetname, Fx_create_frame)
(Fx_window_property, x_create_tip_frame)
(Fx_backspace_delete_keys_p): Likewise.
* xfont.c (xfont_list, xfont_match, xfont_list_family)
(xfont_text_extents): Likewise.
* xmenu.c (set_frame_menubar, xmenu_show): Likewise.
* xrdb.c (magic_file_p, x_get_resource): Likewise.
* xselect.c (x_queue_event, x_get_window_property)
(receive_incremental_selection): Likewise.
* xsmfns.c (x_session_check_input): Likewise.
* xterm.c (x_send_scroll_bar_event, SET_SAVED_MENU_EVENT)
(handle_one_xevent, x_check_errors, xim_initialize, x_term_init):
Likewise.
* character.h (BCOPY_SHORT): Removed.
* config.in: Regenerate.
* dispnew.c (safe_bcopy): Only define as dummy if PROFILING.
* emacs.c (main) [PROFILING]: Don't declare
dump_opcode_frequencies.
* lisp.h (safe_bcopy): Remove declaration.
(memset) [!HAVE_MEMSET]: Declare.
(memcpy) [!HAVE_MEMCPY]: Likewise.
(memmove) [!HAVE_MEMMOVE]: Likewise.
(memcmp) [!HAVE_MEMCMP]: Likewise.
* s/ms-w32.h (bzero, bcopy, bcmp, GAP_USE_BCOPY)
(BCOPY_UPWARD_SAFE, BCOPY_DOWNWARD_SAFE, HAVE_BCOPY, HAVE_BCMP):
Don't define.
(HAVE_MEMCMP, HAVE_MEMCPY, HAVE_MEMMOVE, HAVE_MEMSET): Define.
* s/msdos.h (GAP_USE_BCOPY, BCOPY_UPWARD_SAFE)
(BCOPY_DOWNWARD_SAFE): Don't define.
* sysdep.c (memset) [!HAVE_MEMSET]: Define.
(memcpy) [!HAVE_MEMCPY]: Define.
(memmove) [!HAVE_MEMMOVE]: Define.
(memcmp) [!HAVE_MEMCMP]: Define.
* config.nt (HAVE_BCOPY, HAVE_BCMP): Remove undefs.
(HAVE_MEMCPY, HAVE_MEMMOVE, HAVE_MEMSET, HAVE_MEMCMP): Add undefs.
* sed2v2.inp (HAVE_MEMCPY, HAVE_MEMSET): Edit to 1.
(HAVE_BZERO): Don't edit.
* lwlib.c (lwlib_memset, lwlib_bcopy): Remove.
(malloc_widget_value, free_widget_info, allocate_widget_instance)
(lw_separator_p): Replace lwlib_memset, lwlib_bcopy, bzero, bcmp by
memset, memcpy, memcmp.
* lwlib-utils.c (XtApplyToWidgets): Likewise.
* xlwmenu.c (XlwMenuInitialize): Likewise.
* lwlib.h (lwlib_bcopy): Remove declaration.
* ebrowse.c (add_sym, make_namespace): Replace bcopy, bzero by
memcpy, memmove, memset.
* pop.c (pop_retrieve, socket_connection, pop_getline): Likewise.
* CPP-DEFINES (BCOPY_DOWNWARD_SAFE, BCOPY_UPWARD_SAFE)
(GAP_USE_BCOPY, HAVE_BCMP, HAVE_BCOPY, bcmp, bcopy, bzero):
Remove.
* configure.in: Don't check for bcopy, bcmp, bzero. Don't include
<strings.h> and don't define bcopy, bzero, BCMP in config.h.
2010-07-08 00:18:28 +02:00
|
|
|
|
memset (sa, 0, len);
|
(Qlocal, QCname, QCbuffer, QChost, QCservice, QCfamily)
(QClocal, QCremote, QCserver, QCdatagram, QCnowait, QCnoquery,QCstop)
(QCcoding, QCoptions, QCfilter, QCsentinel, QClog, QCfeature):
New variables.
(NETCONN1_P): New macro.
(DATAGRAM_SOCKETS): New conditional symbol.
(datagram_address): New array.
(DATAGRAM_CONN_P, DATAGRAM_CHAN_P): New macros.
(status_message): Use concat3.
(Fprocess_status): Add `listen' status to doc string. Return `stop'
for a stopped network process.
(Fset_process_buffer): Update contact plist for network process.
(Fset_process_filter): Ditto. Don't enable input for stopped
network processes. Server must listen, even if filter is t.
(Fset_process_query_on_exit_flag, Fprocess_query_on_exit_flag):
New functions.
(Fprocess_kill_without_query): Removed. Now defined in simple.el.
(Fprocess_contact): Added KEY argument. Handle datagrams.
(list_processes_1): Optionally show only processes with the query
on exit flag set. Dynamically adjust column widths. Omit tty
column if not needed. Report stopped network processes.
Identify server and datagram network processes.
(Flist_processes): New optional arg `query-only'.
(conv_sockaddr_to_lisp, get_lisp_to_sockaddr_size)
(conv_lisp_to_sockaddr, set_socket_options)
(network_process_featurep, unwind_request_sigio): New helper functions.
(Fprocess_datagram_address, Fset_process_datagram_address):
(Fset_network_process_options): New lisp functions.
(Fopen_network_stream): Removed. Now defined in simple.el.
(Fmake_network_process): New lisp function. Code is based on previous
Fopen_network_stream, but heavily reworked with new property list based
argument list, support for datagrams, server processes, and local
sockets in addition to old client-only functionality.
(server_accept_connection): New function.
(wait_reading_process_input): Use it to handle incoming connects.
Do not enable input on a new connection if process is stopped.
(read_process_output): Handle datagram sockets. Use 2k buffer for them.
(send_process): Handle datagram sockets.
(Fstop_process, Fcontinue_process): Apply to network processes. A stopped
network process is indicated by setting command field to t .
(Fprocess_send_eof): No-op if datagram connection.
(Fstatus_notify): Don't read input for a stream server socket or a
stopped network process.
(init_process): Initialize datagram_address array.
(syms_of_process): Intern and staticpro new variables, defsubr new
functions.
2002-03-17 20:20:33 +00:00
|
|
|
|
|
|
|
|
|
if (VECTORP (address))
|
|
|
|
|
{
|
|
|
|
|
p = XVECTOR (address);
|
|
|
|
|
if (family == AF_INET)
|
|
|
|
|
{
|
|
|
|
|
struct sockaddr_in *sin = (struct sockaddr_in *) sa;
|
|
|
|
|
len = sizeof (sin->sin_addr) + 1;
|
|
|
|
|
i = XINT (p->contents[--len]);
|
|
|
|
|
sin->sin_port = htons (i);
|
|
|
|
|
cp = (unsigned char *)&sin->sin_addr;
|
2006-04-13 01:08:27 +00:00
|
|
|
|
sa->sa_family = family;
|
(Qlocal, QCname, QCbuffer, QChost, QCservice, QCfamily)
(QClocal, QCremote, QCserver, QCdatagram, QCnowait, QCnoquery,QCstop)
(QCcoding, QCoptions, QCfilter, QCsentinel, QClog, QCfeature):
New variables.
(NETCONN1_P): New macro.
(DATAGRAM_SOCKETS): New conditional symbol.
(datagram_address): New array.
(DATAGRAM_CONN_P, DATAGRAM_CHAN_P): New macros.
(status_message): Use concat3.
(Fprocess_status): Add `listen' status to doc string. Return `stop'
for a stopped network process.
(Fset_process_buffer): Update contact plist for network process.
(Fset_process_filter): Ditto. Don't enable input for stopped
network processes. Server must listen, even if filter is t.
(Fset_process_query_on_exit_flag, Fprocess_query_on_exit_flag):
New functions.
(Fprocess_kill_without_query): Removed. Now defined in simple.el.
(Fprocess_contact): Added KEY argument. Handle datagrams.
(list_processes_1): Optionally show only processes with the query
on exit flag set. Dynamically adjust column widths. Omit tty
column if not needed. Report stopped network processes.
Identify server and datagram network processes.
(Flist_processes): New optional arg `query-only'.
(conv_sockaddr_to_lisp, get_lisp_to_sockaddr_size)
(conv_lisp_to_sockaddr, set_socket_options)
(network_process_featurep, unwind_request_sigio): New helper functions.
(Fprocess_datagram_address, Fset_process_datagram_address):
(Fset_network_process_options): New lisp functions.
(Fopen_network_stream): Removed. Now defined in simple.el.
(Fmake_network_process): New lisp function. Code is based on previous
Fopen_network_stream, but heavily reworked with new property list based
argument list, support for datagrams, server processes, and local
sockets in addition to old client-only functionality.
(server_accept_connection): New function.
(wait_reading_process_input): Use it to handle incoming connects.
Do not enable input on a new connection if process is stopped.
(read_process_output): Handle datagram sockets. Use 2k buffer for them.
(send_process): Handle datagram sockets.
(Fstop_process, Fcontinue_process): Apply to network processes. A stopped
network process is indicated by setting command field to t .
(Fprocess_send_eof): No-op if datagram connection.
(Fstatus_notify): Don't read input for a stream server socket or a
stopped network process.
(init_process): Initialize datagram_address array.
(syms_of_process): Intern and staticpro new variables, defsubr new
functions.
2002-03-17 20:20:33 +00:00
|
|
|
|
}
|
2006-01-04 00:16:54 +00:00
|
|
|
|
#ifdef AF_INET6
|
|
|
|
|
else if (family == AF_INET6)
|
|
|
|
|
{
|
|
|
|
|
struct sockaddr_in6 *sin6 = (struct sockaddr_in6 *) sa;
|
|
|
|
|
uint16_t *ip6 = (uint16_t *)&sin6->sin6_addr;
|
|
|
|
|
len = sizeof (sin6->sin6_addr) + 1;
|
|
|
|
|
i = XINT (p->contents[--len]);
|
|
|
|
|
sin6->sin6_port = htons (i);
|
|
|
|
|
for (i = 0; i < len; i++)
|
|
|
|
|
if (INTEGERP (p->contents[i]))
|
|
|
|
|
{
|
|
|
|
|
int j = XFASTINT (p->contents[i]) & 0xffff;
|
|
|
|
|
ip6[i] = ntohs (j);
|
|
|
|
|
}
|
2006-04-13 01:08:27 +00:00
|
|
|
|
sa->sa_family = family;
|
2010-06-04 00:47:35 +02:00
|
|
|
|
return;
|
2006-01-04 00:16:54 +00:00
|
|
|
|
}
|
|
|
|
|
#endif
|
2010-06-04 00:47:35 +02:00
|
|
|
|
else
|
|
|
|
|
return;
|
(Qlocal, QCname, QCbuffer, QChost, QCservice, QCfamily)
(QClocal, QCremote, QCserver, QCdatagram, QCnowait, QCnoquery,QCstop)
(QCcoding, QCoptions, QCfilter, QCsentinel, QClog, QCfeature):
New variables.
(NETCONN1_P): New macro.
(DATAGRAM_SOCKETS): New conditional symbol.
(datagram_address): New array.
(DATAGRAM_CONN_P, DATAGRAM_CHAN_P): New macros.
(status_message): Use concat3.
(Fprocess_status): Add `listen' status to doc string. Return `stop'
for a stopped network process.
(Fset_process_buffer): Update contact plist for network process.
(Fset_process_filter): Ditto. Don't enable input for stopped
network processes. Server must listen, even if filter is t.
(Fset_process_query_on_exit_flag, Fprocess_query_on_exit_flag):
New functions.
(Fprocess_kill_without_query): Removed. Now defined in simple.el.
(Fprocess_contact): Added KEY argument. Handle datagrams.
(list_processes_1): Optionally show only processes with the query
on exit flag set. Dynamically adjust column widths. Omit tty
column if not needed. Report stopped network processes.
Identify server and datagram network processes.
(Flist_processes): New optional arg `query-only'.
(conv_sockaddr_to_lisp, get_lisp_to_sockaddr_size)
(conv_lisp_to_sockaddr, set_socket_options)
(network_process_featurep, unwind_request_sigio): New helper functions.
(Fprocess_datagram_address, Fset_process_datagram_address):
(Fset_network_process_options): New lisp functions.
(Fopen_network_stream): Removed. Now defined in simple.el.
(Fmake_network_process): New lisp function. Code is based on previous
Fopen_network_stream, but heavily reworked with new property list based
argument list, support for datagrams, server processes, and local
sockets in addition to old client-only functionality.
(server_accept_connection): New function.
(wait_reading_process_input): Use it to handle incoming connects.
Do not enable input on a new connection if process is stopped.
(read_process_output): Handle datagram sockets. Use 2k buffer for them.
(send_process): Handle datagram sockets.
(Fstop_process, Fcontinue_process): Apply to network processes. A stopped
network process is indicated by setting command field to t .
(Fprocess_send_eof): No-op if datagram connection.
(Fstatus_notify): Don't read input for a stream server socket or a
stopped network process.
(init_process): Initialize datagram_address array.
(syms_of_process): Intern and staticpro new variables, defsubr new
functions.
2002-03-17 20:20:33 +00:00
|
|
|
|
}
|
|
|
|
|
else if (STRINGP (address))
|
|
|
|
|
{
|
|
|
|
|
#ifdef HAVE_LOCAL_SOCKETS
|
|
|
|
|
if (family == AF_LOCAL)
|
|
|
|
|
{
|
2002-03-20 18:10:01 +00:00
|
|
|
|
struct sockaddr_un *sockun = (struct sockaddr_un *) sa;
|
2002-07-15 00:01:34 +00:00
|
|
|
|
cp = SDATA (address);
|
2002-03-20 18:10:01 +00:00
|
|
|
|
for (i = 0; i < sizeof (sockun->sun_path) && *cp; i++)
|
|
|
|
|
sockun->sun_path[i] = *cp++;
|
2006-04-13 01:08:27 +00:00
|
|
|
|
sa->sa_family = family;
|
(Qlocal, QCname, QCbuffer, QChost, QCservice, QCfamily)
(QClocal, QCremote, QCserver, QCdatagram, QCnowait, QCnoquery,QCstop)
(QCcoding, QCoptions, QCfilter, QCsentinel, QClog, QCfeature):
New variables.
(NETCONN1_P): New macro.
(DATAGRAM_SOCKETS): New conditional symbol.
(datagram_address): New array.
(DATAGRAM_CONN_P, DATAGRAM_CHAN_P): New macros.
(status_message): Use concat3.
(Fprocess_status): Add `listen' status to doc string. Return `stop'
for a stopped network process.
(Fset_process_buffer): Update contact plist for network process.
(Fset_process_filter): Ditto. Don't enable input for stopped
network processes. Server must listen, even if filter is t.
(Fset_process_query_on_exit_flag, Fprocess_query_on_exit_flag):
New functions.
(Fprocess_kill_without_query): Removed. Now defined in simple.el.
(Fprocess_contact): Added KEY argument. Handle datagrams.
(list_processes_1): Optionally show only processes with the query
on exit flag set. Dynamically adjust column widths. Omit tty
column if not needed. Report stopped network processes.
Identify server and datagram network processes.
(Flist_processes): New optional arg `query-only'.
(conv_sockaddr_to_lisp, get_lisp_to_sockaddr_size)
(conv_lisp_to_sockaddr, set_socket_options)
(network_process_featurep, unwind_request_sigio): New helper functions.
(Fprocess_datagram_address, Fset_process_datagram_address):
(Fset_network_process_options): New lisp functions.
(Fopen_network_stream): Removed. Now defined in simple.el.
(Fmake_network_process): New lisp function. Code is based on previous
Fopen_network_stream, but heavily reworked with new property list based
argument list, support for datagrams, server processes, and local
sockets in addition to old client-only functionality.
(server_accept_connection): New function.
(wait_reading_process_input): Use it to handle incoming connects.
Do not enable input on a new connection if process is stopped.
(read_process_output): Handle datagram sockets. Use 2k buffer for them.
(send_process): Handle datagram sockets.
(Fstop_process, Fcontinue_process): Apply to network processes. A stopped
network process is indicated by setting command field to t .
(Fprocess_send_eof): No-op if datagram connection.
(Fstatus_notify): Don't read input for a stream server socket or a
stopped network process.
(init_process): Initialize datagram_address array.
(syms_of_process): Intern and staticpro new variables, defsubr new
functions.
2002-03-17 20:20:33 +00:00
|
|
|
|
}
|
|
|
|
|
#endif
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
p = XVECTOR (XCDR (address));
|
|
|
|
|
cp = (unsigned char *)sa + sizeof (sa->sa_family);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
for (i = 0; i < len; i++)
|
|
|
|
|
if (INTEGERP (p->contents[i]))
|
|
|
|
|
*cp++ = XFASTINT (p->contents[i]) & 0xff;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
#ifdef DATAGRAM_SOCKETS
|
|
|
|
|
DEFUN ("process-datagram-address", Fprocess_datagram_address, Sprocess_datagram_address,
|
|
|
|
|
1, 1, 0,
|
|
|
|
|
doc: /* Get the current datagram address associated with PROCESS. */)
|
2010-07-08 14:25:08 -07:00
|
|
|
|
(Lisp_Object process)
|
(Qlocal, QCname, QCbuffer, QChost, QCservice, QCfamily)
(QClocal, QCremote, QCserver, QCdatagram, QCnowait, QCnoquery,QCstop)
(QCcoding, QCoptions, QCfilter, QCsentinel, QClog, QCfeature):
New variables.
(NETCONN1_P): New macro.
(DATAGRAM_SOCKETS): New conditional symbol.
(datagram_address): New array.
(DATAGRAM_CONN_P, DATAGRAM_CHAN_P): New macros.
(status_message): Use concat3.
(Fprocess_status): Add `listen' status to doc string. Return `stop'
for a stopped network process.
(Fset_process_buffer): Update contact plist for network process.
(Fset_process_filter): Ditto. Don't enable input for stopped
network processes. Server must listen, even if filter is t.
(Fset_process_query_on_exit_flag, Fprocess_query_on_exit_flag):
New functions.
(Fprocess_kill_without_query): Removed. Now defined in simple.el.
(Fprocess_contact): Added KEY argument. Handle datagrams.
(list_processes_1): Optionally show only processes with the query
on exit flag set. Dynamically adjust column widths. Omit tty
column if not needed. Report stopped network processes.
Identify server and datagram network processes.
(Flist_processes): New optional arg `query-only'.
(conv_sockaddr_to_lisp, get_lisp_to_sockaddr_size)
(conv_lisp_to_sockaddr, set_socket_options)
(network_process_featurep, unwind_request_sigio): New helper functions.
(Fprocess_datagram_address, Fset_process_datagram_address):
(Fset_network_process_options): New lisp functions.
(Fopen_network_stream): Removed. Now defined in simple.el.
(Fmake_network_process): New lisp function. Code is based on previous
Fopen_network_stream, but heavily reworked with new property list based
argument list, support for datagrams, server processes, and local
sockets in addition to old client-only functionality.
(server_accept_connection): New function.
(wait_reading_process_input): Use it to handle incoming connects.
Do not enable input on a new connection if process is stopped.
(read_process_output): Handle datagram sockets. Use 2k buffer for them.
(send_process): Handle datagram sockets.
(Fstop_process, Fcontinue_process): Apply to network processes. A stopped
network process is indicated by setting command field to t .
(Fprocess_send_eof): No-op if datagram connection.
(Fstatus_notify): Don't read input for a stream server socket or a
stopped network process.
(init_process): Initialize datagram_address array.
(syms_of_process): Intern and staticpro new variables, defsubr new
functions.
2002-03-17 20:20:33 +00:00
|
|
|
|
{
|
|
|
|
|
int channel;
|
|
|
|
|
|
|
|
|
|
CHECK_PROCESS (process);
|
|
|
|
|
|
|
|
|
|
if (!DATAGRAM_CONN_P (process))
|
|
|
|
|
return Qnil;
|
|
|
|
|
|
(struct Lisp_Process): Turn slots infd, outfd, kill_without_query, pty_flag,
tick, update_tick, decoding_carryover, inherit_coding_system_flag,
filter_multibyte, adaptive_read_buffering, read_output_delay, and
read_output_skip from Lisp_Objects to ints. Remove unused
encoding_carryover.
2007-07-12 06:36:57 +00:00
|
|
|
|
channel = XPROCESS (process)->infd;
|
(Qlocal, QCname, QCbuffer, QChost, QCservice, QCfamily)
(QClocal, QCremote, QCserver, QCdatagram, QCnowait, QCnoquery,QCstop)
(QCcoding, QCoptions, QCfilter, QCsentinel, QClog, QCfeature):
New variables.
(NETCONN1_P): New macro.
(DATAGRAM_SOCKETS): New conditional symbol.
(datagram_address): New array.
(DATAGRAM_CONN_P, DATAGRAM_CHAN_P): New macros.
(status_message): Use concat3.
(Fprocess_status): Add `listen' status to doc string. Return `stop'
for a stopped network process.
(Fset_process_buffer): Update contact plist for network process.
(Fset_process_filter): Ditto. Don't enable input for stopped
network processes. Server must listen, even if filter is t.
(Fset_process_query_on_exit_flag, Fprocess_query_on_exit_flag):
New functions.
(Fprocess_kill_without_query): Removed. Now defined in simple.el.
(Fprocess_contact): Added KEY argument. Handle datagrams.
(list_processes_1): Optionally show only processes with the query
on exit flag set. Dynamically adjust column widths. Omit tty
column if not needed. Report stopped network processes.
Identify server and datagram network processes.
(Flist_processes): New optional arg `query-only'.
(conv_sockaddr_to_lisp, get_lisp_to_sockaddr_size)
(conv_lisp_to_sockaddr, set_socket_options)
(network_process_featurep, unwind_request_sigio): New helper functions.
(Fprocess_datagram_address, Fset_process_datagram_address):
(Fset_network_process_options): New lisp functions.
(Fopen_network_stream): Removed. Now defined in simple.el.
(Fmake_network_process): New lisp function. Code is based on previous
Fopen_network_stream, but heavily reworked with new property list based
argument list, support for datagrams, server processes, and local
sockets in addition to old client-only functionality.
(server_accept_connection): New function.
(wait_reading_process_input): Use it to handle incoming connects.
Do not enable input on a new connection if process is stopped.
(read_process_output): Handle datagram sockets. Use 2k buffer for them.
(send_process): Handle datagram sockets.
(Fstop_process, Fcontinue_process): Apply to network processes. A stopped
network process is indicated by setting command field to t .
(Fprocess_send_eof): No-op if datagram connection.
(Fstatus_notify): Don't read input for a stream server socket or a
stopped network process.
(init_process): Initialize datagram_address array.
(syms_of_process): Intern and staticpro new variables, defsubr new
functions.
2002-03-17 20:20:33 +00:00
|
|
|
|
return conv_sockaddr_to_lisp (datagram_address[channel].sa,
|
|
|
|
|
datagram_address[channel].len);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
DEFUN ("set-process-datagram-address", Fset_process_datagram_address, Sset_process_datagram_address,
|
|
|
|
|
2, 2, 0,
|
|
|
|
|
doc: /* Set the datagram address for PROCESS to ADDRESS.
|
|
|
|
|
Returns nil upon error setting address, ADDRESS otherwise. */)
|
2010-07-08 14:25:08 -07:00
|
|
|
|
(Lisp_Object process, Lisp_Object address)
|
(Qlocal, QCname, QCbuffer, QChost, QCservice, QCfamily)
(QClocal, QCremote, QCserver, QCdatagram, QCnowait, QCnoquery,QCstop)
(QCcoding, QCoptions, QCfilter, QCsentinel, QClog, QCfeature):
New variables.
(NETCONN1_P): New macro.
(DATAGRAM_SOCKETS): New conditional symbol.
(datagram_address): New array.
(DATAGRAM_CONN_P, DATAGRAM_CHAN_P): New macros.
(status_message): Use concat3.
(Fprocess_status): Add `listen' status to doc string. Return `stop'
for a stopped network process.
(Fset_process_buffer): Update contact plist for network process.
(Fset_process_filter): Ditto. Don't enable input for stopped
network processes. Server must listen, even if filter is t.
(Fset_process_query_on_exit_flag, Fprocess_query_on_exit_flag):
New functions.
(Fprocess_kill_without_query): Removed. Now defined in simple.el.
(Fprocess_contact): Added KEY argument. Handle datagrams.
(list_processes_1): Optionally show only processes with the query
on exit flag set. Dynamically adjust column widths. Omit tty
column if not needed. Report stopped network processes.
Identify server and datagram network processes.
(Flist_processes): New optional arg `query-only'.
(conv_sockaddr_to_lisp, get_lisp_to_sockaddr_size)
(conv_lisp_to_sockaddr, set_socket_options)
(network_process_featurep, unwind_request_sigio): New helper functions.
(Fprocess_datagram_address, Fset_process_datagram_address):
(Fset_network_process_options): New lisp functions.
(Fopen_network_stream): Removed. Now defined in simple.el.
(Fmake_network_process): New lisp function. Code is based on previous
Fopen_network_stream, but heavily reworked with new property list based
argument list, support for datagrams, server processes, and local
sockets in addition to old client-only functionality.
(server_accept_connection): New function.
(wait_reading_process_input): Use it to handle incoming connects.
Do not enable input on a new connection if process is stopped.
(read_process_output): Handle datagram sockets. Use 2k buffer for them.
(send_process): Handle datagram sockets.
(Fstop_process, Fcontinue_process): Apply to network processes. A stopped
network process is indicated by setting command field to t .
(Fprocess_send_eof): No-op if datagram connection.
(Fstatus_notify): Don't read input for a stream server socket or a
stopped network process.
(init_process): Initialize datagram_address array.
(syms_of_process): Intern and staticpro new variables, defsubr new
functions.
2002-03-17 20:20:33 +00:00
|
|
|
|
{
|
|
|
|
|
int channel;
|
|
|
|
|
int family, len;
|
|
|
|
|
|
|
|
|
|
CHECK_PROCESS (process);
|
|
|
|
|
|
|
|
|
|
if (!DATAGRAM_CONN_P (process))
|
|
|
|
|
return Qnil;
|
|
|
|
|
|
(struct Lisp_Process): Turn slots infd, outfd, kill_without_query, pty_flag,
tick, update_tick, decoding_carryover, inherit_coding_system_flag,
filter_multibyte, adaptive_read_buffering, read_output_delay, and
read_output_skip from Lisp_Objects to ints. Remove unused
encoding_carryover.
2007-07-12 06:36:57 +00:00
|
|
|
|
channel = XPROCESS (process)->infd;
|
(Qlocal, QCname, QCbuffer, QChost, QCservice, QCfamily)
(QClocal, QCremote, QCserver, QCdatagram, QCnowait, QCnoquery,QCstop)
(QCcoding, QCoptions, QCfilter, QCsentinel, QClog, QCfeature):
New variables.
(NETCONN1_P): New macro.
(DATAGRAM_SOCKETS): New conditional symbol.
(datagram_address): New array.
(DATAGRAM_CONN_P, DATAGRAM_CHAN_P): New macros.
(status_message): Use concat3.
(Fprocess_status): Add `listen' status to doc string. Return `stop'
for a stopped network process.
(Fset_process_buffer): Update contact plist for network process.
(Fset_process_filter): Ditto. Don't enable input for stopped
network processes. Server must listen, even if filter is t.
(Fset_process_query_on_exit_flag, Fprocess_query_on_exit_flag):
New functions.
(Fprocess_kill_without_query): Removed. Now defined in simple.el.
(Fprocess_contact): Added KEY argument. Handle datagrams.
(list_processes_1): Optionally show only processes with the query
on exit flag set. Dynamically adjust column widths. Omit tty
column if not needed. Report stopped network processes.
Identify server and datagram network processes.
(Flist_processes): New optional arg `query-only'.
(conv_sockaddr_to_lisp, get_lisp_to_sockaddr_size)
(conv_lisp_to_sockaddr, set_socket_options)
(network_process_featurep, unwind_request_sigio): New helper functions.
(Fprocess_datagram_address, Fset_process_datagram_address):
(Fset_network_process_options): New lisp functions.
(Fopen_network_stream): Removed. Now defined in simple.el.
(Fmake_network_process): New lisp function. Code is based on previous
Fopen_network_stream, but heavily reworked with new property list based
argument list, support for datagrams, server processes, and local
sockets in addition to old client-only functionality.
(server_accept_connection): New function.
(wait_reading_process_input): Use it to handle incoming connects.
Do not enable input on a new connection if process is stopped.
(read_process_output): Handle datagram sockets. Use 2k buffer for them.
(send_process): Handle datagram sockets.
(Fstop_process, Fcontinue_process): Apply to network processes. A stopped
network process is indicated by setting command field to t .
(Fprocess_send_eof): No-op if datagram connection.
(Fstatus_notify): Don't read input for a stream server socket or a
stopped network process.
(init_process): Initialize datagram_address array.
(syms_of_process): Intern and staticpro new variables, defsubr new
functions.
2002-03-17 20:20:33 +00:00
|
|
|
|
|
|
|
|
|
len = get_lisp_to_sockaddr_size (address, &family);
|
|
|
|
|
if (datagram_address[channel].len != len)
|
|
|
|
|
return Qnil;
|
|
|
|
|
conv_lisp_to_sockaddr (family, address, datagram_address[channel].sa, len);
|
|
|
|
|
return address;
|
|
|
|
|
}
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
|
* process.c (socket_options): Make it const.
(set_socket_option, init_process): Use a const pointer.
* lread.c (intern_c_string): New function.
(defvar_kboard, defvar_lisp, defvar_lisp_nopro, defvar_bool)
(defvar_int): Uset it. Make the name const char*.
* lisp.h (defvar_kboard, defvar_lisp, defvar_lisp_nopro, defvar_bool)
(defvar_int): Update prototypes.
(DEFUN, EXFUN): Support for prototypes is now required.
(intern_c_string): New prototype.
(struct Lisp_Subr): Make symbol_name constant.
* font.c (struct table_entry): Remove unused member. Make NAMES
constant.
(weight_table, slant_table, width_table): Make constant.
* emacs.c (struct standard_args): Make name and longname constant.
* character.h (DEFSYM): Use intern_c_string.
2009-11-06 06:07:46 +00:00
|
|
|
|
static const struct socket_options {
|
(Qlocal, QCname, QCbuffer, QChost, QCservice, QCfamily)
(QClocal, QCremote, QCserver, QCdatagram, QCnowait, QCnoquery,QCstop)
(QCcoding, QCoptions, QCfilter, QCsentinel, QClog, QCfeature):
New variables.
(NETCONN1_P): New macro.
(DATAGRAM_SOCKETS): New conditional symbol.
(datagram_address): New array.
(DATAGRAM_CONN_P, DATAGRAM_CHAN_P): New macros.
(status_message): Use concat3.
(Fprocess_status): Add `listen' status to doc string. Return `stop'
for a stopped network process.
(Fset_process_buffer): Update contact plist for network process.
(Fset_process_filter): Ditto. Don't enable input for stopped
network processes. Server must listen, even if filter is t.
(Fset_process_query_on_exit_flag, Fprocess_query_on_exit_flag):
New functions.
(Fprocess_kill_without_query): Removed. Now defined in simple.el.
(Fprocess_contact): Added KEY argument. Handle datagrams.
(list_processes_1): Optionally show only processes with the query
on exit flag set. Dynamically adjust column widths. Omit tty
column if not needed. Report stopped network processes.
Identify server and datagram network processes.
(Flist_processes): New optional arg `query-only'.
(conv_sockaddr_to_lisp, get_lisp_to_sockaddr_size)
(conv_lisp_to_sockaddr, set_socket_options)
(network_process_featurep, unwind_request_sigio): New helper functions.
(Fprocess_datagram_address, Fset_process_datagram_address):
(Fset_network_process_options): New lisp functions.
(Fopen_network_stream): Removed. Now defined in simple.el.
(Fmake_network_process): New lisp function. Code is based on previous
Fopen_network_stream, but heavily reworked with new property list based
argument list, support for datagrams, server processes, and local
sockets in addition to old client-only functionality.
(server_accept_connection): New function.
(wait_reading_process_input): Use it to handle incoming connects.
Do not enable input on a new connection if process is stopped.
(read_process_output): Handle datagram sockets. Use 2k buffer for them.
(send_process): Handle datagram sockets.
(Fstop_process, Fcontinue_process): Apply to network processes. A stopped
network process is indicated by setting command field to t .
(Fprocess_send_eof): No-op if datagram connection.
(Fstatus_notify): Don't read input for a stream server socket or a
stopped network process.
(init_process): Initialize datagram_address array.
(syms_of_process): Intern and staticpro new variables, defsubr new
functions.
2002-03-17 20:20:33 +00:00
|
|
|
|
/* The name of this option. Should be lowercase version of option
|
2003-02-04 14:56:31 +00:00
|
|
|
|
name without SO_ prefix. */
|
2010-08-05 17:36:12 -07:00
|
|
|
|
const char *name;
|
(Qlocal, QCname, QCbuffer, QChost, QCservice, QCfamily)
(QClocal, QCremote, QCserver, QCdatagram, QCnowait, QCnoquery,QCstop)
(QCcoding, QCoptions, QCfilter, QCsentinel, QClog, QCfeature):
New variables.
(NETCONN1_P): New macro.
(DATAGRAM_SOCKETS): New conditional symbol.
(datagram_address): New array.
(DATAGRAM_CONN_P, DATAGRAM_CHAN_P): New macros.
(status_message): Use concat3.
(Fprocess_status): Add `listen' status to doc string. Return `stop'
for a stopped network process.
(Fset_process_buffer): Update contact plist for network process.
(Fset_process_filter): Ditto. Don't enable input for stopped
network processes. Server must listen, even if filter is t.
(Fset_process_query_on_exit_flag, Fprocess_query_on_exit_flag):
New functions.
(Fprocess_kill_without_query): Removed. Now defined in simple.el.
(Fprocess_contact): Added KEY argument. Handle datagrams.
(list_processes_1): Optionally show only processes with the query
on exit flag set. Dynamically adjust column widths. Omit tty
column if not needed. Report stopped network processes.
Identify server and datagram network processes.
(Flist_processes): New optional arg `query-only'.
(conv_sockaddr_to_lisp, get_lisp_to_sockaddr_size)
(conv_lisp_to_sockaddr, set_socket_options)
(network_process_featurep, unwind_request_sigio): New helper functions.
(Fprocess_datagram_address, Fset_process_datagram_address):
(Fset_network_process_options): New lisp functions.
(Fopen_network_stream): Removed. Now defined in simple.el.
(Fmake_network_process): New lisp function. Code is based on previous
Fopen_network_stream, but heavily reworked with new property list based
argument list, support for datagrams, server processes, and local
sockets in addition to old client-only functionality.
(server_accept_connection): New function.
(wait_reading_process_input): Use it to handle incoming connects.
Do not enable input on a new connection if process is stopped.
(read_process_output): Handle datagram sockets. Use 2k buffer for them.
(send_process): Handle datagram sockets.
(Fstop_process, Fcontinue_process): Apply to network processes. A stopped
network process is indicated by setting command field to t .
(Fprocess_send_eof): No-op if datagram connection.
(Fstatus_notify): Don't read input for a stream server socket or a
stopped network process.
(init_process): Initialize datagram_address array.
(syms_of_process): Intern and staticpro new variables, defsubr new
functions.
2002-03-17 20:20:33 +00:00
|
|
|
|
/* Option level SOL_... */
|
|
|
|
|
int optlevel;
|
|
|
|
|
/* Option number SO_... */
|
|
|
|
|
int optnum;
|
2004-04-16 12:51:06 +00:00
|
|
|
|
enum { SOPT_UNKNOWN, SOPT_BOOL, SOPT_INT, SOPT_IFNAME, SOPT_LINGER } opttype;
|
|
|
|
|
enum { OPIX_NONE=0, OPIX_MISC=1, OPIX_REUSEADDR=2 } optbit;
|
(Qlocal, QCname, QCbuffer, QChost, QCservice, QCfamily)
(QClocal, QCremote, QCserver, QCdatagram, QCnowait, QCnoquery,QCstop)
(QCcoding, QCoptions, QCfilter, QCsentinel, QClog, QCfeature):
New variables.
(NETCONN1_P): New macro.
(DATAGRAM_SOCKETS): New conditional symbol.
(datagram_address): New array.
(DATAGRAM_CONN_P, DATAGRAM_CHAN_P): New macros.
(status_message): Use concat3.
(Fprocess_status): Add `listen' status to doc string. Return `stop'
for a stopped network process.
(Fset_process_buffer): Update contact plist for network process.
(Fset_process_filter): Ditto. Don't enable input for stopped
network processes. Server must listen, even if filter is t.
(Fset_process_query_on_exit_flag, Fprocess_query_on_exit_flag):
New functions.
(Fprocess_kill_without_query): Removed. Now defined in simple.el.
(Fprocess_contact): Added KEY argument. Handle datagrams.
(list_processes_1): Optionally show only processes with the query
on exit flag set. Dynamically adjust column widths. Omit tty
column if not needed. Report stopped network processes.
Identify server and datagram network processes.
(Flist_processes): New optional arg `query-only'.
(conv_sockaddr_to_lisp, get_lisp_to_sockaddr_size)
(conv_lisp_to_sockaddr, set_socket_options)
(network_process_featurep, unwind_request_sigio): New helper functions.
(Fprocess_datagram_address, Fset_process_datagram_address):
(Fset_network_process_options): New lisp functions.
(Fopen_network_stream): Removed. Now defined in simple.el.
(Fmake_network_process): New lisp function. Code is based on previous
Fopen_network_stream, but heavily reworked with new property list based
argument list, support for datagrams, server processes, and local
sockets in addition to old client-only functionality.
(server_accept_connection): New function.
(wait_reading_process_input): Use it to handle incoming connects.
Do not enable input on a new connection if process is stopped.
(read_process_output): Handle datagram sockets. Use 2k buffer for them.
(send_process): Handle datagram sockets.
(Fstop_process, Fcontinue_process): Apply to network processes. A stopped
network process is indicated by setting command field to t .
(Fprocess_send_eof): No-op if datagram connection.
(Fstatus_notify): Don't read input for a stream server socket or a
stopped network process.
(init_process): Initialize datagram_address array.
(syms_of_process): Intern and staticpro new variables, defsubr new
functions.
2002-03-17 20:20:33 +00:00
|
|
|
|
} socket_options[] =
|
|
|
|
|
{
|
|
|
|
|
#ifdef SO_BINDTODEVICE
|
2004-04-16 12:51:06 +00:00
|
|
|
|
{ ":bindtodevice", SOL_SOCKET, SO_BINDTODEVICE, SOPT_IFNAME, OPIX_MISC },
|
(Qlocal, QCname, QCbuffer, QChost, QCservice, QCfamily)
(QClocal, QCremote, QCserver, QCdatagram, QCnowait, QCnoquery,QCstop)
(QCcoding, QCoptions, QCfilter, QCsentinel, QClog, QCfeature):
New variables.
(NETCONN1_P): New macro.
(DATAGRAM_SOCKETS): New conditional symbol.
(datagram_address): New array.
(DATAGRAM_CONN_P, DATAGRAM_CHAN_P): New macros.
(status_message): Use concat3.
(Fprocess_status): Add `listen' status to doc string. Return `stop'
for a stopped network process.
(Fset_process_buffer): Update contact plist for network process.
(Fset_process_filter): Ditto. Don't enable input for stopped
network processes. Server must listen, even if filter is t.
(Fset_process_query_on_exit_flag, Fprocess_query_on_exit_flag):
New functions.
(Fprocess_kill_without_query): Removed. Now defined in simple.el.
(Fprocess_contact): Added KEY argument. Handle datagrams.
(list_processes_1): Optionally show only processes with the query
on exit flag set. Dynamically adjust column widths. Omit tty
column if not needed. Report stopped network processes.
Identify server and datagram network processes.
(Flist_processes): New optional arg `query-only'.
(conv_sockaddr_to_lisp, get_lisp_to_sockaddr_size)
(conv_lisp_to_sockaddr, set_socket_options)
(network_process_featurep, unwind_request_sigio): New helper functions.
(Fprocess_datagram_address, Fset_process_datagram_address):
(Fset_network_process_options): New lisp functions.
(Fopen_network_stream): Removed. Now defined in simple.el.
(Fmake_network_process): New lisp function. Code is based on previous
Fopen_network_stream, but heavily reworked with new property list based
argument list, support for datagrams, server processes, and local
sockets in addition to old client-only functionality.
(server_accept_connection): New function.
(wait_reading_process_input): Use it to handle incoming connects.
Do not enable input on a new connection if process is stopped.
(read_process_output): Handle datagram sockets. Use 2k buffer for them.
(send_process): Handle datagram sockets.
(Fstop_process, Fcontinue_process): Apply to network processes. A stopped
network process is indicated by setting command field to t .
(Fprocess_send_eof): No-op if datagram connection.
(Fstatus_notify): Don't read input for a stream server socket or a
stopped network process.
(init_process): Initialize datagram_address array.
(syms_of_process): Intern and staticpro new variables, defsubr new
functions.
2002-03-17 20:20:33 +00:00
|
|
|
|
#endif
|
|
|
|
|
#ifdef SO_BROADCAST
|
2004-04-16 12:51:06 +00:00
|
|
|
|
{ ":broadcast", SOL_SOCKET, SO_BROADCAST, SOPT_BOOL, OPIX_MISC },
|
(Qlocal, QCname, QCbuffer, QChost, QCservice, QCfamily)
(QClocal, QCremote, QCserver, QCdatagram, QCnowait, QCnoquery,QCstop)
(QCcoding, QCoptions, QCfilter, QCsentinel, QClog, QCfeature):
New variables.
(NETCONN1_P): New macro.
(DATAGRAM_SOCKETS): New conditional symbol.
(datagram_address): New array.
(DATAGRAM_CONN_P, DATAGRAM_CHAN_P): New macros.
(status_message): Use concat3.
(Fprocess_status): Add `listen' status to doc string. Return `stop'
for a stopped network process.
(Fset_process_buffer): Update contact plist for network process.
(Fset_process_filter): Ditto. Don't enable input for stopped
network processes. Server must listen, even if filter is t.
(Fset_process_query_on_exit_flag, Fprocess_query_on_exit_flag):
New functions.
(Fprocess_kill_without_query): Removed. Now defined in simple.el.
(Fprocess_contact): Added KEY argument. Handle datagrams.
(list_processes_1): Optionally show only processes with the query
on exit flag set. Dynamically adjust column widths. Omit tty
column if not needed. Report stopped network processes.
Identify server and datagram network processes.
(Flist_processes): New optional arg `query-only'.
(conv_sockaddr_to_lisp, get_lisp_to_sockaddr_size)
(conv_lisp_to_sockaddr, set_socket_options)
(network_process_featurep, unwind_request_sigio): New helper functions.
(Fprocess_datagram_address, Fset_process_datagram_address):
(Fset_network_process_options): New lisp functions.
(Fopen_network_stream): Removed. Now defined in simple.el.
(Fmake_network_process): New lisp function. Code is based on previous
Fopen_network_stream, but heavily reworked with new property list based
argument list, support for datagrams, server processes, and local
sockets in addition to old client-only functionality.
(server_accept_connection): New function.
(wait_reading_process_input): Use it to handle incoming connects.
Do not enable input on a new connection if process is stopped.
(read_process_output): Handle datagram sockets. Use 2k buffer for them.
(send_process): Handle datagram sockets.
(Fstop_process, Fcontinue_process): Apply to network processes. A stopped
network process is indicated by setting command field to t .
(Fprocess_send_eof): No-op if datagram connection.
(Fstatus_notify): Don't read input for a stream server socket or a
stopped network process.
(init_process): Initialize datagram_address array.
(syms_of_process): Intern and staticpro new variables, defsubr new
functions.
2002-03-17 20:20:33 +00:00
|
|
|
|
#endif
|
|
|
|
|
#ifdef SO_DONTROUTE
|
2004-04-16 12:51:06 +00:00
|
|
|
|
{ ":dontroute", SOL_SOCKET, SO_DONTROUTE, SOPT_BOOL, OPIX_MISC },
|
(Qlocal, QCname, QCbuffer, QChost, QCservice, QCfamily)
(QClocal, QCremote, QCserver, QCdatagram, QCnowait, QCnoquery,QCstop)
(QCcoding, QCoptions, QCfilter, QCsentinel, QClog, QCfeature):
New variables.
(NETCONN1_P): New macro.
(DATAGRAM_SOCKETS): New conditional symbol.
(datagram_address): New array.
(DATAGRAM_CONN_P, DATAGRAM_CHAN_P): New macros.
(status_message): Use concat3.
(Fprocess_status): Add `listen' status to doc string. Return `stop'
for a stopped network process.
(Fset_process_buffer): Update contact plist for network process.
(Fset_process_filter): Ditto. Don't enable input for stopped
network processes. Server must listen, even if filter is t.
(Fset_process_query_on_exit_flag, Fprocess_query_on_exit_flag):
New functions.
(Fprocess_kill_without_query): Removed. Now defined in simple.el.
(Fprocess_contact): Added KEY argument. Handle datagrams.
(list_processes_1): Optionally show only processes with the query
on exit flag set. Dynamically adjust column widths. Omit tty
column if not needed. Report stopped network processes.
Identify server and datagram network processes.
(Flist_processes): New optional arg `query-only'.
(conv_sockaddr_to_lisp, get_lisp_to_sockaddr_size)
(conv_lisp_to_sockaddr, set_socket_options)
(network_process_featurep, unwind_request_sigio): New helper functions.
(Fprocess_datagram_address, Fset_process_datagram_address):
(Fset_network_process_options): New lisp functions.
(Fopen_network_stream): Removed. Now defined in simple.el.
(Fmake_network_process): New lisp function. Code is based on previous
Fopen_network_stream, but heavily reworked with new property list based
argument list, support for datagrams, server processes, and local
sockets in addition to old client-only functionality.
(server_accept_connection): New function.
(wait_reading_process_input): Use it to handle incoming connects.
Do not enable input on a new connection if process is stopped.
(read_process_output): Handle datagram sockets. Use 2k buffer for them.
(send_process): Handle datagram sockets.
(Fstop_process, Fcontinue_process): Apply to network processes. A stopped
network process is indicated by setting command field to t .
(Fprocess_send_eof): No-op if datagram connection.
(Fstatus_notify): Don't read input for a stream server socket or a
stopped network process.
(init_process): Initialize datagram_address array.
(syms_of_process): Intern and staticpro new variables, defsubr new
functions.
2002-03-17 20:20:33 +00:00
|
|
|
|
#endif
|
|
|
|
|
#ifdef SO_KEEPALIVE
|
2004-04-16 12:51:06 +00:00
|
|
|
|
{ ":keepalive", SOL_SOCKET, SO_KEEPALIVE, SOPT_BOOL, OPIX_MISC },
|
(Qlocal, QCname, QCbuffer, QChost, QCservice, QCfamily)
(QClocal, QCremote, QCserver, QCdatagram, QCnowait, QCnoquery,QCstop)
(QCcoding, QCoptions, QCfilter, QCsentinel, QClog, QCfeature):
New variables.
(NETCONN1_P): New macro.
(DATAGRAM_SOCKETS): New conditional symbol.
(datagram_address): New array.
(DATAGRAM_CONN_P, DATAGRAM_CHAN_P): New macros.
(status_message): Use concat3.
(Fprocess_status): Add `listen' status to doc string. Return `stop'
for a stopped network process.
(Fset_process_buffer): Update contact plist for network process.
(Fset_process_filter): Ditto. Don't enable input for stopped
network processes. Server must listen, even if filter is t.
(Fset_process_query_on_exit_flag, Fprocess_query_on_exit_flag):
New functions.
(Fprocess_kill_without_query): Removed. Now defined in simple.el.
(Fprocess_contact): Added KEY argument. Handle datagrams.
(list_processes_1): Optionally show only processes with the query
on exit flag set. Dynamically adjust column widths. Omit tty
column if not needed. Report stopped network processes.
Identify server and datagram network processes.
(Flist_processes): New optional arg `query-only'.
(conv_sockaddr_to_lisp, get_lisp_to_sockaddr_size)
(conv_lisp_to_sockaddr, set_socket_options)
(network_process_featurep, unwind_request_sigio): New helper functions.
(Fprocess_datagram_address, Fset_process_datagram_address):
(Fset_network_process_options): New lisp functions.
(Fopen_network_stream): Removed. Now defined in simple.el.
(Fmake_network_process): New lisp function. Code is based on previous
Fopen_network_stream, but heavily reworked with new property list based
argument list, support for datagrams, server processes, and local
sockets in addition to old client-only functionality.
(server_accept_connection): New function.
(wait_reading_process_input): Use it to handle incoming connects.
Do not enable input on a new connection if process is stopped.
(read_process_output): Handle datagram sockets. Use 2k buffer for them.
(send_process): Handle datagram sockets.
(Fstop_process, Fcontinue_process): Apply to network processes. A stopped
network process is indicated by setting command field to t .
(Fprocess_send_eof): No-op if datagram connection.
(Fstatus_notify): Don't read input for a stream server socket or a
stopped network process.
(init_process): Initialize datagram_address array.
(syms_of_process): Intern and staticpro new variables, defsubr new
functions.
2002-03-17 20:20:33 +00:00
|
|
|
|
#endif
|
|
|
|
|
#ifdef SO_LINGER
|
2004-04-16 12:51:06 +00:00
|
|
|
|
{ ":linger", SOL_SOCKET, SO_LINGER, SOPT_LINGER, OPIX_MISC },
|
(Qlocal, QCname, QCbuffer, QChost, QCservice, QCfamily)
(QClocal, QCremote, QCserver, QCdatagram, QCnowait, QCnoquery,QCstop)
(QCcoding, QCoptions, QCfilter, QCsentinel, QClog, QCfeature):
New variables.
(NETCONN1_P): New macro.
(DATAGRAM_SOCKETS): New conditional symbol.
(datagram_address): New array.
(DATAGRAM_CONN_P, DATAGRAM_CHAN_P): New macros.
(status_message): Use concat3.
(Fprocess_status): Add `listen' status to doc string. Return `stop'
for a stopped network process.
(Fset_process_buffer): Update contact plist for network process.
(Fset_process_filter): Ditto. Don't enable input for stopped
network processes. Server must listen, even if filter is t.
(Fset_process_query_on_exit_flag, Fprocess_query_on_exit_flag):
New functions.
(Fprocess_kill_without_query): Removed. Now defined in simple.el.
(Fprocess_contact): Added KEY argument. Handle datagrams.
(list_processes_1): Optionally show only processes with the query
on exit flag set. Dynamically adjust column widths. Omit tty
column if not needed. Report stopped network processes.
Identify server and datagram network processes.
(Flist_processes): New optional arg `query-only'.
(conv_sockaddr_to_lisp, get_lisp_to_sockaddr_size)
(conv_lisp_to_sockaddr, set_socket_options)
(network_process_featurep, unwind_request_sigio): New helper functions.
(Fprocess_datagram_address, Fset_process_datagram_address):
(Fset_network_process_options): New lisp functions.
(Fopen_network_stream): Removed. Now defined in simple.el.
(Fmake_network_process): New lisp function. Code is based on previous
Fopen_network_stream, but heavily reworked with new property list based
argument list, support for datagrams, server processes, and local
sockets in addition to old client-only functionality.
(server_accept_connection): New function.
(wait_reading_process_input): Use it to handle incoming connects.
Do not enable input on a new connection if process is stopped.
(read_process_output): Handle datagram sockets. Use 2k buffer for them.
(send_process): Handle datagram sockets.
(Fstop_process, Fcontinue_process): Apply to network processes. A stopped
network process is indicated by setting command field to t .
(Fprocess_send_eof): No-op if datagram connection.
(Fstatus_notify): Don't read input for a stream server socket or a
stopped network process.
(init_process): Initialize datagram_address array.
(syms_of_process): Intern and staticpro new variables, defsubr new
functions.
2002-03-17 20:20:33 +00:00
|
|
|
|
#endif
|
|
|
|
|
#ifdef SO_OOBINLINE
|
2004-04-16 12:51:06 +00:00
|
|
|
|
{ ":oobinline", SOL_SOCKET, SO_OOBINLINE, SOPT_BOOL, OPIX_MISC },
|
(Qlocal, QCname, QCbuffer, QChost, QCservice, QCfamily)
(QClocal, QCremote, QCserver, QCdatagram, QCnowait, QCnoquery,QCstop)
(QCcoding, QCoptions, QCfilter, QCsentinel, QClog, QCfeature):
New variables.
(NETCONN1_P): New macro.
(DATAGRAM_SOCKETS): New conditional symbol.
(datagram_address): New array.
(DATAGRAM_CONN_P, DATAGRAM_CHAN_P): New macros.
(status_message): Use concat3.
(Fprocess_status): Add `listen' status to doc string. Return `stop'
for a stopped network process.
(Fset_process_buffer): Update contact plist for network process.
(Fset_process_filter): Ditto. Don't enable input for stopped
network processes. Server must listen, even if filter is t.
(Fset_process_query_on_exit_flag, Fprocess_query_on_exit_flag):
New functions.
(Fprocess_kill_without_query): Removed. Now defined in simple.el.
(Fprocess_contact): Added KEY argument. Handle datagrams.
(list_processes_1): Optionally show only processes with the query
on exit flag set. Dynamically adjust column widths. Omit tty
column if not needed. Report stopped network processes.
Identify server and datagram network processes.
(Flist_processes): New optional arg `query-only'.
(conv_sockaddr_to_lisp, get_lisp_to_sockaddr_size)
(conv_lisp_to_sockaddr, set_socket_options)
(network_process_featurep, unwind_request_sigio): New helper functions.
(Fprocess_datagram_address, Fset_process_datagram_address):
(Fset_network_process_options): New lisp functions.
(Fopen_network_stream): Removed. Now defined in simple.el.
(Fmake_network_process): New lisp function. Code is based on previous
Fopen_network_stream, but heavily reworked with new property list based
argument list, support for datagrams, server processes, and local
sockets in addition to old client-only functionality.
(server_accept_connection): New function.
(wait_reading_process_input): Use it to handle incoming connects.
Do not enable input on a new connection if process is stopped.
(read_process_output): Handle datagram sockets. Use 2k buffer for them.
(send_process): Handle datagram sockets.
(Fstop_process, Fcontinue_process): Apply to network processes. A stopped
network process is indicated by setting command field to t .
(Fprocess_send_eof): No-op if datagram connection.
(Fstatus_notify): Don't read input for a stream server socket or a
stopped network process.
(init_process): Initialize datagram_address array.
(syms_of_process): Intern and staticpro new variables, defsubr new
functions.
2002-03-17 20:20:33 +00:00
|
|
|
|
#endif
|
|
|
|
|
#ifdef SO_PRIORITY
|
2004-04-16 12:51:06 +00:00
|
|
|
|
{ ":priority", SOL_SOCKET, SO_PRIORITY, SOPT_INT, OPIX_MISC },
|
(Qlocal, QCname, QCbuffer, QChost, QCservice, QCfamily)
(QClocal, QCremote, QCserver, QCdatagram, QCnowait, QCnoquery,QCstop)
(QCcoding, QCoptions, QCfilter, QCsentinel, QClog, QCfeature):
New variables.
(NETCONN1_P): New macro.
(DATAGRAM_SOCKETS): New conditional symbol.
(datagram_address): New array.
(DATAGRAM_CONN_P, DATAGRAM_CHAN_P): New macros.
(status_message): Use concat3.
(Fprocess_status): Add `listen' status to doc string. Return `stop'
for a stopped network process.
(Fset_process_buffer): Update contact plist for network process.
(Fset_process_filter): Ditto. Don't enable input for stopped
network processes. Server must listen, even if filter is t.
(Fset_process_query_on_exit_flag, Fprocess_query_on_exit_flag):
New functions.
(Fprocess_kill_without_query): Removed. Now defined in simple.el.
(Fprocess_contact): Added KEY argument. Handle datagrams.
(list_processes_1): Optionally show only processes with the query
on exit flag set. Dynamically adjust column widths. Omit tty
column if not needed. Report stopped network processes.
Identify server and datagram network processes.
(Flist_processes): New optional arg `query-only'.
(conv_sockaddr_to_lisp, get_lisp_to_sockaddr_size)
(conv_lisp_to_sockaddr, set_socket_options)
(network_process_featurep, unwind_request_sigio): New helper functions.
(Fprocess_datagram_address, Fset_process_datagram_address):
(Fset_network_process_options): New lisp functions.
(Fopen_network_stream): Removed. Now defined in simple.el.
(Fmake_network_process): New lisp function. Code is based on previous
Fopen_network_stream, but heavily reworked with new property list based
argument list, support for datagrams, server processes, and local
sockets in addition to old client-only functionality.
(server_accept_connection): New function.
(wait_reading_process_input): Use it to handle incoming connects.
Do not enable input on a new connection if process is stopped.
(read_process_output): Handle datagram sockets. Use 2k buffer for them.
(send_process): Handle datagram sockets.
(Fstop_process, Fcontinue_process): Apply to network processes. A stopped
network process is indicated by setting command field to t .
(Fprocess_send_eof): No-op if datagram connection.
(Fstatus_notify): Don't read input for a stream server socket or a
stopped network process.
(init_process): Initialize datagram_address array.
(syms_of_process): Intern and staticpro new variables, defsubr new
functions.
2002-03-17 20:20:33 +00:00
|
|
|
|
#endif
|
|
|
|
|
#ifdef SO_REUSEADDR
|
2004-04-16 12:51:06 +00:00
|
|
|
|
{ ":reuseaddr", SOL_SOCKET, SO_REUSEADDR, SOPT_BOOL, OPIX_REUSEADDR },
|
(Qlocal, QCname, QCbuffer, QChost, QCservice, QCfamily)
(QClocal, QCremote, QCserver, QCdatagram, QCnowait, QCnoquery,QCstop)
(QCcoding, QCoptions, QCfilter, QCsentinel, QClog, QCfeature):
New variables.
(NETCONN1_P): New macro.
(DATAGRAM_SOCKETS): New conditional symbol.
(datagram_address): New array.
(DATAGRAM_CONN_P, DATAGRAM_CHAN_P): New macros.
(status_message): Use concat3.
(Fprocess_status): Add `listen' status to doc string. Return `stop'
for a stopped network process.
(Fset_process_buffer): Update contact plist for network process.
(Fset_process_filter): Ditto. Don't enable input for stopped
network processes. Server must listen, even if filter is t.
(Fset_process_query_on_exit_flag, Fprocess_query_on_exit_flag):
New functions.
(Fprocess_kill_without_query): Removed. Now defined in simple.el.
(Fprocess_contact): Added KEY argument. Handle datagrams.
(list_processes_1): Optionally show only processes with the query
on exit flag set. Dynamically adjust column widths. Omit tty
column if not needed. Report stopped network processes.
Identify server and datagram network processes.
(Flist_processes): New optional arg `query-only'.
(conv_sockaddr_to_lisp, get_lisp_to_sockaddr_size)
(conv_lisp_to_sockaddr, set_socket_options)
(network_process_featurep, unwind_request_sigio): New helper functions.
(Fprocess_datagram_address, Fset_process_datagram_address):
(Fset_network_process_options): New lisp functions.
(Fopen_network_stream): Removed. Now defined in simple.el.
(Fmake_network_process): New lisp function. Code is based on previous
Fopen_network_stream, but heavily reworked with new property list based
argument list, support for datagrams, server processes, and local
sockets in addition to old client-only functionality.
(server_accept_connection): New function.
(wait_reading_process_input): Use it to handle incoming connects.
Do not enable input on a new connection if process is stopped.
(read_process_output): Handle datagram sockets. Use 2k buffer for them.
(send_process): Handle datagram sockets.
(Fstop_process, Fcontinue_process): Apply to network processes. A stopped
network process is indicated by setting command field to t .
(Fprocess_send_eof): No-op if datagram connection.
(Fstatus_notify): Don't read input for a stream server socket or a
stopped network process.
(init_process): Initialize datagram_address array.
(syms_of_process): Intern and staticpro new variables, defsubr new
functions.
2002-03-17 20:20:33 +00:00
|
|
|
|
#endif
|
2004-04-16 12:51:06 +00:00
|
|
|
|
{ 0, 0, 0, SOPT_UNKNOWN, OPIX_NONE }
|
(Qlocal, QCname, QCbuffer, QChost, QCservice, QCfamily)
(QClocal, QCremote, QCserver, QCdatagram, QCnowait, QCnoquery,QCstop)
(QCcoding, QCoptions, QCfilter, QCsentinel, QClog, QCfeature):
New variables.
(NETCONN1_P): New macro.
(DATAGRAM_SOCKETS): New conditional symbol.
(datagram_address): New array.
(DATAGRAM_CONN_P, DATAGRAM_CHAN_P): New macros.
(status_message): Use concat3.
(Fprocess_status): Add `listen' status to doc string. Return `stop'
for a stopped network process.
(Fset_process_buffer): Update contact plist for network process.
(Fset_process_filter): Ditto. Don't enable input for stopped
network processes. Server must listen, even if filter is t.
(Fset_process_query_on_exit_flag, Fprocess_query_on_exit_flag):
New functions.
(Fprocess_kill_without_query): Removed. Now defined in simple.el.
(Fprocess_contact): Added KEY argument. Handle datagrams.
(list_processes_1): Optionally show only processes with the query
on exit flag set. Dynamically adjust column widths. Omit tty
column if not needed. Report stopped network processes.
Identify server and datagram network processes.
(Flist_processes): New optional arg `query-only'.
(conv_sockaddr_to_lisp, get_lisp_to_sockaddr_size)
(conv_lisp_to_sockaddr, set_socket_options)
(network_process_featurep, unwind_request_sigio): New helper functions.
(Fprocess_datagram_address, Fset_process_datagram_address):
(Fset_network_process_options): New lisp functions.
(Fopen_network_stream): Removed. Now defined in simple.el.
(Fmake_network_process): New lisp function. Code is based on previous
Fopen_network_stream, but heavily reworked with new property list based
argument list, support for datagrams, server processes, and local
sockets in addition to old client-only functionality.
(server_accept_connection): New function.
(wait_reading_process_input): Use it to handle incoming connects.
Do not enable input on a new connection if process is stopped.
(read_process_output): Handle datagram sockets. Use 2k buffer for them.
(send_process): Handle datagram sockets.
(Fstop_process, Fcontinue_process): Apply to network processes. A stopped
network process is indicated by setting command field to t .
(Fprocess_send_eof): No-op if datagram connection.
(Fstatus_notify): Don't read input for a stream server socket or a
stopped network process.
(init_process): Initialize datagram_address array.
(syms_of_process): Intern and staticpro new variables, defsubr new
functions.
2002-03-17 20:20:33 +00:00
|
|
|
|
};
|
|
|
|
|
|
2004-04-16 12:51:06 +00:00
|
|
|
|
/* Set option OPT to value VAL on socket S.
|
(Qlocal, QCname, QCbuffer, QChost, QCservice, QCfamily)
(QClocal, QCremote, QCserver, QCdatagram, QCnowait, QCnoquery,QCstop)
(QCcoding, QCoptions, QCfilter, QCsentinel, QClog, QCfeature):
New variables.
(NETCONN1_P): New macro.
(DATAGRAM_SOCKETS): New conditional symbol.
(datagram_address): New array.
(DATAGRAM_CONN_P, DATAGRAM_CHAN_P): New macros.
(status_message): Use concat3.
(Fprocess_status): Add `listen' status to doc string. Return `stop'
for a stopped network process.
(Fset_process_buffer): Update contact plist for network process.
(Fset_process_filter): Ditto. Don't enable input for stopped
network processes. Server must listen, even if filter is t.
(Fset_process_query_on_exit_flag, Fprocess_query_on_exit_flag):
New functions.
(Fprocess_kill_without_query): Removed. Now defined in simple.el.
(Fprocess_contact): Added KEY argument. Handle datagrams.
(list_processes_1): Optionally show only processes with the query
on exit flag set. Dynamically adjust column widths. Omit tty
column if not needed. Report stopped network processes.
Identify server and datagram network processes.
(Flist_processes): New optional arg `query-only'.
(conv_sockaddr_to_lisp, get_lisp_to_sockaddr_size)
(conv_lisp_to_sockaddr, set_socket_options)
(network_process_featurep, unwind_request_sigio): New helper functions.
(Fprocess_datagram_address, Fset_process_datagram_address):
(Fset_network_process_options): New lisp functions.
(Fopen_network_stream): Removed. Now defined in simple.el.
(Fmake_network_process): New lisp function. Code is based on previous
Fopen_network_stream, but heavily reworked with new property list based
argument list, support for datagrams, server processes, and local
sockets in addition to old client-only functionality.
(server_accept_connection): New function.
(wait_reading_process_input): Use it to handle incoming connects.
Do not enable input on a new connection if process is stopped.
(read_process_output): Handle datagram sockets. Use 2k buffer for them.
(send_process): Handle datagram sockets.
(Fstop_process, Fcontinue_process): Apply to network processes. A stopped
network process is indicated by setting command field to t .
(Fprocess_send_eof): No-op if datagram connection.
(Fstatus_notify): Don't read input for a stream server socket or a
stopped network process.
(init_process): Initialize datagram_address array.
(syms_of_process): Intern and staticpro new variables, defsubr new
functions.
2002-03-17 20:20:33 +00:00
|
|
|
|
|
2004-04-16 12:51:06 +00:00
|
|
|
|
Returns (1<<socket_options[OPT].optbit) if option is known, 0 otherwise.
|
|
|
|
|
Signals an error if setting a known option fails.
|
|
|
|
|
*/
|
(Qlocal, QCname, QCbuffer, QChost, QCservice, QCfamily)
(QClocal, QCremote, QCserver, QCdatagram, QCnowait, QCnoquery,QCstop)
(QCcoding, QCoptions, QCfilter, QCsentinel, QClog, QCfeature):
New variables.
(NETCONN1_P): New macro.
(DATAGRAM_SOCKETS): New conditional symbol.
(datagram_address): New array.
(DATAGRAM_CONN_P, DATAGRAM_CHAN_P): New macros.
(status_message): Use concat3.
(Fprocess_status): Add `listen' status to doc string. Return `stop'
for a stopped network process.
(Fset_process_buffer): Update contact plist for network process.
(Fset_process_filter): Ditto. Don't enable input for stopped
network processes. Server must listen, even if filter is t.
(Fset_process_query_on_exit_flag, Fprocess_query_on_exit_flag):
New functions.
(Fprocess_kill_without_query): Removed. Now defined in simple.el.
(Fprocess_contact): Added KEY argument. Handle datagrams.
(list_processes_1): Optionally show only processes with the query
on exit flag set. Dynamically adjust column widths. Omit tty
column if not needed. Report stopped network processes.
Identify server and datagram network processes.
(Flist_processes): New optional arg `query-only'.
(conv_sockaddr_to_lisp, get_lisp_to_sockaddr_size)
(conv_lisp_to_sockaddr, set_socket_options)
(network_process_featurep, unwind_request_sigio): New helper functions.
(Fprocess_datagram_address, Fset_process_datagram_address):
(Fset_network_process_options): New lisp functions.
(Fopen_network_stream): Removed. Now defined in simple.el.
(Fmake_network_process): New lisp function. Code is based on previous
Fopen_network_stream, but heavily reworked with new property list based
argument list, support for datagrams, server processes, and local
sockets in addition to old client-only functionality.
(server_accept_connection): New function.
(wait_reading_process_input): Use it to handle incoming connects.
Do not enable input on a new connection if process is stopped.
(read_process_output): Handle datagram sockets. Use 2k buffer for them.
(send_process): Handle datagram sockets.
(Fstop_process, Fcontinue_process): Apply to network processes. A stopped
network process is indicated by setting command field to t .
(Fprocess_send_eof): No-op if datagram connection.
(Fstatus_notify): Don't read input for a stream server socket or a
stopped network process.
(init_process): Initialize datagram_address array.
(syms_of_process): Intern and staticpro new variables, defsubr new
functions.
2002-03-17 20:20:33 +00:00
|
|
|
|
|
|
|
|
|
static int
|
2010-07-05 12:36:06 +02:00
|
|
|
|
set_socket_option (int s, Lisp_Object opt, Lisp_Object val)
|
(Qlocal, QCname, QCbuffer, QChost, QCservice, QCfamily)
(QClocal, QCremote, QCserver, QCdatagram, QCnowait, QCnoquery,QCstop)
(QCcoding, QCoptions, QCfilter, QCsentinel, QClog, QCfeature):
New variables.
(NETCONN1_P): New macro.
(DATAGRAM_SOCKETS): New conditional symbol.
(datagram_address): New array.
(DATAGRAM_CONN_P, DATAGRAM_CHAN_P): New macros.
(status_message): Use concat3.
(Fprocess_status): Add `listen' status to doc string. Return `stop'
for a stopped network process.
(Fset_process_buffer): Update contact plist for network process.
(Fset_process_filter): Ditto. Don't enable input for stopped
network processes. Server must listen, even if filter is t.
(Fset_process_query_on_exit_flag, Fprocess_query_on_exit_flag):
New functions.
(Fprocess_kill_without_query): Removed. Now defined in simple.el.
(Fprocess_contact): Added KEY argument. Handle datagrams.
(list_processes_1): Optionally show only processes with the query
on exit flag set. Dynamically adjust column widths. Omit tty
column if not needed. Report stopped network processes.
Identify server and datagram network processes.
(Flist_processes): New optional arg `query-only'.
(conv_sockaddr_to_lisp, get_lisp_to_sockaddr_size)
(conv_lisp_to_sockaddr, set_socket_options)
(network_process_featurep, unwind_request_sigio): New helper functions.
(Fprocess_datagram_address, Fset_process_datagram_address):
(Fset_network_process_options): New lisp functions.
(Fopen_network_stream): Removed. Now defined in simple.el.
(Fmake_network_process): New lisp function. Code is based on previous
Fopen_network_stream, but heavily reworked with new property list based
argument list, support for datagrams, server processes, and local
sockets in addition to old client-only functionality.
(server_accept_connection): New function.
(wait_reading_process_input): Use it to handle incoming connects.
Do not enable input on a new connection if process is stopped.
(read_process_output): Handle datagram sockets. Use 2k buffer for them.
(send_process): Handle datagram sockets.
(Fstop_process, Fcontinue_process): Apply to network processes. A stopped
network process is indicated by setting command field to t .
(Fprocess_send_eof): No-op if datagram connection.
(Fstatus_notify): Don't read input for a stream server socket or a
stopped network process.
(init_process): Initialize datagram_address array.
(syms_of_process): Intern and staticpro new variables, defsubr new
functions.
2002-03-17 20:20:33 +00:00
|
|
|
|
{
|
2004-04-16 12:51:06 +00:00
|
|
|
|
char *name;
|
* process.c (socket_options): Make it const.
(set_socket_option, init_process): Use a const pointer.
* lread.c (intern_c_string): New function.
(defvar_kboard, defvar_lisp, defvar_lisp_nopro, defvar_bool)
(defvar_int): Uset it. Make the name const char*.
* lisp.h (defvar_kboard, defvar_lisp, defvar_lisp_nopro, defvar_bool)
(defvar_int): Update prototypes.
(DEFUN, EXFUN): Support for prototypes is now required.
(intern_c_string): New prototype.
(struct Lisp_Subr): Make symbol_name constant.
* font.c (struct table_entry): Remove unused member. Make NAMES
constant.
(weight_table, slant_table, width_table): Make constant.
* emacs.c (struct standard_args): Make name and longname constant.
* character.h (DEFSYM): Use intern_c_string.
2009-11-06 06:07:46 +00:00
|
|
|
|
const struct socket_options *sopt;
|
2004-04-16 12:51:06 +00:00
|
|
|
|
int ret = 0;
|
(Qlocal, QCname, QCbuffer, QChost, QCservice, QCfamily)
(QClocal, QCremote, QCserver, QCdatagram, QCnowait, QCnoquery,QCstop)
(QCcoding, QCoptions, QCfilter, QCsentinel, QClog, QCfeature):
New variables.
(NETCONN1_P): New macro.
(DATAGRAM_SOCKETS): New conditional symbol.
(datagram_address): New array.
(DATAGRAM_CONN_P, DATAGRAM_CHAN_P): New macros.
(status_message): Use concat3.
(Fprocess_status): Add `listen' status to doc string. Return `stop'
for a stopped network process.
(Fset_process_buffer): Update contact plist for network process.
(Fset_process_filter): Ditto. Don't enable input for stopped
network processes. Server must listen, even if filter is t.
(Fset_process_query_on_exit_flag, Fprocess_query_on_exit_flag):
New functions.
(Fprocess_kill_without_query): Removed. Now defined in simple.el.
(Fprocess_contact): Added KEY argument. Handle datagrams.
(list_processes_1): Optionally show only processes with the query
on exit flag set. Dynamically adjust column widths. Omit tty
column if not needed. Report stopped network processes.
Identify server and datagram network processes.
(Flist_processes): New optional arg `query-only'.
(conv_sockaddr_to_lisp, get_lisp_to_sockaddr_size)
(conv_lisp_to_sockaddr, set_socket_options)
(network_process_featurep, unwind_request_sigio): New helper functions.
(Fprocess_datagram_address, Fset_process_datagram_address):
(Fset_network_process_options): New lisp functions.
(Fopen_network_stream): Removed. Now defined in simple.el.
(Fmake_network_process): New lisp function. Code is based on previous
Fopen_network_stream, but heavily reworked with new property list based
argument list, support for datagrams, server processes, and local
sockets in addition to old client-only functionality.
(server_accept_connection): New function.
(wait_reading_process_input): Use it to handle incoming connects.
Do not enable input on a new connection if process is stopped.
(read_process_output): Handle datagram sockets. Use 2k buffer for them.
(send_process): Handle datagram sockets.
(Fstop_process, Fcontinue_process): Apply to network processes. A stopped
network process is indicated by setting command field to t .
(Fprocess_send_eof): No-op if datagram connection.
(Fstatus_notify): Don't read input for a stream server socket or a
stopped network process.
(init_process): Initialize datagram_address array.
(syms_of_process): Intern and staticpro new variables, defsubr new
functions.
2002-03-17 20:20:33 +00:00
|
|
|
|
|
2004-04-16 12:51:06 +00:00
|
|
|
|
CHECK_SYMBOL (opt);
|
(Qlocal, QCname, QCbuffer, QChost, QCservice, QCfamily)
(QClocal, QCremote, QCserver, QCdatagram, QCnowait, QCnoquery,QCstop)
(QCcoding, QCoptions, QCfilter, QCsentinel, QClog, QCfeature):
New variables.
(NETCONN1_P): New macro.
(DATAGRAM_SOCKETS): New conditional symbol.
(datagram_address): New array.
(DATAGRAM_CONN_P, DATAGRAM_CHAN_P): New macros.
(status_message): Use concat3.
(Fprocess_status): Add `listen' status to doc string. Return `stop'
for a stopped network process.
(Fset_process_buffer): Update contact plist for network process.
(Fset_process_filter): Ditto. Don't enable input for stopped
network processes. Server must listen, even if filter is t.
(Fset_process_query_on_exit_flag, Fprocess_query_on_exit_flag):
New functions.
(Fprocess_kill_without_query): Removed. Now defined in simple.el.
(Fprocess_contact): Added KEY argument. Handle datagrams.
(list_processes_1): Optionally show only processes with the query
on exit flag set. Dynamically adjust column widths. Omit tty
column if not needed. Report stopped network processes.
Identify server and datagram network processes.
(Flist_processes): New optional arg `query-only'.
(conv_sockaddr_to_lisp, get_lisp_to_sockaddr_size)
(conv_lisp_to_sockaddr, set_socket_options)
(network_process_featurep, unwind_request_sigio): New helper functions.
(Fprocess_datagram_address, Fset_process_datagram_address):
(Fset_network_process_options): New lisp functions.
(Fopen_network_stream): Removed. Now defined in simple.el.
(Fmake_network_process): New lisp function. Code is based on previous
Fopen_network_stream, but heavily reworked with new property list based
argument list, support for datagrams, server processes, and local
sockets in addition to old client-only functionality.
(server_accept_connection): New function.
(wait_reading_process_input): Use it to handle incoming connects.
Do not enable input on a new connection if process is stopped.
(read_process_output): Handle datagram sockets. Use 2k buffer for them.
(send_process): Handle datagram sockets.
(Fstop_process, Fcontinue_process): Apply to network processes. A stopped
network process is indicated by setting command field to t .
(Fprocess_send_eof): No-op if datagram connection.
(Fstatus_notify): Don't read input for a stream server socket or a
stopped network process.
(init_process): Initialize datagram_address array.
(syms_of_process): Intern and staticpro new variables, defsubr new
functions.
2002-03-17 20:20:33 +00:00
|
|
|
|
|
2004-04-16 12:51:06 +00:00
|
|
|
|
name = (char *) SDATA (SYMBOL_NAME (opt));
|
|
|
|
|
for (sopt = socket_options; sopt->name; sopt++)
|
|
|
|
|
if (strcmp (name, sopt->name) == 0)
|
|
|
|
|
break;
|
(Qlocal, QCname, QCbuffer, QChost, QCservice, QCfamily)
(QClocal, QCremote, QCserver, QCdatagram, QCnowait, QCnoquery,QCstop)
(QCcoding, QCoptions, QCfilter, QCsentinel, QClog, QCfeature):
New variables.
(NETCONN1_P): New macro.
(DATAGRAM_SOCKETS): New conditional symbol.
(datagram_address): New array.
(DATAGRAM_CONN_P, DATAGRAM_CHAN_P): New macros.
(status_message): Use concat3.
(Fprocess_status): Add `listen' status to doc string. Return `stop'
for a stopped network process.
(Fset_process_buffer): Update contact plist for network process.
(Fset_process_filter): Ditto. Don't enable input for stopped
network processes. Server must listen, even if filter is t.
(Fset_process_query_on_exit_flag, Fprocess_query_on_exit_flag):
New functions.
(Fprocess_kill_without_query): Removed. Now defined in simple.el.
(Fprocess_contact): Added KEY argument. Handle datagrams.
(list_processes_1): Optionally show only processes with the query
on exit flag set. Dynamically adjust column widths. Omit tty
column if not needed. Report stopped network processes.
Identify server and datagram network processes.
(Flist_processes): New optional arg `query-only'.
(conv_sockaddr_to_lisp, get_lisp_to_sockaddr_size)
(conv_lisp_to_sockaddr, set_socket_options)
(network_process_featurep, unwind_request_sigio): New helper functions.
(Fprocess_datagram_address, Fset_process_datagram_address):
(Fset_network_process_options): New lisp functions.
(Fopen_network_stream): Removed. Now defined in simple.el.
(Fmake_network_process): New lisp function. Code is based on previous
Fopen_network_stream, but heavily reworked with new property list based
argument list, support for datagrams, server processes, and local
sockets in addition to old client-only functionality.
(server_accept_connection): New function.
(wait_reading_process_input): Use it to handle incoming connects.
Do not enable input on a new connection if process is stopped.
(read_process_output): Handle datagram sockets. Use 2k buffer for them.
(send_process): Handle datagram sockets.
(Fstop_process, Fcontinue_process): Apply to network processes. A stopped
network process is indicated by setting command field to t .
(Fprocess_send_eof): No-op if datagram connection.
(Fstatus_notify): Don't read input for a stream server socket or a
stopped network process.
(init_process): Initialize datagram_address array.
(syms_of_process): Intern and staticpro new variables, defsubr new
functions.
2002-03-17 20:20:33 +00:00
|
|
|
|
|
2004-04-16 12:51:06 +00:00
|
|
|
|
switch (sopt->opttype)
|
|
|
|
|
{
|
|
|
|
|
case SOPT_BOOL:
|
|
|
|
|
{
|
|
|
|
|
int optval;
|
|
|
|
|
optval = NILP (val) ? 0 : 1;
|
|
|
|
|
ret = setsockopt (s, sopt->optlevel, sopt->optnum,
|
|
|
|
|
&optval, sizeof (optval));
|
|
|
|
|
break;
|
|
|
|
|
}
|
(Qlocal, QCname, QCbuffer, QChost, QCservice, QCfamily)
(QClocal, QCremote, QCserver, QCdatagram, QCnowait, QCnoquery,QCstop)
(QCcoding, QCoptions, QCfilter, QCsentinel, QClog, QCfeature):
New variables.
(NETCONN1_P): New macro.
(DATAGRAM_SOCKETS): New conditional symbol.
(datagram_address): New array.
(DATAGRAM_CONN_P, DATAGRAM_CHAN_P): New macros.
(status_message): Use concat3.
(Fprocess_status): Add `listen' status to doc string. Return `stop'
for a stopped network process.
(Fset_process_buffer): Update contact plist for network process.
(Fset_process_filter): Ditto. Don't enable input for stopped
network processes. Server must listen, even if filter is t.
(Fset_process_query_on_exit_flag, Fprocess_query_on_exit_flag):
New functions.
(Fprocess_kill_without_query): Removed. Now defined in simple.el.
(Fprocess_contact): Added KEY argument. Handle datagrams.
(list_processes_1): Optionally show only processes with the query
on exit flag set. Dynamically adjust column widths. Omit tty
column if not needed. Report stopped network processes.
Identify server and datagram network processes.
(Flist_processes): New optional arg `query-only'.
(conv_sockaddr_to_lisp, get_lisp_to_sockaddr_size)
(conv_lisp_to_sockaddr, set_socket_options)
(network_process_featurep, unwind_request_sigio): New helper functions.
(Fprocess_datagram_address, Fset_process_datagram_address):
(Fset_network_process_options): New lisp functions.
(Fopen_network_stream): Removed. Now defined in simple.el.
(Fmake_network_process): New lisp function. Code is based on previous
Fopen_network_stream, but heavily reworked with new property list based
argument list, support for datagrams, server processes, and local
sockets in addition to old client-only functionality.
(server_accept_connection): New function.
(wait_reading_process_input): Use it to handle incoming connects.
Do not enable input on a new connection if process is stopped.
(read_process_output): Handle datagram sockets. Use 2k buffer for them.
(send_process): Handle datagram sockets.
(Fstop_process, Fcontinue_process): Apply to network processes. A stopped
network process is indicated by setting command field to t .
(Fprocess_send_eof): No-op if datagram connection.
(Fstatus_notify): Don't read input for a stream server socket or a
stopped network process.
(init_process): Initialize datagram_address array.
(syms_of_process): Intern and staticpro new variables, defsubr new
functions.
2002-03-17 20:20:33 +00:00
|
|
|
|
|
2004-04-16 12:51:06 +00:00
|
|
|
|
case SOPT_INT:
|
|
|
|
|
{
|
|
|
|
|
int optval;
|
|
|
|
|
if (INTEGERP (val))
|
|
|
|
|
optval = XINT (val);
|
|
|
|
|
else
|
|
|
|
|
error ("Bad option value for %s", name);
|
|
|
|
|
ret = setsockopt (s, sopt->optlevel, sopt->optnum,
|
|
|
|
|
&optval, sizeof (optval));
|
|
|
|
|
break;
|
|
|
|
|
}
|
(Qlocal, QCname, QCbuffer, QChost, QCservice, QCfamily)
(QClocal, QCremote, QCserver, QCdatagram, QCnowait, QCnoquery,QCstop)
(QCcoding, QCoptions, QCfilter, QCsentinel, QClog, QCfeature):
New variables.
(NETCONN1_P): New macro.
(DATAGRAM_SOCKETS): New conditional symbol.
(datagram_address): New array.
(DATAGRAM_CONN_P, DATAGRAM_CHAN_P): New macros.
(status_message): Use concat3.
(Fprocess_status): Add `listen' status to doc string. Return `stop'
for a stopped network process.
(Fset_process_buffer): Update contact plist for network process.
(Fset_process_filter): Ditto. Don't enable input for stopped
network processes. Server must listen, even if filter is t.
(Fset_process_query_on_exit_flag, Fprocess_query_on_exit_flag):
New functions.
(Fprocess_kill_without_query): Removed. Now defined in simple.el.
(Fprocess_contact): Added KEY argument. Handle datagrams.
(list_processes_1): Optionally show only processes with the query
on exit flag set. Dynamically adjust column widths. Omit tty
column if not needed. Report stopped network processes.
Identify server and datagram network processes.
(Flist_processes): New optional arg `query-only'.
(conv_sockaddr_to_lisp, get_lisp_to_sockaddr_size)
(conv_lisp_to_sockaddr, set_socket_options)
(network_process_featurep, unwind_request_sigio): New helper functions.
(Fprocess_datagram_address, Fset_process_datagram_address):
(Fset_network_process_options): New lisp functions.
(Fopen_network_stream): Removed. Now defined in simple.el.
(Fmake_network_process): New lisp function. Code is based on previous
Fopen_network_stream, but heavily reworked with new property list based
argument list, support for datagrams, server processes, and local
sockets in addition to old client-only functionality.
(server_accept_connection): New function.
(wait_reading_process_input): Use it to handle incoming connects.
Do not enable input on a new connection if process is stopped.
(read_process_output): Handle datagram sockets. Use 2k buffer for them.
(send_process): Handle datagram sockets.
(Fstop_process, Fcontinue_process): Apply to network processes. A stopped
network process is indicated by setting command field to t .
(Fprocess_send_eof): No-op if datagram connection.
(Fstatus_notify): Don't read input for a stream server socket or a
stopped network process.
(init_process): Initialize datagram_address array.
(syms_of_process): Intern and staticpro new variables, defsubr new
functions.
2002-03-17 20:20:33 +00:00
|
|
|
|
|
2004-04-16 12:51:06 +00:00
|
|
|
|
#ifdef SO_BINDTODEVICE
|
|
|
|
|
case SOPT_IFNAME:
|
|
|
|
|
{
|
|
|
|
|
char devname[IFNAMSIZ+1];
|
(Qlocal, QCname, QCbuffer, QChost, QCservice, QCfamily)
(QClocal, QCremote, QCserver, QCdatagram, QCnowait, QCnoquery,QCstop)
(QCcoding, QCoptions, QCfilter, QCsentinel, QClog, QCfeature):
New variables.
(NETCONN1_P): New macro.
(DATAGRAM_SOCKETS): New conditional symbol.
(datagram_address): New array.
(DATAGRAM_CONN_P, DATAGRAM_CHAN_P): New macros.
(status_message): Use concat3.
(Fprocess_status): Add `listen' status to doc string. Return `stop'
for a stopped network process.
(Fset_process_buffer): Update contact plist for network process.
(Fset_process_filter): Ditto. Don't enable input for stopped
network processes. Server must listen, even if filter is t.
(Fset_process_query_on_exit_flag, Fprocess_query_on_exit_flag):
New functions.
(Fprocess_kill_without_query): Removed. Now defined in simple.el.
(Fprocess_contact): Added KEY argument. Handle datagrams.
(list_processes_1): Optionally show only processes with the query
on exit flag set. Dynamically adjust column widths. Omit tty
column if not needed. Report stopped network processes.
Identify server and datagram network processes.
(Flist_processes): New optional arg `query-only'.
(conv_sockaddr_to_lisp, get_lisp_to_sockaddr_size)
(conv_lisp_to_sockaddr, set_socket_options)
(network_process_featurep, unwind_request_sigio): New helper functions.
(Fprocess_datagram_address, Fset_process_datagram_address):
(Fset_network_process_options): New lisp functions.
(Fopen_network_stream): Removed. Now defined in simple.el.
(Fmake_network_process): New lisp function. Code is based on previous
Fopen_network_stream, but heavily reworked with new property list based
argument list, support for datagrams, server processes, and local
sockets in addition to old client-only functionality.
(server_accept_connection): New function.
(wait_reading_process_input): Use it to handle incoming connects.
Do not enable input on a new connection if process is stopped.
(read_process_output): Handle datagram sockets. Use 2k buffer for them.
(send_process): Handle datagram sockets.
(Fstop_process, Fcontinue_process): Apply to network processes. A stopped
network process is indicated by setting command field to t .
(Fprocess_send_eof): No-op if datagram connection.
(Fstatus_notify): Don't read input for a stream server socket or a
stopped network process.
(init_process): Initialize datagram_address array.
(syms_of_process): Intern and staticpro new variables, defsubr new
functions.
2002-03-17 20:20:33 +00:00
|
|
|
|
|
2004-04-16 12:51:06 +00:00
|
|
|
|
/* This is broken, at least in the Linux 2.4 kernel.
|
|
|
|
|
To unbind, the arg must be a zero integer, not the empty string.
|
|
|
|
|
This should work on all systems. KFS. 2003-09-23. */
|
Replace bcopy, bzero, bcmp by memcpy, memmove, memset, memcmp
* alloc.c (overrun_check_malloc, overrun_check_realloc)
(overrun_check_free, xstrdup, allocate_string)
(allocate_string_data, compact_small_strings, Fmake_string)
(make_unibyte_string, make_multibyte_string)
(make_string_from_bytes, make_specified_string, make_float)
(Fcons, allocate_terminal, allocate_frame, make_pure_string)
(Fgarbage_collect): Replace bcopy, safe_bcopy, bzero, bcmp by
memcpy, memmove, memset, memcmp.
* atimer.c (start_atimer, set_alarm): Likewise.
* buffer.c (clone_per_buffer_values, report_overlay_modification)
(mmap_realloc, init_buffer_once): Likewise.
* callint.c (Fcall_interactively): Likewise.
* callproc.c (Fcall_process, Fcall_process_region, child_setup)
(getenv_internal_1): Likewise.
* casefiddle.c (casify_object): Likewise.
* ccl.c (ccl_driver): Likewise.
* character.c (str_as_multibyte, str_to_multibyte): Likewise.
* charset.c (load_charset_map_from_file)
(load_charset_map_from_file, load_charset_map_from_vector)
(Fdefine_charset_internal): Likewise.
* cm.c (Wcm_clear): Likewise.
* coding.c (decode_eol, decode_coding_object)
(Fset_coding_system_priority, make_subsidiaries): Likewise.
* data.c (Faset): Likewise.
* dired.c (directory_files_internal, file_name_completion_stat):
Likewise.
* dispnew.c (new_glyph_matrix, adjust_glyph_matrix)
(clear_glyph_row, copy_row_except_pointers)
(copy_glyph_row_contents, new_glyph_pool, realloc_glyph_pool)
(save_current_matrix, restore_current_matrix)
(build_frame_matrix_from_leaf_window, mirrored_line_dance)
(mirror_line_dance, scrolling_window): Likewise.
* doc.c (Fsnarf_documentation, Fsubstitute_command_keys):
Likewise.
* doprnt.c (doprnt): Likewise.
* editfns.c (Fuser_full_name, make_buffer_string_both)
(Fmessage_box, Fformat, Ftranspose_regions): Likewise.
* emacs.c (sort_args): Likewise.
* eval.c (Fapply, Ffuncall): Likewise.
* fileio.c (Ffile_name_directory, make_temp_name)
(Fexpand_file_name, search_embedded_absfilename)
(Fsubstitute_in_file_name, Ffile_symlink_p, Finsert_file_contents)
(auto_save_error): Likewise.
* fns.c (Fstring_equal, Fcopy_sequence, concat)
(string_to_multibyte, Fstring_as_unibyte, Fstring_as_multibyte)
(internal_equal, Fclear_string, larger_vector, copy_hash_table)
(Fmake_hash_table): Likewise.
* fringe.c (Fdefine_fringe_bitmap): Likewise.
* ftfont.c (ftfont_text_extents): Likewise.
* getloadavg.c (getloadavg): Likewise.
* image.c (define_image_type, make_image, make_image_cache)
(x_create_x_image_and_pixmap, xbm_image_p)
(w32_create_pixmap_from_bitmap_data, xbm_load, xpm_lookup_color)
(xpm_image_p, x_create_bitmap_from_xpm_data, xpm_load)
(init_color_table, x_build_heuristic_mask, pbm_image_p, pbm_load)
(png_image_p, png_read_from_memory, png_load, jpeg_image_p)
(tiff_image_p, tiff_read_from_memory, gif_image_p)
(gif_read_from_memory, gif_load, svg_image_p, gs_image_p):
Likewise.
* indent.c (scan_for_column, compute_motion): Likewise.
* insdel.c (gap_left, gap_right, make_gap_smaller, copy_text)
(insert_1_both, insert_from_gap, replace_range_2): Likewise.
* intervals.c (reproduce_tree, reproduce_tree_obj): Likewise.
* keyboard.c (echo_char, save_getcjmp, restore_getcjmp)
(kbd_buffer_store_event_hold, apply_modifiers_uncached)
(store_user_signal_events, menu_bar_items, tool_bar_items)
(process_tool_bar_item, append_tool_bar_item)
(read_char_minibuf_menu_prompt, read_key_sequence)
(Fread_key_sequence, Fread_key_sequence_vector, Frecent_keys):
Likewise.
* keymap.c (current_minor_maps, Fdescribe_buffer_bindings):
Likewise.
* lisp.h (STRING_COPYIN): Likewise.
* lread.c (Fload, read1, oblookup): Likewise.
* msdos.c (Frecent_doskeys): Likewise.
* nsfns.m (Fx_create_frame): Likewise.
* nsfont.m (nsfont_open, nsfont_text_extents, ns_glyph_metrics):
Likewise.
* nsimage.m (EmacsImage-initFromSkipXBM:width:height:)
(EmacsImage-initForXPMWithDepth:width:height:flip:length:):
Likewise.
* nsmenu.m (ns_update_menubar): Likewise.
* nsterm.m (ns_draw_fringe_bitmap, ns_term_init): Likewise.
* print.c (print_unwind, printchar, strout, print_string)
(print_error_message): Likewise.
* process.c (conv_lisp_to_sockaddr, set_socket_option)
(Fmake_network_process, Fnetwork_interface_list)
(Fnetwork_interface_info, read_process_output, Fprocess_send_eof)
(init_process): Likewise.
* ralloc.c (resize_bloc, r_alloc_sbrk, r_alloc_init): Likewise.
* regex.c (init_syntax_once, regex_compile, re_compile_fastmap):
Likewise.
* scroll.c (do_scrolling, do_direct_scrolling)
(scrolling_max_lines_saved): Likewise.
* search.c (search_buffer, wordify, Freplace_match): Likewise.
* sound.c (wav_init, au_init, Fplay_sound_internal): Likewise.
* syntax.c (skip_chars, skip_syntaxes): Likewise.
* sysdep.c (child_setup_tty, sys_subshell, emacs_get_tty)
(emacs_set_tty): Likewise.
* term.c (encode_terminal_code, calculate_costs)
(produce_special_glyphs, create_tty_output, init_tty, delete_tty):
Likewise.
* termcap.c (tgetst1, gobble_line): Likewise.
* termhooks.h (EVENT_INIT): Likewise.
* tparam.c (tparam1): Likewise.
* unexalpha.c (unexec): Likewise.
* unexec.c (write_segment): Likewise.
* unexmacosx.c (unexec_write_zero): Likewise.
* w32fns.c (w32_wnd_proc, Fx_create_frame, x_create_tip_frame)
(Fx_file_dialog, Fsystem_move_file_to_trash): Likewise.
* w32font.c (w32font_list_family, w32font_text_extents)
(w32font_list_internal, w32font_match_internal)
(w32font_open_internal, compute_metrics, Fx_select_font):
Likewise.
* w32menu.c (set_frame_menubar, add_menu_item)
(w32_menu_display_help, w32_free_submenu_strings): Likewise.
* w32term.c (XCreateGC, w32_initialize_display_info): Likewise.
* w32uniscribe.c (uniscribe_list_family): Likewise.
* w32xfns.c (get_next_msg, post_msg, prepend_msg): Likewise.
* window.c (make_window, replace_window, set_window_buffer)
(Fsplit_window): Likewise.
* xdisp.c (init_iterator, RECORD_OVERLAY_STRING, reseat_to_string)
(add_to_log, message3, x_consider_frame_title)
(append_space_for_newline, extend_face_to_end_of_line)
(decode_mode_spec_coding, init_glyph_string): Likewise.
* xfaces.c (x_create_gc, get_lface_attributes_no_remap)
(Finternal_copy_lisp_face, Finternal_merge_in_global_face)
(face_attr_equal_p, make_realized_face, make_face_cache)
(free_realized_faces, lookup_named_face, smaller_face)
(face_with_height, lookup_derived_face)
(x_supports_face_attributes_p, Finternal_set_font_selection_order)
(Finternal_set_font_selection_order, realize_default_face)
(compute_char_face, face_at_buffer_position)
(face_for_overlay_string, face_at_string_position, merge_faces):
Likewise.
* xfns.c (xic_create_fontsetname, Fx_create_frame)
(Fx_window_property, x_create_tip_frame)
(Fx_backspace_delete_keys_p): Likewise.
* xfont.c (xfont_list, xfont_match, xfont_list_family)
(xfont_text_extents): Likewise.
* xmenu.c (set_frame_menubar, xmenu_show): Likewise.
* xrdb.c (magic_file_p, x_get_resource): Likewise.
* xselect.c (x_queue_event, x_get_window_property)
(receive_incremental_selection): Likewise.
* xsmfns.c (x_session_check_input): Likewise.
* xterm.c (x_send_scroll_bar_event, SET_SAVED_MENU_EVENT)
(handle_one_xevent, x_check_errors, xim_initialize, x_term_init):
Likewise.
* character.h (BCOPY_SHORT): Removed.
* config.in: Regenerate.
* dispnew.c (safe_bcopy): Only define as dummy if PROFILING.
* emacs.c (main) [PROFILING]: Don't declare
dump_opcode_frequencies.
* lisp.h (safe_bcopy): Remove declaration.
(memset) [!HAVE_MEMSET]: Declare.
(memcpy) [!HAVE_MEMCPY]: Likewise.
(memmove) [!HAVE_MEMMOVE]: Likewise.
(memcmp) [!HAVE_MEMCMP]: Likewise.
* s/ms-w32.h (bzero, bcopy, bcmp, GAP_USE_BCOPY)
(BCOPY_UPWARD_SAFE, BCOPY_DOWNWARD_SAFE, HAVE_BCOPY, HAVE_BCMP):
Don't define.
(HAVE_MEMCMP, HAVE_MEMCPY, HAVE_MEMMOVE, HAVE_MEMSET): Define.
* s/msdos.h (GAP_USE_BCOPY, BCOPY_UPWARD_SAFE)
(BCOPY_DOWNWARD_SAFE): Don't define.
* sysdep.c (memset) [!HAVE_MEMSET]: Define.
(memcpy) [!HAVE_MEMCPY]: Define.
(memmove) [!HAVE_MEMMOVE]: Define.
(memcmp) [!HAVE_MEMCMP]: Define.
* config.nt (HAVE_BCOPY, HAVE_BCMP): Remove undefs.
(HAVE_MEMCPY, HAVE_MEMMOVE, HAVE_MEMSET, HAVE_MEMCMP): Add undefs.
* sed2v2.inp (HAVE_MEMCPY, HAVE_MEMSET): Edit to 1.
(HAVE_BZERO): Don't edit.
* lwlib.c (lwlib_memset, lwlib_bcopy): Remove.
(malloc_widget_value, free_widget_info, allocate_widget_instance)
(lw_separator_p): Replace lwlib_memset, lwlib_bcopy, bzero, bcmp by
memset, memcpy, memcmp.
* lwlib-utils.c (XtApplyToWidgets): Likewise.
* xlwmenu.c (XlwMenuInitialize): Likewise.
* lwlib.h (lwlib_bcopy): Remove declaration.
* ebrowse.c (add_sym, make_namespace): Replace bcopy, bzero by
memcpy, memmove, memset.
* pop.c (pop_retrieve, socket_connection, pop_getline): Likewise.
* CPP-DEFINES (BCOPY_DOWNWARD_SAFE, BCOPY_UPWARD_SAFE)
(GAP_USE_BCOPY, HAVE_BCMP, HAVE_BCOPY, bcmp, bcopy, bzero):
Remove.
* configure.in: Don't check for bcopy, bcmp, bzero. Don't include
<strings.h> and don't define bcopy, bzero, BCMP in config.h.
2010-07-08 00:18:28 +02:00
|
|
|
|
memset (devname, 0, sizeof devname);
|
2004-04-16 12:51:06 +00:00
|
|
|
|
if (STRINGP (val))
|
(Qlocal, QCname, QCbuffer, QChost, QCservice, QCfamily)
(QClocal, QCremote, QCserver, QCdatagram, QCnowait, QCnoquery,QCstop)
(QCcoding, QCoptions, QCfilter, QCsentinel, QClog, QCfeature):
New variables.
(NETCONN1_P): New macro.
(DATAGRAM_SOCKETS): New conditional symbol.
(datagram_address): New array.
(DATAGRAM_CONN_P, DATAGRAM_CHAN_P): New macros.
(status_message): Use concat3.
(Fprocess_status): Add `listen' status to doc string. Return `stop'
for a stopped network process.
(Fset_process_buffer): Update contact plist for network process.
(Fset_process_filter): Ditto. Don't enable input for stopped
network processes. Server must listen, even if filter is t.
(Fset_process_query_on_exit_flag, Fprocess_query_on_exit_flag):
New functions.
(Fprocess_kill_without_query): Removed. Now defined in simple.el.
(Fprocess_contact): Added KEY argument. Handle datagrams.
(list_processes_1): Optionally show only processes with the query
on exit flag set. Dynamically adjust column widths. Omit tty
column if not needed. Report stopped network processes.
Identify server and datagram network processes.
(Flist_processes): New optional arg `query-only'.
(conv_sockaddr_to_lisp, get_lisp_to_sockaddr_size)
(conv_lisp_to_sockaddr, set_socket_options)
(network_process_featurep, unwind_request_sigio): New helper functions.
(Fprocess_datagram_address, Fset_process_datagram_address):
(Fset_network_process_options): New lisp functions.
(Fopen_network_stream): Removed. Now defined in simple.el.
(Fmake_network_process): New lisp function. Code is based on previous
Fopen_network_stream, but heavily reworked with new property list based
argument list, support for datagrams, server processes, and local
sockets in addition to old client-only functionality.
(server_accept_connection): New function.
(wait_reading_process_input): Use it to handle incoming connects.
Do not enable input on a new connection if process is stopped.
(read_process_output): Handle datagram sockets. Use 2k buffer for them.
(send_process): Handle datagram sockets.
(Fstop_process, Fcontinue_process): Apply to network processes. A stopped
network process is indicated by setting command field to t .
(Fprocess_send_eof): No-op if datagram connection.
(Fstatus_notify): Don't read input for a stream server socket or a
stopped network process.
(init_process): Initialize datagram_address array.
(syms_of_process): Intern and staticpro new variables, defsubr new
functions.
2002-03-17 20:20:33 +00:00
|
|
|
|
{
|
2004-04-16 12:51:06 +00:00
|
|
|
|
char *arg = (char *) SDATA (val);
|
|
|
|
|
int len = min (strlen (arg), IFNAMSIZ);
|
Replace bcopy, bzero, bcmp by memcpy, memmove, memset, memcmp
* alloc.c (overrun_check_malloc, overrun_check_realloc)
(overrun_check_free, xstrdup, allocate_string)
(allocate_string_data, compact_small_strings, Fmake_string)
(make_unibyte_string, make_multibyte_string)
(make_string_from_bytes, make_specified_string, make_float)
(Fcons, allocate_terminal, allocate_frame, make_pure_string)
(Fgarbage_collect): Replace bcopy, safe_bcopy, bzero, bcmp by
memcpy, memmove, memset, memcmp.
* atimer.c (start_atimer, set_alarm): Likewise.
* buffer.c (clone_per_buffer_values, report_overlay_modification)
(mmap_realloc, init_buffer_once): Likewise.
* callint.c (Fcall_interactively): Likewise.
* callproc.c (Fcall_process, Fcall_process_region, child_setup)
(getenv_internal_1): Likewise.
* casefiddle.c (casify_object): Likewise.
* ccl.c (ccl_driver): Likewise.
* character.c (str_as_multibyte, str_to_multibyte): Likewise.
* charset.c (load_charset_map_from_file)
(load_charset_map_from_file, load_charset_map_from_vector)
(Fdefine_charset_internal): Likewise.
* cm.c (Wcm_clear): Likewise.
* coding.c (decode_eol, decode_coding_object)
(Fset_coding_system_priority, make_subsidiaries): Likewise.
* data.c (Faset): Likewise.
* dired.c (directory_files_internal, file_name_completion_stat):
Likewise.
* dispnew.c (new_glyph_matrix, adjust_glyph_matrix)
(clear_glyph_row, copy_row_except_pointers)
(copy_glyph_row_contents, new_glyph_pool, realloc_glyph_pool)
(save_current_matrix, restore_current_matrix)
(build_frame_matrix_from_leaf_window, mirrored_line_dance)
(mirror_line_dance, scrolling_window): Likewise.
* doc.c (Fsnarf_documentation, Fsubstitute_command_keys):
Likewise.
* doprnt.c (doprnt): Likewise.
* editfns.c (Fuser_full_name, make_buffer_string_both)
(Fmessage_box, Fformat, Ftranspose_regions): Likewise.
* emacs.c (sort_args): Likewise.
* eval.c (Fapply, Ffuncall): Likewise.
* fileio.c (Ffile_name_directory, make_temp_name)
(Fexpand_file_name, search_embedded_absfilename)
(Fsubstitute_in_file_name, Ffile_symlink_p, Finsert_file_contents)
(auto_save_error): Likewise.
* fns.c (Fstring_equal, Fcopy_sequence, concat)
(string_to_multibyte, Fstring_as_unibyte, Fstring_as_multibyte)
(internal_equal, Fclear_string, larger_vector, copy_hash_table)
(Fmake_hash_table): Likewise.
* fringe.c (Fdefine_fringe_bitmap): Likewise.
* ftfont.c (ftfont_text_extents): Likewise.
* getloadavg.c (getloadavg): Likewise.
* image.c (define_image_type, make_image, make_image_cache)
(x_create_x_image_and_pixmap, xbm_image_p)
(w32_create_pixmap_from_bitmap_data, xbm_load, xpm_lookup_color)
(xpm_image_p, x_create_bitmap_from_xpm_data, xpm_load)
(init_color_table, x_build_heuristic_mask, pbm_image_p, pbm_load)
(png_image_p, png_read_from_memory, png_load, jpeg_image_p)
(tiff_image_p, tiff_read_from_memory, gif_image_p)
(gif_read_from_memory, gif_load, svg_image_p, gs_image_p):
Likewise.
* indent.c (scan_for_column, compute_motion): Likewise.
* insdel.c (gap_left, gap_right, make_gap_smaller, copy_text)
(insert_1_both, insert_from_gap, replace_range_2): Likewise.
* intervals.c (reproduce_tree, reproduce_tree_obj): Likewise.
* keyboard.c (echo_char, save_getcjmp, restore_getcjmp)
(kbd_buffer_store_event_hold, apply_modifiers_uncached)
(store_user_signal_events, menu_bar_items, tool_bar_items)
(process_tool_bar_item, append_tool_bar_item)
(read_char_minibuf_menu_prompt, read_key_sequence)
(Fread_key_sequence, Fread_key_sequence_vector, Frecent_keys):
Likewise.
* keymap.c (current_minor_maps, Fdescribe_buffer_bindings):
Likewise.
* lisp.h (STRING_COPYIN): Likewise.
* lread.c (Fload, read1, oblookup): Likewise.
* msdos.c (Frecent_doskeys): Likewise.
* nsfns.m (Fx_create_frame): Likewise.
* nsfont.m (nsfont_open, nsfont_text_extents, ns_glyph_metrics):
Likewise.
* nsimage.m (EmacsImage-initFromSkipXBM:width:height:)
(EmacsImage-initForXPMWithDepth:width:height:flip:length:):
Likewise.
* nsmenu.m (ns_update_menubar): Likewise.
* nsterm.m (ns_draw_fringe_bitmap, ns_term_init): Likewise.
* print.c (print_unwind, printchar, strout, print_string)
(print_error_message): Likewise.
* process.c (conv_lisp_to_sockaddr, set_socket_option)
(Fmake_network_process, Fnetwork_interface_list)
(Fnetwork_interface_info, read_process_output, Fprocess_send_eof)
(init_process): Likewise.
* ralloc.c (resize_bloc, r_alloc_sbrk, r_alloc_init): Likewise.
* regex.c (init_syntax_once, regex_compile, re_compile_fastmap):
Likewise.
* scroll.c (do_scrolling, do_direct_scrolling)
(scrolling_max_lines_saved): Likewise.
* search.c (search_buffer, wordify, Freplace_match): Likewise.
* sound.c (wav_init, au_init, Fplay_sound_internal): Likewise.
* syntax.c (skip_chars, skip_syntaxes): Likewise.
* sysdep.c (child_setup_tty, sys_subshell, emacs_get_tty)
(emacs_set_tty): Likewise.
* term.c (encode_terminal_code, calculate_costs)
(produce_special_glyphs, create_tty_output, init_tty, delete_tty):
Likewise.
* termcap.c (tgetst1, gobble_line): Likewise.
* termhooks.h (EVENT_INIT): Likewise.
* tparam.c (tparam1): Likewise.
* unexalpha.c (unexec): Likewise.
* unexec.c (write_segment): Likewise.
* unexmacosx.c (unexec_write_zero): Likewise.
* w32fns.c (w32_wnd_proc, Fx_create_frame, x_create_tip_frame)
(Fx_file_dialog, Fsystem_move_file_to_trash): Likewise.
* w32font.c (w32font_list_family, w32font_text_extents)
(w32font_list_internal, w32font_match_internal)
(w32font_open_internal, compute_metrics, Fx_select_font):
Likewise.
* w32menu.c (set_frame_menubar, add_menu_item)
(w32_menu_display_help, w32_free_submenu_strings): Likewise.
* w32term.c (XCreateGC, w32_initialize_display_info): Likewise.
* w32uniscribe.c (uniscribe_list_family): Likewise.
* w32xfns.c (get_next_msg, post_msg, prepend_msg): Likewise.
* window.c (make_window, replace_window, set_window_buffer)
(Fsplit_window): Likewise.
* xdisp.c (init_iterator, RECORD_OVERLAY_STRING, reseat_to_string)
(add_to_log, message3, x_consider_frame_title)
(append_space_for_newline, extend_face_to_end_of_line)
(decode_mode_spec_coding, init_glyph_string): Likewise.
* xfaces.c (x_create_gc, get_lface_attributes_no_remap)
(Finternal_copy_lisp_face, Finternal_merge_in_global_face)
(face_attr_equal_p, make_realized_face, make_face_cache)
(free_realized_faces, lookup_named_face, smaller_face)
(face_with_height, lookup_derived_face)
(x_supports_face_attributes_p, Finternal_set_font_selection_order)
(Finternal_set_font_selection_order, realize_default_face)
(compute_char_face, face_at_buffer_position)
(face_for_overlay_string, face_at_string_position, merge_faces):
Likewise.
* xfns.c (xic_create_fontsetname, Fx_create_frame)
(Fx_window_property, x_create_tip_frame)
(Fx_backspace_delete_keys_p): Likewise.
* xfont.c (xfont_list, xfont_match, xfont_list_family)
(xfont_text_extents): Likewise.
* xmenu.c (set_frame_menubar, xmenu_show): Likewise.
* xrdb.c (magic_file_p, x_get_resource): Likewise.
* xselect.c (x_queue_event, x_get_window_property)
(receive_incremental_selection): Likewise.
* xsmfns.c (x_session_check_input): Likewise.
* xterm.c (x_send_scroll_bar_event, SET_SAVED_MENU_EVENT)
(handle_one_xevent, x_check_errors, xim_initialize, x_term_init):
Likewise.
* character.h (BCOPY_SHORT): Removed.
* config.in: Regenerate.
* dispnew.c (safe_bcopy): Only define as dummy if PROFILING.
* emacs.c (main) [PROFILING]: Don't declare
dump_opcode_frequencies.
* lisp.h (safe_bcopy): Remove declaration.
(memset) [!HAVE_MEMSET]: Declare.
(memcpy) [!HAVE_MEMCPY]: Likewise.
(memmove) [!HAVE_MEMMOVE]: Likewise.
(memcmp) [!HAVE_MEMCMP]: Likewise.
* s/ms-w32.h (bzero, bcopy, bcmp, GAP_USE_BCOPY)
(BCOPY_UPWARD_SAFE, BCOPY_DOWNWARD_SAFE, HAVE_BCOPY, HAVE_BCMP):
Don't define.
(HAVE_MEMCMP, HAVE_MEMCPY, HAVE_MEMMOVE, HAVE_MEMSET): Define.
* s/msdos.h (GAP_USE_BCOPY, BCOPY_UPWARD_SAFE)
(BCOPY_DOWNWARD_SAFE): Don't define.
* sysdep.c (memset) [!HAVE_MEMSET]: Define.
(memcpy) [!HAVE_MEMCPY]: Define.
(memmove) [!HAVE_MEMMOVE]: Define.
(memcmp) [!HAVE_MEMCMP]: Define.
* config.nt (HAVE_BCOPY, HAVE_BCMP): Remove undefs.
(HAVE_MEMCPY, HAVE_MEMMOVE, HAVE_MEMSET, HAVE_MEMCMP): Add undefs.
* sed2v2.inp (HAVE_MEMCPY, HAVE_MEMSET): Edit to 1.
(HAVE_BZERO): Don't edit.
* lwlib.c (lwlib_memset, lwlib_bcopy): Remove.
(malloc_widget_value, free_widget_info, allocate_widget_instance)
(lw_separator_p): Replace lwlib_memset, lwlib_bcopy, bzero, bcmp by
memset, memcpy, memcmp.
* lwlib-utils.c (XtApplyToWidgets): Likewise.
* xlwmenu.c (XlwMenuInitialize): Likewise.
* lwlib.h (lwlib_bcopy): Remove declaration.
* ebrowse.c (add_sym, make_namespace): Replace bcopy, bzero by
memcpy, memmove, memset.
* pop.c (pop_retrieve, socket_connection, pop_getline): Likewise.
* CPP-DEFINES (BCOPY_DOWNWARD_SAFE, BCOPY_UPWARD_SAFE)
(GAP_USE_BCOPY, HAVE_BCMP, HAVE_BCOPY, bcmp, bcopy, bzero):
Remove.
* configure.in: Don't check for bcopy, bcmp, bzero. Don't include
<strings.h> and don't define bcopy, bzero, BCMP in config.h.
2010-07-08 00:18:28 +02:00
|
|
|
|
memcpy (devname, arg, len);
|
(Qlocal, QCname, QCbuffer, QChost, QCservice, QCfamily)
(QClocal, QCremote, QCserver, QCdatagram, QCnowait, QCnoquery,QCstop)
(QCcoding, QCoptions, QCfilter, QCsentinel, QClog, QCfeature):
New variables.
(NETCONN1_P): New macro.
(DATAGRAM_SOCKETS): New conditional symbol.
(datagram_address): New array.
(DATAGRAM_CONN_P, DATAGRAM_CHAN_P): New macros.
(status_message): Use concat3.
(Fprocess_status): Add `listen' status to doc string. Return `stop'
for a stopped network process.
(Fset_process_buffer): Update contact plist for network process.
(Fset_process_filter): Ditto. Don't enable input for stopped
network processes. Server must listen, even if filter is t.
(Fset_process_query_on_exit_flag, Fprocess_query_on_exit_flag):
New functions.
(Fprocess_kill_without_query): Removed. Now defined in simple.el.
(Fprocess_contact): Added KEY argument. Handle datagrams.
(list_processes_1): Optionally show only processes with the query
on exit flag set. Dynamically adjust column widths. Omit tty
column if not needed. Report stopped network processes.
Identify server and datagram network processes.
(Flist_processes): New optional arg `query-only'.
(conv_sockaddr_to_lisp, get_lisp_to_sockaddr_size)
(conv_lisp_to_sockaddr, set_socket_options)
(network_process_featurep, unwind_request_sigio): New helper functions.
(Fprocess_datagram_address, Fset_process_datagram_address):
(Fset_network_process_options): New lisp functions.
(Fopen_network_stream): Removed. Now defined in simple.el.
(Fmake_network_process): New lisp function. Code is based on previous
Fopen_network_stream, but heavily reworked with new property list based
argument list, support for datagrams, server processes, and local
sockets in addition to old client-only functionality.
(server_accept_connection): New function.
(wait_reading_process_input): Use it to handle incoming connects.
Do not enable input on a new connection if process is stopped.
(read_process_output): Handle datagram sockets. Use 2k buffer for them.
(send_process): Handle datagram sockets.
(Fstop_process, Fcontinue_process): Apply to network processes. A stopped
network process is indicated by setting command field to t .
(Fprocess_send_eof): No-op if datagram connection.
(Fstatus_notify): Don't read input for a stream server socket or a
stopped network process.
(init_process): Initialize datagram_address array.
(syms_of_process): Intern and staticpro new variables, defsubr new
functions.
2002-03-17 20:20:33 +00:00
|
|
|
|
}
|
2004-04-16 12:51:06 +00:00
|
|
|
|
else if (!NILP (val))
|
|
|
|
|
error ("Bad option value for %s", name);
|
|
|
|
|
ret = setsockopt (s, sopt->optlevel, sopt->optnum,
|
|
|
|
|
devname, IFNAMSIZ);
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
#endif
|
(Qlocal, QCname, QCbuffer, QChost, QCservice, QCfamily)
(QClocal, QCremote, QCserver, QCdatagram, QCnowait, QCnoquery,QCstop)
(QCcoding, QCoptions, QCfilter, QCsentinel, QClog, QCfeature):
New variables.
(NETCONN1_P): New macro.
(DATAGRAM_SOCKETS): New conditional symbol.
(datagram_address): New array.
(DATAGRAM_CONN_P, DATAGRAM_CHAN_P): New macros.
(status_message): Use concat3.
(Fprocess_status): Add `listen' status to doc string. Return `stop'
for a stopped network process.
(Fset_process_buffer): Update contact plist for network process.
(Fset_process_filter): Ditto. Don't enable input for stopped
network processes. Server must listen, even if filter is t.
(Fset_process_query_on_exit_flag, Fprocess_query_on_exit_flag):
New functions.
(Fprocess_kill_without_query): Removed. Now defined in simple.el.
(Fprocess_contact): Added KEY argument. Handle datagrams.
(list_processes_1): Optionally show only processes with the query
on exit flag set. Dynamically adjust column widths. Omit tty
column if not needed. Report stopped network processes.
Identify server and datagram network processes.
(Flist_processes): New optional arg `query-only'.
(conv_sockaddr_to_lisp, get_lisp_to_sockaddr_size)
(conv_lisp_to_sockaddr, set_socket_options)
(network_process_featurep, unwind_request_sigio): New helper functions.
(Fprocess_datagram_address, Fset_process_datagram_address):
(Fset_network_process_options): New lisp functions.
(Fopen_network_stream): Removed. Now defined in simple.el.
(Fmake_network_process): New lisp function. Code is based on previous
Fopen_network_stream, but heavily reworked with new property list based
argument list, support for datagrams, server processes, and local
sockets in addition to old client-only functionality.
(server_accept_connection): New function.
(wait_reading_process_input): Use it to handle incoming connects.
Do not enable input on a new connection if process is stopped.
(read_process_output): Handle datagram sockets. Use 2k buffer for them.
(send_process): Handle datagram sockets.
(Fstop_process, Fcontinue_process): Apply to network processes. A stopped
network process is indicated by setting command field to t .
(Fprocess_send_eof): No-op if datagram connection.
(Fstatus_notify): Don't read input for a stream server socket or a
stopped network process.
(init_process): Initialize datagram_address array.
(syms_of_process): Intern and staticpro new variables, defsubr new
functions.
2002-03-17 20:20:33 +00:00
|
|
|
|
|
2003-02-04 14:56:31 +00:00
|
|
|
|
#ifdef SO_LINGER
|
2004-04-16 12:51:06 +00:00
|
|
|
|
case SOPT_LINGER:
|
|
|
|
|
{
|
|
|
|
|
struct linger linger;
|
(Qlocal, QCname, QCbuffer, QChost, QCservice, QCfamily)
(QClocal, QCremote, QCserver, QCdatagram, QCnowait, QCnoquery,QCstop)
(QCcoding, QCoptions, QCfilter, QCsentinel, QClog, QCfeature):
New variables.
(NETCONN1_P): New macro.
(DATAGRAM_SOCKETS): New conditional symbol.
(datagram_address): New array.
(DATAGRAM_CONN_P, DATAGRAM_CHAN_P): New macros.
(status_message): Use concat3.
(Fprocess_status): Add `listen' status to doc string. Return `stop'
for a stopped network process.
(Fset_process_buffer): Update contact plist for network process.
(Fset_process_filter): Ditto. Don't enable input for stopped
network processes. Server must listen, even if filter is t.
(Fset_process_query_on_exit_flag, Fprocess_query_on_exit_flag):
New functions.
(Fprocess_kill_without_query): Removed. Now defined in simple.el.
(Fprocess_contact): Added KEY argument. Handle datagrams.
(list_processes_1): Optionally show only processes with the query
on exit flag set. Dynamically adjust column widths. Omit tty
column if not needed. Report stopped network processes.
Identify server and datagram network processes.
(Flist_processes): New optional arg `query-only'.
(conv_sockaddr_to_lisp, get_lisp_to_sockaddr_size)
(conv_lisp_to_sockaddr, set_socket_options)
(network_process_featurep, unwind_request_sigio): New helper functions.
(Fprocess_datagram_address, Fset_process_datagram_address):
(Fset_network_process_options): New lisp functions.
(Fopen_network_stream): Removed. Now defined in simple.el.
(Fmake_network_process): New lisp function. Code is based on previous
Fopen_network_stream, but heavily reworked with new property list based
argument list, support for datagrams, server processes, and local
sockets in addition to old client-only functionality.
(server_accept_connection): New function.
(wait_reading_process_input): Use it to handle incoming connects.
Do not enable input on a new connection if process is stopped.
(read_process_output): Handle datagram sockets. Use 2k buffer for them.
(send_process): Handle datagram sockets.
(Fstop_process, Fcontinue_process): Apply to network processes. A stopped
network process is indicated by setting command field to t .
(Fprocess_send_eof): No-op if datagram connection.
(Fstatus_notify): Don't read input for a stream server socket or a
stopped network process.
(init_process): Initialize datagram_address array.
(syms_of_process): Intern and staticpro new variables, defsubr new
functions.
2002-03-17 20:20:33 +00:00
|
|
|
|
|
2004-04-16 12:51:06 +00:00
|
|
|
|
linger.l_onoff = 1;
|
|
|
|
|
linger.l_linger = 0;
|
|
|
|
|
if (INTEGERP (val))
|
|
|
|
|
linger.l_linger = XINT (val);
|
|
|
|
|
else
|
|
|
|
|
linger.l_onoff = NILP (val) ? 0 : 1;
|
|
|
|
|
ret = setsockopt (s, sopt->optlevel, sopt->optnum,
|
|
|
|
|
&linger, sizeof (linger));
|
|
|
|
|
break;
|
|
|
|
|
}
|
(Qlocal, QCname, QCbuffer, QChost, QCservice, QCfamily)
(QClocal, QCremote, QCserver, QCdatagram, QCnowait, QCnoquery,QCstop)
(QCcoding, QCoptions, QCfilter, QCsentinel, QClog, QCfeature):
New variables.
(NETCONN1_P): New macro.
(DATAGRAM_SOCKETS): New conditional symbol.
(datagram_address): New array.
(DATAGRAM_CONN_P, DATAGRAM_CHAN_P): New macros.
(status_message): Use concat3.
(Fprocess_status): Add `listen' status to doc string. Return `stop'
for a stopped network process.
(Fset_process_buffer): Update contact plist for network process.
(Fset_process_filter): Ditto. Don't enable input for stopped
network processes. Server must listen, even if filter is t.
(Fset_process_query_on_exit_flag, Fprocess_query_on_exit_flag):
New functions.
(Fprocess_kill_without_query): Removed. Now defined in simple.el.
(Fprocess_contact): Added KEY argument. Handle datagrams.
(list_processes_1): Optionally show only processes with the query
on exit flag set. Dynamically adjust column widths. Omit tty
column if not needed. Report stopped network processes.
Identify server and datagram network processes.
(Flist_processes): New optional arg `query-only'.
(conv_sockaddr_to_lisp, get_lisp_to_sockaddr_size)
(conv_lisp_to_sockaddr, set_socket_options)
(network_process_featurep, unwind_request_sigio): New helper functions.
(Fprocess_datagram_address, Fset_process_datagram_address):
(Fset_network_process_options): New lisp functions.
(Fopen_network_stream): Removed. Now defined in simple.el.
(Fmake_network_process): New lisp function. Code is based on previous
Fopen_network_stream, but heavily reworked with new property list based
argument list, support for datagrams, server processes, and local
sockets in addition to old client-only functionality.
(server_accept_connection): New function.
(wait_reading_process_input): Use it to handle incoming connects.
Do not enable input on a new connection if process is stopped.
(read_process_output): Handle datagram sockets. Use 2k buffer for them.
(send_process): Handle datagram sockets.
(Fstop_process, Fcontinue_process): Apply to network processes. A stopped
network process is indicated by setting command field to t .
(Fprocess_send_eof): No-op if datagram connection.
(Fstatus_notify): Don't read input for a stream server socket or a
stopped network process.
(init_process): Initialize datagram_address array.
(syms_of_process): Intern and staticpro new variables, defsubr new
functions.
2002-03-17 20:20:33 +00:00
|
|
|
|
#endif
|
2004-04-16 12:51:06 +00:00
|
|
|
|
|
|
|
|
|
default:
|
|
|
|
|
return 0;
|
(Qlocal, QCname, QCbuffer, QChost, QCservice, QCfamily)
(QClocal, QCremote, QCserver, QCdatagram, QCnowait, QCnoquery,QCstop)
(QCcoding, QCoptions, QCfilter, QCsentinel, QClog, QCfeature):
New variables.
(NETCONN1_P): New macro.
(DATAGRAM_SOCKETS): New conditional symbol.
(datagram_address): New array.
(DATAGRAM_CONN_P, DATAGRAM_CHAN_P): New macros.
(status_message): Use concat3.
(Fprocess_status): Add `listen' status to doc string. Return `stop'
for a stopped network process.
(Fset_process_buffer): Update contact plist for network process.
(Fset_process_filter): Ditto. Don't enable input for stopped
network processes. Server must listen, even if filter is t.
(Fset_process_query_on_exit_flag, Fprocess_query_on_exit_flag):
New functions.
(Fprocess_kill_without_query): Removed. Now defined in simple.el.
(Fprocess_contact): Added KEY argument. Handle datagrams.
(list_processes_1): Optionally show only processes with the query
on exit flag set. Dynamically adjust column widths. Omit tty
column if not needed. Report stopped network processes.
Identify server and datagram network processes.
(Flist_processes): New optional arg `query-only'.
(conv_sockaddr_to_lisp, get_lisp_to_sockaddr_size)
(conv_lisp_to_sockaddr, set_socket_options)
(network_process_featurep, unwind_request_sigio): New helper functions.
(Fprocess_datagram_address, Fset_process_datagram_address):
(Fset_network_process_options): New lisp functions.
(Fopen_network_stream): Removed. Now defined in simple.el.
(Fmake_network_process): New lisp function. Code is based on previous
Fopen_network_stream, but heavily reworked with new property list based
argument list, support for datagrams, server processes, and local
sockets in addition to old client-only functionality.
(server_accept_connection): New function.
(wait_reading_process_input): Use it to handle incoming connects.
Do not enable input on a new connection if process is stopped.
(read_process_output): Handle datagram sockets. Use 2k buffer for them.
(send_process): Handle datagram sockets.
(Fstop_process, Fcontinue_process): Apply to network processes. A stopped
network process is indicated by setting command field to t .
(Fprocess_send_eof): No-op if datagram connection.
(Fstatus_notify): Don't read input for a stream server socket or a
stopped network process.
(init_process): Initialize datagram_address array.
(syms_of_process): Intern and staticpro new variables, defsubr new
functions.
2002-03-17 20:20:33 +00:00
|
|
|
|
}
|
2004-04-16 12:51:06 +00:00
|
|
|
|
|
|
|
|
|
if (ret < 0)
|
|
|
|
|
report_file_error ("Cannot set network option",
|
|
|
|
|
Fcons (opt, Fcons (val, Qnil)));
|
|
|
|
|
return (1 << sopt->optbit);
|
(Qlocal, QCname, QCbuffer, QChost, QCservice, QCfamily)
(QClocal, QCremote, QCserver, QCdatagram, QCnowait, QCnoquery,QCstop)
(QCcoding, QCoptions, QCfilter, QCsentinel, QClog, QCfeature):
New variables.
(NETCONN1_P): New macro.
(DATAGRAM_SOCKETS): New conditional symbol.
(datagram_address): New array.
(DATAGRAM_CONN_P, DATAGRAM_CHAN_P): New macros.
(status_message): Use concat3.
(Fprocess_status): Add `listen' status to doc string. Return `stop'
for a stopped network process.
(Fset_process_buffer): Update contact plist for network process.
(Fset_process_filter): Ditto. Don't enable input for stopped
network processes. Server must listen, even if filter is t.
(Fset_process_query_on_exit_flag, Fprocess_query_on_exit_flag):
New functions.
(Fprocess_kill_without_query): Removed. Now defined in simple.el.
(Fprocess_contact): Added KEY argument. Handle datagrams.
(list_processes_1): Optionally show only processes with the query
on exit flag set. Dynamically adjust column widths. Omit tty
column if not needed. Report stopped network processes.
Identify server and datagram network processes.
(Flist_processes): New optional arg `query-only'.
(conv_sockaddr_to_lisp, get_lisp_to_sockaddr_size)
(conv_lisp_to_sockaddr, set_socket_options)
(network_process_featurep, unwind_request_sigio): New helper functions.
(Fprocess_datagram_address, Fset_process_datagram_address):
(Fset_network_process_options): New lisp functions.
(Fopen_network_stream): Removed. Now defined in simple.el.
(Fmake_network_process): New lisp function. Code is based on previous
Fopen_network_stream, but heavily reworked with new property list based
argument list, support for datagrams, server processes, and local
sockets in addition to old client-only functionality.
(server_accept_connection): New function.
(wait_reading_process_input): Use it to handle incoming connects.
Do not enable input on a new connection if process is stopped.
(read_process_output): Handle datagram sockets. Use 2k buffer for them.
(send_process): Handle datagram sockets.
(Fstop_process, Fcontinue_process): Apply to network processes. A stopped
network process is indicated by setting command field to t .
(Fprocess_send_eof): No-op if datagram connection.
(Fstatus_notify): Don't read input for a stream server socket or a
stopped network process.
(init_process): Initialize datagram_address array.
(syms_of_process): Intern and staticpro new variables, defsubr new
functions.
2002-03-17 20:20:33 +00:00
|
|
|
|
}
|
|
|
|
|
|
2004-04-16 12:51:06 +00:00
|
|
|
|
|
|
|
|
|
DEFUN ("set-network-process-option",
|
|
|
|
|
Fset_network_process_option, Sset_network_process_option,
|
|
|
|
|
3, 4, 0,
|
|
|
|
|
doc: /* For network process PROCESS set option OPTION to value VALUE.
|
|
|
|
|
See `make-network-process' for a list of options and values.
|
|
|
|
|
If optional fourth arg NO-ERROR is non-nil, don't signal an error if
|
|
|
|
|
OPTION is not a supported option, return nil instead; otherwise return t. */)
|
2010-07-08 14:25:08 -07:00
|
|
|
|
(Lisp_Object process, Lisp_Object option, Lisp_Object value, Lisp_Object no_error)
|
(Qlocal, QCname, QCbuffer, QChost, QCservice, QCfamily)
(QClocal, QCremote, QCserver, QCdatagram, QCnowait, QCnoquery,QCstop)
(QCcoding, QCoptions, QCfilter, QCsentinel, QClog, QCfeature):
New variables.
(NETCONN1_P): New macro.
(DATAGRAM_SOCKETS): New conditional symbol.
(datagram_address): New array.
(DATAGRAM_CONN_P, DATAGRAM_CHAN_P): New macros.
(status_message): Use concat3.
(Fprocess_status): Add `listen' status to doc string. Return `stop'
for a stopped network process.
(Fset_process_buffer): Update contact plist for network process.
(Fset_process_filter): Ditto. Don't enable input for stopped
network processes. Server must listen, even if filter is t.
(Fset_process_query_on_exit_flag, Fprocess_query_on_exit_flag):
New functions.
(Fprocess_kill_without_query): Removed. Now defined in simple.el.
(Fprocess_contact): Added KEY argument. Handle datagrams.
(list_processes_1): Optionally show only processes with the query
on exit flag set. Dynamically adjust column widths. Omit tty
column if not needed. Report stopped network processes.
Identify server and datagram network processes.
(Flist_processes): New optional arg `query-only'.
(conv_sockaddr_to_lisp, get_lisp_to_sockaddr_size)
(conv_lisp_to_sockaddr, set_socket_options)
(network_process_featurep, unwind_request_sigio): New helper functions.
(Fprocess_datagram_address, Fset_process_datagram_address):
(Fset_network_process_options): New lisp functions.
(Fopen_network_stream): Removed. Now defined in simple.el.
(Fmake_network_process): New lisp function. Code is based on previous
Fopen_network_stream, but heavily reworked with new property list based
argument list, support for datagrams, server processes, and local
sockets in addition to old client-only functionality.
(server_accept_connection): New function.
(wait_reading_process_input): Use it to handle incoming connects.
Do not enable input on a new connection if process is stopped.
(read_process_output): Handle datagram sockets. Use 2k buffer for them.
(send_process): Handle datagram sockets.
(Fstop_process, Fcontinue_process): Apply to network processes. A stopped
network process is indicated by setting command field to t .
(Fprocess_send_eof): No-op if datagram connection.
(Fstatus_notify): Don't read input for a stream server socket or a
stopped network process.
(init_process): Initialize datagram_address array.
(syms_of_process): Intern and staticpro new variables, defsubr new
functions.
2002-03-17 20:20:33 +00:00
|
|
|
|
{
|
2004-04-16 12:51:06 +00:00
|
|
|
|
int s;
|
|
|
|
|
struct Lisp_Process *p;
|
(Qlocal, QCname, QCbuffer, QChost, QCservice, QCfamily)
(QClocal, QCremote, QCserver, QCdatagram, QCnowait, QCnoquery,QCstop)
(QCcoding, QCoptions, QCfilter, QCsentinel, QClog, QCfeature):
New variables.
(NETCONN1_P): New macro.
(DATAGRAM_SOCKETS): New conditional symbol.
(datagram_address): New array.
(DATAGRAM_CONN_P, DATAGRAM_CHAN_P): New macros.
(status_message): Use concat3.
(Fprocess_status): Add `listen' status to doc string. Return `stop'
for a stopped network process.
(Fset_process_buffer): Update contact plist for network process.
(Fset_process_filter): Ditto. Don't enable input for stopped
network processes. Server must listen, even if filter is t.
(Fset_process_query_on_exit_flag, Fprocess_query_on_exit_flag):
New functions.
(Fprocess_kill_without_query): Removed. Now defined in simple.el.
(Fprocess_contact): Added KEY argument. Handle datagrams.
(list_processes_1): Optionally show only processes with the query
on exit flag set. Dynamically adjust column widths. Omit tty
column if not needed. Report stopped network processes.
Identify server and datagram network processes.
(Flist_processes): New optional arg `query-only'.
(conv_sockaddr_to_lisp, get_lisp_to_sockaddr_size)
(conv_lisp_to_sockaddr, set_socket_options)
(network_process_featurep, unwind_request_sigio): New helper functions.
(Fprocess_datagram_address, Fset_process_datagram_address):
(Fset_network_process_options): New lisp functions.
(Fopen_network_stream): Removed. Now defined in simple.el.
(Fmake_network_process): New lisp function. Code is based on previous
Fopen_network_stream, but heavily reworked with new property list based
argument list, support for datagrams, server processes, and local
sockets in addition to old client-only functionality.
(server_accept_connection): New function.
(wait_reading_process_input): Use it to handle incoming connects.
Do not enable input on a new connection if process is stopped.
(read_process_output): Handle datagram sockets. Use 2k buffer for them.
(send_process): Handle datagram sockets.
(Fstop_process, Fcontinue_process): Apply to network processes. A stopped
network process is indicated by setting command field to t .
(Fprocess_send_eof): No-op if datagram connection.
(Fstatus_notify): Don't read input for a stream server socket or a
stopped network process.
(init_process): Initialize datagram_address array.
(syms_of_process): Intern and staticpro new variables, defsubr new
functions.
2002-03-17 20:20:33 +00:00
|
|
|
|
|
|
|
|
|
CHECK_PROCESS (process);
|
2004-04-16 12:51:06 +00:00
|
|
|
|
p = XPROCESS (process);
|
|
|
|
|
if (!NETCONN1_P (p))
|
|
|
|
|
error ("Process is not a network process");
|
|
|
|
|
|
(struct Lisp_Process): Turn slots infd, outfd, kill_without_query, pty_flag,
tick, update_tick, decoding_carryover, inherit_coding_system_flag,
filter_multibyte, adaptive_read_buffering, read_output_delay, and
read_output_skip from Lisp_Objects to ints. Remove unused
encoding_carryover.
2007-07-12 06:36:57 +00:00
|
|
|
|
s = p->infd;
|
2004-04-16 12:51:06 +00:00
|
|
|
|
if (s < 0)
|
|
|
|
|
error ("Process is not running");
|
|
|
|
|
|
|
|
|
|
if (set_socket_option (s, option, value))
|
(Qlocal, QCname, QCbuffer, QChost, QCservice, QCfamily)
(QClocal, QCremote, QCserver, QCdatagram, QCnowait, QCnoquery,QCstop)
(QCcoding, QCoptions, QCfilter, QCsentinel, QClog, QCfeature):
New variables.
(NETCONN1_P): New macro.
(DATAGRAM_SOCKETS): New conditional symbol.
(datagram_address): New array.
(DATAGRAM_CONN_P, DATAGRAM_CHAN_P): New macros.
(status_message): Use concat3.
(Fprocess_status): Add `listen' status to doc string. Return `stop'
for a stopped network process.
(Fset_process_buffer): Update contact plist for network process.
(Fset_process_filter): Ditto. Don't enable input for stopped
network processes. Server must listen, even if filter is t.
(Fset_process_query_on_exit_flag, Fprocess_query_on_exit_flag):
New functions.
(Fprocess_kill_without_query): Removed. Now defined in simple.el.
(Fprocess_contact): Added KEY argument. Handle datagrams.
(list_processes_1): Optionally show only processes with the query
on exit flag set. Dynamically adjust column widths. Omit tty
column if not needed. Report stopped network processes.
Identify server and datagram network processes.
(Flist_processes): New optional arg `query-only'.
(conv_sockaddr_to_lisp, get_lisp_to_sockaddr_size)
(conv_lisp_to_sockaddr, set_socket_options)
(network_process_featurep, unwind_request_sigio): New helper functions.
(Fprocess_datagram_address, Fset_process_datagram_address):
(Fset_network_process_options): New lisp functions.
(Fopen_network_stream): Removed. Now defined in simple.el.
(Fmake_network_process): New lisp function. Code is based on previous
Fopen_network_stream, but heavily reworked with new property list based
argument list, support for datagrams, server processes, and local
sockets in addition to old client-only functionality.
(server_accept_connection): New function.
(wait_reading_process_input): Use it to handle incoming connects.
Do not enable input on a new connection if process is stopped.
(read_process_output): Handle datagram sockets. Use 2k buffer for them.
(send_process): Handle datagram sockets.
(Fstop_process, Fcontinue_process): Apply to network processes. A stopped
network process is indicated by setting command field to t .
(Fprocess_send_eof): No-op if datagram connection.
(Fstatus_notify): Don't read input for a stream server socket or a
stopped network process.
(init_process): Initialize datagram_address array.
(syms_of_process): Intern and staticpro new variables, defsubr new
functions.
2002-03-17 20:20:33 +00:00
|
|
|
|
{
|
2004-04-16 12:51:06 +00:00
|
|
|
|
p->childp = Fplist_put (p->childp, option, value);
|
|
|
|
|
return Qt;
|
(Qlocal, QCname, QCbuffer, QChost, QCservice, QCfamily)
(QClocal, QCremote, QCserver, QCdatagram, QCnowait, QCnoquery,QCstop)
(QCcoding, QCoptions, QCfilter, QCsentinel, QClog, QCfeature):
New variables.
(NETCONN1_P): New macro.
(DATAGRAM_SOCKETS): New conditional symbol.
(datagram_address): New array.
(DATAGRAM_CONN_P, DATAGRAM_CHAN_P): New macros.
(status_message): Use concat3.
(Fprocess_status): Add `listen' status to doc string. Return `stop'
for a stopped network process.
(Fset_process_buffer): Update contact plist for network process.
(Fset_process_filter): Ditto. Don't enable input for stopped
network processes. Server must listen, even if filter is t.
(Fset_process_query_on_exit_flag, Fprocess_query_on_exit_flag):
New functions.
(Fprocess_kill_without_query): Removed. Now defined in simple.el.
(Fprocess_contact): Added KEY argument. Handle datagrams.
(list_processes_1): Optionally show only processes with the query
on exit flag set. Dynamically adjust column widths. Omit tty
column if not needed. Report stopped network processes.
Identify server and datagram network processes.
(Flist_processes): New optional arg `query-only'.
(conv_sockaddr_to_lisp, get_lisp_to_sockaddr_size)
(conv_lisp_to_sockaddr, set_socket_options)
(network_process_featurep, unwind_request_sigio): New helper functions.
(Fprocess_datagram_address, Fset_process_datagram_address):
(Fset_network_process_options): New lisp functions.
(Fopen_network_stream): Removed. Now defined in simple.el.
(Fmake_network_process): New lisp function. Code is based on previous
Fopen_network_stream, but heavily reworked with new property list based
argument list, support for datagrams, server processes, and local
sockets in addition to old client-only functionality.
(server_accept_connection): New function.
(wait_reading_process_input): Use it to handle incoming connects.
Do not enable input on a new connection if process is stopped.
(read_process_output): Handle datagram sockets. Use 2k buffer for them.
(send_process): Handle datagram sockets.
(Fstop_process, Fcontinue_process): Apply to network processes. A stopped
network process is indicated by setting command field to t .
(Fprocess_send_eof): No-op if datagram connection.
(Fstatus_notify): Don't read input for a stream server socket or a
stopped network process.
(init_process): Initialize datagram_address array.
(syms_of_process): Intern and staticpro new variables, defsubr new
functions.
2002-03-17 20:20:33 +00:00
|
|
|
|
}
|
2004-04-16 12:51:06 +00:00
|
|
|
|
|
|
|
|
|
if (NILP (no_error))
|
|
|
|
|
error ("Unknown or unsupported option");
|
|
|
|
|
|
|
|
|
|
return Qnil;
|
(Qlocal, QCname, QCbuffer, QChost, QCservice, QCfamily)
(QClocal, QCremote, QCserver, QCdatagram, QCnowait, QCnoquery,QCstop)
(QCcoding, QCoptions, QCfilter, QCsentinel, QClog, QCfeature):
New variables.
(NETCONN1_P): New macro.
(DATAGRAM_SOCKETS): New conditional symbol.
(datagram_address): New array.
(DATAGRAM_CONN_P, DATAGRAM_CHAN_P): New macros.
(status_message): Use concat3.
(Fprocess_status): Add `listen' status to doc string. Return `stop'
for a stopped network process.
(Fset_process_buffer): Update contact plist for network process.
(Fset_process_filter): Ditto. Don't enable input for stopped
network processes. Server must listen, even if filter is t.
(Fset_process_query_on_exit_flag, Fprocess_query_on_exit_flag):
New functions.
(Fprocess_kill_without_query): Removed. Now defined in simple.el.
(Fprocess_contact): Added KEY argument. Handle datagrams.
(list_processes_1): Optionally show only processes with the query
on exit flag set. Dynamically adjust column widths. Omit tty
column if not needed. Report stopped network processes.
Identify server and datagram network processes.
(Flist_processes): New optional arg `query-only'.
(conv_sockaddr_to_lisp, get_lisp_to_sockaddr_size)
(conv_lisp_to_sockaddr, set_socket_options)
(network_process_featurep, unwind_request_sigio): New helper functions.
(Fprocess_datagram_address, Fset_process_datagram_address):
(Fset_network_process_options): New lisp functions.
(Fopen_network_stream): Removed. Now defined in simple.el.
(Fmake_network_process): New lisp function. Code is based on previous
Fopen_network_stream, but heavily reworked with new property list based
argument list, support for datagrams, server processes, and local
sockets in addition to old client-only functionality.
(server_accept_connection): New function.
(wait_reading_process_input): Use it to handle incoming connects.
Do not enable input on a new connection if process is stopped.
(read_process_output): Handle datagram sockets. Use 2k buffer for them.
(send_process): Handle datagram sockets.
(Fstop_process, Fcontinue_process): Apply to network processes. A stopped
network process is indicated by setting command field to t .
(Fprocess_send_eof): No-op if datagram connection.
(Fstatus_notify): Don't read input for a stream server socket or a
stopped network process.
(init_process): Initialize datagram_address array.
(syms_of_process): Intern and staticpro new variables, defsubr new
functions.
2002-03-17 20:20:33 +00:00
|
|
|
|
}
|
2004-04-16 12:51:06 +00:00
|
|
|
|
|
(Qlocal, QCname, QCbuffer, QChost, QCservice, QCfamily)
(QClocal, QCremote, QCserver, QCdatagram, QCnowait, QCnoquery,QCstop)
(QCcoding, QCoptions, QCfilter, QCsentinel, QClog, QCfeature):
New variables.
(NETCONN1_P): New macro.
(DATAGRAM_SOCKETS): New conditional symbol.
(datagram_address): New array.
(DATAGRAM_CONN_P, DATAGRAM_CHAN_P): New macros.
(status_message): Use concat3.
(Fprocess_status): Add `listen' status to doc string. Return `stop'
for a stopped network process.
(Fset_process_buffer): Update contact plist for network process.
(Fset_process_filter): Ditto. Don't enable input for stopped
network processes. Server must listen, even if filter is t.
(Fset_process_query_on_exit_flag, Fprocess_query_on_exit_flag):
New functions.
(Fprocess_kill_without_query): Removed. Now defined in simple.el.
(Fprocess_contact): Added KEY argument. Handle datagrams.
(list_processes_1): Optionally show only processes with the query
on exit flag set. Dynamically adjust column widths. Omit tty
column if not needed. Report stopped network processes.
Identify server and datagram network processes.
(Flist_processes): New optional arg `query-only'.
(conv_sockaddr_to_lisp, get_lisp_to_sockaddr_size)
(conv_lisp_to_sockaddr, set_socket_options)
(network_process_featurep, unwind_request_sigio): New helper functions.
(Fprocess_datagram_address, Fset_process_datagram_address):
(Fset_network_process_options): New lisp functions.
(Fopen_network_stream): Removed. Now defined in simple.el.
(Fmake_network_process): New lisp function. Code is based on previous
Fopen_network_stream, but heavily reworked with new property list based
argument list, support for datagrams, server processes, and local
sockets in addition to old client-only functionality.
(server_accept_connection): New function.
(wait_reading_process_input): Use it to handle incoming connects.
Do not enable input on a new connection if process is stopped.
(read_process_output): Handle datagram sockets. Use 2k buffer for them.
(send_process): Handle datagram sockets.
(Fstop_process, Fcontinue_process): Apply to network processes. A stopped
network process is indicated by setting command field to t .
(Fprocess_send_eof): No-op if datagram connection.
(Fstatus_notify): Don't read input for a stream server socket or a
stopped network process.
(init_process): Initialize datagram_address array.
(syms_of_process): Intern and staticpro new variables, defsubr new
functions.
2002-03-17 20:20:33 +00:00
|
|
|
|
|
Daniel Engeler <engeler at gmail.com>
These changes add serial port access.
* process.c: Add HAVE_SERIAL.
(Fdelete_process, Fprocess_status, Fset_process_buffer)
(Fset_process_filter, Fset_process_sentinel, Fprocess_contact)
(list_processes_1, select_wrapper, Fstop_process)
(Fcontinue_process, Fprocess_send_eof, kill_buffer_processes)
(status_notify): Modify to handle serial processes.
[HAVE_SERIAL] (Fserial_process_configure)
[HAVE_SERIAL] (make_serial_process_unwind, Fmake_serial_process):
New functions.
* process.h (struct Lisp_Process): Add `type'.
* sysdep.c [HAVE_TERMIOS] (serial_open, serial_configure):
New functions.
* w32.c (_sys_read_ahead, sys_read, sys_write): Modify to handle serial ports.
(serial_open, serial_configure) New functions.
* w32.h: Add FILE_SERIAL.
(struct _child_process): Add ovl_read, ovl_write.
2008-06-13 08:08:20 +00:00
|
|
|
|
#ifdef HAVE_SERIAL
|
|
|
|
|
DEFUN ("serial-process-configure",
|
|
|
|
|
Fserial_process_configure,
|
|
|
|
|
Sserial_process_configure,
|
|
|
|
|
0, MANY, 0,
|
|
|
|
|
doc: /* Configure speed, bytesize, etc. of a serial process.
|
|
|
|
|
|
|
|
|
|
Arguments are specified as keyword/argument pairs. Attributes that
|
|
|
|
|
are not given are re-initialized from the process's current
|
|
|
|
|
configuration (available via the function `process-contact') or set to
|
|
|
|
|
reasonable default values. The following arguments are defined:
|
|
|
|
|
|
|
|
|
|
:process PROCESS
|
|
|
|
|
:name NAME
|
|
|
|
|
:buffer BUFFER
|
|
|
|
|
:port PORT
|
|
|
|
|
-- Any of these arguments can be given to identify the process that is
|
|
|
|
|
to be configured. If none of these arguments is given, the current
|
|
|
|
|
buffer's process is used.
|
|
|
|
|
|
|
|
|
|
:speed SPEED -- SPEED is the speed of the serial port in bits per
|
|
|
|
|
second, also called baud rate. Any value can be given for SPEED, but
|
|
|
|
|
most serial ports work only at a few defined values between 1200 and
|
|
|
|
|
115200, with 9600 being the most common value. If SPEED is nil, the
|
|
|
|
|
serial port is not configured any further, i.e., all other arguments
|
|
|
|
|
are ignored. This may be useful for special serial ports such as
|
|
|
|
|
Bluetooth-to-serial converters which can only be configured through AT
|
|
|
|
|
commands. A value of nil for SPEED can be used only when passed
|
|
|
|
|
through `make-serial-process' or `serial-term'.
|
|
|
|
|
|
|
|
|
|
:bytesize BYTESIZE -- BYTESIZE is the number of bits per byte, which
|
|
|
|
|
can be 7 or 8. If BYTESIZE is not given or nil, a value of 8 is used.
|
|
|
|
|
|
|
|
|
|
:parity PARITY -- PARITY can be nil (don't use parity), the symbol
|
|
|
|
|
`odd' (use odd parity), or the symbol `even' (use even parity). If
|
|
|
|
|
PARITY is not given, no parity is used.
|
|
|
|
|
|
|
|
|
|
:stopbits STOPBITS -- STOPBITS is the number of stopbits used to
|
|
|
|
|
terminate a byte transmission. STOPBITS can be 1 or 2. If STOPBITS
|
|
|
|
|
is not given or nil, 1 stopbit is used.
|
|
|
|
|
|
|
|
|
|
:flowcontrol FLOWCONTROL -- FLOWCONTROL determines the type of
|
|
|
|
|
flowcontrol to be used, which is either nil (don't use flowcontrol),
|
|
|
|
|
the symbol `hw' (use RTS/CTS hardware flowcontrol), or the symbol `sw'
|
|
|
|
|
\(use XON/XOFF software flowcontrol). If FLOWCONTROL is not given, no
|
|
|
|
|
flowcontrol is used.
|
|
|
|
|
|
|
|
|
|
`serial-process-configure' is called by `make-serial-process' for the
|
|
|
|
|
initial configuration of the serial port.
|
|
|
|
|
|
|
|
|
|
Examples:
|
|
|
|
|
|
|
|
|
|
\(serial-process-configure :process "/dev/ttyS0" :speed 1200)
|
|
|
|
|
|
|
|
|
|
\(serial-process-configure
|
|
|
|
|
:buffer "COM1" :stopbits 1 :parity 'odd :flowcontrol 'hw)
|
|
|
|
|
|
|
|
|
|
\(serial-process-configure :port "\\\\.\\COM13" :bytesize 7)
|
|
|
|
|
|
|
|
|
|
usage: (serial-process-configure &rest ARGS) */)
|
2010-07-08 14:25:08 -07:00
|
|
|
|
(int nargs, Lisp_Object *args)
|
Daniel Engeler <engeler at gmail.com>
These changes add serial port access.
* process.c: Add HAVE_SERIAL.
(Fdelete_process, Fprocess_status, Fset_process_buffer)
(Fset_process_filter, Fset_process_sentinel, Fprocess_contact)
(list_processes_1, select_wrapper, Fstop_process)
(Fcontinue_process, Fprocess_send_eof, kill_buffer_processes)
(status_notify): Modify to handle serial processes.
[HAVE_SERIAL] (Fserial_process_configure)
[HAVE_SERIAL] (make_serial_process_unwind, Fmake_serial_process):
New functions.
* process.h (struct Lisp_Process): Add `type'.
* sysdep.c [HAVE_TERMIOS] (serial_open, serial_configure):
New functions.
* w32.c (_sys_read_ahead, sys_read, sys_write): Modify to handle serial ports.
(serial_open, serial_configure) New functions.
* w32.h: Add FILE_SERIAL.
(struct _child_process): Add ovl_read, ovl_write.
2008-06-13 08:08:20 +00:00
|
|
|
|
{
|
|
|
|
|
struct Lisp_Process *p;
|
|
|
|
|
Lisp_Object contact = Qnil;
|
|
|
|
|
Lisp_Object proc = Qnil;
|
|
|
|
|
struct gcpro gcpro1;
|
|
|
|
|
|
|
|
|
|
contact = Flist (nargs, args);
|
|
|
|
|
GCPRO1 (contact);
|
|
|
|
|
|
|
|
|
|
proc = Fplist_get (contact, QCprocess);
|
|
|
|
|
if (NILP (proc))
|
|
|
|
|
proc = Fplist_get (contact, QCname);
|
|
|
|
|
if (NILP (proc))
|
|
|
|
|
proc = Fplist_get (contact, QCbuffer);
|
|
|
|
|
if (NILP (proc))
|
|
|
|
|
proc = Fplist_get (contact, QCport);
|
|
|
|
|
proc = get_process (proc);
|
|
|
|
|
p = XPROCESS (proc);
|
2008-06-13 16:35:17 +00:00
|
|
|
|
if (!EQ (p->type, Qserial))
|
Daniel Engeler <engeler at gmail.com>
These changes add serial port access.
* process.c: Add HAVE_SERIAL.
(Fdelete_process, Fprocess_status, Fset_process_buffer)
(Fset_process_filter, Fset_process_sentinel, Fprocess_contact)
(list_processes_1, select_wrapper, Fstop_process)
(Fcontinue_process, Fprocess_send_eof, kill_buffer_processes)
(status_notify): Modify to handle serial processes.
[HAVE_SERIAL] (Fserial_process_configure)
[HAVE_SERIAL] (make_serial_process_unwind, Fmake_serial_process):
New functions.
* process.h (struct Lisp_Process): Add `type'.
* sysdep.c [HAVE_TERMIOS] (serial_open, serial_configure):
New functions.
* w32.c (_sys_read_ahead, sys_read, sys_write): Modify to handle serial ports.
(serial_open, serial_configure) New functions.
* w32.h: Add FILE_SERIAL.
(struct _child_process): Add ovl_read, ovl_write.
2008-06-13 08:08:20 +00:00
|
|
|
|
error ("Not a serial process");
|
|
|
|
|
|
|
|
|
|
if (NILP (Fplist_get (p->childp, QCspeed)))
|
|
|
|
|
{
|
|
|
|
|
UNGCPRO;
|
|
|
|
|
return Qnil;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
serial_configure (p, contact);
|
|
|
|
|
|
|
|
|
|
UNGCPRO;
|
|
|
|
|
return Qnil;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Used by make-serial-process to recover from errors. */
|
|
|
|
|
Lisp_Object make_serial_process_unwind (Lisp_Object proc)
|
|
|
|
|
{
|
|
|
|
|
if (!PROCESSP (proc))
|
|
|
|
|
abort ();
|
|
|
|
|
remove_process (proc);
|
|
|
|
|
return Qnil;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
DEFUN ("make-serial-process", Fmake_serial_process, Smake_serial_process,
|
|
|
|
|
0, MANY, 0,
|
|
|
|
|
doc: /* Create and return a serial port process.
|
|
|
|
|
|
|
|
|
|
In Emacs, serial port connections are represented by process objects,
|
|
|
|
|
so input and output work as for subprocesses, and `delete-process'
|
|
|
|
|
closes a serial port connection. However, a serial process has no
|
|
|
|
|
process id, it cannot be signaled, and the status codes are different
|
|
|
|
|
from normal processes.
|
|
|
|
|
|
|
|
|
|
`make-serial-process' creates a process and a buffer, on which you
|
|
|
|
|
probably want to use `process-send-string'. Try \\[serial-term] for
|
|
|
|
|
an interactive terminal. See below for examples.
|
|
|
|
|
|
|
|
|
|
Arguments are specified as keyword/argument pairs. The following
|
|
|
|
|
arguments are defined:
|
|
|
|
|
|
|
|
|
|
:port PORT -- (mandatory) PORT is the path or name of the serial port.
|
|
|
|
|
For example, this could be "/dev/ttyS0" on Unix. On Windows, this
|
|
|
|
|
could be "COM1", or "\\\\.\\COM10" for ports higher than COM9 (double
|
|
|
|
|
the backslashes in strings).
|
|
|
|
|
|
|
|
|
|
:speed SPEED -- (mandatory) is handled by `serial-process-configure',
|
|
|
|
|
which is called by `make-serial-process'.
|
|
|
|
|
|
|
|
|
|
:name NAME -- NAME is the name of the process. If NAME is not given,
|
|
|
|
|
the value of PORT is used.
|
|
|
|
|
|
|
|
|
|
:buffer BUFFER -- BUFFER is the buffer (or buffer-name) to associate
|
|
|
|
|
with the process. Process output goes at the end of that buffer,
|
|
|
|
|
unless you specify an output stream or filter function to handle the
|
|
|
|
|
output. If BUFFER is not given, the value of NAME is used.
|
|
|
|
|
|
|
|
|
|
:coding CODING -- If CODING is a symbol, it specifies the coding
|
|
|
|
|
system used for both reading and writing for this process. If CODING
|
|
|
|
|
is a cons (DECODING . ENCODING), DECODING is used for reading, and
|
|
|
|
|
ENCODING is used for writing.
|
|
|
|
|
|
|
|
|
|
:noquery BOOL -- When exiting Emacs, query the user if BOOL is nil and
|
|
|
|
|
the process is running. If BOOL is not given, query before exiting.
|
|
|
|
|
|
|
|
|
|
:stop BOOL -- Start process in the `stopped' state if BOOL is non-nil.
|
|
|
|
|
In the stopped state, a serial process does not accept incoming data,
|
|
|
|
|
but you can send outgoing data. The stopped state is cleared by
|
|
|
|
|
`continue-process' and set by `stop-process'.
|
|
|
|
|
|
|
|
|
|
:filter FILTER -- Install FILTER as the process filter.
|
|
|
|
|
|
|
|
|
|
:sentinel SENTINEL -- Install SENTINEL as the process sentinel.
|
|
|
|
|
|
|
|
|
|
:plist PLIST -- Install PLIST as the initial plist of the process.
|
|
|
|
|
|
|
|
|
|
:speed
|
|
|
|
|
:bytesize
|
|
|
|
|
:parity
|
|
|
|
|
:stopbits
|
|
|
|
|
:flowcontrol
|
|
|
|
|
-- These arguments are handled by `serial-process-configure', which is
|
|
|
|
|
called by `make-serial-process'.
|
|
|
|
|
|
|
|
|
|
The original argument list, possibly modified by later configuration,
|
|
|
|
|
is available via the function `process-contact'.
|
|
|
|
|
|
|
|
|
|
Examples:
|
|
|
|
|
|
|
|
|
|
\(make-serial-process :port "/dev/ttyS0" :speed 9600)
|
|
|
|
|
|
|
|
|
|
\(make-serial-process :port "COM1" :speed 115200 :stopbits 2)
|
|
|
|
|
|
|
|
|
|
\(make-serial-process :port "\\\\.\\COM13" :speed 1200 :bytesize 7 :parity 'odd)
|
|
|
|
|
|
|
|
|
|
\(make-serial-process :port "/dev/tty.BlueConsole-SPP-1" :speed nil)
|
|
|
|
|
|
|
|
|
|
usage: (make-serial-process &rest ARGS) */)
|
2010-07-08 14:25:08 -07:00
|
|
|
|
(int nargs, Lisp_Object *args)
|
Daniel Engeler <engeler at gmail.com>
These changes add serial port access.
* process.c: Add HAVE_SERIAL.
(Fdelete_process, Fprocess_status, Fset_process_buffer)
(Fset_process_filter, Fset_process_sentinel, Fprocess_contact)
(list_processes_1, select_wrapper, Fstop_process)
(Fcontinue_process, Fprocess_send_eof, kill_buffer_processes)
(status_notify): Modify to handle serial processes.
[HAVE_SERIAL] (Fserial_process_configure)
[HAVE_SERIAL] (make_serial_process_unwind, Fmake_serial_process):
New functions.
* process.h (struct Lisp_Process): Add `type'.
* sysdep.c [HAVE_TERMIOS] (serial_open, serial_configure):
New functions.
* w32.c (_sys_read_ahead, sys_read, sys_write): Modify to handle serial ports.
(serial_open, serial_configure) New functions.
* w32.h: Add FILE_SERIAL.
(struct _child_process): Add ovl_read, ovl_write.
2008-06-13 08:08:20 +00:00
|
|
|
|
{
|
|
|
|
|
int fd = -1;
|
|
|
|
|
Lisp_Object proc, contact, port;
|
|
|
|
|
struct Lisp_Process *p;
|
|
|
|
|
struct gcpro gcpro1;
|
|
|
|
|
Lisp_Object name, buffer;
|
|
|
|
|
Lisp_Object tem, val;
|
|
|
|
|
int specpdl_count = -1;
|
|
|
|
|
|
|
|
|
|
if (nargs == 0)
|
|
|
|
|
return Qnil;
|
|
|
|
|
|
|
|
|
|
contact = Flist (nargs, args);
|
|
|
|
|
GCPRO1 (contact);
|
|
|
|
|
|
|
|
|
|
port = Fplist_get (contact, QCport);
|
|
|
|
|
if (NILP (port))
|
|
|
|
|
error ("No port specified");
|
|
|
|
|
CHECK_STRING (port);
|
|
|
|
|
|
|
|
|
|
if (NILP (Fplist_member (contact, QCspeed)))
|
|
|
|
|
error (":speed not specified");
|
|
|
|
|
if (!NILP (Fplist_get (contact, QCspeed)))
|
|
|
|
|
CHECK_NUMBER (Fplist_get (contact, QCspeed));
|
|
|
|
|
|
|
|
|
|
name = Fplist_get (contact, QCname);
|
|
|
|
|
if (NILP (name))
|
|
|
|
|
name = port;
|
|
|
|
|
CHECK_STRING (name);
|
|
|
|
|
proc = make_process (name);
|
|
|
|
|
specpdl_count = SPECPDL_INDEX ();
|
|
|
|
|
record_unwind_protect (make_serial_process_unwind, proc);
|
|
|
|
|
p = XPROCESS (proc);
|
|
|
|
|
|
|
|
|
|
fd = serial_open ((char*) SDATA (port));
|
|
|
|
|
p->infd = fd;
|
|
|
|
|
p->outfd = fd;
|
|
|
|
|
if (fd > max_process_desc)
|
|
|
|
|
max_process_desc = fd;
|
|
|
|
|
chan_process[fd] = proc;
|
|
|
|
|
|
|
|
|
|
buffer = Fplist_get (contact, QCbuffer);
|
|
|
|
|
if (NILP (buffer))
|
|
|
|
|
buffer = name;
|
|
|
|
|
buffer = Fget_buffer_create (buffer);
|
|
|
|
|
p->buffer = buffer;
|
|
|
|
|
|
|
|
|
|
p->childp = contact;
|
|
|
|
|
p->plist = Fcopy_sequence (Fplist_get (contact, QCplist));
|
|
|
|
|
p->type = Qserial;
|
|
|
|
|
p->sentinel = Fplist_get (contact, QCsentinel);
|
|
|
|
|
p->filter = Fplist_get (contact, QCfilter);
|
|
|
|
|
p->log = Qnil;
|
|
|
|
|
if (tem = Fplist_get (contact, QCnoquery), !NILP (tem))
|
|
|
|
|
p->kill_without_query = 1;
|
|
|
|
|
if (tem = Fplist_get (contact, QCstop), !NILP (tem))
|
|
|
|
|
p->command = Qt;
|
|
|
|
|
p->pty_flag = 0;
|
|
|
|
|
|
|
|
|
|
if (!EQ (p->command, Qt))
|
|
|
|
|
{
|
|
|
|
|
FD_SET (fd, &input_wait_mask);
|
|
|
|
|
FD_SET (fd, &non_keyboard_wait_mask);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (BUFFERP (buffer))
|
|
|
|
|
{
|
|
|
|
|
set_marker_both (p->mark, buffer,
|
|
|
|
|
BUF_ZV (XBUFFER (buffer)),
|
|
|
|
|
BUF_ZV_BYTE (XBUFFER (buffer)));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
tem = Fplist_member (contact, QCcoding);
|
|
|
|
|
if (!NILP (tem) && (!CONSP (tem) || !CONSP (XCDR (tem))))
|
|
|
|
|
tem = Qnil;
|
|
|
|
|
|
|
|
|
|
val = Qnil;
|
|
|
|
|
if (!NILP (tem))
|
|
|
|
|
{
|
|
|
|
|
val = XCAR (XCDR (tem));
|
|
|
|
|
if (CONSP (val))
|
|
|
|
|
val = XCAR (val);
|
|
|
|
|
}
|
|
|
|
|
else if (!NILP (Vcoding_system_for_read))
|
|
|
|
|
val = Vcoding_system_for_read;
|
|
|
|
|
else if ((!NILP (buffer) && NILP (XBUFFER (buffer)->enable_multibyte_characters))
|
|
|
|
|
|| (NILP (buffer) && NILP (buffer_defaults.enable_multibyte_characters)))
|
|
|
|
|
val = Qnil;
|
|
|
|
|
p->decode_coding_system = val;
|
|
|
|
|
|
|
|
|
|
val = Qnil;
|
|
|
|
|
if (!NILP (tem))
|
|
|
|
|
{
|
|
|
|
|
val = XCAR (XCDR (tem));
|
|
|
|
|
if (CONSP (val))
|
|
|
|
|
val = XCDR (val);
|
|
|
|
|
}
|
|
|
|
|
else if (!NILP (Vcoding_system_for_write))
|
|
|
|
|
val = Vcoding_system_for_write;
|
|
|
|
|
else if ((!NILP (buffer) && NILP (XBUFFER (buffer)->enable_multibyte_characters))
|
|
|
|
|
|| (NILP (buffer) && NILP (buffer_defaults.enable_multibyte_characters)))
|
|
|
|
|
val = Qnil;
|
|
|
|
|
p->encode_coding_system = val;
|
|
|
|
|
|
|
|
|
|
setup_process_coding_systems (proc);
|
|
|
|
|
p->decoding_buf = make_uninit_string (0);
|
|
|
|
|
p->decoding_carryover = 0;
|
|
|
|
|
p->encoding_buf = make_uninit_string (0);
|
|
|
|
|
p->inherit_coding_system_flag
|
|
|
|
|
= !(!NILP (tem) || NILP (buffer) || !inherit_process_coding_system);
|
|
|
|
|
|
2010-07-07 11:45:28 +02:00
|
|
|
|
Fserial_process_configure (nargs, args);
|
Daniel Engeler <engeler at gmail.com>
These changes add serial port access.
* process.c: Add HAVE_SERIAL.
(Fdelete_process, Fprocess_status, Fset_process_buffer)
(Fset_process_filter, Fset_process_sentinel, Fprocess_contact)
(list_processes_1, select_wrapper, Fstop_process)
(Fcontinue_process, Fprocess_send_eof, kill_buffer_processes)
(status_notify): Modify to handle serial processes.
[HAVE_SERIAL] (Fserial_process_configure)
[HAVE_SERIAL] (make_serial_process_unwind, Fmake_serial_process):
New functions.
* process.h (struct Lisp_Process): Add `type'.
* sysdep.c [HAVE_TERMIOS] (serial_open, serial_configure):
New functions.
* w32.c (_sys_read_ahead, sys_read, sys_write): Modify to handle serial ports.
(serial_open, serial_configure) New functions.
* w32.h: Add FILE_SERIAL.
(struct _child_process): Add ovl_read, ovl_write.
2008-06-13 08:08:20 +00:00
|
|
|
|
|
|
|
|
|
specpdl_ptr = specpdl + specpdl_count;
|
|
|
|
|
|
|
|
|
|
UNGCPRO;
|
|
|
|
|
return proc;
|
|
|
|
|
}
|
|
|
|
|
#endif /* HAVE_SERIAL */
|
|
|
|
|
|
(Qlocal, QCname, QCbuffer, QChost, QCservice, QCfamily)
(QClocal, QCremote, QCserver, QCdatagram, QCnowait, QCnoquery,QCstop)
(QCcoding, QCoptions, QCfilter, QCsentinel, QClog, QCfeature):
New variables.
(NETCONN1_P): New macro.
(DATAGRAM_SOCKETS): New conditional symbol.
(datagram_address): New array.
(DATAGRAM_CONN_P, DATAGRAM_CHAN_P): New macros.
(status_message): Use concat3.
(Fprocess_status): Add `listen' status to doc string. Return `stop'
for a stopped network process.
(Fset_process_buffer): Update contact plist for network process.
(Fset_process_filter): Ditto. Don't enable input for stopped
network processes. Server must listen, even if filter is t.
(Fset_process_query_on_exit_flag, Fprocess_query_on_exit_flag):
New functions.
(Fprocess_kill_without_query): Removed. Now defined in simple.el.
(Fprocess_contact): Added KEY argument. Handle datagrams.
(list_processes_1): Optionally show only processes with the query
on exit flag set. Dynamically adjust column widths. Omit tty
column if not needed. Report stopped network processes.
Identify server and datagram network processes.
(Flist_processes): New optional arg `query-only'.
(conv_sockaddr_to_lisp, get_lisp_to_sockaddr_size)
(conv_lisp_to_sockaddr, set_socket_options)
(network_process_featurep, unwind_request_sigio): New helper functions.
(Fprocess_datagram_address, Fset_process_datagram_address):
(Fset_network_process_options): New lisp functions.
(Fopen_network_stream): Removed. Now defined in simple.el.
(Fmake_network_process): New lisp function. Code is based on previous
Fopen_network_stream, but heavily reworked with new property list based
argument list, support for datagrams, server processes, and local
sockets in addition to old client-only functionality.
(server_accept_connection): New function.
(wait_reading_process_input): Use it to handle incoming connects.
Do not enable input on a new connection if process is stopped.
(read_process_output): Handle datagram sockets. Use 2k buffer for them.
(send_process): Handle datagram sockets.
(Fstop_process, Fcontinue_process): Apply to network processes. A stopped
network process is indicated by setting command field to t .
(Fprocess_send_eof): No-op if datagram connection.
(Fstatus_notify): Don't read input for a stream server socket or a
stopped network process.
(init_process): Initialize datagram_address array.
(syms_of_process): Intern and staticpro new variables, defsubr new
functions.
2002-03-17 20:20:33 +00:00
|
|
|
|
/* Create a network stream/datagram client/server process. Treated
|
|
|
|
|
exactly like a normal process when reading and writing. Primary
|
1992-03-14 20:40:04 +00:00
|
|
|
|
differences are in status display and process deletion. A network
|
|
|
|
|
connection has no PID; you cannot signal it. All you can do is
|
(Qlocal, QCname, QCbuffer, QChost, QCservice, QCfamily)
(QClocal, QCremote, QCserver, QCdatagram, QCnowait, QCnoquery,QCstop)
(QCcoding, QCoptions, QCfilter, QCsentinel, QClog, QCfeature):
New variables.
(NETCONN1_P): New macro.
(DATAGRAM_SOCKETS): New conditional symbol.
(datagram_address): New array.
(DATAGRAM_CONN_P, DATAGRAM_CHAN_P): New macros.
(status_message): Use concat3.
(Fprocess_status): Add `listen' status to doc string. Return `stop'
for a stopped network process.
(Fset_process_buffer): Update contact plist for network process.
(Fset_process_filter): Ditto. Don't enable input for stopped
network processes. Server must listen, even if filter is t.
(Fset_process_query_on_exit_flag, Fprocess_query_on_exit_flag):
New functions.
(Fprocess_kill_without_query): Removed. Now defined in simple.el.
(Fprocess_contact): Added KEY argument. Handle datagrams.
(list_processes_1): Optionally show only processes with the query
on exit flag set. Dynamically adjust column widths. Omit tty
column if not needed. Report stopped network processes.
Identify server and datagram network processes.
(Flist_processes): New optional arg `query-only'.
(conv_sockaddr_to_lisp, get_lisp_to_sockaddr_size)
(conv_lisp_to_sockaddr, set_socket_options)
(network_process_featurep, unwind_request_sigio): New helper functions.
(Fprocess_datagram_address, Fset_process_datagram_address):
(Fset_network_process_options): New lisp functions.
(Fopen_network_stream): Removed. Now defined in simple.el.
(Fmake_network_process): New lisp function. Code is based on previous
Fopen_network_stream, but heavily reworked with new property list based
argument list, support for datagrams, server processes, and local
sockets in addition to old client-only functionality.
(server_accept_connection): New function.
(wait_reading_process_input): Use it to handle incoming connects.
Do not enable input on a new connection if process is stopped.
(read_process_output): Handle datagram sockets. Use 2k buffer for them.
(send_process): Handle datagram sockets.
(Fstop_process, Fcontinue_process): Apply to network processes. A stopped
network process is indicated by setting command field to t .
(Fprocess_send_eof): No-op if datagram connection.
(Fstatus_notify): Don't read input for a stream server socket or a
stopped network process.
(init_process): Initialize datagram_address array.
(syms_of_process): Intern and staticpro new variables, defsubr new
functions.
2002-03-17 20:20:33 +00:00
|
|
|
|
stop/continue it and deactivate/close it via delete-process */
|
|
|
|
|
|
2003-02-04 14:56:31 +00:00
|
|
|
|
DEFUN ("make-network-process", Fmake_network_process, Smake_network_process,
|
|
|
|
|
0, MANY, 0,
|
(Qlocal, QCname, QCbuffer, QChost, QCservice, QCfamily)
(QClocal, QCremote, QCserver, QCdatagram, QCnowait, QCnoquery,QCstop)
(QCcoding, QCoptions, QCfilter, QCsentinel, QClog, QCfeature):
New variables.
(NETCONN1_P): New macro.
(DATAGRAM_SOCKETS): New conditional symbol.
(datagram_address): New array.
(DATAGRAM_CONN_P, DATAGRAM_CHAN_P): New macros.
(status_message): Use concat3.
(Fprocess_status): Add `listen' status to doc string. Return `stop'
for a stopped network process.
(Fset_process_buffer): Update contact plist for network process.
(Fset_process_filter): Ditto. Don't enable input for stopped
network processes. Server must listen, even if filter is t.
(Fset_process_query_on_exit_flag, Fprocess_query_on_exit_flag):
New functions.
(Fprocess_kill_without_query): Removed. Now defined in simple.el.
(Fprocess_contact): Added KEY argument. Handle datagrams.
(list_processes_1): Optionally show only processes with the query
on exit flag set. Dynamically adjust column widths. Omit tty
column if not needed. Report stopped network processes.
Identify server and datagram network processes.
(Flist_processes): New optional arg `query-only'.
(conv_sockaddr_to_lisp, get_lisp_to_sockaddr_size)
(conv_lisp_to_sockaddr, set_socket_options)
(network_process_featurep, unwind_request_sigio): New helper functions.
(Fprocess_datagram_address, Fset_process_datagram_address):
(Fset_network_process_options): New lisp functions.
(Fopen_network_stream): Removed. Now defined in simple.el.
(Fmake_network_process): New lisp function. Code is based on previous
Fopen_network_stream, but heavily reworked with new property list based
argument list, support for datagrams, server processes, and local
sockets in addition to old client-only functionality.
(server_accept_connection): New function.
(wait_reading_process_input): Use it to handle incoming connects.
Do not enable input on a new connection if process is stopped.
(read_process_output): Handle datagram sockets. Use 2k buffer for them.
(send_process): Handle datagram sockets.
(Fstop_process, Fcontinue_process): Apply to network processes. A stopped
network process is indicated by setting command field to t .
(Fprocess_send_eof): No-op if datagram connection.
(Fstatus_notify): Don't read input for a stream server socket or a
stopped network process.
(init_process): Initialize datagram_address array.
(syms_of_process): Intern and staticpro new variables, defsubr new
functions.
2002-03-17 20:20:33 +00:00
|
|
|
|
doc: /* Create and return a network server or client process.
|
|
|
|
|
|
2002-03-18 11:27:26 +00:00
|
|
|
|
In Emacs, network connections are represented by process objects, so
|
(Qlocal, QCname, QCbuffer, QChost, QCservice, QCfamily)
(QClocal, QCremote, QCserver, QCdatagram, QCnowait, QCnoquery,QCstop)
(QCcoding, QCoptions, QCfilter, QCsentinel, QClog, QCfeature):
New variables.
(NETCONN1_P): New macro.
(DATAGRAM_SOCKETS): New conditional symbol.
(datagram_address): New array.
(DATAGRAM_CONN_P, DATAGRAM_CHAN_P): New macros.
(status_message): Use concat3.
(Fprocess_status): Add `listen' status to doc string. Return `stop'
for a stopped network process.
(Fset_process_buffer): Update contact plist for network process.
(Fset_process_filter): Ditto. Don't enable input for stopped
network processes. Server must listen, even if filter is t.
(Fset_process_query_on_exit_flag, Fprocess_query_on_exit_flag):
New functions.
(Fprocess_kill_without_query): Removed. Now defined in simple.el.
(Fprocess_contact): Added KEY argument. Handle datagrams.
(list_processes_1): Optionally show only processes with the query
on exit flag set. Dynamically adjust column widths. Omit tty
column if not needed. Report stopped network processes.
Identify server and datagram network processes.
(Flist_processes): New optional arg `query-only'.
(conv_sockaddr_to_lisp, get_lisp_to_sockaddr_size)
(conv_lisp_to_sockaddr, set_socket_options)
(network_process_featurep, unwind_request_sigio): New helper functions.
(Fprocess_datagram_address, Fset_process_datagram_address):
(Fset_network_process_options): New lisp functions.
(Fopen_network_stream): Removed. Now defined in simple.el.
(Fmake_network_process): New lisp function. Code is based on previous
Fopen_network_stream, but heavily reworked with new property list based
argument list, support for datagrams, server processes, and local
sockets in addition to old client-only functionality.
(server_accept_connection): New function.
(wait_reading_process_input): Use it to handle incoming connects.
Do not enable input on a new connection if process is stopped.
(read_process_output): Handle datagram sockets. Use 2k buffer for them.
(send_process): Handle datagram sockets.
(Fstop_process, Fcontinue_process): Apply to network processes. A stopped
network process is indicated by setting command field to t .
(Fprocess_send_eof): No-op if datagram connection.
(Fstatus_notify): Don't read input for a stream server socket or a
stopped network process.
(init_process): Initialize datagram_address array.
(syms_of_process): Intern and staticpro new variables, defsubr new
functions.
2002-03-17 20:20:33 +00:00
|
|
|
|
input and output work as for subprocesses and `delete-process' closes
|
|
|
|
|
a network connection. However, a network process has no process id,
|
2005-06-21 13:30:39 +00:00
|
|
|
|
it cannot be signaled, and the status codes are different from normal
|
(Qlocal, QCname, QCbuffer, QChost, QCservice, QCfamily)
(QClocal, QCremote, QCserver, QCdatagram, QCnowait, QCnoquery,QCstop)
(QCcoding, QCoptions, QCfilter, QCsentinel, QClog, QCfeature):
New variables.
(NETCONN1_P): New macro.
(DATAGRAM_SOCKETS): New conditional symbol.
(datagram_address): New array.
(DATAGRAM_CONN_P, DATAGRAM_CHAN_P): New macros.
(status_message): Use concat3.
(Fprocess_status): Add `listen' status to doc string. Return `stop'
for a stopped network process.
(Fset_process_buffer): Update contact plist for network process.
(Fset_process_filter): Ditto. Don't enable input for stopped
network processes. Server must listen, even if filter is t.
(Fset_process_query_on_exit_flag, Fprocess_query_on_exit_flag):
New functions.
(Fprocess_kill_without_query): Removed. Now defined in simple.el.
(Fprocess_contact): Added KEY argument. Handle datagrams.
(list_processes_1): Optionally show only processes with the query
on exit flag set. Dynamically adjust column widths. Omit tty
column if not needed. Report stopped network processes.
Identify server and datagram network processes.
(Flist_processes): New optional arg `query-only'.
(conv_sockaddr_to_lisp, get_lisp_to_sockaddr_size)
(conv_lisp_to_sockaddr, set_socket_options)
(network_process_featurep, unwind_request_sigio): New helper functions.
(Fprocess_datagram_address, Fset_process_datagram_address):
(Fset_network_process_options): New lisp functions.
(Fopen_network_stream): Removed. Now defined in simple.el.
(Fmake_network_process): New lisp function. Code is based on previous
Fopen_network_stream, but heavily reworked with new property list based
argument list, support for datagrams, server processes, and local
sockets in addition to old client-only functionality.
(server_accept_connection): New function.
(wait_reading_process_input): Use it to handle incoming connects.
Do not enable input on a new connection if process is stopped.
(read_process_output): Handle datagram sockets. Use 2k buffer for them.
(send_process): Handle datagram sockets.
(Fstop_process, Fcontinue_process): Apply to network processes. A stopped
network process is indicated by setting command field to t .
(Fprocess_send_eof): No-op if datagram connection.
(Fstatus_notify): Don't read input for a stream server socket or a
stopped network process.
(init_process): Initialize datagram_address array.
(syms_of_process): Intern and staticpro new variables, defsubr new
functions.
2002-03-17 20:20:33 +00:00
|
|
|
|
processes.
|
|
|
|
|
|
|
|
|
|
Arguments are specified as keyword/argument pairs. The following
|
|
|
|
|
arguments are defined:
|
|
|
|
|
|
|
|
|
|
:name NAME -- NAME is name for process. It is modified if necessary
|
|
|
|
|
to make it unique.
|
|
|
|
|
|
|
|
|
|
:buffer BUFFER -- BUFFER is the buffer (or buffer-name) to associate
|
|
|
|
|
with the process. Process output goes at end of that buffer, unless
|
|
|
|
|
you specify an output stream or filter function to handle the output.
|
|
|
|
|
BUFFER may be also nil, meaning that this process is not associated
|
|
|
|
|
with any buffer.
|
|
|
|
|
|
|
|
|
|
:host HOST -- HOST is name of the host to connect to, or its IP
|
|
|
|
|
address. The symbol `local' specifies the local host. If specified
|
|
|
|
|
for a server process, it must be a valid name or address for the local
|
|
|
|
|
host, and only clients connecting to that address will be accepted.
|
|
|
|
|
|
|
|
|
|
:service SERVICE -- SERVICE is name of the service desired, or an
|
|
|
|
|
integer specifying a port number to connect to. If SERVICE is t,
|
2007-09-20 02:46:49 +00:00
|
|
|
|
a random port number is selected for the server. (If Emacs was
|
|
|
|
|
compiled with getaddrinfo, a port number can also be specified as a
|
|
|
|
|
string, e.g. "80", as well as an integer. This is not portable.)
|
(Qlocal, QCname, QCbuffer, QChost, QCservice, QCfamily)
(QClocal, QCremote, QCserver, QCdatagram, QCnowait, QCnoquery,QCstop)
(QCcoding, QCoptions, QCfilter, QCsentinel, QClog, QCfeature):
New variables.
(NETCONN1_P): New macro.
(DATAGRAM_SOCKETS): New conditional symbol.
(datagram_address): New array.
(DATAGRAM_CONN_P, DATAGRAM_CHAN_P): New macros.
(status_message): Use concat3.
(Fprocess_status): Add `listen' status to doc string. Return `stop'
for a stopped network process.
(Fset_process_buffer): Update contact plist for network process.
(Fset_process_filter): Ditto. Don't enable input for stopped
network processes. Server must listen, even if filter is t.
(Fset_process_query_on_exit_flag, Fprocess_query_on_exit_flag):
New functions.
(Fprocess_kill_without_query): Removed. Now defined in simple.el.
(Fprocess_contact): Added KEY argument. Handle datagrams.
(list_processes_1): Optionally show only processes with the query
on exit flag set. Dynamically adjust column widths. Omit tty
column if not needed. Report stopped network processes.
Identify server and datagram network processes.
(Flist_processes): New optional arg `query-only'.
(conv_sockaddr_to_lisp, get_lisp_to_sockaddr_size)
(conv_lisp_to_sockaddr, set_socket_options)
(network_process_featurep, unwind_request_sigio): New helper functions.
(Fprocess_datagram_address, Fset_process_datagram_address):
(Fset_network_process_options): New lisp functions.
(Fopen_network_stream): Removed. Now defined in simple.el.
(Fmake_network_process): New lisp function. Code is based on previous
Fopen_network_stream, but heavily reworked with new property list based
argument list, support for datagrams, server processes, and local
sockets in addition to old client-only functionality.
(server_accept_connection): New function.
(wait_reading_process_input): Use it to handle incoming connects.
Do not enable input on a new connection if process is stopped.
(read_process_output): Handle datagram sockets. Use 2k buffer for them.
(send_process): Handle datagram sockets.
(Fstop_process, Fcontinue_process): Apply to network processes. A stopped
network process is indicated by setting command field to t .
(Fprocess_send_eof): No-op if datagram connection.
(Fstatus_notify): Don't read input for a stream server socket or a
stopped network process.
(init_process): Initialize datagram_address array.
(syms_of_process): Intern and staticpro new variables, defsubr new
functions.
2002-03-17 20:20:33 +00:00
|
|
|
|
|
2002-03-21 12:20:24 +00:00
|
|
|
|
:type TYPE -- TYPE is the type of connection. The default (nil) is a
|
2009-12-03 18:51:32 +00:00
|
|
|
|
stream type connection, `datagram' creates a datagram type connection,
|
|
|
|
|
`seqpacket' creates a reliable datagram connection.
|
2002-03-21 12:20:24 +00:00
|
|
|
|
|
(Qlocal, QCname, QCbuffer, QChost, QCservice, QCfamily)
(QClocal, QCremote, QCserver, QCdatagram, QCnowait, QCnoquery,QCstop)
(QCcoding, QCoptions, QCfilter, QCsentinel, QClog, QCfeature):
New variables.
(NETCONN1_P): New macro.
(DATAGRAM_SOCKETS): New conditional symbol.
(datagram_address): New array.
(DATAGRAM_CONN_P, DATAGRAM_CHAN_P): New macros.
(status_message): Use concat3.
(Fprocess_status): Add `listen' status to doc string. Return `stop'
for a stopped network process.
(Fset_process_buffer): Update contact plist for network process.
(Fset_process_filter): Ditto. Don't enable input for stopped
network processes. Server must listen, even if filter is t.
(Fset_process_query_on_exit_flag, Fprocess_query_on_exit_flag):
New functions.
(Fprocess_kill_without_query): Removed. Now defined in simple.el.
(Fprocess_contact): Added KEY argument. Handle datagrams.
(list_processes_1): Optionally show only processes with the query
on exit flag set. Dynamically adjust column widths. Omit tty
column if not needed. Report stopped network processes.
Identify server and datagram network processes.
(Flist_processes): New optional arg `query-only'.
(conv_sockaddr_to_lisp, get_lisp_to_sockaddr_size)
(conv_lisp_to_sockaddr, set_socket_options)
(network_process_featurep, unwind_request_sigio): New helper functions.
(Fprocess_datagram_address, Fset_process_datagram_address):
(Fset_network_process_options): New lisp functions.
(Fopen_network_stream): Removed. Now defined in simple.el.
(Fmake_network_process): New lisp function. Code is based on previous
Fopen_network_stream, but heavily reworked with new property list based
argument list, support for datagrams, server processes, and local
sockets in addition to old client-only functionality.
(server_accept_connection): New function.
(wait_reading_process_input): Use it to handle incoming connects.
Do not enable input on a new connection if process is stopped.
(read_process_output): Handle datagram sockets. Use 2k buffer for them.
(send_process): Handle datagram sockets.
(Fstop_process, Fcontinue_process): Apply to network processes. A stopped
network process is indicated by setting command field to t .
(Fprocess_send_eof): No-op if datagram connection.
(Fstatus_notify): Don't read input for a stream server socket or a
stopped network process.
(init_process): Initialize datagram_address array.
(syms_of_process): Intern and staticpro new variables, defsubr new
functions.
2002-03-17 20:20:33 +00:00
|
|
|
|
:family FAMILY -- FAMILY is the address (and protocol) family for the
|
2006-01-04 00:16:54 +00:00
|
|
|
|
service specified by HOST and SERVICE. The default (nil) is to use
|
|
|
|
|
whatever address family (IPv4 or IPv6) that is defined for the host
|
|
|
|
|
and port number specified by HOST and SERVICE. Other address families
|
|
|
|
|
supported are:
|
(Qlocal, QCname, QCbuffer, QChost, QCservice, QCfamily)
(QClocal, QCremote, QCserver, QCdatagram, QCnowait, QCnoquery,QCstop)
(QCcoding, QCoptions, QCfilter, QCsentinel, QClog, QCfeature):
New variables.
(NETCONN1_P): New macro.
(DATAGRAM_SOCKETS): New conditional symbol.
(datagram_address): New array.
(DATAGRAM_CONN_P, DATAGRAM_CHAN_P): New macros.
(status_message): Use concat3.
(Fprocess_status): Add `listen' status to doc string. Return `stop'
for a stopped network process.
(Fset_process_buffer): Update contact plist for network process.
(Fset_process_filter): Ditto. Don't enable input for stopped
network processes. Server must listen, even if filter is t.
(Fset_process_query_on_exit_flag, Fprocess_query_on_exit_flag):
New functions.
(Fprocess_kill_without_query): Removed. Now defined in simple.el.
(Fprocess_contact): Added KEY argument. Handle datagrams.
(list_processes_1): Optionally show only processes with the query
on exit flag set. Dynamically adjust column widths. Omit tty
column if not needed. Report stopped network processes.
Identify server and datagram network processes.
(Flist_processes): New optional arg `query-only'.
(conv_sockaddr_to_lisp, get_lisp_to_sockaddr_size)
(conv_lisp_to_sockaddr, set_socket_options)
(network_process_featurep, unwind_request_sigio): New helper functions.
(Fprocess_datagram_address, Fset_process_datagram_address):
(Fset_network_process_options): New lisp functions.
(Fopen_network_stream): Removed. Now defined in simple.el.
(Fmake_network_process): New lisp function. Code is based on previous
Fopen_network_stream, but heavily reworked with new property list based
argument list, support for datagrams, server processes, and local
sockets in addition to old client-only functionality.
(server_accept_connection): New function.
(wait_reading_process_input): Use it to handle incoming connects.
Do not enable input on a new connection if process is stopped.
(read_process_output): Handle datagram sockets. Use 2k buffer for them.
(send_process): Handle datagram sockets.
(Fstop_process, Fcontinue_process): Apply to network processes. A stopped
network process is indicated by setting command field to t .
(Fprocess_send_eof): No-op if datagram connection.
(Fstatus_notify): Don't read input for a stream server socket or a
stopped network process.
(init_process): Initialize datagram_address array.
(syms_of_process): Intern and staticpro new variables, defsubr new
functions.
2002-03-17 20:20:33 +00:00
|
|
|
|
local -- for a local (i.e. UNIX) address specified by SERVICE.
|
2006-01-04 00:16:54 +00:00
|
|
|
|
ipv4 -- use IPv4 address family only.
|
|
|
|
|
ipv6 -- use IPv6 address family only.
|
(Qlocal, QCname, QCbuffer, QChost, QCservice, QCfamily)
(QClocal, QCremote, QCserver, QCdatagram, QCnowait, QCnoquery,QCstop)
(QCcoding, QCoptions, QCfilter, QCsentinel, QClog, QCfeature):
New variables.
(NETCONN1_P): New macro.
(DATAGRAM_SOCKETS): New conditional symbol.
(datagram_address): New array.
(DATAGRAM_CONN_P, DATAGRAM_CHAN_P): New macros.
(status_message): Use concat3.
(Fprocess_status): Add `listen' status to doc string. Return `stop'
for a stopped network process.
(Fset_process_buffer): Update contact plist for network process.
(Fset_process_filter): Ditto. Don't enable input for stopped
network processes. Server must listen, even if filter is t.
(Fset_process_query_on_exit_flag, Fprocess_query_on_exit_flag):
New functions.
(Fprocess_kill_without_query): Removed. Now defined in simple.el.
(Fprocess_contact): Added KEY argument. Handle datagrams.
(list_processes_1): Optionally show only processes with the query
on exit flag set. Dynamically adjust column widths. Omit tty
column if not needed. Report stopped network processes.
Identify server and datagram network processes.
(Flist_processes): New optional arg `query-only'.
(conv_sockaddr_to_lisp, get_lisp_to_sockaddr_size)
(conv_lisp_to_sockaddr, set_socket_options)
(network_process_featurep, unwind_request_sigio): New helper functions.
(Fprocess_datagram_address, Fset_process_datagram_address):
(Fset_network_process_options): New lisp functions.
(Fopen_network_stream): Removed. Now defined in simple.el.
(Fmake_network_process): New lisp function. Code is based on previous
Fopen_network_stream, but heavily reworked with new property list based
argument list, support for datagrams, server processes, and local
sockets in addition to old client-only functionality.
(server_accept_connection): New function.
(wait_reading_process_input): Use it to handle incoming connects.
Do not enable input on a new connection if process is stopped.
(read_process_output): Handle datagram sockets. Use 2k buffer for them.
(send_process): Handle datagram sockets.
(Fstop_process, Fcontinue_process): Apply to network processes. A stopped
network process is indicated by setting command field to t .
(Fprocess_send_eof): No-op if datagram connection.
(Fstatus_notify): Don't read input for a stream server socket or a
stopped network process.
(init_process): Initialize datagram_address array.
(syms_of_process): Intern and staticpro new variables, defsubr new
functions.
2002-03-17 20:20:33 +00:00
|
|
|
|
|
|
|
|
|
:local ADDRESS -- ADDRESS is the local address used for the connection.
|
|
|
|
|
This parameter is ignored when opening a client process. When specified
|
|
|
|
|
for a server process, the FAMILY, HOST and SERVICE args are ignored.
|
|
|
|
|
|
|
|
|
|
:remote ADDRESS -- ADDRESS is the remote partner's address for the
|
|
|
|
|
connection. This parameter is ignored when opening a stream server
|
|
|
|
|
process. For a datagram server process, it specifies the initial
|
|
|
|
|
setting of the remote datagram address. When specified for a client
|
|
|
|
|
process, the FAMILY, HOST, and SERVICE args are ignored.
|
|
|
|
|
|
|
|
|
|
The format of ADDRESS depends on the address family:
|
|
|
|
|
- An IPv4 address is represented as an vector of integers [A B C D P]
|
|
|
|
|
corresponding to numeric IP address A.B.C.D and port number P.
|
|
|
|
|
- A local address is represented as a string with the address in the
|
|
|
|
|
local address space.
|
|
|
|
|
- An "unsupported family" address is represented by a cons (F . AV)
|
|
|
|
|
where F is the family number and AV is a vector containing the socket
|
|
|
|
|
address data with one element per address data byte. Do not rely on
|
|
|
|
|
this format in portable code, as it may depend on implementation
|
|
|
|
|
defined constants, data sizes, and data structure alignment.
|
|
|
|
|
|
2004-04-16 12:51:06 +00:00
|
|
|
|
:coding CODING -- If CODING is a symbol, it specifies the coding
|
|
|
|
|
system used for both reading and writing for this process. If CODING
|
|
|
|
|
is a cons (DECODING . ENCODING), DECODING is used for reading, and
|
|
|
|
|
ENCODING is used for writing.
|
(Qlocal, QCname, QCbuffer, QChost, QCservice, QCfamily)
(QClocal, QCremote, QCserver, QCdatagram, QCnowait, QCnoquery,QCstop)
(QCcoding, QCoptions, QCfilter, QCsentinel, QClog, QCfeature):
New variables.
(NETCONN1_P): New macro.
(DATAGRAM_SOCKETS): New conditional symbol.
(datagram_address): New array.
(DATAGRAM_CONN_P, DATAGRAM_CHAN_P): New macros.
(status_message): Use concat3.
(Fprocess_status): Add `listen' status to doc string. Return `stop'
for a stopped network process.
(Fset_process_buffer): Update contact plist for network process.
(Fset_process_filter): Ditto. Don't enable input for stopped
network processes. Server must listen, even if filter is t.
(Fset_process_query_on_exit_flag, Fprocess_query_on_exit_flag):
New functions.
(Fprocess_kill_without_query): Removed. Now defined in simple.el.
(Fprocess_contact): Added KEY argument. Handle datagrams.
(list_processes_1): Optionally show only processes with the query
on exit flag set. Dynamically adjust column widths. Omit tty
column if not needed. Report stopped network processes.
Identify server and datagram network processes.
(Flist_processes): New optional arg `query-only'.
(conv_sockaddr_to_lisp, get_lisp_to_sockaddr_size)
(conv_lisp_to_sockaddr, set_socket_options)
(network_process_featurep, unwind_request_sigio): New helper functions.
(Fprocess_datagram_address, Fset_process_datagram_address):
(Fset_network_process_options): New lisp functions.
(Fopen_network_stream): Removed. Now defined in simple.el.
(Fmake_network_process): New lisp function. Code is based on previous
Fopen_network_stream, but heavily reworked with new property list based
argument list, support for datagrams, server processes, and local
sockets in addition to old client-only functionality.
(server_accept_connection): New function.
(wait_reading_process_input): Use it to handle incoming connects.
Do not enable input on a new connection if process is stopped.
(read_process_output): Handle datagram sockets. Use 2k buffer for them.
(send_process): Handle datagram sockets.
(Fstop_process, Fcontinue_process): Apply to network processes. A stopped
network process is indicated by setting command field to t .
(Fprocess_send_eof): No-op if datagram connection.
(Fstatus_notify): Don't read input for a stream server socket or a
stopped network process.
(init_process): Initialize datagram_address array.
(syms_of_process): Intern and staticpro new variables, defsubr new
functions.
2002-03-17 20:20:33 +00:00
|
|
|
|
|
|
|
|
|
:nowait BOOL -- If BOOL is non-nil for a stream type client process,
|
|
|
|
|
return without waiting for the connection to complete; instead, the
|
|
|
|
|
sentinel function will be called with second arg matching "open" (if
|
|
|
|
|
successful) or "failed" when the connect completes. Default is to use
|
|
|
|
|
a blocking connect (i.e. wait) for stream type connections.
|
|
|
|
|
|
|
|
|
|
:noquery BOOL -- Query the user unless BOOL is non-nil, and process is
|
2004-05-08 16:11:42 +00:00
|
|
|
|
running when Emacs is exited.
|
(Qlocal, QCname, QCbuffer, QChost, QCservice, QCfamily)
(QClocal, QCremote, QCserver, QCdatagram, QCnowait, QCnoquery,QCstop)
(QCcoding, QCoptions, QCfilter, QCsentinel, QClog, QCfeature):
New variables.
(NETCONN1_P): New macro.
(DATAGRAM_SOCKETS): New conditional symbol.
(datagram_address): New array.
(DATAGRAM_CONN_P, DATAGRAM_CHAN_P): New macros.
(status_message): Use concat3.
(Fprocess_status): Add `listen' status to doc string. Return `stop'
for a stopped network process.
(Fset_process_buffer): Update contact plist for network process.
(Fset_process_filter): Ditto. Don't enable input for stopped
network processes. Server must listen, even if filter is t.
(Fset_process_query_on_exit_flag, Fprocess_query_on_exit_flag):
New functions.
(Fprocess_kill_without_query): Removed. Now defined in simple.el.
(Fprocess_contact): Added KEY argument. Handle datagrams.
(list_processes_1): Optionally show only processes with the query
on exit flag set. Dynamically adjust column widths. Omit tty
column if not needed. Report stopped network processes.
Identify server and datagram network processes.
(Flist_processes): New optional arg `query-only'.
(conv_sockaddr_to_lisp, get_lisp_to_sockaddr_size)
(conv_lisp_to_sockaddr, set_socket_options)
(network_process_featurep, unwind_request_sigio): New helper functions.
(Fprocess_datagram_address, Fset_process_datagram_address):
(Fset_network_process_options): New lisp functions.
(Fopen_network_stream): Removed. Now defined in simple.el.
(Fmake_network_process): New lisp function. Code is based on previous
Fopen_network_stream, but heavily reworked with new property list based
argument list, support for datagrams, server processes, and local
sockets in addition to old client-only functionality.
(server_accept_connection): New function.
(wait_reading_process_input): Use it to handle incoming connects.
Do not enable input on a new connection if process is stopped.
(read_process_output): Handle datagram sockets. Use 2k buffer for them.
(send_process): Handle datagram sockets.
(Fstop_process, Fcontinue_process): Apply to network processes. A stopped
network process is indicated by setting command field to t .
(Fprocess_send_eof): No-op if datagram connection.
(Fstatus_notify): Don't read input for a stream server socket or a
stopped network process.
(init_process): Initialize datagram_address array.
(syms_of_process): Intern and staticpro new variables, defsubr new
functions.
2002-03-17 20:20:33 +00:00
|
|
|
|
|
|
|
|
|
:stop BOOL -- Start process in the `stopped' state if BOOL non-nil.
|
|
|
|
|
In the stopped state, a server process does not accept new
|
|
|
|
|
connections, and a client process does not handle incoming traffic.
|
|
|
|
|
The stopped state is cleared by `continue-process' and set by
|
|
|
|
|
`stop-process'.
|
|
|
|
|
|
|
|
|
|
:filter FILTER -- Install FILTER as the process filter.
|
|
|
|
|
|
2003-02-10 13:51:59 +00:00
|
|
|
|
:filter-multibyte BOOL -- If BOOL is non-nil, strings given to the
|
|
|
|
|
process filter are multibyte, otherwise they are unibyte.
|
2007-08-08 07:49:21 +00:00
|
|
|
|
If this keyword is not specified, the strings are multibyte if
|
2003-02-10 07:58:29 +00:00
|
|
|
|
`default-enable-multibyte-characters' is non-nil.
|
|
|
|
|
|
(Qlocal, QCname, QCbuffer, QChost, QCservice, QCfamily)
(QClocal, QCremote, QCserver, QCdatagram, QCnowait, QCnoquery,QCstop)
(QCcoding, QCoptions, QCfilter, QCsentinel, QClog, QCfeature):
New variables.
(NETCONN1_P): New macro.
(DATAGRAM_SOCKETS): New conditional symbol.
(datagram_address): New array.
(DATAGRAM_CONN_P, DATAGRAM_CHAN_P): New macros.
(status_message): Use concat3.
(Fprocess_status): Add `listen' status to doc string. Return `stop'
for a stopped network process.
(Fset_process_buffer): Update contact plist for network process.
(Fset_process_filter): Ditto. Don't enable input for stopped
network processes. Server must listen, even if filter is t.
(Fset_process_query_on_exit_flag, Fprocess_query_on_exit_flag):
New functions.
(Fprocess_kill_without_query): Removed. Now defined in simple.el.
(Fprocess_contact): Added KEY argument. Handle datagrams.
(list_processes_1): Optionally show only processes with the query
on exit flag set. Dynamically adjust column widths. Omit tty
column if not needed. Report stopped network processes.
Identify server and datagram network processes.
(Flist_processes): New optional arg `query-only'.
(conv_sockaddr_to_lisp, get_lisp_to_sockaddr_size)
(conv_lisp_to_sockaddr, set_socket_options)
(network_process_featurep, unwind_request_sigio): New helper functions.
(Fprocess_datagram_address, Fset_process_datagram_address):
(Fset_network_process_options): New lisp functions.
(Fopen_network_stream): Removed. Now defined in simple.el.
(Fmake_network_process): New lisp function. Code is based on previous
Fopen_network_stream, but heavily reworked with new property list based
argument list, support for datagrams, server processes, and local
sockets in addition to old client-only functionality.
(server_accept_connection): New function.
(wait_reading_process_input): Use it to handle incoming connects.
Do not enable input on a new connection if process is stopped.
(read_process_output): Handle datagram sockets. Use 2k buffer for them.
(send_process): Handle datagram sockets.
(Fstop_process, Fcontinue_process): Apply to network processes. A stopped
network process is indicated by setting command field to t .
(Fprocess_send_eof): No-op if datagram connection.
(Fstatus_notify): Don't read input for a stream server socket or a
stopped network process.
(init_process): Initialize datagram_address array.
(syms_of_process): Intern and staticpro new variables, defsubr new
functions.
2002-03-17 20:20:33 +00:00
|
|
|
|
:sentinel SENTINEL -- Install SENTINEL as the process sentinel.
|
|
|
|
|
|
|
|
|
|
:log LOG -- Install LOG as the server process log function. This
|
2002-10-24 08:03:41 +00:00
|
|
|
|
function is called when the server accepts a network connection from a
|
(Qlocal, QCname, QCbuffer, QChost, QCservice, QCfamily)
(QClocal, QCremote, QCserver, QCdatagram, QCnowait, QCnoquery,QCstop)
(QCcoding, QCoptions, QCfilter, QCsentinel, QClog, QCfeature):
New variables.
(NETCONN1_P): New macro.
(DATAGRAM_SOCKETS): New conditional symbol.
(datagram_address): New array.
(DATAGRAM_CONN_P, DATAGRAM_CHAN_P): New macros.
(status_message): Use concat3.
(Fprocess_status): Add `listen' status to doc string. Return `stop'
for a stopped network process.
(Fset_process_buffer): Update contact plist for network process.
(Fset_process_filter): Ditto. Don't enable input for stopped
network processes. Server must listen, even if filter is t.
(Fset_process_query_on_exit_flag, Fprocess_query_on_exit_flag):
New functions.
(Fprocess_kill_without_query): Removed. Now defined in simple.el.
(Fprocess_contact): Added KEY argument. Handle datagrams.
(list_processes_1): Optionally show only processes with the query
on exit flag set. Dynamically adjust column widths. Omit tty
column if not needed. Report stopped network processes.
Identify server and datagram network processes.
(Flist_processes): New optional arg `query-only'.
(conv_sockaddr_to_lisp, get_lisp_to_sockaddr_size)
(conv_lisp_to_sockaddr, set_socket_options)
(network_process_featurep, unwind_request_sigio): New helper functions.
(Fprocess_datagram_address, Fset_process_datagram_address):
(Fset_network_process_options): New lisp functions.
(Fopen_network_stream): Removed. Now defined in simple.el.
(Fmake_network_process): New lisp function. Code is based on previous
Fopen_network_stream, but heavily reworked with new property list based
argument list, support for datagrams, server processes, and local
sockets in addition to old client-only functionality.
(server_accept_connection): New function.
(wait_reading_process_input): Use it to handle incoming connects.
Do not enable input on a new connection if process is stopped.
(read_process_output): Handle datagram sockets. Use 2k buffer for them.
(send_process): Handle datagram sockets.
(Fstop_process, Fcontinue_process): Apply to network processes. A stopped
network process is indicated by setting command field to t .
(Fprocess_send_eof): No-op if datagram connection.
(Fstatus_notify): Don't read input for a stream server socket or a
stopped network process.
(init_process): Initialize datagram_address array.
(syms_of_process): Intern and staticpro new variables, defsubr new
functions.
2002-03-17 20:20:33 +00:00
|
|
|
|
client. The arguments are SERVER, CLIENT, and MESSAGE, where SERVER
|
|
|
|
|
is the server process, CLIENT is the new process for the connection,
|
|
|
|
|
and MESSAGE is a string.
|
|
|
|
|
|
2003-01-14 09:55:50 +00:00
|
|
|
|
:plist PLIST -- Install PLIST as the new process' initial plist.
|
2003-02-04 14:56:31 +00:00
|
|
|
|
|
2004-04-16 12:51:06 +00:00
|
|
|
|
:server QLEN -- if QLEN is non-nil, create a server process for the
|
(Qlocal, QCname, QCbuffer, QChost, QCservice, QCfamily)
(QClocal, QCremote, QCserver, QCdatagram, QCnowait, QCnoquery,QCstop)
(QCcoding, QCoptions, QCfilter, QCsentinel, QClog, QCfeature):
New variables.
(NETCONN1_P): New macro.
(DATAGRAM_SOCKETS): New conditional symbol.
(datagram_address): New array.
(DATAGRAM_CONN_P, DATAGRAM_CHAN_P): New macros.
(status_message): Use concat3.
(Fprocess_status): Add `listen' status to doc string. Return `stop'
for a stopped network process.
(Fset_process_buffer): Update contact plist for network process.
(Fset_process_filter): Ditto. Don't enable input for stopped
network processes. Server must listen, even if filter is t.
(Fset_process_query_on_exit_flag, Fprocess_query_on_exit_flag):
New functions.
(Fprocess_kill_without_query): Removed. Now defined in simple.el.
(Fprocess_contact): Added KEY argument. Handle datagrams.
(list_processes_1): Optionally show only processes with the query
on exit flag set. Dynamically adjust column widths. Omit tty
column if not needed. Report stopped network processes.
Identify server and datagram network processes.
(Flist_processes): New optional arg `query-only'.
(conv_sockaddr_to_lisp, get_lisp_to_sockaddr_size)
(conv_lisp_to_sockaddr, set_socket_options)
(network_process_featurep, unwind_request_sigio): New helper functions.
(Fprocess_datagram_address, Fset_process_datagram_address):
(Fset_network_process_options): New lisp functions.
(Fopen_network_stream): Removed. Now defined in simple.el.
(Fmake_network_process): New lisp function. Code is based on previous
Fopen_network_stream, but heavily reworked with new property list based
argument list, support for datagrams, server processes, and local
sockets in addition to old client-only functionality.
(server_accept_connection): New function.
(wait_reading_process_input): Use it to handle incoming connects.
Do not enable input on a new connection if process is stopped.
(read_process_output): Handle datagram sockets. Use 2k buffer for them.
(send_process): Handle datagram sockets.
(Fstop_process, Fcontinue_process): Apply to network processes. A stopped
network process is indicated by setting command field to t .
(Fprocess_send_eof): No-op if datagram connection.
(Fstatus_notify): Don't read input for a stream server socket or a
stopped network process.
(init_process): Initialize datagram_address array.
(syms_of_process): Intern and staticpro new variables, defsubr new
functions.
2002-03-17 20:20:33 +00:00
|
|
|
|
specified FAMILY, SERVICE, and connection type (stream or datagram).
|
2004-04-16 12:51:06 +00:00
|
|
|
|
If QLEN is an integer, it is used as the max. length of the server's
|
|
|
|
|
pending connection queue (also known as the backlog); the default
|
|
|
|
|
queue length is 5. Default is to create a client process.
|
|
|
|
|
|
|
|
|
|
The following network options can be specified for this connection:
|
|
|
|
|
|
|
|
|
|
:broadcast BOOL -- Allow send and receive of datagram broadcasts.
|
|
|
|
|
:dontroute BOOL -- Only send to directly connected hosts.
|
|
|
|
|
:keepalive BOOL -- Send keep-alive messages on network stream.
|
|
|
|
|
:linger BOOL or TIMEOUT -- Send queued messages before closing.
|
|
|
|
|
:oobinline BOOL -- Place out-of-band data in receive data stream.
|
|
|
|
|
:priority INT -- Set protocol defined priority for sent packets.
|
|
|
|
|
:reuseaddr BOOL -- Allow reusing a recently used local address
|
|
|
|
|
(this is allowed by default for a server process).
|
|
|
|
|
:bindtodevice NAME -- bind to interface NAME. Using this may require
|
|
|
|
|
special privileges on some systems.
|
|
|
|
|
|
|
|
|
|
Consult the relevant system programmer's manual pages for more
|
|
|
|
|
information on using these options.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
A server process will listen for and accept connections from clients.
|
|
|
|
|
When a client connection is accepted, a new network process is created
|
|
|
|
|
for the connection with the following parameters:
|
(Qlocal, QCname, QCbuffer, QChost, QCservice, QCfamily)
(QClocal, QCremote, QCserver, QCdatagram, QCnowait, QCnoquery,QCstop)
(QCcoding, QCoptions, QCfilter, QCsentinel, QClog, QCfeature):
New variables.
(NETCONN1_P): New macro.
(DATAGRAM_SOCKETS): New conditional symbol.
(datagram_address): New array.
(DATAGRAM_CONN_P, DATAGRAM_CHAN_P): New macros.
(status_message): Use concat3.
(Fprocess_status): Add `listen' status to doc string. Return `stop'
for a stopped network process.
(Fset_process_buffer): Update contact plist for network process.
(Fset_process_filter): Ditto. Don't enable input for stopped
network processes. Server must listen, even if filter is t.
(Fset_process_query_on_exit_flag, Fprocess_query_on_exit_flag):
New functions.
(Fprocess_kill_without_query): Removed. Now defined in simple.el.
(Fprocess_contact): Added KEY argument. Handle datagrams.
(list_processes_1): Optionally show only processes with the query
on exit flag set. Dynamically adjust column widths. Omit tty
column if not needed. Report stopped network processes.
Identify server and datagram network processes.
(Flist_processes): New optional arg `query-only'.
(conv_sockaddr_to_lisp, get_lisp_to_sockaddr_size)
(conv_lisp_to_sockaddr, set_socket_options)
(network_process_featurep, unwind_request_sigio): New helper functions.
(Fprocess_datagram_address, Fset_process_datagram_address):
(Fset_network_process_options): New lisp functions.
(Fopen_network_stream): Removed. Now defined in simple.el.
(Fmake_network_process): New lisp function. Code is based on previous
Fopen_network_stream, but heavily reworked with new property list based
argument list, support for datagrams, server processes, and local
sockets in addition to old client-only functionality.
(server_accept_connection): New function.
(wait_reading_process_input): Use it to handle incoming connects.
Do not enable input on a new connection if process is stopped.
(read_process_output): Handle datagram sockets. Use 2k buffer for them.
(send_process): Handle datagram sockets.
(Fstop_process, Fcontinue_process): Apply to network processes. A stopped
network process is indicated by setting command field to t .
(Fprocess_send_eof): No-op if datagram connection.
(Fstatus_notify): Don't read input for a stream server socket or a
stopped network process.
(init_process): Initialize datagram_address array.
(syms_of_process): Intern and staticpro new variables, defsubr new
functions.
2002-03-17 20:20:33 +00:00
|
|
|
|
|
|
|
|
|
- The client's process name is constructed by concatenating the server
|
|
|
|
|
process' NAME and a client identification string.
|
|
|
|
|
- If the FILTER argument is non-nil, the client process will not get a
|
|
|
|
|
separate process buffer; otherwise, the client's process buffer is a newly
|
|
|
|
|
created buffer named after the server process' BUFFER name or process
|
2003-02-04 14:56:31 +00:00
|
|
|
|
NAME concatenated with the client identification string.
|
(Qlocal, QCname, QCbuffer, QChost, QCservice, QCfamily)
(QClocal, QCremote, QCserver, QCdatagram, QCnowait, QCnoquery,QCstop)
(QCcoding, QCoptions, QCfilter, QCsentinel, QClog, QCfeature):
New variables.
(NETCONN1_P): New macro.
(DATAGRAM_SOCKETS): New conditional symbol.
(datagram_address): New array.
(DATAGRAM_CONN_P, DATAGRAM_CHAN_P): New macros.
(status_message): Use concat3.
(Fprocess_status): Add `listen' status to doc string. Return `stop'
for a stopped network process.
(Fset_process_buffer): Update contact plist for network process.
(Fset_process_filter): Ditto. Don't enable input for stopped
network processes. Server must listen, even if filter is t.
(Fset_process_query_on_exit_flag, Fprocess_query_on_exit_flag):
New functions.
(Fprocess_kill_without_query): Removed. Now defined in simple.el.
(Fprocess_contact): Added KEY argument. Handle datagrams.
(list_processes_1): Optionally show only processes with the query
on exit flag set. Dynamically adjust column widths. Omit tty
column if not needed. Report stopped network processes.
Identify server and datagram network processes.
(Flist_processes): New optional arg `query-only'.
(conv_sockaddr_to_lisp, get_lisp_to_sockaddr_size)
(conv_lisp_to_sockaddr, set_socket_options)
(network_process_featurep, unwind_request_sigio): New helper functions.
(Fprocess_datagram_address, Fset_process_datagram_address):
(Fset_network_process_options): New lisp functions.
(Fopen_network_stream): Removed. Now defined in simple.el.
(Fmake_network_process): New lisp function. Code is based on previous
Fopen_network_stream, but heavily reworked with new property list based
argument list, support for datagrams, server processes, and local
sockets in addition to old client-only functionality.
(server_accept_connection): New function.
(wait_reading_process_input): Use it to handle incoming connects.
Do not enable input on a new connection if process is stopped.
(read_process_output): Handle datagram sockets. Use 2k buffer for them.
(send_process): Handle datagram sockets.
(Fstop_process, Fcontinue_process): Apply to network processes. A stopped
network process is indicated by setting command field to t .
(Fprocess_send_eof): No-op if datagram connection.
(Fstatus_notify): Don't read input for a stream server socket or a
stopped network process.
(init_process): Initialize datagram_address array.
(syms_of_process): Intern and staticpro new variables, defsubr new
functions.
2002-03-17 20:20:33 +00:00
|
|
|
|
- The connection type and the process filter and sentinel parameters are
|
|
|
|
|
inherited from the server process' TYPE, FILTER and SENTINEL.
|
|
|
|
|
- The client process' contact info is set according to the client's
|
|
|
|
|
addressing information (typically an IP address and a port number).
|
2003-01-14 09:55:50 +00:00
|
|
|
|
- The client process' plist is initialized from the server's plist.
|
(Qlocal, QCname, QCbuffer, QChost, QCservice, QCfamily)
(QClocal, QCremote, QCserver, QCdatagram, QCnowait, QCnoquery,QCstop)
(QCcoding, QCoptions, QCfilter, QCsentinel, QClog, QCfeature):
New variables.
(NETCONN1_P): New macro.
(DATAGRAM_SOCKETS): New conditional symbol.
(datagram_address): New array.
(DATAGRAM_CONN_P, DATAGRAM_CHAN_P): New macros.
(status_message): Use concat3.
(Fprocess_status): Add `listen' status to doc string. Return `stop'
for a stopped network process.
(Fset_process_buffer): Update contact plist for network process.
(Fset_process_filter): Ditto. Don't enable input for stopped
network processes. Server must listen, even if filter is t.
(Fset_process_query_on_exit_flag, Fprocess_query_on_exit_flag):
New functions.
(Fprocess_kill_without_query): Removed. Now defined in simple.el.
(Fprocess_contact): Added KEY argument. Handle datagrams.
(list_processes_1): Optionally show only processes with the query
on exit flag set. Dynamically adjust column widths. Omit tty
column if not needed. Report stopped network processes.
Identify server and datagram network processes.
(Flist_processes): New optional arg `query-only'.
(conv_sockaddr_to_lisp, get_lisp_to_sockaddr_size)
(conv_lisp_to_sockaddr, set_socket_options)
(network_process_featurep, unwind_request_sigio): New helper functions.
(Fprocess_datagram_address, Fset_process_datagram_address):
(Fset_network_process_options): New lisp functions.
(Fopen_network_stream): Removed. Now defined in simple.el.
(Fmake_network_process): New lisp function. Code is based on previous
Fopen_network_stream, but heavily reworked with new property list based
argument list, support for datagrams, server processes, and local
sockets in addition to old client-only functionality.
(server_accept_connection): New function.
(wait_reading_process_input): Use it to handle incoming connects.
Do not enable input on a new connection if process is stopped.
(read_process_output): Handle datagram sockets. Use 2k buffer for them.
(send_process): Handle datagram sockets.
(Fstop_process, Fcontinue_process): Apply to network processes. A stopped
network process is indicated by setting command field to t .
(Fprocess_send_eof): No-op if datagram connection.
(Fstatus_notify): Don't read input for a stream server socket or a
stopped network process.
(init_process): Initialize datagram_address array.
(syms_of_process): Intern and staticpro new variables, defsubr new
functions.
2002-03-17 20:20:33 +00:00
|
|
|
|
|
|
|
|
|
Notice that the FILTER and SENTINEL args are never used directly by
|
|
|
|
|
the server process. Also, the BUFFER argument is not used directly by
|
2002-09-18 19:30:26 +00:00
|
|
|
|
the server process, but via the optional :log function, accepted (and
|
|
|
|
|
failed) connections may be logged in the server process' buffer.
|
(Qlocal, QCname, QCbuffer, QChost, QCservice, QCfamily)
(QClocal, QCremote, QCserver, QCdatagram, QCnowait, QCnoquery,QCstop)
(QCcoding, QCoptions, QCfilter, QCsentinel, QClog, QCfeature):
New variables.
(NETCONN1_P): New macro.
(DATAGRAM_SOCKETS): New conditional symbol.
(datagram_address): New array.
(DATAGRAM_CONN_P, DATAGRAM_CHAN_P): New macros.
(status_message): Use concat3.
(Fprocess_status): Add `listen' status to doc string. Return `stop'
for a stopped network process.
(Fset_process_buffer): Update contact plist for network process.
(Fset_process_filter): Ditto. Don't enable input for stopped
network processes. Server must listen, even if filter is t.
(Fset_process_query_on_exit_flag, Fprocess_query_on_exit_flag):
New functions.
(Fprocess_kill_without_query): Removed. Now defined in simple.el.
(Fprocess_contact): Added KEY argument. Handle datagrams.
(list_processes_1): Optionally show only processes with the query
on exit flag set. Dynamically adjust column widths. Omit tty
column if not needed. Report stopped network processes.
Identify server and datagram network processes.
(Flist_processes): New optional arg `query-only'.
(conv_sockaddr_to_lisp, get_lisp_to_sockaddr_size)
(conv_lisp_to_sockaddr, set_socket_options)
(network_process_featurep, unwind_request_sigio): New helper functions.
(Fprocess_datagram_address, Fset_process_datagram_address):
(Fset_network_process_options): New lisp functions.
(Fopen_network_stream): Removed. Now defined in simple.el.
(Fmake_network_process): New lisp function. Code is based on previous
Fopen_network_stream, but heavily reworked with new property list based
argument list, support for datagrams, server processes, and local
sockets in addition to old client-only functionality.
(server_accept_connection): New function.
(wait_reading_process_input): Use it to handle incoming connects.
Do not enable input on a new connection if process is stopped.
(read_process_output): Handle datagram sockets. Use 2k buffer for them.
(send_process): Handle datagram sockets.
(Fstop_process, Fcontinue_process): Apply to network processes. A stopped
network process is indicated by setting command field to t .
(Fprocess_send_eof): No-op if datagram connection.
(Fstatus_notify): Don't read input for a stream server socket or a
stopped network process.
(init_process): Initialize datagram_address array.
(syms_of_process): Intern and staticpro new variables, defsubr new
functions.
2002-03-17 20:20:33 +00:00
|
|
|
|
|
2003-01-10 22:24:41 +00:00
|
|
|
|
The original argument list, modified with the actual connection
|
|
|
|
|
information, is available via the `process-contact' function.
|
|
|
|
|
|
2002-03-18 11:27:26 +00:00
|
|
|
|
usage: (make-network-process &rest ARGS) */)
|
2010-07-08 14:25:08 -07:00
|
|
|
|
(int nargs, Lisp_Object *args)
|
1992-03-14 20:40:04 +00:00
|
|
|
|
{
|
|
|
|
|
Lisp_Object proc;
|
(Qlocal, QCname, QCbuffer, QChost, QCservice, QCfamily)
(QClocal, QCremote, QCserver, QCdatagram, QCnowait, QCnoquery,QCstop)
(QCcoding, QCoptions, QCfilter, QCsentinel, QClog, QCfeature):
New variables.
(NETCONN1_P): New macro.
(DATAGRAM_SOCKETS): New conditional symbol.
(datagram_address): New array.
(DATAGRAM_CONN_P, DATAGRAM_CHAN_P): New macros.
(status_message): Use concat3.
(Fprocess_status): Add `listen' status to doc string. Return `stop'
for a stopped network process.
(Fset_process_buffer): Update contact plist for network process.
(Fset_process_filter): Ditto. Don't enable input for stopped
network processes. Server must listen, even if filter is t.
(Fset_process_query_on_exit_flag, Fprocess_query_on_exit_flag):
New functions.
(Fprocess_kill_without_query): Removed. Now defined in simple.el.
(Fprocess_contact): Added KEY argument. Handle datagrams.
(list_processes_1): Optionally show only processes with the query
on exit flag set. Dynamically adjust column widths. Omit tty
column if not needed. Report stopped network processes.
Identify server and datagram network processes.
(Flist_processes): New optional arg `query-only'.
(conv_sockaddr_to_lisp, get_lisp_to_sockaddr_size)
(conv_lisp_to_sockaddr, set_socket_options)
(network_process_featurep, unwind_request_sigio): New helper functions.
(Fprocess_datagram_address, Fset_process_datagram_address):
(Fset_network_process_options): New lisp functions.
(Fopen_network_stream): Removed. Now defined in simple.el.
(Fmake_network_process): New lisp function. Code is based on previous
Fopen_network_stream, but heavily reworked with new property list based
argument list, support for datagrams, server processes, and local
sockets in addition to old client-only functionality.
(server_accept_connection): New function.
(wait_reading_process_input): Use it to handle incoming connects.
Do not enable input on a new connection if process is stopped.
(read_process_output): Handle datagram sockets. Use 2k buffer for them.
(send_process): Handle datagram sockets.
(Fstop_process, Fcontinue_process): Apply to network processes. A stopped
network process is indicated by setting command field to t .
(Fprocess_send_eof): No-op if datagram connection.
(Fstatus_notify): Don't read input for a stream server socket or a
stopped network process.
(init_process): Initialize datagram_address array.
(syms_of_process): Intern and staticpro new variables, defsubr new
functions.
2002-03-17 20:20:33 +00:00
|
|
|
|
Lisp_Object contact;
|
|
|
|
|
struct Lisp_Process *p;
|
2000-09-30 13:51:15 +00:00
|
|
|
|
#ifdef HAVE_GETADDRINFO
|
(Qlocal, QCname, QCbuffer, QChost, QCservice, QCfamily)
(QClocal, QCremote, QCserver, QCdatagram, QCnowait, QCnoquery,QCstop)
(QCcoding, QCoptions, QCfilter, QCsentinel, QClog, QCfeature):
New variables.
(NETCONN1_P): New macro.
(DATAGRAM_SOCKETS): New conditional symbol.
(datagram_address): New array.
(DATAGRAM_CONN_P, DATAGRAM_CHAN_P): New macros.
(status_message): Use concat3.
(Fprocess_status): Add `listen' status to doc string. Return `stop'
for a stopped network process.
(Fset_process_buffer): Update contact plist for network process.
(Fset_process_filter): Ditto. Don't enable input for stopped
network processes. Server must listen, even if filter is t.
(Fset_process_query_on_exit_flag, Fprocess_query_on_exit_flag):
New functions.
(Fprocess_kill_without_query): Removed. Now defined in simple.el.
(Fprocess_contact): Added KEY argument. Handle datagrams.
(list_processes_1): Optionally show only processes with the query
on exit flag set. Dynamically adjust column widths. Omit tty
column if not needed. Report stopped network processes.
Identify server and datagram network processes.
(Flist_processes): New optional arg `query-only'.
(conv_sockaddr_to_lisp, get_lisp_to_sockaddr_size)
(conv_lisp_to_sockaddr, set_socket_options)
(network_process_featurep, unwind_request_sigio): New helper functions.
(Fprocess_datagram_address, Fset_process_datagram_address):
(Fset_network_process_options): New lisp functions.
(Fopen_network_stream): Removed. Now defined in simple.el.
(Fmake_network_process): New lisp function. Code is based on previous
Fopen_network_stream, but heavily reworked with new property list based
argument list, support for datagrams, server processes, and local
sockets in addition to old client-only functionality.
(server_accept_connection): New function.
(wait_reading_process_input): Use it to handle incoming connects.
Do not enable input on a new connection if process is stopped.
(read_process_output): Handle datagram sockets. Use 2k buffer for them.
(send_process): Handle datagram sockets.
(Fstop_process, Fcontinue_process): Apply to network processes. A stopped
network process is indicated by setting command field to t .
(Fprocess_send_eof): No-op if datagram connection.
(Fstatus_notify): Don't read input for a stream server socket or a
stopped network process.
(init_process): Initialize datagram_address array.
(syms_of_process): Intern and staticpro new variables, defsubr new
functions.
2002-03-17 20:20:33 +00:00
|
|
|
|
struct addrinfo ai, *res, *lres;
|
2006-01-04 00:16:54 +00:00
|
|
|
|
struct addrinfo hints;
|
|
|
|
|
char *portstring, portbuf[128];
|
2000-09-30 13:51:15 +00:00
|
|
|
|
#else /* HAVE_GETADDRINFO */
|
2002-02-28 23:53:59 +00:00
|
|
|
|
struct _emacs_addrinfo
|
|
|
|
|
{
|
|
|
|
|
int ai_family;
|
|
|
|
|
int ai_socktype;
|
|
|
|
|
int ai_protocol;
|
|
|
|
|
int ai_addrlen;
|
|
|
|
|
struct sockaddr *ai_addr;
|
|
|
|
|
struct _emacs_addrinfo *ai_next;
|
|
|
|
|
} ai, *res, *lres;
|
1999-08-14 04:36:10 +00:00
|
|
|
|
#endif /* HAVE_GETADDRINFO */
|
(Qlocal, QCname, QCbuffer, QChost, QCservice, QCfamily)
(QClocal, QCremote, QCserver, QCdatagram, QCnowait, QCnoquery,QCstop)
(QCcoding, QCoptions, QCfilter, QCsentinel, QClog, QCfeature):
New variables.
(NETCONN1_P): New macro.
(DATAGRAM_SOCKETS): New conditional symbol.
(datagram_address): New array.
(DATAGRAM_CONN_P, DATAGRAM_CHAN_P): New macros.
(status_message): Use concat3.
(Fprocess_status): Add `listen' status to doc string. Return `stop'
for a stopped network process.
(Fset_process_buffer): Update contact plist for network process.
(Fset_process_filter): Ditto. Don't enable input for stopped
network processes. Server must listen, even if filter is t.
(Fset_process_query_on_exit_flag, Fprocess_query_on_exit_flag):
New functions.
(Fprocess_kill_without_query): Removed. Now defined in simple.el.
(Fprocess_contact): Added KEY argument. Handle datagrams.
(list_processes_1): Optionally show only processes with the query
on exit flag set. Dynamically adjust column widths. Omit tty
column if not needed. Report stopped network processes.
Identify server and datagram network processes.
(Flist_processes): New optional arg `query-only'.
(conv_sockaddr_to_lisp, get_lisp_to_sockaddr_size)
(conv_lisp_to_sockaddr, set_socket_options)
(network_process_featurep, unwind_request_sigio): New helper functions.
(Fprocess_datagram_address, Fset_process_datagram_address):
(Fset_network_process_options): New lisp functions.
(Fopen_network_stream): Removed. Now defined in simple.el.
(Fmake_network_process): New lisp function. Code is based on previous
Fopen_network_stream, but heavily reworked with new property list based
argument list, support for datagrams, server processes, and local
sockets in addition to old client-only functionality.
(server_accept_connection): New function.
(wait_reading_process_input): Use it to handle incoming connects.
Do not enable input on a new connection if process is stopped.
(read_process_output): Handle datagram sockets. Use 2k buffer for them.
(send_process): Handle datagram sockets.
(Fstop_process, Fcontinue_process): Apply to network processes. A stopped
network process is indicated by setting command field to t .
(Fprocess_send_eof): No-op if datagram connection.
(Fstatus_notify): Don't read input for a stream server socket or a
stopped network process.
(init_process): Initialize datagram_address array.
(syms_of_process): Intern and staticpro new variables, defsubr new
functions.
2002-03-17 20:20:33 +00:00
|
|
|
|
struct sockaddr_in address_in;
|
|
|
|
|
#ifdef HAVE_LOCAL_SOCKETS
|
|
|
|
|
struct sockaddr_un address_un;
|
|
|
|
|
#endif
|
|
|
|
|
int port;
|
2002-02-28 23:53:59 +00:00
|
|
|
|
int ret = 0;
|
|
|
|
|
int xerrno = 0;
|
1999-08-14 04:36:10 +00:00
|
|
|
|
int s = -1, outch, inch;
|
(Qlocal, QCname, QCbuffer, QChost, QCservice, QCfamily)
(QClocal, QCremote, QCserver, QCdatagram, QCnowait, QCnoquery,QCstop)
(QCcoding, QCoptions, QCfilter, QCsentinel, QClog, QCfeature):
New variables.
(NETCONN1_P): New macro.
(DATAGRAM_SOCKETS): New conditional symbol.
(datagram_address): New array.
(DATAGRAM_CONN_P, DATAGRAM_CHAN_P): New macros.
(status_message): Use concat3.
(Fprocess_status): Add `listen' status to doc string. Return `stop'
for a stopped network process.
(Fset_process_buffer): Update contact plist for network process.
(Fset_process_filter): Ditto. Don't enable input for stopped
network processes. Server must listen, even if filter is t.
(Fset_process_query_on_exit_flag, Fprocess_query_on_exit_flag):
New functions.
(Fprocess_kill_without_query): Removed. Now defined in simple.el.
(Fprocess_contact): Added KEY argument. Handle datagrams.
(list_processes_1): Optionally show only processes with the query
on exit flag set. Dynamically adjust column widths. Omit tty
column if not needed. Report stopped network processes.
Identify server and datagram network processes.
(Flist_processes): New optional arg `query-only'.
(conv_sockaddr_to_lisp, get_lisp_to_sockaddr_size)
(conv_lisp_to_sockaddr, set_socket_options)
(network_process_featurep, unwind_request_sigio): New helper functions.
(Fprocess_datagram_address, Fset_process_datagram_address):
(Fset_network_process_options): New lisp functions.
(Fopen_network_stream): Removed. Now defined in simple.el.
(Fmake_network_process): New lisp function. Code is based on previous
Fopen_network_stream, but heavily reworked with new property list based
argument list, support for datagrams, server processes, and local
sockets in addition to old client-only functionality.
(server_accept_connection): New function.
(wait_reading_process_input): Use it to handle incoming connects.
Do not enable input on a new connection if process is stopped.
(read_process_output): Handle datagram sockets. Use 2k buffer for them.
(send_process): Handle datagram sockets.
(Fstop_process, Fcontinue_process): Apply to network processes. A stopped
network process is indicated by setting command field to t .
(Fprocess_send_eof): No-op if datagram connection.
(Fstatus_notify): Don't read input for a stream server socket or a
stopped network process.
(init_process): Initialize datagram_address array.
(syms_of_process): Intern and staticpro new variables, defsubr new
functions.
2002-03-17 20:20:33 +00:00
|
|
|
|
struct gcpro gcpro1;
|
2002-07-11 14:18:02 +00:00
|
|
|
|
int count = SPECPDL_INDEX ();
|
1999-09-14 08:33:24 +00:00
|
|
|
|
int count1;
|
(Qlocal, QCname, QCbuffer, QChost, QCservice, QCfamily)
(QClocal, QCremote, QCserver, QCdatagram, QCnowait, QCnoquery,QCstop)
(QCcoding, QCoptions, QCfilter, QCsentinel, QClog, QCfeature):
New variables.
(NETCONN1_P): New macro.
(DATAGRAM_SOCKETS): New conditional symbol.
(datagram_address): New array.
(DATAGRAM_CONN_P, DATAGRAM_CHAN_P): New macros.
(status_message): Use concat3.
(Fprocess_status): Add `listen' status to doc string. Return `stop'
for a stopped network process.
(Fset_process_buffer): Update contact plist for network process.
(Fset_process_filter): Ditto. Don't enable input for stopped
network processes. Server must listen, even if filter is t.
(Fset_process_query_on_exit_flag, Fprocess_query_on_exit_flag):
New functions.
(Fprocess_kill_without_query): Removed. Now defined in simple.el.
(Fprocess_contact): Added KEY argument. Handle datagrams.
(list_processes_1): Optionally show only processes with the query
on exit flag set. Dynamically adjust column widths. Omit tty
column if not needed. Report stopped network processes.
Identify server and datagram network processes.
(Flist_processes): New optional arg `query-only'.
(conv_sockaddr_to_lisp, get_lisp_to_sockaddr_size)
(conv_lisp_to_sockaddr, set_socket_options)
(network_process_featurep, unwind_request_sigio): New helper functions.
(Fprocess_datagram_address, Fset_process_datagram_address):
(Fset_network_process_options): New lisp functions.
(Fopen_network_stream): Removed. Now defined in simple.el.
(Fmake_network_process): New lisp function. Code is based on previous
Fopen_network_stream, but heavily reworked with new property list based
argument list, support for datagrams, server processes, and local
sockets in addition to old client-only functionality.
(server_accept_connection): New function.
(wait_reading_process_input): Use it to handle incoming connects.
Do not enable input on a new connection if process is stopped.
(read_process_output): Handle datagram sockets. Use 2k buffer for them.
(send_process): Handle datagram sockets.
(Fstop_process, Fcontinue_process): Apply to network processes. A stopped
network process is indicated by setting command field to t .
(Fprocess_send_eof): No-op if datagram connection.
(Fstatus_notify): Don't read input for a stream server socket or a
stopped network process.
(init_process): Initialize datagram_address array.
(syms_of_process): Intern and staticpro new variables, defsubr new
functions.
2002-03-17 20:20:33 +00:00
|
|
|
|
Lisp_Object QCaddress; /* one of QClocal or QCremote */
|
|
|
|
|
Lisp_Object tem;
|
|
|
|
|
Lisp_Object name, buffer, host, service, address;
|
|
|
|
|
Lisp_Object filter, sentinel;
|
|
|
|
|
int is_non_blocking_client = 0;
|
2004-04-16 12:51:06 +00:00
|
|
|
|
int is_server = 0, backlog = 5;
|
2002-03-21 12:20:24 +00:00
|
|
|
|
int socktype;
|
(Qlocal, QCname, QCbuffer, QChost, QCservice, QCfamily)
(QClocal, QCremote, QCserver, QCdatagram, QCnowait, QCnoquery,QCstop)
(QCcoding, QCoptions, QCfilter, QCsentinel, QClog, QCfeature):
New variables.
(NETCONN1_P): New macro.
(DATAGRAM_SOCKETS): New conditional symbol.
(datagram_address): New array.
(DATAGRAM_CONN_P, DATAGRAM_CHAN_P): New macros.
(status_message): Use concat3.
(Fprocess_status): Add `listen' status to doc string. Return `stop'
for a stopped network process.
(Fset_process_buffer): Update contact plist for network process.
(Fset_process_filter): Ditto. Don't enable input for stopped
network processes. Server must listen, even if filter is t.
(Fset_process_query_on_exit_flag, Fprocess_query_on_exit_flag):
New functions.
(Fprocess_kill_without_query): Removed. Now defined in simple.el.
(Fprocess_contact): Added KEY argument. Handle datagrams.
(list_processes_1): Optionally show only processes with the query
on exit flag set. Dynamically adjust column widths. Omit tty
column if not needed. Report stopped network processes.
Identify server and datagram network processes.
(Flist_processes): New optional arg `query-only'.
(conv_sockaddr_to_lisp, get_lisp_to_sockaddr_size)
(conv_lisp_to_sockaddr, set_socket_options)
(network_process_featurep, unwind_request_sigio): New helper functions.
(Fprocess_datagram_address, Fset_process_datagram_address):
(Fset_network_process_options): New lisp functions.
(Fopen_network_stream): Removed. Now defined in simple.el.
(Fmake_network_process): New lisp function. Code is based on previous
Fopen_network_stream, but heavily reworked with new property list based
argument list, support for datagrams, server processes, and local
sockets in addition to old client-only functionality.
(server_accept_connection): New function.
(wait_reading_process_input): Use it to handle incoming connects.
Do not enable input on a new connection if process is stopped.
(read_process_output): Handle datagram sockets. Use 2k buffer for them.
(send_process): Handle datagram sockets.
(Fstop_process, Fcontinue_process): Apply to network processes. A stopped
network process is indicated by setting command field to t .
(Fprocess_send_eof): No-op if datagram connection.
(Fstatus_notify): Don't read input for a stream server socket or a
stopped network process.
(init_process): Initialize datagram_address array.
(syms_of_process): Intern and staticpro new variables, defsubr new
functions.
2002-03-17 20:20:33 +00:00
|
|
|
|
int family = -1;
|
|
|
|
|
|
|
|
|
|
if (nargs == 0)
|
|
|
|
|
return Qnil;
|
2002-02-28 23:53:59 +00:00
|
|
|
|
|
(Qlocal, QCname, QCbuffer, QChost, QCservice, QCfamily)
(QClocal, QCremote, QCserver, QCdatagram, QCnowait, QCnoquery,QCstop)
(QCcoding, QCoptions, QCfilter, QCsentinel, QClog, QCfeature):
New variables.
(NETCONN1_P): New macro.
(DATAGRAM_SOCKETS): New conditional symbol.
(datagram_address): New array.
(DATAGRAM_CONN_P, DATAGRAM_CHAN_P): New macros.
(status_message): Use concat3.
(Fprocess_status): Add `listen' status to doc string. Return `stop'
for a stopped network process.
(Fset_process_buffer): Update contact plist for network process.
(Fset_process_filter): Ditto. Don't enable input for stopped
network processes. Server must listen, even if filter is t.
(Fset_process_query_on_exit_flag, Fprocess_query_on_exit_flag):
New functions.
(Fprocess_kill_without_query): Removed. Now defined in simple.el.
(Fprocess_contact): Added KEY argument. Handle datagrams.
(list_processes_1): Optionally show only processes with the query
on exit flag set. Dynamically adjust column widths. Omit tty
column if not needed. Report stopped network processes.
Identify server and datagram network processes.
(Flist_processes): New optional arg `query-only'.
(conv_sockaddr_to_lisp, get_lisp_to_sockaddr_size)
(conv_lisp_to_sockaddr, set_socket_options)
(network_process_featurep, unwind_request_sigio): New helper functions.
(Fprocess_datagram_address, Fset_process_datagram_address):
(Fset_network_process_options): New lisp functions.
(Fopen_network_stream): Removed. Now defined in simple.el.
(Fmake_network_process): New lisp function. Code is based on previous
Fopen_network_stream, but heavily reworked with new property list based
argument list, support for datagrams, server processes, and local
sockets in addition to old client-only functionality.
(server_accept_connection): New function.
(wait_reading_process_input): Use it to handle incoming connects.
Do not enable input on a new connection if process is stopped.
(read_process_output): Handle datagram sockets. Use 2k buffer for them.
(send_process): Handle datagram sockets.
(Fstop_process, Fcontinue_process): Apply to network processes. A stopped
network process is indicated by setting command field to t .
(Fprocess_send_eof): No-op if datagram connection.
(Fstatus_notify): Don't read input for a stream server socket or a
stopped network process.
(init_process): Initialize datagram_address array.
(syms_of_process): Intern and staticpro new variables, defsubr new
functions.
2002-03-17 20:20:33 +00:00
|
|
|
|
/* Save arguments for process-contact and clone-process. */
|
|
|
|
|
contact = Flist (nargs, args);
|
|
|
|
|
GCPRO1 (contact);
|
|
|
|
|
|
1996-06-08 00:14:31 +00:00
|
|
|
|
#ifdef WINDOWSNT
|
|
|
|
|
/* Ensure socket support is loaded if available. */
|
|
|
|
|
init_winsock (TRUE);
|
|
|
|
|
#endif
|
|
|
|
|
|
2002-03-21 12:20:24 +00:00
|
|
|
|
/* :type TYPE (nil: stream, datagram */
|
|
|
|
|
tem = Fplist_get (contact, QCtype);
|
|
|
|
|
if (NILP (tem))
|
|
|
|
|
socktype = SOCK_STREAM;
|
|
|
|
|
#ifdef DATAGRAM_SOCKETS
|
|
|
|
|
else if (EQ (tem, Qdatagram))
|
|
|
|
|
socktype = SOCK_DGRAM;
|
2009-12-03 18:51:32 +00:00
|
|
|
|
#endif
|
|
|
|
|
#ifdef HAVE_SEQPACKET
|
|
|
|
|
else if (EQ (tem, Qseqpacket))
|
|
|
|
|
socktype = SOCK_SEQPACKET;
|
(Qlocal, QCname, QCbuffer, QChost, QCservice, QCfamily)
(QClocal, QCremote, QCserver, QCdatagram, QCnowait, QCnoquery,QCstop)
(QCcoding, QCoptions, QCfilter, QCsentinel, QClog, QCfeature):
New variables.
(NETCONN1_P): New macro.
(DATAGRAM_SOCKETS): New conditional symbol.
(datagram_address): New array.
(DATAGRAM_CONN_P, DATAGRAM_CHAN_P): New macros.
(status_message): Use concat3.
(Fprocess_status): Add `listen' status to doc string. Return `stop'
for a stopped network process.
(Fset_process_buffer): Update contact plist for network process.
(Fset_process_filter): Ditto. Don't enable input for stopped
network processes. Server must listen, even if filter is t.
(Fset_process_query_on_exit_flag, Fprocess_query_on_exit_flag):
New functions.
(Fprocess_kill_without_query): Removed. Now defined in simple.el.
(Fprocess_contact): Added KEY argument. Handle datagrams.
(list_processes_1): Optionally show only processes with the query
on exit flag set. Dynamically adjust column widths. Omit tty
column if not needed. Report stopped network processes.
Identify server and datagram network processes.
(Flist_processes): New optional arg `query-only'.
(conv_sockaddr_to_lisp, get_lisp_to_sockaddr_size)
(conv_lisp_to_sockaddr, set_socket_options)
(network_process_featurep, unwind_request_sigio): New helper functions.
(Fprocess_datagram_address, Fset_process_datagram_address):
(Fset_network_process_options): New lisp functions.
(Fopen_network_stream): Removed. Now defined in simple.el.
(Fmake_network_process): New lisp function. Code is based on previous
Fopen_network_stream, but heavily reworked with new property list based
argument list, support for datagrams, server processes, and local
sockets in addition to old client-only functionality.
(server_accept_connection): New function.
(wait_reading_process_input): Use it to handle incoming connects.
Do not enable input on a new connection if process is stopped.
(read_process_output): Handle datagram sockets. Use 2k buffer for them.
(send_process): Handle datagram sockets.
(Fstop_process, Fcontinue_process): Apply to network processes. A stopped
network process is indicated by setting command field to t .
(Fprocess_send_eof): No-op if datagram connection.
(Fstatus_notify): Don't read input for a stream server socket or a
stopped network process.
(init_process): Initialize datagram_address array.
(syms_of_process): Intern and staticpro new variables, defsubr new
functions.
2002-03-17 20:20:33 +00:00
|
|
|
|
#endif
|
2002-03-21 12:20:24 +00:00
|
|
|
|
else
|
|
|
|
|
error ("Unsupported connection type");
|
(Qlocal, QCname, QCbuffer, QChost, QCservice, QCfamily)
(QClocal, QCremote, QCserver, QCdatagram, QCnowait, QCnoquery,QCstop)
(QCcoding, QCoptions, QCfilter, QCsentinel, QClog, QCfeature):
New variables.
(NETCONN1_P): New macro.
(DATAGRAM_SOCKETS): New conditional symbol.
(datagram_address): New array.
(DATAGRAM_CONN_P, DATAGRAM_CHAN_P): New macros.
(status_message): Use concat3.
(Fprocess_status): Add `listen' status to doc string. Return `stop'
for a stopped network process.
(Fset_process_buffer): Update contact plist for network process.
(Fset_process_filter): Ditto. Don't enable input for stopped
network processes. Server must listen, even if filter is t.
(Fset_process_query_on_exit_flag, Fprocess_query_on_exit_flag):
New functions.
(Fprocess_kill_without_query): Removed. Now defined in simple.el.
(Fprocess_contact): Added KEY argument. Handle datagrams.
(list_processes_1): Optionally show only processes with the query
on exit flag set. Dynamically adjust column widths. Omit tty
column if not needed. Report stopped network processes.
Identify server and datagram network processes.
(Flist_processes): New optional arg `query-only'.
(conv_sockaddr_to_lisp, get_lisp_to_sockaddr_size)
(conv_lisp_to_sockaddr, set_socket_options)
(network_process_featurep, unwind_request_sigio): New helper functions.
(Fprocess_datagram_address, Fset_process_datagram_address):
(Fset_network_process_options): New lisp functions.
(Fopen_network_stream): Removed. Now defined in simple.el.
(Fmake_network_process): New lisp function. Code is based on previous
Fopen_network_stream, but heavily reworked with new property list based
argument list, support for datagrams, server processes, and local
sockets in addition to old client-only functionality.
(server_accept_connection): New function.
(wait_reading_process_input): Use it to handle incoming connects.
Do not enable input on a new connection if process is stopped.
(read_process_output): Handle datagram sockets. Use 2k buffer for them.
(send_process): Handle datagram sockets.
(Fstop_process, Fcontinue_process): Apply to network processes. A stopped
network process is indicated by setting command field to t .
(Fprocess_send_eof): No-op if datagram connection.
(Fstatus_notify): Don't read input for a stream server socket or a
stopped network process.
(init_process): Initialize datagram_address array.
(syms_of_process): Intern and staticpro new variables, defsubr new
functions.
2002-03-17 20:20:33 +00:00
|
|
|
|
|
|
|
|
|
/* :server BOOL */
|
|
|
|
|
tem = Fplist_get (contact, QCserver);
|
|
|
|
|
if (!NILP (tem))
|
|
|
|
|
{
|
2002-05-03 21:24:27 +00:00
|
|
|
|
/* Don't support network sockets when non-blocking mode is
|
|
|
|
|
not available, since a blocked Emacs is not useful. */
|
* systty.h: Remove code for Aix on 386, unsupported platform.
* s/ms-w32.h: Remove boilerplate comments.
(fcloseall, fgetchar, flushall, fputchar, getw, putw): Remove, unused.
* s/gnu-linux.h (TERM): Remove support.
(HAVE_SYSVIPC): Remove, unused.
(A_TEXT_OFFSET, A_TEXT_SEEK, ADJUST_EXEC_HEADER): Remove, not used
for this system.
* process.c: Remove support for IRIS, unused.
Remove support for TERM, not relevant anymore.
* unexalpha.c (DEFAULT_ENTRY_ADDRESS): Remove, replace the only
used with the definition.
* s/aix4-2.h (static): Do not undef.
* m/ibmrs6000.h: Remove code depending on USG5_4, this file is
only used on Aix.
(HAVE_SYSVIPC): Remove, unused.
* m/hp800.h (CANNOT_DUMP): Do not undef.
* m/alpha.h: Fix comment.
* s/usg5-4.h (HAVE_SYSVIPC): Remove, unused.
(USG_SHARED_LIBRARIES): Remove, only used in unexec.c which is not
used by this configuration.
* emacs.c: Remove code depending on USG_SHARED_LIBRARIES.
* unexec.c: Remove code depending on HPUX and
USG_SHARED_LIBRARIES, not used with this file. Remove code
depending on IRIS, unused. Remove if 0-ed code.
2008-07-16 08:06:18 +00:00
|
|
|
|
#if !defined(O_NONBLOCK) && !defined(O_NDELAY)
|
(Qlocal, QCname, QCbuffer, QChost, QCservice, QCfamily)
(QClocal, QCremote, QCserver, QCdatagram, QCnowait, QCnoquery,QCstop)
(QCcoding, QCoptions, QCfilter, QCsentinel, QClog, QCfeature):
New variables.
(NETCONN1_P): New macro.
(DATAGRAM_SOCKETS): New conditional symbol.
(datagram_address): New array.
(DATAGRAM_CONN_P, DATAGRAM_CHAN_P): New macros.
(status_message): Use concat3.
(Fprocess_status): Add `listen' status to doc string. Return `stop'
for a stopped network process.
(Fset_process_buffer): Update contact plist for network process.
(Fset_process_filter): Ditto. Don't enable input for stopped
network processes. Server must listen, even if filter is t.
(Fset_process_query_on_exit_flag, Fprocess_query_on_exit_flag):
New functions.
(Fprocess_kill_without_query): Removed. Now defined in simple.el.
(Fprocess_contact): Added KEY argument. Handle datagrams.
(list_processes_1): Optionally show only processes with the query
on exit flag set. Dynamically adjust column widths. Omit tty
column if not needed. Report stopped network processes.
Identify server and datagram network processes.
(Flist_processes): New optional arg `query-only'.
(conv_sockaddr_to_lisp, get_lisp_to_sockaddr_size)
(conv_lisp_to_sockaddr, set_socket_options)
(network_process_featurep, unwind_request_sigio): New helper functions.
(Fprocess_datagram_address, Fset_process_datagram_address):
(Fset_network_process_options): New lisp functions.
(Fopen_network_stream): Removed. Now defined in simple.el.
(Fmake_network_process): New lisp function. Code is based on previous
Fopen_network_stream, but heavily reworked with new property list based
argument list, support for datagrams, server processes, and local
sockets in addition to old client-only functionality.
(server_accept_connection): New function.
(wait_reading_process_input): Use it to handle incoming connects.
Do not enable input on a new connection if process is stopped.
(read_process_output): Handle datagram sockets. Use 2k buffer for them.
(send_process): Handle datagram sockets.
(Fstop_process, Fcontinue_process): Apply to network processes. A stopped
network process is indicated by setting command field to t .
(Fprocess_send_eof): No-op if datagram connection.
(Fstatus_notify): Don't read input for a stream server socket or a
stopped network process.
(init_process): Initialize datagram_address array.
(syms_of_process): Intern and staticpro new variables, defsubr new
functions.
2002-03-17 20:20:33 +00:00
|
|
|
|
error ("Network servers not supported");
|
|
|
|
|
#else
|
|
|
|
|
is_server = 1;
|
2004-04-16 12:51:06 +00:00
|
|
|
|
if (INTEGERP (tem))
|
|
|
|
|
backlog = XINT (tem);
|
(Qlocal, QCname, QCbuffer, QChost, QCservice, QCfamily)
(QClocal, QCremote, QCserver, QCdatagram, QCnowait, QCnoquery,QCstop)
(QCcoding, QCoptions, QCfilter, QCsentinel, QClog, QCfeature):
New variables.
(NETCONN1_P): New macro.
(DATAGRAM_SOCKETS): New conditional symbol.
(datagram_address): New array.
(DATAGRAM_CONN_P, DATAGRAM_CHAN_P): New macros.
(status_message): Use concat3.
(Fprocess_status): Add `listen' status to doc string. Return `stop'
for a stopped network process.
(Fset_process_buffer): Update contact plist for network process.
(Fset_process_filter): Ditto. Don't enable input for stopped
network processes. Server must listen, even if filter is t.
(Fset_process_query_on_exit_flag, Fprocess_query_on_exit_flag):
New functions.
(Fprocess_kill_without_query): Removed. Now defined in simple.el.
(Fprocess_contact): Added KEY argument. Handle datagrams.
(list_processes_1): Optionally show only processes with the query
on exit flag set. Dynamically adjust column widths. Omit tty
column if not needed. Report stopped network processes.
Identify server and datagram network processes.
(Flist_processes): New optional arg `query-only'.
(conv_sockaddr_to_lisp, get_lisp_to_sockaddr_size)
(conv_lisp_to_sockaddr, set_socket_options)
(network_process_featurep, unwind_request_sigio): New helper functions.
(Fprocess_datagram_address, Fset_process_datagram_address):
(Fset_network_process_options): New lisp functions.
(Fopen_network_stream): Removed. Now defined in simple.el.
(Fmake_network_process): New lisp function. Code is based on previous
Fopen_network_stream, but heavily reworked with new property list based
argument list, support for datagrams, server processes, and local
sockets in addition to old client-only functionality.
(server_accept_connection): New function.
(wait_reading_process_input): Use it to handle incoming connects.
Do not enable input on a new connection if process is stopped.
(read_process_output): Handle datagram sockets. Use 2k buffer for them.
(send_process): Handle datagram sockets.
(Fstop_process, Fcontinue_process): Apply to network processes. A stopped
network process is indicated by setting command field to t .
(Fprocess_send_eof): No-op if datagram connection.
(Fstatus_notify): Don't read input for a stream server socket or a
stopped network process.
(init_process): Initialize datagram_address array.
(syms_of_process): Intern and staticpro new variables, defsubr new
functions.
2002-03-17 20:20:33 +00:00
|
|
|
|
#endif
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Make QCaddress an alias for :local (server) or :remote (client). */
|
|
|
|
|
QCaddress = is_server ? QClocal : QCremote;
|
|
|
|
|
|
2006-12-27 21:46:25 +00:00
|
|
|
|
/* :nowait BOOL */
|
2009-12-03 19:01:36 +00:00
|
|
|
|
if (!is_server && socktype != SOCK_DGRAM
|
(Qlocal, QCname, QCbuffer, QChost, QCservice, QCfamily)
(QClocal, QCremote, QCserver, QCdatagram, QCnowait, QCnoquery,QCstop)
(QCcoding, QCoptions, QCfilter, QCsentinel, QClog, QCfeature):
New variables.
(NETCONN1_P): New macro.
(DATAGRAM_SOCKETS): New conditional symbol.
(datagram_address): New array.
(DATAGRAM_CONN_P, DATAGRAM_CHAN_P): New macros.
(status_message): Use concat3.
(Fprocess_status): Add `listen' status to doc string. Return `stop'
for a stopped network process.
(Fset_process_buffer): Update contact plist for network process.
(Fset_process_filter): Ditto. Don't enable input for stopped
network processes. Server must listen, even if filter is t.
(Fset_process_query_on_exit_flag, Fprocess_query_on_exit_flag):
New functions.
(Fprocess_kill_without_query): Removed. Now defined in simple.el.
(Fprocess_contact): Added KEY argument. Handle datagrams.
(list_processes_1): Optionally show only processes with the query
on exit flag set. Dynamically adjust column widths. Omit tty
column if not needed. Report stopped network processes.
Identify server and datagram network processes.
(Flist_processes): New optional arg `query-only'.
(conv_sockaddr_to_lisp, get_lisp_to_sockaddr_size)
(conv_lisp_to_sockaddr, set_socket_options)
(network_process_featurep, unwind_request_sigio): New helper functions.
(Fprocess_datagram_address, Fset_process_datagram_address):
(Fset_network_process_options): New lisp functions.
(Fopen_network_stream): Removed. Now defined in simple.el.
(Fmake_network_process): New lisp function. Code is based on previous
Fopen_network_stream, but heavily reworked with new property list based
argument list, support for datagrams, server processes, and local
sockets in addition to old client-only functionality.
(server_accept_connection): New function.
(wait_reading_process_input): Use it to handle incoming connects.
Do not enable input on a new connection if process is stopped.
(read_process_output): Handle datagram sockets. Use 2k buffer for them.
(send_process): Handle datagram sockets.
(Fstop_process, Fcontinue_process): Apply to network processes. A stopped
network process is indicated by setting command field to t .
(Fprocess_send_eof): No-op if datagram connection.
(Fstatus_notify): Don't read input for a stream server socket or a
stopped network process.
(init_process): Initialize datagram_address array.
(syms_of_process): Intern and staticpro new variables, defsubr new
functions.
2002-03-17 20:20:33 +00:00
|
|
|
|
&& (tem = Fplist_get (contact, QCnowait), !NILP (tem)))
|
|
|
|
|
{
|
|
|
|
|
#ifndef NON_BLOCKING_CONNECT
|
|
|
|
|
error ("Non-blocking connect not supported");
|
|
|
|
|
#else
|
|
|
|
|
is_non_blocking_client = 1;
|
|
|
|
|
#endif
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
name = Fplist_get (contact, QCname);
|
|
|
|
|
buffer = Fplist_get (contact, QCbuffer);
|
|
|
|
|
filter = Fplist_get (contact, QCfilter);
|
|
|
|
|
sentinel = Fplist_get (contact, QCsentinel);
|
|
|
|
|
|
2001-11-02 20:46:55 +00:00
|
|
|
|
CHECK_STRING (name);
|
(Qlocal, QCname, QCbuffer, QChost, QCservice, QCfamily)
(QClocal, QCremote, QCserver, QCdatagram, QCnowait, QCnoquery,QCstop)
(QCcoding, QCoptions, QCfilter, QCsentinel, QClog, QCfeature):
New variables.
(NETCONN1_P): New macro.
(DATAGRAM_SOCKETS): New conditional symbol.
(datagram_address): New array.
(DATAGRAM_CONN_P, DATAGRAM_CHAN_P): New macros.
(status_message): Use concat3.
(Fprocess_status): Add `listen' status to doc string. Return `stop'
for a stopped network process.
(Fset_process_buffer): Update contact plist for network process.
(Fset_process_filter): Ditto. Don't enable input for stopped
network processes. Server must listen, even if filter is t.
(Fset_process_query_on_exit_flag, Fprocess_query_on_exit_flag):
New functions.
(Fprocess_kill_without_query): Removed. Now defined in simple.el.
(Fprocess_contact): Added KEY argument. Handle datagrams.
(list_processes_1): Optionally show only processes with the query
on exit flag set. Dynamically adjust column widths. Omit tty
column if not needed. Report stopped network processes.
Identify server and datagram network processes.
(Flist_processes): New optional arg `query-only'.
(conv_sockaddr_to_lisp, get_lisp_to_sockaddr_size)
(conv_lisp_to_sockaddr, set_socket_options)
(network_process_featurep, unwind_request_sigio): New helper functions.
(Fprocess_datagram_address, Fset_process_datagram_address):
(Fset_network_process_options): New lisp functions.
(Fopen_network_stream): Removed. Now defined in simple.el.
(Fmake_network_process): New lisp function. Code is based on previous
Fopen_network_stream, but heavily reworked with new property list based
argument list, support for datagrams, server processes, and local
sockets in addition to old client-only functionality.
(server_accept_connection): New function.
(wait_reading_process_input): Use it to handle incoming connects.
Do not enable input on a new connection if process is stopped.
(read_process_output): Handle datagram sockets. Use 2k buffer for them.
(send_process): Handle datagram sockets.
(Fstop_process, Fcontinue_process): Apply to network processes. A stopped
network process is indicated by setting command field to t .
(Fprocess_send_eof): No-op if datagram connection.
(Fstatus_notify): Don't read input for a stream server socket or a
stopped network process.
(init_process): Initialize datagram_address array.
(syms_of_process): Intern and staticpro new variables, defsubr new
functions.
2002-03-17 20:20:33 +00:00
|
|
|
|
|
|
|
|
|
/* Initialize addrinfo structure in case we don't use getaddrinfo. */
|
|
|
|
|
ai.ai_socktype = socktype;
|
|
|
|
|
ai.ai_protocol = 0;
|
|
|
|
|
ai.ai_next = NULL;
|
|
|
|
|
res = &ai;
|
1999-08-12 16:35:22 +00:00
|
|
|
|
|
(Qlocal, QCname, QCbuffer, QChost, QCservice, QCfamily)
(QClocal, QCremote, QCserver, QCdatagram, QCnowait, QCnoquery,QCstop)
(QCcoding, QCoptions, QCfilter, QCsentinel, QClog, QCfeature):
New variables.
(NETCONN1_P): New macro.
(DATAGRAM_SOCKETS): New conditional symbol.
(datagram_address): New array.
(DATAGRAM_CONN_P, DATAGRAM_CHAN_P): New macros.
(status_message): Use concat3.
(Fprocess_status): Add `listen' status to doc string. Return `stop'
for a stopped network process.
(Fset_process_buffer): Update contact plist for network process.
(Fset_process_filter): Ditto. Don't enable input for stopped
network processes. Server must listen, even if filter is t.
(Fset_process_query_on_exit_flag, Fprocess_query_on_exit_flag):
New functions.
(Fprocess_kill_without_query): Removed. Now defined in simple.el.
(Fprocess_contact): Added KEY argument. Handle datagrams.
(list_processes_1): Optionally show only processes with the query
on exit flag set. Dynamically adjust column widths. Omit tty
column if not needed. Report stopped network processes.
Identify server and datagram network processes.
(Flist_processes): New optional arg `query-only'.
(conv_sockaddr_to_lisp, get_lisp_to_sockaddr_size)
(conv_lisp_to_sockaddr, set_socket_options)
(network_process_featurep, unwind_request_sigio): New helper functions.
(Fprocess_datagram_address, Fset_process_datagram_address):
(Fset_network_process_options): New lisp functions.
(Fopen_network_stream): Removed. Now defined in simple.el.
(Fmake_network_process): New lisp function. Code is based on previous
Fopen_network_stream, but heavily reworked with new property list based
argument list, support for datagrams, server processes, and local
sockets in addition to old client-only functionality.
(server_accept_connection): New function.
(wait_reading_process_input): Use it to handle incoming connects.
Do not enable input on a new connection if process is stopped.
(read_process_output): Handle datagram sockets. Use 2k buffer for them.
(send_process): Handle datagram sockets.
(Fstop_process, Fcontinue_process): Apply to network processes. A stopped
network process is indicated by setting command field to t .
(Fprocess_send_eof): No-op if datagram connection.
(Fstatus_notify): Don't read input for a stream server socket or a
stopped network process.
(init_process): Initialize datagram_address array.
(syms_of_process): Intern and staticpro new variables, defsubr new
functions.
2002-03-17 20:20:33 +00:00
|
|
|
|
/* :local ADDRESS or :remote ADDRESS */
|
|
|
|
|
address = Fplist_get (contact, QCaddress);
|
|
|
|
|
if (!NILP (address))
|
1999-08-12 16:35:22 +00:00
|
|
|
|
{
|
(Qlocal, QCname, QCbuffer, QChost, QCservice, QCfamily)
(QClocal, QCremote, QCserver, QCdatagram, QCnowait, QCnoquery,QCstop)
(QCcoding, QCoptions, QCfilter, QCsentinel, QClog, QCfeature):
New variables.
(NETCONN1_P): New macro.
(DATAGRAM_SOCKETS): New conditional symbol.
(datagram_address): New array.
(DATAGRAM_CONN_P, DATAGRAM_CHAN_P): New macros.
(status_message): Use concat3.
(Fprocess_status): Add `listen' status to doc string. Return `stop'
for a stopped network process.
(Fset_process_buffer): Update contact plist for network process.
(Fset_process_filter): Ditto. Don't enable input for stopped
network processes. Server must listen, even if filter is t.
(Fset_process_query_on_exit_flag, Fprocess_query_on_exit_flag):
New functions.
(Fprocess_kill_without_query): Removed. Now defined in simple.el.
(Fprocess_contact): Added KEY argument. Handle datagrams.
(list_processes_1): Optionally show only processes with the query
on exit flag set. Dynamically adjust column widths. Omit tty
column if not needed. Report stopped network processes.
Identify server and datagram network processes.
(Flist_processes): New optional arg `query-only'.
(conv_sockaddr_to_lisp, get_lisp_to_sockaddr_size)
(conv_lisp_to_sockaddr, set_socket_options)
(network_process_featurep, unwind_request_sigio): New helper functions.
(Fprocess_datagram_address, Fset_process_datagram_address):
(Fset_network_process_options): New lisp functions.
(Fopen_network_stream): Removed. Now defined in simple.el.
(Fmake_network_process): New lisp function. Code is based on previous
Fopen_network_stream, but heavily reworked with new property list based
argument list, support for datagrams, server processes, and local
sockets in addition to old client-only functionality.
(server_accept_connection): New function.
(wait_reading_process_input): Use it to handle incoming connects.
Do not enable input on a new connection if process is stopped.
(read_process_output): Handle datagram sockets. Use 2k buffer for them.
(send_process): Handle datagram sockets.
(Fstop_process, Fcontinue_process): Apply to network processes. A stopped
network process is indicated by setting command field to t .
(Fprocess_send_eof): No-op if datagram connection.
(Fstatus_notify): Don't read input for a stream server socket or a
stopped network process.
(init_process): Initialize datagram_address array.
(syms_of_process): Intern and staticpro new variables, defsubr new
functions.
2002-03-17 20:20:33 +00:00
|
|
|
|
host = service = Qnil;
|
|
|
|
|
|
|
|
|
|
if (!(ai.ai_addrlen = get_lisp_to_sockaddr_size (address, &family)))
|
|
|
|
|
error ("Malformed :address");
|
|
|
|
|
ai.ai_family = family;
|
|
|
|
|
ai.ai_addr = alloca (ai.ai_addrlen);
|
|
|
|
|
conv_lisp_to_sockaddr (family, address, ai.ai_addr, ai.ai_addrlen);
|
|
|
|
|
goto open_socket;
|
1999-08-12 16:35:22 +00:00
|
|
|
|
}
|
(Qlocal, QCname, QCbuffer, QChost, QCservice, QCfamily)
(QClocal, QCremote, QCserver, QCdatagram, QCnowait, QCnoquery,QCstop)
(QCcoding, QCoptions, QCfilter, QCsentinel, QClog, QCfeature):
New variables.
(NETCONN1_P): New macro.
(DATAGRAM_SOCKETS): New conditional symbol.
(datagram_address): New array.
(DATAGRAM_CONN_P, DATAGRAM_CHAN_P): New macros.
(status_message): Use concat3.
(Fprocess_status): Add `listen' status to doc string. Return `stop'
for a stopped network process.
(Fset_process_buffer): Update contact plist for network process.
(Fset_process_filter): Ditto. Don't enable input for stopped
network processes. Server must listen, even if filter is t.
(Fset_process_query_on_exit_flag, Fprocess_query_on_exit_flag):
New functions.
(Fprocess_kill_without_query): Removed. Now defined in simple.el.
(Fprocess_contact): Added KEY argument. Handle datagrams.
(list_processes_1): Optionally show only processes with the query
on exit flag set. Dynamically adjust column widths. Omit tty
column if not needed. Report stopped network processes.
Identify server and datagram network processes.
(Flist_processes): New optional arg `query-only'.
(conv_sockaddr_to_lisp, get_lisp_to_sockaddr_size)
(conv_lisp_to_sockaddr, set_socket_options)
(network_process_featurep, unwind_request_sigio): New helper functions.
(Fprocess_datagram_address, Fset_process_datagram_address):
(Fset_network_process_options): New lisp functions.
(Fopen_network_stream): Removed. Now defined in simple.el.
(Fmake_network_process): New lisp function. Code is based on previous
Fopen_network_stream, but heavily reworked with new property list based
argument list, support for datagrams, server processes, and local
sockets in addition to old client-only functionality.
(server_accept_connection): New function.
(wait_reading_process_input): Use it to handle incoming connects.
Do not enable input on a new connection if process is stopped.
(read_process_output): Handle datagram sockets. Use 2k buffer for them.
(send_process): Handle datagram sockets.
(Fstop_process, Fcontinue_process): Apply to network processes. A stopped
network process is indicated by setting command field to t .
(Fprocess_send_eof): No-op if datagram connection.
(Fstatus_notify): Don't read input for a stream server socket or a
stopped network process.
(init_process): Initialize datagram_address array.
(syms_of_process): Intern and staticpro new variables, defsubr new
functions.
2002-03-17 20:20:33 +00:00
|
|
|
|
|
|
|
|
|
/* :family FAMILY -- nil (for Inet), local, or integer. */
|
|
|
|
|
tem = Fplist_get (contact, QCfamily);
|
2006-01-04 00:16:54 +00:00
|
|
|
|
if (NILP (tem))
|
1999-08-12 16:35:22 +00:00
|
|
|
|
{
|
2006-01-05 09:24:11 +00:00
|
|
|
|
#if defined(HAVE_GETADDRINFO) && defined(AF_INET6)
|
2006-01-04 00:16:54 +00:00
|
|
|
|
family = AF_UNSPEC;
|
|
|
|
|
#else
|
|
|
|
|
family = AF_INET;
|
(Qlocal, QCname, QCbuffer, QChost, QCservice, QCfamily)
(QClocal, QCremote, QCserver, QCdatagram, QCnowait, QCnoquery,QCstop)
(QCcoding, QCoptions, QCfilter, QCsentinel, QClog, QCfeature):
New variables.
(NETCONN1_P): New macro.
(DATAGRAM_SOCKETS): New conditional symbol.
(datagram_address): New array.
(DATAGRAM_CONN_P, DATAGRAM_CHAN_P): New macros.
(status_message): Use concat3.
(Fprocess_status): Add `listen' status to doc string. Return `stop'
for a stopped network process.
(Fset_process_buffer): Update contact plist for network process.
(Fset_process_filter): Ditto. Don't enable input for stopped
network processes. Server must listen, even if filter is t.
(Fset_process_query_on_exit_flag, Fprocess_query_on_exit_flag):
New functions.
(Fprocess_kill_without_query): Removed. Now defined in simple.el.
(Fprocess_contact): Added KEY argument. Handle datagrams.
(list_processes_1): Optionally show only processes with the query
on exit flag set. Dynamically adjust column widths. Omit tty
column if not needed. Report stopped network processes.
Identify server and datagram network processes.
(Flist_processes): New optional arg `query-only'.
(conv_sockaddr_to_lisp, get_lisp_to_sockaddr_size)
(conv_lisp_to_sockaddr, set_socket_options)
(network_process_featurep, unwind_request_sigio): New helper functions.
(Fprocess_datagram_address, Fset_process_datagram_address):
(Fset_network_process_options): New lisp functions.
(Fopen_network_stream): Removed. Now defined in simple.el.
(Fmake_network_process): New lisp function. Code is based on previous
Fopen_network_stream, but heavily reworked with new property list based
argument list, support for datagrams, server processes, and local
sockets in addition to old client-only functionality.
(server_accept_connection): New function.
(wait_reading_process_input): Use it to handle incoming connects.
Do not enable input on a new connection if process is stopped.
(read_process_output): Handle datagram sockets. Use 2k buffer for them.
(send_process): Handle datagram sockets.
(Fstop_process, Fcontinue_process): Apply to network processes. A stopped
network process is indicated by setting command field to t .
(Fprocess_send_eof): No-op if datagram connection.
(Fstatus_notify): Don't read input for a stream server socket or a
stopped network process.
(init_process): Initialize datagram_address array.
(syms_of_process): Intern and staticpro new variables, defsubr new
functions.
2002-03-17 20:20:33 +00:00
|
|
|
|
#endif
|
1999-08-12 16:35:22 +00:00
|
|
|
|
}
|
2006-01-04 00:16:54 +00:00
|
|
|
|
#ifdef HAVE_LOCAL_SOCKETS
|
|
|
|
|
else if (EQ (tem, Qlocal))
|
|
|
|
|
family = AF_LOCAL;
|
|
|
|
|
#endif
|
|
|
|
|
#ifdef AF_INET6
|
|
|
|
|
else if (EQ (tem, Qipv6))
|
|
|
|
|
family = AF_INET6;
|
|
|
|
|
#endif
|
|
|
|
|
else if (EQ (tem, Qipv4))
|
|
|
|
|
family = AF_INET;
|
|
|
|
|
else if (INTEGERP (tem))
|
|
|
|
|
family = XINT (tem);
|
|
|
|
|
else
|
(Qlocal, QCname, QCbuffer, QChost, QCservice, QCfamily)
(QClocal, QCremote, QCserver, QCdatagram, QCnowait, QCnoquery,QCstop)
(QCcoding, QCoptions, QCfilter, QCsentinel, QClog, QCfeature):
New variables.
(NETCONN1_P): New macro.
(DATAGRAM_SOCKETS): New conditional symbol.
(datagram_address): New array.
(DATAGRAM_CONN_P, DATAGRAM_CHAN_P): New macros.
(status_message): Use concat3.
(Fprocess_status): Add `listen' status to doc string. Return `stop'
for a stopped network process.
(Fset_process_buffer): Update contact plist for network process.
(Fset_process_filter): Ditto. Don't enable input for stopped
network processes. Server must listen, even if filter is t.
(Fset_process_query_on_exit_flag, Fprocess_query_on_exit_flag):
New functions.
(Fprocess_kill_without_query): Removed. Now defined in simple.el.
(Fprocess_contact): Added KEY argument. Handle datagrams.
(list_processes_1): Optionally show only processes with the query
on exit flag set. Dynamically adjust column widths. Omit tty
column if not needed. Report stopped network processes.
Identify server and datagram network processes.
(Flist_processes): New optional arg `query-only'.
(conv_sockaddr_to_lisp, get_lisp_to_sockaddr_size)
(conv_lisp_to_sockaddr, set_socket_options)
(network_process_featurep, unwind_request_sigio): New helper functions.
(Fprocess_datagram_address, Fset_process_datagram_address):
(Fset_network_process_options): New lisp functions.
(Fopen_network_stream): Removed. Now defined in simple.el.
(Fmake_network_process): New lisp function. Code is based on previous
Fopen_network_stream, but heavily reworked with new property list based
argument list, support for datagrams, server processes, and local
sockets in addition to old client-only functionality.
(server_accept_connection): New function.
(wait_reading_process_input): Use it to handle incoming connects.
Do not enable input on a new connection if process is stopped.
(read_process_output): Handle datagram sockets. Use 2k buffer for them.
(send_process): Handle datagram sockets.
(Fstop_process, Fcontinue_process): Apply to network processes. A stopped
network process is indicated by setting command field to t .
(Fprocess_send_eof): No-op if datagram connection.
(Fstatus_notify): Don't read input for a stream server socket or a
stopped network process.
(init_process): Initialize datagram_address array.
(syms_of_process): Intern and staticpro new variables, defsubr new
functions.
2002-03-17 20:20:33 +00:00
|
|
|
|
error ("Unknown address family");
|
2006-01-04 00:16:54 +00:00
|
|
|
|
|
(Qlocal, QCname, QCbuffer, QChost, QCservice, QCfamily)
(QClocal, QCremote, QCserver, QCdatagram, QCnowait, QCnoquery,QCstop)
(QCcoding, QCoptions, QCfilter, QCsentinel, QClog, QCfeature):
New variables.
(NETCONN1_P): New macro.
(DATAGRAM_SOCKETS): New conditional symbol.
(datagram_address): New array.
(DATAGRAM_CONN_P, DATAGRAM_CHAN_P): New macros.
(status_message): Use concat3.
(Fprocess_status): Add `listen' status to doc string. Return `stop'
for a stopped network process.
(Fset_process_buffer): Update contact plist for network process.
(Fset_process_filter): Ditto. Don't enable input for stopped
network processes. Server must listen, even if filter is t.
(Fset_process_query_on_exit_flag, Fprocess_query_on_exit_flag):
New functions.
(Fprocess_kill_without_query): Removed. Now defined in simple.el.
(Fprocess_contact): Added KEY argument. Handle datagrams.
(list_processes_1): Optionally show only processes with the query
on exit flag set. Dynamically adjust column widths. Omit tty
column if not needed. Report stopped network processes.
Identify server and datagram network processes.
(Flist_processes): New optional arg `query-only'.
(conv_sockaddr_to_lisp, get_lisp_to_sockaddr_size)
(conv_lisp_to_sockaddr, set_socket_options)
(network_process_featurep, unwind_request_sigio): New helper functions.
(Fprocess_datagram_address, Fset_process_datagram_address):
(Fset_network_process_options): New lisp functions.
(Fopen_network_stream): Removed. Now defined in simple.el.
(Fmake_network_process): New lisp function. Code is based on previous
Fopen_network_stream, but heavily reworked with new property list based
argument list, support for datagrams, server processes, and local
sockets in addition to old client-only functionality.
(server_accept_connection): New function.
(wait_reading_process_input): Use it to handle incoming connects.
Do not enable input on a new connection if process is stopped.
(read_process_output): Handle datagram sockets. Use 2k buffer for them.
(send_process): Handle datagram sockets.
(Fstop_process, Fcontinue_process): Apply to network processes. A stopped
network process is indicated by setting command field to t .
(Fprocess_send_eof): No-op if datagram connection.
(Fstatus_notify): Don't read input for a stream server socket or a
stopped network process.
(init_process): Initialize datagram_address array.
(syms_of_process): Intern and staticpro new variables, defsubr new
functions.
2002-03-17 20:20:33 +00:00
|
|
|
|
ai.ai_family = family;
|
|
|
|
|
|
|
|
|
|
/* :service SERVICE -- string, integer (port number), or t (random port). */
|
|
|
|
|
service = Fplist_get (contact, QCservice);
|
|
|
|
|
|
2010-05-24 16:46:41 -04:00
|
|
|
|
/* :host HOST -- hostname, ip address, or 'local for localhost. */
|
|
|
|
|
host = Fplist_get (contact, QChost);
|
|
|
|
|
if (!NILP (host))
|
|
|
|
|
{
|
|
|
|
|
if (EQ (host, Qlocal))
|
|
|
|
|
host = build_string ("localhost");
|
|
|
|
|
CHECK_STRING (host);
|
|
|
|
|
}
|
|
|
|
|
|
(Qlocal, QCname, QCbuffer, QChost, QCservice, QCfamily)
(QClocal, QCremote, QCserver, QCdatagram, QCnowait, QCnoquery,QCstop)
(QCcoding, QCoptions, QCfilter, QCsentinel, QClog, QCfeature):
New variables.
(NETCONN1_P): New macro.
(DATAGRAM_SOCKETS): New conditional symbol.
(datagram_address): New array.
(DATAGRAM_CONN_P, DATAGRAM_CHAN_P): New macros.
(status_message): Use concat3.
(Fprocess_status): Add `listen' status to doc string. Return `stop'
for a stopped network process.
(Fset_process_buffer): Update contact plist for network process.
(Fset_process_filter): Ditto. Don't enable input for stopped
network processes. Server must listen, even if filter is t.
(Fset_process_query_on_exit_flag, Fprocess_query_on_exit_flag):
New functions.
(Fprocess_kill_without_query): Removed. Now defined in simple.el.
(Fprocess_contact): Added KEY argument. Handle datagrams.
(list_processes_1): Optionally show only processes with the query
on exit flag set. Dynamically adjust column widths. Omit tty
column if not needed. Report stopped network processes.
Identify server and datagram network processes.
(Flist_processes): New optional arg `query-only'.
(conv_sockaddr_to_lisp, get_lisp_to_sockaddr_size)
(conv_lisp_to_sockaddr, set_socket_options)
(network_process_featurep, unwind_request_sigio): New helper functions.
(Fprocess_datagram_address, Fset_process_datagram_address):
(Fset_network_process_options): New lisp functions.
(Fopen_network_stream): Removed. Now defined in simple.el.
(Fmake_network_process): New lisp function. Code is based on previous
Fopen_network_stream, but heavily reworked with new property list based
argument list, support for datagrams, server processes, and local
sockets in addition to old client-only functionality.
(server_accept_connection): New function.
(wait_reading_process_input): Use it to handle incoming connects.
Do not enable input on a new connection if process is stopped.
(read_process_output): Handle datagram sockets. Use 2k buffer for them.
(send_process): Handle datagram sockets.
(Fstop_process, Fcontinue_process): Apply to network processes. A stopped
network process is indicated by setting command field to t .
(Fprocess_send_eof): No-op if datagram connection.
(Fstatus_notify): Don't read input for a stream server socket or a
stopped network process.
(init_process): Initialize datagram_address array.
(syms_of_process): Intern and staticpro new variables, defsubr new
functions.
2002-03-17 20:20:33 +00:00
|
|
|
|
#ifdef HAVE_LOCAL_SOCKETS
|
|
|
|
|
if (family == AF_LOCAL)
|
1992-03-14 20:40:04 +00:00
|
|
|
|
{
|
2010-05-24 16:46:41 -04:00
|
|
|
|
if (!NILP (host))
|
|
|
|
|
{
|
|
|
|
|
message (":family local ignores the :host \"%s\" property",
|
|
|
|
|
SDATA (host));
|
|
|
|
|
contact = Fplist_put (contact, QChost, Qnil);
|
|
|
|
|
host = Qnil;
|
|
|
|
|
}
|
2001-11-02 20:46:55 +00:00
|
|
|
|
CHECK_STRING (service);
|
Replace bcopy, bzero, bcmp by memcpy, memmove, memset, memcmp
* alloc.c (overrun_check_malloc, overrun_check_realloc)
(overrun_check_free, xstrdup, allocate_string)
(allocate_string_data, compact_small_strings, Fmake_string)
(make_unibyte_string, make_multibyte_string)
(make_string_from_bytes, make_specified_string, make_float)
(Fcons, allocate_terminal, allocate_frame, make_pure_string)
(Fgarbage_collect): Replace bcopy, safe_bcopy, bzero, bcmp by
memcpy, memmove, memset, memcmp.
* atimer.c (start_atimer, set_alarm): Likewise.
* buffer.c (clone_per_buffer_values, report_overlay_modification)
(mmap_realloc, init_buffer_once): Likewise.
* callint.c (Fcall_interactively): Likewise.
* callproc.c (Fcall_process, Fcall_process_region, child_setup)
(getenv_internal_1): Likewise.
* casefiddle.c (casify_object): Likewise.
* ccl.c (ccl_driver): Likewise.
* character.c (str_as_multibyte, str_to_multibyte): Likewise.
* charset.c (load_charset_map_from_file)
(load_charset_map_from_file, load_charset_map_from_vector)
(Fdefine_charset_internal): Likewise.
* cm.c (Wcm_clear): Likewise.
* coding.c (decode_eol, decode_coding_object)
(Fset_coding_system_priority, make_subsidiaries): Likewise.
* data.c (Faset): Likewise.
* dired.c (directory_files_internal, file_name_completion_stat):
Likewise.
* dispnew.c (new_glyph_matrix, adjust_glyph_matrix)
(clear_glyph_row, copy_row_except_pointers)
(copy_glyph_row_contents, new_glyph_pool, realloc_glyph_pool)
(save_current_matrix, restore_current_matrix)
(build_frame_matrix_from_leaf_window, mirrored_line_dance)
(mirror_line_dance, scrolling_window): Likewise.
* doc.c (Fsnarf_documentation, Fsubstitute_command_keys):
Likewise.
* doprnt.c (doprnt): Likewise.
* editfns.c (Fuser_full_name, make_buffer_string_both)
(Fmessage_box, Fformat, Ftranspose_regions): Likewise.
* emacs.c (sort_args): Likewise.
* eval.c (Fapply, Ffuncall): Likewise.
* fileio.c (Ffile_name_directory, make_temp_name)
(Fexpand_file_name, search_embedded_absfilename)
(Fsubstitute_in_file_name, Ffile_symlink_p, Finsert_file_contents)
(auto_save_error): Likewise.
* fns.c (Fstring_equal, Fcopy_sequence, concat)
(string_to_multibyte, Fstring_as_unibyte, Fstring_as_multibyte)
(internal_equal, Fclear_string, larger_vector, copy_hash_table)
(Fmake_hash_table): Likewise.
* fringe.c (Fdefine_fringe_bitmap): Likewise.
* ftfont.c (ftfont_text_extents): Likewise.
* getloadavg.c (getloadavg): Likewise.
* image.c (define_image_type, make_image, make_image_cache)
(x_create_x_image_and_pixmap, xbm_image_p)
(w32_create_pixmap_from_bitmap_data, xbm_load, xpm_lookup_color)
(xpm_image_p, x_create_bitmap_from_xpm_data, xpm_load)
(init_color_table, x_build_heuristic_mask, pbm_image_p, pbm_load)
(png_image_p, png_read_from_memory, png_load, jpeg_image_p)
(tiff_image_p, tiff_read_from_memory, gif_image_p)
(gif_read_from_memory, gif_load, svg_image_p, gs_image_p):
Likewise.
* indent.c (scan_for_column, compute_motion): Likewise.
* insdel.c (gap_left, gap_right, make_gap_smaller, copy_text)
(insert_1_both, insert_from_gap, replace_range_2): Likewise.
* intervals.c (reproduce_tree, reproduce_tree_obj): Likewise.
* keyboard.c (echo_char, save_getcjmp, restore_getcjmp)
(kbd_buffer_store_event_hold, apply_modifiers_uncached)
(store_user_signal_events, menu_bar_items, tool_bar_items)
(process_tool_bar_item, append_tool_bar_item)
(read_char_minibuf_menu_prompt, read_key_sequence)
(Fread_key_sequence, Fread_key_sequence_vector, Frecent_keys):
Likewise.
* keymap.c (current_minor_maps, Fdescribe_buffer_bindings):
Likewise.
* lisp.h (STRING_COPYIN): Likewise.
* lread.c (Fload, read1, oblookup): Likewise.
* msdos.c (Frecent_doskeys): Likewise.
* nsfns.m (Fx_create_frame): Likewise.
* nsfont.m (nsfont_open, nsfont_text_extents, ns_glyph_metrics):
Likewise.
* nsimage.m (EmacsImage-initFromSkipXBM:width:height:)
(EmacsImage-initForXPMWithDepth:width:height:flip:length:):
Likewise.
* nsmenu.m (ns_update_menubar): Likewise.
* nsterm.m (ns_draw_fringe_bitmap, ns_term_init): Likewise.
* print.c (print_unwind, printchar, strout, print_string)
(print_error_message): Likewise.
* process.c (conv_lisp_to_sockaddr, set_socket_option)
(Fmake_network_process, Fnetwork_interface_list)
(Fnetwork_interface_info, read_process_output, Fprocess_send_eof)
(init_process): Likewise.
* ralloc.c (resize_bloc, r_alloc_sbrk, r_alloc_init): Likewise.
* regex.c (init_syntax_once, regex_compile, re_compile_fastmap):
Likewise.
* scroll.c (do_scrolling, do_direct_scrolling)
(scrolling_max_lines_saved): Likewise.
* search.c (search_buffer, wordify, Freplace_match): Likewise.
* sound.c (wav_init, au_init, Fplay_sound_internal): Likewise.
* syntax.c (skip_chars, skip_syntaxes): Likewise.
* sysdep.c (child_setup_tty, sys_subshell, emacs_get_tty)
(emacs_set_tty): Likewise.
* term.c (encode_terminal_code, calculate_costs)
(produce_special_glyphs, create_tty_output, init_tty, delete_tty):
Likewise.
* termcap.c (tgetst1, gobble_line): Likewise.
* termhooks.h (EVENT_INIT): Likewise.
* tparam.c (tparam1): Likewise.
* unexalpha.c (unexec): Likewise.
* unexec.c (write_segment): Likewise.
* unexmacosx.c (unexec_write_zero): Likewise.
* w32fns.c (w32_wnd_proc, Fx_create_frame, x_create_tip_frame)
(Fx_file_dialog, Fsystem_move_file_to_trash): Likewise.
* w32font.c (w32font_list_family, w32font_text_extents)
(w32font_list_internal, w32font_match_internal)
(w32font_open_internal, compute_metrics, Fx_select_font):
Likewise.
* w32menu.c (set_frame_menubar, add_menu_item)
(w32_menu_display_help, w32_free_submenu_strings): Likewise.
* w32term.c (XCreateGC, w32_initialize_display_info): Likewise.
* w32uniscribe.c (uniscribe_list_family): Likewise.
* w32xfns.c (get_next_msg, post_msg, prepend_msg): Likewise.
* window.c (make_window, replace_window, set_window_buffer)
(Fsplit_window): Likewise.
* xdisp.c (init_iterator, RECORD_OVERLAY_STRING, reseat_to_string)
(add_to_log, message3, x_consider_frame_title)
(append_space_for_newline, extend_face_to_end_of_line)
(decode_mode_spec_coding, init_glyph_string): Likewise.
* xfaces.c (x_create_gc, get_lface_attributes_no_remap)
(Finternal_copy_lisp_face, Finternal_merge_in_global_face)
(face_attr_equal_p, make_realized_face, make_face_cache)
(free_realized_faces, lookup_named_face, smaller_face)
(face_with_height, lookup_derived_face)
(x_supports_face_attributes_p, Finternal_set_font_selection_order)
(Finternal_set_font_selection_order, realize_default_face)
(compute_char_face, face_at_buffer_position)
(face_for_overlay_string, face_at_string_position, merge_faces):
Likewise.
* xfns.c (xic_create_fontsetname, Fx_create_frame)
(Fx_window_property, x_create_tip_frame)
(Fx_backspace_delete_keys_p): Likewise.
* xfont.c (xfont_list, xfont_match, xfont_list_family)
(xfont_text_extents): Likewise.
* xmenu.c (set_frame_menubar, xmenu_show): Likewise.
* xrdb.c (magic_file_p, x_get_resource): Likewise.
* xselect.c (x_queue_event, x_get_window_property)
(receive_incremental_selection): Likewise.
* xsmfns.c (x_session_check_input): Likewise.
* xterm.c (x_send_scroll_bar_event, SET_SAVED_MENU_EVENT)
(handle_one_xevent, x_check_errors, xim_initialize, x_term_init):
Likewise.
* character.h (BCOPY_SHORT): Removed.
* config.in: Regenerate.
* dispnew.c (safe_bcopy): Only define as dummy if PROFILING.
* emacs.c (main) [PROFILING]: Don't declare
dump_opcode_frequencies.
* lisp.h (safe_bcopy): Remove declaration.
(memset) [!HAVE_MEMSET]: Declare.
(memcpy) [!HAVE_MEMCPY]: Likewise.
(memmove) [!HAVE_MEMMOVE]: Likewise.
(memcmp) [!HAVE_MEMCMP]: Likewise.
* s/ms-w32.h (bzero, bcopy, bcmp, GAP_USE_BCOPY)
(BCOPY_UPWARD_SAFE, BCOPY_DOWNWARD_SAFE, HAVE_BCOPY, HAVE_BCMP):
Don't define.
(HAVE_MEMCMP, HAVE_MEMCPY, HAVE_MEMMOVE, HAVE_MEMSET): Define.
* s/msdos.h (GAP_USE_BCOPY, BCOPY_UPWARD_SAFE)
(BCOPY_DOWNWARD_SAFE): Don't define.
* sysdep.c (memset) [!HAVE_MEMSET]: Define.
(memcpy) [!HAVE_MEMCPY]: Define.
(memmove) [!HAVE_MEMMOVE]: Define.
(memcmp) [!HAVE_MEMCMP]: Define.
* config.nt (HAVE_BCOPY, HAVE_BCMP): Remove undefs.
(HAVE_MEMCPY, HAVE_MEMMOVE, HAVE_MEMSET, HAVE_MEMCMP): Add undefs.
* sed2v2.inp (HAVE_MEMCPY, HAVE_MEMSET): Edit to 1.
(HAVE_BZERO): Don't edit.
* lwlib.c (lwlib_memset, lwlib_bcopy): Remove.
(malloc_widget_value, free_widget_info, allocate_widget_instance)
(lw_separator_p): Replace lwlib_memset, lwlib_bcopy, bzero, bcmp by
memset, memcpy, memcmp.
* lwlib-utils.c (XtApplyToWidgets): Likewise.
* xlwmenu.c (XlwMenuInitialize): Likewise.
* lwlib.h (lwlib_bcopy): Remove declaration.
* ebrowse.c (add_sym, make_namespace): Replace bcopy, bzero by
memcpy, memmove, memset.
* pop.c (pop_retrieve, socket_connection, pop_getline): Likewise.
* CPP-DEFINES (BCOPY_DOWNWARD_SAFE, BCOPY_UPWARD_SAFE)
(GAP_USE_BCOPY, HAVE_BCMP, HAVE_BCOPY, bcmp, bcopy, bzero):
Remove.
* configure.in: Don't check for bcopy, bcmp, bzero. Don't include
<strings.h> and don't define bcopy, bzero, BCMP in config.h.
2010-07-08 00:18:28 +02:00
|
|
|
|
memset (&address_un, 0, sizeof address_un);
|
(Qlocal, QCname, QCbuffer, QChost, QCservice, QCfamily)
(QClocal, QCremote, QCserver, QCdatagram, QCnowait, QCnoquery,QCstop)
(QCcoding, QCoptions, QCfilter, QCsentinel, QClog, QCfeature):
New variables.
(NETCONN1_P): New macro.
(DATAGRAM_SOCKETS): New conditional symbol.
(datagram_address): New array.
(DATAGRAM_CONN_P, DATAGRAM_CHAN_P): New macros.
(status_message): Use concat3.
(Fprocess_status): Add `listen' status to doc string. Return `stop'
for a stopped network process.
(Fset_process_buffer): Update contact plist for network process.
(Fset_process_filter): Ditto. Don't enable input for stopped
network processes. Server must listen, even if filter is t.
(Fset_process_query_on_exit_flag, Fprocess_query_on_exit_flag):
New functions.
(Fprocess_kill_without_query): Removed. Now defined in simple.el.
(Fprocess_contact): Added KEY argument. Handle datagrams.
(list_processes_1): Optionally show only processes with the query
on exit flag set. Dynamically adjust column widths. Omit tty
column if not needed. Report stopped network processes.
Identify server and datagram network processes.
(Flist_processes): New optional arg `query-only'.
(conv_sockaddr_to_lisp, get_lisp_to_sockaddr_size)
(conv_lisp_to_sockaddr, set_socket_options)
(network_process_featurep, unwind_request_sigio): New helper functions.
(Fprocess_datagram_address, Fset_process_datagram_address):
(Fset_network_process_options): New lisp functions.
(Fopen_network_stream): Removed. Now defined in simple.el.
(Fmake_network_process): New lisp function. Code is based on previous
Fopen_network_stream, but heavily reworked with new property list based
argument list, support for datagrams, server processes, and local
sockets in addition to old client-only functionality.
(server_accept_connection): New function.
(wait_reading_process_input): Use it to handle incoming connects.
Do not enable input on a new connection if process is stopped.
(read_process_output): Handle datagram sockets. Use 2k buffer for them.
(send_process): Handle datagram sockets.
(Fstop_process, Fcontinue_process): Apply to network processes. A stopped
network process is indicated by setting command field to t .
(Fprocess_send_eof): No-op if datagram connection.
(Fstatus_notify): Don't read input for a stream server socket or a
stopped network process.
(init_process): Initialize datagram_address array.
(syms_of_process): Intern and staticpro new variables, defsubr new
functions.
2002-03-17 20:20:33 +00:00
|
|
|
|
address_un.sun_family = AF_LOCAL;
|
2002-07-15 00:01:34 +00:00
|
|
|
|
strncpy (address_un.sun_path, SDATA (service), sizeof address_un.sun_path);
|
(Qlocal, QCname, QCbuffer, QChost, QCservice, QCfamily)
(QClocal, QCremote, QCserver, QCdatagram, QCnowait, QCnoquery,QCstop)
(QCcoding, QCoptions, QCfilter, QCsentinel, QClog, QCfeature):
New variables.
(NETCONN1_P): New macro.
(DATAGRAM_SOCKETS): New conditional symbol.
(datagram_address): New array.
(DATAGRAM_CONN_P, DATAGRAM_CHAN_P): New macros.
(status_message): Use concat3.
(Fprocess_status): Add `listen' status to doc string. Return `stop'
for a stopped network process.
(Fset_process_buffer): Update contact plist for network process.
(Fset_process_filter): Ditto. Don't enable input for stopped
network processes. Server must listen, even if filter is t.
(Fset_process_query_on_exit_flag, Fprocess_query_on_exit_flag):
New functions.
(Fprocess_kill_without_query): Removed. Now defined in simple.el.
(Fprocess_contact): Added KEY argument. Handle datagrams.
(list_processes_1): Optionally show only processes with the query
on exit flag set. Dynamically adjust column widths. Omit tty
column if not needed. Report stopped network processes.
Identify server and datagram network processes.
(Flist_processes): New optional arg `query-only'.
(conv_sockaddr_to_lisp, get_lisp_to_sockaddr_size)
(conv_lisp_to_sockaddr, set_socket_options)
(network_process_featurep, unwind_request_sigio): New helper functions.
(Fprocess_datagram_address, Fset_process_datagram_address):
(Fset_network_process_options): New lisp functions.
(Fopen_network_stream): Removed. Now defined in simple.el.
(Fmake_network_process): New lisp function. Code is based on previous
Fopen_network_stream, but heavily reworked with new property list based
argument list, support for datagrams, server processes, and local
sockets in addition to old client-only functionality.
(server_accept_connection): New function.
(wait_reading_process_input): Use it to handle incoming connects.
Do not enable input on a new connection if process is stopped.
(read_process_output): Handle datagram sockets. Use 2k buffer for them.
(send_process): Handle datagram sockets.
(Fstop_process, Fcontinue_process): Apply to network processes. A stopped
network process is indicated by setting command field to t .
(Fprocess_send_eof): No-op if datagram connection.
(Fstatus_notify): Don't read input for a stream server socket or a
stopped network process.
(init_process): Initialize datagram_address array.
(syms_of_process): Intern and staticpro new variables, defsubr new
functions.
2002-03-17 20:20:33 +00:00
|
|
|
|
ai.ai_addr = (struct sockaddr *) &address_un;
|
|
|
|
|
ai.ai_addrlen = sizeof address_un;
|
|
|
|
|
goto open_socket;
|
1992-03-14 20:40:04 +00:00
|
|
|
|
}
|
(Qlocal, QCname, QCbuffer, QChost, QCservice, QCfamily)
(QClocal, QCremote, QCserver, QCdatagram, QCnowait, QCnoquery,QCstop)
(QCcoding, QCoptions, QCfilter, QCsentinel, QClog, QCfeature):
New variables.
(NETCONN1_P): New macro.
(DATAGRAM_SOCKETS): New conditional symbol.
(datagram_address): New array.
(DATAGRAM_CONN_P, DATAGRAM_CHAN_P): New macros.
(status_message): Use concat3.
(Fprocess_status): Add `listen' status to doc string. Return `stop'
for a stopped network process.
(Fset_process_buffer): Update contact plist for network process.
(Fset_process_filter): Ditto. Don't enable input for stopped
network processes. Server must listen, even if filter is t.
(Fset_process_query_on_exit_flag, Fprocess_query_on_exit_flag):
New functions.
(Fprocess_kill_without_query): Removed. Now defined in simple.el.
(Fprocess_contact): Added KEY argument. Handle datagrams.
(list_processes_1): Optionally show only processes with the query
on exit flag set. Dynamically adjust column widths. Omit tty
column if not needed. Report stopped network processes.
Identify server and datagram network processes.
(Flist_processes): New optional arg `query-only'.
(conv_sockaddr_to_lisp, get_lisp_to_sockaddr_size)
(conv_lisp_to_sockaddr, set_socket_options)
(network_process_featurep, unwind_request_sigio): New helper functions.
(Fprocess_datagram_address, Fset_process_datagram_address):
(Fset_network_process_options): New lisp functions.
(Fopen_network_stream): Removed. Now defined in simple.el.
(Fmake_network_process): New lisp function. Code is based on previous
Fopen_network_stream, but heavily reworked with new property list based
argument list, support for datagrams, server processes, and local
sockets in addition to old client-only functionality.
(server_accept_connection): New function.
(wait_reading_process_input): Use it to handle incoming connects.
Do not enable input on a new connection if process is stopped.
(read_process_output): Handle datagram sockets. Use 2k buffer for them.
(send_process): Handle datagram sockets.
(Fstop_process, Fcontinue_process): Apply to network processes. A stopped
network process is indicated by setting command field to t .
(Fprocess_send_eof): No-op if datagram connection.
(Fstatus_notify): Don't read input for a stream server socket or a
stopped network process.
(init_process): Initialize datagram_address array.
(syms_of_process): Intern and staticpro new variables, defsubr new
functions.
2002-03-17 20:20:33 +00:00
|
|
|
|
#endif
|
1999-08-12 16:35:22 +00:00
|
|
|
|
|
1995-12-21 17:13:25 +00:00
|
|
|
|
/* Slow down polling to every ten seconds.
|
|
|
|
|
Some kernels have a bug which causes retrying connect to fail
|
|
|
|
|
after a connect. Polling can interfere with gethostbyname too. */
|
|
|
|
|
#ifdef POLL_FOR_INPUT
|
2009-12-03 19:01:36 +00:00
|
|
|
|
if (socktype != SOCK_DGRAM)
|
(Qlocal, QCname, QCbuffer, QChost, QCservice, QCfamily)
(QClocal, QCremote, QCserver, QCdatagram, QCnowait, QCnoquery,QCstop)
(QCcoding, QCoptions, QCfilter, QCsentinel, QClog, QCfeature):
New variables.
(NETCONN1_P): New macro.
(DATAGRAM_SOCKETS): New conditional symbol.
(datagram_address): New array.
(DATAGRAM_CONN_P, DATAGRAM_CHAN_P): New macros.
(status_message): Use concat3.
(Fprocess_status): Add `listen' status to doc string. Return `stop'
for a stopped network process.
(Fset_process_buffer): Update contact plist for network process.
(Fset_process_filter): Ditto. Don't enable input for stopped
network processes. Server must listen, even if filter is t.
(Fset_process_query_on_exit_flag, Fprocess_query_on_exit_flag):
New functions.
(Fprocess_kill_without_query): Removed. Now defined in simple.el.
(Fprocess_contact): Added KEY argument. Handle datagrams.
(list_processes_1): Optionally show only processes with the query
on exit flag set. Dynamically adjust column widths. Omit tty
column if not needed. Report stopped network processes.
Identify server and datagram network processes.
(Flist_processes): New optional arg `query-only'.
(conv_sockaddr_to_lisp, get_lisp_to_sockaddr_size)
(conv_lisp_to_sockaddr, set_socket_options)
(network_process_featurep, unwind_request_sigio): New helper functions.
(Fprocess_datagram_address, Fset_process_datagram_address):
(Fset_network_process_options): New lisp functions.
(Fopen_network_stream): Removed. Now defined in simple.el.
(Fmake_network_process): New lisp function. Code is based on previous
Fopen_network_stream, but heavily reworked with new property list based
argument list, support for datagrams, server processes, and local
sockets in addition to old client-only functionality.
(server_accept_connection): New function.
(wait_reading_process_input): Use it to handle incoming connects.
Do not enable input on a new connection if process is stopped.
(read_process_output): Handle datagram sockets. Use 2k buffer for them.
(send_process): Handle datagram sockets.
(Fstop_process, Fcontinue_process): Apply to network processes. A stopped
network process is indicated by setting command field to t .
(Fprocess_send_eof): No-op if datagram connection.
(Fstatus_notify): Don't read input for a stream server socket or a
stopped network process.
(init_process): Initialize datagram_address array.
(syms_of_process): Intern and staticpro new variables, defsubr new
functions.
2002-03-17 20:20:33 +00:00
|
|
|
|
{
|
|
|
|
|
record_unwind_protect (unwind_stop_other_atimers, Qnil);
|
|
|
|
|
bind_polling_period (10);
|
|
|
|
|
}
|
1995-12-21 17:13:25 +00:00
|
|
|
|
#endif
|
|
|
|
|
|
1999-08-12 16:35:22 +00:00
|
|
|
|
#ifdef HAVE_GETADDRINFO
|
(Qlocal, QCname, QCbuffer, QChost, QCservice, QCfamily)
(QClocal, QCremote, QCserver, QCdatagram, QCnowait, QCnoquery,QCstop)
(QCcoding, QCoptions, QCfilter, QCsentinel, QClog, QCfeature):
New variables.
(NETCONN1_P): New macro.
(DATAGRAM_SOCKETS): New conditional symbol.
(datagram_address): New array.
(DATAGRAM_CONN_P, DATAGRAM_CHAN_P): New macros.
(status_message): Use concat3.
(Fprocess_status): Add `listen' status to doc string. Return `stop'
for a stopped network process.
(Fset_process_buffer): Update contact plist for network process.
(Fset_process_filter): Ditto. Don't enable input for stopped
network processes. Server must listen, even if filter is t.
(Fset_process_query_on_exit_flag, Fprocess_query_on_exit_flag):
New functions.
(Fprocess_kill_without_query): Removed. Now defined in simple.el.
(Fprocess_contact): Added KEY argument. Handle datagrams.
(list_processes_1): Optionally show only processes with the query
on exit flag set. Dynamically adjust column widths. Omit tty
column if not needed. Report stopped network processes.
Identify server and datagram network processes.
(Flist_processes): New optional arg `query-only'.
(conv_sockaddr_to_lisp, get_lisp_to_sockaddr_size)
(conv_lisp_to_sockaddr, set_socket_options)
(network_process_featurep, unwind_request_sigio): New helper functions.
(Fprocess_datagram_address, Fset_process_datagram_address):
(Fset_network_process_options): New lisp functions.
(Fopen_network_stream): Removed. Now defined in simple.el.
(Fmake_network_process): New lisp function. Code is based on previous
Fopen_network_stream, but heavily reworked with new property list based
argument list, support for datagrams, server processes, and local
sockets in addition to old client-only functionality.
(server_accept_connection): New function.
(wait_reading_process_input): Use it to handle incoming connects.
Do not enable input on a new connection if process is stopped.
(read_process_output): Handle datagram sockets. Use 2k buffer for them.
(send_process): Handle datagram sockets.
(Fstop_process, Fcontinue_process): Apply to network processes. A stopped
network process is indicated by setting command field to t .
(Fprocess_send_eof): No-op if datagram connection.
(Fstatus_notify): Don't read input for a stream server socket or a
stopped network process.
(init_process): Initialize datagram_address array.
(syms_of_process): Intern and staticpro new variables, defsubr new
functions.
2002-03-17 20:20:33 +00:00
|
|
|
|
/* If we have a host, use getaddrinfo to resolve both host and service.
|
|
|
|
|
Otherwise, use getservbyname to lookup the service. */
|
|
|
|
|
if (!NILP (host))
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
/* SERVICE can either be a string or int.
|
|
|
|
|
Convert to a C string for later use by getaddrinfo. */
|
|
|
|
|
if (EQ (service, Qt))
|
|
|
|
|
portstring = "0";
|
|
|
|
|
else if (INTEGERP (service))
|
|
|
|
|
{
|
|
|
|
|
sprintf (portbuf, "%ld", (long) XINT (service));
|
|
|
|
|
portstring = portbuf;
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
CHECK_STRING (service);
|
2002-07-15 00:01:34 +00:00
|
|
|
|
portstring = SDATA (service);
|
(Qlocal, QCname, QCbuffer, QChost, QCservice, QCfamily)
(QClocal, QCremote, QCserver, QCdatagram, QCnowait, QCnoquery,QCstop)
(QCcoding, QCoptions, QCfilter, QCsentinel, QClog, QCfeature):
New variables.
(NETCONN1_P): New macro.
(DATAGRAM_SOCKETS): New conditional symbol.
(datagram_address): New array.
(DATAGRAM_CONN_P, DATAGRAM_CHAN_P): New macros.
(status_message): Use concat3.
(Fprocess_status): Add `listen' status to doc string. Return `stop'
for a stopped network process.
(Fset_process_buffer): Update contact plist for network process.
(Fset_process_filter): Ditto. Don't enable input for stopped
network processes. Server must listen, even if filter is t.
(Fset_process_query_on_exit_flag, Fprocess_query_on_exit_flag):
New functions.
(Fprocess_kill_without_query): Removed. Now defined in simple.el.
(Fprocess_contact): Added KEY argument. Handle datagrams.
(list_processes_1): Optionally show only processes with the query
on exit flag set. Dynamically adjust column widths. Omit tty
column if not needed. Report stopped network processes.
Identify server and datagram network processes.
(Flist_processes): New optional arg `query-only'.
(conv_sockaddr_to_lisp, get_lisp_to_sockaddr_size)
(conv_lisp_to_sockaddr, set_socket_options)
(network_process_featurep, unwind_request_sigio): New helper functions.
(Fprocess_datagram_address, Fset_process_datagram_address):
(Fset_network_process_options): New lisp functions.
(Fopen_network_stream): Removed. Now defined in simple.el.
(Fmake_network_process): New lisp function. Code is based on previous
Fopen_network_stream, but heavily reworked with new property list based
argument list, support for datagrams, server processes, and local
sockets in addition to old client-only functionality.
(server_accept_connection): New function.
(wait_reading_process_input): Use it to handle incoming connects.
Do not enable input on a new connection if process is stopped.
(read_process_output): Handle datagram sockets. Use 2k buffer for them.
(send_process): Handle datagram sockets.
(Fstop_process, Fcontinue_process): Apply to network processes. A stopped
network process is indicated by setting command field to t .
(Fprocess_send_eof): No-op if datagram connection.
(Fstatus_notify): Don't read input for a stream server socket or a
stopped network process.
(init_process): Initialize datagram_address array.
(syms_of_process): Intern and staticpro new variables, defsubr new
functions.
2002-03-17 20:20:33 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
immediate_quit = 1;
|
|
|
|
|
QUIT;
|
|
|
|
|
memset (&hints, 0, sizeof (hints));
|
|
|
|
|
hints.ai_flags = 0;
|
2006-01-04 00:16:54 +00:00
|
|
|
|
hints.ai_family = family;
|
(Qlocal, QCname, QCbuffer, QChost, QCservice, QCfamily)
(QClocal, QCremote, QCserver, QCdatagram, QCnowait, QCnoquery,QCstop)
(QCcoding, QCoptions, QCfilter, QCsentinel, QClog, QCfeature):
New variables.
(NETCONN1_P): New macro.
(DATAGRAM_SOCKETS): New conditional symbol.
(datagram_address): New array.
(DATAGRAM_CONN_P, DATAGRAM_CHAN_P): New macros.
(status_message): Use concat3.
(Fprocess_status): Add `listen' status to doc string. Return `stop'
for a stopped network process.
(Fset_process_buffer): Update contact plist for network process.
(Fset_process_filter): Ditto. Don't enable input for stopped
network processes. Server must listen, even if filter is t.
(Fset_process_query_on_exit_flag, Fprocess_query_on_exit_flag):
New functions.
(Fprocess_kill_without_query): Removed. Now defined in simple.el.
(Fprocess_contact): Added KEY argument. Handle datagrams.
(list_processes_1): Optionally show only processes with the query
on exit flag set. Dynamically adjust column widths. Omit tty
column if not needed. Report stopped network processes.
Identify server and datagram network processes.
(Flist_processes): New optional arg `query-only'.
(conv_sockaddr_to_lisp, get_lisp_to_sockaddr_size)
(conv_lisp_to_sockaddr, set_socket_options)
(network_process_featurep, unwind_request_sigio): New helper functions.
(Fprocess_datagram_address, Fset_process_datagram_address):
(Fset_network_process_options): New lisp functions.
(Fopen_network_stream): Removed. Now defined in simple.el.
(Fmake_network_process): New lisp function. Code is based on previous
Fopen_network_stream, but heavily reworked with new property list based
argument list, support for datagrams, server processes, and local
sockets in addition to old client-only functionality.
(server_accept_connection): New function.
(wait_reading_process_input): Use it to handle incoming connects.
Do not enable input on a new connection if process is stopped.
(read_process_output): Handle datagram sockets. Use 2k buffer for them.
(send_process): Handle datagram sockets.
(Fstop_process, Fcontinue_process): Apply to network processes. A stopped
network process is indicated by setting command field to t .
(Fprocess_send_eof): No-op if datagram connection.
(Fstatus_notify): Don't read input for a stream server socket or a
stopped network process.
(init_process): Initialize datagram_address array.
(syms_of_process): Intern and staticpro new variables, defsubr new
functions.
2002-03-17 20:20:33 +00:00
|
|
|
|
hints.ai_socktype = socktype;
|
|
|
|
|
hints.ai_protocol = 0;
|
2007-10-17 15:57:30 +00:00
|
|
|
|
|
|
|
|
|
#ifdef HAVE_RES_INIT
|
|
|
|
|
res_init ();
|
|
|
|
|
#endif
|
|
|
|
|
|
2002-07-15 00:01:34 +00:00
|
|
|
|
ret = getaddrinfo (SDATA (host), portstring, &hints, &res);
|
(Qlocal, QCname, QCbuffer, QChost, QCservice, QCfamily)
(QClocal, QCremote, QCserver, QCdatagram, QCnowait, QCnoquery,QCstop)
(QCcoding, QCoptions, QCfilter, QCsentinel, QClog, QCfeature):
New variables.
(NETCONN1_P): New macro.
(DATAGRAM_SOCKETS): New conditional symbol.
(datagram_address): New array.
(DATAGRAM_CONN_P, DATAGRAM_CHAN_P): New macros.
(status_message): Use concat3.
(Fprocess_status): Add `listen' status to doc string. Return `stop'
for a stopped network process.
(Fset_process_buffer): Update contact plist for network process.
(Fset_process_filter): Ditto. Don't enable input for stopped
network processes. Server must listen, even if filter is t.
(Fset_process_query_on_exit_flag, Fprocess_query_on_exit_flag):
New functions.
(Fprocess_kill_without_query): Removed. Now defined in simple.el.
(Fprocess_contact): Added KEY argument. Handle datagrams.
(list_processes_1): Optionally show only processes with the query
on exit flag set. Dynamically adjust column widths. Omit tty
column if not needed. Report stopped network processes.
Identify server and datagram network processes.
(Flist_processes): New optional arg `query-only'.
(conv_sockaddr_to_lisp, get_lisp_to_sockaddr_size)
(conv_lisp_to_sockaddr, set_socket_options)
(network_process_featurep, unwind_request_sigio): New helper functions.
(Fprocess_datagram_address, Fset_process_datagram_address):
(Fset_network_process_options): New lisp functions.
(Fopen_network_stream): Removed. Now defined in simple.el.
(Fmake_network_process): New lisp function. Code is based on previous
Fopen_network_stream, but heavily reworked with new property list based
argument list, support for datagrams, server processes, and local
sockets in addition to old client-only functionality.
(server_accept_connection): New function.
(wait_reading_process_input): Use it to handle incoming connects.
Do not enable input on a new connection if process is stopped.
(read_process_output): Handle datagram sockets. Use 2k buffer for them.
(send_process): Handle datagram sockets.
(Fstop_process, Fcontinue_process): Apply to network processes. A stopped
network process is indicated by setting command field to t .
(Fprocess_send_eof): No-op if datagram connection.
(Fstatus_notify): Don't read input for a stream server socket or a
stopped network process.
(init_process): Initialize datagram_address array.
(syms_of_process): Intern and staticpro new variables, defsubr new
functions.
2002-03-17 20:20:33 +00:00
|
|
|
|
if (ret)
|
2000-10-02 16:42:47 +00:00
|
|
|
|
#ifdef HAVE_GAI_STRERROR
|
2010-07-07 11:45:28 +02:00
|
|
|
|
error ("%s/%s %s", SDATA (host), portstring, gai_strerror (ret));
|
2000-10-02 16:42:47 +00:00
|
|
|
|
#else
|
2009-01-01 15:58:38 +00:00
|
|
|
|
error ("%s/%s getaddrinfo error %d", SDATA (host), portstring, ret);
|
2000-10-02 16:42:47 +00:00
|
|
|
|
#endif
|
(Qlocal, QCname, QCbuffer, QChost, QCservice, QCfamily)
(QClocal, QCremote, QCserver, QCdatagram, QCnowait, QCnoquery,QCstop)
(QCcoding, QCoptions, QCfilter, QCsentinel, QClog, QCfeature):
New variables.
(NETCONN1_P): New macro.
(DATAGRAM_SOCKETS): New conditional symbol.
(datagram_address): New array.
(DATAGRAM_CONN_P, DATAGRAM_CHAN_P): New macros.
(status_message): Use concat3.
(Fprocess_status): Add `listen' status to doc string. Return `stop'
for a stopped network process.
(Fset_process_buffer): Update contact plist for network process.
(Fset_process_filter): Ditto. Don't enable input for stopped
network processes. Server must listen, even if filter is t.
(Fset_process_query_on_exit_flag, Fprocess_query_on_exit_flag):
New functions.
(Fprocess_kill_without_query): Removed. Now defined in simple.el.
(Fprocess_contact): Added KEY argument. Handle datagrams.
(list_processes_1): Optionally show only processes with the query
on exit flag set. Dynamically adjust column widths. Omit tty
column if not needed. Report stopped network processes.
Identify server and datagram network processes.
(Flist_processes): New optional arg `query-only'.
(conv_sockaddr_to_lisp, get_lisp_to_sockaddr_size)
(conv_lisp_to_sockaddr, set_socket_options)
(network_process_featurep, unwind_request_sigio): New helper functions.
(Fprocess_datagram_address, Fset_process_datagram_address):
(Fset_network_process_options): New lisp functions.
(Fopen_network_stream): Removed. Now defined in simple.el.
(Fmake_network_process): New lisp function. Code is based on previous
Fopen_network_stream, but heavily reworked with new property list based
argument list, support for datagrams, server processes, and local
sockets in addition to old client-only functionality.
(server_accept_connection): New function.
(wait_reading_process_input): Use it to handle incoming connects.
Do not enable input on a new connection if process is stopped.
(read_process_output): Handle datagram sockets. Use 2k buffer for them.
(send_process): Handle datagram sockets.
(Fstop_process, Fcontinue_process): Apply to network processes. A stopped
network process is indicated by setting command field to t .
(Fprocess_send_eof): No-op if datagram connection.
(Fstatus_notify): Don't read input for a stream server socket or a
stopped network process.
(init_process): Initialize datagram_address array.
(syms_of_process): Intern and staticpro new variables, defsubr new
functions.
2002-03-17 20:20:33 +00:00
|
|
|
|
immediate_quit = 0;
|
1999-08-12 16:35:22 +00:00
|
|
|
|
|
(Qlocal, QCname, QCbuffer, QChost, QCservice, QCfamily)
(QClocal, QCremote, QCserver, QCdatagram, QCnowait, QCnoquery,QCstop)
(QCcoding, QCoptions, QCfilter, QCsentinel, QClog, QCfeature):
New variables.
(NETCONN1_P): New macro.
(DATAGRAM_SOCKETS): New conditional symbol.
(datagram_address): New array.
(DATAGRAM_CONN_P, DATAGRAM_CHAN_P): New macros.
(status_message): Use concat3.
(Fprocess_status): Add `listen' status to doc string. Return `stop'
for a stopped network process.
(Fset_process_buffer): Update contact plist for network process.
(Fset_process_filter): Ditto. Don't enable input for stopped
network processes. Server must listen, even if filter is t.
(Fset_process_query_on_exit_flag, Fprocess_query_on_exit_flag):
New functions.
(Fprocess_kill_without_query): Removed. Now defined in simple.el.
(Fprocess_contact): Added KEY argument. Handle datagrams.
(list_processes_1): Optionally show only processes with the query
on exit flag set. Dynamically adjust column widths. Omit tty
column if not needed. Report stopped network processes.
Identify server and datagram network processes.
(Flist_processes): New optional arg `query-only'.
(conv_sockaddr_to_lisp, get_lisp_to_sockaddr_size)
(conv_lisp_to_sockaddr, set_socket_options)
(network_process_featurep, unwind_request_sigio): New helper functions.
(Fprocess_datagram_address, Fset_process_datagram_address):
(Fset_network_process_options): New lisp functions.
(Fopen_network_stream): Removed. Now defined in simple.el.
(Fmake_network_process): New lisp function. Code is based on previous
Fopen_network_stream, but heavily reworked with new property list based
argument list, support for datagrams, server processes, and local
sockets in addition to old client-only functionality.
(server_accept_connection): New function.
(wait_reading_process_input): Use it to handle incoming connects.
Do not enable input on a new connection if process is stopped.
(read_process_output): Handle datagram sockets. Use 2k buffer for them.
(send_process): Handle datagram sockets.
(Fstop_process, Fcontinue_process): Apply to network processes. A stopped
network process is indicated by setting command field to t .
(Fprocess_send_eof): No-op if datagram connection.
(Fstatus_notify): Don't read input for a stream server socket or a
stopped network process.
(init_process): Initialize datagram_address array.
(syms_of_process): Intern and staticpro new variables, defsubr new
functions.
2002-03-17 20:20:33 +00:00
|
|
|
|
goto open_socket;
|
|
|
|
|
}
|
|
|
|
|
#endif /* HAVE_GETADDRINFO */
|
1999-08-12 16:35:22 +00:00
|
|
|
|
|
(Qlocal, QCname, QCbuffer, QChost, QCservice, QCfamily)
(QClocal, QCremote, QCserver, QCdatagram, QCnowait, QCnoquery,QCstop)
(QCcoding, QCoptions, QCfilter, QCsentinel, QClog, QCfeature):
New variables.
(NETCONN1_P): New macro.
(DATAGRAM_SOCKETS): New conditional symbol.
(datagram_address): New array.
(DATAGRAM_CONN_P, DATAGRAM_CHAN_P): New macros.
(status_message): Use concat3.
(Fprocess_status): Add `listen' status to doc string. Return `stop'
for a stopped network process.
(Fset_process_buffer): Update contact plist for network process.
(Fset_process_filter): Ditto. Don't enable input for stopped
network processes. Server must listen, even if filter is t.
(Fset_process_query_on_exit_flag, Fprocess_query_on_exit_flag):
New functions.
(Fprocess_kill_without_query): Removed. Now defined in simple.el.
(Fprocess_contact): Added KEY argument. Handle datagrams.
(list_processes_1): Optionally show only processes with the query
on exit flag set. Dynamically adjust column widths. Omit tty
column if not needed. Report stopped network processes.
Identify server and datagram network processes.
(Flist_processes): New optional arg `query-only'.
(conv_sockaddr_to_lisp, get_lisp_to_sockaddr_size)
(conv_lisp_to_sockaddr, set_socket_options)
(network_process_featurep, unwind_request_sigio): New helper functions.
(Fprocess_datagram_address, Fset_process_datagram_address):
(Fset_network_process_options): New lisp functions.
(Fopen_network_stream): Removed. Now defined in simple.el.
(Fmake_network_process): New lisp function. Code is based on previous
Fopen_network_stream, but heavily reworked with new property list based
argument list, support for datagrams, server processes, and local
sockets in addition to old client-only functionality.
(server_accept_connection): New function.
(wait_reading_process_input): Use it to handle incoming connects.
Do not enable input on a new connection if process is stopped.
(read_process_output): Handle datagram sockets. Use 2k buffer for them.
(send_process): Handle datagram sockets.
(Fstop_process, Fcontinue_process): Apply to network processes. A stopped
network process is indicated by setting command field to t .
(Fprocess_send_eof): No-op if datagram connection.
(Fstatus_notify): Don't read input for a stream server socket or a
stopped network process.
(init_process): Initialize datagram_address array.
(syms_of_process): Intern and staticpro new variables, defsubr new
functions.
2002-03-17 20:20:33 +00:00
|
|
|
|
/* We end up here if getaddrinfo is not defined, or in case no hostname
|
|
|
|
|
has been specified (e.g. for a local server process). */
|
|
|
|
|
|
|
|
|
|
if (EQ (service, Qt))
|
|
|
|
|
port = 0;
|
|
|
|
|
else if (INTEGERP (service))
|
|
|
|
|
port = htons ((unsigned short) XINT (service));
|
|
|
|
|
else
|
1994-07-19 19:35:43 +00:00
|
|
|
|
{
|
(Qlocal, QCname, QCbuffer, QChost, QCservice, QCfamily)
(QClocal, QCremote, QCserver, QCdatagram, QCnowait, QCnoquery,QCstop)
(QCcoding, QCoptions, QCfilter, QCsentinel, QClog, QCfeature):
New variables.
(NETCONN1_P): New macro.
(DATAGRAM_SOCKETS): New conditional symbol.
(datagram_address): New array.
(DATAGRAM_CONN_P, DATAGRAM_CHAN_P): New macros.
(status_message): Use concat3.
(Fprocess_status): Add `listen' status to doc string. Return `stop'
for a stopped network process.
(Fset_process_buffer): Update contact plist for network process.
(Fset_process_filter): Ditto. Don't enable input for stopped
network processes. Server must listen, even if filter is t.
(Fset_process_query_on_exit_flag, Fprocess_query_on_exit_flag):
New functions.
(Fprocess_kill_without_query): Removed. Now defined in simple.el.
(Fprocess_contact): Added KEY argument. Handle datagrams.
(list_processes_1): Optionally show only processes with the query
on exit flag set. Dynamically adjust column widths. Omit tty
column if not needed. Report stopped network processes.
Identify server and datagram network processes.
(Flist_processes): New optional arg `query-only'.
(conv_sockaddr_to_lisp, get_lisp_to_sockaddr_size)
(conv_lisp_to_sockaddr, set_socket_options)
(network_process_featurep, unwind_request_sigio): New helper functions.
(Fprocess_datagram_address, Fset_process_datagram_address):
(Fset_network_process_options): New lisp functions.
(Fopen_network_stream): Removed. Now defined in simple.el.
(Fmake_network_process): New lisp function. Code is based on previous
Fopen_network_stream, but heavily reworked with new property list based
argument list, support for datagrams, server processes, and local
sockets in addition to old client-only functionality.
(server_accept_connection): New function.
(wait_reading_process_input): Use it to handle incoming connects.
Do not enable input on a new connection if process is stopped.
(read_process_output): Handle datagram sockets. Use 2k buffer for them.
(send_process): Handle datagram sockets.
(Fstop_process, Fcontinue_process): Apply to network processes. A stopped
network process is indicated by setting command field to t .
(Fprocess_send_eof): No-op if datagram connection.
(Fstatus_notify): Don't read input for a stream server socket or a
stopped network process.
(init_process): Initialize datagram_address array.
(syms_of_process): Intern and staticpro new variables, defsubr new
functions.
2002-03-17 20:20:33 +00:00
|
|
|
|
struct servent *svc_info;
|
|
|
|
|
CHECK_STRING (service);
|
2003-02-04 14:56:31 +00:00
|
|
|
|
svc_info = getservbyname (SDATA (service),
|
(Qlocal, QCname, QCbuffer, QChost, QCservice, QCfamily)
(QClocal, QCremote, QCserver, QCdatagram, QCnowait, QCnoquery,QCstop)
(QCcoding, QCoptions, QCfilter, QCsentinel, QClog, QCfeature):
New variables.
(NETCONN1_P): New macro.
(DATAGRAM_SOCKETS): New conditional symbol.
(datagram_address): New array.
(DATAGRAM_CONN_P, DATAGRAM_CHAN_P): New macros.
(status_message): Use concat3.
(Fprocess_status): Add `listen' status to doc string. Return `stop'
for a stopped network process.
(Fset_process_buffer): Update contact plist for network process.
(Fset_process_filter): Ditto. Don't enable input for stopped
network processes. Server must listen, even if filter is t.
(Fset_process_query_on_exit_flag, Fprocess_query_on_exit_flag):
New functions.
(Fprocess_kill_without_query): Removed. Now defined in simple.el.
(Fprocess_contact): Added KEY argument. Handle datagrams.
(list_processes_1): Optionally show only processes with the query
on exit flag set. Dynamically adjust column widths. Omit tty
column if not needed. Report stopped network processes.
Identify server and datagram network processes.
(Flist_processes): New optional arg `query-only'.
(conv_sockaddr_to_lisp, get_lisp_to_sockaddr_size)
(conv_lisp_to_sockaddr, set_socket_options)
(network_process_featurep, unwind_request_sigio): New helper functions.
(Fprocess_datagram_address, Fset_process_datagram_address):
(Fset_network_process_options): New lisp functions.
(Fopen_network_stream): Removed. Now defined in simple.el.
(Fmake_network_process): New lisp function. Code is based on previous
Fopen_network_stream, but heavily reworked with new property list based
argument list, support for datagrams, server processes, and local
sockets in addition to old client-only functionality.
(server_accept_connection): New function.
(wait_reading_process_input): Use it to handle incoming connects.
Do not enable input on a new connection if process is stopped.
(read_process_output): Handle datagram sockets. Use 2k buffer for them.
(send_process): Handle datagram sockets.
(Fstop_process, Fcontinue_process): Apply to network processes. A stopped
network process is indicated by setting command field to t .
(Fprocess_send_eof): No-op if datagram connection.
(Fstatus_notify): Don't read input for a stream server socket or a
stopped network process.
(init_process): Initialize datagram_address array.
(syms_of_process): Intern and staticpro new variables, defsubr new
functions.
2002-03-17 20:20:33 +00:00
|
|
|
|
(socktype == SOCK_DGRAM ? "udp" : "tcp"));
|
|
|
|
|
if (svc_info == 0)
|
2002-07-15 00:01:34 +00:00
|
|
|
|
error ("Unknown service: %s", SDATA (service));
|
(Qlocal, QCname, QCbuffer, QChost, QCservice, QCfamily)
(QClocal, QCremote, QCserver, QCdatagram, QCnowait, QCnoquery,QCstop)
(QCcoding, QCoptions, QCfilter, QCsentinel, QClog, QCfeature):
New variables.
(NETCONN1_P): New macro.
(DATAGRAM_SOCKETS): New conditional symbol.
(datagram_address): New array.
(DATAGRAM_CONN_P, DATAGRAM_CHAN_P): New macros.
(status_message): Use concat3.
(Fprocess_status): Add `listen' status to doc string. Return `stop'
for a stopped network process.
(Fset_process_buffer): Update contact plist for network process.
(Fset_process_filter): Ditto. Don't enable input for stopped
network processes. Server must listen, even if filter is t.
(Fset_process_query_on_exit_flag, Fprocess_query_on_exit_flag):
New functions.
(Fprocess_kill_without_query): Removed. Now defined in simple.el.
(Fprocess_contact): Added KEY argument. Handle datagrams.
(list_processes_1): Optionally show only processes with the query
on exit flag set. Dynamically adjust column widths. Omit tty
column if not needed. Report stopped network processes.
Identify server and datagram network processes.
(Flist_processes): New optional arg `query-only'.
(conv_sockaddr_to_lisp, get_lisp_to_sockaddr_size)
(conv_lisp_to_sockaddr, set_socket_options)
(network_process_featurep, unwind_request_sigio): New helper functions.
(Fprocess_datagram_address, Fset_process_datagram_address):
(Fset_network_process_options): New lisp functions.
(Fopen_network_stream): Removed. Now defined in simple.el.
(Fmake_network_process): New lisp function. Code is based on previous
Fopen_network_stream, but heavily reworked with new property list based
argument list, support for datagrams, server processes, and local
sockets in addition to old client-only functionality.
(server_accept_connection): New function.
(wait_reading_process_input): Use it to handle incoming connects.
Do not enable input on a new connection if process is stopped.
(read_process_output): Handle datagram sockets. Use 2k buffer for them.
(send_process): Handle datagram sockets.
(Fstop_process, Fcontinue_process): Apply to network processes. A stopped
network process is indicated by setting command field to t .
(Fprocess_send_eof): No-op if datagram connection.
(Fstatus_notify): Don't read input for a stream server socket or a
stopped network process.
(init_process): Initialize datagram_address array.
(syms_of_process): Intern and staticpro new variables, defsubr new
functions.
2002-03-17 20:20:33 +00:00
|
|
|
|
port = svc_info->s_port;
|
|
|
|
|
}
|
|
|
|
|
|
Replace bcopy, bzero, bcmp by memcpy, memmove, memset, memcmp
* alloc.c (overrun_check_malloc, overrun_check_realloc)
(overrun_check_free, xstrdup, allocate_string)
(allocate_string_data, compact_small_strings, Fmake_string)
(make_unibyte_string, make_multibyte_string)
(make_string_from_bytes, make_specified_string, make_float)
(Fcons, allocate_terminal, allocate_frame, make_pure_string)
(Fgarbage_collect): Replace bcopy, safe_bcopy, bzero, bcmp by
memcpy, memmove, memset, memcmp.
* atimer.c (start_atimer, set_alarm): Likewise.
* buffer.c (clone_per_buffer_values, report_overlay_modification)
(mmap_realloc, init_buffer_once): Likewise.
* callint.c (Fcall_interactively): Likewise.
* callproc.c (Fcall_process, Fcall_process_region, child_setup)
(getenv_internal_1): Likewise.
* casefiddle.c (casify_object): Likewise.
* ccl.c (ccl_driver): Likewise.
* character.c (str_as_multibyte, str_to_multibyte): Likewise.
* charset.c (load_charset_map_from_file)
(load_charset_map_from_file, load_charset_map_from_vector)
(Fdefine_charset_internal): Likewise.
* cm.c (Wcm_clear): Likewise.
* coding.c (decode_eol, decode_coding_object)
(Fset_coding_system_priority, make_subsidiaries): Likewise.
* data.c (Faset): Likewise.
* dired.c (directory_files_internal, file_name_completion_stat):
Likewise.
* dispnew.c (new_glyph_matrix, adjust_glyph_matrix)
(clear_glyph_row, copy_row_except_pointers)
(copy_glyph_row_contents, new_glyph_pool, realloc_glyph_pool)
(save_current_matrix, restore_current_matrix)
(build_frame_matrix_from_leaf_window, mirrored_line_dance)
(mirror_line_dance, scrolling_window): Likewise.
* doc.c (Fsnarf_documentation, Fsubstitute_command_keys):
Likewise.
* doprnt.c (doprnt): Likewise.
* editfns.c (Fuser_full_name, make_buffer_string_both)
(Fmessage_box, Fformat, Ftranspose_regions): Likewise.
* emacs.c (sort_args): Likewise.
* eval.c (Fapply, Ffuncall): Likewise.
* fileio.c (Ffile_name_directory, make_temp_name)
(Fexpand_file_name, search_embedded_absfilename)
(Fsubstitute_in_file_name, Ffile_symlink_p, Finsert_file_contents)
(auto_save_error): Likewise.
* fns.c (Fstring_equal, Fcopy_sequence, concat)
(string_to_multibyte, Fstring_as_unibyte, Fstring_as_multibyte)
(internal_equal, Fclear_string, larger_vector, copy_hash_table)
(Fmake_hash_table): Likewise.
* fringe.c (Fdefine_fringe_bitmap): Likewise.
* ftfont.c (ftfont_text_extents): Likewise.
* getloadavg.c (getloadavg): Likewise.
* image.c (define_image_type, make_image, make_image_cache)
(x_create_x_image_and_pixmap, xbm_image_p)
(w32_create_pixmap_from_bitmap_data, xbm_load, xpm_lookup_color)
(xpm_image_p, x_create_bitmap_from_xpm_data, xpm_load)
(init_color_table, x_build_heuristic_mask, pbm_image_p, pbm_load)
(png_image_p, png_read_from_memory, png_load, jpeg_image_p)
(tiff_image_p, tiff_read_from_memory, gif_image_p)
(gif_read_from_memory, gif_load, svg_image_p, gs_image_p):
Likewise.
* indent.c (scan_for_column, compute_motion): Likewise.
* insdel.c (gap_left, gap_right, make_gap_smaller, copy_text)
(insert_1_both, insert_from_gap, replace_range_2): Likewise.
* intervals.c (reproduce_tree, reproduce_tree_obj): Likewise.
* keyboard.c (echo_char, save_getcjmp, restore_getcjmp)
(kbd_buffer_store_event_hold, apply_modifiers_uncached)
(store_user_signal_events, menu_bar_items, tool_bar_items)
(process_tool_bar_item, append_tool_bar_item)
(read_char_minibuf_menu_prompt, read_key_sequence)
(Fread_key_sequence, Fread_key_sequence_vector, Frecent_keys):
Likewise.
* keymap.c (current_minor_maps, Fdescribe_buffer_bindings):
Likewise.
* lisp.h (STRING_COPYIN): Likewise.
* lread.c (Fload, read1, oblookup): Likewise.
* msdos.c (Frecent_doskeys): Likewise.
* nsfns.m (Fx_create_frame): Likewise.
* nsfont.m (nsfont_open, nsfont_text_extents, ns_glyph_metrics):
Likewise.
* nsimage.m (EmacsImage-initFromSkipXBM:width:height:)
(EmacsImage-initForXPMWithDepth:width:height:flip:length:):
Likewise.
* nsmenu.m (ns_update_menubar): Likewise.
* nsterm.m (ns_draw_fringe_bitmap, ns_term_init): Likewise.
* print.c (print_unwind, printchar, strout, print_string)
(print_error_message): Likewise.
* process.c (conv_lisp_to_sockaddr, set_socket_option)
(Fmake_network_process, Fnetwork_interface_list)
(Fnetwork_interface_info, read_process_output, Fprocess_send_eof)
(init_process): Likewise.
* ralloc.c (resize_bloc, r_alloc_sbrk, r_alloc_init): Likewise.
* regex.c (init_syntax_once, regex_compile, re_compile_fastmap):
Likewise.
* scroll.c (do_scrolling, do_direct_scrolling)
(scrolling_max_lines_saved): Likewise.
* search.c (search_buffer, wordify, Freplace_match): Likewise.
* sound.c (wav_init, au_init, Fplay_sound_internal): Likewise.
* syntax.c (skip_chars, skip_syntaxes): Likewise.
* sysdep.c (child_setup_tty, sys_subshell, emacs_get_tty)
(emacs_set_tty): Likewise.
* term.c (encode_terminal_code, calculate_costs)
(produce_special_glyphs, create_tty_output, init_tty, delete_tty):
Likewise.
* termcap.c (tgetst1, gobble_line): Likewise.
* termhooks.h (EVENT_INIT): Likewise.
* tparam.c (tparam1): Likewise.
* unexalpha.c (unexec): Likewise.
* unexec.c (write_segment): Likewise.
* unexmacosx.c (unexec_write_zero): Likewise.
* w32fns.c (w32_wnd_proc, Fx_create_frame, x_create_tip_frame)
(Fx_file_dialog, Fsystem_move_file_to_trash): Likewise.
* w32font.c (w32font_list_family, w32font_text_extents)
(w32font_list_internal, w32font_match_internal)
(w32font_open_internal, compute_metrics, Fx_select_font):
Likewise.
* w32menu.c (set_frame_menubar, add_menu_item)
(w32_menu_display_help, w32_free_submenu_strings): Likewise.
* w32term.c (XCreateGC, w32_initialize_display_info): Likewise.
* w32uniscribe.c (uniscribe_list_family): Likewise.
* w32xfns.c (get_next_msg, post_msg, prepend_msg): Likewise.
* window.c (make_window, replace_window, set_window_buffer)
(Fsplit_window): Likewise.
* xdisp.c (init_iterator, RECORD_OVERLAY_STRING, reseat_to_string)
(add_to_log, message3, x_consider_frame_title)
(append_space_for_newline, extend_face_to_end_of_line)
(decode_mode_spec_coding, init_glyph_string): Likewise.
* xfaces.c (x_create_gc, get_lface_attributes_no_remap)
(Finternal_copy_lisp_face, Finternal_merge_in_global_face)
(face_attr_equal_p, make_realized_face, make_face_cache)
(free_realized_faces, lookup_named_face, smaller_face)
(face_with_height, lookup_derived_face)
(x_supports_face_attributes_p, Finternal_set_font_selection_order)
(Finternal_set_font_selection_order, realize_default_face)
(compute_char_face, face_at_buffer_position)
(face_for_overlay_string, face_at_string_position, merge_faces):
Likewise.
* xfns.c (xic_create_fontsetname, Fx_create_frame)
(Fx_window_property, x_create_tip_frame)
(Fx_backspace_delete_keys_p): Likewise.
* xfont.c (xfont_list, xfont_match, xfont_list_family)
(xfont_text_extents): Likewise.
* xmenu.c (set_frame_menubar, xmenu_show): Likewise.
* xrdb.c (magic_file_p, x_get_resource): Likewise.
* xselect.c (x_queue_event, x_get_window_property)
(receive_incremental_selection): Likewise.
* xsmfns.c (x_session_check_input): Likewise.
* xterm.c (x_send_scroll_bar_event, SET_SAVED_MENU_EVENT)
(handle_one_xevent, x_check_errors, xim_initialize, x_term_init):
Likewise.
* character.h (BCOPY_SHORT): Removed.
* config.in: Regenerate.
* dispnew.c (safe_bcopy): Only define as dummy if PROFILING.
* emacs.c (main) [PROFILING]: Don't declare
dump_opcode_frequencies.
* lisp.h (safe_bcopy): Remove declaration.
(memset) [!HAVE_MEMSET]: Declare.
(memcpy) [!HAVE_MEMCPY]: Likewise.
(memmove) [!HAVE_MEMMOVE]: Likewise.
(memcmp) [!HAVE_MEMCMP]: Likewise.
* s/ms-w32.h (bzero, bcopy, bcmp, GAP_USE_BCOPY)
(BCOPY_UPWARD_SAFE, BCOPY_DOWNWARD_SAFE, HAVE_BCOPY, HAVE_BCMP):
Don't define.
(HAVE_MEMCMP, HAVE_MEMCPY, HAVE_MEMMOVE, HAVE_MEMSET): Define.
* s/msdos.h (GAP_USE_BCOPY, BCOPY_UPWARD_SAFE)
(BCOPY_DOWNWARD_SAFE): Don't define.
* sysdep.c (memset) [!HAVE_MEMSET]: Define.
(memcpy) [!HAVE_MEMCPY]: Define.
(memmove) [!HAVE_MEMMOVE]: Define.
(memcmp) [!HAVE_MEMCMP]: Define.
* config.nt (HAVE_BCOPY, HAVE_BCMP): Remove undefs.
(HAVE_MEMCPY, HAVE_MEMMOVE, HAVE_MEMSET, HAVE_MEMCMP): Add undefs.
* sed2v2.inp (HAVE_MEMCPY, HAVE_MEMSET): Edit to 1.
(HAVE_BZERO): Don't edit.
* lwlib.c (lwlib_memset, lwlib_bcopy): Remove.
(malloc_widget_value, free_widget_info, allocate_widget_instance)
(lw_separator_p): Replace lwlib_memset, lwlib_bcopy, bzero, bcmp by
memset, memcpy, memcmp.
* lwlib-utils.c (XtApplyToWidgets): Likewise.
* xlwmenu.c (XlwMenuInitialize): Likewise.
* lwlib.h (lwlib_bcopy): Remove declaration.
* ebrowse.c (add_sym, make_namespace): Replace bcopy, bzero by
memcpy, memmove, memset.
* pop.c (pop_retrieve, socket_connection, pop_getline): Likewise.
* CPP-DEFINES (BCOPY_DOWNWARD_SAFE, BCOPY_UPWARD_SAFE)
(GAP_USE_BCOPY, HAVE_BCMP, HAVE_BCOPY, bcmp, bcopy, bzero):
Remove.
* configure.in: Don't check for bcopy, bcmp, bzero. Don't include
<strings.h> and don't define bcopy, bzero, BCMP in config.h.
2010-07-08 00:18:28 +02:00
|
|
|
|
memset (&address_in, 0, sizeof address_in);
|
(Qlocal, QCname, QCbuffer, QChost, QCservice, QCfamily)
(QClocal, QCremote, QCserver, QCdatagram, QCnowait, QCnoquery,QCstop)
(QCcoding, QCoptions, QCfilter, QCsentinel, QClog, QCfeature):
New variables.
(NETCONN1_P): New macro.
(DATAGRAM_SOCKETS): New conditional symbol.
(datagram_address): New array.
(DATAGRAM_CONN_P, DATAGRAM_CHAN_P): New macros.
(status_message): Use concat3.
(Fprocess_status): Add `listen' status to doc string. Return `stop'
for a stopped network process.
(Fset_process_buffer): Update contact plist for network process.
(Fset_process_filter): Ditto. Don't enable input for stopped
network processes. Server must listen, even if filter is t.
(Fset_process_query_on_exit_flag, Fprocess_query_on_exit_flag):
New functions.
(Fprocess_kill_without_query): Removed. Now defined in simple.el.
(Fprocess_contact): Added KEY argument. Handle datagrams.
(list_processes_1): Optionally show only processes with the query
on exit flag set. Dynamically adjust column widths. Omit tty
column if not needed. Report stopped network processes.
Identify server and datagram network processes.
(Flist_processes): New optional arg `query-only'.
(conv_sockaddr_to_lisp, get_lisp_to_sockaddr_size)
(conv_lisp_to_sockaddr, set_socket_options)
(network_process_featurep, unwind_request_sigio): New helper functions.
(Fprocess_datagram_address, Fset_process_datagram_address):
(Fset_network_process_options): New lisp functions.
(Fopen_network_stream): Removed. Now defined in simple.el.
(Fmake_network_process): New lisp function. Code is based on previous
Fopen_network_stream, but heavily reworked with new property list based
argument list, support for datagrams, server processes, and local
sockets in addition to old client-only functionality.
(server_accept_connection): New function.
(wait_reading_process_input): Use it to handle incoming connects.
Do not enable input on a new connection if process is stopped.
(read_process_output): Handle datagram sockets. Use 2k buffer for them.
(send_process): Handle datagram sockets.
(Fstop_process, Fcontinue_process): Apply to network processes. A stopped
network process is indicated by setting command field to t .
(Fprocess_send_eof): No-op if datagram connection.
(Fstatus_notify): Don't read input for a stream server socket or a
stopped network process.
(init_process): Initialize datagram_address array.
(syms_of_process): Intern and staticpro new variables, defsubr new
functions.
2002-03-17 20:20:33 +00:00
|
|
|
|
address_in.sin_family = family;
|
|
|
|
|
address_in.sin_addr.s_addr = INADDR_ANY;
|
|
|
|
|
address_in.sin_port = port;
|
|
|
|
|
|
|
|
|
|
#ifndef HAVE_GETADDRINFO
|
|
|
|
|
if (!NILP (host))
|
|
|
|
|
{
|
|
|
|
|
struct hostent *host_info_ptr;
|
|
|
|
|
|
|
|
|
|
/* gethostbyname may fail with TRY_AGAIN, but we don't honour that,
|
2004-05-08 16:11:42 +00:00
|
|
|
|
as it may `hang' Emacs for a very long time. */
|
1996-03-05 17:33:27 +00:00
|
|
|
|
immediate_quit = 1;
|
|
|
|
|
QUIT;
|
2007-10-17 15:57:30 +00:00
|
|
|
|
|
|
|
|
|
#ifdef HAVE_RES_INIT
|
|
|
|
|
res_init ();
|
|
|
|
|
#endif
|
|
|
|
|
|
2002-07-15 00:01:34 +00:00
|
|
|
|
host_info_ptr = gethostbyname (SDATA (host));
|
1996-03-05 17:33:27 +00:00
|
|
|
|
immediate_quit = 0;
|
2003-02-04 14:56:31 +00:00
|
|
|
|
|
(Qlocal, QCname, QCbuffer, QChost, QCservice, QCfamily)
(QClocal, QCremote, QCserver, QCdatagram, QCnowait, QCnoquery,QCstop)
(QCcoding, QCoptions, QCfilter, QCsentinel, QClog, QCfeature):
New variables.
(NETCONN1_P): New macro.
(DATAGRAM_SOCKETS): New conditional symbol.
(datagram_address): New array.
(DATAGRAM_CONN_P, DATAGRAM_CHAN_P): New macros.
(status_message): Use concat3.
(Fprocess_status): Add `listen' status to doc string. Return `stop'
for a stopped network process.
(Fset_process_buffer): Update contact plist for network process.
(Fset_process_filter): Ditto. Don't enable input for stopped
network processes. Server must listen, even if filter is t.
(Fset_process_query_on_exit_flag, Fprocess_query_on_exit_flag):
New functions.
(Fprocess_kill_without_query): Removed. Now defined in simple.el.
(Fprocess_contact): Added KEY argument. Handle datagrams.
(list_processes_1): Optionally show only processes with the query
on exit flag set. Dynamically adjust column widths. Omit tty
column if not needed. Report stopped network processes.
Identify server and datagram network processes.
(Flist_processes): New optional arg `query-only'.
(conv_sockaddr_to_lisp, get_lisp_to_sockaddr_size)
(conv_lisp_to_sockaddr, set_socket_options)
(network_process_featurep, unwind_request_sigio): New helper functions.
(Fprocess_datagram_address, Fset_process_datagram_address):
(Fset_network_process_options): New lisp functions.
(Fopen_network_stream): Removed. Now defined in simple.el.
(Fmake_network_process): New lisp function. Code is based on previous
Fopen_network_stream, but heavily reworked with new property list based
argument list, support for datagrams, server processes, and local
sockets in addition to old client-only functionality.
(server_accept_connection): New function.
(wait_reading_process_input): Use it to handle incoming connects.
Do not enable input on a new connection if process is stopped.
(read_process_output): Handle datagram sockets. Use 2k buffer for them.
(send_process): Handle datagram sockets.
(Fstop_process, Fcontinue_process): Apply to network processes. A stopped
network process is indicated by setting command field to t .
(Fprocess_send_eof): No-op if datagram connection.
(Fstatus_notify): Don't read input for a stream server socket or a
stopped network process.
(init_process): Initialize datagram_address array.
(syms_of_process): Intern and staticpro new variables, defsubr new
functions.
2002-03-17 20:20:33 +00:00
|
|
|
|
if (host_info_ptr)
|
|
|
|
|
{
|
Replace bcopy, bzero, bcmp by memcpy, memmove, memset, memcmp
* alloc.c (overrun_check_malloc, overrun_check_realloc)
(overrun_check_free, xstrdup, allocate_string)
(allocate_string_data, compact_small_strings, Fmake_string)
(make_unibyte_string, make_multibyte_string)
(make_string_from_bytes, make_specified_string, make_float)
(Fcons, allocate_terminal, allocate_frame, make_pure_string)
(Fgarbage_collect): Replace bcopy, safe_bcopy, bzero, bcmp by
memcpy, memmove, memset, memcmp.
* atimer.c (start_atimer, set_alarm): Likewise.
* buffer.c (clone_per_buffer_values, report_overlay_modification)
(mmap_realloc, init_buffer_once): Likewise.
* callint.c (Fcall_interactively): Likewise.
* callproc.c (Fcall_process, Fcall_process_region, child_setup)
(getenv_internal_1): Likewise.
* casefiddle.c (casify_object): Likewise.
* ccl.c (ccl_driver): Likewise.
* character.c (str_as_multibyte, str_to_multibyte): Likewise.
* charset.c (load_charset_map_from_file)
(load_charset_map_from_file, load_charset_map_from_vector)
(Fdefine_charset_internal): Likewise.
* cm.c (Wcm_clear): Likewise.
* coding.c (decode_eol, decode_coding_object)
(Fset_coding_system_priority, make_subsidiaries): Likewise.
* data.c (Faset): Likewise.
* dired.c (directory_files_internal, file_name_completion_stat):
Likewise.
* dispnew.c (new_glyph_matrix, adjust_glyph_matrix)
(clear_glyph_row, copy_row_except_pointers)
(copy_glyph_row_contents, new_glyph_pool, realloc_glyph_pool)
(save_current_matrix, restore_current_matrix)
(build_frame_matrix_from_leaf_window, mirrored_line_dance)
(mirror_line_dance, scrolling_window): Likewise.
* doc.c (Fsnarf_documentation, Fsubstitute_command_keys):
Likewise.
* doprnt.c (doprnt): Likewise.
* editfns.c (Fuser_full_name, make_buffer_string_both)
(Fmessage_box, Fformat, Ftranspose_regions): Likewise.
* emacs.c (sort_args): Likewise.
* eval.c (Fapply, Ffuncall): Likewise.
* fileio.c (Ffile_name_directory, make_temp_name)
(Fexpand_file_name, search_embedded_absfilename)
(Fsubstitute_in_file_name, Ffile_symlink_p, Finsert_file_contents)
(auto_save_error): Likewise.
* fns.c (Fstring_equal, Fcopy_sequence, concat)
(string_to_multibyte, Fstring_as_unibyte, Fstring_as_multibyte)
(internal_equal, Fclear_string, larger_vector, copy_hash_table)
(Fmake_hash_table): Likewise.
* fringe.c (Fdefine_fringe_bitmap): Likewise.
* ftfont.c (ftfont_text_extents): Likewise.
* getloadavg.c (getloadavg): Likewise.
* image.c (define_image_type, make_image, make_image_cache)
(x_create_x_image_and_pixmap, xbm_image_p)
(w32_create_pixmap_from_bitmap_data, xbm_load, xpm_lookup_color)
(xpm_image_p, x_create_bitmap_from_xpm_data, xpm_load)
(init_color_table, x_build_heuristic_mask, pbm_image_p, pbm_load)
(png_image_p, png_read_from_memory, png_load, jpeg_image_p)
(tiff_image_p, tiff_read_from_memory, gif_image_p)
(gif_read_from_memory, gif_load, svg_image_p, gs_image_p):
Likewise.
* indent.c (scan_for_column, compute_motion): Likewise.
* insdel.c (gap_left, gap_right, make_gap_smaller, copy_text)
(insert_1_both, insert_from_gap, replace_range_2): Likewise.
* intervals.c (reproduce_tree, reproduce_tree_obj): Likewise.
* keyboard.c (echo_char, save_getcjmp, restore_getcjmp)
(kbd_buffer_store_event_hold, apply_modifiers_uncached)
(store_user_signal_events, menu_bar_items, tool_bar_items)
(process_tool_bar_item, append_tool_bar_item)
(read_char_minibuf_menu_prompt, read_key_sequence)
(Fread_key_sequence, Fread_key_sequence_vector, Frecent_keys):
Likewise.
* keymap.c (current_minor_maps, Fdescribe_buffer_bindings):
Likewise.
* lisp.h (STRING_COPYIN): Likewise.
* lread.c (Fload, read1, oblookup): Likewise.
* msdos.c (Frecent_doskeys): Likewise.
* nsfns.m (Fx_create_frame): Likewise.
* nsfont.m (nsfont_open, nsfont_text_extents, ns_glyph_metrics):
Likewise.
* nsimage.m (EmacsImage-initFromSkipXBM:width:height:)
(EmacsImage-initForXPMWithDepth:width:height:flip:length:):
Likewise.
* nsmenu.m (ns_update_menubar): Likewise.
* nsterm.m (ns_draw_fringe_bitmap, ns_term_init): Likewise.
* print.c (print_unwind, printchar, strout, print_string)
(print_error_message): Likewise.
* process.c (conv_lisp_to_sockaddr, set_socket_option)
(Fmake_network_process, Fnetwork_interface_list)
(Fnetwork_interface_info, read_process_output, Fprocess_send_eof)
(init_process): Likewise.
* ralloc.c (resize_bloc, r_alloc_sbrk, r_alloc_init): Likewise.
* regex.c (init_syntax_once, regex_compile, re_compile_fastmap):
Likewise.
* scroll.c (do_scrolling, do_direct_scrolling)
(scrolling_max_lines_saved): Likewise.
* search.c (search_buffer, wordify, Freplace_match): Likewise.
* sound.c (wav_init, au_init, Fplay_sound_internal): Likewise.
* syntax.c (skip_chars, skip_syntaxes): Likewise.
* sysdep.c (child_setup_tty, sys_subshell, emacs_get_tty)
(emacs_set_tty): Likewise.
* term.c (encode_terminal_code, calculate_costs)
(produce_special_glyphs, create_tty_output, init_tty, delete_tty):
Likewise.
* termcap.c (tgetst1, gobble_line): Likewise.
* termhooks.h (EVENT_INIT): Likewise.
* tparam.c (tparam1): Likewise.
* unexalpha.c (unexec): Likewise.
* unexec.c (write_segment): Likewise.
* unexmacosx.c (unexec_write_zero): Likewise.
* w32fns.c (w32_wnd_proc, Fx_create_frame, x_create_tip_frame)
(Fx_file_dialog, Fsystem_move_file_to_trash): Likewise.
* w32font.c (w32font_list_family, w32font_text_extents)
(w32font_list_internal, w32font_match_internal)
(w32font_open_internal, compute_metrics, Fx_select_font):
Likewise.
* w32menu.c (set_frame_menubar, add_menu_item)
(w32_menu_display_help, w32_free_submenu_strings): Likewise.
* w32term.c (XCreateGC, w32_initialize_display_info): Likewise.
* w32uniscribe.c (uniscribe_list_family): Likewise.
* w32xfns.c (get_next_msg, post_msg, prepend_msg): Likewise.
* window.c (make_window, replace_window, set_window_buffer)
(Fsplit_window): Likewise.
* xdisp.c (init_iterator, RECORD_OVERLAY_STRING, reseat_to_string)
(add_to_log, message3, x_consider_frame_title)
(append_space_for_newline, extend_face_to_end_of_line)
(decode_mode_spec_coding, init_glyph_string): Likewise.
* xfaces.c (x_create_gc, get_lface_attributes_no_remap)
(Finternal_copy_lisp_face, Finternal_merge_in_global_face)
(face_attr_equal_p, make_realized_face, make_face_cache)
(free_realized_faces, lookup_named_face, smaller_face)
(face_with_height, lookup_derived_face)
(x_supports_face_attributes_p, Finternal_set_font_selection_order)
(Finternal_set_font_selection_order, realize_default_face)
(compute_char_face, face_at_buffer_position)
(face_for_overlay_string, face_at_string_position, merge_faces):
Likewise.
* xfns.c (xic_create_fontsetname, Fx_create_frame)
(Fx_window_property, x_create_tip_frame)
(Fx_backspace_delete_keys_p): Likewise.
* xfont.c (xfont_list, xfont_match, xfont_list_family)
(xfont_text_extents): Likewise.
* xmenu.c (set_frame_menubar, xmenu_show): Likewise.
* xrdb.c (magic_file_p, x_get_resource): Likewise.
* xselect.c (x_queue_event, x_get_window_property)
(receive_incremental_selection): Likewise.
* xsmfns.c (x_session_check_input): Likewise.
* xterm.c (x_send_scroll_bar_event, SET_SAVED_MENU_EVENT)
(handle_one_xevent, x_check_errors, xim_initialize, x_term_init):
Likewise.
* character.h (BCOPY_SHORT): Removed.
* config.in: Regenerate.
* dispnew.c (safe_bcopy): Only define as dummy if PROFILING.
* emacs.c (main) [PROFILING]: Don't declare
dump_opcode_frequencies.
* lisp.h (safe_bcopy): Remove declaration.
(memset) [!HAVE_MEMSET]: Declare.
(memcpy) [!HAVE_MEMCPY]: Likewise.
(memmove) [!HAVE_MEMMOVE]: Likewise.
(memcmp) [!HAVE_MEMCMP]: Likewise.
* s/ms-w32.h (bzero, bcopy, bcmp, GAP_USE_BCOPY)
(BCOPY_UPWARD_SAFE, BCOPY_DOWNWARD_SAFE, HAVE_BCOPY, HAVE_BCMP):
Don't define.
(HAVE_MEMCMP, HAVE_MEMCPY, HAVE_MEMMOVE, HAVE_MEMSET): Define.
* s/msdos.h (GAP_USE_BCOPY, BCOPY_UPWARD_SAFE)
(BCOPY_DOWNWARD_SAFE): Don't define.
* sysdep.c (memset) [!HAVE_MEMSET]: Define.
(memcpy) [!HAVE_MEMCPY]: Define.
(memmove) [!HAVE_MEMMOVE]: Define.
(memcmp) [!HAVE_MEMCMP]: Define.
* config.nt (HAVE_BCOPY, HAVE_BCMP): Remove undefs.
(HAVE_MEMCPY, HAVE_MEMMOVE, HAVE_MEMSET, HAVE_MEMCMP): Add undefs.
* sed2v2.inp (HAVE_MEMCPY, HAVE_MEMSET): Edit to 1.
(HAVE_BZERO): Don't edit.
* lwlib.c (lwlib_memset, lwlib_bcopy): Remove.
(malloc_widget_value, free_widget_info, allocate_widget_instance)
(lw_separator_p): Replace lwlib_memset, lwlib_bcopy, bzero, bcmp by
memset, memcpy, memcmp.
* lwlib-utils.c (XtApplyToWidgets): Likewise.
* xlwmenu.c (XlwMenuInitialize): Likewise.
* lwlib.h (lwlib_bcopy): Remove declaration.
* ebrowse.c (add_sym, make_namespace): Replace bcopy, bzero by
memcpy, memmove, memset.
* pop.c (pop_retrieve, socket_connection, pop_getline): Likewise.
* CPP-DEFINES (BCOPY_DOWNWARD_SAFE, BCOPY_UPWARD_SAFE)
(GAP_USE_BCOPY, HAVE_BCMP, HAVE_BCOPY, bcmp, bcopy, bzero):
Remove.
* configure.in: Don't check for bcopy, bcmp, bzero. Don't include
<strings.h> and don't define bcopy, bzero, BCMP in config.h.
2010-07-08 00:18:28 +02:00
|
|
|
|
memcpy (&address_in.sin_addr, host_info_ptr->h_addr,
|
|
|
|
|
host_info_ptr->h_length);
|
(Qlocal, QCname, QCbuffer, QChost, QCservice, QCfamily)
(QClocal, QCremote, QCserver, QCdatagram, QCnowait, QCnoquery,QCstop)
(QCcoding, QCoptions, QCfilter, QCsentinel, QClog, QCfeature):
New variables.
(NETCONN1_P): New macro.
(DATAGRAM_SOCKETS): New conditional symbol.
(datagram_address): New array.
(DATAGRAM_CONN_P, DATAGRAM_CHAN_P): New macros.
(status_message): Use concat3.
(Fprocess_status): Add `listen' status to doc string. Return `stop'
for a stopped network process.
(Fset_process_buffer): Update contact plist for network process.
(Fset_process_filter): Ditto. Don't enable input for stopped
network processes. Server must listen, even if filter is t.
(Fset_process_query_on_exit_flag, Fprocess_query_on_exit_flag):
New functions.
(Fprocess_kill_without_query): Removed. Now defined in simple.el.
(Fprocess_contact): Added KEY argument. Handle datagrams.
(list_processes_1): Optionally show only processes with the query
on exit flag set. Dynamically adjust column widths. Omit tty
column if not needed. Report stopped network processes.
Identify server and datagram network processes.
(Flist_processes): New optional arg `query-only'.
(conv_sockaddr_to_lisp, get_lisp_to_sockaddr_size)
(conv_lisp_to_sockaddr, set_socket_options)
(network_process_featurep, unwind_request_sigio): New helper functions.
(Fprocess_datagram_address, Fset_process_datagram_address):
(Fset_network_process_options): New lisp functions.
(Fopen_network_stream): Removed. Now defined in simple.el.
(Fmake_network_process): New lisp function. Code is based on previous
Fopen_network_stream, but heavily reworked with new property list based
argument list, support for datagrams, server processes, and local
sockets in addition to old client-only functionality.
(server_accept_connection): New function.
(wait_reading_process_input): Use it to handle incoming connects.
Do not enable input on a new connection if process is stopped.
(read_process_output): Handle datagram sockets. Use 2k buffer for them.
(send_process): Handle datagram sockets.
(Fstop_process, Fcontinue_process): Apply to network processes. A stopped
network process is indicated by setting command field to t .
(Fprocess_send_eof): No-op if datagram connection.
(Fstatus_notify): Don't read input for a stream server socket or a
stopped network process.
(init_process): Initialize datagram_address array.
(syms_of_process): Intern and staticpro new variables, defsubr new
functions.
2002-03-17 20:20:33 +00:00
|
|
|
|
family = host_info_ptr->h_addrtype;
|
|
|
|
|
address_in.sin_family = family;
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
/* Attempt to interpret host as numeric inet address */
|
|
|
|
|
{
|
2008-02-09 18:03:10 +00:00
|
|
|
|
unsigned long numeric_addr;
|
2002-07-15 00:01:34 +00:00
|
|
|
|
numeric_addr = inet_addr ((char *) SDATA (host));
|
2008-02-09 18:03:10 +00:00
|
|
|
|
if (numeric_addr == -1)
|
2002-07-15 00:01:34 +00:00
|
|
|
|
error ("Unknown host \"%s\"", SDATA (host));
|
1992-03-14 20:40:04 +00:00
|
|
|
|
|
Replace bcopy, bzero, bcmp by memcpy, memmove, memset, memcmp
* alloc.c (overrun_check_malloc, overrun_check_realloc)
(overrun_check_free, xstrdup, allocate_string)
(allocate_string_data, compact_small_strings, Fmake_string)
(make_unibyte_string, make_multibyte_string)
(make_string_from_bytes, make_specified_string, make_float)
(Fcons, allocate_terminal, allocate_frame, make_pure_string)
(Fgarbage_collect): Replace bcopy, safe_bcopy, bzero, bcmp by
memcpy, memmove, memset, memcmp.
* atimer.c (start_atimer, set_alarm): Likewise.
* buffer.c (clone_per_buffer_values, report_overlay_modification)
(mmap_realloc, init_buffer_once): Likewise.
* callint.c (Fcall_interactively): Likewise.
* callproc.c (Fcall_process, Fcall_process_region, child_setup)
(getenv_internal_1): Likewise.
* casefiddle.c (casify_object): Likewise.
* ccl.c (ccl_driver): Likewise.
* character.c (str_as_multibyte, str_to_multibyte): Likewise.
* charset.c (load_charset_map_from_file)
(load_charset_map_from_file, load_charset_map_from_vector)
(Fdefine_charset_internal): Likewise.
* cm.c (Wcm_clear): Likewise.
* coding.c (decode_eol, decode_coding_object)
(Fset_coding_system_priority, make_subsidiaries): Likewise.
* data.c (Faset): Likewise.
* dired.c (directory_files_internal, file_name_completion_stat):
Likewise.
* dispnew.c (new_glyph_matrix, adjust_glyph_matrix)
(clear_glyph_row, copy_row_except_pointers)
(copy_glyph_row_contents, new_glyph_pool, realloc_glyph_pool)
(save_current_matrix, restore_current_matrix)
(build_frame_matrix_from_leaf_window, mirrored_line_dance)
(mirror_line_dance, scrolling_window): Likewise.
* doc.c (Fsnarf_documentation, Fsubstitute_command_keys):
Likewise.
* doprnt.c (doprnt): Likewise.
* editfns.c (Fuser_full_name, make_buffer_string_both)
(Fmessage_box, Fformat, Ftranspose_regions): Likewise.
* emacs.c (sort_args): Likewise.
* eval.c (Fapply, Ffuncall): Likewise.
* fileio.c (Ffile_name_directory, make_temp_name)
(Fexpand_file_name, search_embedded_absfilename)
(Fsubstitute_in_file_name, Ffile_symlink_p, Finsert_file_contents)
(auto_save_error): Likewise.
* fns.c (Fstring_equal, Fcopy_sequence, concat)
(string_to_multibyte, Fstring_as_unibyte, Fstring_as_multibyte)
(internal_equal, Fclear_string, larger_vector, copy_hash_table)
(Fmake_hash_table): Likewise.
* fringe.c (Fdefine_fringe_bitmap): Likewise.
* ftfont.c (ftfont_text_extents): Likewise.
* getloadavg.c (getloadavg): Likewise.
* image.c (define_image_type, make_image, make_image_cache)
(x_create_x_image_and_pixmap, xbm_image_p)
(w32_create_pixmap_from_bitmap_data, xbm_load, xpm_lookup_color)
(xpm_image_p, x_create_bitmap_from_xpm_data, xpm_load)
(init_color_table, x_build_heuristic_mask, pbm_image_p, pbm_load)
(png_image_p, png_read_from_memory, png_load, jpeg_image_p)
(tiff_image_p, tiff_read_from_memory, gif_image_p)
(gif_read_from_memory, gif_load, svg_image_p, gs_image_p):
Likewise.
* indent.c (scan_for_column, compute_motion): Likewise.
* insdel.c (gap_left, gap_right, make_gap_smaller, copy_text)
(insert_1_both, insert_from_gap, replace_range_2): Likewise.
* intervals.c (reproduce_tree, reproduce_tree_obj): Likewise.
* keyboard.c (echo_char, save_getcjmp, restore_getcjmp)
(kbd_buffer_store_event_hold, apply_modifiers_uncached)
(store_user_signal_events, menu_bar_items, tool_bar_items)
(process_tool_bar_item, append_tool_bar_item)
(read_char_minibuf_menu_prompt, read_key_sequence)
(Fread_key_sequence, Fread_key_sequence_vector, Frecent_keys):
Likewise.
* keymap.c (current_minor_maps, Fdescribe_buffer_bindings):
Likewise.
* lisp.h (STRING_COPYIN): Likewise.
* lread.c (Fload, read1, oblookup): Likewise.
* msdos.c (Frecent_doskeys): Likewise.
* nsfns.m (Fx_create_frame): Likewise.
* nsfont.m (nsfont_open, nsfont_text_extents, ns_glyph_metrics):
Likewise.
* nsimage.m (EmacsImage-initFromSkipXBM:width:height:)
(EmacsImage-initForXPMWithDepth:width:height:flip:length:):
Likewise.
* nsmenu.m (ns_update_menubar): Likewise.
* nsterm.m (ns_draw_fringe_bitmap, ns_term_init): Likewise.
* print.c (print_unwind, printchar, strout, print_string)
(print_error_message): Likewise.
* process.c (conv_lisp_to_sockaddr, set_socket_option)
(Fmake_network_process, Fnetwork_interface_list)
(Fnetwork_interface_info, read_process_output, Fprocess_send_eof)
(init_process): Likewise.
* ralloc.c (resize_bloc, r_alloc_sbrk, r_alloc_init): Likewise.
* regex.c (init_syntax_once, regex_compile, re_compile_fastmap):
Likewise.
* scroll.c (do_scrolling, do_direct_scrolling)
(scrolling_max_lines_saved): Likewise.
* search.c (search_buffer, wordify, Freplace_match): Likewise.
* sound.c (wav_init, au_init, Fplay_sound_internal): Likewise.
* syntax.c (skip_chars, skip_syntaxes): Likewise.
* sysdep.c (child_setup_tty, sys_subshell, emacs_get_tty)
(emacs_set_tty): Likewise.
* term.c (encode_terminal_code, calculate_costs)
(produce_special_glyphs, create_tty_output, init_tty, delete_tty):
Likewise.
* termcap.c (tgetst1, gobble_line): Likewise.
* termhooks.h (EVENT_INIT): Likewise.
* tparam.c (tparam1): Likewise.
* unexalpha.c (unexec): Likewise.
* unexec.c (write_segment): Likewise.
* unexmacosx.c (unexec_write_zero): Likewise.
* w32fns.c (w32_wnd_proc, Fx_create_frame, x_create_tip_frame)
(Fx_file_dialog, Fsystem_move_file_to_trash): Likewise.
* w32font.c (w32font_list_family, w32font_text_extents)
(w32font_list_internal, w32font_match_internal)
(w32font_open_internal, compute_metrics, Fx_select_font):
Likewise.
* w32menu.c (set_frame_menubar, add_menu_item)
(w32_menu_display_help, w32_free_submenu_strings): Likewise.
* w32term.c (XCreateGC, w32_initialize_display_info): Likewise.
* w32uniscribe.c (uniscribe_list_family): Likewise.
* w32xfns.c (get_next_msg, post_msg, prepend_msg): Likewise.
* window.c (make_window, replace_window, set_window_buffer)
(Fsplit_window): Likewise.
* xdisp.c (init_iterator, RECORD_OVERLAY_STRING, reseat_to_string)
(add_to_log, message3, x_consider_frame_title)
(append_space_for_newline, extend_face_to_end_of_line)
(decode_mode_spec_coding, init_glyph_string): Likewise.
* xfaces.c (x_create_gc, get_lface_attributes_no_remap)
(Finternal_copy_lisp_face, Finternal_merge_in_global_face)
(face_attr_equal_p, make_realized_face, make_face_cache)
(free_realized_faces, lookup_named_face, smaller_face)
(face_with_height, lookup_derived_face)
(x_supports_face_attributes_p, Finternal_set_font_selection_order)
(Finternal_set_font_selection_order, realize_default_face)
(compute_char_face, face_at_buffer_position)
(face_for_overlay_string, face_at_string_position, merge_faces):
Likewise.
* xfns.c (xic_create_fontsetname, Fx_create_frame)
(Fx_window_property, x_create_tip_frame)
(Fx_backspace_delete_keys_p): Likewise.
* xfont.c (xfont_list, xfont_match, xfont_list_family)
(xfont_text_extents): Likewise.
* xmenu.c (set_frame_menubar, xmenu_show): Likewise.
* xrdb.c (magic_file_p, x_get_resource): Likewise.
* xselect.c (x_queue_event, x_get_window_property)
(receive_incremental_selection): Likewise.
* xsmfns.c (x_session_check_input): Likewise.
* xterm.c (x_send_scroll_bar_event, SET_SAVED_MENU_EVENT)
(handle_one_xevent, x_check_errors, xim_initialize, x_term_init):
Likewise.
* character.h (BCOPY_SHORT): Removed.
* config.in: Regenerate.
* dispnew.c (safe_bcopy): Only define as dummy if PROFILING.
* emacs.c (main) [PROFILING]: Don't declare
dump_opcode_frequencies.
* lisp.h (safe_bcopy): Remove declaration.
(memset) [!HAVE_MEMSET]: Declare.
(memcpy) [!HAVE_MEMCPY]: Likewise.
(memmove) [!HAVE_MEMMOVE]: Likewise.
(memcmp) [!HAVE_MEMCMP]: Likewise.
* s/ms-w32.h (bzero, bcopy, bcmp, GAP_USE_BCOPY)
(BCOPY_UPWARD_SAFE, BCOPY_DOWNWARD_SAFE, HAVE_BCOPY, HAVE_BCMP):
Don't define.
(HAVE_MEMCMP, HAVE_MEMCPY, HAVE_MEMMOVE, HAVE_MEMSET): Define.
* s/msdos.h (GAP_USE_BCOPY, BCOPY_UPWARD_SAFE)
(BCOPY_DOWNWARD_SAFE): Don't define.
* sysdep.c (memset) [!HAVE_MEMSET]: Define.
(memcpy) [!HAVE_MEMCPY]: Define.
(memmove) [!HAVE_MEMMOVE]: Define.
(memcmp) [!HAVE_MEMCMP]: Define.
* config.nt (HAVE_BCOPY, HAVE_BCMP): Remove undefs.
(HAVE_MEMCPY, HAVE_MEMMOVE, HAVE_MEMSET, HAVE_MEMCMP): Add undefs.
* sed2v2.inp (HAVE_MEMCPY, HAVE_MEMSET): Edit to 1.
(HAVE_BZERO): Don't edit.
* lwlib.c (lwlib_memset, lwlib_bcopy): Remove.
(malloc_widget_value, free_widget_info, allocate_widget_instance)
(lw_separator_p): Replace lwlib_memset, lwlib_bcopy, bzero, bcmp by
memset, memcpy, memcmp.
* lwlib-utils.c (XtApplyToWidgets): Likewise.
* xlwmenu.c (XlwMenuInitialize): Likewise.
* lwlib.h (lwlib_bcopy): Remove declaration.
* ebrowse.c (add_sym, make_namespace): Replace bcopy, bzero by
memcpy, memmove, memset.
* pop.c (pop_retrieve, socket_connection, pop_getline): Likewise.
* CPP-DEFINES (BCOPY_DOWNWARD_SAFE, BCOPY_UPWARD_SAFE)
(GAP_USE_BCOPY, HAVE_BCMP, HAVE_BCOPY, bcmp, bcopy, bzero):
Remove.
* configure.in: Don't check for bcopy, bcmp, bzero. Don't include
<strings.h> and don't define bcopy, bzero, BCMP in config.h.
2010-07-08 00:18:28 +02:00
|
|
|
|
memcpy (&address_in.sin_addr, &numeric_addr,
|
|
|
|
|
sizeof (address_in.sin_addr));
|
(Qlocal, QCname, QCbuffer, QChost, QCservice, QCfamily)
(QClocal, QCremote, QCserver, QCdatagram, QCnowait, QCnoquery,QCstop)
(QCcoding, QCoptions, QCfilter, QCsentinel, QClog, QCfeature):
New variables.
(NETCONN1_P): New macro.
(DATAGRAM_SOCKETS): New conditional symbol.
(datagram_address): New array.
(DATAGRAM_CONN_P, DATAGRAM_CHAN_P): New macros.
(status_message): Use concat3.
(Fprocess_status): Add `listen' status to doc string. Return `stop'
for a stopped network process.
(Fset_process_buffer): Update contact plist for network process.
(Fset_process_filter): Ditto. Don't enable input for stopped
network processes. Server must listen, even if filter is t.
(Fset_process_query_on_exit_flag, Fprocess_query_on_exit_flag):
New functions.
(Fprocess_kill_without_query): Removed. Now defined in simple.el.
(Fprocess_contact): Added KEY argument. Handle datagrams.
(list_processes_1): Optionally show only processes with the query
on exit flag set. Dynamically adjust column widths. Omit tty
column if not needed. Report stopped network processes.
Identify server and datagram network processes.
(Flist_processes): New optional arg `query-only'.
(conv_sockaddr_to_lisp, get_lisp_to_sockaddr_size)
(conv_lisp_to_sockaddr, set_socket_options)
(network_process_featurep, unwind_request_sigio): New helper functions.
(Fprocess_datagram_address, Fset_process_datagram_address):
(Fset_network_process_options): New lisp functions.
(Fopen_network_stream): Removed. Now defined in simple.el.
(Fmake_network_process): New lisp function. Code is based on previous
Fopen_network_stream, but heavily reworked with new property list based
argument list, support for datagrams, server processes, and local
sockets in addition to old client-only functionality.
(server_accept_connection): New function.
(wait_reading_process_input): Use it to handle incoming connects.
Do not enable input on a new connection if process is stopped.
(read_process_output): Handle datagram sockets. Use 2k buffer for them.
(send_process): Handle datagram sockets.
(Fstop_process, Fcontinue_process): Apply to network processes. A stopped
network process is indicated by setting command field to t .
(Fprocess_send_eof): No-op if datagram connection.
(Fstatus_notify): Don't read input for a stream server socket or a
stopped network process.
(init_process): Initialize datagram_address array.
(syms_of_process): Intern and staticpro new variables, defsubr new
functions.
2002-03-17 20:20:33 +00:00
|
|
|
|
}
|
1992-03-14 20:40:04 +00:00
|
|
|
|
|
(Qlocal, QCname, QCbuffer, QChost, QCservice, QCfamily)
(QClocal, QCremote, QCserver, QCdatagram, QCnowait, QCnoquery,QCstop)
(QCcoding, QCoptions, QCfilter, QCsentinel, QClog, QCfeature):
New variables.
(NETCONN1_P): New macro.
(DATAGRAM_SOCKETS): New conditional symbol.
(datagram_address): New array.
(DATAGRAM_CONN_P, DATAGRAM_CHAN_P): New macros.
(status_message): Use concat3.
(Fprocess_status): Add `listen' status to doc string. Return `stop'
for a stopped network process.
(Fset_process_buffer): Update contact plist for network process.
(Fset_process_filter): Ditto. Don't enable input for stopped
network processes. Server must listen, even if filter is t.
(Fset_process_query_on_exit_flag, Fprocess_query_on_exit_flag):
New functions.
(Fprocess_kill_without_query): Removed. Now defined in simple.el.
(Fprocess_contact): Added KEY argument. Handle datagrams.
(list_processes_1): Optionally show only processes with the query
on exit flag set. Dynamically adjust column widths. Omit tty
column if not needed. Report stopped network processes.
Identify server and datagram network processes.
(Flist_processes): New optional arg `query-only'.
(conv_sockaddr_to_lisp, get_lisp_to_sockaddr_size)
(conv_lisp_to_sockaddr, set_socket_options)
(network_process_featurep, unwind_request_sigio): New helper functions.
(Fprocess_datagram_address, Fset_process_datagram_address):
(Fset_network_process_options): New lisp functions.
(Fopen_network_stream): Removed. Now defined in simple.el.
(Fmake_network_process): New lisp function. Code is based on previous
Fopen_network_stream, but heavily reworked with new property list based
argument list, support for datagrams, server processes, and local
sockets in addition to old client-only functionality.
(server_accept_connection): New function.
(wait_reading_process_input): Use it to handle incoming connects.
Do not enable input on a new connection if process is stopped.
(read_process_output): Handle datagram sockets. Use 2k buffer for them.
(send_process): Handle datagram sockets.
(Fstop_process, Fcontinue_process): Apply to network processes. A stopped
network process is indicated by setting command field to t .
(Fprocess_send_eof): No-op if datagram connection.
(Fstatus_notify): Don't read input for a stream server socket or a
stopped network process.
(init_process): Initialize datagram_address array.
(syms_of_process): Intern and staticpro new variables, defsubr new
functions.
2002-03-17 20:20:33 +00:00
|
|
|
|
}
|
2002-02-28 23:53:59 +00:00
|
|
|
|
#endif /* not HAVE_GETADDRINFO */
|
1992-03-14 20:40:04 +00:00
|
|
|
|
|
(Qlocal, QCname, QCbuffer, QChost, QCservice, QCfamily)
(QClocal, QCremote, QCserver, QCdatagram, QCnowait, QCnoquery,QCstop)
(QCcoding, QCoptions, QCfilter, QCsentinel, QClog, QCfeature):
New variables.
(NETCONN1_P): New macro.
(DATAGRAM_SOCKETS): New conditional symbol.
(datagram_address): New array.
(DATAGRAM_CONN_P, DATAGRAM_CHAN_P): New macros.
(status_message): Use concat3.
(Fprocess_status): Add `listen' status to doc string. Return `stop'
for a stopped network process.
(Fset_process_buffer): Update contact plist for network process.
(Fset_process_filter): Ditto. Don't enable input for stopped
network processes. Server must listen, even if filter is t.
(Fset_process_query_on_exit_flag, Fprocess_query_on_exit_flag):
New functions.
(Fprocess_kill_without_query): Removed. Now defined in simple.el.
(Fprocess_contact): Added KEY argument. Handle datagrams.
(list_processes_1): Optionally show only processes with the query
on exit flag set. Dynamically adjust column widths. Omit tty
column if not needed. Report stopped network processes.
Identify server and datagram network processes.
(Flist_processes): New optional arg `query-only'.
(conv_sockaddr_to_lisp, get_lisp_to_sockaddr_size)
(conv_lisp_to_sockaddr, set_socket_options)
(network_process_featurep, unwind_request_sigio): New helper functions.
(Fprocess_datagram_address, Fset_process_datagram_address):
(Fset_network_process_options): New lisp functions.
(Fopen_network_stream): Removed. Now defined in simple.el.
(Fmake_network_process): New lisp function. Code is based on previous
Fopen_network_stream, but heavily reworked with new property list based
argument list, support for datagrams, server processes, and local
sockets in addition to old client-only functionality.
(server_accept_connection): New function.
(wait_reading_process_input): Use it to handle incoming connects.
Do not enable input on a new connection if process is stopped.
(read_process_output): Handle datagram sockets. Use 2k buffer for them.
(send_process): Handle datagram sockets.
(Fstop_process, Fcontinue_process): Apply to network processes. A stopped
network process is indicated by setting command field to t .
(Fprocess_send_eof): No-op if datagram connection.
(Fstatus_notify): Don't read input for a stream server socket or a
stopped network process.
(init_process): Initialize datagram_address array.
(syms_of_process): Intern and staticpro new variables, defsubr new
functions.
2002-03-17 20:20:33 +00:00
|
|
|
|
ai.ai_family = family;
|
|
|
|
|
ai.ai_addr = (struct sockaddr *) &address_in;
|
|
|
|
|
ai.ai_addrlen = sizeof address_in;
|
|
|
|
|
|
|
|
|
|
open_socket:
|
|
|
|
|
|
2002-02-28 23:53:59 +00:00
|
|
|
|
/* Do this in case we never enter the for-loop below. */
|
2002-07-11 14:18:02 +00:00
|
|
|
|
count1 = SPECPDL_INDEX ();
|
2002-02-28 23:53:59 +00:00
|
|
|
|
s = -1;
|
1993-12-24 03:49:30 +00:00
|
|
|
|
|
2002-02-28 23:53:59 +00:00
|
|
|
|
for (lres = res; lres; lres = lres->ai_next)
|
|
|
|
|
{
|
2004-04-16 12:51:06 +00:00
|
|
|
|
int optn, optbits;
|
|
|
|
|
|
2010-03-26 20:45:32 -04:00
|
|
|
|
retry_connect:
|
|
|
|
|
|
2002-02-28 23:53:59 +00:00
|
|
|
|
s = socket (lres->ai_family, lres->ai_socktype, lres->ai_protocol);
|
|
|
|
|
if (s < 0)
|
|
|
|
|
{
|
|
|
|
|
xerrno = errno;
|
|
|
|
|
continue;
|
|
|
|
|
}
|
1996-02-26 00:07:45 +00:00
|
|
|
|
|
(Qlocal, QCname, QCbuffer, QChost, QCservice, QCfamily)
(QClocal, QCremote, QCserver, QCdatagram, QCnowait, QCnoquery,QCstop)
(QCcoding, QCoptions, QCfilter, QCsentinel, QClog, QCfeature):
New variables.
(NETCONN1_P): New macro.
(DATAGRAM_SOCKETS): New conditional symbol.
(datagram_address): New array.
(DATAGRAM_CONN_P, DATAGRAM_CHAN_P): New macros.
(status_message): Use concat3.
(Fprocess_status): Add `listen' status to doc string. Return `stop'
for a stopped network process.
(Fset_process_buffer): Update contact plist for network process.
(Fset_process_filter): Ditto. Don't enable input for stopped
network processes. Server must listen, even if filter is t.
(Fset_process_query_on_exit_flag, Fprocess_query_on_exit_flag):
New functions.
(Fprocess_kill_without_query): Removed. Now defined in simple.el.
(Fprocess_contact): Added KEY argument. Handle datagrams.
(list_processes_1): Optionally show only processes with the query
on exit flag set. Dynamically adjust column widths. Omit tty
column if not needed. Report stopped network processes.
Identify server and datagram network processes.
(Flist_processes): New optional arg `query-only'.
(conv_sockaddr_to_lisp, get_lisp_to_sockaddr_size)
(conv_lisp_to_sockaddr, set_socket_options)
(network_process_featurep, unwind_request_sigio): New helper functions.
(Fprocess_datagram_address, Fset_process_datagram_address):
(Fset_network_process_options): New lisp functions.
(Fopen_network_stream): Removed. Now defined in simple.el.
(Fmake_network_process): New lisp function. Code is based on previous
Fopen_network_stream, but heavily reworked with new property list based
argument list, support for datagrams, server processes, and local
sockets in addition to old client-only functionality.
(server_accept_connection): New function.
(wait_reading_process_input): Use it to handle incoming connects.
Do not enable input on a new connection if process is stopped.
(read_process_output): Handle datagram sockets. Use 2k buffer for them.
(send_process): Handle datagram sockets.
(Fstop_process, Fcontinue_process): Apply to network processes. A stopped
network process is indicated by setting command field to t .
(Fprocess_send_eof): No-op if datagram connection.
(Fstatus_notify): Don't read input for a stream server socket or a
stopped network process.
(init_process): Initialize datagram_address array.
(syms_of_process): Intern and staticpro new variables, defsubr new
functions.
2002-03-17 20:20:33 +00:00
|
|
|
|
#ifdef DATAGRAM_SOCKETS
|
|
|
|
|
if (!is_server && socktype == SOCK_DGRAM)
|
|
|
|
|
break;
|
|
|
|
|
#endif /* DATAGRAM_SOCKETS */
|
|
|
|
|
|
2002-02-28 23:53:59 +00:00
|
|
|
|
#ifdef NON_BLOCKING_CONNECT
|
(Qlocal, QCname, QCbuffer, QChost, QCservice, QCfamily)
(QClocal, QCremote, QCserver, QCdatagram, QCnowait, QCnoquery,QCstop)
(QCcoding, QCoptions, QCfilter, QCsentinel, QClog, QCfeature):
New variables.
(NETCONN1_P): New macro.
(DATAGRAM_SOCKETS): New conditional symbol.
(datagram_address): New array.
(DATAGRAM_CONN_P, DATAGRAM_CHAN_P): New macros.
(status_message): Use concat3.
(Fprocess_status): Add `listen' status to doc string. Return `stop'
for a stopped network process.
(Fset_process_buffer): Update contact plist for network process.
(Fset_process_filter): Ditto. Don't enable input for stopped
network processes. Server must listen, even if filter is t.
(Fset_process_query_on_exit_flag, Fprocess_query_on_exit_flag):
New functions.
(Fprocess_kill_without_query): Removed. Now defined in simple.el.
(Fprocess_contact): Added KEY argument. Handle datagrams.
(list_processes_1): Optionally show only processes with the query
on exit flag set. Dynamically adjust column widths. Omit tty
column if not needed. Report stopped network processes.
Identify server and datagram network processes.
(Flist_processes): New optional arg `query-only'.
(conv_sockaddr_to_lisp, get_lisp_to_sockaddr_size)
(conv_lisp_to_sockaddr, set_socket_options)
(network_process_featurep, unwind_request_sigio): New helper functions.
(Fprocess_datagram_address, Fset_process_datagram_address):
(Fset_network_process_options): New lisp functions.
(Fopen_network_stream): Removed. Now defined in simple.el.
(Fmake_network_process): New lisp function. Code is based on previous
Fopen_network_stream, but heavily reworked with new property list based
argument list, support for datagrams, server processes, and local
sockets in addition to old client-only functionality.
(server_accept_connection): New function.
(wait_reading_process_input): Use it to handle incoming connects.
Do not enable input on a new connection if process is stopped.
(read_process_output): Handle datagram sockets. Use 2k buffer for them.
(send_process): Handle datagram sockets.
(Fstop_process, Fcontinue_process): Apply to network processes. A stopped
network process is indicated by setting command field to t .
(Fprocess_send_eof): No-op if datagram connection.
(Fstatus_notify): Don't read input for a stream server socket or a
stopped network process.
(init_process): Initialize datagram_address array.
(syms_of_process): Intern and staticpro new variables, defsubr new
functions.
2002-03-17 20:20:33 +00:00
|
|
|
|
if (is_non_blocking_client)
|
2002-02-28 23:53:59 +00:00
|
|
|
|
{
|
|
|
|
|
#ifdef O_NONBLOCK
|
|
|
|
|
ret = fcntl (s, F_SETFL, O_NONBLOCK);
|
|
|
|
|
#else
|
|
|
|
|
ret = fcntl (s, F_SETFL, O_NDELAY);
|
|
|
|
|
#endif
|
|
|
|
|
if (ret < 0)
|
|
|
|
|
{
|
|
|
|
|
xerrno = errno;
|
|
|
|
|
emacs_close (s);
|
|
|
|
|
s = -1;
|
|
|
|
|
continue;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
#endif
|
2003-02-04 14:56:31 +00:00
|
|
|
|
|
2002-02-28 23:53:59 +00:00
|
|
|
|
/* Make us close S if quit. */
|
|
|
|
|
record_unwind_protect (close_file_unwind, make_number (s));
|
|
|
|
|
|
2004-04-16 12:51:06 +00:00
|
|
|
|
/* Parse network options in the arg list.
|
|
|
|
|
We simply ignore anything which isn't a known option (including other keywords).
|
2009-01-01 15:58:38 +00:00
|
|
|
|
An error is signaled if setting a known option fails. */
|
2004-04-16 12:51:06 +00:00
|
|
|
|
for (optn = optbits = 0; optn < nargs-1; optn += 2)
|
|
|
|
|
optbits |= set_socket_option (s, args[optn], args[optn+1]);
|
|
|
|
|
|
(Qlocal, QCname, QCbuffer, QChost, QCservice, QCfamily)
(QClocal, QCremote, QCserver, QCdatagram, QCnowait, QCnoquery,QCstop)
(QCcoding, QCoptions, QCfilter, QCsentinel, QClog, QCfeature):
New variables.
(NETCONN1_P): New macro.
(DATAGRAM_SOCKETS): New conditional symbol.
(datagram_address): New array.
(DATAGRAM_CONN_P, DATAGRAM_CHAN_P): New macros.
(status_message): Use concat3.
(Fprocess_status): Add `listen' status to doc string. Return `stop'
for a stopped network process.
(Fset_process_buffer): Update contact plist for network process.
(Fset_process_filter): Ditto. Don't enable input for stopped
network processes. Server must listen, even if filter is t.
(Fset_process_query_on_exit_flag, Fprocess_query_on_exit_flag):
New functions.
(Fprocess_kill_without_query): Removed. Now defined in simple.el.
(Fprocess_contact): Added KEY argument. Handle datagrams.
(list_processes_1): Optionally show only processes with the query
on exit flag set. Dynamically adjust column widths. Omit tty
column if not needed. Report stopped network processes.
Identify server and datagram network processes.
(Flist_processes): New optional arg `query-only'.
(conv_sockaddr_to_lisp, get_lisp_to_sockaddr_size)
(conv_lisp_to_sockaddr, set_socket_options)
(network_process_featurep, unwind_request_sigio): New helper functions.
(Fprocess_datagram_address, Fset_process_datagram_address):
(Fset_network_process_options): New lisp functions.
(Fopen_network_stream): Removed. Now defined in simple.el.
(Fmake_network_process): New lisp function. Code is based on previous
Fopen_network_stream, but heavily reworked with new property list based
argument list, support for datagrams, server processes, and local
sockets in addition to old client-only functionality.
(server_accept_connection): New function.
(wait_reading_process_input): Use it to handle incoming connects.
Do not enable input on a new connection if process is stopped.
(read_process_output): Handle datagram sockets. Use 2k buffer for them.
(send_process): Handle datagram sockets.
(Fstop_process, Fcontinue_process): Apply to network processes. A stopped
network process is indicated by setting command field to t .
(Fprocess_send_eof): No-op if datagram connection.
(Fstatus_notify): Don't read input for a stream server socket or a
stopped network process.
(init_process): Initialize datagram_address array.
(syms_of_process): Intern and staticpro new variables, defsubr new
functions.
2002-03-17 20:20:33 +00:00
|
|
|
|
if (is_server)
|
|
|
|
|
{
|
|
|
|
|
/* Configure as a server socket. */
|
2004-04-16 12:51:06 +00:00
|
|
|
|
|
|
|
|
|
/* SO_REUSEADDR = 1 is default for server sockets; must specify
|
|
|
|
|
explicit :reuseaddr key to override this. */
|
(Qlocal, QCname, QCbuffer, QChost, QCservice, QCfamily)
(QClocal, QCremote, QCserver, QCdatagram, QCnowait, QCnoquery,QCstop)
(QCcoding, QCoptions, QCfilter, QCsentinel, QClog, QCfeature):
New variables.
(NETCONN1_P): New macro.
(DATAGRAM_SOCKETS): New conditional symbol.
(datagram_address): New array.
(DATAGRAM_CONN_P, DATAGRAM_CHAN_P): New macros.
(status_message): Use concat3.
(Fprocess_status): Add `listen' status to doc string. Return `stop'
for a stopped network process.
(Fset_process_buffer): Update contact plist for network process.
(Fset_process_filter): Ditto. Don't enable input for stopped
network processes. Server must listen, even if filter is t.
(Fset_process_query_on_exit_flag, Fprocess_query_on_exit_flag):
New functions.
(Fprocess_kill_without_query): Removed. Now defined in simple.el.
(Fprocess_contact): Added KEY argument. Handle datagrams.
(list_processes_1): Optionally show only processes with the query
on exit flag set. Dynamically adjust column widths. Omit tty
column if not needed. Report stopped network processes.
Identify server and datagram network processes.
(Flist_processes): New optional arg `query-only'.
(conv_sockaddr_to_lisp, get_lisp_to_sockaddr_size)
(conv_lisp_to_sockaddr, set_socket_options)
(network_process_featurep, unwind_request_sigio): New helper functions.
(Fprocess_datagram_address, Fset_process_datagram_address):
(Fset_network_process_options): New lisp functions.
(Fopen_network_stream): Removed. Now defined in simple.el.
(Fmake_network_process): New lisp function. Code is based on previous
Fopen_network_stream, but heavily reworked with new property list based
argument list, support for datagrams, server processes, and local
sockets in addition to old client-only functionality.
(server_accept_connection): New function.
(wait_reading_process_input): Use it to handle incoming connects.
Do not enable input on a new connection if process is stopped.
(read_process_output): Handle datagram sockets. Use 2k buffer for them.
(send_process): Handle datagram sockets.
(Fstop_process, Fcontinue_process): Apply to network processes. A stopped
network process is indicated by setting command field to t .
(Fprocess_send_eof): No-op if datagram connection.
(Fstatus_notify): Don't read input for a stream server socket or a
stopped network process.
(init_process): Initialize datagram_address array.
(syms_of_process): Intern and staticpro new variables, defsubr new
functions.
2002-03-17 20:20:33 +00:00
|
|
|
|
#ifdef HAVE_LOCAL_SOCKETS
|
|
|
|
|
if (family != AF_LOCAL)
|
|
|
|
|
#endif
|
2004-04-16 12:51:06 +00:00
|
|
|
|
if (!(optbits & (1 << OPIX_REUSEADDR)))
|
|
|
|
|
{
|
|
|
|
|
int optval = 1;
|
|
|
|
|
if (setsockopt (s, SOL_SOCKET, SO_REUSEADDR, &optval, sizeof optval))
|
|
|
|
|
report_file_error ("Cannot set reuse option on server socket", Qnil);
|
|
|
|
|
}
|
2003-02-04 14:56:31 +00:00
|
|
|
|
|
(Qlocal, QCname, QCbuffer, QChost, QCservice, QCfamily)
(QClocal, QCremote, QCserver, QCdatagram, QCnowait, QCnoquery,QCstop)
(QCcoding, QCoptions, QCfilter, QCsentinel, QClog, QCfeature):
New variables.
(NETCONN1_P): New macro.
(DATAGRAM_SOCKETS): New conditional symbol.
(datagram_address): New array.
(DATAGRAM_CONN_P, DATAGRAM_CHAN_P): New macros.
(status_message): Use concat3.
(Fprocess_status): Add `listen' status to doc string. Return `stop'
for a stopped network process.
(Fset_process_buffer): Update contact plist for network process.
(Fset_process_filter): Ditto. Don't enable input for stopped
network processes. Server must listen, even if filter is t.
(Fset_process_query_on_exit_flag, Fprocess_query_on_exit_flag):
New functions.
(Fprocess_kill_without_query): Removed. Now defined in simple.el.
(Fprocess_contact): Added KEY argument. Handle datagrams.
(list_processes_1): Optionally show only processes with the query
on exit flag set. Dynamically adjust column widths. Omit tty
column if not needed. Report stopped network processes.
Identify server and datagram network processes.
(Flist_processes): New optional arg `query-only'.
(conv_sockaddr_to_lisp, get_lisp_to_sockaddr_size)
(conv_lisp_to_sockaddr, set_socket_options)
(network_process_featurep, unwind_request_sigio): New helper functions.
(Fprocess_datagram_address, Fset_process_datagram_address):
(Fset_network_process_options): New lisp functions.
(Fopen_network_stream): Removed. Now defined in simple.el.
(Fmake_network_process): New lisp function. Code is based on previous
Fopen_network_stream, but heavily reworked with new property list based
argument list, support for datagrams, server processes, and local
sockets in addition to old client-only functionality.
(server_accept_connection): New function.
(wait_reading_process_input): Use it to handle incoming connects.
Do not enable input on a new connection if process is stopped.
(read_process_output): Handle datagram sockets. Use 2k buffer for them.
(send_process): Handle datagram sockets.
(Fstop_process, Fcontinue_process): Apply to network processes. A stopped
network process is indicated by setting command field to t .
(Fprocess_send_eof): No-op if datagram connection.
(Fstatus_notify): Don't read input for a stream server socket or a
stopped network process.
(init_process): Initialize datagram_address array.
(syms_of_process): Intern and staticpro new variables, defsubr new
functions.
2002-03-17 20:20:33 +00:00
|
|
|
|
if (bind (s, lres->ai_addr, lres->ai_addrlen))
|
|
|
|
|
report_file_error ("Cannot bind server socket", Qnil);
|
|
|
|
|
|
|
|
|
|
#ifdef HAVE_GETSOCKNAME
|
|
|
|
|
if (EQ (service, Qt))
|
|
|
|
|
{
|
|
|
|
|
struct sockaddr_in sa1;
|
|
|
|
|
int len1 = sizeof (sa1);
|
|
|
|
|
if (getsockname (s, (struct sockaddr *)&sa1, &len1) == 0)
|
|
|
|
|
{
|
|
|
|
|
((struct sockaddr_in *)(lres->ai_addr))->sin_port = sa1.sin_port;
|
2003-01-08 22:16:12 +00:00
|
|
|
|
service = make_number (ntohs (sa1.sin_port));
|
(Qlocal, QCname, QCbuffer, QChost, QCservice, QCfamily)
(QClocal, QCremote, QCserver, QCdatagram, QCnowait, QCnoquery,QCstop)
(QCcoding, QCoptions, QCfilter, QCsentinel, QClog, QCfeature):
New variables.
(NETCONN1_P): New macro.
(DATAGRAM_SOCKETS): New conditional symbol.
(datagram_address): New array.
(DATAGRAM_CONN_P, DATAGRAM_CHAN_P): New macros.
(status_message): Use concat3.
(Fprocess_status): Add `listen' status to doc string. Return `stop'
for a stopped network process.
(Fset_process_buffer): Update contact plist for network process.
(Fset_process_filter): Ditto. Don't enable input for stopped
network processes. Server must listen, even if filter is t.
(Fset_process_query_on_exit_flag, Fprocess_query_on_exit_flag):
New functions.
(Fprocess_kill_without_query): Removed. Now defined in simple.el.
(Fprocess_contact): Added KEY argument. Handle datagrams.
(list_processes_1): Optionally show only processes with the query
on exit flag set. Dynamically adjust column widths. Omit tty
column if not needed. Report stopped network processes.
Identify server and datagram network processes.
(Flist_processes): New optional arg `query-only'.
(conv_sockaddr_to_lisp, get_lisp_to_sockaddr_size)
(conv_lisp_to_sockaddr, set_socket_options)
(network_process_featurep, unwind_request_sigio): New helper functions.
(Fprocess_datagram_address, Fset_process_datagram_address):
(Fset_network_process_options): New lisp functions.
(Fopen_network_stream): Removed. Now defined in simple.el.
(Fmake_network_process): New lisp function. Code is based on previous
Fopen_network_stream, but heavily reworked with new property list based
argument list, support for datagrams, server processes, and local
sockets in addition to old client-only functionality.
(server_accept_connection): New function.
(wait_reading_process_input): Use it to handle incoming connects.
Do not enable input on a new connection if process is stopped.
(read_process_output): Handle datagram sockets. Use 2k buffer for them.
(send_process): Handle datagram sockets.
(Fstop_process, Fcontinue_process): Apply to network processes. A stopped
network process is indicated by setting command field to t .
(Fprocess_send_eof): No-op if datagram connection.
(Fstatus_notify): Don't read input for a stream server socket or a
stopped network process.
(init_process): Initialize datagram_address array.
(syms_of_process): Intern and staticpro new variables, defsubr new
functions.
2002-03-17 20:20:33 +00:00
|
|
|
|
contact = Fplist_put (contact, QCservice, service);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
#endif
|
|
|
|
|
|
2009-12-03 19:01:36 +00:00
|
|
|
|
if (socktype != SOCK_DGRAM && listen (s, backlog))
|
(Qlocal, QCname, QCbuffer, QChost, QCservice, QCfamily)
(QClocal, QCremote, QCserver, QCdatagram, QCnowait, QCnoquery,QCstop)
(QCcoding, QCoptions, QCfilter, QCsentinel, QClog, QCfeature):
New variables.
(NETCONN1_P): New macro.
(DATAGRAM_SOCKETS): New conditional symbol.
(datagram_address): New array.
(DATAGRAM_CONN_P, DATAGRAM_CHAN_P): New macros.
(status_message): Use concat3.
(Fprocess_status): Add `listen' status to doc string. Return `stop'
for a stopped network process.
(Fset_process_buffer): Update contact plist for network process.
(Fset_process_filter): Ditto. Don't enable input for stopped
network processes. Server must listen, even if filter is t.
(Fset_process_query_on_exit_flag, Fprocess_query_on_exit_flag):
New functions.
(Fprocess_kill_without_query): Removed. Now defined in simple.el.
(Fprocess_contact): Added KEY argument. Handle datagrams.
(list_processes_1): Optionally show only processes with the query
on exit flag set. Dynamically adjust column widths. Omit tty
column if not needed. Report stopped network processes.
Identify server and datagram network processes.
(Flist_processes): New optional arg `query-only'.
(conv_sockaddr_to_lisp, get_lisp_to_sockaddr_size)
(conv_lisp_to_sockaddr, set_socket_options)
(network_process_featurep, unwind_request_sigio): New helper functions.
(Fprocess_datagram_address, Fset_process_datagram_address):
(Fset_network_process_options): New lisp functions.
(Fopen_network_stream): Removed. Now defined in simple.el.
(Fmake_network_process): New lisp function. Code is based on previous
Fopen_network_stream, but heavily reworked with new property list based
argument list, support for datagrams, server processes, and local
sockets in addition to old client-only functionality.
(server_accept_connection): New function.
(wait_reading_process_input): Use it to handle incoming connects.
Do not enable input on a new connection if process is stopped.
(read_process_output): Handle datagram sockets. Use 2k buffer for them.
(send_process): Handle datagram sockets.
(Fstop_process, Fcontinue_process): Apply to network processes. A stopped
network process is indicated by setting command field to t .
(Fprocess_send_eof): No-op if datagram connection.
(Fstatus_notify): Don't read input for a stream server socket or a
stopped network process.
(init_process): Initialize datagram_address array.
(syms_of_process): Intern and staticpro new variables, defsubr new
functions.
2002-03-17 20:20:33 +00:00
|
|
|
|
report_file_error ("Cannot listen on server socket", Qnil);
|
|
|
|
|
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
|
2002-02-28 23:53:59 +00:00
|
|
|
|
immediate_quit = 1;
|
|
|
|
|
QUIT;
|
|
|
|
|
|
|
|
|
|
ret = connect (s, lres->ai_addr, lres->ai_addrlen);
|
|
|
|
|
xerrno = errno;
|
|
|
|
|
|
|
|
|
|
if (ret == 0 || xerrno == EISCONN)
|
|
|
|
|
{
|
|
|
|
|
/* The unwind-protect will be discarded afterwards.
|
|
|
|
|
Likewise for immediate_quit. */
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
#ifdef NON_BLOCKING_CONNECT
|
|
|
|
|
#ifdef EINPROGRESS
|
(Qlocal, QCname, QCbuffer, QChost, QCservice, QCfamily)
(QClocal, QCremote, QCserver, QCdatagram, QCnowait, QCnoquery,QCstop)
(QCcoding, QCoptions, QCfilter, QCsentinel, QClog, QCfeature):
New variables.
(NETCONN1_P): New macro.
(DATAGRAM_SOCKETS): New conditional symbol.
(datagram_address): New array.
(DATAGRAM_CONN_P, DATAGRAM_CHAN_P): New macros.
(status_message): Use concat3.
(Fprocess_status): Add `listen' status to doc string. Return `stop'
for a stopped network process.
(Fset_process_buffer): Update contact plist for network process.
(Fset_process_filter): Ditto. Don't enable input for stopped
network processes. Server must listen, even if filter is t.
(Fset_process_query_on_exit_flag, Fprocess_query_on_exit_flag):
New functions.
(Fprocess_kill_without_query): Removed. Now defined in simple.el.
(Fprocess_contact): Added KEY argument. Handle datagrams.
(list_processes_1): Optionally show only processes with the query
on exit flag set. Dynamically adjust column widths. Omit tty
column if not needed. Report stopped network processes.
Identify server and datagram network processes.
(Flist_processes): New optional arg `query-only'.
(conv_sockaddr_to_lisp, get_lisp_to_sockaddr_size)
(conv_lisp_to_sockaddr, set_socket_options)
(network_process_featurep, unwind_request_sigio): New helper functions.
(Fprocess_datagram_address, Fset_process_datagram_address):
(Fset_network_process_options): New lisp functions.
(Fopen_network_stream): Removed. Now defined in simple.el.
(Fmake_network_process): New lisp function. Code is based on previous
Fopen_network_stream, but heavily reworked with new property list based
argument list, support for datagrams, server processes, and local
sockets in addition to old client-only functionality.
(server_accept_connection): New function.
(wait_reading_process_input): Use it to handle incoming connects.
Do not enable input on a new connection if process is stopped.
(read_process_output): Handle datagram sockets. Use 2k buffer for them.
(send_process): Handle datagram sockets.
(Fstop_process, Fcontinue_process): Apply to network processes. A stopped
network process is indicated by setting command field to t .
(Fprocess_send_eof): No-op if datagram connection.
(Fstatus_notify): Don't read input for a stream server socket or a
stopped network process.
(init_process): Initialize datagram_address array.
(syms_of_process): Intern and staticpro new variables, defsubr new
functions.
2002-03-17 20:20:33 +00:00
|
|
|
|
if (is_non_blocking_client && xerrno == EINPROGRESS)
|
2002-02-28 23:53:59 +00:00
|
|
|
|
break;
|
|
|
|
|
#else
|
|
|
|
|
#ifdef EWOULDBLOCK
|
(Qlocal, QCname, QCbuffer, QChost, QCservice, QCfamily)
(QClocal, QCremote, QCserver, QCdatagram, QCnowait, QCnoquery,QCstop)
(QCcoding, QCoptions, QCfilter, QCsentinel, QClog, QCfeature):
New variables.
(NETCONN1_P): New macro.
(DATAGRAM_SOCKETS): New conditional symbol.
(datagram_address): New array.
(DATAGRAM_CONN_P, DATAGRAM_CHAN_P): New macros.
(status_message): Use concat3.
(Fprocess_status): Add `listen' status to doc string. Return `stop'
for a stopped network process.
(Fset_process_buffer): Update contact plist for network process.
(Fset_process_filter): Ditto. Don't enable input for stopped
network processes. Server must listen, even if filter is t.
(Fset_process_query_on_exit_flag, Fprocess_query_on_exit_flag):
New functions.
(Fprocess_kill_without_query): Removed. Now defined in simple.el.
(Fprocess_contact): Added KEY argument. Handle datagrams.
(list_processes_1): Optionally show only processes with the query
on exit flag set. Dynamically adjust column widths. Omit tty
column if not needed. Report stopped network processes.
Identify server and datagram network processes.
(Flist_processes): New optional arg `query-only'.
(conv_sockaddr_to_lisp, get_lisp_to_sockaddr_size)
(conv_lisp_to_sockaddr, set_socket_options)
(network_process_featurep, unwind_request_sigio): New helper functions.
(Fprocess_datagram_address, Fset_process_datagram_address):
(Fset_network_process_options): New lisp functions.
(Fopen_network_stream): Removed. Now defined in simple.el.
(Fmake_network_process): New lisp function. Code is based on previous
Fopen_network_stream, but heavily reworked with new property list based
argument list, support for datagrams, server processes, and local
sockets in addition to old client-only functionality.
(server_accept_connection): New function.
(wait_reading_process_input): Use it to handle incoming connects.
Do not enable input on a new connection if process is stopped.
(read_process_output): Handle datagram sockets. Use 2k buffer for them.
(send_process): Handle datagram sockets.
(Fstop_process, Fcontinue_process): Apply to network processes. A stopped
network process is indicated by setting command field to t .
(Fprocess_send_eof): No-op if datagram connection.
(Fstatus_notify): Don't read input for a stream server socket or a
stopped network process.
(init_process): Initialize datagram_address array.
(syms_of_process): Intern and staticpro new variables, defsubr new
functions.
2002-03-17 20:20:33 +00:00
|
|
|
|
if (is_non_blocking_client && xerrno == EWOULDBLOCK)
|
2002-02-28 23:53:59 +00:00
|
|
|
|
break;
|
|
|
|
|
#endif
|
|
|
|
|
#endif
|
|
|
|
|
#endif
|
2010-03-26 20:45:32 -04:00
|
|
|
|
|
|
|
|
|
#ifndef WINDOWSNT
|
2010-03-25 17:48:52 +09:00
|
|
|
|
if (xerrno == EINTR)
|
|
|
|
|
{
|
|
|
|
|
/* Unlike most other syscalls connect() cannot be called
|
|
|
|
|
again. (That would return EALREADY.) The proper way to
|
|
|
|
|
wait for completion is select(). */
|
2010-03-26 20:45:32 -04:00
|
|
|
|
int sc, len;
|
2010-03-25 17:48:52 +09:00
|
|
|
|
SELECT_TYPE fdset;
|
|
|
|
|
retry_select:
|
|
|
|
|
FD_ZERO (&fdset);
|
|
|
|
|
FD_SET (s, &fdset);
|
|
|
|
|
QUIT;
|
|
|
|
|
sc = select (s + 1, (SELECT_TYPE *)0, &fdset, (SELECT_TYPE *)0,
|
|
|
|
|
(EMACS_TIME *)0);
|
|
|
|
|
if (sc == -1)
|
|
|
|
|
{
|
2010-03-26 20:45:32 -04:00
|
|
|
|
if (errno == EINTR)
|
2010-03-25 17:48:52 +09:00
|
|
|
|
goto retry_select;
|
2010-03-26 20:45:32 -04:00
|
|
|
|
else
|
2010-03-25 17:48:52 +09:00
|
|
|
|
report_file_error ("select failed", Qnil);
|
|
|
|
|
}
|
|
|
|
|
eassert (sc > 0);
|
2010-03-26 20:45:32 -04:00
|
|
|
|
|
|
|
|
|
len = sizeof xerrno;
|
|
|
|
|
eassert (FD_ISSET (s, &fdset));
|
|
|
|
|
if (getsockopt (s, SOL_SOCKET, SO_ERROR, &xerrno, &len) == -1)
|
|
|
|
|
report_file_error ("getsockopt failed", Qnil);
|
|
|
|
|
if (xerrno)
|
|
|
|
|
errno = xerrno, report_file_error ("error during connect", Qnil);
|
|
|
|
|
else
|
|
|
|
|
break;
|
2010-03-25 17:48:52 +09:00
|
|
|
|
}
|
2010-03-26 20:45:32 -04:00
|
|
|
|
#endif /* !WINDOWSNT */
|
1994-04-30 06:05:51 +00:00
|
|
|
|
|
1996-02-26 00:07:45 +00:00
|
|
|
|
immediate_quit = 0;
|
|
|
|
|
|
2002-02-28 23:53:59 +00:00
|
|
|
|
/* Discard the unwind protect closing S. */
|
1999-09-14 08:33:24 +00:00
|
|
|
|
specpdl_ptr = specpdl + count1;
|
Add support for large files, 64-bit Solaris, system locale codings.
* Makefile.in (emacs): Set the LC_ALL environment variable to "C"
when dumping, so that the dumped Emacs doesn't have stray locale info.
(dired.o): Depend on systime.h.
(editfns.o): Depend on coding.h.
* alloc.c, buffer.c, callproc.c, ccl.c, charset.c, coding.c, data.c,
dispnew.c, editfns.c, emacs.c, filelock.c, floatfns.c, hftctl.c,
keyboard.c, process.c, sysdep.c, unexelf.c, unexhp9k800.c,
unexsunos4.c, vmsfns.c, vmsgmalloc.c, w32faces.c, w32menu.c, w32term.c,
w32xfns.c, xfaces.c, xfns.c, xmenu.c, xterm.c:
Include <config.h> before any system include files.
* alloc.c, buffer.c, ccl.c, data.c, editfns.c, emacs.c, eval.c,
fileio.c, filelock.c, frame.c, insdel.c, keymap.c, lread.c,
m/alpha.h, print.c, search.c, sysdep.c, xdisp.c, xfaces.c, xfns.c,
xmenu.c, xterm.c:
Do not include <stdlib.h>, as <config.h> does this now.
* callproc.c (Fcall_process):
Synchronize messages locale before invoking strerror.
Decode resulting string with locale-coding-system.
* coding.c (Vlocale_coding_system): New var.
(syms_of_coding): Adjust to above change.
(emacs_strerror): New function.
* coding.h (emacs_strerror, Vlocale_coding_system): New decls.
* config.in (HAVE_STDIO_EXT_H, HAVE_TM_GMTOFF, HAVE___FPENDING,
HAVE_FTELLO, HAVE_GETLOADAVG, HAVE_MBLEN, HAVE_MBRLEN,
HAVE_STRSIGNAL): New macros.
(BITS_PER_LONG): Default to 64 if _LP64 is defined.
<stdlib.h>: Include if HAVE_STDLIB_H is defined and NOT_C_CODE isn't.
* dired.c: Include "systime.h".
(Ffile_attributes): Do not cast s.st_size to int; this loses
information if int is 32 bits but st_size and EMACS_INT are larger.
Treat large device numbers like large inode numbers.
* dispnew.c (PENDING_OUTPUT_COUNT): Use __fpending if available.
* editfns.c: Include coding.h.
(emacs_strftime): Remove decl.
(emacs_strftimeu): New decl.
(emacs_memftimeu): Renamed from emacs_memftime; new arg UT.
Use emacs_strftimeu instead of emacs_strftime.
(Fformat_time_string): Convert format string using
Vlocale_coding_system, and convert result back. Synchronize time
locale before invoking lower level function. Invoke
emacs_memftimeu, passing ut, instead of emacs_memftime.
* emacs.c: Include <locale.h> if HAVE_SETLOCALE is defined.
(Vmessages_locale, Vprevious_messages_locale, Vtime_locale,
Vprevious_time_locale): New variables.
(main): Invoke setlocale early, so that initial error messages are
localized properly. But skip locale-setting if LC_ALL is "C".
Fix up locale when it's safe to do so.
(fixup_locale): Moved here from xterm.c.
(synchronize_locale, synchronize_time_locale,
synchronize_messages_locale): New functions.
(syms_of_emacs): Accommodate above changes.
* fileio.c (report_file_error): Convert strerror output according
to Vlocale_coding_system.
(Finsert_file_contents): Check for arithmetic overflow in
computations that depend on file size. Report IO errors
with emacs_strerror, not strerror.
* fns.c (Fgethash): Declare dflt parameter.
* gmalloc.c: Do not define const to nothing if HAVE_CONFIG_H
is defined; that's config.h's job.
* lisp.h (EMACS_INT, BITS_PER_EMACS_INT, EMACS_UINT): If _LP64,
default these values to long, BITS_PER_LONG, and unsigned long.
(VALBITS, MARKBIT, XINT): Do not assume 32-bit EMACS_INT.
(PNTR_COMPARISON_TYPE): Default to EMACS_UINT, not to unsigned int.
(code_convert_string_norecord, fixup_locale,
synchronize_messages_locale, synchronize_time_locale,
emacs_open, emacs_close, emacs_read, emacs_write): New decls.
All Emacs callers of open, close, read, write changed to use
emacs_open, emacs_close, emacs_read, emacs_write.
* lread.c (file_offset, file_tell): New macros. All uses of ftell
changed to file_tell.
(saved_doc_string_position, prev_saved_doc_string_position): Now
of type file_offset.
(init_lread): Do not fix locale here; fixup_locale now does this.
* m/amdahl.h, s/usg5-4.h:
(NSIG): Remove.
(NSIG_MINIMUM): New macro.
* m/cydra5.h, m/dpx2.h, m/mips.h, m/pfa50.h, m/sps7.h, m/stride.h,
m/ustation.h, s/gnu-linux.h, s/hpux.h, s/iris3-5.h, s/iris3-6.h,
s/umips.h, s/usg5-4.h:
(SIGIO): Do not undef.
(BROKEN_SIGIO): New macro.
* m/ustation.h:
(SIGTSTP): Do not undef.
(BROKEN_SIGTSTP): New macro.
* s/gnu-linux.h:
(SIGPOLL, SIGURG): Do not undef.
(BROKEN_SIGPOLL, BROKEN_SIGURG): New macros.
* s/ptx4.h:
(SIGINFO): Do not undef.
(BROKEN_SIGINFO): New macros.
* m/delta.h, s/ptx.h, s/template.h: Doc fix.
* mktime.c, strftime.c: Update to glibc 2.1.2 version, with
some Emacs-related changes merged.
* print.c (float_to_string): Prepend "-" to representation of a
NaN if the NaN is negative.
* process.c (sys_siglist): Omit if HAVE_STRSIGNAL.
(wait_reading_process_input): Use emacs_strerror, not strerror.
* process.c (status_message, sigchld_handler): Synchronize locale,
then use strsignal istead of sys_siglist.
* w32proc.c (sys_wait): Likewise.
* s/aix3-1.h, s/bsd4-1.h, s/dgux.h, s/gnu-linux.h, s/hiuxmpp.h,
s/hpux.h, s/iris3-5.h, s/iris3-6.h, s/irix3-3.h, s/osf1.h, s/rtu.h,
s/sunos4-1.h, s/unipl5-0.h, s/unipl5-2.h, s/usg5-0.h, s/usg5-2-2.h,
s/usg5-2.h, s/usg5-3.h, s/xenix.h:
(open, close, read, write, INTERRUPTIBLE_OPEN,
INTERRUPTIBLE_CLOSE, INTERRUPTIBLE_IO): Remove.
* s/sol2-5.h (_LARGEFILE_SOURCE, _FILE_OFFSET_BITS): New macros.
* sysdep.c (sys_read, sys_write, read, write, sys_close, close,
sys_open, open): Remove.
(emacs_open, emacs_close, emacs_read, emacs_write): Always define;
the old INTERRUPTIBLE_OPEN, INTERRUPTIBLE_CLOSE, and INTERRUPTIBLE_IO
macros are no longer used.
(emacs_open): Renamed from sys_open. Merge BSD4_1 version.
(emacs_close): Renamed from sys_close.
(emacs_read): Renamed from sys_read.
(emacs_write): Renamed from sys_write.
(sys_siglist): Do not declare if HAVE_STRSIGNAL.
(dup2): Do not print error on failure; the real dup2 doesn't.
(strsignal): New function, defined if !HAVE_STRSIGNAL.
* syssignal.h (SIGINFO): Undef if defined and if BROKEN_SIGINFO
is defined.
(SIGIO, SIGPOLL, SIGTSTP, SIGURG): Likewise.
(NSIG): If less than NSIG_MINIMUM, define to NSIG_MINIMUM.
(strsignal): Declare if !HAVE_STRSIGNAL.
* unexelf.c (ElfBitsW, ELFSIZE, ElfExpandBitsW): New macros.
(ElfW): Define in terms of ElfExpandBitsW.
* w32proc.c (sys_siglist): Remove decl.
* xdisp.c (decode_mode_spec): 3rd arg is int, not char, to comply
with ANSI C.
(display_string): Declare face_string_pos arg.
* xfns.c (Fx_show_tip): Declare timeout param.
* xterm.c: No need to include locale.h.
(x_alloc_lighter_color, x_setup_relief_color):
Pass arg as double, not float, for compatibility with ANSI C.
(fixup_locale): Move to emacs.c.
(x_term_init): Do not setlocale or fixup locale; the main program
does this now.
1999-10-19 07:25:11 +00:00
|
|
|
|
emacs_close (s);
|
2002-02-28 23:53:59 +00:00
|
|
|
|
s = -1;
|
2010-03-26 20:45:32 -04:00
|
|
|
|
|
|
|
|
|
#ifdef WINDOWSNT
|
|
|
|
|
if (xerrno == EINTR)
|
|
|
|
|
goto retry_connect;
|
|
|
|
|
#endif
|
2002-02-28 23:53:59 +00:00
|
|
|
|
}
|
1993-12-24 03:49:30 +00:00
|
|
|
|
|
(Qlocal, QCname, QCbuffer, QChost, QCservice, QCfamily)
(QClocal, QCremote, QCserver, QCdatagram, QCnowait, QCnoquery,QCstop)
(QCcoding, QCoptions, QCfilter, QCsentinel, QClog, QCfeature):
New variables.
(NETCONN1_P): New macro.
(DATAGRAM_SOCKETS): New conditional symbol.
(datagram_address): New array.
(DATAGRAM_CONN_P, DATAGRAM_CHAN_P): New macros.
(status_message): Use concat3.
(Fprocess_status): Add `listen' status to doc string. Return `stop'
for a stopped network process.
(Fset_process_buffer): Update contact plist for network process.
(Fset_process_filter): Ditto. Don't enable input for stopped
network processes. Server must listen, even if filter is t.
(Fset_process_query_on_exit_flag, Fprocess_query_on_exit_flag):
New functions.
(Fprocess_kill_without_query): Removed. Now defined in simple.el.
(Fprocess_contact): Added KEY argument. Handle datagrams.
(list_processes_1): Optionally show only processes with the query
on exit flag set. Dynamically adjust column widths. Omit tty
column if not needed. Report stopped network processes.
Identify server and datagram network processes.
(Flist_processes): New optional arg `query-only'.
(conv_sockaddr_to_lisp, get_lisp_to_sockaddr_size)
(conv_lisp_to_sockaddr, set_socket_options)
(network_process_featurep, unwind_request_sigio): New helper functions.
(Fprocess_datagram_address, Fset_process_datagram_address):
(Fset_network_process_options): New lisp functions.
(Fopen_network_stream): Removed. Now defined in simple.el.
(Fmake_network_process): New lisp function. Code is based on previous
Fopen_network_stream, but heavily reworked with new property list based
argument list, support for datagrams, server processes, and local
sockets in addition to old client-only functionality.
(server_accept_connection): New function.
(wait_reading_process_input): Use it to handle incoming connects.
Do not enable input on a new connection if process is stopped.
(read_process_output): Handle datagram sockets. Use 2k buffer for them.
(send_process): Handle datagram sockets.
(Fstop_process, Fcontinue_process): Apply to network processes. A stopped
network process is indicated by setting command field to t .
(Fprocess_send_eof): No-op if datagram connection.
(Fstatus_notify): Don't read input for a stream server socket or a
stopped network process.
(init_process): Initialize datagram_address array.
(syms_of_process): Intern and staticpro new variables, defsubr new
functions.
2002-03-17 20:20:33 +00:00
|
|
|
|
if (s >= 0)
|
|
|
|
|
{
|
|
|
|
|
#ifdef DATAGRAM_SOCKETS
|
|
|
|
|
if (socktype == SOCK_DGRAM)
|
|
|
|
|
{
|
|
|
|
|
if (datagram_address[s].sa)
|
|
|
|
|
abort ();
|
|
|
|
|
datagram_address[s].sa = (struct sockaddr *) xmalloc (lres->ai_addrlen);
|
|
|
|
|
datagram_address[s].len = lres->ai_addrlen;
|
|
|
|
|
if (is_server)
|
|
|
|
|
{
|
|
|
|
|
Lisp_Object remote;
|
Replace bcopy, bzero, bcmp by memcpy, memmove, memset, memcmp
* alloc.c (overrun_check_malloc, overrun_check_realloc)
(overrun_check_free, xstrdup, allocate_string)
(allocate_string_data, compact_small_strings, Fmake_string)
(make_unibyte_string, make_multibyte_string)
(make_string_from_bytes, make_specified_string, make_float)
(Fcons, allocate_terminal, allocate_frame, make_pure_string)
(Fgarbage_collect): Replace bcopy, safe_bcopy, bzero, bcmp by
memcpy, memmove, memset, memcmp.
* atimer.c (start_atimer, set_alarm): Likewise.
* buffer.c (clone_per_buffer_values, report_overlay_modification)
(mmap_realloc, init_buffer_once): Likewise.
* callint.c (Fcall_interactively): Likewise.
* callproc.c (Fcall_process, Fcall_process_region, child_setup)
(getenv_internal_1): Likewise.
* casefiddle.c (casify_object): Likewise.
* ccl.c (ccl_driver): Likewise.
* character.c (str_as_multibyte, str_to_multibyte): Likewise.
* charset.c (load_charset_map_from_file)
(load_charset_map_from_file, load_charset_map_from_vector)
(Fdefine_charset_internal): Likewise.
* cm.c (Wcm_clear): Likewise.
* coding.c (decode_eol, decode_coding_object)
(Fset_coding_system_priority, make_subsidiaries): Likewise.
* data.c (Faset): Likewise.
* dired.c (directory_files_internal, file_name_completion_stat):
Likewise.
* dispnew.c (new_glyph_matrix, adjust_glyph_matrix)
(clear_glyph_row, copy_row_except_pointers)
(copy_glyph_row_contents, new_glyph_pool, realloc_glyph_pool)
(save_current_matrix, restore_current_matrix)
(build_frame_matrix_from_leaf_window, mirrored_line_dance)
(mirror_line_dance, scrolling_window): Likewise.
* doc.c (Fsnarf_documentation, Fsubstitute_command_keys):
Likewise.
* doprnt.c (doprnt): Likewise.
* editfns.c (Fuser_full_name, make_buffer_string_both)
(Fmessage_box, Fformat, Ftranspose_regions): Likewise.
* emacs.c (sort_args): Likewise.
* eval.c (Fapply, Ffuncall): Likewise.
* fileio.c (Ffile_name_directory, make_temp_name)
(Fexpand_file_name, search_embedded_absfilename)
(Fsubstitute_in_file_name, Ffile_symlink_p, Finsert_file_contents)
(auto_save_error): Likewise.
* fns.c (Fstring_equal, Fcopy_sequence, concat)
(string_to_multibyte, Fstring_as_unibyte, Fstring_as_multibyte)
(internal_equal, Fclear_string, larger_vector, copy_hash_table)
(Fmake_hash_table): Likewise.
* fringe.c (Fdefine_fringe_bitmap): Likewise.
* ftfont.c (ftfont_text_extents): Likewise.
* getloadavg.c (getloadavg): Likewise.
* image.c (define_image_type, make_image, make_image_cache)
(x_create_x_image_and_pixmap, xbm_image_p)
(w32_create_pixmap_from_bitmap_data, xbm_load, xpm_lookup_color)
(xpm_image_p, x_create_bitmap_from_xpm_data, xpm_load)
(init_color_table, x_build_heuristic_mask, pbm_image_p, pbm_load)
(png_image_p, png_read_from_memory, png_load, jpeg_image_p)
(tiff_image_p, tiff_read_from_memory, gif_image_p)
(gif_read_from_memory, gif_load, svg_image_p, gs_image_p):
Likewise.
* indent.c (scan_for_column, compute_motion): Likewise.
* insdel.c (gap_left, gap_right, make_gap_smaller, copy_text)
(insert_1_both, insert_from_gap, replace_range_2): Likewise.
* intervals.c (reproduce_tree, reproduce_tree_obj): Likewise.
* keyboard.c (echo_char, save_getcjmp, restore_getcjmp)
(kbd_buffer_store_event_hold, apply_modifiers_uncached)
(store_user_signal_events, menu_bar_items, tool_bar_items)
(process_tool_bar_item, append_tool_bar_item)
(read_char_minibuf_menu_prompt, read_key_sequence)
(Fread_key_sequence, Fread_key_sequence_vector, Frecent_keys):
Likewise.
* keymap.c (current_minor_maps, Fdescribe_buffer_bindings):
Likewise.
* lisp.h (STRING_COPYIN): Likewise.
* lread.c (Fload, read1, oblookup): Likewise.
* msdos.c (Frecent_doskeys): Likewise.
* nsfns.m (Fx_create_frame): Likewise.
* nsfont.m (nsfont_open, nsfont_text_extents, ns_glyph_metrics):
Likewise.
* nsimage.m (EmacsImage-initFromSkipXBM:width:height:)
(EmacsImage-initForXPMWithDepth:width:height:flip:length:):
Likewise.
* nsmenu.m (ns_update_menubar): Likewise.
* nsterm.m (ns_draw_fringe_bitmap, ns_term_init): Likewise.
* print.c (print_unwind, printchar, strout, print_string)
(print_error_message): Likewise.
* process.c (conv_lisp_to_sockaddr, set_socket_option)
(Fmake_network_process, Fnetwork_interface_list)
(Fnetwork_interface_info, read_process_output, Fprocess_send_eof)
(init_process): Likewise.
* ralloc.c (resize_bloc, r_alloc_sbrk, r_alloc_init): Likewise.
* regex.c (init_syntax_once, regex_compile, re_compile_fastmap):
Likewise.
* scroll.c (do_scrolling, do_direct_scrolling)
(scrolling_max_lines_saved): Likewise.
* search.c (search_buffer, wordify, Freplace_match): Likewise.
* sound.c (wav_init, au_init, Fplay_sound_internal): Likewise.
* syntax.c (skip_chars, skip_syntaxes): Likewise.
* sysdep.c (child_setup_tty, sys_subshell, emacs_get_tty)
(emacs_set_tty): Likewise.
* term.c (encode_terminal_code, calculate_costs)
(produce_special_glyphs, create_tty_output, init_tty, delete_tty):
Likewise.
* termcap.c (tgetst1, gobble_line): Likewise.
* termhooks.h (EVENT_INIT): Likewise.
* tparam.c (tparam1): Likewise.
* unexalpha.c (unexec): Likewise.
* unexec.c (write_segment): Likewise.
* unexmacosx.c (unexec_write_zero): Likewise.
* w32fns.c (w32_wnd_proc, Fx_create_frame, x_create_tip_frame)
(Fx_file_dialog, Fsystem_move_file_to_trash): Likewise.
* w32font.c (w32font_list_family, w32font_text_extents)
(w32font_list_internal, w32font_match_internal)
(w32font_open_internal, compute_metrics, Fx_select_font):
Likewise.
* w32menu.c (set_frame_menubar, add_menu_item)
(w32_menu_display_help, w32_free_submenu_strings): Likewise.
* w32term.c (XCreateGC, w32_initialize_display_info): Likewise.
* w32uniscribe.c (uniscribe_list_family): Likewise.
* w32xfns.c (get_next_msg, post_msg, prepend_msg): Likewise.
* window.c (make_window, replace_window, set_window_buffer)
(Fsplit_window): Likewise.
* xdisp.c (init_iterator, RECORD_OVERLAY_STRING, reseat_to_string)
(add_to_log, message3, x_consider_frame_title)
(append_space_for_newline, extend_face_to_end_of_line)
(decode_mode_spec_coding, init_glyph_string): Likewise.
* xfaces.c (x_create_gc, get_lface_attributes_no_remap)
(Finternal_copy_lisp_face, Finternal_merge_in_global_face)
(face_attr_equal_p, make_realized_face, make_face_cache)
(free_realized_faces, lookup_named_face, smaller_face)
(face_with_height, lookup_derived_face)
(x_supports_face_attributes_p, Finternal_set_font_selection_order)
(Finternal_set_font_selection_order, realize_default_face)
(compute_char_face, face_at_buffer_position)
(face_for_overlay_string, face_at_string_position, merge_faces):
Likewise.
* xfns.c (xic_create_fontsetname, Fx_create_frame)
(Fx_window_property, x_create_tip_frame)
(Fx_backspace_delete_keys_p): Likewise.
* xfont.c (xfont_list, xfont_match, xfont_list_family)
(xfont_text_extents): Likewise.
* xmenu.c (set_frame_menubar, xmenu_show): Likewise.
* xrdb.c (magic_file_p, x_get_resource): Likewise.
* xselect.c (x_queue_event, x_get_window_property)
(receive_incremental_selection): Likewise.
* xsmfns.c (x_session_check_input): Likewise.
* xterm.c (x_send_scroll_bar_event, SET_SAVED_MENU_EVENT)
(handle_one_xevent, x_check_errors, xim_initialize, x_term_init):
Likewise.
* character.h (BCOPY_SHORT): Removed.
* config.in: Regenerate.
* dispnew.c (safe_bcopy): Only define as dummy if PROFILING.
* emacs.c (main) [PROFILING]: Don't declare
dump_opcode_frequencies.
* lisp.h (safe_bcopy): Remove declaration.
(memset) [!HAVE_MEMSET]: Declare.
(memcpy) [!HAVE_MEMCPY]: Likewise.
(memmove) [!HAVE_MEMMOVE]: Likewise.
(memcmp) [!HAVE_MEMCMP]: Likewise.
* s/ms-w32.h (bzero, bcopy, bcmp, GAP_USE_BCOPY)
(BCOPY_UPWARD_SAFE, BCOPY_DOWNWARD_SAFE, HAVE_BCOPY, HAVE_BCMP):
Don't define.
(HAVE_MEMCMP, HAVE_MEMCPY, HAVE_MEMMOVE, HAVE_MEMSET): Define.
* s/msdos.h (GAP_USE_BCOPY, BCOPY_UPWARD_SAFE)
(BCOPY_DOWNWARD_SAFE): Don't define.
* sysdep.c (memset) [!HAVE_MEMSET]: Define.
(memcpy) [!HAVE_MEMCPY]: Define.
(memmove) [!HAVE_MEMMOVE]: Define.
(memcmp) [!HAVE_MEMCMP]: Define.
* config.nt (HAVE_BCOPY, HAVE_BCMP): Remove undefs.
(HAVE_MEMCPY, HAVE_MEMMOVE, HAVE_MEMSET, HAVE_MEMCMP): Add undefs.
* sed2v2.inp (HAVE_MEMCPY, HAVE_MEMSET): Edit to 1.
(HAVE_BZERO): Don't edit.
* lwlib.c (lwlib_memset, lwlib_bcopy): Remove.
(malloc_widget_value, free_widget_info, allocate_widget_instance)
(lw_separator_p): Replace lwlib_memset, lwlib_bcopy, bzero, bcmp by
memset, memcpy, memcmp.
* lwlib-utils.c (XtApplyToWidgets): Likewise.
* xlwmenu.c (XlwMenuInitialize): Likewise.
* lwlib.h (lwlib_bcopy): Remove declaration.
* ebrowse.c (add_sym, make_namespace): Replace bcopy, bzero by
memcpy, memmove, memset.
* pop.c (pop_retrieve, socket_connection, pop_getline): Likewise.
* CPP-DEFINES (BCOPY_DOWNWARD_SAFE, BCOPY_UPWARD_SAFE)
(GAP_USE_BCOPY, HAVE_BCMP, HAVE_BCOPY, bcmp, bcopy, bzero):
Remove.
* configure.in: Don't check for bcopy, bcmp, bzero. Don't include
<strings.h> and don't define bcopy, bzero, BCMP in config.h.
2010-07-08 00:18:28 +02:00
|
|
|
|
memset (datagram_address[s].sa, 0, lres->ai_addrlen);
|
(Qlocal, QCname, QCbuffer, QChost, QCservice, QCfamily)
(QClocal, QCremote, QCserver, QCdatagram, QCnowait, QCnoquery,QCstop)
(QCcoding, QCoptions, QCfilter, QCsentinel, QClog, QCfeature):
New variables.
(NETCONN1_P): New macro.
(DATAGRAM_SOCKETS): New conditional symbol.
(datagram_address): New array.
(DATAGRAM_CONN_P, DATAGRAM_CHAN_P): New macros.
(status_message): Use concat3.
(Fprocess_status): Add `listen' status to doc string. Return `stop'
for a stopped network process.
(Fset_process_buffer): Update contact plist for network process.
(Fset_process_filter): Ditto. Don't enable input for stopped
network processes. Server must listen, even if filter is t.
(Fset_process_query_on_exit_flag, Fprocess_query_on_exit_flag):
New functions.
(Fprocess_kill_without_query): Removed. Now defined in simple.el.
(Fprocess_contact): Added KEY argument. Handle datagrams.
(list_processes_1): Optionally show only processes with the query
on exit flag set. Dynamically adjust column widths. Omit tty
column if not needed. Report stopped network processes.
Identify server and datagram network processes.
(Flist_processes): New optional arg `query-only'.
(conv_sockaddr_to_lisp, get_lisp_to_sockaddr_size)
(conv_lisp_to_sockaddr, set_socket_options)
(network_process_featurep, unwind_request_sigio): New helper functions.
(Fprocess_datagram_address, Fset_process_datagram_address):
(Fset_network_process_options): New lisp functions.
(Fopen_network_stream): Removed. Now defined in simple.el.
(Fmake_network_process): New lisp function. Code is based on previous
Fopen_network_stream, but heavily reworked with new property list based
argument list, support for datagrams, server processes, and local
sockets in addition to old client-only functionality.
(server_accept_connection): New function.
(wait_reading_process_input): Use it to handle incoming connects.
Do not enable input on a new connection if process is stopped.
(read_process_output): Handle datagram sockets. Use 2k buffer for them.
(send_process): Handle datagram sockets.
(Fstop_process, Fcontinue_process): Apply to network processes. A stopped
network process is indicated by setting command field to t .
(Fprocess_send_eof): No-op if datagram connection.
(Fstatus_notify): Don't read input for a stream server socket or a
stopped network process.
(init_process): Initialize datagram_address array.
(syms_of_process): Intern and staticpro new variables, defsubr new
functions.
2002-03-17 20:20:33 +00:00
|
|
|
|
if (remote = Fplist_get (contact, QCremote), !NILP (remote))
|
|
|
|
|
{
|
|
|
|
|
int rfamily, rlen;
|
|
|
|
|
rlen = get_lisp_to_sockaddr_size (remote, &rfamily);
|
|
|
|
|
if (rfamily == lres->ai_family && rlen == lres->ai_addrlen)
|
|
|
|
|
conv_lisp_to_sockaddr (rfamily, remote,
|
|
|
|
|
datagram_address[s].sa, rlen);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
else
|
Replace bcopy, bzero, bcmp by memcpy, memmove, memset, memcmp
* alloc.c (overrun_check_malloc, overrun_check_realloc)
(overrun_check_free, xstrdup, allocate_string)
(allocate_string_data, compact_small_strings, Fmake_string)
(make_unibyte_string, make_multibyte_string)
(make_string_from_bytes, make_specified_string, make_float)
(Fcons, allocate_terminal, allocate_frame, make_pure_string)
(Fgarbage_collect): Replace bcopy, safe_bcopy, bzero, bcmp by
memcpy, memmove, memset, memcmp.
* atimer.c (start_atimer, set_alarm): Likewise.
* buffer.c (clone_per_buffer_values, report_overlay_modification)
(mmap_realloc, init_buffer_once): Likewise.
* callint.c (Fcall_interactively): Likewise.
* callproc.c (Fcall_process, Fcall_process_region, child_setup)
(getenv_internal_1): Likewise.
* casefiddle.c (casify_object): Likewise.
* ccl.c (ccl_driver): Likewise.
* character.c (str_as_multibyte, str_to_multibyte): Likewise.
* charset.c (load_charset_map_from_file)
(load_charset_map_from_file, load_charset_map_from_vector)
(Fdefine_charset_internal): Likewise.
* cm.c (Wcm_clear): Likewise.
* coding.c (decode_eol, decode_coding_object)
(Fset_coding_system_priority, make_subsidiaries): Likewise.
* data.c (Faset): Likewise.
* dired.c (directory_files_internal, file_name_completion_stat):
Likewise.
* dispnew.c (new_glyph_matrix, adjust_glyph_matrix)
(clear_glyph_row, copy_row_except_pointers)
(copy_glyph_row_contents, new_glyph_pool, realloc_glyph_pool)
(save_current_matrix, restore_current_matrix)
(build_frame_matrix_from_leaf_window, mirrored_line_dance)
(mirror_line_dance, scrolling_window): Likewise.
* doc.c (Fsnarf_documentation, Fsubstitute_command_keys):
Likewise.
* doprnt.c (doprnt): Likewise.
* editfns.c (Fuser_full_name, make_buffer_string_both)
(Fmessage_box, Fformat, Ftranspose_regions): Likewise.
* emacs.c (sort_args): Likewise.
* eval.c (Fapply, Ffuncall): Likewise.
* fileio.c (Ffile_name_directory, make_temp_name)
(Fexpand_file_name, search_embedded_absfilename)
(Fsubstitute_in_file_name, Ffile_symlink_p, Finsert_file_contents)
(auto_save_error): Likewise.
* fns.c (Fstring_equal, Fcopy_sequence, concat)
(string_to_multibyte, Fstring_as_unibyte, Fstring_as_multibyte)
(internal_equal, Fclear_string, larger_vector, copy_hash_table)
(Fmake_hash_table): Likewise.
* fringe.c (Fdefine_fringe_bitmap): Likewise.
* ftfont.c (ftfont_text_extents): Likewise.
* getloadavg.c (getloadavg): Likewise.
* image.c (define_image_type, make_image, make_image_cache)
(x_create_x_image_and_pixmap, xbm_image_p)
(w32_create_pixmap_from_bitmap_data, xbm_load, xpm_lookup_color)
(xpm_image_p, x_create_bitmap_from_xpm_data, xpm_load)
(init_color_table, x_build_heuristic_mask, pbm_image_p, pbm_load)
(png_image_p, png_read_from_memory, png_load, jpeg_image_p)
(tiff_image_p, tiff_read_from_memory, gif_image_p)
(gif_read_from_memory, gif_load, svg_image_p, gs_image_p):
Likewise.
* indent.c (scan_for_column, compute_motion): Likewise.
* insdel.c (gap_left, gap_right, make_gap_smaller, copy_text)
(insert_1_both, insert_from_gap, replace_range_2): Likewise.
* intervals.c (reproduce_tree, reproduce_tree_obj): Likewise.
* keyboard.c (echo_char, save_getcjmp, restore_getcjmp)
(kbd_buffer_store_event_hold, apply_modifiers_uncached)
(store_user_signal_events, menu_bar_items, tool_bar_items)
(process_tool_bar_item, append_tool_bar_item)
(read_char_minibuf_menu_prompt, read_key_sequence)
(Fread_key_sequence, Fread_key_sequence_vector, Frecent_keys):
Likewise.
* keymap.c (current_minor_maps, Fdescribe_buffer_bindings):
Likewise.
* lisp.h (STRING_COPYIN): Likewise.
* lread.c (Fload, read1, oblookup): Likewise.
* msdos.c (Frecent_doskeys): Likewise.
* nsfns.m (Fx_create_frame): Likewise.
* nsfont.m (nsfont_open, nsfont_text_extents, ns_glyph_metrics):
Likewise.
* nsimage.m (EmacsImage-initFromSkipXBM:width:height:)
(EmacsImage-initForXPMWithDepth:width:height:flip:length:):
Likewise.
* nsmenu.m (ns_update_menubar): Likewise.
* nsterm.m (ns_draw_fringe_bitmap, ns_term_init): Likewise.
* print.c (print_unwind, printchar, strout, print_string)
(print_error_message): Likewise.
* process.c (conv_lisp_to_sockaddr, set_socket_option)
(Fmake_network_process, Fnetwork_interface_list)
(Fnetwork_interface_info, read_process_output, Fprocess_send_eof)
(init_process): Likewise.
* ralloc.c (resize_bloc, r_alloc_sbrk, r_alloc_init): Likewise.
* regex.c (init_syntax_once, regex_compile, re_compile_fastmap):
Likewise.
* scroll.c (do_scrolling, do_direct_scrolling)
(scrolling_max_lines_saved): Likewise.
* search.c (search_buffer, wordify, Freplace_match): Likewise.
* sound.c (wav_init, au_init, Fplay_sound_internal): Likewise.
* syntax.c (skip_chars, skip_syntaxes): Likewise.
* sysdep.c (child_setup_tty, sys_subshell, emacs_get_tty)
(emacs_set_tty): Likewise.
* term.c (encode_terminal_code, calculate_costs)
(produce_special_glyphs, create_tty_output, init_tty, delete_tty):
Likewise.
* termcap.c (tgetst1, gobble_line): Likewise.
* termhooks.h (EVENT_INIT): Likewise.
* tparam.c (tparam1): Likewise.
* unexalpha.c (unexec): Likewise.
* unexec.c (write_segment): Likewise.
* unexmacosx.c (unexec_write_zero): Likewise.
* w32fns.c (w32_wnd_proc, Fx_create_frame, x_create_tip_frame)
(Fx_file_dialog, Fsystem_move_file_to_trash): Likewise.
* w32font.c (w32font_list_family, w32font_text_extents)
(w32font_list_internal, w32font_match_internal)
(w32font_open_internal, compute_metrics, Fx_select_font):
Likewise.
* w32menu.c (set_frame_menubar, add_menu_item)
(w32_menu_display_help, w32_free_submenu_strings): Likewise.
* w32term.c (XCreateGC, w32_initialize_display_info): Likewise.
* w32uniscribe.c (uniscribe_list_family): Likewise.
* w32xfns.c (get_next_msg, post_msg, prepend_msg): Likewise.
* window.c (make_window, replace_window, set_window_buffer)
(Fsplit_window): Likewise.
* xdisp.c (init_iterator, RECORD_OVERLAY_STRING, reseat_to_string)
(add_to_log, message3, x_consider_frame_title)
(append_space_for_newline, extend_face_to_end_of_line)
(decode_mode_spec_coding, init_glyph_string): Likewise.
* xfaces.c (x_create_gc, get_lface_attributes_no_remap)
(Finternal_copy_lisp_face, Finternal_merge_in_global_face)
(face_attr_equal_p, make_realized_face, make_face_cache)
(free_realized_faces, lookup_named_face, smaller_face)
(face_with_height, lookup_derived_face)
(x_supports_face_attributes_p, Finternal_set_font_selection_order)
(Finternal_set_font_selection_order, realize_default_face)
(compute_char_face, face_at_buffer_position)
(face_for_overlay_string, face_at_string_position, merge_faces):
Likewise.
* xfns.c (xic_create_fontsetname, Fx_create_frame)
(Fx_window_property, x_create_tip_frame)
(Fx_backspace_delete_keys_p): Likewise.
* xfont.c (xfont_list, xfont_match, xfont_list_family)
(xfont_text_extents): Likewise.
* xmenu.c (set_frame_menubar, xmenu_show): Likewise.
* xrdb.c (magic_file_p, x_get_resource): Likewise.
* xselect.c (x_queue_event, x_get_window_property)
(receive_incremental_selection): Likewise.
* xsmfns.c (x_session_check_input): Likewise.
* xterm.c (x_send_scroll_bar_event, SET_SAVED_MENU_EVENT)
(handle_one_xevent, x_check_errors, xim_initialize, x_term_init):
Likewise.
* character.h (BCOPY_SHORT): Removed.
* config.in: Regenerate.
* dispnew.c (safe_bcopy): Only define as dummy if PROFILING.
* emacs.c (main) [PROFILING]: Don't declare
dump_opcode_frequencies.
* lisp.h (safe_bcopy): Remove declaration.
(memset) [!HAVE_MEMSET]: Declare.
(memcpy) [!HAVE_MEMCPY]: Likewise.
(memmove) [!HAVE_MEMMOVE]: Likewise.
(memcmp) [!HAVE_MEMCMP]: Likewise.
* s/ms-w32.h (bzero, bcopy, bcmp, GAP_USE_BCOPY)
(BCOPY_UPWARD_SAFE, BCOPY_DOWNWARD_SAFE, HAVE_BCOPY, HAVE_BCMP):
Don't define.
(HAVE_MEMCMP, HAVE_MEMCPY, HAVE_MEMMOVE, HAVE_MEMSET): Define.
* s/msdos.h (GAP_USE_BCOPY, BCOPY_UPWARD_SAFE)
(BCOPY_DOWNWARD_SAFE): Don't define.
* sysdep.c (memset) [!HAVE_MEMSET]: Define.
(memcpy) [!HAVE_MEMCPY]: Define.
(memmove) [!HAVE_MEMMOVE]: Define.
(memcmp) [!HAVE_MEMCMP]: Define.
* config.nt (HAVE_BCOPY, HAVE_BCMP): Remove undefs.
(HAVE_MEMCPY, HAVE_MEMMOVE, HAVE_MEMSET, HAVE_MEMCMP): Add undefs.
* sed2v2.inp (HAVE_MEMCPY, HAVE_MEMSET): Edit to 1.
(HAVE_BZERO): Don't edit.
* lwlib.c (lwlib_memset, lwlib_bcopy): Remove.
(malloc_widget_value, free_widget_info, allocate_widget_instance)
(lw_separator_p): Replace lwlib_memset, lwlib_bcopy, bzero, bcmp by
memset, memcpy, memcmp.
* lwlib-utils.c (XtApplyToWidgets): Likewise.
* xlwmenu.c (XlwMenuInitialize): Likewise.
* lwlib.h (lwlib_bcopy): Remove declaration.
* ebrowse.c (add_sym, make_namespace): Replace bcopy, bzero by
memcpy, memmove, memset.
* pop.c (pop_retrieve, socket_connection, pop_getline): Likewise.
* CPP-DEFINES (BCOPY_DOWNWARD_SAFE, BCOPY_UPWARD_SAFE)
(GAP_USE_BCOPY, HAVE_BCMP, HAVE_BCOPY, bcmp, bcopy, bzero):
Remove.
* configure.in: Don't check for bcopy, bcmp, bzero. Don't include
<strings.h> and don't define bcopy, bzero, BCMP in config.h.
2010-07-08 00:18:28 +02:00
|
|
|
|
memcpy (datagram_address[s].sa, lres->ai_addr, lres->ai_addrlen);
|
(Qlocal, QCname, QCbuffer, QChost, QCservice, QCfamily)
(QClocal, QCremote, QCserver, QCdatagram, QCnowait, QCnoquery,QCstop)
(QCcoding, QCoptions, QCfilter, QCsentinel, QClog, QCfeature):
New variables.
(NETCONN1_P): New macro.
(DATAGRAM_SOCKETS): New conditional symbol.
(datagram_address): New array.
(DATAGRAM_CONN_P, DATAGRAM_CHAN_P): New macros.
(status_message): Use concat3.
(Fprocess_status): Add `listen' status to doc string. Return `stop'
for a stopped network process.
(Fset_process_buffer): Update contact plist for network process.
(Fset_process_filter): Ditto. Don't enable input for stopped
network processes. Server must listen, even if filter is t.
(Fset_process_query_on_exit_flag, Fprocess_query_on_exit_flag):
New functions.
(Fprocess_kill_without_query): Removed. Now defined in simple.el.
(Fprocess_contact): Added KEY argument. Handle datagrams.
(list_processes_1): Optionally show only processes with the query
on exit flag set. Dynamically adjust column widths. Omit tty
column if not needed. Report stopped network processes.
Identify server and datagram network processes.
(Flist_processes): New optional arg `query-only'.
(conv_sockaddr_to_lisp, get_lisp_to_sockaddr_size)
(conv_lisp_to_sockaddr, set_socket_options)
(network_process_featurep, unwind_request_sigio): New helper functions.
(Fprocess_datagram_address, Fset_process_datagram_address):
(Fset_network_process_options): New lisp functions.
(Fopen_network_stream): Removed. Now defined in simple.el.
(Fmake_network_process): New lisp function. Code is based on previous
Fopen_network_stream, but heavily reworked with new property list based
argument list, support for datagrams, server processes, and local
sockets in addition to old client-only functionality.
(server_accept_connection): New function.
(wait_reading_process_input): Use it to handle incoming connects.
Do not enable input on a new connection if process is stopped.
(read_process_output): Handle datagram sockets. Use 2k buffer for them.
(send_process): Handle datagram sockets.
(Fstop_process, Fcontinue_process): Apply to network processes. A stopped
network process is indicated by setting command field to t .
(Fprocess_send_eof): No-op if datagram connection.
(Fstatus_notify): Don't read input for a stream server socket or a
stopped network process.
(init_process): Initialize datagram_address array.
(syms_of_process): Intern and staticpro new variables, defsubr new
functions.
2002-03-17 20:20:33 +00:00
|
|
|
|
}
|
|
|
|
|
#endif
|
2003-02-04 14:56:31 +00:00
|
|
|
|
contact = Fplist_put (contact, QCaddress,
|
(Qlocal, QCname, QCbuffer, QChost, QCservice, QCfamily)
(QClocal, QCremote, QCserver, QCdatagram, QCnowait, QCnoquery,QCstop)
(QCcoding, QCoptions, QCfilter, QCsentinel, QClog, QCfeature):
New variables.
(NETCONN1_P): New macro.
(DATAGRAM_SOCKETS): New conditional symbol.
(datagram_address): New array.
(DATAGRAM_CONN_P, DATAGRAM_CHAN_P): New macros.
(status_message): Use concat3.
(Fprocess_status): Add `listen' status to doc string. Return `stop'
for a stopped network process.
(Fset_process_buffer): Update contact plist for network process.
(Fset_process_filter): Ditto. Don't enable input for stopped
network processes. Server must listen, even if filter is t.
(Fset_process_query_on_exit_flag, Fprocess_query_on_exit_flag):
New functions.
(Fprocess_kill_without_query): Removed. Now defined in simple.el.
(Fprocess_contact): Added KEY argument. Handle datagrams.
(list_processes_1): Optionally show only processes with the query
on exit flag set. Dynamically adjust column widths. Omit tty
column if not needed. Report stopped network processes.
Identify server and datagram network processes.
(Flist_processes): New optional arg `query-only'.
(conv_sockaddr_to_lisp, get_lisp_to_sockaddr_size)
(conv_lisp_to_sockaddr, set_socket_options)
(network_process_featurep, unwind_request_sigio): New helper functions.
(Fprocess_datagram_address, Fset_process_datagram_address):
(Fset_network_process_options): New lisp functions.
(Fopen_network_stream): Removed. Now defined in simple.el.
(Fmake_network_process): New lisp function. Code is based on previous
Fopen_network_stream, but heavily reworked with new property list based
argument list, support for datagrams, server processes, and local
sockets in addition to old client-only functionality.
(server_accept_connection): New function.
(wait_reading_process_input): Use it to handle incoming connects.
Do not enable input on a new connection if process is stopped.
(read_process_output): Handle datagram sockets. Use 2k buffer for them.
(send_process): Handle datagram sockets.
(Fstop_process, Fcontinue_process): Apply to network processes. A stopped
network process is indicated by setting command field to t .
(Fprocess_send_eof): No-op if datagram connection.
(Fstatus_notify): Don't read input for a stream server socket or a
stopped network process.
(init_process): Initialize datagram_address array.
(syms_of_process): Intern and staticpro new variables, defsubr new
functions.
2002-03-17 20:20:33 +00:00
|
|
|
|
conv_sockaddr_to_lisp (lres->ai_addr, lres->ai_addrlen));
|
2003-01-08 10:38:06 +00:00
|
|
|
|
#ifdef HAVE_GETSOCKNAME
|
|
|
|
|
if (!is_server)
|
|
|
|
|
{
|
|
|
|
|
struct sockaddr_in sa1;
|
|
|
|
|
int len1 = sizeof (sa1);
|
|
|
|
|
if (getsockname (s, (struct sockaddr *)&sa1, &len1) == 0)
|
|
|
|
|
contact = Fplist_put (contact, QClocal,
|
2010-07-05 12:36:06 +02:00
|
|
|
|
conv_sockaddr_to_lisp ((struct sockaddr *)&sa1, len1));
|
2003-01-08 10:38:06 +00:00
|
|
|
|
}
|
|
|
|
|
#endif
|
(Qlocal, QCname, QCbuffer, QChost, QCservice, QCfamily)
(QClocal, QCremote, QCserver, QCdatagram, QCnowait, QCnoquery,QCstop)
(QCcoding, QCoptions, QCfilter, QCsentinel, QClog, QCfeature):
New variables.
(NETCONN1_P): New macro.
(DATAGRAM_SOCKETS): New conditional symbol.
(datagram_address): New array.
(DATAGRAM_CONN_P, DATAGRAM_CHAN_P): New macros.
(status_message): Use concat3.
(Fprocess_status): Add `listen' status to doc string. Return `stop'
for a stopped network process.
(Fset_process_buffer): Update contact plist for network process.
(Fset_process_filter): Ditto. Don't enable input for stopped
network processes. Server must listen, even if filter is t.
(Fset_process_query_on_exit_flag, Fprocess_query_on_exit_flag):
New functions.
(Fprocess_kill_without_query): Removed. Now defined in simple.el.
(Fprocess_contact): Added KEY argument. Handle datagrams.
(list_processes_1): Optionally show only processes with the query
on exit flag set. Dynamically adjust column widths. Omit tty
column if not needed. Report stopped network processes.
Identify server and datagram network processes.
(Flist_processes): New optional arg `query-only'.
(conv_sockaddr_to_lisp, get_lisp_to_sockaddr_size)
(conv_lisp_to_sockaddr, set_socket_options)
(network_process_featurep, unwind_request_sigio): New helper functions.
(Fprocess_datagram_address, Fset_process_datagram_address):
(Fset_network_process_options): New lisp functions.
(Fopen_network_stream): Removed. Now defined in simple.el.
(Fmake_network_process): New lisp function. Code is based on previous
Fopen_network_stream, but heavily reworked with new property list based
argument list, support for datagrams, server processes, and local
sockets in addition to old client-only functionality.
(server_accept_connection): New function.
(wait_reading_process_input): Use it to handle incoming connects.
Do not enable input on a new connection if process is stopped.
(read_process_output): Handle datagram sockets. Use 2k buffer for them.
(send_process): Handle datagram sockets.
(Fstop_process, Fcontinue_process): Apply to network processes. A stopped
network process is indicated by setting command field to t .
(Fprocess_send_eof): No-op if datagram connection.
(Fstatus_notify): Don't read input for a stream server socket or a
stopped network process.
(init_process): Initialize datagram_address array.
(syms_of_process): Intern and staticpro new variables, defsubr new
functions.
2002-03-17 20:20:33 +00:00
|
|
|
|
}
|
|
|
|
|
|
2007-03-20 08:51:03 +00:00
|
|
|
|
immediate_quit = 0;
|
|
|
|
|
|
2002-02-28 23:53:59 +00:00
|
|
|
|
#ifdef HAVE_GETADDRINFO
|
(Qlocal, QCname, QCbuffer, QChost, QCservice, QCfamily)
(QClocal, QCremote, QCserver, QCdatagram, QCnowait, QCnoquery,QCstop)
(QCcoding, QCoptions, QCfilter, QCsentinel, QClog, QCfeature):
New variables.
(NETCONN1_P): New macro.
(DATAGRAM_SOCKETS): New conditional symbol.
(datagram_address): New array.
(DATAGRAM_CONN_P, DATAGRAM_CHAN_P): New macros.
(status_message): Use concat3.
(Fprocess_status): Add `listen' status to doc string. Return `stop'
for a stopped network process.
(Fset_process_buffer): Update contact plist for network process.
(Fset_process_filter): Ditto. Don't enable input for stopped
network processes. Server must listen, even if filter is t.
(Fset_process_query_on_exit_flag, Fprocess_query_on_exit_flag):
New functions.
(Fprocess_kill_without_query): Removed. Now defined in simple.el.
(Fprocess_contact): Added KEY argument. Handle datagrams.
(list_processes_1): Optionally show only processes with the query
on exit flag set. Dynamically adjust column widths. Omit tty
column if not needed. Report stopped network processes.
Identify server and datagram network processes.
(Flist_processes): New optional arg `query-only'.
(conv_sockaddr_to_lisp, get_lisp_to_sockaddr_size)
(conv_lisp_to_sockaddr, set_socket_options)
(network_process_featurep, unwind_request_sigio): New helper functions.
(Fprocess_datagram_address, Fset_process_datagram_address):
(Fset_network_process_options): New lisp functions.
(Fopen_network_stream): Removed. Now defined in simple.el.
(Fmake_network_process): New lisp function. Code is based on previous
Fopen_network_stream, but heavily reworked with new property list based
argument list, support for datagrams, server processes, and local
sockets in addition to old client-only functionality.
(server_accept_connection): New function.
(wait_reading_process_input): Use it to handle incoming connects.
Do not enable input on a new connection if process is stopped.
(read_process_output): Handle datagram sockets. Use 2k buffer for them.
(send_process): Handle datagram sockets.
(Fstop_process, Fcontinue_process): Apply to network processes. A stopped
network process is indicated by setting command field to t .
(Fprocess_send_eof): No-op if datagram connection.
(Fstatus_notify): Don't read input for a stream server socket or a
stopped network process.
(init_process): Initialize datagram_address array.
(syms_of_process): Intern and staticpro new variables, defsubr new
functions.
2002-03-17 20:20:33 +00:00
|
|
|
|
if (res != &ai)
|
2007-03-20 08:51:03 +00:00
|
|
|
|
{
|
|
|
|
|
BLOCK_INPUT;
|
|
|
|
|
freeaddrinfo (res);
|
|
|
|
|
UNBLOCK_INPUT;
|
|
|
|
|
}
|
2002-02-28 23:53:59 +00:00
|
|
|
|
#endif
|
|
|
|
|
|
(Qlocal, QCname, QCbuffer, QChost, QCservice, QCfamily)
(QClocal, QCremote, QCserver, QCdatagram, QCnowait, QCnoquery,QCstop)
(QCcoding, QCoptions, QCfilter, QCsentinel, QClog, QCfeature):
New variables.
(NETCONN1_P): New macro.
(DATAGRAM_SOCKETS): New conditional symbol.
(datagram_address): New array.
(DATAGRAM_CONN_P, DATAGRAM_CHAN_P): New macros.
(status_message): Use concat3.
(Fprocess_status): Add `listen' status to doc string. Return `stop'
for a stopped network process.
(Fset_process_buffer): Update contact plist for network process.
(Fset_process_filter): Ditto. Don't enable input for stopped
network processes. Server must listen, even if filter is t.
(Fset_process_query_on_exit_flag, Fprocess_query_on_exit_flag):
New functions.
(Fprocess_kill_without_query): Removed. Now defined in simple.el.
(Fprocess_contact): Added KEY argument. Handle datagrams.
(list_processes_1): Optionally show only processes with the query
on exit flag set. Dynamically adjust column widths. Omit tty
column if not needed. Report stopped network processes.
Identify server and datagram network processes.
(Flist_processes): New optional arg `query-only'.
(conv_sockaddr_to_lisp, get_lisp_to_sockaddr_size)
(conv_lisp_to_sockaddr, set_socket_options)
(network_process_featurep, unwind_request_sigio): New helper functions.
(Fprocess_datagram_address, Fset_process_datagram_address):
(Fset_network_process_options): New lisp functions.
(Fopen_network_stream): Removed. Now defined in simple.el.
(Fmake_network_process): New lisp function. Code is based on previous
Fopen_network_stream, but heavily reworked with new property list based
argument list, support for datagrams, server processes, and local
sockets in addition to old client-only functionality.
(server_accept_connection): New function.
(wait_reading_process_input): Use it to handle incoming connects.
Do not enable input on a new connection if process is stopped.
(read_process_output): Handle datagram sockets. Use 2k buffer for them.
(send_process): Handle datagram sockets.
(Fstop_process, Fcontinue_process): Apply to network processes. A stopped
network process is indicated by setting command field to t .
(Fprocess_send_eof): No-op if datagram connection.
(Fstatus_notify): Don't read input for a stream server socket or a
stopped network process.
(init_process): Initialize datagram_address array.
(syms_of_process): Intern and staticpro new variables, defsubr new
functions.
2002-03-17 20:20:33 +00:00
|
|
|
|
/* Discard the unwind protect for closing S, if any. */
|
|
|
|
|
specpdl_ptr = specpdl + count1;
|
|
|
|
|
|
|
|
|
|
/* Unwind bind_polling_period and request_sigio. */
|
|
|
|
|
unbind_to (count, Qnil);
|
|
|
|
|
|
2002-02-28 23:53:59 +00:00
|
|
|
|
if (s < 0)
|
|
|
|
|
{
|
|
|
|
|
/* If non-blocking got this far - and failed - assume non-blocking is
|
|
|
|
|
not supported after all. This is probably a wrong assumption, but
|
(Qlocal, QCname, QCbuffer, QChost, QCservice, QCfamily)
(QClocal, QCremote, QCserver, QCdatagram, QCnowait, QCnoquery,QCstop)
(QCcoding, QCoptions, QCfilter, QCsentinel, QClog, QCfeature):
New variables.
(NETCONN1_P): New macro.
(DATAGRAM_SOCKETS): New conditional symbol.
(datagram_address): New array.
(DATAGRAM_CONN_P, DATAGRAM_CHAN_P): New macros.
(status_message): Use concat3.
(Fprocess_status): Add `listen' status to doc string. Return `stop'
for a stopped network process.
(Fset_process_buffer): Update contact plist for network process.
(Fset_process_filter): Ditto. Don't enable input for stopped
network processes. Server must listen, even if filter is t.
(Fset_process_query_on_exit_flag, Fprocess_query_on_exit_flag):
New functions.
(Fprocess_kill_without_query): Removed. Now defined in simple.el.
(Fprocess_contact): Added KEY argument. Handle datagrams.
(list_processes_1): Optionally show only processes with the query
on exit flag set. Dynamically adjust column widths. Omit tty
column if not needed. Report stopped network processes.
Identify server and datagram network processes.
(Flist_processes): New optional arg `query-only'.
(conv_sockaddr_to_lisp, get_lisp_to_sockaddr_size)
(conv_lisp_to_sockaddr, set_socket_options)
(network_process_featurep, unwind_request_sigio): New helper functions.
(Fprocess_datagram_address, Fset_process_datagram_address):
(Fset_network_process_options): New lisp functions.
(Fopen_network_stream): Removed. Now defined in simple.el.
(Fmake_network_process): New lisp function. Code is based on previous
Fopen_network_stream, but heavily reworked with new property list based
argument list, support for datagrams, server processes, and local
sockets in addition to old client-only functionality.
(server_accept_connection): New function.
(wait_reading_process_input): Use it to handle incoming connects.
Do not enable input on a new connection if process is stopped.
(read_process_output): Handle datagram sockets. Use 2k buffer for them.
(send_process): Handle datagram sockets.
(Fstop_process, Fcontinue_process): Apply to network processes. A stopped
network process is indicated by setting command field to t .
(Fprocess_send_eof): No-op if datagram connection.
(Fstatus_notify): Don't read input for a stream server socket or a
stopped network process.
(init_process): Initialize datagram_address array.
(syms_of_process): Intern and staticpro new variables, defsubr new
functions.
2002-03-17 20:20:33 +00:00
|
|
|
|
the normal blocking calls to open-network-stream handles this error
|
|
|
|
|
better. */
|
|
|
|
|
if (is_non_blocking_client)
|
2002-02-28 23:53:59 +00:00
|
|
|
|
return Qnil;
|
|
|
|
|
|
1992-03-14 20:40:04 +00:00
|
|
|
|
errno = xerrno;
|
(Qlocal, QCname, QCbuffer, QChost, QCservice, QCfamily)
(QClocal, QCremote, QCserver, QCdatagram, QCnowait, QCnoquery,QCstop)
(QCcoding, QCoptions, QCfilter, QCsentinel, QClog, QCfeature):
New variables.
(NETCONN1_P): New macro.
(DATAGRAM_SOCKETS): New conditional symbol.
(datagram_address): New array.
(DATAGRAM_CONN_P, DATAGRAM_CHAN_P): New macros.
(status_message): Use concat3.
(Fprocess_status): Add `listen' status to doc string. Return `stop'
for a stopped network process.
(Fset_process_buffer): Update contact plist for network process.
(Fset_process_filter): Ditto. Don't enable input for stopped
network processes. Server must listen, even if filter is t.
(Fset_process_query_on_exit_flag, Fprocess_query_on_exit_flag):
New functions.
(Fprocess_kill_without_query): Removed. Now defined in simple.el.
(Fprocess_contact): Added KEY argument. Handle datagrams.
(list_processes_1): Optionally show only processes with the query
on exit flag set. Dynamically adjust column widths. Omit tty
column if not needed. Report stopped network processes.
Identify server and datagram network processes.
(Flist_processes): New optional arg `query-only'.
(conv_sockaddr_to_lisp, get_lisp_to_sockaddr_size)
(conv_lisp_to_sockaddr, set_socket_options)
(network_process_featurep, unwind_request_sigio): New helper functions.
(Fprocess_datagram_address, Fset_process_datagram_address):
(Fset_network_process_options): New lisp functions.
(Fopen_network_stream): Removed. Now defined in simple.el.
(Fmake_network_process): New lisp function. Code is based on previous
Fopen_network_stream, but heavily reworked with new property list based
argument list, support for datagrams, server processes, and local
sockets in addition to old client-only functionality.
(server_accept_connection): New function.
(wait_reading_process_input): Use it to handle incoming connects.
Do not enable input on a new connection if process is stopped.
(read_process_output): Handle datagram sockets. Use 2k buffer for them.
(send_process): Handle datagram sockets.
(Fstop_process, Fcontinue_process): Apply to network processes. A stopped
network process is indicated by setting command field to t .
(Fprocess_send_eof): No-op if datagram connection.
(Fstatus_notify): Don't read input for a stream server socket or a
stopped network process.
(init_process): Initialize datagram_address array.
(syms_of_process): Intern and staticpro new variables, defsubr new
functions.
2002-03-17 20:20:33 +00:00
|
|
|
|
if (is_server)
|
|
|
|
|
report_file_error ("make server process failed", contact);
|
|
|
|
|
else
|
|
|
|
|
report_file_error ("make client process failed", contact);
|
1992-03-14 20:40:04 +00:00
|
|
|
|
}
|
1994-05-13 08:31:05 +00:00
|
|
|
|
|
1992-03-14 20:40:04 +00:00
|
|
|
|
inch = s;
|
1997-03-25 03:52:53 +00:00
|
|
|
|
outch = s;
|
1992-03-14 20:40:04 +00:00
|
|
|
|
|
|
|
|
|
if (!NILP (buffer))
|
|
|
|
|
buffer = Fget_buffer_create (buffer);
|
|
|
|
|
proc = make_process (name);
|
|
|
|
|
|
|
|
|
|
chan_process[inch] = proc;
|
|
|
|
|
|
|
|
|
|
#ifdef O_NONBLOCK
|
|
|
|
|
fcntl (inch, F_SETFL, O_NONBLOCK);
|
|
|
|
|
#else
|
|
|
|
|
#ifdef O_NDELAY
|
|
|
|
|
fcntl (inch, F_SETFL, O_NDELAY);
|
|
|
|
|
#endif
|
|
|
|
|
#endif
|
|
|
|
|
|
(Qlocal, QCname, QCbuffer, QChost, QCservice, QCfamily)
(QClocal, QCremote, QCserver, QCdatagram, QCnowait, QCnoquery,QCstop)
(QCcoding, QCoptions, QCfilter, QCsentinel, QClog, QCfeature):
New variables.
(NETCONN1_P): New macro.
(DATAGRAM_SOCKETS): New conditional symbol.
(datagram_address): New array.
(DATAGRAM_CONN_P, DATAGRAM_CHAN_P): New macros.
(status_message): Use concat3.
(Fprocess_status): Add `listen' status to doc string. Return `stop'
for a stopped network process.
(Fset_process_buffer): Update contact plist for network process.
(Fset_process_filter): Ditto. Don't enable input for stopped
network processes. Server must listen, even if filter is t.
(Fset_process_query_on_exit_flag, Fprocess_query_on_exit_flag):
New functions.
(Fprocess_kill_without_query): Removed. Now defined in simple.el.
(Fprocess_contact): Added KEY argument. Handle datagrams.
(list_processes_1): Optionally show only processes with the query
on exit flag set. Dynamically adjust column widths. Omit tty
column if not needed. Report stopped network processes.
Identify server and datagram network processes.
(Flist_processes): New optional arg `query-only'.
(conv_sockaddr_to_lisp, get_lisp_to_sockaddr_size)
(conv_lisp_to_sockaddr, set_socket_options)
(network_process_featurep, unwind_request_sigio): New helper functions.
(Fprocess_datagram_address, Fset_process_datagram_address):
(Fset_network_process_options): New lisp functions.
(Fopen_network_stream): Removed. Now defined in simple.el.
(Fmake_network_process): New lisp function. Code is based on previous
Fopen_network_stream, but heavily reworked with new property list based
argument list, support for datagrams, server processes, and local
sockets in addition to old client-only functionality.
(server_accept_connection): New function.
(wait_reading_process_input): Use it to handle incoming connects.
Do not enable input on a new connection if process is stopped.
(read_process_output): Handle datagram sockets. Use 2k buffer for them.
(send_process): Handle datagram sockets.
(Fstop_process, Fcontinue_process): Apply to network processes. A stopped
network process is indicated by setting command field to t .
(Fprocess_send_eof): No-op if datagram connection.
(Fstatus_notify): Don't read input for a stream server socket or a
stopped network process.
(init_process): Initialize datagram_address array.
(syms_of_process): Intern and staticpro new variables, defsubr new
functions.
2002-03-17 20:20:33 +00:00
|
|
|
|
p = XPROCESS (proc);
|
|
|
|
|
|
|
|
|
|
p->childp = contact;
|
2003-01-14 09:55:50 +00:00
|
|
|
|
p->plist = Fcopy_sequence (Fplist_get (contact, QCplist));
|
Daniel Engeler <engeler at gmail.com>
These changes add serial port access.
* process.c: Add HAVE_SERIAL.
(Fdelete_process, Fprocess_status, Fset_process_buffer)
(Fset_process_filter, Fset_process_sentinel, Fprocess_contact)
(list_processes_1, select_wrapper, Fstop_process)
(Fcontinue_process, Fprocess_send_eof, kill_buffer_processes)
(status_notify): Modify to handle serial processes.
[HAVE_SERIAL] (Fserial_process_configure)
[HAVE_SERIAL] (make_serial_process_unwind, Fmake_serial_process):
New functions.
* process.h (struct Lisp_Process): Add `type'.
* sysdep.c [HAVE_TERMIOS] (serial_open, serial_configure):
New functions.
* w32.c (_sys_read_ahead, sys_read, sys_write): Modify to handle serial ports.
(serial_open, serial_configure) New functions.
* w32.h: Add FILE_SERIAL.
(struct _child_process): Add ovl_read, ovl_write.
2008-06-13 08:08:20 +00:00
|
|
|
|
p->type = Qnetwork;
|
2003-02-04 14:56:31 +00:00
|
|
|
|
|
(Qlocal, QCname, QCbuffer, QChost, QCservice, QCfamily)
(QClocal, QCremote, QCserver, QCdatagram, QCnowait, QCnoquery,QCstop)
(QCcoding, QCoptions, QCfilter, QCsentinel, QClog, QCfeature):
New variables.
(NETCONN1_P): New macro.
(DATAGRAM_SOCKETS): New conditional symbol.
(datagram_address): New array.
(DATAGRAM_CONN_P, DATAGRAM_CHAN_P): New macros.
(status_message): Use concat3.
(Fprocess_status): Add `listen' status to doc string. Return `stop'
for a stopped network process.
(Fset_process_buffer): Update contact plist for network process.
(Fset_process_filter): Ditto. Don't enable input for stopped
network processes. Server must listen, even if filter is t.
(Fset_process_query_on_exit_flag, Fprocess_query_on_exit_flag):
New functions.
(Fprocess_kill_without_query): Removed. Now defined in simple.el.
(Fprocess_contact): Added KEY argument. Handle datagrams.
(list_processes_1): Optionally show only processes with the query
on exit flag set. Dynamically adjust column widths. Omit tty
column if not needed. Report stopped network processes.
Identify server and datagram network processes.
(Flist_processes): New optional arg `query-only'.
(conv_sockaddr_to_lisp, get_lisp_to_sockaddr_size)
(conv_lisp_to_sockaddr, set_socket_options)
(network_process_featurep, unwind_request_sigio): New helper functions.
(Fprocess_datagram_address, Fset_process_datagram_address):
(Fset_network_process_options): New lisp functions.
(Fopen_network_stream): Removed. Now defined in simple.el.
(Fmake_network_process): New lisp function. Code is based on previous
Fopen_network_stream, but heavily reworked with new property list based
argument list, support for datagrams, server processes, and local
sockets in addition to old client-only functionality.
(server_accept_connection): New function.
(wait_reading_process_input): Use it to handle incoming connects.
Do not enable input on a new connection if process is stopped.
(read_process_output): Handle datagram sockets. Use 2k buffer for them.
(send_process): Handle datagram sockets.
(Fstop_process, Fcontinue_process): Apply to network processes. A stopped
network process is indicated by setting command field to t .
(Fprocess_send_eof): No-op if datagram connection.
(Fstatus_notify): Don't read input for a stream server socket or a
stopped network process.
(init_process): Initialize datagram_address array.
(syms_of_process): Intern and staticpro new variables, defsubr new
functions.
2002-03-17 20:20:33 +00:00
|
|
|
|
p->buffer = buffer;
|
|
|
|
|
p->sentinel = sentinel;
|
|
|
|
|
p->filter = filter;
|
|
|
|
|
p->log = Fplist_get (contact, QClog);
|
|
|
|
|
if (tem = Fplist_get (contact, QCnoquery), !NILP (tem))
|
(struct Lisp_Process): Turn slots infd, outfd, kill_without_query, pty_flag,
tick, update_tick, decoding_carryover, inherit_coding_system_flag,
filter_multibyte, adaptive_read_buffering, read_output_delay, and
read_output_skip from Lisp_Objects to ints. Remove unused
encoding_carryover.
2007-07-12 06:36:57 +00:00
|
|
|
|
p->kill_without_query = 1;
|
(Qlocal, QCname, QCbuffer, QChost, QCservice, QCfamily)
(QClocal, QCremote, QCserver, QCdatagram, QCnowait, QCnoquery,QCstop)
(QCcoding, QCoptions, QCfilter, QCsentinel, QClog, QCfeature):
New variables.
(NETCONN1_P): New macro.
(DATAGRAM_SOCKETS): New conditional symbol.
(datagram_address): New array.
(DATAGRAM_CONN_P, DATAGRAM_CHAN_P): New macros.
(status_message): Use concat3.
(Fprocess_status): Add `listen' status to doc string. Return `stop'
for a stopped network process.
(Fset_process_buffer): Update contact plist for network process.
(Fset_process_filter): Ditto. Don't enable input for stopped
network processes. Server must listen, even if filter is t.
(Fset_process_query_on_exit_flag, Fprocess_query_on_exit_flag):
New functions.
(Fprocess_kill_without_query): Removed. Now defined in simple.el.
(Fprocess_contact): Added KEY argument. Handle datagrams.
(list_processes_1): Optionally show only processes with the query
on exit flag set. Dynamically adjust column widths. Omit tty
column if not needed. Report stopped network processes.
Identify server and datagram network processes.
(Flist_processes): New optional arg `query-only'.
(conv_sockaddr_to_lisp, get_lisp_to_sockaddr_size)
(conv_lisp_to_sockaddr, set_socket_options)
(network_process_featurep, unwind_request_sigio): New helper functions.
(Fprocess_datagram_address, Fset_process_datagram_address):
(Fset_network_process_options): New lisp functions.
(Fopen_network_stream): Removed. Now defined in simple.el.
(Fmake_network_process): New lisp function. Code is based on previous
Fopen_network_stream, but heavily reworked with new property list based
argument list, support for datagrams, server processes, and local
sockets in addition to old client-only functionality.
(server_accept_connection): New function.
(wait_reading_process_input): Use it to handle incoming connects.
Do not enable input on a new connection if process is stopped.
(read_process_output): Handle datagram sockets. Use 2k buffer for them.
(send_process): Handle datagram sockets.
(Fstop_process, Fcontinue_process): Apply to network processes. A stopped
network process is indicated by setting command field to t .
(Fprocess_send_eof): No-op if datagram connection.
(Fstatus_notify): Don't read input for a stream server socket or a
stopped network process.
(init_process): Initialize datagram_address array.
(syms_of_process): Intern and staticpro new variables, defsubr new
functions.
2002-03-17 20:20:33 +00:00
|
|
|
|
if ((tem = Fplist_get (contact, QCstop), !NILP (tem)))
|
|
|
|
|
p->command = Qt;
|
* process.h (struct Lisp_Process): Replace Lisp_Objects `pid',
`raw_status_high', and `raw_status_low' with plain integers, and move
them to the end of the structure.
* alloc.c (allocate_process): Use PSEUDOVECSIZE to initialize the
pseudovector's size field so only the Lisp_Object fields get GC'd.
* process.c (update_status, make_process, Fdelete_process)
(Fprocess_status, list_processes_1, start_process_unwind)
(create_process, Fmake_network_process, server_accept_connection)
(wait_reading_process_output, send_process, Fprocess_running_child_p)
(process_send_signal, proc_encode_coding_system, Fprocess_send_eof)
(sigchld_handler, status_notify): Adjust to new non-Lisp fields for
`pid' and `raw_status'.
(Fprocess_id, Fsignal_process): Same, and additionally use floats when
representing PIDs that are larger than most-positive-fixnum.
2006-04-08 15:07:35 +00:00
|
|
|
|
p->pid = 0;
|
(struct Lisp_Process): Turn slots infd, outfd, kill_without_query, pty_flag,
tick, update_tick, decoding_carryover, inherit_coding_system_flag,
filter_multibyte, adaptive_read_buffering, read_output_delay, and
read_output_skip from Lisp_Objects to ints. Remove unused
encoding_carryover.
2007-07-12 06:36:57 +00:00
|
|
|
|
p->infd = inch;
|
|
|
|
|
p->outfd = outch;
|
2009-12-03 19:01:36 +00:00
|
|
|
|
if (is_server && socktype != SOCK_DGRAM)
|
(Qlocal, QCname, QCbuffer, QChost, QCservice, QCfamily)
(QClocal, QCremote, QCserver, QCdatagram, QCnowait, QCnoquery,QCstop)
(QCcoding, QCoptions, QCfilter, QCsentinel, QClog, QCfeature):
New variables.
(NETCONN1_P): New macro.
(DATAGRAM_SOCKETS): New conditional symbol.
(datagram_address): New array.
(DATAGRAM_CONN_P, DATAGRAM_CHAN_P): New macros.
(status_message): Use concat3.
(Fprocess_status): Add `listen' status to doc string. Return `stop'
for a stopped network process.
(Fset_process_buffer): Update contact plist for network process.
(Fset_process_filter): Ditto. Don't enable input for stopped
network processes. Server must listen, even if filter is t.
(Fset_process_query_on_exit_flag, Fprocess_query_on_exit_flag):
New functions.
(Fprocess_kill_without_query): Removed. Now defined in simple.el.
(Fprocess_contact): Added KEY argument. Handle datagrams.
(list_processes_1): Optionally show only processes with the query
on exit flag set. Dynamically adjust column widths. Omit tty
column if not needed. Report stopped network processes.
Identify server and datagram network processes.
(Flist_processes): New optional arg `query-only'.
(conv_sockaddr_to_lisp, get_lisp_to_sockaddr_size)
(conv_lisp_to_sockaddr, set_socket_options)
(network_process_featurep, unwind_request_sigio): New helper functions.
(Fprocess_datagram_address, Fset_process_datagram_address):
(Fset_network_process_options): New lisp functions.
(Fopen_network_stream): Removed. Now defined in simple.el.
(Fmake_network_process): New lisp function. Code is based on previous
Fopen_network_stream, but heavily reworked with new property list based
argument list, support for datagrams, server processes, and local
sockets in addition to old client-only functionality.
(server_accept_connection): New function.
(wait_reading_process_input): Use it to handle incoming connects.
Do not enable input on a new connection if process is stopped.
(read_process_output): Handle datagram sockets. Use 2k buffer for them.
(send_process): Handle datagram sockets.
(Fstop_process, Fcontinue_process): Apply to network processes. A stopped
network process is indicated by setting command field to t .
(Fprocess_send_eof): No-op if datagram connection.
(Fstatus_notify): Don't read input for a stream server socket or a
stopped network process.
(init_process): Initialize datagram_address array.
(syms_of_process): Intern and staticpro new variables, defsubr new
functions.
2002-03-17 20:20:33 +00:00
|
|
|
|
p->status = Qlisten;
|
2002-02-28 23:53:59 +00:00
|
|
|
|
|
2006-02-25 16:49:00 +00:00
|
|
|
|
/* Make the process marker point into the process buffer (if any). */
|
|
|
|
|
if (BUFFERP (buffer))
|
|
|
|
|
set_marker_both (p->mark, buffer,
|
|
|
|
|
BUF_ZV (XBUFFER (buffer)),
|
|
|
|
|
BUF_ZV_BYTE (XBUFFER (buffer)));
|
|
|
|
|
|
2002-02-28 23:53:59 +00:00
|
|
|
|
#ifdef NON_BLOCKING_CONNECT
|
(Qlocal, QCname, QCbuffer, QChost, QCservice, QCfamily)
(QClocal, QCremote, QCserver, QCdatagram, QCnowait, QCnoquery,QCstop)
(QCcoding, QCoptions, QCfilter, QCsentinel, QClog, QCfeature):
New variables.
(NETCONN1_P): New macro.
(DATAGRAM_SOCKETS): New conditional symbol.
(datagram_address): New array.
(DATAGRAM_CONN_P, DATAGRAM_CHAN_P): New macros.
(status_message): Use concat3.
(Fprocess_status): Add `listen' status to doc string. Return `stop'
for a stopped network process.
(Fset_process_buffer): Update contact plist for network process.
(Fset_process_filter): Ditto. Don't enable input for stopped
network processes. Server must listen, even if filter is t.
(Fset_process_query_on_exit_flag, Fprocess_query_on_exit_flag):
New functions.
(Fprocess_kill_without_query): Removed. Now defined in simple.el.
(Fprocess_contact): Added KEY argument. Handle datagrams.
(list_processes_1): Optionally show only processes with the query
on exit flag set. Dynamically adjust column widths. Omit tty
column if not needed. Report stopped network processes.
Identify server and datagram network processes.
(Flist_processes): New optional arg `query-only'.
(conv_sockaddr_to_lisp, get_lisp_to_sockaddr_size)
(conv_lisp_to_sockaddr, set_socket_options)
(network_process_featurep, unwind_request_sigio): New helper functions.
(Fprocess_datagram_address, Fset_process_datagram_address):
(Fset_network_process_options): New lisp functions.
(Fopen_network_stream): Removed. Now defined in simple.el.
(Fmake_network_process): New lisp function. Code is based on previous
Fopen_network_stream, but heavily reworked with new property list based
argument list, support for datagrams, server processes, and local
sockets in addition to old client-only functionality.
(server_accept_connection): New function.
(wait_reading_process_input): Use it to handle incoming connects.
Do not enable input on a new connection if process is stopped.
(read_process_output): Handle datagram sockets. Use 2k buffer for them.
(send_process): Handle datagram sockets.
(Fstop_process, Fcontinue_process): Apply to network processes. A stopped
network process is indicated by setting command field to t .
(Fprocess_send_eof): No-op if datagram connection.
(Fstatus_notify): Don't read input for a stream server socket or a
stopped network process.
(init_process): Initialize datagram_address array.
(syms_of_process): Intern and staticpro new variables, defsubr new
functions.
2002-03-17 20:20:33 +00:00
|
|
|
|
if (is_non_blocking_client)
|
2002-02-28 23:53:59 +00:00
|
|
|
|
{
|
|
|
|
|
/* We may get here if connect did succeed immediately. However,
|
|
|
|
|
in that case, we still need to signal this like a non-blocking
|
|
|
|
|
connection. */
|
(Qlocal, QCname, QCbuffer, QChost, QCservice, QCfamily)
(QClocal, QCremote, QCserver, QCdatagram, QCnowait, QCnoquery,QCstop)
(QCcoding, QCoptions, QCfilter, QCsentinel, QClog, QCfeature):
New variables.
(NETCONN1_P): New macro.
(DATAGRAM_SOCKETS): New conditional symbol.
(datagram_address): New array.
(DATAGRAM_CONN_P, DATAGRAM_CHAN_P): New macros.
(status_message): Use concat3.
(Fprocess_status): Add `listen' status to doc string. Return `stop'
for a stopped network process.
(Fset_process_buffer): Update contact plist for network process.
(Fset_process_filter): Ditto. Don't enable input for stopped
network processes. Server must listen, even if filter is t.
(Fset_process_query_on_exit_flag, Fprocess_query_on_exit_flag):
New functions.
(Fprocess_kill_without_query): Removed. Now defined in simple.el.
(Fprocess_contact): Added KEY argument. Handle datagrams.
(list_processes_1): Optionally show only processes with the query
on exit flag set. Dynamically adjust column widths. Omit tty
column if not needed. Report stopped network processes.
Identify server and datagram network processes.
(Flist_processes): New optional arg `query-only'.
(conv_sockaddr_to_lisp, get_lisp_to_sockaddr_size)
(conv_lisp_to_sockaddr, set_socket_options)
(network_process_featurep, unwind_request_sigio): New helper functions.
(Fprocess_datagram_address, Fset_process_datagram_address):
(Fset_network_process_options): New lisp functions.
(Fopen_network_stream): Removed. Now defined in simple.el.
(Fmake_network_process): New lisp function. Code is based on previous
Fopen_network_stream, but heavily reworked with new property list based
argument list, support for datagrams, server processes, and local
sockets in addition to old client-only functionality.
(server_accept_connection): New function.
(wait_reading_process_input): Use it to handle incoming connects.
Do not enable input on a new connection if process is stopped.
(read_process_output): Handle datagram sockets. Use 2k buffer for them.
(send_process): Handle datagram sockets.
(Fstop_process, Fcontinue_process): Apply to network processes. A stopped
network process is indicated by setting command field to t .
(Fprocess_send_eof): No-op if datagram connection.
(Fstatus_notify): Don't read input for a stream server socket or a
stopped network process.
(init_process): Initialize datagram_address array.
(syms_of_process): Intern and staticpro new variables, defsubr new
functions.
2002-03-17 20:20:33 +00:00
|
|
|
|
p->status = Qconnect;
|
2002-02-28 23:53:59 +00:00
|
|
|
|
if (!FD_ISSET (inch, &connect_wait_mask))
|
|
|
|
|
{
|
|
|
|
|
FD_SET (inch, &connect_wait_mask);
|
|
|
|
|
num_pending_connects++;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
#endif
|
(Qlocal, QCname, QCbuffer, QChost, QCservice, QCfamily)
(QClocal, QCremote, QCserver, QCdatagram, QCnowait, QCnoquery,QCstop)
(QCcoding, QCoptions, QCfilter, QCsentinel, QClog, QCfeature):
New variables.
(NETCONN1_P): New macro.
(DATAGRAM_SOCKETS): New conditional symbol.
(datagram_address): New array.
(DATAGRAM_CONN_P, DATAGRAM_CHAN_P): New macros.
(status_message): Use concat3.
(Fprocess_status): Add `listen' status to doc string. Return `stop'
for a stopped network process.
(Fset_process_buffer): Update contact plist for network process.
(Fset_process_filter): Ditto. Don't enable input for stopped
network processes. Server must listen, even if filter is t.
(Fset_process_query_on_exit_flag, Fprocess_query_on_exit_flag):
New functions.
(Fprocess_kill_without_query): Removed. Now defined in simple.el.
(Fprocess_contact): Added KEY argument. Handle datagrams.
(list_processes_1): Optionally show only processes with the query
on exit flag set. Dynamically adjust column widths. Omit tty
column if not needed. Report stopped network processes.
Identify server and datagram network processes.
(Flist_processes): New optional arg `query-only'.
(conv_sockaddr_to_lisp, get_lisp_to_sockaddr_size)
(conv_lisp_to_sockaddr, set_socket_options)
(network_process_featurep, unwind_request_sigio): New helper functions.
(Fprocess_datagram_address, Fset_process_datagram_address):
(Fset_network_process_options): New lisp functions.
(Fopen_network_stream): Removed. Now defined in simple.el.
(Fmake_network_process): New lisp function. Code is based on previous
Fopen_network_stream, but heavily reworked with new property list based
argument list, support for datagrams, server processes, and local
sockets in addition to old client-only functionality.
(server_accept_connection): New function.
(wait_reading_process_input): Use it to handle incoming connects.
Do not enable input on a new connection if process is stopped.
(read_process_output): Handle datagram sockets. Use 2k buffer for them.
(send_process): Handle datagram sockets.
(Fstop_process, Fcontinue_process): Apply to network processes. A stopped
network process is indicated by setting command field to t .
(Fprocess_send_eof): No-op if datagram connection.
(Fstatus_notify): Don't read input for a stream server socket or a
stopped network process.
(init_process): Initialize datagram_address array.
(syms_of_process): Intern and staticpro new variables, defsubr new
functions.
2002-03-17 20:20:33 +00:00
|
|
|
|
/* A server may have a client filter setting of Qt, but it must
|
|
|
|
|
still listen for incoming connects unless it is stopped. */
|
|
|
|
|
if ((!EQ (p->filter, Qt) && !EQ (p->command, Qt))
|
|
|
|
|
|| (EQ (p->status, Qlisten) && NILP (p->command)))
|
2002-02-28 23:53:59 +00:00
|
|
|
|
{
|
|
|
|
|
FD_SET (inch, &input_wait_mask);
|
|
|
|
|
FD_SET (inch, &non_keyboard_wait_mask);
|
|
|
|
|
}
|
|
|
|
|
|
1994-04-23 05:18:09 +00:00
|
|
|
|
if (inch > max_process_desc)
|
|
|
|
|
max_process_desc = inch;
|
1992-03-14 20:40:04 +00:00
|
|
|
|
|
(Qlocal, QCname, QCbuffer, QChost, QCservice, QCfamily)
(QClocal, QCremote, QCserver, QCdatagram, QCnowait, QCnoquery,QCstop)
(QCcoding, QCoptions, QCfilter, QCsentinel, QClog, QCfeature):
New variables.
(NETCONN1_P): New macro.
(DATAGRAM_SOCKETS): New conditional symbol.
(datagram_address): New array.
(DATAGRAM_CONN_P, DATAGRAM_CHAN_P): New macros.
(status_message): Use concat3.
(Fprocess_status): Add `listen' status to doc string. Return `stop'
for a stopped network process.
(Fset_process_buffer): Update contact plist for network process.
(Fset_process_filter): Ditto. Don't enable input for stopped
network processes. Server must listen, even if filter is t.
(Fset_process_query_on_exit_flag, Fprocess_query_on_exit_flag):
New functions.
(Fprocess_kill_without_query): Removed. Now defined in simple.el.
(Fprocess_contact): Added KEY argument. Handle datagrams.
(list_processes_1): Optionally show only processes with the query
on exit flag set. Dynamically adjust column widths. Omit tty
column if not needed. Report stopped network processes.
Identify server and datagram network processes.
(Flist_processes): New optional arg `query-only'.
(conv_sockaddr_to_lisp, get_lisp_to_sockaddr_size)
(conv_lisp_to_sockaddr, set_socket_options)
(network_process_featurep, unwind_request_sigio): New helper functions.
(Fprocess_datagram_address, Fset_process_datagram_address):
(Fset_network_process_options): New lisp functions.
(Fopen_network_stream): Removed. Now defined in simple.el.
(Fmake_network_process): New lisp function. Code is based on previous
Fopen_network_stream, but heavily reworked with new property list based
argument list, support for datagrams, server processes, and local
sockets in addition to old client-only functionality.
(server_accept_connection): New function.
(wait_reading_process_input): Use it to handle incoming connects.
Do not enable input on a new connection if process is stopped.
(read_process_output): Handle datagram sockets. Use 2k buffer for them.
(send_process): Handle datagram sockets.
(Fstop_process, Fcontinue_process): Apply to network processes. A stopped
network process is indicated by setting command field to t .
(Fprocess_send_eof): No-op if datagram connection.
(Fstatus_notify): Don't read input for a stream server socket or a
stopped network process.
(init_process): Initialize datagram_address array.
(syms_of_process): Intern and staticpro new variables, defsubr new
functions.
2002-03-17 20:20:33 +00:00
|
|
|
|
tem = Fplist_member (contact, QCcoding);
|
|
|
|
|
if (!NILP (tem) && (!CONSP (tem) || !CONSP (XCDR (tem))))
|
|
|
|
|
tem = Qnil; /* No error message (too late!). */
|
|
|
|
|
|
1998-05-10 19:21:05 +00:00
|
|
|
|
{
|
|
|
|
|
/* Setup coding systems for communicating with the network stream. */
|
|
|
|
|
struct gcpro gcpro1;
|
|
|
|
|
/* Qt denotes we have not yet called Ffind_operation_coding_system. */
|
|
|
|
|
Lisp_Object coding_systems = Qt;
|
|
|
|
|
Lisp_Object args[5], val;
|
|
|
|
|
|
(Qlocal, QCname, QCbuffer, QChost, QCservice, QCfamily)
(QClocal, QCremote, QCserver, QCdatagram, QCnowait, QCnoquery,QCstop)
(QCcoding, QCoptions, QCfilter, QCsentinel, QClog, QCfeature):
New variables.
(NETCONN1_P): New macro.
(DATAGRAM_SOCKETS): New conditional symbol.
(datagram_address): New array.
(DATAGRAM_CONN_P, DATAGRAM_CHAN_P): New macros.
(status_message): Use concat3.
(Fprocess_status): Add `listen' status to doc string. Return `stop'
for a stopped network process.
(Fset_process_buffer): Update contact plist for network process.
(Fset_process_filter): Ditto. Don't enable input for stopped
network processes. Server must listen, even if filter is t.
(Fset_process_query_on_exit_flag, Fprocess_query_on_exit_flag):
New functions.
(Fprocess_kill_without_query): Removed. Now defined in simple.el.
(Fprocess_contact): Added KEY argument. Handle datagrams.
(list_processes_1): Optionally show only processes with the query
on exit flag set. Dynamically adjust column widths. Omit tty
column if not needed. Report stopped network processes.
Identify server and datagram network processes.
(Flist_processes): New optional arg `query-only'.
(conv_sockaddr_to_lisp, get_lisp_to_sockaddr_size)
(conv_lisp_to_sockaddr, set_socket_options)
(network_process_featurep, unwind_request_sigio): New helper functions.
(Fprocess_datagram_address, Fset_process_datagram_address):
(Fset_network_process_options): New lisp functions.
(Fopen_network_stream): Removed. Now defined in simple.el.
(Fmake_network_process): New lisp function. Code is based on previous
Fopen_network_stream, but heavily reworked with new property list based
argument list, support for datagrams, server processes, and local
sockets in addition to old client-only functionality.
(server_accept_connection): New function.
(wait_reading_process_input): Use it to handle incoming connects.
Do not enable input on a new connection if process is stopped.
(read_process_output): Handle datagram sockets. Use 2k buffer for them.
(send_process): Handle datagram sockets.
(Fstop_process, Fcontinue_process): Apply to network processes. A stopped
network process is indicated by setting command field to t .
(Fprocess_send_eof): No-op if datagram connection.
(Fstatus_notify): Don't read input for a stream server socket or a
stopped network process.
(init_process): Initialize datagram_address array.
(syms_of_process): Intern and staticpro new variables, defsubr new
functions.
2002-03-17 20:20:33 +00:00
|
|
|
|
if (!NILP (tem))
|
2004-04-16 12:51:06 +00:00
|
|
|
|
{
|
|
|
|
|
val = XCAR (XCDR (tem));
|
|
|
|
|
if (CONSP (val))
|
|
|
|
|
val = XCAR (val);
|
|
|
|
|
}
|
(Qlocal, QCname, QCbuffer, QChost, QCservice, QCfamily)
(QClocal, QCremote, QCserver, QCdatagram, QCnowait, QCnoquery,QCstop)
(QCcoding, QCoptions, QCfilter, QCsentinel, QClog, QCfeature):
New variables.
(NETCONN1_P): New macro.
(DATAGRAM_SOCKETS): New conditional symbol.
(datagram_address): New array.
(DATAGRAM_CONN_P, DATAGRAM_CHAN_P): New macros.
(status_message): Use concat3.
(Fprocess_status): Add `listen' status to doc string. Return `stop'
for a stopped network process.
(Fset_process_buffer): Update contact plist for network process.
(Fset_process_filter): Ditto. Don't enable input for stopped
network processes. Server must listen, even if filter is t.
(Fset_process_query_on_exit_flag, Fprocess_query_on_exit_flag):
New functions.
(Fprocess_kill_without_query): Removed. Now defined in simple.el.
(Fprocess_contact): Added KEY argument. Handle datagrams.
(list_processes_1): Optionally show only processes with the query
on exit flag set. Dynamically adjust column widths. Omit tty
column if not needed. Report stopped network processes.
Identify server and datagram network processes.
(Flist_processes): New optional arg `query-only'.
(conv_sockaddr_to_lisp, get_lisp_to_sockaddr_size)
(conv_lisp_to_sockaddr, set_socket_options)
(network_process_featurep, unwind_request_sigio): New helper functions.
(Fprocess_datagram_address, Fset_process_datagram_address):
(Fset_network_process_options): New lisp functions.
(Fopen_network_stream): Removed. Now defined in simple.el.
(Fmake_network_process): New lisp function. Code is based on previous
Fopen_network_stream, but heavily reworked with new property list based
argument list, support for datagrams, server processes, and local
sockets in addition to old client-only functionality.
(server_accept_connection): New function.
(wait_reading_process_input): Use it to handle incoming connects.
Do not enable input on a new connection if process is stopped.
(read_process_output): Handle datagram sockets. Use 2k buffer for them.
(send_process): Handle datagram sockets.
(Fstop_process, Fcontinue_process): Apply to network processes. A stopped
network process is indicated by setting command field to t .
(Fprocess_send_eof): No-op if datagram connection.
(Fstatus_notify): Don't read input for a stream server socket or a
stopped network process.
(init_process): Initialize datagram_address array.
(syms_of_process): Intern and staticpro new variables, defsubr new
functions.
2002-03-17 20:20:33 +00:00
|
|
|
|
else if (!NILP (Vcoding_system_for_read))
|
1998-05-10 19:21:05 +00:00
|
|
|
|
val = Vcoding_system_for_read;
|
1999-09-20 00:34:43 +00:00
|
|
|
|
else if ((!NILP (buffer) && NILP (XBUFFER (buffer)->enable_multibyte_characters))
|
|
|
|
|
|| (NILP (buffer) && NILP (buffer_defaults.enable_multibyte_characters)))
|
1998-05-10 19:21:05 +00:00
|
|
|
|
/* We dare not decode end-of-line format by setting VAL to
|
|
|
|
|
Qraw_text, because the existing Emacs Lisp libraries
|
|
|
|
|
assume that they receive bare code including a sequene of
|
|
|
|
|
CR LF. */
|
|
|
|
|
val = Qnil;
|
|
|
|
|
else
|
|
|
|
|
{
|
2002-10-24 08:03:41 +00:00
|
|
|
|
if (NILP (host) || NILP (service))
|
|
|
|
|
coding_systems = Qnil;
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
args[0] = Qopen_network_stream, args[1] = name,
|
|
|
|
|
args[2] = buffer, args[3] = host, args[4] = service;
|
|
|
|
|
GCPRO1 (proc);
|
|
|
|
|
coding_systems = Ffind_operation_coding_system (5, args);
|
|
|
|
|
UNGCPRO;
|
|
|
|
|
}
|
1998-05-10 19:21:05 +00:00
|
|
|
|
if (CONSP (coding_systems))
|
1999-09-12 05:07:01 +00:00
|
|
|
|
val = XCAR (coding_systems);
|
1998-05-10 19:21:05 +00:00
|
|
|
|
else if (CONSP (Vdefault_process_coding_system))
|
1999-09-12 05:07:01 +00:00
|
|
|
|
val = XCAR (Vdefault_process_coding_system);
|
1998-05-10 19:21:05 +00:00
|
|
|
|
else
|
|
|
|
|
val = Qnil;
|
|
|
|
|
}
|
(Qlocal, QCname, QCbuffer, QChost, QCservice, QCfamily)
(QClocal, QCremote, QCserver, QCdatagram, QCnowait, QCnoquery,QCstop)
(QCcoding, QCoptions, QCfilter, QCsentinel, QClog, QCfeature):
New variables.
(NETCONN1_P): New macro.
(DATAGRAM_SOCKETS): New conditional symbol.
(datagram_address): New array.
(DATAGRAM_CONN_P, DATAGRAM_CHAN_P): New macros.
(status_message): Use concat3.
(Fprocess_status): Add `listen' status to doc string. Return `stop'
for a stopped network process.
(Fset_process_buffer): Update contact plist for network process.
(Fset_process_filter): Ditto. Don't enable input for stopped
network processes. Server must listen, even if filter is t.
(Fset_process_query_on_exit_flag, Fprocess_query_on_exit_flag):
New functions.
(Fprocess_kill_without_query): Removed. Now defined in simple.el.
(Fprocess_contact): Added KEY argument. Handle datagrams.
(list_processes_1): Optionally show only processes with the query
on exit flag set. Dynamically adjust column widths. Omit tty
column if not needed. Report stopped network processes.
Identify server and datagram network processes.
(Flist_processes): New optional arg `query-only'.
(conv_sockaddr_to_lisp, get_lisp_to_sockaddr_size)
(conv_lisp_to_sockaddr, set_socket_options)
(network_process_featurep, unwind_request_sigio): New helper functions.
(Fprocess_datagram_address, Fset_process_datagram_address):
(Fset_network_process_options): New lisp functions.
(Fopen_network_stream): Removed. Now defined in simple.el.
(Fmake_network_process): New lisp function. Code is based on previous
Fopen_network_stream, but heavily reworked with new property list based
argument list, support for datagrams, server processes, and local
sockets in addition to old client-only functionality.
(server_accept_connection): New function.
(wait_reading_process_input): Use it to handle incoming connects.
Do not enable input on a new connection if process is stopped.
(read_process_output): Handle datagram sockets. Use 2k buffer for them.
(send_process): Handle datagram sockets.
(Fstop_process, Fcontinue_process): Apply to network processes. A stopped
network process is indicated by setting command field to t .
(Fprocess_send_eof): No-op if datagram connection.
(Fstatus_notify): Don't read input for a stream server socket or a
stopped network process.
(init_process): Initialize datagram_address array.
(syms_of_process): Intern and staticpro new variables, defsubr new
functions.
2002-03-17 20:20:33 +00:00
|
|
|
|
p->decode_coding_system = val;
|
1997-02-20 06:53:55 +00:00
|
|
|
|
|
(Qlocal, QCname, QCbuffer, QChost, QCservice, QCfamily)
(QClocal, QCremote, QCserver, QCdatagram, QCnowait, QCnoquery,QCstop)
(QCcoding, QCoptions, QCfilter, QCsentinel, QClog, QCfeature):
New variables.
(NETCONN1_P): New macro.
(DATAGRAM_SOCKETS): New conditional symbol.
(datagram_address): New array.
(DATAGRAM_CONN_P, DATAGRAM_CHAN_P): New macros.
(status_message): Use concat3.
(Fprocess_status): Add `listen' status to doc string. Return `stop'
for a stopped network process.
(Fset_process_buffer): Update contact plist for network process.
(Fset_process_filter): Ditto. Don't enable input for stopped
network processes. Server must listen, even if filter is t.
(Fset_process_query_on_exit_flag, Fprocess_query_on_exit_flag):
New functions.
(Fprocess_kill_without_query): Removed. Now defined in simple.el.
(Fprocess_contact): Added KEY argument. Handle datagrams.
(list_processes_1): Optionally show only processes with the query
on exit flag set. Dynamically adjust column widths. Omit tty
column if not needed. Report stopped network processes.
Identify server and datagram network processes.
(Flist_processes): New optional arg `query-only'.
(conv_sockaddr_to_lisp, get_lisp_to_sockaddr_size)
(conv_lisp_to_sockaddr, set_socket_options)
(network_process_featurep, unwind_request_sigio): New helper functions.
(Fprocess_datagram_address, Fset_process_datagram_address):
(Fset_network_process_options): New lisp functions.
(Fopen_network_stream): Removed. Now defined in simple.el.
(Fmake_network_process): New lisp function. Code is based on previous
Fopen_network_stream, but heavily reworked with new property list based
argument list, support for datagrams, server processes, and local
sockets in addition to old client-only functionality.
(server_accept_connection): New function.
(wait_reading_process_input): Use it to handle incoming connects.
Do not enable input on a new connection if process is stopped.
(read_process_output): Handle datagram sockets. Use 2k buffer for them.
(send_process): Handle datagram sockets.
(Fstop_process, Fcontinue_process): Apply to network processes. A stopped
network process is indicated by setting command field to t .
(Fprocess_send_eof): No-op if datagram connection.
(Fstatus_notify): Don't read input for a stream server socket or a
stopped network process.
(init_process): Initialize datagram_address array.
(syms_of_process): Intern and staticpro new variables, defsubr new
functions.
2002-03-17 20:20:33 +00:00
|
|
|
|
if (!NILP (tem))
|
2004-04-16 12:51:06 +00:00
|
|
|
|
{
|
|
|
|
|
val = XCAR (XCDR (tem));
|
|
|
|
|
if (CONSP (val))
|
|
|
|
|
val = XCDR (val);
|
|
|
|
|
}
|
(Qlocal, QCname, QCbuffer, QChost, QCservice, QCfamily)
(QClocal, QCremote, QCserver, QCdatagram, QCnowait, QCnoquery,QCstop)
(QCcoding, QCoptions, QCfilter, QCsentinel, QClog, QCfeature):
New variables.
(NETCONN1_P): New macro.
(DATAGRAM_SOCKETS): New conditional symbol.
(datagram_address): New array.
(DATAGRAM_CONN_P, DATAGRAM_CHAN_P): New macros.
(status_message): Use concat3.
(Fprocess_status): Add `listen' status to doc string. Return `stop'
for a stopped network process.
(Fset_process_buffer): Update contact plist for network process.
(Fset_process_filter): Ditto. Don't enable input for stopped
network processes. Server must listen, even if filter is t.
(Fset_process_query_on_exit_flag, Fprocess_query_on_exit_flag):
New functions.
(Fprocess_kill_without_query): Removed. Now defined in simple.el.
(Fprocess_contact): Added KEY argument. Handle datagrams.
(list_processes_1): Optionally show only processes with the query
on exit flag set. Dynamically adjust column widths. Omit tty
column if not needed. Report stopped network processes.
Identify server and datagram network processes.
(Flist_processes): New optional arg `query-only'.
(conv_sockaddr_to_lisp, get_lisp_to_sockaddr_size)
(conv_lisp_to_sockaddr, set_socket_options)
(network_process_featurep, unwind_request_sigio): New helper functions.
(Fprocess_datagram_address, Fset_process_datagram_address):
(Fset_network_process_options): New lisp functions.
(Fopen_network_stream): Removed. Now defined in simple.el.
(Fmake_network_process): New lisp function. Code is based on previous
Fopen_network_stream, but heavily reworked with new property list based
argument list, support for datagrams, server processes, and local
sockets in addition to old client-only functionality.
(server_accept_connection): New function.
(wait_reading_process_input): Use it to handle incoming connects.
Do not enable input on a new connection if process is stopped.
(read_process_output): Handle datagram sockets. Use 2k buffer for them.
(send_process): Handle datagram sockets.
(Fstop_process, Fcontinue_process): Apply to network processes. A stopped
network process is indicated by setting command field to t .
(Fprocess_send_eof): No-op if datagram connection.
(Fstatus_notify): Don't read input for a stream server socket or a
stopped network process.
(init_process): Initialize datagram_address array.
(syms_of_process): Intern and staticpro new variables, defsubr new
functions.
2002-03-17 20:20:33 +00:00
|
|
|
|
else if (!NILP (Vcoding_system_for_write))
|
1998-05-10 19:21:05 +00:00
|
|
|
|
val = Vcoding_system_for_write;
|
|
|
|
|
else if (NILP (current_buffer->enable_multibyte_characters))
|
|
|
|
|
val = Qnil;
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
if (EQ (coding_systems, Qt))
|
|
|
|
|
{
|
2002-10-24 08:03:41 +00:00
|
|
|
|
if (NILP (host) || NILP (service))
|
|
|
|
|
coding_systems = Qnil;
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
args[0] = Qopen_network_stream, args[1] = name,
|
|
|
|
|
args[2] = buffer, args[3] = host, args[4] = service;
|
|
|
|
|
GCPRO1 (proc);
|
|
|
|
|
coding_systems = Ffind_operation_coding_system (5, args);
|
|
|
|
|
UNGCPRO;
|
|
|
|
|
}
|
1998-05-10 19:21:05 +00:00
|
|
|
|
}
|
|
|
|
|
if (CONSP (coding_systems))
|
1999-09-12 05:07:01 +00:00
|
|
|
|
val = XCDR (coding_systems);
|
1998-05-10 19:21:05 +00:00
|
|
|
|
else if (CONSP (Vdefault_process_coding_system))
|
1999-09-12 05:07:01 +00:00
|
|
|
|
val = XCDR (Vdefault_process_coding_system);
|
1998-05-10 19:21:05 +00:00
|
|
|
|
else
|
|
|
|
|
val = Qnil;
|
|
|
|
|
}
|
(Qlocal, QCname, QCbuffer, QChost, QCservice, QCfamily)
(QClocal, QCremote, QCserver, QCdatagram, QCnowait, QCnoquery,QCstop)
(QCcoding, QCoptions, QCfilter, QCsentinel, QClog, QCfeature):
New variables.
(NETCONN1_P): New macro.
(DATAGRAM_SOCKETS): New conditional symbol.
(datagram_address): New array.
(DATAGRAM_CONN_P, DATAGRAM_CHAN_P): New macros.
(status_message): Use concat3.
(Fprocess_status): Add `listen' status to doc string. Return `stop'
for a stopped network process.
(Fset_process_buffer): Update contact plist for network process.
(Fset_process_filter): Ditto. Don't enable input for stopped
network processes. Server must listen, even if filter is t.
(Fset_process_query_on_exit_flag, Fprocess_query_on_exit_flag):
New functions.
(Fprocess_kill_without_query): Removed. Now defined in simple.el.
(Fprocess_contact): Added KEY argument. Handle datagrams.
(list_processes_1): Optionally show only processes with the query
on exit flag set. Dynamically adjust column widths. Omit tty
column if not needed. Report stopped network processes.
Identify server and datagram network processes.
(Flist_processes): New optional arg `query-only'.
(conv_sockaddr_to_lisp, get_lisp_to_sockaddr_size)
(conv_lisp_to_sockaddr, set_socket_options)
(network_process_featurep, unwind_request_sigio): New helper functions.
(Fprocess_datagram_address, Fset_process_datagram_address):
(Fset_network_process_options): New lisp functions.
(Fopen_network_stream): Removed. Now defined in simple.el.
(Fmake_network_process): New lisp function. Code is based on previous
Fopen_network_stream, but heavily reworked with new property list based
argument list, support for datagrams, server processes, and local
sockets in addition to old client-only functionality.
(server_accept_connection): New function.
(wait_reading_process_input): Use it to handle incoming connects.
Do not enable input on a new connection if process is stopped.
(read_process_output): Handle datagram sockets. Use 2k buffer for them.
(send_process): Handle datagram sockets.
(Fstop_process, Fcontinue_process): Apply to network processes. A stopped
network process is indicated by setting command field to t .
(Fprocess_send_eof): No-op if datagram connection.
(Fstatus_notify): Don't read input for a stream server socket or a
stopped network process.
(init_process): Initialize datagram_address array.
(syms_of_process): Intern and staticpro new variables, defsubr new
functions.
2002-03-17 20:20:33 +00:00
|
|
|
|
p->encode_coding_system = val;
|
1998-05-10 19:21:05 +00:00
|
|
|
|
}
|
2003-02-10 07:58:29 +00:00
|
|
|
|
setup_process_coding_systems (proc);
|
1997-02-20 06:53:55 +00:00
|
|
|
|
|
(Qlocal, QCname, QCbuffer, QChost, QCservice, QCfamily)
(QClocal, QCremote, QCserver, QCdatagram, QCnowait, QCnoquery,QCstop)
(QCcoding, QCoptions, QCfilter, QCsentinel, QClog, QCfeature):
New variables.
(NETCONN1_P): New macro.
(DATAGRAM_SOCKETS): New conditional symbol.
(datagram_address): New array.
(DATAGRAM_CONN_P, DATAGRAM_CHAN_P): New macros.
(status_message): Use concat3.
(Fprocess_status): Add `listen' status to doc string. Return `stop'
for a stopped network process.
(Fset_process_buffer): Update contact plist for network process.
(Fset_process_filter): Ditto. Don't enable input for stopped
network processes. Server must listen, even if filter is t.
(Fset_process_query_on_exit_flag, Fprocess_query_on_exit_flag):
New functions.
(Fprocess_kill_without_query): Removed. Now defined in simple.el.
(Fprocess_contact): Added KEY argument. Handle datagrams.
(list_processes_1): Optionally show only processes with the query
on exit flag set. Dynamically adjust column widths. Omit tty
column if not needed. Report stopped network processes.
Identify server and datagram network processes.
(Flist_processes): New optional arg `query-only'.
(conv_sockaddr_to_lisp, get_lisp_to_sockaddr_size)
(conv_lisp_to_sockaddr, set_socket_options)
(network_process_featurep, unwind_request_sigio): New helper functions.
(Fprocess_datagram_address, Fset_process_datagram_address):
(Fset_network_process_options): New lisp functions.
(Fopen_network_stream): Removed. Now defined in simple.el.
(Fmake_network_process): New lisp function. Code is based on previous
Fopen_network_stream, but heavily reworked with new property list based
argument list, support for datagrams, server processes, and local
sockets in addition to old client-only functionality.
(server_accept_connection): New function.
(wait_reading_process_input): Use it to handle incoming connects.
Do not enable input on a new connection if process is stopped.
(read_process_output): Handle datagram sockets. Use 2k buffer for them.
(send_process): Handle datagram sockets.
(Fstop_process, Fcontinue_process): Apply to network processes. A stopped
network process is indicated by setting command field to t .
(Fprocess_send_eof): No-op if datagram connection.
(Fstatus_notify): Don't read input for a stream server socket or a
stopped network process.
(init_process): Initialize datagram_address array.
(syms_of_process): Intern and staticpro new variables, defsubr new
functions.
2002-03-17 20:20:33 +00:00
|
|
|
|
p->decoding_buf = make_uninit_string (0);
|
(struct Lisp_Process): Turn slots infd, outfd, kill_without_query, pty_flag,
tick, update_tick, decoding_carryover, inherit_coding_system_flag,
filter_multibyte, adaptive_read_buffering, read_output_delay, and
read_output_skip from Lisp_Objects to ints. Remove unused
encoding_carryover.
2007-07-12 06:36:57 +00:00
|
|
|
|
p->decoding_carryover = 0;
|
(Qlocal, QCname, QCbuffer, QChost, QCservice, QCfamily)
(QClocal, QCremote, QCserver, QCdatagram, QCnowait, QCnoquery,QCstop)
(QCcoding, QCoptions, QCfilter, QCsentinel, QClog, QCfeature):
New variables.
(NETCONN1_P): New macro.
(DATAGRAM_SOCKETS): New conditional symbol.
(datagram_address): New array.
(DATAGRAM_CONN_P, DATAGRAM_CHAN_P): New macros.
(status_message): Use concat3.
(Fprocess_status): Add `listen' status to doc string. Return `stop'
for a stopped network process.
(Fset_process_buffer): Update contact plist for network process.
(Fset_process_filter): Ditto. Don't enable input for stopped
network processes. Server must listen, even if filter is t.
(Fset_process_query_on_exit_flag, Fprocess_query_on_exit_flag):
New functions.
(Fprocess_kill_without_query): Removed. Now defined in simple.el.
(Fprocess_contact): Added KEY argument. Handle datagrams.
(list_processes_1): Optionally show only processes with the query
on exit flag set. Dynamically adjust column widths. Omit tty
column if not needed. Report stopped network processes.
Identify server and datagram network processes.
(Flist_processes): New optional arg `query-only'.
(conv_sockaddr_to_lisp, get_lisp_to_sockaddr_size)
(conv_lisp_to_sockaddr, set_socket_options)
(network_process_featurep, unwind_request_sigio): New helper functions.
(Fprocess_datagram_address, Fset_process_datagram_address):
(Fset_network_process_options): New lisp functions.
(Fopen_network_stream): Removed. Now defined in simple.el.
(Fmake_network_process): New lisp function. Code is based on previous
Fopen_network_stream, but heavily reworked with new property list based
argument list, support for datagrams, server processes, and local
sockets in addition to old client-only functionality.
(server_accept_connection): New function.
(wait_reading_process_input): Use it to handle incoming connects.
Do not enable input on a new connection if process is stopped.
(read_process_output): Handle datagram sockets. Use 2k buffer for them.
(send_process): Handle datagram sockets.
(Fstop_process, Fcontinue_process): Apply to network processes. A stopped
network process is indicated by setting command field to t .
(Fprocess_send_eof): No-op if datagram connection.
(Fstatus_notify): Don't read input for a stream server socket or a
stopped network process.
(init_process): Initialize datagram_address array.
(syms_of_process): Intern and staticpro new variables, defsubr new
functions.
2002-03-17 20:20:33 +00:00
|
|
|
|
p->encoding_buf = make_uninit_string (0);
|
1997-02-20 06:53:55 +00:00
|
|
|
|
|
(Qlocal, QCname, QCbuffer, QChost, QCservice, QCfamily)
(QClocal, QCremote, QCserver, QCdatagram, QCnowait, QCnoquery,QCstop)
(QCcoding, QCoptions, QCfilter, QCsentinel, QClog, QCfeature):
New variables.
(NETCONN1_P): New macro.
(DATAGRAM_SOCKETS): New conditional symbol.
(datagram_address): New array.
(DATAGRAM_CONN_P, DATAGRAM_CHAN_P): New macros.
(status_message): Use concat3.
(Fprocess_status): Add `listen' status to doc string. Return `stop'
for a stopped network process.
(Fset_process_buffer): Update contact plist for network process.
(Fset_process_filter): Ditto. Don't enable input for stopped
network processes. Server must listen, even if filter is t.
(Fset_process_query_on_exit_flag, Fprocess_query_on_exit_flag):
New functions.
(Fprocess_kill_without_query): Removed. Now defined in simple.el.
(Fprocess_contact): Added KEY argument. Handle datagrams.
(list_processes_1): Optionally show only processes with the query
on exit flag set. Dynamically adjust column widths. Omit tty
column if not needed. Report stopped network processes.
Identify server and datagram network processes.
(Flist_processes): New optional arg `query-only'.
(conv_sockaddr_to_lisp, get_lisp_to_sockaddr_size)
(conv_lisp_to_sockaddr, set_socket_options)
(network_process_featurep, unwind_request_sigio): New helper functions.
(Fprocess_datagram_address, Fset_process_datagram_address):
(Fset_network_process_options): New lisp functions.
(Fopen_network_stream): Removed. Now defined in simple.el.
(Fmake_network_process): New lisp function. Code is based on previous
Fopen_network_stream, but heavily reworked with new property list based
argument list, support for datagrams, server processes, and local
sockets in addition to old client-only functionality.
(server_accept_connection): New function.
(wait_reading_process_input): Use it to handle incoming connects.
Do not enable input on a new connection if process is stopped.
(read_process_output): Handle datagram sockets. Use 2k buffer for them.
(send_process): Handle datagram sockets.
(Fstop_process, Fcontinue_process): Apply to network processes. A stopped
network process is indicated by setting command field to t .
(Fprocess_send_eof): No-op if datagram connection.
(Fstatus_notify): Don't read input for a stream server socket or a
stopped network process.
(init_process): Initialize datagram_address array.
(syms_of_process): Intern and staticpro new variables, defsubr new
functions.
2002-03-17 20:20:33 +00:00
|
|
|
|
p->inherit_coding_system_flag
|
2007-07-17 05:57:35 +00:00
|
|
|
|
= !(!NILP (tem) || NILP (buffer) || !inherit_process_coding_system);
|
1998-04-19 14:13:47 +00:00
|
|
|
|
|
1992-03-14 20:40:04 +00:00
|
|
|
|
UNGCPRO;
|
|
|
|
|
return proc;
|
|
|
|
|
}
|
|
|
|
|
|
2004-04-16 12:51:06 +00:00
|
|
|
|
|
2010-08-05 17:36:12 -07:00
|
|
|
|
#if defined(HAVE_NET_IF_H) && defined(HAVE_SYS_IOCTL_H)
|
2004-04-16 12:51:06 +00:00
|
|
|
|
|
|
|
|
|
#ifdef SIOCGIFCONF
|
|
|
|
|
DEFUN ("network-interface-list", Fnetwork_interface_list, Snetwork_interface_list, 0, 0, 0,
|
|
|
|
|
doc: /* Return an alist of all network interfaces and their network address.
|
|
|
|
|
Each element is a cons, the car of which is a string containing the
|
|
|
|
|
interface name, and the cdr is the network address in internal
|
|
|
|
|
format; see the description of ADDRESS in `make-network-process'. */)
|
2010-07-08 14:25:08 -07:00
|
|
|
|
(void)
|
2004-04-16 12:51:06 +00:00
|
|
|
|
{
|
|
|
|
|
struct ifconf ifconf;
|
|
|
|
|
struct ifreq *ifreqs = NULL;
|
|
|
|
|
int ifaces = 0;
|
|
|
|
|
int buf_size, s;
|
|
|
|
|
Lisp_Object res;
|
|
|
|
|
|
|
|
|
|
s = socket (AF_INET, SOCK_STREAM, 0);
|
|
|
|
|
if (s < 0)
|
|
|
|
|
return Qnil;
|
|
|
|
|
|
|
|
|
|
again:
|
|
|
|
|
ifaces += 25;
|
2010-07-07 11:45:28 +02:00
|
|
|
|
buf_size = ifaces * sizeof (ifreqs[0]);
|
2004-04-16 12:51:06 +00:00
|
|
|
|
ifreqs = (struct ifreq *)xrealloc(ifreqs, buf_size);
|
|
|
|
|
if (!ifreqs)
|
|
|
|
|
{
|
|
|
|
|
close (s);
|
|
|
|
|
return Qnil;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
ifconf.ifc_len = buf_size;
|
|
|
|
|
ifconf.ifc_req = ifreqs;
|
|
|
|
|
if (ioctl (s, SIOCGIFCONF, &ifconf))
|
|
|
|
|
{
|
|
|
|
|
close (s);
|
|
|
|
|
return Qnil;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (ifconf.ifc_len == buf_size)
|
|
|
|
|
goto again;
|
|
|
|
|
|
|
|
|
|
close (s);
|
|
|
|
|
ifaces = ifconf.ifc_len / sizeof (ifreqs[0]);
|
|
|
|
|
|
|
|
|
|
res = Qnil;
|
|
|
|
|
while (--ifaces >= 0)
|
|
|
|
|
{
|
|
|
|
|
struct ifreq *ifq = &ifreqs[ifaces];
|
|
|
|
|
char namebuf[sizeof (ifq->ifr_name) + 1];
|
|
|
|
|
if (ifq->ifr_addr.sa_family != AF_INET)
|
|
|
|
|
continue;
|
Replace bcopy, bzero, bcmp by memcpy, memmove, memset, memcmp
* alloc.c (overrun_check_malloc, overrun_check_realloc)
(overrun_check_free, xstrdup, allocate_string)
(allocate_string_data, compact_small_strings, Fmake_string)
(make_unibyte_string, make_multibyte_string)
(make_string_from_bytes, make_specified_string, make_float)
(Fcons, allocate_terminal, allocate_frame, make_pure_string)
(Fgarbage_collect): Replace bcopy, safe_bcopy, bzero, bcmp by
memcpy, memmove, memset, memcmp.
* atimer.c (start_atimer, set_alarm): Likewise.
* buffer.c (clone_per_buffer_values, report_overlay_modification)
(mmap_realloc, init_buffer_once): Likewise.
* callint.c (Fcall_interactively): Likewise.
* callproc.c (Fcall_process, Fcall_process_region, child_setup)
(getenv_internal_1): Likewise.
* casefiddle.c (casify_object): Likewise.
* ccl.c (ccl_driver): Likewise.
* character.c (str_as_multibyte, str_to_multibyte): Likewise.
* charset.c (load_charset_map_from_file)
(load_charset_map_from_file, load_charset_map_from_vector)
(Fdefine_charset_internal): Likewise.
* cm.c (Wcm_clear): Likewise.
* coding.c (decode_eol, decode_coding_object)
(Fset_coding_system_priority, make_subsidiaries): Likewise.
* data.c (Faset): Likewise.
* dired.c (directory_files_internal, file_name_completion_stat):
Likewise.
* dispnew.c (new_glyph_matrix, adjust_glyph_matrix)
(clear_glyph_row, copy_row_except_pointers)
(copy_glyph_row_contents, new_glyph_pool, realloc_glyph_pool)
(save_current_matrix, restore_current_matrix)
(build_frame_matrix_from_leaf_window, mirrored_line_dance)
(mirror_line_dance, scrolling_window): Likewise.
* doc.c (Fsnarf_documentation, Fsubstitute_command_keys):
Likewise.
* doprnt.c (doprnt): Likewise.
* editfns.c (Fuser_full_name, make_buffer_string_both)
(Fmessage_box, Fformat, Ftranspose_regions): Likewise.
* emacs.c (sort_args): Likewise.
* eval.c (Fapply, Ffuncall): Likewise.
* fileio.c (Ffile_name_directory, make_temp_name)
(Fexpand_file_name, search_embedded_absfilename)
(Fsubstitute_in_file_name, Ffile_symlink_p, Finsert_file_contents)
(auto_save_error): Likewise.
* fns.c (Fstring_equal, Fcopy_sequence, concat)
(string_to_multibyte, Fstring_as_unibyte, Fstring_as_multibyte)
(internal_equal, Fclear_string, larger_vector, copy_hash_table)
(Fmake_hash_table): Likewise.
* fringe.c (Fdefine_fringe_bitmap): Likewise.
* ftfont.c (ftfont_text_extents): Likewise.
* getloadavg.c (getloadavg): Likewise.
* image.c (define_image_type, make_image, make_image_cache)
(x_create_x_image_and_pixmap, xbm_image_p)
(w32_create_pixmap_from_bitmap_data, xbm_load, xpm_lookup_color)
(xpm_image_p, x_create_bitmap_from_xpm_data, xpm_load)
(init_color_table, x_build_heuristic_mask, pbm_image_p, pbm_load)
(png_image_p, png_read_from_memory, png_load, jpeg_image_p)
(tiff_image_p, tiff_read_from_memory, gif_image_p)
(gif_read_from_memory, gif_load, svg_image_p, gs_image_p):
Likewise.
* indent.c (scan_for_column, compute_motion): Likewise.
* insdel.c (gap_left, gap_right, make_gap_smaller, copy_text)
(insert_1_both, insert_from_gap, replace_range_2): Likewise.
* intervals.c (reproduce_tree, reproduce_tree_obj): Likewise.
* keyboard.c (echo_char, save_getcjmp, restore_getcjmp)
(kbd_buffer_store_event_hold, apply_modifiers_uncached)
(store_user_signal_events, menu_bar_items, tool_bar_items)
(process_tool_bar_item, append_tool_bar_item)
(read_char_minibuf_menu_prompt, read_key_sequence)
(Fread_key_sequence, Fread_key_sequence_vector, Frecent_keys):
Likewise.
* keymap.c (current_minor_maps, Fdescribe_buffer_bindings):
Likewise.
* lisp.h (STRING_COPYIN): Likewise.
* lread.c (Fload, read1, oblookup): Likewise.
* msdos.c (Frecent_doskeys): Likewise.
* nsfns.m (Fx_create_frame): Likewise.
* nsfont.m (nsfont_open, nsfont_text_extents, ns_glyph_metrics):
Likewise.
* nsimage.m (EmacsImage-initFromSkipXBM:width:height:)
(EmacsImage-initForXPMWithDepth:width:height:flip:length:):
Likewise.
* nsmenu.m (ns_update_menubar): Likewise.
* nsterm.m (ns_draw_fringe_bitmap, ns_term_init): Likewise.
* print.c (print_unwind, printchar, strout, print_string)
(print_error_message): Likewise.
* process.c (conv_lisp_to_sockaddr, set_socket_option)
(Fmake_network_process, Fnetwork_interface_list)
(Fnetwork_interface_info, read_process_output, Fprocess_send_eof)
(init_process): Likewise.
* ralloc.c (resize_bloc, r_alloc_sbrk, r_alloc_init): Likewise.
* regex.c (init_syntax_once, regex_compile, re_compile_fastmap):
Likewise.
* scroll.c (do_scrolling, do_direct_scrolling)
(scrolling_max_lines_saved): Likewise.
* search.c (search_buffer, wordify, Freplace_match): Likewise.
* sound.c (wav_init, au_init, Fplay_sound_internal): Likewise.
* syntax.c (skip_chars, skip_syntaxes): Likewise.
* sysdep.c (child_setup_tty, sys_subshell, emacs_get_tty)
(emacs_set_tty): Likewise.
* term.c (encode_terminal_code, calculate_costs)
(produce_special_glyphs, create_tty_output, init_tty, delete_tty):
Likewise.
* termcap.c (tgetst1, gobble_line): Likewise.
* termhooks.h (EVENT_INIT): Likewise.
* tparam.c (tparam1): Likewise.
* unexalpha.c (unexec): Likewise.
* unexec.c (write_segment): Likewise.
* unexmacosx.c (unexec_write_zero): Likewise.
* w32fns.c (w32_wnd_proc, Fx_create_frame, x_create_tip_frame)
(Fx_file_dialog, Fsystem_move_file_to_trash): Likewise.
* w32font.c (w32font_list_family, w32font_text_extents)
(w32font_list_internal, w32font_match_internal)
(w32font_open_internal, compute_metrics, Fx_select_font):
Likewise.
* w32menu.c (set_frame_menubar, add_menu_item)
(w32_menu_display_help, w32_free_submenu_strings): Likewise.
* w32term.c (XCreateGC, w32_initialize_display_info): Likewise.
* w32uniscribe.c (uniscribe_list_family): Likewise.
* w32xfns.c (get_next_msg, post_msg, prepend_msg): Likewise.
* window.c (make_window, replace_window, set_window_buffer)
(Fsplit_window): Likewise.
* xdisp.c (init_iterator, RECORD_OVERLAY_STRING, reseat_to_string)
(add_to_log, message3, x_consider_frame_title)
(append_space_for_newline, extend_face_to_end_of_line)
(decode_mode_spec_coding, init_glyph_string): Likewise.
* xfaces.c (x_create_gc, get_lface_attributes_no_remap)
(Finternal_copy_lisp_face, Finternal_merge_in_global_face)
(face_attr_equal_p, make_realized_face, make_face_cache)
(free_realized_faces, lookup_named_face, smaller_face)
(face_with_height, lookup_derived_face)
(x_supports_face_attributes_p, Finternal_set_font_selection_order)
(Finternal_set_font_selection_order, realize_default_face)
(compute_char_face, face_at_buffer_position)
(face_for_overlay_string, face_at_string_position, merge_faces):
Likewise.
* xfns.c (xic_create_fontsetname, Fx_create_frame)
(Fx_window_property, x_create_tip_frame)
(Fx_backspace_delete_keys_p): Likewise.
* xfont.c (xfont_list, xfont_match, xfont_list_family)
(xfont_text_extents): Likewise.
* xmenu.c (set_frame_menubar, xmenu_show): Likewise.
* xrdb.c (magic_file_p, x_get_resource): Likewise.
* xselect.c (x_queue_event, x_get_window_property)
(receive_incremental_selection): Likewise.
* xsmfns.c (x_session_check_input): Likewise.
* xterm.c (x_send_scroll_bar_event, SET_SAVED_MENU_EVENT)
(handle_one_xevent, x_check_errors, xim_initialize, x_term_init):
Likewise.
* character.h (BCOPY_SHORT): Removed.
* config.in: Regenerate.
* dispnew.c (safe_bcopy): Only define as dummy if PROFILING.
* emacs.c (main) [PROFILING]: Don't declare
dump_opcode_frequencies.
* lisp.h (safe_bcopy): Remove declaration.
(memset) [!HAVE_MEMSET]: Declare.
(memcpy) [!HAVE_MEMCPY]: Likewise.
(memmove) [!HAVE_MEMMOVE]: Likewise.
(memcmp) [!HAVE_MEMCMP]: Likewise.
* s/ms-w32.h (bzero, bcopy, bcmp, GAP_USE_BCOPY)
(BCOPY_UPWARD_SAFE, BCOPY_DOWNWARD_SAFE, HAVE_BCOPY, HAVE_BCMP):
Don't define.
(HAVE_MEMCMP, HAVE_MEMCPY, HAVE_MEMMOVE, HAVE_MEMSET): Define.
* s/msdos.h (GAP_USE_BCOPY, BCOPY_UPWARD_SAFE)
(BCOPY_DOWNWARD_SAFE): Don't define.
* sysdep.c (memset) [!HAVE_MEMSET]: Define.
(memcpy) [!HAVE_MEMCPY]: Define.
(memmove) [!HAVE_MEMMOVE]: Define.
(memcmp) [!HAVE_MEMCMP]: Define.
* config.nt (HAVE_BCOPY, HAVE_BCMP): Remove undefs.
(HAVE_MEMCPY, HAVE_MEMMOVE, HAVE_MEMSET, HAVE_MEMCMP): Add undefs.
* sed2v2.inp (HAVE_MEMCPY, HAVE_MEMSET): Edit to 1.
(HAVE_BZERO): Don't edit.
* lwlib.c (lwlib_memset, lwlib_bcopy): Remove.
(malloc_widget_value, free_widget_info, allocate_widget_instance)
(lw_separator_p): Replace lwlib_memset, lwlib_bcopy, bzero, bcmp by
memset, memcpy, memcmp.
* lwlib-utils.c (XtApplyToWidgets): Likewise.
* xlwmenu.c (XlwMenuInitialize): Likewise.
* lwlib.h (lwlib_bcopy): Remove declaration.
* ebrowse.c (add_sym, make_namespace): Replace bcopy, bzero by
memcpy, memmove, memset.
* pop.c (pop_retrieve, socket_connection, pop_getline): Likewise.
* CPP-DEFINES (BCOPY_DOWNWARD_SAFE, BCOPY_UPWARD_SAFE)
(GAP_USE_BCOPY, HAVE_BCMP, HAVE_BCOPY, bcmp, bcopy, bzero):
Remove.
* configure.in: Don't check for bcopy, bcmp, bzero. Don't include
<strings.h> and don't define bcopy, bzero, BCMP in config.h.
2010-07-08 00:18:28 +02:00
|
|
|
|
memcpy (namebuf, ifq->ifr_name, sizeof (ifq->ifr_name));
|
2004-04-16 12:51:06 +00:00
|
|
|
|
namebuf[sizeof (ifq->ifr_name)] = 0;
|
|
|
|
|
res = Fcons (Fcons (build_string (namebuf),
|
|
|
|
|
conv_sockaddr_to_lisp (&ifq->ifr_addr,
|
|
|
|
|
sizeof (struct sockaddr))),
|
|
|
|
|
res);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return res;
|
|
|
|
|
}
|
|
|
|
|
#endif /* SIOCGIFCONF */
|
|
|
|
|
|
|
|
|
|
#if defined(SIOCGIFADDR) || defined(SIOCGIFHWADDR) || defined(SIOCGIFFLAGS)
|
|
|
|
|
|
|
|
|
|
struct ifflag_def {
|
|
|
|
|
int flag_bit;
|
* process.c (ifflag_def): Make flag_sym constant.
(Fnetwork_interface_info): Use a constant pointer.
(ifflag_table):
* xfns.c (cursor_bits):
* xdisp.c (power_letter):
* termcap.c (speeds, esctab):
* sysdep.c (baud_convert):
* keyboard.c (lispy_accent_codes, modifier_names):
* image.c (xbm_format, xpm_format, pbm_format, png_format)
(jpeg_format, tiff_format, gif_format, svg_format)
(interlace_start, interlace_increment, gs_format):
* gtkutil.c (separator_names):
* fringe.c (swap_nibble):
* fns.c (base64_value_to_char, base64_char_to_value):
* fileio.c (make_temp_name_tbl):
* coding.c (suffixes): Make constant.
2009-11-11 20:11:51 +00:00
|
|
|
|
const char *flag_sym;
|
2004-04-16 12:51:06 +00:00
|
|
|
|
};
|
|
|
|
|
|
* process.c (ifflag_def): Make flag_sym constant.
(Fnetwork_interface_info): Use a constant pointer.
(ifflag_table):
* xfns.c (cursor_bits):
* xdisp.c (power_letter):
* termcap.c (speeds, esctab):
* sysdep.c (baud_convert):
* keyboard.c (lispy_accent_codes, modifier_names):
* image.c (xbm_format, xpm_format, pbm_format, png_format)
(jpeg_format, tiff_format, gif_format, svg_format)
(interlace_start, interlace_increment, gs_format):
* gtkutil.c (separator_names):
* fringe.c (swap_nibble):
* fns.c (base64_value_to_char, base64_char_to_value):
* fileio.c (make_temp_name_tbl):
* coding.c (suffixes): Make constant.
2009-11-11 20:11:51 +00:00
|
|
|
|
static const struct ifflag_def ifflag_table[] = {
|
2004-04-16 12:51:06 +00:00
|
|
|
|
#ifdef IFF_UP
|
|
|
|
|
{ IFF_UP, "up" },
|
|
|
|
|
#endif
|
|
|
|
|
#ifdef IFF_BROADCAST
|
|
|
|
|
{ IFF_BROADCAST, "broadcast" },
|
|
|
|
|
#endif
|
|
|
|
|
#ifdef IFF_DEBUG
|
|
|
|
|
{ IFF_DEBUG, "debug" },
|
|
|
|
|
#endif
|
|
|
|
|
#ifdef IFF_LOOPBACK
|
|
|
|
|
{ IFF_LOOPBACK, "loopback" },
|
|
|
|
|
#endif
|
|
|
|
|
#ifdef IFF_POINTOPOINT
|
|
|
|
|
{ IFF_POINTOPOINT, "pointopoint" },
|
|
|
|
|
#endif
|
|
|
|
|
#ifdef IFF_RUNNING
|
|
|
|
|
{ IFF_RUNNING, "running" },
|
|
|
|
|
#endif
|
|
|
|
|
#ifdef IFF_NOARP
|
|
|
|
|
{ IFF_NOARP, "noarp" },
|
|
|
|
|
#endif
|
|
|
|
|
#ifdef IFF_PROMISC
|
|
|
|
|
{ IFF_PROMISC, "promisc" },
|
|
|
|
|
#endif
|
|
|
|
|
#ifdef IFF_NOTRAILERS
|
|
|
|
|
{ IFF_NOTRAILERS, "notrailers" },
|
|
|
|
|
#endif
|
|
|
|
|
#ifdef IFF_ALLMULTI
|
|
|
|
|
{ IFF_ALLMULTI, "allmulti" },
|
|
|
|
|
#endif
|
|
|
|
|
#ifdef IFF_MASTER
|
|
|
|
|
{ IFF_MASTER, "master" },
|
|
|
|
|
#endif
|
|
|
|
|
#ifdef IFF_SLAVE
|
|
|
|
|
{ IFF_SLAVE, "slave" },
|
|
|
|
|
#endif
|
|
|
|
|
#ifdef IFF_MULTICAST
|
|
|
|
|
{ IFF_MULTICAST, "multicast" },
|
|
|
|
|
#endif
|
|
|
|
|
#ifdef IFF_PORTSEL
|
|
|
|
|
{ IFF_PORTSEL, "portsel" },
|
|
|
|
|
#endif
|
|
|
|
|
#ifdef IFF_AUTOMEDIA
|
|
|
|
|
{ IFF_AUTOMEDIA, "automedia" },
|
|
|
|
|
#endif
|
|
|
|
|
#ifdef IFF_DYNAMIC
|
|
|
|
|
{ IFF_DYNAMIC, "dynamic" },
|
2006-01-04 00:16:54 +00:00
|
|
|
|
#endif
|
2006-01-12 08:16:12 +00:00
|
|
|
|
#ifdef IFF_OACTIVE
|
|
|
|
|
{ IFF_OACTIVE, "oactive" }, /* OpenBSD: transmission in progress */
|
2006-01-04 00:16:54 +00:00
|
|
|
|
#endif
|
|
|
|
|
#ifdef IFF_SIMPLEX
|
|
|
|
|
{ IFF_SIMPLEX, "simplex" }, /* OpenBSD: can't hear own transmissions */
|
|
|
|
|
#endif
|
|
|
|
|
#ifdef IFF_LINK0
|
|
|
|
|
{ IFF_LINK0, "link0" }, /* OpenBSD: per link layer defined bit */
|
|
|
|
|
#endif
|
|
|
|
|
#ifdef IFF_LINK1
|
|
|
|
|
{ IFF_LINK1, "link1" }, /* OpenBSD: per link layer defined bit */
|
|
|
|
|
#endif
|
|
|
|
|
#ifdef IFF_LINK2
|
|
|
|
|
{ IFF_LINK2, "link2" }, /* OpenBSD: per link layer defined bit */
|
2004-04-16 12:51:06 +00:00
|
|
|
|
#endif
|
|
|
|
|
{ 0, 0 }
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
DEFUN ("network-interface-info", Fnetwork_interface_info, Snetwork_interface_info, 1, 1, 0,
|
|
|
|
|
doc: /* Return information about network interface named IFNAME.
|
|
|
|
|
The return value is a list (ADDR BCAST NETMASK HWADDR FLAGS),
|
|
|
|
|
where ADDR is the layer 3 address, BCAST is the layer 3 broadcast address,
|
|
|
|
|
NETMASK is the layer 3 network mask, HWADDR is the layer 2 addres, and
|
|
|
|
|
FLAGS is the current flags of the interface. */)
|
2010-07-08 14:25:08 -07:00
|
|
|
|
(Lisp_Object ifname)
|
2004-04-16 12:51:06 +00:00
|
|
|
|
{
|
|
|
|
|
struct ifreq rq;
|
|
|
|
|
Lisp_Object res = Qnil;
|
|
|
|
|
Lisp_Object elt;
|
|
|
|
|
int s;
|
|
|
|
|
int any = 0;
|
|
|
|
|
|
|
|
|
|
CHECK_STRING (ifname);
|
|
|
|
|
|
Replace bcopy, bzero, bcmp by memcpy, memmove, memset, memcmp
* alloc.c (overrun_check_malloc, overrun_check_realloc)
(overrun_check_free, xstrdup, allocate_string)
(allocate_string_data, compact_small_strings, Fmake_string)
(make_unibyte_string, make_multibyte_string)
(make_string_from_bytes, make_specified_string, make_float)
(Fcons, allocate_terminal, allocate_frame, make_pure_string)
(Fgarbage_collect): Replace bcopy, safe_bcopy, bzero, bcmp by
memcpy, memmove, memset, memcmp.
* atimer.c (start_atimer, set_alarm): Likewise.
* buffer.c (clone_per_buffer_values, report_overlay_modification)
(mmap_realloc, init_buffer_once): Likewise.
* callint.c (Fcall_interactively): Likewise.
* callproc.c (Fcall_process, Fcall_process_region, child_setup)
(getenv_internal_1): Likewise.
* casefiddle.c (casify_object): Likewise.
* ccl.c (ccl_driver): Likewise.
* character.c (str_as_multibyte, str_to_multibyte): Likewise.
* charset.c (load_charset_map_from_file)
(load_charset_map_from_file, load_charset_map_from_vector)
(Fdefine_charset_internal): Likewise.
* cm.c (Wcm_clear): Likewise.
* coding.c (decode_eol, decode_coding_object)
(Fset_coding_system_priority, make_subsidiaries): Likewise.
* data.c (Faset): Likewise.
* dired.c (directory_files_internal, file_name_completion_stat):
Likewise.
* dispnew.c (new_glyph_matrix, adjust_glyph_matrix)
(clear_glyph_row, copy_row_except_pointers)
(copy_glyph_row_contents, new_glyph_pool, realloc_glyph_pool)
(save_current_matrix, restore_current_matrix)
(build_frame_matrix_from_leaf_window, mirrored_line_dance)
(mirror_line_dance, scrolling_window): Likewise.
* doc.c (Fsnarf_documentation, Fsubstitute_command_keys):
Likewise.
* doprnt.c (doprnt): Likewise.
* editfns.c (Fuser_full_name, make_buffer_string_both)
(Fmessage_box, Fformat, Ftranspose_regions): Likewise.
* emacs.c (sort_args): Likewise.
* eval.c (Fapply, Ffuncall): Likewise.
* fileio.c (Ffile_name_directory, make_temp_name)
(Fexpand_file_name, search_embedded_absfilename)
(Fsubstitute_in_file_name, Ffile_symlink_p, Finsert_file_contents)
(auto_save_error): Likewise.
* fns.c (Fstring_equal, Fcopy_sequence, concat)
(string_to_multibyte, Fstring_as_unibyte, Fstring_as_multibyte)
(internal_equal, Fclear_string, larger_vector, copy_hash_table)
(Fmake_hash_table): Likewise.
* fringe.c (Fdefine_fringe_bitmap): Likewise.
* ftfont.c (ftfont_text_extents): Likewise.
* getloadavg.c (getloadavg): Likewise.
* image.c (define_image_type, make_image, make_image_cache)
(x_create_x_image_and_pixmap, xbm_image_p)
(w32_create_pixmap_from_bitmap_data, xbm_load, xpm_lookup_color)
(xpm_image_p, x_create_bitmap_from_xpm_data, xpm_load)
(init_color_table, x_build_heuristic_mask, pbm_image_p, pbm_load)
(png_image_p, png_read_from_memory, png_load, jpeg_image_p)
(tiff_image_p, tiff_read_from_memory, gif_image_p)
(gif_read_from_memory, gif_load, svg_image_p, gs_image_p):
Likewise.
* indent.c (scan_for_column, compute_motion): Likewise.
* insdel.c (gap_left, gap_right, make_gap_smaller, copy_text)
(insert_1_both, insert_from_gap, replace_range_2): Likewise.
* intervals.c (reproduce_tree, reproduce_tree_obj): Likewise.
* keyboard.c (echo_char, save_getcjmp, restore_getcjmp)
(kbd_buffer_store_event_hold, apply_modifiers_uncached)
(store_user_signal_events, menu_bar_items, tool_bar_items)
(process_tool_bar_item, append_tool_bar_item)
(read_char_minibuf_menu_prompt, read_key_sequence)
(Fread_key_sequence, Fread_key_sequence_vector, Frecent_keys):
Likewise.
* keymap.c (current_minor_maps, Fdescribe_buffer_bindings):
Likewise.
* lisp.h (STRING_COPYIN): Likewise.
* lread.c (Fload, read1, oblookup): Likewise.
* msdos.c (Frecent_doskeys): Likewise.
* nsfns.m (Fx_create_frame): Likewise.
* nsfont.m (nsfont_open, nsfont_text_extents, ns_glyph_metrics):
Likewise.
* nsimage.m (EmacsImage-initFromSkipXBM:width:height:)
(EmacsImage-initForXPMWithDepth:width:height:flip:length:):
Likewise.
* nsmenu.m (ns_update_menubar): Likewise.
* nsterm.m (ns_draw_fringe_bitmap, ns_term_init): Likewise.
* print.c (print_unwind, printchar, strout, print_string)
(print_error_message): Likewise.
* process.c (conv_lisp_to_sockaddr, set_socket_option)
(Fmake_network_process, Fnetwork_interface_list)
(Fnetwork_interface_info, read_process_output, Fprocess_send_eof)
(init_process): Likewise.
* ralloc.c (resize_bloc, r_alloc_sbrk, r_alloc_init): Likewise.
* regex.c (init_syntax_once, regex_compile, re_compile_fastmap):
Likewise.
* scroll.c (do_scrolling, do_direct_scrolling)
(scrolling_max_lines_saved): Likewise.
* search.c (search_buffer, wordify, Freplace_match): Likewise.
* sound.c (wav_init, au_init, Fplay_sound_internal): Likewise.
* syntax.c (skip_chars, skip_syntaxes): Likewise.
* sysdep.c (child_setup_tty, sys_subshell, emacs_get_tty)
(emacs_set_tty): Likewise.
* term.c (encode_terminal_code, calculate_costs)
(produce_special_glyphs, create_tty_output, init_tty, delete_tty):
Likewise.
* termcap.c (tgetst1, gobble_line): Likewise.
* termhooks.h (EVENT_INIT): Likewise.
* tparam.c (tparam1): Likewise.
* unexalpha.c (unexec): Likewise.
* unexec.c (write_segment): Likewise.
* unexmacosx.c (unexec_write_zero): Likewise.
* w32fns.c (w32_wnd_proc, Fx_create_frame, x_create_tip_frame)
(Fx_file_dialog, Fsystem_move_file_to_trash): Likewise.
* w32font.c (w32font_list_family, w32font_text_extents)
(w32font_list_internal, w32font_match_internal)
(w32font_open_internal, compute_metrics, Fx_select_font):
Likewise.
* w32menu.c (set_frame_menubar, add_menu_item)
(w32_menu_display_help, w32_free_submenu_strings): Likewise.
* w32term.c (XCreateGC, w32_initialize_display_info): Likewise.
* w32uniscribe.c (uniscribe_list_family): Likewise.
* w32xfns.c (get_next_msg, post_msg, prepend_msg): Likewise.
* window.c (make_window, replace_window, set_window_buffer)
(Fsplit_window): Likewise.
* xdisp.c (init_iterator, RECORD_OVERLAY_STRING, reseat_to_string)
(add_to_log, message3, x_consider_frame_title)
(append_space_for_newline, extend_face_to_end_of_line)
(decode_mode_spec_coding, init_glyph_string): Likewise.
* xfaces.c (x_create_gc, get_lface_attributes_no_remap)
(Finternal_copy_lisp_face, Finternal_merge_in_global_face)
(face_attr_equal_p, make_realized_face, make_face_cache)
(free_realized_faces, lookup_named_face, smaller_face)
(face_with_height, lookup_derived_face)
(x_supports_face_attributes_p, Finternal_set_font_selection_order)
(Finternal_set_font_selection_order, realize_default_face)
(compute_char_face, face_at_buffer_position)
(face_for_overlay_string, face_at_string_position, merge_faces):
Likewise.
* xfns.c (xic_create_fontsetname, Fx_create_frame)
(Fx_window_property, x_create_tip_frame)
(Fx_backspace_delete_keys_p): Likewise.
* xfont.c (xfont_list, xfont_match, xfont_list_family)
(xfont_text_extents): Likewise.
* xmenu.c (set_frame_menubar, xmenu_show): Likewise.
* xrdb.c (magic_file_p, x_get_resource): Likewise.
* xselect.c (x_queue_event, x_get_window_property)
(receive_incremental_selection): Likewise.
* xsmfns.c (x_session_check_input): Likewise.
* xterm.c (x_send_scroll_bar_event, SET_SAVED_MENU_EVENT)
(handle_one_xevent, x_check_errors, xim_initialize, x_term_init):
Likewise.
* character.h (BCOPY_SHORT): Removed.
* config.in: Regenerate.
* dispnew.c (safe_bcopy): Only define as dummy if PROFILING.
* emacs.c (main) [PROFILING]: Don't declare
dump_opcode_frequencies.
* lisp.h (safe_bcopy): Remove declaration.
(memset) [!HAVE_MEMSET]: Declare.
(memcpy) [!HAVE_MEMCPY]: Likewise.
(memmove) [!HAVE_MEMMOVE]: Likewise.
(memcmp) [!HAVE_MEMCMP]: Likewise.
* s/ms-w32.h (bzero, bcopy, bcmp, GAP_USE_BCOPY)
(BCOPY_UPWARD_SAFE, BCOPY_DOWNWARD_SAFE, HAVE_BCOPY, HAVE_BCMP):
Don't define.
(HAVE_MEMCMP, HAVE_MEMCPY, HAVE_MEMMOVE, HAVE_MEMSET): Define.
* s/msdos.h (GAP_USE_BCOPY, BCOPY_UPWARD_SAFE)
(BCOPY_DOWNWARD_SAFE): Don't define.
* sysdep.c (memset) [!HAVE_MEMSET]: Define.
(memcpy) [!HAVE_MEMCPY]: Define.
(memmove) [!HAVE_MEMMOVE]: Define.
(memcmp) [!HAVE_MEMCMP]: Define.
* config.nt (HAVE_BCOPY, HAVE_BCMP): Remove undefs.
(HAVE_MEMCPY, HAVE_MEMMOVE, HAVE_MEMSET, HAVE_MEMCMP): Add undefs.
* sed2v2.inp (HAVE_MEMCPY, HAVE_MEMSET): Edit to 1.
(HAVE_BZERO): Don't edit.
* lwlib.c (lwlib_memset, lwlib_bcopy): Remove.
(malloc_widget_value, free_widget_info, allocate_widget_instance)
(lw_separator_p): Replace lwlib_memset, lwlib_bcopy, bzero, bcmp by
memset, memcpy, memcmp.
* lwlib-utils.c (XtApplyToWidgets): Likewise.
* xlwmenu.c (XlwMenuInitialize): Likewise.
* lwlib.h (lwlib_bcopy): Remove declaration.
* ebrowse.c (add_sym, make_namespace): Replace bcopy, bzero by
memcpy, memmove, memset.
* pop.c (pop_retrieve, socket_connection, pop_getline): Likewise.
* CPP-DEFINES (BCOPY_DOWNWARD_SAFE, BCOPY_UPWARD_SAFE)
(GAP_USE_BCOPY, HAVE_BCMP, HAVE_BCOPY, bcmp, bcopy, bzero):
Remove.
* configure.in: Don't check for bcopy, bcmp, bzero. Don't include
<strings.h> and don't define bcopy, bzero, BCMP in config.h.
2010-07-08 00:18:28 +02:00
|
|
|
|
memset (rq.ifr_name, 0, sizeof rq.ifr_name);
|
2004-04-16 12:51:06 +00:00
|
|
|
|
strncpy (rq.ifr_name, SDATA (ifname), sizeof (rq.ifr_name));
|
|
|
|
|
|
|
|
|
|
s = socket (AF_INET, SOCK_STREAM, 0);
|
|
|
|
|
if (s < 0)
|
|
|
|
|
return Qnil;
|
|
|
|
|
|
|
|
|
|
elt = Qnil;
|
|
|
|
|
#if defined(SIOCGIFFLAGS) && defined(HAVE_STRUCT_IFREQ_IFR_FLAGS)
|
|
|
|
|
if (ioctl (s, SIOCGIFFLAGS, &rq) == 0)
|
|
|
|
|
{
|
|
|
|
|
int flags = rq.ifr_flags;
|
* process.c (ifflag_def): Make flag_sym constant.
(Fnetwork_interface_info): Use a constant pointer.
(ifflag_table):
* xfns.c (cursor_bits):
* xdisp.c (power_letter):
* termcap.c (speeds, esctab):
* sysdep.c (baud_convert):
* keyboard.c (lispy_accent_codes, modifier_names):
* image.c (xbm_format, xpm_format, pbm_format, png_format)
(jpeg_format, tiff_format, gif_format, svg_format)
(interlace_start, interlace_increment, gs_format):
* gtkutil.c (separator_names):
* fringe.c (swap_nibble):
* fns.c (base64_value_to_char, base64_char_to_value):
* fileio.c (make_temp_name_tbl):
* coding.c (suffixes): Make constant.
2009-11-11 20:11:51 +00:00
|
|
|
|
const struct ifflag_def *fp;
|
2004-04-16 12:51:06 +00:00
|
|
|
|
int fnum;
|
|
|
|
|
|
|
|
|
|
any++;
|
2005-12-30 11:03:41 +00:00
|
|
|
|
for (fp = ifflag_table; flags != 0 && fp->flag_sym; fp++)
|
2004-04-16 12:51:06 +00:00
|
|
|
|
{
|
|
|
|
|
if (flags & fp->flag_bit)
|
|
|
|
|
{
|
|
|
|
|
elt = Fcons (intern (fp->flag_sym), elt);
|
|
|
|
|
flags -= fp->flag_bit;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
for (fnum = 0; flags && fnum < 32; fnum++)
|
|
|
|
|
{
|
|
|
|
|
if (flags & (1 << fnum))
|
|
|
|
|
{
|
|
|
|
|
elt = Fcons (make_number (fnum), elt);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
#endif
|
|
|
|
|
res = Fcons (elt, res);
|
|
|
|
|
|
|
|
|
|
elt = Qnil;
|
|
|
|
|
#if defined(SIOCGIFHWADDR) && defined(HAVE_STRUCT_IFREQ_IFR_HWADDR)
|
|
|
|
|
if (ioctl (s, SIOCGIFHWADDR, &rq) == 0)
|
|
|
|
|
{
|
|
|
|
|
Lisp_Object hwaddr = Fmake_vector (make_number (6), Qnil);
|
|
|
|
|
register struct Lisp_Vector *p = XVECTOR (hwaddr);
|
|
|
|
|
int n;
|
|
|
|
|
|
|
|
|
|
any++;
|
|
|
|
|
for (n = 0; n < 6; n++)
|
|
|
|
|
p->contents[n] = make_number (((unsigned char *)&rq.ifr_hwaddr.sa_data[0])[n]);
|
|
|
|
|
elt = Fcons (make_number (rq.ifr_hwaddr.sa_family), hwaddr);
|
|
|
|
|
}
|
|
|
|
|
#endif
|
|
|
|
|
res = Fcons (elt, res);
|
|
|
|
|
|
|
|
|
|
elt = Qnil;
|
2006-01-12 08:16:12 +00:00
|
|
|
|
#if defined(SIOCGIFNETMASK) && (defined(HAVE_STRUCT_IFREQ_IFR_NETMASK) || defined(HAVE_STRUCT_IFREQ_IFR_ADDR))
|
2004-04-16 12:51:06 +00:00
|
|
|
|
if (ioctl (s, SIOCGIFNETMASK, &rq) == 0)
|
|
|
|
|
{
|
|
|
|
|
any++;
|
2006-01-12 08:16:12 +00:00
|
|
|
|
#ifdef HAVE_STRUCT_IFREQ_IFR_NETMASK
|
2004-04-16 12:51:06 +00:00
|
|
|
|
elt = conv_sockaddr_to_lisp (&rq.ifr_netmask, sizeof (rq.ifr_netmask));
|
2006-01-12 08:16:12 +00:00
|
|
|
|
#else
|
|
|
|
|
elt = conv_sockaddr_to_lisp (&rq.ifr_addr, sizeof (rq.ifr_addr));
|
|
|
|
|
#endif
|
2004-04-16 12:51:06 +00:00
|
|
|
|
}
|
|
|
|
|
#endif
|
|
|
|
|
res = Fcons (elt, res);
|
|
|
|
|
|
|
|
|
|
elt = Qnil;
|
|
|
|
|
#if defined(SIOCGIFBRDADDR) && defined(HAVE_STRUCT_IFREQ_IFR_BROADADDR)
|
|
|
|
|
if (ioctl (s, SIOCGIFBRDADDR, &rq) == 0)
|
|
|
|
|
{
|
|
|
|
|
any++;
|
|
|
|
|
elt = conv_sockaddr_to_lisp (&rq.ifr_broadaddr, sizeof (rq.ifr_broadaddr));
|
|
|
|
|
}
|
|
|
|
|
#endif
|
|
|
|
|
res = Fcons (elt, res);
|
|
|
|
|
|
|
|
|
|
elt = Qnil;
|
|
|
|
|
#if defined(SIOCGIFADDR) && defined(HAVE_STRUCT_IFREQ_IFR_ADDR)
|
|
|
|
|
if (ioctl (s, SIOCGIFADDR, &rq) == 0)
|
|
|
|
|
{
|
|
|
|
|
any++;
|
|
|
|
|
elt = conv_sockaddr_to_lisp (&rq.ifr_addr, sizeof (rq.ifr_addr));
|
|
|
|
|
}
|
|
|
|
|
#endif
|
|
|
|
|
res = Fcons (elt, res);
|
|
|
|
|
|
|
|
|
|
close (s);
|
|
|
|
|
|
|
|
|
|
return any ? res : Qnil;
|
|
|
|
|
}
|
|
|
|
|
#endif
|
2010-08-05 17:36:12 -07:00
|
|
|
|
#endif /* defined(HAVE_NET_IF_H) && defined(HAVE_SYS_IOCTL_H) */
|
2004-04-16 12:51:06 +00:00
|
|
|
|
|
2004-06-13 22:37:07 +00:00
|
|
|
|
/* Turn off input and output for process PROC. */
|
|
|
|
|
|
1997-11-28 14:53:09 +00:00
|
|
|
|
void
|
2010-07-05 12:36:06 +02:00
|
|
|
|
deactivate_process (Lisp_Object proc)
|
1992-03-14 20:40:04 +00:00
|
|
|
|
{
|
|
|
|
|
register int inchannel, outchannel;
|
|
|
|
|
register struct Lisp_Process *p = XPROCESS (proc);
|
|
|
|
|
|
(struct Lisp_Process): Turn slots infd, outfd, kill_without_query, pty_flag,
tick, update_tick, decoding_carryover, inherit_coding_system_flag,
filter_multibyte, adaptive_read_buffering, read_output_delay, and
read_output_skip from Lisp_Objects to ints. Remove unused
encoding_carryover.
2007-07-12 06:36:57 +00:00
|
|
|
|
inchannel = p->infd;
|
|
|
|
|
outchannel = p->outfd;
|
1992-03-14 20:40:04 +00:00
|
|
|
|
|
2004-04-16 12:51:06 +00:00
|
|
|
|
#ifdef ADAPTIVE_READ_BUFFERING
|
(struct Lisp_Process): Turn slots infd, outfd, kill_without_query, pty_flag,
tick, update_tick, decoding_carryover, inherit_coding_system_flag,
filter_multibyte, adaptive_read_buffering, read_output_delay, and
read_output_skip from Lisp_Objects to ints. Remove unused
encoding_carryover.
2007-07-12 06:36:57 +00:00
|
|
|
|
if (p->read_output_delay > 0)
|
2004-04-16 12:51:06 +00:00
|
|
|
|
{
|
|
|
|
|
if (--process_output_delay_count < 0)
|
|
|
|
|
process_output_delay_count = 0;
|
(struct Lisp_Process): Turn slots infd, outfd, kill_without_query, pty_flag,
tick, update_tick, decoding_carryover, inherit_coding_system_flag,
filter_multibyte, adaptive_read_buffering, read_output_delay, and
read_output_skip from Lisp_Objects to ints. Remove unused
encoding_carryover.
2007-07-12 06:36:57 +00:00
|
|
|
|
p->read_output_delay = 0;
|
|
|
|
|
p->read_output_skip = 0;
|
2004-04-16 12:51:06 +00:00
|
|
|
|
}
|
|
|
|
|
#endif
|
2004-05-08 16:11:42 +00:00
|
|
|
|
|
1993-11-23 10:57:16 +00:00
|
|
|
|
if (inchannel >= 0)
|
1992-03-14 20:40:04 +00:00
|
|
|
|
{
|
|
|
|
|
/* Beware SIGCHLD hereabouts. */
|
|
|
|
|
flush_pending_output (inchannel);
|
Add support for large files, 64-bit Solaris, system locale codings.
* Makefile.in (emacs): Set the LC_ALL environment variable to "C"
when dumping, so that the dumped Emacs doesn't have stray locale info.
(dired.o): Depend on systime.h.
(editfns.o): Depend on coding.h.
* alloc.c, buffer.c, callproc.c, ccl.c, charset.c, coding.c, data.c,
dispnew.c, editfns.c, emacs.c, filelock.c, floatfns.c, hftctl.c,
keyboard.c, process.c, sysdep.c, unexelf.c, unexhp9k800.c,
unexsunos4.c, vmsfns.c, vmsgmalloc.c, w32faces.c, w32menu.c, w32term.c,
w32xfns.c, xfaces.c, xfns.c, xmenu.c, xterm.c:
Include <config.h> before any system include files.
* alloc.c, buffer.c, ccl.c, data.c, editfns.c, emacs.c, eval.c,
fileio.c, filelock.c, frame.c, insdel.c, keymap.c, lread.c,
m/alpha.h, print.c, search.c, sysdep.c, xdisp.c, xfaces.c, xfns.c,
xmenu.c, xterm.c:
Do not include <stdlib.h>, as <config.h> does this now.
* callproc.c (Fcall_process):
Synchronize messages locale before invoking strerror.
Decode resulting string with locale-coding-system.
* coding.c (Vlocale_coding_system): New var.
(syms_of_coding): Adjust to above change.
(emacs_strerror): New function.
* coding.h (emacs_strerror, Vlocale_coding_system): New decls.
* config.in (HAVE_STDIO_EXT_H, HAVE_TM_GMTOFF, HAVE___FPENDING,
HAVE_FTELLO, HAVE_GETLOADAVG, HAVE_MBLEN, HAVE_MBRLEN,
HAVE_STRSIGNAL): New macros.
(BITS_PER_LONG): Default to 64 if _LP64 is defined.
<stdlib.h>: Include if HAVE_STDLIB_H is defined and NOT_C_CODE isn't.
* dired.c: Include "systime.h".
(Ffile_attributes): Do not cast s.st_size to int; this loses
information if int is 32 bits but st_size and EMACS_INT are larger.
Treat large device numbers like large inode numbers.
* dispnew.c (PENDING_OUTPUT_COUNT): Use __fpending if available.
* editfns.c: Include coding.h.
(emacs_strftime): Remove decl.
(emacs_strftimeu): New decl.
(emacs_memftimeu): Renamed from emacs_memftime; new arg UT.
Use emacs_strftimeu instead of emacs_strftime.
(Fformat_time_string): Convert format string using
Vlocale_coding_system, and convert result back. Synchronize time
locale before invoking lower level function. Invoke
emacs_memftimeu, passing ut, instead of emacs_memftime.
* emacs.c: Include <locale.h> if HAVE_SETLOCALE is defined.
(Vmessages_locale, Vprevious_messages_locale, Vtime_locale,
Vprevious_time_locale): New variables.
(main): Invoke setlocale early, so that initial error messages are
localized properly. But skip locale-setting if LC_ALL is "C".
Fix up locale when it's safe to do so.
(fixup_locale): Moved here from xterm.c.
(synchronize_locale, synchronize_time_locale,
synchronize_messages_locale): New functions.
(syms_of_emacs): Accommodate above changes.
* fileio.c (report_file_error): Convert strerror output according
to Vlocale_coding_system.
(Finsert_file_contents): Check for arithmetic overflow in
computations that depend on file size. Report IO errors
with emacs_strerror, not strerror.
* fns.c (Fgethash): Declare dflt parameter.
* gmalloc.c: Do not define const to nothing if HAVE_CONFIG_H
is defined; that's config.h's job.
* lisp.h (EMACS_INT, BITS_PER_EMACS_INT, EMACS_UINT): If _LP64,
default these values to long, BITS_PER_LONG, and unsigned long.
(VALBITS, MARKBIT, XINT): Do not assume 32-bit EMACS_INT.
(PNTR_COMPARISON_TYPE): Default to EMACS_UINT, not to unsigned int.
(code_convert_string_norecord, fixup_locale,
synchronize_messages_locale, synchronize_time_locale,
emacs_open, emacs_close, emacs_read, emacs_write): New decls.
All Emacs callers of open, close, read, write changed to use
emacs_open, emacs_close, emacs_read, emacs_write.
* lread.c (file_offset, file_tell): New macros. All uses of ftell
changed to file_tell.
(saved_doc_string_position, prev_saved_doc_string_position): Now
of type file_offset.
(init_lread): Do not fix locale here; fixup_locale now does this.
* m/amdahl.h, s/usg5-4.h:
(NSIG): Remove.
(NSIG_MINIMUM): New macro.
* m/cydra5.h, m/dpx2.h, m/mips.h, m/pfa50.h, m/sps7.h, m/stride.h,
m/ustation.h, s/gnu-linux.h, s/hpux.h, s/iris3-5.h, s/iris3-6.h,
s/umips.h, s/usg5-4.h:
(SIGIO): Do not undef.
(BROKEN_SIGIO): New macro.
* m/ustation.h:
(SIGTSTP): Do not undef.
(BROKEN_SIGTSTP): New macro.
* s/gnu-linux.h:
(SIGPOLL, SIGURG): Do not undef.
(BROKEN_SIGPOLL, BROKEN_SIGURG): New macros.
* s/ptx4.h:
(SIGINFO): Do not undef.
(BROKEN_SIGINFO): New macros.
* m/delta.h, s/ptx.h, s/template.h: Doc fix.
* mktime.c, strftime.c: Update to glibc 2.1.2 version, with
some Emacs-related changes merged.
* print.c (float_to_string): Prepend "-" to representation of a
NaN if the NaN is negative.
* process.c (sys_siglist): Omit if HAVE_STRSIGNAL.
(wait_reading_process_input): Use emacs_strerror, not strerror.
* process.c (status_message, sigchld_handler): Synchronize locale,
then use strsignal istead of sys_siglist.
* w32proc.c (sys_wait): Likewise.
* s/aix3-1.h, s/bsd4-1.h, s/dgux.h, s/gnu-linux.h, s/hiuxmpp.h,
s/hpux.h, s/iris3-5.h, s/iris3-6.h, s/irix3-3.h, s/osf1.h, s/rtu.h,
s/sunos4-1.h, s/unipl5-0.h, s/unipl5-2.h, s/usg5-0.h, s/usg5-2-2.h,
s/usg5-2.h, s/usg5-3.h, s/xenix.h:
(open, close, read, write, INTERRUPTIBLE_OPEN,
INTERRUPTIBLE_CLOSE, INTERRUPTIBLE_IO): Remove.
* s/sol2-5.h (_LARGEFILE_SOURCE, _FILE_OFFSET_BITS): New macros.
* sysdep.c (sys_read, sys_write, read, write, sys_close, close,
sys_open, open): Remove.
(emacs_open, emacs_close, emacs_read, emacs_write): Always define;
the old INTERRUPTIBLE_OPEN, INTERRUPTIBLE_CLOSE, and INTERRUPTIBLE_IO
macros are no longer used.
(emacs_open): Renamed from sys_open. Merge BSD4_1 version.
(emacs_close): Renamed from sys_close.
(emacs_read): Renamed from sys_read.
(emacs_write): Renamed from sys_write.
(sys_siglist): Do not declare if HAVE_STRSIGNAL.
(dup2): Do not print error on failure; the real dup2 doesn't.
(strsignal): New function, defined if !HAVE_STRSIGNAL.
* syssignal.h (SIGINFO): Undef if defined and if BROKEN_SIGINFO
is defined.
(SIGIO, SIGPOLL, SIGTSTP, SIGURG): Likewise.
(NSIG): If less than NSIG_MINIMUM, define to NSIG_MINIMUM.
(strsignal): Declare if !HAVE_STRSIGNAL.
* unexelf.c (ElfBitsW, ELFSIZE, ElfExpandBitsW): New macros.
(ElfW): Define in terms of ElfExpandBitsW.
* w32proc.c (sys_siglist): Remove decl.
* xdisp.c (decode_mode_spec): 3rd arg is int, not char, to comply
with ANSI C.
(display_string): Declare face_string_pos arg.
* xfns.c (Fx_show_tip): Declare timeout param.
* xterm.c: No need to include locale.h.
(x_alloc_lighter_color, x_setup_relief_color):
Pass arg as double, not float, for compatibility with ANSI C.
(fixup_locale): Move to emacs.c.
(x_term_init): Do not setlocale or fixup locale; the main program
does this now.
1999-10-19 07:25:11 +00:00
|
|
|
|
emacs_close (inchannel);
|
1993-11-23 10:57:16 +00:00
|
|
|
|
if (outchannel >= 0 && outchannel != inchannel)
|
Add support for large files, 64-bit Solaris, system locale codings.
* Makefile.in (emacs): Set the LC_ALL environment variable to "C"
when dumping, so that the dumped Emacs doesn't have stray locale info.
(dired.o): Depend on systime.h.
(editfns.o): Depend on coding.h.
* alloc.c, buffer.c, callproc.c, ccl.c, charset.c, coding.c, data.c,
dispnew.c, editfns.c, emacs.c, filelock.c, floatfns.c, hftctl.c,
keyboard.c, process.c, sysdep.c, unexelf.c, unexhp9k800.c,
unexsunos4.c, vmsfns.c, vmsgmalloc.c, w32faces.c, w32menu.c, w32term.c,
w32xfns.c, xfaces.c, xfns.c, xmenu.c, xterm.c:
Include <config.h> before any system include files.
* alloc.c, buffer.c, ccl.c, data.c, editfns.c, emacs.c, eval.c,
fileio.c, filelock.c, frame.c, insdel.c, keymap.c, lread.c,
m/alpha.h, print.c, search.c, sysdep.c, xdisp.c, xfaces.c, xfns.c,
xmenu.c, xterm.c:
Do not include <stdlib.h>, as <config.h> does this now.
* callproc.c (Fcall_process):
Synchronize messages locale before invoking strerror.
Decode resulting string with locale-coding-system.
* coding.c (Vlocale_coding_system): New var.
(syms_of_coding): Adjust to above change.
(emacs_strerror): New function.
* coding.h (emacs_strerror, Vlocale_coding_system): New decls.
* config.in (HAVE_STDIO_EXT_H, HAVE_TM_GMTOFF, HAVE___FPENDING,
HAVE_FTELLO, HAVE_GETLOADAVG, HAVE_MBLEN, HAVE_MBRLEN,
HAVE_STRSIGNAL): New macros.
(BITS_PER_LONG): Default to 64 if _LP64 is defined.
<stdlib.h>: Include if HAVE_STDLIB_H is defined and NOT_C_CODE isn't.
* dired.c: Include "systime.h".
(Ffile_attributes): Do not cast s.st_size to int; this loses
information if int is 32 bits but st_size and EMACS_INT are larger.
Treat large device numbers like large inode numbers.
* dispnew.c (PENDING_OUTPUT_COUNT): Use __fpending if available.
* editfns.c: Include coding.h.
(emacs_strftime): Remove decl.
(emacs_strftimeu): New decl.
(emacs_memftimeu): Renamed from emacs_memftime; new arg UT.
Use emacs_strftimeu instead of emacs_strftime.
(Fformat_time_string): Convert format string using
Vlocale_coding_system, and convert result back. Synchronize time
locale before invoking lower level function. Invoke
emacs_memftimeu, passing ut, instead of emacs_memftime.
* emacs.c: Include <locale.h> if HAVE_SETLOCALE is defined.
(Vmessages_locale, Vprevious_messages_locale, Vtime_locale,
Vprevious_time_locale): New variables.
(main): Invoke setlocale early, so that initial error messages are
localized properly. But skip locale-setting if LC_ALL is "C".
Fix up locale when it's safe to do so.
(fixup_locale): Moved here from xterm.c.
(synchronize_locale, synchronize_time_locale,
synchronize_messages_locale): New functions.
(syms_of_emacs): Accommodate above changes.
* fileio.c (report_file_error): Convert strerror output according
to Vlocale_coding_system.
(Finsert_file_contents): Check for arithmetic overflow in
computations that depend on file size. Report IO errors
with emacs_strerror, not strerror.
* fns.c (Fgethash): Declare dflt parameter.
* gmalloc.c: Do not define const to nothing if HAVE_CONFIG_H
is defined; that's config.h's job.
* lisp.h (EMACS_INT, BITS_PER_EMACS_INT, EMACS_UINT): If _LP64,
default these values to long, BITS_PER_LONG, and unsigned long.
(VALBITS, MARKBIT, XINT): Do not assume 32-bit EMACS_INT.
(PNTR_COMPARISON_TYPE): Default to EMACS_UINT, not to unsigned int.
(code_convert_string_norecord, fixup_locale,
synchronize_messages_locale, synchronize_time_locale,
emacs_open, emacs_close, emacs_read, emacs_write): New decls.
All Emacs callers of open, close, read, write changed to use
emacs_open, emacs_close, emacs_read, emacs_write.
* lread.c (file_offset, file_tell): New macros. All uses of ftell
changed to file_tell.
(saved_doc_string_position, prev_saved_doc_string_position): Now
of type file_offset.
(init_lread): Do not fix locale here; fixup_locale now does this.
* m/amdahl.h, s/usg5-4.h:
(NSIG): Remove.
(NSIG_MINIMUM): New macro.
* m/cydra5.h, m/dpx2.h, m/mips.h, m/pfa50.h, m/sps7.h, m/stride.h,
m/ustation.h, s/gnu-linux.h, s/hpux.h, s/iris3-5.h, s/iris3-6.h,
s/umips.h, s/usg5-4.h:
(SIGIO): Do not undef.
(BROKEN_SIGIO): New macro.
* m/ustation.h:
(SIGTSTP): Do not undef.
(BROKEN_SIGTSTP): New macro.
* s/gnu-linux.h:
(SIGPOLL, SIGURG): Do not undef.
(BROKEN_SIGPOLL, BROKEN_SIGURG): New macros.
* s/ptx4.h:
(SIGINFO): Do not undef.
(BROKEN_SIGINFO): New macros.
* m/delta.h, s/ptx.h, s/template.h: Doc fix.
* mktime.c, strftime.c: Update to glibc 2.1.2 version, with
some Emacs-related changes merged.
* print.c (float_to_string): Prepend "-" to representation of a
NaN if the NaN is negative.
* process.c (sys_siglist): Omit if HAVE_STRSIGNAL.
(wait_reading_process_input): Use emacs_strerror, not strerror.
* process.c (status_message, sigchld_handler): Synchronize locale,
then use strsignal istead of sys_siglist.
* w32proc.c (sys_wait): Likewise.
* s/aix3-1.h, s/bsd4-1.h, s/dgux.h, s/gnu-linux.h, s/hiuxmpp.h,
s/hpux.h, s/iris3-5.h, s/iris3-6.h, s/irix3-3.h, s/osf1.h, s/rtu.h,
s/sunos4-1.h, s/unipl5-0.h, s/unipl5-2.h, s/usg5-0.h, s/usg5-2-2.h,
s/usg5-2.h, s/usg5-3.h, s/xenix.h:
(open, close, read, write, INTERRUPTIBLE_OPEN,
INTERRUPTIBLE_CLOSE, INTERRUPTIBLE_IO): Remove.
* s/sol2-5.h (_LARGEFILE_SOURCE, _FILE_OFFSET_BITS): New macros.
* sysdep.c (sys_read, sys_write, read, write, sys_close, close,
sys_open, open): Remove.
(emacs_open, emacs_close, emacs_read, emacs_write): Always define;
the old INTERRUPTIBLE_OPEN, INTERRUPTIBLE_CLOSE, and INTERRUPTIBLE_IO
macros are no longer used.
(emacs_open): Renamed from sys_open. Merge BSD4_1 version.
(emacs_close): Renamed from sys_close.
(emacs_read): Renamed from sys_read.
(emacs_write): Renamed from sys_write.
(sys_siglist): Do not declare if HAVE_STRSIGNAL.
(dup2): Do not print error on failure; the real dup2 doesn't.
(strsignal): New function, defined if !HAVE_STRSIGNAL.
* syssignal.h (SIGINFO): Undef if defined and if BROKEN_SIGINFO
is defined.
(SIGIO, SIGPOLL, SIGTSTP, SIGURG): Likewise.
(NSIG): If less than NSIG_MINIMUM, define to NSIG_MINIMUM.
(strsignal): Declare if !HAVE_STRSIGNAL.
* unexelf.c (ElfBitsW, ELFSIZE, ElfExpandBitsW): New macros.
(ElfW): Define in terms of ElfExpandBitsW.
* w32proc.c (sys_siglist): Remove decl.
* xdisp.c (decode_mode_spec): 3rd arg is int, not char, to comply
with ANSI C.
(display_string): Declare face_string_pos arg.
* xfns.c (Fx_show_tip): Declare timeout param.
* xterm.c: No need to include locale.h.
(x_alloc_lighter_color, x_setup_relief_color):
Pass arg as double, not float, for compatibility with ANSI C.
(fixup_locale): Move to emacs.c.
(x_term_init): Do not setlocale or fixup locale; the main program
does this now.
1999-10-19 07:25:11 +00:00
|
|
|
|
emacs_close (outchannel);
|
1992-03-14 20:40:04 +00:00
|
|
|
|
|
(struct Lisp_Process): Turn slots infd, outfd, kill_without_query, pty_flag,
tick, update_tick, decoding_carryover, inherit_coding_system_flag,
filter_multibyte, adaptive_read_buffering, read_output_delay, and
read_output_skip from Lisp_Objects to ints. Remove unused
encoding_carryover.
2007-07-12 06:36:57 +00:00
|
|
|
|
p->infd = -1;
|
|
|
|
|
p->outfd = -1;
|
(Qlocal, QCname, QCbuffer, QChost, QCservice, QCfamily)
(QClocal, QCremote, QCserver, QCdatagram, QCnowait, QCnoquery,QCstop)
(QCcoding, QCoptions, QCfilter, QCsentinel, QClog, QCfeature):
New variables.
(NETCONN1_P): New macro.
(DATAGRAM_SOCKETS): New conditional symbol.
(datagram_address): New array.
(DATAGRAM_CONN_P, DATAGRAM_CHAN_P): New macros.
(status_message): Use concat3.
(Fprocess_status): Add `listen' status to doc string. Return `stop'
for a stopped network process.
(Fset_process_buffer): Update contact plist for network process.
(Fset_process_filter): Ditto. Don't enable input for stopped
network processes. Server must listen, even if filter is t.
(Fset_process_query_on_exit_flag, Fprocess_query_on_exit_flag):
New functions.
(Fprocess_kill_without_query): Removed. Now defined in simple.el.
(Fprocess_contact): Added KEY argument. Handle datagrams.
(list_processes_1): Optionally show only processes with the query
on exit flag set. Dynamically adjust column widths. Omit tty
column if not needed. Report stopped network processes.
Identify server and datagram network processes.
(Flist_processes): New optional arg `query-only'.
(conv_sockaddr_to_lisp, get_lisp_to_sockaddr_size)
(conv_lisp_to_sockaddr, set_socket_options)
(network_process_featurep, unwind_request_sigio): New helper functions.
(Fprocess_datagram_address, Fset_process_datagram_address):
(Fset_network_process_options): New lisp functions.
(Fopen_network_stream): Removed. Now defined in simple.el.
(Fmake_network_process): New lisp function. Code is based on previous
Fopen_network_stream, but heavily reworked with new property list based
argument list, support for datagrams, server processes, and local
sockets in addition to old client-only functionality.
(server_accept_connection): New function.
(wait_reading_process_input): Use it to handle incoming connects.
Do not enable input on a new connection if process is stopped.
(read_process_output): Handle datagram sockets. Use 2k buffer for them.
(send_process): Handle datagram sockets.
(Fstop_process, Fcontinue_process): Apply to network processes. A stopped
network process is indicated by setting command field to t .
(Fprocess_send_eof): No-op if datagram connection.
(Fstatus_notify): Don't read input for a stream server socket or a
stopped network process.
(init_process): Initialize datagram_address array.
(syms_of_process): Intern and staticpro new variables, defsubr new
functions.
2002-03-17 20:20:33 +00:00
|
|
|
|
#ifdef DATAGRAM_SOCKETS
|
|
|
|
|
if (DATAGRAM_CHAN_P (inchannel))
|
|
|
|
|
{
|
|
|
|
|
xfree (datagram_address[inchannel].sa);
|
|
|
|
|
datagram_address[inchannel].sa = 0;
|
|
|
|
|
datagram_address[inchannel].len = 0;
|
|
|
|
|
}
|
|
|
|
|
#endif
|
1992-03-14 20:40:04 +00:00
|
|
|
|
chan_process[inchannel] = Qnil;
|
|
|
|
|
FD_CLR (inchannel, &input_wait_mask);
|
1994-10-25 09:48:44 +00:00
|
|
|
|
FD_CLR (inchannel, &non_keyboard_wait_mask);
|
2004-11-01 11:04:37 +00:00
|
|
|
|
#ifdef NON_BLOCKING_CONNECT
|
2002-02-28 23:53:59 +00:00
|
|
|
|
if (FD_ISSET (inchannel, &connect_wait_mask))
|
|
|
|
|
{
|
|
|
|
|
FD_CLR (inchannel, &connect_wait_mask);
|
|
|
|
|
if (--num_pending_connects < 0)
|
|
|
|
|
abort ();
|
|
|
|
|
}
|
2004-11-01 11:04:37 +00:00
|
|
|
|
#endif
|
1994-04-23 05:18:09 +00:00
|
|
|
|
if (inchannel == max_process_desc)
|
|
|
|
|
{
|
|
|
|
|
int i;
|
|
|
|
|
/* We just closed the highest-numbered process input descriptor,
|
|
|
|
|
so recompute the highest-numbered one now. */
|
|
|
|
|
max_process_desc = 0;
|
|
|
|
|
for (i = 0; i < MAXDESC; i++)
|
|
|
|
|
if (!NILP (chan_process[i]))
|
|
|
|
|
max_process_desc = i;
|
|
|
|
|
}
|
1992-03-14 20:40:04 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
DEFUN ("accept-process-output", Faccept_process_output, Saccept_process_output,
|
2004-08-17 22:24:29 +00:00
|
|
|
|
0, 4, 0,
|
2001-10-20 20:56:10 +00:00
|
|
|
|
doc: /* Allow any pending output from subprocesses to be read by Emacs.
|
|
|
|
|
It is read into the process' buffers or given to their filter functions.
|
|
|
|
|
Non-nil arg PROCESS means do not return until some output has been received
|
|
|
|
|
from PROCESS.
|
2006-03-22 22:33:35 +00:00
|
|
|
|
|
2008-10-02 08:04:54 +00:00
|
|
|
|
Non-nil second arg SECONDS and third arg MILLISEC are number of seconds
|
|
|
|
|
and milliseconds to wait; return after that much time whether or not
|
|
|
|
|
there is any subprocess output. If SECONDS is a floating point number,
|
2006-03-22 22:33:35 +00:00
|
|
|
|
it specifies a fractional number of seconds to wait.
|
2008-05-29 16:54:53 +00:00
|
|
|
|
The MILLISEC argument is obsolete and should be avoided.
|
2006-03-22 22:33:35 +00:00
|
|
|
|
|
2004-08-17 22:24:29 +00:00
|
|
|
|
If optional fourth arg JUST-THIS-ONE is non-nil, only accept output
|
|
|
|
|
from PROCESS, suspending reading output from other processes.
|
|
|
|
|
If JUST-THIS-ONE is an integer, don't run any timers either.
|
2007-08-08 07:49:21 +00:00
|
|
|
|
Return non-nil if we received any output before the timeout expired. */)
|
2010-07-08 14:25:08 -07:00
|
|
|
|
(register Lisp_Object process, Lisp_Object seconds, Lisp_Object millisec, Lisp_Object just_this_one)
|
1992-03-14 20:40:04 +00:00
|
|
|
|
{
|
2006-03-22 22:33:35 +00:00
|
|
|
|
int secs, usecs = 0;
|
1992-03-14 20:40:04 +00:00
|
|
|
|
|
1999-04-08 16:50:04 +00:00
|
|
|
|
if (! NILP (process))
|
2001-11-02 20:46:55 +00:00
|
|
|
|
CHECK_PROCESS (process);
|
2004-08-17 22:24:29 +00:00
|
|
|
|
else
|
|
|
|
|
just_this_one = Qnil;
|
1999-04-08 16:50:04 +00:00
|
|
|
|
|
2008-05-29 16:54:53 +00:00
|
|
|
|
if (!NILP (millisec))
|
|
|
|
|
{ /* Obsolete calling convention using integers rather than floats. */
|
|
|
|
|
CHECK_NUMBER (millisec);
|
|
|
|
|
if (NILP (seconds))
|
|
|
|
|
seconds = make_float (XINT (millisec) / 1000.0);
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
CHECK_NUMBER (seconds);
|
|
|
|
|
seconds = make_float (XINT (millisec) / 1000.0 + XINT (seconds));
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2006-03-22 22:33:35 +00:00
|
|
|
|
if (!NILP (seconds))
|
1992-03-14 20:40:04 +00:00
|
|
|
|
{
|
2006-03-22 22:33:35 +00:00
|
|
|
|
if (INTEGERP (seconds))
|
|
|
|
|
secs = XINT (seconds);
|
|
|
|
|
else if (FLOATP (seconds))
|
|
|
|
|
{
|
|
|
|
|
double timeout = XFLOAT_DATA (seconds);
|
|
|
|
|
secs = (int) timeout;
|
|
|
|
|
usecs = (int) ((timeout - (double) secs) * 1000000);
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
wrong_type_argument (Qnumberp, seconds);
|
1992-03-14 20:40:04 +00:00
|
|
|
|
|
2006-03-22 22:33:35 +00:00
|
|
|
|
if (secs < 0 || (secs == 0 && usecs == 0))
|
|
|
|
|
secs = -1, usecs = 0;
|
1992-03-14 20:40:04 +00:00
|
|
|
|
}
|
|
|
|
|
else
|
2006-03-22 22:33:35 +00:00
|
|
|
|
secs = NILP (process) ? -1 : 0;
|
1992-03-14 20:40:04 +00:00
|
|
|
|
|
|
|
|
|
return
|
2006-03-22 22:33:35 +00:00
|
|
|
|
(wait_reading_process_output (secs, usecs, 0, 0,
|
2004-08-20 10:33:25 +00:00
|
|
|
|
Qnil,
|
|
|
|
|
!NILP (process) ? XPROCESS (process) : NULL,
|
|
|
|
|
NILP (just_this_one) ? 0 :
|
|
|
|
|
!INTEGERP (just_this_one) ? 1 : -1)
|
1992-03-14 20:40:04 +00:00
|
|
|
|
? Qt : Qnil);
|
|
|
|
|
}
|
|
|
|
|
|
(Qlocal, QCname, QCbuffer, QChost, QCservice, QCfamily)
(QClocal, QCremote, QCserver, QCdatagram, QCnowait, QCnoquery,QCstop)
(QCcoding, QCoptions, QCfilter, QCsentinel, QClog, QCfeature):
New variables.
(NETCONN1_P): New macro.
(DATAGRAM_SOCKETS): New conditional symbol.
(datagram_address): New array.
(DATAGRAM_CONN_P, DATAGRAM_CHAN_P): New macros.
(status_message): Use concat3.
(Fprocess_status): Add `listen' status to doc string. Return `stop'
for a stopped network process.
(Fset_process_buffer): Update contact plist for network process.
(Fset_process_filter): Ditto. Don't enable input for stopped
network processes. Server must listen, even if filter is t.
(Fset_process_query_on_exit_flag, Fprocess_query_on_exit_flag):
New functions.
(Fprocess_kill_without_query): Removed. Now defined in simple.el.
(Fprocess_contact): Added KEY argument. Handle datagrams.
(list_processes_1): Optionally show only processes with the query
on exit flag set. Dynamically adjust column widths. Omit tty
column if not needed. Report stopped network processes.
Identify server and datagram network processes.
(Flist_processes): New optional arg `query-only'.
(conv_sockaddr_to_lisp, get_lisp_to_sockaddr_size)
(conv_lisp_to_sockaddr, set_socket_options)
(network_process_featurep, unwind_request_sigio): New helper functions.
(Fprocess_datagram_address, Fset_process_datagram_address):
(Fset_network_process_options): New lisp functions.
(Fopen_network_stream): Removed. Now defined in simple.el.
(Fmake_network_process): New lisp function. Code is based on previous
Fopen_network_stream, but heavily reworked with new property list based
argument list, support for datagrams, server processes, and local
sockets in addition to old client-only functionality.
(server_accept_connection): New function.
(wait_reading_process_input): Use it to handle incoming connects.
Do not enable input on a new connection if process is stopped.
(read_process_output): Handle datagram sockets. Use 2k buffer for them.
(send_process): Handle datagram sockets.
(Fstop_process, Fcontinue_process): Apply to network processes. A stopped
network process is indicated by setting command field to t .
(Fprocess_send_eof): No-op if datagram connection.
(Fstatus_notify): Don't read input for a stream server socket or a
stopped network process.
(init_process): Initialize datagram_address array.
(syms_of_process): Intern and staticpro new variables, defsubr new
functions.
2002-03-17 20:20:33 +00:00
|
|
|
|
/* Accept a connection for server process SERVER on CHANNEL. */
|
|
|
|
|
|
|
|
|
|
static int connect_counter = 0;
|
|
|
|
|
|
|
|
|
|
static void
|
2010-07-05 12:36:06 +02:00
|
|
|
|
server_accept_connection (Lisp_Object server, int channel)
|
(Qlocal, QCname, QCbuffer, QChost, QCservice, QCfamily)
(QClocal, QCremote, QCserver, QCdatagram, QCnowait, QCnoquery,QCstop)
(QCcoding, QCoptions, QCfilter, QCsentinel, QClog, QCfeature):
New variables.
(NETCONN1_P): New macro.
(DATAGRAM_SOCKETS): New conditional symbol.
(datagram_address): New array.
(DATAGRAM_CONN_P, DATAGRAM_CHAN_P): New macros.
(status_message): Use concat3.
(Fprocess_status): Add `listen' status to doc string. Return `stop'
for a stopped network process.
(Fset_process_buffer): Update contact plist for network process.
(Fset_process_filter): Ditto. Don't enable input for stopped
network processes. Server must listen, even if filter is t.
(Fset_process_query_on_exit_flag, Fprocess_query_on_exit_flag):
New functions.
(Fprocess_kill_without_query): Removed. Now defined in simple.el.
(Fprocess_contact): Added KEY argument. Handle datagrams.
(list_processes_1): Optionally show only processes with the query
on exit flag set. Dynamically adjust column widths. Omit tty
column if not needed. Report stopped network processes.
Identify server and datagram network processes.
(Flist_processes): New optional arg `query-only'.
(conv_sockaddr_to_lisp, get_lisp_to_sockaddr_size)
(conv_lisp_to_sockaddr, set_socket_options)
(network_process_featurep, unwind_request_sigio): New helper functions.
(Fprocess_datagram_address, Fset_process_datagram_address):
(Fset_network_process_options): New lisp functions.
(Fopen_network_stream): Removed. Now defined in simple.el.
(Fmake_network_process): New lisp function. Code is based on previous
Fopen_network_stream, but heavily reworked with new property list based
argument list, support for datagrams, server processes, and local
sockets in addition to old client-only functionality.
(server_accept_connection): New function.
(wait_reading_process_input): Use it to handle incoming connects.
Do not enable input on a new connection if process is stopped.
(read_process_output): Handle datagram sockets. Use 2k buffer for them.
(send_process): Handle datagram sockets.
(Fstop_process, Fcontinue_process): Apply to network processes. A stopped
network process is indicated by setting command field to t .
(Fprocess_send_eof): No-op if datagram connection.
(Fstatus_notify): Don't read input for a stream server socket or a
stopped network process.
(init_process): Initialize datagram_address array.
(syms_of_process): Intern and staticpro new variables, defsubr new
functions.
2002-03-17 20:20:33 +00:00
|
|
|
|
{
|
|
|
|
|
Lisp_Object proc, caller, name, buffer;
|
|
|
|
|
Lisp_Object contact, host, service;
|
|
|
|
|
struct Lisp_Process *ps= XPROCESS (server);
|
|
|
|
|
struct Lisp_Process *p;
|
|
|
|
|
int s;
|
|
|
|
|
union u_sockaddr {
|
|
|
|
|
struct sockaddr sa;
|
|
|
|
|
struct sockaddr_in in;
|
2006-01-04 00:16:54 +00:00
|
|
|
|
#ifdef AF_INET6
|
|
|
|
|
struct sockaddr_in6 in6;
|
|
|
|
|
#endif
|
(Qlocal, QCname, QCbuffer, QChost, QCservice, QCfamily)
(QClocal, QCremote, QCserver, QCdatagram, QCnowait, QCnoquery,QCstop)
(QCcoding, QCoptions, QCfilter, QCsentinel, QClog, QCfeature):
New variables.
(NETCONN1_P): New macro.
(DATAGRAM_SOCKETS): New conditional symbol.
(datagram_address): New array.
(DATAGRAM_CONN_P, DATAGRAM_CHAN_P): New macros.
(status_message): Use concat3.
(Fprocess_status): Add `listen' status to doc string. Return `stop'
for a stopped network process.
(Fset_process_buffer): Update contact plist for network process.
(Fset_process_filter): Ditto. Don't enable input for stopped
network processes. Server must listen, even if filter is t.
(Fset_process_query_on_exit_flag, Fprocess_query_on_exit_flag):
New functions.
(Fprocess_kill_without_query): Removed. Now defined in simple.el.
(Fprocess_contact): Added KEY argument. Handle datagrams.
(list_processes_1): Optionally show only processes with the query
on exit flag set. Dynamically adjust column widths. Omit tty
column if not needed. Report stopped network processes.
Identify server and datagram network processes.
(Flist_processes): New optional arg `query-only'.
(conv_sockaddr_to_lisp, get_lisp_to_sockaddr_size)
(conv_lisp_to_sockaddr, set_socket_options)
(network_process_featurep, unwind_request_sigio): New helper functions.
(Fprocess_datagram_address, Fset_process_datagram_address):
(Fset_network_process_options): New lisp functions.
(Fopen_network_stream): Removed. Now defined in simple.el.
(Fmake_network_process): New lisp function. Code is based on previous
Fopen_network_stream, but heavily reworked with new property list based
argument list, support for datagrams, server processes, and local
sockets in addition to old client-only functionality.
(server_accept_connection): New function.
(wait_reading_process_input): Use it to handle incoming connects.
Do not enable input on a new connection if process is stopped.
(read_process_output): Handle datagram sockets. Use 2k buffer for them.
(send_process): Handle datagram sockets.
(Fstop_process, Fcontinue_process): Apply to network processes. A stopped
network process is indicated by setting command field to t .
(Fprocess_send_eof): No-op if datagram connection.
(Fstatus_notify): Don't read input for a stream server socket or a
stopped network process.
(init_process): Initialize datagram_address array.
(syms_of_process): Intern and staticpro new variables, defsubr new
functions.
2002-03-17 20:20:33 +00:00
|
|
|
|
#ifdef HAVE_LOCAL_SOCKETS
|
|
|
|
|
struct sockaddr_un un;
|
|
|
|
|
#endif
|
|
|
|
|
} saddr;
|
|
|
|
|
int len = sizeof saddr;
|
|
|
|
|
|
|
|
|
|
s = accept (channel, &saddr.sa, &len);
|
|
|
|
|
|
|
|
|
|
if (s < 0)
|
|
|
|
|
{
|
|
|
|
|
int code = errno;
|
|
|
|
|
|
|
|
|
|
if (code == EAGAIN)
|
|
|
|
|
return;
|
|
|
|
|
#ifdef EWOULDBLOCK
|
|
|
|
|
if (code == EWOULDBLOCK)
|
|
|
|
|
return;
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
if (!NILP (ps->log))
|
|
|
|
|
call3 (ps->log, server, Qnil,
|
|
|
|
|
concat3 (build_string ("accept failed with code"),
|
|
|
|
|
Fnumber_to_string (make_number (code)),
|
|
|
|
|
build_string ("\n")));
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
connect_counter++;
|
|
|
|
|
|
|
|
|
|
/* Setup a new process to handle the connection. */
|
|
|
|
|
|
|
|
|
|
/* Generate a unique identification of the caller, and build contact
|
|
|
|
|
information for this process. */
|
|
|
|
|
host = Qt;
|
|
|
|
|
service = Qnil;
|
|
|
|
|
switch (saddr.sa.sa_family)
|
|
|
|
|
{
|
|
|
|
|
case AF_INET:
|
|
|
|
|
{
|
|
|
|
|
Lisp_Object args[5];
|
|
|
|
|
unsigned char *ip = (unsigned char *)&saddr.in.sin_addr.s_addr;
|
|
|
|
|
args[0] = build_string ("%d.%d.%d.%d");
|
|
|
|
|
args[1] = make_number (*ip++);
|
|
|
|
|
args[2] = make_number (*ip++);
|
|
|
|
|
args[3] = make_number (*ip++);
|
|
|
|
|
args[4] = make_number (*ip++);
|
|
|
|
|
host = Fformat (5, args);
|
|
|
|
|
service = make_number (ntohs (saddr.in.sin_port));
|
|
|
|
|
|
|
|
|
|
args[0] = build_string (" <%s:%d>");
|
|
|
|
|
args[1] = host;
|
|
|
|
|
args[2] = service;
|
|
|
|
|
caller = Fformat (3, args);
|
|
|
|
|
}
|
|
|
|
|
break;
|
|
|
|
|
|
2006-01-04 00:16:54 +00:00
|
|
|
|
#ifdef AF_INET6
|
|
|
|
|
case AF_INET6:
|
|
|
|
|
{
|
|
|
|
|
Lisp_Object args[9];
|
|
|
|
|
uint16_t *ip6 = (uint16_t *)&saddr.in6.sin6_addr;
|
|
|
|
|
int i;
|
|
|
|
|
args[0] = build_string ("%x:%x:%x:%x:%x:%x:%x:%x");
|
|
|
|
|
for (i = 0; i < 8; i++)
|
2010-07-07 11:45:28 +02:00
|
|
|
|
args[i+1] = make_number (ntohs (ip6[i]));
|
2006-01-04 00:16:54 +00:00
|
|
|
|
host = Fformat (9, args);
|
|
|
|
|
service = make_number (ntohs (saddr.in.sin_port));
|
|
|
|
|
|
|
|
|
|
args[0] = build_string (" <[%s]:%d>");
|
|
|
|
|
args[1] = host;
|
|
|
|
|
args[2] = service;
|
|
|
|
|
caller = Fformat (3, args);
|
|
|
|
|
}
|
|
|
|
|
break;
|
|
|
|
|
#endif
|
|
|
|
|
|
(Qlocal, QCname, QCbuffer, QChost, QCservice, QCfamily)
(QClocal, QCremote, QCserver, QCdatagram, QCnowait, QCnoquery,QCstop)
(QCcoding, QCoptions, QCfilter, QCsentinel, QClog, QCfeature):
New variables.
(NETCONN1_P): New macro.
(DATAGRAM_SOCKETS): New conditional symbol.
(datagram_address): New array.
(DATAGRAM_CONN_P, DATAGRAM_CHAN_P): New macros.
(status_message): Use concat3.
(Fprocess_status): Add `listen' status to doc string. Return `stop'
for a stopped network process.
(Fset_process_buffer): Update contact plist for network process.
(Fset_process_filter): Ditto. Don't enable input for stopped
network processes. Server must listen, even if filter is t.
(Fset_process_query_on_exit_flag, Fprocess_query_on_exit_flag):
New functions.
(Fprocess_kill_without_query): Removed. Now defined in simple.el.
(Fprocess_contact): Added KEY argument. Handle datagrams.
(list_processes_1): Optionally show only processes with the query
on exit flag set. Dynamically adjust column widths. Omit tty
column if not needed. Report stopped network processes.
Identify server and datagram network processes.
(Flist_processes): New optional arg `query-only'.
(conv_sockaddr_to_lisp, get_lisp_to_sockaddr_size)
(conv_lisp_to_sockaddr, set_socket_options)
(network_process_featurep, unwind_request_sigio): New helper functions.
(Fprocess_datagram_address, Fset_process_datagram_address):
(Fset_network_process_options): New lisp functions.
(Fopen_network_stream): Removed. Now defined in simple.el.
(Fmake_network_process): New lisp function. Code is based on previous
Fopen_network_stream, but heavily reworked with new property list based
argument list, support for datagrams, server processes, and local
sockets in addition to old client-only functionality.
(server_accept_connection): New function.
(wait_reading_process_input): Use it to handle incoming connects.
Do not enable input on a new connection if process is stopped.
(read_process_output): Handle datagram sockets. Use 2k buffer for them.
(send_process): Handle datagram sockets.
(Fstop_process, Fcontinue_process): Apply to network processes. A stopped
network process is indicated by setting command field to t .
(Fprocess_send_eof): No-op if datagram connection.
(Fstatus_notify): Don't read input for a stream server socket or a
stopped network process.
(init_process): Initialize datagram_address array.
(syms_of_process): Intern and staticpro new variables, defsubr new
functions.
2002-03-17 20:20:33 +00:00
|
|
|
|
#ifdef HAVE_LOCAL_SOCKETS
|
|
|
|
|
case AF_LOCAL:
|
|
|
|
|
#endif
|
|
|
|
|
default:
|
|
|
|
|
caller = Fnumber_to_string (make_number (connect_counter));
|
2008-03-27 20:52:24 +00:00
|
|
|
|
caller = concat3 (build_string (" <"), caller, build_string (">"));
|
(Qlocal, QCname, QCbuffer, QChost, QCservice, QCfamily)
(QClocal, QCremote, QCserver, QCdatagram, QCnowait, QCnoquery,QCstop)
(QCcoding, QCoptions, QCfilter, QCsentinel, QClog, QCfeature):
New variables.
(NETCONN1_P): New macro.
(DATAGRAM_SOCKETS): New conditional symbol.
(datagram_address): New array.
(DATAGRAM_CONN_P, DATAGRAM_CHAN_P): New macros.
(status_message): Use concat3.
(Fprocess_status): Add `listen' status to doc string. Return `stop'
for a stopped network process.
(Fset_process_buffer): Update contact plist for network process.
(Fset_process_filter): Ditto. Don't enable input for stopped
network processes. Server must listen, even if filter is t.
(Fset_process_query_on_exit_flag, Fprocess_query_on_exit_flag):
New functions.
(Fprocess_kill_without_query): Removed. Now defined in simple.el.
(Fprocess_contact): Added KEY argument. Handle datagrams.
(list_processes_1): Optionally show only processes with the query
on exit flag set. Dynamically adjust column widths. Omit tty
column if not needed. Report stopped network processes.
Identify server and datagram network processes.
(Flist_processes): New optional arg `query-only'.
(conv_sockaddr_to_lisp, get_lisp_to_sockaddr_size)
(conv_lisp_to_sockaddr, set_socket_options)
(network_process_featurep, unwind_request_sigio): New helper functions.
(Fprocess_datagram_address, Fset_process_datagram_address):
(Fset_network_process_options): New lisp functions.
(Fopen_network_stream): Removed. Now defined in simple.el.
(Fmake_network_process): New lisp function. Code is based on previous
Fopen_network_stream, but heavily reworked with new property list based
argument list, support for datagrams, server processes, and local
sockets in addition to old client-only functionality.
(server_accept_connection): New function.
(wait_reading_process_input): Use it to handle incoming connects.
Do not enable input on a new connection if process is stopped.
(read_process_output): Handle datagram sockets. Use 2k buffer for them.
(send_process): Handle datagram sockets.
(Fstop_process, Fcontinue_process): Apply to network processes. A stopped
network process is indicated by setting command field to t .
(Fprocess_send_eof): No-op if datagram connection.
(Fstatus_notify): Don't read input for a stream server socket or a
stopped network process.
(init_process): Initialize datagram_address array.
(syms_of_process): Intern and staticpro new variables, defsubr new
functions.
2002-03-17 20:20:33 +00:00
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Create a new buffer name for this process if it doesn't have a
|
|
|
|
|
filter. The new buffer name is based on the buffer name or
|
|
|
|
|
process name of the server process concatenated with the caller
|
|
|
|
|
identification. */
|
|
|
|
|
|
|
|
|
|
if (!NILP (ps->filter) && !EQ (ps->filter, Qt))
|
|
|
|
|
buffer = Qnil;
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
buffer = ps->buffer;
|
|
|
|
|
if (!NILP (buffer))
|
|
|
|
|
buffer = Fbuffer_name (buffer);
|
|
|
|
|
else
|
|
|
|
|
buffer = ps->name;
|
|
|
|
|
if (!NILP (buffer))
|
|
|
|
|
{
|
|
|
|
|
buffer = concat2 (buffer, caller);
|
|
|
|
|
buffer = Fget_buffer_create (buffer);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Generate a unique name for the new server process. Combine the
|
|
|
|
|
server process name with the caller identification. */
|
|
|
|
|
|
|
|
|
|
name = concat2 (ps->name, caller);
|
|
|
|
|
proc = make_process (name);
|
|
|
|
|
|
|
|
|
|
chan_process[s] = proc;
|
|
|
|
|
|
|
|
|
|
#ifdef O_NONBLOCK
|
|
|
|
|
fcntl (s, F_SETFL, O_NONBLOCK);
|
|
|
|
|
#else
|
|
|
|
|
#ifdef O_NDELAY
|
|
|
|
|
fcntl (s, F_SETFL, O_NDELAY);
|
|
|
|
|
#endif
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
p = XPROCESS (proc);
|
|
|
|
|
|
|
|
|
|
/* Build new contact information for this setup. */
|
|
|
|
|
contact = Fcopy_sequence (ps->childp);
|
|
|
|
|
contact = Fplist_put (contact, QCserver, Qnil);
|
|
|
|
|
contact = Fplist_put (contact, QChost, host);
|
|
|
|
|
if (!NILP (service))
|
|
|
|
|
contact = Fplist_put (contact, QCservice, service);
|
2003-02-04 14:56:31 +00:00
|
|
|
|
contact = Fplist_put (contact, QCremote,
|
(Qlocal, QCname, QCbuffer, QChost, QCservice, QCfamily)
(QClocal, QCremote, QCserver, QCdatagram, QCnowait, QCnoquery,QCstop)
(QCcoding, QCoptions, QCfilter, QCsentinel, QClog, QCfeature):
New variables.
(NETCONN1_P): New macro.
(DATAGRAM_SOCKETS): New conditional symbol.
(datagram_address): New array.
(DATAGRAM_CONN_P, DATAGRAM_CHAN_P): New macros.
(status_message): Use concat3.
(Fprocess_status): Add `listen' status to doc string. Return `stop'
for a stopped network process.
(Fset_process_buffer): Update contact plist for network process.
(Fset_process_filter): Ditto. Don't enable input for stopped
network processes. Server must listen, even if filter is t.
(Fset_process_query_on_exit_flag, Fprocess_query_on_exit_flag):
New functions.
(Fprocess_kill_without_query): Removed. Now defined in simple.el.
(Fprocess_contact): Added KEY argument. Handle datagrams.
(list_processes_1): Optionally show only processes with the query
on exit flag set. Dynamically adjust column widths. Omit tty
column if not needed. Report stopped network processes.
Identify server and datagram network processes.
(Flist_processes): New optional arg `query-only'.
(conv_sockaddr_to_lisp, get_lisp_to_sockaddr_size)
(conv_lisp_to_sockaddr, set_socket_options)
(network_process_featurep, unwind_request_sigio): New helper functions.
(Fprocess_datagram_address, Fset_process_datagram_address):
(Fset_network_process_options): New lisp functions.
(Fopen_network_stream): Removed. Now defined in simple.el.
(Fmake_network_process): New lisp function. Code is based on previous
Fopen_network_stream, but heavily reworked with new property list based
argument list, support for datagrams, server processes, and local
sockets in addition to old client-only functionality.
(server_accept_connection): New function.
(wait_reading_process_input): Use it to handle incoming connects.
Do not enable input on a new connection if process is stopped.
(read_process_output): Handle datagram sockets. Use 2k buffer for them.
(send_process): Handle datagram sockets.
(Fstop_process, Fcontinue_process): Apply to network processes. A stopped
network process is indicated by setting command field to t .
(Fprocess_send_eof): No-op if datagram connection.
(Fstatus_notify): Don't read input for a stream server socket or a
stopped network process.
(init_process): Initialize datagram_address array.
(syms_of_process): Intern and staticpro new variables, defsubr new
functions.
2002-03-17 20:20:33 +00:00
|
|
|
|
conv_sockaddr_to_lisp (&saddr.sa, len));
|
|
|
|
|
#ifdef HAVE_GETSOCKNAME
|
|
|
|
|
len = sizeof saddr;
|
2003-01-08 10:38:06 +00:00
|
|
|
|
if (getsockname (s, &saddr.sa, &len) == 0)
|
2003-02-04 14:56:31 +00:00
|
|
|
|
contact = Fplist_put (contact, QClocal,
|
(Qlocal, QCname, QCbuffer, QChost, QCservice, QCfamily)
(QClocal, QCremote, QCserver, QCdatagram, QCnowait, QCnoquery,QCstop)
(QCcoding, QCoptions, QCfilter, QCsentinel, QClog, QCfeature):
New variables.
(NETCONN1_P): New macro.
(DATAGRAM_SOCKETS): New conditional symbol.
(datagram_address): New array.
(DATAGRAM_CONN_P, DATAGRAM_CHAN_P): New macros.
(status_message): Use concat3.
(Fprocess_status): Add `listen' status to doc string. Return `stop'
for a stopped network process.
(Fset_process_buffer): Update contact plist for network process.
(Fset_process_filter): Ditto. Don't enable input for stopped
network processes. Server must listen, even if filter is t.
(Fset_process_query_on_exit_flag, Fprocess_query_on_exit_flag):
New functions.
(Fprocess_kill_without_query): Removed. Now defined in simple.el.
(Fprocess_contact): Added KEY argument. Handle datagrams.
(list_processes_1): Optionally show only processes with the query
on exit flag set. Dynamically adjust column widths. Omit tty
column if not needed. Report stopped network processes.
Identify server and datagram network processes.
(Flist_processes): New optional arg `query-only'.
(conv_sockaddr_to_lisp, get_lisp_to_sockaddr_size)
(conv_lisp_to_sockaddr, set_socket_options)
(network_process_featurep, unwind_request_sigio): New helper functions.
(Fprocess_datagram_address, Fset_process_datagram_address):
(Fset_network_process_options): New lisp functions.
(Fopen_network_stream): Removed. Now defined in simple.el.
(Fmake_network_process): New lisp function. Code is based on previous
Fopen_network_stream, but heavily reworked with new property list based
argument list, support for datagrams, server processes, and local
sockets in addition to old client-only functionality.
(server_accept_connection): New function.
(wait_reading_process_input): Use it to handle incoming connects.
Do not enable input on a new connection if process is stopped.
(read_process_output): Handle datagram sockets. Use 2k buffer for them.
(send_process): Handle datagram sockets.
(Fstop_process, Fcontinue_process): Apply to network processes. A stopped
network process is indicated by setting command field to t .
(Fprocess_send_eof): No-op if datagram connection.
(Fstatus_notify): Don't read input for a stream server socket or a
stopped network process.
(init_process): Initialize datagram_address array.
(syms_of_process): Intern and staticpro new variables, defsubr new
functions.
2002-03-17 20:20:33 +00:00
|
|
|
|
conv_sockaddr_to_lisp (&saddr.sa, len));
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
p->childp = contact;
|
2003-01-14 09:55:50 +00:00
|
|
|
|
p->plist = Fcopy_sequence (ps->plist);
|
Daniel Engeler <engeler at gmail.com>
These changes add serial port access.
* process.c: Add HAVE_SERIAL.
(Fdelete_process, Fprocess_status, Fset_process_buffer)
(Fset_process_filter, Fset_process_sentinel, Fprocess_contact)
(list_processes_1, select_wrapper, Fstop_process)
(Fcontinue_process, Fprocess_send_eof, kill_buffer_processes)
(status_notify): Modify to handle serial processes.
[HAVE_SERIAL] (Fserial_process_configure)
[HAVE_SERIAL] (make_serial_process_unwind, Fmake_serial_process):
New functions.
* process.h (struct Lisp_Process): Add `type'.
* sysdep.c [HAVE_TERMIOS] (serial_open, serial_configure):
New functions.
* w32.c (_sys_read_ahead, sys_read, sys_write): Modify to handle serial ports.
(serial_open, serial_configure) New functions.
* w32.h: Add FILE_SERIAL.
(struct _child_process): Add ovl_read, ovl_write.
2008-06-13 08:08:20 +00:00
|
|
|
|
p->type = Qnetwork;
|
2003-01-12 20:24:06 +00:00
|
|
|
|
|
(Qlocal, QCname, QCbuffer, QChost, QCservice, QCfamily)
(QClocal, QCremote, QCserver, QCdatagram, QCnowait, QCnoquery,QCstop)
(QCcoding, QCoptions, QCfilter, QCsentinel, QClog, QCfeature):
New variables.
(NETCONN1_P): New macro.
(DATAGRAM_SOCKETS): New conditional symbol.
(datagram_address): New array.
(DATAGRAM_CONN_P, DATAGRAM_CHAN_P): New macros.
(status_message): Use concat3.
(Fprocess_status): Add `listen' status to doc string. Return `stop'
for a stopped network process.
(Fset_process_buffer): Update contact plist for network process.
(Fset_process_filter): Ditto. Don't enable input for stopped
network processes. Server must listen, even if filter is t.
(Fset_process_query_on_exit_flag, Fprocess_query_on_exit_flag):
New functions.
(Fprocess_kill_without_query): Removed. Now defined in simple.el.
(Fprocess_contact): Added KEY argument. Handle datagrams.
(list_processes_1): Optionally show only processes with the query
on exit flag set. Dynamically adjust column widths. Omit tty
column if not needed. Report stopped network processes.
Identify server and datagram network processes.
(Flist_processes): New optional arg `query-only'.
(conv_sockaddr_to_lisp, get_lisp_to_sockaddr_size)
(conv_lisp_to_sockaddr, set_socket_options)
(network_process_featurep, unwind_request_sigio): New helper functions.
(Fprocess_datagram_address, Fset_process_datagram_address):
(Fset_network_process_options): New lisp functions.
(Fopen_network_stream): Removed. Now defined in simple.el.
(Fmake_network_process): New lisp function. Code is based on previous
Fopen_network_stream, but heavily reworked with new property list based
argument list, support for datagrams, server processes, and local
sockets in addition to old client-only functionality.
(server_accept_connection): New function.
(wait_reading_process_input): Use it to handle incoming connects.
Do not enable input on a new connection if process is stopped.
(read_process_output): Handle datagram sockets. Use 2k buffer for them.
(send_process): Handle datagram sockets.
(Fstop_process, Fcontinue_process): Apply to network processes. A stopped
network process is indicated by setting command field to t .
(Fprocess_send_eof): No-op if datagram connection.
(Fstatus_notify): Don't read input for a stream server socket or a
stopped network process.
(init_process): Initialize datagram_address array.
(syms_of_process): Intern and staticpro new variables, defsubr new
functions.
2002-03-17 20:20:33 +00:00
|
|
|
|
p->buffer = buffer;
|
|
|
|
|
p->sentinel = ps->sentinel;
|
|
|
|
|
p->filter = ps->filter;
|
|
|
|
|
p->command = Qnil;
|
* process.h (struct Lisp_Process): Replace Lisp_Objects `pid',
`raw_status_high', and `raw_status_low' with plain integers, and move
them to the end of the structure.
* alloc.c (allocate_process): Use PSEUDOVECSIZE to initialize the
pseudovector's size field so only the Lisp_Object fields get GC'd.
* process.c (update_status, make_process, Fdelete_process)
(Fprocess_status, list_processes_1, start_process_unwind)
(create_process, Fmake_network_process, server_accept_connection)
(wait_reading_process_output, send_process, Fprocess_running_child_p)
(process_send_signal, proc_encode_coding_system, Fprocess_send_eof)
(sigchld_handler, status_notify): Adjust to new non-Lisp fields for
`pid' and `raw_status'.
(Fprocess_id, Fsignal_process): Same, and additionally use floats when
representing PIDs that are larger than most-positive-fixnum.
2006-04-08 15:07:35 +00:00
|
|
|
|
p->pid = 0;
|
(struct Lisp_Process): Turn slots infd, outfd, kill_without_query, pty_flag,
tick, update_tick, decoding_carryover, inherit_coding_system_flag,
filter_multibyte, adaptive_read_buffering, read_output_delay, and
read_output_skip from Lisp_Objects to ints. Remove unused
encoding_carryover.
2007-07-12 06:36:57 +00:00
|
|
|
|
p->infd = s;
|
|
|
|
|
p->outfd = s;
|
(Qlocal, QCname, QCbuffer, QChost, QCservice, QCfamily)
(QClocal, QCremote, QCserver, QCdatagram, QCnowait, QCnoquery,QCstop)
(QCcoding, QCoptions, QCfilter, QCsentinel, QClog, QCfeature):
New variables.
(NETCONN1_P): New macro.
(DATAGRAM_SOCKETS): New conditional symbol.
(datagram_address): New array.
(DATAGRAM_CONN_P, DATAGRAM_CHAN_P): New macros.
(status_message): Use concat3.
(Fprocess_status): Add `listen' status to doc string. Return `stop'
for a stopped network process.
(Fset_process_buffer): Update contact plist for network process.
(Fset_process_filter): Ditto. Don't enable input for stopped
network processes. Server must listen, even if filter is t.
(Fset_process_query_on_exit_flag, Fprocess_query_on_exit_flag):
New functions.
(Fprocess_kill_without_query): Removed. Now defined in simple.el.
(Fprocess_contact): Added KEY argument. Handle datagrams.
(list_processes_1): Optionally show only processes with the query
on exit flag set. Dynamically adjust column widths. Omit tty
column if not needed. Report stopped network processes.
Identify server and datagram network processes.
(Flist_processes): New optional arg `query-only'.
(conv_sockaddr_to_lisp, get_lisp_to_sockaddr_size)
(conv_lisp_to_sockaddr, set_socket_options)
(network_process_featurep, unwind_request_sigio): New helper functions.
(Fprocess_datagram_address, Fset_process_datagram_address):
(Fset_network_process_options): New lisp functions.
(Fopen_network_stream): Removed. Now defined in simple.el.
(Fmake_network_process): New lisp function. Code is based on previous
Fopen_network_stream, but heavily reworked with new property list based
argument list, support for datagrams, server processes, and local
sockets in addition to old client-only functionality.
(server_accept_connection): New function.
(wait_reading_process_input): Use it to handle incoming connects.
Do not enable input on a new connection if process is stopped.
(read_process_output): Handle datagram sockets. Use 2k buffer for them.
(send_process): Handle datagram sockets.
(Fstop_process, Fcontinue_process): Apply to network processes. A stopped
network process is indicated by setting command field to t .
(Fprocess_send_eof): No-op if datagram connection.
(Fstatus_notify): Don't read input for a stream server socket or a
stopped network process.
(init_process): Initialize datagram_address array.
(syms_of_process): Intern and staticpro new variables, defsubr new
functions.
2002-03-17 20:20:33 +00:00
|
|
|
|
p->status = Qrun;
|
|
|
|
|
|
|
|
|
|
/* Client processes for accepted connections are not stopped initially. */
|
|
|
|
|
if (!EQ (p->filter, Qt))
|
|
|
|
|
{
|
|
|
|
|
FD_SET (s, &input_wait_mask);
|
|
|
|
|
FD_SET (s, &non_keyboard_wait_mask);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (s > max_process_desc)
|
|
|
|
|
max_process_desc = s;
|
|
|
|
|
|
2003-02-04 14:56:31 +00:00
|
|
|
|
/* Setup coding system for new process based on server process.
|
(Qlocal, QCname, QCbuffer, QChost, QCservice, QCfamily)
(QClocal, QCremote, QCserver, QCdatagram, QCnowait, QCnoquery,QCstop)
(QCcoding, QCoptions, QCfilter, QCsentinel, QClog, QCfeature):
New variables.
(NETCONN1_P): New macro.
(DATAGRAM_SOCKETS): New conditional symbol.
(datagram_address): New array.
(DATAGRAM_CONN_P, DATAGRAM_CHAN_P): New macros.
(status_message): Use concat3.
(Fprocess_status): Add `listen' status to doc string. Return `stop'
for a stopped network process.
(Fset_process_buffer): Update contact plist for network process.
(Fset_process_filter): Ditto. Don't enable input for stopped
network processes. Server must listen, even if filter is t.
(Fset_process_query_on_exit_flag, Fprocess_query_on_exit_flag):
New functions.
(Fprocess_kill_without_query): Removed. Now defined in simple.el.
(Fprocess_contact): Added KEY argument. Handle datagrams.
(list_processes_1): Optionally show only processes with the query
on exit flag set. Dynamically adjust column widths. Omit tty
column if not needed. Report stopped network processes.
Identify server and datagram network processes.
(Flist_processes): New optional arg `query-only'.
(conv_sockaddr_to_lisp, get_lisp_to_sockaddr_size)
(conv_lisp_to_sockaddr, set_socket_options)
(network_process_featurep, unwind_request_sigio): New helper functions.
(Fprocess_datagram_address, Fset_process_datagram_address):
(Fset_network_process_options): New lisp functions.
(Fopen_network_stream): Removed. Now defined in simple.el.
(Fmake_network_process): New lisp function. Code is based on previous
Fopen_network_stream, but heavily reworked with new property list based
argument list, support for datagrams, server processes, and local
sockets in addition to old client-only functionality.
(server_accept_connection): New function.
(wait_reading_process_input): Use it to handle incoming connects.
Do not enable input on a new connection if process is stopped.
(read_process_output): Handle datagram sockets. Use 2k buffer for them.
(send_process): Handle datagram sockets.
(Fstop_process, Fcontinue_process): Apply to network processes. A stopped
network process is indicated by setting command field to t .
(Fprocess_send_eof): No-op if datagram connection.
(Fstatus_notify): Don't read input for a stream server socket or a
stopped network process.
(init_process): Initialize datagram_address array.
(syms_of_process): Intern and staticpro new variables, defsubr new
functions.
2002-03-17 20:20:33 +00:00
|
|
|
|
This seems to be the proper thing to do, as the coding system
|
|
|
|
|
of the new process should reflect the settings at the time the
|
|
|
|
|
server socket was opened; not the current settings. */
|
|
|
|
|
|
|
|
|
|
p->decode_coding_system = ps->decode_coding_system;
|
|
|
|
|
p->encode_coding_system = ps->encode_coding_system;
|
2003-02-10 07:58:29 +00:00
|
|
|
|
setup_process_coding_systems (proc);
|
(Qlocal, QCname, QCbuffer, QChost, QCservice, QCfamily)
(QClocal, QCremote, QCserver, QCdatagram, QCnowait, QCnoquery,QCstop)
(QCcoding, QCoptions, QCfilter, QCsentinel, QClog, QCfeature):
New variables.
(NETCONN1_P): New macro.
(DATAGRAM_SOCKETS): New conditional symbol.
(datagram_address): New array.
(DATAGRAM_CONN_P, DATAGRAM_CHAN_P): New macros.
(status_message): Use concat3.
(Fprocess_status): Add `listen' status to doc string. Return `stop'
for a stopped network process.
(Fset_process_buffer): Update contact plist for network process.
(Fset_process_filter): Ditto. Don't enable input for stopped
network processes. Server must listen, even if filter is t.
(Fset_process_query_on_exit_flag, Fprocess_query_on_exit_flag):
New functions.
(Fprocess_kill_without_query): Removed. Now defined in simple.el.
(Fprocess_contact): Added KEY argument. Handle datagrams.
(list_processes_1): Optionally show only processes with the query
on exit flag set. Dynamically adjust column widths. Omit tty
column if not needed. Report stopped network processes.
Identify server and datagram network processes.
(Flist_processes): New optional arg `query-only'.
(conv_sockaddr_to_lisp, get_lisp_to_sockaddr_size)
(conv_lisp_to_sockaddr, set_socket_options)
(network_process_featurep, unwind_request_sigio): New helper functions.
(Fprocess_datagram_address, Fset_process_datagram_address):
(Fset_network_process_options): New lisp functions.
(Fopen_network_stream): Removed. Now defined in simple.el.
(Fmake_network_process): New lisp function. Code is based on previous
Fopen_network_stream, but heavily reworked with new property list based
argument list, support for datagrams, server processes, and local
sockets in addition to old client-only functionality.
(server_accept_connection): New function.
(wait_reading_process_input): Use it to handle incoming connects.
Do not enable input on a new connection if process is stopped.
(read_process_output): Handle datagram sockets. Use 2k buffer for them.
(send_process): Handle datagram sockets.
(Fstop_process, Fcontinue_process): Apply to network processes. A stopped
network process is indicated by setting command field to t .
(Fprocess_send_eof): No-op if datagram connection.
(Fstatus_notify): Don't read input for a stream server socket or a
stopped network process.
(init_process): Initialize datagram_address array.
(syms_of_process): Intern and staticpro new variables, defsubr new
functions.
2002-03-17 20:20:33 +00:00
|
|
|
|
|
|
|
|
|
p->decoding_buf = make_uninit_string (0);
|
(struct Lisp_Process): Turn slots infd, outfd, kill_without_query, pty_flag,
tick, update_tick, decoding_carryover, inherit_coding_system_flag,
filter_multibyte, adaptive_read_buffering, read_output_delay, and
read_output_skip from Lisp_Objects to ints. Remove unused
encoding_carryover.
2007-07-12 06:36:57 +00:00
|
|
|
|
p->decoding_carryover = 0;
|
(Qlocal, QCname, QCbuffer, QChost, QCservice, QCfamily)
(QClocal, QCremote, QCserver, QCdatagram, QCnowait, QCnoquery,QCstop)
(QCcoding, QCoptions, QCfilter, QCsentinel, QClog, QCfeature):
New variables.
(NETCONN1_P): New macro.
(DATAGRAM_SOCKETS): New conditional symbol.
(datagram_address): New array.
(DATAGRAM_CONN_P, DATAGRAM_CHAN_P): New macros.
(status_message): Use concat3.
(Fprocess_status): Add `listen' status to doc string. Return `stop'
for a stopped network process.
(Fset_process_buffer): Update contact plist for network process.
(Fset_process_filter): Ditto. Don't enable input for stopped
network processes. Server must listen, even if filter is t.
(Fset_process_query_on_exit_flag, Fprocess_query_on_exit_flag):
New functions.
(Fprocess_kill_without_query): Removed. Now defined in simple.el.
(Fprocess_contact): Added KEY argument. Handle datagrams.
(list_processes_1): Optionally show only processes with the query
on exit flag set. Dynamically adjust column widths. Omit tty
column if not needed. Report stopped network processes.
Identify server and datagram network processes.
(Flist_processes): New optional arg `query-only'.
(conv_sockaddr_to_lisp, get_lisp_to_sockaddr_size)
(conv_lisp_to_sockaddr, set_socket_options)
(network_process_featurep, unwind_request_sigio): New helper functions.
(Fprocess_datagram_address, Fset_process_datagram_address):
(Fset_network_process_options): New lisp functions.
(Fopen_network_stream): Removed. Now defined in simple.el.
(Fmake_network_process): New lisp function. Code is based on previous
Fopen_network_stream, but heavily reworked with new property list based
argument list, support for datagrams, server processes, and local
sockets in addition to old client-only functionality.
(server_accept_connection): New function.
(wait_reading_process_input): Use it to handle incoming connects.
Do not enable input on a new connection if process is stopped.
(read_process_output): Handle datagram sockets. Use 2k buffer for them.
(send_process): Handle datagram sockets.
(Fstop_process, Fcontinue_process): Apply to network processes. A stopped
network process is indicated by setting command field to t .
(Fprocess_send_eof): No-op if datagram connection.
(Fstatus_notify): Don't read input for a stream server socket or a
stopped network process.
(init_process): Initialize datagram_address array.
(syms_of_process): Intern and staticpro new variables, defsubr new
functions.
2002-03-17 20:20:33 +00:00
|
|
|
|
p->encoding_buf = make_uninit_string (0);
|
|
|
|
|
|
|
|
|
|
p->inherit_coding_system_flag
|
(struct Lisp_Process): Turn slots infd, outfd, kill_without_query, pty_flag,
tick, update_tick, decoding_carryover, inherit_coding_system_flag,
filter_multibyte, adaptive_read_buffering, read_output_delay, and
read_output_skip from Lisp_Objects to ints. Remove unused
encoding_carryover.
2007-07-12 06:36:57 +00:00
|
|
|
|
= (NILP (buffer) ? 0 : ps->inherit_coding_system_flag);
|
(Qlocal, QCname, QCbuffer, QChost, QCservice, QCfamily)
(QClocal, QCremote, QCserver, QCdatagram, QCnowait, QCnoquery,QCstop)
(QCcoding, QCoptions, QCfilter, QCsentinel, QClog, QCfeature):
New variables.
(NETCONN1_P): New macro.
(DATAGRAM_SOCKETS): New conditional symbol.
(datagram_address): New array.
(DATAGRAM_CONN_P, DATAGRAM_CHAN_P): New macros.
(status_message): Use concat3.
(Fprocess_status): Add `listen' status to doc string. Return `stop'
for a stopped network process.
(Fset_process_buffer): Update contact plist for network process.
(Fset_process_filter): Ditto. Don't enable input for stopped
network processes. Server must listen, even if filter is t.
(Fset_process_query_on_exit_flag, Fprocess_query_on_exit_flag):
New functions.
(Fprocess_kill_without_query): Removed. Now defined in simple.el.
(Fprocess_contact): Added KEY argument. Handle datagrams.
(list_processes_1): Optionally show only processes with the query
on exit flag set. Dynamically adjust column widths. Omit tty
column if not needed. Report stopped network processes.
Identify server and datagram network processes.
(Flist_processes): New optional arg `query-only'.
(conv_sockaddr_to_lisp, get_lisp_to_sockaddr_size)
(conv_lisp_to_sockaddr, set_socket_options)
(network_process_featurep, unwind_request_sigio): New helper functions.
(Fprocess_datagram_address, Fset_process_datagram_address):
(Fset_network_process_options): New lisp functions.
(Fopen_network_stream): Removed. Now defined in simple.el.
(Fmake_network_process): New lisp function. Code is based on previous
Fopen_network_stream, but heavily reworked with new property list based
argument list, support for datagrams, server processes, and local
sockets in addition to old client-only functionality.
(server_accept_connection): New function.
(wait_reading_process_input): Use it to handle incoming connects.
Do not enable input on a new connection if process is stopped.
(read_process_output): Handle datagram sockets. Use 2k buffer for them.
(send_process): Handle datagram sockets.
(Fstop_process, Fcontinue_process): Apply to network processes. A stopped
network process is indicated by setting command field to t .
(Fprocess_send_eof): No-op if datagram connection.
(Fstatus_notify): Don't read input for a stream server socket or a
stopped network process.
(init_process): Initialize datagram_address array.
(syms_of_process): Intern and staticpro new variables, defsubr new
functions.
2002-03-17 20:20:33 +00:00
|
|
|
|
|
|
|
|
|
if (!NILP (ps->log))
|
|
|
|
|
call3 (ps->log, server, proc,
|
|
|
|
|
concat3 (build_string ("accept from "),
|
|
|
|
|
(STRINGP (host) ? host : build_string ("-")),
|
|
|
|
|
build_string ("\n")));
|
|
|
|
|
|
2002-04-01 19:50:51 +00:00
|
|
|
|
if (!NILP (p->sentinel))
|
2003-02-04 14:56:31 +00:00
|
|
|
|
exec_sentinel (proc,
|
(Qlocal, QCname, QCbuffer, QChost, QCservice, QCfamily)
(QClocal, QCremote, QCserver, QCdatagram, QCnowait, QCnoquery,QCstop)
(QCcoding, QCoptions, QCfilter, QCsentinel, QClog, QCfeature):
New variables.
(NETCONN1_P): New macro.
(DATAGRAM_SOCKETS): New conditional symbol.
(datagram_address): New array.
(DATAGRAM_CONN_P, DATAGRAM_CHAN_P): New macros.
(status_message): Use concat3.
(Fprocess_status): Add `listen' status to doc string. Return `stop'
for a stopped network process.
(Fset_process_buffer): Update contact plist for network process.
(Fset_process_filter): Ditto. Don't enable input for stopped
network processes. Server must listen, even if filter is t.
(Fset_process_query_on_exit_flag, Fprocess_query_on_exit_flag):
New functions.
(Fprocess_kill_without_query): Removed. Now defined in simple.el.
(Fprocess_contact): Added KEY argument. Handle datagrams.
(list_processes_1): Optionally show only processes with the query
on exit flag set. Dynamically adjust column widths. Omit tty
column if not needed. Report stopped network processes.
Identify server and datagram network processes.
(Flist_processes): New optional arg `query-only'.
(conv_sockaddr_to_lisp, get_lisp_to_sockaddr_size)
(conv_lisp_to_sockaddr, set_socket_options)
(network_process_featurep, unwind_request_sigio): New helper functions.
(Fprocess_datagram_address, Fset_process_datagram_address):
(Fset_network_process_options): New lisp functions.
(Fopen_network_stream): Removed. Now defined in simple.el.
(Fmake_network_process): New lisp function. Code is based on previous
Fopen_network_stream, but heavily reworked with new property list based
argument list, support for datagrams, server processes, and local
sockets in addition to old client-only functionality.
(server_accept_connection): New function.
(wait_reading_process_input): Use it to handle incoming connects.
Do not enable input on a new connection if process is stopped.
(read_process_output): Handle datagram sockets. Use 2k buffer for them.
(send_process): Handle datagram sockets.
(Fstop_process, Fcontinue_process): Apply to network processes. A stopped
network process is indicated by setting command field to t .
(Fprocess_send_eof): No-op if datagram connection.
(Fstatus_notify): Don't read input for a stream server socket or a
stopped network process.
(init_process): Initialize datagram_address array.
(syms_of_process): Intern and staticpro new variables, defsubr new
functions.
2002-03-17 20:20:33 +00:00
|
|
|
|
concat3 (build_string ("open from "),
|
|
|
|
|
(STRINGP (host) ? host : build_string ("-")),
|
|
|
|
|
build_string ("\n")));
|
|
|
|
|
}
|
|
|
|
|
|
1992-03-14 20:40:04 +00:00
|
|
|
|
/* This variable is different from waiting_for_input in keyboard.c.
|
|
|
|
|
It is used to communicate to a lisp process-filter/sentinel (via the
|
2004-05-08 16:11:42 +00:00
|
|
|
|
function Fwaiting_for_user_input_p below) whether Emacs was waiting
|
1992-03-14 20:40:04 +00:00
|
|
|
|
for user-input when that process-filter was called.
|
|
|
|
|
waiting_for_input cannot be used as that is by definition 0 when
|
1994-08-19 07:23:05 +00:00
|
|
|
|
lisp code is being evalled.
|
|
|
|
|
This is also used in record_asynch_buffer_change.
|
|
|
|
|
For that purpose, this must be 0
|
2004-08-20 10:33:25 +00:00
|
|
|
|
when not inside wait_reading_process_output. */
|
1992-03-14 20:40:04 +00:00
|
|
|
|
static int waiting_for_user_input_p;
|
|
|
|
|
|
2006-08-01 00:13:08 +00:00
|
|
|
|
static Lisp_Object
|
2010-07-05 12:36:06 +02:00
|
|
|
|
wait_reading_process_output_unwind (Lisp_Object data)
|
2006-08-01 00:13:08 +00:00
|
|
|
|
{
|
|
|
|
|
waiting_for_user_input_p = XINT (data);
|
|
|
|
|
return Qnil;
|
|
|
|
|
}
|
|
|
|
|
|
1996-03-27 02:35:15 +00:00
|
|
|
|
/* This is here so breakpoints can be put on it. */
|
1998-04-14 12:25:56 +00:00
|
|
|
|
static void
|
2010-07-05 12:36:06 +02:00
|
|
|
|
wait_reading_process_output_1 (void)
|
1996-03-27 02:35:15 +00:00
|
|
|
|
{
|
|
|
|
|
}
|
|
|
|
|
|
2006-05-31 08:58:02 +00:00
|
|
|
|
/* Use a wrapper around select to work around a bug in gdb 5.3.
|
2009-12-29 01:51:07 +01:00
|
|
|
|
Normally, the wrapper is optimized away by inlining.
|
2006-05-31 08:58:02 +00:00
|
|
|
|
|
|
|
|
|
If emacs is stopped inside select, the gdb backtrace doesn't
|
|
|
|
|
show the function which called select, so it is practically
|
|
|
|
|
impossible to step through wait_reading_process_output. */
|
|
|
|
|
|
|
|
|
|
#ifndef select
|
|
|
|
|
static INLINE int
|
2010-07-05 12:36:06 +02:00
|
|
|
|
select_wrapper (int n, fd_set *rfd, fd_set *wfd, fd_set *xfd, struct timeval *tmo)
|
2006-05-31 08:58:02 +00:00
|
|
|
|
{
|
|
|
|
|
return select (n, rfd, wfd, xfd, tmo);
|
|
|
|
|
}
|
|
|
|
|
#define select select_wrapper
|
|
|
|
|
#endif
|
|
|
|
|
|
1992-03-14 20:40:04 +00:00
|
|
|
|
/* Read and dispose of subprocess output while waiting for timeout to
|
|
|
|
|
elapse and/or keyboard input to be available.
|
|
|
|
|
|
1993-07-02 05:43:43 +00:00
|
|
|
|
TIME_LIMIT is:
|
1992-03-14 20:40:04 +00:00
|
|
|
|
timeout in seconds, or
|
|
|
|
|
zero for no limit, or
|
|
|
|
|
-1 means gobble data immediately available but don't wait for any.
|
|
|
|
|
|
1993-07-02 05:43:43 +00:00
|
|
|
|
MICROSECS is:
|
|
|
|
|
an additional duration to wait, measured in microseconds.
|
|
|
|
|
If this is nonzero and time_limit is 0, then the timeout
|
|
|
|
|
consists of MICROSECS only.
|
1993-03-20 22:58:54 +00:00
|
|
|
|
|
1993-07-02 05:43:43 +00:00
|
|
|
|
READ_KBD is a lisp value:
|
1992-03-14 20:40:04 +00:00
|
|
|
|
0 to ignore keyboard input, or
|
|
|
|
|
1 to return when input is available, or
|
1993-03-15 06:09:04 +00:00
|
|
|
|
-1 meaning caller will actually read the input, so don't throw to
|
1992-03-14 20:40:04 +00:00
|
|
|
|
the quit handler, or
|
|
|
|
|
|
1993-07-02 05:43:43 +00:00
|
|
|
|
DO_DISPLAY != 0 means redisplay should be done to show subprocess
|
2004-08-17 22:24:29 +00:00
|
|
|
|
output that arrives.
|
1992-03-14 20:40:04 +00:00
|
|
|
|
|
2004-08-19 13:57:17 +00:00
|
|
|
|
If WAIT_FOR_CELL is a cons cell, wait until its car is non-nil
|
|
|
|
|
(and gobble terminal input into the buffer if any arrives).
|
1992-03-14 20:40:04 +00:00
|
|
|
|
|
2004-08-19 13:57:17 +00:00
|
|
|
|
If WAIT_PROC is specified, wait until something arrives from that
|
2007-08-08 07:49:21 +00:00
|
|
|
|
process. The return value is true if we read some input from
|
2004-08-19 13:57:17 +00:00
|
|
|
|
that process.
|
|
|
|
|
|
|
|
|
|
If JUST_WAIT_PROC is non-nil, handle only output from WAIT_PROC
|
|
|
|
|
(suspending output from other processes). A negative value
|
|
|
|
|
means don't run any timers either.
|
|
|
|
|
|
2007-08-08 07:49:21 +00:00
|
|
|
|
If WAIT_PROC is specified, then the function returns true if we
|
2004-08-19 13:57:17 +00:00
|
|
|
|
received input from that process before the timeout elapsed.
|
2007-08-08 07:49:21 +00:00
|
|
|
|
Otherwise, return true if we received input from any process. */
|
1992-03-14 20:40:04 +00:00
|
|
|
|
|
1998-04-14 12:25:56 +00:00
|
|
|
|
int
|
Convert old-style definitions
* editfns.c (transpose_markers): Convert old-style definition.
* emacs.c (abort, shut_down_emacs, fixup_locale)
(synchronize_system_time_locale)
(synchronize_system_messages_locale, syms_of_emacs): Likewise.
* floatfns.c (extract_float, matherr, init_floatfns)
(syms_of_floatfns): Likewise.
* fns.c (make_hash_table): Likewise.
* ftfont.c (ftfont_get_otf, ftfont_otf_features)
(ftfont_otf_capability, ftfont_get_glyph_id, ftfont_get_metrics)
(ftfont_drive_otf, ftfont_shape_by_flt, ftfont_shape)
(ftfont_variation_glyphs): Likewise.
* gtkutil.c (xg_create_widget, xg_modify_menubar_widgets): Likewise.
* keymap.c (describe_map_tree, describe_map, describe_vector): Likewise.
* lread.c (read_filtered_event): Likewise.
* minibuf.c (read_minibuf_noninteractive, read_minibuf): Likewise.
* process.c (wait_reading_process_output): Likewise.
* scroll.c (do_line_insertion_deletion_costs): Likewise.
* search.c (search_buffer, boyer_moore): Likewise.
* syntax.c (scan_sexps_forward): Likewise.
* xdisp.c (try_scrolling): Likewise.
* xfaces.c (face_at_buffer_position, face_for_overlay_string)
(face_at_string_position): Likewise.
* xfns.c (x_default_scroll_bar_color_parameter): Likewise.
* xselect.c (x_get_window_property, receive_incremental_selection)
(x_get_window_property_as_lisp_data, lisp_data_to_selection_data):
Likewise.
* xterm.c (x_draw_relief_rect, x_draw_box_rect): Likewise.
2010-07-12 19:47:17 +02:00
|
|
|
|
wait_reading_process_output (int time_limit, int microsecs, int read_kbd,
|
|
|
|
|
int do_display,
|
|
|
|
|
Lisp_Object wait_for_cell,
|
|
|
|
|
struct Lisp_Process *wait_proc, int just_wait_proc)
|
1992-03-14 20:40:04 +00:00
|
|
|
|
{
|
1999-09-20 00:34:43 +00:00
|
|
|
|
register int channel, nfds;
|
2004-05-13 23:07:07 +00:00
|
|
|
|
SELECT_TYPE Available;
|
2004-11-01 11:04:37 +00:00
|
|
|
|
#ifdef NON_BLOCKING_CONNECT
|
2004-05-13 23:07:07 +00:00
|
|
|
|
SELECT_TYPE Connecting;
|
2004-11-01 11:04:37 +00:00
|
|
|
|
int check_connect;
|
|
|
|
|
#endif
|
|
|
|
|
int check_delay, no_avail;
|
1992-03-14 20:40:04 +00:00
|
|
|
|
int xerrno;
|
|
|
|
|
Lisp_Object proc;
|
1999-09-20 00:34:43 +00:00
|
|
|
|
EMACS_TIME timeout, end_time;
|
1993-11-23 10:57:16 +00:00
|
|
|
|
int wait_channel = -1;
|
1992-03-14 20:40:04 +00:00
|
|
|
|
int got_some_input = 0;
|
2006-08-01 00:13:08 +00:00
|
|
|
|
int count = SPECPDL_INDEX ();
|
1992-03-14 20:40:04 +00:00
|
|
|
|
|
|
|
|
|
FD_ZERO (&Available);
|
2004-11-01 11:04:37 +00:00
|
|
|
|
#ifdef NON_BLOCKING_CONNECT
|
2002-02-28 23:53:59 +00:00
|
|
|
|
FD_ZERO (&Connecting);
|
2004-11-01 11:04:37 +00:00
|
|
|
|
#endif
|
1992-03-14 20:40:04 +00:00
|
|
|
|
|
2010-04-12 22:07:48 -04:00
|
|
|
|
if (time_limit == 0 && wait_proc && !NILP (Vinhibit_quit)
|
|
|
|
|
&& !(CONSP (wait_proc->status) && EQ (XCAR (wait_proc->status), Qexit)))
|
|
|
|
|
message ("Blocking call to accept-process-output with quit inhibited!!");
|
|
|
|
|
|
2004-08-19 13:57:17 +00:00
|
|
|
|
/* If wait_proc is a process to watch, set wait_channel accordingly. */
|
|
|
|
|
if (wait_proc != NULL)
|
(struct Lisp_Process): Turn slots infd, outfd, kill_without_query, pty_flag,
tick, update_tick, decoding_carryover, inherit_coding_system_flag,
filter_multibyte, adaptive_read_buffering, read_output_delay, and
read_output_skip from Lisp_Objects to ints. Remove unused
encoding_carryover.
2007-07-12 06:36:57 +00:00
|
|
|
|
wait_channel = wait_proc->infd;
|
1993-03-15 06:09:04 +00:00
|
|
|
|
|
2006-08-01 00:13:08 +00:00
|
|
|
|
record_unwind_protect (wait_reading_process_output_unwind,
|
|
|
|
|
make_number (waiting_for_user_input_p));
|
2004-08-19 13:57:17 +00:00
|
|
|
|
waiting_for_user_input_p = read_kbd;
|
1992-03-14 20:40:04 +00:00
|
|
|
|
|
|
|
|
|
/* Since we may need to wait several times,
|
|
|
|
|
compute the absolute time to return at. */
|
|
|
|
|
if (time_limit || microsecs)
|
|
|
|
|
{
|
|
|
|
|
EMACS_GET_TIME (end_time);
|
|
|
|
|
EMACS_SET_SECS_USECS (timeout, time_limit, microsecs);
|
|
|
|
|
EMACS_ADD_TIME (end_time, end_time, timeout);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
while (1)
|
|
|
|
|
{
|
1996-02-01 20:35:59 +00:00
|
|
|
|
int timeout_reduced_for_timers = 0;
|
|
|
|
|
|
1992-03-14 20:40:04 +00:00
|
|
|
|
/* If calling from keyboard input, do not quit
|
|
|
|
|
since we want to return C-g as an input character.
|
|
|
|
|
Otherwise, do pending quit if requested. */
|
2004-08-19 13:57:17 +00:00
|
|
|
|
if (read_kbd >= 0)
|
1992-03-14 20:40:04 +00:00
|
|
|
|
QUIT;
|
2004-04-16 12:51:06 +00:00
|
|
|
|
#ifdef SYNC_INPUT
|
2008-04-09 06:47:19 +00:00
|
|
|
|
else
|
2009-01-29 14:34:38 +00:00
|
|
|
|
process_pending_signals ();
|
2004-04-16 12:51:06 +00:00
|
|
|
|
#endif
|
1992-03-14 20:40:04 +00:00
|
|
|
|
|
1993-08-15 03:52:43 +00:00
|
|
|
|
/* Exit now if the cell we're waiting for became non-nil. */
|
2001-10-16 09:09:51 +00:00
|
|
|
|
if (! NILP (wait_for_cell) && ! NILP (XCAR (wait_for_cell)))
|
1993-08-15 03:52:43 +00:00
|
|
|
|
break;
|
|
|
|
|
|
1992-03-14 20:40:04 +00:00
|
|
|
|
/* Compute time from now till when time limit is up */
|
|
|
|
|
/* Exit if already run out */
|
|
|
|
|
if (time_limit == -1)
|
|
|
|
|
{
|
|
|
|
|
/* -1 specified for timeout means
|
|
|
|
|
gobble output available now
|
|
|
|
|
but don't wait at all. */
|
|
|
|
|
|
|
|
|
|
EMACS_SET_SECS_USECS (timeout, 0, 0);
|
|
|
|
|
}
|
|
|
|
|
else if (time_limit || microsecs)
|
|
|
|
|
{
|
|
|
|
|
EMACS_GET_TIME (timeout);
|
|
|
|
|
EMACS_SUB_TIME (timeout, end_time, timeout);
|
|
|
|
|
if (EMACS_TIME_NEG_P (timeout))
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
EMACS_SET_SECS_USECS (timeout, 100000, 0);
|
|
|
|
|
}
|
|
|
|
|
|
1996-04-23 20:32:33 +00:00
|
|
|
|
/* Normally we run timers here.
|
|
|
|
|
But not if wait_for_cell; in those cases,
|
|
|
|
|
the wait is supposed to be short,
|
|
|
|
|
and those callers cannot handle running arbitrary Lisp code here. */
|
2004-08-17 22:24:29 +00:00
|
|
|
|
if (NILP (wait_for_cell)
|
2004-08-19 13:57:17 +00:00
|
|
|
|
&& just_wait_proc >= 0)
|
1996-01-29 04:50:16 +00:00
|
|
|
|
{
|
1996-02-01 20:35:59 +00:00
|
|
|
|
EMACS_TIME timer_delay;
|
1996-03-27 02:35:15 +00:00
|
|
|
|
|
2000-12-18 10:53:51 +00:00
|
|
|
|
do
|
1996-03-27 02:35:15 +00:00
|
|
|
|
{
|
2000-12-18 10:53:51 +00:00
|
|
|
|
int old_timers_run = timers_run;
|
2001-04-25 15:12:49 +00:00
|
|
|
|
struct buffer *old_buffer = current_buffer;
|
2008-02-27 15:09:04 +00:00
|
|
|
|
Lisp_Object old_window = selected_window;
|
2003-02-04 14:56:31 +00:00
|
|
|
|
|
2000-12-18 10:53:51 +00:00
|
|
|
|
timer_delay = timer_check (1);
|
2001-04-19 12:47:59 +00:00
|
|
|
|
|
|
|
|
|
/* If a timer has run, this might have changed buffers
|
|
|
|
|
an alike. Make read_key_sequence aware of that. */
|
|
|
|
|
if (timers_run != old_timers_run
|
2008-02-27 15:09:04 +00:00
|
|
|
|
&& (old_buffer != current_buffer
|
|
|
|
|
|| !EQ (old_window, selected_window))
|
2001-04-19 12:47:59 +00:00
|
|
|
|
&& waiting_for_user_input_p == -1)
|
|
|
|
|
record_asynch_buffer_change ();
|
2003-02-04 14:56:31 +00:00
|
|
|
|
|
2000-12-18 10:53:51 +00:00
|
|
|
|
if (timers_run != old_timers_run && do_display)
|
|
|
|
|
/* We must retry, since a timer may have requeued itself
|
|
|
|
|
and that could alter the time_delay. */
|
2001-01-16 12:42:22 +00:00
|
|
|
|
redisplay_preserve_echo_area (9);
|
2000-12-18 10:53:51 +00:00
|
|
|
|
else
|
|
|
|
|
break;
|
1996-03-27 02:35:15 +00:00
|
|
|
|
}
|
2000-12-18 10:53:51 +00:00
|
|
|
|
while (!detect_input_pending ());
|
1996-03-27 02:35:15 +00:00
|
|
|
|
|
1997-06-13 00:45:19 +00:00
|
|
|
|
/* If there is unread keyboard input, also return. */
|
2004-08-19 13:57:17 +00:00
|
|
|
|
if (read_kbd != 0
|
1997-06-13 00:45:19 +00:00
|
|
|
|
&& requeued_events_pending_p ())
|
|
|
|
|
break;
|
|
|
|
|
|
1996-02-01 20:35:59 +00:00
|
|
|
|
if (! EMACS_TIME_NEG_P (timer_delay) && time_limit != -1)
|
1996-01-29 04:50:16 +00:00
|
|
|
|
{
|
|
|
|
|
EMACS_TIME difference;
|
|
|
|
|
EMACS_SUB_TIME (difference, timer_delay, timeout);
|
|
|
|
|
if (EMACS_TIME_NEG_P (difference))
|
1996-02-01 20:35:59 +00:00
|
|
|
|
{
|
|
|
|
|
timeout = timer_delay;
|
|
|
|
|
timeout_reduced_for_timers = 1;
|
|
|
|
|
}
|
1996-01-29 04:50:16 +00:00
|
|
|
|
}
|
1996-04-03 19:30:03 +00:00
|
|
|
|
/* If time_limit is -1, we are not going to wait at all. */
|
|
|
|
|
else if (time_limit != -1)
|
1996-03-27 02:35:15 +00:00
|
|
|
|
{
|
|
|
|
|
/* This is so a breakpoint can be put here. */
|
2004-08-20 10:33:25 +00:00
|
|
|
|
wait_reading_process_output_1 ();
|
1996-03-27 02:35:15 +00:00
|
|
|
|
}
|
1996-01-29 04:50:16 +00:00
|
|
|
|
}
|
|
|
|
|
|
1993-05-19 05:41:37 +00:00
|
|
|
|
/* Cause C-g and alarm signals to take immediate action,
|
|
|
|
|
and cause input available signals to zero out timeout.
|
|
|
|
|
|
|
|
|
|
It is important that we do this before checking for process
|
|
|
|
|
activity. If we get a SIGCHLD after the explicit checks for
|
|
|
|
|
process activity, timeout is the only way we will know. */
|
2004-08-19 13:57:17 +00:00
|
|
|
|
if (read_kbd < 0)
|
1993-05-19 05:41:37 +00:00
|
|
|
|
set_waiting_for_input (&timeout);
|
|
|
|
|
|
1993-02-22 14:47:53 +00:00
|
|
|
|
/* If status of something has changed, and no input is
|
|
|
|
|
available, notify the user of the change right away. After
|
|
|
|
|
this explicit check, we'll let the SIGCHLD handler zap
|
2009-08-17 21:04:05 +00:00
|
|
|
|
timeout to get our attention. */
|
|
|
|
|
if (update_tick != process_tick)
|
1993-02-22 14:47:53 +00:00
|
|
|
|
{
|
2004-11-01 11:04:37 +00:00
|
|
|
|
SELECT_TYPE Atemp;
|
|
|
|
|
#ifdef NON_BLOCKING_CONNECT
|
|
|
|
|
SELECT_TYPE Ctemp;
|
|
|
|
|
#endif
|
2002-02-28 23:53:59 +00:00
|
|
|
|
|
2010-07-07 19:39:49 +02:00
|
|
|
|
if (kbd_on_hold_p ())
|
|
|
|
|
FD_ZERO (&Atemp);
|
|
|
|
|
else
|
|
|
|
|
Atemp = input_wait_mask;
|
2004-11-01 11:04:37 +00:00
|
|
|
|
IF_NON_BLOCKING_CONNECT (Ctemp = connect_wait_mask);
|
|
|
|
|
|
1993-02-22 14:47:53 +00:00
|
|
|
|
EMACS_SET_SECS_USECS (timeout, 0, 0);
|
2007-05-20 02:41:19 +00:00
|
|
|
|
if ((select (max (max (max_process_desc, max_keyboard_desc),
|
|
|
|
|
max_gpm_desc) + 1,
|
2003-02-04 14:56:31 +00:00
|
|
|
|
&Atemp,
|
2004-11-01 11:04:37 +00:00
|
|
|
|
#ifdef NON_BLOCKING_CONNECT
|
2002-02-28 23:53:59 +00:00
|
|
|
|
(num_pending_connects > 0 ? &Ctemp : (SELECT_TYPE *)0),
|
2004-11-01 11:04:37 +00:00
|
|
|
|
#else
|
|
|
|
|
(SELECT_TYPE *)0,
|
|
|
|
|
#endif
|
2002-02-28 23:53:59 +00:00
|
|
|
|
(SELECT_TYPE *)0, &timeout)
|
1995-05-26 03:21:30 +00:00
|
|
|
|
<= 0))
|
1993-05-19 05:41:37 +00:00
|
|
|
|
{
|
|
|
|
|
/* It's okay for us to do this and then continue with
|
1994-01-09 12:16:26 +00:00
|
|
|
|
the loop, since timeout has already been zeroed out. */
|
1993-05-19 05:41:37 +00:00
|
|
|
|
clear_waiting_for_input ();
|
(deactivate_process, status_notify, read_process_output)
(update_status, status_convert, decode_status, allocate_pty)
(make_process, remove_process, list_processes_1)
(create_process_1, unwind_request_sigio, read_process_output)
(send_process, keyboard_bit_set): Declare static.
(Fdelete_process): Simplify. Pass process to status_notify, so we
don't try to read output from it.
(status_notify): New arg deleting_process--don't try to read
output from that process.
2005-08-15 08:44:53 +00:00
|
|
|
|
status_notify (NULL);
|
2009-08-17 21:04:05 +00:00
|
|
|
|
if (do_display) redisplay_preserve_echo_area (13);
|
1993-05-19 05:41:37 +00:00
|
|
|
|
}
|
1993-02-22 14:47:53 +00:00
|
|
|
|
}
|
|
|
|
|
|
2002-02-28 23:53:59 +00:00
|
|
|
|
/* Don't wait for output from a non-running process. Just
|
2009-01-01 15:58:38 +00:00
|
|
|
|
read whatever data has already been received. */
|
* process.h (struct Lisp_Process): Replace Lisp_Objects `pid',
`raw_status_high', and `raw_status_low' with plain integers, and move
them to the end of the structure.
* alloc.c (allocate_process): Use PSEUDOVECSIZE to initialize the
pseudovector's size field so only the Lisp_Object fields get GC'd.
* process.c (update_status, make_process, Fdelete_process)
(Fprocess_status, list_processes_1, start_process_unwind)
(create_process, Fmake_network_process, server_accept_connection)
(wait_reading_process_output, send_process, Fprocess_running_child_p)
(process_send_signal, proc_encode_coding_system, Fprocess_send_eof)
(sigchld_handler, status_notify): Adjust to new non-Lisp fields for
`pid' and `raw_status'.
(Fprocess_id, Fsignal_process): Same, and additionally use floats when
representing PIDs that are larger than most-positive-fixnum.
2006-04-08 15:07:35 +00:00
|
|
|
|
if (wait_proc && wait_proc->raw_status_new)
|
1993-02-22 14:47:53 +00:00
|
|
|
|
update_status (wait_proc);
|
* process.h (struct Lisp_Process): Replace Lisp_Objects `pid',
`raw_status_high', and `raw_status_low' with plain integers, and move
them to the end of the structure.
* alloc.c (allocate_process): Use PSEUDOVECSIZE to initialize the
pseudovector's size field so only the Lisp_Object fields get GC'd.
* process.c (update_status, make_process, Fdelete_process)
(Fprocess_status, list_processes_1, start_process_unwind)
(create_process, Fmake_network_process, server_accept_connection)
(wait_reading_process_output, send_process, Fprocess_running_child_p)
(process_send_signal, proc_encode_coding_system, Fprocess_send_eof)
(sigchld_handler, status_notify): Adjust to new non-Lisp fields for
`pid' and `raw_status'.
(Fprocess_id, Fsignal_process): Same, and additionally use floats when
representing PIDs that are larger than most-positive-fixnum.
2006-04-08 15:07:35 +00:00
|
|
|
|
if (wait_proc
|
2002-02-28 23:53:59 +00:00
|
|
|
|
&& ! EQ (wait_proc->status, Qrun)
|
|
|
|
|
&& ! EQ (wait_proc->status, Qconnect))
|
1993-05-19 05:05:46 +00:00
|
|
|
|
{
|
1997-07-24 16:58:05 +00:00
|
|
|
|
int nread, total_nread = 0;
|
1997-06-16 06:24:22 +00:00
|
|
|
|
|
1993-05-19 05:05:46 +00:00
|
|
|
|
clear_waiting_for_input ();
|
1997-06-16 06:24:22 +00:00
|
|
|
|
XSETPROCESS (proc, wait_proc);
|
|
|
|
|
|
|
|
|
|
/* Read data from the process, until we exhaust it. */
|
(struct Lisp_Process): Turn slots infd, outfd, kill_without_query, pty_flag,
tick, update_tick, decoding_carryover, inherit_coding_system_flag,
filter_multibyte, adaptive_read_buffering, read_output_delay, and
read_output_skip from Lisp_Objects to ints. Remove unused
encoding_carryover.
2007-07-12 06:36:57 +00:00
|
|
|
|
while (wait_proc->infd >= 0)
|
1997-07-24 16:58:05 +00:00
|
|
|
|
{
|
(struct Lisp_Process): Turn slots infd, outfd, kill_without_query, pty_flag,
tick, update_tick, decoding_carryover, inherit_coding_system_flag,
filter_multibyte, adaptive_read_buffering, read_output_delay, and
read_output_skip from Lisp_Objects to ints. Remove unused
encoding_carryover.
2007-07-12 06:36:57 +00:00
|
|
|
|
nread = read_process_output (proc, wait_proc->infd);
|
1999-10-07 11:37:40 +00:00
|
|
|
|
|
|
|
|
|
if (nread == 0)
|
|
|
|
|
break;
|
|
|
|
|
|
2009-01-01 15:58:38 +00:00
|
|
|
|
if (0 < nread)
|
|
|
|
|
{
|
2008-05-29 16:54:53 +00:00
|
|
|
|
total_nread += nread;
|
|
|
|
|
got_some_input = 1;
|
|
|
|
|
}
|
1997-07-24 16:58:05 +00:00
|
|
|
|
#ifdef EIO
|
|
|
|
|
else if (nread == -1 && EIO == errno)
|
2009-01-01 15:58:38 +00:00
|
|
|
|
break;
|
1999-10-07 11:37:40 +00:00
|
|
|
|
#endif
|
|
|
|
|
#ifdef EAGAIN
|
|
|
|
|
else if (nread == -1 && EAGAIN == errno)
|
2009-01-01 15:58:38 +00:00
|
|
|
|
break;
|
1999-10-07 11:37:40 +00:00
|
|
|
|
#endif
|
|
|
|
|
#ifdef EWOULDBLOCK
|
|
|
|
|
else if (nread == -1 && EWOULDBLOCK == errno)
|
2009-01-01 15:58:38 +00:00
|
|
|
|
break;
|
1997-07-24 16:58:05 +00:00
|
|
|
|
#endif
|
|
|
|
|
}
|
1997-06-16 06:24:22 +00:00
|
|
|
|
if (total_nread > 0 && do_display)
|
2001-01-16 12:42:22 +00:00
|
|
|
|
redisplay_preserve_echo_area (10);
|
1997-06-16 06:24:22 +00:00
|
|
|
|
|
1993-05-19 05:05:46 +00:00
|
|
|
|
break;
|
|
|
|
|
}
|
1993-02-22 14:47:53 +00:00
|
|
|
|
|
1992-03-14 20:40:04 +00:00
|
|
|
|
/* Wait till there is something to do */
|
|
|
|
|
|
2004-08-19 13:57:17 +00:00
|
|
|
|
if (wait_proc && just_wait_proc)
|
2004-08-17 22:24:29 +00:00
|
|
|
|
{
|
(struct Lisp_Process): Turn slots infd, outfd, kill_without_query, pty_flag,
tick, update_tick, decoding_carryover, inherit_coding_system_flag,
filter_multibyte, adaptive_read_buffering, read_output_delay, and
read_output_skip from Lisp_Objects to ints. Remove unused
encoding_carryover.
2007-07-12 06:36:57 +00:00
|
|
|
|
if (wait_proc->infd < 0) /* Terminated */
|
2004-08-19 13:57:17 +00:00
|
|
|
|
break;
|
(struct Lisp_Process): Turn slots infd, outfd, kill_without_query, pty_flag,
tick, update_tick, decoding_carryover, inherit_coding_system_flag,
filter_multibyte, adaptive_read_buffering, read_output_delay, and
read_output_skip from Lisp_Objects to ints. Remove unused
encoding_carryover.
2007-07-12 06:36:57 +00:00
|
|
|
|
FD_SET (wait_proc->infd, &Available);
|
2004-11-01 11:04:37 +00:00
|
|
|
|
check_delay = 0;
|
|
|
|
|
IF_NON_BLOCKING_CONNECT (check_connect = 0);
|
2004-08-17 22:24:29 +00:00
|
|
|
|
}
|
|
|
|
|
else if (!NILP (wait_for_cell))
|
2002-02-28 23:53:59 +00:00
|
|
|
|
{
|
|
|
|
|
Available = non_process_wait_mask;
|
2004-11-01 11:04:37 +00:00
|
|
|
|
check_delay = 0;
|
|
|
|
|
IF_NON_BLOCKING_CONNECT (check_connect = 0);
|
2002-02-28 23:53:59 +00:00
|
|
|
|
}
|
1994-10-25 09:48:44 +00:00
|
|
|
|
else
|
2002-02-28 23:53:59 +00:00
|
|
|
|
{
|
2004-08-19 13:57:17 +00:00
|
|
|
|
if (! read_kbd)
|
2002-02-28 23:53:59 +00:00
|
|
|
|
Available = non_keyboard_wait_mask;
|
|
|
|
|
else
|
|
|
|
|
Available = input_wait_mask;
|
2004-11-01 11:04:37 +00:00
|
|
|
|
IF_NON_BLOCKING_CONNECT (check_connect = (num_pending_connects > 0));
|
2004-04-16 12:51:06 +00:00
|
|
|
|
check_delay = wait_channel >= 0 ? 0 : process_output_delay_count;
|
2002-02-28 23:53:59 +00:00
|
|
|
|
}
|
1992-03-14 20:40:04 +00:00
|
|
|
|
|
1992-07-13 20:53:59 +00:00
|
|
|
|
/* If frame size has changed or the window is newly mapped,
|
1992-05-18 08:14:41 +00:00
|
|
|
|
redisplay now, before we start to wait. There is a race
|
|
|
|
|
condition here; if a SIGIO arrives between now and the select
|
1992-12-06 22:19:47 +00:00
|
|
|
|
and indicates that a frame is trashed, the select may block
|
|
|
|
|
displaying a trashed screen. */
|
1994-03-20 01:16:55 +00:00
|
|
|
|
if (frame_garbaged && do_display)
|
1995-05-06 23:07:51 +00:00
|
|
|
|
{
|
|
|
|
|
clear_waiting_for_input ();
|
2001-01-16 12:42:22 +00:00
|
|
|
|
redisplay_preserve_echo_area (11);
|
2004-08-19 13:57:17 +00:00
|
|
|
|
if (read_kbd < 0)
|
1995-05-07 22:23:26 +00:00
|
|
|
|
set_waiting_for_input (&timeout);
|
1995-05-06 23:07:51 +00:00
|
|
|
|
}
|
1992-05-18 08:14:41 +00:00
|
|
|
|
|
2002-02-28 23:53:59 +00:00
|
|
|
|
no_avail = 0;
|
2004-08-19 13:57:17 +00:00
|
|
|
|
if (read_kbd && detect_input_pending ())
|
1996-04-14 17:45:31 +00:00
|
|
|
|
{
|
|
|
|
|
nfds = 0;
|
2002-02-28 23:53:59 +00:00
|
|
|
|
no_avail = 1;
|
1996-04-14 17:45:31 +00:00
|
|
|
|
}
|
|
|
|
|
else
|
2002-02-28 23:53:59 +00:00
|
|
|
|
{
|
2004-11-01 11:04:37 +00:00
|
|
|
|
#ifdef NON_BLOCKING_CONNECT
|
2002-02-28 23:53:59 +00:00
|
|
|
|
if (check_connect)
|
|
|
|
|
Connecting = connect_wait_mask;
|
2004-11-01 11:04:37 +00:00
|
|
|
|
#endif
|
2004-04-16 12:51:06 +00:00
|
|
|
|
|
|
|
|
|
#ifdef ADAPTIVE_READ_BUFFERING
|
2005-06-07 13:19:25 +00:00
|
|
|
|
/* Set the timeout for adaptive read buffering if any
|
(struct Lisp_Process): Turn slots infd, outfd, kill_without_query, pty_flag,
tick, update_tick, decoding_carryover, inherit_coding_system_flag,
filter_multibyte, adaptive_read_buffering, read_output_delay, and
read_output_skip from Lisp_Objects to ints. Remove unused
encoding_carryover.
2007-07-12 06:36:57 +00:00
|
|
|
|
process has non-zero read_output_skip and non-zero
|
2005-06-07 13:19:25 +00:00
|
|
|
|
read_output_delay, and we are not reading output for a
|
|
|
|
|
specific wait_channel. It is not executed if
|
|
|
|
|
Vprocess_adaptive_read_buffering is nil. */
|
2004-04-16 12:51:06 +00:00
|
|
|
|
if (process_output_skip && check_delay > 0)
|
|
|
|
|
{
|
|
|
|
|
int usecs = EMACS_USECS (timeout);
|
|
|
|
|
if (EMACS_SECS (timeout) > 0 || usecs > READ_OUTPUT_DELAY_MAX)
|
|
|
|
|
usecs = READ_OUTPUT_DELAY_MAX;
|
|
|
|
|
for (channel = 0; check_delay > 0 && channel <= max_process_desc; channel++)
|
|
|
|
|
{
|
|
|
|
|
proc = chan_process[channel];
|
|
|
|
|
if (NILP (proc))
|
|
|
|
|
continue;
|
2005-06-07 13:19:25 +00:00
|
|
|
|
/* Find minimum non-zero read_output_delay among the
|
(struct Lisp_Process): Turn slots infd, outfd, kill_without_query, pty_flag,
tick, update_tick, decoding_carryover, inherit_coding_system_flag,
filter_multibyte, adaptive_read_buffering, read_output_delay, and
read_output_skip from Lisp_Objects to ints. Remove unused
encoding_carryover.
2007-07-12 06:36:57 +00:00
|
|
|
|
processes with non-zero read_output_skip. */
|
|
|
|
|
if (XPROCESS (proc)->read_output_delay > 0)
|
2004-04-16 12:51:06 +00:00
|
|
|
|
{
|
|
|
|
|
check_delay--;
|
(struct Lisp_Process): Turn slots infd, outfd, kill_without_query, pty_flag,
tick, update_tick, decoding_carryover, inherit_coding_system_flag,
filter_multibyte, adaptive_read_buffering, read_output_delay, and
read_output_skip from Lisp_Objects to ints. Remove unused
encoding_carryover.
2007-07-12 06:36:57 +00:00
|
|
|
|
if (!XPROCESS (proc)->read_output_skip)
|
2004-04-16 12:51:06 +00:00
|
|
|
|
continue;
|
|
|
|
|
FD_CLR (channel, &Available);
|
(struct Lisp_Process): Turn slots infd, outfd, kill_without_query, pty_flag,
tick, update_tick, decoding_carryover, inherit_coding_system_flag,
filter_multibyte, adaptive_read_buffering, read_output_delay, and
read_output_skip from Lisp_Objects to ints. Remove unused
encoding_carryover.
2007-07-12 06:36:57 +00:00
|
|
|
|
XPROCESS (proc)->read_output_skip = 0;
|
|
|
|
|
if (XPROCESS (proc)->read_output_delay < usecs)
|
|
|
|
|
usecs = XPROCESS (proc)->read_output_delay;
|
2004-04-16 12:51:06 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
EMACS_SET_SECS_USECS (timeout, 0, usecs);
|
|
|
|
|
process_output_skip = 0;
|
|
|
|
|
}
|
|
|
|
|
#endif
|
2009-11-21 15:28:59 +00:00
|
|
|
|
#if defined (USE_GTK) || defined (HAVE_GCONF)
|
|
|
|
|
nfds = xg_select
|
|
|
|
|
#elif defined (HAVE_NS)
|
2009-01-01 15:58:38 +00:00
|
|
|
|
nfds = ns_select
|
2008-07-15 18:15:18 +00:00
|
|
|
|
#else
|
2009-01-01 15:58:38 +00:00
|
|
|
|
nfds = select
|
2008-07-15 18:15:18 +00:00
|
|
|
|
#endif
|
2009-01-01 15:58:38 +00:00
|
|
|
|
(max (max (max_process_desc, max_keyboard_desc),
|
2007-05-20 02:41:19 +00:00
|
|
|
|
max_gpm_desc) + 1,
|
2003-02-04 14:56:31 +00:00
|
|
|
|
&Available,
|
2004-11-01 11:04:37 +00:00
|
|
|
|
#ifdef NON_BLOCKING_CONNECT
|
2002-02-28 23:53:59 +00:00
|
|
|
|
(check_connect ? &Connecting : (SELECT_TYPE *)0),
|
2004-11-01 11:04:37 +00:00
|
|
|
|
#else
|
|
|
|
|
(SELECT_TYPE *)0,
|
|
|
|
|
#endif
|
2002-02-28 23:53:59 +00:00
|
|
|
|
(SELECT_TYPE *)0, &timeout);
|
|
|
|
|
}
|
1992-03-18 20:22:31 +00:00
|
|
|
|
|
1992-03-14 20:40:04 +00:00
|
|
|
|
xerrno = errno;
|
|
|
|
|
|
|
|
|
|
/* Make C-g and alarm signals set flags again */
|
|
|
|
|
clear_waiting_for_input ();
|
|
|
|
|
|
|
|
|
|
/* If we woke up due to SIGWINCH, actually change size now. */
|
1999-08-21 19:30:35 +00:00
|
|
|
|
do_pending_window_change (0);
|
1992-03-14 20:40:04 +00:00
|
|
|
|
|
1996-02-01 20:35:59 +00:00
|
|
|
|
if (time_limit && nfds == 0 && ! timeout_reduced_for_timers)
|
|
|
|
|
/* We wanted the full specified time, so return now. */
|
1992-03-14 20:40:04 +00:00
|
|
|
|
break;
|
|
|
|
|
if (nfds < 0)
|
|
|
|
|
{
|
|
|
|
|
if (xerrno == EINTR)
|
2002-02-28 23:53:59 +00:00
|
|
|
|
no_avail = 1;
|
1992-03-14 20:40:04 +00:00
|
|
|
|
else if (xerrno == EBADF)
|
|
|
|
|
{
|
|
|
|
|
#ifdef AIX
|
|
|
|
|
/* AIX doesn't handle PTY closure the same way BSD does. On AIX,
|
|
|
|
|
the child's closure of the pts gives the parent a SIGHUP, and
|
|
|
|
|
the ptc file descriptor is automatically closed,
|
|
|
|
|
yielding EBADF here or at select() call above.
|
|
|
|
|
So, SIGHUP is ignored (see def of PTY_TTY_NAME_SPRINTF
|
1994-01-09 12:16:26 +00:00
|
|
|
|
in m/ibmrt-aix.h), and here we just ignore the select error.
|
1992-03-14 20:40:04 +00:00
|
|
|
|
Cleanup occurs c/o status_notify after SIGCLD. */
|
2002-02-28 23:53:59 +00:00
|
|
|
|
no_avail = 1; /* Cannot depend on values returned */
|
1992-03-14 20:40:04 +00:00
|
|
|
|
#else
|
|
|
|
|
abort ();
|
|
|
|
|
#endif
|
|
|
|
|
}
|
|
|
|
|
else
|
Add support for large files, 64-bit Solaris, system locale codings.
* Makefile.in (emacs): Set the LC_ALL environment variable to "C"
when dumping, so that the dumped Emacs doesn't have stray locale info.
(dired.o): Depend on systime.h.
(editfns.o): Depend on coding.h.
* alloc.c, buffer.c, callproc.c, ccl.c, charset.c, coding.c, data.c,
dispnew.c, editfns.c, emacs.c, filelock.c, floatfns.c, hftctl.c,
keyboard.c, process.c, sysdep.c, unexelf.c, unexhp9k800.c,
unexsunos4.c, vmsfns.c, vmsgmalloc.c, w32faces.c, w32menu.c, w32term.c,
w32xfns.c, xfaces.c, xfns.c, xmenu.c, xterm.c:
Include <config.h> before any system include files.
* alloc.c, buffer.c, ccl.c, data.c, editfns.c, emacs.c, eval.c,
fileio.c, filelock.c, frame.c, insdel.c, keymap.c, lread.c,
m/alpha.h, print.c, search.c, sysdep.c, xdisp.c, xfaces.c, xfns.c,
xmenu.c, xterm.c:
Do not include <stdlib.h>, as <config.h> does this now.
* callproc.c (Fcall_process):
Synchronize messages locale before invoking strerror.
Decode resulting string with locale-coding-system.
* coding.c (Vlocale_coding_system): New var.
(syms_of_coding): Adjust to above change.
(emacs_strerror): New function.
* coding.h (emacs_strerror, Vlocale_coding_system): New decls.
* config.in (HAVE_STDIO_EXT_H, HAVE_TM_GMTOFF, HAVE___FPENDING,
HAVE_FTELLO, HAVE_GETLOADAVG, HAVE_MBLEN, HAVE_MBRLEN,
HAVE_STRSIGNAL): New macros.
(BITS_PER_LONG): Default to 64 if _LP64 is defined.
<stdlib.h>: Include if HAVE_STDLIB_H is defined and NOT_C_CODE isn't.
* dired.c: Include "systime.h".
(Ffile_attributes): Do not cast s.st_size to int; this loses
information if int is 32 bits but st_size and EMACS_INT are larger.
Treat large device numbers like large inode numbers.
* dispnew.c (PENDING_OUTPUT_COUNT): Use __fpending if available.
* editfns.c: Include coding.h.
(emacs_strftime): Remove decl.
(emacs_strftimeu): New decl.
(emacs_memftimeu): Renamed from emacs_memftime; new arg UT.
Use emacs_strftimeu instead of emacs_strftime.
(Fformat_time_string): Convert format string using
Vlocale_coding_system, and convert result back. Synchronize time
locale before invoking lower level function. Invoke
emacs_memftimeu, passing ut, instead of emacs_memftime.
* emacs.c: Include <locale.h> if HAVE_SETLOCALE is defined.
(Vmessages_locale, Vprevious_messages_locale, Vtime_locale,
Vprevious_time_locale): New variables.
(main): Invoke setlocale early, so that initial error messages are
localized properly. But skip locale-setting if LC_ALL is "C".
Fix up locale when it's safe to do so.
(fixup_locale): Moved here from xterm.c.
(synchronize_locale, synchronize_time_locale,
synchronize_messages_locale): New functions.
(syms_of_emacs): Accommodate above changes.
* fileio.c (report_file_error): Convert strerror output according
to Vlocale_coding_system.
(Finsert_file_contents): Check for arithmetic overflow in
computations that depend on file size. Report IO errors
with emacs_strerror, not strerror.
* fns.c (Fgethash): Declare dflt parameter.
* gmalloc.c: Do not define const to nothing if HAVE_CONFIG_H
is defined; that's config.h's job.
* lisp.h (EMACS_INT, BITS_PER_EMACS_INT, EMACS_UINT): If _LP64,
default these values to long, BITS_PER_LONG, and unsigned long.
(VALBITS, MARKBIT, XINT): Do not assume 32-bit EMACS_INT.
(PNTR_COMPARISON_TYPE): Default to EMACS_UINT, not to unsigned int.
(code_convert_string_norecord, fixup_locale,
synchronize_messages_locale, synchronize_time_locale,
emacs_open, emacs_close, emacs_read, emacs_write): New decls.
All Emacs callers of open, close, read, write changed to use
emacs_open, emacs_close, emacs_read, emacs_write.
* lread.c (file_offset, file_tell): New macros. All uses of ftell
changed to file_tell.
(saved_doc_string_position, prev_saved_doc_string_position): Now
of type file_offset.
(init_lread): Do not fix locale here; fixup_locale now does this.
* m/amdahl.h, s/usg5-4.h:
(NSIG): Remove.
(NSIG_MINIMUM): New macro.
* m/cydra5.h, m/dpx2.h, m/mips.h, m/pfa50.h, m/sps7.h, m/stride.h,
m/ustation.h, s/gnu-linux.h, s/hpux.h, s/iris3-5.h, s/iris3-6.h,
s/umips.h, s/usg5-4.h:
(SIGIO): Do not undef.
(BROKEN_SIGIO): New macro.
* m/ustation.h:
(SIGTSTP): Do not undef.
(BROKEN_SIGTSTP): New macro.
* s/gnu-linux.h:
(SIGPOLL, SIGURG): Do not undef.
(BROKEN_SIGPOLL, BROKEN_SIGURG): New macros.
* s/ptx4.h:
(SIGINFO): Do not undef.
(BROKEN_SIGINFO): New macros.
* m/delta.h, s/ptx.h, s/template.h: Doc fix.
* mktime.c, strftime.c: Update to glibc 2.1.2 version, with
some Emacs-related changes merged.
* print.c (float_to_string): Prepend "-" to representation of a
NaN if the NaN is negative.
* process.c (sys_siglist): Omit if HAVE_STRSIGNAL.
(wait_reading_process_input): Use emacs_strerror, not strerror.
* process.c (status_message, sigchld_handler): Synchronize locale,
then use strsignal istead of sys_siglist.
* w32proc.c (sys_wait): Likewise.
* s/aix3-1.h, s/bsd4-1.h, s/dgux.h, s/gnu-linux.h, s/hiuxmpp.h,
s/hpux.h, s/iris3-5.h, s/iris3-6.h, s/irix3-3.h, s/osf1.h, s/rtu.h,
s/sunos4-1.h, s/unipl5-0.h, s/unipl5-2.h, s/usg5-0.h, s/usg5-2-2.h,
s/usg5-2.h, s/usg5-3.h, s/xenix.h:
(open, close, read, write, INTERRUPTIBLE_OPEN,
INTERRUPTIBLE_CLOSE, INTERRUPTIBLE_IO): Remove.
* s/sol2-5.h (_LARGEFILE_SOURCE, _FILE_OFFSET_BITS): New macros.
* sysdep.c (sys_read, sys_write, read, write, sys_close, close,
sys_open, open): Remove.
(emacs_open, emacs_close, emacs_read, emacs_write): Always define;
the old INTERRUPTIBLE_OPEN, INTERRUPTIBLE_CLOSE, and INTERRUPTIBLE_IO
macros are no longer used.
(emacs_open): Renamed from sys_open. Merge BSD4_1 version.
(emacs_close): Renamed from sys_close.
(emacs_read): Renamed from sys_read.
(emacs_write): Renamed from sys_write.
(sys_siglist): Do not declare if HAVE_STRSIGNAL.
(dup2): Do not print error on failure; the real dup2 doesn't.
(strsignal): New function, defined if !HAVE_STRSIGNAL.
* syssignal.h (SIGINFO): Undef if defined and if BROKEN_SIGINFO
is defined.
(SIGIO, SIGPOLL, SIGTSTP, SIGURG): Likewise.
(NSIG): If less than NSIG_MINIMUM, define to NSIG_MINIMUM.
(strsignal): Declare if !HAVE_STRSIGNAL.
* unexelf.c (ElfBitsW, ELFSIZE, ElfExpandBitsW): New macros.
(ElfW): Define in terms of ElfExpandBitsW.
* w32proc.c (sys_siglist): Remove decl.
* xdisp.c (decode_mode_spec): 3rd arg is int, not char, to comply
with ANSI C.
(display_string): Declare face_string_pos arg.
* xfns.c (Fx_show_tip): Declare timeout param.
* xterm.c: No need to include locale.h.
(x_alloc_lighter_color, x_setup_relief_color):
Pass arg as double, not float, for compatibility with ANSI C.
(fixup_locale): Move to emacs.c.
(x_term_init): Do not setlocale or fixup locale; the main program
does this now.
1999-10-19 07:25:11 +00:00
|
|
|
|
error ("select error: %s", emacs_strerror (xerrno));
|
1992-03-14 20:40:04 +00:00
|
|
|
|
}
|
2002-02-28 23:53:59 +00:00
|
|
|
|
|
|
|
|
|
if (no_avail)
|
|
|
|
|
{
|
|
|
|
|
FD_ZERO (&Available);
|
2004-11-01 11:04:37 +00:00
|
|
|
|
IF_NON_BLOCKING_CONNECT (check_connect = 0);
|
2002-02-28 23:53:59 +00:00
|
|
|
|
}
|
|
|
|
|
|
1997-06-22 09:06:04 +00:00
|
|
|
|
#if 0 /* When polling is used, interrupt_input is 0,
|
|
|
|
|
so get_input_pending should read the input.
|
|
|
|
|
So this should not be needed. */
|
|
|
|
|
/* If we are using polling for input,
|
|
|
|
|
and we see input available, make it get read now.
|
|
|
|
|
Otherwise it might not actually get read for a second.
|
2004-08-20 10:33:25 +00:00
|
|
|
|
And on hpux, since we turn off polling in wait_reading_process_output,
|
1997-06-22 09:06:04 +00:00
|
|
|
|
it might never get read at all if we don't spend much time
|
2004-08-20 10:33:25 +00:00
|
|
|
|
outside of wait_reading_process_output. */
|
2004-08-19 13:57:17 +00:00
|
|
|
|
if (read_kbd && interrupt_input
|
1997-06-22 09:06:04 +00:00
|
|
|
|
&& keyboard_bit_set (&Available)
|
|
|
|
|
&& input_polling_used ())
|
|
|
|
|
kill (getpid (), SIGALRM);
|
|
|
|
|
#endif
|
|
|
|
|
|
1992-03-14 20:40:04 +00:00
|
|
|
|
/* Check for keyboard input */
|
|
|
|
|
/* If there is any, return immediately
|
|
|
|
|
to give it higher priority than subprocesses */
|
|
|
|
|
|
2004-08-19 13:57:17 +00:00
|
|
|
|
if (read_kbd != 0)
|
1996-02-21 21:08:31 +00:00
|
|
|
|
{
|
2001-04-19 12:47:59 +00:00
|
|
|
|
int old_timers_run = timers_run;
|
2001-04-25 15:12:49 +00:00
|
|
|
|
struct buffer *old_buffer = current_buffer;
|
2008-01-10 04:08:55 +00:00
|
|
|
|
Lisp_Object old_window = selected_window;
|
2001-04-19 12:47:59 +00:00
|
|
|
|
int leave = 0;
|
2003-02-04 14:56:31 +00:00
|
|
|
|
|
1996-03-05 17:33:27 +00:00
|
|
|
|
if (detect_input_pending_run_timers (do_display))
|
2001-04-19 12:47:59 +00:00
|
|
|
|
{
|
|
|
|
|
swallow_events (do_display);
|
|
|
|
|
if (detect_input_pending_run_timers (do_display))
|
|
|
|
|
leave = 1;
|
|
|
|
|
}
|
1996-02-21 21:08:31 +00:00
|
|
|
|
|
2001-04-19 12:47:59 +00:00
|
|
|
|
/* If a timer has run, this might have changed buffers
|
|
|
|
|
an alike. Make read_key_sequence aware of that. */
|
|
|
|
|
if (timers_run != old_timers_run
|
2001-04-25 15:12:49 +00:00
|
|
|
|
&& waiting_for_user_input_p == -1
|
2008-01-10 04:08:55 +00:00
|
|
|
|
&& (old_buffer != current_buffer
|
|
|
|
|
|| !EQ (old_window, selected_window)))
|
2001-04-19 12:47:59 +00:00
|
|
|
|
record_asynch_buffer_change ();
|
|
|
|
|
|
|
|
|
|
if (leave)
|
|
|
|
|
break;
|
2003-02-04 14:56:31 +00:00
|
|
|
|
}
|
|
|
|
|
|
1997-06-13 00:45:19 +00:00
|
|
|
|
/* If there is unread keyboard input, also return. */
|
2004-08-19 13:57:17 +00:00
|
|
|
|
if (read_kbd != 0
|
1997-06-13 00:45:19 +00:00
|
|
|
|
&& requeued_events_pending_p ())
|
|
|
|
|
break;
|
|
|
|
|
|
1997-07-31 06:08:07 +00:00
|
|
|
|
/* If we are not checking for keyboard input now,
|
|
|
|
|
do process events (but don't run any timers).
|
|
|
|
|
This is so that X events will be processed.
|
1997-06-29 00:34:36 +00:00
|
|
|
|
Otherwise they may have to wait until polling takes place.
|
1997-07-31 06:08:07 +00:00
|
|
|
|
That would causes delays in pasting selections, for example.
|
|
|
|
|
|
|
|
|
|
(We used to do this only if wait_for_cell.) */
|
2004-08-19 13:57:17 +00:00
|
|
|
|
if (read_kbd == 0 && detect_input_pending ())
|
1996-04-23 20:32:33 +00:00
|
|
|
|
{
|
|
|
|
|
swallow_events (do_display);
|
1997-06-29 00:34:36 +00:00
|
|
|
|
#if 0 /* Exiting when read_kbd doesn't request that seems wrong, though. */
|
1996-04-23 20:32:33 +00:00
|
|
|
|
if (detect_input_pending ())
|
|
|
|
|
break;
|
1997-06-22 09:06:04 +00:00
|
|
|
|
#endif
|
1997-06-29 00:34:36 +00:00
|
|
|
|
}
|
1996-04-23 20:32:33 +00:00
|
|
|
|
|
1993-03-15 06:09:04 +00:00
|
|
|
|
/* Exit now if the cell we're waiting for became non-nil. */
|
2001-10-16 09:09:51 +00:00
|
|
|
|
if (! NILP (wait_for_cell) && ! NILP (XCAR (wait_for_cell)))
|
1993-03-15 06:09:04 +00:00
|
|
|
|
break;
|
|
|
|
|
|
1992-04-24 08:11:54 +00:00
|
|
|
|
#ifdef SIGIO
|
1997-06-22 09:06:04 +00:00
|
|
|
|
/* If we think we have keyboard input waiting, but didn't get SIGIO,
|
1992-03-14 20:40:04 +00:00
|
|
|
|
go read it. This can happen with X on BSD after logging out.
|
|
|
|
|
In that case, there really is no input and no SIGIO,
|
|
|
|
|
but select says there is input. */
|
|
|
|
|
|
2004-08-19 13:57:17 +00:00
|
|
|
|
if (read_kbd && interrupt_input
|
2003-06-22 00:04:49 +00:00
|
|
|
|
&& keyboard_bit_set (&Available) && ! noninteractive)
|
1996-03-03 05:34:59 +00:00
|
|
|
|
kill (getpid (), SIGIO);
|
1992-04-24 08:11:54 +00:00
|
|
|
|
#endif
|
1992-03-14 20:40:04 +00:00
|
|
|
|
|
|
|
|
|
if (! wait_proc)
|
|
|
|
|
got_some_input |= nfds > 0;
|
|
|
|
|
|
1992-05-01 06:20:46 +00:00
|
|
|
|
/* If checking input just got us a size-change event from X,
|
|
|
|
|
obey it now if we should. */
|
2004-08-19 13:57:17 +00:00
|
|
|
|
if (read_kbd || ! NILP (wait_for_cell))
|
1999-08-21 19:30:35 +00:00
|
|
|
|
do_pending_window_change (0);
|
1992-05-01 06:20:46 +00:00
|
|
|
|
|
1993-11-23 10:57:16 +00:00
|
|
|
|
/* Check for data from a process. */
|
2002-02-28 23:53:59 +00:00
|
|
|
|
if (no_avail || nfds == 0)
|
|
|
|
|
continue;
|
|
|
|
|
|
1993-11-23 10:57:16 +00:00
|
|
|
|
/* Really FIRST_PROC_DESC should be 0 on Unix,
|
|
|
|
|
but this is safer in the short run. */
|
1994-10-25 09:48:44 +00:00
|
|
|
|
for (channel = 0; channel <= max_process_desc; channel++)
|
1992-03-14 20:40:04 +00:00
|
|
|
|
{
|
1994-10-25 09:48:44 +00:00
|
|
|
|
if (FD_ISSET (channel, &Available)
|
|
|
|
|
&& FD_ISSET (channel, &non_keyboard_wait_mask))
|
1992-03-14 20:40:04 +00:00
|
|
|
|
{
|
|
|
|
|
int nread;
|
|
|
|
|
|
|
|
|
|
/* If waiting for this channel, arrange to return as
|
|
|
|
|
soon as no more input to be processed. No more
|
|
|
|
|
waiting. */
|
|
|
|
|
if (wait_channel == channel)
|
|
|
|
|
{
|
1993-11-23 10:57:16 +00:00
|
|
|
|
wait_channel = -1;
|
1992-03-14 20:40:04 +00:00
|
|
|
|
time_limit = -1;
|
|
|
|
|
got_some_input = 1;
|
|
|
|
|
}
|
|
|
|
|
proc = chan_process[channel];
|
|
|
|
|
if (NILP (proc))
|
|
|
|
|
continue;
|
|
|
|
|
|
(Qlocal, QCname, QCbuffer, QChost, QCservice, QCfamily)
(QClocal, QCremote, QCserver, QCdatagram, QCnowait, QCnoquery,QCstop)
(QCcoding, QCoptions, QCfilter, QCsentinel, QClog, QCfeature):
New variables.
(NETCONN1_P): New macro.
(DATAGRAM_SOCKETS): New conditional symbol.
(datagram_address): New array.
(DATAGRAM_CONN_P, DATAGRAM_CHAN_P): New macros.
(status_message): Use concat3.
(Fprocess_status): Add `listen' status to doc string. Return `stop'
for a stopped network process.
(Fset_process_buffer): Update contact plist for network process.
(Fset_process_filter): Ditto. Don't enable input for stopped
network processes. Server must listen, even if filter is t.
(Fset_process_query_on_exit_flag, Fprocess_query_on_exit_flag):
New functions.
(Fprocess_kill_without_query): Removed. Now defined in simple.el.
(Fprocess_contact): Added KEY argument. Handle datagrams.
(list_processes_1): Optionally show only processes with the query
on exit flag set. Dynamically adjust column widths. Omit tty
column if not needed. Report stopped network processes.
Identify server and datagram network processes.
(Flist_processes): New optional arg `query-only'.
(conv_sockaddr_to_lisp, get_lisp_to_sockaddr_size)
(conv_lisp_to_sockaddr, set_socket_options)
(network_process_featurep, unwind_request_sigio): New helper functions.
(Fprocess_datagram_address, Fset_process_datagram_address):
(Fset_network_process_options): New lisp functions.
(Fopen_network_stream): Removed. Now defined in simple.el.
(Fmake_network_process): New lisp function. Code is based on previous
Fopen_network_stream, but heavily reworked with new property list based
argument list, support for datagrams, server processes, and local
sockets in addition to old client-only functionality.
(server_accept_connection): New function.
(wait_reading_process_input): Use it to handle incoming connects.
Do not enable input on a new connection if process is stopped.
(read_process_output): Handle datagram sockets. Use 2k buffer for them.
(send_process): Handle datagram sockets.
(Fstop_process, Fcontinue_process): Apply to network processes. A stopped
network process is indicated by setting command field to t .
(Fprocess_send_eof): No-op if datagram connection.
(Fstatus_notify): Don't read input for a stream server socket or a
stopped network process.
(init_process): Initialize datagram_address array.
(syms_of_process): Intern and staticpro new variables, defsubr new
functions.
2002-03-17 20:20:33 +00:00
|
|
|
|
/* If this is a server stream socket, accept connection. */
|
|
|
|
|
if (EQ (XPROCESS (proc)->status, Qlisten))
|
|
|
|
|
{
|
|
|
|
|
server_accept_connection (proc, channel);
|
|
|
|
|
continue;
|
|
|
|
|
}
|
|
|
|
|
|
1992-03-14 20:40:04 +00:00
|
|
|
|
/* Read data from the process, starting with our
|
|
|
|
|
buffered-ahead character if we have one. */
|
|
|
|
|
|
|
|
|
|
nread = read_process_output (proc, channel);
|
|
|
|
|
if (nread > 0)
|
|
|
|
|
{
|
|
|
|
|
/* Since read_process_output can run a filter,
|
|
|
|
|
which can call accept-process-output,
|
|
|
|
|
don't try to read from any other processes
|
|
|
|
|
before doing the select again. */
|
|
|
|
|
FD_ZERO (&Available);
|
|
|
|
|
|
|
|
|
|
if (do_display)
|
2001-01-16 12:42:22 +00:00
|
|
|
|
redisplay_preserve_echo_area (12);
|
1992-03-14 20:40:04 +00:00
|
|
|
|
}
|
|
|
|
|
#ifdef EWOULDBLOCK
|
|
|
|
|
else if (nread == -1 && errno == EWOULDBLOCK)
|
|
|
|
|
;
|
1996-06-11 19:48:13 +00:00
|
|
|
|
#endif
|
1996-06-11 19:50:32 +00:00
|
|
|
|
/* ISC 4.1 defines both EWOULDBLOCK and O_NONBLOCK,
|
|
|
|
|
and Emacs uses O_NONBLOCK, so what we get is EAGAIN. */
|
1992-03-14 20:40:04 +00:00
|
|
|
|
#ifdef O_NONBLOCK
|
|
|
|
|
else if (nread == -1 && errno == EAGAIN)
|
|
|
|
|
;
|
|
|
|
|
#else
|
|
|
|
|
#ifdef O_NDELAY
|
|
|
|
|
else if (nread == -1 && errno == EAGAIN)
|
|
|
|
|
;
|
|
|
|
|
/* 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. */
|
Daniel Engeler <engeler at gmail.com>
These changes add serial port access.
* process.c: Add HAVE_SERIAL.
(Fdelete_process, Fprocess_status, Fset_process_buffer)
(Fset_process_filter, Fset_process_sentinel, Fprocess_contact)
(list_processes_1, select_wrapper, Fstop_process)
(Fcontinue_process, Fprocess_send_eof, kill_buffer_processes)
(status_notify): Modify to handle serial processes.
[HAVE_SERIAL] (Fserial_process_configure)
[HAVE_SERIAL] (make_serial_process_unwind, Fmake_serial_process):
New functions.
* process.h (struct Lisp_Process): Add `type'.
* sysdep.c [HAVE_TERMIOS] (serial_open, serial_configure):
New functions.
* w32.c (_sys_read_ahead, sys_read, sys_write): Modify to handle serial ports.
(serial_open, serial_configure) New functions.
* w32.h: Add FILE_SERIAL.
(struct _child_process): Add ovl_read, ovl_write.
2008-06-13 08:08:20 +00:00
|
|
|
|
else if (nread == 0 && !NETCONN_P (proc) && !SERIALCONN_P (proc))
|
1992-03-14 20:40:04 +00:00
|
|
|
|
;
|
2007-03-29 21:24:38 +00:00
|
|
|
|
#endif /* O_NDELAY */
|
|
|
|
|
#endif /* O_NONBLOCK */
|
1992-03-14 20:40:04 +00:00
|
|
|
|
#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
|
|
|
|
|
errno = EIO instead of getting an EOF (0 bytes read).
|
|
|
|
|
Therefore, if we get an error reading and errno =
|
|
|
|
|
EIO, just continue, because the child process has
|
|
|
|
|
exited and should clean itself up soon (e.g. when we
|
1998-08-15 05:53:00 +00:00
|
|
|
|
get a SIGCHLD).
|
|
|
|
|
|
|
|
|
|
However, it has been known to happen that the SIGCHLD
|
2007-03-29 21:24:38 +00:00
|
|
|
|
got lost. So raise the signal again just in case.
|
1998-08-15 05:53:00 +00:00
|
|
|
|
It can't hurt. */
|
1992-03-14 20:40:04 +00:00
|
|
|
|
else if (nread == -1 && errno == EIO)
|
2007-03-29 21:24:38 +00:00
|
|
|
|
{
|
2009-08-30 04:54:34 +00:00
|
|
|
|
/* Clear the descriptor now, so we only raise the
|
2009-08-30 05:00:59 +00:00
|
|
|
|
signal once. Don't do this if `process' is only
|
2009-08-30 04:54:34 +00:00
|
|
|
|
a pty. */
|
|
|
|
|
if (XPROCESS (proc)->pid != -2)
|
|
|
|
|
{
|
|
|
|
|
FD_CLR (channel, &input_wait_mask);
|
|
|
|
|
FD_CLR (channel, &non_keyboard_wait_mask);
|
2007-03-29 21:24:38 +00:00
|
|
|
|
|
2009-08-30 04:54:34 +00:00
|
|
|
|
kill (getpid (), SIGCHLD);
|
|
|
|
|
}
|
2007-03-29 21:24:38 +00:00
|
|
|
|
}
|
|
|
|
|
#endif /* HAVE_PTYS */
|
1992-05-18 08:14:41 +00:00
|
|
|
|
/* If we can detect process termination, don't consider the process
|
|
|
|
|
gone just because its pipe is closed. */
|
1992-03-14 20:40:04 +00:00
|
|
|
|
#ifdef SIGCHLD
|
Daniel Engeler <engeler at gmail.com>
These changes add serial port access.
* process.c: Add HAVE_SERIAL.
(Fdelete_process, Fprocess_status, Fset_process_buffer)
(Fset_process_filter, Fset_process_sentinel, Fprocess_contact)
(list_processes_1, select_wrapper, Fstop_process)
(Fcontinue_process, Fprocess_send_eof, kill_buffer_processes)
(status_notify): Modify to handle serial processes.
[HAVE_SERIAL] (Fserial_process_configure)
[HAVE_SERIAL] (make_serial_process_unwind, Fmake_serial_process):
New functions.
* process.h (struct Lisp_Process): Add `type'.
* sysdep.c [HAVE_TERMIOS] (serial_open, serial_configure):
New functions.
* w32.c (_sys_read_ahead, sys_read, sys_write): Modify to handle serial ports.
(serial_open, serial_configure) New functions.
* w32.h: Add FILE_SERIAL.
(struct _child_process): Add ovl_read, ovl_write.
2008-06-13 08:08:20 +00:00
|
|
|
|
else if (nread == 0 && !NETCONN_P (proc) && !SERIALCONN_P (proc))
|
1992-03-14 20:40:04 +00:00
|
|
|
|
;
|
|
|
|
|
#endif
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
/* Preserve status of processes already terminated. */
|
(struct Lisp_Process): Turn slots infd, outfd, kill_without_query, pty_flag,
tick, update_tick, decoding_carryover, inherit_coding_system_flag,
filter_multibyte, adaptive_read_buffering, read_output_delay, and
read_output_skip from Lisp_Objects to ints. Remove unused
encoding_carryover.
2007-07-12 06:36:57 +00:00
|
|
|
|
XPROCESS (proc)->tick = ++process_tick;
|
1992-03-14 20:40:04 +00:00
|
|
|
|
deactivate_process (proc);
|
* process.h (struct Lisp_Process): Replace Lisp_Objects `pid',
`raw_status_high', and `raw_status_low' with plain integers, and move
them to the end of the structure.
* alloc.c (allocate_process): Use PSEUDOVECSIZE to initialize the
pseudovector's size field so only the Lisp_Object fields get GC'd.
* process.c (update_status, make_process, Fdelete_process)
(Fprocess_status, list_processes_1, start_process_unwind)
(create_process, Fmake_network_process, server_accept_connection)
(wait_reading_process_output, send_process, Fprocess_running_child_p)
(process_send_signal, proc_encode_coding_system, Fprocess_send_eof)
(sigchld_handler, status_notify): Adjust to new non-Lisp fields for
`pid' and `raw_status'.
(Fprocess_id, Fsignal_process): Same, and additionally use floats when
representing PIDs that are larger than most-positive-fixnum.
2006-04-08 15:07:35 +00:00
|
|
|
|
if (XPROCESS (proc)->raw_status_new)
|
1992-03-14 20:40:04 +00:00
|
|
|
|
update_status (XPROCESS (proc));
|
|
|
|
|
if (EQ (XPROCESS (proc)->status, Qrun))
|
|
|
|
|
XPROCESS (proc)->status
|
|
|
|
|
= Fcons (Qexit, Fcons (make_number (256), Qnil));
|
|
|
|
|
}
|
|
|
|
|
}
|
2003-02-04 14:56:31 +00:00
|
|
|
|
#ifdef NON_BLOCKING_CONNECT
|
2004-05-25 11:17:43 +00:00
|
|
|
|
if (check_connect && FD_ISSET (channel, &Connecting)
|
|
|
|
|
&& FD_ISSET (channel, &connect_wait_mask))
|
2002-02-28 23:53:59 +00:00
|
|
|
|
{
|
|
|
|
|
struct Lisp_Process *p;
|
|
|
|
|
|
|
|
|
|
FD_CLR (channel, &connect_wait_mask);
|
|
|
|
|
if (--num_pending_connects < 0)
|
|
|
|
|
abort ();
|
|
|
|
|
|
|
|
|
|
proc = chan_process[channel];
|
|
|
|
|
if (NILP (proc))
|
|
|
|
|
continue;
|
|
|
|
|
|
|
|
|
|
p = XPROCESS (proc);
|
|
|
|
|
|
|
|
|
|
#ifdef GNU_LINUX
|
|
|
|
|
/* getsockopt(,,SO_ERROR,,) is said to hang on some systems.
|
2009-01-01 15:58:38 +00:00
|
|
|
|
So only use it on systems where it is known to work. */
|
2002-02-28 23:53:59 +00:00
|
|
|
|
{
|
2010-07-07 11:45:28 +02:00
|
|
|
|
int xlen = sizeof (xerrno);
|
|
|
|
|
if (getsockopt (channel, SOL_SOCKET, SO_ERROR, &xerrno, &xlen))
|
2002-02-28 23:53:59 +00:00
|
|
|
|
xerrno = errno;
|
|
|
|
|
}
|
|
|
|
|
#else
|
2002-03-18 18:22:37 +00:00
|
|
|
|
{
|
|
|
|
|
struct sockaddr pname;
|
2010-07-07 11:45:28 +02:00
|
|
|
|
int pnamelen = sizeof (pname);
|
2002-03-18 18:22:37 +00:00
|
|
|
|
|
|
|
|
|
/* If connection failed, getpeername will fail. */
|
|
|
|
|
xerrno = 0;
|
2010-07-07 11:45:28 +02:00
|
|
|
|
if (getpeername (channel, &pname, &pnamelen) < 0)
|
2002-03-18 18:22:37 +00:00
|
|
|
|
{
|
|
|
|
|
/* Obtain connect failure code through error slippage. */
|
|
|
|
|
char dummy;
|
2002-02-28 23:53:59 +00:00
|
|
|
|
xerrno = errno;
|
2010-07-07 11:45:28 +02:00
|
|
|
|
if (errno == ENOTCONN && read (channel, &dummy, 1) < 0)
|
2002-03-18 18:22:37 +00:00
|
|
|
|
xerrno = errno;
|
|
|
|
|
}
|
|
|
|
|
}
|
2002-02-28 23:53:59 +00:00
|
|
|
|
#endif
|
|
|
|
|
if (xerrno)
|
|
|
|
|
{
|
(struct Lisp_Process): Turn slots infd, outfd, kill_without_query, pty_flag,
tick, update_tick, decoding_carryover, inherit_coding_system_flag,
filter_multibyte, adaptive_read_buffering, read_output_delay, and
read_output_skip from Lisp_Objects to ints. Remove unused
encoding_carryover.
2007-07-12 06:36:57 +00:00
|
|
|
|
p->tick = ++process_tick;
|
2002-02-28 23:53:59 +00:00
|
|
|
|
p->status = Fcons (Qfailed, Fcons (make_number (xerrno), Qnil));
|
|
|
|
|
deactivate_process (proc);
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
p->status = Qrun;
|
|
|
|
|
/* Execute the sentinel here. If we had relied on
|
|
|
|
|
status_notify to do it later, it will read input
|
|
|
|
|
from the process before calling the sentinel. */
|
|
|
|
|
exec_sentinel (proc, build_string ("open\n"));
|
(Qlocal, QCname, QCbuffer, QChost, QCservice, QCfamily)
(QClocal, QCremote, QCserver, QCdatagram, QCnowait, QCnoquery,QCstop)
(QCcoding, QCoptions, QCfilter, QCsentinel, QClog, QCfeature):
New variables.
(NETCONN1_P): New macro.
(DATAGRAM_SOCKETS): New conditional symbol.
(datagram_address): New array.
(DATAGRAM_CONN_P, DATAGRAM_CHAN_P): New macros.
(status_message): Use concat3.
(Fprocess_status): Add `listen' status to doc string. Return `stop'
for a stopped network process.
(Fset_process_buffer): Update contact plist for network process.
(Fset_process_filter): Ditto. Don't enable input for stopped
network processes. Server must listen, even if filter is t.
(Fset_process_query_on_exit_flag, Fprocess_query_on_exit_flag):
New functions.
(Fprocess_kill_without_query): Removed. Now defined in simple.el.
(Fprocess_contact): Added KEY argument. Handle datagrams.
(list_processes_1): Optionally show only processes with the query
on exit flag set. Dynamically adjust column widths. Omit tty
column if not needed. Report stopped network processes.
Identify server and datagram network processes.
(Flist_processes): New optional arg `query-only'.
(conv_sockaddr_to_lisp, get_lisp_to_sockaddr_size)
(conv_lisp_to_sockaddr, set_socket_options)
(network_process_featurep, unwind_request_sigio): New helper functions.
(Fprocess_datagram_address, Fset_process_datagram_address):
(Fset_network_process_options): New lisp functions.
(Fopen_network_stream): Removed. Now defined in simple.el.
(Fmake_network_process): New lisp function. Code is based on previous
Fopen_network_stream, but heavily reworked with new property list based
argument list, support for datagrams, server processes, and local
sockets in addition to old client-only functionality.
(server_accept_connection): New function.
(wait_reading_process_input): Use it to handle incoming connects.
Do not enable input on a new connection if process is stopped.
(read_process_output): Handle datagram sockets. Use 2k buffer for them.
(send_process): Handle datagram sockets.
(Fstop_process, Fcontinue_process): Apply to network processes. A stopped
network process is indicated by setting command field to t .
(Fprocess_send_eof): No-op if datagram connection.
(Fstatus_notify): Don't read input for a stream server socket or a
stopped network process.
(init_process): Initialize datagram_address array.
(syms_of_process): Intern and staticpro new variables, defsubr new
functions.
2002-03-17 20:20:33 +00:00
|
|
|
|
if (!EQ (p->filter, Qt) && !EQ (p->command, Qt))
|
2002-02-28 23:53:59 +00:00
|
|
|
|
{
|
(struct Lisp_Process): Turn slots infd, outfd, kill_without_query, pty_flag,
tick, update_tick, decoding_carryover, inherit_coding_system_flag,
filter_multibyte, adaptive_read_buffering, read_output_delay, and
read_output_skip from Lisp_Objects to ints. Remove unused
encoding_carryover.
2007-07-12 06:36:57 +00:00
|
|
|
|
FD_SET (p->infd, &input_wait_mask);
|
|
|
|
|
FD_SET (p->infd, &non_keyboard_wait_mask);
|
2002-02-28 23:53:59 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
#endif /* NON_BLOCKING_CONNECT */
|
1992-05-18 08:14:41 +00:00
|
|
|
|
} /* end for each file descriptor */
|
|
|
|
|
} /* end while exit conditions not met */
|
1992-03-14 20:40:04 +00:00
|
|
|
|
|
2006-08-01 00:13:08 +00:00
|
|
|
|
unbind_to (count, Qnil);
|
1994-08-19 07:23:05 +00:00
|
|
|
|
|
1992-05-18 08:14:41 +00:00
|
|
|
|
/* If calling from keyboard input, do not quit
|
|
|
|
|
since we want to return C-g as an input character.
|
|
|
|
|
Otherwise, do pending quit if requested. */
|
2004-08-19 13:57:17 +00:00
|
|
|
|
if (read_kbd >= 0)
|
1992-05-18 08:14:41 +00:00
|
|
|
|
{
|
|
|
|
|
/* Prevent input_pending from remaining set if we quit. */
|
|
|
|
|
clear_input_pending ();
|
|
|
|
|
QUIT;
|
|
|
|
|
}
|
1999-07-21 21:43:52 +00:00
|
|
|
|
|
1992-03-14 20:40:04 +00:00
|
|
|
|
return got_some_input;
|
|
|
|
|
}
|
|
|
|
|
|
1994-09-23 22:28:08 +00:00
|
|
|
|
/* Given a list (FUNCTION ARGS...), apply FUNCTION to the ARGS. */
|
|
|
|
|
|
|
|
|
|
static Lisp_Object
|
2010-07-05 12:36:06 +02:00
|
|
|
|
read_process_output_call (Lisp_Object fun_and_args)
|
1994-09-23 22:28:08 +00:00
|
|
|
|
{
|
1999-09-12 05:07:01 +00:00
|
|
|
|
return apply1 (XCAR (fun_and_args), XCDR (fun_and_args));
|
1994-09-23 22:28:08 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static Lisp_Object
|
2010-07-05 12:36:06 +02:00
|
|
|
|
read_process_output_error_handler (Lisp_Object error)
|
1994-09-23 22:28:08 +00:00
|
|
|
|
{
|
|
|
|
|
cmd_error_internal (error, "error in process filter: ");
|
|
|
|
|
Vinhibit_quit = Qt;
|
|
|
|
|
update_echo_area ();
|
1995-04-07 22:41:58 +00:00
|
|
|
|
Fsleep_for (make_number (2), Qnil);
|
2000-02-01 15:01:28 +00:00
|
|
|
|
return Qt;
|
1994-09-23 22:28:08 +00:00
|
|
|
|
}
|
|
|
|
|
|
1992-03-14 20:40:04 +00:00
|
|
|
|
/* Read pending output from the process channel,
|
|
|
|
|
starting with our buffered-ahead character if we have one.
|
1997-02-20 06:53:55 +00:00
|
|
|
|
Yield number of decoded characters read.
|
1992-03-14 20:40:04 +00:00
|
|
|
|
|
2004-06-06 22:17:53 +00:00
|
|
|
|
This function reads at most 4096 characters.
|
1992-03-14 20:40:04 +00:00
|
|
|
|
If you want to read all available subprocess output,
|
1997-02-20 06:53:55 +00:00
|
|
|
|
you must call it repeatedly until it returns zero.
|
|
|
|
|
|
|
|
|
|
The characters read are decoded according to PROC's coding-system
|
|
|
|
|
for decoding. */
|
1992-03-14 20:40:04 +00:00
|
|
|
|
|
(deactivate_process, status_notify, read_process_output)
(update_status, status_convert, decode_status, allocate_pty)
(make_process, remove_process, list_processes_1)
(create_process_1, unwind_request_sigio, read_process_output)
(send_process, keyboard_bit_set): Declare static.
(Fdelete_process): Simplify. Pass process to status_notify, so we
don't try to read output from it.
(status_notify): New arg deleting_process--don't try to read
output from that process.
2005-08-15 08:44:53 +00:00
|
|
|
|
static int
|
2010-07-05 12:36:06 +02:00
|
|
|
|
read_process_output (Lisp_Object proc, register int channel)
|
1992-03-14 20:40:04 +00:00
|
|
|
|
{
|
2003-09-08 12:53:41 +00:00
|
|
|
|
register int nbytes;
|
1992-03-14 20:40:04 +00:00
|
|
|
|
char *chars;
|
|
|
|
|
register Lisp_Object outstream;
|
|
|
|
|
register struct Lisp_Process *p = XPROCESS (proc);
|
|
|
|
|
register int opoint;
|
1997-02-27 07:48:21 +00:00
|
|
|
|
struct coding_system *coding = proc_decode_coding_system[channel];
|
(struct Lisp_Process): Turn slots infd, outfd, kill_without_query, pty_flag,
tick, update_tick, decoding_carryover, inherit_coding_system_flag,
filter_multibyte, adaptive_read_buffering, read_output_delay, and
read_output_skip from Lisp_Objects to ints. Remove unused
encoding_carryover.
2007-07-12 06:36:57 +00:00
|
|
|
|
int carryover = p->decoding_carryover;
|
2004-06-06 22:17:53 +00:00
|
|
|
|
int readmax = 4096;
|
2010-04-11 11:53:13 -04:00
|
|
|
|
int count = SPECPDL_INDEX ();
|
|
|
|
|
Lisp_Object odeactivate;
|
1992-03-14 20:40:04 +00:00
|
|
|
|
|
(Qlocal, QCname, QCbuffer, QChost, QCservice, QCfamily)
(QClocal, QCremote, QCserver, QCdatagram, QCnowait, QCnoquery,QCstop)
(QCcoding, QCoptions, QCfilter, QCsentinel, QClog, QCfeature):
New variables.
(NETCONN1_P): New macro.
(DATAGRAM_SOCKETS): New conditional symbol.
(datagram_address): New array.
(DATAGRAM_CONN_P, DATAGRAM_CHAN_P): New macros.
(status_message): Use concat3.
(Fprocess_status): Add `listen' status to doc string. Return `stop'
for a stopped network process.
(Fset_process_buffer): Update contact plist for network process.
(Fset_process_filter): Ditto. Don't enable input for stopped
network processes. Server must listen, even if filter is t.
(Fset_process_query_on_exit_flag, Fprocess_query_on_exit_flag):
New functions.
(Fprocess_kill_without_query): Removed. Now defined in simple.el.
(Fprocess_contact): Added KEY argument. Handle datagrams.
(list_processes_1): Optionally show only processes with the query
on exit flag set. Dynamically adjust column widths. Omit tty
column if not needed. Report stopped network processes.
Identify server and datagram network processes.
(Flist_processes): New optional arg `query-only'.
(conv_sockaddr_to_lisp, get_lisp_to_sockaddr_size)
(conv_lisp_to_sockaddr, set_socket_options)
(network_process_featurep, unwind_request_sigio): New helper functions.
(Fprocess_datagram_address, Fset_process_datagram_address):
(Fset_network_process_options): New lisp functions.
(Fopen_network_stream): Removed. Now defined in simple.el.
(Fmake_network_process): New lisp function. Code is based on previous
Fopen_network_stream, but heavily reworked with new property list based
argument list, support for datagrams, server processes, and local
sockets in addition to old client-only functionality.
(server_accept_connection): New function.
(wait_reading_process_input): Use it to handle incoming connects.
Do not enable input on a new connection if process is stopped.
(read_process_output): Handle datagram sockets. Use 2k buffer for them.
(send_process): Handle datagram sockets.
(Fstop_process, Fcontinue_process): Apply to network processes. A stopped
network process is indicated by setting command field to t .
(Fprocess_send_eof): No-op if datagram connection.
(Fstatus_notify): Don't read input for a stream server socket or a
stopped network process.
(init_process): Initialize datagram_address array.
(syms_of_process): Intern and staticpro new variables, defsubr new
functions.
2002-03-17 20:20:33 +00:00
|
|
|
|
chars = (char *) alloca (carryover + readmax);
|
1998-01-22 01:26:45 +00:00
|
|
|
|
if (carryover)
|
|
|
|
|
/* See the comment above. */
|
Replace bcopy, bzero, bcmp by memcpy, memmove, memset, memcmp
* alloc.c (overrun_check_malloc, overrun_check_realloc)
(overrun_check_free, xstrdup, allocate_string)
(allocate_string_data, compact_small_strings, Fmake_string)
(make_unibyte_string, make_multibyte_string)
(make_string_from_bytes, make_specified_string, make_float)
(Fcons, allocate_terminal, allocate_frame, make_pure_string)
(Fgarbage_collect): Replace bcopy, safe_bcopy, bzero, bcmp by
memcpy, memmove, memset, memcmp.
* atimer.c (start_atimer, set_alarm): Likewise.
* buffer.c (clone_per_buffer_values, report_overlay_modification)
(mmap_realloc, init_buffer_once): Likewise.
* callint.c (Fcall_interactively): Likewise.
* callproc.c (Fcall_process, Fcall_process_region, child_setup)
(getenv_internal_1): Likewise.
* casefiddle.c (casify_object): Likewise.
* ccl.c (ccl_driver): Likewise.
* character.c (str_as_multibyte, str_to_multibyte): Likewise.
* charset.c (load_charset_map_from_file)
(load_charset_map_from_file, load_charset_map_from_vector)
(Fdefine_charset_internal): Likewise.
* cm.c (Wcm_clear): Likewise.
* coding.c (decode_eol, decode_coding_object)
(Fset_coding_system_priority, make_subsidiaries): Likewise.
* data.c (Faset): Likewise.
* dired.c (directory_files_internal, file_name_completion_stat):
Likewise.
* dispnew.c (new_glyph_matrix, adjust_glyph_matrix)
(clear_glyph_row, copy_row_except_pointers)
(copy_glyph_row_contents, new_glyph_pool, realloc_glyph_pool)
(save_current_matrix, restore_current_matrix)
(build_frame_matrix_from_leaf_window, mirrored_line_dance)
(mirror_line_dance, scrolling_window): Likewise.
* doc.c (Fsnarf_documentation, Fsubstitute_command_keys):
Likewise.
* doprnt.c (doprnt): Likewise.
* editfns.c (Fuser_full_name, make_buffer_string_both)
(Fmessage_box, Fformat, Ftranspose_regions): Likewise.
* emacs.c (sort_args): Likewise.
* eval.c (Fapply, Ffuncall): Likewise.
* fileio.c (Ffile_name_directory, make_temp_name)
(Fexpand_file_name, search_embedded_absfilename)
(Fsubstitute_in_file_name, Ffile_symlink_p, Finsert_file_contents)
(auto_save_error): Likewise.
* fns.c (Fstring_equal, Fcopy_sequence, concat)
(string_to_multibyte, Fstring_as_unibyte, Fstring_as_multibyte)
(internal_equal, Fclear_string, larger_vector, copy_hash_table)
(Fmake_hash_table): Likewise.
* fringe.c (Fdefine_fringe_bitmap): Likewise.
* ftfont.c (ftfont_text_extents): Likewise.
* getloadavg.c (getloadavg): Likewise.
* image.c (define_image_type, make_image, make_image_cache)
(x_create_x_image_and_pixmap, xbm_image_p)
(w32_create_pixmap_from_bitmap_data, xbm_load, xpm_lookup_color)
(xpm_image_p, x_create_bitmap_from_xpm_data, xpm_load)
(init_color_table, x_build_heuristic_mask, pbm_image_p, pbm_load)
(png_image_p, png_read_from_memory, png_load, jpeg_image_p)
(tiff_image_p, tiff_read_from_memory, gif_image_p)
(gif_read_from_memory, gif_load, svg_image_p, gs_image_p):
Likewise.
* indent.c (scan_for_column, compute_motion): Likewise.
* insdel.c (gap_left, gap_right, make_gap_smaller, copy_text)
(insert_1_both, insert_from_gap, replace_range_2): Likewise.
* intervals.c (reproduce_tree, reproduce_tree_obj): Likewise.
* keyboard.c (echo_char, save_getcjmp, restore_getcjmp)
(kbd_buffer_store_event_hold, apply_modifiers_uncached)
(store_user_signal_events, menu_bar_items, tool_bar_items)
(process_tool_bar_item, append_tool_bar_item)
(read_char_minibuf_menu_prompt, read_key_sequence)
(Fread_key_sequence, Fread_key_sequence_vector, Frecent_keys):
Likewise.
* keymap.c (current_minor_maps, Fdescribe_buffer_bindings):
Likewise.
* lisp.h (STRING_COPYIN): Likewise.
* lread.c (Fload, read1, oblookup): Likewise.
* msdos.c (Frecent_doskeys): Likewise.
* nsfns.m (Fx_create_frame): Likewise.
* nsfont.m (nsfont_open, nsfont_text_extents, ns_glyph_metrics):
Likewise.
* nsimage.m (EmacsImage-initFromSkipXBM:width:height:)
(EmacsImage-initForXPMWithDepth:width:height:flip:length:):
Likewise.
* nsmenu.m (ns_update_menubar): Likewise.
* nsterm.m (ns_draw_fringe_bitmap, ns_term_init): Likewise.
* print.c (print_unwind, printchar, strout, print_string)
(print_error_message): Likewise.
* process.c (conv_lisp_to_sockaddr, set_socket_option)
(Fmake_network_process, Fnetwork_interface_list)
(Fnetwork_interface_info, read_process_output, Fprocess_send_eof)
(init_process): Likewise.
* ralloc.c (resize_bloc, r_alloc_sbrk, r_alloc_init): Likewise.
* regex.c (init_syntax_once, regex_compile, re_compile_fastmap):
Likewise.
* scroll.c (do_scrolling, do_direct_scrolling)
(scrolling_max_lines_saved): Likewise.
* search.c (search_buffer, wordify, Freplace_match): Likewise.
* sound.c (wav_init, au_init, Fplay_sound_internal): Likewise.
* syntax.c (skip_chars, skip_syntaxes): Likewise.
* sysdep.c (child_setup_tty, sys_subshell, emacs_get_tty)
(emacs_set_tty): Likewise.
* term.c (encode_terminal_code, calculate_costs)
(produce_special_glyphs, create_tty_output, init_tty, delete_tty):
Likewise.
* termcap.c (tgetst1, gobble_line): Likewise.
* termhooks.h (EVENT_INIT): Likewise.
* tparam.c (tparam1): Likewise.
* unexalpha.c (unexec): Likewise.
* unexec.c (write_segment): Likewise.
* unexmacosx.c (unexec_write_zero): Likewise.
* w32fns.c (w32_wnd_proc, Fx_create_frame, x_create_tip_frame)
(Fx_file_dialog, Fsystem_move_file_to_trash): Likewise.
* w32font.c (w32font_list_family, w32font_text_extents)
(w32font_list_internal, w32font_match_internal)
(w32font_open_internal, compute_metrics, Fx_select_font):
Likewise.
* w32menu.c (set_frame_menubar, add_menu_item)
(w32_menu_display_help, w32_free_submenu_strings): Likewise.
* w32term.c (XCreateGC, w32_initialize_display_info): Likewise.
* w32uniscribe.c (uniscribe_list_family): Likewise.
* w32xfns.c (get_next_msg, post_msg, prepend_msg): Likewise.
* window.c (make_window, replace_window, set_window_buffer)
(Fsplit_window): Likewise.
* xdisp.c (init_iterator, RECORD_OVERLAY_STRING, reseat_to_string)
(add_to_log, message3, x_consider_frame_title)
(append_space_for_newline, extend_face_to_end_of_line)
(decode_mode_spec_coding, init_glyph_string): Likewise.
* xfaces.c (x_create_gc, get_lface_attributes_no_remap)
(Finternal_copy_lisp_face, Finternal_merge_in_global_face)
(face_attr_equal_p, make_realized_face, make_face_cache)
(free_realized_faces, lookup_named_face, smaller_face)
(face_with_height, lookup_derived_face)
(x_supports_face_attributes_p, Finternal_set_font_selection_order)
(Finternal_set_font_selection_order, realize_default_face)
(compute_char_face, face_at_buffer_position)
(face_for_overlay_string, face_at_string_position, merge_faces):
Likewise.
* xfns.c (xic_create_fontsetname, Fx_create_frame)
(Fx_window_property, x_create_tip_frame)
(Fx_backspace_delete_keys_p): Likewise.
* xfont.c (xfont_list, xfont_match, xfont_list_family)
(xfont_text_extents): Likewise.
* xmenu.c (set_frame_menubar, xmenu_show): Likewise.
* xrdb.c (magic_file_p, x_get_resource): Likewise.
* xselect.c (x_queue_event, x_get_window_property)
(receive_incremental_selection): Likewise.
* xsmfns.c (x_session_check_input): Likewise.
* xterm.c (x_send_scroll_bar_event, SET_SAVED_MENU_EVENT)
(handle_one_xevent, x_check_errors, xim_initialize, x_term_init):
Likewise.
* character.h (BCOPY_SHORT): Removed.
* config.in: Regenerate.
* dispnew.c (safe_bcopy): Only define as dummy if PROFILING.
* emacs.c (main) [PROFILING]: Don't declare
dump_opcode_frequencies.
* lisp.h (safe_bcopy): Remove declaration.
(memset) [!HAVE_MEMSET]: Declare.
(memcpy) [!HAVE_MEMCPY]: Likewise.
(memmove) [!HAVE_MEMMOVE]: Likewise.
(memcmp) [!HAVE_MEMCMP]: Likewise.
* s/ms-w32.h (bzero, bcopy, bcmp, GAP_USE_BCOPY)
(BCOPY_UPWARD_SAFE, BCOPY_DOWNWARD_SAFE, HAVE_BCOPY, HAVE_BCMP):
Don't define.
(HAVE_MEMCMP, HAVE_MEMCPY, HAVE_MEMMOVE, HAVE_MEMSET): Define.
* s/msdos.h (GAP_USE_BCOPY, BCOPY_UPWARD_SAFE)
(BCOPY_DOWNWARD_SAFE): Don't define.
* sysdep.c (memset) [!HAVE_MEMSET]: Define.
(memcpy) [!HAVE_MEMCPY]: Define.
(memmove) [!HAVE_MEMMOVE]: Define.
(memcmp) [!HAVE_MEMCMP]: Define.
* config.nt (HAVE_BCOPY, HAVE_BCMP): Remove undefs.
(HAVE_MEMCPY, HAVE_MEMMOVE, HAVE_MEMSET, HAVE_MEMCMP): Add undefs.
* sed2v2.inp (HAVE_MEMCPY, HAVE_MEMSET): Edit to 1.
(HAVE_BZERO): Don't edit.
* lwlib.c (lwlib_memset, lwlib_bcopy): Remove.
(malloc_widget_value, free_widget_info, allocate_widget_instance)
(lw_separator_p): Replace lwlib_memset, lwlib_bcopy, bzero, bcmp by
memset, memcpy, memcmp.
* lwlib-utils.c (XtApplyToWidgets): Likewise.
* xlwmenu.c (XlwMenuInitialize): Likewise.
* lwlib.h (lwlib_bcopy): Remove declaration.
* ebrowse.c (add_sym, make_namespace): Replace bcopy, bzero by
memcpy, memmove, memset.
* pop.c (pop_retrieve, socket_connection, pop_getline): Likewise.
* CPP-DEFINES (BCOPY_DOWNWARD_SAFE, BCOPY_UPWARD_SAFE)
(GAP_USE_BCOPY, HAVE_BCMP, HAVE_BCOPY, bcmp, bcopy, bzero):
Remove.
* configure.in: Don't check for bcopy, bcmp, bzero. Don't include
<strings.h> and don't define bcopy, bzero, BCMP in config.h.
2010-07-08 00:18:28 +02:00
|
|
|
|
memcpy (chars, SDATA (p->decoding_buf), carryover);
|
1997-02-20 06:53:55 +00:00
|
|
|
|
|
(Qlocal, QCname, QCbuffer, QChost, QCservice, QCfamily)
(QClocal, QCremote, QCserver, QCdatagram, QCnowait, QCnoquery,QCstop)
(QCcoding, QCoptions, QCfilter, QCsentinel, QClog, QCfeature):
New variables.
(NETCONN1_P): New macro.
(DATAGRAM_SOCKETS): New conditional symbol.
(datagram_address): New array.
(DATAGRAM_CONN_P, DATAGRAM_CHAN_P): New macros.
(status_message): Use concat3.
(Fprocess_status): Add `listen' status to doc string. Return `stop'
for a stopped network process.
(Fset_process_buffer): Update contact plist for network process.
(Fset_process_filter): Ditto. Don't enable input for stopped
network processes. Server must listen, even if filter is t.
(Fset_process_query_on_exit_flag, Fprocess_query_on_exit_flag):
New functions.
(Fprocess_kill_without_query): Removed. Now defined in simple.el.
(Fprocess_contact): Added KEY argument. Handle datagrams.
(list_processes_1): Optionally show only processes with the query
on exit flag set. Dynamically adjust column widths. Omit tty
column if not needed. Report stopped network processes.
Identify server and datagram network processes.
(Flist_processes): New optional arg `query-only'.
(conv_sockaddr_to_lisp, get_lisp_to_sockaddr_size)
(conv_lisp_to_sockaddr, set_socket_options)
(network_process_featurep, unwind_request_sigio): New helper functions.
(Fprocess_datagram_address, Fset_process_datagram_address):
(Fset_network_process_options): New lisp functions.
(Fopen_network_stream): Removed. Now defined in simple.el.
(Fmake_network_process): New lisp function. Code is based on previous
Fopen_network_stream, but heavily reworked with new property list based
argument list, support for datagrams, server processes, and local
sockets in addition to old client-only functionality.
(server_accept_connection): New function.
(wait_reading_process_input): Use it to handle incoming connects.
Do not enable input on a new connection if process is stopped.
(read_process_output): Handle datagram sockets. Use 2k buffer for them.
(send_process): Handle datagram sockets.
(Fstop_process, Fcontinue_process): Apply to network processes. A stopped
network process is indicated by setting command field to t .
(Fprocess_send_eof): No-op if datagram connection.
(Fstatus_notify): Don't read input for a stream server socket or a
stopped network process.
(init_process): Initialize datagram_address array.
(syms_of_process): Intern and staticpro new variables, defsubr new
functions.
2002-03-17 20:20:33 +00:00
|
|
|
|
#ifdef DATAGRAM_SOCKETS
|
|
|
|
|
/* We have a working select, so proc_buffered_char is always -1. */
|
|
|
|
|
if (DATAGRAM_CHAN_P (channel))
|
|
|
|
|
{
|
|
|
|
|
int len = datagram_address[channel].len;
|
2004-08-01 23:10:06 +00:00
|
|
|
|
nbytes = recvfrom (channel, chars + carryover, readmax,
|
(Qlocal, QCname, QCbuffer, QChost, QCservice, QCfamily)
(QClocal, QCremote, QCserver, QCdatagram, QCnowait, QCnoquery,QCstop)
(QCcoding, QCoptions, QCfilter, QCsentinel, QClog, QCfeature):
New variables.
(NETCONN1_P): New macro.
(DATAGRAM_SOCKETS): New conditional symbol.
(datagram_address): New array.
(DATAGRAM_CONN_P, DATAGRAM_CHAN_P): New macros.
(status_message): Use concat3.
(Fprocess_status): Add `listen' status to doc string. Return `stop'
for a stopped network process.
(Fset_process_buffer): Update contact plist for network process.
(Fset_process_filter): Ditto. Don't enable input for stopped
network processes. Server must listen, even if filter is t.
(Fset_process_query_on_exit_flag, Fprocess_query_on_exit_flag):
New functions.
(Fprocess_kill_without_query): Removed. Now defined in simple.el.
(Fprocess_contact): Added KEY argument. Handle datagrams.
(list_processes_1): Optionally show only processes with the query
on exit flag set. Dynamically adjust column widths. Omit tty
column if not needed. Report stopped network processes.
Identify server and datagram network processes.
(Flist_processes): New optional arg `query-only'.
(conv_sockaddr_to_lisp, get_lisp_to_sockaddr_size)
(conv_lisp_to_sockaddr, set_socket_options)
(network_process_featurep, unwind_request_sigio): New helper functions.
(Fprocess_datagram_address, Fset_process_datagram_address):
(Fset_network_process_options): New lisp functions.
(Fopen_network_stream): Removed. Now defined in simple.el.
(Fmake_network_process): New lisp function. Code is based on previous
Fopen_network_stream, but heavily reworked with new property list based
argument list, support for datagrams, server processes, and local
sockets in addition to old client-only functionality.
(server_accept_connection): New function.
(wait_reading_process_input): Use it to handle incoming connects.
Do not enable input on a new connection if process is stopped.
(read_process_output): Handle datagram sockets. Use 2k buffer for them.
(send_process): Handle datagram sockets.
(Fstop_process, Fcontinue_process): Apply to network processes. A stopped
network process is indicated by setting command field to t .
(Fprocess_send_eof): No-op if datagram connection.
(Fstatus_notify): Don't read input for a stream server socket or a
stopped network process.
(init_process): Initialize datagram_address array.
(syms_of_process): Intern and staticpro new variables, defsubr new
functions.
2002-03-17 20:20:33 +00:00
|
|
|
|
0, datagram_address[channel].sa, &len);
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
#endif
|
1992-03-14 20:40:04 +00:00
|
|
|
|
if (proc_buffered_char[channel] < 0)
|
2004-04-16 12:51:06 +00:00
|
|
|
|
{
|
2004-08-01 23:10:06 +00:00
|
|
|
|
nbytes = emacs_read (channel, chars + carryover, readmax);
|
2004-04-16 12:51:06 +00:00
|
|
|
|
#ifdef ADAPTIVE_READ_BUFFERING
|
(struct Lisp_Process): Turn slots infd, outfd, kill_without_query, pty_flag,
tick, update_tick, decoding_carryover, inherit_coding_system_flag,
filter_multibyte, adaptive_read_buffering, read_output_delay, and
read_output_skip from Lisp_Objects to ints. Remove unused
encoding_carryover.
2007-07-12 06:36:57 +00:00
|
|
|
|
if (nbytes > 0 && p->adaptive_read_buffering)
|
2004-04-16 12:51:06 +00:00
|
|
|
|
{
|
(struct Lisp_Process): Turn slots infd, outfd, kill_without_query, pty_flag,
tick, update_tick, decoding_carryover, inherit_coding_system_flag,
filter_multibyte, adaptive_read_buffering, read_output_delay, and
read_output_skip from Lisp_Objects to ints. Remove unused
encoding_carryover.
2007-07-12 06:36:57 +00:00
|
|
|
|
int delay = p->read_output_delay;
|
2004-04-16 12:51:06 +00:00
|
|
|
|
if (nbytes < 256)
|
|
|
|
|
{
|
|
|
|
|
if (delay < READ_OUTPUT_DELAY_MAX_MAX)
|
|
|
|
|
{
|
|
|
|
|
if (delay == 0)
|
|
|
|
|
process_output_delay_count++;
|
|
|
|
|
delay += READ_OUTPUT_DELAY_INCREMENT * 2;
|
|
|
|
|
}
|
|
|
|
|
}
|
2004-08-01 23:10:06 +00:00
|
|
|
|
else if (delay > 0 && (nbytes == readmax))
|
2004-04-16 12:51:06 +00:00
|
|
|
|
{
|
|
|
|
|
delay -= READ_OUTPUT_DELAY_INCREMENT;
|
|
|
|
|
if (delay == 0)
|
|
|
|
|
process_output_delay_count--;
|
|
|
|
|
}
|
(struct Lisp_Process): Turn slots infd, outfd, kill_without_query, pty_flag,
tick, update_tick, decoding_carryover, inherit_coding_system_flag,
filter_multibyte, adaptive_read_buffering, read_output_delay, and
read_output_skip from Lisp_Objects to ints. Remove unused
encoding_carryover.
2007-07-12 06:36:57 +00:00
|
|
|
|
p->read_output_delay = delay;
|
2004-04-16 12:51:06 +00:00
|
|
|
|
if (delay)
|
|
|
|
|
{
|
(struct Lisp_Process): Turn slots infd, outfd, kill_without_query, pty_flag,
tick, update_tick, decoding_carryover, inherit_coding_system_flag,
filter_multibyte, adaptive_read_buffering, read_output_delay, and
read_output_skip from Lisp_Objects to ints. Remove unused
encoding_carryover.
2007-07-12 06:36:57 +00:00
|
|
|
|
p->read_output_skip = 1;
|
2004-04-16 12:51:06 +00:00
|
|
|
|
process_output_skip = 1;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
#endif
|
|
|
|
|
}
|
1992-03-14 20:40:04 +00:00
|
|
|
|
else
|
|
|
|
|
{
|
2000-08-04 02:26:32 +00:00
|
|
|
|
chars[carryover] = proc_buffered_char[channel];
|
1992-03-14 20:40:04 +00:00
|
|
|
|
proc_buffered_char[channel] = -1;
|
2004-08-01 23:10:06 +00:00
|
|
|
|
nbytes = emacs_read (channel, chars + carryover + 1, readmax - 1);
|
1998-01-05 17:33:41 +00:00
|
|
|
|
if (nbytes < 0)
|
|
|
|
|
nbytes = 1;
|
1992-03-14 20:40:04 +00:00
|
|
|
|
else
|
1998-01-05 17:33:41 +00:00
|
|
|
|
nbytes = nbytes + 1;
|
1992-03-14 20:40:04 +00:00
|
|
|
|
}
|
|
|
|
|
|
(struct Lisp_Process): Turn slots infd, outfd, kill_without_query, pty_flag,
tick, update_tick, decoding_carryover, inherit_coding_system_flag,
filter_multibyte, adaptive_read_buffering, read_output_delay, and
read_output_skip from Lisp_Objects to ints. Remove unused
encoding_carryover.
2007-07-12 06:36:57 +00:00
|
|
|
|
p->decoding_carryover = 0;
|
1998-06-20 03:01:00 +00:00
|
|
|
|
|
2000-08-04 02:26:32 +00:00
|
|
|
|
/* At this point, NBYTES holds number of bytes just received
|
1997-02-20 06:53:55 +00:00
|
|
|
|
(including the one in proc_buffered_char[channel]). */
|
1998-12-15 04:35:38 +00:00
|
|
|
|
if (nbytes <= 0)
|
|
|
|
|
{
|
|
|
|
|
if (nbytes < 0 || coding->mode & CODING_MODE_LAST_BLOCK)
|
|
|
|
|
return nbytes;
|
|
|
|
|
coding->mode |= CODING_MODE_LAST_BLOCK;
|
|
|
|
|
}
|
1992-03-14 20:40:04 +00:00
|
|
|
|
|
1998-01-05 17:33:41 +00:00
|
|
|
|
/* Now set NBYTES how many bytes we must decode. */
|
1998-01-22 01:26:45 +00:00
|
|
|
|
nbytes += carryover;
|
1997-02-20 06:53:55 +00:00
|
|
|
|
|
2010-04-11 11:53:13 -04:00
|
|
|
|
odeactivate = Vdeactivate_mark;
|
|
|
|
|
/* There's no good reason to let process filters change the current
|
|
|
|
|
buffer, and many callers of accept-process-output, sit-for, and
|
|
|
|
|
friends don't expect current-buffer to be changed from under them. */
|
2010-04-29 10:29:09 -04:00
|
|
|
|
record_unwind_protect (set_buffer_if_live, Fcurrent_buffer ());
|
2010-04-11 11:53:13 -04:00
|
|
|
|
|
1998-01-05 17:33:41 +00:00
|
|
|
|
/* Read and dispose of the process output. */
|
1992-03-14 20:40:04 +00:00
|
|
|
|
outstream = p->filter;
|
|
|
|
|
if (!NILP (outstream))
|
|
|
|
|
{
|
1995-03-03 10:31:49 +00:00
|
|
|
|
Lisp_Object obuffer, okeymap;
|
1998-01-05 17:33:41 +00:00
|
|
|
|
Lisp_Object text;
|
1996-12-08 21:36:42 +00:00
|
|
|
|
int outer_running_asynch_code = running_asynch_code;
|
1998-10-14 14:36:33 +00:00
|
|
|
|
int waiting = waiting_for_user_input_p;
|
1993-06-06 03:15:59 +00:00
|
|
|
|
|
1995-03-03 10:31:49 +00:00
|
|
|
|
/* No need to gcpro these, because all we do with them later
|
|
|
|
|
is test them for EQness, and none of them should be a string. */
|
|
|
|
|
XSETBUFFER (obuffer, current_buffer);
|
|
|
|
|
okeymap = current_buffer->keymap;
|
1993-06-06 03:15:59 +00:00
|
|
|
|
|
2010-04-11 11:53:13 -04:00
|
|
|
|
/* We inhibit quit here instead of just catching it so that
|
|
|
|
|
hitting ^G when a filter happens to be running won't screw
|
|
|
|
|
it up. */
|
1992-03-14 20:40:04 +00:00
|
|
|
|
specbind (Qinhibit_quit, Qt);
|
1994-07-13 03:52:05 +00:00
|
|
|
|
specbind (Qlast_nonmenu_event, Qt);
|
1994-09-23 22:28:08 +00:00
|
|
|
|
|
1996-12-08 21:36:42 +00:00
|
|
|
|
/* In case we get recursively called,
|
|
|
|
|
and we already saved the match data nonrecursively,
|
|
|
|
|
save the same match data in safely recursive fashion. */
|
|
|
|
|
if (outer_running_asynch_code)
|
|
|
|
|
{
|
|
|
|
|
Lisp_Object tem;
|
|
|
|
|
/* Don't clobber the CURRENT match data, either! */
|
2005-06-08 22:33:36 +00:00
|
|
|
|
tem = Fmatch_data (Qnil, Qnil, Qnil);
|
|
|
|
|
restore_search_regs ();
|
|
|
|
|
record_unwind_save_match_data ();
|
|
|
|
|
Fset_match_data (tem, Qt);
|
1996-12-08 21:36:42 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* For speed, if a search happens within this code,
|
|
|
|
|
save the match data in a special nonrecursive fashion. */
|
1994-11-21 12:50:27 +00:00
|
|
|
|
running_asynch_code = 1;
|
1996-12-08 21:36:42 +00:00
|
|
|
|
|
2002-03-01 01:45:23 +00:00
|
|
|
|
decode_coding_c_string (coding, chars, nbytes, Qt);
|
|
|
|
|
text = coding->dst_object;
|
|
|
|
|
Vlast_coding_system_used = CODING_ID_NAME (coding->id);
|
2000-08-04 02:26:32 +00:00
|
|
|
|
/* A new coding system might be found. */
|
2002-03-01 01:45:23 +00:00
|
|
|
|
if (!EQ (p->decode_coding_system, Vlast_coding_system_used))
|
2000-08-04 02:26:32 +00:00
|
|
|
|
{
|
2002-03-01 01:45:23 +00:00
|
|
|
|
p->decode_coding_system = Vlast_coding_system_used;
|
2000-08-04 02:26:32 +00:00
|
|
|
|
|
|
|
|
|
/* Don't call setup_coding_system for
|
|
|
|
|
proc_decode_coding_system[channel] here. It is done in
|
|
|
|
|
detect_coding called via decode_coding above. */
|
|
|
|
|
|
|
|
|
|
/* If a coding system for encoding is not yet decided, we set
|
|
|
|
|
it as the same as coding-system for decoding.
|
|
|
|
|
|
|
|
|
|
But, before doing that we must check if
|
|
|
|
|
proc_encode_coding_system[p->outfd] surely points to a
|
|
|
|
|
valid memory because p->outfd will be changed once EOF is
|
|
|
|
|
sent to the process. */
|
|
|
|
|
if (NILP (p->encode_coding_system)
|
(struct Lisp_Process): Turn slots infd, outfd, kill_without_query, pty_flag,
tick, update_tick, decoding_carryover, inherit_coding_system_flag,
filter_multibyte, adaptive_read_buffering, read_output_delay, and
read_output_skip from Lisp_Objects to ints. Remove unused
encoding_carryover.
2007-07-12 06:36:57 +00:00
|
|
|
|
&& proc_encode_coding_system[p->outfd])
|
2000-08-04 02:26:32 +00:00
|
|
|
|
{
|
2006-05-15 02:47:05 +00:00
|
|
|
|
p->encode_coding_system
|
|
|
|
|
= coding_inherit_eol_type (Vlast_coding_system_used, Qnil);
|
2002-03-01 01:45:23 +00:00
|
|
|
|
setup_coding_system (p->encode_coding_system,
|
(struct Lisp_Process): Turn slots infd, outfd, kill_without_query, pty_flag,
tick, update_tick, decoding_carryover, inherit_coding_system_flag,
filter_multibyte, adaptive_read_buffering, read_output_delay, and
read_output_skip from Lisp_Objects to ints. Remove unused
encoding_carryover.
2007-07-12 06:36:57 +00:00
|
|
|
|
proc_encode_coding_system[p->outfd]);
|
2000-08-04 02:26:32 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
1998-12-22 06:06:48 +00:00
|
|
|
|
|
2003-06-05 07:17:10 +00:00
|
|
|
|
if (coding->carryover_bytes > 0)
|
|
|
|
|
{
|
2004-05-13 12:52:29 +00:00
|
|
|
|
if (SCHARS (p->decoding_buf) < coding->carryover_bytes)
|
|
|
|
|
p->decoding_buf = make_uninit_string (coding->carryover_bytes);
|
Replace bcopy, bzero, bcmp by memcpy, memmove, memset, memcmp
* alloc.c (overrun_check_malloc, overrun_check_realloc)
(overrun_check_free, xstrdup, allocate_string)
(allocate_string_data, compact_small_strings, Fmake_string)
(make_unibyte_string, make_multibyte_string)
(make_string_from_bytes, make_specified_string, make_float)
(Fcons, allocate_terminal, allocate_frame, make_pure_string)
(Fgarbage_collect): Replace bcopy, safe_bcopy, bzero, bcmp by
memcpy, memmove, memset, memcmp.
* atimer.c (start_atimer, set_alarm): Likewise.
* buffer.c (clone_per_buffer_values, report_overlay_modification)
(mmap_realloc, init_buffer_once): Likewise.
* callint.c (Fcall_interactively): Likewise.
* callproc.c (Fcall_process, Fcall_process_region, child_setup)
(getenv_internal_1): Likewise.
* casefiddle.c (casify_object): Likewise.
* ccl.c (ccl_driver): Likewise.
* character.c (str_as_multibyte, str_to_multibyte): Likewise.
* charset.c (load_charset_map_from_file)
(load_charset_map_from_file, load_charset_map_from_vector)
(Fdefine_charset_internal): Likewise.
* cm.c (Wcm_clear): Likewise.
* coding.c (decode_eol, decode_coding_object)
(Fset_coding_system_priority, make_subsidiaries): Likewise.
* data.c (Faset): Likewise.
* dired.c (directory_files_internal, file_name_completion_stat):
Likewise.
* dispnew.c (new_glyph_matrix, adjust_glyph_matrix)
(clear_glyph_row, copy_row_except_pointers)
(copy_glyph_row_contents, new_glyph_pool, realloc_glyph_pool)
(save_current_matrix, restore_current_matrix)
(build_frame_matrix_from_leaf_window, mirrored_line_dance)
(mirror_line_dance, scrolling_window): Likewise.
* doc.c (Fsnarf_documentation, Fsubstitute_command_keys):
Likewise.
* doprnt.c (doprnt): Likewise.
* editfns.c (Fuser_full_name, make_buffer_string_both)
(Fmessage_box, Fformat, Ftranspose_regions): Likewise.
* emacs.c (sort_args): Likewise.
* eval.c (Fapply, Ffuncall): Likewise.
* fileio.c (Ffile_name_directory, make_temp_name)
(Fexpand_file_name, search_embedded_absfilename)
(Fsubstitute_in_file_name, Ffile_symlink_p, Finsert_file_contents)
(auto_save_error): Likewise.
* fns.c (Fstring_equal, Fcopy_sequence, concat)
(string_to_multibyte, Fstring_as_unibyte, Fstring_as_multibyte)
(internal_equal, Fclear_string, larger_vector, copy_hash_table)
(Fmake_hash_table): Likewise.
* fringe.c (Fdefine_fringe_bitmap): Likewise.
* ftfont.c (ftfont_text_extents): Likewise.
* getloadavg.c (getloadavg): Likewise.
* image.c (define_image_type, make_image, make_image_cache)
(x_create_x_image_and_pixmap, xbm_image_p)
(w32_create_pixmap_from_bitmap_data, xbm_load, xpm_lookup_color)
(xpm_image_p, x_create_bitmap_from_xpm_data, xpm_load)
(init_color_table, x_build_heuristic_mask, pbm_image_p, pbm_load)
(png_image_p, png_read_from_memory, png_load, jpeg_image_p)
(tiff_image_p, tiff_read_from_memory, gif_image_p)
(gif_read_from_memory, gif_load, svg_image_p, gs_image_p):
Likewise.
* indent.c (scan_for_column, compute_motion): Likewise.
* insdel.c (gap_left, gap_right, make_gap_smaller, copy_text)
(insert_1_both, insert_from_gap, replace_range_2): Likewise.
* intervals.c (reproduce_tree, reproduce_tree_obj): Likewise.
* keyboard.c (echo_char, save_getcjmp, restore_getcjmp)
(kbd_buffer_store_event_hold, apply_modifiers_uncached)
(store_user_signal_events, menu_bar_items, tool_bar_items)
(process_tool_bar_item, append_tool_bar_item)
(read_char_minibuf_menu_prompt, read_key_sequence)
(Fread_key_sequence, Fread_key_sequence_vector, Frecent_keys):
Likewise.
* keymap.c (current_minor_maps, Fdescribe_buffer_bindings):
Likewise.
* lisp.h (STRING_COPYIN): Likewise.
* lread.c (Fload, read1, oblookup): Likewise.
* msdos.c (Frecent_doskeys): Likewise.
* nsfns.m (Fx_create_frame): Likewise.
* nsfont.m (nsfont_open, nsfont_text_extents, ns_glyph_metrics):
Likewise.
* nsimage.m (EmacsImage-initFromSkipXBM:width:height:)
(EmacsImage-initForXPMWithDepth:width:height:flip:length:):
Likewise.
* nsmenu.m (ns_update_menubar): Likewise.
* nsterm.m (ns_draw_fringe_bitmap, ns_term_init): Likewise.
* print.c (print_unwind, printchar, strout, print_string)
(print_error_message): Likewise.
* process.c (conv_lisp_to_sockaddr, set_socket_option)
(Fmake_network_process, Fnetwork_interface_list)
(Fnetwork_interface_info, read_process_output, Fprocess_send_eof)
(init_process): Likewise.
* ralloc.c (resize_bloc, r_alloc_sbrk, r_alloc_init): Likewise.
* regex.c (init_syntax_once, regex_compile, re_compile_fastmap):
Likewise.
* scroll.c (do_scrolling, do_direct_scrolling)
(scrolling_max_lines_saved): Likewise.
* search.c (search_buffer, wordify, Freplace_match): Likewise.
* sound.c (wav_init, au_init, Fplay_sound_internal): Likewise.
* syntax.c (skip_chars, skip_syntaxes): Likewise.
* sysdep.c (child_setup_tty, sys_subshell, emacs_get_tty)
(emacs_set_tty): Likewise.
* term.c (encode_terminal_code, calculate_costs)
(produce_special_glyphs, create_tty_output, init_tty, delete_tty):
Likewise.
* termcap.c (tgetst1, gobble_line): Likewise.
* termhooks.h (EVENT_INIT): Likewise.
* tparam.c (tparam1): Likewise.
* unexalpha.c (unexec): Likewise.
* unexec.c (write_segment): Likewise.
* unexmacosx.c (unexec_write_zero): Likewise.
* w32fns.c (w32_wnd_proc, Fx_create_frame, x_create_tip_frame)
(Fx_file_dialog, Fsystem_move_file_to_trash): Likewise.
* w32font.c (w32font_list_family, w32font_text_extents)
(w32font_list_internal, w32font_match_internal)
(w32font_open_internal, compute_metrics, Fx_select_font):
Likewise.
* w32menu.c (set_frame_menubar, add_menu_item)
(w32_menu_display_help, w32_free_submenu_strings): Likewise.
* w32term.c (XCreateGC, w32_initialize_display_info): Likewise.
* w32uniscribe.c (uniscribe_list_family): Likewise.
* w32xfns.c (get_next_msg, post_msg, prepend_msg): Likewise.
* window.c (make_window, replace_window, set_window_buffer)
(Fsplit_window): Likewise.
* xdisp.c (init_iterator, RECORD_OVERLAY_STRING, reseat_to_string)
(add_to_log, message3, x_consider_frame_title)
(append_space_for_newline, extend_face_to_end_of_line)
(decode_mode_spec_coding, init_glyph_string): Likewise.
* xfaces.c (x_create_gc, get_lface_attributes_no_remap)
(Finternal_copy_lisp_face, Finternal_merge_in_global_face)
(face_attr_equal_p, make_realized_face, make_face_cache)
(free_realized_faces, lookup_named_face, smaller_face)
(face_with_height, lookup_derived_face)
(x_supports_face_attributes_p, Finternal_set_font_selection_order)
(Finternal_set_font_selection_order, realize_default_face)
(compute_char_face, face_at_buffer_position)
(face_for_overlay_string, face_at_string_position, merge_faces):
Likewise.
* xfns.c (xic_create_fontsetname, Fx_create_frame)
(Fx_window_property, x_create_tip_frame)
(Fx_backspace_delete_keys_p): Likewise.
* xfont.c (xfont_list, xfont_match, xfont_list_family)
(xfont_text_extents): Likewise.
* xmenu.c (set_frame_menubar, xmenu_show): Likewise.
* xrdb.c (magic_file_p, x_get_resource): Likewise.
* xselect.c (x_queue_event, x_get_window_property)
(receive_incremental_selection): Likewise.
* xsmfns.c (x_session_check_input): Likewise.
* xterm.c (x_send_scroll_bar_event, SET_SAVED_MENU_EVENT)
(handle_one_xevent, x_check_errors, xim_initialize, x_term_init):
Likewise.
* character.h (BCOPY_SHORT): Removed.
* config.in: Regenerate.
* dispnew.c (safe_bcopy): Only define as dummy if PROFILING.
* emacs.c (main) [PROFILING]: Don't declare
dump_opcode_frequencies.
* lisp.h (safe_bcopy): Remove declaration.
(memset) [!HAVE_MEMSET]: Declare.
(memcpy) [!HAVE_MEMCPY]: Likewise.
(memmove) [!HAVE_MEMMOVE]: Likewise.
(memcmp) [!HAVE_MEMCMP]: Likewise.
* s/ms-w32.h (bzero, bcopy, bcmp, GAP_USE_BCOPY)
(BCOPY_UPWARD_SAFE, BCOPY_DOWNWARD_SAFE, HAVE_BCOPY, HAVE_BCMP):
Don't define.
(HAVE_MEMCMP, HAVE_MEMCPY, HAVE_MEMMOVE, HAVE_MEMSET): Define.
* s/msdos.h (GAP_USE_BCOPY, BCOPY_UPWARD_SAFE)
(BCOPY_DOWNWARD_SAFE): Don't define.
* sysdep.c (memset) [!HAVE_MEMSET]: Define.
(memcpy) [!HAVE_MEMCPY]: Define.
(memmove) [!HAVE_MEMMOVE]: Define.
(memcmp) [!HAVE_MEMCMP]: Define.
* config.nt (HAVE_BCOPY, HAVE_BCMP): Remove undefs.
(HAVE_MEMCPY, HAVE_MEMMOVE, HAVE_MEMSET, HAVE_MEMCMP): Add undefs.
* sed2v2.inp (HAVE_MEMCPY, HAVE_MEMSET): Edit to 1.
(HAVE_BZERO): Don't edit.
* lwlib.c (lwlib_memset, lwlib_bcopy): Remove.
(malloc_widget_value, free_widget_info, allocate_widget_instance)
(lw_separator_p): Replace lwlib_memset, lwlib_bcopy, bzero, bcmp by
memset, memcpy, memcmp.
* lwlib-utils.c (XtApplyToWidgets): Likewise.
* xlwmenu.c (XlwMenuInitialize): Likewise.
* lwlib.h (lwlib_bcopy): Remove declaration.
* ebrowse.c (add_sym, make_namespace): Replace bcopy, bzero by
memcpy, memmove, memset.
* pop.c (pop_retrieve, socket_connection, pop_getline): Likewise.
* CPP-DEFINES (BCOPY_DOWNWARD_SAFE, BCOPY_UPWARD_SAFE)
(GAP_USE_BCOPY, HAVE_BCMP, HAVE_BCOPY, bcmp, bcopy, bzero):
Remove.
* configure.in: Don't check for bcopy, bcmp, bzero. Don't include
<strings.h> and don't define bcopy, bzero, BCMP in config.h.
2010-07-08 00:18:28 +02:00
|
|
|
|
memcpy (SDATA (p->decoding_buf), coding->carryover,
|
|
|
|
|
coding->carryover_bytes);
|
2007-07-15 04:47:46 +00:00
|
|
|
|
p->decoding_carryover = coding->carryover_bytes;
|
2003-06-05 07:17:10 +00:00
|
|
|
|
}
|
2003-07-31 01:24:44 +00:00
|
|
|
|
if (SBYTES (text) > 0)
|
2000-12-18 00:39:59 +00:00
|
|
|
|
internal_condition_case_1 (read_process_output_call,
|
|
|
|
|
Fcons (outstream,
|
|
|
|
|
Fcons (proc, Fcons (text, Qnil))),
|
|
|
|
|
!NILP (Vdebug_on_error) ? Qnil : Qerror,
|
|
|
|
|
read_process_output_error_handler);
|
1996-12-08 21:36:42 +00:00
|
|
|
|
|
|
|
|
|
/* If we saved the match data nonrecursively, restore it now. */
|
2005-06-08 22:33:36 +00:00
|
|
|
|
restore_search_regs ();
|
1996-12-08 21:36:42 +00:00
|
|
|
|
running_asynch_code = outer_running_asynch_code;
|
1992-03-14 20:40:04 +00:00
|
|
|
|
|
1998-10-14 14:36:33 +00:00
|
|
|
|
/* Restore waiting_for_user_input_p as it was
|
|
|
|
|
when we were called, in case the filter clobbered it. */
|
|
|
|
|
waiting_for_user_input_p = waiting;
|
|
|
|
|
|
1995-08-08 21:22:16 +00:00
|
|
|
|
#if 0 /* Call record_asynch_buffer_change unconditionally,
|
|
|
|
|
because we might have changed minor modes or other things
|
|
|
|
|
that affect key bindings. */
|
1995-03-03 10:31:49 +00:00
|
|
|
|
if (! EQ (Fcurrent_buffer (), obuffer)
|
|
|
|
|
|| ! EQ (current_buffer->keymap, okeymap))
|
1995-08-08 21:22:16 +00:00
|
|
|
|
#endif
|
1995-10-09 00:31:24 +00:00
|
|
|
|
/* But do it only if the caller is actually going to read events.
|
|
|
|
|
Otherwise there's no need to make him wake up, and it could
|
2006-07-10 18:51:42 +00:00
|
|
|
|
cause trouble (for example it would make sit_for return). */
|
1995-10-09 00:31:24 +00:00
|
|
|
|
if (waiting_for_user_input_p == -1)
|
|
|
|
|
record_asynch_buffer_change ();
|
1992-03-14 20:40:04 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* If no filter, write into buffer if it isn't dead. */
|
2010-04-11 11:53:13 -04:00
|
|
|
|
else if (!NILP (p->buffer) && !NILP (XBUFFER (p->buffer)->name))
|
1992-03-14 20:40:04 +00:00
|
|
|
|
{
|
* systty.h, process.c, buffer.h, callproc.c, sysdep.c, dired.c:
Added VMS changes from Roland Roberts.
* process.c (read_process_output): Save, widen, insert the process
output, and then restore the restriction if inserting text outside
the visible region.
* process.c (Fstart_process): Establish an unwind-protect to
remove PROC from the process list if an error occurs while
starting it.
(start_process_unwind): New function to help with that.
(create_process): There's no need to explicitly call
remove_process if the fork fails; the record_unwind_protect in
Fstart_process will take care of it.
* process.c (wait_reading_process_input): Test the C preprocessor
symbol "ultrix", not "__ultrix__" to see if we should ignore
ENOMEM errors from select.
* process.c (process_send_signal): On systems which have both
the TIOCGETC and TCGETA ioctls, just use the former.
* s/bsd4-2.h, s/bsd4-3.h: #define SIGNALS_VIA_CHARACTERS.
* process.c (process_send_signal): Put all the code for sending
signals via characters in a #ifdef SIGNALS_VIA_CHARACTERS. Decide
whether to use the Berkeley-style or SYSV-style ioctls by seeing
which ioctl commands are #defined.
* process.c (process_send_signal): Doc fix.
1992-11-16 00:53:26 +00:00
|
|
|
|
Lisp_Object old_read_only;
|
1997-04-30 18:34:17 +00:00
|
|
|
|
int old_begv, old_zv;
|
1998-01-01 06:45:08 +00:00
|
|
|
|
int old_begv_byte, old_zv_byte;
|
|
|
|
|
int before, before_byte;
|
|
|
|
|
int opoint_byte;
|
2000-08-04 02:26:32 +00:00
|
|
|
|
Lisp_Object text;
|
2000-12-07 15:53:18 +00:00
|
|
|
|
struct buffer *b;
|
1993-06-06 03:15:59 +00:00
|
|
|
|
|
1992-03-14 20:40:04 +00:00
|
|
|
|
Fset_buffer (p->buffer);
|
1996-09-01 19:15:05 +00:00
|
|
|
|
opoint = PT;
|
1998-01-01 06:45:08 +00:00
|
|
|
|
opoint_byte = PT_BYTE;
|
* systty.h, process.c, buffer.h, callproc.c, sysdep.c, dired.c:
Added VMS changes from Roland Roberts.
* process.c (read_process_output): Save, widen, insert the process
output, and then restore the restriction if inserting text outside
the visible region.
* process.c (Fstart_process): Establish an unwind-protect to
remove PROC from the process list if an error occurs while
starting it.
(start_process_unwind): New function to help with that.
(create_process): There's no need to explicitly call
remove_process if the fork fails; the record_unwind_protect in
Fstart_process will take care of it.
* process.c (wait_reading_process_input): Test the C preprocessor
symbol "ultrix", not "__ultrix__" to see if we should ignore
ENOMEM errors from select.
* process.c (process_send_signal): On systems which have both
the TIOCGETC and TCGETA ioctls, just use the former.
* s/bsd4-2.h, s/bsd4-3.h: #define SIGNALS_VIA_CHARACTERS.
* process.c (process_send_signal): Put all the code for sending
signals via characters in a #ifdef SIGNALS_VIA_CHARACTERS. Decide
whether to use the Berkeley-style or SYSV-style ioctls by seeing
which ioctl commands are #defined.
* process.c (process_send_signal): Doc fix.
1992-11-16 00:53:26 +00:00
|
|
|
|
old_read_only = current_buffer->read_only;
|
1997-04-30 18:34:17 +00:00
|
|
|
|
old_begv = BEGV;
|
|
|
|
|
old_zv = ZV;
|
1998-01-01 06:45:08 +00:00
|
|
|
|
old_begv_byte = BEGV_BYTE;
|
|
|
|
|
old_zv_byte = ZV_BYTE;
|
* systty.h, process.c, buffer.h, callproc.c, sysdep.c, dired.c:
Added VMS changes from Roland Roberts.
* process.c (read_process_output): Save, widen, insert the process
output, and then restore the restriction if inserting text outside
the visible region.
* process.c (Fstart_process): Establish an unwind-protect to
remove PROC from the process list if an error occurs while
starting it.
(start_process_unwind): New function to help with that.
(create_process): There's no need to explicitly call
remove_process if the fork fails; the record_unwind_protect in
Fstart_process will take care of it.
* process.c (wait_reading_process_input): Test the C preprocessor
symbol "ultrix", not "__ultrix__" to see if we should ignore
ENOMEM errors from select.
* process.c (process_send_signal): On systems which have both
the TIOCGETC and TCGETA ioctls, just use the former.
* s/bsd4-2.h, s/bsd4-3.h: #define SIGNALS_VIA_CHARACTERS.
* process.c (process_send_signal): Put all the code for sending
signals via characters in a #ifdef SIGNALS_VIA_CHARACTERS. Decide
whether to use the Berkeley-style or SYSV-style ioctls by seeing
which ioctl commands are #defined.
* process.c (process_send_signal): Doc fix.
1992-11-16 00:53:26 +00:00
|
|
|
|
|
|
|
|
|
current_buffer->read_only = Qnil;
|
1992-03-14 20:40:04 +00:00
|
|
|
|
|
|
|
|
|
/* Insert new output into buffer
|
|
|
|
|
at the current end-of-output marker,
|
|
|
|
|
thus preserving logical ordering of input and output. */
|
|
|
|
|
if (XMARKER (p->mark)->buffer)
|
1998-01-01 06:45:08 +00:00
|
|
|
|
SET_PT_BOTH (clip_to_bounds (BEGV, marker_position (p->mark), ZV),
|
|
|
|
|
clip_to_bounds (BEGV_BYTE, marker_byte_position (p->mark),
|
|
|
|
|
ZV_BYTE));
|
1992-03-14 20:40:04 +00:00
|
|
|
|
else
|
1998-01-01 06:45:08 +00:00
|
|
|
|
SET_PT_BOTH (ZV, ZV_BYTE);
|
1997-04-30 18:34:17 +00:00
|
|
|
|
before = PT;
|
1998-01-01 06:45:08 +00:00
|
|
|
|
before_byte = PT_BYTE;
|
* systty.h, process.c, buffer.h, callproc.c, sysdep.c, dired.c:
Added VMS changes from Roland Roberts.
* process.c (read_process_output): Save, widen, insert the process
output, and then restore the restriction if inserting text outside
the visible region.
* process.c (Fstart_process): Establish an unwind-protect to
remove PROC from the process list if an error occurs while
starting it.
(start_process_unwind): New function to help with that.
(create_process): There's no need to explicitly call
remove_process if the fork fails; the record_unwind_protect in
Fstart_process will take care of it.
* process.c (wait_reading_process_input): Test the C preprocessor
symbol "ultrix", not "__ultrix__" to see if we should ignore
ENOMEM errors from select.
* process.c (process_send_signal): On systems which have both
the TIOCGETC and TCGETA ioctls, just use the former.
* s/bsd4-2.h, s/bsd4-3.h: #define SIGNALS_VIA_CHARACTERS.
* process.c (process_send_signal): Put all the code for sending
signals via characters in a #ifdef SIGNALS_VIA_CHARACTERS. Decide
whether to use the Berkeley-style or SYSV-style ioctls by seeing
which ioctl commands are #defined.
* process.c (process_send_signal): Doc fix.
1992-11-16 00:53:26 +00:00
|
|
|
|
|
|
|
|
|
/* If the output marker is outside of the visible region, save
|
|
|
|
|
the restriction and widen. */
|
1996-09-01 19:15:05 +00:00
|
|
|
|
if (! (BEGV <= PT && PT <= ZV))
|
* systty.h, process.c, buffer.h, callproc.c, sysdep.c, dired.c:
Added VMS changes from Roland Roberts.
* process.c (read_process_output): Save, widen, insert the process
output, and then restore the restriction if inserting text outside
the visible region.
* process.c (Fstart_process): Establish an unwind-protect to
remove PROC from the process list if an error occurs while
starting it.
(start_process_unwind): New function to help with that.
(create_process): There's no need to explicitly call
remove_process if the fork fails; the record_unwind_protect in
Fstart_process will take care of it.
* process.c (wait_reading_process_input): Test the C preprocessor
symbol "ultrix", not "__ultrix__" to see if we should ignore
ENOMEM errors from select.
* process.c (process_send_signal): On systems which have both
the TIOCGETC and TCGETA ioctls, just use the former.
* s/bsd4-2.h, s/bsd4-3.h: #define SIGNALS_VIA_CHARACTERS.
* process.c (process_send_signal): Put all the code for sending
signals via characters in a #ifdef SIGNALS_VIA_CHARACTERS. Decide
whether to use the Berkeley-style or SYSV-style ioctls by seeing
which ioctl commands are #defined.
* process.c (process_send_signal): Doc fix.
1992-11-16 00:53:26 +00:00
|
|
|
|
Fwiden ();
|
|
|
|
|
|
2002-03-01 01:45:23 +00:00
|
|
|
|
decode_coding_c_string (coding, chars, nbytes, Qt);
|
|
|
|
|
text = coding->dst_object;
|
|
|
|
|
Vlast_coding_system_used = CODING_ID_NAME (coding->id);
|
2000-08-04 02:26:32 +00:00
|
|
|
|
/* A new coding system might be found. See the comment in the
|
|
|
|
|
similar code in the previous `if' block. */
|
2002-03-01 01:45:23 +00:00
|
|
|
|
if (!EQ (p->decode_coding_system, Vlast_coding_system_used))
|
2000-08-04 02:26:32 +00:00
|
|
|
|
{
|
2002-03-01 01:45:23 +00:00
|
|
|
|
p->decode_coding_system = Vlast_coding_system_used;
|
2000-08-04 02:26:32 +00:00
|
|
|
|
if (NILP (p->encode_coding_system)
|
(struct Lisp_Process): Turn slots infd, outfd, kill_without_query, pty_flag,
tick, update_tick, decoding_carryover, inherit_coding_system_flag,
filter_multibyte, adaptive_read_buffering, read_output_delay, and
read_output_skip from Lisp_Objects to ints. Remove unused
encoding_carryover.
2007-07-12 06:36:57 +00:00
|
|
|
|
&& proc_encode_coding_system[p->outfd])
|
2000-08-04 02:26:32 +00:00
|
|
|
|
{
|
2006-05-15 02:47:05 +00:00
|
|
|
|
p->encode_coding_system
|
|
|
|
|
= coding_inherit_eol_type (Vlast_coding_system_used, Qnil);
|
2002-03-01 01:45:23 +00:00
|
|
|
|
setup_coding_system (p->encode_coding_system,
|
(struct Lisp_Process): Turn slots infd, outfd, kill_without_query, pty_flag,
tick, update_tick, decoding_carryover, inherit_coding_system_flag,
filter_multibyte, adaptive_read_buffering, read_output_delay, and
read_output_skip from Lisp_Objects to ints. Remove unused
encoding_carryover.
2007-07-12 06:36:57 +00:00
|
|
|
|
proc_encode_coding_system[p->outfd]);
|
2000-08-04 02:26:32 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
2003-06-05 07:17:10 +00:00
|
|
|
|
if (coding->carryover_bytes > 0)
|
|
|
|
|
{
|
2004-05-13 12:52:29 +00:00
|
|
|
|
if (SCHARS (p->decoding_buf) < coding->carryover_bytes)
|
|
|
|
|
p->decoding_buf = make_uninit_string (coding->carryover_bytes);
|
Replace bcopy, bzero, bcmp by memcpy, memmove, memset, memcmp
* alloc.c (overrun_check_malloc, overrun_check_realloc)
(overrun_check_free, xstrdup, allocate_string)
(allocate_string_data, compact_small_strings, Fmake_string)
(make_unibyte_string, make_multibyte_string)
(make_string_from_bytes, make_specified_string, make_float)
(Fcons, allocate_terminal, allocate_frame, make_pure_string)
(Fgarbage_collect): Replace bcopy, safe_bcopy, bzero, bcmp by
memcpy, memmove, memset, memcmp.
* atimer.c (start_atimer, set_alarm): Likewise.
* buffer.c (clone_per_buffer_values, report_overlay_modification)
(mmap_realloc, init_buffer_once): Likewise.
* callint.c (Fcall_interactively): Likewise.
* callproc.c (Fcall_process, Fcall_process_region, child_setup)
(getenv_internal_1): Likewise.
* casefiddle.c (casify_object): Likewise.
* ccl.c (ccl_driver): Likewise.
* character.c (str_as_multibyte, str_to_multibyte): Likewise.
* charset.c (load_charset_map_from_file)
(load_charset_map_from_file, load_charset_map_from_vector)
(Fdefine_charset_internal): Likewise.
* cm.c (Wcm_clear): Likewise.
* coding.c (decode_eol, decode_coding_object)
(Fset_coding_system_priority, make_subsidiaries): Likewise.
* data.c (Faset): Likewise.
* dired.c (directory_files_internal, file_name_completion_stat):
Likewise.
* dispnew.c (new_glyph_matrix, adjust_glyph_matrix)
(clear_glyph_row, copy_row_except_pointers)
(copy_glyph_row_contents, new_glyph_pool, realloc_glyph_pool)
(save_current_matrix, restore_current_matrix)
(build_frame_matrix_from_leaf_window, mirrored_line_dance)
(mirror_line_dance, scrolling_window): Likewise.
* doc.c (Fsnarf_documentation, Fsubstitute_command_keys):
Likewise.
* doprnt.c (doprnt): Likewise.
* editfns.c (Fuser_full_name, make_buffer_string_both)
(Fmessage_box, Fformat, Ftranspose_regions): Likewise.
* emacs.c (sort_args): Likewise.
* eval.c (Fapply, Ffuncall): Likewise.
* fileio.c (Ffile_name_directory, make_temp_name)
(Fexpand_file_name, search_embedded_absfilename)
(Fsubstitute_in_file_name, Ffile_symlink_p, Finsert_file_contents)
(auto_save_error): Likewise.
* fns.c (Fstring_equal, Fcopy_sequence, concat)
(string_to_multibyte, Fstring_as_unibyte, Fstring_as_multibyte)
(internal_equal, Fclear_string, larger_vector, copy_hash_table)
(Fmake_hash_table): Likewise.
* fringe.c (Fdefine_fringe_bitmap): Likewise.
* ftfont.c (ftfont_text_extents): Likewise.
* getloadavg.c (getloadavg): Likewise.
* image.c (define_image_type, make_image, make_image_cache)
(x_create_x_image_and_pixmap, xbm_image_p)
(w32_create_pixmap_from_bitmap_data, xbm_load, xpm_lookup_color)
(xpm_image_p, x_create_bitmap_from_xpm_data, xpm_load)
(init_color_table, x_build_heuristic_mask, pbm_image_p, pbm_load)
(png_image_p, png_read_from_memory, png_load, jpeg_image_p)
(tiff_image_p, tiff_read_from_memory, gif_image_p)
(gif_read_from_memory, gif_load, svg_image_p, gs_image_p):
Likewise.
* indent.c (scan_for_column, compute_motion): Likewise.
* insdel.c (gap_left, gap_right, make_gap_smaller, copy_text)
(insert_1_both, insert_from_gap, replace_range_2): Likewise.
* intervals.c (reproduce_tree, reproduce_tree_obj): Likewise.
* keyboard.c (echo_char, save_getcjmp, restore_getcjmp)
(kbd_buffer_store_event_hold, apply_modifiers_uncached)
(store_user_signal_events, menu_bar_items, tool_bar_items)
(process_tool_bar_item, append_tool_bar_item)
(read_char_minibuf_menu_prompt, read_key_sequence)
(Fread_key_sequence, Fread_key_sequence_vector, Frecent_keys):
Likewise.
* keymap.c (current_minor_maps, Fdescribe_buffer_bindings):
Likewise.
* lisp.h (STRING_COPYIN): Likewise.
* lread.c (Fload, read1, oblookup): Likewise.
* msdos.c (Frecent_doskeys): Likewise.
* nsfns.m (Fx_create_frame): Likewise.
* nsfont.m (nsfont_open, nsfont_text_extents, ns_glyph_metrics):
Likewise.
* nsimage.m (EmacsImage-initFromSkipXBM:width:height:)
(EmacsImage-initForXPMWithDepth:width:height:flip:length:):
Likewise.
* nsmenu.m (ns_update_menubar): Likewise.
* nsterm.m (ns_draw_fringe_bitmap, ns_term_init): Likewise.
* print.c (print_unwind, printchar, strout, print_string)
(print_error_message): Likewise.
* process.c (conv_lisp_to_sockaddr, set_socket_option)
(Fmake_network_process, Fnetwork_interface_list)
(Fnetwork_interface_info, read_process_output, Fprocess_send_eof)
(init_process): Likewise.
* ralloc.c (resize_bloc, r_alloc_sbrk, r_alloc_init): Likewise.
* regex.c (init_syntax_once, regex_compile, re_compile_fastmap):
Likewise.
* scroll.c (do_scrolling, do_direct_scrolling)
(scrolling_max_lines_saved): Likewise.
* search.c (search_buffer, wordify, Freplace_match): Likewise.
* sound.c (wav_init, au_init, Fplay_sound_internal): Likewise.
* syntax.c (skip_chars, skip_syntaxes): Likewise.
* sysdep.c (child_setup_tty, sys_subshell, emacs_get_tty)
(emacs_set_tty): Likewise.
* term.c (encode_terminal_code, calculate_costs)
(produce_special_glyphs, create_tty_output, init_tty, delete_tty):
Likewise.
* termcap.c (tgetst1, gobble_line): Likewise.
* termhooks.h (EVENT_INIT): Likewise.
* tparam.c (tparam1): Likewise.
* unexalpha.c (unexec): Likewise.
* unexec.c (write_segment): Likewise.
* unexmacosx.c (unexec_write_zero): Likewise.
* w32fns.c (w32_wnd_proc, Fx_create_frame, x_create_tip_frame)
(Fx_file_dialog, Fsystem_move_file_to_trash): Likewise.
* w32font.c (w32font_list_family, w32font_text_extents)
(w32font_list_internal, w32font_match_internal)
(w32font_open_internal, compute_metrics, Fx_select_font):
Likewise.
* w32menu.c (set_frame_menubar, add_menu_item)
(w32_menu_display_help, w32_free_submenu_strings): Likewise.
* w32term.c (XCreateGC, w32_initialize_display_info): Likewise.
* w32uniscribe.c (uniscribe_list_family): Likewise.
* w32xfns.c (get_next_msg, post_msg, prepend_msg): Likewise.
* window.c (make_window, replace_window, set_window_buffer)
(Fsplit_window): Likewise.
* xdisp.c (init_iterator, RECORD_OVERLAY_STRING, reseat_to_string)
(add_to_log, message3, x_consider_frame_title)
(append_space_for_newline, extend_face_to_end_of_line)
(decode_mode_spec_coding, init_glyph_string): Likewise.
* xfaces.c (x_create_gc, get_lface_attributes_no_remap)
(Finternal_copy_lisp_face, Finternal_merge_in_global_face)
(face_attr_equal_p, make_realized_face, make_face_cache)
(free_realized_faces, lookup_named_face, smaller_face)
(face_with_height, lookup_derived_face)
(x_supports_face_attributes_p, Finternal_set_font_selection_order)
(Finternal_set_font_selection_order, realize_default_face)
(compute_char_face, face_at_buffer_position)
(face_for_overlay_string, face_at_string_position, merge_faces):
Likewise.
* xfns.c (xic_create_fontsetname, Fx_create_frame)
(Fx_window_property, x_create_tip_frame)
(Fx_backspace_delete_keys_p): Likewise.
* xfont.c (xfont_list, xfont_match, xfont_list_family)
(xfont_text_extents): Likewise.
* xmenu.c (set_frame_menubar, xmenu_show): Likewise.
* xrdb.c (magic_file_p, x_get_resource): Likewise.
* xselect.c (x_queue_event, x_get_window_property)
(receive_incremental_selection): Likewise.
* xsmfns.c (x_session_check_input): Likewise.
* xterm.c (x_send_scroll_bar_event, SET_SAVED_MENU_EVENT)
(handle_one_xevent, x_check_errors, xim_initialize, x_term_init):
Likewise.
* character.h (BCOPY_SHORT): Removed.
* config.in: Regenerate.
* dispnew.c (safe_bcopy): Only define as dummy if PROFILING.
* emacs.c (main) [PROFILING]: Don't declare
dump_opcode_frequencies.
* lisp.h (safe_bcopy): Remove declaration.
(memset) [!HAVE_MEMSET]: Declare.
(memcpy) [!HAVE_MEMCPY]: Likewise.
(memmove) [!HAVE_MEMMOVE]: Likewise.
(memcmp) [!HAVE_MEMCMP]: Likewise.
* s/ms-w32.h (bzero, bcopy, bcmp, GAP_USE_BCOPY)
(BCOPY_UPWARD_SAFE, BCOPY_DOWNWARD_SAFE, HAVE_BCOPY, HAVE_BCMP):
Don't define.
(HAVE_MEMCMP, HAVE_MEMCPY, HAVE_MEMMOVE, HAVE_MEMSET): Define.
* s/msdos.h (GAP_USE_BCOPY, BCOPY_UPWARD_SAFE)
(BCOPY_DOWNWARD_SAFE): Don't define.
* sysdep.c (memset) [!HAVE_MEMSET]: Define.
(memcpy) [!HAVE_MEMCPY]: Define.
(memmove) [!HAVE_MEMMOVE]: Define.
(memcmp) [!HAVE_MEMCMP]: Define.
* config.nt (HAVE_BCOPY, HAVE_BCMP): Remove undefs.
(HAVE_MEMCPY, HAVE_MEMMOVE, HAVE_MEMSET, HAVE_MEMCMP): Add undefs.
* sed2v2.inp (HAVE_MEMCPY, HAVE_MEMSET): Edit to 1.
(HAVE_BZERO): Don't edit.
* lwlib.c (lwlib_memset, lwlib_bcopy): Remove.
(malloc_widget_value, free_widget_info, allocate_widget_instance)
(lw_separator_p): Replace lwlib_memset, lwlib_bcopy, bzero, bcmp by
memset, memcpy, memcmp.
* lwlib-utils.c (XtApplyToWidgets): Likewise.
* xlwmenu.c (XlwMenuInitialize): Likewise.
* lwlib.h (lwlib_bcopy): Remove declaration.
* ebrowse.c (add_sym, make_namespace): Replace bcopy, bzero by
memcpy, memmove, memset.
* pop.c (pop_retrieve, socket_connection, pop_getline): Likewise.
* CPP-DEFINES (BCOPY_DOWNWARD_SAFE, BCOPY_UPWARD_SAFE)
(GAP_USE_BCOPY, HAVE_BCMP, HAVE_BCOPY, bcmp, bcopy, bzero):
Remove.
* configure.in: Don't check for bcopy, bcmp, bzero. Don't include
<strings.h> and don't define bcopy, bzero, BCMP in config.h.
2010-07-08 00:18:28 +02:00
|
|
|
|
memcpy (SDATA (p->decoding_buf), coding->carryover,
|
|
|
|
|
coding->carryover_bytes);
|
2007-07-15 04:47:46 +00:00
|
|
|
|
p->decoding_carryover = coding->carryover_bytes;
|
2003-06-05 07:17:10 +00:00
|
|
|
|
}
|
2000-09-07 01:14:20 +00:00
|
|
|
|
/* Adjust the multibyteness of TEXT to that of the buffer. */
|
|
|
|
|
if (NILP (current_buffer->enable_multibyte_characters)
|
|
|
|
|
!= ! STRING_MULTIBYTE (text))
|
|
|
|
|
text = (STRING_MULTIBYTE (text)
|
2000-10-11 23:56:30 +00:00
|
|
|
|
? Fstring_as_unibyte (text)
|
2003-02-10 07:58:29 +00:00
|
|
|
|
: Fstring_to_multibyte (text));
|
2000-10-11 23:56:30 +00:00
|
|
|
|
/* Insert before markers in case we are inserting where
|
|
|
|
|
the buffer's mark is, and the user's next command is Meta-y. */
|
2003-07-31 01:24:44 +00:00
|
|
|
|
insert_from_string_before_markers (text, 0, 0,
|
|
|
|
|
SCHARS (text), SBYTES (text), 0);
|
1998-03-25 10:45:59 +00:00
|
|
|
|
|
2000-12-07 15:53:18 +00:00
|
|
|
|
/* Make sure the process marker's position is valid when the
|
|
|
|
|
process buffer is changed in the signal_after_change above.
|
|
|
|
|
W3 is known to do that. */
|
|
|
|
|
if (BUFFERP (p->buffer)
|
|
|
|
|
&& (b = XBUFFER (p->buffer), b != current_buffer))
|
|
|
|
|
set_marker_both (p->mark, p->buffer, BUF_PT (b), BUF_PT_BYTE (b));
|
|
|
|
|
else
|
|
|
|
|
set_marker_both (p->mark, p->buffer, PT, PT_BYTE);
|
* systty.h, process.c, buffer.h, callproc.c, sysdep.c, dired.c:
Added VMS changes from Roland Roberts.
* process.c (read_process_output): Save, widen, insert the process
output, and then restore the restriction if inserting text outside
the visible region.
* process.c (Fstart_process): Establish an unwind-protect to
remove PROC from the process list if an error occurs while
starting it.
(start_process_unwind): New function to help with that.
(create_process): There's no need to explicitly call
remove_process if the fork fails; the record_unwind_protect in
Fstart_process will take care of it.
* process.c (wait_reading_process_input): Test the C preprocessor
symbol "ultrix", not "__ultrix__" to see if we should ignore
ENOMEM errors from select.
* process.c (process_send_signal): On systems which have both
the TIOCGETC and TCGETA ioctls, just use the former.
* s/bsd4-2.h, s/bsd4-3.h: #define SIGNALS_VIA_CHARACTERS.
* process.c (process_send_signal): Put all the code for sending
signals via characters in a #ifdef SIGNALS_VIA_CHARACTERS. Decide
whether to use the Berkeley-style or SYSV-style ioctls by seeing
which ioctl commands are #defined.
* process.c (process_send_signal): Doc fix.
1992-11-16 00:53:26 +00:00
|
|
|
|
|
1992-03-14 20:40:04 +00:00
|
|
|
|
update_mode_lines++;
|
|
|
|
|
|
1997-04-30 18:34:17 +00:00
|
|
|
|
/* Make sure opoint and the old restrictions
|
|
|
|
|
float ahead of any new text just as point would. */
|
|
|
|
|
if (opoint >= before)
|
1998-01-01 06:45:08 +00:00
|
|
|
|
{
|
|
|
|
|
opoint += PT - before;
|
|
|
|
|
opoint_byte += PT_BYTE - before_byte;
|
|
|
|
|
}
|
1997-04-30 18:34:17 +00:00
|
|
|
|
if (old_begv > before)
|
1998-01-01 06:45:08 +00:00
|
|
|
|
{
|
|
|
|
|
old_begv += PT - before;
|
|
|
|
|
old_begv_byte += PT_BYTE - before_byte;
|
|
|
|
|
}
|
1997-04-30 18:34:17 +00:00
|
|
|
|
if (old_zv >= before)
|
1998-01-01 06:45:08 +00:00
|
|
|
|
{
|
|
|
|
|
old_zv += PT - before;
|
|
|
|
|
old_zv_byte += PT_BYTE - before_byte;
|
|
|
|
|
}
|
1997-04-30 18:34:17 +00:00
|
|
|
|
|
* systty.h, process.c, buffer.h, callproc.c, sysdep.c, dired.c:
Added VMS changes from Roland Roberts.
* process.c (read_process_output): Save, widen, insert the process
output, and then restore the restriction if inserting text outside
the visible region.
* process.c (Fstart_process): Establish an unwind-protect to
remove PROC from the process list if an error occurs while
starting it.
(start_process_unwind): New function to help with that.
(create_process): There's no need to explicitly call
remove_process if the fork fails; the record_unwind_protect in
Fstart_process will take care of it.
* process.c (wait_reading_process_input): Test the C preprocessor
symbol "ultrix", not "__ultrix__" to see if we should ignore
ENOMEM errors from select.
* process.c (process_send_signal): On systems which have both
the TIOCGETC and TCGETA ioctls, just use the former.
* s/bsd4-2.h, s/bsd4-3.h: #define SIGNALS_VIA_CHARACTERS.
* process.c (process_send_signal): Put all the code for sending
signals via characters in a #ifdef SIGNALS_VIA_CHARACTERS. Decide
whether to use the Berkeley-style or SYSV-style ioctls by seeing
which ioctl commands are #defined.
* process.c (process_send_signal): Doc fix.
1992-11-16 00:53:26 +00:00
|
|
|
|
/* If the restriction isn't what it should be, set it. */
|
1997-04-30 18:34:17 +00:00
|
|
|
|
if (old_begv != BEGV || old_zv != ZV)
|
|
|
|
|
Fnarrow_to_region (make_number (old_begv), make_number (old_zv));
|
* systty.h, process.c, buffer.h, callproc.c, sysdep.c, dired.c:
Added VMS changes from Roland Roberts.
* process.c (read_process_output): Save, widen, insert the process
output, and then restore the restriction if inserting text outside
the visible region.
* process.c (Fstart_process): Establish an unwind-protect to
remove PROC from the process list if an error occurs while
starting it.
(start_process_unwind): New function to help with that.
(create_process): There's no need to explicitly call
remove_process if the fork fails; the record_unwind_protect in
Fstart_process will take care of it.
* process.c (wait_reading_process_input): Test the C preprocessor
symbol "ultrix", not "__ultrix__" to see if we should ignore
ENOMEM errors from select.
* process.c (process_send_signal): On systems which have both
the TIOCGETC and TCGETA ioctls, just use the former.
* s/bsd4-2.h, s/bsd4-3.h: #define SIGNALS_VIA_CHARACTERS.
* process.c (process_send_signal): Put all the code for sending
signals via characters in a #ifdef SIGNALS_VIA_CHARACTERS. Decide
whether to use the Berkeley-style or SYSV-style ioctls by seeing
which ioctl commands are #defined.
* process.c (process_send_signal): Doc fix.
1992-11-16 00:53:26 +00:00
|
|
|
|
|
1993-06-06 03:15:59 +00:00
|
|
|
|
|
* systty.h, process.c, buffer.h, callproc.c, sysdep.c, dired.c:
Added VMS changes from Roland Roberts.
* process.c (read_process_output): Save, widen, insert the process
output, and then restore the restriction if inserting text outside
the visible region.
* process.c (Fstart_process): Establish an unwind-protect to
remove PROC from the process list if an error occurs while
starting it.
(start_process_unwind): New function to help with that.
(create_process): There's no need to explicitly call
remove_process if the fork fails; the record_unwind_protect in
Fstart_process will take care of it.
* process.c (wait_reading_process_input): Test the C preprocessor
symbol "ultrix", not "__ultrix__" to see if we should ignore
ENOMEM errors from select.
* process.c (process_send_signal): On systems which have both
the TIOCGETC and TCGETA ioctls, just use the former.
* s/bsd4-2.h, s/bsd4-3.h: #define SIGNALS_VIA_CHARACTERS.
* process.c (process_send_signal): Put all the code for sending
signals via characters in a #ifdef SIGNALS_VIA_CHARACTERS. Decide
whether to use the Berkeley-style or SYSV-style ioctls by seeing
which ioctl commands are #defined.
* process.c (process_send_signal): Doc fix.
1992-11-16 00:53:26 +00:00
|
|
|
|
current_buffer->read_only = old_read_only;
|
1998-01-01 06:45:08 +00:00
|
|
|
|
SET_PT_BOTH (opoint, opoint_byte);
|
1992-03-14 20:40:04 +00:00
|
|
|
|
}
|
2010-04-11 11:53:13 -04:00
|
|
|
|
/* Handling the process output should not deactivate the mark. */
|
|
|
|
|
Vdeactivate_mark = odeactivate;
|
|
|
|
|
|
|
|
|
|
unbind_to (count, Qnil);
|
1998-01-05 17:33:41 +00:00
|
|
|
|
return nbytes;
|
1992-03-14 20:40:04 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Sending data to subprocess */
|
|
|
|
|
|
|
|
|
|
jmp_buf send_process_frame;
|
2000-09-21 11:48:48 +00:00
|
|
|
|
Lisp_Object process_sent_to;
|
1992-03-14 20:40:04 +00:00
|
|
|
|
|
|
|
|
|
SIGTYPE
|
2010-07-05 12:36:06 +02:00
|
|
|
|
send_process_trap (int ignore)
|
1992-03-14 20:40:04 +00:00
|
|
|
|
{
|
2004-12-15 21:40:41 +00:00
|
|
|
|
SIGNAL_THREAD_CHECK (SIGPIPE);
|
2005-05-14 14:06:33 +00:00
|
|
|
|
sigunblock (sigmask (SIGPIPE));
|
1992-03-14 20:40:04 +00:00
|
|
|
|
longjmp (send_process_frame, 1);
|
|
|
|
|
}
|
|
|
|
|
|
1994-06-25 22:35:28 +00:00
|
|
|
|
/* Send some data to process PROC.
|
|
|
|
|
BUF is the beginning of the data; LEN is the number of characters.
|
2000-10-25 11:06:51 +00:00
|
|
|
|
OBJECT is the Lisp object that the data comes from. If OBJECT is
|
|
|
|
|
nil or t, it means that the data comes from C string.
|
1997-02-20 06:53:55 +00:00
|
|
|
|
|
2000-10-25 11:06:51 +00:00
|
|
|
|
If OBJECT is not nil, the data is encoded by PROC's coding-system
|
|
|
|
|
for encoding before it is sent.
|
2000-03-15 19:58:03 +00:00
|
|
|
|
|
|
|
|
|
This function can evaluate Lisp code and can garbage collect. */
|
1994-06-25 22:35:28 +00:00
|
|
|
|
|
(deactivate_process, status_notify, read_process_output)
(update_status, status_convert, decode_status, allocate_pty)
(make_process, remove_process, list_processes_1)
(create_process_1, unwind_request_sigio, read_process_output)
(send_process, keyboard_bit_set): Declare static.
(Fdelete_process): Simplify. Pass process to status_notify, so we
don't try to read output from it.
(status_notify): New arg deleting_process--don't try to read
output from that process.
2005-08-15 08:44:53 +00:00
|
|
|
|
static void
|
2010-07-05 12:36:06 +02:00
|
|
|
|
send_process (volatile Lisp_Object proc, unsigned char *volatile buf,
|
|
|
|
|
volatile int len, volatile Lisp_Object object)
|
1992-03-14 20:40:04 +00:00
|
|
|
|
{
|
1995-05-26 03:21:30 +00:00
|
|
|
|
/* Use volatile to protect variables from being clobbered by longjmp. */
|
2004-04-16 12:51:06 +00:00
|
|
|
|
struct Lisp_Process *p = XPROCESS (proc);
|
1992-03-14 20:40:04 +00:00
|
|
|
|
int rv;
|
1997-02-20 06:53:55 +00:00
|
|
|
|
struct coding_system *coding;
|
2009-06-28 20:25:49 +00:00
|
|
|
|
struct gcpro gcpro1;
|
2010-07-05 09:29:35 -07:00
|
|
|
|
SIGTYPE (*volatile old_sigpipe) (int);
|
1996-08-22 02:57:09 +00:00
|
|
|
|
|
2009-06-28 20:25:49 +00:00
|
|
|
|
GCPRO1 (object);
|
1992-03-14 20:40:04 +00:00
|
|
|
|
|
* process.h (struct Lisp_Process): Replace Lisp_Objects `pid',
`raw_status_high', and `raw_status_low' with plain integers, and move
them to the end of the structure.
* alloc.c (allocate_process): Use PSEUDOVECSIZE to initialize the
pseudovector's size field so only the Lisp_Object fields get GC'd.
* process.c (update_status, make_process, Fdelete_process)
(Fprocess_status, list_processes_1, start_process_unwind)
(create_process, Fmake_network_process, server_accept_connection)
(wait_reading_process_output, send_process, Fprocess_running_child_p)
(process_send_signal, proc_encode_coding_system, Fprocess_send_eof)
(sigchld_handler, status_notify): Adjust to new non-Lisp fields for
`pid' and `raw_status'.
(Fprocess_id, Fsignal_process): Same, and additionally use floats when
representing PIDs that are larger than most-positive-fixnum.
2006-04-08 15:07:35 +00:00
|
|
|
|
if (p->raw_status_new)
|
2004-04-16 12:51:06 +00:00
|
|
|
|
update_status (p);
|
|
|
|
|
if (! EQ (p->status, Qrun))
|
|
|
|
|
error ("Process %s not running", SDATA (p->name));
|
(struct Lisp_Process): Turn slots infd, outfd, kill_without_query, pty_flag,
tick, update_tick, decoding_carryover, inherit_coding_system_flag,
filter_multibyte, adaptive_read_buffering, read_output_delay, and
read_output_skip from Lisp_Objects to ints. Remove unused
encoding_carryover.
2007-07-12 06:36:57 +00:00
|
|
|
|
if (p->outfd < 0)
|
2004-04-16 12:51:06 +00:00
|
|
|
|
error ("Output file descriptor of %s is closed", SDATA (p->name));
|
1997-02-20 06:53:55 +00:00
|
|
|
|
|
(struct Lisp_Process): Turn slots infd, outfd, kill_without_query, pty_flag,
tick, update_tick, decoding_carryover, inherit_coding_system_flag,
filter_multibyte, adaptive_read_buffering, read_output_delay, and
read_output_skip from Lisp_Objects to ints. Remove unused
encoding_carryover.
2007-07-12 06:36:57 +00:00
|
|
|
|
coding = proc_encode_coding_system[p->outfd];
|
2002-03-01 01:45:23 +00:00
|
|
|
|
Vlast_coding_system_used = CODING_ID_NAME (coding->id);
|
1997-12-09 04:12:03 +00:00
|
|
|
|
|
2000-08-04 02:26:32 +00:00
|
|
|
|
if ((STRINGP (object) && STRING_MULTIBYTE (object))
|
|
|
|
|
|| (BUFFERP (object)
|
2000-10-25 11:06:51 +00:00
|
|
|
|
&& !NILP (XBUFFER (object)->enable_multibyte_characters))
|
|
|
|
|
|| EQ (object, Qt))
|
2000-08-24 02:06:43 +00:00
|
|
|
|
{
|
2004-04-16 12:51:06 +00:00
|
|
|
|
if (!EQ (Vlast_coding_system_used, p->encode_coding_system))
|
2000-08-24 02:06:43 +00:00
|
|
|
|
/* The coding system for encoding was changed to raw-text
|
|
|
|
|
because we sent a unibyte text previously. Now we are
|
|
|
|
|
sending a multibyte text, thus we must encode it by the
|
2004-04-16 12:51:06 +00:00
|
|
|
|
original coding system specified for the current process. */
|
|
|
|
|
setup_coding_system (p->encode_coding_system, coding);
|
2003-12-29 07:53:43 +00:00
|
|
|
|
coding->src_multibyte = 1;
|
2000-08-24 02:06:43 +00:00
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
2000-10-25 11:06:51 +00:00
|
|
|
|
/* For sending a unibyte text, character code conversion should
|
|
|
|
|
not take place but EOL conversion should. So, setup raw-text
|
|
|
|
|
or one of the subsidiary if we have not yet done it. */
|
2002-03-01 01:45:23 +00:00
|
|
|
|
if (CODING_REQUIRE_ENCODING (coding))
|
2000-10-25 11:06:51 +00:00
|
|
|
|
{
|
|
|
|
|
if (CODING_REQUIRE_FLUSHING (coding))
|
|
|
|
|
{
|
|
|
|
|
/* But, before changing the coding, we must flush out data. */
|
|
|
|
|
coding->mode |= CODING_MODE_LAST_BLOCK;
|
|
|
|
|
send_process (proc, "", 0, Qt);
|
2003-09-08 12:53:41 +00:00
|
|
|
|
coding->mode &= CODING_MODE_LAST_BLOCK;
|
2000-10-25 11:06:51 +00:00
|
|
|
|
}
|
2002-03-01 01:45:23 +00:00
|
|
|
|
setup_coding_system (raw_text_coding_system
|
|
|
|
|
(Vlast_coding_system_used),
|
|
|
|
|
coding);
|
2003-12-29 07:53:43 +00:00
|
|
|
|
coding->src_multibyte = 0;
|
2000-10-25 11:06:51 +00:00
|
|
|
|
}
|
2000-08-24 02:06:43 +00:00
|
|
|
|
}
|
2000-05-20 00:04:37 +00:00
|
|
|
|
coding->dst_multibyte = 0;
|
|
|
|
|
|
2000-08-04 02:26:32 +00:00
|
|
|
|
if (CODING_REQUIRE_ENCODING (coding))
|
1997-02-20 06:53:55 +00:00
|
|
|
|
{
|
2002-03-01 01:45:23 +00:00
|
|
|
|
coding->dst_object = Qt;
|
2000-08-04 02:26:32 +00:00
|
|
|
|
if (BUFFERP (object))
|
1997-02-20 06:53:55 +00:00
|
|
|
|
{
|
2002-03-01 01:45:23 +00:00
|
|
|
|
int from_byte, from, to;
|
|
|
|
|
int save_pt, save_pt_byte;
|
|
|
|
|
struct buffer *cur = current_buffer;
|
|
|
|
|
|
|
|
|
|
set_buffer_internal (XBUFFER (object));
|
|
|
|
|
save_pt = PT, save_pt_byte = PT_BYTE;
|
|
|
|
|
|
|
|
|
|
from_byte = PTR_BYTE_POS (buf);
|
|
|
|
|
from = BYTE_TO_CHAR (from_byte);
|
|
|
|
|
to = BYTE_TO_CHAR (from_byte + len);
|
|
|
|
|
TEMP_SET_PT_BOTH (from, from_byte);
|
|
|
|
|
encode_coding_object (coding, object, from, from_byte,
|
|
|
|
|
to, from_byte + len, Qt);
|
|
|
|
|
TEMP_SET_PT_BOTH (save_pt, save_pt_byte);
|
|
|
|
|
set_buffer_internal (cur);
|
2000-08-04 02:26:32 +00:00
|
|
|
|
}
|
|
|
|
|
else if (STRINGP (object))
|
|
|
|
|
{
|
2009-08-27 11:13:33 +00:00
|
|
|
|
encode_coding_object (coding, object, 0, 0, SCHARS (object),
|
|
|
|
|
SBYTES (object), Qt);
|
1997-02-20 06:53:55 +00:00
|
|
|
|
}
|
2002-03-01 01:45:23 +00:00
|
|
|
|
else
|
2001-09-25 08:21:22 +00:00
|
|
|
|
{
|
2002-03-01 01:45:23 +00:00
|
|
|
|
coding->dst_object = make_unibyte_string (buf, len);
|
|
|
|
|
coding->produced = len;
|
2001-09-25 08:21:22 +00:00
|
|
|
|
}
|
2000-08-04 02:26:32 +00:00
|
|
|
|
|
1998-01-22 01:26:45 +00:00
|
|
|
|
len = coding->produced;
|
2009-06-28 20:25:49 +00:00
|
|
|
|
object = coding->dst_object;
|
|
|
|
|
buf = SDATA (object);
|
1997-02-20 06:53:55 +00:00
|
|
|
|
}
|
1992-03-14 20:40:04 +00:00
|
|
|
|
|
1994-06-25 22:35:28 +00:00
|
|
|
|
if (pty_max_bytes == 0)
|
|
|
|
|
{
|
|
|
|
|
#if defined (HAVE_FPATHCONF) && defined (_PC_MAX_CANON)
|
(struct Lisp_Process): Turn slots infd, outfd, kill_without_query, pty_flag,
tick, update_tick, decoding_carryover, inherit_coding_system_flag,
filter_multibyte, adaptive_read_buffering, read_output_delay, and
read_output_skip from Lisp_Objects to ints. Remove unused
encoding_carryover.
2007-07-12 06:36:57 +00:00
|
|
|
|
pty_max_bytes = fpathconf (p->outfd, _PC_MAX_CANON);
|
1994-06-25 22:35:28 +00:00
|
|
|
|
if (pty_max_bytes < 0)
|
|
|
|
|
pty_max_bytes = 250;
|
|
|
|
|
#else
|
|
|
|
|
pty_max_bytes = 250;
|
|
|
|
|
#endif
|
|
|
|
|
/* Deduct one, to leave space for the eof. */
|
|
|
|
|
pty_max_bytes--;
|
|
|
|
|
}
|
|
|
|
|
|
2000-09-21 11:48:48 +00:00
|
|
|
|
/* 2000-09-21: Emacs 20.7, sparc-sun-solaris-2.6, GCC 2.95.2,
|
|
|
|
|
CFLAGS="-g -O": The value of the parameter `proc' is clobbered
|
|
|
|
|
when returning with longjmp despite being declared volatile. */
|
1992-03-14 20:40:04 +00:00
|
|
|
|
if (!setjmp (send_process_frame))
|
2000-09-21 11:48:48 +00:00
|
|
|
|
{
|
|
|
|
|
process_sent_to = proc;
|
|
|
|
|
while (len > 0)
|
|
|
|
|
{
|
|
|
|
|
int this = len;
|
1994-03-02 22:50:31 +00:00
|
|
|
|
|
2000-09-21 11:48:48 +00:00
|
|
|
|
/* Send this batch, using one or more write calls. */
|
|
|
|
|
while (this > 0)
|
|
|
|
|
{
|
(struct Lisp_Process): Turn slots infd, outfd, kill_without_query, pty_flag,
tick, update_tick, decoding_carryover, inherit_coding_system_flag,
filter_multibyte, adaptive_read_buffering, read_output_delay, and
read_output_skip from Lisp_Objects to ints. Remove unused
encoding_carryover.
2007-07-12 06:36:57 +00:00
|
|
|
|
int outfd = p->outfd;
|
2010-07-05 09:29:35 -07:00
|
|
|
|
old_sigpipe = (SIGTYPE (*) (int)) signal (SIGPIPE, send_process_trap);
|
(Qlocal, QCname, QCbuffer, QChost, QCservice, QCfamily)
(QClocal, QCremote, QCserver, QCdatagram, QCnowait, QCnoquery,QCstop)
(QCcoding, QCoptions, QCfilter, QCsentinel, QClog, QCfeature):
New variables.
(NETCONN1_P): New macro.
(DATAGRAM_SOCKETS): New conditional symbol.
(datagram_address): New array.
(DATAGRAM_CONN_P, DATAGRAM_CHAN_P): New macros.
(status_message): Use concat3.
(Fprocess_status): Add `listen' status to doc string. Return `stop'
for a stopped network process.
(Fset_process_buffer): Update contact plist for network process.
(Fset_process_filter): Ditto. Don't enable input for stopped
network processes. Server must listen, even if filter is t.
(Fset_process_query_on_exit_flag, Fprocess_query_on_exit_flag):
New functions.
(Fprocess_kill_without_query): Removed. Now defined in simple.el.
(Fprocess_contact): Added KEY argument. Handle datagrams.
(list_processes_1): Optionally show only processes with the query
on exit flag set. Dynamically adjust column widths. Omit tty
column if not needed. Report stopped network processes.
Identify server and datagram network processes.
(Flist_processes): New optional arg `query-only'.
(conv_sockaddr_to_lisp, get_lisp_to_sockaddr_size)
(conv_lisp_to_sockaddr, set_socket_options)
(network_process_featurep, unwind_request_sigio): New helper functions.
(Fprocess_datagram_address, Fset_process_datagram_address):
(Fset_network_process_options): New lisp functions.
(Fopen_network_stream): Removed. Now defined in simple.el.
(Fmake_network_process): New lisp function. Code is based on previous
Fopen_network_stream, but heavily reworked with new property list based
argument list, support for datagrams, server processes, and local
sockets in addition to old client-only functionality.
(server_accept_connection): New function.
(wait_reading_process_input): Use it to handle incoming connects.
Do not enable input on a new connection if process is stopped.
(read_process_output): Handle datagram sockets. Use 2k buffer for them.
(send_process): Handle datagram sockets.
(Fstop_process, Fcontinue_process): Apply to network processes. A stopped
network process is indicated by setting command field to t .
(Fprocess_send_eof): No-op if datagram connection.
(Fstatus_notify): Don't read input for a stream server socket or a
stopped network process.
(init_process): Initialize datagram_address array.
(syms_of_process): Intern and staticpro new variables, defsubr new
functions.
2002-03-17 20:20:33 +00:00
|
|
|
|
#ifdef DATAGRAM_SOCKETS
|
|
|
|
|
if (DATAGRAM_CHAN_P (outfd))
|
|
|
|
|
{
|
|
|
|
|
rv = sendto (outfd, (char *) buf, this,
|
|
|
|
|
0, datagram_address[outfd].sa,
|
|
|
|
|
datagram_address[outfd].len);
|
|
|
|
|
if (rv < 0 && errno == EMSGSIZE)
|
2005-05-14 14:06:33 +00:00
|
|
|
|
{
|
|
|
|
|
signal (SIGPIPE, old_sigpipe);
|
|
|
|
|
report_file_error ("sending datagram",
|
|
|
|
|
Fcons (proc, Qnil));
|
|
|
|
|
}
|
(Qlocal, QCname, QCbuffer, QChost, QCservice, QCfamily)
(QClocal, QCremote, QCserver, QCdatagram, QCnowait, QCnoquery,QCstop)
(QCcoding, QCoptions, QCfilter, QCsentinel, QClog, QCfeature):
New variables.
(NETCONN1_P): New macro.
(DATAGRAM_SOCKETS): New conditional symbol.
(datagram_address): New array.
(DATAGRAM_CONN_P, DATAGRAM_CHAN_P): New macros.
(status_message): Use concat3.
(Fprocess_status): Add `listen' status to doc string. Return `stop'
for a stopped network process.
(Fset_process_buffer): Update contact plist for network process.
(Fset_process_filter): Ditto. Don't enable input for stopped
network processes. Server must listen, even if filter is t.
(Fset_process_query_on_exit_flag, Fprocess_query_on_exit_flag):
New functions.
(Fprocess_kill_without_query): Removed. Now defined in simple.el.
(Fprocess_contact): Added KEY argument. Handle datagrams.
(list_processes_1): Optionally show only processes with the query
on exit flag set. Dynamically adjust column widths. Omit tty
column if not needed. Report stopped network processes.
Identify server and datagram network processes.
(Flist_processes): New optional arg `query-only'.
(conv_sockaddr_to_lisp, get_lisp_to_sockaddr_size)
(conv_lisp_to_sockaddr, set_socket_options)
(network_process_featurep, unwind_request_sigio): New helper functions.
(Fprocess_datagram_address, Fset_process_datagram_address):
(Fset_network_process_options): New lisp functions.
(Fopen_network_stream): Removed. Now defined in simple.el.
(Fmake_network_process): New lisp function. Code is based on previous
Fopen_network_stream, but heavily reworked with new property list based
argument list, support for datagrams, server processes, and local
sockets in addition to old client-only functionality.
(server_accept_connection): New function.
(wait_reading_process_input): Use it to handle incoming connects.
Do not enable input on a new connection if process is stopped.
(read_process_output): Handle datagram sockets. Use 2k buffer for them.
(send_process): Handle datagram sockets.
(Fstop_process, Fcontinue_process): Apply to network processes. A stopped
network process is indicated by setting command field to t .
(Fprocess_send_eof): No-op if datagram connection.
(Fstatus_notify): Don't read input for a stream server socket or a
stopped network process.
(init_process): Initialize datagram_address array.
(syms_of_process): Intern and staticpro new variables, defsubr new
functions.
2002-03-17 20:20:33 +00:00
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
#endif
|
2004-04-16 12:51:06 +00:00
|
|
|
|
{
|
|
|
|
|
rv = emacs_write (outfd, (char *) buf, this);
|
|
|
|
|
#ifdef ADAPTIVE_READ_BUFFERING
|
(struct Lisp_Process): Turn slots infd, outfd, kill_without_query, pty_flag,
tick, update_tick, decoding_carryover, inherit_coding_system_flag,
filter_multibyte, adaptive_read_buffering, read_output_delay, and
read_output_skip from Lisp_Objects to ints. Remove unused
encoding_carryover.
2007-07-12 06:36:57 +00:00
|
|
|
|
if (p->read_output_delay > 0
|
|
|
|
|
&& p->adaptive_read_buffering == 1)
|
2004-04-16 12:51:06 +00:00
|
|
|
|
{
|
(struct Lisp_Process): Turn slots infd, outfd, kill_without_query, pty_flag,
tick, update_tick, decoding_carryover, inherit_coding_system_flag,
filter_multibyte, adaptive_read_buffering, read_output_delay, and
read_output_skip from Lisp_Objects to ints. Remove unused
encoding_carryover.
2007-07-12 06:36:57 +00:00
|
|
|
|
p->read_output_delay = 0;
|
2004-04-16 12:51:06 +00:00
|
|
|
|
process_output_delay_count--;
|
(struct Lisp_Process): Turn slots infd, outfd, kill_without_query, pty_flag,
tick, update_tick, decoding_carryover, inherit_coding_system_flag,
filter_multibyte, adaptive_read_buffering, read_output_delay, and
read_output_skip from Lisp_Objects to ints. Remove unused
encoding_carryover.
2007-07-12 06:36:57 +00:00
|
|
|
|
p->read_output_skip = 0;
|
2004-04-16 12:51:06 +00:00
|
|
|
|
}
|
|
|
|
|
#endif
|
|
|
|
|
}
|
2000-09-21 11:48:48 +00:00
|
|
|
|
signal (SIGPIPE, old_sigpipe);
|
1994-06-25 22:35:28 +00:00
|
|
|
|
|
2000-09-21 11:48:48 +00:00
|
|
|
|
if (rv < 0)
|
|
|
|
|
{
|
|
|
|
|
if (0
|
1992-03-14 20:40:04 +00:00
|
|
|
|
#ifdef EWOULDBLOCK
|
2000-09-21 11:48:48 +00:00
|
|
|
|
|| errno == EWOULDBLOCK
|
1992-03-14 20:40:04 +00:00
|
|
|
|
#endif
|
|
|
|
|
#ifdef EAGAIN
|
2000-09-21 11:48:48 +00:00
|
|
|
|
|| errno == EAGAIN
|
1992-03-14 20:40:04 +00:00
|
|
|
|
#endif
|
2000-09-21 11:48:48 +00:00
|
|
|
|
)
|
2003-02-04 14:56:31 +00:00
|
|
|
|
/* Buffer is full. Wait, accepting input;
|
2000-09-21 11:48:48 +00:00
|
|
|
|
that may allow the program
|
|
|
|
|
to finish doing output and read more. */
|
|
|
|
|
{
|
|
|
|
|
int offset = 0;
|
1994-06-25 22:35:28 +00:00
|
|
|
|
|
2000-02-15 10:27:23 +00:00
|
|
|
|
#ifdef BROKEN_PTY_READ_AFTER_EAGAIN
|
2000-09-21 11:48:48 +00:00
|
|
|
|
/* A gross hack to work around a bug in FreeBSD.
|
|
|
|
|
In the following sequence, read(2) returns
|
|
|
|
|
bogus data:
|
|
|
|
|
|
|
|
|
|
write(2) 1022 bytes
|
|
|
|
|
write(2) 954 bytes, get EAGAIN
|
|
|
|
|
read(2) 1024 bytes in process_read_output
|
|
|
|
|
read(2) 11 bytes in process_read_output
|
|
|
|
|
|
|
|
|
|
That is, read(2) returns more bytes than have
|
|
|
|
|
ever been written successfully. The 1033 bytes
|
|
|
|
|
read are the 1022 bytes written successfully
|
|
|
|
|
after processing (for example with CRs added if
|
|
|
|
|
the terminal is set up that way which it is
|
|
|
|
|
here). The same bytes will be seen again in a
|
|
|
|
|
later read(2), without the CRs. */
|
2003-02-04 14:56:31 +00:00
|
|
|
|
|
2000-09-21 11:48:48 +00:00
|
|
|
|
if (errno == EAGAIN)
|
|
|
|
|
{
|
|
|
|
|
int flags = FWRITE;
|
(struct Lisp_Process): Turn slots infd, outfd, kill_without_query, pty_flag,
tick, update_tick, decoding_carryover, inherit_coding_system_flag,
filter_multibyte, adaptive_read_buffering, read_output_delay, and
read_output_skip from Lisp_Objects to ints. Remove unused
encoding_carryover.
2007-07-12 06:36:57 +00:00
|
|
|
|
ioctl (p->outfd, TIOCFLUSH, &flags);
|
2000-09-21 11:48:48 +00:00
|
|
|
|
}
|
2000-02-15 10:27:23 +00:00
|
|
|
|
#endif /* BROKEN_PTY_READ_AFTER_EAGAIN */
|
2003-02-04 14:56:31 +00:00
|
|
|
|
|
2000-09-21 11:48:48 +00:00
|
|
|
|
/* Running filters might relocate buffers or strings.
|
|
|
|
|
Arrange to relocate BUF. */
|
2009-06-28 20:25:49 +00:00
|
|
|
|
if (BUFFERP (object))
|
2000-09-21 11:48:48 +00:00
|
|
|
|
offset = BUF_PTR_BYTE_POS (XBUFFER (object), buf);
|
|
|
|
|
else if (STRINGP (object))
|
2002-07-15 00:01:34 +00:00
|
|
|
|
offset = buf - SDATA (object);
|
2000-09-21 11:48:48 +00:00
|
|
|
|
|
1996-12-18 16:37:52 +00:00
|
|
|
|
#ifdef EMACS_HAS_USECS
|
2004-08-20 10:33:25 +00:00
|
|
|
|
wait_reading_process_output (0, 20000, 0, 0, Qnil, NULL, 0);
|
1996-12-18 16:37:52 +00:00
|
|
|
|
#else
|
2004-08-20 10:33:25 +00:00
|
|
|
|
wait_reading_process_output (1, 0, 0, 0, Qnil, NULL, 0);
|
1996-12-18 16:37:52 +00:00
|
|
|
|
#endif
|
1994-06-25 22:35:28 +00:00
|
|
|
|
|
2009-06-28 20:25:49 +00:00
|
|
|
|
if (BUFFERP (object))
|
2000-09-21 11:48:48 +00:00
|
|
|
|
buf = BUF_BYTE_ADDRESS (XBUFFER (object), offset);
|
|
|
|
|
else if (STRINGP (object))
|
2002-07-15 00:01:34 +00:00
|
|
|
|
buf = offset + SDATA (object);
|
1994-06-25 22:35:28 +00:00
|
|
|
|
|
2000-09-21 11:48:48 +00:00
|
|
|
|
rv = 0;
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
/* This is a real error. */
|
|
|
|
|
report_file_error ("writing to process", Fcons (proc, Qnil));
|
|
|
|
|
}
|
|
|
|
|
buf += rv;
|
|
|
|
|
len -= rv;
|
|
|
|
|
this -= rv;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
1992-03-14 20:40:04 +00:00
|
|
|
|
else
|
|
|
|
|
{
|
2005-05-21 11:58:49 +00:00
|
|
|
|
signal (SIGPIPE, old_sigpipe);
|
2000-09-21 11:48:48 +00:00
|
|
|
|
proc = process_sent_to;
|
2004-04-16 12:51:06 +00:00
|
|
|
|
p = XPROCESS (proc);
|
* process.h (struct Lisp_Process): Replace Lisp_Objects `pid',
`raw_status_high', and `raw_status_low' with plain integers, and move
them to the end of the structure.
* alloc.c (allocate_process): Use PSEUDOVECSIZE to initialize the
pseudovector's size field so only the Lisp_Object fields get GC'd.
* process.c (update_status, make_process, Fdelete_process)
(Fprocess_status, list_processes_1, start_process_unwind)
(create_process, Fmake_network_process, server_accept_connection)
(wait_reading_process_output, send_process, Fprocess_running_child_p)
(process_send_signal, proc_encode_coding_system, Fprocess_send_eof)
(sigchld_handler, status_notify): Adjust to new non-Lisp fields for
`pid' and `raw_status'.
(Fprocess_id, Fsignal_process): Same, and additionally use floats when
representing PIDs that are larger than most-positive-fixnum.
2006-04-08 15:07:35 +00:00
|
|
|
|
p->raw_status_new = 0;
|
2004-04-16 12:51:06 +00:00
|
|
|
|
p->status = Fcons (Qexit, Fcons (make_number (256), Qnil));
|
(struct Lisp_Process): Turn slots infd, outfd, kill_without_query, pty_flag,
tick, update_tick, decoding_carryover, inherit_coding_system_flag,
filter_multibyte, adaptive_read_buffering, read_output_delay, and
read_output_skip from Lisp_Objects to ints. Remove unused
encoding_carryover.
2007-07-12 06:36:57 +00:00
|
|
|
|
p->tick = ++process_tick;
|
1992-03-14 20:40:04 +00:00
|
|
|
|
deactivate_process (proc);
|
2004-04-16 12:51:06 +00:00
|
|
|
|
error ("SIGPIPE raised on process %s; closed it", SDATA (p->name));
|
1992-03-14 20:40:04 +00:00
|
|
|
|
}
|
1996-08-22 02:57:09 +00:00
|
|
|
|
|
|
|
|
|
UNGCPRO;
|
1992-03-14 20:40:04 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
DEFUN ("process-send-region", Fprocess_send_region, Sprocess_send_region,
|
2001-10-20 20:56:10 +00:00
|
|
|
|
3, 3, 0,
|
|
|
|
|
doc: /* Send current contents of region as input to PROCESS.
|
|
|
|
|
PROCESS may be a process, a buffer, the name of a process or buffer, or
|
|
|
|
|
nil, indicating the current buffer's process.
|
|
|
|
|
Called from program, takes three arguments, PROCESS, START and END.
|
|
|
|
|
If the region is more than 500 characters long,
|
|
|
|
|
it is sent in several bunches. This may happen even for shorter regions.
|
|
|
|
|
Output from processes can arrive in between bunches. */)
|
2010-07-08 14:25:08 -07:00
|
|
|
|
(Lisp_Object process, Lisp_Object start, Lisp_Object end)
|
1992-03-14 20:40:04 +00:00
|
|
|
|
{
|
|
|
|
|
Lisp_Object proc;
|
2007-02-27 11:03:46 +00:00
|
|
|
|
int start1, end1;
|
1992-03-14 20:40:04 +00:00
|
|
|
|
|
|
|
|
|
proc = get_process (process);
|
|
|
|
|
validate_region (&start, &end);
|
2007-02-27 11:03:46 +00:00
|
|
|
|
|
|
|
|
|
if (XINT (start) < GPT && XINT (end) > GPT)
|
|
|
|
|
move_gap (XINT (start));
|
|
|
|
|
|
|
|
|
|
start1 = CHAR_TO_BYTE (XINT (start));
|
|
|
|
|
end1 = CHAR_TO_BYTE (XINT (end));
|
|
|
|
|
send_process (proc, BYTE_POS_ADDR (start1), end1 - start1,
|
|
|
|
|
Fcurrent_buffer ());
|
|
|
|
|
|
1992-03-14 20:40:04 +00:00
|
|
|
|
return Qnil;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
DEFUN ("process-send-string", Fprocess_send_string, Sprocess_send_string,
|
2001-10-20 20:56:10 +00:00
|
|
|
|
2, 2, 0,
|
|
|
|
|
doc: /* Send PROCESS the contents of STRING as input.
|
|
|
|
|
PROCESS may be a process, a buffer, the name of a process or buffer, or
|
|
|
|
|
nil, indicating the current buffer's process.
|
|
|
|
|
If STRING is more than 500 characters long,
|
|
|
|
|
it is sent in several bunches. This may happen even for shorter strings.
|
|
|
|
|
Output from processes can arrive in between bunches. */)
|
2010-07-08 14:25:08 -07:00
|
|
|
|
(Lisp_Object process, Lisp_Object string)
|
1992-03-14 20:40:04 +00:00
|
|
|
|
{
|
|
|
|
|
Lisp_Object proc;
|
2001-11-02 20:46:55 +00:00
|
|
|
|
CHECK_STRING (string);
|
1992-03-14 20:40:04 +00:00
|
|
|
|
proc = get_process (process);
|
2007-02-27 11:03:46 +00:00
|
|
|
|
send_process (proc, SDATA (string),
|
|
|
|
|
SBYTES (string), string);
|
1992-03-14 20:40:04 +00:00
|
|
|
|
return Qnil;
|
|
|
|
|
}
|
|
|
|
|
|
2003-02-21 18:13:53 +00:00
|
|
|
|
/* Return the foreground process group for the tty/pty that
|
|
|
|
|
the process P uses. */
|
|
|
|
|
static int
|
2010-07-05 12:36:06 +02:00
|
|
|
|
emacs_get_tty_pgrp (struct Lisp_Process *p)
|
2003-02-21 18:13:53 +00:00
|
|
|
|
{
|
|
|
|
|
int gid = -1;
|
|
|
|
|
|
2004-05-08 16:11:42 +00:00
|
|
|
|
#ifdef TIOCGPGRP
|
(struct Lisp_Process): Turn slots infd, outfd, kill_without_query, pty_flag,
tick, update_tick, decoding_carryover, inherit_coding_system_flag,
filter_multibyte, adaptive_read_buffering, read_output_delay, and
read_output_skip from Lisp_Objects to ints. Remove unused
encoding_carryover.
2007-07-12 06:36:57 +00:00
|
|
|
|
if (ioctl (p->infd, TIOCGPGRP, &gid) == -1 && ! NILP (p->tty_name))
|
2003-02-21 18:13:53 +00:00
|
|
|
|
{
|
|
|
|
|
int fd;
|
|
|
|
|
/* Some OS:es (Solaris 8/9) does not allow TIOCGPGRP from the
|
|
|
|
|
master side. Try the slave side. */
|
2008-03-27 20:52:24 +00:00
|
|
|
|
fd = emacs_open (SDATA (p->tty_name), O_RDONLY, 0);
|
2003-02-21 18:13:53 +00:00
|
|
|
|
|
|
|
|
|
if (fd != -1)
|
|
|
|
|
{
|
|
|
|
|
ioctl (fd, TIOCGPGRP, &gid);
|
|
|
|
|
emacs_close (fd);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
#endif /* defined (TIOCGPGRP ) */
|
|
|
|
|
|
|
|
|
|
return gid;
|
|
|
|
|
}
|
|
|
|
|
|
1999-02-19 01:39:27 +00:00
|
|
|
|
DEFUN ("process-running-child-p", Fprocess_running_child_p,
|
|
|
|
|
Sprocess_running_child_p, 0, 1, 0,
|
2001-10-20 20:56:10 +00:00
|
|
|
|
doc: /* Return t if PROCESS has given the terminal to a child.
|
|
|
|
|
If the operating system does not make it possible to find out,
|
|
|
|
|
return t unconditionally. */)
|
2010-07-08 14:25:08 -07:00
|
|
|
|
(Lisp_Object process)
|
1999-02-19 01:39:27 +00:00
|
|
|
|
{
|
|
|
|
|
/* Initialize in case ioctl doesn't exist or gives an error,
|
|
|
|
|
in a way that will cause returning t. */
|
2003-02-21 18:13:53 +00:00
|
|
|
|
int gid;
|
1999-02-19 01:39:27 +00:00
|
|
|
|
Lisp_Object proc;
|
|
|
|
|
struct Lisp_Process *p;
|
|
|
|
|
|
|
|
|
|
proc = get_process (process);
|
|
|
|
|
p = XPROCESS (proc);
|
|
|
|
|
|
Daniel Engeler <engeler at gmail.com>
These changes add serial port access.
* process.c: Add HAVE_SERIAL.
(Fdelete_process, Fprocess_status, Fset_process_buffer)
(Fset_process_filter, Fset_process_sentinel, Fprocess_contact)
(list_processes_1, select_wrapper, Fstop_process)
(Fcontinue_process, Fprocess_send_eof, kill_buffer_processes)
(status_notify): Modify to handle serial processes.
[HAVE_SERIAL] (Fserial_process_configure)
[HAVE_SERIAL] (make_serial_process_unwind, Fmake_serial_process):
New functions.
* process.h (struct Lisp_Process): Add `type'.
* sysdep.c [HAVE_TERMIOS] (serial_open, serial_configure):
New functions.
* w32.c (_sys_read_ahead, sys_read, sys_write): Modify to handle serial ports.
(serial_open, serial_configure) New functions.
* w32.h: Add FILE_SERIAL.
(struct _child_process): Add ovl_read, ovl_write.
2008-06-13 08:08:20 +00:00
|
|
|
|
if (!EQ (p->type, Qreal))
|
1999-02-19 01:39:27 +00:00
|
|
|
|
error ("Process %s is not a subprocess",
|
2002-07-15 00:01:34 +00:00
|
|
|
|
SDATA (p->name));
|
(struct Lisp_Process): Turn slots infd, outfd, kill_without_query, pty_flag,
tick, update_tick, decoding_carryover, inherit_coding_system_flag,
filter_multibyte, adaptive_read_buffering, read_output_delay, and
read_output_skip from Lisp_Objects to ints. Remove unused
encoding_carryover.
2007-07-12 06:36:57 +00:00
|
|
|
|
if (p->infd < 0)
|
1999-02-19 01:39:27 +00:00
|
|
|
|
error ("Process %s is not active",
|
2002-07-15 00:01:34 +00:00
|
|
|
|
SDATA (p->name));
|
1999-02-19 01:39:27 +00:00
|
|
|
|
|
2003-02-21 18:13:53 +00:00
|
|
|
|
gid = emacs_get_tty_pgrp (p);
|
1999-02-19 01:39:27 +00:00
|
|
|
|
|
* process.h (struct Lisp_Process): Replace Lisp_Objects `pid',
`raw_status_high', and `raw_status_low' with plain integers, and move
them to the end of the structure.
* alloc.c (allocate_process): Use PSEUDOVECSIZE to initialize the
pseudovector's size field so only the Lisp_Object fields get GC'd.
* process.c (update_status, make_process, Fdelete_process)
(Fprocess_status, list_processes_1, start_process_unwind)
(create_process, Fmake_network_process, server_accept_connection)
(wait_reading_process_output, send_process, Fprocess_running_child_p)
(process_send_signal, proc_encode_coding_system, Fprocess_send_eof)
(sigchld_handler, status_notify): Adjust to new non-Lisp fields for
`pid' and `raw_status'.
(Fprocess_id, Fsignal_process): Same, and additionally use floats when
representing PIDs that are larger than most-positive-fixnum.
2006-04-08 15:07:35 +00:00
|
|
|
|
if (gid == p->pid)
|
1999-02-19 01:39:27 +00:00
|
|
|
|
return Qnil;
|
|
|
|
|
return Qt;
|
|
|
|
|
}
|
|
|
|
|
|
1992-03-14 20:40:04 +00:00
|
|
|
|
/* send a signal number SIGNO to PROCESS.
|
1999-02-19 01:39:27 +00:00
|
|
|
|
If CURRENT_GROUP is t, that means send to the process group
|
|
|
|
|
that currently owns the terminal being used to communicate with PROCESS.
|
1992-03-14 20:40:04 +00:00
|
|
|
|
This is used for various commands in shell mode.
|
1999-02-19 01:39:27 +00:00
|
|
|
|
If CURRENT_GROUP is lambda, that means send to the process group
|
|
|
|
|
that currently owns the terminal, but only if it is NOT the shell itself.
|
|
|
|
|
|
1992-03-14 20:40:04 +00:00
|
|
|
|
If NOMSG is zero, insert signal-announcements into process's buffers
|
* systty.h, process.c, buffer.h, callproc.c, sysdep.c, dired.c:
Added VMS changes from Roland Roberts.
* process.c (read_process_output): Save, widen, insert the process
output, and then restore the restriction if inserting text outside
the visible region.
* process.c (Fstart_process): Establish an unwind-protect to
remove PROC from the process list if an error occurs while
starting it.
(start_process_unwind): New function to help with that.
(create_process): There's no need to explicitly call
remove_process if the fork fails; the record_unwind_protect in
Fstart_process will take care of it.
* process.c (wait_reading_process_input): Test the C preprocessor
symbol "ultrix", not "__ultrix__" to see if we should ignore
ENOMEM errors from select.
* process.c (process_send_signal): On systems which have both
the TIOCGETC and TCGETA ioctls, just use the former.
* s/bsd4-2.h, s/bsd4-3.h: #define SIGNALS_VIA_CHARACTERS.
* process.c (process_send_signal): Put all the code for sending
signals via characters in a #ifdef SIGNALS_VIA_CHARACTERS. Decide
whether to use the Berkeley-style or SYSV-style ioctls by seeing
which ioctl commands are #defined.
* process.c (process_send_signal): Doc fix.
1992-11-16 00:53:26 +00:00
|
|
|
|
right away.
|
|
|
|
|
|
|
|
|
|
If we can, we try to signal PROCESS by sending control characters
|
1994-04-30 06:05:51 +00:00
|
|
|
|
down the pty. This allows us to signal inferiors who have changed
|
* systty.h, process.c, buffer.h, callproc.c, sysdep.c, dired.c:
Added VMS changes from Roland Roberts.
* process.c (read_process_output): Save, widen, insert the process
output, and then restore the restriction if inserting text outside
the visible region.
* process.c (Fstart_process): Establish an unwind-protect to
remove PROC from the process list if an error occurs while
starting it.
(start_process_unwind): New function to help with that.
(create_process): There's no need to explicitly call
remove_process if the fork fails; the record_unwind_protect in
Fstart_process will take care of it.
* process.c (wait_reading_process_input): Test the C preprocessor
symbol "ultrix", not "__ultrix__" to see if we should ignore
ENOMEM errors from select.
* process.c (process_send_signal): On systems which have both
the TIOCGETC and TCGETA ioctls, just use the former.
* s/bsd4-2.h, s/bsd4-3.h: #define SIGNALS_VIA_CHARACTERS.
* process.c (process_send_signal): Put all the code for sending
signals via characters in a #ifdef SIGNALS_VIA_CHARACTERS. Decide
whether to use the Berkeley-style or SYSV-style ioctls by seeing
which ioctl commands are #defined.
* process.c (process_send_signal): Doc fix.
1992-11-16 00:53:26 +00:00
|
|
|
|
their uid, for which killpg would return an EPERM error. */
|
1992-03-14 20:40:04 +00:00
|
|
|
|
|
1992-10-31 05:27:42 +00:00
|
|
|
|
static void
|
2010-07-05 12:36:06 +02:00
|
|
|
|
process_send_signal (Lisp_Object process, int signo, Lisp_Object current_group,
|
|
|
|
|
int nomsg)
|
1992-03-14 20:40:04 +00:00
|
|
|
|
{
|
|
|
|
|
Lisp_Object proc;
|
|
|
|
|
register struct Lisp_Process *p;
|
|
|
|
|
int gid;
|
|
|
|
|
int no_pgrp = 0;
|
|
|
|
|
|
|
|
|
|
proc = get_process (process);
|
|
|
|
|
p = XPROCESS (proc);
|
|
|
|
|
|
Daniel Engeler <engeler at gmail.com>
These changes add serial port access.
* process.c: Add HAVE_SERIAL.
(Fdelete_process, Fprocess_status, Fset_process_buffer)
(Fset_process_filter, Fset_process_sentinel, Fprocess_contact)
(list_processes_1, select_wrapper, Fstop_process)
(Fcontinue_process, Fprocess_send_eof, kill_buffer_processes)
(status_notify): Modify to handle serial processes.
[HAVE_SERIAL] (Fserial_process_configure)
[HAVE_SERIAL] (make_serial_process_unwind, Fmake_serial_process):
New functions.
* process.h (struct Lisp_Process): Add `type'.
* sysdep.c [HAVE_TERMIOS] (serial_open, serial_configure):
New functions.
* w32.c (_sys_read_ahead, sys_read, sys_write): Modify to handle serial ports.
(serial_open, serial_configure) New functions.
* w32.h: Add FILE_SERIAL.
(struct _child_process): Add ovl_read, ovl_write.
2008-06-13 08:08:20 +00:00
|
|
|
|
if (!EQ (p->type, Qreal))
|
1992-03-14 20:40:04 +00:00
|
|
|
|
error ("Process %s is not a subprocess",
|
2002-07-15 00:01:34 +00:00
|
|
|
|
SDATA (p->name));
|
(struct Lisp_Process): Turn slots infd, outfd, kill_without_query, pty_flag,
tick, update_tick, decoding_carryover, inherit_coding_system_flag,
filter_multibyte, adaptive_read_buffering, read_output_delay, and
read_output_skip from Lisp_Objects to ints. Remove unused
encoding_carryover.
2007-07-12 06:36:57 +00:00
|
|
|
|
if (p->infd < 0)
|
1992-03-14 20:40:04 +00:00
|
|
|
|
error ("Process %s is not active",
|
2002-07-15 00:01:34 +00:00
|
|
|
|
SDATA (p->name));
|
1992-03-14 20:40:04 +00:00
|
|
|
|
|
(struct Lisp_Process): Turn slots infd, outfd, kill_without_query, pty_flag,
tick, update_tick, decoding_carryover, inherit_coding_system_flag,
filter_multibyte, adaptive_read_buffering, read_output_delay, and
read_output_skip from Lisp_Objects to ints. Remove unused
encoding_carryover.
2007-07-12 06:36:57 +00:00
|
|
|
|
if (!p->pty_flag)
|
1992-03-14 20:40:04 +00:00
|
|
|
|
current_group = Qnil;
|
|
|
|
|
|
|
|
|
|
/* If we are using pgrps, get a pgrp number and make it negative. */
|
2002-07-16 13:41:16 +00:00
|
|
|
|
if (NILP (current_group))
|
|
|
|
|
/* Send the signal to the shell's process group. */
|
* process.h (struct Lisp_Process): Replace Lisp_Objects `pid',
`raw_status_high', and `raw_status_low' with plain integers, and move
them to the end of the structure.
* alloc.c (allocate_process): Use PSEUDOVECSIZE to initialize the
pseudovector's size field so only the Lisp_Object fields get GC'd.
* process.c (update_status, make_process, Fdelete_process)
(Fprocess_status, list_processes_1, start_process_unwind)
(create_process, Fmake_network_process, server_accept_connection)
(wait_reading_process_output, send_process, Fprocess_running_child_p)
(process_send_signal, proc_encode_coding_system, Fprocess_send_eof)
(sigchld_handler, status_notify): Adjust to new non-Lisp fields for
`pid' and `raw_status'.
(Fprocess_id, Fsignal_process): Same, and additionally use floats when
representing PIDs that are larger than most-positive-fixnum.
2006-04-08 15:07:35 +00:00
|
|
|
|
gid = p->pid;
|
2002-07-16 13:41:16 +00:00
|
|
|
|
else
|
1992-03-14 20:40:04 +00:00
|
|
|
|
{
|
* systty.h, process.c, buffer.h, callproc.c, sysdep.c, dired.c:
Added VMS changes from Roland Roberts.
* process.c (read_process_output): Save, widen, insert the process
output, and then restore the restriction if inserting text outside
the visible region.
* process.c (Fstart_process): Establish an unwind-protect to
remove PROC from the process list if an error occurs while
starting it.
(start_process_unwind): New function to help with that.
(create_process): There's no need to explicitly call
remove_process if the fork fails; the record_unwind_protect in
Fstart_process will take care of it.
* process.c (wait_reading_process_input): Test the C preprocessor
symbol "ultrix", not "__ultrix__" to see if we should ignore
ENOMEM errors from select.
* process.c (process_send_signal): On systems which have both
the TIOCGETC and TCGETA ioctls, just use the former.
* s/bsd4-2.h, s/bsd4-3.h: #define SIGNALS_VIA_CHARACTERS.
* process.c (process_send_signal): Put all the code for sending
signals via characters in a #ifdef SIGNALS_VIA_CHARACTERS. Decide
whether to use the Berkeley-style or SYSV-style ioctls by seeing
which ioctl commands are #defined.
* process.c (process_send_signal): Doc fix.
1992-11-16 00:53:26 +00:00
|
|
|
|
#ifdef SIGNALS_VIA_CHARACTERS
|
1992-03-14 20:40:04 +00:00
|
|
|
|
/* If possible, send signals to the entire pgrp
|
|
|
|
|
by sending an input character to it. */
|
* systty.h, process.c, buffer.h, callproc.c, sysdep.c, dired.c:
Added VMS changes from Roland Roberts.
* process.c (read_process_output): Save, widen, insert the process
output, and then restore the restriction if inserting text outside
the visible region.
* process.c (Fstart_process): Establish an unwind-protect to
remove PROC from the process list if an error occurs while
starting it.
(start_process_unwind): New function to help with that.
(create_process): There's no need to explicitly call
remove_process if the fork fails; the record_unwind_protect in
Fstart_process will take care of it.
* process.c (wait_reading_process_input): Test the C preprocessor
symbol "ultrix", not "__ultrix__" to see if we should ignore
ENOMEM errors from select.
* process.c (process_send_signal): On systems which have both
the TIOCGETC and TCGETA ioctls, just use the former.
* s/bsd4-2.h, s/bsd4-3.h: #define SIGNALS_VIA_CHARACTERS.
* process.c (process_send_signal): Put all the code for sending
signals via characters in a #ifdef SIGNALS_VIA_CHARACTERS. Decide
whether to use the Berkeley-style or SYSV-style ioctls by seeing
which ioctl commands are #defined.
* process.c (process_send_signal): Doc fix.
1992-11-16 00:53:26 +00:00
|
|
|
|
|
1993-02-22 14:47:53 +00:00
|
|
|
|
/* TERMIOS is the latest and bestest, and seems most likely to
|
2009-01-01 15:58:38 +00:00
|
|
|
|
work. If the system has it, use it. */
|
1993-02-22 14:47:53 +00:00
|
|
|
|
#ifdef HAVE_TERMIOS
|
|
|
|
|
struct termios t;
|
2004-08-16 22:57:26 +00:00
|
|
|
|
cc_t *sig_char = NULL;
|
|
|
|
|
|
(struct Lisp_Process): Turn slots infd, outfd, kill_without_query, pty_flag,
tick, update_tick, decoding_carryover, inherit_coding_system_flag,
filter_multibyte, adaptive_read_buffering, read_output_delay, and
read_output_skip from Lisp_Objects to ints. Remove unused
encoding_carryover.
2007-07-12 06:36:57 +00:00
|
|
|
|
tcgetattr (p->infd, &t);
|
1993-02-22 14:47:53 +00:00
|
|
|
|
|
|
|
|
|
switch (signo)
|
|
|
|
|
{
|
|
|
|
|
case SIGINT:
|
2004-08-16 22:57:26 +00:00
|
|
|
|
sig_char = &t.c_cc[VINTR];
|
|
|
|
|
break;
|
1993-02-22 14:47:53 +00:00
|
|
|
|
|
|
|
|
|
case SIGQUIT:
|
2004-08-16 22:57:26 +00:00
|
|
|
|
sig_char = &t.c_cc[VQUIT];
|
|
|
|
|
break;
|
1993-02-22 14:47:53 +00:00
|
|
|
|
|
|
|
|
|
case SIGTSTP:
|
1994-05-09 03:30:55 +00:00
|
|
|
|
#if defined (VSWTCH) && !defined (PREFER_VSUSP)
|
2004-08-16 22:57:26 +00:00
|
|
|
|
sig_char = &t.c_cc[VSWTCH];
|
1993-02-22 14:47:53 +00:00
|
|
|
|
#else
|
2004-08-16 22:57:26 +00:00
|
|
|
|
sig_char = &t.c_cc[VSUSP];
|
1993-02-22 14:47:53 +00:00
|
|
|
|
#endif
|
2004-08-16 22:57:26 +00:00
|
|
|
|
break;
|
1993-02-22 14:47:53 +00:00
|
|
|
|
}
|
|
|
|
|
|
2004-08-19 10:08:00 +00:00
|
|
|
|
if (sig_char && *sig_char != CDISABLE)
|
2004-08-22 17:45:36 +00:00
|
|
|
|
{
|
|
|
|
|
send_process (proc, sig_char, 1, Qnil);
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
/* If we can't send the signal with a character,
|
|
|
|
|
fall through and send it another way. */
|
1993-02-22 14:47:53 +00:00
|
|
|
|
#else /* ! HAVE_TERMIOS */
|
|
|
|
|
|
* systty.h, process.c, buffer.h, callproc.c, sysdep.c, dired.c:
Added VMS changes from Roland Roberts.
* process.c (read_process_output): Save, widen, insert the process
output, and then restore the restriction if inserting text outside
the visible region.
* process.c (Fstart_process): Establish an unwind-protect to
remove PROC from the process list if an error occurs while
starting it.
(start_process_unwind): New function to help with that.
(create_process): There's no need to explicitly call
remove_process if the fork fails; the record_unwind_protect in
Fstart_process will take care of it.
* process.c (wait_reading_process_input): Test the C preprocessor
symbol "ultrix", not "__ultrix__" to see if we should ignore
ENOMEM errors from select.
* process.c (process_send_signal): On systems which have both
the TIOCGETC and TCGETA ioctls, just use the former.
* s/bsd4-2.h, s/bsd4-3.h: #define SIGNALS_VIA_CHARACTERS.
* process.c (process_send_signal): Put all the code for sending
signals via characters in a #ifdef SIGNALS_VIA_CHARACTERS. Decide
whether to use the Berkeley-style or SYSV-style ioctls by seeing
which ioctl commands are #defined.
* process.c (process_send_signal): Doc fix.
1992-11-16 00:53:26 +00:00
|
|
|
|
/* On Berkeley descendants, the following IOCTL's retrieve the
|
|
|
|
|
current control characters. */
|
1992-03-14 20:40:04 +00:00
|
|
|
|
#if defined (TIOCGLTC) && defined (TIOCGETC)
|
* systty.h, process.c, buffer.h, callproc.c, sysdep.c, dired.c:
Added VMS changes from Roland Roberts.
* process.c (read_process_output): Save, widen, insert the process
output, and then restore the restriction if inserting text outside
the visible region.
* process.c (Fstart_process): Establish an unwind-protect to
remove PROC from the process list if an error occurs while
starting it.
(start_process_unwind): New function to help with that.
(create_process): There's no need to explicitly call
remove_process if the fork fails; the record_unwind_protect in
Fstart_process will take care of it.
* process.c (wait_reading_process_input): Test the C preprocessor
symbol "ultrix", not "__ultrix__" to see if we should ignore
ENOMEM errors from select.
* process.c (process_send_signal): On systems which have both
the TIOCGETC and TCGETA ioctls, just use the former.
* s/bsd4-2.h, s/bsd4-3.h: #define SIGNALS_VIA_CHARACTERS.
* process.c (process_send_signal): Put all the code for sending
signals via characters in a #ifdef SIGNALS_VIA_CHARACTERS. Decide
whether to use the Berkeley-style or SYSV-style ioctls by seeing
which ioctl commands are #defined.
* process.c (process_send_signal): Doc fix.
1992-11-16 00:53:26 +00:00
|
|
|
|
|
1992-03-14 20:40:04 +00:00
|
|
|
|
struct tchars c;
|
|
|
|
|
struct ltchars lc;
|
|
|
|
|
|
|
|
|
|
switch (signo)
|
|
|
|
|
{
|
|
|
|
|
case SIGINT:
|
(struct Lisp_Process): Turn slots infd, outfd, kill_without_query, pty_flag,
tick, update_tick, decoding_carryover, inherit_coding_system_flag,
filter_multibyte, adaptive_read_buffering, read_output_delay, and
read_output_skip from Lisp_Objects to ints. Remove unused
encoding_carryover.
2007-07-12 06:36:57 +00:00
|
|
|
|
ioctl (p->infd, TIOCGETC, &c);
|
1994-06-25 22:35:28 +00:00
|
|
|
|
send_process (proc, &c.t_intrc, 1, Qnil);
|
1992-10-31 05:27:42 +00:00
|
|
|
|
return;
|
1992-03-14 20:40:04 +00:00
|
|
|
|
case SIGQUIT:
|
(struct Lisp_Process): Turn slots infd, outfd, kill_without_query, pty_flag,
tick, update_tick, decoding_carryover, inherit_coding_system_flag,
filter_multibyte, adaptive_read_buffering, read_output_delay, and
read_output_skip from Lisp_Objects to ints. Remove unused
encoding_carryover.
2007-07-12 06:36:57 +00:00
|
|
|
|
ioctl (p->infd, TIOCGETC, &c);
|
1994-06-25 22:35:28 +00:00
|
|
|
|
send_process (proc, &c.t_quitc, 1, Qnil);
|
1992-10-31 05:27:42 +00:00
|
|
|
|
return;
|
1992-08-19 06:35:23 +00:00
|
|
|
|
#ifdef SIGTSTP
|
1992-03-14 20:40:04 +00:00
|
|
|
|
case SIGTSTP:
|
(struct Lisp_Process): Turn slots infd, outfd, kill_without_query, pty_flag,
tick, update_tick, decoding_carryover, inherit_coding_system_flag,
filter_multibyte, adaptive_read_buffering, read_output_delay, and
read_output_skip from Lisp_Objects to ints. Remove unused
encoding_carryover.
2007-07-12 06:36:57 +00:00
|
|
|
|
ioctl (p->infd, TIOCGLTC, &lc);
|
1994-06-25 22:35:28 +00:00
|
|
|
|
send_process (proc, &lc.t_suspc, 1, Qnil);
|
1992-10-31 05:27:42 +00:00
|
|
|
|
return;
|
* systty.h, process.c, buffer.h, callproc.c, sysdep.c, dired.c:
Added VMS changes from Roland Roberts.
* process.c (read_process_output): Save, widen, insert the process
output, and then restore the restriction if inserting text outside
the visible region.
* process.c (Fstart_process): Establish an unwind-protect to
remove PROC from the process list if an error occurs while
starting it.
(start_process_unwind): New function to help with that.
(create_process): There's no need to explicitly call
remove_process if the fork fails; the record_unwind_protect in
Fstart_process will take care of it.
* process.c (wait_reading_process_input): Test the C preprocessor
symbol "ultrix", not "__ultrix__" to see if we should ignore
ENOMEM errors from select.
* process.c (process_send_signal): On systems which have both
the TIOCGETC and TCGETA ioctls, just use the former.
* s/bsd4-2.h, s/bsd4-3.h: #define SIGNALS_VIA_CHARACTERS.
* process.c (process_send_signal): Put all the code for sending
signals via characters in a #ifdef SIGNALS_VIA_CHARACTERS. Decide
whether to use the Berkeley-style or SYSV-style ioctls by seeing
which ioctl commands are #defined.
* process.c (process_send_signal): Doc fix.
1992-11-16 00:53:26 +00:00
|
|
|
|
#endif /* ! defined (SIGTSTP) */
|
1992-03-14 20:40:04 +00:00
|
|
|
|
}
|
* systty.h, process.c, buffer.h, callproc.c, sysdep.c, dired.c:
Added VMS changes from Roland Roberts.
* process.c (read_process_output): Save, widen, insert the process
output, and then restore the restriction if inserting text outside
the visible region.
* process.c (Fstart_process): Establish an unwind-protect to
remove PROC from the process list if an error occurs while
starting it.
(start_process_unwind): New function to help with that.
(create_process): There's no need to explicitly call
remove_process if the fork fails; the record_unwind_protect in
Fstart_process will take care of it.
* process.c (wait_reading_process_input): Test the C preprocessor
symbol "ultrix", not "__ultrix__" to see if we should ignore
ENOMEM errors from select.
* process.c (process_send_signal): On systems which have both
the TIOCGETC and TCGETA ioctls, just use the former.
* s/bsd4-2.h, s/bsd4-3.h: #define SIGNALS_VIA_CHARACTERS.
* process.c (process_send_signal): Put all the code for sending
signals via characters in a #ifdef SIGNALS_VIA_CHARACTERS. Decide
whether to use the Berkeley-style or SYSV-style ioctls by seeing
which ioctl commands are #defined.
* process.c (process_send_signal): Doc fix.
1992-11-16 00:53:26 +00:00
|
|
|
|
|
|
|
|
|
#else /* ! defined (TIOCGLTC) && defined (TIOCGETC) */
|
|
|
|
|
|
|
|
|
|
/* On SYSV descendants, the TCGETA ioctl retrieves the current control
|
|
|
|
|
characters. */
|
|
|
|
|
#ifdef TCGETA
|
1992-03-14 20:40:04 +00:00
|
|
|
|
struct termio t;
|
|
|
|
|
switch (signo)
|
|
|
|
|
{
|
|
|
|
|
case SIGINT:
|
(struct Lisp_Process): Turn slots infd, outfd, kill_without_query, pty_flag,
tick, update_tick, decoding_carryover, inherit_coding_system_flag,
filter_multibyte, adaptive_read_buffering, read_output_delay, and
read_output_skip from Lisp_Objects to ints. Remove unused
encoding_carryover.
2007-07-12 06:36:57 +00:00
|
|
|
|
ioctl (p->infd, TCGETA, &t);
|
1994-06-25 22:35:28 +00:00
|
|
|
|
send_process (proc, &t.c_cc[VINTR], 1, Qnil);
|
1992-10-31 05:27:42 +00:00
|
|
|
|
return;
|
1992-03-14 20:40:04 +00:00
|
|
|
|
case SIGQUIT:
|
(struct Lisp_Process): Turn slots infd, outfd, kill_without_query, pty_flag,
tick, update_tick, decoding_carryover, inherit_coding_system_flag,
filter_multibyte, adaptive_read_buffering, read_output_delay, and
read_output_skip from Lisp_Objects to ints. Remove unused
encoding_carryover.
2007-07-12 06:36:57 +00:00
|
|
|
|
ioctl (p->infd, TCGETA, &t);
|
1994-06-25 22:35:28 +00:00
|
|
|
|
send_process (proc, &t.c_cc[VQUIT], 1, Qnil);
|
1992-10-31 05:27:42 +00:00
|
|
|
|
return;
|
1992-11-07 07:36:10 +00:00
|
|
|
|
#ifdef SIGTSTP
|
1992-03-14 20:40:04 +00:00
|
|
|
|
case SIGTSTP:
|
(struct Lisp_Process): Turn slots infd, outfd, kill_without_query, pty_flag,
tick, update_tick, decoding_carryover, inherit_coding_system_flag,
filter_multibyte, adaptive_read_buffering, read_output_delay, and
read_output_skip from Lisp_Objects to ints. Remove unused
encoding_carryover.
2007-07-12 06:36:57 +00:00
|
|
|
|
ioctl (p->infd, TCGETA, &t);
|
1994-06-25 22:35:28 +00:00
|
|
|
|
send_process (proc, &t.c_cc[VSWTCH], 1, Qnil);
|
1992-10-31 05:27:42 +00:00
|
|
|
|
return;
|
* systty.h, process.c, buffer.h, callproc.c, sysdep.c, dired.c:
Added VMS changes from Roland Roberts.
* process.c (read_process_output): Save, widen, insert the process
output, and then restore the restriction if inserting text outside
the visible region.
* process.c (Fstart_process): Establish an unwind-protect to
remove PROC from the process list if an error occurs while
starting it.
(start_process_unwind): New function to help with that.
(create_process): There's no need to explicitly call
remove_process if the fork fails; the record_unwind_protect in
Fstart_process will take care of it.
* process.c (wait_reading_process_input): Test the C preprocessor
symbol "ultrix", not "__ultrix__" to see if we should ignore
ENOMEM errors from select.
* process.c (process_send_signal): On systems which have both
the TIOCGETC and TCGETA ioctls, just use the former.
* s/bsd4-2.h, s/bsd4-3.h: #define SIGNALS_VIA_CHARACTERS.
* process.c (process_send_signal): Put all the code for sending
signals via characters in a #ifdef SIGNALS_VIA_CHARACTERS. Decide
whether to use the Berkeley-style or SYSV-style ioctls by seeing
which ioctl commands are #defined.
* process.c (process_send_signal): Doc fix.
1992-11-16 00:53:26 +00:00
|
|
|
|
#endif /* ! defined (SIGTSTP) */
|
1992-03-14 20:40:04 +00:00
|
|
|
|
}
|
* systty.h, process.c, buffer.h, callproc.c, sysdep.c, dired.c:
Added VMS changes from Roland Roberts.
* process.c (read_process_output): Save, widen, insert the process
output, and then restore the restriction if inserting text outside
the visible region.
* process.c (Fstart_process): Establish an unwind-protect to
remove PROC from the process list if an error occurs while
starting it.
(start_process_unwind): New function to help with that.
(create_process): There's no need to explicitly call
remove_process if the fork fails; the record_unwind_protect in
Fstart_process will take care of it.
* process.c (wait_reading_process_input): Test the C preprocessor
symbol "ultrix", not "__ultrix__" to see if we should ignore
ENOMEM errors from select.
* process.c (process_send_signal): On systems which have both
the TIOCGETC and TCGETA ioctls, just use the former.
* s/bsd4-2.h, s/bsd4-3.h: #define SIGNALS_VIA_CHARACTERS.
* process.c (process_send_signal): Put all the code for sending
signals via characters in a #ifdef SIGNALS_VIA_CHARACTERS. Decide
whether to use the Berkeley-style or SYSV-style ioctls by seeing
which ioctl commands are #defined.
* process.c (process_send_signal): Doc fix.
1992-11-16 00:53:26 +00:00
|
|
|
|
#else /* ! defined (TCGETA) */
|
|
|
|
|
Your configuration files are messed up.
|
|
|
|
|
/* If your system configuration files define SIGNALS_VIA_CHARACTERS,
|
|
|
|
|
you'd better be using one of the alternatives above! */
|
|
|
|
|
#endif /* ! defined (TCGETA) */
|
|
|
|
|
#endif /* ! defined (TIOCGLTC) && defined (TIOCGETC) */
|
2008-03-27 20:52:24 +00:00
|
|
|
|
/* In this case, the code above should alway return. */
|
2002-07-12 11:13:47 +00:00
|
|
|
|
abort ();
|
2004-08-22 17:45:36 +00:00
|
|
|
|
#endif /* ! defined HAVE_TERMIOS */
|
|
|
|
|
|
|
|
|
|
/* The code above may fall through if it can't
|
|
|
|
|
handle the signal. */
|
2002-07-12 11:13:47 +00:00
|
|
|
|
#endif /* defined (SIGNALS_VIA_CHARACTERS) */
|
1992-03-14 20:40:04 +00:00
|
|
|
|
|
2003-02-04 14:56:31 +00:00
|
|
|
|
#ifdef TIOCGPGRP
|
2002-07-16 13:41:16 +00:00
|
|
|
|
/* Get the current pgrp using the tty itself, if we have that.
|
1992-03-14 20:40:04 +00:00
|
|
|
|
Otherwise, use the pty to get the pgrp.
|
|
|
|
|
On pfa systems, saka@pfu.fujitsu.co.JP writes:
|
* systty.h, process.c, buffer.h, callproc.c, sysdep.c, dired.c:
Added VMS changes from Roland Roberts.
* process.c (read_process_output): Save, widen, insert the process
output, and then restore the restriction if inserting text outside
the visible region.
* process.c (Fstart_process): Establish an unwind-protect to
remove PROC from the process list if an error occurs while
starting it.
(start_process_unwind): New function to help with that.
(create_process): There's no need to explicitly call
remove_process if the fork fails; the record_unwind_protect in
Fstart_process will take care of it.
* process.c (wait_reading_process_input): Test the C preprocessor
symbol "ultrix", not "__ultrix__" to see if we should ignore
ENOMEM errors from select.
* process.c (process_send_signal): On systems which have both
the TIOCGETC and TCGETA ioctls, just use the former.
* s/bsd4-2.h, s/bsd4-3.h: #define SIGNALS_VIA_CHARACTERS.
* process.c (process_send_signal): Put all the code for sending
signals via characters in a #ifdef SIGNALS_VIA_CHARACTERS. Decide
whether to use the Berkeley-style or SYSV-style ioctls by seeing
which ioctl commands are #defined.
* process.c (process_send_signal): Doc fix.
1992-11-16 00:53:26 +00:00
|
|
|
|
"TIOCGPGRP symbol defined in sys/ioctl.h at E50.
|
|
|
|
|
But, TIOCGPGRP does not work on E50 ;-P works fine on E60"
|
1992-03-14 20:40:04 +00:00
|
|
|
|
His patch indicates that if TIOCGPGRP returns an error, then
|
|
|
|
|
we should just assume that p->pid is also the process group id. */
|
|
|
|
|
|
2003-02-21 18:13:53 +00:00
|
|
|
|
gid = emacs_get_tty_pgrp (p);
|
2004-05-08 16:11:42 +00:00
|
|
|
|
|
2003-02-21 18:13:53 +00:00
|
|
|
|
if (gid == -1)
|
|
|
|
|
/* If we can't get the information, assume
|
|
|
|
|
the shell owns the tty. */
|
* process.h (struct Lisp_Process): Replace Lisp_Objects `pid',
`raw_status_high', and `raw_status_low' with plain integers, and move
them to the end of the structure.
* alloc.c (allocate_process): Use PSEUDOVECSIZE to initialize the
pseudovector's size field so only the Lisp_Object fields get GC'd.
* process.c (update_status, make_process, Fdelete_process)
(Fprocess_status, list_processes_1, start_process_unwind)
(create_process, Fmake_network_process, server_accept_connection)
(wait_reading_process_output, send_process, Fprocess_running_child_p)
(process_send_signal, proc_encode_coding_system, Fprocess_send_eof)
(sigchld_handler, status_notify): Adjust to new non-Lisp fields for
`pid' and `raw_status'.
(Fprocess_id, Fsignal_process): Same, and additionally use floats when
representing PIDs that are larger than most-positive-fixnum.
2006-04-08 15:07:35 +00:00
|
|
|
|
gid = p->pid;
|
2002-07-16 13:41:16 +00:00
|
|
|
|
|
|
|
|
|
/* It is not clear whether anything really can set GID to -1.
|
|
|
|
|
Perhaps on some system one of those ioctls can or could do so.
|
|
|
|
|
Or perhaps this is vestigial. */
|
1992-03-14 20:40:04 +00:00
|
|
|
|
if (gid == -1)
|
|
|
|
|
no_pgrp = 1;
|
* systty.h, process.c, buffer.h, callproc.c, sysdep.c, dired.c:
Added VMS changes from Roland Roberts.
* process.c (read_process_output): Save, widen, insert the process
output, and then restore the restriction if inserting text outside
the visible region.
* process.c (Fstart_process): Establish an unwind-protect to
remove PROC from the process list if an error occurs while
starting it.
(start_process_unwind): New function to help with that.
(create_process): There's no need to explicitly call
remove_process if the fork fails; the record_unwind_protect in
Fstart_process will take care of it.
* process.c (wait_reading_process_input): Test the C preprocessor
symbol "ultrix", not "__ultrix__" to see if we should ignore
ENOMEM errors from select.
* process.c (process_send_signal): On systems which have both
the TIOCGETC and TCGETA ioctls, just use the former.
* s/bsd4-2.h, s/bsd4-3.h: #define SIGNALS_VIA_CHARACTERS.
* process.c (process_send_signal): Put all the code for sending
signals via characters in a #ifdef SIGNALS_VIA_CHARACTERS. Decide
whether to use the Berkeley-style or SYSV-style ioctls by seeing
which ioctl commands are #defined.
* process.c (process_send_signal): Doc fix.
1992-11-16 00:53:26 +00:00
|
|
|
|
#else /* ! defined (TIOCGPGRP ) */
|
1992-07-22 18:20:35 +00:00
|
|
|
|
/* Can't select pgrps on this system, so we know that
|
|
|
|
|
the child itself heads the pgrp. */
|
* process.h (struct Lisp_Process): Replace Lisp_Objects `pid',
`raw_status_high', and `raw_status_low' with plain integers, and move
them to the end of the structure.
* alloc.c (allocate_process): Use PSEUDOVECSIZE to initialize the
pseudovector's size field so only the Lisp_Object fields get GC'd.
* process.c (update_status, make_process, Fdelete_process)
(Fprocess_status, list_processes_1, start_process_unwind)
(create_process, Fmake_network_process, server_accept_connection)
(wait_reading_process_output, send_process, Fprocess_running_child_p)
(process_send_signal, proc_encode_coding_system, Fprocess_send_eof)
(sigchld_handler, status_notify): Adjust to new non-Lisp fields for
`pid' and `raw_status'.
(Fprocess_id, Fsignal_process): Same, and additionally use floats when
representing PIDs that are larger than most-positive-fixnum.
2006-04-08 15:07:35 +00:00
|
|
|
|
gid = p->pid;
|
1992-07-22 18:20:35 +00:00
|
|
|
|
#endif /* ! defined (TIOCGPGRP ) */
|
1999-02-19 01:39:27 +00:00
|
|
|
|
|
|
|
|
|
/* If current_group is lambda, and the shell owns the terminal,
|
|
|
|
|
don't send any signal. */
|
* process.h (struct Lisp_Process): Replace Lisp_Objects `pid',
`raw_status_high', and `raw_status_low' with plain integers, and move
them to the end of the structure.
* alloc.c (allocate_process): Use PSEUDOVECSIZE to initialize the
pseudovector's size field so only the Lisp_Object fields get GC'd.
* process.c (update_status, make_process, Fdelete_process)
(Fprocess_status, list_processes_1, start_process_unwind)
(create_process, Fmake_network_process, server_accept_connection)
(wait_reading_process_output, send_process, Fprocess_running_child_p)
(process_send_signal, proc_encode_coding_system, Fprocess_send_eof)
(sigchld_handler, status_notify): Adjust to new non-Lisp fields for
`pid' and `raw_status'.
(Fprocess_id, Fsignal_process): Same, and additionally use floats when
representing PIDs that are larger than most-positive-fixnum.
2006-04-08 15:07:35 +00:00
|
|
|
|
if (EQ (current_group, Qlambda) && gid == p->pid)
|
1999-02-19 01:39:27 +00:00
|
|
|
|
return;
|
1992-03-14 20:40:04 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
switch (signo)
|
|
|
|
|
{
|
|
|
|
|
#ifdef SIGCONT
|
|
|
|
|
case SIGCONT:
|
* process.h (struct Lisp_Process): Replace Lisp_Objects `pid',
`raw_status_high', and `raw_status_low' with plain integers, and move
them to the end of the structure.
* alloc.c (allocate_process): Use PSEUDOVECSIZE to initialize the
pseudovector's size field so only the Lisp_Object fields get GC'd.
* process.c (update_status, make_process, Fdelete_process)
(Fprocess_status, list_processes_1, start_process_unwind)
(create_process, Fmake_network_process, server_accept_connection)
(wait_reading_process_output, send_process, Fprocess_running_child_p)
(process_send_signal, proc_encode_coding_system, Fprocess_send_eof)
(sigchld_handler, status_notify): Adjust to new non-Lisp fields for
`pid' and `raw_status'.
(Fprocess_id, Fsignal_process): Same, and additionally use floats when
representing PIDs that are larger than most-positive-fixnum.
2006-04-08 15:07:35 +00:00
|
|
|
|
p->raw_status_new = 0;
|
1992-03-14 20:40:04 +00:00
|
|
|
|
p->status = Qrun;
|
(struct Lisp_Process): Turn slots infd, outfd, kill_without_query, pty_flag,
tick, update_tick, decoding_carryover, inherit_coding_system_flag,
filter_multibyte, adaptive_read_buffering, read_output_delay, and
read_output_skip from Lisp_Objects to ints. Remove unused
encoding_carryover.
2007-07-12 06:36:57 +00:00
|
|
|
|
p->tick = ++process_tick;
|
1992-03-14 20:40:04 +00:00
|
|
|
|
if (!nomsg)
|
2009-08-17 21:04:05 +00:00
|
|
|
|
{
|
|
|
|
|
status_notify (NULL);
|
|
|
|
|
redisplay_preserve_echo_area (13);
|
|
|
|
|
}
|
1992-03-14 20:40:04 +00:00
|
|
|
|
break;
|
1992-07-22 18:20:35 +00:00
|
|
|
|
#endif /* ! defined (SIGCONT) */
|
1992-03-14 20:40:04 +00:00
|
|
|
|
case SIGINT:
|
|
|
|
|
case SIGQUIT:
|
|
|
|
|
case SIGKILL:
|
(struct Lisp_Process): Turn slots infd, outfd, kill_without_query, pty_flag,
tick, update_tick, decoding_carryover, inherit_coding_system_flag,
filter_multibyte, adaptive_read_buffering, read_output_delay, and
read_output_skip from Lisp_Objects to ints. Remove unused
encoding_carryover.
2007-07-12 06:36:57 +00:00
|
|
|
|
flush_pending_output (p->infd);
|
1992-03-14 20:40:04 +00:00
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* If we don't have process groups, send the signal to the immediate
|
|
|
|
|
subprocess. That isn't really right, but it's better than any
|
|
|
|
|
obvious alternative. */
|
|
|
|
|
if (no_pgrp)
|
|
|
|
|
{
|
* process.h (struct Lisp_Process): Replace Lisp_Objects `pid',
`raw_status_high', and `raw_status_low' with plain integers, and move
them to the end of the structure.
* alloc.c (allocate_process): Use PSEUDOVECSIZE to initialize the
pseudovector's size field so only the Lisp_Object fields get GC'd.
* process.c (update_status, make_process, Fdelete_process)
(Fprocess_status, list_processes_1, start_process_unwind)
(create_process, Fmake_network_process, server_accept_connection)
(wait_reading_process_output, send_process, Fprocess_running_child_p)
(process_send_signal, proc_encode_coding_system, Fprocess_send_eof)
(sigchld_handler, status_notify): Adjust to new non-Lisp fields for
`pid' and `raw_status'.
(Fprocess_id, Fsignal_process): Same, and additionally use floats when
representing PIDs that are larger than most-positive-fixnum.
2006-04-08 15:07:35 +00:00
|
|
|
|
kill (p->pid, signo);
|
1992-03-14 20:40:04 +00:00
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* gid may be a pid, or minus a pgrp's number */
|
|
|
|
|
#ifdef TIOCSIGSEND
|
|
|
|
|
if (!NILP (current_group))
|
2003-02-21 18:13:53 +00:00
|
|
|
|
{
|
(struct Lisp_Process): Turn slots infd, outfd, kill_without_query, pty_flag,
tick, update_tick, decoding_carryover, inherit_coding_system_flag,
filter_multibyte, adaptive_read_buffering, read_output_delay, and
read_output_skip from Lisp_Objects to ints. Remove unused
encoding_carryover.
2007-07-12 06:36:57 +00:00
|
|
|
|
if (ioctl (p->infd, TIOCSIGSEND, signo) == -1)
|
2003-02-21 18:13:53 +00:00
|
|
|
|
EMACS_KILLPG (gid, signo);
|
|
|
|
|
}
|
1992-03-14 20:40:04 +00:00
|
|
|
|
else
|
|
|
|
|
{
|
* process.h (struct Lisp_Process): Replace Lisp_Objects `pid',
`raw_status_high', and `raw_status_low' with plain integers, and move
them to the end of the structure.
* alloc.c (allocate_process): Use PSEUDOVECSIZE to initialize the
pseudovector's size field so only the Lisp_Object fields get GC'd.
* process.c (update_status, make_process, Fdelete_process)
(Fprocess_status, list_processes_1, start_process_unwind)
(create_process, Fmake_network_process, server_accept_connection)
(wait_reading_process_output, send_process, Fprocess_running_child_p)
(process_send_signal, proc_encode_coding_system, Fprocess_send_eof)
(sigchld_handler, status_notify): Adjust to new non-Lisp fields for
`pid' and `raw_status'.
(Fprocess_id, Fsignal_process): Same, and additionally use floats when
representing PIDs that are larger than most-positive-fixnum.
2006-04-08 15:07:35 +00:00
|
|
|
|
gid = - p->pid;
|
1992-03-14 20:40:04 +00:00
|
|
|
|
kill (gid, signo);
|
|
|
|
|
}
|
1992-07-22 18:20:35 +00:00
|
|
|
|
#else /* ! defined (TIOCSIGSEND) */
|
2002-07-16 13:41:16 +00:00
|
|
|
|
EMACS_KILLPG (gid, signo);
|
1992-07-22 18:20:35 +00:00
|
|
|
|
#endif /* ! defined (TIOCSIGSEND) */
|
1992-03-14 20:40:04 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
DEFUN ("interrupt-process", Finterrupt_process, Sinterrupt_process, 0, 2, 0,
|
2001-10-20 20:56:10 +00:00
|
|
|
|
doc: /* Interrupt process PROCESS.
|
|
|
|
|
PROCESS may be a process, a buffer, or the name of a process or buffer.
|
2004-05-08 16:11:42 +00:00
|
|
|
|
No arg or nil means current buffer's process.
|
2001-10-20 20:56:10 +00:00
|
|
|
|
Second arg CURRENT-GROUP non-nil means send signal to
|
|
|
|
|
the current process-group of the process's controlling terminal
|
|
|
|
|
rather than to the process's own process group.
|
|
|
|
|
If the process is a shell, this means interrupt current subjob
|
|
|
|
|
rather than the shell.
|
|
|
|
|
|
|
|
|
|
If CURRENT-GROUP is `lambda', and if the shell owns the terminal,
|
|
|
|
|
don't send the signal. */)
|
2010-07-08 14:25:08 -07:00
|
|
|
|
(Lisp_Object process, Lisp_Object current_group)
|
1992-03-14 20:40:04 +00:00
|
|
|
|
{
|
|
|
|
|
process_send_signal (process, SIGINT, current_group, 0);
|
|
|
|
|
return process;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
DEFUN ("kill-process", Fkill_process, Skill_process, 0, 2, 0,
|
2001-10-20 20:56:10 +00:00
|
|
|
|
doc: /* Kill process PROCESS. May be process or name of one.
|
|
|
|
|
See function `interrupt-process' for more details on usage. */)
|
2010-07-08 14:25:08 -07:00
|
|
|
|
(Lisp_Object process, Lisp_Object current_group)
|
1992-03-14 20:40:04 +00:00
|
|
|
|
{
|
|
|
|
|
process_send_signal (process, SIGKILL, current_group, 0);
|
|
|
|
|
return process;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
DEFUN ("quit-process", Fquit_process, Squit_process, 0, 2, 0,
|
2001-10-20 20:56:10 +00:00
|
|
|
|
doc: /* Send QUIT signal to process PROCESS. May be process or name of one.
|
|
|
|
|
See function `interrupt-process' for more details on usage. */)
|
2010-07-08 14:25:08 -07:00
|
|
|
|
(Lisp_Object process, Lisp_Object current_group)
|
1992-03-14 20:40:04 +00:00
|
|
|
|
{
|
|
|
|
|
process_send_signal (process, SIGQUIT, current_group, 0);
|
|
|
|
|
return process;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
DEFUN ("stop-process", Fstop_process, Sstop_process, 0, 2, 0,
|
2001-10-20 20:56:10 +00:00
|
|
|
|
doc: /* Stop process PROCESS. May be process or name of one.
|
2003-02-04 14:56:31 +00:00
|
|
|
|
See function `interrupt-process' for more details on usage.
|
Daniel Engeler <engeler at gmail.com>
These changes add serial port access.
* process.c: Add HAVE_SERIAL.
(Fdelete_process, Fprocess_status, Fset_process_buffer)
(Fset_process_filter, Fset_process_sentinel, Fprocess_contact)
(list_processes_1, select_wrapper, Fstop_process)
(Fcontinue_process, Fprocess_send_eof, kill_buffer_processes)
(status_notify): Modify to handle serial processes.
[HAVE_SERIAL] (Fserial_process_configure)
[HAVE_SERIAL] (make_serial_process_unwind, Fmake_serial_process):
New functions.
* process.h (struct Lisp_Process): Add `type'.
* sysdep.c [HAVE_TERMIOS] (serial_open, serial_configure):
New functions.
* w32.c (_sys_read_ahead, sys_read, sys_write): Modify to handle serial ports.
(serial_open, serial_configure) New functions.
* w32.h: Add FILE_SERIAL.
(struct _child_process): Add ovl_read, ovl_write.
2008-06-13 08:08:20 +00:00
|
|
|
|
If PROCESS is a network or serial process, inhibit handling of incoming
|
|
|
|
|
traffic. */)
|
2010-07-08 14:25:08 -07:00
|
|
|
|
(Lisp_Object process, Lisp_Object current_group)
|
1992-03-14 20:40:04 +00:00
|
|
|
|
{
|
Daniel Engeler <engeler at gmail.com>
These changes add serial port access.
* process.c: Add HAVE_SERIAL.
(Fdelete_process, Fprocess_status, Fset_process_buffer)
(Fset_process_filter, Fset_process_sentinel, Fprocess_contact)
(list_processes_1, select_wrapper, Fstop_process)
(Fcontinue_process, Fprocess_send_eof, kill_buffer_processes)
(status_notify): Modify to handle serial processes.
[HAVE_SERIAL] (Fserial_process_configure)
[HAVE_SERIAL] (make_serial_process_unwind, Fmake_serial_process):
New functions.
* process.h (struct Lisp_Process): Add `type'.
* sysdep.c [HAVE_TERMIOS] (serial_open, serial_configure):
New functions.
* w32.c (_sys_read_ahead, sys_read, sys_write): Modify to handle serial ports.
(serial_open, serial_configure) New functions.
* w32.h: Add FILE_SERIAL.
(struct _child_process): Add ovl_read, ovl_write.
2008-06-13 08:08:20 +00:00
|
|
|
|
if (PROCESSP (process) && (NETCONN_P (process) || SERIALCONN_P (process)))
|
(Qlocal, QCname, QCbuffer, QChost, QCservice, QCfamily)
(QClocal, QCremote, QCserver, QCdatagram, QCnowait, QCnoquery,QCstop)
(QCcoding, QCoptions, QCfilter, QCsentinel, QClog, QCfeature):
New variables.
(NETCONN1_P): New macro.
(DATAGRAM_SOCKETS): New conditional symbol.
(datagram_address): New array.
(DATAGRAM_CONN_P, DATAGRAM_CHAN_P): New macros.
(status_message): Use concat3.
(Fprocess_status): Add `listen' status to doc string. Return `stop'
for a stopped network process.
(Fset_process_buffer): Update contact plist for network process.
(Fset_process_filter): Ditto. Don't enable input for stopped
network processes. Server must listen, even if filter is t.
(Fset_process_query_on_exit_flag, Fprocess_query_on_exit_flag):
New functions.
(Fprocess_kill_without_query): Removed. Now defined in simple.el.
(Fprocess_contact): Added KEY argument. Handle datagrams.
(list_processes_1): Optionally show only processes with the query
on exit flag set. Dynamically adjust column widths. Omit tty
column if not needed. Report stopped network processes.
Identify server and datagram network processes.
(Flist_processes): New optional arg `query-only'.
(conv_sockaddr_to_lisp, get_lisp_to_sockaddr_size)
(conv_lisp_to_sockaddr, set_socket_options)
(network_process_featurep, unwind_request_sigio): New helper functions.
(Fprocess_datagram_address, Fset_process_datagram_address):
(Fset_network_process_options): New lisp functions.
(Fopen_network_stream): Removed. Now defined in simple.el.
(Fmake_network_process): New lisp function. Code is based on previous
Fopen_network_stream, but heavily reworked with new property list based
argument list, support for datagrams, server processes, and local
sockets in addition to old client-only functionality.
(server_accept_connection): New function.
(wait_reading_process_input): Use it to handle incoming connects.
Do not enable input on a new connection if process is stopped.
(read_process_output): Handle datagram sockets. Use 2k buffer for them.
(send_process): Handle datagram sockets.
(Fstop_process, Fcontinue_process): Apply to network processes. A stopped
network process is indicated by setting command field to t .
(Fprocess_send_eof): No-op if datagram connection.
(Fstatus_notify): Don't read input for a stream server socket or a
stopped network process.
(init_process): Initialize datagram_address array.
(syms_of_process): Intern and staticpro new variables, defsubr new
functions.
2002-03-17 20:20:33 +00:00
|
|
|
|
{
|
|
|
|
|
struct Lisp_Process *p;
|
2003-02-04 14:56:31 +00:00
|
|
|
|
|
(Qlocal, QCname, QCbuffer, QChost, QCservice, QCfamily)
(QClocal, QCremote, QCserver, QCdatagram, QCnowait, QCnoquery,QCstop)
(QCcoding, QCoptions, QCfilter, QCsentinel, QClog, QCfeature):
New variables.
(NETCONN1_P): New macro.
(DATAGRAM_SOCKETS): New conditional symbol.
(datagram_address): New array.
(DATAGRAM_CONN_P, DATAGRAM_CHAN_P): New macros.
(status_message): Use concat3.
(Fprocess_status): Add `listen' status to doc string. Return `stop'
for a stopped network process.
(Fset_process_buffer): Update contact plist for network process.
(Fset_process_filter): Ditto. Don't enable input for stopped
network processes. Server must listen, even if filter is t.
(Fset_process_query_on_exit_flag, Fprocess_query_on_exit_flag):
New functions.
(Fprocess_kill_without_query): Removed. Now defined in simple.el.
(Fprocess_contact): Added KEY argument. Handle datagrams.
(list_processes_1): Optionally show only processes with the query
on exit flag set. Dynamically adjust column widths. Omit tty
column if not needed. Report stopped network processes.
Identify server and datagram network processes.
(Flist_processes): New optional arg `query-only'.
(conv_sockaddr_to_lisp, get_lisp_to_sockaddr_size)
(conv_lisp_to_sockaddr, set_socket_options)
(network_process_featurep, unwind_request_sigio): New helper functions.
(Fprocess_datagram_address, Fset_process_datagram_address):
(Fset_network_process_options): New lisp functions.
(Fopen_network_stream): Removed. Now defined in simple.el.
(Fmake_network_process): New lisp function. Code is based on previous
Fopen_network_stream, but heavily reworked with new property list based
argument list, support for datagrams, server processes, and local
sockets in addition to old client-only functionality.
(server_accept_connection): New function.
(wait_reading_process_input): Use it to handle incoming connects.
Do not enable input on a new connection if process is stopped.
(read_process_output): Handle datagram sockets. Use 2k buffer for them.
(send_process): Handle datagram sockets.
(Fstop_process, Fcontinue_process): Apply to network processes. A stopped
network process is indicated by setting command field to t .
(Fprocess_send_eof): No-op if datagram connection.
(Fstatus_notify): Don't read input for a stream server socket or a
stopped network process.
(init_process): Initialize datagram_address array.
(syms_of_process): Intern and staticpro new variables, defsubr new
functions.
2002-03-17 20:20:33 +00:00
|
|
|
|
p = XPROCESS (process);
|
|
|
|
|
if (NILP (p->command)
|
(struct Lisp_Process): Turn slots infd, outfd, kill_without_query, pty_flag,
tick, update_tick, decoding_carryover, inherit_coding_system_flag,
filter_multibyte, adaptive_read_buffering, read_output_delay, and
read_output_skip from Lisp_Objects to ints. Remove unused
encoding_carryover.
2007-07-12 06:36:57 +00:00
|
|
|
|
&& p->infd >= 0)
|
(Qlocal, QCname, QCbuffer, QChost, QCservice, QCfamily)
(QClocal, QCremote, QCserver, QCdatagram, QCnowait, QCnoquery,QCstop)
(QCcoding, QCoptions, QCfilter, QCsentinel, QClog, QCfeature):
New variables.
(NETCONN1_P): New macro.
(DATAGRAM_SOCKETS): New conditional symbol.
(datagram_address): New array.
(DATAGRAM_CONN_P, DATAGRAM_CHAN_P): New macros.
(status_message): Use concat3.
(Fprocess_status): Add `listen' status to doc string. Return `stop'
for a stopped network process.
(Fset_process_buffer): Update contact plist for network process.
(Fset_process_filter): Ditto. Don't enable input for stopped
network processes. Server must listen, even if filter is t.
(Fset_process_query_on_exit_flag, Fprocess_query_on_exit_flag):
New functions.
(Fprocess_kill_without_query): Removed. Now defined in simple.el.
(Fprocess_contact): Added KEY argument. Handle datagrams.
(list_processes_1): Optionally show only processes with the query
on exit flag set. Dynamically adjust column widths. Omit tty
column if not needed. Report stopped network processes.
Identify server and datagram network processes.
(Flist_processes): New optional arg `query-only'.
(conv_sockaddr_to_lisp, get_lisp_to_sockaddr_size)
(conv_lisp_to_sockaddr, set_socket_options)
(network_process_featurep, unwind_request_sigio): New helper functions.
(Fprocess_datagram_address, Fset_process_datagram_address):
(Fset_network_process_options): New lisp functions.
(Fopen_network_stream): Removed. Now defined in simple.el.
(Fmake_network_process): New lisp function. Code is based on previous
Fopen_network_stream, but heavily reworked with new property list based
argument list, support for datagrams, server processes, and local
sockets in addition to old client-only functionality.
(server_accept_connection): New function.
(wait_reading_process_input): Use it to handle incoming connects.
Do not enable input on a new connection if process is stopped.
(read_process_output): Handle datagram sockets. Use 2k buffer for them.
(send_process): Handle datagram sockets.
(Fstop_process, Fcontinue_process): Apply to network processes. A stopped
network process is indicated by setting command field to t .
(Fprocess_send_eof): No-op if datagram connection.
(Fstatus_notify): Don't read input for a stream server socket or a
stopped network process.
(init_process): Initialize datagram_address array.
(syms_of_process): Intern and staticpro new variables, defsubr new
functions.
2002-03-17 20:20:33 +00:00
|
|
|
|
{
|
(struct Lisp_Process): Turn slots infd, outfd, kill_without_query, pty_flag,
tick, update_tick, decoding_carryover, inherit_coding_system_flag,
filter_multibyte, adaptive_read_buffering, read_output_delay, and
read_output_skip from Lisp_Objects to ints. Remove unused
encoding_carryover.
2007-07-12 06:36:57 +00:00
|
|
|
|
FD_CLR (p->infd, &input_wait_mask);
|
|
|
|
|
FD_CLR (p->infd, &non_keyboard_wait_mask);
|
(Qlocal, QCname, QCbuffer, QChost, QCservice, QCfamily)
(QClocal, QCremote, QCserver, QCdatagram, QCnowait, QCnoquery,QCstop)
(QCcoding, QCoptions, QCfilter, QCsentinel, QClog, QCfeature):
New variables.
(NETCONN1_P): New macro.
(DATAGRAM_SOCKETS): New conditional symbol.
(datagram_address): New array.
(DATAGRAM_CONN_P, DATAGRAM_CHAN_P): New macros.
(status_message): Use concat3.
(Fprocess_status): Add `listen' status to doc string. Return `stop'
for a stopped network process.
(Fset_process_buffer): Update contact plist for network process.
(Fset_process_filter): Ditto. Don't enable input for stopped
network processes. Server must listen, even if filter is t.
(Fset_process_query_on_exit_flag, Fprocess_query_on_exit_flag):
New functions.
(Fprocess_kill_without_query): Removed. Now defined in simple.el.
(Fprocess_contact): Added KEY argument. Handle datagrams.
(list_processes_1): Optionally show only processes with the query
on exit flag set. Dynamically adjust column widths. Omit tty
column if not needed. Report stopped network processes.
Identify server and datagram network processes.
(Flist_processes): New optional arg `query-only'.
(conv_sockaddr_to_lisp, get_lisp_to_sockaddr_size)
(conv_lisp_to_sockaddr, set_socket_options)
(network_process_featurep, unwind_request_sigio): New helper functions.
(Fprocess_datagram_address, Fset_process_datagram_address):
(Fset_network_process_options): New lisp functions.
(Fopen_network_stream): Removed. Now defined in simple.el.
(Fmake_network_process): New lisp function. Code is based on previous
Fopen_network_stream, but heavily reworked with new property list based
argument list, support for datagrams, server processes, and local
sockets in addition to old client-only functionality.
(server_accept_connection): New function.
(wait_reading_process_input): Use it to handle incoming connects.
Do not enable input on a new connection if process is stopped.
(read_process_output): Handle datagram sockets. Use 2k buffer for them.
(send_process): Handle datagram sockets.
(Fstop_process, Fcontinue_process): Apply to network processes. A stopped
network process is indicated by setting command field to t .
(Fprocess_send_eof): No-op if datagram connection.
(Fstatus_notify): Don't read input for a stream server socket or a
stopped network process.
(init_process): Initialize datagram_address array.
(syms_of_process): Intern and staticpro new variables, defsubr new
functions.
2002-03-17 20:20:33 +00:00
|
|
|
|
}
|
|
|
|
|
p->command = Qt;
|
|
|
|
|
return process;
|
|
|
|
|
}
|
1992-03-14 20:40:04 +00:00
|
|
|
|
#ifndef SIGTSTP
|
2005-06-23 16:13:54 +00:00
|
|
|
|
error ("No SIGTSTP support");
|
1992-03-14 20:40:04 +00:00
|
|
|
|
#else
|
|
|
|
|
process_send_signal (process, SIGTSTP, current_group, 0);
|
|
|
|
|
#endif
|
|
|
|
|
return process;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
DEFUN ("continue-process", Fcontinue_process, Scontinue_process, 0, 2, 0,
|
2001-10-20 20:56:10 +00:00
|
|
|
|
doc: /* Continue process PROCESS. May be process or name of one.
|
2003-02-04 14:56:31 +00:00
|
|
|
|
See function `interrupt-process' for more details on usage.
|
Daniel Engeler <engeler at gmail.com>
These changes add serial port access.
* process.c: Add HAVE_SERIAL.
(Fdelete_process, Fprocess_status, Fset_process_buffer)
(Fset_process_filter, Fset_process_sentinel, Fprocess_contact)
(list_processes_1, select_wrapper, Fstop_process)
(Fcontinue_process, Fprocess_send_eof, kill_buffer_processes)
(status_notify): Modify to handle serial processes.
[HAVE_SERIAL] (Fserial_process_configure)
[HAVE_SERIAL] (make_serial_process_unwind, Fmake_serial_process):
New functions.
* process.h (struct Lisp_Process): Add `type'.
* sysdep.c [HAVE_TERMIOS] (serial_open, serial_configure):
New functions.
* w32.c (_sys_read_ahead, sys_read, sys_write): Modify to handle serial ports.
(serial_open, serial_configure) New functions.
* w32.h: Add FILE_SERIAL.
(struct _child_process): Add ovl_read, ovl_write.
2008-06-13 08:08:20 +00:00
|
|
|
|
If PROCESS is a network or serial process, resume handling of incoming
|
|
|
|
|
traffic. */)
|
2010-07-08 14:25:08 -07:00
|
|
|
|
(Lisp_Object process, Lisp_Object current_group)
|
1992-03-14 20:40:04 +00:00
|
|
|
|
{
|
Daniel Engeler <engeler at gmail.com>
These changes add serial port access.
* process.c: Add HAVE_SERIAL.
(Fdelete_process, Fprocess_status, Fset_process_buffer)
(Fset_process_filter, Fset_process_sentinel, Fprocess_contact)
(list_processes_1, select_wrapper, Fstop_process)
(Fcontinue_process, Fprocess_send_eof, kill_buffer_processes)
(status_notify): Modify to handle serial processes.
[HAVE_SERIAL] (Fserial_process_configure)
[HAVE_SERIAL] (make_serial_process_unwind, Fmake_serial_process):
New functions.
* process.h (struct Lisp_Process): Add `type'.
* sysdep.c [HAVE_TERMIOS] (serial_open, serial_configure):
New functions.
* w32.c (_sys_read_ahead, sys_read, sys_write): Modify to handle serial ports.
(serial_open, serial_configure) New functions.
* w32.h: Add FILE_SERIAL.
(struct _child_process): Add ovl_read, ovl_write.
2008-06-13 08:08:20 +00:00
|
|
|
|
if (PROCESSP (process) && (NETCONN_P (process) || SERIALCONN_P (process)))
|
(Qlocal, QCname, QCbuffer, QChost, QCservice, QCfamily)
(QClocal, QCremote, QCserver, QCdatagram, QCnowait, QCnoquery,QCstop)
(QCcoding, QCoptions, QCfilter, QCsentinel, QClog, QCfeature):
New variables.
(NETCONN1_P): New macro.
(DATAGRAM_SOCKETS): New conditional symbol.
(datagram_address): New array.
(DATAGRAM_CONN_P, DATAGRAM_CHAN_P): New macros.
(status_message): Use concat3.
(Fprocess_status): Add `listen' status to doc string. Return `stop'
for a stopped network process.
(Fset_process_buffer): Update contact plist for network process.
(Fset_process_filter): Ditto. Don't enable input for stopped
network processes. Server must listen, even if filter is t.
(Fset_process_query_on_exit_flag, Fprocess_query_on_exit_flag):
New functions.
(Fprocess_kill_without_query): Removed. Now defined in simple.el.
(Fprocess_contact): Added KEY argument. Handle datagrams.
(list_processes_1): Optionally show only processes with the query
on exit flag set. Dynamically adjust column widths. Omit tty
column if not needed. Report stopped network processes.
Identify server and datagram network processes.
(Flist_processes): New optional arg `query-only'.
(conv_sockaddr_to_lisp, get_lisp_to_sockaddr_size)
(conv_lisp_to_sockaddr, set_socket_options)
(network_process_featurep, unwind_request_sigio): New helper functions.
(Fprocess_datagram_address, Fset_process_datagram_address):
(Fset_network_process_options): New lisp functions.
(Fopen_network_stream): Removed. Now defined in simple.el.
(Fmake_network_process): New lisp function. Code is based on previous
Fopen_network_stream, but heavily reworked with new property list based
argument list, support for datagrams, server processes, and local
sockets in addition to old client-only functionality.
(server_accept_connection): New function.
(wait_reading_process_input): Use it to handle incoming connects.
Do not enable input on a new connection if process is stopped.
(read_process_output): Handle datagram sockets. Use 2k buffer for them.
(send_process): Handle datagram sockets.
(Fstop_process, Fcontinue_process): Apply to network processes. A stopped
network process is indicated by setting command field to t .
(Fprocess_send_eof): No-op if datagram connection.
(Fstatus_notify): Don't read input for a stream server socket or a
stopped network process.
(init_process): Initialize datagram_address array.
(syms_of_process): Intern and staticpro new variables, defsubr new
functions.
2002-03-17 20:20:33 +00:00
|
|
|
|
{
|
|
|
|
|
struct Lisp_Process *p;
|
|
|
|
|
|
|
|
|
|
p = XPROCESS (process);
|
|
|
|
|
if (EQ (p->command, Qt)
|
(struct Lisp_Process): Turn slots infd, outfd, kill_without_query, pty_flag,
tick, update_tick, decoding_carryover, inherit_coding_system_flag,
filter_multibyte, adaptive_read_buffering, read_output_delay, and
read_output_skip from Lisp_Objects to ints. Remove unused
encoding_carryover.
2007-07-12 06:36:57 +00:00
|
|
|
|
&& p->infd >= 0
|
(Qlocal, QCname, QCbuffer, QChost, QCservice, QCfamily)
(QClocal, QCremote, QCserver, QCdatagram, QCnowait, QCnoquery,QCstop)
(QCcoding, QCoptions, QCfilter, QCsentinel, QClog, QCfeature):
New variables.
(NETCONN1_P): New macro.
(DATAGRAM_SOCKETS): New conditional symbol.
(datagram_address): New array.
(DATAGRAM_CONN_P, DATAGRAM_CHAN_P): New macros.
(status_message): Use concat3.
(Fprocess_status): Add `listen' status to doc string. Return `stop'
for a stopped network process.
(Fset_process_buffer): Update contact plist for network process.
(Fset_process_filter): Ditto. Don't enable input for stopped
network processes. Server must listen, even if filter is t.
(Fset_process_query_on_exit_flag, Fprocess_query_on_exit_flag):
New functions.
(Fprocess_kill_without_query): Removed. Now defined in simple.el.
(Fprocess_contact): Added KEY argument. Handle datagrams.
(list_processes_1): Optionally show only processes with the query
on exit flag set. Dynamically adjust column widths. Omit tty
column if not needed. Report stopped network processes.
Identify server and datagram network processes.
(Flist_processes): New optional arg `query-only'.
(conv_sockaddr_to_lisp, get_lisp_to_sockaddr_size)
(conv_lisp_to_sockaddr, set_socket_options)
(network_process_featurep, unwind_request_sigio): New helper functions.
(Fprocess_datagram_address, Fset_process_datagram_address):
(Fset_network_process_options): New lisp functions.
(Fopen_network_stream): Removed. Now defined in simple.el.
(Fmake_network_process): New lisp function. Code is based on previous
Fopen_network_stream, but heavily reworked with new property list based
argument list, support for datagrams, server processes, and local
sockets in addition to old client-only functionality.
(server_accept_connection): New function.
(wait_reading_process_input): Use it to handle incoming connects.
Do not enable input on a new connection if process is stopped.
(read_process_output): Handle datagram sockets. Use 2k buffer for them.
(send_process): Handle datagram sockets.
(Fstop_process, Fcontinue_process): Apply to network processes. A stopped
network process is indicated by setting command field to t .
(Fprocess_send_eof): No-op if datagram connection.
(Fstatus_notify): Don't read input for a stream server socket or a
stopped network process.
(init_process): Initialize datagram_address array.
(syms_of_process): Intern and staticpro new variables, defsubr new
functions.
2002-03-17 20:20:33 +00:00
|
|
|
|
&& (!EQ (p->filter, Qt) || EQ (p->status, Qlisten)))
|
|
|
|
|
{
|
(struct Lisp_Process): Turn slots infd, outfd, kill_without_query, pty_flag,
tick, update_tick, decoding_carryover, inherit_coding_system_flag,
filter_multibyte, adaptive_read_buffering, read_output_delay, and
read_output_skip from Lisp_Objects to ints. Remove unused
encoding_carryover.
2007-07-12 06:36:57 +00:00
|
|
|
|
FD_SET (p->infd, &input_wait_mask);
|
|
|
|
|
FD_SET (p->infd, &non_keyboard_wait_mask);
|
Daniel Engeler <engeler at gmail.com>
These changes add serial port access.
* process.c: Add HAVE_SERIAL.
(Fdelete_process, Fprocess_status, Fset_process_buffer)
(Fset_process_filter, Fset_process_sentinel, Fprocess_contact)
(list_processes_1, select_wrapper, Fstop_process)
(Fcontinue_process, Fprocess_send_eof, kill_buffer_processes)
(status_notify): Modify to handle serial processes.
[HAVE_SERIAL] (Fserial_process_configure)
[HAVE_SERIAL] (make_serial_process_unwind, Fmake_serial_process):
New functions.
* process.h (struct Lisp_Process): Add `type'.
* sysdep.c [HAVE_TERMIOS] (serial_open, serial_configure):
New functions.
* w32.c (_sys_read_ahead, sys_read, sys_write): Modify to handle serial ports.
(serial_open, serial_configure) New functions.
* w32.h: Add FILE_SERIAL.
(struct _child_process): Add ovl_read, ovl_write.
2008-06-13 08:08:20 +00:00
|
|
|
|
#ifdef WINDOWSNT
|
|
|
|
|
if (fd_info[ p->infd ].flags & FILE_SERIAL)
|
|
|
|
|
PurgeComm (fd_info[ p->infd ].hnd, PURGE_RXABORT | PURGE_RXCLEAR);
|
|
|
|
|
#endif
|
|
|
|
|
#ifdef HAVE_TERMIOS
|
|
|
|
|
tcflush (p->infd, TCIFLUSH);
|
|
|
|
|
#endif
|
(Qlocal, QCname, QCbuffer, QChost, QCservice, QCfamily)
(QClocal, QCremote, QCserver, QCdatagram, QCnowait, QCnoquery,QCstop)
(QCcoding, QCoptions, QCfilter, QCsentinel, QClog, QCfeature):
New variables.
(NETCONN1_P): New macro.
(DATAGRAM_SOCKETS): New conditional symbol.
(datagram_address): New array.
(DATAGRAM_CONN_P, DATAGRAM_CHAN_P): New macros.
(status_message): Use concat3.
(Fprocess_status): Add `listen' status to doc string. Return `stop'
for a stopped network process.
(Fset_process_buffer): Update contact plist for network process.
(Fset_process_filter): Ditto. Don't enable input for stopped
network processes. Server must listen, even if filter is t.
(Fset_process_query_on_exit_flag, Fprocess_query_on_exit_flag):
New functions.
(Fprocess_kill_without_query): Removed. Now defined in simple.el.
(Fprocess_contact): Added KEY argument. Handle datagrams.
(list_processes_1): Optionally show only processes with the query
on exit flag set. Dynamically adjust column widths. Omit tty
column if not needed. Report stopped network processes.
Identify server and datagram network processes.
(Flist_processes): New optional arg `query-only'.
(conv_sockaddr_to_lisp, get_lisp_to_sockaddr_size)
(conv_lisp_to_sockaddr, set_socket_options)
(network_process_featurep, unwind_request_sigio): New helper functions.
(Fprocess_datagram_address, Fset_process_datagram_address):
(Fset_network_process_options): New lisp functions.
(Fopen_network_stream): Removed. Now defined in simple.el.
(Fmake_network_process): New lisp function. Code is based on previous
Fopen_network_stream, but heavily reworked with new property list based
argument list, support for datagrams, server processes, and local
sockets in addition to old client-only functionality.
(server_accept_connection): New function.
(wait_reading_process_input): Use it to handle incoming connects.
Do not enable input on a new connection if process is stopped.
(read_process_output): Handle datagram sockets. Use 2k buffer for them.
(send_process): Handle datagram sockets.
(Fstop_process, Fcontinue_process): Apply to network processes. A stopped
network process is indicated by setting command field to t .
(Fprocess_send_eof): No-op if datagram connection.
(Fstatus_notify): Don't read input for a stream server socket or a
stopped network process.
(init_process): Initialize datagram_address array.
(syms_of_process): Intern and staticpro new variables, defsubr new
functions.
2002-03-17 20:20:33 +00:00
|
|
|
|
}
|
|
|
|
|
p->command = Qnil;
|
|
|
|
|
return process;
|
|
|
|
|
}
|
1992-03-14 20:40:04 +00:00
|
|
|
|
#ifdef SIGCONT
|
|
|
|
|
process_send_signal (process, SIGCONT, current_group, 0);
|
|
|
|
|
#else
|
2005-06-23 16:13:54 +00:00
|
|
|
|
error ("No SIGCONT support");
|
1992-03-14 20:40:04 +00:00
|
|
|
|
#endif
|
|
|
|
|
return process;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
DEFUN ("signal-process", Fsignal_process, Ssignal_process,
|
2002-10-28 23:18:50 +00:00
|
|
|
|
2, 2, "sProcess (name or number): \nnSignal code: ",
|
|
|
|
|
doc: /* Send PROCESS the signal with code SIGCODE.
|
2006-12-09 22:00:18 +00:00
|
|
|
|
PROCESS may also be a number specifying the process id of the
|
2002-10-28 23:18:50 +00:00
|
|
|
|
process to signal; in this case, the process need not be a child of
|
|
|
|
|
this Emacs.
|
2001-10-20 20:56:10 +00:00
|
|
|
|
SIGCODE may be an integer, or a symbol whose name is a signal name. */)
|
2010-07-08 14:25:08 -07:00
|
|
|
|
(Lisp_Object process, Lisp_Object sigcode)
|
1992-03-14 20:40:04 +00:00
|
|
|
|
{
|
* process.h (struct Lisp_Process): Replace Lisp_Objects `pid',
`raw_status_high', and `raw_status_low' with plain integers, and move
them to the end of the structure.
* alloc.c (allocate_process): Use PSEUDOVECSIZE to initialize the
pseudovector's size field so only the Lisp_Object fields get GC'd.
* process.c (update_status, make_process, Fdelete_process)
(Fprocess_status, list_processes_1, start_process_unwind)
(create_process, Fmake_network_process, server_accept_connection)
(wait_reading_process_output, send_process, Fprocess_running_child_p)
(process_send_signal, proc_encode_coding_system, Fprocess_send_eof)
(sigchld_handler, status_notify): Adjust to new non-Lisp fields for
`pid' and `raw_status'.
(Fprocess_id, Fsignal_process): Same, and additionally use floats when
representing PIDs that are larger than most-positive-fixnum.
2006-04-08 15:07:35 +00:00
|
|
|
|
pid_t pid;
|
2002-10-28 23:18:50 +00:00
|
|
|
|
|
|
|
|
|
if (INTEGERP (process))
|
|
|
|
|
{
|
* process.h (struct Lisp_Process): Replace Lisp_Objects `pid',
`raw_status_high', and `raw_status_low' with plain integers, and move
them to the end of the structure.
* alloc.c (allocate_process): Use PSEUDOVECSIZE to initialize the
pseudovector's size field so only the Lisp_Object fields get GC'd.
* process.c (update_status, make_process, Fdelete_process)
(Fprocess_status, list_processes_1, start_process_unwind)
(create_process, Fmake_network_process, server_accept_connection)
(wait_reading_process_output, send_process, Fprocess_running_child_p)
(process_send_signal, proc_encode_coding_system, Fprocess_send_eof)
(sigchld_handler, status_notify): Adjust to new non-Lisp fields for
`pid' and `raw_status'.
(Fprocess_id, Fsignal_process): Same, and additionally use floats when
representing PIDs that are larger than most-positive-fixnum.
2006-04-08 15:07:35 +00:00
|
|
|
|
pid = XINT (process);
|
|
|
|
|
goto got_it;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (FLOATP (process))
|
|
|
|
|
{
|
2006-12-09 22:00:18 +00:00
|
|
|
|
pid = (pid_t) XFLOAT_DATA (process);
|
2002-10-28 23:18:50 +00:00
|
|
|
|
goto got_it;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (STRINGP (process))
|
|
|
|
|
{
|
|
|
|
|
Lisp_Object tem;
|
|
|
|
|
if (tem = Fget_process (process), NILP (tem))
|
|
|
|
|
{
|
* process.h (struct Lisp_Process): Replace Lisp_Objects `pid',
`raw_status_high', and `raw_status_low' with plain integers, and move
them to the end of the structure.
* alloc.c (allocate_process): Use PSEUDOVECSIZE to initialize the
pseudovector's size field so only the Lisp_Object fields get GC'd.
* process.c (update_status, make_process, Fdelete_process)
(Fprocess_status, list_processes_1, start_process_unwind)
(create_process, Fmake_network_process, server_accept_connection)
(wait_reading_process_output, send_process, Fprocess_running_child_p)
(process_send_signal, proc_encode_coding_system, Fprocess_send_eof)
(sigchld_handler, status_notify): Adjust to new non-Lisp fields for
`pid' and `raw_status'.
(Fprocess_id, Fsignal_process): Same, and additionally use floats when
representing PIDs that are larger than most-positive-fixnum.
2006-04-08 15:07:35 +00:00
|
|
|
|
pid = XINT (Fstring_to_number (process, make_number (10)));
|
|
|
|
|
if (pid > 0)
|
2002-10-28 23:18:50 +00:00
|
|
|
|
goto got_it;
|
|
|
|
|
}
|
|
|
|
|
process = tem;
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
process = get_process (process);
|
2003-02-04 14:56:31 +00:00
|
|
|
|
|
2002-10-28 23:18:50 +00:00
|
|
|
|
if (NILP (process))
|
|
|
|
|
return process;
|
|
|
|
|
|
|
|
|
|
CHECK_PROCESS (process);
|
|
|
|
|
pid = XPROCESS (process)->pid;
|
* process.h (struct Lisp_Process): Replace Lisp_Objects `pid',
`raw_status_high', and `raw_status_low' with plain integers, and move
them to the end of the structure.
* alloc.c (allocate_process): Use PSEUDOVECSIZE to initialize the
pseudovector's size field so only the Lisp_Object fields get GC'd.
* process.c (update_status, make_process, Fdelete_process)
(Fprocess_status, list_processes_1, start_process_unwind)
(create_process, Fmake_network_process, server_accept_connection)
(wait_reading_process_output, send_process, Fprocess_running_child_p)
(process_send_signal, proc_encode_coding_system, Fprocess_send_eof)
(sigchld_handler, status_notify): Adjust to new non-Lisp fields for
`pid' and `raw_status'.
(Fprocess_id, Fsignal_process): Same, and additionally use floats when
representing PIDs that are larger than most-positive-fixnum.
2006-04-08 15:07:35 +00:00
|
|
|
|
if (pid <= 0)
|
2002-10-28 23:18:50 +00:00
|
|
|
|
error ("Cannot signal process %s", SDATA (XPROCESS (process)->name));
|
|
|
|
|
|
|
|
|
|
got_it:
|
1995-03-28 17:34:52 +00:00
|
|
|
|
|
2006-12-04 15:21:39 +00:00
|
|
|
|
#define parse_signal(NAME, VALUE) \
|
* dispextern.h, xfaces.c (xstrcasecmp): Renamed from xstricmp.
* dosfns.c, fileio.c, font.c, fontset.c, image.c, macfns.c:
* macterm.c, process.c, w32.c, w32fns.c, w32proc.c, xfaces.c:
* xfns.c, xfont.c: Callers changed.
2008-05-22 14:54:27 +00:00
|
|
|
|
else if (!xstrcasecmp (name, NAME)) \
|
1995-03-28 17:34:52 +00:00
|
|
|
|
XSETINT (sigcode, VALUE)
|
|
|
|
|
|
|
|
|
|
if (INTEGERP (sigcode))
|
|
|
|
|
;
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
unsigned char *name;
|
|
|
|
|
|
2001-11-02 20:46:55 +00:00
|
|
|
|
CHECK_SYMBOL (sigcode);
|
2002-07-15 00:01:34 +00:00
|
|
|
|
name = SDATA (SYMBOL_NAME (sigcode));
|
1995-03-28 17:34:52 +00:00
|
|
|
|
|
2010-07-07 11:45:28 +02:00
|
|
|
|
if (!strncmp (name, "SIG", 3) || !strncmp (name, "sig", 3))
|
2005-11-08 21:38:37 +00:00
|
|
|
|
name += 3;
|
|
|
|
|
|
1995-03-28 17:34:52 +00:00
|
|
|
|
if (0)
|
|
|
|
|
;
|
2006-12-04 15:21:39 +00:00
|
|
|
|
#ifdef SIGUSR1
|
|
|
|
|
parse_signal ("usr1", SIGUSR1);
|
|
|
|
|
#endif
|
|
|
|
|
#ifdef SIGUSR2
|
|
|
|
|
parse_signal ("usr2", SIGUSR2);
|
|
|
|
|
#endif
|
|
|
|
|
#ifdef SIGTERM
|
|
|
|
|
parse_signal ("term", SIGTERM);
|
|
|
|
|
#endif
|
1995-03-28 17:34:52 +00:00
|
|
|
|
#ifdef SIGHUP
|
2006-12-04 15:21:39 +00:00
|
|
|
|
parse_signal ("hup", SIGHUP);
|
1995-03-28 17:34:52 +00:00
|
|
|
|
#endif
|
|
|
|
|
#ifdef SIGINT
|
2006-12-04 15:21:39 +00:00
|
|
|
|
parse_signal ("int", SIGINT);
|
1995-03-28 17:34:52 +00:00
|
|
|
|
#endif
|
|
|
|
|
#ifdef SIGQUIT
|
2006-12-04 15:21:39 +00:00
|
|
|
|
parse_signal ("quit", SIGQUIT);
|
1995-03-28 17:34:52 +00:00
|
|
|
|
#endif
|
|
|
|
|
#ifdef SIGILL
|
2006-12-04 15:21:39 +00:00
|
|
|
|
parse_signal ("ill", SIGILL);
|
1995-03-28 17:34:52 +00:00
|
|
|
|
#endif
|
|
|
|
|
#ifdef SIGABRT
|
2006-12-04 15:21:39 +00:00
|
|
|
|
parse_signal ("abrt", SIGABRT);
|
1995-03-28 17:34:52 +00:00
|
|
|
|
#endif
|
|
|
|
|
#ifdef SIGEMT
|
2006-12-04 15:21:39 +00:00
|
|
|
|
parse_signal ("emt", SIGEMT);
|
1995-03-28 17:34:52 +00:00
|
|
|
|
#endif
|
|
|
|
|
#ifdef SIGKILL
|
2006-12-04 15:21:39 +00:00
|
|
|
|
parse_signal ("kill", SIGKILL);
|
1995-03-28 17:34:52 +00:00
|
|
|
|
#endif
|
|
|
|
|
#ifdef SIGFPE
|
2006-12-04 15:21:39 +00:00
|
|
|
|
parse_signal ("fpe", SIGFPE);
|
1995-03-28 17:34:52 +00:00
|
|
|
|
#endif
|
|
|
|
|
#ifdef SIGBUS
|
2006-12-04 15:21:39 +00:00
|
|
|
|
parse_signal ("bus", SIGBUS);
|
1995-03-28 17:34:52 +00:00
|
|
|
|
#endif
|
|
|
|
|
#ifdef SIGSEGV
|
2006-12-04 15:21:39 +00:00
|
|
|
|
parse_signal ("segv", SIGSEGV);
|
1995-03-28 17:34:52 +00:00
|
|
|
|
#endif
|
|
|
|
|
#ifdef SIGSYS
|
2006-12-04 15:21:39 +00:00
|
|
|
|
parse_signal ("sys", SIGSYS);
|
1995-03-28 17:34:52 +00:00
|
|
|
|
#endif
|
|
|
|
|
#ifdef SIGPIPE
|
2006-12-04 15:21:39 +00:00
|
|
|
|
parse_signal ("pipe", SIGPIPE);
|
1995-03-28 17:34:52 +00:00
|
|
|
|
#endif
|
|
|
|
|
#ifdef SIGALRM
|
2006-12-04 15:21:39 +00:00
|
|
|
|
parse_signal ("alrm", SIGALRM);
|
1995-03-28 17:34:52 +00:00
|
|
|
|
#endif
|
|
|
|
|
#ifdef SIGURG
|
2006-12-04 15:21:39 +00:00
|
|
|
|
parse_signal ("urg", SIGURG);
|
1995-03-28 17:34:52 +00:00
|
|
|
|
#endif
|
|
|
|
|
#ifdef SIGSTOP
|
2006-12-04 15:21:39 +00:00
|
|
|
|
parse_signal ("stop", SIGSTOP);
|
1995-03-28 17:34:52 +00:00
|
|
|
|
#endif
|
|
|
|
|
#ifdef SIGTSTP
|
2006-12-04 15:21:39 +00:00
|
|
|
|
parse_signal ("tstp", SIGTSTP);
|
1995-03-28 17:34:52 +00:00
|
|
|
|
#endif
|
|
|
|
|
#ifdef SIGCONT
|
2006-12-04 15:21:39 +00:00
|
|
|
|
parse_signal ("cont", SIGCONT);
|
1995-03-28 17:34:52 +00:00
|
|
|
|
#endif
|
|
|
|
|
#ifdef SIGCHLD
|
2006-12-04 15:21:39 +00:00
|
|
|
|
parse_signal ("chld", SIGCHLD);
|
1995-03-28 17:34:52 +00:00
|
|
|
|
#endif
|
|
|
|
|
#ifdef SIGTTIN
|
2006-12-04 15:21:39 +00:00
|
|
|
|
parse_signal ("ttin", SIGTTIN);
|
1995-03-28 17:34:52 +00:00
|
|
|
|
#endif
|
|
|
|
|
#ifdef SIGTTOU
|
2006-12-04 15:21:39 +00:00
|
|
|
|
parse_signal ("ttou", SIGTTOU);
|
1995-03-28 17:34:52 +00:00
|
|
|
|
#endif
|
|
|
|
|
#ifdef SIGIO
|
2006-12-04 15:21:39 +00:00
|
|
|
|
parse_signal ("io", SIGIO);
|
1995-03-28 17:34:52 +00:00
|
|
|
|
#endif
|
|
|
|
|
#ifdef SIGXCPU
|
2006-12-04 15:21:39 +00:00
|
|
|
|
parse_signal ("xcpu", SIGXCPU);
|
1995-03-28 17:34:52 +00:00
|
|
|
|
#endif
|
|
|
|
|
#ifdef SIGXFSZ
|
2006-12-04 15:21:39 +00:00
|
|
|
|
parse_signal ("xfsz", SIGXFSZ);
|
1995-03-28 17:34:52 +00:00
|
|
|
|
#endif
|
|
|
|
|
#ifdef SIGVTALRM
|
2006-12-04 15:21:39 +00:00
|
|
|
|
parse_signal ("vtalrm", SIGVTALRM);
|
1995-03-28 17:34:52 +00:00
|
|
|
|
#endif
|
|
|
|
|
#ifdef SIGPROF
|
2006-12-04 15:21:39 +00:00
|
|
|
|
parse_signal ("prof", SIGPROF);
|
1995-03-28 17:34:52 +00:00
|
|
|
|
#endif
|
|
|
|
|
#ifdef SIGWINCH
|
2006-12-04 15:21:39 +00:00
|
|
|
|
parse_signal ("winch", SIGWINCH);
|
1995-03-28 17:34:52 +00:00
|
|
|
|
#endif
|
|
|
|
|
#ifdef SIGINFO
|
2006-12-04 15:21:39 +00:00
|
|
|
|
parse_signal ("info", SIGINFO);
|
1995-03-28 17:34:52 +00:00
|
|
|
|
#endif
|
|
|
|
|
else
|
1995-03-28 23:33:32 +00:00
|
|
|
|
error ("Undefined signal name %s", name);
|
1995-03-28 17:34:52 +00:00
|
|
|
|
}
|
|
|
|
|
|
2006-12-04 15:21:39 +00:00
|
|
|
|
#undef parse_signal
|
1995-03-28 17:34:52 +00:00
|
|
|
|
|
* process.h (struct Lisp_Process): Replace Lisp_Objects `pid',
`raw_status_high', and `raw_status_low' with plain integers, and move
them to the end of the structure.
* alloc.c (allocate_process): Use PSEUDOVECSIZE to initialize the
pseudovector's size field so only the Lisp_Object fields get GC'd.
* process.c (update_status, make_process, Fdelete_process)
(Fprocess_status, list_processes_1, start_process_unwind)
(create_process, Fmake_network_process, server_accept_connection)
(wait_reading_process_output, send_process, Fprocess_running_child_p)
(process_send_signal, proc_encode_coding_system, Fprocess_send_eof)
(sigchld_handler, status_notify): Adjust to new non-Lisp fields for
`pid' and `raw_status'.
(Fprocess_id, Fsignal_process): Same, and additionally use floats when
representing PIDs that are larger than most-positive-fixnum.
2006-04-08 15:07:35 +00:00
|
|
|
|
return make_number (kill (pid, XINT (sigcode)));
|
1992-03-14 20:40:04 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
DEFUN ("process-send-eof", Fprocess_send_eof, Sprocess_send_eof, 0, 1, 0,
|
2001-10-20 20:56:10 +00:00
|
|
|
|
doc: /* Make PROCESS see end-of-file in its input.
|
|
|
|
|
EOF comes after any text already sent to it.
|
|
|
|
|
PROCESS may be a process, a buffer, the name of a process or buffer, or
|
|
|
|
|
nil, indicating the current buffer's process.
|
|
|
|
|
If PROCESS is a network connection, or is a process communicating
|
|
|
|
|
through a pipe (as opposed to a pty), then you cannot send any more
|
Daniel Engeler <engeler at gmail.com>
These changes add serial port access.
* process.c: Add HAVE_SERIAL.
(Fdelete_process, Fprocess_status, Fset_process_buffer)
(Fset_process_filter, Fset_process_sentinel, Fprocess_contact)
(list_processes_1, select_wrapper, Fstop_process)
(Fcontinue_process, Fprocess_send_eof, kill_buffer_processes)
(status_notify): Modify to handle serial processes.
[HAVE_SERIAL] (Fserial_process_configure)
[HAVE_SERIAL] (make_serial_process_unwind, Fmake_serial_process):
New functions.
* process.h (struct Lisp_Process): Add `type'.
* sysdep.c [HAVE_TERMIOS] (serial_open, serial_configure):
New functions.
* w32.c (_sys_read_ahead, sys_read, sys_write): Modify to handle serial ports.
(serial_open, serial_configure) New functions.
* w32.h: Add FILE_SERIAL.
(struct _child_process): Add ovl_read, ovl_write.
2008-06-13 08:08:20 +00:00
|
|
|
|
text to PROCESS after you call this function.
|
|
|
|
|
If PROCESS is a serial process, wait until all output written to the
|
|
|
|
|
process has been transmitted to the serial port. */)
|
2010-07-08 14:25:08 -07:00
|
|
|
|
(Lisp_Object process)
|
1992-03-14 20:40:04 +00:00
|
|
|
|
{
|
|
|
|
|
Lisp_Object proc;
|
1998-12-15 04:35:38 +00:00
|
|
|
|
struct coding_system *coding;
|
1992-03-14 20:40:04 +00:00
|
|
|
|
|
(Qlocal, QCname, QCbuffer, QChost, QCservice, QCfamily)
(QClocal, QCremote, QCserver, QCdatagram, QCnowait, QCnoquery,QCstop)
(QCcoding, QCoptions, QCfilter, QCsentinel, QClog, QCfeature):
New variables.
(NETCONN1_P): New macro.
(DATAGRAM_SOCKETS): New conditional symbol.
(datagram_address): New array.
(DATAGRAM_CONN_P, DATAGRAM_CHAN_P): New macros.
(status_message): Use concat3.
(Fprocess_status): Add `listen' status to doc string. Return `stop'
for a stopped network process.
(Fset_process_buffer): Update contact plist for network process.
(Fset_process_filter): Ditto. Don't enable input for stopped
network processes. Server must listen, even if filter is t.
(Fset_process_query_on_exit_flag, Fprocess_query_on_exit_flag):
New functions.
(Fprocess_kill_without_query): Removed. Now defined in simple.el.
(Fprocess_contact): Added KEY argument. Handle datagrams.
(list_processes_1): Optionally show only processes with the query
on exit flag set. Dynamically adjust column widths. Omit tty
column if not needed. Report stopped network processes.
Identify server and datagram network processes.
(Flist_processes): New optional arg `query-only'.
(conv_sockaddr_to_lisp, get_lisp_to_sockaddr_size)
(conv_lisp_to_sockaddr, set_socket_options)
(network_process_featurep, unwind_request_sigio): New helper functions.
(Fprocess_datagram_address, Fset_process_datagram_address):
(Fset_network_process_options): New lisp functions.
(Fopen_network_stream): Removed. Now defined in simple.el.
(Fmake_network_process): New lisp function. Code is based on previous
Fopen_network_stream, but heavily reworked with new property list based
argument list, support for datagrams, server processes, and local
sockets in addition to old client-only functionality.
(server_accept_connection): New function.
(wait_reading_process_input): Use it to handle incoming connects.
Do not enable input on a new connection if process is stopped.
(read_process_output): Handle datagram sockets. Use 2k buffer for them.
(send_process): Handle datagram sockets.
(Fstop_process, Fcontinue_process): Apply to network processes. A stopped
network process is indicated by setting command field to t .
(Fprocess_send_eof): No-op if datagram connection.
(Fstatus_notify): Don't read input for a stream server socket or a
stopped network process.
(init_process): Initialize datagram_address array.
(syms_of_process): Intern and staticpro new variables, defsubr new
functions.
2002-03-17 20:20:33 +00:00
|
|
|
|
if (DATAGRAM_CONN_P (process))
|
|
|
|
|
return process;
|
|
|
|
|
|
1992-03-14 20:40:04 +00:00
|
|
|
|
proc = get_process (process);
|
(struct Lisp_Process): Turn slots infd, outfd, kill_without_query, pty_flag,
tick, update_tick, decoding_carryover, inherit_coding_system_flag,
filter_multibyte, adaptive_read_buffering, read_output_delay, and
read_output_skip from Lisp_Objects to ints. Remove unused
encoding_carryover.
2007-07-12 06:36:57 +00:00
|
|
|
|
coding = proc_encode_coding_system[XPROCESS (proc)->outfd];
|
1993-03-17 07:59:09 +00:00
|
|
|
|
|
|
|
|
|
/* Make sure the process is really alive. */
|
* process.h (struct Lisp_Process): Replace Lisp_Objects `pid',
`raw_status_high', and `raw_status_low' with plain integers, and move
them to the end of the structure.
* alloc.c (allocate_process): Use PSEUDOVECSIZE to initialize the
pseudovector's size field so only the Lisp_Object fields get GC'd.
* process.c (update_status, make_process, Fdelete_process)
(Fprocess_status, list_processes_1, start_process_unwind)
(create_process, Fmake_network_process, server_accept_connection)
(wait_reading_process_output, send_process, Fprocess_running_child_p)
(process_send_signal, proc_encode_coding_system, Fprocess_send_eof)
(sigchld_handler, status_notify): Adjust to new non-Lisp fields for
`pid' and `raw_status'.
(Fprocess_id, Fsignal_process): Same, and additionally use floats when
representing PIDs that are larger than most-positive-fixnum.
2006-04-08 15:07:35 +00:00
|
|
|
|
if (XPROCESS (proc)->raw_status_new)
|
1993-03-17 07:59:09 +00:00
|
|
|
|
update_status (XPROCESS (proc));
|
|
|
|
|
if (! EQ (XPROCESS (proc)->status, Qrun))
|
2002-07-15 00:01:34 +00:00
|
|
|
|
error ("Process %s not running", SDATA (XPROCESS (proc)->name));
|
1993-03-17 07:59:09 +00:00
|
|
|
|
|
1998-12-15 04:35:38 +00:00
|
|
|
|
if (CODING_REQUIRE_FLUSHING (coding))
|
|
|
|
|
{
|
|
|
|
|
coding->mode |= CODING_MODE_LAST_BLOCK;
|
|
|
|
|
send_process (proc, "", 0, Qnil);
|
|
|
|
|
}
|
|
|
|
|
|
(struct Lisp_Process): Turn slots infd, outfd, kill_without_query, pty_flag,
tick, update_tick, decoding_carryover, inherit_coding_system_flag,
filter_multibyte, adaptive_read_buffering, read_output_delay, and
read_output_skip from Lisp_Objects to ints. Remove unused
encoding_carryover.
2007-07-12 06:36:57 +00:00
|
|
|
|
if (XPROCESS (proc)->pty_flag)
|
1994-06-25 22:35:28 +00:00
|
|
|
|
send_process (proc, "\004", 1, Qnil);
|
2008-06-13 16:35:17 +00:00
|
|
|
|
else if (EQ (XPROCESS (proc)->type, Qserial))
|
Daniel Engeler <engeler at gmail.com>
These changes add serial port access.
* process.c: Add HAVE_SERIAL.
(Fdelete_process, Fprocess_status, Fset_process_buffer)
(Fset_process_filter, Fset_process_sentinel, Fprocess_contact)
(list_processes_1, select_wrapper, Fstop_process)
(Fcontinue_process, Fprocess_send_eof, kill_buffer_processes)
(status_notify): Modify to handle serial processes.
[HAVE_SERIAL] (Fserial_process_configure)
[HAVE_SERIAL] (make_serial_process_unwind, Fmake_serial_process):
New functions.
* process.h (struct Lisp_Process): Add `type'.
* sysdep.c [HAVE_TERMIOS] (serial_open, serial_configure):
New functions.
* w32.c (_sys_read_ahead, sys_read, sys_write): Modify to handle serial ports.
(serial_open, serial_configure) New functions.
* w32.h: Add FILE_SERIAL.
(struct _child_process): Add ovl_read, ovl_write.
2008-06-13 08:08:20 +00:00
|
|
|
|
{
|
|
|
|
|
#ifdef HAVE_TERMIOS
|
|
|
|
|
if (tcdrain (XPROCESS (proc)->outfd) != 0)
|
|
|
|
|
error ("tcdrain() failed: %s", emacs_strerror (errno));
|
|
|
|
|
#endif
|
|
|
|
|
/* Do nothing on Windows because writes are blocking. */
|
|
|
|
|
}
|
1992-03-14 20:40:04 +00:00
|
|
|
|
else
|
|
|
|
|
{
|
1998-08-08 00:49:24 +00:00
|
|
|
|
int old_outfd, new_outfd;
|
|
|
|
|
|
1997-06-19 08:13:44 +00:00
|
|
|
|
#ifdef HAVE_SHUTDOWN
|
1997-06-19 03:03:08 +00:00
|
|
|
|
/* If this is a network connection, or socketpair is used
|
|
|
|
|
for communication with the subprocess, call shutdown to cause EOF.
|
|
|
|
|
(In some old system, shutdown to socketpair doesn't work.
|
|
|
|
|
Then we just can't win.) */
|
2008-06-13 16:35:17 +00:00
|
|
|
|
if (EQ (XPROCESS (proc)->type, Qnetwork)
|
(struct Lisp_Process): Turn slots infd, outfd, kill_without_query, pty_flag,
tick, update_tick, decoding_carryover, inherit_coding_system_flag,
filter_multibyte, adaptive_read_buffering, read_output_delay, and
read_output_skip from Lisp_Objects to ints. Remove unused
encoding_carryover.
2007-07-12 06:36:57 +00:00
|
|
|
|
|| XPROCESS (proc)->outfd == XPROCESS (proc)->infd)
|
|
|
|
|
shutdown (XPROCESS (proc)->outfd, 1);
|
1997-06-19 03:03:08 +00:00
|
|
|
|
/* In case of socketpair, outfd == infd, so don't close it. */
|
(struct Lisp_Process): Turn slots infd, outfd, kill_without_query, pty_flag,
tick, update_tick, decoding_carryover, inherit_coding_system_flag,
filter_multibyte, adaptive_read_buffering, read_output_delay, and
read_output_skip from Lisp_Objects to ints. Remove unused
encoding_carryover.
2007-07-12 06:36:57 +00:00
|
|
|
|
if (XPROCESS (proc)->outfd != XPROCESS (proc)->infd)
|
|
|
|
|
emacs_close (XPROCESS (proc)->outfd);
|
1997-06-19 08:13:44 +00:00
|
|
|
|
#else /* not HAVE_SHUTDOWN */
|
(struct Lisp_Process): Turn slots infd, outfd, kill_without_query, pty_flag,
tick, update_tick, decoding_carryover, inherit_coding_system_flag,
filter_multibyte, adaptive_read_buffering, read_output_delay, and
read_output_skip from Lisp_Objects to ints. Remove unused
encoding_carryover.
2007-07-12 06:36:57 +00:00
|
|
|
|
emacs_close (XPROCESS (proc)->outfd);
|
1997-06-19 08:13:44 +00:00
|
|
|
|
#endif /* not HAVE_SHUTDOWN */
|
Add support for large files, 64-bit Solaris, system locale codings.
* Makefile.in (emacs): Set the LC_ALL environment variable to "C"
when dumping, so that the dumped Emacs doesn't have stray locale info.
(dired.o): Depend on systime.h.
(editfns.o): Depend on coding.h.
* alloc.c, buffer.c, callproc.c, ccl.c, charset.c, coding.c, data.c,
dispnew.c, editfns.c, emacs.c, filelock.c, floatfns.c, hftctl.c,
keyboard.c, process.c, sysdep.c, unexelf.c, unexhp9k800.c,
unexsunos4.c, vmsfns.c, vmsgmalloc.c, w32faces.c, w32menu.c, w32term.c,
w32xfns.c, xfaces.c, xfns.c, xmenu.c, xterm.c:
Include <config.h> before any system include files.
* alloc.c, buffer.c, ccl.c, data.c, editfns.c, emacs.c, eval.c,
fileio.c, filelock.c, frame.c, insdel.c, keymap.c, lread.c,
m/alpha.h, print.c, search.c, sysdep.c, xdisp.c, xfaces.c, xfns.c,
xmenu.c, xterm.c:
Do not include <stdlib.h>, as <config.h> does this now.
* callproc.c (Fcall_process):
Synchronize messages locale before invoking strerror.
Decode resulting string with locale-coding-system.
* coding.c (Vlocale_coding_system): New var.
(syms_of_coding): Adjust to above change.
(emacs_strerror): New function.
* coding.h (emacs_strerror, Vlocale_coding_system): New decls.
* config.in (HAVE_STDIO_EXT_H, HAVE_TM_GMTOFF, HAVE___FPENDING,
HAVE_FTELLO, HAVE_GETLOADAVG, HAVE_MBLEN, HAVE_MBRLEN,
HAVE_STRSIGNAL): New macros.
(BITS_PER_LONG): Default to 64 if _LP64 is defined.
<stdlib.h>: Include if HAVE_STDLIB_H is defined and NOT_C_CODE isn't.
* dired.c: Include "systime.h".
(Ffile_attributes): Do not cast s.st_size to int; this loses
information if int is 32 bits but st_size and EMACS_INT are larger.
Treat large device numbers like large inode numbers.
* dispnew.c (PENDING_OUTPUT_COUNT): Use __fpending if available.
* editfns.c: Include coding.h.
(emacs_strftime): Remove decl.
(emacs_strftimeu): New decl.
(emacs_memftimeu): Renamed from emacs_memftime; new arg UT.
Use emacs_strftimeu instead of emacs_strftime.
(Fformat_time_string): Convert format string using
Vlocale_coding_system, and convert result back. Synchronize time
locale before invoking lower level function. Invoke
emacs_memftimeu, passing ut, instead of emacs_memftime.
* emacs.c: Include <locale.h> if HAVE_SETLOCALE is defined.
(Vmessages_locale, Vprevious_messages_locale, Vtime_locale,
Vprevious_time_locale): New variables.
(main): Invoke setlocale early, so that initial error messages are
localized properly. But skip locale-setting if LC_ALL is "C".
Fix up locale when it's safe to do so.
(fixup_locale): Moved here from xterm.c.
(synchronize_locale, synchronize_time_locale,
synchronize_messages_locale): New functions.
(syms_of_emacs): Accommodate above changes.
* fileio.c (report_file_error): Convert strerror output according
to Vlocale_coding_system.
(Finsert_file_contents): Check for arithmetic overflow in
computations that depend on file size. Report IO errors
with emacs_strerror, not strerror.
* fns.c (Fgethash): Declare dflt parameter.
* gmalloc.c: Do not define const to nothing if HAVE_CONFIG_H
is defined; that's config.h's job.
* lisp.h (EMACS_INT, BITS_PER_EMACS_INT, EMACS_UINT): If _LP64,
default these values to long, BITS_PER_LONG, and unsigned long.
(VALBITS, MARKBIT, XINT): Do not assume 32-bit EMACS_INT.
(PNTR_COMPARISON_TYPE): Default to EMACS_UINT, not to unsigned int.
(code_convert_string_norecord, fixup_locale,
synchronize_messages_locale, synchronize_time_locale,
emacs_open, emacs_close, emacs_read, emacs_write): New decls.
All Emacs callers of open, close, read, write changed to use
emacs_open, emacs_close, emacs_read, emacs_write.
* lread.c (file_offset, file_tell): New macros. All uses of ftell
changed to file_tell.
(saved_doc_string_position, prev_saved_doc_string_position): Now
of type file_offset.
(init_lread): Do not fix locale here; fixup_locale now does this.
* m/amdahl.h, s/usg5-4.h:
(NSIG): Remove.
(NSIG_MINIMUM): New macro.
* m/cydra5.h, m/dpx2.h, m/mips.h, m/pfa50.h, m/sps7.h, m/stride.h,
m/ustation.h, s/gnu-linux.h, s/hpux.h, s/iris3-5.h, s/iris3-6.h,
s/umips.h, s/usg5-4.h:
(SIGIO): Do not undef.
(BROKEN_SIGIO): New macro.
* m/ustation.h:
(SIGTSTP): Do not undef.
(BROKEN_SIGTSTP): New macro.
* s/gnu-linux.h:
(SIGPOLL, SIGURG): Do not undef.
(BROKEN_SIGPOLL, BROKEN_SIGURG): New macros.
* s/ptx4.h:
(SIGINFO): Do not undef.
(BROKEN_SIGINFO): New macros.
* m/delta.h, s/ptx.h, s/template.h: Doc fix.
* mktime.c, strftime.c: Update to glibc 2.1.2 version, with
some Emacs-related changes merged.
* print.c (float_to_string): Prepend "-" to representation of a
NaN if the NaN is negative.
* process.c (sys_siglist): Omit if HAVE_STRSIGNAL.
(wait_reading_process_input): Use emacs_strerror, not strerror.
* process.c (status_message, sigchld_handler): Synchronize locale,
then use strsignal istead of sys_siglist.
* w32proc.c (sys_wait): Likewise.
* s/aix3-1.h, s/bsd4-1.h, s/dgux.h, s/gnu-linux.h, s/hiuxmpp.h,
s/hpux.h, s/iris3-5.h, s/iris3-6.h, s/irix3-3.h, s/osf1.h, s/rtu.h,
s/sunos4-1.h, s/unipl5-0.h, s/unipl5-2.h, s/usg5-0.h, s/usg5-2-2.h,
s/usg5-2.h, s/usg5-3.h, s/xenix.h:
(open, close, read, write, INTERRUPTIBLE_OPEN,
INTERRUPTIBLE_CLOSE, INTERRUPTIBLE_IO): Remove.
* s/sol2-5.h (_LARGEFILE_SOURCE, _FILE_OFFSET_BITS): New macros.
* sysdep.c (sys_read, sys_write, read, write, sys_close, close,
sys_open, open): Remove.
(emacs_open, emacs_close, emacs_read, emacs_write): Always define;
the old INTERRUPTIBLE_OPEN, INTERRUPTIBLE_CLOSE, and INTERRUPTIBLE_IO
macros are no longer used.
(emacs_open): Renamed from sys_open. Merge BSD4_1 version.
(emacs_close): Renamed from sys_close.
(emacs_read): Renamed from sys_read.
(emacs_write): Renamed from sys_write.
(sys_siglist): Do not declare if HAVE_STRSIGNAL.
(dup2): Do not print error on failure; the real dup2 doesn't.
(strsignal): New function, defined if !HAVE_STRSIGNAL.
* syssignal.h (SIGINFO): Undef if defined and if BROKEN_SIGINFO
is defined.
(SIGIO, SIGPOLL, SIGTSTP, SIGURG): Likewise.
(NSIG): If less than NSIG_MINIMUM, define to NSIG_MINIMUM.
(strsignal): Declare if !HAVE_STRSIGNAL.
* unexelf.c (ElfBitsW, ELFSIZE, ElfExpandBitsW): New macros.
(ElfW): Define in terms of ElfExpandBitsW.
* w32proc.c (sys_siglist): Remove decl.
* xdisp.c (decode_mode_spec): 3rd arg is int, not char, to comply
with ANSI C.
(display_string): Declare face_string_pos arg.
* xfns.c (Fx_show_tip): Declare timeout param.
* xterm.c: No need to include locale.h.
(x_alloc_lighter_color, x_setup_relief_color):
Pass arg as double, not float, for compatibility with ANSI C.
(fixup_locale): Move to emacs.c.
(x_term_init): Do not setlocale or fixup locale; the main program
does this now.
1999-10-19 07:25:11 +00:00
|
|
|
|
new_outfd = emacs_open (NULL_DEVICE, O_WRONLY, 0);
|
2006-04-12 15:01:37 +00:00
|
|
|
|
if (new_outfd < 0)
|
|
|
|
|
abort ();
|
(struct Lisp_Process): Turn slots infd, outfd, kill_without_query, pty_flag,
tick, update_tick, decoding_carryover, inherit_coding_system_flag,
filter_multibyte, adaptive_read_buffering, read_output_delay, and
read_output_skip from Lisp_Objects to ints. Remove unused
encoding_carryover.
2007-07-12 06:36:57 +00:00
|
|
|
|
old_outfd = XPROCESS (proc)->outfd;
|
1998-08-08 00:49:24 +00:00
|
|
|
|
|
|
|
|
|
if (!proc_encode_coding_system[new_outfd])
|
|
|
|
|
proc_encode_coding_system[new_outfd]
|
|
|
|
|
= (struct coding_system *) xmalloc (sizeof (struct coding_system));
|
Replace bcopy, bzero, bcmp by memcpy, memmove, memset, memcmp
* alloc.c (overrun_check_malloc, overrun_check_realloc)
(overrun_check_free, xstrdup, allocate_string)
(allocate_string_data, compact_small_strings, Fmake_string)
(make_unibyte_string, make_multibyte_string)
(make_string_from_bytes, make_specified_string, make_float)
(Fcons, allocate_terminal, allocate_frame, make_pure_string)
(Fgarbage_collect): Replace bcopy, safe_bcopy, bzero, bcmp by
memcpy, memmove, memset, memcmp.
* atimer.c (start_atimer, set_alarm): Likewise.
* buffer.c (clone_per_buffer_values, report_overlay_modification)
(mmap_realloc, init_buffer_once): Likewise.
* callint.c (Fcall_interactively): Likewise.
* callproc.c (Fcall_process, Fcall_process_region, child_setup)
(getenv_internal_1): Likewise.
* casefiddle.c (casify_object): Likewise.
* ccl.c (ccl_driver): Likewise.
* character.c (str_as_multibyte, str_to_multibyte): Likewise.
* charset.c (load_charset_map_from_file)
(load_charset_map_from_file, load_charset_map_from_vector)
(Fdefine_charset_internal): Likewise.
* cm.c (Wcm_clear): Likewise.
* coding.c (decode_eol, decode_coding_object)
(Fset_coding_system_priority, make_subsidiaries): Likewise.
* data.c (Faset): Likewise.
* dired.c (directory_files_internal, file_name_completion_stat):
Likewise.
* dispnew.c (new_glyph_matrix, adjust_glyph_matrix)
(clear_glyph_row, copy_row_except_pointers)
(copy_glyph_row_contents, new_glyph_pool, realloc_glyph_pool)
(save_current_matrix, restore_current_matrix)
(build_frame_matrix_from_leaf_window, mirrored_line_dance)
(mirror_line_dance, scrolling_window): Likewise.
* doc.c (Fsnarf_documentation, Fsubstitute_command_keys):
Likewise.
* doprnt.c (doprnt): Likewise.
* editfns.c (Fuser_full_name, make_buffer_string_both)
(Fmessage_box, Fformat, Ftranspose_regions): Likewise.
* emacs.c (sort_args): Likewise.
* eval.c (Fapply, Ffuncall): Likewise.
* fileio.c (Ffile_name_directory, make_temp_name)
(Fexpand_file_name, search_embedded_absfilename)
(Fsubstitute_in_file_name, Ffile_symlink_p, Finsert_file_contents)
(auto_save_error): Likewise.
* fns.c (Fstring_equal, Fcopy_sequence, concat)
(string_to_multibyte, Fstring_as_unibyte, Fstring_as_multibyte)
(internal_equal, Fclear_string, larger_vector, copy_hash_table)
(Fmake_hash_table): Likewise.
* fringe.c (Fdefine_fringe_bitmap): Likewise.
* ftfont.c (ftfont_text_extents): Likewise.
* getloadavg.c (getloadavg): Likewise.
* image.c (define_image_type, make_image, make_image_cache)
(x_create_x_image_and_pixmap, xbm_image_p)
(w32_create_pixmap_from_bitmap_data, xbm_load, xpm_lookup_color)
(xpm_image_p, x_create_bitmap_from_xpm_data, xpm_load)
(init_color_table, x_build_heuristic_mask, pbm_image_p, pbm_load)
(png_image_p, png_read_from_memory, png_load, jpeg_image_p)
(tiff_image_p, tiff_read_from_memory, gif_image_p)
(gif_read_from_memory, gif_load, svg_image_p, gs_image_p):
Likewise.
* indent.c (scan_for_column, compute_motion): Likewise.
* insdel.c (gap_left, gap_right, make_gap_smaller, copy_text)
(insert_1_both, insert_from_gap, replace_range_2): Likewise.
* intervals.c (reproduce_tree, reproduce_tree_obj): Likewise.
* keyboard.c (echo_char, save_getcjmp, restore_getcjmp)
(kbd_buffer_store_event_hold, apply_modifiers_uncached)
(store_user_signal_events, menu_bar_items, tool_bar_items)
(process_tool_bar_item, append_tool_bar_item)
(read_char_minibuf_menu_prompt, read_key_sequence)
(Fread_key_sequence, Fread_key_sequence_vector, Frecent_keys):
Likewise.
* keymap.c (current_minor_maps, Fdescribe_buffer_bindings):
Likewise.
* lisp.h (STRING_COPYIN): Likewise.
* lread.c (Fload, read1, oblookup): Likewise.
* msdos.c (Frecent_doskeys): Likewise.
* nsfns.m (Fx_create_frame): Likewise.
* nsfont.m (nsfont_open, nsfont_text_extents, ns_glyph_metrics):
Likewise.
* nsimage.m (EmacsImage-initFromSkipXBM:width:height:)
(EmacsImage-initForXPMWithDepth:width:height:flip:length:):
Likewise.
* nsmenu.m (ns_update_menubar): Likewise.
* nsterm.m (ns_draw_fringe_bitmap, ns_term_init): Likewise.
* print.c (print_unwind, printchar, strout, print_string)
(print_error_message): Likewise.
* process.c (conv_lisp_to_sockaddr, set_socket_option)
(Fmake_network_process, Fnetwork_interface_list)
(Fnetwork_interface_info, read_process_output, Fprocess_send_eof)
(init_process): Likewise.
* ralloc.c (resize_bloc, r_alloc_sbrk, r_alloc_init): Likewise.
* regex.c (init_syntax_once, regex_compile, re_compile_fastmap):
Likewise.
* scroll.c (do_scrolling, do_direct_scrolling)
(scrolling_max_lines_saved): Likewise.
* search.c (search_buffer, wordify, Freplace_match): Likewise.
* sound.c (wav_init, au_init, Fplay_sound_internal): Likewise.
* syntax.c (skip_chars, skip_syntaxes): Likewise.
* sysdep.c (child_setup_tty, sys_subshell, emacs_get_tty)
(emacs_set_tty): Likewise.
* term.c (encode_terminal_code, calculate_costs)
(produce_special_glyphs, create_tty_output, init_tty, delete_tty):
Likewise.
* termcap.c (tgetst1, gobble_line): Likewise.
* termhooks.h (EVENT_INIT): Likewise.
* tparam.c (tparam1): Likewise.
* unexalpha.c (unexec): Likewise.
* unexec.c (write_segment): Likewise.
* unexmacosx.c (unexec_write_zero): Likewise.
* w32fns.c (w32_wnd_proc, Fx_create_frame, x_create_tip_frame)
(Fx_file_dialog, Fsystem_move_file_to_trash): Likewise.
* w32font.c (w32font_list_family, w32font_text_extents)
(w32font_list_internal, w32font_match_internal)
(w32font_open_internal, compute_metrics, Fx_select_font):
Likewise.
* w32menu.c (set_frame_menubar, add_menu_item)
(w32_menu_display_help, w32_free_submenu_strings): Likewise.
* w32term.c (XCreateGC, w32_initialize_display_info): Likewise.
* w32uniscribe.c (uniscribe_list_family): Likewise.
* w32xfns.c (get_next_msg, post_msg, prepend_msg): Likewise.
* window.c (make_window, replace_window, set_window_buffer)
(Fsplit_window): Likewise.
* xdisp.c (init_iterator, RECORD_OVERLAY_STRING, reseat_to_string)
(add_to_log, message3, x_consider_frame_title)
(append_space_for_newline, extend_face_to_end_of_line)
(decode_mode_spec_coding, init_glyph_string): Likewise.
* xfaces.c (x_create_gc, get_lface_attributes_no_remap)
(Finternal_copy_lisp_face, Finternal_merge_in_global_face)
(face_attr_equal_p, make_realized_face, make_face_cache)
(free_realized_faces, lookup_named_face, smaller_face)
(face_with_height, lookup_derived_face)
(x_supports_face_attributes_p, Finternal_set_font_selection_order)
(Finternal_set_font_selection_order, realize_default_face)
(compute_char_face, face_at_buffer_position)
(face_for_overlay_string, face_at_string_position, merge_faces):
Likewise.
* xfns.c (xic_create_fontsetname, Fx_create_frame)
(Fx_window_property, x_create_tip_frame)
(Fx_backspace_delete_keys_p): Likewise.
* xfont.c (xfont_list, xfont_match, xfont_list_family)
(xfont_text_extents): Likewise.
* xmenu.c (set_frame_menubar, xmenu_show): Likewise.
* xrdb.c (magic_file_p, x_get_resource): Likewise.
* xselect.c (x_queue_event, x_get_window_property)
(receive_incremental_selection): Likewise.
* xsmfns.c (x_session_check_input): Likewise.
* xterm.c (x_send_scroll_bar_event, SET_SAVED_MENU_EVENT)
(handle_one_xevent, x_check_errors, xim_initialize, x_term_init):
Likewise.
* character.h (BCOPY_SHORT): Removed.
* config.in: Regenerate.
* dispnew.c (safe_bcopy): Only define as dummy if PROFILING.
* emacs.c (main) [PROFILING]: Don't declare
dump_opcode_frequencies.
* lisp.h (safe_bcopy): Remove declaration.
(memset) [!HAVE_MEMSET]: Declare.
(memcpy) [!HAVE_MEMCPY]: Likewise.
(memmove) [!HAVE_MEMMOVE]: Likewise.
(memcmp) [!HAVE_MEMCMP]: Likewise.
* s/ms-w32.h (bzero, bcopy, bcmp, GAP_USE_BCOPY)
(BCOPY_UPWARD_SAFE, BCOPY_DOWNWARD_SAFE, HAVE_BCOPY, HAVE_BCMP):
Don't define.
(HAVE_MEMCMP, HAVE_MEMCPY, HAVE_MEMMOVE, HAVE_MEMSET): Define.
* s/msdos.h (GAP_USE_BCOPY, BCOPY_UPWARD_SAFE)
(BCOPY_DOWNWARD_SAFE): Don't define.
* sysdep.c (memset) [!HAVE_MEMSET]: Define.
(memcpy) [!HAVE_MEMCPY]: Define.
(memmove) [!HAVE_MEMMOVE]: Define.
(memcmp) [!HAVE_MEMCMP]: Define.
* config.nt (HAVE_BCOPY, HAVE_BCMP): Remove undefs.
(HAVE_MEMCPY, HAVE_MEMMOVE, HAVE_MEMSET, HAVE_MEMCMP): Add undefs.
* sed2v2.inp (HAVE_MEMCPY, HAVE_MEMSET): Edit to 1.
(HAVE_BZERO): Don't edit.
* lwlib.c (lwlib_memset, lwlib_bcopy): Remove.
(malloc_widget_value, free_widget_info, allocate_widget_instance)
(lw_separator_p): Replace lwlib_memset, lwlib_bcopy, bzero, bcmp by
memset, memcpy, memcmp.
* lwlib-utils.c (XtApplyToWidgets): Likewise.
* xlwmenu.c (XlwMenuInitialize): Likewise.
* lwlib.h (lwlib_bcopy): Remove declaration.
* ebrowse.c (add_sym, make_namespace): Replace bcopy, bzero by
memcpy, memmove, memset.
* pop.c (pop_retrieve, socket_connection, pop_getline): Likewise.
* CPP-DEFINES (BCOPY_DOWNWARD_SAFE, BCOPY_UPWARD_SAFE)
(GAP_USE_BCOPY, HAVE_BCMP, HAVE_BCOPY, bcmp, bcopy, bzero):
Remove.
* configure.in: Don't check for bcopy, bcmp, bzero. Don't include
<strings.h> and don't define bcopy, bzero, BCMP in config.h.
2010-07-08 00:18:28 +02:00
|
|
|
|
memcpy (proc_encode_coding_system[new_outfd],
|
|
|
|
|
proc_encode_coding_system[old_outfd],
|
|
|
|
|
sizeof (struct coding_system));
|
|
|
|
|
memset (proc_encode_coding_system[old_outfd], 0,
|
|
|
|
|
sizeof (struct coding_system));
|
1998-08-08 00:49:24 +00:00
|
|
|
|
|
(struct Lisp_Process): Turn slots infd, outfd, kill_without_query, pty_flag,
tick, update_tick, decoding_carryover, inherit_coding_system_flag,
filter_multibyte, adaptive_read_buffering, read_output_delay, and
read_output_skip from Lisp_Objects to ints. Remove unused
encoding_carryover.
2007-07-12 06:36:57 +00:00
|
|
|
|
XPROCESS (proc)->outfd = new_outfd;
|
1992-03-14 20:40:04 +00:00
|
|
|
|
}
|
|
|
|
|
return process;
|
|
|
|
|
}
|
|
|
|
|
|
2001-09-20 11:44:26 +00:00
|
|
|
|
/* On receipt of a signal that a child status has changed, loop asking
|
|
|
|
|
about children with changed statuses until the system says there
|
|
|
|
|
are no more.
|
2003-02-04 14:56:31 +00:00
|
|
|
|
|
2001-09-20 11:44:26 +00:00
|
|
|
|
All we do is change the status; we do not run sentinels or print
|
|
|
|
|
notifications. That is saved for the next time keyboard input is
|
|
|
|
|
done, in order to avoid timing errors.
|
|
|
|
|
|
|
|
|
|
** WARNING: this can be called during garbage collection.
|
|
|
|
|
Therefore, it must not be fooled by the presence of mark bits in
|
|
|
|
|
Lisp objects.
|
|
|
|
|
|
|
|
|
|
** USG WARNING: Although it is not obvious from the documentation
|
|
|
|
|
in signal(2), on a USG system the SIGCLD handler MUST NOT call
|
|
|
|
|
signal() before executing at least one wait(), otherwise the
|
|
|
|
|
handler will be called again, resulting in an infinite loop. The
|
|
|
|
|
relevant portion of the documentation reads "SIGCLD signals will be
|
|
|
|
|
queued and the signal-catching function will be continually
|
|
|
|
|
reentered until the queue is empty". Invoking signal() causes the
|
|
|
|
|
kernel to reexamine the SIGCLD queue. Fred Fish, UniSoft Systems
|
2004-04-16 12:51:06 +00:00
|
|
|
|
Inc.
|
|
|
|
|
|
|
|
|
|
** Malloc WARNING: This should never call malloc either directly or
|
|
|
|
|
indirectly; if it does, that is a bug */
|
1992-03-14 20:40:04 +00:00
|
|
|
|
|
2006-06-01 14:08:25 +00:00
|
|
|
|
#ifdef SIGCHLD
|
1992-03-14 20:40:04 +00:00
|
|
|
|
SIGTYPE
|
2010-07-05 12:36:06 +02:00
|
|
|
|
sigchld_handler (int signo)
|
1992-03-14 20:40:04 +00:00
|
|
|
|
{
|
|
|
|
|
int old_errno = errno;
|
|
|
|
|
Lisp_Object proc;
|
|
|
|
|
register struct Lisp_Process *p;
|
1993-02-22 14:47:53 +00:00
|
|
|
|
extern EMACS_TIME *input_available_clear_time;
|
1992-03-14 20:40:04 +00:00
|
|
|
|
|
2004-12-15 21:40:41 +00:00
|
|
|
|
SIGNAL_THREAD_CHECK (signo);
|
|
|
|
|
|
1992-03-14 20:40:04 +00:00
|
|
|
|
while (1)
|
|
|
|
|
{
|
2007-03-17 18:16:03 +00:00
|
|
|
|
pid_t pid;
|
2008-07-12 05:31:23 +00:00
|
|
|
|
int w;
|
1992-03-14 20:40:04 +00:00
|
|
|
|
Lisp_Object tail;
|
|
|
|
|
|
|
|
|
|
#ifdef WNOHANG
|
|
|
|
|
#ifndef WUNTRACED
|
|
|
|
|
#define WUNTRACED 0
|
|
|
|
|
#endif /* no WUNTRACED */
|
|
|
|
|
/* Keep trying to get a status until we get a definitive result. */
|
2007-03-25 03:03:40 +00:00
|
|
|
|
do
|
2009-01-01 15:58:38 +00:00
|
|
|
|
{
|
2007-03-17 18:24:46 +00:00
|
|
|
|
errno = 0;
|
|
|
|
|
pid = wait3 (&w, WNOHANG | WUNTRACED, 0);
|
|
|
|
|
}
|
2007-03-25 03:03:40 +00:00
|
|
|
|
while (pid < 0 && errno == EINTR);
|
1992-03-14 20:40:04 +00:00
|
|
|
|
|
|
|
|
|
if (pid <= 0)
|
|
|
|
|
{
|
2001-09-20 11:44:26 +00:00
|
|
|
|
/* PID == 0 means no processes found, PID == -1 means a real
|
|
|
|
|
failure. We have done all our job, so return. */
|
1992-03-14 20:40:04 +00:00
|
|
|
|
|
|
|
|
|
errno = old_errno;
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
#else
|
|
|
|
|
pid = wait (&w);
|
|
|
|
|
#endif /* no WNOHANG */
|
|
|
|
|
|
|
|
|
|
/* Find the process that signaled us, and record its status. */
|
|
|
|
|
|
2006-06-01 14:08:25 +00:00
|
|
|
|
/* The process can have been deleted by Fdelete_process. */
|
2007-06-29 03:37:33 +00:00
|
|
|
|
for (tail = deleted_pid_list; CONSP (tail); tail = XCDR (tail))
|
2006-06-01 14:08:25 +00:00
|
|
|
|
{
|
2007-03-17 18:16:03 +00:00
|
|
|
|
Lisp_Object xpid = XCAR (tail);
|
2007-06-29 03:37:33 +00:00
|
|
|
|
if ((INTEGERP (xpid) && pid == (pid_t) XINT (xpid))
|
|
|
|
|
|| (FLOATP (xpid) && pid == (pid_t) XFLOAT_DATA (xpid)))
|
2007-03-17 18:16:03 +00:00
|
|
|
|
{
|
|
|
|
|
XSETCAR (tail, Qnil);
|
|
|
|
|
goto sigchld_end_of_loop;
|
|
|
|
|
}
|
2006-06-01 14:08:25 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Otherwise, if it is asynchronous, it is in Vprocess_alist. */
|
1992-03-14 20:40:04 +00:00
|
|
|
|
p = 0;
|
2007-06-29 03:37:33 +00:00
|
|
|
|
for (tail = Vprocess_alist; CONSP (tail); tail = XCDR (tail))
|
1992-03-14 20:40:04 +00:00
|
|
|
|
{
|
1999-09-12 05:07:01 +00:00
|
|
|
|
proc = XCDR (XCAR (tail));
|
1992-03-14 20:40:04 +00:00
|
|
|
|
p = XPROCESS (proc);
|
Daniel Engeler <engeler at gmail.com>
These changes add serial port access.
* process.c: Add HAVE_SERIAL.
(Fdelete_process, Fprocess_status, Fset_process_buffer)
(Fset_process_filter, Fset_process_sentinel, Fprocess_contact)
(list_processes_1, select_wrapper, Fstop_process)
(Fcontinue_process, Fprocess_send_eof, kill_buffer_processes)
(status_notify): Modify to handle serial processes.
[HAVE_SERIAL] (Fserial_process_configure)
[HAVE_SERIAL] (make_serial_process_unwind, Fmake_serial_process):
New functions.
* process.h (struct Lisp_Process): Add `type'.
* sysdep.c [HAVE_TERMIOS] (serial_open, serial_configure):
New functions.
* w32.c (_sys_read_ahead, sys_read, sys_write): Modify to handle serial ports.
(serial_open, serial_configure) New functions.
* w32.h: Add FILE_SERIAL.
(struct _child_process): Add ovl_read, ovl_write.
2008-06-13 08:08:20 +00:00
|
|
|
|
if (EQ (p->type, Qreal) && p->pid == pid)
|
1992-03-14 20:40:04 +00:00
|
|
|
|
break;
|
|
|
|
|
p = 0;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Look for an asynchronous process whose pid hasn't been filled
|
|
|
|
|
in yet. */
|
|
|
|
|
if (p == 0)
|
2007-06-29 03:37:33 +00:00
|
|
|
|
for (tail = Vprocess_alist; CONSP (tail); tail = XCDR (tail))
|
1992-03-14 20:40:04 +00:00
|
|
|
|
{
|
1999-09-12 05:07:01 +00:00
|
|
|
|
proc = XCDR (XCAR (tail));
|
1992-03-14 20:40:04 +00:00
|
|
|
|
p = XPROCESS (proc);
|
* process.h (struct Lisp_Process): Replace Lisp_Objects `pid',
`raw_status_high', and `raw_status_low' with plain integers, and move
them to the end of the structure.
* alloc.c (allocate_process): Use PSEUDOVECSIZE to initialize the
pseudovector's size field so only the Lisp_Object fields get GC'd.
* process.c (update_status, make_process, Fdelete_process)
(Fprocess_status, list_processes_1, start_process_unwind)
(create_process, Fmake_network_process, server_accept_connection)
(wait_reading_process_output, send_process, Fprocess_running_child_p)
(process_send_signal, proc_encode_coding_system, Fprocess_send_eof)
(sigchld_handler, status_notify): Adjust to new non-Lisp fields for
`pid' and `raw_status'.
(Fprocess_id, Fsignal_process): Same, and additionally use floats when
representing PIDs that are larger than most-positive-fixnum.
2006-04-08 15:07:35 +00:00
|
|
|
|
if (p->pid == -1)
|
1992-03-14 20:40:04 +00:00
|
|
|
|
break;
|
|
|
|
|
p = 0;
|
|
|
|
|
}
|
2003-02-04 14:56:31 +00:00
|
|
|
|
|
1992-03-14 20:40:04 +00:00
|
|
|
|
/* Change the status of the process that was found. */
|
|
|
|
|
if (p != 0)
|
|
|
|
|
{
|
1994-11-01 08:31:31 +00:00
|
|
|
|
int clear_desc_flag = 0;
|
2003-02-04 14:56:31 +00:00
|
|
|
|
|
(struct Lisp_Process): Turn slots infd, outfd, kill_without_query, pty_flag,
tick, update_tick, decoding_carryover, inherit_coding_system_flag,
filter_multibyte, adaptive_read_buffering, read_output_delay, and
read_output_skip from Lisp_Objects to ints. Remove unused
encoding_carryover.
2007-07-12 06:36:57 +00:00
|
|
|
|
p->tick = ++process_tick;
|
2008-07-12 05:31:23 +00:00
|
|
|
|
p->raw_status = w;
|
* process.h (struct Lisp_Process): Replace Lisp_Objects `pid',
`raw_status_high', and `raw_status_low' with plain integers, and move
them to the end of the structure.
* alloc.c (allocate_process): Use PSEUDOVECSIZE to initialize the
pseudovector's size field so only the Lisp_Object fields get GC'd.
* process.c (update_status, make_process, Fdelete_process)
(Fprocess_status, list_processes_1, start_process_unwind)
(create_process, Fmake_network_process, server_accept_connection)
(wait_reading_process_output, send_process, Fprocess_running_child_p)
(process_send_signal, proc_encode_coding_system, Fprocess_send_eof)
(sigchld_handler, status_notify): Adjust to new non-Lisp fields for
`pid' and `raw_status'.
(Fprocess_id, Fsignal_process): Same, and additionally use floats when
representing PIDs that are larger than most-positive-fixnum.
2006-04-08 15:07:35 +00:00
|
|
|
|
p->raw_status_new = 1;
|
2003-02-04 14:56:31 +00:00
|
|
|
|
|
1992-03-14 20:40:04 +00:00
|
|
|
|
/* If process has terminated, stop waiting for its output. */
|
1994-11-01 08:31:31 +00:00
|
|
|
|
if ((WIFSIGNALED (w) || WIFEXITED (w))
|
(struct Lisp_Process): Turn slots infd, outfd, kill_without_query, pty_flag,
tick, update_tick, decoding_carryover, inherit_coding_system_flag,
filter_multibyte, adaptive_read_buffering, read_output_delay, and
read_output_skip from Lisp_Objects to ints. Remove unused
encoding_carryover.
2007-07-12 06:36:57 +00:00
|
|
|
|
&& p->infd >= 0)
|
1994-11-01 08:31:31 +00:00
|
|
|
|
clear_desc_flag = 1;
|
|
|
|
|
|
|
|
|
|
/* We use clear_desc_flag to avoid a compiler bug in Microsoft C. */
|
|
|
|
|
if (clear_desc_flag)
|
|
|
|
|
{
|
(struct Lisp_Process): Turn slots infd, outfd, kill_without_query, pty_flag,
tick, update_tick, decoding_carryover, inherit_coding_system_flag,
filter_multibyte, adaptive_read_buffering, read_output_delay, and
read_output_skip from Lisp_Objects to ints. Remove unused
encoding_carryover.
2007-07-12 06:36:57 +00:00
|
|
|
|
FD_CLR (p->infd, &input_wait_mask);
|
|
|
|
|
FD_CLR (p->infd, &non_keyboard_wait_mask);
|
1994-11-01 08:31:31 +00:00
|
|
|
|
}
|
1993-02-22 14:47:53 +00:00
|
|
|
|
|
2004-08-20 10:33:25 +00:00
|
|
|
|
/* Tell wait_reading_process_output that it needs to wake up and
|
1993-02-22 14:47:53 +00:00
|
|
|
|
look around. */
|
|
|
|
|
if (input_available_clear_time)
|
|
|
|
|
EMACS_SET_SECS_USECS (*input_available_clear_time, 0, 0);
|
1992-03-14 20:40:04 +00:00
|
|
|
|
}
|
|
|
|
|
|
2006-06-01 14:08:25 +00:00
|
|
|
|
/* There was no asynchronous process found for that pid: we have
|
|
|
|
|
a synchronous process. */
|
1992-03-14 20:40:04 +00:00
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
synch_process_alive = 0;
|
|
|
|
|
|
|
|
|
|
/* Report the status of the synchronous process. */
|
|
|
|
|
if (WIFEXITED (w))
|
|
|
|
|
synch_process_retcode = WRETCODE (w);
|
|
|
|
|
else if (WIFSIGNALED (w))
|
2009-01-01 15:58:38 +00:00
|
|
|
|
synch_process_termsig = WTERMSIG (w);
|
1993-02-22 14:47:53 +00:00
|
|
|
|
|
2004-08-20 10:33:25 +00:00
|
|
|
|
/* Tell wait_reading_process_output that it needs to wake up and
|
1993-02-22 14:47:53 +00:00
|
|
|
|
look around. */
|
|
|
|
|
if (input_available_clear_time)
|
|
|
|
|
EMACS_SET_SECS_USECS (*input_available_clear_time, 0, 0);
|
1992-03-14 20:40:04 +00:00
|
|
|
|
}
|
|
|
|
|
|
2006-06-01 14:08:25 +00:00
|
|
|
|
sigchld_end_of_loop:
|
|
|
|
|
;
|
|
|
|
|
|
1992-03-14 20:40:04 +00:00
|
|
|
|
/* On some systems, we must return right away.
|
|
|
|
|
If any more processes want to signal us, we will
|
|
|
|
|
get another signal.
|
|
|
|
|
Otherwise (on systems that have WNOHANG), loop around
|
|
|
|
|
to use up all the processes that have something to tell us. */
|
2001-09-24 09:18:19 +00:00
|
|
|
|
#if (defined WINDOWSNT \
|
2001-12-11 22:20:20 +00:00
|
|
|
|
|| (defined USG && !defined GNU_LINUX \
|
2009-01-01 15:58:38 +00:00
|
|
|
|
&& !(defined HPUX && defined WNOHANG)))
|
1992-03-14 20:40:04 +00:00
|
|
|
|
errno = old_errno;
|
|
|
|
|
return;
|
|
|
|
|
#endif /* USG, but not HPUX with WNOHANG */
|
|
|
|
|
}
|
|
|
|
|
}
|
2006-06-01 14:08:25 +00:00
|
|
|
|
#endif /* SIGCHLD */
|
1992-03-14 20:40:04 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
static Lisp_Object
|
2010-07-05 12:36:06 +02:00
|
|
|
|
exec_sentinel_unwind (Lisp_Object data)
|
1992-03-14 20:40:04 +00:00
|
|
|
|
{
|
1999-09-12 05:07:01 +00:00
|
|
|
|
XPROCESS (XCAR (data))->sentinel = XCDR (data);
|
1992-03-14 20:40:04 +00:00
|
|
|
|
return Qnil;
|
|
|
|
|
}
|
|
|
|
|
|
1994-09-23 22:28:08 +00:00
|
|
|
|
static Lisp_Object
|
2010-07-05 12:36:06 +02:00
|
|
|
|
exec_sentinel_error_handler (Lisp_Object error)
|
1994-09-23 22:28:08 +00:00
|
|
|
|
{
|
|
|
|
|
cmd_error_internal (error, "error in process sentinel: ");
|
|
|
|
|
Vinhibit_quit = Qt;
|
|
|
|
|
update_echo_area ();
|
1995-04-07 22:41:58 +00:00
|
|
|
|
Fsleep_for (make_number (2), Qnil);
|
2000-02-01 15:01:28 +00:00
|
|
|
|
return Qt;
|
1994-09-23 22:28:08 +00:00
|
|
|
|
}
|
|
|
|
|
|
1992-03-14 20:40:04 +00:00
|
|
|
|
static void
|
2010-07-05 12:36:06 +02:00
|
|
|
|
exec_sentinel (Lisp_Object proc, Lisp_Object reason)
|
1992-03-14 20:40:04 +00:00
|
|
|
|
{
|
1995-03-03 10:31:49 +00:00
|
|
|
|
Lisp_Object sentinel, obuffer, odeactivate, okeymap;
|
1992-03-14 20:40:04 +00:00
|
|
|
|
register struct Lisp_Process *p = XPROCESS (proc);
|
2002-07-11 14:18:02 +00:00
|
|
|
|
int count = SPECPDL_INDEX ();
|
1996-12-08 21:36:42 +00:00
|
|
|
|
int outer_running_asynch_code = running_asynch_code;
|
1998-10-14 14:36:33 +00:00
|
|
|
|
int waiting = waiting_for_user_input_p;
|
1992-03-14 20:40:04 +00:00
|
|
|
|
|
2006-09-08 12:08:54 +00:00
|
|
|
|
if (inhibit_sentinels)
|
|
|
|
|
return;
|
|
|
|
|
|
1995-03-03 10:31:49 +00:00
|
|
|
|
/* No need to gcpro these, because all we do with them later
|
|
|
|
|
is test them for EQness, and none of them should be a string. */
|
1994-05-11 04:04:03 +00:00
|
|
|
|
odeactivate = Vdeactivate_mark;
|
1995-03-03 10:31:49 +00:00
|
|
|
|
XSETBUFFER (obuffer, current_buffer);
|
|
|
|
|
okeymap = current_buffer->keymap;
|
|
|
|
|
|
2010-04-11 12:15:09 -04:00
|
|
|
|
/* There's no good reason to let sentinels change the current
|
|
|
|
|
buffer, and many callers of accept-process-output, sit-for, and
|
|
|
|
|
friends don't expect current-buffer to be changed from under them. */
|
2010-04-29 10:29:09 -04:00
|
|
|
|
record_unwind_protect (set_buffer_if_live, Fcurrent_buffer ());
|
2010-04-11 12:15:09 -04:00
|
|
|
|
|
1992-03-14 20:40:04 +00:00
|
|
|
|
sentinel = p->sentinel;
|
|
|
|
|
if (NILP (sentinel))
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
/* Zilch the sentinel while it's running, to avoid recursive invocations;
|
|
|
|
|
assure that it gets restored no matter how the sentinel exits. */
|
|
|
|
|
p->sentinel = Qnil;
|
|
|
|
|
record_unwind_protect (exec_sentinel_unwind, Fcons (proc, sentinel));
|
|
|
|
|
/* Inhibit quit so that random quits don't screw up a running filter. */
|
|
|
|
|
specbind (Qinhibit_quit, Qt);
|
2009-12-03 18:51:32 +00:00
|
|
|
|
specbind (Qlast_nonmenu_event, Qt); /* Why? --Stef */
|
1994-09-23 22:28:08 +00:00
|
|
|
|
|
1996-12-08 21:36:42 +00:00
|
|
|
|
/* In case we get recursively called,
|
|
|
|
|
and we already saved the match data nonrecursively,
|
|
|
|
|
save the same match data in safely recursive fashion. */
|
|
|
|
|
if (outer_running_asynch_code)
|
|
|
|
|
{
|
|
|
|
|
Lisp_Object tem;
|
2005-06-08 22:33:36 +00:00
|
|
|
|
tem = Fmatch_data (Qnil, Qnil, Qnil);
|
|
|
|
|
restore_search_regs ();
|
|
|
|
|
record_unwind_save_match_data ();
|
|
|
|
|
Fset_match_data (tem, Qt);
|
1996-12-08 21:36:42 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* For speed, if a search happens within this code,
|
|
|
|
|
save the match data in a special nonrecursive fashion. */
|
1994-11-21 12:50:27 +00:00
|
|
|
|
running_asynch_code = 1;
|
1996-12-08 21:36:42 +00:00
|
|
|
|
|
1994-09-23 22:28:08 +00:00
|
|
|
|
internal_condition_case_1 (read_process_output_call,
|
|
|
|
|
Fcons (sentinel,
|
|
|
|
|
Fcons (proc, Fcons (reason, Qnil))),
|
|
|
|
|
!NILP (Vdebug_on_error) ? Qnil : Qerror,
|
|
|
|
|
exec_sentinel_error_handler);
|
1996-12-08 21:36:42 +00:00
|
|
|
|
|
|
|
|
|
/* If we saved the match data nonrecursively, restore it now. */
|
2005-06-08 22:33:36 +00:00
|
|
|
|
restore_search_regs ();
|
1996-12-08 21:36:42 +00:00
|
|
|
|
running_asynch_code = outer_running_asynch_code;
|
1994-05-11 04:04:03 +00:00
|
|
|
|
|
|
|
|
|
Vdeactivate_mark = odeactivate;
|
1998-10-14 14:36:33 +00:00
|
|
|
|
|
|
|
|
|
/* Restore waiting_for_user_input_p as it was
|
|
|
|
|
when we were called, in case the filter clobbered it. */
|
|
|
|
|
waiting_for_user_input_p = waiting;
|
|
|
|
|
|
1995-08-08 21:22:16 +00:00
|
|
|
|
#if 0
|
1995-03-03 10:31:49 +00:00
|
|
|
|
if (! EQ (Fcurrent_buffer (), obuffer)
|
|
|
|
|
|| ! EQ (current_buffer->keymap, okeymap))
|
1995-08-08 21:22:16 +00:00
|
|
|
|
#endif
|
1995-10-09 00:31:24 +00:00
|
|
|
|
/* But do it only if the caller is actually going to read events.
|
|
|
|
|
Otherwise there's no need to make him wake up, and it could
|
2006-07-10 18:51:42 +00:00
|
|
|
|
cause trouble (for example it would make sit_for return). */
|
1995-10-09 00:31:24 +00:00
|
|
|
|
if (waiting_for_user_input_p == -1)
|
|
|
|
|
record_asynch_buffer_change ();
|
1994-05-11 04:04:03 +00:00
|
|
|
|
|
1994-01-11 05:49:41 +00:00
|
|
|
|
unbind_to (count, Qnil);
|
1992-03-14 20:40:04 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Report all recent events of a change in process status
|
|
|
|
|
(either run the sentinel or output a message).
|
2002-04-03 15:19:39 +00:00
|
|
|
|
This is usually done while Emacs is waiting for keyboard input
|
|
|
|
|
but can be done at other times. */
|
1992-03-14 20:40:04 +00:00
|
|
|
|
|
(deactivate_process, status_notify, read_process_output)
(update_status, status_convert, decode_status, allocate_pty)
(make_process, remove_process, list_processes_1)
(create_process_1, unwind_request_sigio, read_process_output)
(send_process, keyboard_bit_set): Declare static.
(Fdelete_process): Simplify. Pass process to status_notify, so we
don't try to read output from it.
(status_notify): New arg deleting_process--don't try to read
output from that process.
2005-08-15 08:44:53 +00:00
|
|
|
|
static void
|
2010-07-05 12:36:06 +02:00
|
|
|
|
status_notify (struct Lisp_Process *deleting_process)
|
1992-03-14 20:40:04 +00:00
|
|
|
|
{
|
|
|
|
|
register Lisp_Object proc, buffer;
|
1994-03-25 00:40:16 +00:00
|
|
|
|
Lisp_Object tail, msg;
|
1992-03-14 20:40:04 +00:00
|
|
|
|
struct gcpro gcpro1, gcpro2;
|
|
|
|
|
|
1994-03-25 00:40:16 +00:00
|
|
|
|
tail = Qnil;
|
|
|
|
|
msg = Qnil;
|
1992-03-14 20:40:04 +00:00
|
|
|
|
/* We need to gcpro tail; if read_process_output calls a filter
|
|
|
|
|
which deletes a process and removes the cons to which tail points
|
|
|
|
|
from Vprocess_alist, and then causes a GC, tail is an unprotected
|
|
|
|
|
reference. */
|
|
|
|
|
GCPRO2 (tail, msg);
|
|
|
|
|
|
1995-06-14 14:10:27 +00:00
|
|
|
|
/* Set this now, so that if new processes are created by sentinels
|
|
|
|
|
that we run, we get called again to handle their status changes. */
|
|
|
|
|
update_tick = process_tick;
|
|
|
|
|
|
* xselect.c (x_own_selection, x_handle_selection_clear)
(x_clear_frame_selections):
* w32menu.c (list_of_panes, list_of_items):
* w32fns.c (w32_color_map_lookup, Fx_create_frame, Fx_display_list):
* textprop.c (validate_plist, interval_has_all_properties)
(interval_has_some_properties, interval_has_some_properties_list)
(add_properties, text_property_list):
* process.c (Fget_buffer_process, list_processes_1, status_notify):
* minibuf.c (Fassoc_string):
* macselect.c (x_own_selection, x_clear_frame_selections)
(Fx_disown_selection_internal):
* keymap.c (Fcommand_remapping, where_is_internal, describe_map_tree):
Use CONSP rather than !NILP and XC[AD]R rather than Fc[ad]r.
2007-10-17 23:43:52 +00:00
|
|
|
|
for (tail = Vprocess_alist; CONSP (tail); tail = XCDR (tail))
|
1992-03-14 20:40:04 +00:00
|
|
|
|
{
|
1995-06-14 14:10:27 +00:00
|
|
|
|
Lisp_Object symbol;
|
|
|
|
|
register struct Lisp_Process *p;
|
|
|
|
|
|
* xselect.c (x_own_selection, x_handle_selection_clear)
(x_clear_frame_selections):
* w32menu.c (list_of_panes, list_of_items):
* w32fns.c (w32_color_map_lookup, Fx_create_frame, Fx_display_list):
* textprop.c (validate_plist, interval_has_all_properties)
(interval_has_some_properties, interval_has_some_properties_list)
(add_properties, text_property_list):
* process.c (Fget_buffer_process, list_processes_1, status_notify):
* minibuf.c (Fassoc_string):
* macselect.c (x_own_selection, x_clear_frame_selections)
(Fx_disown_selection_internal):
* keymap.c (Fcommand_remapping, where_is_internal, describe_map_tree):
Use CONSP rather than !NILP and XC[AD]R rather than Fc[ad]r.
2007-10-17 23:43:52 +00:00
|
|
|
|
proc = Fcdr (XCAR (tail));
|
1995-06-14 14:10:27 +00:00
|
|
|
|
p = XPROCESS (proc);
|
|
|
|
|
|
(struct Lisp_Process): Turn slots infd, outfd, kill_without_query, pty_flag,
tick, update_tick, decoding_carryover, inherit_coding_system_flag,
filter_multibyte, adaptive_read_buffering, read_output_delay, and
read_output_skip from Lisp_Objects to ints. Remove unused
encoding_carryover.
2007-07-12 06:36:57 +00:00
|
|
|
|
if (p->tick != p->update_tick)
|
1992-03-14 20:40:04 +00:00
|
|
|
|
{
|
(struct Lisp_Process): Turn slots infd, outfd, kill_without_query, pty_flag,
tick, update_tick, decoding_carryover, inherit_coding_system_flag,
filter_multibyte, adaptive_read_buffering, read_output_delay, and
read_output_skip from Lisp_Objects to ints. Remove unused
encoding_carryover.
2007-07-12 06:36:57 +00:00
|
|
|
|
p->update_tick = p->tick;
|
1992-03-14 20:40:04 +00:00
|
|
|
|
|
1995-06-14 14:10:27 +00:00
|
|
|
|
/* If process is still active, read any output that remains. */
|
1996-12-08 21:36:42 +00:00
|
|
|
|
while (! EQ (p->filter, Qt)
|
2002-02-28 23:53:59 +00:00
|
|
|
|
&& ! EQ (p->status, Qconnect)
|
(Qlocal, QCname, QCbuffer, QChost, QCservice, QCfamily)
(QClocal, QCremote, QCserver, QCdatagram, QCnowait, QCnoquery,QCstop)
(QCcoding, QCoptions, QCfilter, QCsentinel, QClog, QCfeature):
New variables.
(NETCONN1_P): New macro.
(DATAGRAM_SOCKETS): New conditional symbol.
(datagram_address): New array.
(DATAGRAM_CONN_P, DATAGRAM_CHAN_P): New macros.
(status_message): Use concat3.
(Fprocess_status): Add `listen' status to doc string. Return `stop'
for a stopped network process.
(Fset_process_buffer): Update contact plist for network process.
(Fset_process_filter): Ditto. Don't enable input for stopped
network processes. Server must listen, even if filter is t.
(Fset_process_query_on_exit_flag, Fprocess_query_on_exit_flag):
New functions.
(Fprocess_kill_without_query): Removed. Now defined in simple.el.
(Fprocess_contact): Added KEY argument. Handle datagrams.
(list_processes_1): Optionally show only processes with the query
on exit flag set. Dynamically adjust column widths. Omit tty
column if not needed. Report stopped network processes.
Identify server and datagram network processes.
(Flist_processes): New optional arg `query-only'.
(conv_sockaddr_to_lisp, get_lisp_to_sockaddr_size)
(conv_lisp_to_sockaddr, set_socket_options)
(network_process_featurep, unwind_request_sigio): New helper functions.
(Fprocess_datagram_address, Fset_process_datagram_address):
(Fset_network_process_options): New lisp functions.
(Fopen_network_stream): Removed. Now defined in simple.el.
(Fmake_network_process): New lisp function. Code is based on previous
Fopen_network_stream, but heavily reworked with new property list based
argument list, support for datagrams, server processes, and local
sockets in addition to old client-only functionality.
(server_accept_connection): New function.
(wait_reading_process_input): Use it to handle incoming connects.
Do not enable input on a new connection if process is stopped.
(read_process_output): Handle datagram sockets. Use 2k buffer for them.
(send_process): Handle datagram sockets.
(Fstop_process, Fcontinue_process): Apply to network processes. A stopped
network process is indicated by setting command field to t .
(Fprocess_send_eof): No-op if datagram connection.
(Fstatus_notify): Don't read input for a stream server socket or a
stopped network process.
(init_process): Initialize datagram_address array.
(syms_of_process): Intern and staticpro new variables, defsubr new
functions.
2002-03-17 20:20:33 +00:00
|
|
|
|
&& ! EQ (p->status, Qlisten)
|
Daniel Engeler <engeler at gmail.com>
These changes add serial port access.
* process.c: Add HAVE_SERIAL.
(Fdelete_process, Fprocess_status, Fset_process_buffer)
(Fset_process_filter, Fset_process_sentinel, Fprocess_contact)
(list_processes_1, select_wrapper, Fstop_process)
(Fcontinue_process, Fprocess_send_eof, kill_buffer_processes)
(status_notify): Modify to handle serial processes.
[HAVE_SERIAL] (Fserial_process_configure)
[HAVE_SERIAL] (make_serial_process_unwind, Fmake_serial_process):
New functions.
* process.h (struct Lisp_Process): Add `type'.
* sysdep.c [HAVE_TERMIOS] (serial_open, serial_configure):
New functions.
* w32.c (_sys_read_ahead, sys_read, sys_write): Modify to handle serial ports.
(serial_open, serial_configure) New functions.
* w32.h: Add FILE_SERIAL.
(struct _child_process): Add ovl_read, ovl_write.
2008-06-13 08:08:20 +00:00
|
|
|
|
/* Network or serial process not stopped: */
|
|
|
|
|
&& ! EQ (p->command, Qt)
|
(struct Lisp_Process): Turn slots infd, outfd, kill_without_query, pty_flag,
tick, update_tick, decoding_carryover, inherit_coding_system_flag,
filter_multibyte, adaptive_read_buffering, read_output_delay, and
read_output_skip from Lisp_Objects to ints. Remove unused
encoding_carryover.
2007-07-12 06:36:57 +00:00
|
|
|
|
&& p->infd >= 0
|
(deactivate_process, status_notify, read_process_output)
(update_status, status_convert, decode_status, allocate_pty)
(make_process, remove_process, list_processes_1)
(create_process_1, unwind_request_sigio, read_process_output)
(send_process, keyboard_bit_set): Declare static.
(Fdelete_process): Simplify. Pass process to status_notify, so we
don't try to read output from it.
(status_notify): New arg deleting_process--don't try to read
output from that process.
2005-08-15 08:44:53 +00:00
|
|
|
|
&& p != deleting_process
|
(struct Lisp_Process): Turn slots infd, outfd, kill_without_query, pty_flag,
tick, update_tick, decoding_carryover, inherit_coding_system_flag,
filter_multibyte, adaptive_read_buffering, read_output_delay, and
read_output_skip from Lisp_Objects to ints. Remove unused
encoding_carryover.
2007-07-12 06:36:57 +00:00
|
|
|
|
&& read_process_output (proc, p->infd) > 0);
|
1992-03-14 20:40:04 +00:00
|
|
|
|
|
1995-06-14 14:10:27 +00:00
|
|
|
|
buffer = p->buffer;
|
1992-03-14 20:40:04 +00:00
|
|
|
|
|
1995-06-14 14:10:27 +00:00
|
|
|
|
/* Get the text to use for the message. */
|
* process.h (struct Lisp_Process): Replace Lisp_Objects `pid',
`raw_status_high', and `raw_status_low' with plain integers, and move
them to the end of the structure.
* alloc.c (allocate_process): Use PSEUDOVECSIZE to initialize the
pseudovector's size field so only the Lisp_Object fields get GC'd.
* process.c (update_status, make_process, Fdelete_process)
(Fprocess_status, list_processes_1, start_process_unwind)
(create_process, Fmake_network_process, server_accept_connection)
(wait_reading_process_output, send_process, Fprocess_running_child_p)
(process_send_signal, proc_encode_coding_system, Fprocess_send_eof)
(sigchld_handler, status_notify): Adjust to new non-Lisp fields for
`pid' and `raw_status'.
(Fprocess_id, Fsignal_process): Same, and additionally use floats when
representing PIDs that are larger than most-positive-fixnum.
2006-04-08 15:07:35 +00:00
|
|
|
|
if (p->raw_status_new)
|
1995-06-14 14:10:27 +00:00
|
|
|
|
update_status (p);
|
2004-06-06 22:17:53 +00:00
|
|
|
|
msg = status_message (p);
|
1992-03-14 20:40:04 +00:00
|
|
|
|
|
1995-06-14 14:10:27 +00:00
|
|
|
|
/* If process is terminated, deactivate it or delete it. */
|
|
|
|
|
symbol = p->status;
|
|
|
|
|
if (CONSP (p->status))
|
1999-09-12 05:07:01 +00:00
|
|
|
|
symbol = XCAR (p->status);
|
1992-03-14 20:40:04 +00:00
|
|
|
|
|
1995-06-14 14:10:27 +00:00
|
|
|
|
if (EQ (symbol, Qsignal) || EQ (symbol, Qexit)
|
|
|
|
|
|| EQ (symbol, Qclosed))
|
|
|
|
|
{
|
|
|
|
|
if (delete_exited_processes)
|
|
|
|
|
remove_process (proc);
|
|
|
|
|
else
|
|
|
|
|
deactivate_process (proc);
|
|
|
|
|
}
|
1992-03-14 20:40:04 +00:00
|
|
|
|
|
1996-10-26 16:01:03 +00:00
|
|
|
|
/* The actions above may have further incremented p->tick.
|
|
|
|
|
So set p->update_tick again
|
|
|
|
|
so that an error in the sentinel will not cause
|
|
|
|
|
this code to be run again. */
|
(struct Lisp_Process): Turn slots infd, outfd, kill_without_query, pty_flag,
tick, update_tick, decoding_carryover, inherit_coding_system_flag,
filter_multibyte, adaptive_read_buffering, read_output_delay, and
read_output_skip from Lisp_Objects to ints. Remove unused
encoding_carryover.
2007-07-12 06:36:57 +00:00
|
|
|
|
p->update_tick = p->tick;
|
1995-06-14 14:10:27 +00:00
|
|
|
|
/* Now output the message suitably. */
|
|
|
|
|
if (!NILP (p->sentinel))
|
|
|
|
|
exec_sentinel (proc, msg);
|
|
|
|
|
/* Don't bother with a message in the buffer
|
|
|
|
|
when a process becomes runnable. */
|
|
|
|
|
else if (!EQ (symbol, Qrun) && !NILP (buffer))
|
|
|
|
|
{
|
2010-04-12 19:49:29 -04:00
|
|
|
|
Lisp_Object tem;
|
1995-06-14 14:10:27 +00:00
|
|
|
|
struct buffer *old = current_buffer;
|
1998-01-01 06:45:08 +00:00
|
|
|
|
int opoint, opoint_byte;
|
|
|
|
|
int before, before_byte;
|
1994-03-25 00:40:16 +00:00
|
|
|
|
|
1995-06-14 14:10:27 +00:00
|
|
|
|
/* Avoid error if buffer is deleted
|
|
|
|
|
(probably that's why the process is dead, too) */
|
|
|
|
|
if (NILP (XBUFFER (buffer)->name))
|
|
|
|
|
continue;
|
|
|
|
|
Fset_buffer (buffer);
|
1997-04-30 18:34:17 +00:00
|
|
|
|
|
1996-09-01 19:15:05 +00:00
|
|
|
|
opoint = PT;
|
1998-01-01 06:45:08 +00:00
|
|
|
|
opoint_byte = PT_BYTE;
|
1995-06-14 14:10:27 +00:00
|
|
|
|
/* Insert new output into buffer
|
|
|
|
|
at the current end-of-output marker,
|
|
|
|
|
thus preserving logical ordering of input and output. */
|
|
|
|
|
if (XMARKER (p->mark)->buffer)
|
1998-01-01 06:45:08 +00:00
|
|
|
|
Fgoto_char (p->mark);
|
1995-06-14 14:10:27 +00:00
|
|
|
|
else
|
1998-01-01 06:45:08 +00:00
|
|
|
|
SET_PT_BOTH (ZV, ZV_BYTE);
|
1997-04-30 18:34:17 +00:00
|
|
|
|
|
|
|
|
|
before = PT;
|
1998-01-01 06:45:08 +00:00
|
|
|
|
before_byte = PT_BYTE;
|
1995-06-14 14:10:27 +00:00
|
|
|
|
|
|
|
|
|
tem = current_buffer->read_only;
|
|
|
|
|
current_buffer->read_only = Qnil;
|
|
|
|
|
insert_string ("\nProcess ");
|
|
|
|
|
Finsert (1, &p->name);
|
|
|
|
|
insert_string (" ");
|
|
|
|
|
Finsert (1, &msg);
|
|
|
|
|
current_buffer->read_only = tem;
|
1998-01-01 06:45:08 +00:00
|
|
|
|
set_marker_both (p->mark, p->buffer, PT, PT_BYTE);
|
1995-06-14 14:10:27 +00:00
|
|
|
|
|
1997-04-30 18:34:17 +00:00
|
|
|
|
if (opoint >= before)
|
1998-01-01 06:45:08 +00:00
|
|
|
|
SET_PT_BOTH (opoint + (PT - before),
|
|
|
|
|
opoint_byte + (PT_BYTE - before_byte));
|
1997-04-30 18:34:17 +00:00
|
|
|
|
else
|
1998-01-01 06:45:08 +00:00
|
|
|
|
SET_PT_BOTH (opoint, opoint_byte);
|
1997-04-30 18:34:17 +00:00
|
|
|
|
|
1995-06-14 14:10:27 +00:00
|
|
|
|
set_buffer_internal (old);
|
1992-03-14 20:40:04 +00:00
|
|
|
|
}
|
1995-06-14 14:10:27 +00:00
|
|
|
|
}
|
|
|
|
|
} /* end for */
|
1992-03-14 20:40:04 +00:00
|
|
|
|
|
|
|
|
|
update_mode_lines++; /* in case buffers use %s in mode-line-format */
|
|
|
|
|
UNGCPRO;
|
|
|
|
|
}
|
1997-02-20 06:53:55 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
DEFUN ("set-process-coding-system", Fset_process_coding_system,
|
|
|
|
|
Sset_process_coding_system, 1, 3, 0,
|
2001-10-20 20:56:10 +00:00
|
|
|
|
doc: /* Set coding systems of PROCESS to DECODING and ENCODING.
|
|
|
|
|
DECODING will be used to decode subprocess output and ENCODING to
|
|
|
|
|
encode subprocess input. */)
|
2010-07-08 14:25:08 -07:00
|
|
|
|
(register Lisp_Object process, Lisp_Object decoding, Lisp_Object encoding)
|
1997-02-20 06:53:55 +00:00
|
|
|
|
{
|
|
|
|
|
register struct Lisp_Process *p;
|
|
|
|
|
|
2004-05-08 16:11:42 +00:00
|
|
|
|
CHECK_PROCESS (process);
|
|
|
|
|
p = XPROCESS (process);
|
(struct Lisp_Process): Turn slots infd, outfd, kill_without_query, pty_flag,
tick, update_tick, decoding_carryover, inherit_coding_system_flag,
filter_multibyte, adaptive_read_buffering, read_output_delay, and
read_output_skip from Lisp_Objects to ints. Remove unused
encoding_carryover.
2007-07-12 06:36:57 +00:00
|
|
|
|
if (p->infd < 0)
|
2002-07-15 00:01:34 +00:00
|
|
|
|
error ("Input file descriptor of %s closed", SDATA (p->name));
|
(struct Lisp_Process): Turn slots infd, outfd, kill_without_query, pty_flag,
tick, update_tick, decoding_carryover, inherit_coding_system_flag,
filter_multibyte, adaptive_read_buffering, read_output_delay, and
read_output_skip from Lisp_Objects to ints. Remove unused
encoding_carryover.
2007-07-12 06:36:57 +00:00
|
|
|
|
if (p->outfd < 0)
|
2002-07-15 00:01:34 +00:00
|
|
|
|
error ("Output file descriptor of %s closed", SDATA (p->name));
|
2003-02-10 07:58:29 +00:00
|
|
|
|
Fcheck_coding_system (decoding);
|
|
|
|
|
Fcheck_coding_system (encoding);
|
2006-05-15 02:47:05 +00:00
|
|
|
|
encoding = coding_inherit_eol_type (encoding, Qnil);
|
2003-02-10 07:58:29 +00:00
|
|
|
|
p->decode_coding_system = decoding;
|
|
|
|
|
p->encode_coding_system = encoding;
|
2004-05-08 16:11:42 +00:00
|
|
|
|
setup_process_coding_systems (process);
|
1997-02-20 06:53:55 +00:00
|
|
|
|
|
|
|
|
|
return Qnil;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
DEFUN ("process-coding-system",
|
|
|
|
|
Fprocess_coding_system, Sprocess_coding_system, 1, 1, 0,
|
2001-10-20 20:56:10 +00:00
|
|
|
|
doc: /* Return a cons of coding systems for decoding and encoding of PROCESS. */)
|
2010-07-08 14:25:08 -07:00
|
|
|
|
(register Lisp_Object process)
|
1997-02-20 06:53:55 +00:00
|
|
|
|
{
|
2004-05-08 16:11:42 +00:00
|
|
|
|
CHECK_PROCESS (process);
|
|
|
|
|
return Fcons (XPROCESS (process)->decode_coding_system,
|
|
|
|
|
XPROCESS (process)->encode_coding_system);
|
1997-02-20 06:53:55 +00:00
|
|
|
|
}
|
2003-02-10 07:58:29 +00:00
|
|
|
|
|
|
|
|
|
DEFUN ("set-process-filter-multibyte", Fset_process_filter_multibyte,
|
|
|
|
|
Sset_process_filter_multibyte, 2, 2, 0,
|
2003-02-10 13:51:59 +00:00
|
|
|
|
doc: /* Set multibyteness of the strings given to PROCESS's filter.
|
|
|
|
|
If FLAG is non-nil, the filter is given multibyte strings.
|
|
|
|
|
If FLAG is nil, the filter is given unibyte strings. In this case,
|
2003-02-10 07:58:29 +00:00
|
|
|
|
all character code conversion except for end-of-line conversion is
|
|
|
|
|
suppressed. */)
|
2010-07-08 14:25:08 -07:00
|
|
|
|
(Lisp_Object process, Lisp_Object flag)
|
2003-02-10 07:58:29 +00:00
|
|
|
|
{
|
|
|
|
|
register struct Lisp_Process *p;
|
|
|
|
|
|
2004-05-08 16:11:42 +00:00
|
|
|
|
CHECK_PROCESS (process);
|
|
|
|
|
p = XPROCESS (process);
|
2008-03-25 17:35:48 +00:00
|
|
|
|
if (NILP (flag))
|
|
|
|
|
p->decode_coding_system = raw_text_coding_system (p->decode_coding_system);
|
2004-05-08 16:11:42 +00:00
|
|
|
|
setup_process_coding_systems (process);
|
2003-02-10 07:58:29 +00:00
|
|
|
|
|
|
|
|
|
return Qnil;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
DEFUN ("process-filter-multibyte-p", Fprocess_filter_multibyte_p,
|
|
|
|
|
Sprocess_filter_multibyte_p, 1, 1, 0,
|
|
|
|
|
doc: /* Return t if a multibyte string is given to PROCESS's filter.*/)
|
2010-07-08 14:25:08 -07:00
|
|
|
|
(Lisp_Object process)
|
2003-02-10 07:58:29 +00:00
|
|
|
|
{
|
|
|
|
|
register struct Lisp_Process *p;
|
2008-03-25 17:35:48 +00:00
|
|
|
|
struct coding_system *coding;
|
2003-02-10 07:58:29 +00:00
|
|
|
|
|
2004-05-08 16:11:42 +00:00
|
|
|
|
CHECK_PROCESS (process);
|
|
|
|
|
p = XPROCESS (process);
|
2008-03-25 17:35:48 +00:00
|
|
|
|
coding = proc_decode_coding_system[p->infd];
|
|
|
|
|
return (CODING_FOR_UNIBYTE (coding) ? Qnil : Qt);
|
2003-02-10 07:58:29 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
1992-03-14 20:40:04 +00:00
|
|
|
|
|
2010-07-07 19:39:49 +02:00
|
|
|
|
|
2007-05-20 02:41:19 +00:00
|
|
|
|
static int add_gpm_wait_descriptor_called_flag;
|
|
|
|
|
|
|
|
|
|
void
|
2010-07-05 12:36:06 +02:00
|
|
|
|
add_gpm_wait_descriptor (int desc)
|
2007-05-20 02:41:19 +00:00
|
|
|
|
{
|
|
|
|
|
if (! add_gpm_wait_descriptor_called_flag)
|
|
|
|
|
FD_CLR (0, &input_wait_mask);
|
|
|
|
|
add_gpm_wait_descriptor_called_flag = 1;
|
|
|
|
|
FD_SET (desc, &input_wait_mask);
|
|
|
|
|
FD_SET (desc, &gpm_wait_mask);
|
|
|
|
|
if (desc > max_gpm_desc)
|
|
|
|
|
max_gpm_desc = desc;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void
|
2010-07-05 12:36:06 +02:00
|
|
|
|
delete_gpm_wait_descriptor (int desc)
|
2007-05-20 02:41:19 +00:00
|
|
|
|
{
|
|
|
|
|
int fd;
|
|
|
|
|
int lim = max_gpm_desc;
|
|
|
|
|
|
|
|
|
|
FD_CLR (desc, &input_wait_mask);
|
|
|
|
|
FD_CLR (desc, &non_process_wait_mask);
|
|
|
|
|
|
|
|
|
|
if (desc == max_gpm_desc)
|
|
|
|
|
for (fd = 0; fd < lim; fd++)
|
|
|
|
|
if (FD_ISSET (fd, &input_wait_mask)
|
|
|
|
|
&& !FD_ISSET (fd, &non_keyboard_wait_mask)
|
|
|
|
|
&& !FD_ISSET (fd, &non_process_wait_mask))
|
|
|
|
|
max_gpm_desc = fd;
|
|
|
|
|
}
|
|
|
|
|
|
1994-10-25 09:48:44 +00:00
|
|
|
|
/* Return nonzero if *MASK has a bit set
|
|
|
|
|
that corresponds to one of the keyboard input descriptors. */
|
|
|
|
|
|
(deactivate_process, status_notify, read_process_output)
(update_status, status_convert, decode_status, allocate_pty)
(make_process, remove_process, list_processes_1)
(create_process_1, unwind_request_sigio, read_process_output)
(send_process, keyboard_bit_set): Declare static.
(Fdelete_process): Simplify. Pass process to status_notify, so we
don't try to read output from it.
(status_notify): New arg deleting_process--don't try to read
output from that process.
2005-08-15 08:44:53 +00:00
|
|
|
|
static int
|
2010-07-05 12:36:06 +02:00
|
|
|
|
keyboard_bit_set (fd_set *mask)
|
1994-10-25 09:48:44 +00:00
|
|
|
|
{
|
|
|
|
|
int fd;
|
|
|
|
|
|
1995-07-17 22:21:21 +00:00
|
|
|
|
for (fd = 0; fd <= max_keyboard_desc; fd++)
|
1994-10-25 09:48:44 +00:00
|
|
|
|
if (FD_ISSET (fd, mask) && FD_ISSET (fd, &input_wait_mask)
|
|
|
|
|
&& !FD_ISSET (fd, &non_keyboard_wait_mask))
|
|
|
|
|
return 1;
|
|
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
2008-08-02 16:27:44 +00:00
|
|
|
|
|
2010-07-10 16:26:44 +03:00
|
|
|
|
#else /* not subprocesses */
|
2008-08-02 16:27:44 +00:00
|
|
|
|
|
2010-07-10 16:26:44 +03:00
|
|
|
|
/* Defined on msdos.c. */
|
|
|
|
|
extern int sys_select (int, SELECT_TYPE *, SELECT_TYPE *, SELECT_TYPE *,
|
|
|
|
|
EMACS_TIME *);
|
2008-08-02 16:27:44 +00:00
|
|
|
|
|
2010-07-10 16:26:44 +03:00
|
|
|
|
/* Implementation of wait_reading_process_output, assuming that there
|
|
|
|
|
are no subprocesses. Used only by the MS-DOS build.
|
2008-08-02 16:27:44 +00:00
|
|
|
|
|
2010-07-10 16:26:44 +03:00
|
|
|
|
Wait for timeout to elapse and/or keyboard input to be available.
|
2008-08-02 16:27:44 +00:00
|
|
|
|
|
2010-07-10 16:26:44 +03:00
|
|
|
|
time_limit is:
|
|
|
|
|
timeout in seconds, or
|
|
|
|
|
zero for no limit, or
|
|
|
|
|
-1 means gobble data immediately available but don't wait for any.
|
2008-08-02 16:27:44 +00:00
|
|
|
|
|
2010-07-10 16:26:44 +03:00
|
|
|
|
read_kbd is a Lisp_Object:
|
|
|
|
|
0 to ignore keyboard input, or
|
|
|
|
|
1 to return when input is available, or
|
|
|
|
|
-1 means caller will actually read the input, so don't throw to
|
|
|
|
|
the quit handler.
|
2008-08-02 16:27:44 +00:00
|
|
|
|
|
2010-07-10 16:26:44 +03:00
|
|
|
|
see full version for other parameters. We know that wait_proc will
|
|
|
|
|
always be NULL, since `subprocesses' isn't defined.
|
2008-08-02 16:27:44 +00:00
|
|
|
|
|
2010-07-10 16:26:44 +03:00
|
|
|
|
do_display != 0 means redisplay should be done to show subprocess
|
|
|
|
|
output that arrives.
|
2008-08-02 16:27:44 +00:00
|
|
|
|
|
2010-07-10 16:26:44 +03:00
|
|
|
|
Return true if we received input from any process. */
|
|
|
|
|
|
|
|
|
|
int
|
2010-07-12 21:44:35 +03:00
|
|
|
|
wait_reading_process_output (int time_limit, int microsecs, int read_kbd,
|
|
|
|
|
int do_display,
|
|
|
|
|
Lisp_Object wait_for_cell,
|
|
|
|
|
struct Lisp_Process *wait_proc, int just_wait_proc)
|
1992-03-14 20:40:04 +00:00
|
|
|
|
{
|
2010-07-10 16:26:44 +03:00
|
|
|
|
register int nfds;
|
|
|
|
|
EMACS_TIME end_time, timeout;
|
|
|
|
|
SELECT_TYPE waitchannels;
|
|
|
|
|
int xerrno;
|
1992-03-14 20:40:04 +00:00
|
|
|
|
|
2010-07-10 16:26:44 +03:00
|
|
|
|
/* What does time_limit really mean? */
|
|
|
|
|
if (time_limit || microsecs)
|
|
|
|
|
{
|
|
|
|
|
EMACS_GET_TIME (end_time);
|
|
|
|
|
EMACS_SET_SECS_USECS (timeout, time_limit, microsecs);
|
|
|
|
|
EMACS_ADD_TIME (end_time, end_time, timeout);
|
|
|
|
|
}
|
2006-09-08 12:08:54 +00:00
|
|
|
|
|
2010-07-10 16:26:44 +03:00
|
|
|
|
/* Turn off periodic alarms (in case they are in use)
|
|
|
|
|
and then turn off any other atimers,
|
|
|
|
|
because the select emulator uses alarms. */
|
|
|
|
|
stop_polling ();
|
|
|
|
|
turn_on_atimers (0);
|
1992-03-14 20:40:04 +00:00
|
|
|
|
|
2010-07-10 16:26:44 +03:00
|
|
|
|
while (1)
|
|
|
|
|
{
|
|
|
|
|
int timeout_reduced_for_timers = 0;
|
1993-09-08 17:53:11 +00:00
|
|
|
|
|
2010-07-10 16:26:44 +03:00
|
|
|
|
/* If calling from keyboard input, do not quit
|
|
|
|
|
since we want to return C-g as an input character.
|
|
|
|
|
Otherwise, do pending quit if requested. */
|
|
|
|
|
if (read_kbd >= 0)
|
|
|
|
|
QUIT;
|
2004-11-01 11:04:37 +00:00
|
|
|
|
|
2010-07-10 16:26:44 +03:00
|
|
|
|
/* Exit now if the cell we're waiting for became non-nil. */
|
|
|
|
|
if (! NILP (wait_for_cell) && ! NILP (XCAR (wait_for_cell)))
|
|
|
|
|
break;
|
1996-04-14 17:45:31 +00:00
|
|
|
|
|
1996-03-10 14:38:37 +00:00
|
|
|
|
/* Compute time from now till when time limit is up */
|
|
|
|
|
/* Exit if already run out */
|
1998-06-21 14:52:08 +00:00
|
|
|
|
if (time_limit == -1)
|
|
|
|
|
{
|
|
|
|
|
/* -1 specified for timeout means
|
|
|
|
|
gobble output available now
|
|
|
|
|
but don't wait at all. */
|
|
|
|
|
|
|
|
|
|
EMACS_SET_SECS_USECS (timeout, 0, 0);
|
|
|
|
|
}
|
|
|
|
|
else if (time_limit || microsecs)
|
1992-03-18 20:22:31 +00:00
|
|
|
|
{
|
1996-03-14 05:20:44 +00:00
|
|
|
|
EMACS_GET_TIME (timeout);
|
|
|
|
|
EMACS_SUB_TIME (timeout, end_time, timeout);
|
|
|
|
|
if (EMACS_TIME_NEG_P (timeout))
|
1992-03-18 20:22:31 +00:00
|
|
|
|
break;
|
|
|
|
|
}
|
1998-06-21 14:52:08 +00:00
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
EMACS_SET_SECS_USECS (timeout, 100000, 0);
|
|
|
|
|
}
|
1992-03-18 20:22:31 +00:00
|
|
|
|
|
1996-03-10 14:38:37 +00:00
|
|
|
|
/* If our caller will not immediately handle keyboard events,
|
|
|
|
|
run timer events directly.
|
|
|
|
|
(Callers that will immediately read keyboard events
|
|
|
|
|
call timer_delay on their own.) */
|
2001-10-16 09:09:51 +00:00
|
|
|
|
if (NILP (wait_for_cell))
|
1996-03-10 14:38:37 +00:00
|
|
|
|
{
|
|
|
|
|
EMACS_TIME timer_delay;
|
1996-04-14 17:45:31 +00:00
|
|
|
|
|
2000-12-18 10:53:51 +00:00
|
|
|
|
do
|
1996-04-14 17:45:31 +00:00
|
|
|
|
{
|
2000-12-18 10:53:51 +00:00
|
|
|
|
int old_timers_run = timers_run;
|
|
|
|
|
timer_delay = timer_check (1);
|
|
|
|
|
if (timers_run != old_timers_run && do_display)
|
|
|
|
|
/* We must retry, since a timer may have requeued itself
|
|
|
|
|
and that could alter the time delay. */
|
2001-01-16 12:42:22 +00:00
|
|
|
|
redisplay_preserve_echo_area (14);
|
2000-12-18 10:53:51 +00:00
|
|
|
|
else
|
|
|
|
|
break;
|
1996-04-14 17:45:31 +00:00
|
|
|
|
}
|
2000-12-18 10:53:51 +00:00
|
|
|
|
while (!detect_input_pending ());
|
1996-04-14 17:45:31 +00:00
|
|
|
|
|
1998-06-21 14:52:08 +00:00
|
|
|
|
/* If there is unread keyboard input, also return. */
|
2004-08-19 13:57:17 +00:00
|
|
|
|
if (read_kbd != 0
|
1998-06-21 14:52:08 +00:00
|
|
|
|
&& requeued_events_pending_p ())
|
|
|
|
|
break;
|
|
|
|
|
|
1996-03-14 05:20:44 +00:00
|
|
|
|
if (! EMACS_TIME_NEG_P (timer_delay) && time_limit != -1)
|
1996-03-10 14:38:37 +00:00
|
|
|
|
{
|
|
|
|
|
EMACS_TIME difference;
|
1996-03-14 05:20:44 +00:00
|
|
|
|
EMACS_SUB_TIME (difference, timer_delay, timeout);
|
1996-03-10 14:38:37 +00:00
|
|
|
|
if (EMACS_TIME_NEG_P (difference))
|
|
|
|
|
{
|
1996-03-14 05:20:44 +00:00
|
|
|
|
timeout = timer_delay;
|
1996-03-10 14:38:37 +00:00
|
|
|
|
timeout_reduced_for_timers = 1;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
1992-03-18 20:22:31 +00:00
|
|
|
|
/* Cause C-g and alarm signals to take immediate action,
|
|
|
|
|
and cause input available signals to zero out timeout. */
|
2004-08-19 13:57:17 +00:00
|
|
|
|
if (read_kbd < 0)
|
1992-03-18 20:22:31 +00:00
|
|
|
|
set_waiting_for_input (&timeout);
|
|
|
|
|
|
1996-04-14 17:45:31 +00:00
|
|
|
|
/* Wait till there is something to do. */
|
|
|
|
|
|
2004-08-19 13:57:17 +00:00
|
|
|
|
if (! read_kbd && NILP (wait_for_cell))
|
1996-04-14 17:45:31 +00:00
|
|
|
|
FD_ZERO (&waitchannels);
|
|
|
|
|
else
|
|
|
|
|
FD_SET (0, &waitchannels);
|
|
|
|
|
|
1992-07-13 20:53:59 +00:00
|
|
|
|
/* If a frame has been newly mapped and needs updating,
|
1992-03-18 20:22:31 +00:00
|
|
|
|
reprocess its display stuff. */
|
1994-03-20 01:16:55 +00:00
|
|
|
|
if (frame_garbaged && do_display)
|
1996-04-14 17:45:31 +00:00
|
|
|
|
{
|
|
|
|
|
clear_waiting_for_input ();
|
2001-01-16 12:42:22 +00:00
|
|
|
|
redisplay_preserve_echo_area (15);
|
2004-08-19 13:57:17 +00:00
|
|
|
|
if (read_kbd < 0)
|
1996-04-14 17:45:31 +00:00
|
|
|
|
set_waiting_for_input (&timeout);
|
|
|
|
|
}
|
1992-03-18 20:22:31 +00:00
|
|
|
|
|
2004-08-19 13:57:17 +00:00
|
|
|
|
if (read_kbd && detect_input_pending ())
|
1996-04-15 19:12:01 +00:00
|
|
|
|
{
|
|
|
|
|
nfds = 0;
|
|
|
|
|
FD_ZERO (&waitchannels);
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
nfds = select (1, &waitchannels, (SELECT_TYPE *)0, (SELECT_TYPE *)0,
|
|
|
|
|
&timeout);
|
1996-03-14 05:20:44 +00:00
|
|
|
|
|
|
|
|
|
xerrno = errno;
|
1992-03-18 20:22:31 +00:00
|
|
|
|
|
|
|
|
|
/* Make C-g and alarm signals set flags again */
|
|
|
|
|
clear_waiting_for_input ();
|
|
|
|
|
|
|
|
|
|
/* If we woke up due to SIGWINCH, actually change size now. */
|
1999-08-21 19:30:35 +00:00
|
|
|
|
do_pending_window_change (0);
|
1992-03-18 20:22:31 +00:00
|
|
|
|
|
1996-03-14 05:20:44 +00:00
|
|
|
|
if (time_limit && nfds == 0 && ! timeout_reduced_for_timers)
|
|
|
|
|
/* We waited the full specified time, so return now. */
|
|
|
|
|
break;
|
|
|
|
|
|
1992-03-18 20:22:31 +00:00
|
|
|
|
if (nfds == -1)
|
|
|
|
|
{
|
|
|
|
|
/* If the system call was interrupted, then go around the
|
|
|
|
|
loop again. */
|
1996-03-14 05:20:44 +00:00
|
|
|
|
if (xerrno == EINTR)
|
1996-01-24 21:21:07 +00:00
|
|
|
|
FD_ZERO (&waitchannels);
|
1996-03-14 05:20:44 +00:00
|
|
|
|
else
|
Add support for large files, 64-bit Solaris, system locale codings.
* Makefile.in (emacs): Set the LC_ALL environment variable to "C"
when dumping, so that the dumped Emacs doesn't have stray locale info.
(dired.o): Depend on systime.h.
(editfns.o): Depend on coding.h.
* alloc.c, buffer.c, callproc.c, ccl.c, charset.c, coding.c, data.c,
dispnew.c, editfns.c, emacs.c, filelock.c, floatfns.c, hftctl.c,
keyboard.c, process.c, sysdep.c, unexelf.c, unexhp9k800.c,
unexsunos4.c, vmsfns.c, vmsgmalloc.c, w32faces.c, w32menu.c, w32term.c,
w32xfns.c, xfaces.c, xfns.c, xmenu.c, xterm.c:
Include <config.h> before any system include files.
* alloc.c, buffer.c, ccl.c, data.c, editfns.c, emacs.c, eval.c,
fileio.c, filelock.c, frame.c, insdel.c, keymap.c, lread.c,
m/alpha.h, print.c, search.c, sysdep.c, xdisp.c, xfaces.c, xfns.c,
xmenu.c, xterm.c:
Do not include <stdlib.h>, as <config.h> does this now.
* callproc.c (Fcall_process):
Synchronize messages locale before invoking strerror.
Decode resulting string with locale-coding-system.
* coding.c (Vlocale_coding_system): New var.
(syms_of_coding): Adjust to above change.
(emacs_strerror): New function.
* coding.h (emacs_strerror, Vlocale_coding_system): New decls.
* config.in (HAVE_STDIO_EXT_H, HAVE_TM_GMTOFF, HAVE___FPENDING,
HAVE_FTELLO, HAVE_GETLOADAVG, HAVE_MBLEN, HAVE_MBRLEN,
HAVE_STRSIGNAL): New macros.
(BITS_PER_LONG): Default to 64 if _LP64 is defined.
<stdlib.h>: Include if HAVE_STDLIB_H is defined and NOT_C_CODE isn't.
* dired.c: Include "systime.h".
(Ffile_attributes): Do not cast s.st_size to int; this loses
information if int is 32 bits but st_size and EMACS_INT are larger.
Treat large device numbers like large inode numbers.
* dispnew.c (PENDING_OUTPUT_COUNT): Use __fpending if available.
* editfns.c: Include coding.h.
(emacs_strftime): Remove decl.
(emacs_strftimeu): New decl.
(emacs_memftimeu): Renamed from emacs_memftime; new arg UT.
Use emacs_strftimeu instead of emacs_strftime.
(Fformat_time_string): Convert format string using
Vlocale_coding_system, and convert result back. Synchronize time
locale before invoking lower level function. Invoke
emacs_memftimeu, passing ut, instead of emacs_memftime.
* emacs.c: Include <locale.h> if HAVE_SETLOCALE is defined.
(Vmessages_locale, Vprevious_messages_locale, Vtime_locale,
Vprevious_time_locale): New variables.
(main): Invoke setlocale early, so that initial error messages are
localized properly. But skip locale-setting if LC_ALL is "C".
Fix up locale when it's safe to do so.
(fixup_locale): Moved here from xterm.c.
(synchronize_locale, synchronize_time_locale,
synchronize_messages_locale): New functions.
(syms_of_emacs): Accommodate above changes.
* fileio.c (report_file_error): Convert strerror output according
to Vlocale_coding_system.
(Finsert_file_contents): Check for arithmetic overflow in
computations that depend on file size. Report IO errors
with emacs_strerror, not strerror.
* fns.c (Fgethash): Declare dflt parameter.
* gmalloc.c: Do not define const to nothing if HAVE_CONFIG_H
is defined; that's config.h's job.
* lisp.h (EMACS_INT, BITS_PER_EMACS_INT, EMACS_UINT): If _LP64,
default these values to long, BITS_PER_LONG, and unsigned long.
(VALBITS, MARKBIT, XINT): Do not assume 32-bit EMACS_INT.
(PNTR_COMPARISON_TYPE): Default to EMACS_UINT, not to unsigned int.
(code_convert_string_norecord, fixup_locale,
synchronize_messages_locale, synchronize_time_locale,
emacs_open, emacs_close, emacs_read, emacs_write): New decls.
All Emacs callers of open, close, read, write changed to use
emacs_open, emacs_close, emacs_read, emacs_write.
* lread.c (file_offset, file_tell): New macros. All uses of ftell
changed to file_tell.
(saved_doc_string_position, prev_saved_doc_string_position): Now
of type file_offset.
(init_lread): Do not fix locale here; fixup_locale now does this.
* m/amdahl.h, s/usg5-4.h:
(NSIG): Remove.
(NSIG_MINIMUM): New macro.
* m/cydra5.h, m/dpx2.h, m/mips.h, m/pfa50.h, m/sps7.h, m/stride.h,
m/ustation.h, s/gnu-linux.h, s/hpux.h, s/iris3-5.h, s/iris3-6.h,
s/umips.h, s/usg5-4.h:
(SIGIO): Do not undef.
(BROKEN_SIGIO): New macro.
* m/ustation.h:
(SIGTSTP): Do not undef.
(BROKEN_SIGTSTP): New macro.
* s/gnu-linux.h:
(SIGPOLL, SIGURG): Do not undef.
(BROKEN_SIGPOLL, BROKEN_SIGURG): New macros.
* s/ptx4.h:
(SIGINFO): Do not undef.
(BROKEN_SIGINFO): New macros.
* m/delta.h, s/ptx.h, s/template.h: Doc fix.
* mktime.c, strftime.c: Update to glibc 2.1.2 version, with
some Emacs-related changes merged.
* print.c (float_to_string): Prepend "-" to representation of a
NaN if the NaN is negative.
* process.c (sys_siglist): Omit if HAVE_STRSIGNAL.
(wait_reading_process_input): Use emacs_strerror, not strerror.
* process.c (status_message, sigchld_handler): Synchronize locale,
then use strsignal istead of sys_siglist.
* w32proc.c (sys_wait): Likewise.
* s/aix3-1.h, s/bsd4-1.h, s/dgux.h, s/gnu-linux.h, s/hiuxmpp.h,
s/hpux.h, s/iris3-5.h, s/iris3-6.h, s/irix3-3.h, s/osf1.h, s/rtu.h,
s/sunos4-1.h, s/unipl5-0.h, s/unipl5-2.h, s/usg5-0.h, s/usg5-2-2.h,
s/usg5-2.h, s/usg5-3.h, s/xenix.h:
(open, close, read, write, INTERRUPTIBLE_OPEN,
INTERRUPTIBLE_CLOSE, INTERRUPTIBLE_IO): Remove.
* s/sol2-5.h (_LARGEFILE_SOURCE, _FILE_OFFSET_BITS): New macros.
* sysdep.c (sys_read, sys_write, read, write, sys_close, close,
sys_open, open): Remove.
(emacs_open, emacs_close, emacs_read, emacs_write): Always define;
the old INTERRUPTIBLE_OPEN, INTERRUPTIBLE_CLOSE, and INTERRUPTIBLE_IO
macros are no longer used.
(emacs_open): Renamed from sys_open. Merge BSD4_1 version.
(emacs_close): Renamed from sys_close.
(emacs_read): Renamed from sys_read.
(emacs_write): Renamed from sys_write.
(sys_siglist): Do not declare if HAVE_STRSIGNAL.
(dup2): Do not print error on failure; the real dup2 doesn't.
(strsignal): New function, defined if !HAVE_STRSIGNAL.
* syssignal.h (SIGINFO): Undef if defined and if BROKEN_SIGINFO
is defined.
(SIGIO, SIGPOLL, SIGTSTP, SIGURG): Likewise.
(NSIG): If less than NSIG_MINIMUM, define to NSIG_MINIMUM.
(strsignal): Declare if !HAVE_STRSIGNAL.
* unexelf.c (ElfBitsW, ELFSIZE, ElfExpandBitsW): New macros.
(ElfW): Define in terms of ElfExpandBitsW.
* w32proc.c (sys_siglist): Remove decl.
* xdisp.c (decode_mode_spec): 3rd arg is int, not char, to comply
with ANSI C.
(display_string): Declare face_string_pos arg.
* xfns.c (Fx_show_tip): Declare timeout param.
* xterm.c: No need to include locale.h.
(x_alloc_lighter_color, x_setup_relief_color):
Pass arg as double, not float, for compatibility with ANSI C.
(fixup_locale): Move to emacs.c.
(x_term_init): Do not setlocale or fixup locale; the main program
does this now.
1999-10-19 07:25:11 +00:00
|
|
|
|
error ("select error: %s", emacs_strerror (xerrno));
|
1992-03-18 20:22:31 +00:00
|
|
|
|
}
|
|
|
|
|
|
1996-03-14 05:20:44 +00:00
|
|
|
|
/* Check for keyboard input */
|
|
|
|
|
|
2004-08-19 13:57:17 +00:00
|
|
|
|
if (read_kbd
|
2001-04-21 19:52:11 +00:00
|
|
|
|
&& detect_input_pending_run_timers (do_display))
|
1996-03-14 05:20:44 +00:00
|
|
|
|
{
|
2001-04-21 19:52:11 +00:00
|
|
|
|
swallow_events (do_display);
|
1996-03-14 05:20:44 +00:00
|
|
|
|
if (detect_input_pending_run_timers (do_display))
|
2001-04-19 12:47:59 +00:00
|
|
|
|
break;
|
2001-04-21 19:52:11 +00:00
|
|
|
|
}
|
|
|
|
|
|
1998-06-21 14:52:08 +00:00
|
|
|
|
/* If there is unread keyboard input, also return. */
|
2004-08-19 13:57:17 +00:00
|
|
|
|
if (read_kbd
|
1998-06-21 14:52:08 +00:00
|
|
|
|
&& requeued_events_pending_p ())
|
|
|
|
|
break;
|
|
|
|
|
|
1996-04-23 20:32:33 +00:00
|
|
|
|
/* If wait_for_cell. check for keyboard input
|
|
|
|
|
but don't run any timers.
|
|
|
|
|
??? (It seems wrong to me to check for keyboard
|
|
|
|
|
input at all when wait_for_cell, but the code
|
|
|
|
|
has been this way since July 1994.
|
|
|
|
|
Try changing this after version 19.31.) */
|
2001-10-16 09:09:51 +00:00
|
|
|
|
if (! NILP (wait_for_cell)
|
1996-04-23 20:32:33 +00:00
|
|
|
|
&& detect_input_pending ())
|
|
|
|
|
{
|
|
|
|
|
swallow_events (do_display);
|
|
|
|
|
if (detect_input_pending ())
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
|
1996-04-14 17:45:31 +00:00
|
|
|
|
/* Exit now if the cell we're waiting for became non-nil. */
|
2001-10-16 09:09:51 +00:00
|
|
|
|
if (! NILP (wait_for_cell) && ! NILP (XCAR (wait_for_cell)))
|
1996-04-14 17:45:31 +00:00
|
|
|
|
break;
|
1992-03-18 20:22:31 +00:00
|
|
|
|
}
|
|
|
|
|
|
1993-03-11 07:14:16 +00:00
|
|
|
|
start_polling ();
|
|
|
|
|
|
1992-03-18 20:22:31 +00:00
|
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
|
2010-07-10 16:26:44 +03:00
|
|
|
|
#endif /* not subprocesses */
|
|
|
|
|
|
|
|
|
|
/* The following functions are needed even if async subprocesses are
|
|
|
|
|
not supported. Some of them are no-op stubs in that case. */
|
1992-03-18 20:22:31 +00:00
|
|
|
|
|
2010-07-12 21:54:28 -07:00
|
|
|
|
/* Add DESC to the set of keyboard input descriptors. */
|
|
|
|
|
|
|
|
|
|
void
|
|
|
|
|
add_keyboard_wait_descriptor (int desc)
|
|
|
|
|
{
|
2010-07-13 13:03:22 +03:00
|
|
|
|
#ifdef subprocesses
|
2010-07-12 21:54:28 -07:00
|
|
|
|
FD_SET (desc, &input_wait_mask);
|
|
|
|
|
FD_SET (desc, &non_process_wait_mask);
|
|
|
|
|
if (desc > max_keyboard_desc)
|
|
|
|
|
max_keyboard_desc = desc;
|
2010-07-13 13:03:22 +03:00
|
|
|
|
#endif
|
2010-07-12 21:54:28 -07:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* From now on, do not expect DESC to give keyboard input. */
|
|
|
|
|
|
|
|
|
|
void
|
|
|
|
|
delete_keyboard_wait_descriptor (int desc)
|
|
|
|
|
{
|
|
|
|
|
#ifdef subprocesses
|
|
|
|
|
int fd;
|
|
|
|
|
int lim = max_keyboard_desc;
|
|
|
|
|
|
|
|
|
|
FD_CLR (desc, &input_wait_mask);
|
|
|
|
|
FD_CLR (desc, &non_process_wait_mask);
|
|
|
|
|
|
|
|
|
|
if (desc == max_keyboard_desc)
|
|
|
|
|
for (fd = 0; fd < lim; fd++)
|
|
|
|
|
if (FD_ISSET (fd, &input_wait_mask)
|
|
|
|
|
&& !FD_ISSET (fd, &non_keyboard_wait_mask)
|
|
|
|
|
&& !FD_ISSET (fd, &gpm_wait_mask))
|
|
|
|
|
max_keyboard_desc = fd;
|
|
|
|
|
#endif /* subprocesses */
|
|
|
|
|
}
|
|
|
|
|
|
2010-07-12 21:23:00 +03:00
|
|
|
|
/* Setup coding systems of PROCESS. */
|
|
|
|
|
|
|
|
|
|
void
|
|
|
|
|
setup_process_coding_systems (Lisp_Object process)
|
|
|
|
|
{
|
|
|
|
|
#ifdef subprocesses
|
|
|
|
|
struct Lisp_Process *p = XPROCESS (process);
|
|
|
|
|
int inch = p->infd;
|
|
|
|
|
int outch = p->outfd;
|
|
|
|
|
Lisp_Object coding_system;
|
|
|
|
|
|
|
|
|
|
if (inch < 0 || outch < 0)
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
if (!proc_decode_coding_system[inch])
|
|
|
|
|
proc_decode_coding_system[inch]
|
|
|
|
|
= (struct coding_system *) xmalloc (sizeof (struct coding_system));
|
|
|
|
|
coding_system = p->decode_coding_system;
|
|
|
|
|
if (! NILP (p->filter))
|
|
|
|
|
;
|
|
|
|
|
else if (BUFFERP (p->buffer))
|
|
|
|
|
{
|
|
|
|
|
if (NILP (XBUFFER (p->buffer)->enable_multibyte_characters))
|
|
|
|
|
coding_system = raw_text_coding_system (coding_system);
|
|
|
|
|
}
|
|
|
|
|
setup_coding_system (coding_system, proc_decode_coding_system[inch]);
|
|
|
|
|
|
|
|
|
|
if (!proc_encode_coding_system[outch])
|
|
|
|
|
proc_encode_coding_system[outch]
|
|
|
|
|
= (struct coding_system *) xmalloc (sizeof (struct coding_system));
|
|
|
|
|
setup_coding_system (p->encode_coding_system,
|
|
|
|
|
proc_encode_coding_system[outch]);
|
|
|
|
|
#endif
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Close all descriptors currently in use for communication
|
|
|
|
|
with subprocess. This is used in a newly-forked subprocess
|
|
|
|
|
to get rid of irrelevant descriptors. */
|
|
|
|
|
|
|
|
|
|
void
|
|
|
|
|
close_process_descs (void)
|
|
|
|
|
{
|
|
|
|
|
#ifndef DOS_NT
|
|
|
|
|
int i;
|
|
|
|
|
for (i = 0; i < MAXDESC; i++)
|
|
|
|
|
{
|
|
|
|
|
Lisp_Object process;
|
|
|
|
|
process = chan_process[i];
|
|
|
|
|
if (!NILP (process))
|
|
|
|
|
{
|
|
|
|
|
int in = XPROCESS (process)->infd;
|
|
|
|
|
int out = XPROCESS (process)->outfd;
|
|
|
|
|
if (in >= 0)
|
|
|
|
|
emacs_close (in);
|
|
|
|
|
if (out >= 0 && in != out)
|
|
|
|
|
emacs_close (out);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
#endif
|
|
|
|
|
}
|
|
|
|
|
|
1992-03-18 20:22:31 +00:00
|
|
|
|
DEFUN ("get-buffer-process", Fget_buffer_process, Sget_buffer_process, 1, 1, 0,
|
2010-07-10 16:26:44 +03:00
|
|
|
|
doc: /* Return the (or a) process associated with BUFFER.
|
|
|
|
|
BUFFER may be a buffer or the name of one. */)
|
|
|
|
|
(register Lisp_Object buffer)
|
1992-03-18 20:22:31 +00:00
|
|
|
|
{
|
2010-07-10 16:26:44 +03:00
|
|
|
|
#ifdef subprocesses
|
|
|
|
|
register Lisp_Object buf, tail, proc;
|
|
|
|
|
|
|
|
|
|
if (NILP (buffer)) return Qnil;
|
|
|
|
|
buf = Fget_buffer (buffer);
|
|
|
|
|
if (NILP (buf)) return Qnil;
|
|
|
|
|
|
|
|
|
|
for (tail = Vprocess_alist; CONSP (tail); tail = XCDR (tail))
|
|
|
|
|
{
|
|
|
|
|
proc = Fcdr (XCAR (tail));
|
|
|
|
|
if (PROCESSP (proc) && EQ (XPROCESS (proc)->buffer, buf))
|
|
|
|
|
return proc;
|
|
|
|
|
}
|
|
|
|
|
#endif /* subprocesses */
|
1992-03-18 20:22:31 +00:00
|
|
|
|
return Qnil;
|
|
|
|
|
}
|
|
|
|
|
|
1998-04-19 14:13:47 +00:00
|
|
|
|
DEFUN ("process-inherit-coding-system-flag",
|
2001-10-20 20:56:10 +00:00
|
|
|
|
Fprocess_inherit_coding_system_flag, Sprocess_inherit_coding_system_flag,
|
|
|
|
|
1, 1, 0,
|
2010-07-10 16:26:44 +03:00
|
|
|
|
doc: /* Return the value of inherit-coding-system flag for PROCESS.
|
|
|
|
|
If this flag is t, `buffer-file-coding-system' of the buffer
|
|
|
|
|
associated with PROCESS will inherit the coding system used to decode
|
|
|
|
|
the process output. */)
|
2010-07-08 14:25:08 -07:00
|
|
|
|
(register Lisp_Object process)
|
1998-04-19 14:13:47 +00:00
|
|
|
|
{
|
2010-07-10 16:26:44 +03:00
|
|
|
|
#ifdef subprocesses
|
|
|
|
|
CHECK_PROCESS (process);
|
|
|
|
|
return XPROCESS (process)->inherit_coding_system_flag ? Qt : Qnil;
|
|
|
|
|
#else
|
1998-04-19 14:13:47 +00:00
|
|
|
|
/* Ignore the argument and return the value of
|
|
|
|
|
inherit-process-coding-system. */
|
|
|
|
|
return inherit_process_coding_system ? Qt : Qnil;
|
2010-07-10 16:26:44 +03:00
|
|
|
|
#endif
|
1998-04-19 14:13:47 +00:00
|
|
|
|
}
|
|
|
|
|
|
1992-03-18 20:22:31 +00:00
|
|
|
|
/* Kill all processes associated with `buffer'.
|
2010-07-10 16:26:44 +03:00
|
|
|
|
If `buffer' is nil, kill all processes */
|
1992-03-18 20:22:31 +00:00
|
|
|
|
|
1998-04-08 06:49:17 +00:00
|
|
|
|
void
|
2010-07-10 16:26:44 +03:00
|
|
|
|
kill_buffer_processes (Lisp_Object buffer)
|
1992-03-18 20:22:31 +00:00
|
|
|
|
{
|
2010-07-10 16:26:44 +03:00
|
|
|
|
#ifdef subprocesses
|
|
|
|
|
Lisp_Object tail, proc;
|
|
|
|
|
|
|
|
|
|
for (tail = Vprocess_alist; CONSP (tail); tail = XCDR (tail))
|
|
|
|
|
{
|
|
|
|
|
proc = XCDR (XCAR (tail));
|
|
|
|
|
if (PROCESSP (proc)
|
|
|
|
|
&& (NILP (buffer) || EQ (XPROCESS (proc)->buffer, buffer)))
|
|
|
|
|
{
|
|
|
|
|
if (NETCONN_P (proc) || SERIALCONN_P (proc))
|
|
|
|
|
Fdelete_process (proc);
|
|
|
|
|
else if (XPROCESS (proc)->infd >= 0)
|
|
|
|
|
process_send_signal (proc, SIGHUP, Qnil, 1);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
#else /* subprocesses */
|
|
|
|
|
/* Since we have no subprocesses, this does nothing. */
|
|
|
|
|
#endif /* subprocesses */
|
1992-03-18 20:22:31 +00:00
|
|
|
|
}
|
|
|
|
|
|
2010-07-13 13:57:00 +03:00
|
|
|
|
DEFUN ("waiting-for-user-input-p", Fwaiting_for_user_input_p, Swaiting_for_user_input_p,
|
|
|
|
|
0, 0, 0,
|
|
|
|
|
doc: /* Returns non-nil if Emacs is waiting for input from the user.
|
|
|
|
|
This is intended for use by asynchronous process output filters and sentinels. */)
|
|
|
|
|
(void)
|
|
|
|
|
{
|
|
|
|
|
#ifdef subprocesses
|
|
|
|
|
return (waiting_for_user_input_p ? Qt : Qnil);
|
|
|
|
|
#else
|
|
|
|
|
return Qnil;
|
|
|
|
|
#endif
|
|
|
|
|
}
|
|
|
|
|
|
2010-07-08 20:30:58 +03:00
|
|
|
|
/* Stop reading input from keyboard sources. */
|
|
|
|
|
|
|
|
|
|
void
|
|
|
|
|
hold_keyboard_input (void)
|
|
|
|
|
{
|
|
|
|
|
kbd_is_on_hold = 1;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Resume reading input from keyboard sources. */
|
|
|
|
|
|
|
|
|
|
void
|
|
|
|
|
unhold_keyboard_input (void)
|
|
|
|
|
{
|
|
|
|
|
kbd_is_on_hold = 0;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Return non-zero if keyboard input is on hold, zero otherwise. */
|
|
|
|
|
|
|
|
|
|
int
|
|
|
|
|
kbd_on_hold_p (void)
|
|
|
|
|
{
|
|
|
|
|
return kbd_is_on_hold;
|
|
|
|
|
}
|
|
|
|
|
|
2010-07-10 16:26:44 +03:00
|
|
|
|
|
|
|
|
|
/* Enumeration of and access to system processes a-la ps(1). */
|
|
|
|
|
|
2008-08-02 16:27:44 +00:00
|
|
|
|
DEFUN ("list-system-processes", Flist_system_processes, Slist_system_processes,
|
|
|
|
|
0, 0, 0,
|
|
|
|
|
doc: /* Return a list of numerical process IDs of all running processes.
|
|
|
|
|
If this functionality is unsupported, return nil.
|
|
|
|
|
|
2010-07-10 16:26:44 +03:00
|
|
|
|
See `process-attributes' for getting attributes of a process given its ID. */)
|
|
|
|
|
(void)
|
|
|
|
|
{
|
|
|
|
|
return list_system_processes ();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
DEFUN ("process-attributes", Fprocess_attributes,
|
|
|
|
|
Sprocess_attributes, 1, 1, 0,
|
|
|
|
|
doc: /* Return attributes of the process given by its PID, a number.
|
|
|
|
|
|
|
|
|
|
Value is an alist where each element is a cons cell of the form
|
|
|
|
|
|
|
|
|
|
\(KEY . VALUE)
|
|
|
|
|
|
|
|
|
|
If this functionality is unsupported, the value is nil.
|
|
|
|
|
|
|
|
|
|
See `list-system-processes' for getting a list of all process IDs.
|
|
|
|
|
|
|
|
|
|
The KEYs of the attributes that this function may return are listed
|
|
|
|
|
below, together with the type of the associated VALUE (in parentheses).
|
|
|
|
|
Not all platforms support all of these attributes; unsupported
|
|
|
|
|
attributes will not appear in the returned alist.
|
|
|
|
|
Unless explicitly indicated otherwise, numbers can have either
|
|
|
|
|
integer or floating point values.
|
|
|
|
|
|
|
|
|
|
euid -- Effective user User ID of the process (number)
|
|
|
|
|
user -- User name corresponding to euid (string)
|
|
|
|
|
egid -- Effective user Group ID of the process (number)
|
|
|
|
|
group -- Group name corresponding to egid (string)
|
|
|
|
|
comm -- Command name (executable name only) (string)
|
|
|
|
|
state -- Process state code, such as "S", "R", or "T" (string)
|
|
|
|
|
ppid -- Parent process ID (number)
|
|
|
|
|
pgrp -- Process group ID (number)
|
|
|
|
|
sess -- Session ID, i.e. process ID of session leader (number)
|
|
|
|
|
ttname -- Controlling tty name (string)
|
|
|
|
|
tpgid -- ID of foreground process group on the process's tty (number)
|
|
|
|
|
minflt -- number of minor page faults (number)
|
|
|
|
|
majflt -- number of major page faults (number)
|
|
|
|
|
cminflt -- cumulative number of minor page faults (number)
|
|
|
|
|
cmajflt -- cumulative number of major page faults (number)
|
|
|
|
|
utime -- user time used by the process, in the (HIGH LOW USEC) format
|
|
|
|
|
stime -- system time used by the process, in the (HIGH LOW USEC) format
|
|
|
|
|
time -- sum of utime and stime, in the (HIGH LOW USEC) format
|
|
|
|
|
cutime -- user time used by the process and its children, (HIGH LOW USEC)
|
|
|
|
|
cstime -- system time used by the process and its children, (HIGH LOW USEC)
|
|
|
|
|
ctime -- sum of cutime and cstime, in the (HIGH LOW USEC) format
|
|
|
|
|
pri -- priority of the process (number)
|
|
|
|
|
nice -- nice value of the process (number)
|
|
|
|
|
thcount -- process thread count (number)
|
|
|
|
|
start -- time the process started, in the (HIGH LOW USEC) format
|
|
|
|
|
vsize -- virtual memory size of the process in KB's (number)
|
|
|
|
|
rss -- resident set size of the process in KB's (number)
|
|
|
|
|
etime -- elapsed time the process is running, in (HIGH LOW USEC) format
|
|
|
|
|
pcpu -- percents of CPU time used by the process (floating-point number)
|
|
|
|
|
pmem -- percents of total physical memory used by process's resident set
|
|
|
|
|
(floating-point number)
|
|
|
|
|
args -- command line which invoked the process (string). */)
|
|
|
|
|
( Lisp_Object pid)
|
|
|
|
|
{
|
|
|
|
|
return system_process_attributes (pid);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void
|
|
|
|
|
init_process (void)
|
|
|
|
|
{
|
|
|
|
|
#ifdef subprocesses
|
|
|
|
|
register int i;
|
|
|
|
|
|
|
|
|
|
inhibit_sentinels = 0;
|
|
|
|
|
|
|
|
|
|
#ifdef SIGCHLD
|
|
|
|
|
#ifndef CANNOT_DUMP
|
|
|
|
|
if (! noninteractive || initialized)
|
|
|
|
|
#endif
|
|
|
|
|
signal (SIGCHLD, sigchld_handler);
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
FD_ZERO (&input_wait_mask);
|
|
|
|
|
FD_ZERO (&non_keyboard_wait_mask);
|
|
|
|
|
FD_ZERO (&non_process_wait_mask);
|
|
|
|
|
max_process_desc = 0;
|
|
|
|
|
|
|
|
|
|
#ifdef NON_BLOCKING_CONNECT
|
|
|
|
|
FD_ZERO (&connect_wait_mask);
|
|
|
|
|
num_pending_connects = 0;
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
#ifdef ADAPTIVE_READ_BUFFERING
|
|
|
|
|
process_output_delay_count = 0;
|
|
|
|
|
process_output_skip = 0;
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
/* Don't do this, it caused infinite select loops. The display
|
|
|
|
|
method should call add_keyboard_wait_descriptor on stdin if it
|
|
|
|
|
needs that. */
|
|
|
|
|
#if 0
|
|
|
|
|
FD_SET (0, &input_wait_mask);
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
Vprocess_alist = Qnil;
|
|
|
|
|
#ifdef SIGCHLD
|
|
|
|
|
deleted_pid_list = Qnil;
|
|
|
|
|
#endif
|
|
|
|
|
for (i = 0; i < MAXDESC; i++)
|
|
|
|
|
{
|
|
|
|
|
chan_process[i] = Qnil;
|
|
|
|
|
proc_buffered_char[i] = -1;
|
|
|
|
|
}
|
|
|
|
|
memset (proc_decode_coding_system, 0, sizeof proc_decode_coding_system);
|
|
|
|
|
memset (proc_encode_coding_system, 0, sizeof proc_encode_coding_system);
|
|
|
|
|
#ifdef DATAGRAM_SOCKETS
|
|
|
|
|
memset (datagram_address, 0, sizeof datagram_address);
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
{
|
|
|
|
|
Lisp_Object subfeatures = Qnil;
|
|
|
|
|
const struct socket_options *sopt;
|
|
|
|
|
|
|
|
|
|
#define ADD_SUBFEATURE(key, val) \
|
|
|
|
|
subfeatures = pure_cons (pure_cons (key, pure_cons (val, Qnil)), subfeatures)
|
|
|
|
|
|
|
|
|
|
#ifdef NON_BLOCKING_CONNECT
|
|
|
|
|
ADD_SUBFEATURE (QCnowait, Qt);
|
|
|
|
|
#endif
|
|
|
|
|
#ifdef DATAGRAM_SOCKETS
|
|
|
|
|
ADD_SUBFEATURE (QCtype, Qdatagram);
|
|
|
|
|
#endif
|
|
|
|
|
#ifdef HAVE_SEQPACKET
|
|
|
|
|
ADD_SUBFEATURE (QCtype, Qseqpacket);
|
|
|
|
|
#endif
|
|
|
|
|
#ifdef HAVE_LOCAL_SOCKETS
|
|
|
|
|
ADD_SUBFEATURE (QCfamily, Qlocal);
|
|
|
|
|
#endif
|
|
|
|
|
ADD_SUBFEATURE (QCfamily, Qipv4);
|
|
|
|
|
#ifdef AF_INET6
|
|
|
|
|
ADD_SUBFEATURE (QCfamily, Qipv6);
|
|
|
|
|
#endif
|
|
|
|
|
#ifdef HAVE_GETSOCKNAME
|
|
|
|
|
ADD_SUBFEATURE (QCservice, Qt);
|
|
|
|
|
#endif
|
|
|
|
|
#if defined(O_NONBLOCK) || defined(O_NDELAY)
|
|
|
|
|
ADD_SUBFEATURE (QCserver, Qt);
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
for (sopt = socket_options; sopt->name; sopt++)
|
|
|
|
|
subfeatures = pure_cons (intern_c_string (sopt->name), subfeatures);
|
|
|
|
|
|
|
|
|
|
Fprovide (intern_c_string ("make-network-process"), subfeatures);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
#if defined (DARWIN_OS)
|
|
|
|
|
/* PTYs are broken on Darwin < 6, but are sometimes useful for interactive
|
|
|
|
|
processes. As such, we only change the default value. */
|
|
|
|
|
if (initialized)
|
|
|
|
|
{
|
|
|
|
|
char *release = get_operating_system_release ();
|
|
|
|
|
if (!release || !release[0] || (release[0] < MIN_PTY_KERNEL_VERSION
|
|
|
|
|
&& release[1] == '.')) {
|
|
|
|
|
Vprocess_connection_type = Qnil;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
#endif
|
|
|
|
|
#endif /* subprocesses */
|
|
|
|
|
kbd_is_on_hold = 0;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void
|
|
|
|
|
syms_of_process (void)
|
|
|
|
|
{
|
|
|
|
|
#ifdef subprocesses
|
|
|
|
|
|
|
|
|
|
Qprocessp = intern_c_string ("processp");
|
|
|
|
|
staticpro (&Qprocessp);
|
|
|
|
|
Qrun = intern_c_string ("run");
|
|
|
|
|
staticpro (&Qrun);
|
|
|
|
|
Qstop = intern_c_string ("stop");
|
|
|
|
|
staticpro (&Qstop);
|
|
|
|
|
Qsignal = intern_c_string ("signal");
|
|
|
|
|
staticpro (&Qsignal);
|
|
|
|
|
|
|
|
|
|
/* Qexit is already staticpro'd by syms_of_eval; don't staticpro it
|
|
|
|
|
here again.
|
2008-08-02 16:27:44 +00:00
|
|
|
|
|
2010-07-10 16:26:44 +03:00
|
|
|
|
Qexit = intern_c_string ("exit");
|
|
|
|
|
staticpro (&Qexit); */
|
2008-08-02 16:27:44 +00:00
|
|
|
|
|
2010-07-10 16:26:44 +03:00
|
|
|
|
Qopen = intern_c_string ("open");
|
|
|
|
|
staticpro (&Qopen);
|
|
|
|
|
Qclosed = intern_c_string ("closed");
|
|
|
|
|
staticpro (&Qclosed);
|
|
|
|
|
Qconnect = intern_c_string ("connect");
|
|
|
|
|
staticpro (&Qconnect);
|
|
|
|
|
Qfailed = intern_c_string ("failed");
|
|
|
|
|
staticpro (&Qfailed);
|
|
|
|
|
Qlisten = intern_c_string ("listen");
|
|
|
|
|
staticpro (&Qlisten);
|
|
|
|
|
Qlocal = intern_c_string ("local");
|
|
|
|
|
staticpro (&Qlocal);
|
|
|
|
|
Qipv4 = intern_c_string ("ipv4");
|
|
|
|
|
staticpro (&Qipv4);
|
|
|
|
|
#ifdef AF_INET6
|
|
|
|
|
Qipv6 = intern_c_string ("ipv6");
|
|
|
|
|
staticpro (&Qipv6);
|
|
|
|
|
#endif
|
|
|
|
|
Qdatagram = intern_c_string ("datagram");
|
|
|
|
|
staticpro (&Qdatagram);
|
|
|
|
|
Qseqpacket = intern_c_string ("seqpacket");
|
|
|
|
|
staticpro (&Qseqpacket);
|
2008-08-02 16:27:44 +00:00
|
|
|
|
|
2010-07-10 16:26:44 +03:00
|
|
|
|
QCport = intern_c_string (":port");
|
|
|
|
|
staticpro (&QCport);
|
|
|
|
|
QCspeed = intern_c_string (":speed");
|
|
|
|
|
staticpro (&QCspeed);
|
|
|
|
|
QCprocess = intern_c_string (":process");
|
|
|
|
|
staticpro (&QCprocess);
|
2008-08-02 16:27:44 +00:00
|
|
|
|
|
2010-07-10 16:26:44 +03:00
|
|
|
|
QCbytesize = intern_c_string (":bytesize");
|
|
|
|
|
staticpro (&QCbytesize);
|
|
|
|
|
QCstopbits = intern_c_string (":stopbits");
|
|
|
|
|
staticpro (&QCstopbits);
|
|
|
|
|
QCparity = intern_c_string (":parity");
|
|
|
|
|
staticpro (&QCparity);
|
|
|
|
|
Qodd = intern_c_string ("odd");
|
|
|
|
|
staticpro (&Qodd);
|
|
|
|
|
Qeven = intern_c_string ("even");
|
|
|
|
|
staticpro (&Qeven);
|
|
|
|
|
QCflowcontrol = intern_c_string (":flowcontrol");
|
|
|
|
|
staticpro (&QCflowcontrol);
|
|
|
|
|
Qhw = intern_c_string ("hw");
|
|
|
|
|
staticpro (&Qhw);
|
|
|
|
|
Qsw = intern_c_string ("sw");
|
|
|
|
|
staticpro (&Qsw);
|
|
|
|
|
QCsummary = intern_c_string (":summary");
|
|
|
|
|
staticpro (&QCsummary);
|
2008-08-02 16:27:44 +00:00
|
|
|
|
|
2010-07-10 16:26:44 +03:00
|
|
|
|
Qreal = intern_c_string ("real");
|
|
|
|
|
staticpro (&Qreal);
|
|
|
|
|
Qnetwork = intern_c_string ("network");
|
|
|
|
|
staticpro (&Qnetwork);
|
|
|
|
|
Qserial = intern_c_string ("serial");
|
|
|
|
|
staticpro (&Qserial);
|
|
|
|
|
QCbuffer = intern_c_string (":buffer");
|
|
|
|
|
staticpro (&QCbuffer);
|
|
|
|
|
QChost = intern_c_string (":host");
|
|
|
|
|
staticpro (&QChost);
|
|
|
|
|
QCservice = intern_c_string (":service");
|
|
|
|
|
staticpro (&QCservice);
|
|
|
|
|
QClocal = intern_c_string (":local");
|
|
|
|
|
staticpro (&QClocal);
|
|
|
|
|
QCremote = intern_c_string (":remote");
|
|
|
|
|
staticpro (&QCremote);
|
|
|
|
|
QCcoding = intern_c_string (":coding");
|
|
|
|
|
staticpro (&QCcoding);
|
|
|
|
|
QCserver = intern_c_string (":server");
|
|
|
|
|
staticpro (&QCserver);
|
|
|
|
|
QCnowait = intern_c_string (":nowait");
|
|
|
|
|
staticpro (&QCnowait);
|
|
|
|
|
QCsentinel = intern_c_string (":sentinel");
|
|
|
|
|
staticpro (&QCsentinel);
|
|
|
|
|
QClog = intern_c_string (":log");
|
|
|
|
|
staticpro (&QClog);
|
|
|
|
|
QCnoquery = intern_c_string (":noquery");
|
|
|
|
|
staticpro (&QCnoquery);
|
|
|
|
|
QCstop = intern_c_string (":stop");
|
|
|
|
|
staticpro (&QCstop);
|
|
|
|
|
QCoptions = intern_c_string (":options");
|
|
|
|
|
staticpro (&QCoptions);
|
|
|
|
|
QCplist = intern_c_string (":plist");
|
|
|
|
|
staticpro (&QCplist);
|
2008-08-02 16:27:44 +00:00
|
|
|
|
|
2010-07-10 16:26:44 +03:00
|
|
|
|
Qlast_nonmenu_event = intern_c_string ("last-nonmenu-event");
|
|
|
|
|
staticpro (&Qlast_nonmenu_event);
|
2008-08-02 16:27:44 +00:00
|
|
|
|
|
2010-07-10 16:26:44 +03:00
|
|
|
|
staticpro (&Vprocess_alist);
|
|
|
|
|
#ifdef SIGCHLD
|
|
|
|
|
staticpro (&deleted_pid_list);
|
|
|
|
|
#endif
|
2008-08-02 16:27:44 +00:00
|
|
|
|
|
2010-07-10 16:26:44 +03:00
|
|
|
|
#endif /* subprocesses */
|
1992-03-18 20:22:31 +00:00
|
|
|
|
|
* xterm.c (syms_of_xterm):
* xselect.c (syms_of_xselect):
* xmenu.c (syms_of_xmenu):
* xfns.c (syms_of_xfns):
* xfaces.c (syms_of_xfaces):
* xdisp.c (syms_of_xdisp):
* window.c (syms_of_window):
* w32fns.c (syms_of_w32fns):
* undo.c (syms_of_undo):
* textprop.c (syms_of_textprop):
* terminal.c (syms_of_terminal):
* syntax.c (syms_of_syntax):
* sound.c (syms_of_sound):
* search.c (syms_of_search):
* print.c (syms_of_print):
* minibuf.c (syms_of_minibuf):
* macros.c (syms_of_macros):
* keymap.c (syms_of_keymap, initial_define_key)
(initial_define_lispy_key):
* keyboard.c (syms_of_keyboard):
* insdel.c (syms_of_insdel):
* image.c (syms_of_image):
* fringe.c (syms_of_fringe):
* frame.c (syms_of_frame):
* fontset.c (syms_of_fontset):
* fns.c (syms_of_fns):
* fns.c (syms_of_fns):
* fileio.c (syms_of_fileio):
* fileio.c (syms_of_fileio):
* eval.c (syms_of_eval):
* doc.c (syms_of_doc):
* dispnew.c (syms_of_display):
* dired.c (syms_of_dired):
* dbusbind.c (syms_of_dbusbind):
* data.c (syms_of_data):
* composite.c (syms_of_composite):
* coding.c (syms_of_coding):
* cmds.c (syms_of_cmds):
* charset.c (define_charset_internal, syms_of_character):
* ccl.c (syms_of_ccl):
* category.c (syms_of_category, init_category_once):
* casetab.c (syms_of_casetab):
* casefiddle.c (syms_of_casefiddle):
* callint.c (syms_of_callint):
* bytecode.c (syms_of_bytecode):
* buffer.c (keys_of_buffer, syms_of_buffer):
* alloc.c (syms_of_alloc):
* process.c (syms_of_process, init_process):
* lread.c (syms_of_lread, init_obarray):
* font.c (build_style_table):
* emacs.c (syms_of_emacs, main): Replace calls to intern with
intern_c_string, calls to make_pure_string with
make_pure_c_string. Use pure_cons instead of Fcons.
* process.c (socket_options): Make it const.
(set_socket_option, init_process): Use a const pointer.
* lread.c (intern_c_string): New function.
(defvar_kboard, defvar_lisp, defvar_lisp_nopro, defvar_bool)
(defvar_int): Uset it. Make the name const char*.
* font.c (struct table_entry): Remove unused member. Make NAMES
constant.
(weight_table, slant_table, width_table): Make constant.
* emacs.c (struct standard_args): Make name and longname constant.
2009-11-06 06:50:52 +00:00
|
|
|
|
QCname = intern_c_string (":name");
|
2008-08-23 16:48:55 +00:00
|
|
|
|
staticpro (&QCname);
|
* xterm.c (syms_of_xterm):
* xselect.c (syms_of_xselect):
* xmenu.c (syms_of_xmenu):
* xfns.c (syms_of_xfns):
* xfaces.c (syms_of_xfaces):
* xdisp.c (syms_of_xdisp):
* window.c (syms_of_window):
* w32fns.c (syms_of_w32fns):
* undo.c (syms_of_undo):
* textprop.c (syms_of_textprop):
* terminal.c (syms_of_terminal):
* syntax.c (syms_of_syntax):
* sound.c (syms_of_sound):
* search.c (syms_of_search):
* print.c (syms_of_print):
* minibuf.c (syms_of_minibuf):
* macros.c (syms_of_macros):
* keymap.c (syms_of_keymap, initial_define_key)
(initial_define_lispy_key):
* keyboard.c (syms_of_keyboard):
* insdel.c (syms_of_insdel):
* image.c (syms_of_image):
* fringe.c (syms_of_fringe):
* frame.c (syms_of_frame):
* fontset.c (syms_of_fontset):
* fns.c (syms_of_fns):
* fns.c (syms_of_fns):
* fileio.c (syms_of_fileio):
* fileio.c (syms_of_fileio):
* eval.c (syms_of_eval):
* doc.c (syms_of_doc):
* dispnew.c (syms_of_display):
* dired.c (syms_of_dired):
* dbusbind.c (syms_of_dbusbind):
* data.c (syms_of_data):
* composite.c (syms_of_composite):
* coding.c (syms_of_coding):
* cmds.c (syms_of_cmds):
* charset.c (define_charset_internal, syms_of_character):
* ccl.c (syms_of_ccl):
* category.c (syms_of_category, init_category_once):
* casetab.c (syms_of_casetab):
* casefiddle.c (syms_of_casefiddle):
* callint.c (syms_of_callint):
* bytecode.c (syms_of_bytecode):
* buffer.c (keys_of_buffer, syms_of_buffer):
* alloc.c (syms_of_alloc):
* process.c (syms_of_process, init_process):
* lread.c (syms_of_lread, init_obarray):
* font.c (build_style_table):
* emacs.c (syms_of_emacs, main): Replace calls to intern with
intern_c_string, calls to make_pure_string with
make_pure_c_string. Use pure_cons instead of Fcons.
* process.c (socket_options): Make it const.
(set_socket_option, init_process): Use a const pointer.
* lread.c (intern_c_string): New function.
(defvar_kboard, defvar_lisp, defvar_lisp_nopro, defvar_bool)
(defvar_int): Uset it. Make the name const char*.
* font.c (struct table_entry): Remove unused member. Make NAMES
constant.
(weight_table, slant_table, width_table): Make constant.
* emacs.c (struct standard_args): Make name and longname constant.
2009-11-06 06:50:52 +00:00
|
|
|
|
QCtype = intern_c_string (":type");
|
(Qeuid, Qegid, Qcomm, Qstate, Qppid, Qpgrp, Qsess)
(Qttname, Qminflt, Qmajflt, Qcminflt, Qcmajflt, Qutime, Qstime)
(Qcutime, Qpri, Qnice, Qthcount, Qstart, Qvsize, Qrss, Qargs)
(Quser, Qgroup, Qetime, Qpcpu, Qpmem, Qtpgid, Qcstime) [!subprocesses]: Define.
(syms_of_process) [!subprocesses]: Intern and staticpro them.
(Flist_system_processes, Fsystem_process_attributes) [!subprocesses]: Call
list_system_processes and system_process_attributes instead of returning Qnil.
2009-01-03 15:03:59 +00:00
|
|
|
|
staticpro (&QCtype);
|
2010-07-10 16:26:44 +03:00
|
|
|
|
|
* xterm.c (syms_of_xterm):
* xselect.c (syms_of_xselect):
* xmenu.c (syms_of_xmenu):
* xfns.c (syms_of_xfns):
* xfaces.c (syms_of_xfaces):
* xdisp.c (syms_of_xdisp):
* window.c (syms_of_window):
* w32fns.c (syms_of_w32fns):
* undo.c (syms_of_undo):
* textprop.c (syms_of_textprop):
* terminal.c (syms_of_terminal):
* syntax.c (syms_of_syntax):
* sound.c (syms_of_sound):
* search.c (syms_of_search):
* print.c (syms_of_print):
* minibuf.c (syms_of_minibuf):
* macros.c (syms_of_macros):
* keymap.c (syms_of_keymap, initial_define_key)
(initial_define_lispy_key):
* keyboard.c (syms_of_keyboard):
* insdel.c (syms_of_insdel):
* image.c (syms_of_image):
* fringe.c (syms_of_fringe):
* frame.c (syms_of_frame):
* fontset.c (syms_of_fontset):
* fns.c (syms_of_fns):
* fns.c (syms_of_fns):
* fileio.c (syms_of_fileio):
* fileio.c (syms_of_fileio):
* eval.c (syms_of_eval):
* doc.c (syms_of_doc):
* dispnew.c (syms_of_display):
* dired.c (syms_of_dired):
* dbusbind.c (syms_of_dbusbind):
* data.c (syms_of_data):
* composite.c (syms_of_composite):
* coding.c (syms_of_coding):
* cmds.c (syms_of_cmds):
* charset.c (define_charset_internal, syms_of_character):
* ccl.c (syms_of_ccl):
* category.c (syms_of_category, init_category_once):
* casetab.c (syms_of_casetab):
* casefiddle.c (syms_of_casefiddle):
* callint.c (syms_of_callint):
* bytecode.c (syms_of_bytecode):
* buffer.c (keys_of_buffer, syms_of_buffer):
* alloc.c (syms_of_alloc):
* process.c (syms_of_process, init_process):
* lread.c (syms_of_lread, init_obarray):
* font.c (build_style_table):
* emacs.c (syms_of_emacs, main): Replace calls to intern with
intern_c_string, calls to make_pure_string with
make_pure_c_string. Use pure_cons instead of Fcons.
* process.c (socket_options): Make it const.
(set_socket_option, init_process): Use a const pointer.
* lread.c (intern_c_string): New function.
(defvar_kboard, defvar_lisp, defvar_lisp_nopro, defvar_bool)
(defvar_int): Uset it. Make the name const char*.
* font.c (struct table_entry): Remove unused member. Make NAMES
constant.
(weight_table, slant_table, width_table): Make constant.
* emacs.c (struct standard_args): Make name and longname constant.
2009-11-06 06:50:52 +00:00
|
|
|
|
Qeuid = intern_c_string ("euid");
|
(Qeuid, Qegid, Qcomm, Qstate, Qppid, Qpgrp, Qsess)
(Qttname, Qminflt, Qmajflt, Qcminflt, Qcmajflt, Qutime, Qstime)
(Qcutime, Qpri, Qnice, Qthcount, Qstart, Qvsize, Qrss, Qargs)
(Quser, Qgroup, Qetime, Qpcpu, Qpmem, Qtpgid, Qcstime) [!subprocesses]: Define.
(syms_of_process) [!subprocesses]: Intern and staticpro them.
(Flist_system_processes, Fsystem_process_attributes) [!subprocesses]: Call
list_system_processes and system_process_attributes instead of returning Qnil.
2009-01-03 15:03:59 +00:00
|
|
|
|
staticpro (&Qeuid);
|
* xterm.c (syms_of_xterm):
* xselect.c (syms_of_xselect):
* xmenu.c (syms_of_xmenu):
* xfns.c (syms_of_xfns):
* xfaces.c (syms_of_xfaces):
* xdisp.c (syms_of_xdisp):
* window.c (syms_of_window):
* w32fns.c (syms_of_w32fns):
* undo.c (syms_of_undo):
* textprop.c (syms_of_textprop):
* terminal.c (syms_of_terminal):
* syntax.c (syms_of_syntax):
* sound.c (syms_of_sound):
* search.c (syms_of_search):
* print.c (syms_of_print):
* minibuf.c (syms_of_minibuf):
* macros.c (syms_of_macros):
* keymap.c (syms_of_keymap, initial_define_key)
(initial_define_lispy_key):
* keyboard.c (syms_of_keyboard):
* insdel.c (syms_of_insdel):
* image.c (syms_of_image):
* fringe.c (syms_of_fringe):
* frame.c (syms_of_frame):
* fontset.c (syms_of_fontset):
* fns.c (syms_of_fns):
* fns.c (syms_of_fns):
* fileio.c (syms_of_fileio):
* fileio.c (syms_of_fileio):
* eval.c (syms_of_eval):
* doc.c (syms_of_doc):
* dispnew.c (syms_of_display):
* dired.c (syms_of_dired):
* dbusbind.c (syms_of_dbusbind):
* data.c (syms_of_data):
* composite.c (syms_of_composite):
* coding.c (syms_of_coding):
* cmds.c (syms_of_cmds):
* charset.c (define_charset_internal, syms_of_character):
* ccl.c (syms_of_ccl):
* category.c (syms_of_category, init_category_once):
* casetab.c (syms_of_casetab):
* casefiddle.c (syms_of_casefiddle):
* callint.c (syms_of_callint):
* bytecode.c (syms_of_bytecode):
* buffer.c (keys_of_buffer, syms_of_buffer):
* alloc.c (syms_of_alloc):
* process.c (syms_of_process, init_process):
* lread.c (syms_of_lread, init_obarray):
* font.c (build_style_table):
* emacs.c (syms_of_emacs, main): Replace calls to intern with
intern_c_string, calls to make_pure_string with
make_pure_c_string. Use pure_cons instead of Fcons.
* process.c (socket_options): Make it const.
(set_socket_option, init_process): Use a const pointer.
* lread.c (intern_c_string): New function.
(defvar_kboard, defvar_lisp, defvar_lisp_nopro, defvar_bool)
(defvar_int): Uset it. Make the name const char*.
* font.c (struct table_entry): Remove unused member. Make NAMES
constant.
(weight_table, slant_table, width_table): Make constant.
* emacs.c (struct standard_args): Make name and longname constant.
2009-11-06 06:50:52 +00:00
|
|
|
|
Qegid = intern_c_string ("egid");
|
(Qeuid, Qegid, Qcomm, Qstate, Qppid, Qpgrp, Qsess)
(Qttname, Qminflt, Qmajflt, Qcminflt, Qcmajflt, Qutime, Qstime)
(Qcutime, Qpri, Qnice, Qthcount, Qstart, Qvsize, Qrss, Qargs)
(Quser, Qgroup, Qetime, Qpcpu, Qpmem, Qtpgid, Qcstime) [!subprocesses]: Define.
(syms_of_process) [!subprocesses]: Intern and staticpro them.
(Flist_system_processes, Fsystem_process_attributes) [!subprocesses]: Call
list_system_processes and system_process_attributes instead of returning Qnil.
2009-01-03 15:03:59 +00:00
|
|
|
|
staticpro (&Qegid);
|
* xterm.c (syms_of_xterm):
* xselect.c (syms_of_xselect):
* xmenu.c (syms_of_xmenu):
* xfns.c (syms_of_xfns):
* xfaces.c (syms_of_xfaces):
* xdisp.c (syms_of_xdisp):
* window.c (syms_of_window):
* w32fns.c (syms_of_w32fns):
* undo.c (syms_of_undo):
* textprop.c (syms_of_textprop):
* terminal.c (syms_of_terminal):
* syntax.c (syms_of_syntax):
* sound.c (syms_of_sound):
* search.c (syms_of_search):
* print.c (syms_of_print):
* minibuf.c (syms_of_minibuf):
* macros.c (syms_of_macros):
* keymap.c (syms_of_keymap, initial_define_key)
(initial_define_lispy_key):
* keyboard.c (syms_of_keyboard):
* insdel.c (syms_of_insdel):
* image.c (syms_of_image):
* fringe.c (syms_of_fringe):
* frame.c (syms_of_frame):
* fontset.c (syms_of_fontset):
* fns.c (syms_of_fns):
* fns.c (syms_of_fns):
* fileio.c (syms_of_fileio):
* fileio.c (syms_of_fileio):
* eval.c (syms_of_eval):
* doc.c (syms_of_doc):
* dispnew.c (syms_of_display):
* dired.c (syms_of_dired):
* dbusbind.c (syms_of_dbusbind):
* data.c (syms_of_data):
* composite.c (syms_of_composite):
* coding.c (syms_of_coding):
* cmds.c (syms_of_cmds):
* charset.c (define_charset_internal, syms_of_character):
* ccl.c (syms_of_ccl):
* category.c (syms_of_category, init_category_once):
* casetab.c (syms_of_casetab):
* casefiddle.c (syms_of_casefiddle):
* callint.c (syms_of_callint):
* bytecode.c (syms_of_bytecode):
* buffer.c (keys_of_buffer, syms_of_buffer):
* alloc.c (syms_of_alloc):
* process.c (syms_of_process, init_process):
* lread.c (syms_of_lread, init_obarray):
* font.c (build_style_table):
* emacs.c (syms_of_emacs, main): Replace calls to intern with
intern_c_string, calls to make_pure_string with
make_pure_c_string. Use pure_cons instead of Fcons.
* process.c (socket_options): Make it const.
(set_socket_option, init_process): Use a const pointer.
* lread.c (intern_c_string): New function.
(defvar_kboard, defvar_lisp, defvar_lisp_nopro, defvar_bool)
(defvar_int): Uset it. Make the name const char*.
* font.c (struct table_entry): Remove unused member. Make NAMES
constant.
(weight_table, slant_table, width_table): Make constant.
* emacs.c (struct standard_args): Make name and longname constant.
2009-11-06 06:50:52 +00:00
|
|
|
|
Quser = intern_c_string ("user");
|
(Qeuid, Qegid, Qcomm, Qstate, Qppid, Qpgrp, Qsess)
(Qttname, Qminflt, Qmajflt, Qcminflt, Qcmajflt, Qutime, Qstime)
(Qcutime, Qpri, Qnice, Qthcount, Qstart, Qvsize, Qrss, Qargs)
(Quser, Qgroup, Qetime, Qpcpu, Qpmem, Qtpgid, Qcstime) [!subprocesses]: Define.
(syms_of_process) [!subprocesses]: Intern and staticpro them.
(Flist_system_processes, Fsystem_process_attributes) [!subprocesses]: Call
list_system_processes and system_process_attributes instead of returning Qnil.
2009-01-03 15:03:59 +00:00
|
|
|
|
staticpro (&Quser);
|
* xterm.c (syms_of_xterm):
* xselect.c (syms_of_xselect):
* xmenu.c (syms_of_xmenu):
* xfns.c (syms_of_xfns):
* xfaces.c (syms_of_xfaces):
* xdisp.c (syms_of_xdisp):
* window.c (syms_of_window):
* w32fns.c (syms_of_w32fns):
* undo.c (syms_of_undo):
* textprop.c (syms_of_textprop):
* terminal.c (syms_of_terminal):
* syntax.c (syms_of_syntax):
* sound.c (syms_of_sound):
* search.c (syms_of_search):
* print.c (syms_of_print):
* minibuf.c (syms_of_minibuf):
* macros.c (syms_of_macros):
* keymap.c (syms_of_keymap, initial_define_key)
(initial_define_lispy_key):
* keyboard.c (syms_of_keyboard):
* insdel.c (syms_of_insdel):
* image.c (syms_of_image):
* fringe.c (syms_of_fringe):
* frame.c (syms_of_frame):
* fontset.c (syms_of_fontset):
* fns.c (syms_of_fns):
* fns.c (syms_of_fns):
* fileio.c (syms_of_fileio):
* fileio.c (syms_of_fileio):
* eval.c (syms_of_eval):
* doc.c (syms_of_doc):
* dispnew.c (syms_of_display):
* dired.c (syms_of_dired):
* dbusbind.c (syms_of_dbusbind):
* data.c (syms_of_data):
* composite.c (syms_of_composite):
* coding.c (syms_of_coding):
* cmds.c (syms_of_cmds):
* charset.c (define_charset_internal, syms_of_character):
* ccl.c (syms_of_ccl):
* category.c (syms_of_category, init_category_once):
* casetab.c (syms_of_casetab):
* casefiddle.c (syms_of_casefiddle):
* callint.c (syms_of_callint):
* bytecode.c (syms_of_bytecode):
* buffer.c (keys_of_buffer, syms_of_buffer):
* alloc.c (syms_of_alloc):
* process.c (syms_of_process, init_process):
* lread.c (syms_of_lread, init_obarray):
* font.c (build_style_table):
* emacs.c (syms_of_emacs, main): Replace calls to intern with
intern_c_string, calls to make_pure_string with
make_pure_c_string. Use pure_cons instead of Fcons.
* process.c (socket_options): Make it const.
(set_socket_option, init_process): Use a const pointer.
* lread.c (intern_c_string): New function.
(defvar_kboard, defvar_lisp, defvar_lisp_nopro, defvar_bool)
(defvar_int): Uset it. Make the name const char*.
* font.c (struct table_entry): Remove unused member. Make NAMES
constant.
(weight_table, slant_table, width_table): Make constant.
* emacs.c (struct standard_args): Make name and longname constant.
2009-11-06 06:50:52 +00:00
|
|
|
|
Qgroup = intern_c_string ("group");
|
(Qeuid, Qegid, Qcomm, Qstate, Qppid, Qpgrp, Qsess)
(Qttname, Qminflt, Qmajflt, Qcminflt, Qcmajflt, Qutime, Qstime)
(Qcutime, Qpri, Qnice, Qthcount, Qstart, Qvsize, Qrss, Qargs)
(Quser, Qgroup, Qetime, Qpcpu, Qpmem, Qtpgid, Qcstime) [!subprocesses]: Define.
(syms_of_process) [!subprocesses]: Intern and staticpro them.
(Flist_system_processes, Fsystem_process_attributes) [!subprocesses]: Call
list_system_processes and system_process_attributes instead of returning Qnil.
2009-01-03 15:03:59 +00:00
|
|
|
|
staticpro (&Qgroup);
|
* xterm.c (syms_of_xterm):
* xselect.c (syms_of_xselect):
* xmenu.c (syms_of_xmenu):
* xfns.c (syms_of_xfns):
* xfaces.c (syms_of_xfaces):
* xdisp.c (syms_of_xdisp):
* window.c (syms_of_window):
* w32fns.c (syms_of_w32fns):
* undo.c (syms_of_undo):
* textprop.c (syms_of_textprop):
* terminal.c (syms_of_terminal):
* syntax.c (syms_of_syntax):
* sound.c (syms_of_sound):
* search.c (syms_of_search):
* print.c (syms_of_print):
* minibuf.c (syms_of_minibuf):
* macros.c (syms_of_macros):
* keymap.c (syms_of_keymap, initial_define_key)
(initial_define_lispy_key):
* keyboard.c (syms_of_keyboard):
* insdel.c (syms_of_insdel):
* image.c (syms_of_image):
* fringe.c (syms_of_fringe):
* frame.c (syms_of_frame):
* fontset.c (syms_of_fontset):
* fns.c (syms_of_fns):
* fns.c (syms_of_fns):
* fileio.c (syms_of_fileio):
* fileio.c (syms_of_fileio):
* eval.c (syms_of_eval):
* doc.c (syms_of_doc):
* dispnew.c (syms_of_display):
* dired.c (syms_of_dired):
* dbusbind.c (syms_of_dbusbind):
* data.c (syms_of_data):
* composite.c (syms_of_composite):
* coding.c (syms_of_coding):
* cmds.c (syms_of_cmds):
* charset.c (define_charset_internal, syms_of_character):
* ccl.c (syms_of_ccl):
* category.c (syms_of_category, init_category_once):
* casetab.c (syms_of_casetab):
* casefiddle.c (syms_of_casefiddle):
* callint.c (syms_of_callint):
* bytecode.c (syms_of_bytecode):
* buffer.c (keys_of_buffer, syms_of_buffer):
* alloc.c (syms_of_alloc):
* process.c (syms_of_process, init_process):
* lread.c (syms_of_lread, init_obarray):
* font.c (build_style_table):
* emacs.c (syms_of_emacs, main): Replace calls to intern with
intern_c_string, calls to make_pure_string with
make_pure_c_string. Use pure_cons instead of Fcons.
* process.c (socket_options): Make it const.
(set_socket_option, init_process): Use a const pointer.
* lread.c (intern_c_string): New function.
(defvar_kboard, defvar_lisp, defvar_lisp_nopro, defvar_bool)
(defvar_int): Uset it. Make the name const char*.
* font.c (struct table_entry): Remove unused member. Make NAMES
constant.
(weight_table, slant_table, width_table): Make constant.
* emacs.c (struct standard_args): Make name and longname constant.
2009-11-06 06:50:52 +00:00
|
|
|
|
Qcomm = intern_c_string ("comm");
|
(Qeuid, Qegid, Qcomm, Qstate, Qppid, Qpgrp, Qsess)
(Qttname, Qminflt, Qmajflt, Qcminflt, Qcmajflt, Qutime, Qstime)
(Qcutime, Qpri, Qnice, Qthcount, Qstart, Qvsize, Qrss, Qargs)
(Quser, Qgroup, Qetime, Qpcpu, Qpmem, Qtpgid, Qcstime) [!subprocesses]: Define.
(syms_of_process) [!subprocesses]: Intern and staticpro them.
(Flist_system_processes, Fsystem_process_attributes) [!subprocesses]: Call
list_system_processes and system_process_attributes instead of returning Qnil.
2009-01-03 15:03:59 +00:00
|
|
|
|
staticpro (&Qcomm);
|
* xterm.c (syms_of_xterm):
* xselect.c (syms_of_xselect):
* xmenu.c (syms_of_xmenu):
* xfns.c (syms_of_xfns):
* xfaces.c (syms_of_xfaces):
* xdisp.c (syms_of_xdisp):
* window.c (syms_of_window):
* w32fns.c (syms_of_w32fns):
* undo.c (syms_of_undo):
* textprop.c (syms_of_textprop):
* terminal.c (syms_of_terminal):
* syntax.c (syms_of_syntax):
* sound.c (syms_of_sound):
* search.c (syms_of_search):
* print.c (syms_of_print):
* minibuf.c (syms_of_minibuf):
* macros.c (syms_of_macros):
* keymap.c (syms_of_keymap, initial_define_key)
(initial_define_lispy_key):
* keyboard.c (syms_of_keyboard):
* insdel.c (syms_of_insdel):
* image.c (syms_of_image):
* fringe.c (syms_of_fringe):
* frame.c (syms_of_frame):
* fontset.c (syms_of_fontset):
* fns.c (syms_of_fns):
* fns.c (syms_of_fns):
* fileio.c (syms_of_fileio):
* fileio.c (syms_of_fileio):
* eval.c (syms_of_eval):
* doc.c (syms_of_doc):
* dispnew.c (syms_of_display):
* dired.c (syms_of_dired):
* dbusbind.c (syms_of_dbusbind):
* data.c (syms_of_data):
* composite.c (syms_of_composite):
* coding.c (syms_of_coding):
* cmds.c (syms_of_cmds):
* charset.c (define_charset_internal, syms_of_character):
* ccl.c (syms_of_ccl):
* category.c (syms_of_category, init_category_once):
* casetab.c (syms_of_casetab):
* casefiddle.c (syms_of_casefiddle):
* callint.c (syms_of_callint):
* bytecode.c (syms_of_bytecode):
* buffer.c (keys_of_buffer, syms_of_buffer):
* alloc.c (syms_of_alloc):
* process.c (syms_of_process, init_process):
* lread.c (syms_of_lread, init_obarray):
* font.c (build_style_table):
* emacs.c (syms_of_emacs, main): Replace calls to intern with
intern_c_string, calls to make_pure_string with
make_pure_c_string. Use pure_cons instead of Fcons.
* process.c (socket_options): Make it const.
(set_socket_option, init_process): Use a const pointer.
* lread.c (intern_c_string): New function.
(defvar_kboard, defvar_lisp, defvar_lisp_nopro, defvar_bool)
(defvar_int): Uset it. Make the name const char*.
* font.c (struct table_entry): Remove unused member. Make NAMES
constant.
(weight_table, slant_table, width_table): Make constant.
* emacs.c (struct standard_args): Make name and longname constant.
2009-11-06 06:50:52 +00:00
|
|
|
|
Qstate = intern_c_string ("state");
|
(Qeuid, Qegid, Qcomm, Qstate, Qppid, Qpgrp, Qsess)
(Qttname, Qminflt, Qmajflt, Qcminflt, Qcmajflt, Qutime, Qstime)
(Qcutime, Qpri, Qnice, Qthcount, Qstart, Qvsize, Qrss, Qargs)
(Quser, Qgroup, Qetime, Qpcpu, Qpmem, Qtpgid, Qcstime) [!subprocesses]: Define.
(syms_of_process) [!subprocesses]: Intern and staticpro them.
(Flist_system_processes, Fsystem_process_attributes) [!subprocesses]: Call
list_system_processes and system_process_attributes instead of returning Qnil.
2009-01-03 15:03:59 +00:00
|
|
|
|
staticpro (&Qstate);
|
* xterm.c (syms_of_xterm):
* xselect.c (syms_of_xselect):
* xmenu.c (syms_of_xmenu):
* xfns.c (syms_of_xfns):
* xfaces.c (syms_of_xfaces):
* xdisp.c (syms_of_xdisp):
* window.c (syms_of_window):
* w32fns.c (syms_of_w32fns):
* undo.c (syms_of_undo):
* textprop.c (syms_of_textprop):
* terminal.c (syms_of_terminal):
* syntax.c (syms_of_syntax):
* sound.c (syms_of_sound):
* search.c (syms_of_search):
* print.c (syms_of_print):
* minibuf.c (syms_of_minibuf):
* macros.c (syms_of_macros):
* keymap.c (syms_of_keymap, initial_define_key)
(initial_define_lispy_key):
* keyboard.c (syms_of_keyboard):
* insdel.c (syms_of_insdel):
* image.c (syms_of_image):
* fringe.c (syms_of_fringe):
* frame.c (syms_of_frame):
* fontset.c (syms_of_fontset):
* fns.c (syms_of_fns):
* fns.c (syms_of_fns):
* fileio.c (syms_of_fileio):
* fileio.c (syms_of_fileio):
* eval.c (syms_of_eval):
* doc.c (syms_of_doc):
* dispnew.c (syms_of_display):
* dired.c (syms_of_dired):
* dbusbind.c (syms_of_dbusbind):
* data.c (syms_of_data):
* composite.c (syms_of_composite):
* coding.c (syms_of_coding):
* cmds.c (syms_of_cmds):
* charset.c (define_charset_internal, syms_of_character):
* ccl.c (syms_of_ccl):
* category.c (syms_of_category, init_category_once):
* casetab.c (syms_of_casetab):
* casefiddle.c (syms_of_casefiddle):
* callint.c (syms_of_callint):
* bytecode.c (syms_of_bytecode):
* buffer.c (keys_of_buffer, syms_of_buffer):
* alloc.c (syms_of_alloc):
* process.c (syms_of_process, init_process):
* lread.c (syms_of_lread, init_obarray):
* font.c (build_style_table):
* emacs.c (syms_of_emacs, main): Replace calls to intern with
intern_c_string, calls to make_pure_string with
make_pure_c_string. Use pure_cons instead of Fcons.
* process.c (socket_options): Make it const.
(set_socket_option, init_process): Use a const pointer.
* lread.c (intern_c_string): New function.
(defvar_kboard, defvar_lisp, defvar_lisp_nopro, defvar_bool)
(defvar_int): Uset it. Make the name const char*.
* font.c (struct table_entry): Remove unused member. Make NAMES
constant.
(weight_table, slant_table, width_table): Make constant.
* emacs.c (struct standard_args): Make name and longname constant.
2009-11-06 06:50:52 +00:00
|
|
|
|
Qppid = intern_c_string ("ppid");
|
(Qeuid, Qegid, Qcomm, Qstate, Qppid, Qpgrp, Qsess)
(Qttname, Qminflt, Qmajflt, Qcminflt, Qcmajflt, Qutime, Qstime)
(Qcutime, Qpri, Qnice, Qthcount, Qstart, Qvsize, Qrss, Qargs)
(Quser, Qgroup, Qetime, Qpcpu, Qpmem, Qtpgid, Qcstime) [!subprocesses]: Define.
(syms_of_process) [!subprocesses]: Intern and staticpro them.
(Flist_system_processes, Fsystem_process_attributes) [!subprocesses]: Call
list_system_processes and system_process_attributes instead of returning Qnil.
2009-01-03 15:03:59 +00:00
|
|
|
|
staticpro (&Qppid);
|
* xterm.c (syms_of_xterm):
* xselect.c (syms_of_xselect):
* xmenu.c (syms_of_xmenu):
* xfns.c (syms_of_xfns):
* xfaces.c (syms_of_xfaces):
* xdisp.c (syms_of_xdisp):
* window.c (syms_of_window):
* w32fns.c (syms_of_w32fns):
* undo.c (syms_of_undo):
* textprop.c (syms_of_textprop):
* terminal.c (syms_of_terminal):
* syntax.c (syms_of_syntax):
* sound.c (syms_of_sound):
* search.c (syms_of_search):
* print.c (syms_of_print):
* minibuf.c (syms_of_minibuf):
* macros.c (syms_of_macros):
* keymap.c (syms_of_keymap, initial_define_key)
(initial_define_lispy_key):
* keyboard.c (syms_of_keyboard):
* insdel.c (syms_of_insdel):
* image.c (syms_of_image):
* fringe.c (syms_of_fringe):
* frame.c (syms_of_frame):
* fontset.c (syms_of_fontset):
* fns.c (syms_of_fns):
* fns.c (syms_of_fns):
* fileio.c (syms_of_fileio):
* fileio.c (syms_of_fileio):
* eval.c (syms_of_eval):
* doc.c (syms_of_doc):
* dispnew.c (syms_of_display):
* dired.c (syms_of_dired):
* dbusbind.c (syms_of_dbusbind):
* data.c (syms_of_data):
* composite.c (syms_of_composite):
* coding.c (syms_of_coding):
* cmds.c (syms_of_cmds):
* charset.c (define_charset_internal, syms_of_character):
* ccl.c (syms_of_ccl):
* category.c (syms_of_category, init_category_once):
* casetab.c (syms_of_casetab):
* casefiddle.c (syms_of_casefiddle):
* callint.c (syms_of_callint):
* bytecode.c (syms_of_bytecode):
* buffer.c (keys_of_buffer, syms_of_buffer):
* alloc.c (syms_of_alloc):
* process.c (syms_of_process, init_process):
* lread.c (syms_of_lread, init_obarray):
* font.c (build_style_table):
* emacs.c (syms_of_emacs, main): Replace calls to intern with
intern_c_string, calls to make_pure_string with
make_pure_c_string. Use pure_cons instead of Fcons.
* process.c (socket_options): Make it const.
(set_socket_option, init_process): Use a const pointer.
* lread.c (intern_c_string): New function.
(defvar_kboard, defvar_lisp, defvar_lisp_nopro, defvar_bool)
(defvar_int): Uset it. Make the name const char*.
* font.c (struct table_entry): Remove unused member. Make NAMES
constant.
(weight_table, slant_table, width_table): Make constant.
* emacs.c (struct standard_args): Make name and longname constant.
2009-11-06 06:50:52 +00:00
|
|
|
|
Qpgrp = intern_c_string ("pgrp");
|
(Qeuid, Qegid, Qcomm, Qstate, Qppid, Qpgrp, Qsess)
(Qttname, Qminflt, Qmajflt, Qcminflt, Qcmajflt, Qutime, Qstime)
(Qcutime, Qpri, Qnice, Qthcount, Qstart, Qvsize, Qrss, Qargs)
(Quser, Qgroup, Qetime, Qpcpu, Qpmem, Qtpgid, Qcstime) [!subprocesses]: Define.
(syms_of_process) [!subprocesses]: Intern and staticpro them.
(Flist_system_processes, Fsystem_process_attributes) [!subprocesses]: Call
list_system_processes and system_process_attributes instead of returning Qnil.
2009-01-03 15:03:59 +00:00
|
|
|
|
staticpro (&Qpgrp);
|
* xterm.c (syms_of_xterm):
* xselect.c (syms_of_xselect):
* xmenu.c (syms_of_xmenu):
* xfns.c (syms_of_xfns):
* xfaces.c (syms_of_xfaces):
* xdisp.c (syms_of_xdisp):
* window.c (syms_of_window):
* w32fns.c (syms_of_w32fns):
* undo.c (syms_of_undo):
* textprop.c (syms_of_textprop):
* terminal.c (syms_of_terminal):
* syntax.c (syms_of_syntax):
* sound.c (syms_of_sound):
* search.c (syms_of_search):
* print.c (syms_of_print):
* minibuf.c (syms_of_minibuf):
* macros.c (syms_of_macros):
* keymap.c (syms_of_keymap, initial_define_key)
(initial_define_lispy_key):
* keyboard.c (syms_of_keyboard):
* insdel.c (syms_of_insdel):
* image.c (syms_of_image):
* fringe.c (syms_of_fringe):
* frame.c (syms_of_frame):
* fontset.c (syms_of_fontset):
* fns.c (syms_of_fns):
* fns.c (syms_of_fns):
* fileio.c (syms_of_fileio):
* fileio.c (syms_of_fileio):
* eval.c (syms_of_eval):
* doc.c (syms_of_doc):
* dispnew.c (syms_of_display):
* dired.c (syms_of_dired):
* dbusbind.c (syms_of_dbusbind):
* data.c (syms_of_data):
* composite.c (syms_of_composite):
* coding.c (syms_of_coding):
* cmds.c (syms_of_cmds):
* charset.c (define_charset_internal, syms_of_character):
* ccl.c (syms_of_ccl):
* category.c (syms_of_category, init_category_once):
* casetab.c (syms_of_casetab):
* casefiddle.c (syms_of_casefiddle):
* callint.c (syms_of_callint):
* bytecode.c (syms_of_bytecode):
* buffer.c (keys_of_buffer, syms_of_buffer):
* alloc.c (syms_of_alloc):
* process.c (syms_of_process, init_process):
* lread.c (syms_of_lread, init_obarray):
* font.c (build_style_table):
* emacs.c (syms_of_emacs, main): Replace calls to intern with
intern_c_string, calls to make_pure_string with
make_pure_c_string. Use pure_cons instead of Fcons.
* process.c (socket_options): Make it const.
(set_socket_option, init_process): Use a const pointer.
* lread.c (intern_c_string): New function.
(defvar_kboard, defvar_lisp, defvar_lisp_nopro, defvar_bool)
(defvar_int): Uset it. Make the name const char*.
* font.c (struct table_entry): Remove unused member. Make NAMES
constant.
(weight_table, slant_table, width_table): Make constant.
* emacs.c (struct standard_args): Make name and longname constant.
2009-11-06 06:50:52 +00:00
|
|
|
|
Qsess = intern_c_string ("sess");
|
(Qeuid, Qegid, Qcomm, Qstate, Qppid, Qpgrp, Qsess)
(Qttname, Qminflt, Qmajflt, Qcminflt, Qcmajflt, Qutime, Qstime)
(Qcutime, Qpri, Qnice, Qthcount, Qstart, Qvsize, Qrss, Qargs)
(Quser, Qgroup, Qetime, Qpcpu, Qpmem, Qtpgid, Qcstime) [!subprocesses]: Define.
(syms_of_process) [!subprocesses]: Intern and staticpro them.
(Flist_system_processes, Fsystem_process_attributes) [!subprocesses]: Call
list_system_processes and system_process_attributes instead of returning Qnil.
2009-01-03 15:03:59 +00:00
|
|
|
|
staticpro (&Qsess);
|
* xterm.c (syms_of_xterm):
* xselect.c (syms_of_xselect):
* xmenu.c (syms_of_xmenu):
* xfns.c (syms_of_xfns):
* xfaces.c (syms_of_xfaces):
* xdisp.c (syms_of_xdisp):
* window.c (syms_of_window):
* w32fns.c (syms_of_w32fns):
* undo.c (syms_of_undo):
* textprop.c (syms_of_textprop):
* terminal.c (syms_of_terminal):
* syntax.c (syms_of_syntax):
* sound.c (syms_of_sound):
* search.c (syms_of_search):
* print.c (syms_of_print):
* minibuf.c (syms_of_minibuf):
* macros.c (syms_of_macros):
* keymap.c (syms_of_keymap, initial_define_key)
(initial_define_lispy_key):
* keyboard.c (syms_of_keyboard):
* insdel.c (syms_of_insdel):
* image.c (syms_of_image):
* fringe.c (syms_of_fringe):
* frame.c (syms_of_frame):
* fontset.c (syms_of_fontset):
* fns.c (syms_of_fns):
* fns.c (syms_of_fns):
* fileio.c (syms_of_fileio):
* fileio.c (syms_of_fileio):
* eval.c (syms_of_eval):
* doc.c (syms_of_doc):
* dispnew.c (syms_of_display):
* dired.c (syms_of_dired):
* dbusbind.c (syms_of_dbusbind):
* data.c (syms_of_data):
* composite.c (syms_of_composite):
* coding.c (syms_of_coding):
* cmds.c (syms_of_cmds):
* charset.c (define_charset_internal, syms_of_character):
* ccl.c (syms_of_ccl):
* category.c (syms_of_category, init_category_once):
* casetab.c (syms_of_casetab):
* casefiddle.c (syms_of_casefiddle):
* callint.c (syms_of_callint):
* bytecode.c (syms_of_bytecode):
* buffer.c (keys_of_buffer, syms_of_buffer):
* alloc.c (syms_of_alloc):
* process.c (syms_of_process, init_process):
* lread.c (syms_of_lread, init_obarray):
* font.c (build_style_table):
* emacs.c (syms_of_emacs, main): Replace calls to intern with
intern_c_string, calls to make_pure_string with
make_pure_c_string. Use pure_cons instead of Fcons.
* process.c (socket_options): Make it const.
(set_socket_option, init_process): Use a const pointer.
* lread.c (intern_c_string): New function.
(defvar_kboard, defvar_lisp, defvar_lisp_nopro, defvar_bool)
(defvar_int): Uset it. Make the name const char*.
* font.c (struct table_entry): Remove unused member. Make NAMES
constant.
(weight_table, slant_table, width_table): Make constant.
* emacs.c (struct standard_args): Make name and longname constant.
2009-11-06 06:50:52 +00:00
|
|
|
|
Qttname = intern_c_string ("ttname");
|
(Qeuid, Qegid, Qcomm, Qstate, Qppid, Qpgrp, Qsess)
(Qttname, Qminflt, Qmajflt, Qcminflt, Qcmajflt, Qutime, Qstime)
(Qcutime, Qpri, Qnice, Qthcount, Qstart, Qvsize, Qrss, Qargs)
(Quser, Qgroup, Qetime, Qpcpu, Qpmem, Qtpgid, Qcstime) [!subprocesses]: Define.
(syms_of_process) [!subprocesses]: Intern and staticpro them.
(Flist_system_processes, Fsystem_process_attributes) [!subprocesses]: Call
list_system_processes and system_process_attributes instead of returning Qnil.
2009-01-03 15:03:59 +00:00
|
|
|
|
staticpro (&Qttname);
|
* xterm.c (syms_of_xterm):
* xselect.c (syms_of_xselect):
* xmenu.c (syms_of_xmenu):
* xfns.c (syms_of_xfns):
* xfaces.c (syms_of_xfaces):
* xdisp.c (syms_of_xdisp):
* window.c (syms_of_window):
* w32fns.c (syms_of_w32fns):
* undo.c (syms_of_undo):
* textprop.c (syms_of_textprop):
* terminal.c (syms_of_terminal):
* syntax.c (syms_of_syntax):
* sound.c (syms_of_sound):
* search.c (syms_of_search):
* print.c (syms_of_print):
* minibuf.c (syms_of_minibuf):
* macros.c (syms_of_macros):
* keymap.c (syms_of_keymap, initial_define_key)
(initial_define_lispy_key):
* keyboard.c (syms_of_keyboard):
* insdel.c (syms_of_insdel):
* image.c (syms_of_image):
* fringe.c (syms_of_fringe):
* frame.c (syms_of_frame):
* fontset.c (syms_of_fontset):
* fns.c (syms_of_fns):
* fns.c (syms_of_fns):
* fileio.c (syms_of_fileio):
* fileio.c (syms_of_fileio):
* eval.c (syms_of_eval):
* doc.c (syms_of_doc):
* dispnew.c (syms_of_display):
* dired.c (syms_of_dired):
* dbusbind.c (syms_of_dbusbind):
* data.c (syms_of_data):
* composite.c (syms_of_composite):
* coding.c (syms_of_coding):
* cmds.c (syms_of_cmds):
* charset.c (define_charset_internal, syms_of_character):
* ccl.c (syms_of_ccl):
* category.c (syms_of_category, init_category_once):
* casetab.c (syms_of_casetab):
* casefiddle.c (syms_of_casefiddle):
* callint.c (syms_of_callint):
* bytecode.c (syms_of_bytecode):
* buffer.c (keys_of_buffer, syms_of_buffer):
* alloc.c (syms_of_alloc):
* process.c (syms_of_process, init_process):
* lread.c (syms_of_lread, init_obarray):
* font.c (build_style_table):
* emacs.c (syms_of_emacs, main): Replace calls to intern with
intern_c_string, calls to make_pure_string with
make_pure_c_string. Use pure_cons instead of Fcons.
* process.c (socket_options): Make it const.
(set_socket_option, init_process): Use a const pointer.
* lread.c (intern_c_string): New function.
(defvar_kboard, defvar_lisp, defvar_lisp_nopro, defvar_bool)
(defvar_int): Uset it. Make the name const char*.
* font.c (struct table_entry): Remove unused member. Make NAMES
constant.
(weight_table, slant_table, width_table): Make constant.
* emacs.c (struct standard_args): Make name and longname constant.
2009-11-06 06:50:52 +00:00
|
|
|
|
Qtpgid = intern_c_string ("tpgid");
|
(Qeuid, Qegid, Qcomm, Qstate, Qppid, Qpgrp, Qsess)
(Qttname, Qminflt, Qmajflt, Qcminflt, Qcmajflt, Qutime, Qstime)
(Qcutime, Qpri, Qnice, Qthcount, Qstart, Qvsize, Qrss, Qargs)
(Quser, Qgroup, Qetime, Qpcpu, Qpmem, Qtpgid, Qcstime) [!subprocesses]: Define.
(syms_of_process) [!subprocesses]: Intern and staticpro them.
(Flist_system_processes, Fsystem_process_attributes) [!subprocesses]: Call
list_system_processes and system_process_attributes instead of returning Qnil.
2009-01-03 15:03:59 +00:00
|
|
|
|
staticpro (&Qtpgid);
|
* xterm.c (syms_of_xterm):
* xselect.c (syms_of_xselect):
* xmenu.c (syms_of_xmenu):
* xfns.c (syms_of_xfns):
* xfaces.c (syms_of_xfaces):
* xdisp.c (syms_of_xdisp):
* window.c (syms_of_window):
* w32fns.c (syms_of_w32fns):
* undo.c (syms_of_undo):
* textprop.c (syms_of_textprop):
* terminal.c (syms_of_terminal):
* syntax.c (syms_of_syntax):
* sound.c (syms_of_sound):
* search.c (syms_of_search):
* print.c (syms_of_print):
* minibuf.c (syms_of_minibuf):
* macros.c (syms_of_macros):
* keymap.c (syms_of_keymap, initial_define_key)
(initial_define_lispy_key):
* keyboard.c (syms_of_keyboard):
* insdel.c (syms_of_insdel):
* image.c (syms_of_image):
* fringe.c (syms_of_fringe):
* frame.c (syms_of_frame):
* fontset.c (syms_of_fontset):
* fns.c (syms_of_fns):
* fns.c (syms_of_fns):
* fileio.c (syms_of_fileio):
* fileio.c (syms_of_fileio):
* eval.c (syms_of_eval):
* doc.c (syms_of_doc):
* dispnew.c (syms_of_display):
* dired.c (syms_of_dired):
* dbusbind.c (syms_of_dbusbind):
* data.c (syms_of_data):
* composite.c (syms_of_composite):
* coding.c (syms_of_coding):
* cmds.c (syms_of_cmds):
* charset.c (define_charset_internal, syms_of_character):
* ccl.c (syms_of_ccl):
* category.c (syms_of_category, init_category_once):
* casetab.c (syms_of_casetab):
* casefiddle.c (syms_of_casefiddle):
* callint.c (syms_of_callint):
* bytecode.c (syms_of_bytecode):
* buffer.c (keys_of_buffer, syms_of_buffer):
* alloc.c (syms_of_alloc):
* process.c (syms_of_process, init_process):
* lread.c (syms_of_lread, init_obarray):
* font.c (build_style_table):
* emacs.c (syms_of_emacs, main): Replace calls to intern with
intern_c_string, calls to make_pure_string with
make_pure_c_string. Use pure_cons instead of Fcons.
* process.c (socket_options): Make it const.
(set_socket_option, init_process): Use a const pointer.
* lread.c (intern_c_string): New function.
(defvar_kboard, defvar_lisp, defvar_lisp_nopro, defvar_bool)
(defvar_int): Uset it. Make the name const char*.
* font.c (struct table_entry): Remove unused member. Make NAMES
constant.
(weight_table, slant_table, width_table): Make constant.
* emacs.c (struct standard_args): Make name and longname constant.
2009-11-06 06:50:52 +00:00
|
|
|
|
Qminflt = intern_c_string ("minflt");
|
(Qeuid, Qegid, Qcomm, Qstate, Qppid, Qpgrp, Qsess)
(Qttname, Qminflt, Qmajflt, Qcminflt, Qcmajflt, Qutime, Qstime)
(Qcutime, Qpri, Qnice, Qthcount, Qstart, Qvsize, Qrss, Qargs)
(Quser, Qgroup, Qetime, Qpcpu, Qpmem, Qtpgid, Qcstime) [!subprocesses]: Define.
(syms_of_process) [!subprocesses]: Intern and staticpro them.
(Flist_system_processes, Fsystem_process_attributes) [!subprocesses]: Call
list_system_processes and system_process_attributes instead of returning Qnil.
2009-01-03 15:03:59 +00:00
|
|
|
|
staticpro (&Qminflt);
|
* xterm.c (syms_of_xterm):
* xselect.c (syms_of_xselect):
* xmenu.c (syms_of_xmenu):
* xfns.c (syms_of_xfns):
* xfaces.c (syms_of_xfaces):
* xdisp.c (syms_of_xdisp):
* window.c (syms_of_window):
* w32fns.c (syms_of_w32fns):
* undo.c (syms_of_undo):
* textprop.c (syms_of_textprop):
* terminal.c (syms_of_terminal):
* syntax.c (syms_of_syntax):
* sound.c (syms_of_sound):
* search.c (syms_of_search):
* print.c (syms_of_print):
* minibuf.c (syms_of_minibuf):
* macros.c (syms_of_macros):
* keymap.c (syms_of_keymap, initial_define_key)
(initial_define_lispy_key):
* keyboard.c (syms_of_keyboard):
* insdel.c (syms_of_insdel):
* image.c (syms_of_image):
* fringe.c (syms_of_fringe):
* frame.c (syms_of_frame):
* fontset.c (syms_of_fontset):
* fns.c (syms_of_fns):
* fns.c (syms_of_fns):
* fileio.c (syms_of_fileio):
* fileio.c (syms_of_fileio):
* eval.c (syms_of_eval):
* doc.c (syms_of_doc):
* dispnew.c (syms_of_display):
* dired.c (syms_of_dired):
* dbusbind.c (syms_of_dbusbind):
* data.c (syms_of_data):
* composite.c (syms_of_composite):
* coding.c (syms_of_coding):
* cmds.c (syms_of_cmds):
* charset.c (define_charset_internal, syms_of_character):
* ccl.c (syms_of_ccl):
* category.c (syms_of_category, init_category_once):
* casetab.c (syms_of_casetab):
* casefiddle.c (syms_of_casefiddle):
* callint.c (syms_of_callint):
* bytecode.c (syms_of_bytecode):
* buffer.c (keys_of_buffer, syms_of_buffer):
* alloc.c (syms_of_alloc):
* process.c (syms_of_process, init_process):
* lread.c (syms_of_lread, init_obarray):
* font.c (build_style_table):
* emacs.c (syms_of_emacs, main): Replace calls to intern with
intern_c_string, calls to make_pure_string with
make_pure_c_string. Use pure_cons instead of Fcons.
* process.c (socket_options): Make it const.
(set_socket_option, init_process): Use a const pointer.
* lread.c (intern_c_string): New function.
(defvar_kboard, defvar_lisp, defvar_lisp_nopro, defvar_bool)
(defvar_int): Uset it. Make the name const char*.
* font.c (struct table_entry): Remove unused member. Make NAMES
constant.
(weight_table, slant_table, width_table): Make constant.
* emacs.c (struct standard_args): Make name and longname constant.
2009-11-06 06:50:52 +00:00
|
|
|
|
Qmajflt = intern_c_string ("majflt");
|
(Qeuid, Qegid, Qcomm, Qstate, Qppid, Qpgrp, Qsess)
(Qttname, Qminflt, Qmajflt, Qcminflt, Qcmajflt, Qutime, Qstime)
(Qcutime, Qpri, Qnice, Qthcount, Qstart, Qvsize, Qrss, Qargs)
(Quser, Qgroup, Qetime, Qpcpu, Qpmem, Qtpgid, Qcstime) [!subprocesses]: Define.
(syms_of_process) [!subprocesses]: Intern and staticpro them.
(Flist_system_processes, Fsystem_process_attributes) [!subprocesses]: Call
list_system_processes and system_process_attributes instead of returning Qnil.
2009-01-03 15:03:59 +00:00
|
|
|
|
staticpro (&Qmajflt);
|
* xterm.c (syms_of_xterm):
* xselect.c (syms_of_xselect):
* xmenu.c (syms_of_xmenu):
* xfns.c (syms_of_xfns):
* xfaces.c (syms_of_xfaces):
* xdisp.c (syms_of_xdisp):
* window.c (syms_of_window):
* w32fns.c (syms_of_w32fns):
* undo.c (syms_of_undo):
* textprop.c (syms_of_textprop):
* terminal.c (syms_of_terminal):
* syntax.c (syms_of_syntax):
* sound.c (syms_of_sound):
* search.c (syms_of_search):
* print.c (syms_of_print):
* minibuf.c (syms_of_minibuf):
* macros.c (syms_of_macros):
* keymap.c (syms_of_keymap, initial_define_key)
(initial_define_lispy_key):
* keyboard.c (syms_of_keyboard):
* insdel.c (syms_of_insdel):
* image.c (syms_of_image):
* fringe.c (syms_of_fringe):
* frame.c (syms_of_frame):
* fontset.c (syms_of_fontset):
* fns.c (syms_of_fns):
* fns.c (syms_of_fns):
* fileio.c (syms_of_fileio):
* fileio.c (syms_of_fileio):
* eval.c (syms_of_eval):
* doc.c (syms_of_doc):
* dispnew.c (syms_of_display):
* dired.c (syms_of_dired):
* dbusbind.c (syms_of_dbusbind):
* data.c (syms_of_data):
* composite.c (syms_of_composite):
* coding.c (syms_of_coding):
* cmds.c (syms_of_cmds):
* charset.c (define_charset_internal, syms_of_character):
* ccl.c (syms_of_ccl):
* category.c (syms_of_category, init_category_once):
* casetab.c (syms_of_casetab):
* casefiddle.c (syms_of_casefiddle):
* callint.c (syms_of_callint):
* bytecode.c (syms_of_bytecode):
* buffer.c (keys_of_buffer, syms_of_buffer):
* alloc.c (syms_of_alloc):
* process.c (syms_of_process, init_process):
* lread.c (syms_of_lread, init_obarray):
* font.c (build_style_table):
* emacs.c (syms_of_emacs, main): Replace calls to intern with
intern_c_string, calls to make_pure_string with
make_pure_c_string. Use pure_cons instead of Fcons.
* process.c (socket_options): Make it const.
(set_socket_option, init_process): Use a const pointer.
* lread.c (intern_c_string): New function.
(defvar_kboard, defvar_lisp, defvar_lisp_nopro, defvar_bool)
(defvar_int): Uset it. Make the name const char*.
* font.c (struct table_entry): Remove unused member. Make NAMES
constant.
(weight_table, slant_table, width_table): Make constant.
* emacs.c (struct standard_args): Make name and longname constant.
2009-11-06 06:50:52 +00:00
|
|
|
|
Qcminflt = intern_c_string ("cminflt");
|
(Qeuid, Qegid, Qcomm, Qstate, Qppid, Qpgrp, Qsess)
(Qttname, Qminflt, Qmajflt, Qcminflt, Qcmajflt, Qutime, Qstime)
(Qcutime, Qpri, Qnice, Qthcount, Qstart, Qvsize, Qrss, Qargs)
(Quser, Qgroup, Qetime, Qpcpu, Qpmem, Qtpgid, Qcstime) [!subprocesses]: Define.
(syms_of_process) [!subprocesses]: Intern and staticpro them.
(Flist_system_processes, Fsystem_process_attributes) [!subprocesses]: Call
list_system_processes and system_process_attributes instead of returning Qnil.
2009-01-03 15:03:59 +00:00
|
|
|
|
staticpro (&Qcminflt);
|
* xterm.c (syms_of_xterm):
* xselect.c (syms_of_xselect):
* xmenu.c (syms_of_xmenu):
* xfns.c (syms_of_xfns):
* xfaces.c (syms_of_xfaces):
* xdisp.c (syms_of_xdisp):
* window.c (syms_of_window):
* w32fns.c (syms_of_w32fns):
* undo.c (syms_of_undo):
* textprop.c (syms_of_textprop):
* terminal.c (syms_of_terminal):
* syntax.c (syms_of_syntax):
* sound.c (syms_of_sound):
* search.c (syms_of_search):
* print.c (syms_of_print):
* minibuf.c (syms_of_minibuf):
* macros.c (syms_of_macros):
* keymap.c (syms_of_keymap, initial_define_key)
(initial_define_lispy_key):
* keyboard.c (syms_of_keyboard):
* insdel.c (syms_of_insdel):
* image.c (syms_of_image):
* fringe.c (syms_of_fringe):
* frame.c (syms_of_frame):
* fontset.c (syms_of_fontset):
* fns.c (syms_of_fns):
* fns.c (syms_of_fns):
* fileio.c (syms_of_fileio):
* fileio.c (syms_of_fileio):
* eval.c (syms_of_eval):
* doc.c (syms_of_doc):
* dispnew.c (syms_of_display):
* dired.c (syms_of_dired):
* dbusbind.c (syms_of_dbusbind):
* data.c (syms_of_data):
* composite.c (syms_of_composite):
* coding.c (syms_of_coding):
* cmds.c (syms_of_cmds):
* charset.c (define_charset_internal, syms_of_character):
* ccl.c (syms_of_ccl):
* category.c (syms_of_category, init_category_once):
* casetab.c (syms_of_casetab):
* casefiddle.c (syms_of_casefiddle):
* callint.c (syms_of_callint):
* bytecode.c (syms_of_bytecode):
* buffer.c (keys_of_buffer, syms_of_buffer):
* alloc.c (syms_of_alloc):
* process.c (syms_of_process, init_process):
* lread.c (syms_of_lread, init_obarray):
* font.c (build_style_table):
* emacs.c (syms_of_emacs, main): Replace calls to intern with
intern_c_string, calls to make_pure_string with
make_pure_c_string. Use pure_cons instead of Fcons.
* process.c (socket_options): Make it const.
(set_socket_option, init_process): Use a const pointer.
* lread.c (intern_c_string): New function.
(defvar_kboard, defvar_lisp, defvar_lisp_nopro, defvar_bool)
(defvar_int): Uset it. Make the name const char*.
* font.c (struct table_entry): Remove unused member. Make NAMES
constant.
(weight_table, slant_table, width_table): Make constant.
* emacs.c (struct standard_args): Make name and longname constant.
2009-11-06 06:50:52 +00:00
|
|
|
|
Qcmajflt = intern_c_string ("cmajflt");
|
(Qeuid, Qegid, Qcomm, Qstate, Qppid, Qpgrp, Qsess)
(Qttname, Qminflt, Qmajflt, Qcminflt, Qcmajflt, Qutime, Qstime)
(Qcutime, Qpri, Qnice, Qthcount, Qstart, Qvsize, Qrss, Qargs)
(Quser, Qgroup, Qetime, Qpcpu, Qpmem, Qtpgid, Qcstime) [!subprocesses]: Define.
(syms_of_process) [!subprocesses]: Intern and staticpro them.
(Flist_system_processes, Fsystem_process_attributes) [!subprocesses]: Call
list_system_processes and system_process_attributes instead of returning Qnil.
2009-01-03 15:03:59 +00:00
|
|
|
|
staticpro (&Qcmajflt);
|
* xterm.c (syms_of_xterm):
* xselect.c (syms_of_xselect):
* xmenu.c (syms_of_xmenu):
* xfns.c (syms_of_xfns):
* xfaces.c (syms_of_xfaces):
* xdisp.c (syms_of_xdisp):
* window.c (syms_of_window):
* w32fns.c (syms_of_w32fns):
* undo.c (syms_of_undo):
* textprop.c (syms_of_textprop):
* terminal.c (syms_of_terminal):
* syntax.c (syms_of_syntax):
* sound.c (syms_of_sound):
* search.c (syms_of_search):
* print.c (syms_of_print):
* minibuf.c (syms_of_minibuf):
* macros.c (syms_of_macros):
* keymap.c (syms_of_keymap, initial_define_key)
(initial_define_lispy_key):
* keyboard.c (syms_of_keyboard):
* insdel.c (syms_of_insdel):
* image.c (syms_of_image):
* fringe.c (syms_of_fringe):
* frame.c (syms_of_frame):
* fontset.c (syms_of_fontset):
* fns.c (syms_of_fns):
* fns.c (syms_of_fns):
* fileio.c (syms_of_fileio):
* fileio.c (syms_of_fileio):
* eval.c (syms_of_eval):
* doc.c (syms_of_doc):
* dispnew.c (syms_of_display):
* dired.c (syms_of_dired):
* dbusbind.c (syms_of_dbusbind):
* data.c (syms_of_data):
* composite.c (syms_of_composite):
* coding.c (syms_of_coding):
* cmds.c (syms_of_cmds):
* charset.c (define_charset_internal, syms_of_character):
* ccl.c (syms_of_ccl):
* category.c (syms_of_category, init_category_once):
* casetab.c (syms_of_casetab):
* casefiddle.c (syms_of_casefiddle):
* callint.c (syms_of_callint):
* bytecode.c (syms_of_bytecode):
* buffer.c (keys_of_buffer, syms_of_buffer):
* alloc.c (syms_of_alloc):
* process.c (syms_of_process, init_process):
* lread.c (syms_of_lread, init_obarray):
* font.c (build_style_table):
* emacs.c (syms_of_emacs, main): Replace calls to intern with
intern_c_string, calls to make_pure_string with
make_pure_c_string. Use pure_cons instead of Fcons.
* process.c (socket_options): Make it const.
(set_socket_option, init_process): Use a const pointer.
* lread.c (intern_c_string): New function.
(defvar_kboard, defvar_lisp, defvar_lisp_nopro, defvar_bool)
(defvar_int): Uset it. Make the name const char*.
* font.c (struct table_entry): Remove unused member. Make NAMES
constant.
(weight_table, slant_table, width_table): Make constant.
* emacs.c (struct standard_args): Make name and longname constant.
2009-11-06 06:50:52 +00:00
|
|
|
|
Qutime = intern_c_string ("utime");
|
(Qeuid, Qegid, Qcomm, Qstate, Qppid, Qpgrp, Qsess)
(Qttname, Qminflt, Qmajflt, Qcminflt, Qcmajflt, Qutime, Qstime)
(Qcutime, Qpri, Qnice, Qthcount, Qstart, Qvsize, Qrss, Qargs)
(Quser, Qgroup, Qetime, Qpcpu, Qpmem, Qtpgid, Qcstime) [!subprocesses]: Define.
(syms_of_process) [!subprocesses]: Intern and staticpro them.
(Flist_system_processes, Fsystem_process_attributes) [!subprocesses]: Call
list_system_processes and system_process_attributes instead of returning Qnil.
2009-01-03 15:03:59 +00:00
|
|
|
|
staticpro (&Qutime);
|
* xterm.c (syms_of_xterm):
* xselect.c (syms_of_xselect):
* xmenu.c (syms_of_xmenu):
* xfns.c (syms_of_xfns):
* xfaces.c (syms_of_xfaces):
* xdisp.c (syms_of_xdisp):
* window.c (syms_of_window):
* w32fns.c (syms_of_w32fns):
* undo.c (syms_of_undo):
* textprop.c (syms_of_textprop):
* terminal.c (syms_of_terminal):
* syntax.c (syms_of_syntax):
* sound.c (syms_of_sound):
* search.c (syms_of_search):
* print.c (syms_of_print):
* minibuf.c (syms_of_minibuf):
* macros.c (syms_of_macros):
* keymap.c (syms_of_keymap, initial_define_key)
(initial_define_lispy_key):
* keyboard.c (syms_of_keyboard):
* insdel.c (syms_of_insdel):
* image.c (syms_of_image):
* fringe.c (syms_of_fringe):
* frame.c (syms_of_frame):
* fontset.c (syms_of_fontset):
* fns.c (syms_of_fns):
* fns.c (syms_of_fns):
* fileio.c (syms_of_fileio):
* fileio.c (syms_of_fileio):
* eval.c (syms_of_eval):
* doc.c (syms_of_doc):
* dispnew.c (syms_of_display):
* dired.c (syms_of_dired):
* dbusbind.c (syms_of_dbusbind):
* data.c (syms_of_data):
* composite.c (syms_of_composite):
* coding.c (syms_of_coding):
* cmds.c (syms_of_cmds):
* charset.c (define_charset_internal, syms_of_character):
* ccl.c (syms_of_ccl):
* category.c (syms_of_category, init_category_once):
* casetab.c (syms_of_casetab):
* casefiddle.c (syms_of_casefiddle):
* callint.c (syms_of_callint):
* bytecode.c (syms_of_bytecode):
* buffer.c (keys_of_buffer, syms_of_buffer):
* alloc.c (syms_of_alloc):
* process.c (syms_of_process, init_process):
* lread.c (syms_of_lread, init_obarray):
* font.c (build_style_table):
* emacs.c (syms_of_emacs, main): Replace calls to intern with
intern_c_string, calls to make_pure_string with
make_pure_c_string. Use pure_cons instead of Fcons.
* process.c (socket_options): Make it const.
(set_socket_option, init_process): Use a const pointer.
* lread.c (intern_c_string): New function.
(defvar_kboard, defvar_lisp, defvar_lisp_nopro, defvar_bool)
(defvar_int): Uset it. Make the name const char*.
* font.c (struct table_entry): Remove unused member. Make NAMES
constant.
(weight_table, slant_table, width_table): Make constant.
* emacs.c (struct standard_args): Make name and longname constant.
2009-11-06 06:50:52 +00:00
|
|
|
|
Qstime = intern_c_string ("stime");
|
(Qeuid, Qegid, Qcomm, Qstate, Qppid, Qpgrp, Qsess)
(Qttname, Qminflt, Qmajflt, Qcminflt, Qcmajflt, Qutime, Qstime)
(Qcutime, Qpri, Qnice, Qthcount, Qstart, Qvsize, Qrss, Qargs)
(Quser, Qgroup, Qetime, Qpcpu, Qpmem, Qtpgid, Qcstime) [!subprocesses]: Define.
(syms_of_process) [!subprocesses]: Intern and staticpro them.
(Flist_system_processes, Fsystem_process_attributes) [!subprocesses]: Call
list_system_processes and system_process_attributes instead of returning Qnil.
2009-01-03 15:03:59 +00:00
|
|
|
|
staticpro (&Qstime);
|
* xterm.c (syms_of_xterm):
* xselect.c (syms_of_xselect):
* xmenu.c (syms_of_xmenu):
* xfns.c (syms_of_xfns):
* xfaces.c (syms_of_xfaces):
* xdisp.c (syms_of_xdisp):
* window.c (syms_of_window):
* w32fns.c (syms_of_w32fns):
* undo.c (syms_of_undo):
* textprop.c (syms_of_textprop):
* terminal.c (syms_of_terminal):
* syntax.c (syms_of_syntax):
* sound.c (syms_of_sound):
* search.c (syms_of_search):
* print.c (syms_of_print):
* minibuf.c (syms_of_minibuf):
* macros.c (syms_of_macros):
* keymap.c (syms_of_keymap, initial_define_key)
(initial_define_lispy_key):
* keyboard.c (syms_of_keyboard):
* insdel.c (syms_of_insdel):
* image.c (syms_of_image):
* fringe.c (syms_of_fringe):
* frame.c (syms_of_frame):
* fontset.c (syms_of_fontset):
* fns.c (syms_of_fns):
* fns.c (syms_of_fns):
* fileio.c (syms_of_fileio):
* fileio.c (syms_of_fileio):
* eval.c (syms_of_eval):
* doc.c (syms_of_doc):
* dispnew.c (syms_of_display):
* dired.c (syms_of_dired):
* dbusbind.c (syms_of_dbusbind):
* data.c (syms_of_data):
* composite.c (syms_of_composite):
* coding.c (syms_of_coding):
* cmds.c (syms_of_cmds):
* charset.c (define_charset_internal, syms_of_character):
* ccl.c (syms_of_ccl):
* category.c (syms_of_category, init_category_once):
* casetab.c (syms_of_casetab):
* casefiddle.c (syms_of_casefiddle):
* callint.c (syms_of_callint):
* bytecode.c (syms_of_bytecode):
* buffer.c (keys_of_buffer, syms_of_buffer):
* alloc.c (syms_of_alloc):
* process.c (syms_of_process, init_process):
* lread.c (syms_of_lread, init_obarray):
* font.c (build_style_table):
* emacs.c (syms_of_emacs, main): Replace calls to intern with
intern_c_string, calls to make_pure_string with
make_pure_c_string. Use pure_cons instead of Fcons.
* process.c (socket_options): Make it const.
(set_socket_option, init_process): Use a const pointer.
* lread.c (intern_c_string): New function.
(defvar_kboard, defvar_lisp, defvar_lisp_nopro, defvar_bool)
(defvar_int): Uset it. Make the name const char*.
* font.c (struct table_entry): Remove unused member. Make NAMES
constant.
(weight_table, slant_table, width_table): Make constant.
* emacs.c (struct standard_args): Make name and longname constant.
2009-11-06 06:50:52 +00:00
|
|
|
|
Qtime = intern_c_string ("time");
|
(Qeuid, Qegid, Qcomm, Qstate, Qppid, Qpgrp, Qsess)
(Qttname, Qminflt, Qmajflt, Qcminflt, Qcmajflt, Qutime, Qstime)
(Qcutime, Qpri, Qnice, Qthcount, Qstart, Qvsize, Qrss, Qargs)
(Quser, Qgroup, Qetime, Qpcpu, Qpmem, Qtpgid, Qcstime) [!subprocesses]: Define.
(syms_of_process) [!subprocesses]: Intern and staticpro them.
(Flist_system_processes, Fsystem_process_attributes) [!subprocesses]: Call
list_system_processes and system_process_attributes instead of returning Qnil.
2009-01-03 15:03:59 +00:00
|
|
|
|
staticpro (&Qtime);
|
* xterm.c (syms_of_xterm):
* xselect.c (syms_of_xselect):
* xmenu.c (syms_of_xmenu):
* xfns.c (syms_of_xfns):
* xfaces.c (syms_of_xfaces):
* xdisp.c (syms_of_xdisp):
* window.c (syms_of_window):
* w32fns.c (syms_of_w32fns):
* undo.c (syms_of_undo):
* textprop.c (syms_of_textprop):
* terminal.c (syms_of_terminal):
* syntax.c (syms_of_syntax):
* sound.c (syms_of_sound):
* search.c (syms_of_search):
* print.c (syms_of_print):
* minibuf.c (syms_of_minibuf):
* macros.c (syms_of_macros):
* keymap.c (syms_of_keymap, initial_define_key)
(initial_define_lispy_key):
* keyboard.c (syms_of_keyboard):
* insdel.c (syms_of_insdel):
* image.c (syms_of_image):
* fringe.c (syms_of_fringe):
* frame.c (syms_of_frame):
* fontset.c (syms_of_fontset):
* fns.c (syms_of_fns):
* fns.c (syms_of_fns):
* fileio.c (syms_of_fileio):
* fileio.c (syms_of_fileio):
* eval.c (syms_of_eval):
* doc.c (syms_of_doc):
* dispnew.c (syms_of_display):
* dired.c (syms_of_dired):
* dbusbind.c (syms_of_dbusbind):
* data.c (syms_of_data):
* composite.c (syms_of_composite):
* coding.c (syms_of_coding):
* cmds.c (syms_of_cmds):
* charset.c (define_charset_internal, syms_of_character):
* ccl.c (syms_of_ccl):
* category.c (syms_of_category, init_category_once):
* casetab.c (syms_of_casetab):
* casefiddle.c (syms_of_casefiddle):
* callint.c (syms_of_callint):
* bytecode.c (syms_of_bytecode):
* buffer.c (keys_of_buffer, syms_of_buffer):
* alloc.c (syms_of_alloc):
* process.c (syms_of_process, init_process):
* lread.c (syms_of_lread, init_obarray):
* font.c (build_style_table):
* emacs.c (syms_of_emacs, main): Replace calls to intern with
intern_c_string, calls to make_pure_string with
make_pure_c_string. Use pure_cons instead of Fcons.
* process.c (socket_options): Make it const.
(set_socket_option, init_process): Use a const pointer.
* lread.c (intern_c_string): New function.
(defvar_kboard, defvar_lisp, defvar_lisp_nopro, defvar_bool)
(defvar_int): Uset it. Make the name const char*.
* font.c (struct table_entry): Remove unused member. Make NAMES
constant.
(weight_table, slant_table, width_table): Make constant.
* emacs.c (struct standard_args): Make name and longname constant.
2009-11-06 06:50:52 +00:00
|
|
|
|
Qcutime = intern_c_string ("cutime");
|
(Qeuid, Qegid, Qcomm, Qstate, Qppid, Qpgrp, Qsess)
(Qttname, Qminflt, Qmajflt, Qcminflt, Qcmajflt, Qutime, Qstime)
(Qcutime, Qpri, Qnice, Qthcount, Qstart, Qvsize, Qrss, Qargs)
(Quser, Qgroup, Qetime, Qpcpu, Qpmem, Qtpgid, Qcstime) [!subprocesses]: Define.
(syms_of_process) [!subprocesses]: Intern and staticpro them.
(Flist_system_processes, Fsystem_process_attributes) [!subprocesses]: Call
list_system_processes and system_process_attributes instead of returning Qnil.
2009-01-03 15:03:59 +00:00
|
|
|
|
staticpro (&Qcutime);
|
* xterm.c (syms_of_xterm):
* xselect.c (syms_of_xselect):
* xmenu.c (syms_of_xmenu):
* xfns.c (syms_of_xfns):
* xfaces.c (syms_of_xfaces):
* xdisp.c (syms_of_xdisp):
* window.c (syms_of_window):
* w32fns.c (syms_of_w32fns):
* undo.c (syms_of_undo):
* textprop.c (syms_of_textprop):
* terminal.c (syms_of_terminal):
* syntax.c (syms_of_syntax):
* sound.c (syms_of_sound):
* search.c (syms_of_search):
* print.c (syms_of_print):
* minibuf.c (syms_of_minibuf):
* macros.c (syms_of_macros):
* keymap.c (syms_of_keymap, initial_define_key)
(initial_define_lispy_key):
* keyboard.c (syms_of_keyboard):
* insdel.c (syms_of_insdel):
* image.c (syms_of_image):
* fringe.c (syms_of_fringe):
* frame.c (syms_of_frame):
* fontset.c (syms_of_fontset):
* fns.c (syms_of_fns):
* fns.c (syms_of_fns):
* fileio.c (syms_of_fileio):
* fileio.c (syms_of_fileio):
* eval.c (syms_of_eval):
* doc.c (syms_of_doc):
* dispnew.c (syms_of_display):
* dired.c (syms_of_dired):
* dbusbind.c (syms_of_dbusbind):
* data.c (syms_of_data):
* composite.c (syms_of_composite):
* coding.c (syms_of_coding):
* cmds.c (syms_of_cmds):
* charset.c (define_charset_internal, syms_of_character):
* ccl.c (syms_of_ccl):
* category.c (syms_of_category, init_category_once):
* casetab.c (syms_of_casetab):
* casefiddle.c (syms_of_casefiddle):
* callint.c (syms_of_callint):
* bytecode.c (syms_of_bytecode):
* buffer.c (keys_of_buffer, syms_of_buffer):
* alloc.c (syms_of_alloc):
* process.c (syms_of_process, init_process):
* lread.c (syms_of_lread, init_obarray):
* font.c (build_style_table):
* emacs.c (syms_of_emacs, main): Replace calls to intern with
intern_c_string, calls to make_pure_string with
make_pure_c_string. Use pure_cons instead of Fcons.
* process.c (socket_options): Make it const.
(set_socket_option, init_process): Use a const pointer.
* lread.c (intern_c_string): New function.
(defvar_kboard, defvar_lisp, defvar_lisp_nopro, defvar_bool)
(defvar_int): Uset it. Make the name const char*.
* font.c (struct table_entry): Remove unused member. Make NAMES
constant.
(weight_table, slant_table, width_table): Make constant.
* emacs.c (struct standard_args): Make name and longname constant.
2009-11-06 06:50:52 +00:00
|
|
|
|
Qcstime = intern_c_string ("cstime");
|
(Qeuid, Qegid, Qcomm, Qstate, Qppid, Qpgrp, Qsess)
(Qttname, Qminflt, Qmajflt, Qcminflt, Qcmajflt, Qutime, Qstime)
(Qcutime, Qpri, Qnice, Qthcount, Qstart, Qvsize, Qrss, Qargs)
(Quser, Qgroup, Qetime, Qpcpu, Qpmem, Qtpgid, Qcstime) [!subprocesses]: Define.
(syms_of_process) [!subprocesses]: Intern and staticpro them.
(Flist_system_processes, Fsystem_process_attributes) [!subprocesses]: Call
list_system_processes and system_process_attributes instead of returning Qnil.
2009-01-03 15:03:59 +00:00
|
|
|
|
staticpro (&Qcstime);
|
* xterm.c (syms_of_xterm):
* xselect.c (syms_of_xselect):
* xmenu.c (syms_of_xmenu):
* xfns.c (syms_of_xfns):
* xfaces.c (syms_of_xfaces):
* xdisp.c (syms_of_xdisp):
* window.c (syms_of_window):
* w32fns.c (syms_of_w32fns):
* undo.c (syms_of_undo):
* textprop.c (syms_of_textprop):
* terminal.c (syms_of_terminal):
* syntax.c (syms_of_syntax):
* sound.c (syms_of_sound):
* search.c (syms_of_search):
* print.c (syms_of_print):
* minibuf.c (syms_of_minibuf):
* macros.c (syms_of_macros):
* keymap.c (syms_of_keymap, initial_define_key)
(initial_define_lispy_key):
* keyboard.c (syms_of_keyboard):
* insdel.c (syms_of_insdel):
* image.c (syms_of_image):
* fringe.c (syms_of_fringe):
* frame.c (syms_of_frame):
* fontset.c (syms_of_fontset):
* fns.c (syms_of_fns):
* fns.c (syms_of_fns):
* fileio.c (syms_of_fileio):
* fileio.c (syms_of_fileio):
* eval.c (syms_of_eval):
* doc.c (syms_of_doc):
* dispnew.c (syms_of_display):
* dired.c (syms_of_dired):
* dbusbind.c (syms_of_dbusbind):
* data.c (syms_of_data):
* composite.c (syms_of_composite):
* coding.c (syms_of_coding):
* cmds.c (syms_of_cmds):
* charset.c (define_charset_internal, syms_of_character):
* ccl.c (syms_of_ccl):
* category.c (syms_of_category, init_category_once):
* casetab.c (syms_of_casetab):
* casefiddle.c (syms_of_casefiddle):
* callint.c (syms_of_callint):
* bytecode.c (syms_of_bytecode):
* buffer.c (keys_of_buffer, syms_of_buffer):
* alloc.c (syms_of_alloc):
* process.c (syms_of_process, init_process):
* lread.c (syms_of_lread, init_obarray):
* font.c (build_style_table):
* emacs.c (syms_of_emacs, main): Replace calls to intern with
intern_c_string, calls to make_pure_string with
make_pure_c_string. Use pure_cons instead of Fcons.
* process.c (socket_options): Make it const.
(set_socket_option, init_process): Use a const pointer.
* lread.c (intern_c_string): New function.
(defvar_kboard, defvar_lisp, defvar_lisp_nopro, defvar_bool)
(defvar_int): Uset it. Make the name const char*.
* font.c (struct table_entry): Remove unused member. Make NAMES
constant.
(weight_table, slant_table, width_table): Make constant.
* emacs.c (struct standard_args): Make name and longname constant.
2009-11-06 06:50:52 +00:00
|
|
|
|
Qctime = intern_c_string ("ctime");
|
(Qeuid, Qegid, Qcomm, Qstate, Qppid, Qpgrp, Qsess)
(Qttname, Qminflt, Qmajflt, Qcminflt, Qcmajflt, Qutime, Qstime)
(Qcutime, Qpri, Qnice, Qthcount, Qstart, Qvsize, Qrss, Qargs)
(Quser, Qgroup, Qetime, Qpcpu, Qpmem, Qtpgid, Qcstime) [!subprocesses]: Define.
(syms_of_process) [!subprocesses]: Intern and staticpro them.
(Flist_system_processes, Fsystem_process_attributes) [!subprocesses]: Call
list_system_processes and system_process_attributes instead of returning Qnil.
2009-01-03 15:03:59 +00:00
|
|
|
|
staticpro (&Qctime);
|
* xterm.c (syms_of_xterm):
* xselect.c (syms_of_xselect):
* xmenu.c (syms_of_xmenu):
* xfns.c (syms_of_xfns):
* xfaces.c (syms_of_xfaces):
* xdisp.c (syms_of_xdisp):
* window.c (syms_of_window):
* w32fns.c (syms_of_w32fns):
* undo.c (syms_of_undo):
* textprop.c (syms_of_textprop):
* terminal.c (syms_of_terminal):
* syntax.c (syms_of_syntax):
* sound.c (syms_of_sound):
* search.c (syms_of_search):
* print.c (syms_of_print):
* minibuf.c (syms_of_minibuf):
* macros.c (syms_of_macros):
* keymap.c (syms_of_keymap, initial_define_key)
(initial_define_lispy_key):
* keyboard.c (syms_of_keyboard):
* insdel.c (syms_of_insdel):
* image.c (syms_of_image):
* fringe.c (syms_of_fringe):
* frame.c (syms_of_frame):
* fontset.c (syms_of_fontset):
* fns.c (syms_of_fns):
* fns.c (syms_of_fns):
* fileio.c (syms_of_fileio):
* fileio.c (syms_of_fileio):
* eval.c (syms_of_eval):
* doc.c (syms_of_doc):
* dispnew.c (syms_of_display):
* dired.c (syms_of_dired):
* dbusbind.c (syms_of_dbusbind):
* data.c (syms_of_data):
* composite.c (syms_of_composite):
* coding.c (syms_of_coding):
* cmds.c (syms_of_cmds):
* charset.c (define_charset_internal, syms_of_character):
* ccl.c (syms_of_ccl):
* category.c (syms_of_category, init_category_once):
* casetab.c (syms_of_casetab):
* casefiddle.c (syms_of_casefiddle):
* callint.c (syms_of_callint):
* bytecode.c (syms_of_bytecode):
* buffer.c (keys_of_buffer, syms_of_buffer):
* alloc.c (syms_of_alloc):
* process.c (syms_of_process, init_process):
* lread.c (syms_of_lread, init_obarray):
* font.c (build_style_table):
* emacs.c (syms_of_emacs, main): Replace calls to intern with
intern_c_string, calls to make_pure_string with
make_pure_c_string. Use pure_cons instead of Fcons.
* process.c (socket_options): Make it const.
(set_socket_option, init_process): Use a const pointer.
* lread.c (intern_c_string): New function.
(defvar_kboard, defvar_lisp, defvar_lisp_nopro, defvar_bool)
(defvar_int): Uset it. Make the name const char*.
* font.c (struct table_entry): Remove unused member. Make NAMES
constant.
(weight_table, slant_table, width_table): Make constant.
* emacs.c (struct standard_args): Make name and longname constant.
2009-11-06 06:50:52 +00:00
|
|
|
|
Qpri = intern_c_string ("pri");
|
(Qeuid, Qegid, Qcomm, Qstate, Qppid, Qpgrp, Qsess)
(Qttname, Qminflt, Qmajflt, Qcminflt, Qcmajflt, Qutime, Qstime)
(Qcutime, Qpri, Qnice, Qthcount, Qstart, Qvsize, Qrss, Qargs)
(Quser, Qgroup, Qetime, Qpcpu, Qpmem, Qtpgid, Qcstime) [!subprocesses]: Define.
(syms_of_process) [!subprocesses]: Intern and staticpro them.
(Flist_system_processes, Fsystem_process_attributes) [!subprocesses]: Call
list_system_processes and system_process_attributes instead of returning Qnil.
2009-01-03 15:03:59 +00:00
|
|
|
|
staticpro (&Qpri);
|
* xterm.c (syms_of_xterm):
* xselect.c (syms_of_xselect):
* xmenu.c (syms_of_xmenu):
* xfns.c (syms_of_xfns):
* xfaces.c (syms_of_xfaces):
* xdisp.c (syms_of_xdisp):
* window.c (syms_of_window):
* w32fns.c (syms_of_w32fns):
* undo.c (syms_of_undo):
* textprop.c (syms_of_textprop):
* terminal.c (syms_of_terminal):
* syntax.c (syms_of_syntax):
* sound.c (syms_of_sound):
* search.c (syms_of_search):
* print.c (syms_of_print):
* minibuf.c (syms_of_minibuf):
* macros.c (syms_of_macros):
* keymap.c (syms_of_keymap, initial_define_key)
(initial_define_lispy_key):
* keyboard.c (syms_of_keyboard):
* insdel.c (syms_of_insdel):
* image.c (syms_of_image):
* fringe.c (syms_of_fringe):
* frame.c (syms_of_frame):
* fontset.c (syms_of_fontset):
* fns.c (syms_of_fns):
* fns.c (syms_of_fns):
* fileio.c (syms_of_fileio):
* fileio.c (syms_of_fileio):
* eval.c (syms_of_eval):
* doc.c (syms_of_doc):
* dispnew.c (syms_of_display):
* dired.c (syms_of_dired):
* dbusbind.c (syms_of_dbusbind):
* data.c (syms_of_data):
* composite.c (syms_of_composite):
* coding.c (syms_of_coding):
* cmds.c (syms_of_cmds):
* charset.c (define_charset_internal, syms_of_character):
* ccl.c (syms_of_ccl):
* category.c (syms_of_category, init_category_once):
* casetab.c (syms_of_casetab):
* casefiddle.c (syms_of_casefiddle):
* callint.c (syms_of_callint):
* bytecode.c (syms_of_bytecode):
* buffer.c (keys_of_buffer, syms_of_buffer):
* alloc.c (syms_of_alloc):
* process.c (syms_of_process, init_process):
* lread.c (syms_of_lread, init_obarray):
* font.c (build_style_table):
* emacs.c (syms_of_emacs, main): Replace calls to intern with
intern_c_string, calls to make_pure_string with
make_pure_c_string. Use pure_cons instead of Fcons.
* process.c (socket_options): Make it const.
(set_socket_option, init_process): Use a const pointer.
* lread.c (intern_c_string): New function.
(defvar_kboard, defvar_lisp, defvar_lisp_nopro, defvar_bool)
(defvar_int): Uset it. Make the name const char*.
* font.c (struct table_entry): Remove unused member. Make NAMES
constant.
(weight_table, slant_table, width_table): Make constant.
* emacs.c (struct standard_args): Make name and longname constant.
2009-11-06 06:50:52 +00:00
|
|
|
|
Qnice = intern_c_string ("nice");
|
(Qeuid, Qegid, Qcomm, Qstate, Qppid, Qpgrp, Qsess)
(Qttname, Qminflt, Qmajflt, Qcminflt, Qcmajflt, Qutime, Qstime)
(Qcutime, Qpri, Qnice, Qthcount, Qstart, Qvsize, Qrss, Qargs)
(Quser, Qgroup, Qetime, Qpcpu, Qpmem, Qtpgid, Qcstime) [!subprocesses]: Define.
(syms_of_process) [!subprocesses]: Intern and staticpro them.
(Flist_system_processes, Fsystem_process_attributes) [!subprocesses]: Call
list_system_processes and system_process_attributes instead of returning Qnil.
2009-01-03 15:03:59 +00:00
|
|
|
|
staticpro (&Qnice);
|
* xterm.c (syms_of_xterm):
* xselect.c (syms_of_xselect):
* xmenu.c (syms_of_xmenu):
* xfns.c (syms_of_xfns):
* xfaces.c (syms_of_xfaces):
* xdisp.c (syms_of_xdisp):
* window.c (syms_of_window):
* w32fns.c (syms_of_w32fns):
* undo.c (syms_of_undo):
* textprop.c (syms_of_textprop):
* terminal.c (syms_of_terminal):
* syntax.c (syms_of_syntax):
* sound.c (syms_of_sound):
* search.c (syms_of_search):
* print.c (syms_of_print):
* minibuf.c (syms_of_minibuf):
* macros.c (syms_of_macros):
* keymap.c (syms_of_keymap, initial_define_key)
(initial_define_lispy_key):
* keyboard.c (syms_of_keyboard):
* insdel.c (syms_of_insdel):
* image.c (syms_of_image):
* fringe.c (syms_of_fringe):
* frame.c (syms_of_frame):
* fontset.c (syms_of_fontset):
* fns.c (syms_of_fns):
* fns.c (syms_of_fns):
* fileio.c (syms_of_fileio):
* fileio.c (syms_of_fileio):
* eval.c (syms_of_eval):
* doc.c (syms_of_doc):
* dispnew.c (syms_of_display):
* dired.c (syms_of_dired):
* dbusbind.c (syms_of_dbusbind):
* data.c (syms_of_data):
* composite.c (syms_of_composite):
* coding.c (syms_of_coding):
* cmds.c (syms_of_cmds):
* charset.c (define_charset_internal, syms_of_character):
* ccl.c (syms_of_ccl):
* category.c (syms_of_category, init_category_once):
* casetab.c (syms_of_casetab):
* casefiddle.c (syms_of_casefiddle):
* callint.c (syms_of_callint):
* bytecode.c (syms_of_bytecode):
* buffer.c (keys_of_buffer, syms_of_buffer):
* alloc.c (syms_of_alloc):
* process.c (syms_of_process, init_process):
* lread.c (syms_of_lread, init_obarray):
* font.c (build_style_table):
* emacs.c (syms_of_emacs, main): Replace calls to intern with
intern_c_string, calls to make_pure_string with
make_pure_c_string. Use pure_cons instead of Fcons.
* process.c (socket_options): Make it const.
(set_socket_option, init_process): Use a const pointer.
* lread.c (intern_c_string): New function.
(defvar_kboard, defvar_lisp, defvar_lisp_nopro, defvar_bool)
(defvar_int): Uset it. Make the name const char*.
* font.c (struct table_entry): Remove unused member. Make NAMES
constant.
(weight_table, slant_table, width_table): Make constant.
* emacs.c (struct standard_args): Make name and longname constant.
2009-11-06 06:50:52 +00:00
|
|
|
|
Qthcount = intern_c_string ("thcount");
|
(Qeuid, Qegid, Qcomm, Qstate, Qppid, Qpgrp, Qsess)
(Qttname, Qminflt, Qmajflt, Qcminflt, Qcmajflt, Qutime, Qstime)
(Qcutime, Qpri, Qnice, Qthcount, Qstart, Qvsize, Qrss, Qargs)
(Quser, Qgroup, Qetime, Qpcpu, Qpmem, Qtpgid, Qcstime) [!subprocesses]: Define.
(syms_of_process) [!subprocesses]: Intern and staticpro them.
(Flist_system_processes, Fsystem_process_attributes) [!subprocesses]: Call
list_system_processes and system_process_attributes instead of returning Qnil.
2009-01-03 15:03:59 +00:00
|
|
|
|
staticpro (&Qthcount);
|
* xterm.c (syms_of_xterm):
* xselect.c (syms_of_xselect):
* xmenu.c (syms_of_xmenu):
* xfns.c (syms_of_xfns):
* xfaces.c (syms_of_xfaces):
* xdisp.c (syms_of_xdisp):
* window.c (syms_of_window):
* w32fns.c (syms_of_w32fns):
* undo.c (syms_of_undo):
* textprop.c (syms_of_textprop):
* terminal.c (syms_of_terminal):
* syntax.c (syms_of_syntax):
* sound.c (syms_of_sound):
* search.c (syms_of_search):
* print.c (syms_of_print):
* minibuf.c (syms_of_minibuf):
* macros.c (syms_of_macros):
* keymap.c (syms_of_keymap, initial_define_key)
(initial_define_lispy_key):
* keyboard.c (syms_of_keyboard):
* insdel.c (syms_of_insdel):
* image.c (syms_of_image):
* fringe.c (syms_of_fringe):
* frame.c (syms_of_frame):
* fontset.c (syms_of_fontset):
* fns.c (syms_of_fns):
* fns.c (syms_of_fns):
* fileio.c (syms_of_fileio):
* fileio.c (syms_of_fileio):
* eval.c (syms_of_eval):
* doc.c (syms_of_doc):
* dispnew.c (syms_of_display):
* dired.c (syms_of_dired):
* dbusbind.c (syms_of_dbusbind):
* data.c (syms_of_data):
* composite.c (syms_of_composite):
* coding.c (syms_of_coding):
* cmds.c (syms_of_cmds):
* charset.c (define_charset_internal, syms_of_character):
* ccl.c (syms_of_ccl):
* category.c (syms_of_category, init_category_once):
* casetab.c (syms_of_casetab):
* casefiddle.c (syms_of_casefiddle):
* callint.c (syms_of_callint):
* bytecode.c (syms_of_bytecode):
* buffer.c (keys_of_buffer, syms_of_buffer):
* alloc.c (syms_of_alloc):
* process.c (syms_of_process, init_process):
* lread.c (syms_of_lread, init_obarray):
* font.c (build_style_table):
* emacs.c (syms_of_emacs, main): Replace calls to intern with
intern_c_string, calls to make_pure_string with
make_pure_c_string. Use pure_cons instead of Fcons.
* process.c (socket_options): Make it const.
(set_socket_option, init_process): Use a const pointer.
* lread.c (intern_c_string): New function.
(defvar_kboard, defvar_lisp, defvar_lisp_nopro, defvar_bool)
(defvar_int): Uset it. Make the name const char*.
* font.c (struct table_entry): Remove unused member. Make NAMES
constant.
(weight_table, slant_table, width_table): Make constant.
* emacs.c (struct standard_args): Make name and longname constant.
2009-11-06 06:50:52 +00:00
|
|
|
|
Qstart = intern_c_string ("start");
|
(Qeuid, Qegid, Qcomm, Qstate, Qppid, Qpgrp, Qsess)
(Qttname, Qminflt, Qmajflt, Qcminflt, Qcmajflt, Qutime, Qstime)
(Qcutime, Qpri, Qnice, Qthcount, Qstart, Qvsize, Qrss, Qargs)
(Quser, Qgroup, Qetime, Qpcpu, Qpmem, Qtpgid, Qcstime) [!subprocesses]: Define.
(syms_of_process) [!subprocesses]: Intern and staticpro them.
(Flist_system_processes, Fsystem_process_attributes) [!subprocesses]: Call
list_system_processes and system_process_attributes instead of returning Qnil.
2009-01-03 15:03:59 +00:00
|
|
|
|
staticpro (&Qstart);
|
* xterm.c (syms_of_xterm):
* xselect.c (syms_of_xselect):
* xmenu.c (syms_of_xmenu):
* xfns.c (syms_of_xfns):
* xfaces.c (syms_of_xfaces):
* xdisp.c (syms_of_xdisp):
* window.c (syms_of_window):
* w32fns.c (syms_of_w32fns):
* undo.c (syms_of_undo):
* textprop.c (syms_of_textprop):
* terminal.c (syms_of_terminal):
* syntax.c (syms_of_syntax):
* sound.c (syms_of_sound):
* search.c (syms_of_search):
* print.c (syms_of_print):
* minibuf.c (syms_of_minibuf):
* macros.c (syms_of_macros):
* keymap.c (syms_of_keymap, initial_define_key)
(initial_define_lispy_key):
* keyboard.c (syms_of_keyboard):
* insdel.c (syms_of_insdel):
* image.c (syms_of_image):
* fringe.c (syms_of_fringe):
* frame.c (syms_of_frame):
* fontset.c (syms_of_fontset):
* fns.c (syms_of_fns):
* fns.c (syms_of_fns):
* fileio.c (syms_of_fileio):
* fileio.c (syms_of_fileio):
* eval.c (syms_of_eval):
* doc.c (syms_of_doc):
* dispnew.c (syms_of_display):
* dired.c (syms_of_dired):
* dbusbind.c (syms_of_dbusbind):
* data.c (syms_of_data):
* composite.c (syms_of_composite):
* coding.c (syms_of_coding):
* cmds.c (syms_of_cmds):
* charset.c (define_charset_internal, syms_of_character):
* ccl.c (syms_of_ccl):
* category.c (syms_of_category, init_category_once):
* casetab.c (syms_of_casetab):
* casefiddle.c (syms_of_casefiddle):
* callint.c (syms_of_callint):
* bytecode.c (syms_of_bytecode):
* buffer.c (keys_of_buffer, syms_of_buffer):
* alloc.c (syms_of_alloc):
* process.c (syms_of_process, init_process):
* lread.c (syms_of_lread, init_obarray):
* font.c (build_style_table):
* emacs.c (syms_of_emacs, main): Replace calls to intern with
intern_c_string, calls to make_pure_string with
make_pure_c_string. Use pure_cons instead of Fcons.
* process.c (socket_options): Make it const.
(set_socket_option, init_process): Use a const pointer.
* lread.c (intern_c_string): New function.
(defvar_kboard, defvar_lisp, defvar_lisp_nopro, defvar_bool)
(defvar_int): Uset it. Make the name const char*.
* font.c (struct table_entry): Remove unused member. Make NAMES
constant.
(weight_table, slant_table, width_table): Make constant.
* emacs.c (struct standard_args): Make name and longname constant.
2009-11-06 06:50:52 +00:00
|
|
|
|
Qvsize = intern_c_string ("vsize");
|
(Qeuid, Qegid, Qcomm, Qstate, Qppid, Qpgrp, Qsess)
(Qttname, Qminflt, Qmajflt, Qcminflt, Qcmajflt, Qutime, Qstime)
(Qcutime, Qpri, Qnice, Qthcount, Qstart, Qvsize, Qrss, Qargs)
(Quser, Qgroup, Qetime, Qpcpu, Qpmem, Qtpgid, Qcstime) [!subprocesses]: Define.
(syms_of_process) [!subprocesses]: Intern and staticpro them.
(Flist_system_processes, Fsystem_process_attributes) [!subprocesses]: Call
list_system_processes and system_process_attributes instead of returning Qnil.
2009-01-03 15:03:59 +00:00
|
|
|
|
staticpro (&Qvsize);
|
* xterm.c (syms_of_xterm):
* xselect.c (syms_of_xselect):
* xmenu.c (syms_of_xmenu):
* xfns.c (syms_of_xfns):
* xfaces.c (syms_of_xfaces):
* xdisp.c (syms_of_xdisp):
* window.c (syms_of_window):
* w32fns.c (syms_of_w32fns):
* undo.c (syms_of_undo):
* textprop.c (syms_of_textprop):
* terminal.c (syms_of_terminal):
* syntax.c (syms_of_syntax):
* sound.c (syms_of_sound):
* search.c (syms_of_search):
* print.c (syms_of_print):
* minibuf.c (syms_of_minibuf):
* macros.c (syms_of_macros):
* keymap.c (syms_of_keymap, initial_define_key)
(initial_define_lispy_key):
* keyboard.c (syms_of_keyboard):
* insdel.c (syms_of_insdel):
* image.c (syms_of_image):
* fringe.c (syms_of_fringe):
* frame.c (syms_of_frame):
* fontset.c (syms_of_fontset):
* fns.c (syms_of_fns):
* fns.c (syms_of_fns):
* fileio.c (syms_of_fileio):
* fileio.c (syms_of_fileio):
* eval.c (syms_of_eval):
* doc.c (syms_of_doc):
* dispnew.c (syms_of_display):
* dired.c (syms_of_dired):
* dbusbind.c (syms_of_dbusbind):
* data.c (syms_of_data):
* composite.c (syms_of_composite):
* coding.c (syms_of_coding):
* cmds.c (syms_of_cmds):
* charset.c (define_charset_internal, syms_of_character):
* ccl.c (syms_of_ccl):
* category.c (syms_of_category, init_category_once):
* casetab.c (syms_of_casetab):
* casefiddle.c (syms_of_casefiddle):
* callint.c (syms_of_callint):
* bytecode.c (syms_of_bytecode):
* buffer.c (keys_of_buffer, syms_of_buffer):
* alloc.c (syms_of_alloc):
* process.c (syms_of_process, init_process):
* lread.c (syms_of_lread, init_obarray):
* font.c (build_style_table):
* emacs.c (syms_of_emacs, main): Replace calls to intern with
intern_c_string, calls to make_pure_string with
make_pure_c_string. Use pure_cons instead of Fcons.
* process.c (socket_options): Make it const.
(set_socket_option, init_process): Use a const pointer.
* lread.c (intern_c_string): New function.
(defvar_kboard, defvar_lisp, defvar_lisp_nopro, defvar_bool)
(defvar_int): Uset it. Make the name const char*.
* font.c (struct table_entry): Remove unused member. Make NAMES
constant.
(weight_table, slant_table, width_table): Make constant.
* emacs.c (struct standard_args): Make name and longname constant.
2009-11-06 06:50:52 +00:00
|
|
|
|
Qrss = intern_c_string ("rss");
|
(Qeuid, Qegid, Qcomm, Qstate, Qppid, Qpgrp, Qsess)
(Qttname, Qminflt, Qmajflt, Qcminflt, Qcmajflt, Qutime, Qstime)
(Qcutime, Qpri, Qnice, Qthcount, Qstart, Qvsize, Qrss, Qargs)
(Quser, Qgroup, Qetime, Qpcpu, Qpmem, Qtpgid, Qcstime) [!subprocesses]: Define.
(syms_of_process) [!subprocesses]: Intern and staticpro them.
(Flist_system_processes, Fsystem_process_attributes) [!subprocesses]: Call
list_system_processes and system_process_attributes instead of returning Qnil.
2009-01-03 15:03:59 +00:00
|
|
|
|
staticpro (&Qrss);
|
* xterm.c (syms_of_xterm):
* xselect.c (syms_of_xselect):
* xmenu.c (syms_of_xmenu):
* xfns.c (syms_of_xfns):
* xfaces.c (syms_of_xfaces):
* xdisp.c (syms_of_xdisp):
* window.c (syms_of_window):
* w32fns.c (syms_of_w32fns):
* undo.c (syms_of_undo):
* textprop.c (syms_of_textprop):
* terminal.c (syms_of_terminal):
* syntax.c (syms_of_syntax):
* sound.c (syms_of_sound):
* search.c (syms_of_search):
* print.c (syms_of_print):
* minibuf.c (syms_of_minibuf):
* macros.c (syms_of_macros):
* keymap.c (syms_of_keymap, initial_define_key)
(initial_define_lispy_key):
* keyboard.c (syms_of_keyboard):
* insdel.c (syms_of_insdel):
* image.c (syms_of_image):
* fringe.c (syms_of_fringe):
* frame.c (syms_of_frame):
* fontset.c (syms_of_fontset):
* fns.c (syms_of_fns):
* fns.c (syms_of_fns):
* fileio.c (syms_of_fileio):
* fileio.c (syms_of_fileio):
* eval.c (syms_of_eval):
* doc.c (syms_of_doc):
* dispnew.c (syms_of_display):
* dired.c (syms_of_dired):
* dbusbind.c (syms_of_dbusbind):
* data.c (syms_of_data):
* composite.c (syms_of_composite):
* coding.c (syms_of_coding):
* cmds.c (syms_of_cmds):
* charset.c (define_charset_internal, syms_of_character):
* ccl.c (syms_of_ccl):
* category.c (syms_of_category, init_category_once):
* casetab.c (syms_of_casetab):
* casefiddle.c (syms_of_casefiddle):
* callint.c (syms_of_callint):
* bytecode.c (syms_of_bytecode):
* buffer.c (keys_of_buffer, syms_of_buffer):
* alloc.c (syms_of_alloc):
* process.c (syms_of_process, init_process):
* lread.c (syms_of_lread, init_obarray):
* font.c (build_style_table):
* emacs.c (syms_of_emacs, main): Replace calls to intern with
intern_c_string, calls to make_pure_string with
make_pure_c_string. Use pure_cons instead of Fcons.
* process.c (socket_options): Make it const.
(set_socket_option, init_process): Use a const pointer.
* lread.c (intern_c_string): New function.
(defvar_kboard, defvar_lisp, defvar_lisp_nopro, defvar_bool)
(defvar_int): Uset it. Make the name const char*.
* font.c (struct table_entry): Remove unused member. Make NAMES
constant.
(weight_table, slant_table, width_table): Make constant.
* emacs.c (struct standard_args): Make name and longname constant.
2009-11-06 06:50:52 +00:00
|
|
|
|
Qetime = intern_c_string ("etime");
|
(Qeuid, Qegid, Qcomm, Qstate, Qppid, Qpgrp, Qsess)
(Qttname, Qminflt, Qmajflt, Qcminflt, Qcmajflt, Qutime, Qstime)
(Qcutime, Qpri, Qnice, Qthcount, Qstart, Qvsize, Qrss, Qargs)
(Quser, Qgroup, Qetime, Qpcpu, Qpmem, Qtpgid, Qcstime) [!subprocesses]: Define.
(syms_of_process) [!subprocesses]: Intern and staticpro them.
(Flist_system_processes, Fsystem_process_attributes) [!subprocesses]: Call
list_system_processes and system_process_attributes instead of returning Qnil.
2009-01-03 15:03:59 +00:00
|
|
|
|
staticpro (&Qetime);
|
* xterm.c (syms_of_xterm):
* xselect.c (syms_of_xselect):
* xmenu.c (syms_of_xmenu):
* xfns.c (syms_of_xfns):
* xfaces.c (syms_of_xfaces):
* xdisp.c (syms_of_xdisp):
* window.c (syms_of_window):
* w32fns.c (syms_of_w32fns):
* undo.c (syms_of_undo):
* textprop.c (syms_of_textprop):
* terminal.c (syms_of_terminal):
* syntax.c (syms_of_syntax):
* sound.c (syms_of_sound):
* search.c (syms_of_search):
* print.c (syms_of_print):
* minibuf.c (syms_of_minibuf):
* macros.c (syms_of_macros):
* keymap.c (syms_of_keymap, initial_define_key)
(initial_define_lispy_key):
* keyboard.c (syms_of_keyboard):
* insdel.c (syms_of_insdel):
* image.c (syms_of_image):
* fringe.c (syms_of_fringe):
* frame.c (syms_of_frame):
* fontset.c (syms_of_fontset):
* fns.c (syms_of_fns):
* fns.c (syms_of_fns):
* fileio.c (syms_of_fileio):
* fileio.c (syms_of_fileio):
* eval.c (syms_of_eval):
* doc.c (syms_of_doc):
* dispnew.c (syms_of_display):
* dired.c (syms_of_dired):
* dbusbind.c (syms_of_dbusbind):
* data.c (syms_of_data):
* composite.c (syms_of_composite):
* coding.c (syms_of_coding):
* cmds.c (syms_of_cmds):
* charset.c (define_charset_internal, syms_of_character):
* ccl.c (syms_of_ccl):
* category.c (syms_of_category, init_category_once):
* casetab.c (syms_of_casetab):
* casefiddle.c (syms_of_casefiddle):
* callint.c (syms_of_callint):
* bytecode.c (syms_of_bytecode):
* buffer.c (keys_of_buffer, syms_of_buffer):
* alloc.c (syms_of_alloc):
* process.c (syms_of_process, init_process):
* lread.c (syms_of_lread, init_obarray):
* font.c (build_style_table):
* emacs.c (syms_of_emacs, main): Replace calls to intern with
intern_c_string, calls to make_pure_string with
make_pure_c_string. Use pure_cons instead of Fcons.
* process.c (socket_options): Make it const.
(set_socket_option, init_process): Use a const pointer.
* lread.c (intern_c_string): New function.
(defvar_kboard, defvar_lisp, defvar_lisp_nopro, defvar_bool)
(defvar_int): Uset it. Make the name const char*.
* font.c (struct table_entry): Remove unused member. Make NAMES
constant.
(weight_table, slant_table, width_table): Make constant.
* emacs.c (struct standard_args): Make name and longname constant.
2009-11-06 06:50:52 +00:00
|
|
|
|
Qpcpu = intern_c_string ("pcpu");
|
(Qeuid, Qegid, Qcomm, Qstate, Qppid, Qpgrp, Qsess)
(Qttname, Qminflt, Qmajflt, Qcminflt, Qcmajflt, Qutime, Qstime)
(Qcutime, Qpri, Qnice, Qthcount, Qstart, Qvsize, Qrss, Qargs)
(Quser, Qgroup, Qetime, Qpcpu, Qpmem, Qtpgid, Qcstime) [!subprocesses]: Define.
(syms_of_process) [!subprocesses]: Intern and staticpro them.
(Flist_system_processes, Fsystem_process_attributes) [!subprocesses]: Call
list_system_processes and system_process_attributes instead of returning Qnil.
2009-01-03 15:03:59 +00:00
|
|
|
|
staticpro (&Qpcpu);
|
* xterm.c (syms_of_xterm):
* xselect.c (syms_of_xselect):
* xmenu.c (syms_of_xmenu):
* xfns.c (syms_of_xfns):
* xfaces.c (syms_of_xfaces):
* xdisp.c (syms_of_xdisp):
* window.c (syms_of_window):
* w32fns.c (syms_of_w32fns):
* undo.c (syms_of_undo):
* textprop.c (syms_of_textprop):
* terminal.c (syms_of_terminal):
* syntax.c (syms_of_syntax):
* sound.c (syms_of_sound):
* search.c (syms_of_search):
* print.c (syms_of_print):
* minibuf.c (syms_of_minibuf):
* macros.c (syms_of_macros):
* keymap.c (syms_of_keymap, initial_define_key)
(initial_define_lispy_key):
* keyboard.c (syms_of_keyboard):
* insdel.c (syms_of_insdel):
* image.c (syms_of_image):
* fringe.c (syms_of_fringe):
* frame.c (syms_of_frame):
* fontset.c (syms_of_fontset):
* fns.c (syms_of_fns):
* fns.c (syms_of_fns):
* fileio.c (syms_of_fileio):
* fileio.c (syms_of_fileio):
* eval.c (syms_of_eval):
* doc.c (syms_of_doc):
* dispnew.c (syms_of_display):
* dired.c (syms_of_dired):
* dbusbind.c (syms_of_dbusbind):
* data.c (syms_of_data):
* composite.c (syms_of_composite):
* coding.c (syms_of_coding):
* cmds.c (syms_of_cmds):
* charset.c (define_charset_internal, syms_of_character):
* ccl.c (syms_of_ccl):
* category.c (syms_of_category, init_category_once):
* casetab.c (syms_of_casetab):
* casefiddle.c (syms_of_casefiddle):
* callint.c (syms_of_callint):
* bytecode.c (syms_of_bytecode):
* buffer.c (keys_of_buffer, syms_of_buffer):
* alloc.c (syms_of_alloc):
* process.c (syms_of_process, init_process):
* lread.c (syms_of_lread, init_obarray):
* font.c (build_style_table):
* emacs.c (syms_of_emacs, main): Replace calls to intern with
intern_c_string, calls to make_pure_string with
make_pure_c_string. Use pure_cons instead of Fcons.
* process.c (socket_options): Make it const.
(set_socket_option, init_process): Use a const pointer.
* lread.c (intern_c_string): New function.
(defvar_kboard, defvar_lisp, defvar_lisp_nopro, defvar_bool)
(defvar_int): Uset it. Make the name const char*.
* font.c (struct table_entry): Remove unused member. Make NAMES
constant.
(weight_table, slant_table, width_table): Make constant.
* emacs.c (struct standard_args): Make name and longname constant.
2009-11-06 06:50:52 +00:00
|
|
|
|
Qpmem = intern_c_string ("pmem");
|
(Qeuid, Qegid, Qcomm, Qstate, Qppid, Qpgrp, Qsess)
(Qttname, Qminflt, Qmajflt, Qcminflt, Qcmajflt, Qutime, Qstime)
(Qcutime, Qpri, Qnice, Qthcount, Qstart, Qvsize, Qrss, Qargs)
(Quser, Qgroup, Qetime, Qpcpu, Qpmem, Qtpgid, Qcstime) [!subprocesses]: Define.
(syms_of_process) [!subprocesses]: Intern and staticpro them.
(Flist_system_processes, Fsystem_process_attributes) [!subprocesses]: Call
list_system_processes and system_process_attributes instead of returning Qnil.
2009-01-03 15:03:59 +00:00
|
|
|
|
staticpro (&Qpmem);
|
* xterm.c (syms_of_xterm):
* xselect.c (syms_of_xselect):
* xmenu.c (syms_of_xmenu):
* xfns.c (syms_of_xfns):
* xfaces.c (syms_of_xfaces):
* xdisp.c (syms_of_xdisp):
* window.c (syms_of_window):
* w32fns.c (syms_of_w32fns):
* undo.c (syms_of_undo):
* textprop.c (syms_of_textprop):
* terminal.c (syms_of_terminal):
* syntax.c (syms_of_syntax):
* sound.c (syms_of_sound):
* search.c (syms_of_search):
* print.c (syms_of_print):
* minibuf.c (syms_of_minibuf):
* macros.c (syms_of_macros):
* keymap.c (syms_of_keymap, initial_define_key)
(initial_define_lispy_key):
* keyboard.c (syms_of_keyboard):
* insdel.c (syms_of_insdel):
* image.c (syms_of_image):
* fringe.c (syms_of_fringe):
* frame.c (syms_of_frame):
* fontset.c (syms_of_fontset):
* fns.c (syms_of_fns):
* fns.c (syms_of_fns):
* fileio.c (syms_of_fileio):
* fileio.c (syms_of_fileio):
* eval.c (syms_of_eval):
* doc.c (syms_of_doc):
* dispnew.c (syms_of_display):
* dired.c (syms_of_dired):
* dbusbind.c (syms_of_dbusbind):
* data.c (syms_of_data):
* composite.c (syms_of_composite):
* coding.c (syms_of_coding):
* cmds.c (syms_of_cmds):
* charset.c (define_charset_internal, syms_of_character):
* ccl.c (syms_of_ccl):
* category.c (syms_of_category, init_category_once):
* casetab.c (syms_of_casetab):
* casefiddle.c (syms_of_casefiddle):
* callint.c (syms_of_callint):
* bytecode.c (syms_of_bytecode):
* buffer.c (keys_of_buffer, syms_of_buffer):
* alloc.c (syms_of_alloc):
* process.c (syms_of_process, init_process):
* lread.c (syms_of_lread, init_obarray):
* font.c (build_style_table):
* emacs.c (syms_of_emacs, main): Replace calls to intern with
intern_c_string, calls to make_pure_string with
make_pure_c_string. Use pure_cons instead of Fcons.
* process.c (socket_options): Make it const.
(set_socket_option, init_process): Use a const pointer.
* lread.c (intern_c_string): New function.
(defvar_kboard, defvar_lisp, defvar_lisp_nopro, defvar_bool)
(defvar_int): Uset it. Make the name const char*.
* font.c (struct table_entry): Remove unused member. Make NAMES
constant.
(weight_table, slant_table, width_table): Make constant.
* emacs.c (struct standard_args): Make name and longname constant.
2009-11-06 06:50:52 +00:00
|
|
|
|
Qargs = intern_c_string ("args");
|
(Qeuid, Qegid, Qcomm, Qstate, Qppid, Qpgrp, Qsess)
(Qttname, Qminflt, Qmajflt, Qcminflt, Qcmajflt, Qutime, Qstime)
(Qcutime, Qpri, Qnice, Qthcount, Qstart, Qvsize, Qrss, Qargs)
(Quser, Qgroup, Qetime, Qpcpu, Qpmem, Qtpgid, Qcstime) [!subprocesses]: Define.
(syms_of_process) [!subprocesses]: Intern and staticpro them.
(Flist_system_processes, Fsystem_process_attributes) [!subprocesses]: Call
list_system_processes and system_process_attributes instead of returning Qnil.
2009-01-03 15:03:59 +00:00
|
|
|
|
staticpro (&Qargs);
|
2002-03-21 12:20:24 +00:00
|
|
|
|
|
2010-07-10 16:26:44 +03:00
|
|
|
|
DEFVAR_BOOL ("delete-exited-processes", &delete_exited_processes,
|
|
|
|
|
doc: /* *Non-nil means delete processes immediately when they exit.
|
|
|
|
|
A value of nil means don't delete them until `list-processes' is run. */);
|
|
|
|
|
|
|
|
|
|
delete_exited_processes = 1;
|
|
|
|
|
|
2010-07-11 08:55:06 +03:00
|
|
|
|
#ifdef subprocesses
|
2010-07-10 16:26:44 +03:00
|
|
|
|
DEFVAR_LISP ("process-connection-type", &Vprocess_connection_type,
|
|
|
|
|
doc: /* Control type of device used to communicate with subprocesses.
|
|
|
|
|
Values are nil to use a pipe, or t or `pty' to use a pty.
|
|
|
|
|
The value has no effect if the system has no ptys or if all ptys are busy:
|
|
|
|
|
then a pipe is used in any case.
|
|
|
|
|
The value takes effect when `start-process' is called. */);
|
|
|
|
|
Vprocess_connection_type = Qt;
|
|
|
|
|
|
|
|
|
|
#ifdef ADAPTIVE_READ_BUFFERING
|
|
|
|
|
DEFVAR_LISP ("process-adaptive-read-buffering", &Vprocess_adaptive_read_buffering,
|
|
|
|
|
doc: /* If non-nil, improve receive buffering by delaying after short reads.
|
|
|
|
|
On some systems, when Emacs reads the output from a subprocess, the output data
|
|
|
|
|
is read in very small blocks, potentially resulting in very poor performance.
|
|
|
|
|
This behavior can be remedied to some extent by setting this variable to a
|
|
|
|
|
non-nil value, as it will automatically delay reading from such processes, to
|
|
|
|
|
allow them to produce more output before Emacs tries to read it.
|
|
|
|
|
If the value is t, the delay is reset after each write to the process; any other
|
|
|
|
|
non-nil value means that the delay is not reset on write.
|
|
|
|
|
The variable takes effect when `start-process' is called. */);
|
|
|
|
|
Vprocess_adaptive_read_buffering = Qt;
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
defsubr (&Sprocessp);
|
|
|
|
|
defsubr (&Sget_process);
|
|
|
|
|
defsubr (&Sdelete_process);
|
|
|
|
|
defsubr (&Sprocess_status);
|
|
|
|
|
defsubr (&Sprocess_exit_status);
|
|
|
|
|
defsubr (&Sprocess_id);
|
|
|
|
|
defsubr (&Sprocess_name);
|
|
|
|
|
defsubr (&Sprocess_tty_name);
|
|
|
|
|
defsubr (&Sprocess_command);
|
|
|
|
|
defsubr (&Sset_process_buffer);
|
|
|
|
|
defsubr (&Sprocess_buffer);
|
|
|
|
|
defsubr (&Sprocess_mark);
|
|
|
|
|
defsubr (&Sset_process_filter);
|
|
|
|
|
defsubr (&Sprocess_filter);
|
|
|
|
|
defsubr (&Sset_process_sentinel);
|
|
|
|
|
defsubr (&Sprocess_sentinel);
|
|
|
|
|
defsubr (&Sset_process_window_size);
|
|
|
|
|
defsubr (&Sset_process_inherit_coding_system_flag);
|
|
|
|
|
defsubr (&Sset_process_query_on_exit_flag);
|
|
|
|
|
defsubr (&Sprocess_query_on_exit_flag);
|
|
|
|
|
defsubr (&Sprocess_contact);
|
|
|
|
|
defsubr (&Sprocess_plist);
|
|
|
|
|
defsubr (&Sset_process_plist);
|
|
|
|
|
defsubr (&Slist_processes);
|
|
|
|
|
defsubr (&Sprocess_list);
|
|
|
|
|
defsubr (&Sstart_process);
|
|
|
|
|
#ifdef HAVE_SERIAL
|
|
|
|
|
defsubr (&Sserial_process_configure);
|
|
|
|
|
defsubr (&Smake_serial_process);
|
|
|
|
|
#endif /* HAVE_SERIAL */
|
|
|
|
|
defsubr (&Sset_network_process_option);
|
|
|
|
|
defsubr (&Smake_network_process);
|
|
|
|
|
defsubr (&Sformat_network_address);
|
2010-08-05 17:36:12 -07:00
|
|
|
|
#if defined(HAVE_NET_IF_H) && defined(HAVE_SYS_IOCTL_H)
|
2010-07-10 16:26:44 +03:00
|
|
|
|
#ifdef SIOCGIFCONF
|
|
|
|
|
defsubr (&Snetwork_interface_list);
|
|
|
|
|
#endif
|
|
|
|
|
#if defined(SIOCGIFADDR) || defined(SIOCGIFHWADDR) || defined(SIOCGIFFLAGS)
|
|
|
|
|
defsubr (&Snetwork_interface_info);
|
|
|
|
|
#endif
|
2010-08-05 17:36:12 -07:00
|
|
|
|
#endif /* defined(HAVE_NET_IF_H) && defined(HAVE_SYS_IOCTL_H) */
|
2010-07-10 16:26:44 +03:00
|
|
|
|
#ifdef DATAGRAM_SOCKETS
|
|
|
|
|
defsubr (&Sprocess_datagram_address);
|
|
|
|
|
defsubr (&Sset_process_datagram_address);
|
|
|
|
|
#endif
|
|
|
|
|
defsubr (&Saccept_process_output);
|
|
|
|
|
defsubr (&Sprocess_send_region);
|
|
|
|
|
defsubr (&Sprocess_send_string);
|
|
|
|
|
defsubr (&Sinterrupt_process);
|
|
|
|
|
defsubr (&Skill_process);
|
|
|
|
|
defsubr (&Squit_process);
|
|
|
|
|
defsubr (&Sstop_process);
|
|
|
|
|
defsubr (&Scontinue_process);
|
|
|
|
|
defsubr (&Sprocess_running_child_p);
|
|
|
|
|
defsubr (&Sprocess_send_eof);
|
|
|
|
|
defsubr (&Ssignal_process);
|
|
|
|
|
defsubr (&Swaiting_for_user_input_p);
|
|
|
|
|
defsubr (&Sprocess_type);
|
|
|
|
|
defsubr (&Sset_process_coding_system);
|
|
|
|
|
defsubr (&Sprocess_coding_system);
|
|
|
|
|
defsubr (&Sset_process_filter_multibyte);
|
|
|
|
|
defsubr (&Sprocess_filter_multibyte_p);
|
|
|
|
|
|
|
|
|
|
#endif /* subprocesses */
|
|
|
|
|
|
1992-03-18 20:22:31 +00:00
|
|
|
|
defsubr (&Sget_buffer_process);
|
1998-04-19 14:13:47 +00:00
|
|
|
|
defsubr (&Sprocess_inherit_coding_system_flag);
|
2008-08-02 16:27:44 +00:00
|
|
|
|
defsubr (&Slist_system_processes);
|
2009-02-23 05:06:36 +00:00
|
|
|
|
defsubr (&Sprocess_attributes);
|
1992-03-18 20:22:31 +00:00
|
|
|
|
}
|
|
|
|
|
|
2004-04-16 12:51:06 +00:00
|
|
|
|
/* arch-tag: 3706c011-7b9a-4117-bd4f-59e7f701a4c4
|
|
|
|
|
(do not change this comment) */
|