1990-09-27 21:17:59 +00:00
|
|
|
/* IBM has disclaimed copyright on this module. */
|
|
|
|
|
|
|
|
/***************************************************************/
|
|
|
|
/* */
|
|
|
|
/* Function: hftctl */
|
|
|
|
/* */
|
|
|
|
/* Syntax: */
|
|
|
|
/* #include <sys/ioctl.h> */
|
|
|
|
/* #include <sys/hft.h> */
|
|
|
|
/* */
|
|
|
|
/* int hftctl(fildes, request, arg ) */
|
1992-01-13 21:48:08 +00:00
|
|
|
/* int fildes, request; */
|
|
|
|
/* char *arg; */
|
1990-09-27 21:17:59 +00:00
|
|
|
/* */
|
|
|
|
/* Description: */
|
|
|
|
/* */
|
|
|
|
/* Does the following: */
|
|
|
|
/* 1. determines if fildes is pty */
|
|
|
|
/* does normal ioctl it is not */
|
|
|
|
/* 2. places fildes into raw mode */
|
|
|
|
/* 3. converts ioctl arguments to datastream */
|
|
|
|
/* 4. waits for 2 secs for acknowledgement before */
|
1993-06-09 11:59:12 +00:00
|
|
|
/* timing out. */
|
1990-09-27 21:17:59 +00:00
|
|
|
/* 5. places response in callers buffer ( just like */
|
|
|
|
/* ioctl. */
|
|
|
|
/* 6. returns fildes to its original mode */
|
|
|
|
/* */
|
|
|
|
/* User of this program should review steps 1,4, and 3. */
|
|
|
|
/* hftctl makes no check on the request type. It must be */
|
|
|
|
/* a HFT ioctl that is supported remotely. */
|
|
|
|
/* This program will use the SIGALRM and alarm(2). Any */
|
|
|
|
/* Previous alarms are lost. */
|
|
|
|
/* */
|
|
|
|
/* Users of this program are free to modify it any way */
|
|
|
|
/* they want. */
|
|
|
|
/* */
|
|
|
|
/* Return Value: */
|
|
|
|
/* */
|
|
|
|
/* If ioctl fails, a value of -1 is returned and errno */
|
|
|
|
/* is set to indicate the error. */
|
|
|
|
/* */
|
|
|
|
/***************************************************************/
|
|
|
|
|
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 <config.h>
|
1994-06-15 03:45:54 +00:00
|
|
|
#include <sys/signal.h>
|
|
|
|
#include <errno.h>
|
1990-09-27 21:17:59 +00:00
|
|
|
#include <stdio.h>
|
|
|
|
#include <fcntl.h>
|
|
|
|
#include <setjmp.h>
|
|
|
|
#include <sys/ioctl.h>
|
|
|
|
#include <sys/devinfo.h>
|
1992-01-13 21:48:08 +00:00
|
|
|
#include <termios.h>
|
1990-09-27 21:17:59 +00:00
|
|
|
#include <termio.h>
|
|
|
|
#include <sys/hft.h>
|
1992-02-22 21:15:26 +00:00
|
|
|
#include <sys/uio.h>
|
1990-09-27 21:17:59 +00:00
|
|
|
#include <sys/tty.h>
|
|
|
|
/* #include <sys/pty.h> */
|
1993-11-21 22:19:51 +00:00
|
|
|
|
1990-09-27 21:17:59 +00:00
|
|
|
#define REMOTE 0x01
|
|
|
|
|
|
|
|
#undef ioctl
|
1992-01-13 21:48:08 +00:00
|
|
|
static char SCCSid[] = "com/gnuemacs/src,3.1,9021-90/05/03-5/3/90";
|
1990-09-27 21:17:59 +00:00
|
|
|
|
|
|
|
/*************** LOCAL DEFINES **********************************/
|
|
|
|
|
|
|
|
#define QDEV ((HFQPDEVCH<<8)|HFQPDEVCL)
|
|
|
|
#define QLOC ((HFQLOCCH<<8)|HFQLOCCL)
|
|
|
|
#define QPS ((HFQPRESCH<<8)|HFQPRESCL)
|
|
|
|
|
1992-01-13 21:48:08 +00:00
|
|
|
#ifndef TCGETS
|
|
|
|
#define TCGETS TCGETA
|
|
|
|
#endif
|
|
|
|
#ifndef TCSETS
|
|
|
|
#define TCSETS TCSETA
|
|
|
|
#endif
|
|
|
|
|
1990-09-27 21:17:59 +00:00
|
|
|
/*************** EXTERNAL / GLOBAL DATA AREA ********************/
|
|
|
|
|
1992-02-22 21:15:26 +00:00
|
|
|
static int hfqry();
|
|
|
|
static int hfskbd();
|
Put interrupt input blocking in a separate file from xterm.h.
This isn't specific to X, and it allows us to avoid #including
xterm.h in files that don't really have anything to do with X.
* blockinput.h: New file.
* xterm.h (BLOCK_INPUT, UNBLOCK_INPUT, TOTALLY_UNBLOCK_INPUT,
UNBLOCK_INPUT_RESIGNAL): These are now in blockinput.h.
(x_input_blocked, x_pending_input): Deleted; there are analogs
in blockinput.h called interrupt_input_blocked and
interrupt_input_pending.
* keyboard.c (interrupt_input_blocked, interrupt_input_pending):
New variables, used by the macros in blockinput.h.
* xterm.c: #include blockinput.h.
(x_input_blocked, x_pending_input): Deleted.
(XTread_socket): Test and set interrupt_input_blocked and
interrupt_input_pending instead of the old variables.
* alloc.c, xfaces.c, xfns.c, xmenu.c, xselect.c, keymap.c:
#include blockinput.h.
* eval.c: #include blockinput.h instead of xterm.h.
* keyboard.c: #include blockinput.h.
(input_poll_signal): Just test
interrupt_input_blocked, instead of testing HAVE_X_WINDOWS and
x_input_blocked.
Block the processing of interrupt input while we're manipulating the
malloc heap.
* alloc.c: (xfree): New function, to make it easy to free things
safely.
(xmalloc, xrealloc): Block X input while doing the deed.
(VALIDATE_LISP_STORAGE, gc_sweep, compact_strings): Use xfree
instead of free.
(uninterrupt_malloc): New function, to install input-blocking
hooks into the GNU malloc routines.
* emacs.c [not SYSTEM_MALLOC] (main): Call uninterrupt_malloc
on startup.
* alloc.c: (make_interval, make_float, Fcons, Fmake_vector,
Fmake_symbol, Fmake_marker, make_uninit_string, Fgarbage_collect):
Use xmalloc instead of malloc; don't bother to check if out of
memory here.
(Fgarbage_collect): Call xrealloc instead of realloc.
* buffer.c: Use xmalloc and xfree instead of malloc and free;
don't bother to check if out of memory here.
(Fget_buffer_create): Put BLOCK_INPUT/UNBLOCK_INPUT pair around
calls to ralloc routines.
* insdel.c: Same.
* lisp.h (xfree): New extern declaration.
* xfaces.c (xfree): Don't #define this to be free; use the
definition in alloc.c.
* dispnew.c, doc.c, doprnt.c, fileio.c, lread.c, term.c, xfns.c,
xmenu.c, xterm.c: Use xfree instead of free.
* hftctl.c: Use xfree and xmalloc instead of free and malloc.
* keymap.c (current_minor_maps): BLOCK_INPUT while calling realloc
and malloc.
* search.c: Since the regexp routines can malloc, BLOCK_INPUT
while runing them. #include blockinput.h.
* sysdep.c: #include blockinput.h. Call xfree and xmalloc instead
of free and malloc. BLOCK_INPUT around routines which we know
will call malloc.
ymakefile (keyboard.o, keymap.o, search.o, sysdep.o, xfaces.o,
xfns.o, xmenu.o, xterm.o, xselect.o, alloc.o, eval.o): Note that
these depend on blockinput.h.
1993-03-31 10:55:33 +00:00
|
|
|
char *xmalloc();
|
1990-09-27 21:17:59 +00:00
|
|
|
|
1992-01-13 21:48:08 +00:00
|
|
|
extern int errno;
|
|
|
|
static jmp_buf hftenv;
|
|
|
|
static int is_ack_vtd;
|
1993-11-21 22:19:51 +00:00
|
|
|
static SIGTYPE (*sav_alrm) ();
|
1990-09-27 21:17:59 +00:00
|
|
|
static struct hfctlreq req =
|
|
|
|
{ 0x1b,'[','x',0,0,0,21,HFCTLREQCH,HFCTLREQCL};
|
|
|
|
static struct hfctlack ACK =
|
|
|
|
{ 0x1b,'[','x',0,0,0,21,HFCTLACKCH,HFCTLACKCL};
|
|
|
|
|
1992-01-13 21:48:08 +00:00
|
|
|
/* FUNC signal(); */
|
1990-09-27 21:17:59 +00:00
|
|
|
|
|
|
|
/*************** LOCAL MACROS ***********************************/
|
|
|
|
|
|
|
|
#define HFTYPE(p) ((p->hf_typehi<<8)|(p->hf_typelo))
|
|
|
|
|
1992-01-13 21:48:08 +00:00
|
|
|
#define BYTE4(p) ((p)[0]<<24 | (p)[1]<<16 | (p)[2]<<8 | (p)[3])
|
1990-09-27 21:17:59 +00:00
|
|
|
|
|
|
|
/* read a buffer */
|
|
|
|
#define RD_BUF(f,p,l) \
|
1992-01-13 21:48:08 +00:00
|
|
|
while ((l)) \
|
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
|
|
|
if ((j = emacs_read (f, p, l)) < 0) \
|
1992-01-13 21:48:08 +00:00
|
|
|
if (errno != EINTR) return (-1); \
|
|
|
|
else continue; \
|
|
|
|
else { (l) -= j; (p) += j; }
|
|
|
|
|
|
|
|
/*************** function prototypes ***************************/
|
2000-03-08 18:55:10 +00:00
|
|
|
#ifdef PROTOTYPES
|
1992-01-13 21:48:08 +00:00
|
|
|
static GT_ACK (int fd, int req, char *buf);
|
|
|
|
static WR_REQ (int fd, int request, int cmdlen, char *cmd, int resplen);
|
1993-05-30 20:16:09 +00:00
|
|
|
static void hft_alrm(int sig);
|
1992-01-13 21:48:08 +00:00
|
|
|
#else
|
|
|
|
static GT_ACK ();
|
|
|
|
static WR_REQ ();
|
1993-06-04 05:20:16 +00:00
|
|
|
static void hft_alrm ();
|
1992-01-13 21:48:08 +00:00
|
|
|
#endif
|
1990-09-27 21:17:59 +00:00
|
|
|
|
|
|
|
/*************** HFTCTL FUNCTION *******************************/
|
|
|
|
|
1992-01-13 21:48:08 +00:00
|
|
|
hftctl (fd, request, arg)
|
|
|
|
int fd;
|
|
|
|
int request;
|
|
|
|
union {
|
|
|
|
struct hfintro *intro;
|
|
|
|
struct hfquery *query;
|
|
|
|
char *c;
|
|
|
|
} arg;
|
1990-09-27 21:17:59 +00:00
|
|
|
{
|
|
|
|
|
1992-01-13 21:48:08 +00:00
|
|
|
int i;
|
|
|
|
int fd_flag; /* fcntl flags */
|
|
|
|
register union {
|
|
|
|
struct hfintro *cmd; /* p.cmd - intro des. */
|
|
|
|
struct hfqphdevc *ph; /* p.ph - physical dev.*/
|
|
|
|
char *c; /* p.c - char ptr */
|
|
|
|
} p; /* general pointer */
|
|
|
|
int pty_new; /* pty modes */
|
|
|
|
int pty_old;
|
|
|
|
int retcode;
|
|
|
|
struct termios term_new; /* terminal attributes */
|
|
|
|
struct termios term_old;
|
|
|
|
struct devinfo devInfo; /* defined in sys/devinfo.h */
|
|
|
|
|
|
|
|
|
|
|
|
if (ioctl (fd, IOCINFO, &devInfo) == -1) return(-1);
|
|
|
|
|
|
|
|
if (devInfo.devtype != DD_PSEU) /* is it a pty? */
|
|
|
|
return (ioctl(fd, request, arg)); /* no, do IOCTL */
|
|
|
|
|
|
|
|
/******* START PTY **************/
|
|
|
|
/** Pty found, possible HFT */
|
|
|
|
/** set new file des as raw */
|
|
|
|
/** as you can. */
|
|
|
|
/********************************/
|
|
|
|
|
|
|
|
/* Get current state of file */
|
|
|
|
/* descriptor & save */
|
|
|
|
if ((fd_flag = fcntl (fd, F_GETFL, 0)) == -1) return (-1);
|
|
|
|
if (ioctl (fd, TCGETS, &term_old) == -1) return (-1);
|
|
|
|
/* set terminal attr to raw */
|
|
|
|
/* and to delay on read */
|
|
|
|
pty_new = pty_old | REMOTE;
|
|
|
|
memcpy (&term_new, &term_old, sizeof (term_new));
|
|
|
|
term_new.c_iflag = 0;
|
|
|
|
term_new.c_oflag = 0;
|
|
|
|
term_new.c_lflag = 0;
|
|
|
|
/* term_new.c_line = 0; */
|
|
|
|
for (i = 1; i <= 5; i++)
|
|
|
|
term_new.c_cc[i] = 0;
|
|
|
|
term_new.c_cc[0] = -1;
|
|
|
|
ioctl (fd, TCSETS, &term_new);
|
|
|
|
if (fcntl (fd, F_SETFL, fd_flag & ~O_NDELAY) == -1)
|
|
|
|
return(-1);
|
|
|
|
/* call spacific function */
|
|
|
|
if (request == HFSKBD)
|
|
|
|
retcode = hfskbd (fd, request, arg.c);
|
|
|
|
else /* assume HFQUERY */
|
|
|
|
retcode = hfqry (fd, request, arg.c);
|
|
|
|
|
|
|
|
fcntl (fd, F_SETFL, fd_flag); /* reset terminal to original */
|
|
|
|
ioctl (fd, TCSETS, &term_old);
|
|
|
|
|
|
|
|
|
|
|
|
return (retcode); /* return error */
|
1990-09-27 21:17:59 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/*************** HFSKBD FUNCTION ******************************/
|
1992-01-13 21:48:08 +00:00
|
|
|
static int
|
|
|
|
hfskbd (fd, request, arg)
|
|
|
|
int fd;
|
|
|
|
int request;
|
|
|
|
struct hfbuf *arg;
|
1990-09-27 21:17:59 +00:00
|
|
|
{
|
1992-01-13 21:48:08 +00:00
|
|
|
WR_REQ(fd, request, arg->hf_buflen, arg->hf_bufp,0);
|
|
|
|
return (GT_ACK(fd, request, arg->hf_bufp));
|
1990-09-27 21:17:59 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/*************** HFQUERY FUNCTION ******************************/
|
1992-01-13 21:48:08 +00:00
|
|
|
static int
|
|
|
|
hfqry (fd, request, arg)
|
|
|
|
int fd;
|
|
|
|
int request;
|
|
|
|
struct hfquery *arg;
|
1990-09-27 21:17:59 +00:00
|
|
|
{
|
1992-01-13 21:48:08 +00:00
|
|
|
WR_REQ(fd, request, arg->hf_cmdlen, arg->hf_cmd, arg->hf_resplen);
|
|
|
|
return (GT_ACK(fd, request, arg->hf_resp));
|
1990-09-27 21:17:59 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/*************** GT_ACK FUNCTION ******************************/
|
1992-01-13 21:48:08 +00:00
|
|
|
static int
|
|
|
|
GT_ACK (fd, req, buf)
|
|
|
|
int fd;
|
|
|
|
int req;
|
|
|
|
char *buf;
|
1990-09-27 21:17:59 +00:00
|
|
|
{
|
1992-01-13 21:48:08 +00:00
|
|
|
struct hfctlack ack;
|
|
|
|
int i = sizeof (ack);
|
|
|
|
int j = 0;
|
|
|
|
union {
|
|
|
|
char *c;
|
|
|
|
struct hfctlack *ack;
|
|
|
|
} p;
|
|
|
|
|
|
|
|
is_ack_vtd = 0; /* flag no ACT VTD yet */
|
|
|
|
|
|
|
|
if (setjmp (hftenv)) /* set environment in case */
|
|
|
|
{ /* of time out */
|
|
|
|
errno = ENODEV; /* if time out, set errno */
|
|
|
|
return (-1); /* flag error */
|
|
|
|
}
|
|
|
|
|
|
|
|
alarm(3); /* time out in 3 secs */
|
|
|
|
sav_alrm = signal (SIGALRM, hft_alrm); /* prepare to catch time out */
|
|
|
|
|
|
|
|
p.ack = &ack;
|
|
|
|
while (! is_ack_vtd) /* do until valid ACK VTD */
|
|
|
|
{
|
|
|
|
RD_BUF(fd, p.c, i); /* read until a ACK VTD is fill*/
|
|
|
|
|
|
|
|
if (! memcmp (&ack, &ACK, sizeof (HFINTROSZ)) /* the ACK intro & */
|
|
|
|
&& (ack.hf_request == req)) /* is it the response we want ?*/
|
|
|
|
{ /* yes, ACK VTD found */
|
|
|
|
is_ack_vtd = 1; /* quickly, flag it */
|
|
|
|
break; /* get the %$%#@ out of here */
|
|
|
|
}
|
|
|
|
|
|
|
|
p.ack = &ack; /* no, then skip 1st */
|
|
|
|
++p.c; /* char and start over */
|
|
|
|
i = sizeof (ack) - 1; /* one less ESC to cry over */
|
|
|
|
|
|
|
|
while ((*p.c != 0x1b) && i) /* scan for next ESC */
|
|
|
|
{ ++p.c; --i; } /* if any */
|
|
|
|
|
|
|
|
(i ? memcpy (&ack, p.c, i) : 0); /* if any left over, then move */
|
|
|
|
p.ack = &ack; /* ESC to front of ack struct */
|
|
|
|
p.c += i; /* skip over whats been read */
|
|
|
|
i = sizeof (ack) - i; /* set whats left to be read */
|
|
|
|
} /***** TRY AGAIN */
|
|
|
|
|
|
|
|
alarm(0); /* ACK VTD received, reset alrm*/
|
|
|
|
signal (SIGALRM, sav_alrm); /* reset signal */
|
|
|
|
|
|
|
|
if (i = ack.hf_arg_len) /* any data following ? */
|
|
|
|
{ /* yes, */
|
|
|
|
RD_BUF(fd,buf,i); /* read until it is received */
|
|
|
|
}
|
|
|
|
|
|
|
|
if (errno = ack.hf_retcode) /* set errno based on returned */
|
|
|
|
return (-1); /* code, if 0, then no error */
|
|
|
|
else
|
|
|
|
return (0); /* if set, then error returned */
|
1990-09-27 21:17:59 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/*************** HFT_ALRM FUNCTION ******************************/
|
1993-05-30 20:16:09 +00:00
|
|
|
static void
|
|
|
|
hft_alrm (sig) /* Function hft_alrm - handle */
|
|
|
|
int sig; /* alarm signal */
|
1990-09-27 21:17:59 +00:00
|
|
|
{
|
1992-01-13 21:48:08 +00:00
|
|
|
signal (SIGALRM, sav_alrm); /* reset to previous */
|
1990-09-27 21:17:59 +00:00
|
|
|
|
1992-01-13 21:48:08 +00:00
|
|
|
if (is_ack_vtd) /* has ack vtd arrived ? */
|
1993-06-04 05:20:16 +00:00
|
|
|
return; /* yes, then continue */
|
1992-01-13 21:48:08 +00:00
|
|
|
else /* no, then return with error */
|
|
|
|
longjmp (hftenv, -1);
|
1990-09-27 21:17:59 +00:00
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
/*********************************************************************/
|
|
|
|
/*** ***/
|
|
|
|
/*** NOTE: Both the HFCTLREQ and the arg structure should be ***/
|
|
|
|
/*** sent in one io write operation. If terminal ***/
|
|
|
|
/*** emulators are in NODELAY mode then multiple writes ***/
|
|
|
|
/*** may cause bogus information to be read by the emulator ***/
|
|
|
|
/*** depending on the timing. ***/
|
|
|
|
/*** ***/
|
|
|
|
/*********************************************************************/
|
|
|
|
|
1992-01-13 21:48:08 +00:00
|
|
|
static int
|
|
|
|
WR_REQ (fd, request, cmdlen, cmd, resplen)
|
|
|
|
int fd;
|
|
|
|
int request;
|
|
|
|
int cmdlen;
|
|
|
|
char *cmd;
|
|
|
|
int resplen;
|
1990-09-27 21:17:59 +00:00
|
|
|
{
|
1992-01-13 21:48:08 +00:00
|
|
|
struct {
|
|
|
|
char *c;
|
|
|
|
struct hfctlreq *req;
|
|
|
|
} p;
|
|
|
|
int size;
|
|
|
|
|
|
|
|
req.hf_request = request;
|
|
|
|
req.hf_arg_len = cmdlen;
|
|
|
|
req.hf_rsp_len = resplen;
|
|
|
|
|
|
|
|
if (cmdlen) /* if arg structure to pass */
|
|
|
|
{
|
|
|
|
size = sizeof (struct hfctlreq) + cmdlen;
|
Put interrupt input blocking in a separate file from xterm.h.
This isn't specific to X, and it allows us to avoid #including
xterm.h in files that don't really have anything to do with X.
* blockinput.h: New file.
* xterm.h (BLOCK_INPUT, UNBLOCK_INPUT, TOTALLY_UNBLOCK_INPUT,
UNBLOCK_INPUT_RESIGNAL): These are now in blockinput.h.
(x_input_blocked, x_pending_input): Deleted; there are analogs
in blockinput.h called interrupt_input_blocked and
interrupt_input_pending.
* keyboard.c (interrupt_input_blocked, interrupt_input_pending):
New variables, used by the macros in blockinput.h.
* xterm.c: #include blockinput.h.
(x_input_blocked, x_pending_input): Deleted.
(XTread_socket): Test and set interrupt_input_blocked and
interrupt_input_pending instead of the old variables.
* alloc.c, xfaces.c, xfns.c, xmenu.c, xselect.c, keymap.c:
#include blockinput.h.
* eval.c: #include blockinput.h instead of xterm.h.
* keyboard.c: #include blockinput.h.
(input_poll_signal): Just test
interrupt_input_blocked, instead of testing HAVE_X_WINDOWS and
x_input_blocked.
Block the processing of interrupt input while we're manipulating the
malloc heap.
* alloc.c: (xfree): New function, to make it easy to free things
safely.
(xmalloc, xrealloc): Block X input while doing the deed.
(VALIDATE_LISP_STORAGE, gc_sweep, compact_strings): Use xfree
instead of free.
(uninterrupt_malloc): New function, to install input-blocking
hooks into the GNU malloc routines.
* emacs.c [not SYSTEM_MALLOC] (main): Call uninterrupt_malloc
on startup.
* alloc.c: (make_interval, make_float, Fcons, Fmake_vector,
Fmake_symbol, Fmake_marker, make_uninit_string, Fgarbage_collect):
Use xmalloc instead of malloc; don't bother to check if out of
memory here.
(Fgarbage_collect): Call xrealloc instead of realloc.
* buffer.c: Use xmalloc and xfree instead of malloc and free;
don't bother to check if out of memory here.
(Fget_buffer_create): Put BLOCK_INPUT/UNBLOCK_INPUT pair around
calls to ralloc routines.
* insdel.c: Same.
* lisp.h (xfree): New extern declaration.
* xfaces.c (xfree): Don't #define this to be free; use the
definition in alloc.c.
* dispnew.c, doc.c, doprnt.c, fileio.c, lread.c, term.c, xfns.c,
xmenu.c, xterm.c: Use xfree instead of free.
* hftctl.c: Use xfree and xmalloc instead of free and malloc.
* keymap.c (current_minor_maps): BLOCK_INPUT while calling realloc
and malloc.
* search.c: Since the regexp routines can malloc, BLOCK_INPUT
while runing them. #include blockinput.h.
* sysdep.c: #include blockinput.h. Call xfree and xmalloc instead
of free and malloc. BLOCK_INPUT around routines which we know
will call malloc.
ymakefile (keyboard.o, keymap.o, search.o, sysdep.o, xfaces.o,
xfns.o, xmenu.o, xterm.o, xselect.o, alloc.o, eval.o): Note that
these depend on blockinput.h.
1993-03-31 10:55:33 +00:00
|
|
|
if ((p.c = xmalloc(size)) == NULL) /* malloc one area */
|
1992-01-13 21:48:08 +00:00
|
|
|
return (-1);
|
|
|
|
|
|
|
|
memcpy (p.c, &req, sizeof (req)); /* copy CTL REQ struct */
|
|
|
|
memcpy (p.c + sizeof (req), cmd, cmdlen); /* copy arg struct */
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
p.req = &req; /* otherwise use only CTL REQ */
|
|
|
|
size = sizeof (req);
|
|
|
|
}
|
|
|
|
|
|
|
|
/* write request to terminal */
|
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
|
|
|
if (emacs_write (fd, p.c, size) == -1) return (-1);
|
1992-01-13 21:48:08 +00:00
|
|
|
if (p.req != &req) /* free if allocated */
|
Put interrupt input blocking in a separate file from xterm.h.
This isn't specific to X, and it allows us to avoid #including
xterm.h in files that don't really have anything to do with X.
* blockinput.h: New file.
* xterm.h (BLOCK_INPUT, UNBLOCK_INPUT, TOTALLY_UNBLOCK_INPUT,
UNBLOCK_INPUT_RESIGNAL): These are now in blockinput.h.
(x_input_blocked, x_pending_input): Deleted; there are analogs
in blockinput.h called interrupt_input_blocked and
interrupt_input_pending.
* keyboard.c (interrupt_input_blocked, interrupt_input_pending):
New variables, used by the macros in blockinput.h.
* xterm.c: #include blockinput.h.
(x_input_blocked, x_pending_input): Deleted.
(XTread_socket): Test and set interrupt_input_blocked and
interrupt_input_pending instead of the old variables.
* alloc.c, xfaces.c, xfns.c, xmenu.c, xselect.c, keymap.c:
#include blockinput.h.
* eval.c: #include blockinput.h instead of xterm.h.
* keyboard.c: #include blockinput.h.
(input_poll_signal): Just test
interrupt_input_blocked, instead of testing HAVE_X_WINDOWS and
x_input_blocked.
Block the processing of interrupt input while we're manipulating the
malloc heap.
* alloc.c: (xfree): New function, to make it easy to free things
safely.
(xmalloc, xrealloc): Block X input while doing the deed.
(VALIDATE_LISP_STORAGE, gc_sweep, compact_strings): Use xfree
instead of free.
(uninterrupt_malloc): New function, to install input-blocking
hooks into the GNU malloc routines.
* emacs.c [not SYSTEM_MALLOC] (main): Call uninterrupt_malloc
on startup.
* alloc.c: (make_interval, make_float, Fcons, Fmake_vector,
Fmake_symbol, Fmake_marker, make_uninit_string, Fgarbage_collect):
Use xmalloc instead of malloc; don't bother to check if out of
memory here.
(Fgarbage_collect): Call xrealloc instead of realloc.
* buffer.c: Use xmalloc and xfree instead of malloc and free;
don't bother to check if out of memory here.
(Fget_buffer_create): Put BLOCK_INPUT/UNBLOCK_INPUT pair around
calls to ralloc routines.
* insdel.c: Same.
* lisp.h (xfree): New extern declaration.
* xfaces.c (xfree): Don't #define this to be free; use the
definition in alloc.c.
* dispnew.c, doc.c, doprnt.c, fileio.c, lread.c, term.c, xfns.c,
xmenu.c, xterm.c: Use xfree instead of free.
* hftctl.c: Use xfree and xmalloc instead of free and malloc.
* keymap.c (current_minor_maps): BLOCK_INPUT while calling realloc
and malloc.
* search.c: Since the regexp routines can malloc, BLOCK_INPUT
while runing them. #include blockinput.h.
* sysdep.c: #include blockinput.h. Call xfree and xmalloc instead
of free and malloc. BLOCK_INPUT around routines which we know
will call malloc.
ymakefile (keyboard.o, keymap.o, search.o, sysdep.o, xfaces.o,
xfns.o, xmenu.o, xterm.o, xselect.o, alloc.o, eval.o): Note that
these depend on blockinput.h.
1993-03-31 10:55:33 +00:00
|
|
|
xfree (p.c);
|
1992-01-13 21:48:08 +00:00
|
|
|
return (0);
|
1990-09-27 21:17:59 +00:00
|
|
|
|
|
|
|
}
|