1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
|
commit a03e18c3d85dd0e4c50be4630afd5bf5cffd9a0e (HEAD -> ymake-refactoring)
author: thegeorg
date: 2022-01-24T14:25:44+03:00
Make psutil compile with -fno-common
--- contrib/python/psutil/py3/psutil/_psutil_common.c (dd7c6db013778a31c03086c567edb72a9dfa4604)
+++ contrib/python/psutil/py3/psutil/_psutil_common.c (a03e18c3d85dd0e4c50be4630afd5bf5cffd9a0e)
@@ -7,6 +7,7 @@
*/
#include <Python.h>
+#define PSUTIL_MAYBE_EXTERN
#include "_psutil_common.h"
// ====================================================================
--- contrib/python/psutil/py3/psutil/arch/windows/ntextapi.h (dd7c6db013778a31c03086c567edb72a9dfa4604)
+++ contrib/python/psutil/py3/psutil/arch/windows/ntextapi.h (a03e18c3d85dd0e4c50be4630afd5bf5cffd9a0e)
@@ -10,6 +10,10 @@
#include <winternl.h>
#include <iphlpapi.h>
+#ifndef PSUTIL_MAYBE_EXTERN
+#define PSUTIL_MAYBE_EXTERN extern
+#endif
+
typedef LONG NTSTATUS;
// https://github.com/ajkhoury/TestDll/blob/master/nt_ddk.h
@@ -550,14 +554,14 @@ typedef struct {
// Type defs for modules loaded at runtime.
// ================================================================
-BOOL (WINAPI *_GetLogicalProcessorInformationEx) (
+PSUTIL_MAYBE_EXTERN BOOL (WINAPI *_GetLogicalProcessorInformationEx) (
LOGICAL_PROCESSOR_RELATIONSHIP relationship,
PSYSTEM_LOGICAL_PROCESSOR_INFORMATION_EX Buffer,
PDWORD ReturnLength);
#define GetLogicalProcessorInformationEx _GetLogicalProcessorInformationEx
-BOOLEAN (WINAPI * _WinStationQueryInformationW) (
+PSUTIL_MAYBE_EXTERN BOOLEAN (WINAPI * _WinStationQueryInformationW) (
HANDLE ServerHandle,
ULONG SessionId,
WINSTATIONINFOCLASS WinStationInformationClass,
@@ -567,7 +571,7 @@ BOOLEAN (WINAPI * _WinStationQueryInformationW) (
#define WinStationQueryInformationW _WinStationQueryInformationW
-NTSTATUS (NTAPI *_NtQueryInformationProcess) (
+PSUTIL_MAYBE_EXTERN NTSTATUS (NTAPI *_NtQueryInformationProcess) (
HANDLE ProcessHandle,
DWORD ProcessInformationClass,
PVOID ProcessInformation,
@@ -576,7 +580,7 @@ NTSTATUS (NTAPI *_NtQueryInformationProcess) (
#define NtQueryInformationProcess _NtQueryInformationProcess
-NTSTATUS (NTAPI *_NtQuerySystemInformation) (
+PSUTIL_MAYBE_EXTERN NTSTATUS (NTAPI *_NtQuerySystemInformation) (
ULONG SystemInformationClass,
PVOID SystemInformation,
ULONG SystemInformationLength,
@@ -584,7 +588,7 @@ NTSTATUS (NTAPI *_NtQuerySystemInformation) (
#define NtQuerySystemInformation _NtQuerySystemInformation
-NTSTATUS (NTAPI *_NtSetInformationProcess) (
+PSUTIL_MAYBE_EXTERN NTSTATUS (NTAPI *_NtSetInformationProcess) (
HANDLE ProcessHandle,
DWORD ProcessInformationClass,
PVOID ProcessInformation,
@@ -592,19 +596,19 @@ NTSTATUS (NTAPI *_NtSetInformationProcess) (
#define NtSetInformationProcess _NtSetInformationProcess
-PSTR (NTAPI * _RtlIpv4AddressToStringA) (
+PSUTIL_MAYBE_EXTERN PSTR (NTAPI * _RtlIpv4AddressToStringA) (
struct in_addr *Addr,
PSTR S);
#define RtlIpv4AddressToStringA _RtlIpv4AddressToStringA
-PSTR (NTAPI * _RtlIpv6AddressToStringA) (
+PSUTIL_MAYBE_EXTERN PSTR (NTAPI * _RtlIpv6AddressToStringA) (
struct in6_addr *Addr,
PSTR P);
#define RtlIpv6AddressToStringA _RtlIpv6AddressToStringA
-DWORD (WINAPI * _GetExtendedTcpTable) (
+PSUTIL_MAYBE_EXTERN DWORD (WINAPI * _GetExtendedTcpTable) (
PVOID pTcpTable,
PDWORD pdwSize,
BOOL bOrder,
@@ -614,7 +618,7 @@ DWORD (WINAPI * _GetExtendedTcpTable) (
#define GetExtendedTcpTable _GetExtendedTcpTable
-DWORD (WINAPI * _GetExtendedUdpTable) (
+PSUTIL_MAYBE_EXTERN DWORD (WINAPI * _GetExtendedUdpTable) (
PVOID pUdpTable,
PDWORD pdwSize,
BOOL bOrder,
@@ -624,12 +628,12 @@ DWORD (WINAPI * _GetExtendedUdpTable) (
#define GetExtendedUdpTable _GetExtendedUdpTable
-DWORD (CALLBACK *_GetActiveProcessorCount) (
+PSUTIL_MAYBE_EXTERN DWORD (CALLBACK *_GetActiveProcessorCount) (
WORD GroupNumber);
#define GetActiveProcessorCount _GetActiveProcessorCount
-BOOL(CALLBACK *_WTSQuerySessionInformationW) (
+PSUTIL_MAYBE_EXTERN BOOL(CALLBACK *_WTSQuerySessionInformationW) (
HANDLE hServer,
DWORD SessionId,
WTS_INFO_CLASS WTSInfoClass,
@@ -639,7 +643,7 @@ BOOL(CALLBACK *_WTSQuerySessionInformationW) (
#define WTSQuerySessionInformationW _WTSQuerySessionInformationW
-BOOL(CALLBACK *_WTSEnumerateSessionsW)(
+PSUTIL_MAYBE_EXTERN BOOL(CALLBACK *_WTSEnumerateSessionsW)(
HANDLE hServer,
DWORD Reserved,
DWORD Version,
@@ -649,18 +653,18 @@ BOOL(CALLBACK *_WTSEnumerateSessionsW)(
#define WTSEnumerateSessionsW _WTSEnumerateSessionsW
-VOID(CALLBACK *_WTSFreeMemory)(
+PSUTIL_MAYBE_EXTERN VOID(CALLBACK *_WTSFreeMemory)(
IN PVOID pMemory
);
#define WTSFreeMemory _WTSFreeMemory
-ULONGLONG (CALLBACK *_GetTickCount64) (
+PSUTIL_MAYBE_EXTERN ULONGLONG (CALLBACK *_GetTickCount64) (
void);
#define GetTickCount64 _GetTickCount64
-NTSTATUS (NTAPI *_NtQueryObject) (
+PSUTIL_MAYBE_EXTERN NTSTATUS (NTAPI *_NtQueryObject) (
HANDLE Handle,
OBJECT_INFORMATION_CLASS ObjectInformationClass,
PVOID ObjectInformation,
@@ -669,25 +673,25 @@ NTSTATUS (NTAPI *_NtQueryObject) (
#define NtQueryObject _NtQueryObject
-NTSTATUS (WINAPI *_RtlGetVersion) (
+PSUTIL_MAYBE_EXTERN NTSTATUS (WINAPI *_RtlGetVersion) (
PRTL_OSVERSIONINFOW lpVersionInformation
);
#define RtlGetVersion _RtlGetVersion
-NTSTATUS (WINAPI *_NtResumeProcess) (
+PSUTIL_MAYBE_EXTERN NTSTATUS (WINAPI *_NtResumeProcess) (
HANDLE hProcess
);
#define NtResumeProcess _NtResumeProcess
-NTSTATUS (WINAPI *_NtSuspendProcess) (
+PSUTIL_MAYBE_EXTERN NTSTATUS (WINAPI *_NtSuspendProcess) (
HANDLE hProcess
);
#define NtSuspendProcess _NtSuspendProcess
-NTSTATUS (NTAPI *_NtQueryVirtualMemory) (
+PSUTIL_MAYBE_EXTERN NTSTATUS (NTAPI *_NtQueryVirtualMemory) (
HANDLE ProcessHandle,
PVOID BaseAddress,
int MemoryInformationClass,
@@ -698,7 +702,7 @@ NTSTATUS (NTAPI *_NtQueryVirtualMemory) (
#define NtQueryVirtualMemory _NtQueryVirtualMemory
-ULONG (WINAPI *_RtlNtStatusToDosErrorNoTeb) (
+PSUTIL_MAYBE_EXTERN ULONG (WINAPI *_RtlNtStatusToDosErrorNoTeb) (
NTSTATUS status
);
|