UNIXSocket#send_io and #recv_io

Someone pointed these out to me yesterday, and said they were
currently not implemented… I haven’t played with it yet
myself, but I assume it’s the same on my system.

Who’s knowledgeable about these – how they work, why they’re
not implemented, will they be available later?

Thanks,
Hal

Hi,

At Wed, 21 Apr 2004 16:07:24 +0900,
Hal Fulton wrote in [ruby-talk:97796]:

Someone pointed these out to me yesterday, and said they were
currently not implemented… I haven’t played with it yet
myself, but I assume it’s the same on my system.

Implemented in 1.7.

$ ruby-1.8 -v -rsocket -e ‘p UNIXSocket.instance_methods.grep(/(recv|send)_io/)’
ruby 1.8.1 (2004-04-19) [i686-linux]
[“send_io”, “recv_io”]

···


Nobu Nakada

Thanks for replying… see below.

Someone pointed these out to me yesterday, and said they were
currently not implemented… I haven’t played with it yet
myself, but I assume it’s the same on my system.

Implemented in 1.7.

$ ruby-1.8 -v -rsocket -e ‘p UNIXSocket.instance_methods.grep(/(recv|send)_io/)’
ruby 1.8.1 (2004-04-19) [i686-linux]
[“send_io”, “recv_io”]

But are they operational? There are several conditional
defines in socket.c, ending with:

#else
rb_notimplement();
return Qnil; /* not reached */
#endif

My impression was that my friend was getting the “not implemented”
message… but I see now that the return is marked “not reached.”

Hmm, maybe a compile error on his box?

Anyhow, are these methods documented anywhere?

Thanks,
Hal

···

nobu.nokada@softhome.net wrote:

Hi,

At Wed, 21 Apr 2004 17:24:09 +0900,
Hal Fulton wrote in [ruby-talk:97804]:

But are they operational? There are several conditional
defines in socket.c, ending with:

#else
rb_notimplement();
return Qnil; /* not reached */
#endif

My impression was that my friend was getting the “not implemented”
message… but I see now that the return is marked “not reached.”

Hmm, maybe a compile error on his box?

What’s his system? Maybe, it has no sendmsg(2) and struct
msghdr, or extconf.rb failed to detect them. There is the
mkmf.log?

Anyhow, are these methods documented anywhere?

Still Japanese only.
http://www.ruby-lang.org/ja/man/index.cgi?cmd=view;name=UNIXSocket#recv_io

···


Nobu Nakada

Apparently this is happening again with 1.8.1 on his box. (Steve doesn’t
read this list regularly.)

Not sure what his system is – I’ll find out. And I don’t know how to
interpret the log entry (see below).

Thanks for any help…

Hal

 have_struct_member: checking for struct msghdr.msg_control... 

-------------------- yes

 "gcc -c -I/usr/local/src/ruby-1.8.1 -I/usr/local/src/ruby-1.8.1 

-DHAVE_SOCKADDR_STORAGE -DINET6
-g -O2 -DENABLE_IPV6 conftest.c"
checked program was:
/* begin */

 #include <sys/types.h>
 #include <sys/socket.h>

 /*top*/
 int main() { return 0; }
 int s = (char *)&((struct msghdr*)0)->msg_control - (char *)0;
 /* end */
···

nobu.nokada@softhome.net wrote:

Hal Fulton wrote in [ruby-talk:97804]:

My impression was that my friend was getting the “not implemented”
message… but I see now that the return is marked “not reached.”

Hmm, maybe a compile error on his box?

What’s his system? Maybe, it has no sendmsg(2) and struct
msghdr, or extconf.rb failed to detect them. There is the
mkmf.log?

 --------------------

 have_struct_member: checking for struct msghdr.msg_accrights... 

-------------------- no

 "gcc -c -I/usr/local/src/ruby-1.8.1 -I/usr/local/src/ruby-1.8.1 

-DHAVE_SOCKADDR_STORAGE -DINET6
-g -O2 -DENABLE_IPV6 conftest.c"
conftest.c:7: structure has no member named `msg_accrights’
checked program was:
/* begin */

 #include <sys/types.h>
 #include <sys/socket.h>

 /*top*/
 int main() { return 0; }
 int s = (char *)&((struct msghdr*)0)->msg_accrights - (char *)0;
 /* end */

In article 4095E404.8050808@hypermetrics.com,
Hal Fulton hal9000@hypermetrics.com writes:

 have_struct_member: checking for struct msghdr.msg_control... 

-------------------- yes

It seems that 4.4BSD or Linux.

I don’t know why it doesn’t work. It works on Linux as follows.

% ruby-1.8.1 -v -rsocket -e ’
p1, p2 = UNIXSocket.pair
pid = fork {
w = p2.recv_io
w.print “a”
}
r, w = IO.pipe
p1.send_io(w)
w.close
p1.close
p2.close
p r.gets
r.close
Process.wait pid

ruby 1.8.1 (2003-12-25) [i686-linux]
“a”

Note that ruby-1.8.0 had a bug.

···


Tanaka Akira