80 #include <sys/types.h>
105 #if defined(HAVE_SYNC_FILE_RANGE)
106 #define PG_FLUSH_DATA_WORKS 1
107 #elif !defined(WIN32) && defined(MS_ASYNC)
108 #define PG_FLUSH_DATA_WORKS 1
109 #elif defined(USE_POSIX_FADVISE) && defined(POSIX_FADV_DONTNEED)
110 #define PG_FLUSH_DATA_WORKS 1
128 #define NUM_RESERVED_FDS 10
137 #define FD_MINFREE 48
174 int _do_db_save_errno = errno; \
176 errno = _do_db_save_errno; \
183 #define VFD_CLOSED (-1)
185 #define FileIsValid(file) \
186 ((file) > 0 && (file) < (int) SizeVfdCache && VfdCache[file].fileName != NULL)
188 #define FileIsNotOpen(file) (VfdCache[file].fd == VFD_CLOSED)
191 #define FD_DELETE_AT_CLOSE (1 << 0)
192 #define FD_CLOSE_AT_EOXACT (1 << 1)
193 #define FD_TEMP_FILE_LIMIT (1 << 2)
238 #ifdef USE_ASSERT_CHECKING
239 static bool temporary_files_allowed =
false;
343 static void walkdir(
const char *path,
344 void (*
action) (
const char *fname,
bool isdir,
int elevel),
345 bool process_symlinks,
347 #ifdef PG_FLUSH_DATA_WORKS
348 static void pre_sync_fname(
const char *fname,
bool isdir,
int elevel);
387 #if !defined(WIN32) && defined(USE_ASSERT_CHECKING)
411 int desc_flags = fcntl(
fd, F_GETFL);
418 Assert((desc_flags & (O_RDWR | O_WRONLY)) == 0);
420 Assert((desc_flags & (O_RDWR | O_WRONLY)) != 0);
426 #if defined(HAVE_FSYNC_WRITETHROUGH)
450 if (rc == -1 && errno ==
EINTR)
464 #if defined(F_FULLFSYNC)
465 return (fcntl(
fd, F_FULLFSYNC, 0) == -1) ? -1 : 0;
489 if (rc == -1 && errno ==
EINTR)
510 else if (!(errno == ENOENT || errno == ENOTDIR || errno == EACCES))
513 errmsg(
"could not access file \"%s\": %m",
name)));
539 #if defined(HAVE_SYNC_FILE_RANGE)
542 static bool not_implemented_by_kernel =
false;
544 if (not_implemented_by_kernel)
558 rc = sync_file_range(
fd, offset, nbytes,
559 SYNC_FILE_RANGE_WRITE);
575 not_implemented_by_kernel =
true;
582 errmsg(
"could not flush dirty data: %m")));
588 #if !defined(WIN32) && defined(MS_ASYNC)
591 static int pagesize = 0;
605 if (offset == 0 && nbytes == 0)
607 nbytes = lseek(
fd, 0, SEEK_END);
612 errmsg(
"could not determine dirty data size: %m")));
625 pagesize = sysconf(_SC_PAGESIZE);
629 nbytes = (nbytes / pagesize) * pagesize;
640 if (nbytes <= (off_t) SSIZE_MAX)
641 p = mmap(NULL, nbytes, PROT_READ, MAP_SHARED,
fd, offset);
649 rc = msync(p, (
size_t) nbytes, MS_ASYNC);
654 errmsg(
"could not flush dirty data: %m")));
658 rc = munmap(p, (
size_t) nbytes);
664 errmsg(
"could not munmap() while flushing data: %m")));
671 #if defined(USE_POSIX_FADVISE) && defined(POSIX_FADV_DONTNEED)
683 rc = posix_fadvise(
fd, offset, nbytes, POSIX_FADV_DONTNEED);
690 errmsg(
"could not flush dirty data: %m")));
709 if (ret == -1 && errno ==
EINTR)
739 ret = truncate(path, length);
741 if (ret == -1 && errno ==
EINTR)
802 errmsg(
"could not open file \"%s\": %m", newfile)));
819 errmsg(
"could not fsync file \"%s\": %m", newfile)));
827 errmsg(
"could not close file \"%s\": %m", newfile)));
833 if (rename(oldfile, newfile) < 0)
837 errmsg(
"could not rename file \"%s\" to \"%s\": %m",
873 if (unlink(fname) < 0)
877 errmsg(
"could not remove file \"%s\": %m",
910 (
errcode(ERRCODE_OUT_OF_MEMORY),
911 errmsg(
"out of memory")));
935 Assert(!temporary_files_allowed);
943 #ifdef USE_ASSERT_CHECKING
944 temporary_files_allowed =
true;
971 #ifdef HAVE_GETRLIMIT
973 int getrlimit_status;
979 #ifdef HAVE_GETRLIMIT
980 getrlimit_status = getrlimit(RLIMIT_NOFILE, &rlim);
981 if (getrlimit_status != 0)
990 #ifdef HAVE_GETRLIMIT
996 if (getrlimit_status == 0 && highestfd >= rlim.rlim_cur - 1)
1004 if (errno != EMFILE && errno != ENFILE)
1005 elog(
WARNING,
"duplicating stderr file descriptor failed after %d successes: %m", used);
1014 fd[used++] = thisfd;
1016 if (highestfd < thisfd)
1019 if (used >= max_to_probe)
1024 for (
j = 0;
j < used;
j++)
1035 *already_open = highestfd + 1 - used;
1057 &usable_fds, &already_open);
1071 (
errcode(ERRCODE_INSUFFICIENT_RESOURCES),
1072 errmsg(
"insufficient file descriptors available to start server process"),
1073 errdetail(
"System allows %d, server needs at least %d.",
1077 elog(
DEBUG2,
"max_safe_fds = %d, usable_fds = %d, already_open = %d",
1113 #ifdef PG_O_DIRECT_USE_F_NOCACHE
1130 "PG_O_DIRECT value collides with standard flag");
1133 fd = open(fileName, fileFlags, fileMode);
1138 #ifdef PG_O_DIRECT_USE_F_NOCACHE
1141 if (fcntl(
fd, F_NOCACHE, 1) < 0)
1143 int save_errno = errno;
1155 if (errno == EMFILE || errno == ENFILE)
1157 int save_errno = errno;
1160 (
errcode(ERRCODE_INSUFFICIENT_RESOURCES),
1161 errmsg(
"out of file descriptors: %m; release and retry")));
1245 #if defined(FDDEBUG)
1303 "could not close file \"%s\": %m", vfdP->
fileName);
1432 if (newCacheSize < 32)
1439 if (newVfdCache == NULL)
1441 (
errcode(ERRCODE_OUT_OF_MEMORY),
1442 errmsg(
"out of memory")));
1506 if (returnValue != 0)
1509 else if (
VfdCache[0].lruLessRecently != file)
1535 (
errmsg(
"temporary file: path \"%s\", size %lu",
1536 path, (
unsigned long)
size)));
1561 FileInvalidate(
File file)
1594 fileName, fileFlags, fileMode));
1599 fnamecopy = strdup(fileName);
1600 if (fnamecopy == NULL)
1602 (
errcode(ERRCODE_OUT_OF_MEMORY),
1603 errmsg(
"out of memory")));
1623 int save_errno = errno;
1636 vfdP->
fileFlags = fileFlags & ~(O_CREAT | O_TRUNC | O_EXCL);
1663 if (errno == EEXIST)
1674 errmsg(
"cannot create temporary directory \"%s\": %m",
1681 errmsg(
"cannot create temporary subdirectory \"%s\": %m",
1692 struct stat statbuf;
1695 if (
stat(dirname, &statbuf) != 0 && errno == ENOENT)
1727 Assert(temporary_files_allowed);
1761 DEFAULTTABLESPACE_OID,
1815 snprintf(tempfilepath,
sizeof(tempfilepath),
"%s/%s%d.%ld",
1823 O_RDWR | O_CREAT | O_TRUNC |
PG_BINARY);
1837 O_RDWR | O_CREAT | O_TRUNC |
PG_BINARY);
1838 if (file <= 0 && rejectError)
1839 elog(
ERROR,
"could not create temporary file \"%s\": %m",
1864 Assert(temporary_files_allowed);
1875 if (error_on_failure)
1878 errmsg(
"could not create temporary file \"%s\": %m",
1904 Assert(temporary_files_allowed);
1911 if (file <= 0 && errno != ENOENT)
1914 errmsg(
"could not open temporary file \"%s\": %m",
1933 struct stat filestats;
1937 if (
stat(path, &filestats) != 0)
1947 if (stat_errno == ENOENT)
1950 if (unlink(path) < 0)
1952 if (errno != ENOENT)
1955 errmsg(
"could not unlink temporary file \"%s\": %m",
1960 if (stat_errno == 0)
1967 errmsg(
"could not stat file \"%s\": %m", path)));
1998 "could not close file \"%s\": %m", vfdP->
fileName);
2020 struct stat filestats;
2046 if (stat_errno == 0)
2082 (int64) offset, (int64) amount));
2084 #if defined(USE_POSIX_FADVISE) && defined(POSIX_FADV_WILLNEED)
2094 returnCode = posix_fadvise(
VfdCache[file].
fd, offset, amount,
2095 POSIX_FADV_WILLNEED);
2098 if (returnCode ==
EINTR)
2103 #elif defined(__darwin__)
2116 ra.ra_offset = offset;
2117 ra.ra_count = amount;
2119 returnCode = fcntl(
VfdCache[file].
fd, F_RDADVISE, &ra);
2121 if (returnCode != -1)
2140 (int64) offset, (int64) nbytes));
2179 returnCode =
pg_preadv(vfdP->
fd, iov, iovcnt, offset);
2192 DWORD
error = GetLastError();
2196 case ERROR_NO_SYSTEM_RESOURCES:
2243 off_t past_write = offset;
2245 for (
int i = 0;
i < iovcnt; ++
i)
2246 past_write += iov[
i].iov_len;
2252 newTotal += past_write - vfdP->
fileSize;
2255 (
errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
2256 errmsg(
"temporary file size exceeds \"temp_file_limit\" (%dkB)",
2263 returnCode =
pg_pwritev(vfdP->
fd, iov, iovcnt, offset);
2266 if (returnCode >= 0)
2282 off_t past_write = offset + returnCode;
2297 DWORD
error = GetLastError();
2301 case ERROR_NO_SYSTEM_RESOURCES:
2355 (int64) offset, (int64) amount));
2367 else if (written != amount)
2393 #ifdef HAVE_POSIX_FALLOCATE
2400 (int64) offset, (int64) amount));
2408 returnCode = posix_fallocate(
VfdCache[file].
fd, offset, amount);
2411 if (returnCode == 0)
2413 else if (returnCode ==
EINTR)
2423 if (returnCode != EINVAL && returnCode !=
EOPNOTSUPP)
2427 return FileZero(file, offset, amount, wait_event_info);
2444 return lseek(
VfdCache[file].
fd, 0, SEEK_END);
2465 if (returnCode == 0 &&
VfdCache[file].fileSize > offset)
2550 if (newDescs == NULL)
2552 (
errcode(ERRCODE_OUT_OF_MEMORY),
2553 errmsg(
"out of memory")));
2576 if (newDescs == NULL)
2615 (
errcode(ERRCODE_INSUFFICIENT_RESOURCES),
2616 errmsg(
"exceeded maxAllocatedDescs (%d) while trying to open file \"%s\"",
2623 if ((file = fopen(
name,
mode)) != NULL)
2634 if (errno == EMFILE || errno == ENFILE)
2636 int save_errno = errno;
2639 (
errcode(ERRCODE_INSUFFICIENT_RESOURCES),
2640 errmsg(
"out of file descriptors: %m; release and retry")));
2668 DO_DB(
elog(
LOG,
"OpenTransientFile: Allocated %d (%s)",
2674 (
errcode(ERRCODE_INSUFFICIENT_RESOURCES),
2675 errmsg(
"exceeded maxAllocatedDescs (%d) while trying to open file \"%s\"",
2719 (
errcode(ERRCODE_INSUFFICIENT_RESOURCES),
2720 errmsg(
"exceeded maxAllocatedDescs (%d) while trying to execute command \"%s\"",
2730 file = popen(command,
mode);
2745 if (errno == EMFILE || errno == ENFILE)
2748 (
errcode(ERRCODE_INSUFFICIENT_RESOURCES),
2749 errmsg(
"out of file descriptors: %m; release and retry")));
2784 elog(
ERROR,
"AllocateDesc kind not recognized");
2819 elog(
WARNING,
"file passed to FreeFile was not obtained from AllocateFile");
2821 return fclose(file);
2847 elog(
WARNING,
"fd passed to CloseTransientFile was not obtained from OpenTransientFile");
2875 (
errcode(ERRCODE_INSUFFICIENT_RESOURCES),
2876 errmsg(
"exceeded maxAllocatedDescs (%d) while trying to open directory \"%s\"",
2883 if ((dir =
opendir(dirname)) != NULL)
2894 if (errno == EMFILE || errno == ENFILE)
2896 int save_errno = errno;
2899 (
errcode(ERRCODE_INSUFFICIENT_RESOURCES),
2900 errmsg(
"out of file descriptors: %m; release and retry")));
2955 errmsg(
"could not open directory \"%s\": %m",
2961 if ((dent =
readdir(dir)) != NULL)
2967 errmsg(
"could not read directory \"%s\": %m",
3003 elog(
WARNING,
"dir passed to FreeDir was not obtained from AllocateDir");
3029 elog(
WARNING,
"file passed to ClosePipeStream was not obtained from OpenPipeStream");
3031 return pclose(file);
3206 #ifdef USE_ASSERT_CHECKING
3207 temporary_files_allowed =
false;
3254 "temporary file %s not closed at end-of-transaction",
3266 elog(
WARNING,
"%d temporary files and directories not closed at end-of-transaction",
3316 if (strcmp(spc_de->
d_name,
".") == 0 ||
3317 strcmp(spc_de->
d_name,
"..") == 0)
3320 snprintf(temp_path,
sizeof(temp_path),
"%s/%s/%s/%s",
3325 snprintf(temp_path,
sizeof(temp_path),
"%s/%s/%s",
3364 if (temp_dir == NULL && errno == ENOENT && missing_ok)
3369 if (strcmp(temp_de->
d_name,
".") == 0 ||
3370 strcmp(temp_de->
d_name,
"..") == 0)
3373 snprintf(rm_path,
sizeof(rm_path),
"%s/%s",
3374 tmpdirname, temp_de->
d_name);
3390 if (rmdir(rm_path) < 0)
3393 errmsg(
"could not remove directory \"%s\": %m",
3398 if (unlink(rm_path) < 0)
3401 errmsg(
"could not remove file \"%s\": %m",
3407 (
errmsg(
"unexpected file found in temporary-files directory: \"%s\"",
3431 if (strspn(de->
d_name,
"0123456789") != strlen(de->
d_name))
3434 snprintf(dbspace_path,
sizeof(dbspace_path),
"%s/%s",
3457 snprintf(rm_path,
sizeof(rm_path),
"%s/%s",
3458 dbspacedirname, de->
d_name);
3460 if (unlink(rm_path) < 0)
3463 errmsg(
"could not remove file \"%s\": %m",
3482 for (pos = 1; isdigit((
unsigned char)
name[pos]); ++pos)
3484 if (pos == 1 ||
name[pos] !=
'_')
3488 for (savepos = ++pos; isdigit((
unsigned char)
name[pos]); ++pos)
3494 if (
name[pos] ==
'_')
3500 pos += forkchar + 1;
3502 if (
name[pos] ==
'.')
3506 for (segchar = 1; isdigit((
unsigned char)
name[pos + segchar]); ++segchar)
3514 if (
name[pos] !=
'\0')
3521 do_syncfs(
const char *path)
3533 errmsg(
"could not open file \"%s\": %m", path)));
3539 errmsg(
"could not synchronize file system for file \"%s\": %m", path)));
3569 bool xlog_is_symlink;
3579 xlog_is_symlink =
false;
3584 if (
lstat(
"pg_wal", &st) < 0)
3587 errmsg(
"could not stat file \"%s\": %m",
3590 xlog_is_symlink =
true;
3618 if (strcmp(de->
d_name,
".") == 0 || strcmp(de->
d_name,
"..") == 0)
3626 if (xlog_is_symlink)
3627 do_syncfs(
"pg_wal");
3632 #ifdef PG_FLUSH_DATA_WORKS
3642 if (xlog_is_symlink)
3660 if (xlog_is_symlink)
3682 void (*
action) (
const char *fname,
bool isdir,
int elevel),
3683 bool process_symlinks,
3697 if (strcmp(de->
d_name,
".") == 0 ||
3698 strcmp(de->
d_name,
"..") == 0)
3706 (*action) (
subpath,
false, elevel);
3731 (*action) (path,
true, elevel);
3741 #ifdef PG_FLUSH_DATA_WORKS
3744 pre_sync_fname(
const char *fname,
bool isdir,
int elevel)
3759 if (errno == EACCES)
3763 errmsg(
"could not open file \"%s\": %m", fname)));
3776 errmsg(
"could not close file \"%s\": %m", fname)));
3799 if (rmdir(fname) != 0 && errno != ENOENT)
3802 errmsg(
"could not remove directory \"%s\": %m", fname)));
3845 if (
fd < 0 && isdir && (errno == EISDIR || errno == EACCES))
3847 else if (
fd < 0 && ignore_perm && errno == EACCES)
3853 errmsg(
"could not open file \"%s\": %m", fname)));
3863 if (returncode != 0 && !(isdir && (errno == EBADF || errno == EINVAL)))
3874 errmsg(
"could not fsync file \"%s\": %m", fname)));
3882 errmsg(
"could not close file \"%s\": %m", fname)));
3908 if (strlen(parentpath) == 0)
3970 #if PG_O_DIRECT == 0
3971 if (strcmp(*
newval,
"") != 0)
3996 foreach(l, elemlist)
3998 char *item = (
char *)
lfirst(l);
4018 #if XLOG_BLCKSZ < PG_IO_ALIGN_SIZE
4022 "debug_io_direct",
"XLOG_BLCKSZ");
4026 #if BLCKSZ < PG_IO_ALIGN_SIZE
4030 "debug_io_direct",
"BLCKSZ");
4044 *((
int *) *extra) = flags;
4052 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::@20 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