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);
363 #if !defined(WIN32) && defined(USE_ASSERT_CHECKING)
387 int desc_flags = fcntl(
fd, F_GETFL);
394 Assert((desc_flags & (O_RDWR | O_WRONLY)) == 0);
396 Assert((desc_flags & (O_RDWR | O_WRONLY)) != 0);
402 #if defined(HAVE_FSYNC_WRITETHROUGH)
426 if (rc == -1 && errno ==
EINTR)
440 #if defined(F_FULLFSYNC)
441 return (fcntl(
fd, F_FULLFSYNC, 0) == -1) ? -1 : 0;
465 if (rc == -1 && errno ==
EINTR)
492 #if defined(HAVE_SYNC_FILE_RANGE)
495 static bool not_implemented_by_kernel =
false;
497 if (not_implemented_by_kernel)
511 rc = sync_file_range(
fd, offset, nbytes,
512 SYNC_FILE_RANGE_WRITE);
528 not_implemented_by_kernel =
true;
535 errmsg(
"could not flush dirty data: %m")));
541 #if !defined(WIN32) && defined(MS_ASYNC)
544 static int pagesize = 0;
558 if (offset == 0 && nbytes == 0)
560 nbytes = lseek(
fd, 0, SEEK_END);
565 errmsg(
"could not determine dirty data size: %m")));
578 pagesize = sysconf(_SC_PAGESIZE);
582 nbytes = (nbytes / pagesize) * pagesize;
593 if (nbytes <= (off_t) SSIZE_MAX)
594 p = mmap(NULL, nbytes, PROT_READ, MAP_SHARED,
fd, offset);
602 rc = msync(p, (
size_t) nbytes, MS_ASYNC);
607 errmsg(
"could not flush dirty data: %m")));
611 rc = munmap(p, (
size_t) nbytes);
617 errmsg(
"could not munmap() while flushing data: %m")));
624 #if defined(USE_POSIX_FADVISE) && defined(POSIX_FADV_DONTNEED)
636 rc = posix_fadvise(
fd, offset, nbytes, POSIX_FADV_DONTNEED);
643 errmsg(
"could not flush dirty data: %m")));
662 if (ret == -1 && errno ==
EINTR)
692 ret = truncate(path, length);
694 if (ret == -1 && errno ==
EINTR)
755 errmsg(
"could not open file \"%s\": %m", newfile)));
772 errmsg(
"could not fsync file \"%s\": %m", newfile)));
780 errmsg(
"could not close file \"%s\": %m", newfile)));
786 if (rename(oldfile, newfile) < 0)
790 errmsg(
"could not rename file \"%s\" to \"%s\": %m",
826 if (unlink(fname) < 0)
830 errmsg(
"could not remove file \"%s\": %m",
863 (
errcode(ERRCODE_OUT_OF_MEMORY),
864 errmsg(
"out of memory")));
888 Assert(!temporary_files_allowed);
896 #ifdef USE_ASSERT_CHECKING
897 temporary_files_allowed =
true;
924 #ifdef HAVE_GETRLIMIT
926 int getrlimit_status;
930 fd = (
int *)
palloc(size *
sizeof(
int));
932 #ifdef HAVE_GETRLIMIT
933 getrlimit_status = getrlimit(RLIMIT_NOFILE, &rlim);
934 if (getrlimit_status != 0)
943 #ifdef HAVE_GETRLIMIT
949 if (getrlimit_status == 0 && highestfd >= rlim.rlim_cur - 1)
957 if (errno != EMFILE && errno != ENFILE)
958 elog(
WARNING,
"duplicating stderr file descriptor failed after %d successes: %m", used);
969 if (highestfd < thisfd)
972 if (used >= max_to_probe)
977 for (
j = 0;
j < used;
j++)
988 *already_open = highestfd + 1 - used;
1010 &usable_fds, &already_open);
1024 (
errcode(ERRCODE_INSUFFICIENT_RESOURCES),
1025 errmsg(
"insufficient file descriptors available to start server process"),
1026 errdetail(
"System allows %d, server needs at least %d.",
1030 elog(
DEBUG2,
"max_safe_fds = %d, usable_fds = %d, already_open = %d",
1066 #ifdef PG_O_DIRECT_USE_F_NOCACHE
1083 "PG_O_DIRECT value collides with standard flag");
1086 fd = open(fileName, fileFlags, fileMode);
1091 #ifdef PG_O_DIRECT_USE_F_NOCACHE
1094 if (fcntl(
fd, F_NOCACHE, 1) < 0)
1096 int save_errno = errno;
1108 if (errno == EMFILE || errno == ENFILE)
1110 int save_errno = errno;
1113 (
errcode(ERRCODE_INSUFFICIENT_RESOURCES),
1114 errmsg(
"out of file descriptors: %m; release and retry")));
1198 #if defined(FDDEBUG)
1256 "could not close file \"%s\": %m", vfdP->
fileName);
1385 if (newCacheSize < 32)
1392 if (newVfdCache == NULL)
1394 (
errcode(ERRCODE_OUT_OF_MEMORY),
1395 errmsg(
"out of memory")));
1459 if (returnValue != 0)
1462 else if (
VfdCache[0].lruLessRecently != file)
1488 (
errmsg(
"temporary file: path \"%s\", size %lu",
1489 path, (
unsigned long) size)));
1514 FileInvalidate(
File file)
1547 fileName, fileFlags, fileMode));
1552 fnamecopy = strdup(fileName);
1553 if (fnamecopy == NULL)
1555 (
errcode(ERRCODE_OUT_OF_MEMORY),
1556 errmsg(
"out of memory")));
1576 int save_errno = errno;
1589 vfdP->
fileFlags = fileFlags & ~(O_CREAT | O_TRUNC | O_EXCL);
1616 if (errno == EEXIST)
1627 errmsg(
"cannot create temporary directory \"%s\": %m",
1634 errmsg(
"cannot create temporary subdirectory \"%s\": %m",
1645 struct stat statbuf;
1648 if (
stat(dirname, &statbuf) != 0 && errno == ENOENT)
1680 Assert(temporary_files_allowed);
1714 DEFAULTTABLESPACE_OID,
1768 snprintf(tempfilepath,
sizeof(tempfilepath),
"%s/%s%d.%ld",
1776 O_RDWR | O_CREAT | O_TRUNC |
PG_BINARY);
1790 O_RDWR | O_CREAT | O_TRUNC |
PG_BINARY);
1791 if (file <= 0 && rejectError)
1792 elog(
ERROR,
"could not create temporary file \"%s\": %m",
1817 Assert(temporary_files_allowed);
1828 if (error_on_failure)
1831 errmsg(
"could not create temporary file \"%s\": %m",
1857 Assert(temporary_files_allowed);
1864 if (file <= 0 && errno != ENOENT)
1867 errmsg(
"could not open temporary file \"%s\": %m",
1886 struct stat filestats;
1890 if (
stat(path, &filestats) != 0)
1900 if (stat_errno == ENOENT)
1903 if (unlink(path) < 0)
1905 if (errno != ENOENT)
1908 errmsg(
"could not unlink temporary file \"%s\": %m",
1913 if (stat_errno == 0)
1920 errmsg(
"could not stat file \"%s\": %m", path)));
1951 "could not close file \"%s\": %m", vfdP->
fileName);
1973 struct stat filestats;
1999 if (stat_errno == 0)
2032 #if defined(USE_POSIX_FADVISE) && defined(POSIX_FADV_WILLNEED)
2039 (int64) offset, (int64) amount));
2047 returnCode = posix_fadvise(
VfdCache[file].
fd, offset, amount,
2048 POSIX_FADV_WILLNEED);
2051 if (returnCode ==
EINTR)
2070 (int64) offset, (int64) nbytes));
2109 returnCode =
pg_pread(vfdP->
fd, buffer, amount, offset);
2122 DWORD
error = GetLastError();
2126 case ERROR_NO_SYSTEM_RESOURCES:
2173 off_t past_write = offset + amount;
2179 newTotal += past_write - vfdP->
fileSize;
2182 (
errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
2183 errmsg(
"temporary file size exceeds temp_file_limit (%dkB)",
2195 if (returnCode != amount && errno == 0)
2198 if (returnCode >= 0)
2205 off_t past_write = offset + amount;
2220 DWORD
error = GetLastError();
2224 case ERROR_NO_SYSTEM_RESOURCES:
2278 (int64) offset, (int64) amount));
2290 else if (written != amount)
2316 #ifdef HAVE_POSIX_FALLOCATE
2323 (int64) offset, (int64) amount));
2331 returnCode = posix_fallocate(
VfdCache[file].
fd, offset, amount);
2334 if (returnCode == 0)
2336 else if (returnCode ==
EINTR)
2346 if (returnCode != EINVAL && returnCode !=
EOPNOTSUPP)
2350 return FileZero(file, offset, amount, wait_event_info);
2367 return lseek(
VfdCache[file].
fd, 0, SEEK_END);
2388 if (returnCode == 0 &&
VfdCache[file].fileSize > offset)
2473 if (newDescs == NULL)
2475 (
errcode(ERRCODE_OUT_OF_MEMORY),
2476 errmsg(
"out of memory")));
2499 if (newDescs == NULL)
2538 (
errcode(ERRCODE_INSUFFICIENT_RESOURCES),
2539 errmsg(
"exceeded maxAllocatedDescs (%d) while trying to open file \"%s\"",
2546 if ((file = fopen(
name,
mode)) != NULL)
2557 if (errno == EMFILE || errno == ENFILE)
2559 int save_errno = errno;
2562 (
errcode(ERRCODE_INSUFFICIENT_RESOURCES),
2563 errmsg(
"out of file descriptors: %m; release and retry")));
2591 DO_DB(
elog(
LOG,
"OpenTransientFile: Allocated %d (%s)",
2597 (
errcode(ERRCODE_INSUFFICIENT_RESOURCES),
2598 errmsg(
"exceeded maxAllocatedDescs (%d) while trying to open file \"%s\"",
2642 (
errcode(ERRCODE_INSUFFICIENT_RESOURCES),
2643 errmsg(
"exceeded maxAllocatedDescs (%d) while trying to execute command \"%s\"",
2653 file = popen(command,
mode);
2668 if (errno == EMFILE || errno == ENFILE)
2671 (
errcode(ERRCODE_INSUFFICIENT_RESOURCES),
2672 errmsg(
"out of file descriptors: %m; release and retry")));
2707 elog(
ERROR,
"AllocateDesc kind not recognized");
2742 elog(
WARNING,
"file passed to FreeFile was not obtained from AllocateFile");
2744 return fclose(file);
2770 elog(
WARNING,
"fd passed to CloseTransientFile was not obtained from OpenTransientFile");
2798 (
errcode(ERRCODE_INSUFFICIENT_RESOURCES),
2799 errmsg(
"exceeded maxAllocatedDescs (%d) while trying to open directory \"%s\"",
2806 if ((dir =
opendir(dirname)) != NULL)
2817 if (errno == EMFILE || errno == ENFILE)
2819 int save_errno = errno;
2822 (
errcode(ERRCODE_INSUFFICIENT_RESOURCES),
2823 errmsg(
"out of file descriptors: %m; release and retry")));
2878 errmsg(
"could not open directory \"%s\": %m",
2884 if ((dent =
readdir(dir)) != NULL)
2890 errmsg(
"could not read directory \"%s\": %m",
2926 elog(
WARNING,
"dir passed to FreeDir was not obtained from AllocateDir");
2952 elog(
WARNING,
"file passed to ClosePipeStream was not obtained from OpenPipeStream");
2954 return pclose(file);
3129 #ifdef USE_ASSERT_CHECKING
3130 temporary_files_allowed =
false;
3177 "temporary file %s not closed at end-of-transaction",
3189 elog(
WARNING,
"%d temporary files and directories not closed at end-of-transaction",
3239 if (strcmp(spc_de->
d_name,
".") == 0 ||
3240 strcmp(spc_de->
d_name,
"..") == 0)
3243 snprintf(temp_path,
sizeof(temp_path),
"pg_tblspc/%s/%s/%s",
3247 snprintf(temp_path,
sizeof(temp_path),
"pg_tblspc/%s/%s",
3286 if (temp_dir == NULL && errno == ENOENT && missing_ok)
3291 if (strcmp(temp_de->
d_name,
".") == 0 ||
3292 strcmp(temp_de->
d_name,
"..") == 0)
3295 snprintf(rm_path,
sizeof(rm_path),
"%s/%s",
3296 tmpdirname, temp_de->
d_name);
3312 if (rmdir(rm_path) < 0)
3315 errmsg(
"could not remove directory \"%s\": %m",
3320 if (unlink(rm_path) < 0)
3323 errmsg(
"could not remove file \"%s\": %m",
3329 (
errmsg(
"unexpected file found in temporary-files directory: \"%s\"",
3353 if (strspn(de->
d_name,
"0123456789") != strlen(de->
d_name))
3356 snprintf(dbspace_path,
sizeof(dbspace_path),
"%s/%s",
3379 snprintf(rm_path,
sizeof(rm_path),
"%s/%s",
3380 dbspacedirname, de->
d_name);
3382 if (unlink(rm_path) < 0)
3385 errmsg(
"could not remove file \"%s\": %m",
3404 for (pos = 1; isdigit((
unsigned char)
name[pos]); ++pos)
3406 if (pos == 1 ||
name[pos] !=
'_')
3410 for (savepos = ++pos; isdigit((
unsigned char)
name[pos]); ++pos)
3416 if (
name[pos] ==
'_')
3422 pos += forkchar + 1;
3424 if (
name[pos] ==
'.')
3428 for (segchar = 1; isdigit((
unsigned char)
name[pos + segchar]); ++segchar)
3436 if (
name[pos] !=
'\0')
3443 do_syncfs(
const char *path)
3455 errmsg(
"could not open file \"%s\": %m", path)));
3461 errmsg(
"could not synchronize file system for file \"%s\": %m", path)));
3491 bool xlog_is_symlink;
3501 xlog_is_symlink =
false;
3506 if (
lstat(
"pg_wal", &st) < 0)
3509 errmsg(
"could not stat file \"%s\": %m",
3512 xlog_is_symlink =
true;
3540 if (strcmp(de->
d_name,
".") == 0 || strcmp(de->
d_name,
"..") == 0)
3548 if (xlog_is_symlink)
3549 do_syncfs(
"pg_wal");
3554 #ifdef PG_FLUSH_DATA_WORKS
3564 if (xlog_is_symlink)
3582 if (xlog_is_symlink)
3604 void (*
action) (
const char *fname,
bool isdir,
int elevel),
3605 bool process_symlinks,
3619 if (strcmp(de->
d_name,
".") == 0 ||
3620 strcmp(de->
d_name,
"..") == 0)
3628 (*action) (
subpath,
false, elevel);
3653 (*action) (path,
true, elevel);
3663 #ifdef PG_FLUSH_DATA_WORKS
3666 pre_sync_fname(
const char *fname,
bool isdir,
int elevel)
3681 if (errno == EACCES)
3685 errmsg(
"could not open file \"%s\": %m", fname)));
3698 errmsg(
"could not close file \"%s\": %m", fname)));
3721 if (rmdir(fname) != 0 && errno != ENOENT)
3724 errmsg(
"could not remove directory \"%s\": %m", fname)));
3767 if (
fd < 0 && isdir && (errno == EISDIR || errno == EACCES))
3769 else if (
fd < 0 && ignore_perm && errno == EACCES)
3775 errmsg(
"could not open file \"%s\": %m", fname)));
3785 if (returncode != 0 && !(isdir && (errno == EBADF || errno == EINVAL)))
3796 errmsg(
"could not fsync file \"%s\": %m", fname)));
3804 errmsg(
"could not close file \"%s\": %m", fname)));
3830 if (strlen(parentpath) == 0)
3892 #if PG_O_DIRECT == 0
3893 if (strcmp(*
newval,
"") != 0)
3917 foreach(l, elemlist)
3919 char *item = (
char *)
lfirst(l);
3939 #if XLOG_BLCKSZ < PG_IO_ALIGN_SIZE
3942 GUC_check_errdetail(
"debug_io_direct is not supported for WAL because XLOG_BLCKSZ is too small");
3946 #if BLCKSZ < PG_IO_ALIGN_SIZE
3949 GUC_check_errdetail(
"debug_io_direct is not supported for data because BLCKSZ is too small");
3963 *((
int *) *extra) = flags;
3971 int *flags = (
int *) extra;
void begin_startup_progress_phase(void)
#define MemSet(start, val, len)
#define StaticAssertStmt(condition, errmessage)
int fdatasync(int fildes)
#define OidIsValid(objectId)
elog(ERROR, "%s: %s", p2, msg)
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
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
int durable_rename(const char *oldfile, const char *newfile, int elevel)
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 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)
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)
int FileWrite(File file, const void *buffer, size_t amount, off_t offset, uint32 wait_event_info)
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)
int FileRead(File file, void *buffer, size_t amount, off_t offset, uint32 wait_event_info)
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)
void SyncDataDirectory(void)
int FileZero(File file, off_t offset, off_t amount, uint32 wait_event_info)
off_t FileSize(File file)
int FileTruncate(File file, off_t offset, uint32 wait_event_info)
bool check_debug_io_direct(char **newval, void **extra, GucSource source)
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)
Assert(fmt[strlen(fmt) - 1] !='\n')
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
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 int fd(const char *x, int i)
int forkname_chars(const char *str, ForkNumber *fork)
#define TABLESPACE_VERSION_DIRECTORY
void ResourceOwnerEnlargeFiles(ResourceOwner owner)
void ResourceOwnerForgetFile(ResourceOwner owner, File file)
ResourceOwner CurrentResourceOwner
void ResourceOwnerRememberFile(ResourceOwner owner, File file)
void pg_usleep(long microsec)
#define ereport_startup_progress(msg,...)
SubTransactionId create_subid
union AllocateDesc::@19 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)
#define SYNC_METHOD_FSYNC_WRITETHROUGH
static const char * directory