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.

Macros

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

Typedefs

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

Enumerations

enum  DumpSections { DUMP_PRE_DATA = 0x01, DUMP_DATA = 0x02, DUMP_POST_DATA = 0x04, DUMP_UNSECTIONED = 0xff }
 

Functions

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()
 

Variables

const char * progname
 

Macro Definition Documentation

◆ fatal

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

Definition at line 36 of file pg_backup_utils.h.

Referenced by _allocAH(), _check_database_version(), _Clone(), _CloseArchive(), _connectDB(), _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(), ConnectDatabase(), createViewAsClause(), die_on_query_failure(), dump_lo_buf(), dumpACL(), dumpAgg(), dumpBlobs(), dumpCast(), dumpCollation(), dumpConstraint(), dumpDefaultACL(), dumpFunc(), dumpSearchPath(), dumpSequence(), dumpTableSchema(), dumpTransform(), EndCompressor(), EndDBCopyMode(), ExecuteSqlCommandBuf(), ExecuteSqlQueryForSingleRow(), expand_schema_name_patterns(), expand_table_name_patterns(), findDependencyLoops(), findNamespace(), 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(), processStdStringsEntry(), ReadDataFromArchive(), ReadHead(), ReadOffset(), ReadToc(), RestoreArchive(), RestoreOutput(), sendMessageToMaster(), 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 28 of file pg_backup_utils.h.

Enumeration Type Documentation

◆ DumpSections

Enumerator
DUMP_PRE_DATA 
DUMP_DATA 
DUMP_POST_DATA 
DUMP_UNSECTIONED 

Definition at line 20 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;
97 
98  for (i = on_exit_nicely_index - 1; i >= 0; i--)
99  on_exit_nicely_list[i].function(code,
101 
102 #ifdef WIN32
103  if (parallel_init_done && GetCurrentThreadId() != mainThreadId)
104  _endthreadex(code);
105 #endif
106 
107  exit(code);
108 }
static struct @38 on_exit_nicely_list[MAX_ON_EXIT_NICELY]
int i
static int on_exit_nicely_index
void * arg

◆ 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 init_parallel_dump_utils(), and 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 }
#define MAX_ON_EXIT_NICELY
void exit_nicely(int code)
static struct @38 on_exit_nicely_list[MAX_ON_EXIT_NICELY]
static int on_exit_nicely_index
void * arg
#define pg_log_fatal(...)
Definition: logging.h:75

◆ 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;
45 
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:79
#define fprintf
Definition: port.h:196
const char * progname
void * arg
#define _(x)
Definition: elog.c:87

Variable Documentation

◆ progname

const char* progname

Definition at line 36 of file pg_standby.c.