PostgreSQL Source Code  git master
help_config.c File Reference
#include "postgres.h"
#include <limits.h>
#include <unistd.h>
#include "utils/guc_tables.h"
#include "utils/help_config.h"
Include dependency graph for help_config.c:

Go to the source code of this file.

Data Structures

union  mixedStruct
 

Functions

static void printMixedStruct (mixedStruct *structToPrint)
 
static bool displayStruct (mixedStruct *structToDisplay)
 
void GucInfoMain (void)
 

Function Documentation

◆ displayStruct()

static bool displayStruct ( mixedStruct structToDisplay)
static

Definition at line 75 of file help_config.c.

References config_generic::flags, mixedStruct::generic, GUC_DISALLOW_IN_FILE, GUC_NO_SHOW_ALL, and GUC_NOT_IN_SAMPLE.

Referenced by GucInfoMain().

76 {
77  return !(structToDisplay->generic.flags & (GUC_NO_SHOW_ALL |
80 }
struct config_generic generic
Definition: help_config.c:32
#define GUC_NO_SHOW_ALL
Definition: guc.h:206
#define GUC_NOT_IN_SAMPLE
Definition: guc.h:209
#define GUC_DISALLOW_IN_FILE
Definition: guc.h:210

◆ GucInfoMain()

void GucInfoMain ( void  )

Definition at line 46 of file help_config.c.

References build_guc_variables(), displayStruct(), get_guc_variables(), GetNumConfigOptions(), i, and printMixedStruct().

Referenced by main().

47 {
48  struct config_generic **guc_vars;
49  int numOpts,
50  i;
51 
52  /* Initialize the guc_variables[] array */
54 
55  guc_vars = get_guc_variables();
56  numOpts = GetNumConfigOptions();
57 
58  for (i = 0; i < numOpts; i++)
59  {
60  mixedStruct *var = (mixedStruct *) guc_vars[i];
61 
62  if (displayStruct(var))
63  printMixedStruct(var);
64  }
65 
66  exit(0);
67 }
void build_guc_variables(void)
Definition: guc.c:4832
static bool displayStruct(mixedStruct *structToDisplay)
Definition: help_config.c:75
struct config_generic ** get_guc_variables(void)
Definition: guc.c:4820
static void printMixedStruct(mixedStruct *structToPrint)
Definition: help_config.c:88
int i
int GetNumConfigOptions(void)
Definition: guc.c:9242

◆ printMixedStruct()

static void printMixedStruct ( mixedStruct structToPrint)
static

Definition at line 88 of file help_config.c.

References _, mixedStruct::_bool, mixedStruct::_enum, config_string::boot_val, config_enum::boot_val, config_enum_lookup_by_value(), config_group_names, config_generic::context, mixedStruct::generic, config_generic::group, GucContext_Names, mixedStruct::integer, config_generic::long_desc, config_int::max, config_real::max, config_int::min, config_real::min, config_generic::name, PGC_BOOL, PGC_ENUM, PGC_INT, PGC_REAL, PGC_STRING, printf, mixedStruct::real, config_bool::reset_val, config_int::reset_val, config_real::reset_val, config_generic::short_desc, mixedStruct::string, config_generic::vartype, and write_stderr.

Referenced by GucInfoMain().

89 {
90  printf("%s\t%s\t%s\t",
91  structToPrint->generic.name,
92  GucContext_Names[structToPrint->generic.context],
93  _(config_group_names[structToPrint->generic.group]));
94 
95  switch (structToPrint->generic.vartype)
96  {
97 
98  case PGC_BOOL:
99  printf("BOOLEAN\t%s\t\t\t",
100  (structToPrint->_bool.reset_val == 0) ?
101  "FALSE" : "TRUE");
102  break;
103 
104  case PGC_INT:
105  printf("INTEGER\t%d\t%d\t%d\t",
106  structToPrint->integer.reset_val,
107  structToPrint->integer.min,
108  structToPrint->integer.max);
109  break;
110 
111  case PGC_REAL:
112  printf("REAL\t%g\t%g\t%g\t",
113  structToPrint->real.reset_val,
114  structToPrint->real.min,
115  structToPrint->real.max);
116  break;
117 
118  case PGC_STRING:
119  printf("STRING\t%s\t\t\t",
120  structToPrint->string.boot_val ? structToPrint->string.boot_val : "");
121  break;
122 
123  case PGC_ENUM:
124  printf("ENUM\t%s\t\t\t",
125  config_enum_lookup_by_value(&structToPrint->_enum,
126  structToPrint->_enum.boot_val));
127  break;
128 
129  default:
130  write_stderr("internal error: unrecognized run-time parameter type\n");
131  break;
132  }
133 
134  printf("%s\t%s\n",
135  (structToPrint->generic.short_desc == NULL) ? "" : _(structToPrint->generic.short_desc),
136  (structToPrint->generic.long_desc == NULL) ? "" : _(structToPrint->generic.long_desc));
137 }
const char * long_desc
Definition: guc_tables.h:153
double reset_val
Definition: guc_tables.h:222
struct config_int integer
Definition: help_config.c:35
struct config_bool _bool
Definition: help_config.c:33
const char * name
Definition: guc_tables.h:149
const char * short_desc
Definition: guc_tables.h:152
const char * boot_val
Definition: guc_tables.h:231
#define write_stderr(str)
Definition: parallel.c:182
const char * config_enum_lookup_by_value(struct config_enum *record, int val)
Definition: guc.c:6418
struct config_real real
Definition: help_config.c:34
#define printf(...)
Definition: port.h:198
struct config_enum _enum
Definition: help_config.c:37
struct config_generic generic
Definition: help_config.c:32
const char *const GucContext_Names[]
Definition: guc.c:594
const char *const config_group_names[]
Definition: guc.c:631
enum config_type vartype
Definition: guc_tables.h:156
struct config_string string
Definition: help_config.c:36
double max
Definition: guc_tables.h:217
double min
Definition: guc_tables.h:216
enum config_group group
Definition: guc_tables.h:151
bool reset_val
Definition: guc_tables.h:190
#define _(x)
Definition: elog.c:84
GucContext context
Definition: guc_tables.h:150
int reset_val
Definition: guc_tables.h:206