MCPcopy Create free account
hub / github.com/apache/cloudberry / process_startup_options

Function process_startup_options

src/backend/utils/init/postinit.c:1503–1587  ·  view source on GitHub ↗

* Process any command-line switches and any additional GUC variable * settings passed in the startup packet. */

Source from the content-addressed store, hash-verified

1501 * settings passed in the startup packet.
1502 */
1503static void
1504process_startup_options(Port *port, bool am_superuser)
1505{
1506 GucContext gucctx;
1507 ListCell *gucopts;
1508
1509 gucctx = am_superuser ? PGC_SU_BACKEND : PGC_BACKEND;
1510
1511 /*
1512 * First process any command-line switches that were included in the
1513 * startup packet, if we are in a regular backend.
1514 */
1515 if (port->cmdline_options != NULL)
1516 {
1517 /*
1518 * The maximum possible number of commandline arguments that could
1519 * come from port->cmdline_options is (strlen + 1) / 2; see
1520 * pg_split_opts().
1521 */
1522 char **av;
1523 int maxac;
1524 int ac;
1525
1526 maxac = 2 + (strlen(port->cmdline_options) + 1) / 2;
1527
1528 av = (char **) palloc(maxac * sizeof(char *));
1529 ac = 0;
1530
1531 av[ac++] = "postgres";
1532
1533 pg_split_opts(av, &ac, port->cmdline_options);
1534
1535 av[ac] = NULL;
1536
1537 Assert(ac < maxac);
1538
1539 (void) process_postgres_switches(ac, av, gucctx, NULL);
1540 }
1541
1542 /*
1543 * Process any additional GUC variable settings passed in startup packet.
1544 * These are handled exactly like command-line variables.
1545 */
1546 gucopts = list_head(port->guc_options);
1547 while (gucopts)
1548 {
1549 char *name;
1550 char *value;
1551
1552 name = lfirst(gucopts);
1553 gucopts = lnext(port->guc_options, gucopts);
1554
1555 value = lfirst(gucopts);
1556 gucopts = lnext(port->guc_options, gucopts);
1557
1558 SetConfigOption(name, value, gucctx, PGC_S_CLIENT);
1559 }
1560

Callers 1

InitPostgresFunction · 0.85

Calls 8

pg_split_optsFunction · 0.85
list_headFunction · 0.85
lnextFunction · 0.85
SetConfigOptionFunction · 0.85
ParseLongOptionFunction · 0.85
pallocFunction · 0.50
pfreeFunction · 0.50

Tested by

no test coverage detected