PostgreSQL Source Code git master
guc-file.l File Reference
#include "postgres.h"
#include <ctype.h>
#include <unistd.h>
#include "common/file_utils.h"
#include "guc_internal.h"
#include "mb/pg_wchar.h"
#include "miscadmin.h"
#include "storage/fd.h"
#include "utils/conffiles.h"
#include "utils/memutils.h"
Include dependency graph for guc-file.l:

Go to the source code of this file.

Macros

#define fprintf(file, fmt, msg)   GUC_flex_fatal(msg)
 

Enumerations

enum  {
  GUC_ID = 1 , GUC_STRING = 2 , GUC_INTEGER = 3 , GUC_REAL = 4 ,
  GUC_EQUALS = 5 , GUC_UNQUOTED_STRING = 6 , GUC_QUALIFIED_ID = 7 , GUC_EOL = 99 ,
  GUC_ERROR = 100
}
 

Functions

static void FreeConfigVariable (ConfigVariable *item)
 
static int GUC_flex_fatal (const char *msg)
 
int yylex (yyscan_t yyscanner)
 
void ProcessConfigFile (GucContext context)
 
bool ParseConfigFile (const char *config_file, bool strict, const char *calling_file, int calling_lineno, int depth, int elevel, ConfigVariable **head_p, ConfigVariable **tail_p)
 
void record_config_file_error (const char *errmsg, const char *config_file, int lineno, ConfigVariable **head_p, ConfigVariable **tail_p)
 
bool ParseConfigFp (FILE *fp, const char *config_file, int depth, int elevel, ConfigVariable **head_p, ConfigVariable **tail_p)
 
bool ParseConfigDirectory (const char *includedir, const char *calling_file, int calling_lineno, int depth, int elevel, ConfigVariable **head_p, ConfigVariable **tail_p)
 
void FreeConfigVariables (ConfigVariable *list)
 
char * DeescapeQuotedString (const char *s)
 

Variables

static unsigned int ConfigFileLineno
 
static const char * GUC_flex_fatal_errmsg
 
static sigjmp_buf * GUC_flex_fatal_jmp
 

Macro Definition Documentation

◆ fprintf

#define fprintf (   file,
  fmt,
  msg 
)    GUC_flex_fatal(msg)

Definition at line 33 of file guc-file.l.

Enumeration Type Documentation

◆ anonymous enum

anonymous enum
Enumerator
GUC_ID 
GUC_STRING 
GUC_INTEGER 
GUC_REAL 
GUC_EQUALS 
GUC_UNQUOTED_STRING 
GUC_QUALIFIED_ID 
GUC_EOL 
GUC_ERROR 

Definition at line 35 of file guc-file.l.

36{
37 GUC_ID = 1,
38 GUC_STRING = 2,
39 GUC_INTEGER = 3,
40 GUC_REAL = 4,
41 GUC_EQUALS = 5,
44 GUC_EOL = 99,
45 GUC_ERROR = 100
@ GUC_STRING
Definition: guc-file.l:38
@ GUC_UNQUOTED_STRING
Definition: guc-file.l:42
@ GUC_ERROR
Definition: guc-file.l:45
@ GUC_INTEGER
Definition: guc-file.l:39
@ GUC_QUALIFIED_ID
Definition: guc-file.l:43
@ GUC_REAL
Definition: guc-file.l:40
@ GUC_ID
Definition: guc-file.l:37
@ GUC_EOL
Definition: guc-file.l:44
@ GUC_EQUALS
Definition: guc-file.l:41
46};

Function Documentation

◆ DeescapeQuotedString()

char * DeescapeQuotedString ( const char *  s)

Definition at line 661 of file guc-file.l.

