zsh-workers
 help / color / mirror / code / Atom feed
* zsh on serial line?
@ 2001-05-01  9:48 Thomas Köhler
  2001-05-01 17:06 ` Bart Schaefer
  0 siblings, 1 reply; 4+ messages in thread
From: Thomas Köhler @ 2001-05-01  9:48 UTC (permalink / raw)
  To: zsh-workers

[-- Attachment #1: Type: text/plain, Size: 928 bytes --]

Hi,
I have a digital VT510 which I connected to my PC's second serial port,
/dev/ttyS1, and on the linux box, I started "mgetty -r /dev/ttyS1".
Well, works fine if login shell is bash: I issue login and password and
get a bash.
But when I try to start zsh (Version is 4.0.1-pre-3), well, it tries to
start, then it hangs forever. When I do "strace -o XXX zsh -f", I get
some output like this:
[snipped lots of syscalls]
readlink("/proc/self/fd/0", "/dev/ttyS1", 4095) = 10
open("/dev/ttyS1", O_RDWR|O_NOCTTY|0x8000

Uhm. It stops when trying to open /dev/ttyS1 - what is it waiting for?
How can I change that?

CU,
Thomas

-- 
 Thomas Köhler Email:   jean-luc@picard.franken.de     | LCARS - Linux
     <><        WWW:     http://jeanluc-picard.de      | for Computers
                IRC:             jeanluc               | on All Real
               PGP public key available from Homepage! | Starships

[-- Attachment #2: Type: application/pgp-signature, Size: 232 bytes --]

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: zsh on serial line?
  2001-05-01  9:48 zsh on serial line? Thomas Köhler
@ 2001-05-01 17:06 ` Bart Schaefer
  2001-05-01 21:23   ` Thomas Köhler
  0 siblings, 1 reply; 4+ messages in thread
From: Bart Schaefer @ 2001-05-01 17:06 UTC (permalink / raw)
  To: Thomas Köhler, zsh-workers

On May 1, 11:48am, Thomas wrote:
} Subject: zsh on serial line?
}
} I have a digital VT510 which I connected to my PC's second serial port,
} /dev/ttyS1, and on the linux box, I started "mgetty -r /dev/ttyS1".
}[...]
} [snipped lots of syscalls]
} readlink("/proc/self/fd/0", "/dev/ttyS1", 4095) = 10
} open("/dev/ttyS1", O_RDWR|O_NOCTTY|0x8000
} 
} Uhm. It stops when trying to open /dev/ttyS1 - what is it waiting for?

It must be this code in init.c:

    /* Make sure the tty is opened read/write. */
    if (isatty(0)) {
        zsfree(ttystrname);
        if ((ttystrname = ztrdup(ttyname(0)))) {
            SHTTY = movefd(open(ttystrname, O_RDWR | O_NOCTTY));

The kernel probably thinks that ttyS1 is a modem line and is imposing the
"two-device / kernel-locking scheme" mentioned under the -b option in the
mgetty manual page.

} How can I change that?

Try using "setserial ^session_lockout ^pgrp_lockout" on the line, but I've
never actually done that so I don't know if it will make any difference.

If that doesn't help, try commenting out the `SHTTY = ...' line so that
the code falls through to this later bit:

        if (SHTTY == -1 && rdwrtty(0)) {
            SHTTY = movefd(dup(0));
        }

However, I'd be concerned that you're going to have problems with any
program that tries to open /dev/tty or /dev/fd/0 or /proc/self/fd/0, so
you probably want to get this cleared up at the device level rather than
in the zsh code.

-- 
Bart Schaefer                                 Brass Lantern Enterprises
http://www.well.com/user/barts              http://www.brasslantern.com

