Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!mnetor!seismo!lll-crg!nike!sri-spam!mordor!ehj From: ehj@mordor.ARPA (Eric H Jensen) Newsgroups: net.emacs Subject: Re: Inferior process violates gnuemacs 1st ammendment? Message-ID: <14636@mordor.ARPA> Date: Thu, 14-Aug-86 14:57:05 EDT Article-I.D.: mordor.14636 Posted: Thu Aug 14 14:57:05 1986 Date-Received: Thu, 14-Aug-86 21:53:27 EDT References: <1508@mcc-pp.UUCP> Reply-To: ehj@mordor.UUCP (Eric H Jensen) Organization: S-1 Project, LLNL Lines: 99 Keywords: hot-shots, pipes, send-region, @$**&! In article <1508@mcc-pp.UUCP> tiemann@mcc-pp.UUCP (Michael Tiemann) writes: >On our SUN-3 about the 4th "ESC-4" the error message "writing to process: >operation would block, cat" pops up. If we continue to type "ESC-$", >the error sometimes comes up, and sometimes does not. On our VAX >11/750 "running" (walking) BDS 4.2, there is no error message, but the >gnuemacs shows up as Idle in ps -ux. (A few ^G's wake it into >abortion-land). I believe I had a similar problem to yours (GNUemacs 17.49). The cause is that emacs does an ioctl instructing unix that writes to the pipe should not block (which, I believe, is for most purposes is the right thing). After thinking about it and consulting with our local unix guru I came up with the following changes (hope this helps): *** process.c.orig Thu May 29 17:04:36 1986 --- process.c Wed Jun 4 14:15:20 1986 *************** *** 166,171 **** --- 166,174 ---- Always -1 on systems that support FIONREAD. */ int proc_buffered_char[MAXDESC]; + + Lisp_Object Vwait_no_block; + #ifdef HAVE_PTYS *************** *** 1201,1206 **** --- 1204,1217 ---- { /* Don't use register vars; longjmp can lose them. */ int rv; + int fd; + + #ifdef HAVE_TIMEVAL + struct timeval sd; + int usec; + int sv; + #endif /* HAVE_TIMEVAL */ + unsigned char *procname = XSTRING (XPROCESS (proc)->name)->data; if ((XFASTINT (XPROCESS (proc)->flags) & PROC_STATUS) != RUNNING) *************** *** 1211,1217 **** if (!setjmp (send_process_frame)) while (len > 0) { ! rv = write (XFASTINT (XPROCESS (proc)->outfd), buf, len); if (rv < 0) break; buf += rv; --- 1222,1239 ---- if (!setjmp (send_process_frame)) while (len > 0) { ! fd = XFASTINT (XPROCESS (proc)->outfd); ! ! #ifdef HAVE_TIMEVAL ! if (XTYPE (Vwait_no_block) == Lisp_Int) ! sd.tv_usec = XUINT (Vwait_no_block); ! else sd.tv_usec = 0; ! sd.tv_sec = 0; ! usec = 1 << fd; ! sv = select (fd + 1, 0,&usec, 0, &sd); ! #endif /* HAVE_TIMEVAL */ ! ! rv = write (fd, buf, len); if (rv < 0) break; buf += rv; *************** *** 1694,1699 **** --- 1716,1729 ---- staticpro (&Qprocessp); staticpro (&Vprocess_alist); + + DefLispVar ("wait-no-block", &Vwait_no_block, + "*If integer, unsigned value indicates number of microseconds \n\ + for select to wait before writing to a subprocess. This mechanism \n\ + is provided because Emacs refuses to block on writes to subprocesses.\n\ + A non-integer value is equivalent to 0. The default value is 50000."); + + Vwait_no_block = XFASTINT(50000); DefBoolVar ("delete-exited-processes", &delete_exited_processes, "*Non-nil means delete processes immediately when they exit.\n\ -- eric h. jensen (S1 Project @ Lawrence Livermore National Laboratory) Phone: (415) 423-0229 USMail: LLNL, P.O. Box 5503, L-276, Livermore, Ca., 94550 ARPA: ehj@angband UUCP: ...!decvax!decwrl!mordor!angband!ehj