PostgreSQL Source Code  git master
pg_backup_utils.c File Reference
#include "postgres_fe.h"
#include "parallel.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 char * progname = 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 22 of file pg_backup_utils.c.

Referenced by on_exit_nicely().

Function Documentation

◆ exit_nicely()

void exit_nicely ( int  code)

Definition at line 94 of file pg_backup_utils.c.

References arg, i, on_exit_nicely_index, and on_exit_nicely_list.

Referenced by on_exit_nicely(), and set_dump_section().

95 {
96  int i;
97 
98  for (i = on_exit_nicely_index - 1; i >= 0; i--)
99  on_exit_nicely_list[i].function(code,
101 
102 #ifdef WIN32
103  if (parallel_init_done && GetCurrentThreadId() != mainThreadId)
104  _endthreadex(code);
105 #endif
106 
107  exit(code);
108 }
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 on_exit_nicely ( on_exit_nicely_callback  function,
void *  arg 
)

Definition at line 64 of file pg_backup_utils.c.

References arg, exit_nicely(), MAX_ON_EXIT_NICELY, on_exit_nicely_index, on_exit_nicely_list, and pg_log_fatal.

Referenced by init_parallel_dump_utils(), and on_exit_close_archive().

65 {
67  {
68  pg_log_fatal("out of on_exit_nicely slots");
69  exit_nicely(1);
70  }
71  on_exit_nicely_list[on_exit_nicely_index].function = function;
74 }
#define MAX_ON_EXIT_NICELY
void exit_nicely(int code)
static struct @38 on_exit_nicely_list[MAX_ON_EXIT_NICELY]
static int on_exit_nicely_index
void * arg
#define pg_log_fatal(...)
Definition: logging.h:75

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

Variable Documentation

◆ arg

void* arg

Definition at line 27 of file pg_backup_utils.c.

Referenced by _bt_mkscankey(), _copyA_Indirection(), _copyArrayCoerceExpr(), _copyBooleanTest(), _copyCaseExpr(), _copyCoerceToDomain(), _copyCoerceViaIO(), _copyCollateClause(), _copyCollateExpr(), _copyConvertRowtypeExpr(), _copyDefElem(), _copyFieldSelect(), _copyFieldStore(), _copyNamedArgExpr(), _copyNullTest(), _copyRelabelType(), _copyTypeCast(), _equalA_Indirection(), _equalArrayCoerceExpr(), _equalBooleanTest(), _equalCaseExpr(), _equalCoerceToDomain(), _equalCoerceViaIO(), _equalCollateClause(), _equalCollateExpr(), _equalConvertRowtypeExpr(), _equalDefElem(), _equalFieldSelect(), _equalFieldStore(), _equalNamedArgExpr(), _equalNullTest(), _equalRelabelType(), _equalTypeCast(), _outA_Indirection(), _outArrayCoerceExpr(), _outBooleanTest(), _outCaseExpr(), _outCoerceToDomain(), _outCoerceViaIO(), _outCollateClause(), _outCollateExpr(), _outConvertRowtypeExpr(), _outDefElem(), _outFieldSelect(), _outFieldStore(), _outNamedArgExpr(), _outNullTest(), _outRelabelType(), _outTypeCast(), _readArrayCoerceExpr(), _readBooleanTest(), _readCaseExpr(), _readCoerceToDomain(), _readCoerceViaIO(), _readCollateExpr(), _readConvertRowtypeExpr(), _readDefElem(), _readFieldSelect(), _readFieldStore(), _readNamedArgExpr(), _readNullTest(), _readRelabelType(), accumArrayResultArr(), add_one(), add_one_float8(), advance_windowaggregate(), advance_windowaggregate_base(), ATColumnChangeRequiresRewrite(), binaryheap_allocate(), bit(), bitlength(), bitnot(), bitoctetlength(), bitshiftleft(), bitshiftright(), bittoint4(), bittoint8(), bpcharlen(), bpcharoctetlen(), bsearch_arg(), build_subplan(), CacheRegisterRelcacheCallback(), CacheRegisterSyscacheCallback(), canonicalize_ec_expression(), CatalogCacheCompareTuple(), clause_is_strict_for(), clause_selectivity(), coerce_record_to_complex(), coerce_to_domain(), coerce_to_target_type(), ComputeIndexAttrs(), ComputePartitionAttrs(), contain_nonstrict_functions_walker(), ConvertTriggerToFK(), decrypt_init(), deparseAggref(), deparseFuncExpr(), deparseOpExpr(), dmetaphone(), dmetaphone_alt(), dshash_attach(), dshash_create(), ecpg_init(), eval_const_expressions_mutator(), evaluate_function(), examine_opclause_expression(), examine_variable(), exec_check_rw_parameter(), exec_rt_fetch(), ExecBuildAggTrans(), ExecEvalFuncArgs(), ExecEvalXmlExpr(), ExecIndexBuildScanKeys(), ExecInitExprRec(), ExecInitFunc(), ExecuteDoStmt(), exit_nicely(), expand_function_arguments(), exprCollation(), expression_tree_walker(), exprLocation(), exprSetCollation(), exprType(), exprTypmod(), extract_jsp_bool_expr(), extract_jsp_path_expr_nodes(), FigureColnameInternal(), find_duplicate_ors(), find_ec_member_for_tle(), find_em_expr_for_input_target(), find_enumitem(), find_param_referent(), fix_indexqual_operand(), flatten_set_variable_args(), flattenJsonPathParseItem(), float4up(), float8up(), gen_partprune_steps_internal(), get_agg_expr(), get_cast_hashentry(), get_func_expr(), get_oper_expr(), get_rule_expr(), get_windowfunc_expr(), gincost_opexpr(), gincost_scalararrayopexpr(), ginExtractEntries(), HandleSlashCmds(), i8tod(), i8tof(), i8tooid(), ignore_slash_filepipe(), ignore_slash_options(), ignore_slash_whole_line(), inline_function(), int28(), int2um(), int2up(), int48(), int4inc(), int4um(), int4up(), int82(), int84(), int8dec(), int8inc(), int8um(), int8up(), isSimpleNode(), json_object_agg_transfn(), jsonb_agg_finalfn(), jsonb_object_agg_finalfn(), main(), makeDefElem(), makeDefElemExtended(), makeRelabelType(), match_boolean_index_clause(), match_boolean_partition_clause(), match_clause_to_partition_key(), match_eclass_clauses_to_index(), match_expr_to_partition_keys(), match_index_to_operand(), matches_boolean_partition_clause(), mdc_init(), mdcbuf_init(), numeric_exp(), numeric_inc(), numeric_ln(), numeric_round(), numeric_sqrt(), numeric_trunc(), oidtoi8(), on_exit_nicely(), pairingheap_allocate(), ParseFuncOrColumn(), pg_digest(), pg_hmac(), pg_size_bytes(), pgp_pub_decrypt_bytea(), pgp_pub_decrypt_text(), pgp_pub_encrypt_bytea(), pgp_pub_encrypt_text(), pgp_sym_decrypt_bytea(), pgp_sym_decrypt_text(), pgp_sym_encrypt_bytea(), pgp_sym_encrypt_text(), PLy_cursor_plan(), PLy_function_build_args(), PLy_spi_execute_plan(), postgresGetForeignPaths(), PQsetNoticeProcessor(), PQsetNoticeReceiver(), predicate_refuted_by_simple_clause(), prefix_init(), process_matched_tle(), pull_ands(), pull_from_mbuf(), pull_ors(), push_into_mbuf(), quote_postgres(), RangeVarCallbackForReindexIndex(), raw_expression_tree_walker(), RegisterExprContextCallback(), RegisterResourceReleaseCallback(), RegisterSubXactCallback(), RegisterXactCallback(), relabel_to_typmod(), reorder_function_arguments(), runShellCommand(), sepgsql_object_access(), show_tablesample(), simplify_and_arguments(), simplify_or_arguments(), socket_has_input(), soundex(), spg_quad_choose(), statext_is_compatible_clause_internal(), strip_array_coercion(), tablesample_init(), text_format(), tlist_member_ignore_relabel(), transformAggregateCall(), transformCaseExpr(), transformRangeFunction(), transformRangeTableSample(), txid_snapshot_xip(), varbit(), write_syslogger_file(), xmlcomment(), and xmlelement().

◆ function

Definition at line 26 of file pg_backup_utils.c.

◆ on_exit_nicely_index

int on_exit_nicely_index
static

Definition at line 30 of file pg_backup_utils.c.

Referenced by exit_nicely(), and on_exit_nicely().

◆ on_exit_nicely_list

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

Referenced by set_dump_section().