#include "c.h"
#include <windows.h>
Go to the source code of this file.
◆ pg_pread()
ssize_t pg_pread |
( |
int |
fd, |
|
|
void * |
buf, |
|
|
size_t |
size, |
|
|
off_t |
offset |
|
) |
| |
Definition at line 20 of file win32pread.c.
21{
22 OVERLAPPED overlapped = {0};
23 HANDLE handle;
24 DWORD result;
25
26 handle = (HANDLE) _get_osfhandle(
fd);
27 if (handle == INVALID_HANDLE_VALUE)
28 {
29 errno = EBADF;
30 return -1;
31 }
32
33
35
36
37 overlapped.Offset = offset;
38 if (!ReadFile(handle,
buf,
size, &result, &overlapped))
39 {
40 if (GetLastError() == ERROR_HANDLE_EOF)
41 return 0;
42
44 return -1;
45 }
46
47 return result;
48}
static int fd(const char *x, int i)
static pg_noinline void Size size
void _dosmaperr(unsigned long)
References _dosmaperr(), buf, fd(), Min, and size.