mirror of
https://github.com/openjdk/jdk.git
synced 2025-09-21 03:24:38 +02:00
Merge
This commit is contained in:
commit
4b9150eaf7
96 changed files with 3726 additions and 1144 deletions
|
@ -3773,6 +3773,8 @@ extern "C" {
|
|||
}
|
||||
}
|
||||
|
||||
static jint initSock();
|
||||
|
||||
// this is called _after_ the global arguments have been parsed
|
||||
jint os::init_2(void) {
|
||||
// Allocate a single page and mark it as readable for safepoint polling
|
||||
|
@ -3903,6 +3905,10 @@ jint os::init_2(void) {
|
|||
if (!success) UseNUMAInterleaving = false;
|
||||
}
|
||||
|
||||
if (initSock() != JNI_OK) {
|
||||
return JNI_ERR;
|
||||
}
|
||||
|
||||
return JNI_OK;
|
||||
}
|
||||
|
||||
|
@ -4899,42 +4905,24 @@ LONG WINAPI os::win32::serialize_fault_filter(struct _EXCEPTION_POINTERS* e) {
|
|||
// We don't build a headless jre for Windows
|
||||
bool os::is_headless_jre() { return false; }
|
||||
|
||||
|
||||
typedef CRITICAL_SECTION mutex_t;
|
||||
#define mutexInit(m) InitializeCriticalSection(m)
|
||||
#define mutexDestroy(m) DeleteCriticalSection(m)
|
||||
#define mutexLock(m) EnterCriticalSection(m)
|
||||
#define mutexUnlock(m) LeaveCriticalSection(m)
|
||||
|
||||
static bool sock_initialized = FALSE;
|
||||
static mutex_t sockFnTableMutex;
|
||||
|
||||
static void initSock() {
|
||||
static jint initSock() {
|
||||
WSADATA wsadata;
|
||||
|
||||
if (!os::WinSock2Dll::WinSock2Available()) {
|
||||
jio_fprintf(stderr, "Could not load Winsock 2 (error: %d)\n",
|
||||
jio_fprintf(stderr, "Could not load Winsock (error: %d)\n",
|
||||
::GetLastError());
|
||||
return;
|
||||
return JNI_ERR;
|
||||
}
|
||||
if (sock_initialized == TRUE) return;
|
||||
|
||||
::mutexInit(&sockFnTableMutex);
|
||||
::mutexLock(&sockFnTableMutex);
|
||||
if (os::WinSock2Dll::WSAStartup(MAKEWORD(1,1), &wsadata) != 0) {
|
||||
jio_fprintf(stderr, "Could not initialize Winsock\n");
|
||||
if (os::WinSock2Dll::WSAStartup(MAKEWORD(2,2), &wsadata) != 0) {
|
||||
jio_fprintf(stderr, "Could not initialize Winsock (error: %d)\n",
|
||||
::GetLastError());
|
||||
return JNI_ERR;
|
||||
}
|
||||
sock_initialized = TRUE;
|
||||
::mutexUnlock(&sockFnTableMutex);
|
||||
return JNI_OK;
|
||||
}
|
||||
|
||||
struct hostent* os::get_host_by_name(char* name) {
|
||||
if (!sock_initialized) {
|
||||
initSock();
|
||||
}
|
||||
if (!os::WinSock2Dll::WinSock2Available()) {
|
||||
return NULL;
|
||||
}
|
||||
return (struct hostent*)os::WinSock2Dll::gethostbyname(name);
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue