[Bug go/56171] syscall FAILs on Solaris

2013-02-20 Thread ian at gcc dot gnu.org


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=56171



--- Comment #10 from ian at gcc dot gnu.org ian at gcc dot gnu.org 2013-02-20 
20:04:48 UTC ---

Author: ian

Date: Wed Feb 20 20:04:36 2013

New Revision: 196180



URL: http://gcc.gnu.org/viewcvs?root=gccview=revrev=196180

Log:

PR go/56171

syscall: Solaris fixes for passing file descriptor.



From Rainer Orth.



Added:

trunk/libgo/go/syscall/socket_posix.go

trunk/libgo/go/syscall/socket_xnet.go

Modified:

trunk/libgo/Makefile.am

trunk/libgo/Makefile.in

trunk/libgo/go/syscall/sockcmsg_unix.go

trunk/libgo/go/syscall/socket.go


[Bug go/56171] syscall FAILs on Solaris

2013-02-20 Thread ian at airs dot com


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=56171



Ian Lance Taylor ian at airs dot com changed:



   What|Removed |Added



 Status|REOPENED|RESOLVED

 Resolution||FIXED



--- Comment #11 from Ian Lance Taylor ian at airs dot com 2013-02-20 20:06:04 
UTC ---

Fixed again.


[Bug go/56171] syscall FAILs on Solaris

2013-02-14 Thread ro at gcc dot gnu.org


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=56171



--- Comment #9 from Rainer Orth ro at gcc dot gnu.org 2013-02-14 10:11:11 UTC 
---

Created attachment 29448

  -- http://gcc.gnu.org/bugzilla/attachment.cgi?id=29448

proposed patch for __xnet_ socket functions



This works fine in the 32-bit case, but for 64-bit (both sparc and x86) needed

one further adjustment: the 64-bit tests were failing like this:



  amd64:



--- FAIL: TestPassFD (0.09 seconds)

:0: child process ReadAll: , nil; want Hello from child process!\n

FAIL

FAIL: syscall



  sparcv9:



--- FAIL: TestPassFD (0.28 seconds)

passfd_test.go:102: child process ReadAll: , nil; want Hello from

child process!\n

FAIL

FAIL: syscall