662{
663 char *newStr;
664 int len,
665 i,
666 j;
int j
Definition: isn.c:73
int i
Definition: isn.c:72
const void size_t len
667
668 /* We just Assert that there are leading and trailing quotes */
669 Assert(s != NULL && s[0] == '\'');
670 len = strlen(s);
671 Assert(len >= 2);
672 Assert(s[len - 1] == '\'');
#define Assert(condition)
Definition: c.h:815
673
674 /* Skip the leading quote; we'll handle the trailing quote below */
675 s++, len--;
676
677 /* Since len still includes trailing quote, this is enough space */
678 newStr = palloc(len);
void * palloc(Size size)
Definition: mcxt.c:1317
679
680 for (i = 0, j = 0; i < len; i++)
681 {
682 if (s[i] == '\\')
683 {
684 i++;
685 switch (s[i])
686 {
687 case 'b':
688 newStr[j] = '\b';
689 break;
690 case 'f':
691 newStr[j] = '\f';
692 break;
693 case 'n':
694 newStr[j] = '\n';
695 break;
696 case 'r':
697 newStr[j] = '\r';
698 break;
699 case 't':
700 newStr[j] = '\t';
701 break;
702 case '0':
703 case '1':
704 case '2':
705 case '3':
706 case '4':
707 case '5':
708 case '6':
709 case '7':
710 {
711 int k;
712 long octVal = 0;
713
714 for (k = 0;
715 s[i + k] >= '0' && s[i + k] <= '7' && k < 3;
716 k++)
717 octVal = (octVal << 3) + (s[i + k] - '0');
718 i += k - 1;
719 newStr[j] = ((char) octVal);
720 }
721 break;
722 default:
723 newStr[j] = s[i];
724 break;
725 } /* switch */
726 }
727 else if (s[i] == '\'' && s[i + 1] == '\'')
728 {
729 /* doubled quote becomes just one quote */
730 newStr[j] = s[++i];
731 }
732 else
733 newStr[j] = s[i];
734 j++;
735 }
736
737 /* We copied the ending quote to newStr, so replace with \0 */
738 Assert(j > 0 && j <= len);
739 newStr[--j] = '\0';
740
741 return newStr;
742}

References Assert, i, j, len, and palloc().

Referenced by ParseConfigFp().

◆ FreeConfigVariable()

static void FreeConfigVariable ( ConfigVariable item)
static

Definition at line 635 of file guc-file.l.

636{
637 if (item->name)
638 pfree(item->name);
639 if (item->value)
640 pfree(item->value);
641 if (item->errmsg)
642 pfree(item->errmsg);
643 if (item->filename)
644 pfree(item->filename);
645 pfree(item);
void pfree(void *pointer)
Definition: mcxt.c:1521
char * name
Definition: guc.h:141
char * filename
Definition: guc.h:144
char * value
Definition: guc.h:142
char * errmsg
Definition: guc.h:143
646}

References ConfigVariable::errmsg, ConfigVariable::filename, ConfigVariable::name, pfree(), and ConfigVariable::value.

Referenced by FreeConfigVariables().

◆ FreeConfigVariables()

void FreeConfigVariables ( ConfigVariable list)

Definition at line 617 of file guc-file.l.

618{
619 ConfigVariable *item;
620
621 item = list;
622 while (item)
623 {
624 ConfigVariable *next = item->next;
static int32 next
Definition: blutils.c:221
struct ConfigVariable * next
Definition: guc.h:148
625
626 FreeConfigVariable(item);
627 item = next;
628 }
static void FreeConfigVariable(ConfigVariable *item)
Definition: guc-file.l:635
629}

References FreeConfigVariable(), sort-test::list, next, and ConfigVariable::next.

Referenced by AlterSystemSetConfigFile(), and parse_extension_control_file().

◆ GUC_flex_fatal()

static int GUC_flex_fatal ( const char *  msg)
static

Definition at line 311 of file guc-file.l.

312{
314 siglongjmp(*GUC_flex_fatal_jmp, 1);
315 return 0; /* keep compiler quiet */
static sigjmp_buf * GUC_flex_fatal_jmp
Definition: guc-file.l:50
static const char * GUC_flex_fatal_errmsg
Definition: guc-file.l:49
316}

References GUC_flex_fatal_errmsg, and GUC_flex_fatal_jmp.

◆ ParseConfigDirectory()

bool ParseConfigDirectory ( const char *  includedir,
const char *  calling_file,
int  calling_lineno,
int  depth,
int  elevel,
ConfigVariable **  head_p,
ConfigVariable **  tail_p 
)

Definition at line 581 of file guc-file.l.

