zsh-workers
 help / color / mirror / code / Atom feed
* fg/bg on FreeBSD.
@ 2000-05-06 15:03 Tanaka Akira
  2000-05-06 17:08 ` Bart Schaefer
  0 siblings, 1 reply; 10+ messages in thread
From: Tanaka Akira @ 2000-05-06 15:03 UTC (permalink / raw)
  To: zsh-workers

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 <C-z>.

| 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


^ permalink raw reply	[flat|nested] 10+ messages in thread
* Re: fg/bg on FreeBSD.
@ 2000-05-08  8:48 Sven Wischnowsky
  2000-05-08  9:17 ` Tanaka Akira
  0 siblings, 1 reply; 10+ messages in thread
From: Sven Wischnowsky @ 2000-05-08  8:48 UTC (permalink / raw)
  To: zsh-workers


Tanaka Akira wrote:

> 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.

Indeed. Why no patch for this? In other words: have I missed something?


Bye
 Sven


--
Sven Wischnowsky                         wischnow@informatik.hu-berlin.de


^ permalink raw reply	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2000-05-08  9:17 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2000-05-06 15:03 fg/bg on FreeBSD 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
2000-05-08  8:48 Sven Wischnowsky
2000-05-08  9:17 ` Tanaka Akira

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).