(Btw., need to check why filename and line number aren't detected on x86...)



It turned out that as on Darwin, we always need 32-bit alignment.  The attached

patch does just that and allows the syscall to pass on both 32- and 64-bit

Solaris/SPARC and x86.



  Rainer



2013-02-13  Rainer Orth  r...@cebitec.uni-bielefeld.de



PR go/5617

* go/syscall/sockcmsg_unix.go: Import runtime.

(cmsgAlignOf): Enforce 32-bit alignment on Solaris.

* go/syscall/socket.go (bind, connect, socket, socketpair)

(getsockopt, sendto, recvmsg, sendmsg): Move ...

* go/syscall/socket_posix.go: ... here.

New file.

* go/syscall/socket_xnet.go: New file.

* Makefile.am (syscall_socket_os_file): New variable.

(go_base_syscall_files): Use it.

* Makefile.in: Regenerate.


[Bug go/56171] syscall FAILs on Solaris

2013-02-12 Thread ro at CeBiTec dot Uni-Bielefeld.DE


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=56171



--- Comment #7 from ro at CeBiTec dot Uni-Bielefeld.DE ro at CeBiTec dot 
Uni-Bielefeld.DE 2013-02-12 14:43:41 UTC ---

 --- Comment #6 from Ian Lance Taylor ian at airs dot com 2013-02-11

 19:16:41 UTC ---

[...]

 Note that this test case execs itself in a separate process, so when using

 truss you need to trace both processes to see what is happening.  The

 WriteMsgUnix failure is happening in the child process.  It indicates that

 sendmsg is returning an EBADF errno value, but I don't know why.



 One place to look would be the function UnixRights in 
 syscall/sockcmsg_unix.go.

  Is that the right format for passing a file descriptor on Solaris?



It turned out that there was a mismatch between configure.ac which

defines -D_XOPEN_SOURCE=500 for Solaris, and libcalls.go: the latter has

e.g.



//extern sendmsg



but according to sys/socket.h, we need



#ifdef_XPG4_2

#ifdef__PRAGMA_REDEFINE_EXTNAME

#pragma redefine_extname bind __xnet_bind

#pragma redefine_extname connect __xnet_connect

#pragma redefine_extname recvmsg __xnet_recvmsg

#pragma redefine_extname sendmsg __xnet_sendmsg

#pragma redefine_extname sendto __xnet_sendto

#pragma redefine_extname socket __xnet_socket

#pragma redefine_extname socketpair __xnet_socketpair

#pragma redefine_extname getsockopt __xnet_getsockopt



Depending on whether sendmsg or __xnet_sendmsg is used, the kernel

expects different variants of struct msghdr.



I hacked around this by manually adapting libcalls.go to use the __xnet_

forms, which allowed the test to pass.  I've not yet checked what's the

best way to handle this properly.



Rainer


[Bug go/56171] syscall FAILs on Solaris

2013-02-12 Thread ian at airs dot com


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=56171



--- Comment #8 from Ian Lance Taylor ian at airs dot com 2013-02-12 15:02:12 
UTC ---

I think we'll need to pull the relevant //sys lines out of socket.go into,

e.g., socket_posix.go, and then add socket_xnet.go, and arrange for the

Makefile to choose between them based on LIBGO_IS_SOLARIS.


[Bug go/56171] syscall FAILs on Solaris

2013-02-11 Thread ian at gcc dot gnu.org


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=56171



--- Comment #5 from ian at gcc dot gnu.org ian at gcc dot gnu.org 2013-02-11 
19:03:09 UTC ---

Author: ian

Date: Mon Feb 11 19:03:04 2013

New Revision: 195950



URL: http://gcc.gnu.org/viewcvs?root=gccview=revrev=195950

Log:

PR go/56171

libgo: Solaris portability for syscall package.



From Rainer Orth.



Modified:

trunk/libgo/Makefile.am

trunk/libgo/Makefile.in

trunk/libgo/configure

trunk/libgo/configure.ac

trunk/libgo/mksysinfo.sh


[Bug go/56171] syscall FAILs on Solaris

2013-02-11 Thread ian at airs dot com


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=56171



--- Comment #6 from Ian Lance Taylor ian at airs dot com 2013-02-11 19:16:41 
UTC ---

The two closes of file descriptor 4 that you show are actually normal and

expected for this test.  The first is the deferred close of the os.File that

wraps the file descriptor, created by a call to os.NewFile.  The second is the

deferred close of the file descriptor itself.  The second close is deferred to

make sure that it happens even if os.NewFile fails.



Both closes are happening after the WriteMsgUnix failure.



Note that this test case execs itself in a separate process, so when using

truss you need to trace both processes to see what is happening.  The

WriteMsgUnix failure is happening in the child process.  It indicates that

sendmsg is returning an EBADF errno value, but I don't know why.



One place to look would be the function UnixRights in syscall/sockcmsg_unix.go.

 Is that the right format for passing a file descriptor on Solaris?


[Bug go/56171] syscall FAILs on Solaris

2013-02-07 Thread ro at gcc dot gnu.org


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=56171



Rainer Orth ro at gcc dot gnu.org changed:



   What|Removed |Added



 Status|RESOLVED|REOPENED

   Last reconfirmed||2013-02-07

 Resolution|FIXED   |

   Target Milestone|--- |4.8.0

 Ever Confirmed|0   |1



--- Comment #3 from Rainer Orth ro at gcc dot gnu.org 2013-02-07 17:02:35 UTC 
---

The test still doesn't pass on Solaris for a couple of reasons:



* passfd_test.go still uses AF_LOCAL which is missing on Solaris 9 and 10.  I'm

  attaching a patch that defines it from AF_UNIX if missing.



* Once it compiles, the test fails to link before Solaris 11:



Undefined   first referenced

 symbol in file

nanosleep   _gotest_.o  (symbol belongs to implicit

depe

ndency /lib/librt.so.1)

ld: fatal: symbol referencing errors. No output written to a.out

collect2: error: ld returned 1 exit status

FAIL: syscall



  We need two things to fix this: also check for nanosleep in librt, just as we

  do for sched_yield, and add $(LIBS) to GOLIBS so testcases are also linked

with

  -lrt if necessary.  The attached patch also handles this.



After those changes, the testcase compiles and links, but still fails:



--- FAIL: TestPassFD (0.11 seconds)

:0: child process: WriteMsgUnix: write unix: bad file number, nil

FAIL

FAIL: syscall



In truss, it seems the same fds (4, 5) are closed twice, yielding EBADF

the second time.  For fd 4, I found those stacktraces when the closes happen:



  12   4387 close:return fd = 4 errno = 0



  libc.so.1`__close+0x7

  a.out`syscall.Close+0x1b

  libgo.so.3.0.1`os.close.pN7_os.file+0x5d

  libgo.so.3.0.1`os.Close.pN7_os.File+0x2a

  a.out`syscall_test.$thunk4+0x2a

  libgo.so.3.0.1`runtime.Goexit+0x42

  libgo.so.3.0.1`testing.FailNow.pN14_testing.common+0x22

  libgo.so.3.0.1`testing.Fatalf.pN14_testing.common+0x65

  a.out`syscall_test.TestPassFD+0xd77

  libgo.so.3.0.1`testing.$thunk10+0xe2

  libgo.so.3.0.1`kickoff+0x39

  libc.so.1`resumecontext

  libgo.so.3.0.1`testing.RunTests+0x461

  libgo.so.3.0.1`testing.Main+0x470

  a.out`main.main+0x63

  libgo.so.3.0.1`runtime_main+0x7b

  libgo.so.3.0.1`kickoff+0x39

  libc.so.1`resumecontext

  a.out`main+0x4b

  a.out`_start+0x83



  12   4387 close:return fd = 4 errno = 9



  libc.so.1`__close+0x7

  a.out`syscall.Close+0x1b

  a.out`syscall_test.$thunk2+0x2a

  libgo.so.3.0.1`runtime.Goexit+0x42

  libgo.so.3.0.1`testing.FailNow.pN14_testing.common+0x22

  libgo.so.3.0.1`testing.Fatalf.pN14_testing.common+0x65

  a.out`syscall_test.TestPassFD+0xd77

  libgo.so.3.0.1`testing.$thunk10+0xe2

  libgo.so.3.0.1`kickoff+0x39

  libc.so.1`resumecontext

  libgo.so.3.0.1`testing.RunTests+0x461

  libgo.so.3.0.1`testing.Main+0x470

  a.out`main.main+0x63

  libgo.so.3.0.1`runtime_main+0x7b

  libgo.so.3.0.1`kickoff+0x39

  libc.so.1`resumecontext

  a.out`main+0x4b

  a.out`_start+0x83



I haven't yet made the necessary connections to the code to explain this.



  Rainer

In


[Bug go/56171] syscall FAILs on Solaris

2013-02-07 Thread ro at gcc dot gnu.org


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=56171



--- Comment #4 from Rainer Orth ro at gcc dot gnu.org 2013-02-07 17:06:27 UTC 
---

Created attachment 29387

  -- http://gcc.gnu.org/bugzilla/attachment.cgi?id=29387

proposed patch



2013-02-06  Rainer Orth  r...@cebitec.uni-bielefeld.de



PR go/56171

* mksysinfo.sh (AF_LOCAL): Provide via AF_UNIX if missing.



* configure.ac: Check for nanosleep in librt.

* configure: Regenerate.



* Makefile.am (CHECK): Add $(LIBS) to GOLIBS.

* Makefile.in: Regenerate.


[Bug go/56171] syscall FAILs on Solaris

2013-02-02 Thread ian at gcc dot gnu.org


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=56171



--- Comment #1 from ian at gcc dot gnu.org ian at gcc dot gnu.org 2013-02-02 
15:40:20 UTC ---

Author: ian

Date: Sat Feb  2 15:40:14 2013

New Revision: 195686



URL: http://gcc.gnu.org/viewcvs?root=gccview=revrev=195686

Log:

PR go/56171

syscall: Only run creds_test on GNU/Linux.



Modified:

trunk/libgo/Makefile.am

trunk/libgo/Makefile.in

trunk/libgo/testsuite/gotest


[Bug go/56171] syscall FAILs on Solaris

2013-02-02 Thread ian at airs dot com


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=56171



Ian Lance Taylor ian at airs dot com changed:



   What|Removed |Added



 Status|UNCONFIRMED |RESOLVED

 Resolution||FIXED



--- Comment #2 from Ian Lance Taylor ian at airs dot com 2013-02-02 15:40:39 
UTC ---

Fixed.