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 06:41:19 +0900	[thread overview]
Message-ID: <hvoog6jicg0.fsf@serein.m17n.org> (raw)
In-Reply-To: <1000506212352.ZM8935@candle.brasslantern.com> (Bart Schaefer's message of "Sat, 6 May 2000 21:23:52 +0000")

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

> What happens if you reverse the order of the test?
> 
>           if (setpgrp(0L, jobtab[list_pipe_job].gleader) == -1 ||
> 	      killpg(jobtab[list_pipe_job].gleader, 0) == -1) {

Wow!  It's good idea.

| Z:akr@dhcp21% ktrace -i Src/zsh -f 
| dhcp21% echo|sleep 100
| ^Z
| zsh: done       echo | 
| zsh: suspended  sleep 100
| dhcp21% jobs -l
| [1]  + 50065 done       echo | 
|        50066 suspended  sleep 100
| dhcp21% ps j50066
| USER   PID  PPID  PGID   SESS JOBC STAT  TT       TIME COMMAND
| akr  50066 50064 50065 97d1c0    1 T     p0    0:00.00 sleep 100
| dhcp21% bg
| [1]  + done       echo | 
|        continued  sleep 100
| dhcp21% ps j50066
| USER   PID  PPID  PGID   SESS JOBC STAT  TT       TIME COMMAND
| akr  50066 50064 50065 97d1c0    1 S     p0    0:00.00 sleep 100

It's resumed successfully.

| dhcp21% 
| [1]  + done       echo | sleep 100
| dhcp21% exit

> What I'm trying to discover is whether killpg() continues to fail after
> a process is successfully added to the group.

| Z:akr@dhcp21% kdump|egrep 'kill|fork|exit|setpgid|wait'
|  50064 zsh      CALL  fork
|  50064 zsh      RET   fork 50065/0xc391
|  50065 zsh      RET   fork 0
|  50065 zsh      CALL  setpgid(0,0xc391)
|  50065 zsh      RET   setpgid 0
|  50064 zsh      CALL  fork
|  50064 zsh      RET   fork 50066/0xc392
|  50065 zsh      CALL  exit(0)

Now, echo is zombie.

|  50066 zsh      RET   fork 0
|  50066 zsh      CALL  setpgid(0,0xc391)
|  50066 zsh      RET   setpgid 0

sleep comes into the group successfully.

|  50066 zsh      CALL  kill(0xffff3c6f,0)
|  50066 zsh      RET   kill 0

killpg succeeds.

|  50064 zsh      CALL  wait4(0xffffffff,0xbfbff530,0x3,0)
|  50064 zsh      RET   wait4 50065/0xc391
|  50064 zsh      CALL  wait4(0xffffffff,0xbfbff530,0x3,0)
|  50064 zsh      RET   wait4 0
|  50064 zsh      CALL  wait4(0xffffffff,0xbfbff530,0x3,0)
|  50064 zsh      RET   wait4 50066/0xc392

echo is waited.

|  50064 zsh      CALL  wait4(0xffffffff,0xbfbff530,0x3,0)
|  50064 zsh      RET   wait4 0
|  50064 zsh      CALL  fork
|  50064 zsh      RET   fork 50067/0xc393
|  50067 zsh      RET   fork 0
|  50067 zsh      CALL  setpgid(0,0xc393)
|  50067 zsh      RET   setpgid 0
|  50067 ps       CALL  exit(0)
|  50064 zsh      CALL  wait4(0xffffffff,0xbfbff530,0x3,0)
|  50064 zsh      RET   wait4 50067/0xc393
|  50064 zsh      CALL  kill(0xfffe7960,0)
|  50064 zsh      RET   kill -1 errno 3 No such process
|  50064 zsh      CALL  wait4(0xffffffff,0xbfbff530,0x3,0)
|  50064 zsh      RET   wait4 0
|  50064 zsh      CALL  kill(0xffff3c6f,0x13)
|  50064 zsh      RET   kill 0
|  50064 zsh      CALL  fork
|  50064 zsh      RET   fork 50071/0xc397
|  50071 zsh      RET   fork 0
|  50071 zsh      CALL  setpgid(0,0xc397)
|  50071 zsh      RET   setpgid 0
|  50071 ps       CALL  exit(0)
|  50064 zsh      CALL  wait4(0xffffffff,0xbfbff530,0x3,0)
|  50064 zsh      RET   wait4 50071/0xc397
|  50064 zsh      CALL  kill(0xfffe7960,0)
|  50064 zsh      RET   kill -1 errno 3 No such process
|  50064 zsh      CALL  wait4(0xffffffff,0xbfbff530,0x3,0)
|  50064 zsh      RET   wait4 0
|  50064 zsh      CALL  kill(0xffff3c6f,0xf)
|  50064 zsh      RET   kill 0
|  50064 zsh      CALL  wait4(0xffffffff,0xbfbff5c0,0x3,0)
|  50064 zsh      RET   wait4 50066/0xc392
|  50064 zsh      CALL  wait4(0xffffffff,0xbfbff5c0,0x3,0)
|  50064 zsh      RET   wait4 -1 errno 10 No child processes
|  50064 zsh      CALL  exit(0)
-- 
Tanaka Akira


  reply	other threads:[~2000-05-06 21:40 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
2000-05-06 19:58     ` Tanaka Akira
2000-05-06 21:23       ` Bart Schaefer
2000-05-06 21:41         ` Tanaka Akira [this message]
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=hvoog6jicg0.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).