From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 18019 invoked from network); 6 May 2000 15:02:28 -0000 Received: from sunsite.auc.dk (130.225.51.30) by ns1.primenet.com.au with SMTP; 6 May 2000 15:02:28 -0000 Received: (qmail 16168 invoked by alias); 6 May 2000 15:02:18 -0000 Mailing-List: contact zsh-workers-help@sunsite.auc.dk; run by ezmlm Precedence: bulk X-No-Archive: yes X-Seq: 11232 Received: (qmail 16118 invoked from network); 6 May 2000 15:02:14 -0000 To: zsh-workers@sunsite.auc.dk Subject: fg/bg on FreeBSD. 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 00:03:14 +0900 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) On FreeBSD 3.4 and 4.0, fg/bg may not activate suspended process. | Z:akr@dhcp21% ktrace zsh -f Start zsh with kernel trace. | dhcp21% echo|sleep 10 | ^Z | zsh: done echo | | zsh: suspended sleep 10 Start `echo|sleep 10' and immediately suspend it by . | dhcp21% jobs -l | [1] + 754 done echo | | 755 suspended sleep 10 Report the job info. echo's PID is 754 and it's already done. sleep's PID is 755 and it's suspended. | dhcp21% ps j755 | USER PID PPID PGID SESS JOBC STAT TT TIME COMMAND | akr 755 753 755 92fdc0 1 T p1 0:00.00 sleep 10 Check the process status by ps. `T' on `STAT' field shows that it's stopped. | dhcp21% bg | [1] + done echo | | continued sleep 10 Resume the job on a background. It seems resumed, but ... | dhcp21% ps j755 | USER PID PPID PGID SESS JOBC STAT TT TIME COMMAND | akr 755 753 755 92fdc0 1 T p1 0:00.00 sleep 10 Check the process status by ps again. The process is not resumed. | dhcp21% kill -9 755 | [1] + done echo | | killed sleep 10 | dhcp21% exit kill the process and exit. | Z:akr@dhcp21% kdump|grep kill | 753 zsh CALL kill(0xfffffd0d,0) # kill(-755,0) | 753 zsh RET kill 0 | 753 zsh CALL kill(0xfffe7960,0) # kill(-100000,0) | 753 zsh RET kill -1 errno 3 No such process | 753 zsh CALL kill(0xfffffd0e,0x13) # kill(-754,SIGCONT) | 753 zsh RET kill -1 errno 3 No such process | 753 zsh CALL kill(0xfffe7960,0) # kill(-100000,0) | 753 zsh RET kill -1 errno 3 No such process | 753 zsh CALL kill(0x2f3,0x9) # kill(755,SIGKILL) | 753 zsh RET kill 0 | killed sleep 10 | Z:akr@dhcp21% There are `kill system call' called by zsh. I suppose the system call correspondding to the `bg' is `kill(-754,SIGCONT)'. It's failed because the process group 754 is not exist. I think it is wrong that the sleep process has process group 755 rather than 754. Because zsh assigns a process group as a process number of first component of a pipe. Note that if `fg' is used for resume the job, zsh hangs. -- Tanaka Akira