PostgreSQL Source Code
git master
|
#include <dirent.h>
Go to the source code of this file.
Macros | |
#define | FILE_POSSIBLY_DELETED(err) ((err) == ENOENT) |
#define | PG_O_DIRECT 0 |
#define | PG_TEMP_FILES_DIR "pgsql_tmp" |
#define | PG_TEMP_FILE_PREFIX "pgsql_tmp" |
Typedefs | |
typedef enum RecoveryInitSyncMethod | RecoveryInitSyncMethod |
typedef int | File |
Enumerations | |
enum | RecoveryInitSyncMethod { RECOVERY_INIT_SYNC_METHOD_FSYNC , RECOVERY_INIT_SYNC_METHOD_SYNCFS } |
Functions | |
File | PathNameOpenFile (const char *fileName, int fileFlags) |
File | PathNameOpenFilePerm (const char *fileName, int fileFlags, mode_t fileMode) |
File | OpenTemporaryFile (bool interXact) |
void | FileClose (File file) |
int | FilePrefetch (File file, off_t offset, int amount, uint32 wait_event_info) |
int | FileRead (File file, char *buffer, int amount, off_t offset, uint32 wait_event_info) |
int | FileWrite (File file, char *buffer, int amount, off_t offset, uint32 wait_event_info) |
int | FileSync (File file, uint32 wait_event_info) |
off_t | FileSize (File file) |
int | FileTruncate (File file, off_t offset, uint32 wait_event_info) |
void | FileWriteback (File file, off_t offset, off_t nbytes, uint32 wait_event_info) |
char * | FilePathName (File file) |
int | FileGetRawDesc (File file) |
int | FileGetRawFlags (File file) |
mode_t | FileGetRawMode (File file) |
File | PathNameCreateTemporaryFile (const char *name, bool error_on_failure) |
File | PathNameOpenTemporaryFile (const char *path, int mode) |
bool | PathNameDeleteTemporaryFile (const char *name, bool error_on_failure) |
void | PathNameCreateTemporaryDir (const char *base, const char *name) |
void | PathNameDeleteTemporaryDir (const char *name) |
void | TempTablespacePath (char *path, Oid tablespace) |
FILE * | AllocateFile (const char *name, const char *mode) |
int | FreeFile (FILE *file) |
FILE * | OpenPipeStream (const char *command, const char *mode) |
int | ClosePipeStream (FILE *file) |
DIR * | AllocateDir (const char *dirname) |
struct dirent * | ReadDir (DIR *dir, const char *dirname) |
struct dirent * | ReadDirExtended (DIR *dir, const char *dirname, int elevel) |
int | FreeDir (DIR *dir) |
int | OpenTransientFile (const char *fileName, int fileFlags) |
int | OpenTransientFilePerm (const char *fileName, int fileFlags, mode_t fileMode) |
int | CloseTransientFile (int fd) |
int | BasicOpenFile (const char *fileName, int fileFlags) |
int | BasicOpenFilePerm (const char *fileName, int fileFlags, mode_t fileMode) |
bool | AcquireExternalFD (void) |
void | ReserveExternalFD (void) |
void | ReleaseExternalFD (void) |
int | MakePGDirectory (const char *directoryName) |
void | InitFileAccess (void) |
void | InitTemporaryFileAccess (void) |
void | set_max_safe_fds (void) |
void | closeAllVfds (void) |
void | SetTempTablespaces (Oid *tableSpaces, int numSpaces) |
bool | TempTablespacesAreSet (void) |
int | GetTempTablespaces (Oid *tableSpaces, int numSpaces) |
Oid | GetNextTempTableSpace (void) |
void | AtEOXact_Files (bool isCommit) |
void | AtEOSubXact_Files (bool isCommit, SubTransactionId mySubid, SubTransactionId parentSubid) |
void | RemovePgTempFiles (void) |
void | RemovePgTempFilesInDir (const char *tmpdirname, bool missing_ok, bool unlink_all) |
bool | looks_like_temp_rel_name (const char *name) |
int | pg_fsync (int fd) |
int | pg_fsync_no_writethrough (int fd) |
int | pg_fsync_writethrough (int fd) |
int | pg_fdatasync (int fd) |
void | pg_flush_data (int fd, off_t offset, off_t amount) |
ssize_t | pg_pwritev_with_retry (int fd, const struct iovec *iov, int iovcnt, off_t offset) |
int | pg_truncate (const char *path, off_t length) |
void | fsync_fname (const char *fname, bool isdir) |
int | fsync_fname_ext (const char *fname, bool isdir, bool ignore_perm, int elevel) |
int | durable_rename (const char *oldfile, const char *newfile, int loglevel) |
int | durable_unlink (const char *fname, int loglevel) |
int | durable_rename_excl (const char *oldfile, const char *newfile, int loglevel) |
void | SyncDataDirectory (void) |
int | data_sync_elevel (int elevel) |
Variables | |
PGDLLIMPORT int | max_files_per_process |
PGDLLIMPORT bool | data_sync_retry |
PGDLLIMPORT int | recovery_init_sync_method |
PGDLLIMPORT int | max_safe_fds |
typedef enum RecoveryInitSyncMethod RecoveryInitSyncMethod |
bool AcquireExternalFD | ( | void | ) |
Definition at line 1177 of file fd.c.
References max_safe_fds, numExternalFDs, and ReserveExternalFD().
Referenced by connect_pg_server(), CreateWaitEventSet(), dblink_connect(), and dblink_get_conn().
DIR* AllocateDir | ( | const char * | dirname | ) |
Definition at line 2722 of file fd.c.
References allocatedDescs, AllocateDescDir, AllocateDesc::create_subid, AllocateDesc::desc, AllocateDesc::dir, DO_DB, elog(), ereport, errcode(), errmsg(), ERROR, GetCurrentSubTransactionId(), AllocateDesc::kind, LOG, maxAllocatedDescs, numAllocatedDescs, opendir(), ReleaseLruFile(), ReleaseLruFiles(), and reserveAllocatedDesc().
Referenced by calculate_database_size(), calculate_tablespace_size(), CheckPointLogicalRewriteHeap(), CheckPointSnapBuild(), CleanupBackupHistory(), copydir(), db_dir_size(), DeleteAllExportedSnapshotFiles(), destroy_tablespace_directories(), directory_is_empty(), do_pg_backup_start(), dsm_cleanup_for_mmap(), extension_file_exists(), get_ext_ver_list(), getInstallationPaths(), movedb(), ParseTzFile(), perform_base_backup(), pg_available_extension_versions(), pg_available_extensions(), pg_logdir_ls_internal(), pg_ls_dir(), pg_ls_dir_files(), pg_tablespace_databases(), pg_tzenumerate_next(), pg_tzenumerate_start(), pgarch_readyXlog(), RelationCacheInitFileRemove(), RelationCacheInitFileRemoveInDir(), RemoveNonParentXlogFiles(), RemoveOldXlogFiles(), RemovePgTempFiles(), RemovePgTempFilesInDir(), RemovePgTempRelationFiles(), RemovePgTempRelationFilesInDbspace(), RemoveTempXlogFiles(), ReorderBufferCleanupSerializedTXNs(), ResetUnloggedRelations(), ResetUnloggedRelationsInDbspaceDir(), ResetUnloggedRelationsInTablespaceDir(), restoreTwoPhaseData(), scan_directory_ci(), sendDir(), SlruScanDirectory(), StartupReorderBuffer(), StartupReplicationSlots(), SyncDataDirectory(), UpdateLogicalMappings(), and walkdir().
FILE* AllocateFile | ( | const char * | name, |
const char * | mode | ||
) |
Definition at line 2461 of file fd.c.
References allocatedDescs, AllocateDescFile, AllocateDesc::create_subid, AllocateDesc::desc, DO_DB, elog(), ereport, errcode(), errmsg(), ERROR, AllocateDesc::file, GetCurrentSubTransactionId(), AllocateDesc::kind, LOG, maxAllocatedDescs, mode, name, numAllocatedDescs, ReleaseLruFile(), ReleaseLruFiles(), and reserveAllocatedDesc().
Referenced by AlterSystemSetConfigFile(), apw_dump_now(), apw_load_buffers(), BeginCopyFrom(), BeginCopyTo(), checkControlFile(), do_pg_backup_stop(), entry_reset(), existsTimeLineHistory(), ExportSnapshot(), fill_hba_view(), fill_ident_view(), gc_qtexts(), GetHugePageSize(), ImportSnapshot(), load_dh_file(), load_hba(), load_ident(), load_relcache_init_file(), parse_extension_control_file(), ParseTzFile(), pg_current_logfile(), pg_file_write_internal(), pg_promote(), pgss_shmem_shutdown(), pgss_shmem_startup(), pgstat_read_statsfile(), pgstat_write_statsfile(), read_backup_label(), read_binary_file(), read_tablespace_map(), read_whole_file(), readTimeLineHistory(), tokenize_inc_file(), tsearch_readline_begin(), ValidatePgVersion(), write_relcache_init_file(), XLogArchiveForceDone(), and XLogArchiveNotify().
void AtEOSubXact_Files | ( | bool | isCommit, |
SubTransactionId | mySubid, | ||
SubTransactionId | parentSubid | ||
) |
Definition at line 3011 of file fd.c.
References allocatedDescs, AllocateDesc::create_subid, FreeDesc(), i, and numAllocatedDescs.
Referenced by AbortSubTransaction(), basic_archive_file(), and CommitSubTransaction().
void AtEOXact_Files | ( | bool | isCommit | ) |
Definition at line 3044 of file fd.c.
References CleanupTempFiles(), numTempTableSpaces, and tempTableSpaces.
Referenced by AbortTransaction(), AutoVacLauncherMain(), BackgroundWriterMain(), CheckpointerMain(), CommitTransaction(), PrepareTransaction(), and WalWriterMain().
int BasicOpenFile | ( | const char * | fileName, |
int | fileFlags | ||
) |
Definition at line 1071 of file fd.c.
References BasicOpenFilePerm(), and pg_file_create_mode.
Referenced by AlterSystemSetConfigFile(), ReadControlFile(), update_controlfile(), wal_segment_open(), WalSndSegmentOpen(), WriteControlFile(), XLogFileInit(), XLogFileInitInternal(), XLogFileOpen(), and XLogFileRead().
int BasicOpenFilePerm | ( | const char * | fileName, |
int | fileFlags, | ||
mode_t | fileMode | ||
) |
Definition at line 1093 of file fd.c.
References close, ereport, errcode(), errmsg(), fd(), LOG, O_DSYNC, PG_O_DIRECT, ReleaseLruFile(), and StaticAssertStmt.
Referenced by BasicOpenFile(), LruInsert(), OpenTransientFilePerm(), PathNameOpenFilePerm(), and readRecoverySignalFile().
void closeAllVfds | ( | void | ) |
Definition at line 2899 of file fd.c.
References Assert(), FileIsNotOpen, i, LruDelete(), and SizeVfdCache.
Referenced by standard_ProcessUtility().
int ClosePipeStream | ( | FILE * | file | ) |
Definition at line 2870 of file fd.c.
References allocatedDescs, AllocateDescPipe, AllocateDesc::desc, DO_DB, elog(), AllocateDesc::file, FreeDesc(), i, AllocateDesc::kind, LOG, numAllocatedDescs, and WARNING.
Referenced by ClosePipeFromProgram(), ClosePipeToProgram(), pg_import_system_collations(), run_ssl_passphrase_command(), and shell_finish_command().
int CloseTransientFile | ( | int | fd | ) |
Definition at line 2688 of file fd.c.
References allocatedDescs, AllocateDescRawFD, close, AllocateDesc::desc, DO_DB, elog(), AllocateDesc::fd, fd(), FreeDesc(), i, AllocateDesc::kind, LOG, numAllocatedDescs, and WARNING.
Referenced by ApplyLogicalMappingFile(), be_lo_export(), CheckPointLogicalRewriteHeap(), CheckPointReplicationOrigin(), compare_files(), copy_file(), CreateDirAndVersionFile(), dsm_impl_mmap(), durable_rename(), fsync_fname_ext(), get_controlfile(), heap_xlog_logical_rewrite(), lo_import_internal(), perform_base_backup(), pg_truncate(), qtext_load_file(), qtext_store(), read_relmap_file(), ReadTwoPhaseFile(), RecreateTwoPhaseFile(), ReorderBufferSerializeChange(), ReorderBufferSerializeTXN(), RestoreSlotFromDisk(), SaveSlotToPath(), sendFile(), SendTimeLineHistory(), SimpleLruDoesPhysicalPageExist(), SimpleLruWriteAll(), SlruInternalWritePage(), SlruPhysicalReadPage(), SlruPhysicalWritePage(), SlruSyncFileTag(), SnapBuildRestore(), SnapBuildSerialize(), StartupReplicationOrigin(), write_relmap_file(), writeTimeLineHistory(), writeTimeLineHistoryFile(), and XLogFileCopy().
int data_sync_elevel | ( | int | elevel | ) |
Definition at line 3826 of file fd.c.
References data_sync_retry, and PANIC.
Referenced by CheckPointLogicalRewriteHeap(), FileClose(), fsync_fname(), heap_xlog_logical_rewrite(), logical_end_heap_rewrite(), LruDelete(), mdimmedsync(), pg_flush_data(), ProcessSyncRequests(), register_dirty_segment(), SlruReportIOError(), write_relmap_file(), writeTimeLineHistory(), writeTimeLineHistoryFile(), and XLogFileCopy().
int durable_rename | ( | const char * | oldfile, |
const char * | newfile, | ||
int | loglevel | ||
) |
Definition at line 699 of file fd.c.
References CloseTransientFile(), ereport, errcode_for_file_access(), errmsg(), fd(), fsync_fname_ext(), fsync_parent_path(), OpenTransientFile(), PG_BINARY, and pg_fsync().
Referenced by AlterSystemSetConfigFile(), apw_dump_now(), BaseBackup(), bbsink_server_end_manifest(), CheckPointReplicationOrigin(), CleanupAfterArchiveRecovery(), dir_close(), InitWalRecovery(), KeepFileRestoredFromArchive(), pgarch_archiveDone(), pgss_shmem_shutdown(), StartupXLOG(), and XLogArchiveForceDone().
int durable_rename_excl | ( | const char * | oldfile, |
const char * | newfile, | ||
int | loglevel | ||
) |
Definition at line 829 of file fd.c.
References ereport, errcode_for_file_access(), errmsg(), fsync_fname_ext(), fsync_parent_path(), and link().
Referenced by basic_archive_file_internal(), InstallXLogFileSegment(), writeTimeLineHistory(), and writeTimeLineHistoryFile().
int durable_unlink | ( | const char * | fname, |
int | loglevel | ||
) |
Definition at line 789 of file fd.c.
References ereport, errcode_for_file_access(), errmsg(), and fsync_parent_path().
Referenced by InstallXLogFileSegment(), RemoveXlogFile(), and StartupXLOG().
void FileClose | ( | File | file | ) |
Definition at line 1961 of file fd.c.
References Assert(), close, data_sync_elevel(), Delete(), DO_DB, elog(), ereport, errcode_for_file_access(), errmsg(), vfd::fd, FD_DELETE_AT_CLOSE, FD_TEMP_FILE_LIMIT, vfd::fdstate, FileIsNotOpen, FileIsValid, vfd::fileName, vfd::fileSize, FreeVfd(), LOG, nfile, ReportTemporaryFileUsage(), ResourceOwnerForgetFile(), vfd::resowner, stat::st_size, stat, temporary_files_size, VFD_CLOSED, and VfdCache.
Referenced by bbsink_server_end_archive(), bbsink_server_end_manifest(), BufFileClose(), BufFileTruncateFileSet(), CleanupTempFiles(), logical_end_heap_rewrite(), mdclose(), mdimmedsync(), mdsyncfiletag(), mdtruncate(), ReorderBufferIterTXNFinish(), ReorderBufferRestoreChanges(), and ResourceOwnerReleaseInternal().
int FileGetRawDesc | ( | File | file | ) |
int FileGetRawFlags | ( | File | file | ) |
Definition at line 2365 of file fd.c.
References Assert(), vfd::fileFlags, FileIsValid, and VfdCache.
mode_t FileGetRawMode | ( | File | file | ) |
Definition at line 2375 of file fd.c.
References Assert(), FileIsValid, vfd::fileMode, and VfdCache.
char* FilePathName | ( | File | file | ) |
Definition at line 2339 of file fd.c.
References Assert(), FileIsValid, vfd::fileName, and VfdCache.
Referenced by _mdnblocks(), bbsink_server_archive_contents(), bbsink_server_end_archive(), bbsink_server_manifest_contents(), BufFileDumpBuffer(), BufFileLoadBuffer(), BufFileSeek(), BufFileSize(), BufFileTruncateFileSet(), mdextend(), mdimmedsync(), mdread(), mdsyncfiletag(), mdtruncate(), mdwrite(), and register_dirty_segment().
Definition at line 2061 of file fd.c.
References Assert(), DO_DB, elog(), fd(), FileAccess(), FileIsValid, INT64_FORMAT, LOG, pgstat_report_wait_end(), pgstat_report_wait_start(), and VfdCache.
Referenced by mdprefetch().
Definition at line 2112 of file fd.c.
References _dosmaperr(), Assert(), DO_DB, EINTR, elog(), error(), vfd::fd, FileAccess(), FileIsValid, INT64_FORMAT, LOG, pg_pread(), pg_usleep(), pgstat_report_wait_end(), pgstat_report_wait_start(), and VfdCache.
Referenced by BufFileLoadBuffer(), mdread(), and ReorderBufferRestoreChanges().
off_t FileSize | ( | File | file | ) |
Definition at line 2287 of file fd.c.
References Assert(), DO_DB, elog(), fd(), FileAccess(), FileIsNotOpen, FileIsValid, LOG, and VfdCache.
Referenced by _mdnblocks(), BufFileSeek(), and BufFileSize().
Definition at line 2266 of file fd.c.
References Assert(), DO_DB, elog(), fd(), FileAccess(), FileIsValid, LOG, pg_fsync(), pgstat_report_wait_end(), pgstat_report_wait_start(), and VfdCache.
Referenced by bbsink_server_end_archive(), logical_end_heap_rewrite(), mdimmedsync(), mdsyncfiletag(), and register_dirty_segment().
Definition at line 2304 of file fd.c.
References Assert(), DO_DB, elog(), fd(), FD_TEMP_FILE_LIMIT, FileAccess(), FileIsValid, vfd::fileSize, ftruncate, LOG, pgstat_report_wait_end(), pgstat_report_wait_start(), temporary_files_size, and VfdCache.
Referenced by BufFileTruncateFileSet(), and mdtruncate().
Definition at line 2168 of file fd.c.
References _dosmaperr(), Assert(), DO_DB, EINTR, elog(), ereport, errcode(), errmsg(), ERROR, error(), fd(), FD_TEMP_FILE_LIMIT, vfd::fdstate, FileAccess(), FileIsValid, vfd::fileSize, INT64_FORMAT, LOG, pg_pwrite(), pg_usleep(), pgstat_report_wait_end(), pgstat_report_wait_start(), temp_file_limit, temporary_files_size, and VfdCache.
Referenced by bbsink_server_archive_contents(), bbsink_server_manifest_contents(), BufFileDumpBuffer(), logical_heap_rewrite_flush_mappings(), mdextend(), and mdwrite().
Definition at line 2089 of file fd.c.
References Assert(), DO_DB, elog(), fd(), FileAccess(), FileIsValid, INT64_FORMAT, LOG, pg_flush_data(), pgstat_report_wait_end(), pgstat_report_wait_start(), and VfdCache.
Referenced by mdwriteback().
int FreeDir | ( | DIR * | dir | ) |
Definition at line 2840 of file fd.c.
References allocatedDescs, AllocateDescDir, closedir(), AllocateDesc::desc, AllocateDesc::dir, DO_DB, elog(), FreeDesc(), i, AllocateDesc::kind, LOG, numAllocatedDescs, and WARNING.
Referenced by calculate_database_size(), calculate_tablespace_size(), CheckPointLogicalRewriteHeap(), CheckPointSnapBuild(), CleanupBackupHistory(), copydir(), db_dir_size(), DeleteAllExportedSnapshotFiles(), destroy_tablespace_directories(), directory_is_empty(), do_pg_backup_start(), dsm_cleanup_for_mmap(), extension_file_exists(), get_ext_ver_list(), getInstallationPaths(), movedb(), ParseTzFile(), perform_base_backup(), pg_available_extension_versions(), pg_available_extensions(), pg_logdir_ls_internal(), pg_ls_dir(), pg_ls_dir_files(), pg_tablespace_databases(), pg_tzenumerate_end(), pg_tzenumerate_next(), pgarch_readyXlog(), RelationCacheInitFileRemove(), RelationCacheInitFileRemoveInDir(), RemoveNonParentXlogFiles(), RemoveOldXlogFiles(), RemovePgTempFiles(), RemovePgTempFilesInDir(), RemovePgTempRelationFiles(), RemovePgTempRelationFilesInDbspace(), RemoveTempXlogFiles(), ReorderBufferCleanupSerializedTXNs(), ResetUnloggedRelations(), ResetUnloggedRelationsInDbspaceDir(), ResetUnloggedRelationsInTablespaceDir(), restoreTwoPhaseData(), scan_directory_ci(), sendDir(), SlruScanDirectory(), StartupReorderBuffer(), StartupReplicationSlots(), SyncDataDirectory(), UpdateLogicalMappings(), and walkdir().
int FreeFile | ( | FILE * | file | ) |
Definition at line 2660 of file fd.c.
References allocatedDescs, AllocateDescFile, AllocateDesc::desc, DO_DB, elog(), AllocateDesc::file, FreeDesc(), i, AllocateDesc::kind, LOG, numAllocatedDescs, and WARNING.
Referenced by AlterSystemSetConfigFile(), apw_dump_now(), apw_load_buffers(), checkControlFile(), do_pg_backup_stop(), EndCopy(), EndCopyFrom(), entry_reset(), existsTimeLineHistory(), ExportSnapshot(), fill_hba_view(), fill_ident_view(), gc_qtexts(), GetHugePageSize(), ImportSnapshot(), load_dh_file(), load_hba(), load_ident(), load_relcache_init_file(), parse_extension_control_file(), ParseTzFile(), pg_current_logfile(), pg_file_write_internal(), pg_promote(), pgss_shmem_shutdown(), pgss_shmem_startup(), pgstat_read_statsfile(), pgstat_write_statsfile(), read_backup_label(), read_binary_file(), read_tablespace_map(), read_whole_file(), readTimeLineHistory(), tokenize_inc_file(), tsearch_readline_end(), ValidatePgVersion(), write_relcache_init_file(), XLogArchiveForceDone(), and XLogArchiveNotify().
void fsync_fname | ( | const char * | fname, |
bool | isdir | ||
) |
Definition at line 673 of file fd.c.
References data_sync_elevel(), ERROR, and fsync_fname_ext().
Referenced by _CloseArchive(), basic_archive_file_internal(), CheckPointLogicalRewriteHeap(), CheckPointTwoPhase(), copydir(), CreateSlotOnDisk(), dir_close(), dir_finish(), dir_open_for_write(), main(), ReplicationSlotDropPtr(), ResetUnloggedRelationsInDbspaceDir(), RestoreSlotFromDisk(), SaveSlotToPath(), SimpleLruWriteAll(), SnapBuildRestore(), SnapBuildSerialize(), StartupReplicationSlots(), and tar_finish().
Definition at line 3687 of file fd.c.
References CloseTransientFile(), ereport, errcode_for_file_access(), errmsg(), fd(), OpenTransientFile(), PG_BINARY, and pg_fsync().
Referenced by datadir_fsync_fname(), durable_rename(), durable_rename_excl(), fsync_fname(), fsync_parent_path(), and pg_file_sync().
Oid GetNextTempTableSpace | ( | void | ) |
Definition at line 2990 of file fd.c.
References InvalidOid, nextTempTableSpace, numTempTableSpaces, and tempTableSpaces.
Referenced by GetDefaultTablespace(), and OpenTemporaryFile().
int GetTempTablespaces | ( | Oid * | tableSpaces, |
int | numSpaces | ||
) |
Definition at line 2972 of file fd.c.
References Assert(), i, numTempTableSpaces, tempTableSpaces, and TempTablespacesAreSet().
Referenced by FileSetInit().
void InitFileAccess | ( | void | ) |
Definition at line 883 of file fd.c.
References Assert(), ereport, errcode(), errmsg(), FATAL, vfd::fd, malloc, MemSet, SizeVfdCache, VFD_CLOSED, and VfdCache.
Referenced by BaseInit().
void InitTemporaryFileAccess | ( | void | ) |
Definition at line 913 of file fd.c.
References Assert(), before_shmem_exit(), BeforeShmemExit_Files(), and SizeVfdCache.
Referenced by BaseInit().
bool looks_like_temp_rel_name | ( | const char * | name | ) |
Definition at line 3334 of file fd.c.
References forkname_chars(), and name.
Referenced by RemovePgTempRelationFilesInDbspace(), and sendDir().
int MakePGDirectory | ( | const char * | directoryName | ) |
Definition at line 3803 of file fd.c.
References mkdir, and pg_dir_create_mode.
Referenced by bbsink_server_new(), copydir(), create_tablespace_directories(), CreateDirAndVersionFile(), CreateSlotOnDisk(), OpenTemporaryFileInTablespace(), PathNameCreateTemporaryDir(), SysLogger_Start(), SysLoggerMain(), TablespaceCreateDbspace(), and ValidateXLOGDirectoryStructure().
FILE* OpenPipeStream | ( | const char * | command, |
const char * | mode | ||
) |
Definition at line 2564 of file fd.c.
References allocatedDescs, AllocateDescPipe, AllocateDesc::create_subid, AllocateDesc::desc, DO_DB, elog(), ereport, errcode(), errmsg(), ERROR, fflush(), AllocateDesc::file, GetCurrentSubTransactionId(), AllocateDesc::kind, LOG, maxAllocatedDescs, mode, numAllocatedDescs, pqsignal(), ReleaseLruFile(), ReleaseLruFiles(), reserveAllocatedDesc(), SIG_DFL, SIG_IGN, SIGPIPE, and generate_unaccent_rules::stdout.
Referenced by BeginCopyFrom(), BeginCopyTo(), pg_import_system_collations(), run_ssl_passphrase_command(), and shell_run_command().
Definition at line 1707 of file fd.c.
References Assert(), CurrentResourceOwner, FD_DELETE_AT_CLOSE, FD_TEMP_FILE_LIMIT, vfd::fdstate, GetNextTempTableSpace(), MyDatabaseTableSpace, numTempTableSpaces, OidIsValid, OpenTemporaryFileInTablespace(), RegisterTemporaryFile(), ResourceOwnerEnlargeFiles(), and VfdCache.
Referenced by BufFileCreateTemp(), and extendBufFile().
int OpenTransientFile | ( | const char * | fileName, |
int | fileFlags | ||
) |
Definition at line 2511 of file fd.c.
References OpenTransientFilePerm(), and pg_file_create_mode.
Referenced by ApplyLogicalMappingFile(), CheckPointLogicalRewriteHeap(), CheckPointReplicationOrigin(), compare_files(), copy_file(), CreateDirAndVersionFile(), dsm_impl_mmap(), durable_rename(), fsync_fname_ext(), get_controlfile(), heap_xlog_logical_rewrite(), lo_import_internal(), perform_base_backup(), pg_truncate(), qtext_load_file(), qtext_store(), read_relmap_file(), ReadTwoPhaseFile(), RecreateTwoPhaseFile(), ReorderBufferSerializeTXN(), RestoreSlotFromDisk(), SaveSlotToPath(), sendFile(), SendTimeLineHistory(), SimpleLruDoesPhysicalPageExist(), SlruPhysicalReadPage(), SlruPhysicalWritePage(), SlruSyncFileTag(), SnapBuildRestore(), SnapBuildSerialize(), StartupReplicationOrigin(), write_relmap_file(), writeTimeLineHistory(), writeTimeLineHistoryFile(), and XLogFileCopy().
int OpenTransientFilePerm | ( | const char * | fileName, |
int | fileFlags, | ||
mode_t | fileMode | ||
) |
Definition at line 2520 of file fd.c.
References allocatedDescs, AllocateDescRawFD, BasicOpenFilePerm(), AllocateDesc::create_subid, AllocateDesc::desc, DO_DB, elog(), ereport, errcode(), errmsg(), ERROR, AllocateDesc::fd, fd(), GetCurrentSubTransactionId(), AllocateDesc::kind, LOG, maxAllocatedDescs, numAllocatedDescs, ReleaseLruFiles(), and reserveAllocatedDesc().
Referenced by be_lo_export(), and OpenTransientFile().
void PathNameCreateTemporaryDir | ( | const char * | base, |
const char * | name | ||
) |
Definition at line 1643 of file fd.c.
References basedir, directory, ereport, errcode_for_file_access(), errmsg(), ERROR, and MakePGDirectory().
Referenced by FileSetCreate().
Definition at line 1844 of file fd.c.
References Assert(), CurrentResourceOwner, ereport, errcode_for_file_access(), errmsg(), ERROR, FD_TEMP_FILE_LIMIT, vfd::fdstate, PathNameOpenFile(), PG_BINARY, RegisterTemporaryFile(), ResourceOwnerEnlargeFiles(), and VfdCache.
Referenced by FileSetCreate().
void PathNameDeleteTemporaryDir | ( | const char * | name | ) |
Definition at line 1674 of file fd.c.
References LOG, stat, unlink_if_exists_fname(), and walkdir().
Referenced by FileSetDeleteAll().
Definition at line 1915 of file fd.c.
References ereport, errcode_for_file_access(), errmsg(), ERROR, LOG, ReportTemporaryFileUsage(), stat::st_size, and stat.
Referenced by FileSetDelete(), and unlink_if_exists_fname().
File PathNameOpenFile | ( | const char * | fileName, |
int | fileFlags | ||
) |
Definition at line 1566 of file fd.c.
References PathNameOpenFilePerm(), and pg_file_create_mode.
Referenced by _mdfd_openseg(), bbsink_server_begin_archive(), bbsink_server_begin_manifest(), logical_rewrite_log_mapping(), mdcreate(), mdopenfork(), mdsyncfiletag(), OpenTemporaryFileInTablespace(), PathNameCreateTemporaryFile(), PathNameOpenTemporaryFile(), and ReorderBufferRestoreChanges().
File PathNameOpenFilePerm | ( | const char * | fileName, |
int | fileFlags, | ||
mode_t | fileMode | ||
) |
Definition at line 1579 of file fd.c.
References AllocateVfd(), BasicOpenFilePerm(), DO_DB, elog(), ereport, errcode(), errmsg(), ERROR, vfd::fd, vfd::fdstate, vfd::fileFlags, vfd::fileMode, vfd::fileName, vfd::fileSize, free, FreeVfd(), Insert(), LOG, nfile, ReleaseLruFiles(), vfd::resowner, and VfdCache.
Referenced by PathNameOpenFile().
File PathNameOpenTemporaryFile | ( | const char * | path, |
int | mode | ||
) |
Definition at line 1884 of file fd.c.
References Assert(), CurrentResourceOwner, ereport, errcode_for_file_access(), errmsg(), ERROR, mode, PathNameOpenFile(), PG_BINARY, RegisterTemporaryFile(), and ResourceOwnerEnlargeFiles().
Referenced by FileSetOpen().
int pg_fdatasync | ( | int | fd | ) |
Definition at line 449 of file fd.c.
References enableFsync, fd(), and fsync.
Referenced by issue_xlog_fsync().
void pg_flush_data | ( | int | fd, |
off_t | offset, | ||
off_t | amount | ||
) |
Definition at line 469 of file fd.c.
References data_sync_elevel(), enableFsync, ereport, errcode_for_file_access(), errmsg(), FATAL, fd(), MAP_FAILED, and WARNING.
Referenced by copy_file(), and FileWriteback().
int pg_fsync | ( | int | fd | ) |
Definition at line 359 of file fd.c.
References Assert(), fd(), fstat, pg_fsync_no_writethrough(), pg_fsync_writethrough(), S_ISDIR, stat::st_mode, sync_method, and SYNC_METHOD_FSYNC_WRITETHROUGH.
Referenced by AddToDataDirLockFile(), assign_xlog_sync_method(), BootStrapXLOG(), CheckPointLogicalRewriteHeap(), CreateLockFile(), durable_rename(), FileSync(), fsync_fname_ext(), heap_xlog_logical_rewrite(), readRecoverySignalFile(), RecreateTwoPhaseFile(), RestoreSlotFromDisk(), SaveSlotToPath(), SlruPhysicalWritePage(), SlruSyncFileTag(), SnapBuildSerialize(), update_controlfile(), write_auto_conf_file(), write_relmap_file(), WriteControlFile(), writeTimeLineHistory(), writeTimeLineHistoryFile(), XLogFileCopy(), and XLogFileInitInternal().
int pg_fsync_no_writethrough | ( | int | fd | ) |
Definition at line 414 of file fd.c.
References enableFsync, fd(), and fsync.
Referenced by issue_xlog_fsync(), and pg_fsync().
int pg_fsync_writethrough | ( | int | fd | ) |
Definition at line 426 of file fd.c.
References enableFsync, and fd().
Referenced by issue_xlog_fsync(), pg_fsync(), and test_sync().
ssize_t pg_pwritev_with_retry | ( | int | fd, |
const struct iovec * | iov, | ||
int | iovcnt, | ||
off_t | offset | ||
) |
Definition at line 3836 of file fd.c.
References Assert(), fd(), iovec::iov_base, iovec::iov_len, Min, PG_IOV_MAX, and pg_pwritev().
Referenced by XLogFileInitInternal().
int pg_truncate | ( | const char * | path, |
off_t | length | ||
) |
Definition at line 642 of file fd.c.
References CloseTransientFile(), fd(), ftruncate, OpenTransientFile(), and PG_BINARY.
Referenced by do_truncate().
Definition at line 2788 of file fd.c.
References ERROR, and ReadDirExtended().
Referenced by calculate_database_size(), calculate_tablespace_size(), CheckPointLogicalRewriteHeap(), CheckPointSnapBuild(), CleanupBackupHistory(), copydir(), db_dir_size(), destroy_tablespace_directories(), directory_is_empty(), do_pg_backup_start(), dsm_cleanup_for_mmap(), extension_file_exists(), get_ext_ver_list(), movedb(), perform_base_backup(), pg_available_extension_versions(), pg_available_extensions(), pg_logdir_ls_internal(), pg_ls_dir(), pg_ls_dir_files(), pg_tablespace_databases(), pg_tzenumerate_next(), pgarch_readyXlog(), RemoveNonParentXlogFiles(), RemoveOldXlogFiles(), RemoveTempXlogFiles(), ResetUnloggedRelations(), ResetUnloggedRelationsInDbspaceDir(), ResetUnloggedRelationsInTablespaceDir(), restoreTwoPhaseData(), sendDir(), SlruScanDirectory(), StartupReorderBuffer(), StartupReplicationSlots(), and UpdateLogicalMappings().
Definition at line 2803 of file fd.c.
References ereport, errcode_for_file_access(), errmsg(), and readdir().
Referenced by DeleteAllExportedSnapshotFiles(), ReadDir(), RelationCacheInitFileRemove(), RelationCacheInitFileRemoveInDir(), RemovePgTempFiles(), RemovePgTempFilesInDir(), RemovePgTempRelationFiles(), RemovePgTempRelationFilesInDbspace(), ReorderBufferCleanupSerializedTXNs(), scan_directory_ci(), SyncDataDirectory(), and walkdir().
void ReleaseExternalFD | ( | void | ) |
Definition at line 1230 of file fd.c.
References Assert(), and numExternalFDs.
Referenced by ClosePostmasterPorts(), connect_pg_server(), createNewConnection(), CreateWaitEventSet(), dblink_connect(), dblink_disconnect(), dblink_exec(), dblink_get_conn(), dblink_record_internal(), dblink_security_check(), disconnect_pg_server(), FreeWaitEventSet(), InitializeLatchSupport(), and XLogFileClose().
void RemovePgTempFiles | ( | void | ) |
Definition at line 3153 of file fd.c.
References AllocateDir(), dirent::d_name, FreeDir(), LOG, MAXPGPATH, PG_TEMP_FILES_DIR, ReadDirExtended(), RemovePgTempFilesInDir(), RemovePgTempRelationFiles(), snprintf, and TABLESPACE_VERSION_DIRECTORY.
Referenced by PostmasterMain(), and PostmasterStateMachine().
Definition at line 3212 of file fd.c.
References AllocateDir(), dirent::d_name, ereport, errcode_for_file_access(), errmsg(), FreeDir(), LOG, lstat, MAXPGPATH, PG_TEMP_FILE_PREFIX, ReadDirExtended(), S_ISDIR, snprintf, and stat::st_mode.
Referenced by PostmasterMain(), and RemovePgTempFiles().
void ReserveExternalFD | ( | void | ) |
Definition at line 1212 of file fd.c.
References numExternalFDs, and ReleaseLruFiles().
Referenced by AcquireExternalFD(), BackendInitialize(), InitializeLatchSupport(), InitPostmasterDeathWatchHandle(), and XLogWrite().
void set_max_safe_fds | ( | void | ) |
Definition at line 1028 of file fd.c.
References count_usable_fds(), DEBUG2, elog(), ereport, errcode(), errdetail(), errmsg(), FATAL, FD_MINFREE, max_files_per_process, max_safe_fds, Min, and NUM_RESERVED_FDS.
Referenced by PostmasterMain().
void SetTempTablespaces | ( | Oid * | tableSpaces, |
int | numSpaces | ||
) |
Definition at line 2928 of file fd.c.
References Assert(), nextTempTableSpace, numTempTableSpaces, pg_global_prng_state, pg_prng_uint64_range(), and tempTableSpaces.
Referenced by assign_temp_tablespaces(), and PrepareTempTablespaces().
void SyncDataDirectory | ( | void | ) |
Definition at line 3429 of file fd.c.
References AllocateDir(), begin_startup_progress_phase(), dirent::d_name, datadir_fsync_fname(), DEBUG1, enableFsync, ereport, errcode_for_file_access(), errmsg(), FreeDir(), LOG, lstat, MAXPGPATH, pgwin32_is_junction(), ReadDirExtended(), recovery_init_sync_method, RECOVERY_INIT_SYNC_METHOD_SYNCFS, snprintf, stat::st_mode, and walkdir().
Referenced by StartupXLOG().
void TempTablespacePath | ( | char * | path, |
Oid | tablespace | ||
) |
Definition at line 1762 of file fd.c.
References InvalidOid, MAXPGPATH, PG_TEMP_FILES_DIR, snprintf, tablespace, and TABLESPACE_VERSION_DIRECTORY.
Referenced by FileSetCreate(), FileSetPath(), OpenTemporaryFileInTablespace(), and pg_ls_tmpdir().
bool TempTablespacesAreSet | ( | void | ) |
Definition at line 2957 of file fd.c.
References numTempTableSpaces.
Referenced by GetTempTablespaces(), and PrepareTempTablespaces().
|
extern |
Definition at line 163 of file fd.c.
Referenced by data_sync_elevel().
|
extern |
Definition at line 147 of file fd.c.
Referenced by set_max_safe_fds().
|
extern |
Definition at line 160 of file fd.c.
Referenced by AcquireExternalFD(), ReleaseLruFiles(), reserveAllocatedDesc(), and set_max_safe_fds().
|
extern |
Definition at line 166 of file fd.c.
Referenced by SyncDataDirectory().