code review 5700045: os: make Wait return on SIGSTOP on linux (issue 5700045)

14 views
Skip to first unread message

byt...@gmail.com

unread,
Feb 23, 2012, 4:41:22 AM2/23/12
to golan...@googlegroups.com, golan...@googlegroups.com, re...@codereview-hr.appspotmail.com
Reviewers: golang-dev_googlegroups.com,

Message:
Hello golan...@googlegroups.com (cc: golan...@googlegroups.com),

I'd like you to review this change to
https://go.googlecode.com/hg/


Description:
os: make Wait return on SIGSTOP on linux

Fixes issue 3111.

Please review this at http://codereview.appspot.com/5700045/

Affected files:
M src/pkg/os/exec_unix.go


Index: src/pkg/os/exec_unix.go
===================================================================
--- a/src/pkg/os/exec_unix.go
+++ b/src/pkg/os/exec_unix.go
@@ -21,7 +21,7 @@
}
var status syscall.WaitStatus
var rusage syscall.Rusage
- pid1, e := syscall.Wait4(p.Pid, &status, 0, &rusage)
+ pid1, e := syscall.Wait4(p.Pid, &status, syscall.WSTOPPED, &rusage)
if e != nil {
return nil, NewSyscallError("wait", e)
}


minux

unread,
Feb 23, 2012, 4:52:27 AM2/23/12
to byt...@gmail.com, golan...@googlegroups.com, re...@codereview-hr.appspotmail.com
issue description: s/linux/unix/, this is not linux specific change.

Why not add WCONTINUED and WUNTRACED as well?

Scott Lawrence

unread,
Feb 23, 2012, 5:13:02 AM2/23/12
to minux, byt...@gmail.com, golan...@googlegroups.com, re...@codereview-hr.appspotmail.com
Agreed on both; changed.

On Thu, 23 Feb 2012, minux wrote:

> issue description: s/linux/unix/, this is not linux specific change.
>
> Why not add WCONTINUED and WUNTRACED as well?
>

--
Scott Lawrence

Linux jagadai 3.2.5-1-ARCH #1 SMP PREEMPT Tue Feb 7 08:34:36 CET 2012 x86_64 Intel(R) Core(TM)2 Duo CPU P8700 @ 2.53GHz GenuineIntel GNU/Linux

Ian Lance Taylor

unread,
Feb 23, 2012, 8:10:22 AM2/23/12
to byt...@gmail.com, golan...@googlegroups.com, re...@codereview-hr.appspotmail.com
FYI

I understand that it is good to be able to see whether a process has
stopped, but I think there has to be a way to simply wait for a process
to exit. It shouldn't be necessary to call Wait() in a loop.

Ian

Scott Lawrence

unread,
Feb 23, 2012, 11:07:37 AM2/23/12
to Ian Lance Taylor, byt...@gmail.com, golan...@googlegroups.com, re...@codereview-hr.appspotmail.com
Perhaps add WaitSignal with the new behavior, and leave Wait, then?

--

Russ Cox

unread,
Feb 23, 2012, 11:44:29 AM2/23/12
to byt...@gmail.com, golan...@googlegroups.com, re...@codereview-hr.appspotmail.com
No thanks.

Package os is for portable behavior, and this is not portable.
Process.Wait is for waiting for a process to be gone, not
for it to SIGSTOP. If you want the latter, use package
syscall directly.

Russ

Scott Lawrence

unread,
Feb 23, 2012, 11:51:28 AM2/23/12
to Russ Cox, byt...@gmail.com, golan...@googlegroups.com, re...@codereview-hr.appspotmail.com
Is either behavior portable? I ask because right now, the windows
implementation seems more analagous to using WSTOPPED et al.

--

Russ Cox

unread,
Feb 23, 2012, 11:57:15 AM2/23/12
to Scott Lawrence, golan...@googlegroups.com, re...@codereview-hr.appspotmail.com
Process.Wait is defined to wait for the process to
exit/be killed/never going to run again/whatever.
If Windows isn't doing that, that's the bug we should fix.
Reply all
Reply to author
Forward
0 new messages