summaryrefslogtreecommitdiff
path: root/compat
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2022-03-25 23:38:24 (GMT)
committerJunio C Hamano <gitster@pobox.com>2022-03-25 23:38:24 (GMT)
commiteb804cd405618ef78b772072685c39392aea4ac1 (patch)
treec86dd22ade3bf93d03d9ac01c507c6254c8fee7a /compat
parenta68dfadae5e95c7f255cf38c9efdcbc2e36d1931 (diff)
parentb9f5d0358d2e882d47f496c1a5589f6cebc25578 (diff)
downloadgit-eb804cd405618ef78b772072685c39392aea4ac1.zip
git-eb804cd405618ef78b772072685c39392aea4ac1.tar.gz
git-eb804cd405618ef78b772072685c39392aea4ac1.tar.bz2
Merge branch 'ns/core-fsyncmethod'
Replace core.fsyncObjectFiles with two new configuration variables, core.fsync and core.fsyncMethod. * ns/core-fsyncmethod: core.fsync: documentation and user-friendly aggregate options core.fsync: new option to harden the index core.fsync: add configuration parsing core.fsync: introduce granular fsync control infrastructure core.fsyncmethod: add writeout-only mode wrapper: make inclusion of Windows csprng header tightly scoped
Diffstat (limited to 'compat')
-rw-r--r--compat/mingw.h3
-rw-r--r--compat/win32/flush.c28
-rw-r--r--compat/winansi.c5
3 files changed, 31 insertions, 5 deletions
diff --git a/compat/mingw.h b/compat/mingw.h
index c9a52ad..6074a3d 100644
--- a/compat/mingw.h
+++ b/compat/mingw.h
@@ -329,6 +329,9 @@ int mingw_getpagesize(void);
#define getpagesize mingw_getpagesize
#endif
+int win32_fsync_no_flush(int fd);
+#define fsync_no_flush win32_fsync_no_flush
+
struct rlimit {
unsigned int rlim_cur;
};
diff --git a/compat/win32/flush.c b/compat/win32/flush.c
new file mode 100644
index 0000000..291f90e
--- /dev/null
+++ b/compat/win32/flush.c
@@ -0,0 +1,28 @@
+#include "git-compat-util.h"
+#include <winternl.h>
+#include "lazyload.h"
+
+int win32_fsync_no_flush(int fd)
+{
+ IO_STATUS_BLOCK io_status;
+
+#define FLUSH_FLAGS_FILE_DATA_ONLY 1
+
+ DECLARE_PROC_ADDR(ntdll.dll, NTSTATUS, NTAPI, NtFlushBuffersFileEx,
+ HANDLE FileHandle, ULONG Flags, PVOID Parameters, ULONG ParameterSize,
+ PIO_STATUS_BLOCK IoStatusBlock);
+
+ if (!INIT_PROC_ADDR(NtFlushBuffersFileEx)) {
+ errno = ENOSYS;
+ return -1;
+ }
+
+ memset(&io_status, 0, sizeof(io_status));
+ if (NtFlushBuffersFileEx((HANDLE)_get_osfhandle(fd), FLUSH_FLAGS_FILE_DATA_ONLY,
+ NULL, 0, &io_status)) {
+ errno = EINVAL;
+ return -1;
+ }
+
+ return 0;
+}
diff --git a/compat/winansi.c b/compat/winansi.c
index 936a80a..3abe8dd 100644
--- a/compat/winansi.c
+++ b/compat/winansi.c
@@ -4,11 +4,6 @@
#undef NOGDI
-/*
- * Including the appropriate header file for RtlGenRandom causes MSVC to see a
- * redefinition of types in an incompatible way when including headers below.
- */
-#undef HAVE_RTLGENRANDOM
#include "../git-compat-util.h"
#include <wingdi.h>
#include <winreg.h>