On Sun 01 Apr 2001, Geoff Wing wrote:
> Paul Slootman <[EMAIL PROTECTED]> typed:
> : On Sat 30 Sep 2000, Geoff Wing wrote:
> : It appears that "test -e" isn't standard; "-c" might be a better choice
> : (I'm guessing /dev/ptym/clone is a character special device).
> : After fixing this, it reports
> :   pty/tty type:               GLIBC
> : which makes me wonder a bit, I don't think solaris uses glibc...

Now it reports
   pty/tty type:               STREAMS
which looks a lot better!

> Second patch makes sure /dev/tty is reassociated with the tty (as
> a controlling tty) when certain OS-specific ioctl()s aren't available.

> diff -u -r1.69 init.c
> --- src/init.c        2001/03/23 06:15:37     1.69
> +++ src/init.c        2001/04/01 08:12:27
> @@ -1137,6 +1137,12 @@
>      ioctl(r->tty_fd, TIOCSCTTY, 0);
>  # elif defined(TIOCSETCTTY)
>      ioctl(r->tty_fd, TIOCSETCTTY, 0);
> +# else
> +    fd = open(r->h->ttydev, O_RDWR);

Make this
        int fd = open(r->h->ttydev, O_RDWR);
        ^^^
otherwise it complains about fd not being declared...

It compiles with this, but still doesn't work. It now dies without any
error; DEBUG_TTY says:

ontrol_tty(): pid: 8783, tty fd: 6, dev: /dev/pts/15
rxvt_control_tty(): /dev/tty has controlling tty? no (good)
rxvt_control_tty(): tty opened OK
rxvt_control_tty(): do we have controlling tty now: yes (good)
rxvt_control_tty(): tcgetpgrp(): 8783  getpgrp(): 8783

and that's the last I see.

Running with -e sh -c '/bin/stty -a; sleep 100' I see a window opened,
and the following output:
        stty: : Invalid argument
(the cursor is below the end of the text, i.e. -opost :-)

truss says:

8980:   ioctl(0, STGET, 0x0002643C)                     Err#22 EINVAL
8980:   ioctl(0, TCGETS, 0x00026460)                    Err#22 EINVAL
8980:   ioctl(0, TCGETA, 0x0002644C)                    Err#22 EINVAL
8980:   write(2, " s t t y :  ", 6)                     = 6
8972:   poll(0xEFFFCF30, 2, -1)                         = 1
8980:   write(2, " :  ", 2)                             = 2
8972:   read(5, " s t t y :   :  ", 1024)               = 8
8972:   read(5, " I n v a l i d   a r g u".., 1016)     = 16
8980:   write(2, " I n v a l i d   a r g u".., 16)      = 16

Aha! The streams modules aren't being pushed. The following patches
are needed (includes the fd thing I already mentioned):

--- rxvt.cvs/src/init.c Mon Apr  2 13:19:05 2001
+++ rxvt/src/init.c     Mon Apr  2 13:23:26 2001
@@ -1143,7 +1143,7 @@
 
        ioctl(STDIN_FILENO, TIOCCONS, &on);
 #elif defined (SRIOCSREDIR)
-       fd = open(CONSOLE, O_WRONLY, 0);
+       int fd = open(CONSOLE, O_WRONLY, 0);
        if (fd >= 0) {
            if (ioctl(fd, SRIOCSREDIR, NULL) < 0)
                close(fd);
--- rxvt.cs/src/init.h  Fri Mar 23 07:15:37 2001
+++ rxvt/src/init.h     Mon Apr  2 13:45:40 2001
@@ -16,7 +16,6 @@
 
 #if defined(PTYS_ARE_PTMX) && !defined(__CYGWIN32__)
 # include <sys/resource.h>     /* for struct rlimit */
-# include <sys/stropts.h>      /* for I_PUSH */
 # define _NEW_TTY_CTRL         /* to get proper defines in <termios.h> */
 #endif
 
--- rxvt.cvs/src/ptytty.c       Mon Apr  2 09:32:35 2001
+++ rxvt/src/ptytty.c   Mon Apr  2 13:45:55 2001
@@ -23,6 +23,10 @@
 
 #include "../config.h"         /* NECESSARY */
 
+#if defined(PTYS_ARE_PTMX) && !defined(__CYGWIN32__)
+# include <sys/stropts.h>      /* for I_PUSH */
+#endif
+
 /*
  * Try to be self-contained except for the above autoconfig'd defines
  */


This seems to make it work.
BTW, my unscientific timings of the 2.6.2 version and the current CVS:

time locate / | wc
   81819   81819 5323527

real    0m0.259s
user    0m0.400s
sys     0m0.060s

I.e. 5MB over 81000 lines, locate itself barely using CPU.

[2.6.2] time /usr/local/bin/rxvt -e locate /
real    0m24.653s
user    0m2.650s
sys     0m2.020s

[CVS] time src/rxve -e locate /
real    0m7.467s
user    0m2.890s
sys     0m1.950s


This is on a remote display (Xoftware from Chameleon on win95), 500
scrollback lines, 24x80, default font size).
Good work!


Paul Slootman
-- 
home:       [EMAIL PROTECTED]      http://www.wurtel.demon.nl/
work:       [EMAIL PROTECTED]       http://www.murphy.nl/
debian:     [EMAIL PROTECTED]      http://www.debian.org/
isdn4linux: [EMAIL PROTECTED]  http://www.isdn4linux.org/

Reply via email to