Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion compat/mingw.c
Original file line number Diff line number Diff line change
Expand Up @@ -2938,7 +2938,7 @@ int mingw_rename(const char *pold, const char *pnew)
if (supports_file_rename_info_ex) {
/*
* Our minimum required Windows version is still set to Windows
* Vista. We thus have to declare required infrastructure for
* 8.1. We thus have to declare required infrastructure for
* FileRenameInfoEx ourselves until we bump _WIN32_WINNT to
* 0x0A00. Furthermore, we have to handle cases where the
* FileRenameInfoEx call isn't supported yet.
Expand Down
2 changes: 1 addition & 1 deletion compat/nedmalloc/malloc.c.h
Original file line number Diff line number Diff line change
Expand Up @@ -500,7 +500,7 @@ MAX_RELEASE_CHECK_RATE default: 4095 unless not HAVE_MMAP
#ifdef WIN32
#define WIN32_LEAN_AND_MEAN
#ifndef _WIN32_WINNT
#define _WIN32_WINNT 0x403
#define _WIN32_WINNT 0x603
#endif
#include <windows.h>
#define HAVE_MMAP 1
Expand Down
4 changes: 2 additions & 2 deletions compat/poll/poll.c
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@

#define DISABLE_SIGN_COMPARE_WARNINGS

/* To bump the minimum Windows version to Windows Vista */
/* To bump the minimum Windows version to Windows 8.1 */
#include "git-compat-util.h"

/* Tell gcc not to warn about the (nfd < 0) tests, below. */
Expand All @@ -41,7 +41,7 @@
#if (defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__
# define WIN32_NATIVE
# if defined (_MSC_VER) && !defined(_WIN32_WINNT)
# define _WIN32_WINNT 0x0502
# define _WIN32_WINNT 0x0603
# endif
# include <winsock2.h>
# include <windows.h>
Expand Down
2 changes: 1 addition & 1 deletion compat/posix.h
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@

#if defined(WIN32) && !defined(__CYGWIN__) /* Both MinGW and MSVC */
# if !defined(_WIN32_WINNT)
# define _WIN32_WINNT 0x0600
# define _WIN32_WINNT 0x0603
# endif
#define WIN32_LEAN_AND_MEAN /* stops windows.h including winsock.h */
#include <winsock2.h>
Expand Down
2 changes: 2 additions & 0 deletions compat/win32/flush.c
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,9 @@ int win32_fsync_no_flush(int fd)
{
IO_STATUS_BLOCK io_status;

#ifndef FLUSH_FLAGS_FILE_DATA_ONLY
#define FLUSH_FLAGS_FILE_DATA_ONLY 1
#endif

DECLARE_PROC_ADDR(ntdll.dll, NTSTATUS, NTAPI, NtFlushBuffersFileEx,
HANDLE FileHandle, ULONG Flags, PVOID Parameters, ULONG ParameterSize,
Expand Down
27 changes: 22 additions & 5 deletions thread-utils.c
Original file line number Diff line number Diff line change
Expand Up @@ -28,11 +28,28 @@ int online_cpus(void)
#endif

#ifdef GIT_WINDOWS_NATIVE
SYSTEM_INFO info;
GetSystemInfo(&info);

if ((int)info.dwNumberOfProcessors > 0)
return (int)info.dwNumberOfProcessors;
DWORD len = 0;
if (!GetLogicalProcessorInformationEx(RelationProcessorCore, NULL, &len) && GetLastError() == ERROR_INSUFFICIENT_BUFFER) {
uint8_t *buf = malloc(len);
if (buf) {
if (GetLogicalProcessorInformationEx(RelationProcessorCore, (PSYSTEM_LOGICAL_PROCESSOR_INFORMATION_EX) buf, &len)) {
DWORD offset = 0;
int n_cores = 0;
while (offset < len) {
PSYSTEM_LOGICAL_PROCESSOR_INFORMATION_EX info = (PSYSTEM_LOGICAL_PROCESSOR_INFORMATION_EX) (buf + offset);
offset += info->Size;
/* The threads within a core always share a single group. We need to count the bits in the mask to get a thread count. */
for (KAFFINITY mask = info->Processor.GroupMask[0].Mask; mask; mask >>= 1)
n_cores += mask &1;
}
if (n_cores) {
free(buf);
return n_cores;
}
}
free(buf);
}
}
#elif defined(hpux) || defined(__hpux) || defined(_hpux)
struct pst_dynamic psd;

Expand Down
Loading