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 DUMP_PRE_DATA   0x01
 
#define DUMP_DATA   0x02
 
#define DUMP_POST_DATA   0x04
 
#define DUMP_UNSECTIONED   0xff
 
#define pg_fatal(...)
 

Typedefs

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

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

◆ DUMP_DATA

#define DUMP_DATA   0x02

Definition at line 22 of file pg_backup_utils.h.

◆ DUMP_POST_DATA

#define DUMP_POST_DATA   0x04

Definition at line 23 of file pg_backup_utils.h.

◆ DUMP_PRE_DATA

#define DUMP_PRE_DATA   0x01

Definition at line 21 of file pg_backup_utils.h.

◆ DUMP_UNSECTIONED

#define DUMP_UNSECTIONED   0xff

Definition at line 24 of file pg_backup_utils.h.

◆ pg_fatal

#define pg_fatal (   ...)
Value:
do { \
pg_log_generic(PG_LOG_ERROR, PG_LOG_PRIMARY, __VA_ARGS__); \
exit_nicely(1); \
} while(0)
@ PG_LOG_PRIMARY
Definition: logging.h:67
@ PG_LOG_ERROR
Definition: logging.h:43

Definition at line 36 of file pg_backup_utils.h.

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 90 of file pg_backup_utils.c.

91 {
92  int i;
93 
94  for (i = on_exit_nicely_index - 1; i >= 0; i--)
95  on_exit_nicely_list[i].function(code,
97 
98 #ifdef WIN32
99  if (parallel_init_done && GetCurrentThreadId() != mainThreadId)
100  _endthreadex(code);
101 #endif
102 
103  exit(code);
104 }
int i
Definition: isn.c:73
exit(1)
static int on_exit_nicely_index
void * arg
static struct @32 on_exit_nicely_list[MAX_ON_EXIT_NICELY]

References arg, exit(), i, on_exit_nicely_index, and on_exit_nicely_list.

Referenced by set_dump_section().

◆ on_exit_nicely()

void on_exit_nicely ( on_exit_nicely_callback  function,
void *  arg 
)

Definition at line 63 of file pg_backup_utils.c.

64 {
66  pg_fatal("out of on_exit_nicely slots");
67  on_exit_nicely_list[on_exit_nicely_index].function = function;
70 }
#define MAX_ON_EXIT_NICELY
#define pg_fatal(...)

References arg, MAX_ON_EXIT_NICELY, on_exit_nicely_index, on_exit_nicely_list, and pg_fatal.

Referenced by on_exit_close_archive().

◆ set_dump_section()

void set_dump_section ( const char *  arg,
int *  dumpSections 
)

Definition at line 40 of file pg_backup_utils.c.

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  pg_log_error_hint("Try \"%s --help\" for more information.", progname);
56  exit_nicely(1);
57  }
58 }
#define pg_log_error(...)
Definition: logging.h:106
#define pg_log_error_hint(...)
Definition: logging.h:112
void exit_nicely(int code)
const char * progname
#define DUMP_PRE_DATA
#define DUMP_DATA
#define DUMP_UNSECTIONED
#define DUMP_POST_DATA

References arg, DUMP_DATA, DUMP_POST_DATA, DUMP_PRE_DATA, DUMP_UNSECTIONED, exit_nicely(), pg_log_error, pg_log_error_hint, and progname.

Referenced by main().

Variable Documentation

◆ progname

const char* progname
extern

Definition at line 44 of file main.c.