public inbox for linuxppc-dev@ozlabs.org 
 help / color / mirror / Atom feed
From: Scott Anderson <scott_anderson@mvista•com>
To: gopi@india•tejasnetworks.com
Cc: linuxppc-dev@lists•linuxppc.org
Subject: Re: why is tty->pgrp set to -1 for console?
Date: Thu, 31 Jan 2002 13:34:34 -0800	[thread overview]
Message-ID: <3C59B86A.E24F89A1@mvista.com> (raw)
In-Reply-To: Pine.LNX.4.21.0201312050570.1490-100000@tn100build.india.tejasnetworks.com


gopi@india•tejasnetworks.com wrote:
>   What is the correct procedure to follow to get around this problem
> and get ctrl-c working on console?

It looks like everyone is taking a swing at this one, so I think I'll
join in.  First off, the easiest way I've found to track down why
ctrl-c doesn't work is to just run "ps -j".  For ctrl-c to work, you
need a controlling terminal (the TTY column) and a process group.  If
you have a '?' in the TTY column, ctrl-c won't work.  In the past I
have seen this happen because of this code in drivers/char/tty_io.c:
        if (device == SYSCONS_DEV) {
                struct console *c = console_drivers;
                while(c && !c->device)
                        c = c->next;
                if (!c)
                        return -ENODEV;
                device = c->device(c);
                filp->f_flags |= O_NONBLOCK; /* Don't let /dev/console block */
                noctty = 1;
        }
Note that O_NOCTTY (no controlling terminal) is forced on whenever
/dev/console is opened (noctty = 1).  Possible workarounds:
  1) Run getty on something other than /dev/console.  For example,
     if you console is on the first serial port, run getty on /dev/ttyS0.
     I believe this is the "correct" answer.
  2) You could also change getty to do a TIOCSCTTY ioctl explicitly after
     it has opened the terminal.
  3) You could remove the forcing of noctty on from tty_io.c

    Scott Anderson
    scott_anderson@mvista•com   MontaVista Software Inc.
    (408)328-9214               1237 East Arques Ave.
    http://www.mvista.com       Sunnyvale, CA  94085

** Sent via the linuxppc-dev mail list. See http://lists.linuxppc.org/

  parent reply	other threads:[~2002-01-31 21:34 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2002-01-30 12:14 kernel hang when machine_restart called from isr gopi
2002-01-31 20:58 ` why is tty->pgrp set to -1 for console? gopi
2002-01-31 17:09   ` Daniel Jacobowitz
2002-01-31 21:34   ` Scott Anderson [this message]
2002-02-01 19:12     ` gopi
2002-02-21  0:53   ` Unable to write to SIMASK gopi
2002-02-20 21:27     ` Ricardo Scop
2002-02-21 17:34       ` gopi
  -- strict thread matches above, loose matches on Subject: below --
2002-01-31 19:14 why is tty->pgrp set to -1 for console? David Boutcher
2002-01-31 20:49 ` mod+linuxppc-dev
2002-01-31 20:53 ` Dan Malek

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=3C59B86A.E24F89A1@mvista.com \
    --to=scott_anderson@mvista$(echo .)com \
    --cc=gopi@india$(echo .)tejasnetworks.com \
    --cc=linuxppc-dev@lists$(echo .)linuxppc.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox