zsh-workers
 help / color / mirror / code / Atom feed
From: Tanaka Akira <akr@m17n.org>
To: zsh-workers@sunsite.auc.dk
Subject: Re: fg/bg on FreeBSD.
Date: 07 May 2000 04:03:56 +0900	[thread overview]
Message-ID: <hvowvl7mrfn.fsf@serein.m17n.org> (raw)
In-Reply-To: <1000506184503.ZM6391@candle.brasslantern.com> (Bart Schaefer's message of "Sat, 6 May 2000 18:45:03 +0000")

In article <1000506184503.ZM6391@candle.brasslantern.com>,
  "Bart Schaefer" <schaefer@candle.brasslantern.com> writes:

> OK, now, can you "fg" it, wait for the first sleep (but not the second)
> to exit, then ^Z again and check the PGIDs?

| Z:akr@dhcp21% ktrace -i zsh -f
| dhcp21% sleep 30|sleep 100
| ^Z
| zsh: suspended  sleep 30 | sleep 100
| dhcp21% jobs -l
| [1]  + 29347 suspended  sleep 30 | 
|        29348 suspended  sleep 100
| dhcp21% ps j   
| USER   PID  PPID  PGID   SESS JOBC STAT  TT       TIME COMMAND
| akr  29335 29333 29335 a0fe80    0 Is    p0    0:00.11 /home/akr/.zsh/arch/i386-unknown-freebsd4.0/bin/zsh -l
| akr  29346 29335 29346 a0fe80    1 S     p0    0:00.07 zsh -f
| akr  29347 29346 29347 a0fe80    2 T     p0    0:00.00 sleep 30
| akr  29348 29346 29347 a0fe80    2 T     p0    0:00.00 sleep 100
| akr  29349 29346 29349 a0fe80    1 R+    p0    0:00.00 ps j

PGID of `sleep 100' is both 29347.  No problem.

| dhcp21% fg
| [1]  + continued  sleep 30 | sleep 100
| ^Z
| zsh: done       sleep 30 | 
| zsh: suspended  sleep 100
| dhcp21% ps j
| USER   PID  PPID  PGID   SESS JOBC STAT  TT       TIME COMMAND
| akr  29335 29333 29335 a0fe80    0 Is    p0    0:00.11 /home/akr/.zsh/arch/i386-unknown-freebsd4.0/bin/zsh -l
| akr  29346 29335 29346 a0fe80    1 S     p0    0:00.08 zsh -f
| akr  29348 29346 29347 a0fe80    1 T     p0    0:00.00 sleep 100
| akr  29365 29346 29365 a0fe80    1 R+    p0    0:00.00 ps j
| akr  29352 29350 29352 9099c0    0 Ss+   p1    0:00.12 /home/akr/.zsh/arch/i386-unknown-freebsd4.0/bin/zsh -l
| dhcp21% 

The PGID is not changed: 29347.

> Another test to try:
> 
> 	echo | sleep 100 | sleep 200
> 
> If you ^Z this, do both sleeps get the same PGID, or do they each become
> their own process group?  (I'm hoping the latter, for sanity, otherwise
> it's a guessing game as to what PID becomes the leader.)

Wow!  This cannot stop with ^Z.

| Z:akr@dhcp21% zsh -f
| dhcp21% echo $$
| 29385
| dhcp21% tty
| /dev/ttyp0
| dhcp21% echo | sleep 100 | sleep 200
| ^Z

`ps j' from another termianl before ^Z:

| Z:akr@dhcp21% ps j         
| USER   PID  PPID  PGID   SESS JOBC STAT  TT       TIME COMMAND
| akr  29335 29333 29335 a0fe80    0 Ss    p0    0:00.12 /home/akr/.zsh/arch/i386
| akr  29385 29335 29385 a0fe80    1 S     p0    0:00.03 zsh -f
| akr  29388 29385 29388 a0fe80    1 S     p0    0:00.00 sleep 100
| akr  29389 29385 29389 a0fe80    1 S+    p0    0:00.00 sleep 200
| akr  29352 29350 29352 9099c0    0 Ss    p1    0:00.14 /home/akr/.zsh/arch/i386
| akr  29390 29352 29390 9099c0    1 R+    p1    0:00.00 ps j

Hm.  Two sleep commands has own PGID.  They are both process group leader.

`ps j' from another termianl after ^Z:

| Z:akr@dhcp21% ps j
| USER   PID  PPID  PGID   SESS JOBC STAT  TT       TIME COMMAND
| akr  29335 29333 29335 a0fe80    0 Is    p0    0:00.12 /home/akr/.zsh/arch/i386
| akr  29385 29335 29385 a0fe80    1 S     p0    0:00.03 zsh -f
| akr  29388 29385 29388 a0fe80    1 S     p0    0:00.00 sleep 100
| akr  29389 29385 29389 a0fe80    1 T+    p0    0:00.00 sleep 200
| akr  29352 29350 29352 9099c0    0 Ss    p1    0:00.14 /home/akr/.zsh/arch/i386
| akr  29391 29352 29391 9099c0    1 R+    p1    0:00.00 ps j

Only `sleep 200' is stopped because foreground process group for ttyp0
is 29389.  Maybe.
-- 
Tanaka Akira


  reply	other threads:[~2000-05-06 19:03 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2000-05-06 15:03 Tanaka Akira
2000-05-06 17:08 ` Bart Schaefer
2000-05-06 17:48   ` Tanaka Akira
2000-05-06 18:45     ` Bart Schaefer
2000-05-06 19:03       ` Tanaka Akira [this message]
2000-05-06 19:58     ` Tanaka Akira
2000-05-06 21:23       ` Bart Schaefer
2000-05-06 21:41         ` Tanaka Akira
2000-05-08  8:48 Sven Wischnowsky
2000-05-08  9:17 ` Tanaka Akira

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=hvowvl7mrfn.fsf@serein.m17n.org \
    --to=akr@m17n.org \
    --cc=zsh-workers@sunsite.auc.dk \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).