@@ -52,11 +52,15 @@ namespace rubinius {
52
52
return io;
53
53
}
54
54
55
- native_int IO::descriptor (STATE) {
56
- NativeMethodEnvironment* native_env = state->vm ()->native_method_environment ;
57
- Object* io_object = (Object*) native_env->current_call_frame ()->self ();
55
+ native_int IO::descriptor (STATE, CallFrame* frame) {
56
+ if (!frame) {
57
+ NativeMethodEnvironment* native_env = state->vm ()->native_method_environment ;
58
+ frame = native_env->current_call_frame ();
59
+ }
58
60
59
- return as<Fixnum>(io_object->send (state, native_env->current_call_frame (), state->symbol (" descriptor" )))->to_native ();
61
+ assert (frame);
62
+ Object* io_object = (Object*) frame->self ();
63
+ return as<Fixnum>(io_object->send (state, frame, state->symbol (" descriptor" )))->to_native ();
60
64
}
61
65
62
66
void IO::ensure_open (STATE) {
@@ -157,7 +161,7 @@ namespace rubinius {
157
161
158
162
{
159
163
GCIndependent guard (state, calling_environment);
160
- bytes_read = recvfrom (descriptor (state),
164
+ bytes_read = recvfrom (descriptor (state, calling_environment ),
161
165
(char *)buffer->byte_address (), size,
162
166
flags->to_native (),
163
167
(struct sockaddr *)buf, &alen);
@@ -412,7 +416,7 @@ namespace rubinius {
412
416
struct cmsghdr *cmsg;
413
417
char cmsg_buf[cmsg_space];
414
418
415
- fd = io->descriptor (state);
419
+ fd = io->descriptor (state, NULL );
416
420
417
421
msg.msg_name = NULL ;
418
422
msg.msg_namelen = 0 ;
@@ -437,7 +441,7 @@ namespace rubinius {
437
441
int * fd_data = (int *)CMSG_DATA (cmsg);
438
442
*fd_data = fd;
439
443
440
- if (sendmsg (descriptor (state), &msg, 0 ) == -1 ) {
444
+ if (sendmsg (descriptor (state, NULL ), &msg, 0 ) == -1 ) {
441
445
return Primitives::failure ();
442
446
}
443
447
@@ -479,7 +483,7 @@ namespace rubinius {
479
483
int * fd_data = (int *)CMSG_DATA (cmsg);
480
484
*fd_data = -1 ;
481
485
482
- int read_fd = descriptor (state);
486
+ int read_fd = descriptor (state, NULL );
483
487
484
488
int code = -1 ;
485
489
0 commit comments