80 #include <sys/types.h>
106 #if defined(HAVE_SYNC_FILE_RANGE)
107 #define PG_FLUSH_DATA_WORKS 1
108 #elif !defined(WIN32) && defined(MS_ASYNC)
109 #define PG_FLUSH_DATA_WORKS 1
110 #elif defined(USE_POSIX_FADVISE) && defined(POSIX_FADV_DONTNEED)
111 #define PG_FLUSH_DATA_WORKS 1
129 #define NUM_RESERVED_FDS 10
138 #define FD_MINFREE 48
175 int _do_db_save_errno = errno; \
177 errno = _do_db_save_errno; \
184 #define VFD_CLOSED (-1)
186 #define FileIsValid(file) \
187 ((file) > 0 && (file) < (int) SizeVfdCache && VfdCache[file].fileName != NULL)
189 #define FileIsNotOpen(file) (VfdCache[file].fd == VFD_CLOSED)
192 #define FD_DELETE_AT_CLOSE (1 << 0)
193 #define FD_CLOSE_AT_EOXACT (1 << 1)
194 #define FD_TEMP_FILE_LIMIT (1 << 2)
239 #ifdef USE_ASSERT_CHECKING
240 static bool temporary_files_allowed =
false;
344 static void walkdir(
const char *path,
345 void (*
action) (
const char *fname,
bool isdir,
int elevel),
346 bool process_symlinks,
348 #ifdef PG_FLUSH_DATA_WORKS
349 static void pre_sync_fname(
const char *fname,
bool isdir,
int elevel);
388 #if !defined(WIN32) && defined(USE_ASSERT_CHECKING)
412 int desc_flags = fcntl(
fd, F_GETFL);
419 Assert((desc_flags & (O_RDWR | O_WRONLY)) == 0);
421 Assert((desc_flags & (O_RDWR | O_WRONLY)) != 0);
427 #if defined(HAVE_FSYNC_WRITETHROUGH)
451 if (rc == -1 && errno ==
EINTR)
465 #if defined(F_FULLFSYNC)
466 return (fcntl(
fd, F_FULLFSYNC, 0) == -1) ? -1 : 0;
490 if (rc == -1 && errno ==
EINTR)
511 else if (!(errno == ENOENT || errno == ENOTDIR || errno == EACCES))
514 errmsg(
"could not access file \"%s\": %m",
name)));
540 #if defined(HAVE_SYNC_FILE_RANGE)
543 static bool not_implemented_by_kernel =
false;
545 if (not_implemented_by_kernel)
559 rc = sync_file_range(
fd, offset, nbytes,
560 SYNC_FILE_RANGE_WRITE);
576 not_implemented_by_kernel =
true;
583 errmsg(
"could not flush dirty data: %m")));
589 #if !defined(WIN32) && defined(MS_ASYNC)
592 static int pagesize = 0;
606 if (offset == 0 && nbytes == 0)
608 nbytes = lseek(
fd, 0, SEEK_END);
613 errmsg(
"could not determine dirty data size: %m")));
626 pagesize = sysconf(_SC_PAGESIZE);
630 nbytes = (nbytes / pagesize) * pagesize;
641 if (nbytes <= (off_t) SSIZE_MAX)
642 p = mmap(NULL, nbytes, PROT_READ, MAP_SHARED,
fd, offset);
650 rc = msync(p, (
size_t) nbytes, MS_ASYNC);
655 errmsg(
"could not flush dirty data: %m")));
659 rc = munmap(p, (
size_t) nbytes);
665 errmsg(
"could not munmap() while flushing data: %m")));
672 #if defined(USE_POSIX_FADVISE) && defined(POSIX_FADV_DONTNEED)
684 rc = posix_fadvise(
fd, offset, nbytes, POSIX_FADV_DONTNEED);
691 errmsg(
"could not flush dirty data: %m")));
710 if (ret == -1 && errno ==
EINTR)
740 ret = truncate(path, length);
742 if (ret == -1 && errno ==
EINTR)
803 errmsg(
"could not open file \"%s\": %m", newfile)));
820 errmsg(
"could not fsync file \"%s\": %m", newfile)));
828 errmsg(
"could not close file \"%s\": %m", newfile)));
834 if (rename(oldfile, newfile) < 0)
838 errmsg(
"could not rename file \"%s\" to \"%s\": %m",
874 if (unlink(fname) < 0)
878 errmsg(
"could not remove file \"%s\": %m",
911 (
errcode(ERRCODE_OUT_OF_MEMORY),
912 errmsg(
"out of memory")));
936 Assert(!temporary_files_allowed);
944 #ifdef USE_ASSERT_CHECKING
945 temporary_files_allowed =
true;
972 #ifdef HAVE_GETRLIMIT
974 int getrlimit_status;
980 #ifdef HAVE_GETRLIMIT
981 getrlimit_status = getrlimit(RLIMIT_NOFILE, &rlim);
982 if (getrlimit_status != 0)
991 #ifdef HAVE_GETRLIMIT
997 if (getrlimit_status == 0 && highestfd >= rlim.rlim_cur - 1)
1005 if (errno != EMFILE && errno != ENFILE)
1006 elog(
WARNING,
"duplicating stderr file descriptor failed after %d successes: %m", used);
1015 fd[used++] = thisfd;
1017 if (highestfd < thisfd)
1020 if (used >= max_to_probe)
1025 for (
j = 0;
j < used;
j++)
1036 *already_open = highestfd + 1 - used;
1058 &usable_fds, &already_open);
1072 (
errcode(ERRCODE_INSUFFICIENT_RESOURCES),
1073 errmsg(
"insufficient file descriptors available to start server process"),
1074 errdetail(
"System allows %d, server needs at least %d.",
1078 elog(
DEBUG2,
"max_safe_fds = %d, usable_fds = %d, already_open = %d",
1114 #ifdef PG_O_DIRECT_USE_F_NOCACHE
1131 "PG_O_DIRECT value collides with standard flag");
1134 fd = open(fileName, fileFlags, fileMode);
1139 #ifdef PG_O_DIRECT_USE_F_NOCACHE
1142 if (fcntl(
fd, F_NOCACHE, 1) < 0)
1144 int save_errno = errno;
1156 if (errno == EMFILE || errno == ENFILE)
1158 int save_errno = errno;
1161 (
errcode(ERRCODE_INSUFFICIENT_RESOURCES),
1162 errmsg(
"out of file descriptors: %m; release and retry")));
1246 #if defined(FDDEBUG)
1304 "could not close file \"%s\": %m", vfdP->
fileName);
1433 if (newCacheSize < 32)
1440 if (newVfdCache == NULL)
1442 (
errcode(ERRCODE_OUT_OF_MEMORY),
1443 errmsg(
"out of memory")));
1507 if (returnValue != 0)
1510 else if (
VfdCache[0].lruLessRecently != file)
1536 (
errmsg(
"temporary file: path \"%s\", size %lu",
1537 path, (
unsigned long)
size)));
1562 FileInvalidate(
File file)
1595 fileName, fileFlags, fileMode));
1600 fnamecopy = strdup(fileName);
1601 if (fnamecopy == NULL)
1603 (
errcode(ERRCODE_OUT_OF_MEMORY),
1604 errmsg(
"out of memory")));
1624 int save_errno = errno;
1637 vfdP->
fileFlags = fileFlags & ~(O_CREAT | O_TRUNC | O_EXCL);
1664 if (errno == EEXIST)
1675 errmsg(
"cannot create temporary directory \"%s\": %m",
1682 errmsg(
"cannot create temporary subdirectory \"%s\": %m",
1693 struct stat statbuf;
1696 if (
stat(dirname, &statbuf) != 0 && errno == ENOENT)
1728 Assert(temporary_files_allowed);
1762 DEFAULTTABLESPACE_OID,
1816 snprintf(tempfilepath,
sizeof(tempfilepath),
"%s/%s%d.%ld",
1824 O_RDWR | O_CREAT | O_TRUNC |
PG_BINARY);
1838 O_RDWR | O_CREAT | O_TRUNC |
PG_BINARY);
1839 if (file <= 0 && rejectError)
1840 elog(
ERROR,
"could not create temporary file \"%s\": %m",
1865 Assert(temporary_files_allowed);
1876 if (error_on_failure)
1879 errmsg(
"could not create temporary file \"%s\": %m",
1905 Assert(temporary_files_allowed);
1912 if (file <= 0 && errno != ENOENT)
1915 errmsg(
"could not open temporary file \"%s\": %m",
1934 struct stat filestats;
1938 if (
stat(path, &filestats) != 0)
1948 if (stat_errno == ENOENT)
1951 if (unlink(path) < 0)
1953 if (errno != ENOENT)
1956 errmsg(
"could not unlink temporary file \"%s\": %m",
1961 if (stat_errno == 0)
1968 errmsg(
"could not stat file \"%s\": %m", path)));
1999 "could not close file \"%s\": %m", vfdP->
fileName);
2021 struct stat filestats;
2047 if (stat_errno == 0)
2083 (int64) offset, (int64) amount));
2085 #if defined(USE_POSIX_FADVISE) && defined(POSIX_FADV_WILLNEED)
2095 returnCode = posix_fadvise(
VfdCache[file].
fd, offset, amount,
2096 POSIX_FADV_WILLNEED);
2099 if (returnCode ==
EINTR)
2104 #elif defined(__darwin__)
2117 ra.ra_offset = offset;
2118 ra.ra_count = amount;
2120 returnCode = fcntl(
VfdCache[file].
fd, F_RDADVISE, &ra);
2122 if (returnCode != -1)
2141 (int64) offset, (int64) nbytes));
2180 returnCode =
pg_preadv(vfdP->
fd, iov, iovcnt, offset);
2193 DWORD
error = GetLastError();
2197 case ERROR_NO_SYSTEM_RESOURCES:
2244 off_t past_write = offset;
2246 for (
int i = 0;
i < iovcnt; ++
i)
2247 past_write += iov[
i].iov_len;
2253 newTotal += past_write - vfdP->
fileSize;
2256 (
errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
2257 errmsg(
"temporary file size exceeds \"temp_file_limit\" (%dkB)",
2264 returnCode =
pg_pwritev(vfdP->
fd, iov, iovcnt, offset);
2267 if (returnCode >= 0)
2283 off_t past_write = offset + returnCode;
2298 DWORD
error = GetLastError();
2302 case ERROR_NO_SYSTEM_RESOURCES:
2356 (int64) offset, (int64) amount));
2368 else if (written != amount)
2394 #ifdef HAVE_POSIX_FALLOCATE
2401 (int64) offset, (int64) amount));
2409 returnCode = posix_fallocate(
VfdCache[file].
fd, offset, amount);
2412 if (returnCode == 0)
2414 else if (returnCode ==
EINTR)
2424 if (returnCode != EINVAL && returnCode !=
EOPNOTSUPP)
2428 return FileZero(file, offset, amount, wait_event_info);
2445 return lseek(
VfdCache[file].
fd, 0, SEEK_END);
2466 if (returnCode == 0 &&
VfdCache[file].fileSize > offset)
2551 if (newDescs == NULL)
2553 (
errcode(ERRCODE_OUT_OF_MEMORY),
2554 errmsg(
"out of memory")));
2577 if (newDescs == NULL)
2616 (
errcode(ERRCODE_INSUFFICIENT_RESOURCES),
2617 errmsg(
"exceeded maxAllocatedDescs (%d) while trying to open file \"%s\"",
2624 if ((file = fopen(
name,
mode)) != NULL)
2635 if (errno == EMFILE || errno == ENFILE)
2637 int save_errno = errno;
2640 (
errcode(ERRCODE_INSUFFICIENT_RESOURCES),
2641 errmsg(
"out of file descriptors: %m; release and retry")));
2669 DO_DB(
elog(
LOG,
"OpenTransientFile: Allocated %d (%s)",
2675 (
errcode(ERRCODE_INSUFFICIENT_RESOURCES),
2676 errmsg(
"exceeded maxAllocatedDescs (%d) while trying to open file \"%s\"",
2720 (
errcode(ERRCODE_INSUFFICIENT_RESOURCES),
2721 errmsg(
"exceeded maxAllocatedDescs (%d) while trying to execute command \"%s\"",
2731 file = popen(command,
mode);
2746 if (errno == EMFILE || errno == ENFILE)
2749 (
errcode(ERRCODE_INSUFFICIENT_RESOURCES),
2750 errmsg(
"out of file descriptors: %m; release and retry")));
2785 elog(
ERROR,
"AllocateDesc kind not recognized");
2820 elog(
WARNING,
"file passed to FreeFile was not obtained from AllocateFile");
2822 return fclose(file);
2848 elog(
WARNING,
"fd passed to CloseTransientFile was not obtained from OpenTransientFile");
2876 (
errcode(ERRCODE_INSUFFICIENT_RESOURCES),
2877 errmsg(
"exceeded maxAllocatedDescs (%d) while trying to open directory \"%s\"",
2884 if ((dir =
opendir(dirname)) != NULL)
2895 if (errno == EMFILE || errno == ENFILE)
2897 int save_errno = errno;
2900 (
errcode(ERRCODE_INSUFFICIENT_RESOURCES),
2901 errmsg(
"out of file descriptors: %m; release and retry")));
2956 errmsg(
"could not open directory \"%s\": %m",
2962 if ((dent =
readdir(dir)) != NULL)
2968 errmsg(
"could not read directory \"%s\": %m",
3004 elog(
WARNING,
"dir passed to FreeDir was not obtained from AllocateDir");
3030 elog(
WARNING,
"file passed to ClosePipeStream was not obtained from OpenPipeStream");
3032 return pclose(file);
3207 #ifdef USE_ASSERT_CHECKING
3208 temporary_files_allowed =
false;
3255 "temporary file %s not closed at end-of-transaction",
3267 elog(
WARNING,
"%d temporary files and directories not closed at end-of-transaction",
3317 if (strcmp(spc_de->
d_name,
".") == 0 ||
3318 strcmp(spc_de->
d_name,
"..") == 0)
3321 snprintf(temp_path,
sizeof(temp_path),
"%s/%s/%s/%s",
3326 snprintf(temp_path,
sizeof(temp_path),
"%s/%s/%s",
3365 if (temp_dir == NULL && errno == ENOENT && missing_ok)
3370 if (strcmp(temp_de->
d_name,
".") == 0 ||
3371 strcmp(temp_de->
d_name,
"..") == 0)
3374 snprintf(rm_path,
sizeof(rm_path),
"%s/%s",
3375 tmpdirname, temp_de->
d_name);
3391 if (rmdir(rm_path) < 0)
3394 errmsg(
"could not remove directory \"%s\": %m",
3399 if (unlink(rm_path) < 0)
3402 errmsg(
"could not remove file \"%s\": %m",
3408 (
errmsg(
"unexpected file found in temporary-files directory: \"%s\"",
3432 if (strspn(de->
d_name,
"0123456789") != strlen(de->
d_name))
3435 snprintf(dbspace_path,
sizeof(dbspace_path),
"%s/%s",
3458 snprintf(rm_path,
sizeof(rm_path),
"%s/%s",
3459 dbspacedirname, de->
d_name);
3461 if (unlink(rm_path) < 0)
3464 errmsg(
"could not remove file \"%s\": %m",
3483 for (pos = 1; isdigit((
unsigned char)
name[pos]); ++pos)
3485 if (pos == 1 ||
name[pos] !=
'_')
3489 for (savepos = ++pos; isdigit((
unsigned char)
name[pos]); ++pos)
3495 if (
name[pos] ==
'_')
3501 pos += forkchar + 1;
3503 if (
name[pos] ==
'.')
3507 for (segchar = 1; isdigit((
unsigned char)
name[pos + segchar]); ++segchar)
3515 if (
name[pos] !=
'\0')
3522 do_syncfs(
const char *path)
3534 errmsg(
"could not open file \"%s\": %m", path)));
3540 errmsg(
"could not synchronize file system for file \"%s\": %m", path)));
3570 bool xlog_is_symlink;
3580 xlog_is_symlink =
false;
3585 if (
lstat(
"pg_wal", &st) < 0)
3588 errmsg(
"could not stat file \"%s\": %m",
3591 xlog_is_symlink =
true;
3619 if (strcmp(de->
d_name,
".") == 0 || strcmp(de->
d_name,
"..") == 0)
3627 if (xlog_is_symlink)
3628 do_syncfs(
"pg_wal");
3633 #ifdef PG_FLUSH_DATA_WORKS
3643 if (xlog_is_symlink)
3661 if (xlog_is_symlink)
3683 void (*
action) (
const char *fname,
bool isdir,
int elevel),
3684 bool process_symlinks,
3698 if (strcmp(de->
d_name,
".") == 0 ||
3699 strcmp(de->
d_name,
"..") == 0)
3707 (*action) (
subpath,
false, elevel);
3732 (*action) (path,
true, elevel);
3742 #ifdef PG_FLUSH_DATA_WORKS
3745 pre_sync_fname(
const char *fname,
bool isdir,
int elevel)
3760 if (errno == EACCES)
3764 errmsg(
"could not open file \"%s\": %m", fname)));
3777 errmsg(
"could not close file \"%s\": %m", fname)));
3800 if (rmdir(fname) != 0 && errno != ENOENT)
3803 errmsg(
"could not remove directory \"%s\": %m", fname)));
3846 if (
fd < 0 && isdir && (errno == EISDIR || errno == EACCES))
3848 else if (
fd < 0 && ignore_perm && errno == EACCES)
3854 errmsg(
"could not open file \"%s\": %m", fname)));
3864 if (returncode != 0 && !(isdir && (errno == EBADF || errno == EINVAL)))
3875 errmsg(
"could not fsync file \"%s\": %m", fname)));
3883 errmsg(
"could not close file \"%s\": %m", fname)));
3909 if (strlen(parentpath) == 0)
3971 #if PG_O_DIRECT == 0
3972 if (strcmp(*
newval,
"") != 0)
3997 foreach(l, elemlist)
3999 char *item = (
char *)
lfirst(l);
4019 #if XLOG_BLCKSZ < PG_IO_ALIGN_SIZE
4023 "debug_io_direct",
"XLOG_BLCKSZ");
4027 #if BLCKSZ < PG_IO_ALIGN_SIZE
4031 "debug_io_direct",
"BLCKSZ");
4045 *((
int *) *extra) = flags;
4053 int *flags = (
int *) extra;
void begin_startup_progress_phase(void)
#define Assert(condition)
#define MemSet(start, val, len)
#define StaticAssertStmt(condition, errmessage)
int fdatasync(int fildes)
#define OidIsValid(objectId)
static void PGresult * res
struct dirent * readdir(DIR *)
DIR * opendir(const char *)
int errcode_for_file_access(void)
int errdetail(const char *fmt,...)
int errcode(int sqlerrcode)
int errmsg(const char *fmt,...)
#define ereport(elevel,...)
struct dirent * ReadDir(DIR *dir, const char *dirname)
static int pg_ftruncate(int fd, off_t length)
int max_files_per_process
void pg_flush_data(int fd, off_t offset, off_t nbytes)
int FileGetRawDesc(File file)
int MakePGDirectory(const char *directoryName)
int recovery_init_sync_method
static const ResourceOwnerDesc file_resowner_desc
void FileWriteback(File file, off_t offset, off_t nbytes, uint32 wait_event_info)
int pg_fsync_no_writethrough(int fd)
static int numTempTableSpaces
static bool ReleaseLruFile(void)
FILE * AllocateFile(const char *name, const char *mode)
#define FD_DELETE_AT_CLOSE
int BasicOpenFilePerm(const char *fileName, int fileFlags, mode_t fileMode)
static int maxAllocatedDescs
static void Delete(File file)
static int FreeDesc(AllocateDesc *desc)
static long tempFileCounter
static char * ResOwnerPrintFile(Datum res)
int durable_rename(const char *oldfile, const char *newfile, int elevel)
static void ResourceOwnerForgetFile(ResourceOwner owner, File file)
int GetTempTablespaces(Oid *tableSpaces, int numSpaces)
static int numAllocatedDescs
File PathNameOpenTemporaryFile(const char *path, int mode)
static void LruDelete(File file)
#define FileIsValid(file)
void assign_debug_io_direct(const char *newval, void *extra)
int FileSync(File file, uint32 wait_event_info)
int CloseTransientFile(int fd)
int BasicOpenFile(const char *fileName, int fileFlags)
static File AllocateVfd(void)
File PathNameCreateTemporaryFile(const char *path, bool error_on_failure)
void PathNameDeleteTemporaryDir(const char *dirname)
int ClosePipeStream(FILE *file)
void AtEOXact_Files(bool isCommit)
int FileGetRawFlags(File file)
static int nextTempTableSpace
#define FD_CLOSE_AT_EOXACT
int fsync_fname_ext(const char *fname, bool isdir, bool ignore_perm, int elevel)
static void unlink_if_exists_fname(const char *fname, bool isdir, int elevel)
static void ResOwnerReleaseFile(Datum res)
static void RemovePgTempRelationFiles(const char *tsdirname)
mode_t FileGetRawMode(File file)
static AllocateDesc * allocatedDescs
static void count_usable_fds(int max_to_probe, int *usable_fds, int *already_open)
static int FileAccess(File file)
static void FreeVfd(File file)
int pg_fsync_writethrough(int fd)
void FileClose(File file)
FILE * OpenPipeStream(const char *command, const char *mode)
void ReleaseExternalFD(void)
#define FD_TEMP_FILE_LIMIT
void RemovePgTempFilesInDir(const char *tmpdirname, bool missing_ok, bool unlink_all)
bool pg_file_exists(const char *name)
void RemovePgTempFiles(void)
#define FileIsNotOpen(file)
bool TempTablespacesAreSet(void)
void fsync_fname(const char *fname, bool isdir)
int FileFallocate(File file, off_t offset, off_t amount, uint32 wait_event_info)
int FilePrefetch(File file, off_t offset, off_t amount, uint32 wait_event_info)
int data_sync_elevel(int elevel)
File PathNameOpenFile(const char *fileName, int fileFlags)
static void Insert(File file)
Oid GetNextTempTableSpace(void)
File PathNameOpenFilePerm(const char *fileName, int fileFlags, mode_t fileMode)
static void datadir_fsync_fname(const char *fname, bool isdir, int elevel)
static void ReportTemporaryFileUsage(const char *path, off_t size)
static File OpenTemporaryFileInTablespace(Oid tblspcOid, bool rejectError)
bool AcquireExternalFD(void)
static void RegisterTemporaryFile(File file)
struct dirent * ReadDirExtended(DIR *dir, const char *dirname, int elevel)
static Oid * tempTableSpaces
static bool reserveAllocatedDesc(void)
void InitFileAccess(void)
static void RemovePgTempRelationFilesInDbspace(const char *dbspacedirname)
File OpenTemporaryFile(bool interXact)
int durable_unlink(const char *fname, int elevel)
static uint64 temporary_files_size
void ReserveExternalFD(void)
char * FilePathName(File file)
bool looks_like_temp_rel_name(const char *name)
bool PathNameDeleteTemporaryFile(const char *path, bool error_on_failure)
void set_max_safe_fds(void)
static void CleanupTempFiles(bool isCommit, bool isProcExit)
static bool have_xact_temporary_files
static int LruInsert(File file)
static int numExternalFDs
static int fsync_parent_path(const char *fname, int elevel)
void PathNameCreateTemporaryDir(const char *basedir, const char *directory)
void AtEOSubXact_Files(bool isCommit, SubTransactionId mySubid, SubTransactionId parentSubid)
int OpenTransientFile(const char *fileName, int fileFlags)
void InitTemporaryFileAccess(void)
int OpenTransientFilePerm(const char *fileName, int fileFlags, mode_t fileMode)
static void ReleaseLruFiles(void)
ssize_t FileWriteV(File file, const struct iovec *iov, int iovcnt, off_t offset, uint32 wait_event_info)
void SyncDataDirectory(void)
int FileZero(File file, off_t offset, off_t amount, uint32 wait_event_info)
off_t FileSize(File file)
ssize_t FileReadV(File file, const struct iovec *iov, int iovcnt, off_t offset, uint32 wait_event_info)
int FileTruncate(File file, off_t offset, uint32 wait_event_info)
bool check_debug_io_direct(char **newval, void **extra, GucSource source)
static void ResourceOwnerRememberFile(ResourceOwner owner, File file)
static void BeforeShmemExit_Files(int code, Datum arg)
static void walkdir(const char *path, void(*action)(const char *fname, bool isdir, int elevel), bool process_symlinks, int elevel)
int pg_truncate(const char *path, off_t length)
void SetTempTablespaces(Oid *tableSpaces, int numSpaces)
DIR * AllocateDir(const char *dirname)
void TempTablespacePath(char *path, Oid tablespace)
#define IO_DIRECT_WAL_INIT
ssize_t pg_pwrite_zeros(int fd, size_t size, off_t offset)
PGFileType get_dirent_type(const char *path, const struct dirent *de, bool look_through_symlinks, int elevel)
#define PG_TEMP_FILES_DIR
#define PG_TEMP_FILE_PREFIX
@ DATA_DIR_SYNC_METHOD_SYNCFS
@ DATA_DIR_SYNC_METHOD_FSYNC
void * guc_malloc(int elevel, size_t size)
#define GUC_check_errdetail
void before_shmem_exit(pg_on_exit_callback function, Datum arg)
static void const char fflush(stdout)
void list_free(List *list)
Datum subpath(PG_FUNCTION_ARGS)
char * pstrdup(const char *in)
void pfree(void *pointer)
void * repalloc(void *pointer, Size size)
#define CHECK_FOR_INTERRUPTS()
static PgChecksumMode mode
static ssize_t pg_pwritev(int fd, const struct iovec *iov, int iovcnt, off_t offset)
static ssize_t pg_preadv(int fd, const struct iovec *iov, int iovcnt, off_t offset)
uint64 pg_prng_uint64_range(pg_prng_state *state, uint64 rmin, uint64 rmax)
pg_prng_state pg_global_prng_state
static rewind_source * source
void pgstat_report_tempfile(size_t filesize)
int pg_strcasecmp(const char *s1, const char *s2)
void get_parent_directory(char *path)
pqsigfunc pqsignal(int signo, pqsigfunc func)
size_t strlcpy(char *dst, const char *src, size_t siz)
static Datum Int32GetDatum(int32 X)
static int32 DatumGetInt32(Datum X)
static int fd(const char *x, int i)
char * psprintf(const char *fmt,...)
int forkname_chars(const char *str, ForkNumber *fork)
#define TABLESPACE_VERSION_DIRECTORY
ResourceOwner CurrentResourceOwner
void ResourceOwnerForget(ResourceOwner owner, Datum value, const ResourceOwnerDesc *kind)
void ResourceOwnerRemember(ResourceOwner owner, Datum value, const ResourceOwnerDesc *kind)
void ResourceOwnerEnlarge(ResourceOwner owner)
@ RESOURCE_RELEASE_AFTER_LOCKS
#define RELEASE_PRIO_FILES
void pg_usleep(long microsec)
static pg_noinline void Size size
#define ereport_startup_progress(msg,...)
SubTransactionId create_subid
union AllocateDesc::@22 desc
bool SplitGUCList(char *rawstring, char separator, List **namelist)
static void pgstat_report_wait_start(uint32 wait_event_info)
static void pgstat_report_wait_end(void)
void _dosmaperr(unsigned long)
SubTransactionId GetCurrentSubTransactionId(void)
@ WAL_SYNC_METHOD_FSYNC_WRITETHROUGH
static const char * directory