586{
587 char *err_msg;
588 char **filenames;
589 int num_filenames;
590
591 filenames = GetConfFilesInDir(includedir, calling_file, elevel,
592 &num_filenames, &err_msg);
char ** GetConfFilesInDir(const char *includedir, const char *calling_file, int elevel, int *num_filenames, char **err_msg)
Definition: conffiles.c:70
593
594 if (!filenames)
595 {
596 record_config_file_error(err_msg, calling_file, calling_lineno, head_p,
597 tail_p);
598 return false;
599 }
void record_config_file_error(const char *errmsg, const char *config_file, int lineno, ConfigVariable **head_p, ConfigVariable **tail_p)
Definition: guc-file.l:278
600
601 for (int i = 0; i < num_filenames; i++)
602 {
603 if (!ParseConfigFile(filenames[i], true,
604 calling_file, calling_lineno,
605 depth, elevel,
606 head_p, tail_p))
607 return false;
608 }
bool ParseConfigFile(const char *config_file, bool strict, const char *calling_file, int calling_lineno, int depth, int elevel, ConfigVariable **head_p, ConfigVariable **tail_p)
Definition: guc-file.l:175
609
610 return true;
611}

References GetConfFilesInDir(), i, ParseConfigFile(), and record_config_file_error().

Referenced by ParseConfigFp().

◆ ParseConfigFile()

bool ParseConfigFile ( const char *  config_file,
bool  strict,
const char *  calling_file,
int  calling_lineno,
int  depth,
int  elevel,
ConfigVariable **  head_p,
ConfigVariable **  tail_p 
)

Definition at line 175 of file guc-file.l.

180{
181 char *abs_path;
182 bool OK = true;
183 FILE *fp;
184
185 /*
186 * Reject file name that is all-blank (including empty), as that leads to
187 * confusion --- we'd try to read the containing directory as a file.
188 */
189 if (strspn(config_file, " \t\r\n") == strlen(config_file))
190 {
191 ereport(elevel,
192 (errcode(ERRCODE_INVALID_PARAMETER_VALUE),
193 errmsg("empty configuration file name: \"%s\"",
194 config_file)));
195 record_config_file_error("empty configuration file name",
196 calling_file, calling_lineno,
197 head_p, tail_p);
198 return false;
199 }
int errcode(int sqlerrcode)
Definition: elog.c:853
int errmsg(const char *fmt,...)
Definition: elog.c:1070
#define ereport(elevel,...)
Definition: elog.h:149
static char * config_file
Definition: pg_rewind.c:71
200
201 /*
202 * Reject too-deep include nesting depth. This is just a safety check to
203 * avoid dumping core due to stack overflow if an include file loops back
204 * to itself. The maximum nesting depth is pretty arbitrary.
205 */
206 if (depth > CONF_FILE_MAX_DEPTH)
207 {
208 ereport(elevel,
209 (errcode(ERRCODE_PROGRAM_LIMIT_EXCEEDED),
210 errmsg("could not open configuration file \"%s\": maximum nesting depth exceeded",
211 config_file)));
212 record_config_file_error("nesting depth exceeded",
213 calling_file, calling_lineno,
214 head_p, tail_p);
215 return false;
216 }
#define CONF_FILE_MAX_DEPTH
Definition: conffiles.h:18
217
218 abs_path = AbsoluteConfigLocation(config_file, calling_file);
char * AbsoluteConfigLocation(const char *location, const char *calling_file)
Definition: conffiles.c:36
219
220 /*
221 * Reject direct recursion. Indirect recursion is also possible, but it's
222 * harder to detect and so doesn't seem worth the trouble. (We test at
223 * this step because the canonicalization done by AbsoluteConfigLocation
224 * makes it more likely that a simple strcmp comparison will match.)
225 */
226 if (calling_file && strcmp(abs_path, calling_file) == 0)
227 {
228 ereport(elevel,
229 (errcode(ERRCODE_INVALID_PARAMETER_VALUE),
230 errmsg("configuration file recursion in \"%s\"",
231 calling_file)));
232 record_config_file_error("configuration file recursion",
233 calling_file, calling_lineno,
234 head_p, tail_p);
235 pfree(abs_path);
236 return false;
237 }
238
239 fp = AllocateFile(abs_path, "r");
240 if (!fp)
241 {
242 if (strict)
243 {
244 ereport(elevel,
246 errmsg("could not open configuration file \"%s\": %m",
247 abs_path)));
248 record_config_file_error(psprintf("could not open file \"%s\"",
249 abs_path),
250 calling_file, calling_lineno,
251 head_p, tail_p);
252 OK = false;
253 }
254 else
255 {
256 ereport(LOG,
257 (errmsg("skipping missing configuration file \"%s\"",
258 abs_path)));
259 }
260 goto cleanup;
261 }
static void cleanup(void)
Definition: bootstrap.c:713
int errcode_for_file_access(void)
Definition: elog.c:876
#define LOG
Definition: elog.h:31
FILE * AllocateFile(const char *name, const char *mode)
Definition: fd.c:2605
char * psprintf(const char *fmt,...)
Definition: psprintf.c:43
262
263 OK = ParseConfigFp(fp, abs_path, depth, elevel, head_p, tail_p);
bool ParseConfigFp(FILE *fp, const char *config_file, int depth, int elevel, ConfigVariable **head_p, ConfigVariable **tail_p)
Definition: guc-file.l:350
264
265cleanup:
266 if (fp)
267 FreeFile(fp);
268 pfree(abs_path);
int FreeFile(FILE *file)
Definition: fd.c:2803
269
270 return OK;
271}

