| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
|
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| #ifndef FD_H |
| #define FD_H |
|
|
| #include <dirent.h> |
| #include <fcntl.h> |
|
|
| typedef enum RecoveryInitSyncMethod |
| { |
| RECOVERY_INIT_SYNC_METHOD_FSYNC, |
| RECOVERY_INIT_SYNC_METHOD_SYNCFS |
| } RecoveryInitSyncMethod; |
|
|
| typedef int File; |
|
|
|
|
| #define IO_DIRECT_DATA 0x01 |
| #define IO_DIRECT_WAL 0x02 |
| #define IO_DIRECT_WAL_INIT 0x04 |
|
|
|
|
| |
| extern PGDLLIMPORT int max_files_per_process; |
| extern PGDLLIMPORT bool data_sync_retry; |
| extern PGDLLIMPORT int recovery_init_sync_method; |
| extern PGDLLIMPORT int io_direct_flags; |
|
|
| |
| |
| |
| extern PGDLLIMPORT int max_safe_fds; |
|
|
| |
| |
| |
| |
| |
| |
| |
| #ifndef WIN32 |
| #define FILE_POSSIBLY_DELETED(err) ((err) == ENOENT) |
| #else |
| #define FILE_POSSIBLY_DELETED(err) ((err) == ENOENT || (err) == EACCES) |
| #endif |
|
|
| |
| |
| |
| |
| |
| |
| |
| |
| #if defined(O_DIRECT) && defined(pg_attribute_aligned) |
| #define PG_O_DIRECT O_DIRECT |
| #elif defined(F_NOCACHE) |
| #define PG_O_DIRECT 0x80000000 |
| #define PG_O_DIRECT_USE_F_NOCACHE |
| #else |
| #define PG_O_DIRECT 0 |
| #endif |
|
|
| |
| |
| |
|
|
| |
| extern File PathNameOpenFile(const char *fileName, int fileFlags); |
| extern File PathNameOpenFilePerm(const char *fileName, int fileFlags, mode_t fileMode); |
| extern File OpenTemporaryFile(bool interXact); |
| extern void FileClose(File file); |
| extern int FilePrefetch(File file, off_t offset, off_t amount, uint32 wait_event_info); |
| extern int FileRead(File file, void *buffer, size_t amount, off_t offset, uint32 wait_event_info); |
| extern int FileWrite(File file, const void *buffer, size_t amount, off_t offset, uint32 wait_event_info); |
| extern int FileSync(File file, uint32 wait_event_info); |
| extern int FileZero(File file, off_t offset, off_t amount, uint32 wait_event_info); |
| extern int FileFallocate(File file, off_t offset, off_t amount, uint32 wait_event_info); |
|
|
| extern off_t FileSize(File file); |
| extern int FileTruncate(File file, off_t offset, uint32 wait_event_info); |
| extern void FileWriteback(File file, off_t offset, off_t nbytes, uint32 wait_event_info); |
| extern char *FilePathName(File file); |
| extern int FileGetRawDesc(File file); |
| extern int FileGetRawFlags(File file); |
| extern mode_t FileGetRawMode(File file); |
|
|
| |
| extern File PathNameCreateTemporaryFile(const char *path, bool error_on_failure); |
| extern File PathNameOpenTemporaryFile(const char *path, int mode); |
| extern bool PathNameDeleteTemporaryFile(const char *path, bool error_on_failure); |
| extern void PathNameCreateTemporaryDir(const char *basedir, const char *directory); |
| extern void PathNameDeleteTemporaryDir(const char *dirname); |
| extern void TempTablespacePath(char *path, Oid tablespace); |
|
|
| |
| extern FILE *AllocateFile(const char *name, const char *mode); |
| extern int FreeFile(FILE *file); |
|
|
| |
| extern FILE *OpenPipeStream(const char *command, const char *mode); |
| extern int ClosePipeStream(FILE *file); |
|
|
| |
| extern DIR *AllocateDir(const char *dirname); |
| extern struct dirent *ReadDir(DIR *dir, const char *dirname); |
| extern struct dirent *ReadDirExtended(DIR *dir, const char *dirname, |
| int elevel); |
| extern int FreeDir(DIR *dir); |
|
|
| |
| extern int OpenTransientFile(const char *fileName, int fileFlags); |
| extern int OpenTransientFilePerm(const char *fileName, int fileFlags, mode_t fileMode); |
| extern int CloseTransientFile(int fd); |
|
|
| |
| extern int BasicOpenFile(const char *fileName, int fileFlags); |
| extern int BasicOpenFilePerm(const char *fileName, int fileFlags, mode_t fileMode); |
|
|
| |
| extern bool AcquireExternalFD(void); |
| extern void ReserveExternalFD(void); |
| extern void ReleaseExternalFD(void); |
|
|
| |
| extern int MakePGDirectory(const char *directoryName); |
|
|
| |
| extern void InitFileAccess(void); |
| extern void InitTemporaryFileAccess(void); |
| extern void set_max_safe_fds(void); |
| extern void closeAllVfds(void); |
| extern void SetTempTablespaces(Oid *tableSpaces, int numSpaces); |
| extern bool TempTablespacesAreSet(void); |
| extern int GetTempTablespaces(Oid *tableSpaces, int numSpaces); |
| extern Oid GetNextTempTableSpace(void); |
| extern void AtEOXact_Files(bool isCommit); |
| extern void AtEOSubXact_Files(bool isCommit, SubTransactionId mySubid, |
| SubTransactionId parentSubid); |
| extern void RemovePgTempFiles(void); |
| extern void RemovePgTempFilesInDir(const char *tmpdirname, bool missing_ok, |
| bool unlink_all); |
| extern bool looks_like_temp_rel_name(const char *name); |
|
|
| extern int pg_fsync(int fd); |
| extern int pg_fsync_no_writethrough(int fd); |
| extern int pg_fsync_writethrough(int fd); |
| extern int pg_fdatasync(int fd); |
| extern void pg_flush_data(int fd, off_t offset, off_t nbytes); |
| extern int pg_truncate(const char *path, off_t length); |
| extern void fsync_fname(const char *fname, bool isdir); |
| extern int fsync_fname_ext(const char *fname, bool isdir, bool ignore_perm, int elevel); |
| extern int durable_rename(const char *oldfile, const char *newfile, int elevel); |
| extern int durable_unlink(const char *fname, int elevel); |
| extern void SyncDataDirectory(void); |
| extern int data_sync_elevel(int elevel); |
|
|
| |
| #define PG_TEMP_FILES_DIR "pgsql_tmp" |
| #define PG_TEMP_FILE_PREFIX "pgsql_tmp" |
|
|
| #endif |
|
|