PostgreSQL Source Code  git master
pg_backup_utils.h File Reference
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

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 write_msg (const char *modulename, const char *fmt,...) pg_attribute_printf(2
 
void void vwrite_msg (const char *modulename, const char *fmt, va_list ap) pg_attribute_printf(2
 
void void void on_exit_nicely (on_exit_nicely_callback function, void *arg)
 
void exit_nicely (int code) pg_attribute_noreturn()
 
void exit_horribly (const char *modulename, const char *fmt,...) pg_attribute_printf(2
 
void pg_attribute_noreturn ()
 

Variables

const char * progname
 

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.

Enumeration Type Documentation

◆ DumpSections

Enumerator
DUMP_PRE_DATA 
DUMP_DATA 
DUMP_POST_DATA 
DUMP_UNSECTIONED 

Definition at line 18 of file pg_backup_utils.h.

Function Documentation

◆ exit_horribly()

void exit_horribly ( const char *  modulename,
const char *  fmt,
  ... 
)

◆ exit_nicely()

void exit_nicely ( int  code)

Definition at line 142 of file pg_backup_utils.c.

References arg, i, on_exit_nicely_index, and on_exit_nicely_list.

Referenced by exit_horribly(), and set_dump_section().

143 {
144  int i;
145 
146  for (i = on_exit_nicely_index - 1; i >= 0; i--)
147  on_exit_nicely_list[i].function(code,
149 
150 #ifdef WIN32
151  if (parallel_init_done && GetCurrentThreadId() != mainThreadId)
152  _endthreadex(code);
153 #endif
154 
155  exit(code);
156 }
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 void void on_exit_nicely ( on_exit_nicely_callback  function,
void *  arg 
)

Definition at line 115 of file pg_backup_utils.c.

References arg, exit_horribly(), MAX_ON_EXIT_NICELY, on_exit_nicely_index, and on_exit_nicely_list.

Referenced by init_parallel_dump_utils(), and on_exit_close_archive().

116 {
118  exit_horribly(NULL, "out of on_exit_nicely slots\n");
119  on_exit_nicely_list[on_exit_nicely_index].function = function;
122 }
#define MAX_ON_EXIT_NICELY
static struct @38 on_exit_nicely_list[MAX_ON_EXIT_NICELY]
void exit_horribly(const char *modulename, const char *fmt,...)
static int on_exit_nicely_index
void * arg

◆ pg_attribute_noreturn()

void pg_attribute_noreturn ( )

◆ 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(), 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  fprintf(stderr, _("%s: unrecognized section name: \"%s\"\n"),
55  progname, arg);
56  fprintf(stderr, _("Try \"%s --help\" for more information.\n"),
57  progname);
58  exit_nicely(1);
59  }
60 }
void exit_nicely(int code)
const char * progname
void * arg
#define _(x)
Definition: elog.c:84

◆ vwrite_msg()

void void vwrite_msg ( const char *  modulename,
const char *  fmt,
va_list  ap 
)

◆ write_msg()

void write_msg ( const char *  modulename,
const char *  fmt,
  ... 
)

Variable Documentation

◆ progname

const char* progname

Definition at line 37 of file pg_standby.c.