Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 4 Sep 2002 12:11:10 +0100
From:      "Duncan Barclay" <dmlb@dmlb.org>
To:        "John E Hein" <jhein@timing.com>
Cc:        "Mark Santcroos" <marks@ripe.net>, <emulation@FreeBSD.ORG>
Subject:   Re: TIOCSCTTY not implemented in linuxulator?
Message-ID:  <001b01c25403$c65353e0$6d6020c2@pc598cam>
References:  <XFMail.20020903224917.dmlb@computer.my.domain><20020904020952.GB7157@dhcp01.pn.xcllnt.net><20020904064620.GA713@laptop.6bone.nl><000801c253f7$2cae8ea0$6d6020c2@pc598cam> <15733.59121.143526.699051@brain.timing.com>

next in thread | previous in thread | raw e-mail | index | archive | help
From: "John E Hein" <jhein@timing.com>
Sent: Wednesday, September 04, 2002 11:56 AM

[sorry about quoting/format, using outlook at ${REALJOB}]

> Duncan Barclay wrote at 10:40 +0100 on Sep  4:
>  > > Hi Duncan,
>  > >
>  > > Can you find out (ktrace) to which devices it is sending these
ioctls?
>  >
>  > It's the tty side of a pty/ttp pair. Matlab spawns a subprocess, and
it's
>  > the subprocess that issues these ioctls.
>
> See this freebsd-emulation thread ("can't quit matlab"):
>
http://groups.google.com/groups?hl=en&lr=&ie=UTF-8&oe=UTF-8&frame=right&th=2
06ec3e38e06e5d2&seekm=15218.39637.311548.512594_localhost.econ.vt.edu%40ns.s
ol.net#link1
>
> Note that the 540e is TIOCSCTTY:
>
> /usr/src/linux-2.2.19/include/asm-i386/ioctls.h:#define TIOCSCTTY
0x540E
>
> Particularly look at the 3rd message in the thread that talks about the
>  /dev/ptmx workaround and unix98 ptys.
> If someone could solve this, it'd be great.
>

Yup, this is the problem I'm trying to solve. Exiting without using the
/dev/ptmx problem.

ktrace output on spawned matlab process.

 54357 matlab_helper NAMI  "/compat/linux/dev/ttyp2"
 54357 matlab_helper NAMI  "/dev/ttyp2"
 54357 matlab_helper RET   linux_newstat 0
 54357 matlab_helper CALL  setsid
 54357 matlab_helper RET   setsid 54357/0xd455
 54357 matlab_helper CALL  linux_open(0xbfbfed58,0x2,0x60)
 54357 matlab_helper NAMI  "/compat/linux/dev/ttyp2"
 54357 matlab_helper NAMI  "/dev/ttyp2"
 54357 matlab_helper RET   linux_open 4
 54357 matlab_helper CALL  linux_ioctl(0x4,TIOCSER_TEMT,0x8049362)
 54357 matlab_helper RET   linux_ioctl -1 errno 22 Invalid argument
 54357 matlab_helper CALL  linux_ioctl(0x4,TIOCSER_TEMT,0x8049367)
 54357 matlab_helper RET   linux_ioctl -1 errno 22 Invalid argument
 54357 matlab_helper CALL  linux_ioctl(0x4,TIOCSCTTY,0x8049362)
 54357 matlab_helper RET   linux_ioctl -1 errno 22 Invalid argument
 54357 matlab_helper CALL  getpgrp
 54357 matlab_helper RET   getpgrp 54357/0xd455
 54357 matlab_helper CALL  linux_ioctl(0x4,TIOCSPGRP,0xbfbfecb4)
 54357 matlab_helper RET   linux_ioctl 0
 54357 matlab_helper CALL  read(0,0xbfbfecfc,0x4)
[end of trace]

Trying to quit matlab causes it to hang, kill -9 works. If I start
matlab with
    /usr/local/bin/matlab -glnx86 -nosplash -nodesktop
so I get matlab running in a terminal, after the kill -9, the terminal
doesn't receive keyboard input.

Adding
        case LINUX_TIOCSCTTY:
                args->cmd = TIOCSCTTY;
                return (ioctl(p, (struct ioctl_args *)args));
to /sys/compat/linux/linux_ioctl.h, correctly restores the terminal but does
not fix the exit problem itself. i.e. kill -9 is still needed.

Duncan

________________________________________________________________________
Duncan Barclay  | God smiles upon the little children,
dmlb@dmlb.org   | the alcoholics, and the permanently stoned.
dmlb@freebsd.org| Steven King
________________________________________________________________________




To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-emulation" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?001b01c25403$c65353e0$6d6020c2>