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.

Function Documentation

◆ exit_nicely()

void exit_nicely ( int  code)

Definition at line 90 of file pg_backup_utils.c.

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

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

64 {
66  pg_fatal("out of on_exit_nicely slots");
67  on_exit_nicely_list[on_exit_nicely_index].function = function;
70 }
#define MAX_ON_EXIT_NICELY
#define pg_fatal(...)

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

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  pg_log_error_hint("Try \"%s --help\" for more information.", progname);
56  exit_nicely(1);
57  }
58 }
#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

◆ arg

void* arg

Definition at line 27 of file pg_backup_utils.c.

Referenced by _bt_compare_array_elements(), _bt_end_vacuum_callback(), _bt_mkscankey(), _copyA_Indirection(), _copyArrayCoerceExpr(), _copyBooleanTest(), _copyCaseExpr(), _copyCoerceToDomain(), _copyCoerceViaIO(), _copyCollateClause(), _copyCollateExpr(), _copyConvertRowtypeExpr(), _copyDefElem(), _copyFieldSelect(), _copyFieldStore(), _copyJsonArrayAgg(), _copyJsonObjectAgg(), _copyNamedArgExpr(), _copyNullTest(), _copyRelabelType(), _copyTypeCast(), _equalA_Indirection(), _equalArrayCoerceExpr(), _equalBooleanTest(), _equalCaseExpr(), _equalCoerceToDomain(), _equalCoerceViaIO(), _equalCollateClause(), _equalCollateExpr(), _equalConvertRowtypeExpr(), _equalDefElem(), _equalFieldSelect(), _equalFieldStore(), _equalJsonArrayAgg(), _equalJsonObjectAgg(), _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(), _SPI_error_callback(), accesstype_arg_to_string(), accumArrayResultArr(), add_one(), add_one_float8(), adjacent_cmp_bounds(), adjacent_inner_consistent(), advance_windowaggregate(), advance_windowaggregate_base(), AggRegisterCallback(), AppendNoticeMessage(), applyRelabelType(), archive_close_connection(), ATColumnChangeRequiresRewrite(), AuxiliaryProcKill(), bcTruelen(), before_shmem_exit(), binaryheap_allocate(), bind_param_error_callback(), bit(), bit_bit_count(), bitlength(), bitnot(), bitoctetlength(), bitshiftleft(), bitshiftright(), bitsubstring(), bittoint4(), bittoint8(), booltestsel(), boolvarsel(), bound_cmp(), bpcharlen(), bpcharoctetlen(), bsearch_arg(), build_subplan(), CacheRegisterRelcacheCallback(), CacheRegisterSyscacheCallback(), cancel_before_shmem_exit(), cancel_on_dsm_detach(), chr(), clause_is_strict_for(), clause_selectivity_ext(), cleanup_background_workers(), CleanupInvalidationState(), CleanupProcSignalState(), cmpEntries(), cmpEntryAccumulator(), coerce_record_to_complex(), coerce_to_domain(), coerce_to_target_type(), compare_expanded_ranges(), compare_scalars(), compare_scalars_simple(), compare_values(), compareentry(), compareQueryOperand(), ComputeIndexAttrs(), ComputePartitionAttrs(), contain_nonstrict_functions_walker(), conversion_error_callback(), convert_and_check_filename(), CopyFromErrorCallback(), createdb_failure_callback(), dccref_deletion_callback(), decrypt_init(), defaultNoticeProcessor(), defaultNoticeReceiver(), deparseAggref(), deparseFuncExpr(), dmetaphone(), dmetaphone_alt(), do_pg_abort_backup(), dshash_attach(), dshash_create(), dsm_detach(), dsm_postmaster_shutdown(), ec_member_matches_foreign(), ec_member_matches_indexcol(), ECPGnoticeReceiver(), element_compare(), entryIndexByFrequencyCmp(), enum_known_sorted(), ER_mc_callback(), eval_const_expressions_mutator(), evaluate_function(), examine_opclause_args(), examine_variable(), exec_check_rw_parameter(), ExecBuildAggTrans(), ExecEvalFuncArgs(), ExecEvalXmlExpr(), ExecIndexBuildScanKeys(), ExecInitExprRec(), ExecInitFunc(), ExecuteDoStmt(), exit_nicely(), exp_var(), expand_function_arguments(), exprCollation(), expression_tree_walker(), exprIsNullConstant(), exprLocation(), exprSetCollation(), exprType(), exprTypmod(), extract_jsp_bool_expr(), extract_jsp_path_expr_nodes(), FigureColnameInternal(), find_duplicate_ors(), find_ec_member_matching_expr(), find_em_for_rel_target(), find_enumitem(), find_param_referent(), find_window_run_conditions(), fix_indexqual_operand(), flatten_set_variable_args(), flattenJsonPathParseItem(), float4up(), float8up(), gbt_vsrt_cmp(), gen_partprune_steps_internal(), get_agg_expr_helper(), get_call_expr_arg_stable(), get_cast_hashentry(), get_coercion_expr(), get_func_expr(), get_oper_expr(), get_rule_expr(), get_stats_option_name(), get_width_cost_multiplier(), get_windowfunc_expr_helper(), ginAllocEntryAccumulator(), ginCombineData(), gincost_opexpr(), gincost_scalararrayopexpr(), ginExtractEntries(), guc_restore_error_context_callback(), HandleSlashCmds(), heap_compare_slots(), i8tod(), i8tof(), i8tooid(), ignore_slash_filepipe(), ignore_slash_options(), ignore_slash_whole_line(), import_error_callback(), indexOfColumn(), inline_function(), int28(), int2um(), int2up(), int48(), int4inc(), int4um(), int4up(), int82(), int84(), int8dec(), int8inc(), int8um(), int8up(), interval_cmp_lower(), interval_cmp_upper(), InvalidateTSCacheCallBack(), is_fake_var(), isort_cmp(), isotesterNoticeProcessor(), isSimpleNode(), json_object_agg_transfn_worker(), jsonb_agg_finalfn(), jsonb_object_agg_finalfn(), jspIsMutableWalker(), left_oper(), ln_var(), local_buffer_write_error_callback(), main(), make_nulltest_from_distinct(), 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(), movedb_failure_callback(), multi_sort_compare(), NoticeProcessor(), nulltestsel(), numeric_exp(), numeric_inc(), numeric_is_integral(), numeric_ln(), numeric_min_scale(), numeric_round(), numeric_sqrt(), numeric_trunc(), oidtoi8(), on_dsm_detach(), on_exit_nicely(), on_proc_exit(), on_shmem_exit(), ordered_set_shutdown(), output_plugin_error_callback(), pairingheap_allocate(), pairingheap_GISTSearchItem_cmp(), pairingheap_SpGistSearchItem_cmp(), parallel_vacuum_error_callback(), ParallelWorkerShutdown(), paramlist_parser_setup(), ParamsErrorCallback(), ParseFuncOrColumn(), pcb_error_callback(), pg_digest(), pg_hmac(), pg_size_bytes(), pg_snapshot_xip(), 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(), pgstat_cmp_hash_key(), pgstat_hash_hash_key(), plperl_compile_callback(), plperl_exec_callback(), plperl_ref_from_pg_array(), plpgsql_compile_error_callback(), plpgsql_exec_error_callback(), plpython_error_callback(), plpython_srf_cleanup_callback(), PLy_cursor_dealloc(), PLy_cursor_plan(), PLy_function_build_args(), PLy_input_convert(), PLy_input_from_tuple(), PLy_input_setup_func(), PLy_input_setup_tuple(), PLy_output_convert(), PLy_output_setup_func(), PLy_output_setup_record(), PLy_output_setup_tuple(), PLy_plan_dealloc(), PLy_result_ass_subscript(), PLy_result_dealloc(), PLy_result_item(), PLy_result_length(), PLy_result_str(), PLy_result_subscript(), PLy_spi_execute_plan(), PLyDict_FromComposite(), PLyDict_FromTuple(), PLyGenericObject_ToComposite(), PLyList_FromArray(), PLyMapping_ToComposite(), PLyObject_FromTransform(), PLyObject_ToComposite(), PLyObject_ToDomain(), PLyObject_ToScalar(), PLyObject_ToTransform(), PLySequence_ToArray(), PLySequence_ToComposite(), PLyUnicode_FromScalar(), PLyUnicode_ToComposite(), postgresGetForeignPaths(), PQsetnonblocking(), PQsetNoticeProcessor(), PQsetNoticeReceiver(), predicate_refuted_by_simple_clause(), proc_exit_prepare(), process_matched_tle(), pts_error_callback(), publication_invalidation_cb(), pull_ands(), pull_ors(), qsort_partition_list_value_cmp(), qsort_partition_rbound_cmp(), qunique_arg(), quote_postgres(), range_bound_qsort_cmp(), range_compare(), RangeVarCallbackForAlterRelation(), RangeVarCallbackForAttachIndex(), RangeVarCallbackForDropRelation(), RangeVarCallbackForLockTable(), RangeVarCallbackForReindexIndex(), raw_expression_tree_walker(), rbt_create(), regex_affix_deletion_callback(), RegisterExprContextCallback(), RegisterResourceReleaseCallback(), RegisterSubXactCallback(), RegisterXactCallback(), REGRESS_object_access_hook(), REGRESS_object_access_hook_str(), reindex_error_callback(), reorder_function_arguments(), ReorderBufferIterCompare(), reorderqueue_cmp(), rm_redo_error_callback(), runShellCommand(), sepgsql_object_access(), set_dump_section(), set_plan_disabling_options(), shared_buffer_write_error_callback(), shared_record_table_compare(), shared_record_table_hash(), shm_mq_detach_callback(), shmem_exit(), show_tablesample(), shutdown_MultiFuncCall(), ShutdownSetExpr(), ShutdownSQLFunction(), simplify_and_arguments(), simplify_or_arguments(), single_bound_cmp(), sort_item_compare(), soundex(), sql_exec_error_callback(), sql_function_parse_error_callback(), sql_inline_error_callback(), sqrt_var(), start_proc_error_callback(), statext_is_compatible_clause_internal(), strip_array_coercion(), tablesample_init(), tablespace_list_append(), tbm_shared_comparator(), text_format(), threadRun(), transformAggregateCall(), transformBoolExpr(), transformCaseExpr(), transformFuncCall(), transformJsonArrayAgg(), transformJsonParseExpr(), transformJsonPassingArgs(), transformJsonScalarExpr(), transformJsonSerializeExpr(), transformRangeFunction(), transformRangeTableSample(), transformTypeCast(), TS_execute(), TS_execute_recurse(), TS_execute_ternary(), TS_phrase_execute(), tsearch_readline_callback(), UnregisterExprContextCallback(), UnregisterResourceReleaseCallback(), UnregisterSubXactCallback(), UnregisterXactCallback(), vacuum_error_callback(), varbit(), WalRcvDie(), XactLockTableWaitErrorCb(), xml_is_document(), xmlcomment(), xmlelement(), and xmlpi().

◆ function

◆ 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().

◆ 

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().