PostgreSQL Source Code  git master
pg_backup_utils.h
Go to the documentation of this file.
1 /*-------------------------------------------------------------------------
2  *
3  * pg_backup_utils.h
4  * Utility routines shared by pg_dump and pg_restore.
5  *
6  *
7  * Portions Copyright (c) 1996-2024, PostgreSQL Global Development Group
8  * Portions Copyright (c) 1994, Regents of the University of California
9  *
10  * src/bin/pg_dump/pg_backup_utils.h
11  *
12  *-------------------------------------------------------------------------
13  */
14 
15 #ifndef PG_BACKUP_UTILS_H
16 #define PG_BACKUP_UTILS_H
17 
18 #include "common/logging.h"
19 
20 /* bits returned by set_dump_section */
21 #define DUMP_PRE_DATA 0x01
22 #define DUMP_DATA 0x02
23 #define DUMP_POST_DATA 0x04
24 #define DUMP_UNSECTIONED 0xff
25 
26 typedef void (*on_exit_nicely_callback) (int code, void *arg);
27 
28 extern const char *progname;
29 
30 extern void set_dump_section(const char *arg, int *dumpSections);
31 extern void on_exit_nicely(on_exit_nicely_callback function, void *arg);
32 extern void exit_nicely(int code) pg_attribute_noreturn();
33 
34 /* In pg_dump, we modify pg_fatal to call exit_nicely instead of exit */
35 #undef pg_fatal
36 #define pg_fatal(...) do { \
37  pg_log_generic(PG_LOG_ERROR, PG_LOG_PRIMARY, __VA_ARGS__); \
38  exit_nicely(1); \
39  } while(0)
40 
41 #endif /* PG_BACKUP_UTILS_H */
#define pg_attribute_noreturn()
Definition: c.h:204
void * arg
void(* on_exit_nicely_callback)(int code, void *arg)
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()
const char * progname
Definition: main.c:44