References AbsoluteConfigLocation(), AllocateFile(), cleanup(), CONF_FILE_MAX_DEPTH, config_file, ereport, errcode(), errcode_for_file_access(), errmsg(), FreeFile(), LOG, ParseConfigFp(), pfree(), psprintf(), and record_config_file_error().

Referenced by ParseConfigDirectory(), ParseConfigFp(), and ProcessConfigFileInternal().

◆ ParseConfigFp()

bool ParseConfigFp ( FILE *  fp,
const char *  config_file,
int  depth,
int  elevel,
ConfigVariable **  head_p,
ConfigVariable **  tail_p 
)

Definition at line 350 of file guc-file.l.

352{
353 volatile bool OK = true;
354 unsigned int save_ConfigFileLineno = ConfigFileLineno;
355 sigjmp_buf *save_GUC_flex_fatal_jmp = GUC_flex_fatal_jmp;
356 sigjmp_buf flex_fatal_jmp;
357 yyscan_t scanner;
358 struct yyguts_t *yyg; /* needed for yytext macro */
359 volatile YY_BUFFER_STATE lex_buffer = NULL;
360 int errorcount;
361 int token;
void * yyscan_t
Definition: cubedata.h:67
static unsigned int ConfigFileLineno
Definition: guc-file.l:48
#define token
Definition: indent_globs.h:126
struct yy_buffer_state * YY_BUFFER_STATE
Definition: psqlscan_int.h:56
362
363 if (sigsetjmp(flex_fatal_jmp, 1) == 0)
364 GUC_flex_fatal_jmp = &flex_fatal_jmp;
365 else
366 {
367 /*
368 * Regain control after a fatal, internal flex error. It may have
369 * corrupted parser state. Consequently, abandon the file, but trust
370 * that the state remains sane enough for yy_delete_buffer().
371 */
372 elog(elevel, "%s at file \"%s\" line %u",
376 head_p, tail_p);
377 OK = false;
378 goto cleanup;
379 }
#define elog(elevel,...)
Definition: elog.h:225
380
381 /*
382 * Parse
383 */
385 errorcount = 0;
386
387 if (yylex_init(&scanner) != 0)
388 elog(elevel, "yylex_init() failed: %m");
389 yyg = (struct yyguts_t *) scanner;
390
391 lex_buffer = yy_create_buffer(fp, YY_BUF_SIZE, scanner);
392 yy_switch_to_buffer(lex_buffer, scanner);
393
394 /* This loop iterates once per logical line */
395 while ((token = yylex(scanner)))
396 {
397 char *opt_name = NULL;
398 char *opt_value = NULL;
399 ConfigVariable *item;
int yylex(yyscan_t yyscanner)
Definition: guc-file.l:91
400
401 if (token == GUC_EOL) /* empty or comment line */
402 continue;
403
404 /* first token on line is option name */
405 if (token != GUC_ID && token != GUC_QUALIFIED_ID)
406 goto parse_error;
407 opt_name = pstrdup(yytext);
char * pstrdup(const char *in)
Definition: mcxt.c:1696
408
409 /* next we have an optional equal sign; discard if present */
410 token = yylex(scanner);
411 if (token == GUC_EQUALS)
412 token = yylex(scanner);
413
414 /* now we must have the option value */
415 if (token != GUC_ID &&
416 token != GUC_STRING &&
417 token != GUC_INTEGER &&
418 token != GUC_REAL &&
420 goto parse_error;
421 if (token == GUC_STRING) /* strip quotes and escapes */
422 opt_value = DeescapeQuotedString(yytext);
423 else
424 opt_value = pstrdup(yytext);
char * DeescapeQuotedString(const char *s)
Definition: guc-file.l:661
425
426 /* now we'd like an end of line, or possibly EOF */
427 token = yylex(scanner);
428 if (token != GUC_EOL)
429 {
430 if (token != 0)
431 goto parse_error;
432 /* treat EOF like \n for line numbering purposes, cf bug 4752 */
434 }
435
436 /* OK, process the option name and value */
437 if (guc_name_compare(opt_name, "include_dir") == 0)
438 {
439 /*
440 * An include_dir directive isn't a variable and should be
441 * processed immediately.
442 */
443 if (!ParseConfigDirectory(opt_value,
445 depth + 1, elevel,
446 head_p, tail_p))
447 OK = false;
448 yy_switch_to_buffer(lex_buffer, scanner);
449 pfree(opt_name);
450 pfree(opt_value);
451 }
452 else if (guc_name_compare(opt_name, "include_if_exists") == 0)
453 {
454 /*
455 * An include_if_exists directive isn't a variable and should be
456 * processed immediately.
457 */
458 if (!ParseConfigFile(opt_value, false,
460 depth + 1, elevel,
461 head_p, tail_p))
462 OK = false;
463 yy_switch_to_buffer(lex_buffer, scanner);
464 pfree(opt_name);
465 pfree(opt_value);
466 }
467 else if (guc_name_compare(opt_name, "include") == 0)
468 {
469 /*
470 * An include directive isn't a variable and should be processed
471 * immediately.
472 */
473 if (!ParseConfigFile(opt_value, true,
475 depth + 1, elevel,
476 head_p, tail_p))
477 OK = false;
478 yy_switch_to_buffer(lex_buffer, scanner);
479 pfree(opt_name);
480 pfree(opt_value);
481 }
482 else
483 {
484 /* ordinary variable, append to list */
485 item = palloc(sizeof *item);
486 item->name = opt_name;
487 item->value = opt_value;
488 item->errmsg = NULL;
490 item->sourceline = ConfigFileLineno - 1;
491 item->ignore = false;
492 item->applied = false;
493 item->next = NULL;
494 if (*head_p == NULL)
495 *head_p = item;
496 else
497 (*tail_p)->next = item;
498 *tail_p = item;
499 }
bool ParseConfigDirectory(const char *includedir, const char *calling_file, int calling_lineno, int depth, int elevel, ConfigVariable **head_p, ConfigVariable **tail_p)
Definition: guc-file.l:581
int guc_name_compare(const char *namea, const char *nameb)
Definition: guc.c:1300
bool ignore
Definition: guc.h:146
bool applied
Definition: guc.h:147
int sourceline
Definition: guc.h:145
500
501 /* break out of loop if read EOF, else loop for next line */
502 if (token == 0)
503 break;
504 continue;
505
506parse_error:
507 /* release storage if we allocated any on this line */
508 if (opt_name)
509 pfree(opt_name);
510 if (opt_value)
511 pfree(opt_value);
512
513 /* report the error */
514 if (token == GUC_EOL || token == 0)
515 {
516 ereport(elevel,
517 (errcode(ERRCODE_SYNTAX_ERROR),
518 errmsg("syntax error in file \"%s\" line %u, near end of line",
520 record_config_file_error("syntax error",
522 head_p, tail_p);
523 }
524 else
525 {
526 ereport(elevel,
527 (errcode(ERRCODE_SYNTAX_ERROR),
528 errmsg("syntax error in file \"%s\" line %u, near token \"%s\"",
529 config_file, ConfigFileLineno, yytext)));
530 record_config_file_error("syntax error",
532 head_p, tail_p);
533 }
534 OK = false;
535 errorcount++;
536
537 /*
538 * To avoid producing too much noise when fed a totally bogus file,
539 * give up after 100 syntax errors per file (an arbitrary number).
540 * Also, if we're only logging the errors at DEBUG level anyway, might
541 * as well give up immediately. (This prevents postmaster children
542 * from bloating the logs with duplicate complaints.)
543 */
544 if (errorcount >= 100 || elevel <= DEBUG1)
545 {
546 ereport(elevel,
547 (errcode(ERRCODE_PROGRAM_LIMIT_EXCEEDED),
548 errmsg("too many syntax errors found, abandoning file \"%s\"",
549 config_file)));
550 break;
551 }
#define DEBUG1
Definition: elog.h:30
552
553 /* resync to next end-of-line or EOF */
554 while (token != GUC_EOL && token != 0)
555 token = yylex(scanner);
556 /* break out of loop on EOF */
557 if (token == 0)
558 break;
559 }
560
561cleanup:
562 yy_delete_buffer(lex_buffer, scanner);
563 yylex_destroy(scanner);
564 /* Each recursion level must save and restore these static variables. */
565 ConfigFileLineno = save_ConfigFileLineno;
566 GUC_flex_fatal_jmp = save_GUC_flex_fatal_jmp;
567 return OK;
568}

References ConfigVariable::applied, cleanup(), config_file, ConfigFileLineno, DEBUG1, DeescapeQuotedString(), elog, ereport, errcode(), errmsg(), ConfigVariable::errmsg, ConfigVariable::filename, GUC_EOL, GUC_EQUALS, GUC_flex_fatal_errmsg, GUC_flex_fatal_jmp, GUC_ID, GUC_INTEGER, guc_name_compare(), GUC_QUALIFIED_ID, GUC_REAL, GUC_STRING, GUC_UNQUOTED_STRING, ConfigVariable::ignore, ConfigVariable::name, ConfigVariable::next, palloc(), ParseConfigDirectory(), ParseConfigFile(), pfree(), pstrdup(), record_config_file_error(), ConfigVariable::sourceline, token, ConfigVariable::value, and yylex().

Referenced by AlterSystemSetConfigFile(), parse_extension_control_file(), and ParseConfigFile().

◆ ProcessConfigFile()

void ProcessConfigFile ( GucContext  context)

Definition at line 120 of file guc-file.l.

121{
122 int elevel;
123 MemoryContext config_cxt;
124 MemoryContext caller_cxt;
125
126 /*
127 * Config files are processed on startup (by the postmaster only) and on
128 * SIGHUP (by the postmaster and its children)
129 */
130 Assert((context == PGC_POSTMASTER && !IsUnderPostmaster) ||
131 context == PGC_SIGHUP);
bool IsUnderPostmaster
Definition: globals.c:119
@ PGC_POSTMASTER
Definition: guc.h:74
@ PGC_SIGHUP
Definition: guc.h:75
132
133 /*
134 * To avoid cluttering the log, only the postmaster bleats loudly about
135 * problems with the config file.
136 */
137 elevel = IsUnderPostmaster ? DEBUG2 : LOG;
#define DEBUG2
Definition: elog.h:29
138
139 /*
140 * This function is usually called within a process-lifespan memory
141 * context. To ensure that any memory leaked during GUC processing does
142 * not accumulate across repeated SIGHUP cycles, do the work in a private
143 * context that we can free at exit.
144 */
146 "config file processing",
148 caller_cxt = MemoryContextSwitchTo(config_cxt);
MemoryContext CurrentMemoryContext
Definition: mcxt.c:143
#define AllocSetContextCreate
Definition: memutils.h:129
#define ALLOCSET_DEFAULT_SIZES
Definition: memutils.h:160
static MemoryContext MemoryContextSwitchTo(MemoryContext context)
Definition: palloc.h:124
149
150 /*
151 * Read and apply the config file. We don't need to examine the result.
152 */
153 (void) ProcessConfigFileInternal(context, true, elevel);
ConfigVariable * ProcessConfigFileInternal(GucContext context, bool applySettings, int elevel)
Definition: guc.c:282
154
155 /* Clean up */
156 MemoryContextSwitchTo(caller_cxt);
157 MemoryContextDelete(config_cxt);
void MemoryContextDelete(MemoryContext context)
Definition: mcxt.c:454
158}

References ALLOCSET_DEFAULT_SIZES, AllocSetContextCreate, Assert, CurrentMemoryContext, DEBUG2, IsUnderPostmaster, LOG, MemoryContextDelete(), MemoryContextSwitchTo(), PGC_POSTMASTER, PGC_SIGHUP, and ProcessConfigFileInternal().

Referenced by ApplyLauncherMain(), autoprewarm_main(), CheckpointWriteDelay(), do_autovacuum(), HandleAutoVacLauncherInterrupts(), HandleCheckpointerInterrupts(), HandleMainLoopInterrupts(), HandlePgArchInterrupts(), HandleWalSummarizerInterrupts(), LogicalRepApplyLoop(), PostgresMain(), process_pm_reload_request(), ProcessParallelApplyInterrupts(), ProcessPendingWrites(), SelectConfigFiles(), slotsync_reread_config(), StartupRereadConfig(), SysLoggerMain(), vacuum_delay_point(), WaitForStandbyConfirmation(), WalReceiverMain(), WalSndLoop(), WalSndWaitForWal(), and worker_spi_main().

◆ record_config_file_error()

void record_config_file_error ( const char *  errmsg,
const char *  config_file,
int  lineno,
ConfigVariable **  head_p,
ConfigVariable **  tail_p 
)

Definition at line 278 of file guc-file.l.

283{
284 ConfigVariable *item;
285
286 item = palloc(sizeof *item);
287 item->name = NULL;
288 item->value = NULL;
289 item->errmsg = pstrdup(errmsg);
290 item->filename = config_file ? pstrdup(config_file) : NULL;
291 item->sourceline = lineno;
292 item->ignore = true;
293 item->applied = false;
294 item->next = NULL;
295 if (*head_p == NULL)
296 *head_p = item;
297 else
298 (*tail_p)->next = item;
299 *tail_p = item;
300}

References ConfigVariable::applied, config_file, errmsg(), ConfigVariable::errmsg, ConfigVariable::filename, ConfigVariable::ignore, ConfigVariable::name, ConfigVariable::next, palloc(), pstrdup(), ConfigVariable::sourceline, and ConfigVariable::value.

Referenced by ParseConfigDirectory(), ParseConfigFile(), ParseConfigFp(), and ProcessConfigFileInternal().

◆ yylex()

int yylex ( yyscan_t  yyscanner)

Definition at line 91 of file guc-file.l.

97{ID} return GUC_ID;
98{QUALIFIED_ID} return GUC_QUALIFIED_ID;
99{STRING} return GUC_STRING;
100{UNQUOTED_STRING} return GUC_UNQUOTED_STRING;
101{INTEGER} return GUC_INTEGER;
102{REAL} return GUC_REAL;
103= return GUC_EQUALS;
104
105. return GUC_ERROR;
106
107%%

Referenced by ParseConfigFp().

Variable Documentation

◆ ConfigFileLineno

unsigned int ConfigFileLineno
static

Definition at line 48 of file guc-file.l.

Referenced by ParseConfigFp().

◆ GUC_flex_fatal_errmsg

const char* GUC_flex_fatal_errmsg
static

Definition at line 49 of file guc-file.l.

Referenced by GUC_flex_fatal(), and ParseConfigFp().

◆ GUC_flex_fatal_jmp

sigjmp_buf* GUC_flex_fatal_jmp
static

Definition at line 50 of file guc-file.l.

Referenced by GUC_flex_fatal(), and ParseConfigFp().