mirror of
https://github.com/openjdk/jdk.git
synced 2026-01-28 12:09:14 +00:00
8346383: Cannot use DllMain in libdt_socket for static builds
Reviewed-by: dholmes, sspitsyn
This commit is contained in:
parent
13a1775718
commit
d3a7ac22c9
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 1998, 2024, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 1998, 2025, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@ -1345,6 +1345,10 @@ jdwpTransport_OnLoad(JavaVM *vm, jdwpTransportCallback* cbTablePtr,
|
||||
jvm = vm;
|
||||
callback = cbTablePtr;
|
||||
|
||||
if (dbgsysPlatformInit() != 0) {
|
||||
return JNI_ERR;
|
||||
}
|
||||
|
||||
/* initialize interface table */
|
||||
interface.GetCapabilities = &socketTransport_getCapabilities;
|
||||
interface.Attach = &socketTransport_attach;
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 1998, 2019, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 1998, 2025, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@ -38,6 +38,7 @@
|
||||
typedef int socklen_t;
|
||||
#endif
|
||||
|
||||
int dbgsysPlatformInit();
|
||||
int dbgsysSocketClose(int fd);
|
||||
int dbgsysConnect(int fd, struct sockaddr *him, socklen_t len);
|
||||
int dbgsysFinishConnect(int fd, int timeout);
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 1998, 2023, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 1998, 2025, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@ -39,6 +39,15 @@
|
||||
#include "socket_md.h"
|
||||
#include "sysSocket.h"
|
||||
|
||||
/* Perform platform specific initialization.
|
||||
* Returns 0 on success, non-0 on failure */
|
||||
int
|
||||
dbgsysPlatformInit()
|
||||
{
|
||||
// Not needed on unix
|
||||
return 0;
|
||||
}
|
||||
|
||||
int
|
||||
dbgsysListen(int fd, int backlog) {
|
||||
return listen(fd, backlog);
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 1998, 2023, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 1998, 2025, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@ -22,6 +22,7 @@
|
||||
* or visit www.oracle.com if you need additional information or have any
|
||||
* questions.
|
||||
*/
|
||||
#include <stdlib.h>
|
||||
#include <windows.h>
|
||||
#include <winsock2.h>
|
||||
#include <ws2tcpip.h>
|
||||
@ -88,30 +89,21 @@ static struct {
|
||||
{ WSA_OPERATION_ABORTED, "Overlapped operation aborted" },
|
||||
};
|
||||
|
||||
static void dbgsysAtExitCallback(void)
|
||||
{
|
||||
WSACleanup();
|
||||
}
|
||||
|
||||
/*
|
||||
* Initialize Windows Sockets API support
|
||||
*/
|
||||
BOOL WINAPI
|
||||
DllMain(HINSTANCE hinst, DWORD reason, LPVOID reserved)
|
||||
/* Perform platform specific initialization.
|
||||
* Returns 0 on success, non-0 on failure */
|
||||
int
|
||||
dbgsysPlatformInit()
|
||||
{
|
||||
WSADATA wsadata;
|
||||
|
||||
switch (reason) {
|
||||
case DLL_PROCESS_ATTACH:
|
||||
if (WSAStartup(MAKEWORD(2,2), &wsadata) != 0) {
|
||||
return FALSE;
|
||||
}
|
||||
break;
|
||||
atexit(dbgsysAtExitCallback);
|
||||
|
||||
case DLL_PROCESS_DETACH:
|
||||
WSACleanup();
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
return TRUE;
|
||||
return WSAStartup(MAKEWORD(2,2), &wsadata);
|
||||
}
|
||||
|
||||
/*
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user