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

Reply via email to