mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
* ext/socket/ (rsock_make_hostent): renamed from sock_make_hostent.
(rsock_addrinfo): renamed from sock_addrinfo. (rsock_getaddrinfo): renamed from sock_getaddrinfo. (rsock_socket): renamed from ruby_socket. (rsock_sock_s_socketpair): renamed from sock_s_socketpair. (rsock_connect): renamed from ruby_connect. * ext/socket/socket.c (sock_listen): make it static. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@22686 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
a6274c1e72
commit
172d208789
9 changed files with 47 additions and 38 deletions
11
ChangeLog
11
ChangeLog
|
@ -1,3 +1,14 @@
|
||||||
|
Sun Mar 1 15:45:49 2009 Tanaka Akira <akr@fsij.org>
|
||||||
|
|
||||||
|
* ext/socket/ (rsock_make_hostent): renamed from sock_make_hostent.
|
||||||
|
(rsock_addrinfo): renamed from sock_addrinfo.
|
||||||
|
(rsock_getaddrinfo): renamed from sock_getaddrinfo.
|
||||||
|
(rsock_socket): renamed from ruby_socket.
|
||||||
|
(rsock_sock_s_socketpair): renamed from sock_s_socketpair.
|
||||||
|
(rsock_connect): renamed from ruby_connect.
|
||||||
|
|
||||||
|
* ext/socket/socket.c (sock_listen): make it static.
|
||||||
|
|
||||||
Sun Mar 1 15:29:31 2009 Tanaka Akira <akr@fsij.org>
|
Sun Mar 1 15:29:31 2009 Tanaka Akira <akr@fsij.org>
|
||||||
|
|
||||||
* ext/socket: add rsock_ prefix.
|
* ext/socket: add rsock_ prefix.
|
||||||
|
|
|
@ -228,7 +228,7 @@ rsock_s_recvfrom_nonblock(VALUE sock, int argc, VALUE *argv, enum sock_recv_type
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
ruby_socket(int domain, int type, int proto)
|
rsock_socket(int domain, int type, int proto)
|
||||||
{
|
{
|
||||||
int fd;
|
int fd;
|
||||||
|
|
||||||
|
@ -353,7 +353,7 @@ socks_connect_blocking(void *data)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
int
|
int
|
||||||
ruby_connect(int fd, const struct sockaddr *sockaddr, int len, int socks)
|
rsock_connect(int fd, const struct sockaddr *sockaddr, int len, int socks)
|
||||||
{
|
{
|
||||||
int status;
|
int status;
|
||||||
rb_blocking_function_t *func = connect_blocking;
|
rb_blocking_function_t *func = connect_blocking;
|
||||||
|
|
|
@ -46,19 +46,19 @@ init_inetsock_internal(struct inetsock_arg *arg)
|
||||||
int fd, status = 0;
|
int fd, status = 0;
|
||||||
const char *syscall = 0;
|
const char *syscall = 0;
|
||||||
|
|
||||||
arg->remote.res = sock_addrinfo(arg->remote.host, arg->remote.serv, SOCK_STREAM,
|
arg->remote.res = rsock_addrinfo(arg->remote.host, arg->remote.serv, SOCK_STREAM,
|
||||||
(type == INET_SERVER) ? AI_PASSIVE : 0);
|
(type == INET_SERVER) ? AI_PASSIVE : 0);
|
||||||
/*
|
/*
|
||||||
* Maybe also accept a local address
|
* Maybe also accept a local address
|
||||||
*/
|
*/
|
||||||
|
|
||||||
if (type != INET_SERVER && (!NIL_P(arg->local.host) || !NIL_P(arg->local.serv))) {
|
if (type != INET_SERVER && (!NIL_P(arg->local.host) || !NIL_P(arg->local.serv))) {
|
||||||
arg->local.res = sock_addrinfo(arg->local.host, arg->local.serv, SOCK_STREAM, 0);
|
arg->local.res = rsock_addrinfo(arg->local.host, arg->local.serv, SOCK_STREAM, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
arg->fd = fd = -1;
|
arg->fd = fd = -1;
|
||||||
for (res = arg->remote.res; res; res = res->ai_next) {
|
for (res = arg->remote.res; res; res = res->ai_next) {
|
||||||
status = ruby_socket(res->ai_family,res->ai_socktype,res->ai_protocol);
|
status = rsock_socket(res->ai_family,res->ai_socktype,res->ai_protocol);
|
||||||
syscall = "socket(2)";
|
syscall = "socket(2)";
|
||||||
fd = status;
|
fd = status;
|
||||||
if (fd < 0) {
|
if (fd < 0) {
|
||||||
|
@ -81,8 +81,8 @@ init_inetsock_internal(struct inetsock_arg *arg)
|
||||||
}
|
}
|
||||||
|
|
||||||
if (status >= 0) {
|
if (status >= 0) {
|
||||||
status = ruby_connect(fd, res->ai_addr, res->ai_addrlen,
|
status = rsock_connect(fd, res->ai_addr, res->ai_addrlen,
|
||||||
(type == INET_SOCKS));
|
(type == INET_SOCKS));
|
||||||
syscall = "connect(2)";
|
syscall = "connect(2)";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -223,7 +223,7 @@ static VALUE
|
||||||
ip_s_getaddress(VALUE obj, VALUE host)
|
ip_s_getaddress(VALUE obj, VALUE host)
|
||||||
{
|
{
|
||||||
struct sockaddr_storage addr;
|
struct sockaddr_storage addr;
|
||||||
struct addrinfo *res = sock_addrinfo(host, Qnil, SOCK_STREAM, 0);
|
struct addrinfo *res = rsock_addrinfo(host, Qnil, SOCK_STREAM, 0);
|
||||||
|
|
||||||
/* just take the first one */
|
/* just take the first one */
|
||||||
memcpy(&addr, res->ai_addr, res->ai_addrlen);
|
memcpy(&addr, res->ai_addr, res->ai_addrlen);
|
||||||
|
|
|
@ -291,7 +291,7 @@ port_str(VALUE port, char *pbuf, size_t len, int *flags_ptr)
|
||||||
}
|
}
|
||||||
|
|
||||||
struct addrinfo*
|
struct addrinfo*
|
||||||
sock_getaddrinfo(VALUE host, VALUE port, struct addrinfo *hints, int socktype_hack)
|
rsock_getaddrinfo(VALUE host, VALUE port, struct addrinfo *hints, int socktype_hack)
|
||||||
{
|
{
|
||||||
struct addrinfo* res = NULL;
|
struct addrinfo* res = NULL;
|
||||||
char *hostp, *portp;
|
char *hostp, *portp;
|
||||||
|
@ -337,7 +337,7 @@ sock_getaddrinfo(VALUE host, VALUE port, struct addrinfo *hints, int socktype_ha
|
||||||
}
|
}
|
||||||
|
|
||||||
struct addrinfo*
|
struct addrinfo*
|
||||||
sock_addrinfo(VALUE host, VALUE port, int socktype, int flags)
|
rsock_addrinfo(VALUE host, VALUE port, int socktype, int flags)
|
||||||
{
|
{
|
||||||
struct addrinfo hints;
|
struct addrinfo hints;
|
||||||
|
|
||||||
|
@ -345,7 +345,7 @@ sock_addrinfo(VALUE host, VALUE port, int socktype, int flags)
|
||||||
hints.ai_family = AF_UNSPEC;
|
hints.ai_family = AF_UNSPEC;
|
||||||
hints.ai_socktype = socktype;
|
hints.ai_socktype = socktype;
|
||||||
hints.ai_flags = flags;
|
hints.ai_flags = flags;
|
||||||
return sock_getaddrinfo(host, port, &hints, 1);
|
return rsock_getaddrinfo(host, port, &hints, 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
VALUE
|
VALUE
|
||||||
|
@ -583,7 +583,7 @@ call_getaddrinfo(VALUE node, VALUE service,
|
||||||
if (!NIL_P(flags)) {
|
if (!NIL_P(flags)) {
|
||||||
hints.ai_flags = NUM2INT(flags);
|
hints.ai_flags = NUM2INT(flags);
|
||||||
}
|
}
|
||||||
res = sock_getaddrinfo(node, service, &hints, socktype_hack);
|
res = rsock_getaddrinfo(node, service, &hints, socktype_hack);
|
||||||
|
|
||||||
if (res == NULL)
|
if (res == NULL)
|
||||||
rb_raise(rb_eSocket, "host not found");
|
rb_raise(rb_eSocket, "host not found");
|
||||||
|
|
|
@ -207,8 +207,8 @@ int rb_sock_getfamily(int sockfd);
|
||||||
|
|
||||||
int rb_getaddrinfo(const char *node, const char *service, const struct addrinfo *hints, struct addrinfo **res);
|
int rb_getaddrinfo(const char *node, const char *service, const struct addrinfo *hints, struct addrinfo **res);
|
||||||
int rb_getnameinfo(const struct sockaddr *sa, socklen_t salen, char *host, size_t hostlen, char *serv, size_t servlen, int flags);
|
int rb_getnameinfo(const struct sockaddr *sa, socklen_t salen, char *host, size_t hostlen, char *serv, size_t servlen, int flags);
|
||||||
struct addrinfo *sock_addrinfo(VALUE host, VALUE port, int socktype, int flags);
|
struct addrinfo *rsock_addrinfo(VALUE host, VALUE port, int socktype, int flags);
|
||||||
struct addrinfo *sock_getaddrinfo(VALUE host, VALUE port, struct addrinfo *hints, int socktype_hack);
|
struct addrinfo *rsock_getaddrinfo(VALUE host, VALUE port, struct addrinfo *hints, int socktype_hack);
|
||||||
VALUE rsock_fd_socket_addrinfo(int fd, struct sockaddr *addr, socklen_t len);
|
VALUE rsock_fd_socket_addrinfo(int fd, struct sockaddr *addr, socklen_t len);
|
||||||
VALUE rsock_io_socket_addrinfo(VALUE io, struct sockaddr *addr, socklen_t len);
|
VALUE rsock_io_socket_addrinfo(VALUE io, struct sockaddr *addr, socklen_t len);
|
||||||
|
|
||||||
|
@ -223,9 +223,9 @@ const char* rsock_unixpath(struct sockaddr_un *sockaddr, socklen_t len);
|
||||||
VALUE rsock_unixaddr(struct sockaddr_un *sockaddr, socklen_t len);
|
VALUE rsock_unixaddr(struct sockaddr_un *sockaddr, socklen_t len);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
int ruby_socket(int domain, int type, int proto);
|
int rsock_socket(int domain, int type, int proto);
|
||||||
VALUE rsock_init_sock(VALUE sock, int fd);
|
VALUE rsock_init_sock(VALUE sock, int fd);
|
||||||
VALUE sock_s_socketpair(int argc, VALUE *argv, VALUE klass);
|
VALUE rsock_sock_s_socketpair(int argc, VALUE *argv, VALUE klass);
|
||||||
VALUE rsock_init_inetsock(VALUE sock, VALUE remote_host, VALUE remote_serv, VALUE local_host, VALUE local_serv, int type);
|
VALUE rsock_init_inetsock(VALUE sock, VALUE remote_host, VALUE remote_serv, VALUE local_host, VALUE local_serv, int type);
|
||||||
VALUE rsock_init_unixsock(VALUE sock, VALUE path, int server);
|
VALUE rsock_init_unixsock(VALUE sock, VALUE path, int server);
|
||||||
|
|
||||||
|
@ -250,9 +250,7 @@ enum sock_recv_type {
|
||||||
VALUE rsock_s_recvfrom_nonblock(VALUE sock, int argc, VALUE *argv, enum sock_recv_type from);
|
VALUE rsock_s_recvfrom_nonblock(VALUE sock, int argc, VALUE *argv, enum sock_recv_type from);
|
||||||
VALUE rsock_s_recvfrom(VALUE sock, int argc, VALUE *argv, enum sock_recv_type from);
|
VALUE rsock_s_recvfrom(VALUE sock, int argc, VALUE *argv, enum sock_recv_type from);
|
||||||
|
|
||||||
int ruby_connect(int fd, const struct sockaddr *sockaddr, int len, int socks);
|
int rsock_connect(int fd, const struct sockaddr *sockaddr, int len, int socks);
|
||||||
|
|
||||||
VALUE sock_listen(VALUE sock, VALUE log);
|
|
||||||
|
|
||||||
VALUE rsock_s_accept(VALUE klass, int fd, struct sockaddr *sockaddr, socklen_t *len);
|
VALUE rsock_s_accept(VALUE klass, int fd, struct sockaddr *sockaddr, socklen_t *len);
|
||||||
VALUE rsock_s_accept_nonblock(VALUE klass, rb_io_t *fptr, struct sockaddr *sockaddr, socklen_t *len);
|
VALUE rsock_s_accept_nonblock(VALUE klass, rb_io_t *fptr, struct sockaddr *sockaddr, socklen_t *len);
|
||||||
|
|
|
@ -49,7 +49,7 @@ sock_initialize(int argc, VALUE *argv, VALUE sock)
|
||||||
|
|
||||||
rb_secure(3);
|
rb_secure(3);
|
||||||
setup_domain_and_type(domain, &d, type, &t);
|
setup_domain_and_type(domain, &d, type, &t);
|
||||||
fd = ruby_socket(d, t, NUM2INT(protocol));
|
fd = rsock_socket(d, t, NUM2INT(protocol));
|
||||||
if (fd < 0) rb_sys_fail("socket(2)");
|
if (fd < 0) rb_sys_fail("socket(2)");
|
||||||
|
|
||||||
return rsock_init_sock(sock, fd);
|
return rsock_init_sock(sock, fd);
|
||||||
|
@ -97,7 +97,7 @@ pair_yield(VALUE pair)
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
VALUE
|
VALUE
|
||||||
sock_s_socketpair(int argc, VALUE *argv, VALUE klass)
|
rsock_sock_s_socketpair(int argc, VALUE *argv, VALUE klass)
|
||||||
{
|
{
|
||||||
#if defined HAVE_SOCKETPAIR
|
#if defined HAVE_SOCKETPAIR
|
||||||
VALUE domain, type, protocol;
|
VALUE domain, type, protocol;
|
||||||
|
@ -253,7 +253,7 @@ sock_connect(VALUE sock, VALUE addr)
|
||||||
addr = rb_str_new4(addr);
|
addr = rb_str_new4(addr);
|
||||||
GetOpenFile(sock, fptr);
|
GetOpenFile(sock, fptr);
|
||||||
fd = fptr->fd;
|
fd = fptr->fd;
|
||||||
n = ruby_connect(fd, (struct sockaddr*)RSTRING_PTR(addr), RSTRING_LEN(addr), 0);
|
n = rsock_connect(fd, (struct sockaddr*)RSTRING_PTR(addr), RSTRING_LEN(addr), 0);
|
||||||
if (n < 0) {
|
if (n < 0) {
|
||||||
rb_sys_fail("connect(2)");
|
rb_sys_fail("connect(2)");
|
||||||
}
|
}
|
||||||
|
@ -481,7 +481,7 @@ sock_bind(VALUE sock, VALUE addr)
|
||||||
* * listen manual pages on unix-based systems
|
* * listen manual pages on unix-based systems
|
||||||
* * listen function in Microsoft's Winsock functions reference
|
* * listen function in Microsoft's Winsock functions reference
|
||||||
*/
|
*/
|
||||||
VALUE
|
static VALUE
|
||||||
sock_listen(VALUE sock, VALUE log)
|
sock_listen(VALUE sock, VALUE log)
|
||||||
{
|
{
|
||||||
rb_io_t *fptr;
|
rb_io_t *fptr;
|
||||||
|
@ -922,7 +922,7 @@ static VALUE
|
||||||
sock_s_gethostbyname(VALUE obj, VALUE host)
|
sock_s_gethostbyname(VALUE obj, VALUE host)
|
||||||
{
|
{
|
||||||
rb_secure(3);
|
rb_secure(3);
|
||||||
return rsock_make_hostent(host, sock_addrinfo(host, Qnil, SOCK_STREAM, AI_CANONNAME), sock_sockaddr);
|
return rsock_make_hostent(host, rsock_addrinfo(host, Qnil, SOCK_STREAM, AI_CANONNAME), sock_sockaddr);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -1105,7 +1105,7 @@ sock_s_getaddrinfo(int argc, VALUE *argv)
|
||||||
if (!NIL_P(flags)) {
|
if (!NIL_P(flags)) {
|
||||||
hints.ai_flags = NUM2INT(flags);
|
hints.ai_flags = NUM2INT(flags);
|
||||||
}
|
}
|
||||||
res = sock_getaddrinfo(host, port, &hints, 0);
|
res = rsock_getaddrinfo(host, port, &hints, 0);
|
||||||
|
|
||||||
ret = make_addrinfo(res);
|
ret = make_addrinfo(res);
|
||||||
freeaddrinfo(res);
|
freeaddrinfo(res);
|
||||||
|
@ -1274,7 +1274,7 @@ sock_s_getnameinfo(int argc, VALUE *argv)
|
||||||
static VALUE
|
static VALUE
|
||||||
sock_s_pack_sockaddr_in(VALUE self, VALUE port, VALUE host)
|
sock_s_pack_sockaddr_in(VALUE self, VALUE port, VALUE host)
|
||||||
{
|
{
|
||||||
struct addrinfo *res = sock_addrinfo(host, port, 0, 0);
|
struct addrinfo *res = rsock_addrinfo(host, port, 0, 0);
|
||||||
VALUE addr = rb_str_new((char*)res->ai_addr, res->ai_addrlen);
|
VALUE addr = rb_str_new((char*)res->ai_addr, res->ai_addrlen);
|
||||||
|
|
||||||
freeaddrinfo(res);
|
freeaddrinfo(res);
|
||||||
|
@ -1787,8 +1787,8 @@ Init_socket()
|
||||||
rb_define_method(rb_cSocket, "recvfrom", sock_recvfrom, -1);
|
rb_define_method(rb_cSocket, "recvfrom", sock_recvfrom, -1);
|
||||||
rb_define_method(rb_cSocket, "recvfrom_nonblock", sock_recvfrom_nonblock, -1);
|
rb_define_method(rb_cSocket, "recvfrom_nonblock", sock_recvfrom_nonblock, -1);
|
||||||
|
|
||||||
rb_define_singleton_method(rb_cSocket, "socketpair", sock_s_socketpair, -1);
|
rb_define_singleton_method(rb_cSocket, "socketpair", rsock_sock_s_socketpair, -1);
|
||||||
rb_define_singleton_method(rb_cSocket, "pair", sock_s_socketpair, -1);
|
rb_define_singleton_method(rb_cSocket, "pair", rsock_sock_s_socketpair, -1);
|
||||||
rb_define_singleton_method(rb_cSocket, "gethostname", sock_gethostname, 0);
|
rb_define_singleton_method(rb_cSocket, "gethostname", sock_gethostname, 0);
|
||||||
rb_define_singleton_method(rb_cSocket, "gethostbyname", sock_s_gethostbyname, 1);
|
rb_define_singleton_method(rb_cSocket, "gethostbyname", sock_s_gethostbyname, 1);
|
||||||
rb_define_singleton_method(rb_cSocket, "gethostbyaddr", sock_s_gethostbyaddr, -1);
|
rb_define_singleton_method(rb_cSocket, "gethostbyaddr", sock_s_gethostbyaddr, -1);
|
||||||
|
|
|
@ -51,7 +51,7 @@ static VALUE
|
||||||
tcp_s_gethostbyname(VALUE obj, VALUE host)
|
tcp_s_gethostbyname(VALUE obj, VALUE host)
|
||||||
{
|
{
|
||||||
rb_secure(3);
|
rb_secure(3);
|
||||||
return rsock_make_hostent(host, sock_addrinfo(host, Qnil, SOCK_STREAM, AI_CANONNAME),
|
return rsock_make_hostent(host, rsock_addrinfo(host, Qnil, SOCK_STREAM, AI_CANONNAME),
|
||||||
tcp_sockaddr);
|
tcp_sockaddr);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -34,7 +34,7 @@ udp_init(int argc, VALUE *argv, VALUE sock)
|
||||||
if (rb_scan_args(argc, argv, "01", &arg) == 1) {
|
if (rb_scan_args(argc, argv, "01", &arg) == 1) {
|
||||||
family = rsock_family_arg(arg);
|
family = rsock_family_arg(arg);
|
||||||
}
|
}
|
||||||
fd = ruby_socket(family, SOCK_DGRAM, 0);
|
fd = rsock_socket(family, SOCK_DGRAM, 0);
|
||||||
if (fd < 0) {
|
if (fd < 0) {
|
||||||
rb_sys_fail("socket(2) - udp");
|
rb_sys_fail("socket(2) - udp");
|
||||||
}
|
}
|
||||||
|
@ -55,7 +55,7 @@ udp_connect_internal(struct udp_arg *arg)
|
||||||
struct addrinfo *res;
|
struct addrinfo *res;
|
||||||
|
|
||||||
for (res = arg->res; res; res = res->ai_next) {
|
for (res = arg->res; res; res = res->ai_next) {
|
||||||
if (ruby_connect(fd, res->ai_addr, res->ai_addrlen, 0) >= 0) {
|
if (rsock_connect(fd, res->ai_addr, res->ai_addrlen, 0) >= 0) {
|
||||||
return Qtrue;
|
return Qtrue;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -86,7 +86,7 @@ udp_connect(VALUE sock, VALUE host, VALUE port)
|
||||||
VALUE ret;
|
VALUE ret;
|
||||||
|
|
||||||
rb_secure(3);
|
rb_secure(3);
|
||||||
arg.res = sock_addrinfo(host, port, SOCK_DGRAM, 0);
|
arg.res = rsock_addrinfo(host, port, SOCK_DGRAM, 0);
|
||||||
GetOpenFile(sock, fptr);
|
GetOpenFile(sock, fptr);
|
||||||
arg.fd = fptr->fd;
|
arg.fd = fptr->fd;
|
||||||
ret = rb_ensure(udp_connect_internal, (VALUE)&arg,
|
ret = rb_ensure(udp_connect_internal, (VALUE)&arg,
|
||||||
|
@ -114,7 +114,7 @@ udp_bind(VALUE sock, VALUE host, VALUE port)
|
||||||
struct addrinfo *res0, *res;
|
struct addrinfo *res0, *res;
|
||||||
|
|
||||||
rb_secure(3);
|
rb_secure(3);
|
||||||
res0 = sock_addrinfo(host, port, SOCK_DGRAM, 0);
|
res0 = rsock_addrinfo(host, port, SOCK_DGRAM, 0);
|
||||||
GetOpenFile(sock, fptr);
|
GetOpenFile(sock, fptr);
|
||||||
for (res = res0; res; res = res->ai_next) {
|
for (res = res0; res; res = res->ai_next) {
|
||||||
if (bind(fptr->fd, res->ai_addr, res->ai_addrlen) < 0) {
|
if (bind(fptr->fd, res->ai_addr, res->ai_addrlen) < 0) {
|
||||||
|
@ -166,7 +166,7 @@ udp_send(int argc, VALUE *argv, VALUE sock)
|
||||||
rb_scan_args(argc, argv, "4", &arg.mesg, &flags, &host, &port);
|
rb_scan_args(argc, argv, "4", &arg.mesg, &flags, &host, &port);
|
||||||
|
|
||||||
StringValue(arg.mesg);
|
StringValue(arg.mesg);
|
||||||
res0 = sock_addrinfo(host, port, SOCK_DGRAM, 0);
|
res0 = rsock_addrinfo(host, port, SOCK_DGRAM, 0);
|
||||||
GetOpenFile(sock, fptr);
|
GetOpenFile(sock, fptr);
|
||||||
arg.fd = fptr->fd;
|
arg.fd = fptr->fd;
|
||||||
arg.flags = NUM2INT(flags);
|
arg.flags = NUM2INT(flags);
|
||||||
|
|
|
@ -19,8 +19,8 @@ struct unixsock_arg {
|
||||||
static VALUE
|
static VALUE
|
||||||
unixsock_connect_internal(struct unixsock_arg *arg)
|
unixsock_connect_internal(struct unixsock_arg *arg)
|
||||||
{
|
{
|
||||||
return (VALUE)ruby_connect(arg->fd, (struct sockaddr*)arg->sockaddr,
|
return (VALUE)rsock_connect(arg->fd, (struct sockaddr*)arg->sockaddr,
|
||||||
sizeof(*arg->sockaddr), 0);
|
sizeof(*arg->sockaddr), 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
VALUE
|
VALUE
|
||||||
|
@ -31,7 +31,7 @@ rsock_init_unixsock(VALUE sock, VALUE path, int server)
|
||||||
rb_io_t *fptr;
|
rb_io_t *fptr;
|
||||||
|
|
||||||
SafeStringValue(path);
|
SafeStringValue(path);
|
||||||
fd = ruby_socket(AF_UNIX, SOCK_STREAM, 0);
|
fd = rsock_socket(AF_UNIX, SOCK_STREAM, 0);
|
||||||
if (fd < 0) {
|
if (fd < 0) {
|
||||||
rb_sys_fail("socket(2)");
|
rb_sys_fail("socket(2)");
|
||||||
}
|
}
|
||||||
|
@ -482,7 +482,7 @@ unix_s_socketpair(int argc, VALUE *argv, VALUE klass)
|
||||||
args[1] = type;
|
args[1] = type;
|
||||||
args[2] = protocol;
|
args[2] = protocol;
|
||||||
|
|
||||||
return sock_s_socketpair(3, args, klass);
|
return rsock_sock_s_socketpair(3, args, klass);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue