src/os/windows/vm/os_windows.cpp

changeset 3747
ec15e8f6e4f1
parent 3606
da4be62fb889
child 3783
7432b9db36ff
equal deleted inserted replaced
3746:df3d4a91f7f6 3747:ec15e8f6e4f1
4818 return NULL; 4818 return NULL;
4819 } 4819 }
4820 return (struct hostent*)os::WinSock2Dll::gethostbyname(name); 4820 return (struct hostent*)os::WinSock2Dll::gethostbyname(name);
4821 } 4821 }
4822 4822
4823
4824 int os::socket_close(int fd) { 4823 int os::socket_close(int fd) {
4825 ShouldNotReachHere(); 4824 return ::closesocket(fd);
4826 return 0;
4827 } 4825 }
4828 4826
4829 int os::socket_available(int fd, jint *pbytes) { 4827 int os::socket_available(int fd, jint *pbytes) {
4830 ShouldNotReachHere(); 4828 int ret = ::ioctlsocket(fd, FIONREAD, (u_long*)pbytes);
4831 return 0; 4829 return (ret < 0) ? 0 : 1;
4832 } 4830 }
4833 4831
4834 int os::socket(int domain, int type, int protocol) { 4832 int os::socket(int domain, int type, int protocol) {
4835 ShouldNotReachHere(); 4833 return ::socket(domain, type, protocol);
4836 return 0;
4837 } 4834 }
4838 4835
4839 int os::listen(int fd, int count) { 4836 int os::listen(int fd, int count) {
4840 ShouldNotReachHere(); 4837 return ::listen(fd, count);
4841 return 0;
4842 } 4838 }
4843 4839
4844 int os::connect(int fd, struct sockaddr* him, socklen_t len) { 4840 int os::connect(int fd, struct sockaddr* him, socklen_t len) {
4845 ShouldNotReachHere(); 4841 return ::connect(fd, him, len);
4846 return 0;
4847 } 4842 }
4848 4843
4849 int os::accept(int fd, struct sockaddr* him, socklen_t* len) { 4844 int os::accept(int fd, struct sockaddr* him, socklen_t* len) {
4850 ShouldNotReachHere(); 4845 return ::accept(fd, him, len);
4851 return 0;
4852 } 4846 }
4853 4847
4854 int os::sendto(int fd, char* buf, size_t len, uint flags, 4848 int os::sendto(int fd, char* buf, size_t len, uint flags,
4855 struct sockaddr* to, socklen_t tolen) { 4849 struct sockaddr* to, socklen_t tolen) {
4856 ShouldNotReachHere(); 4850
4857 return 0; 4851 return ::sendto(fd, buf, (int)len, flags, to, tolen);
4858 } 4852 }
4859 4853
4860 int os::recvfrom(int fd, char *buf, size_t nBytes, uint flags, 4854 int os::recvfrom(int fd, char *buf, size_t nBytes, uint flags,
4861 sockaddr* from, socklen_t* fromlen) { 4855 sockaddr* from, socklen_t* fromlen) {
4862 ShouldNotReachHere(); 4856
4863 return 0; 4857 return ::recvfrom(fd, buf, (int)nBytes, flags, from, fromlen);
4864 } 4858 }
4865 4859
4866 int os::recv(int fd, char* buf, size_t nBytes, uint flags) { 4860 int os::recv(int fd, char* buf, size_t nBytes, uint flags) {
4867 ShouldNotReachHere(); 4861 return ::recv(fd, buf, (int)nBytes, flags);
4868 return 0;
4869 } 4862 }
4870 4863
4871 int os::send(int fd, char* buf, size_t nBytes, uint flags) { 4864 int os::send(int fd, char* buf, size_t nBytes, uint flags) {
4872 ShouldNotReachHere(); 4865 return ::send(fd, buf, (int)nBytes, flags);
4873 return 0;
4874 } 4866 }
4875 4867
4876 int os::raw_send(int fd, char* buf, size_t nBytes, uint flags) { 4868 int os::raw_send(int fd, char* buf, size_t nBytes, uint flags) {
4877 ShouldNotReachHere(); 4869 return ::send(fd, buf, (int)nBytes, flags);
4878 return 0;
4879 } 4870 }
4880 4871
4881 int os::timeout(int fd, long timeout) { 4872 int os::timeout(int fd, long timeout) {
4882 ShouldNotReachHere(); 4873 fd_set tbl;
4883 return 0; 4874 struct timeval t;
4875
4876 t.tv_sec = timeout / 1000;
4877 t.tv_usec = (timeout % 1000) * 1000;
4878
4879 tbl.fd_count = 1;
4880 tbl.fd_array[0] = fd;
4881
4882 return ::select(1, &tbl, 0, 0, &t);
4884 } 4883 }
4885 4884
4886 int os::get_host_name(char* name, int namelen) { 4885 int os::get_host_name(char* name, int namelen) {
4887 ShouldNotReachHere(); 4886 return ::gethostname(name, namelen);
4888 return 0;
4889 } 4887 }
4890 4888
4891 int os::socket_shutdown(int fd, int howto) { 4889 int os::socket_shutdown(int fd, int howto) {
4892 ShouldNotReachHere(); 4890 return ::shutdown(fd, howto);
4893 return 0;
4894 } 4891 }
4895 4892
4896 int os::bind(int fd, struct sockaddr* him, socklen_t len) { 4893 int os::bind(int fd, struct sockaddr* him, socklen_t len) {
4897 ShouldNotReachHere(); 4894 return ::bind(fd, him, len);
4898 return 0;
4899 } 4895 }
4900 4896
4901 int os::get_sock_name(int fd, struct sockaddr* him, socklen_t* len) { 4897 int os::get_sock_name(int fd, struct sockaddr* him, socklen_t* len) {
4902 ShouldNotReachHere(); 4898 return ::getsockname(fd, him, len);
4903 return 0;
4904 } 4899 }
4905 4900
4906 int os::get_sock_opt(int fd, int level, int optname, 4901 int os::get_sock_opt(int fd, int level, int optname,
4907 char* optval, socklen_t* optlen) { 4902 char* optval, socklen_t* optlen) {
4908 ShouldNotReachHere(); 4903 return ::getsockopt(fd, level, optname, optval, optlen);
4909 return 0;
4910 } 4904 }
4911 4905
4912 int os::set_sock_opt(int fd, int level, int optname, 4906 int os::set_sock_opt(int fd, int level, int optname,
4913 const char* optval, socklen_t optlen) { 4907 const char* optval, socklen_t optlen) {
4914 ShouldNotReachHere(); 4908 return ::setsockopt(fd, level, optname, optval, optlen);
4915 return 0;
4916 } 4909 }
4917 4910
4918 4911
4919 // Kernel32 API 4912 // Kernel32 API
4920 typedef SIZE_T (WINAPI* GetLargePageMinimum_Fn)(void); 4913 typedef SIZE_T (WINAPI* GetLargePageMinimum_Fn)(void);

mercurial