⚲
Project
General
Profile
Sign in
Register
Home
Projects
Help
Search
:
Ruby master
All Projects
Ruby
»
Ruby master
Overview
Activity
Roadmap
Issues
Repository
Like
Download (605 Bytes)
Feature #2250
» syssocket.c
pilcrow (Mike Pomraning)
, 10/22/2009 12:43 PM
#include
<ruby.h>
#include
<unistd.h>
#include
<sys/types.h>
#include
<sys/socket.h>
static
VALUE
io_syssocket
(
VALUE
klass
,
VALUE
domain
,
VALUE
type
,
VALUE
protocol
)
{
int
s
;
s
=
socket
(
NUM2INT
(
domain
),
NUM2INT
(
type
),
NUM2INT
(
protocol
));
if
(
s
<
0
)
rb_sys_fail
(
"socket"
);
return
INT2FIX
(
s
);
}
static
VALUE
io_sysclose
(
VALUE
klass
,
VALUE
fd
)
{
int
r
;
r
=
close
(
NUM2INT
(
fd
));
if
(
r
<
0
)
rb_sys_fail
(
"sysclose"
);
return
INT2FIX
(
r
);
}
void
Init_iosyssocket
()
{
rb_define_singleton_method
(
rb_cIO
,
"syssocket"
,
io_syssocket
,
3
);
rb_define_singleton_method
(
rb_cIO
,
"sysclose"
,
io_sysclose
,
1
);
}
« Previous
1
2
Next »
(1-1/2)
Loading...