提交 bea13805 编写于 作者: T twisti

7157695: Add windows implementation of socket interface

Reviewed-by: kvn, dholmes, twisti
Contributed-by: NNils Eliasson <nils.eliasson@oracle.com>
上级 c2d69d99
......@@ -59,7 +59,7 @@ typedef struct _MODULEINFO {
#include <Tlhelp32.h>
typedef unsigned int socklen_t;
typedef int socklen_t;
// #include "jni.h"
......
......@@ -4820,99 +4820,92 @@ struct hostent* os::get_host_by_name(char* name) {
return (struct hostent*)os::WinSock2Dll::gethostbyname(name);
}
int os::socket_close(int fd) {
ShouldNotReachHere();
return 0;
return ::closesocket(fd);
}
int os::socket_available(int fd, jint *pbytes) {
ShouldNotReachHere();
return 0;
int ret = ::ioctlsocket(fd, FIONREAD, (u_long*)pbytes);
return (ret < 0) ? 0 : 1;
}
int os::socket(int domain, int type, int protocol) {
ShouldNotReachHere();
return 0;
return ::socket(domain, type, protocol);
}
int os::listen(int fd, int count) {
ShouldNotReachHere();
return 0;
return ::listen(fd, count);
}
int os::connect(int fd, struct sockaddr* him, socklen_t len) {
ShouldNotReachHere();
return 0;
return ::connect(fd, him, len);
}
int os::accept(int fd, struct sockaddr* him, socklen_t* len) {
ShouldNotReachHere();
return 0;
return ::accept(fd, him, len);
}
int os::sendto(int fd, char* buf, size_t len, uint flags,
struct sockaddr* to, socklen_t tolen) {
ShouldNotReachHere();
return 0;
return ::sendto(fd, buf, (int)len, flags, to, tolen);
}
int os::recvfrom(int fd, char *buf, size_t nBytes, uint flags,
sockaddr* from, socklen_t* fromlen) {
ShouldNotReachHere();
return 0;
return ::recvfrom(fd, buf, (int)nBytes, flags, from, fromlen);
}
int os::recv(int fd, char* buf, size_t nBytes, uint flags) {
ShouldNotReachHere();
return 0;
return ::recv(fd, buf, (int)nBytes, flags);
}
int os::send(int fd, char* buf, size_t nBytes, uint flags) {
ShouldNotReachHere();
return 0;
return ::send(fd, buf, (int)nBytes, flags);
}
int os::raw_send(int fd, char* buf, size_t nBytes, uint flags) {
ShouldNotReachHere();
return 0;
return ::send(fd, buf, (int)nBytes, flags);
}
int os::timeout(int fd, long timeout) {
ShouldNotReachHere();
return 0;
fd_set tbl;
struct timeval t;
t.tv_sec = timeout / 1000;
t.tv_usec = (timeout % 1000) * 1000;
tbl.fd_count = 1;
tbl.fd_array[0] = fd;
return ::select(1, &tbl, 0, 0, &t);
}
int os::get_host_name(char* name, int namelen) {
ShouldNotReachHere();
return 0;
return ::gethostname(name, namelen);
}
int os::socket_shutdown(int fd, int howto) {
ShouldNotReachHere();
return 0;
return ::shutdown(fd, howto);
}
int os::bind(int fd, struct sockaddr* him, socklen_t len) {
ShouldNotReachHere();
return 0;
return ::bind(fd, him, len);
}
int os::get_sock_name(int fd, struct sockaddr* him, socklen_t* len) {
ShouldNotReachHere();
return 0;
return ::getsockname(fd, him, len);
}
int os::get_sock_opt(int fd, int level, int optname,
char* optval, socklen_t* optlen) {
ShouldNotReachHere();
return 0;
return ::getsockopt(fd, level, optname, optval, optlen);
}
int os::set_sock_opt(int fd, int level, int optname,
const char* optval, socklen_t optlen) {
ShouldNotReachHere();
return 0;
return ::setsockopt(fd, level, optname, optval, optlen);
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册