02-unaccepted-pr2064-missing-extern.patch 6.1 KB

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