PostgreSQL Source Code git master
All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
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 92 of file pg_backup_utils.c.

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

References arg, exit(), function, 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 65 of file pg_backup_utils.c.

66{
68 pg_fatal("out of on_exit_nicely slots");
72}
#define MAX_ON_EXIT_NICELY
#define pg_fatal(...)

References arg, function, 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 42 of file pg_backup_utils.c.

43{
44 /* if this is the first call, clear all the bits */
45 if (*dumpSections == DUMP_UNSECTIONED)
46 *dumpSections = 0;
47
48 if (strcmp(arg, "pre-data") == 0)
49 *dumpSections |= DUMP_PRE_DATA;
50 else if (strcmp(arg, "data") == 0)
51 *dumpSections |= DUMP_DATA;
52 else if (strcmp(arg, "post-data") == 0)
53 *dumpSections |= DUMP_POST_DATA;
54 else
55 {
56 pg_log_error("unrecognized section name: \"%s\"", arg);
57 pg_log_error_hint("Try \"%s --help\" for more information.", progname);
58 exit_nicely(1);
59 }
60}
#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.