Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 14 Sep 2000 20:47:21 -0400 (EDT)
From:      Zhiui Zhang <zzhang@cs.binghamton.edu>
To:        Mike Meyer <mwm@mired.org>
Cc:        questions@freebsd.org
Subject:   Re: write to terminal in a background process
Message-ID:  <Pine.SOL.4.21.0009142040540.7747-100000@opal>
In-Reply-To: <14785.27988.529047.912155@guru.mired.org>

next in thread | previous in thread | raw e-mail | index | archive | help


On Thu, 14 Sep 2000, Mike Meyer wrote:

> Zhiui Zhang writes:
> > I thought a background process can not write to terminal. It will get a
> > signal if trying to do so. But someone presents me a small program:
> 
> No, it *may* not be able to write to the terminal, depending on the
> terminals modes. See "man stty", particularly the "tostop" option.
> 
> > #include
> > main()
> > {
> > 	printf("printing\n");
> > }
> > 
> > $ a.out &
> > 
> > and it does print. Can anyone explain this to me?  Thanks.
> 
> Try
> $ stty tostop
> $ a.out &
> 
> and see what it does (or maybe it's "stty -tostop").

You are right! I just tested it and it worked. May I ask you another
question?  If several foreground processes reading from the stdin, will
the keyboard inputs be accepted by them in a round-robin fashion? Thanks.

-Zhihui



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




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?Pine.SOL.4.21.0009142040540.7747-100000>