1/*-------------------------------------------------------------------------
3 * Assorted utility functions to work on files.
6 * Portions Copyright (c) 1996-2025, PostgreSQL Global Development Group
7 * Portions Copyright (c) 1994, Regents of the University of California
9 * src/include/common/file_utils.h
11 *-------------------------------------------------------------------------
33struct iovec;
/* avoid including port/pg_iovec.h here */
36extern int pre_sync_fname(
const char *fname,
bool isdir);
37extern int fsync_fname(
const char *fname,
bool isdir);
38extern void sync_pgdata(
const char *
pg_data,
int serverVersion,
41extern int durable_rename(
const char *oldfile,
const char *newfile);
47 bool look_through_symlinks,
51 const struct iovec *
source,
56 const struct iovec *iov,
62/* Filename components */
63 #define PG_TEMP_FILES_DIR "pgsql_tmp"
64 #define PG_TEMP_FILE_PREFIX "pgsql_tmp"
66#endif /* FILE_UTILS_H */
int durable_rename(const char *oldfile, const char *newfile, int elevel)
void fsync_fname(const char *fname, bool isdir)
static int fsync_parent_path(const char *fname, int elevel)
int compute_remaining_iovec(struct iovec *destination, const struct iovec *source, int iovcnt, size_t transferred)
ssize_t pg_pwrite_zeros(int fd, size_t size, off_t offset)
@ DATA_DIR_SYNC_METHOD_SYNCFS
@ DATA_DIR_SYNC_METHOD_FSYNC
ssize_t pg_pwritev_with_retry(int fd, const struct iovec *iov, int iovcnt, off_t offset)
PGFileType get_dirent_type(const char *path, const struct dirent *de, bool look_through_symlinks, int elevel)
static bool sync_data_files
static DataDirSyncMethod sync_method
static rewind_source * source
static int fd(const char *x, int i)