PostgreSQL Source Code git master
Loading...
Searching...
No Matches
pg_backup_utils.c File Reference
#include "postgres_fe.h"
#include "pg_backup_utils.h"
Include dependency graph for pg_backup_utils.c:

Go to the source code of this file.

Macros

#define MAX_ON_EXIT_NICELY   20
 

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)
 

Variables

const charprogname = NULL
 
struct { 
 
   on_exit_nicely_callback   function 
 
   void *   arg 
 
on_exit_nicely_list [MAX_ON_EXIT_NICELY
 
static int on_exit_nicely_index
 

Macro Definition Documentation

◆ MAX_ON_EXIT_NICELY

#define MAX_ON_EXIT_NICELY   20

Definition at line 24 of file pg_backup_utils.c.

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
102 _endthreadex(code);
103#endif
104
105 exit(code);
106}
int i
Definition isn.c:77
static int on_exit_nicely_index
on_exit_nicely_callback function
void * arg
static struct @38 on_exit_nicely_list[MAX_ON_EXIT_NICELY]
static int fb(int x)

References arg, fb(), function, i, on_exit_nicely_index, and on_exit_nicely_list.

Referenced by ConnectDatabase(), dumpRoleGUCPrivs(), dumpRoleMembership(), dumpTableData_copy(), dumpTablespaces(), executeCommand(), executeQuery(), expand_dbname_patterns(), get_dbnames_list_to_restore(), getTableAttrs(), main(), main(), read_dump_filters(), read_dumpall_filters(), read_restore_filters(), restore_all_databases(), set_dump_section(), and warn_or_exit_horribly().

◆ 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(), fb(), pg_log_error, pg_log_error_hint, and progname.

Referenced by main().

Variable Documentation

◆ arg

void* arg

Definition at line 29 of file pg_backup_utils.c.

Referenced by exit_nicely(), on_exit_nicely(), and set_dump_section().

◆ function

◆ on_exit_nicely_index

int on_exit_nicely_index
static

Definition at line 32 of file pg_backup_utils.c.

Referenced by exit_nicely(), and on_exit_nicely().

◆ [struct]

struct { ... } on_exit_nicely_list[MAX_ON_EXIT_NICELY]

Referenced by exit_nicely(), and on_exit_nicely().

◆ progname

const char* progname = NULL

Definition at line 22 of file pg_backup_utils.c.

Referenced by set_dump_section().