PostgreSQL Source Code  git master
pg_backup_utils.h File Reference
#include "common/logging.h"
Include dependency graph for pg_backup_utils.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.


#define DUMP_PRE_DATA   0x01
#define DUMP_DATA   0x02
#define DUMP_POST_DATA   0x04
#define DUMP_UNSECTIONED   0xff
#define fatal(...)   do { pg_log_error(__VA_ARGS__); exit_nicely(1); } while(0)


typedef void(* on_exit_nicely_callback) (int code, void *arg)


void set_dump_section (const char *arg, int *dumpSections)
void on_exit_nicely (on_exit_nicely_callback function, void *arg)
void exit_nicely (int code) pg_attribute_noreturn()


const char * progname

Macro Definition Documentation


#define DUMP_DATA   0x02

Definition at line 22 of file pg_backup_utils.h.

Referenced by _tocEntryRequired(), and set_dump_section().


#define DUMP_POST_DATA   0x04

Definition at line 23 of file pg_backup_utils.h.

Referenced by _tocEntryRequired(), and set_dump_section().


#define DUMP_PRE_DATA   0x01

Definition at line 21 of file pg_backup_utils.h.

Referenced by _tocEntryRequired(), and set_dump_section().


#define DUMP_UNSECTIONED   0xff

Definition at line 24 of file pg_backup_utils.h.

Referenced by InitDumpOptions(), NewRestoreOptions(), and set_dump_section().

◆ fatal

#define fatal (   ...)    do { pg_log_error(__VA_ARGS__); exit_nicely(1); } while(0)

Definition at line 34 of file pg_backup_utils.h.

Referenced by _allocAH(), _check_database_version(), _Clone(), _CloseArchive(), _discoverArchiveFormat(), _doSetSessionAuth(), _EndBlob(), _getFilePos(), _LoadBlobs(), _PrepParallelRestore(), _PrintFileData(), _PrintTocData(), _ReadBuf(), _ReadByte(), _ReopenArchive(), _skipData(), _StartBlob(), _StartBlobs(), _StartData(), _tarAddFile(), _tarGetHeader(), _tarPositionTo(), _tarReadRaw(), _WriteBuf(), _WriteByte(), _WriteData(), AllocateCompressor(), binary_upgrade_extension_member(), buildTocEntryArrays(), cfgetc(), cfopen(), cfopen_write(), cfread(), CloseArchive(), compile_database_list(), ConnectDatabase(), createViewAsClause(), die_on_query_failure(), dumpACL(), dumpAgg(), dumpBlobs(), dumpCast(), dumpCollation(), dumpConstraint(), dumpDefaultACL(), dumpFunc(), dumpIndex(), dumpSearchPath(), dumpSequence(), dumpSubscription(), dumpTransform(), EndCompressor(), EndDBCopyMode(), ExecuteSqlCommandBuf(), ExecuteSqlQueryForSingleRow(), expand_extension_name_patterns(), expand_foreign_server_name_patterns(), expand_schema_name_patterns(), expand_table_name_patterns(), findDependencyLoops(), findNamespace(), flagInhTables(), getAttrName(), getMessageFromWorker(), getOwnedSeqs(), getRules(), getTableAttrs(), getTriggers(), InitArchiveFmt_Custom(), InitArchiveFmt_Directory(), InitArchiveFmt_Null(), InitArchiveFmt_Tar(), ListenToWorkers(), lockTableForWorker(), main(), mark_dump_job_done(), mark_restore_job_done(), ParallelBackupStart(), parseArchiveFormat(), ParseCompressionOption(), parseWorkerCommand(), parseWorkerResponse(), ProcessArchiveRestoreOptions(), processEncodingEntry(), processExtensionTables(), processStdStringsEntry(), ReadDataFromArchive(), ReadHead(), ReadOffset(), ReadToc(), RestoreArchive(), RestoreOutput(), sendMessageToLeader(), sendMessageToWorker(), setFilePath(), SetOutput(), setup_connection(), SortTocFromFile(), StartBlob(), StartRestoreBlob(), StrictNamesCheck(), tarClose(), tarOpen(), TopoSort(), WriteData(), and WriteDataToArchive().

Typedef Documentation

◆ on_exit_nicely_callback

typedef void(* on_exit_nicely_callback) (int code, void *arg)

Definition at line 26 of file pg_backup_utils.h.

Function Documentation

◆ exit_nicely()

void exit_nicely ( int  code)

Definition at line 94 of file pg_backup_utils.c.

References arg, i, on_exit_nicely_index, and on_exit_nicely_list.

Referenced by on_exit_nicely(), and set_dump_section().

95 {
96  int i;
98  for (i = on_exit_nicely_index - 1; i >= 0; i--)
99  on_exit_nicely_list[i].function(code,
102 #ifdef WIN32
103  if (parallel_init_done && GetCurrentThreadId() != mainThreadId)
104  _endthreadex(code);
105 #endif
107  exit(code);
108 }
int i
static int on_exit_nicely_index
void * arg
static struct @30 on_exit_nicely_list[MAX_ON_EXIT_NICELY]

◆ on_exit_nicely()

void on_exit_nicely ( on_exit_nicely_callback  function,
void *  arg 

Definition at line 64 of file pg_backup_utils.c.

References arg, exit_nicely(), MAX_ON_EXIT_NICELY, on_exit_nicely_index, on_exit_nicely_list, and pg_log_fatal.

Referenced by on_exit_close_archive().

65 {
67  {
68  pg_log_fatal("out of on_exit_nicely slots");
69  exit_nicely(1);
70  }
71  on_exit_nicely_list[on_exit_nicely_index].function = function;
74 }
void exit_nicely(int code)
static int on_exit_nicely_index
void * arg
static struct @30 on_exit_nicely_list[MAX_ON_EXIT_NICELY]
#define pg_log_fatal(...)
Definition: logging.h:76

◆ set_dump_section()

void set_dump_section ( const char *  arg,
int *  dumpSections 

Definition at line 40 of file pg_backup_utils.c.

References _, DUMP_DATA, DUMP_POST_DATA, DUMP_PRE_DATA, DUMP_UNSECTIONED, exit_nicely(), fprintf, pg_log_error, and progname.

Referenced by main().

41 {
42  /* if this is the first call, clear all the bits */
43  if (*dumpSections == DUMP_UNSECTIONED)
44  *dumpSections = 0;
46  if (strcmp(arg, "pre-data") == 0)
47  *dumpSections |= DUMP_PRE_DATA;
48  else if (strcmp(arg, "data") == 0)
49  *dumpSections |= DUMP_DATA;
50  else if (strcmp(arg, "post-data") == 0)
51  *dumpSections |= DUMP_POST_DATA;
52  else
53  {
54  pg_log_error("unrecognized section name: \"%s\"", arg);
55  fprintf(stderr, _("Try \"%s --help\" for more information.\n"),
56  progname);
57  exit_nicely(1);
58  }
59 }
void exit_nicely(int code)
#define pg_log_error(...)
Definition: logging.h:80
#define fprintf
Definition: port.h:221
const char * progname
#define DUMP_DATA
void * arg
#define _(x)
Definition: elog.c:89

Variable Documentation

◆ progname

const char* progname

Definition at line 46 of file main.c.