ReactOS 0.4.16-dev-927-g467dec4
commit.cpp File Reference
Include dependency graph for commit.cpp:

Go to the source code of this file.

Functions

int __cdecl _commit (int const fh)
 

Function Documentation

◆ _commit()

int __cdecl _commit ( int const  fh)

Definition at line 15 of file commit.cpp.

16{
17 _CHECK_FH_RETURN(fh, EBADF, -1);
18 _VALIDATE_RETURN((fh >= 0 && (unsigned)fh < (unsigned)_nhandle), EBADF, -1);
19 _VALIDATE_RETURN((_osfile(fh) & FOPEN), EBADF, -1);
20
21 return __acrt_lowio_lock_fh_and_call(fh, [&]()
22 {
23 if (_osfile(fh) & FOPEN)
24 {
25 if (FlushFileBuffers(reinterpret_cast<HANDLE>(_get_osfhandle(fh))))
26 return 0; // Success
27
29 }
30
31 errno = EBADF;
32
33 _ASSERTE(("Invalid file descriptor. File possibly closed by a different thread",0));
34 return -1;
35 });
36}
#define EBADF
Definition: acclib.h:82
#define _CHECK_FH_RETURN(handle, errorcode, retexpr)
int _nhandle
Definition: ioinit.cpp:34
auto __acrt_lowio_lock_fh_and_call(int const fh, Action &&action) -> decltype(action())
#define _VALIDATE_RETURN(expr, errorcode, retexpr)
#define _ASSERTE(expr)
Definition: crtdbg.h:114
BOOL WINAPI FlushFileBuffers(IN HANDLE hFile)
Definition: fileinfo.c:25
#define FOPEN
#define _doserrno
Definition: stdlib.h:131
#define errno
Definition: errno.h:18
_CRTIMP intptr_t __cdecl _get_osfhandle(_In_ int _FileHandle)
#define _osfile(i)
Definition: internal.h:72
DWORD WINAPI GetLastError(void)
Definition: except.c:1042