Zsh: http://www.zsh.org | PHPerl Project: http://phperl.sourceforge.net   


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: zsh on serial line?
  2001-05-01 17:06 ` Bart Schaefer
@ 2001-05-01 21:23   ` Thomas Köhler
  2001-05-01 21:28     ` Thomas Köhler
  0 siblings, 1 reply; 4+ messages in thread
From: Thomas Köhler @ 2001-05-01 21:23 UTC (permalink / raw)
  To: zsh-workers

[-- Attachment #1: Type: text/plain, Size: 1911 bytes --]

On Tue, May 01, 2001 at 05:06:47PM +0000,
Bart Schaefer <schaefer@candle.brasslantern.com> wrote:
> 
> On May 1, 11:48am, Thomas wrote:
> } Subject: zsh on serial line?
> }
> } I have a digital VT510 which I connected to my PC's second serial port,
> } /dev/ttyS1, and on the linux box, I started "mgetty -r /dev/ttyS1".
> }[...]
> } [snipped lots of syscalls]
> } readlink("/proc/self/fd/0", "/dev/ttyS1", 4095) = 10
> } open("/dev/ttyS1", O_RDWR|O_NOCTTY|0x8000
> } 
> } Uhm. It stops when trying to open /dev/ttyS1 - what is it waiting for?
> 
> It must be this code in init.c:
> 
>     /* Make sure the tty is opened read/write. */
>     if (isatty(0)) {
>         zsfree(ttystrname);
>         if ((ttystrname = ztrdup(ttyname(0)))) {
>             SHTTY = movefd(open(ttystrname, O_RDWR | O_NOCTTY));
> 
> The kernel probably thinks that ttyS1 is a modem line and is imposing the
> "two-device / kernel-locking scheme" mentioned under the -b option in the
> mgetty manual page.

Good point.

> } How can I change that?
> 
> Try using "setserial ^session_lockout ^pgrp_lockout" on the line, but I've
> never actually done that so I don't know if it will make any difference.

Well, setserial doesn't like "^pgrp_lockout", but "^session_lockout"
seems to help in that I can interrupt the zsh using ^C - but that ends
the zsh session which is not exactly what I want :)

Uhm... the trick is not even that complicated: Just use /sbin/getty
instead of /sbin/mgetty - voila, all works like a charm :-)

Now guess why it's called m(odem)getty and not vtgetty :)

Thanks,
Thomas

-- 
 Thomas Köhler Email:   jean-luc@picard.franken.de     | LCARS - Linux
     <><        WWW:     http://jeanluc-picard.de      | for Computers
                IRC:             jeanluc               | on All Real
               PGP public key available from Homepage! | Starships

[-- Attachment #2: Type: application/pgp-signature, Size: 232 bytes --]

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: zsh on serial line?
  2001-05-01 21:23   ` Thomas Köhler
@ 2001-05-01 21:28     ` Thomas Köhler
  0 siblings, 0 replies; 4+ messages in thread
From: Thomas Köhler @ 2001-05-01 21:28 UTC (permalink / raw)
  To: zsh-workers

[-- Attachment #1: Type: text/plain, Size: 499 bytes --]

On Tue, May 01, 2001 at 11:23:57PM +0200,
Thomas Köhler <jean-luc@picard.franken.de> wrote:
[...]
> Well, setserial doesn't like "^pgrp_lockout",

Silly me. It does if spelled correctly :)

CU,
Thomas

-- 
 Thomas Köhler Email:   jean-luc@picard.franken.de     | LCARS - Linux
     <><        WWW:     http://jeanluc-picard.de      | for Computers
                IRC:             jeanluc               | on All Real
               PGP public key available from Homepage! | Starships

[-- Attachment #2: Type: application/pgp-signature, Size: 232 bytes --]

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2001-05-01 21:29 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2001-05-01  9:48 zsh on serial line? Thomas Köhler
2001-05-01 17:06 ` Bart Schaefer
2001-05-01 21:23   ` Thomas Köhler
2001-05-01 21:28     ` Thomas Köhler

Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/zsh/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).