UNIXSocket#send_io and #recv_io

H

Hal Fulton

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
 
N

nobu.nokada

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"]
 
H

Hal Fulton

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
 
N

nobu.nokada

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
 
H

Hal Fulton

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?

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 */

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

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 */
 
T

Tanaka Akira

Hal Fulton said:
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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
474,145
Messages
2,570,826
Members
47,371
Latest member
Brkaa

Latest Threads

Top