interplane.Get Omega
Read in your language

git

[Ported from github.com/git/git] Sync with Git 2.56.1

Brought by drakestapleton

branch master Branches Tags History

git / compat / win32 / flush.c

30 lines · 730 bytes Raw Blame History
1#include "git-compat-util.h"
2#include <winternl.h>
3#include "lazyload.h"
4
5int win32_fsync_no_flush(int fd)
6{
7 IO_STATUS_BLOCK io_status;
8
9#ifndef FLUSH_FLAGS_FILE_DATA_ONLY
10#define FLUSH_FLAGS_FILE_DATA_ONLY 1
11#endif
12
13 DECLARE_PROC_ADDR(ntdll.dll, NTSTATUS, NTAPI, NtFlushBuffersFileEx,
14 HANDLE FileHandle, ULONG Flags, PVOID Parameters, ULONG ParameterSize,
15 PIO_STATUS_BLOCK IoStatusBlock);
16
17 if (!INIT_PROC_ADDR(NtFlushBuffersFileEx)) {
18 errno = ENOSYS;
19 return -1;
20 }
21
22 memset(&io_status, 0, sizeof(io_status));
23 if (NtFlushBuffersFileEx((HANDLE)_get_osfhandle(fd), FLUSH_FLAGS_FILE_DATA_ONLY,
24 NULL, 0, &io_status)) {
25 errno = EINVAL;
26 return -1;
27 }
28
29 return 0;
30}