zsh-workers
 help / color / mirror / code / Atom feed
From: Tanaka Akira <akr@m17n.org>
To: zsh-workers@sunsite.auc.dk
Subject: fg/bg on FreeBSD.
Date: 07 May 2000 00:03:14 +0900	[thread overview]
Message-ID: <hvo3dnvoh59.fsf@serein.m17n.org> (raw)

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


             reply	other threads:[~2000-05-06 15:02 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2000-05-06 15:03 Tanaka Akira [this message]
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

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