Re: [gofrontend-dev] gccgo and syscall.SysProcAttr.Cloneflags

2014-09-06 Thread Michael Hudson-Doyle
Ian Lance Taylor i...@golang.org writes:

 On Mon, Sep 1, 2014 at 4:18 AM, Michael Hudson-Doyle
 michael.hud...@linaro.org wrote:

 It's late for me and I don't have a proper test case but it seems to me
 that while gccgo's syscall lets you set Cloneflags on its SysProcAttr,
 but doesn't actually *do* anything with the flags.  Am I missing
 something?

 You aren't missing anything.  I made an error in an libgo merge last
 year.  This patch fixes the problem.  

Hi, I can confirm that docker's libcontainer works much better with this
patch!  Thanks for the quick fix.

Cheers,
mwh

 Bootstrapped and ran Go testsuite on x86_64-unknown-linux-gnu.
 Committed to mainline and 4.9 branch.

 Ian

 diff -r da369647d0ec libgo/go/syscall/exec_linux.go
 --- a/libgo/go/syscall/exec_linux.go Fri Sep 05 07:42:57 2014 -0700
 +++ b/libgo/go/syscall/exec_linux.go Fri Sep 05 08:05:22 2014 -0700
 @@ -43,7 +43,7 @@
   // Declare all variables at top in case any
   // declarations require heap allocation (e.g., err1).
   var (
 - r1 Pid_t
 + r1 uintptr
   err1   Errno
   nextfd int
   i  int
 @@ -65,7 +65,7 @@
   // About to call fork.
   // No more allocation or calls of non-assembly functions.
   runtime_BeforeFork()
 - r1, err1 = raw_fork()
 + r1, _, err1 = RawSyscall6(SYS_CLONE,
 uintptr(SIGCHLD)|sys.Cloneflags, 0, 0, 0, 0, 0)
   if err1 != 0 {
   runtime_AfterFork()
   return 0, err1


pgphVdlMFWmUt.pgp
Description: PGP signature


Re: [gofrontend-dev] gccgo and syscall.SysProcAttr.Cloneflags

2014-09-05 Thread Ian Lance Taylor
On Mon, Sep 1, 2014 at 4:18 AM, Michael Hudson-Doyle
michael.hud...@linaro.org wrote:

 It's late for me and I don't have a proper test case but it seems to me
 that while gccgo's syscall lets you set Cloneflags on its SysProcAttr,
 but doesn't actually *do* anything with the flags.  Am I missing
 something?

You aren't missing anything.  I made an error in an libgo merge last
year.  This patch fixes the problem.  Bootstrapped and ran Go
testsuite on x86_64-unknown-linux-gnu.  Committed to mainline and 4.9
branch.

Ian

diff -r da369647d0ec libgo/go/syscall/exec_linux.go
--- a/libgo/go/syscall/exec_linux.go Fri Sep 05 07:42:57 2014 -0700
+++ b/libgo/go/syscall/exec_linux.go Fri Sep 05 08:05:22 2014 -0700
@@ -43,7 +43,7 @@
  // Declare all variables at top in case any
  // declarations require heap allocation (e.g., err1).
  var (
- r1 Pid_t
+ r1 uintptr
  err1   Errno
  nextfd int
  i  int
@@ -65,7 +65,7 @@
  // About to call fork.
  // No more allocation or calls of non-assembly functions.
  runtime_BeforeFork()
- r1, err1 = raw_fork()
+ r1, _, err1 = RawSyscall6(SYS_CLONE,
uintptr(SIGCHLD)|sys.Cloneflags, 0, 0, 0, 0, 0)
  if err1 != 0 {
  runtime_AfterFork()
  return 0, err1