From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 21518 invoked from network); 6 May 2000 21:40:32 -0000 Received: from sunsite.auc.dk (130.225.51.30) by ns1.primenet.com.au with SMTP; 6 May 2000 21:40:32 -0000 Received: (qmail 14857 invoked by alias); 6 May 2000 21:40:23 -0000 Mailing-List: contact zsh-workers-help@sunsite.auc.dk; run by ezmlm Precedence: bulk X-No-Archive: yes X-Seq: 11241 Received: (qmail 14804 invoked from network); 6 May 2000 21:40:19 -0000 To: zsh-workers@sunsite.auc.dk Subject: Re: fg/bg on FreeBSD. References: <1000506170828.ZM2063@candle.brasslantern.com> <1000506212352.ZM8935@candle.brasslantern.com> MIME-Version: 1.0 (generated by SEMI 1.13.7 - "Awazu") Content-Type: text/plain; charset=US-ASCII From: Tanaka Akira Date: 07 May 2000 06:41:19 +0900 In-Reply-To: <1000506212352.ZM8935@candle.brasslantern.com> (Bart Schaefer's message of "Sat, 6 May 2000 21:23:52 +0000") Message-ID: User-Agent: T-gnus/6.14.1 (based on Gnus v5.8.3) (revision 16) SEMI/1.13.7 (Awazu) FLIM/1.13.2 (Kasanui) Emacs/20.6 (i686-pc-linux-gnu) MULE/4.0 (HANANOEN) In article <1000506212352.ZM8935@candle.brasslantern.com>, "Bart Schaefer" 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