MCPcopy Create free account
hub / github.com/apache/cloudberry / pg_pwrite

Function pg_pwrite

src/port/pwrite.c:26–55  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

24#endif
25
26ssize_t
27pg_pwrite(int fd, const void *buf, size_t size, off_t offset)
28{
29#ifdef WIN32
30 OVERLAPPED overlapped = {0};
31 HANDLE handle;
32 DWORD result;
33
34 handle = (HANDLE) _get_osfhandle(fd);
35 if (handle == INVALID_HANDLE_VALUE)
36 {
37 errno = EBADF;
38 return -1;
39 }
40
41 overlapped.Offset = offset;
42 if (!WriteFile(handle, buf, size, &result, &overlapped))
43 {
44 _dosmaperr(GetLastError());
45 return -1;
46 }
47
48 return result;
49#else
50 if (lseek(fd, offset, SEEK_SET) < 0)
51 return -1;
52
53 return write(fd, buf, size);
54#endif
55}

Callers 12

qtext_storeFunction · 0.85
AddToDataDirLockFileFunction · 0.85
XLogWalRcvWriteFunction · 0.85
FileWriteFunction · 0.85
XLogWriteFunction · 0.85
XLogFileInitFunction · 0.85
SlruPhysicalWritePageFunction · 0.85
pg_pwritevFunction · 0.85
test_syncFunction · 0.85
test_open_syncFunction · 0.85
test_non_syncFunction · 0.85

Calls 2

_dosmaperrFunction · 0.85
GetLastErrorFunction · 0.85

Tested by 3

test_syncFunction · 0.68
test_open_syncFunction · 0.68
test_non_syncFunction · 0.68