1 /* A lexical scanner generated by flex */
3 /* Scanner skeleton version:
4 * $Header: /cvsroot/pgpool/pgpool-II/pool_config.c,v 1.27.2.1 2009/08/22 04:19:49 t-ishii Exp $
8 #define YY_FLEX_MAJOR_VERSION 2
9 #define YY_FLEX_MINOR_VERSION 5
15 /* cfront 1.2 defines "c_plusplus" instead of "__cplusplus" */
27 /* Use prototypes in function declarations. */
30 /* The "const" storage-class-modifier is valid. */
33 #else /* ! __cplusplus */
41 #endif /* ! __cplusplus */
60 #define YY_PROTO(proto) proto
62 #define YY_PROTO(proto) ()
65 /* Returned upon end-of-file. */
68 /* Promotes a possibly negative, possibly signed char to an unsigned
69 * integer for use as an array index. If the signed char is negative,
70 * we want to instead treat it as an 8-bit unsigned char, hence the
73 #define YY_SC_TO_UI(c) ((unsigned int) (unsigned char) c)
75 /* Enter a start condition. This macro really ought to take a parameter,
76 * but we do it the disgusting crufty way forced on us by the ()-less
77 * definition of BEGIN.
79 #define BEGIN yy_start = 1 + 2 *
81 /* Translate the current start state into a value that can be later handed
82 * to BEGIN to return to the state. The YYSTATE alias is for lex
85 #define YY_START ((yy_start - 1) / 2)
86 #define YYSTATE YY_START
88 /* Action number for EOF rule of a given start state. */
89 #define YY_STATE_EOF(state) (YY_END_OF_BUFFER + state + 1)
91 /* Special action meaning "start processing a new file". */
92 #define YY_NEW_FILE yyrestart( yyin )
94 #define YY_END_OF_BUFFER_CHAR 0
96 /* Size of default input buffer. */
97 #define YY_BUF_SIZE 16384
99 typedef struct yy_buffer_state *YY_BUFFER_STATE;
102 extern FILE *yyin, *yyout;
104 #define EOB_ACT_CONTINUE_SCAN 0
105 #define EOB_ACT_END_OF_FILE 1
106 #define EOB_ACT_LAST_MATCH 2
108 /* The funky do-while in the following #define is used to turn the definition
109 * int a single C statement (which needs a semi-colon terminator). This
110 * avoids problems with code like:
112 * if ( condition_holds )
115 * do_something_else();
117 * Prior to using the do-while the compiler would get upset at the
118 * "else" because it interpreted the "if" statement as being all
119 * done when it reached the ';' after the yyless() call.
122 /* Return all but the first 'n' matched characters back to the input stream. */
127 /* Undo effects of setting up yytext. */ \
128 *yy_cp = yy_hold_char; \
129 YY_RESTORE_YY_MORE_OFFSET \
130 yy_c_buf_p = yy_cp = yy_bp + n - YY_MORE_ADJ; \
131 YY_DO_BEFORE_ACTION; /* set up yytext again */ \
135 #define unput(c) yyunput( c, yytext_ptr )
137 /* The following is because we cannot portably get our hands on size_t
138 * (without autoconf's help, which isn't available because we want
139 * flex-generated scanners to compile on their own).
141 typedef unsigned int yy_size_t;
144 struct yy_buffer_state
148 char *yy_ch_buf; /* input buffer */
149 char *yy_buf_pos; /* current position in input buffer */
151 /* Size of input buffer in bytes, not including room for EOB
154 yy_size_t yy_buf_size;
156 /* Number of characters read into yy_ch_buf, not including EOB
161 /* Whether we "own" the buffer - i.e., we know we created it,
162 * and can realloc() it to grow it, and should free() it to
165 int yy_is_our_buffer;
167 /* Whether this is an "interactive" input source; if so, and
168 * if we're using stdio for input, then we want to use getc()
169 * instead of fread(), to make sure we stop fetching input after
172 int yy_is_interactive;
174 /* Whether we're considered to be at the beginning of a line.
175 * If so, '^' rules will be active on the next match, otherwise
180 /* Whether to try to fill the input buffer when we reach the
185 int yy_buffer_status;
186 #define YY_BUFFER_NEW 0
187 #define YY_BUFFER_NORMAL 1
188 /* When an EOF's been seen but there's still some text to process
189 * then we mark the buffer as YY_EOF_PENDING, to indicate that we
190 * shouldn't try reading from the input source any more. We might
191 * still have a bunch of tokens to match, though, because of
192 * possible backing-up.
194 * When we actually see the EOF, we change the status to "new"
195 * (via yyrestart()), so that the user can continue scanning by
196 * just pointing yyin at a new input file.
198 #define YY_BUFFER_EOF_PENDING 2
201 static YY_BUFFER_STATE yy_current_buffer = 0;
203 /* We provide macros for accessing buffer states in case in the
204 * future we want to put the buffer states in a more general
207 #define YY_CURRENT_BUFFER yy_current_buffer
210 /* yy_hold_char holds the character lost when yytext is formed. */
211 static char yy_hold_char;
213 static int yy_n_chars; /* number of characters read into yy_ch_buf */
218 /* Points to current character in buffer. */
219 static char *yy_c_buf_p = (char *) 0;
220 static int yy_init = 1; /* whether we need to initialize */
221 static int yy_start = 0; /* start state number */
223 /* Flag which is used to allow yywrap()'s to do buffer switches
224 * instead of setting up a fresh yyin. A bit of a hack ...
226 static int yy_did_buffer_switch_on_eof;
228 void yyrestart YY_PROTO(( FILE *input_file ));
230 void yy_switch_to_buffer YY_PROTO(( YY_BUFFER_STATE new_buffer ));
231 void yy_load_buffer_state YY_PROTO(( void ));
232 YY_BUFFER_STATE yy_create_buffer YY_PROTO(( FILE *file, int size ));
233 void yy_delete_buffer YY_PROTO(( YY_BUFFER_STATE b ));
234 void yy_init_buffer YY_PROTO(( YY_BUFFER_STATE b, FILE *file ));
235 void yy_flush_buffer YY_PROTO(( YY_BUFFER_STATE b ));
236 #define YY_FLUSH_BUFFER yy_flush_buffer( yy_current_buffer )
238 YY_BUFFER_STATE yy_scan_buffer YY_PROTO(( char *base, yy_size_t size ));
239 YY_BUFFER_STATE yy_scan_string YY_PROTO(( yyconst char *yy_str ));
240 YY_BUFFER_STATE yy_scan_bytes YY_PROTO(( yyconst char *bytes, int len ));
242 static void *yy_flex_alloc YY_PROTO(( yy_size_t ));
243 static void *yy_flex_realloc YY_PROTO(( void *, yy_size_t ));
244 static void yy_flex_free YY_PROTO(( void * ));
246 #define yy_new_buffer yy_create_buffer
248 #define yy_set_interactive(is_interactive) \
250 if ( ! yy_current_buffer ) \
251 yy_current_buffer = yy_create_buffer( yyin, YY_BUF_SIZE ); \
252 yy_current_buffer->yy_is_interactive = is_interactive; \
255 #define yy_set_bol(at_bol) \
257 if ( ! yy_current_buffer ) \
258 yy_current_buffer = yy_create_buffer( yyin, YY_BUF_SIZE ); \
259 yy_current_buffer->yy_at_bol = at_bol; \
262 #define YY_AT_BOL() (yy_current_buffer->yy_at_bol)
266 #define YY_SKIP_YYWRAP
267 typedef unsigned char YY_CHAR;
268 FILE *yyin = (FILE *) 0, *yyout = (FILE *) 0;
269 typedef int yy_state_type;
271 #define yytext_ptr yytext
273 static yy_state_type yy_get_previous_state YY_PROTO(( void ));
274 static yy_state_type yy_try_NUL_trans YY_PROTO(( yy_state_type current_state ));
275 static int yy_get_next_buffer YY_PROTO(( void ));
276 static void yy_fatal_error YY_PROTO(( yyconst char msg[] ));
278 /* Done after the current pattern has been matched and before the
279 * corresponding action - sets up yytext.
281 #define YY_DO_BEFORE_ACTION \
282 yytext_ptr = yy_bp; \
283 yyleng = (int) (yy_cp - yy_bp); \
284 yy_hold_char = *yy_cp; \
288 #define YY_NUM_RULES 11
289 #define YY_END_OF_BUFFER 12
290 static yyconst short int yy_accept[38] =
292 0, 0, 12, 10, 2, 1, 10, 10, 10, 8,
293 7, 7, 9, 4, 2, 0, 3, 0, 5, 0,
294 8, 7, 7, 8, 0, 0, 6, 4, 4, 0,
298 static yyconst int yy_ec[256] =
300 1, 1, 1, 1, 1, 1, 1, 1, 2, 3,
301 1, 1, 2, 1, 1, 1, 1, 1, 1, 1,
302 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
303 1, 2, 1, 1, 4, 1, 1, 1, 5, 1,
304 1, 1, 6, 1, 7, 8, 9, 10, 11, 11,
305 11, 11, 11, 11, 11, 11, 11, 9, 1, 1,
306 12, 1, 1, 1, 13, 13, 13, 13, 14, 13,
307 15, 15, 15, 15, 15, 15, 15, 15, 15, 15,
308 15, 15, 15, 15, 15, 15, 15, 15, 15, 15,
309 1, 16, 1, 1, 17, 1, 13, 13, 13, 13,
311 14, 13, 15, 15, 15, 15, 15, 15, 15, 15,
312 15, 15, 15, 15, 15, 15, 15, 15, 15, 18,
313 15, 15, 1, 1, 1, 1, 1, 15, 15, 15,
314 15, 15, 15, 15, 15, 15, 15, 15, 15, 15,
315 15, 15, 15, 15, 15, 15, 15, 15, 15, 15,
316 15, 15, 15, 15, 15, 15, 15, 15, 15, 15,
317 15, 15, 15, 15, 15, 15, 15, 15, 15, 15,
318 15, 15, 15, 15, 15, 15, 15, 15, 15, 15,
319 15, 15, 15, 15, 15, 15, 15, 15, 15, 15,
320 15, 15, 15, 15, 15, 15, 15, 15, 15, 15,
322 15, 15, 15, 15, 15, 15, 15, 15, 15, 15,
323 15, 15, 15, 15, 15, 15, 15, 15, 15, 15,
324 15, 15, 15, 15, 15, 15, 15, 15, 15, 15,
325 15, 15, 15, 15, 15, 15, 15, 15, 15, 15,
326 15, 15, 15, 15, 15, 15, 15, 15, 15, 15,
330 static yyconst int yy_meta[19] =
332 1, 1, 2, 1, 1, 1, 3, 3, 3, 4,
333 4, 1, 5, 4, 3, 1, 3, 3
336 static yyconst short int yy_base[45] =
338 0, 0, 61, 86, 58, 86, 55, 14, 23, 43,
339 10, 46, 86, 28, 47, 40, 86, 16, 86, 22,
340 28, 0, 0, 0, 40, 0, 24, 45, 0, 24,
341 39, 43, 12, 14, 0, 22, 86, 62, 67, 22,
345 static yyconst short int yy_def[45] =
347 37, 1, 37, 37, 37, 37, 38, 39, 37, 40,
348 9, 9, 37, 41, 37, 38, 37, 39, 37, 42,
349 40, 11, 12, 21, 37, 43, 44, 41, 28, 39,
350 39, 42, 37, 37, 43, 44, 0, 37, 37, 37,
354 static yyconst short int yy_nxt[105] =
356 4, 5, 6, 7, 8, 9, 9, 10, 4, 11,
357 12, 13, 14, 14, 14, 4, 14, 14, 19, 23,
358 19, 34, 34, 34, 34, 24, 31, 26, 19, 20,
359 21, 20, 22, 23, 27, 27, 27, 32, 36, 20,
360 36, 25, 17, 19, 29, 33, 33, 31, 15, 34,
361 34, 27, 27, 27, 20, 23, 25, 17, 32, 15,
362 37, 29, 16, 16, 16, 16, 16, 18, 37, 18,
363 18, 18, 28, 28, 28, 30, 37, 30, 30, 30,
364 35, 35, 27, 27, 27, 3, 37, 37, 37, 37,
365 37, 37, 37, 37, 37, 37, 37, 37, 37, 37,
370 static yyconst short int yy_chk[105] =
372 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
373 1, 1, 1, 1, 1, 1, 1, 1, 8, 11,
374 18, 33, 33, 34, 34, 40, 20, 11, 30, 8,
375 9, 18, 9, 9, 14, 14, 14, 20, 36, 30,
376 27, 21, 16, 31, 14, 25, 25, 32, 15, 25,
377 25, 28, 28, 28, 31, 12, 10, 7, 32, 5,
378 3, 28, 38, 38, 38, 38, 38, 39, 0, 39,
379 39, 39, 41, 41, 41, 42, 0, 42, 42, 42,
380 43, 43, 44, 44, 44, 37, 37, 37, 37, 37,
381 37, 37, 37, 37, 37, 37, 37, 37, 37, 37,
386 static yy_state_type yy_last_accepting_state;
387 static char *yy_last_accepting_cpos;
389 /* The intent behind this definition is that it'll catch
390 * any uses of REJECT which flex missed.
392 #define REJECT reject_used_but_not_detected
393 #define yymore() yymore_used_but_not_detected
394 #define YY_MORE_ADJ 0
395 #define YY_RESTORE_YY_MORE_OFFSET
397 #line 1 "pool_config.l"
402 * $Header: /cvsroot/pgpool/pgpool-II/pool_config.c,v 1.27.2.1 2009/08/22 04:19:49 t-ishii Exp $
404 * pgpool: a language independent connection pool server for PostgreSQL
405 * written by Tatsuo Ishii
407 * Copyright (c) 2003-2009 PgPool Global Development Group
409 * Permission to use, copy, modify, and distribute this software and
410 * its documentation for any purpose and without fee is hereby
411 * granted, provided that the above copyright notice appear in all
412 * copies and that both that copyright notice and this permission
413 * notice appear in supporting documentation, and that the name of the
414 * author not be used in advertising or publicity pertaining to
415 * distribution of the software without specific, written prior
416 * permission. The author makes no representations about the
417 * suitability of this software for any purpose. It is provided "as
418 * is" without express or implied warranty.
420 * pool_config.l: read configuration file
423 #line 27 "pool_config.l"
431 #define CHECK_CONTEXT(mask, context) ((mask) & (context))
433 /* to shut off compiler warnings */
436 POOL_CONFIG *pool_config; /* configuration values */
437 POOL_SYSTEMDB_CONNECTION_POOL *system_db_info;
438 static unsigned Lineno;
439 static char *default_reset_query_list[] = {"ABORT", "RESET ALL", "SET SESSION AUTHORIZATION DEFAULT"};
446 POOL_UNQUOTED_STRING,
452 static char *extract_string(char *value, POOL_TOKEN token);
453 static char **extract_string_tokens(char *str, char *delim, int *n);
454 static int eval_logical(char *str);
455 static void clear_host_entry(int slot);
457 #define YY_NEVER_INTERACTIVE 1
458 #define YY_NO_UNPUT 1
459 #line 460 "pool_config.c"
461 /* Macros after this point can all be overridden by user definitions in
465 #ifndef YY_SKIP_YYWRAP
467 extern "C" int yywrap YY_PROTO(( void ));
469 extern int yywrap YY_PROTO(( void ));
474 static void yyunput YY_PROTO(( int c, char *buf_ptr ));
478 static void yy_flex_strncpy YY_PROTO(( char *, yyconst char *, int ));
481 #ifdef YY_NEED_STRLEN
482 static int yy_flex_strlen YY_PROTO(( yyconst char * ));
487 static int yyinput YY_PROTO(( void ));
489 static int input YY_PROTO(( void ));
494 static int yy_start_stack_ptr = 0;
495 static int yy_start_stack_depth = 0;
496 static int *yy_start_stack = 0;
497 #ifndef YY_NO_PUSH_STATE
498 static void yy_push_state YY_PROTO(( int new_state ));
500 #ifndef YY_NO_POP_STATE
501 static void yy_pop_state YY_PROTO(( void ));
503 #ifndef YY_NO_TOP_STATE
504 static int yy_top_state YY_PROTO(( void ));
508 #define YY_NO_PUSH_STATE 1
509 #define YY_NO_POP_STATE 1
510 #define YY_NO_TOP_STATE 1
513 #ifdef YY_MALLOC_DECL
521 /* Just try to get by without declaring the routines. This will fail
522 * miserably on non-ANSI systems for which sizeof(size_t) != sizeof(int)
523 * or sizeof(void*) != sizeof(int).
528 /* Amount of stuff to slurp up with each read. */
529 #ifndef YY_READ_BUF_SIZE
530 #define YY_READ_BUF_SIZE 8192
533 /* Copy whatever the last rule matched to the standard output. */
536 /* This used to be an fputs(), but since the string might contain NUL's,
537 * we now use fwrite().
539 #define ECHO (void) fwrite( yytext, yyleng, 1, yyout )
542 /* Gets input and stuffs it into "buf". number of characters read, or YY_NULL,
543 * is returned in "result".
546 #define YY_INPUT(buf,result,max_size) \
547 if ( yy_current_buffer->yy_is_interactive ) \
550 for ( n = 0; n < max_size && \
551 (c = getc( yyin )) != EOF && c != '\n'; ++n ) \
554 buf[n++] = (char) c; \
555 if ( c == EOF && ferror( yyin ) ) \
556 YY_FATAL_ERROR( "input in flex scanner failed" ); \
559 else if ( ((result = fread( buf, 1, max_size, yyin )) == 0) \
560 && ferror( yyin ) ) \
561 YY_FATAL_ERROR( "input in flex scanner failed" );
564 /* No semi-colon after return; correct usage is to write "yyterminate();" -
565 * we don't want an extra ';' after the "return" because that will cause
566 * some compilers to complain about unreachable statements.
569 #define yyterminate() return YY_NULL
572 /* Number of entries by which start-condition stack grows. */
573 #ifndef YY_START_STACK_INCR
574 #define YY_START_STACK_INCR 25
577 /* Report a fatal error. */
578 #ifndef YY_FATAL_ERROR
579 #define YY_FATAL_ERROR(msg) yy_fatal_error( msg )
582 /* Default declaration of generated scanner - a define so the user can
583 * easily add parameters.
586 #define YY_DECL int yylex YY_PROTO(( void ))
589 /* Code executed at the beginning of each rule, after yytext and yyleng
592 #ifndef YY_USER_ACTION
593 #define YY_USER_ACTION
596 /* Code executed at the end of each rule. */
598 #define YY_BREAK break;
601 #define YY_RULE_SETUP \
606 register yy_state_type yy_current_state;
607 register char *yy_cp = NULL, *yy_bp = NULL;
610 #line 84 "pool_config.l"
613 #line 614 "pool_config.c"
624 yy_start = 1; /* first start state */
632 if ( ! yy_current_buffer )
634 yy_create_buffer( yyin, YY_BUF_SIZE );
636 yy_load_buffer_state();
639 while ( 1 ) /* loops until end-of-file is reached */
643 /* Support of yytext. */
644 *yy_cp = yy_hold_char;
646 /* yy_bp points to the position in yy_ch_buf of the start of
651 yy_current_state = yy_start;
655 register YY_CHAR yy_c = yy_ec[YY_SC_TO_UI(*yy_cp)];
656 if ( yy_accept[yy_current_state] )
658 yy_last_accepting_state = yy_current_state;
659 yy_last_accepting_cpos = yy_cp;
661 while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
663 yy_current_state = (int) yy_def[yy_current_state];
664 if ( yy_current_state >= 38 )
665 yy_c = yy_meta[(unsigned int) yy_c];
667 yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
670 while ( yy_base[yy_current_state] != 86 );
673 yy_act = yy_accept[yy_current_state];
675 { /* have to back up */
676 yy_cp = yy_last_accepting_cpos;
677 yy_current_state = yy_last_accepting_state;
678 yy_act = yy_accept[yy_current_state];
684 do_action: /* This label is used only to access EOF actions. */
688 { /* beginning of action switch */
689 case 0: /* must back up */
690 /* undo the effects of YY_DO_BEFORE_ACTION */
691 *yy_cp = yy_hold_char;
692 yy_cp = yy_last_accepting_cpos;
693 yy_current_state = yy_last_accepting_state;
698 #line 86 "pool_config.l"
699 Lineno++; return POOL_EOL;
703 #line 87 "pool_config.l"
707 *yy_cp = yy_hold_char; /* undo effects of setting up yytext */
708 yy_c_buf_p = yy_cp -= 1;
709 YY_DO_BEFORE_ACTION; /* set up yytext again */
711 #line 88 "pool_config.l"
716 #line 90 "pool_config.l"
721 #line 91 "pool_config.l"
726 #line 92 "pool_config.l"
727 return POOL_UNQUOTED_STRING;
731 #line 93 "pool_config.l"
736 #line 94 "pool_config.l"
741 #line 95 "pool_config.l"
746 #line 97 "pool_config.l"
747 return POOL_PARSE_ERROR;
751 #line 99 "pool_config.l"
754 #line 755 "pool_config.c"
755 case YY_STATE_EOF(INITIAL):
758 case YY_END_OF_BUFFER:
760 /* Amount of text matched not including the EOB char. */
761 int yy_amount_of_matched_text = (int) (yy_cp - yytext_ptr) - 1;
763 /* Undo the effects of YY_DO_BEFORE_ACTION. */
764 *yy_cp = yy_hold_char;
765 YY_RESTORE_YY_MORE_OFFSET
767 if ( yy_current_buffer->yy_buffer_status == YY_BUFFER_NEW )
769 /* We're scanning a new file or input source. It's
770 * possible that this happened because the user
771 * just pointed yyin at a new source and called
772 * yylex(). If so, then we have to assure
773 * consistency between yy_current_buffer and our
774 * globals. Here is the right place to do so, because
775 * this is the first action (other than possibly a
776 * back-up) that will match for the new input source.
778 yy_n_chars = yy_current_buffer->yy_n_chars;
779 yy_current_buffer->yy_input_file = yyin;
780 yy_current_buffer->yy_buffer_status = YY_BUFFER_NORMAL;
783 /* Note that here we test for yy_c_buf_p "<=" to the position
784 * of the first EOB in the buffer, since yy_c_buf_p will
785 * already have been incremented past the NUL character
786 * (since all states make transitions on EOB to the
787 * end-of-buffer state). Contrast this with the test
790 if ( yy_c_buf_p <= &yy_current_buffer->yy_ch_buf[yy_n_chars] )
791 { /* This was really a NUL. */
792 yy_state_type yy_next_state;
794 yy_c_buf_p = yytext_ptr + yy_amount_of_matched_text;
796 yy_current_state = yy_get_previous_state();
798 /* Okay, we're now positioned to make the NUL
799 * transition. We couldn't have
800 * yy_get_previous_state() go ahead and do it
801 * for us because it doesn't know how to deal
802 * with the possibility of jamming (and we don't
803 * want to build jamming into it because then it
804 * will run more slowly).
807 yy_next_state = yy_try_NUL_trans( yy_current_state );
809 yy_bp = yytext_ptr + YY_MORE_ADJ;
813 /* Consume the NUL. */
814 yy_cp = ++yy_c_buf_p;
815 yy_current_state = yy_next_state;
826 else switch ( yy_get_next_buffer() )
828 case EOB_ACT_END_OF_FILE:
830 yy_did_buffer_switch_on_eof = 0;
834 /* Note: because we've taken care in
835 * yy_get_next_buffer() to have set up
836 * yytext, we can now set up
837 * yy_c_buf_p so that if some total
838 * hoser (like flex itself) wants to
839 * call the scanner after we return the
840 * YY_NULL, it'll still work - another
841 * YY_NULL will get returned.
843 yy_c_buf_p = yytext_ptr + YY_MORE_ADJ;
845 yy_act = YY_STATE_EOF(YY_START);
851 if ( ! yy_did_buffer_switch_on_eof )
857 case EOB_ACT_CONTINUE_SCAN:
859 yytext_ptr + yy_amount_of_matched_text;
861 yy_current_state = yy_get_previous_state();
864 yy_bp = yytext_ptr + YY_MORE_ADJ;
867 case EOB_ACT_LAST_MATCH:
869 &yy_current_buffer->yy_ch_buf[yy_n_chars];
871 yy_current_state = yy_get_previous_state();
874 yy_bp = yytext_ptr + YY_MORE_ADJ;
882 "fatal flex scanner internal error--no action found" );
883 } /* end of action switch */
884 } /* end of scanning one token */
888 /* yy_get_next_buffer - try to read in a new buffer
890 * Returns a code representing an action:
891 * EOB_ACT_LAST_MATCH -
892 * EOB_ACT_CONTINUE_SCAN - continue scanning from current position
893 * EOB_ACT_END_OF_FILE - end of file
896 static int yy_get_next_buffer()
898 register char *dest = yy_current_buffer->yy_ch_buf;
899 register char *source = yytext_ptr;
900 register int number_to_move, i;
903 if ( yy_c_buf_p > &yy_current_buffer->yy_ch_buf[yy_n_chars + 1] )
905 "fatal flex scanner internal error--end of buffer missed" );
907 if ( yy_current_buffer->yy_fill_buffer == 0 )
908 { /* Don't try to fill the buffer, so this is an EOF. */
909 if ( yy_c_buf_p - yytext_ptr - YY_MORE_ADJ == 1 )
911 /* We matched a single character, the EOB, so
912 * treat this as a final EOF.
914 return EOB_ACT_END_OF_FILE;
919 /* We matched some text prior to the EOB, first
922 return EOB_ACT_LAST_MATCH;
926 /* Try to read more data. */
928 /* First move last chars to start of buffer. */
929 number_to_move = (int) (yy_c_buf_p - yytext_ptr) - 1;
931 for ( i = 0; i < number_to_move; ++i )
932 *(dest++) = *(source++);
934 if ( yy_current_buffer->yy_buffer_status == YY_BUFFER_EOF_PENDING )
935 /* don't do the read, it's not guaranteed to return an EOF,
938 yy_current_buffer->yy_n_chars = yy_n_chars = 0;
943 yy_current_buffer->yy_buf_size - number_to_move - 1;
945 while ( num_to_read <= 0 )
946 { /* Not enough room in the buffer - grow it. */
947 #ifdef YY_USES_REJECT
949 "input buffer overflow, can't enlarge buffer because scanner uses REJECT" );
952 /* just a shorter name for the current buffer */
953 YY_BUFFER_STATE b = yy_current_buffer;
955 int yy_c_buf_p_offset =
956 (int) (yy_c_buf_p - b->yy_ch_buf);
958 if ( b->yy_is_our_buffer )
960 int new_size = b->yy_buf_size * 2;
963 b->yy_buf_size += b->yy_buf_size / 8;
967 b->yy_ch_buf = (char *)
968 /* Include room in for 2 EOB chars. */
969 yy_flex_realloc( (void *) b->yy_ch_buf,
970 b->yy_buf_size + 2 );
973 /* Can't grow it, we don't own it. */
976 if ( ! b->yy_ch_buf )
978 "fatal error - scanner input buffer overflow" );
980 yy_c_buf_p = &b->yy_ch_buf[yy_c_buf_p_offset];
982 num_to_read = yy_current_buffer->yy_buf_size -
987 if ( num_to_read > YY_READ_BUF_SIZE )
988 num_to_read = YY_READ_BUF_SIZE;
990 /* Read in more data. */
991 YY_INPUT( (&yy_current_buffer->yy_ch_buf[number_to_move]),
992 yy_n_chars, num_to_read );
994 yy_current_buffer->yy_n_chars = yy_n_chars;
997 if ( yy_n_chars == 0 )
999 if ( number_to_move == YY_MORE_ADJ )
1001 ret_val = EOB_ACT_END_OF_FILE;
1007 ret_val = EOB_ACT_LAST_MATCH;
1008 yy_current_buffer->yy_buffer_status =
1009 YY_BUFFER_EOF_PENDING;
1014 ret_val = EOB_ACT_CONTINUE_SCAN;
1016 yy_n_chars += number_to_move;
1017 yy_current_buffer->yy_ch_buf[yy_n_chars] = YY_END_OF_BUFFER_CHAR;
1018 yy_current_buffer->yy_ch_buf[yy_n_chars + 1] = YY_END_OF_BUFFER_CHAR;
1020 yytext_ptr = &yy_current_buffer->yy_ch_buf[0];
1026 /* yy_get_previous_state - get the state just before the EOB char was reached */
1028 static yy_state_type yy_get_previous_state()
1030 register yy_state_type yy_current_state;
1031 register char *yy_cp;
1033 yy_current_state = yy_start;
1035 for ( yy_cp = yytext_ptr + YY_MORE_ADJ; yy_cp < yy_c_buf_p; ++yy_cp )
1037 register YY_CHAR yy_c = (*yy_cp ? yy_ec[YY_SC_TO_UI(*yy_cp)] : 1);
1038 if ( yy_accept[yy_current_state] )
1040 yy_last_accepting_state = yy_current_state;
1041 yy_last_accepting_cpos = yy_cp;
1043 while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
1045 yy_current_state = (int) yy_def[yy_current_state];
1046 if ( yy_current_state >= 38 )
1047 yy_c = yy_meta[(unsigned int) yy_c];
1049 yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
1052 return yy_current_state;
1056 /* yy_try_NUL_trans - try to make a transition on the NUL character
1059 * next_state = yy_try_NUL_trans( current_state );
1062 #ifdef YY_USE_PROTOS
1063 static yy_state_type yy_try_NUL_trans( yy_state_type yy_current_state )
1065 static yy_state_type yy_try_NUL_trans( yy_current_state )
1066 yy_state_type yy_current_state;
1069 register int yy_is_jam;
1070 register char *yy_cp = yy_c_buf_p;
1072 register YY_CHAR yy_c = 1;
1073 if ( yy_accept[yy_current_state] )
1075 yy_last_accepting_state = yy_current_state;
1076 yy_last_accepting_cpos = yy_cp;
1078 while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
1080 yy_current_state = (int) yy_def[yy_current_state];
1081 if ( yy_current_state >= 38 )
1082 yy_c = yy_meta[(unsigned int) yy_c];
1084 yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
1085 yy_is_jam = (yy_current_state == 37);
1087 return yy_is_jam ? 0 : yy_current_state;
1092 #ifdef YY_USE_PROTOS
1093 static void yyunput( int c, register char *yy_bp )
1095 static void yyunput( c, yy_bp )
1097 register char *yy_bp;
1100 register char *yy_cp = yy_c_buf_p;
1102 /* undo effects of setting up yytext */
1103 *yy_cp = yy_hold_char;
1105 if ( yy_cp < yy_current_buffer->yy_ch_buf + 2 )
1106 { /* need to shift things up to make room */
1107 /* +2 for EOB chars. */
1108 register int number_to_move = yy_n_chars + 2;
1109 register char *dest = &yy_current_buffer->yy_ch_buf[
1110 yy_current_buffer->yy_buf_size + 2];
1111 register char *source =
1112 &yy_current_buffer->yy_ch_buf[number_to_move];
1114 while ( source > yy_current_buffer->yy_ch_buf )
1115 *--dest = *--source;
1117 yy_cp += (int) (dest - source);
1118 yy_bp += (int) (dest - source);
1119 yy_current_buffer->yy_n_chars =
1120 yy_n_chars = yy_current_buffer->yy_buf_size;
1122 if ( yy_cp < yy_current_buffer->yy_ch_buf + 2 )
1123 YY_FATAL_ERROR( "flex scanner push-back overflow" );
1126 *--yy_cp = (char) c;
1130 yy_hold_char = *yy_cp;
1133 #endif /* ifndef YY_NO_UNPUT */
1138 static int yyinput()
1145 *yy_c_buf_p = yy_hold_char;
1147 if ( *yy_c_buf_p == YY_END_OF_BUFFER_CHAR )
1149 /* yy_c_buf_p now points to the character we want to return.
1150 * If this occurs *before* the EOB characters, then it's a
1151 * valid NUL; if not, then we've hit the end of the buffer.
1153 if ( yy_c_buf_p < &yy_current_buffer->yy_ch_buf[yy_n_chars] )
1154 /* This was really a NUL. */
1158 { /* need more input */
1159 int offset = yy_c_buf_p - yytext_ptr;
1162 switch ( yy_get_next_buffer() )
1164 case EOB_ACT_LAST_MATCH:
1165 /* This happens because yy_g_n_b()
1166 * sees that we've accumulated a
1167 * token and flags that we need to
1168 * try matching the token before
1169 * proceeding. But for input(),
1170 * there's no matching to consider.
1171 * So convert the EOB_ACT_LAST_MATCH
1172 * to EOB_ACT_END_OF_FILE.
1175 /* Reset buffer status. */
1180 case EOB_ACT_END_OF_FILE:
1185 if ( ! yy_did_buffer_switch_on_eof )
1194 case EOB_ACT_CONTINUE_SCAN:
1195 yy_c_buf_p = yytext_ptr + offset;
1201 c = *(unsigned char *) yy_c_buf_p; /* cast for 8-bit char's */
1202 *yy_c_buf_p = '\0'; /* preserve yytext */
1203 yy_hold_char = *++yy_c_buf_p;
1208 #endif /* YY_NO_INPUT */
1210 #ifdef YY_USE_PROTOS
1211 void yyrestart( FILE *input_file )
1213 void yyrestart( input_file )
1217 if ( ! yy_current_buffer )
1218 yy_current_buffer = yy_create_buffer( yyin, YY_BUF_SIZE );
1220 yy_init_buffer( yy_current_buffer, input_file );
1221 yy_load_buffer_state();
1225 #ifdef YY_USE_PROTOS
1226 void yy_switch_to_buffer( YY_BUFFER_STATE new_buffer )
1228 void yy_switch_to_buffer( new_buffer )
1229 YY_BUFFER_STATE new_buffer;
1232 if ( yy_current_buffer == new_buffer )
1235 if ( yy_current_buffer )
1237 /* Flush out information for old buffer. */
1238 *yy_c_buf_p = yy_hold_char;
1239 yy_current_buffer->yy_buf_pos = yy_c_buf_p;
1240 yy_current_buffer->yy_n_chars = yy_n_chars;
1243 yy_current_buffer = new_buffer;
1244 yy_load_buffer_state();
1246 /* We don't actually know whether we did this switch during
1247 * EOF (yywrap()) processing, but the only time this flag
1248 * is looked at is after yywrap() is called, so it's safe
1249 * to go ahead and always set it.
1251 yy_did_buffer_switch_on_eof = 1;
1255 #ifdef YY_USE_PROTOS
1256 void yy_load_buffer_state( void )
1258 void yy_load_buffer_state()
1261 yy_n_chars = yy_current_buffer->yy_n_chars;
1262 yytext_ptr = yy_c_buf_p = yy_current_buffer->yy_buf_pos;
1263 yyin = yy_current_buffer->yy_input_file;
1264 yy_hold_char = *yy_c_buf_p;
1268 #ifdef YY_USE_PROTOS
1269 YY_BUFFER_STATE yy_create_buffer( FILE *file, int size )
1271 YY_BUFFER_STATE yy_create_buffer( file, size )
1278 b = (YY_BUFFER_STATE) yy_flex_alloc( sizeof( struct yy_buffer_state ) );
1280 YY_FATAL_ERROR( "out of dynamic memory in yy_create_buffer()" );
1282 b->yy_buf_size = size;
1284 /* yy_ch_buf has to be 2 characters longer than the size given because
1285 * we need to put in 2 end-of-buffer characters.
1287 b->yy_ch_buf = (char *) yy_flex_alloc( b->yy_buf_size + 2 );
1288 if ( ! b->yy_ch_buf )
1289 YY_FATAL_ERROR( "out of dynamic memory in yy_create_buffer()" );
1291 b->yy_is_our_buffer = 1;
1293 yy_init_buffer( b, file );
1299 #ifdef YY_USE_PROTOS
1300 void yy_delete_buffer( YY_BUFFER_STATE b )
1302 void yy_delete_buffer( b )
1309 if ( b == yy_current_buffer )
1310 yy_current_buffer = (YY_BUFFER_STATE) 0;
1312 if ( b->yy_is_our_buffer )
1313 yy_flex_free( (void *) b->yy_ch_buf );
1315 yy_flex_free( (void *) b );
1320 #ifdef YY_USE_PROTOS
1321 void yy_init_buffer( YY_BUFFER_STATE b, FILE *file )
1323 void yy_init_buffer( b, file )
1330 yy_flush_buffer( b );
1332 b->yy_input_file = file;
1333 b->yy_fill_buffer = 1;
1335 #if YY_ALWAYS_INTERACTIVE
1336 b->yy_is_interactive = 1;
1338 #if YY_NEVER_INTERACTIVE
1339 b->yy_is_interactive = 0;
1341 b->yy_is_interactive = file ? (isatty( fileno(file) ) > 0) : 0;
1347 #ifdef YY_USE_PROTOS
1348 void yy_flush_buffer( YY_BUFFER_STATE b )
1350 void yy_flush_buffer( b )
1360 /* We always need two end-of-buffer characters. The first causes
1361 * a transition to the end-of-buffer state. The second causes
1362 * a jam in that state.
1364 b->yy_ch_buf[0] = YY_END_OF_BUFFER_CHAR;
1365 b->yy_ch_buf[1] = YY_END_OF_BUFFER_CHAR;
1367 b->yy_buf_pos = &b->yy_ch_buf[0];
1370 b->yy_buffer_status = YY_BUFFER_NEW;
1372 if ( b == yy_current_buffer )
1373 yy_load_buffer_state();
1377 #ifndef YY_NO_SCAN_BUFFER
1378 #ifdef YY_USE_PROTOS
1379 YY_BUFFER_STATE yy_scan_buffer( char *base, yy_size_t size )
1381 YY_BUFFER_STATE yy_scan_buffer( base, size )
1389 base[size-2] != YY_END_OF_BUFFER_CHAR ||
1390 base[size-1] != YY_END_OF_BUFFER_CHAR )
1391 /* They forgot to leave room for the EOB's. */
1394 b = (YY_BUFFER_STATE) yy_flex_alloc( sizeof( struct yy_buffer_state ) );
1396 YY_FATAL_ERROR( "out of dynamic memory in yy_scan_buffer()" );
1398 b->yy_buf_size = size - 2; /* "- 2" to take care of EOB's */
1399 b->yy_buf_pos = b->yy_ch_buf = base;
1400 b->yy_is_our_buffer = 0;
1401 b->yy_input_file = 0;
1402 b->yy_n_chars = b->yy_buf_size;
1403 b->yy_is_interactive = 0;
1405 b->yy_fill_buffer = 0;
1406 b->yy_buffer_status = YY_BUFFER_NEW;
1408 yy_switch_to_buffer( b );
1415 #ifndef YY_NO_SCAN_STRING
1416 #ifdef YY_USE_PROTOS
1417 YY_BUFFER_STATE yy_scan_string( yyconst char *yy_str )
1419 YY_BUFFER_STATE yy_scan_string( yy_str )
1420 yyconst char *yy_str;
1424 for ( len = 0; yy_str[len]; ++len )
1427 return yy_scan_bytes( yy_str, len );
1432 #ifndef YY_NO_SCAN_BYTES
1433 #ifdef YY_USE_PROTOS
1434 YY_BUFFER_STATE yy_scan_bytes( yyconst char *bytes, int len )
1436 YY_BUFFER_STATE yy_scan_bytes( bytes, len )
1437 yyconst char *bytes;
1446 /* Get memory for full buffer, including space for trailing EOB's. */
1448 buf = (char *) yy_flex_alloc( n );
1450 YY_FATAL_ERROR( "out of dynamic memory in yy_scan_bytes()" );
1452 for ( i = 0; i < len; ++i )
1455 buf[len] = buf[len+1] = YY_END_OF_BUFFER_CHAR;
1457 b = yy_scan_buffer( buf, n );
1459 YY_FATAL_ERROR( "bad buffer in yy_scan_bytes()" );
1461 /* It's okay to grow etc. this buffer, and we should throw it
1462 * away when we're done.
1464 b->yy_is_our_buffer = 1;
1471 #ifndef YY_NO_PUSH_STATE
1472 #ifdef YY_USE_PROTOS
1473 static void yy_push_state( int new_state )
1475 static void yy_push_state( new_state )
1479 if ( yy_start_stack_ptr >= yy_start_stack_depth )
1483 yy_start_stack_depth += YY_START_STACK_INCR;
1484 new_size = yy_start_stack_depth * sizeof( int );
1486 if ( ! yy_start_stack )
1487 yy_start_stack = (int *) yy_flex_alloc( new_size );
1490 yy_start_stack = (int *) yy_flex_realloc(
1491 (void *) yy_start_stack, new_size );
1493 if ( ! yy_start_stack )
1495 "out of memory expanding start-condition stack" );
1498 yy_start_stack[yy_start_stack_ptr++] = YY_START;
1505 #ifndef YY_NO_POP_STATE
1506 static void yy_pop_state()
1508 if ( --yy_start_stack_ptr < 0 )
1509 YY_FATAL_ERROR( "start-condition stack underflow" );
1511 BEGIN(yy_start_stack[yy_start_stack_ptr]);
1516 #ifndef YY_NO_TOP_STATE
1517 static int yy_top_state()
1519 return yy_start_stack[yy_start_stack_ptr - 1];
1523 #ifndef YY_EXIT_FAILURE
1524 #define YY_EXIT_FAILURE 2
1527 #ifdef YY_USE_PROTOS
1528 static void yy_fatal_error( yyconst char msg[] )
1530 static void yy_fatal_error( msg )
1534 (void) fprintf( stderr, "%s\n", msg );
1535 exit( YY_EXIT_FAILURE );
1540 /* Redefine yyless() so it works in section 3 code. */
1546 /* Undo effects of setting up yytext. */ \
1547 yytext[yyleng] = yy_hold_char; \
1548 yy_c_buf_p = yytext + n; \
1549 yy_hold_char = *yy_c_buf_p; \
1550 *yy_c_buf_p = '\0'; \
1556 /* Internal utility routines. */
1559 #ifdef YY_USE_PROTOS
1560 static void yy_flex_strncpy( char *s1, yyconst char *s2, int n )
1562 static void yy_flex_strncpy( s1, s2, n )
1569 for ( i = 0; i < n; ++i )
1574 #ifdef YY_NEED_STRLEN
1575 #ifdef YY_USE_PROTOS
1576 static int yy_flex_strlen( yyconst char *s )
1578 static int yy_flex_strlen( s )
1583 for ( n = 0; s[n]; ++n )
1591 #ifdef YY_USE_PROTOS
1592 static void *yy_flex_alloc( yy_size_t size )
1594 static void *yy_flex_alloc( size )
1598 return (void *) malloc( size );
1601 #ifdef YY_USE_PROTOS
1602 static void *yy_flex_realloc( void *ptr, yy_size_t size )
1604 static void *yy_flex_realloc( ptr, size )
1609 /* The cast to (char *) in the following accommodates both
1610 * implementations that use char* generic pointers, and those
1611 * that use void* generic pointers. It works with the latter
1612 * because both ANSI C and C++ allow castless assignment from
1613 * any pointer type to void*, and deal with argument conversions
1614 * as though doing an assignment.
1616 return (void *) realloc( (char *) ptr, size );
1619 #ifdef YY_USE_PROTOS
1620 static void yy_flex_free( void *ptr )
1622 static void yy_flex_free( ptr )
1636 #line 99 "pool_config.l"
1639 int pool_init_config(void)
1642 static char localhostname[256];
1645 pool_config = malloc(sizeof(POOL_CONFIG));
1646 if (pool_config == NULL)
1648 pool_error("failed to allocate pool_config");
1652 memset(pool_config, 0, sizeof(POOL_CONFIG));
1654 pool_config->backend_desc = pool_shared_memory_create(sizeof(BackendDesc));
1655 if (pool_config->backend_desc == NULL)
1657 pool_error("failed to allocate pool_config->backend_desc");
1661 /* set hardcoded default values */
1662 pool_config->listen_addresses = "localhost";
1663 pool_config->port = 9999;
1664 pool_config->pcp_port = 9898;
1665 pool_config->socket_dir = DEFAULT_SOCKET_DIR;
1666 pool_config->pcp_socket_dir = DEFAULT_SOCKET_DIR;
1667 pool_config->backend_socket_dir = DEFAULT_SOCKET_DIR;
1668 pool_config->pcp_timeout = 10;
1669 pool_config->num_init_children = 32;
1670 pool_config->max_pool = 4;
1671 pool_config->child_life_time = 300;
1672 pool_config->client_idle_limit = 0;
1673 pool_config->connection_life_time = 0;
1674 pool_config->child_max_connections = 0;
1675 pool_config->authentication_timeout = 60;
1676 pool_config->logdir = DEFAULT_LOGDIR;
1677 pool_config->pid_file_name = DEFAULT_PID_FILE_NAME;
1678 pool_config->log_statement = 0;
1679 pool_config->log_connections = 0;
1680 pool_config->log_hostname = 0;
1681 pool_config->enable_pool_hba = 0;
1683 pool_config->replication_mode = 0;
1684 pool_config->load_balance_mode = 0;
1685 pool_config->replication_stop_on_mismatch = 0;
1686 pool_config->replicate_select = 0;
1687 pool_config->reset_query_list = default_reset_query_list;
1688 pool_config->num_reset_queries = sizeof(default_reset_query_list)/sizeof(char *);
1689 pool_config->reset_query_list = default_reset_query_list;
1690 pool_config->print_timestamp = 1;
1691 pool_config->master_slave_mode = 0;
1692 pool_config->connection_cache = 1;
1693 pool_config->health_check_timeout = 20;
1694 pool_config->health_check_period = 0;
1695 pool_config->health_check_user = "nobody";
1696 pool_config->failover_command = "";
1697 pool_config->failback_command = "";
1698 pool_config->insert_lock = 1;
1699 pool_config->ignore_leading_white_space = 1;
1700 pool_config->parallel_mode = 0;
1701 pool_config->enable_query_cache = 0;
1702 pool_config->system_db_hostname = "localhost";
1703 pool_config->system_db_port = 5432;
1704 pool_config->system_db_dbname = "pgpool";
1705 pool_config->system_db_schema = "pgpool_catalog";
1706 pool_config->system_db_user = "pgpool";
1707 pool_config->system_db_password = "";
1708 pool_config->backend_desc->num_backends = 0;
1709 pool_config->recovery_user = "";
1710 pool_config->recovery_password = "";
1711 pool_config->recovery_1st_stage_command = "";
1712 pool_config->recovery_2nd_stage_command = "";
1713 pool_config->recovery_timeout = 90;
1714 pool_config->client_idle_limit_in_recovery = 0;
1716 res = gethostname(localhostname,sizeof(localhostname));
1719 pool_debug("faild to get this hostname");
1721 pool_config->pgpool2_hostname = localhostname;
1723 for (i=0;i<MAX_CONNECTION_SLOTS;i++)
1725 clear_host_entry(i);
1730 int pool_get_config(char *confpath, POOL_CONFIG_CONTEXT context)
1735 double total_weight;
1738 #define PARSE_ERROR() pool_error("pool_config: parse error at line %d '%s'", Lineno, yytext)
1740 /* open config file */
1741 fd = fopen(confpath, "r");
1744 fprintf(stderr, "pool_config: could not open configuration file (%s)\n",
1745 POOL_CONF_FILE_NAME);
1746 fprintf(stderr, "pool_config: using default values...\n");
1753 while ((token = yylex()))
1755 if (token == POOL_PARSE_ERROR)
1761 if (token == POOL_EOL)
1764 if (token != POOL_KEY)
1771 strncpy(key, yytext, sizeof(key));
1773 pool_debug("key: %s", key);
1777 if (token == POOL_EQUALS)
1780 pool_debug("value: %s kind: %d", yytext, token);
1782 if (!strcmp(key, "allow_inet_domain_socket") && CHECK_CONTEXT(INIT_CONFIG, context))
1784 /* for backward compatibility */
1785 int v = eval_logical(yytext);
1789 pool_error("pool_config: invalid value %s for %s", yytext, key);
1794 pool_config->listen_addresses = strdup("*");
1796 pool_config->listen_addresses = strdup("");
1798 else if (!strcmp(key, "listen_addresses") && CHECK_CONTEXT(INIT_CONFIG, context))
1802 if (token != POOL_STRING && token != POOL_UNQUOTED_STRING && token != POOL_KEY)
1808 str = extract_string(yytext, token);
1814 pool_config->listen_addresses = str;
1817 else if (!strcmp(key, "port") && CHECK_CONTEXT(INIT_CONFIG, context))
1819 int v = atoi(yytext);
1821 if (token != POOL_INTEGER || v < 1024)
1823 pool_error("pool_config: %s must be 1024 or higher numeric value", key);
1827 pool_config->port = v;
1829 else if (!strcmp(key, "pcp_port") && CHECK_CONTEXT(INIT_CONFIG, context))
1831 int v = atoi(yytext);
1833 if (token != POOL_INTEGER || v < 1024)
1835 pool_error("pool_config: %s must be 1024 or higher numeric value", key);
1839 pool_config->pcp_port = v;
1841 else if (!strcmp(key, "socket_dir") && CHECK_CONTEXT(INIT_CONFIG, context))
1845 if (token != POOL_STRING && token != POOL_UNQUOTED_STRING && token != POOL_KEY)
1851 str = extract_string(yytext, token);
1857 pool_config->socket_dir = str;
1859 else if (!strcmp(key, "pcp_socket_dir") && CHECK_CONTEXT(INIT_CONFIG, context))
1863 if (token != POOL_STRING && token != POOL_UNQUOTED_STRING && token != POOL_KEY)
1869 str = extract_string(yytext, token);
1875 pool_config->pcp_socket_dir = str;
1877 else if (!strcmp(key, "pcp_timeout") &&
1878 CHECK_CONTEXT(INIT_CONFIG|RELOAD_CONFIG, context))
1880 int v = atoi(yytext);
1882 if (token != POOL_INTEGER || v < 0)
1884 pool_error("pool_config: %s must be equal or greater or equal to 0 numeric value", key);
1888 pool_config->pcp_timeout = v;
1890 else if (!strcmp(key, "num_init_children") && CHECK_CONTEXT(INIT_CONFIG, context))
1892 int v = atoi(yytext);
1894 if (token != POOL_INTEGER || v < 1)
1896 pool_error("pool_config: %s must be higher than 1 numeric value", key);
1900 pool_config->num_init_children = v;
1902 else if (!strcmp(key, "child_life_time") &&
1903 CHECK_CONTEXT(INIT_CONFIG|RELOAD_CONFIG, context))
1905 int v = atoi(yytext);
1907 if (token != POOL_INTEGER || v < 0)
1909 pool_error("pool_config: %s must be greater or equal to 0 numeric value", key);
1913 pool_config->child_life_time = v;
1915 else if (!strcmp(key, "client_idle_limit") &&
1916 CHECK_CONTEXT(INIT_CONFIG|RELOAD_CONFIG, context))
1918 int v = atoi(yytext);
1920 if (token != POOL_INTEGER || v < 0)
1922 pool_error("pool_config: %s must be greater or equal to 0 numeric value", key);
1926 pool_config->client_idle_limit = v;
1928 else if (!strcmp(key, "connection_life_time") &&
1929 CHECK_CONTEXT(INIT_CONFIG|RELOAD_CONFIG, context))
1931 int v = atoi(yytext);
1933 if (token != POOL_INTEGER || v < 0)
1935 pool_error("pool_config: %s must be greater or equal to 0 numeric value", key);
1939 pool_config->connection_life_time = v;
1941 else if (!strcmp(key, "child_max_connections") &&
1942 CHECK_CONTEXT(INIT_CONFIG|RELOAD_CONFIG, context))
1944 int v = atoi(yytext);
1946 if (token != POOL_INTEGER || v < 0)
1948 pool_error("pool_config: %s must be greater or equal to 0 numeric value", key);
1952 pool_config->child_max_connections = v;
1954 else if (!strcmp(key, "authentication_timeout") &&
1955 CHECK_CONTEXT(INIT_CONFIG|RELOAD_CONFIG, context))
1957 int v = atoi(yytext);
1959 if (token != POOL_INTEGER || v < 0)
1961 pool_error("pool_config: %s must be higher than 0 numeric value", key);
1965 pool_config->authentication_timeout = v;
1967 else if (!strcmp(key, "max_pool") && CHECK_CONTEXT(INIT_CONFIG, context))
1969 int v = atoi(yytext);
1971 if (token != POOL_INTEGER || v < 0)
1973 pool_error("pool_config: %s must be greater or equal to 0 numeric value", key);
1977 pool_config->max_pool = v;
1979 else if (!strcmp(key, "logdir") && CHECK_CONTEXT(INIT_CONFIG, context))
1983 if (token != POOL_STRING && token != POOL_UNQUOTED_STRING && token != POOL_KEY)
1989 str = extract_string(yytext, token);
1995 pool_config->logdir = str;
1997 else if (!strcmp(key, "pid_file_name") && CHECK_CONTEXT(INIT_CONFIG, context))
2001 if (token != POOL_STRING && token != POOL_UNQUOTED_STRING && token != POOL_KEY)
2007 str = extract_string(yytext, token);
2013 pool_config->pid_file_name = str;
2015 else if (!strcmp(key, "log_connections") &&
2016 CHECK_CONTEXT(INIT_CONFIG|RELOAD_CONFIG, context))
2018 int v = eval_logical(yytext);
2022 pool_error("pool_config: invalid value %s for %s", yytext, key);
2026 pool_config->log_connections = v;
2028 else if (!strcmp(key, "log_hostname") &&
2029 CHECK_CONTEXT(INIT_CONFIG|RELOAD_CONFIG, context))
2031 int v = eval_logical(yytext);
2035 pool_error("pool_config: invalid value %s for %s", yytext, key);
2039 pool_config->log_hostname = v;
2041 else if (!strcmp(key, "enable_pool_hba") &&
2042 CHECK_CONTEXT(INIT_CONFIG|RELOAD_CONFIG, context))
2044 int v = eval_logical(yytext);
2048 pool_error("pool_config: invalid value %s for %s", yytext, key);
2052 pool_config->enable_pool_hba = v;
2054 else if (!strcmp(key, "backend_socket_dir") && CHECK_CONTEXT(INIT_CONFIG, context))
2058 if (token != POOL_STRING && token != POOL_UNQUOTED_STRING && token != POOL_KEY)
2064 str = extract_string(yytext, token);
2070 pool_config->backend_socket_dir = str;
2072 else if (!strcmp(key, "replication_mode") && CHECK_CONTEXT(INIT_CONFIG, context))
2074 int v = eval_logical(yytext);
2078 pool_error("pool_config: invalid value %s for %s", yytext, key);
2082 pool_config->replication_mode = pool_config->replication_enabled = v;
2084 if (pool_config->master_slave_enabled && pool_config->replication_enabled)
2086 pool_error("pool_config: replication_mode and master_slave_mode cannot be enabled at the same time");
2092 else if (!strcmp(key, "load_balance_mode") && CHECK_CONTEXT(INIT_CONFIG, context))
2094 int v = eval_logical(yytext);
2098 pool_error("pool_config: invalid value %s for %s", yytext, key);
2102 pool_config->load_balance_mode = v;
2104 else if (!strcmp(key, "replication_stop_on_mismatch") &&
2105 CHECK_CONTEXT(INIT_CONFIG|RELOAD_CONFIG, context))
2107 int v = eval_logical(yytext);
2111 pool_error("pool_config: invalid value %s for %s", yytext, key);
2115 pool_debug("replication_stop_on_mismatch: %d", v);
2116 pool_config->replication_stop_on_mismatch = v;
2118 else if (!strcmp(key, "replicate_select") &&
2119 CHECK_CONTEXT(INIT_CONFIG|RELOAD_CONFIG, context))
2121 int v = eval_logical(yytext);
2125 pool_error("pool_config: invalid value %s for %s", yytext, key);
2129 pool_debug("replicate_select: %d", v);
2130 pool_config->replicate_select = v;
2132 else if (!strcmp(key, "reset_query_list") &&
2133 CHECK_CONTEXT(INIT_CONFIG|RELOAD_CONFIG, context))
2137 if (token != POOL_STRING && token != POOL_UNQUOTED_STRING && token != POOL_KEY)
2143 str = extract_string(yytext, token);
2149 pool_config->reset_query_list = extract_string_tokens(str, ";", &pool_config->num_reset_queries);
2150 if (pool_config->reset_query_list == NULL)
2157 else if (!strcmp(key, "print_timestamp") && CHECK_CONTEXT(INIT_CONFIG, context))
2159 int v = eval_logical(yytext);
2163 pool_error("pool_config: invalid value %s for %s", yytext, key);
2167 pool_config->print_timestamp = v;
2170 else if (!strcmp(key, "master_slave_mode") && CHECK_CONTEXT(INIT_CONFIG, context))
2172 int v = eval_logical(yytext);
2176 pool_error("pool_config: invalid value %s for %s", yytext, key);
2180 pool_config->master_slave_mode = pool_config->master_slave_enabled = v;
2182 if (pool_config->master_slave_enabled && pool_config->replication_enabled)
2184 pool_error("pool_config: replication_mode and master_slave_mode cannot be enabled at the same time");
2190 else if (!strcmp(key, "connection_cache") && CHECK_CONTEXT(INIT_CONFIG, context))
2192 int v = eval_logical(yytext);
2196 pool_error("pool_config: invalid value %s for %s", yytext, key);
2200 pool_config->connection_cache = v;
2203 else if (!strcmp(key, "health_check_timeout") &&
2204 CHECK_CONTEXT(INIT_CONFIG|RELOAD_CONFIG, context))
2206 int v = atoi(yytext);
2208 if (token != POOL_INTEGER || v < 0)
2210 pool_error("pool_config: %s must be equal or higher than 0 numeric value", key);
2214 pool_config->health_check_timeout = v;
2217 else if (!strcmp(key, "health_check_period") &&
2218 CHECK_CONTEXT(INIT_CONFIG|RELOAD_CONFIG, context))
2220 int v = atoi(yytext);
2222 if (token != POOL_INTEGER || v < 0)
2224 pool_error("pool_config: %s must be equal or higher than 0 numeric value", key);
2228 pool_config->health_check_period = v;
2231 else if (!strcmp(key, "health_check_user") &&
2232 CHECK_CONTEXT(INIT_CONFIG|RELOAD_CONFIG, context))
2236 if (token != POOL_STRING && token != POOL_UNQUOTED_STRING && token != POOL_KEY)
2242 str = extract_string(yytext, token);
2248 pool_config->health_check_user = str;
2251 else if (!strcmp(key, "failover_command") &&
2252 CHECK_CONTEXT(INIT_CONFIG|RELOAD_CONFIG, context))
2256 if (token != POOL_STRING && token != POOL_UNQUOTED_STRING && token != POOL_KEY)
2262 str = extract_string(yytext, token);
2268 pool_config->failover_command = str;
2271 else if (!strcmp(key, "failback_command") &&
2272 CHECK_CONTEXT(INIT_CONFIG|RELOAD_CONFIG, context))
2276 if (token != POOL_STRING && token != POOL_UNQUOTED_STRING && token != POOL_KEY)
2282 str = extract_string(yytext, token);
2288 pool_config->failback_command = str;
2291 else if (!strcmp(key, "recovery_user") &&
2292 CHECK_CONTEXT(INIT_CONFIG|RELOAD_CONFIG, context))
2296 if (token != POOL_STRING && token != POOL_UNQUOTED_STRING && token != POOL_KEY)
2302 str = extract_string(yytext, token);
2308 pool_config->recovery_user = str;
2311 else if (!strcmp(key, "recovery_password") &&
2312 CHECK_CONTEXT(INIT_CONFIG|RELOAD_CONFIG, context))
2316 if (token != POOL_STRING && token != POOL_UNQUOTED_STRING && token != POOL_KEY)
2322 str = extract_string(yytext, token);
2328 pool_config->recovery_password = str;
2331 else if (!strcmp(key, "recovery_1st_stage_command") &&
2332 CHECK_CONTEXT(INIT_CONFIG|RELOAD_CONFIG, context))
2336 if (token != POOL_STRING && token != POOL_UNQUOTED_STRING && token != POOL_KEY)
2342 str = extract_string(yytext, token);
2348 pool_config->recovery_1st_stage_command = str;
2351 else if (!strcmp(key, "recovery_2nd_stage_command") &&
2352 CHECK_CONTEXT(INIT_CONFIG|RELOAD_CONFIG, context))
2356 if (token != POOL_STRING && token != POOL_UNQUOTED_STRING && token != POOL_KEY)
2362 str = extract_string(yytext, token);
2368 pool_config->recovery_2nd_stage_command = str;
2371 else if (!strcmp(key, "recovery_timeout") &&
2372 CHECK_CONTEXT(INIT_CONFIG|RELOAD_CONFIG, context))
2374 int v = atoi(yytext);
2376 if (token != POOL_INTEGER || v < 0)
2378 pool_error("pool_config: %s must be equal or higher than 0 numeric value", key);
2382 pool_config->recovery_timeout = v;
2385 else if (!strcmp(key, "client_idle_limit_in_recovery") &&
2386 CHECK_CONTEXT(INIT_CONFIG|RELOAD_CONFIG, context))
2388 int v = atoi(yytext);
2390 if (token != POOL_INTEGER || v < 0)
2392 pool_error("pool_config: %s must be greater or equal to 0 numeric value", key);
2396 pool_config->client_idle_limit_in_recovery = v;
2399 else if (!strcmp(key, "insert_lock") &&
2400 CHECK_CONTEXT(INIT_CONFIG|RELOAD_CONFIG, context))
2402 int v = eval_logical(yytext);
2406 pool_error("pool_config: invalid value %s for %s", yytext, key);
2410 pool_config->insert_lock = v;
2413 else if (!strcmp(key, "ignore_leading_white_space") &&
2414 CHECK_CONTEXT(INIT_CONFIG|RELOAD_CONFIG, context))
2416 int v = eval_logical(yytext);
2420 pool_error("pool_config: invalid value %s for %s", yytext, key);
2424 pool_config->ignore_leading_white_space = v;
2427 else if (!strcmp(key, "parallel_mode") && CHECK_CONTEXT(INIT_CONFIG, context))
2429 int v = eval_logical(yytext);
2433 pool_error("pool_config: invalid value %s for %s", yytext, key);
2437 pool_config->parallel_mode = v;
2440 else if (!strcmp(key, "enable_query_cache") && CHECK_CONTEXT(INIT_CONFIG, context))
2442 int v = eval_logical(yytext);
2446 pool_error("pool_config: invalid value %s for %s", yytext, key);
2450 pool_config->enable_query_cache = v;
2453 else if (!strcmp(key, "pgpool2_hostname") && CHECK_CONTEXT(INIT_CONFIG, context))
2457 if (token != POOL_STRING && token != POOL_UNQUOTED_STRING && token != POOL_KEY)
2463 str = extract_string(yytext, token);
2470 pool_config->pgpool2_hostname = str;
2473 else if (!strcmp(key, "system_db_hostname") && CHECK_CONTEXT(INIT_CONFIG, context))
2477 if (token != POOL_STRING && token != POOL_UNQUOTED_STRING && token != POOL_KEY)
2483 str = extract_string(yytext, token);
2489 pool_config->system_db_hostname = str;
2492 else if (!strcmp(key, "system_db_port") && CHECK_CONTEXT(INIT_CONFIG, context))
2494 int v = atoi(yytext);
2496 if (token != POOL_INTEGER || v < 0)
2498 pool_error("pool_config: %s must be equal or higher than 0 numeric value", key);
2502 pool_config->system_db_port = v;
2505 else if (!strcmp(key, "system_db_dbname") && CHECK_CONTEXT(INIT_CONFIG, context))
2509 if (token != POOL_STRING && token != POOL_UNQUOTED_STRING && token != POOL_KEY)
2515 str = extract_string(yytext, token);
2521 pool_config->system_db_dbname = str;
2524 else if (!strcmp(key, "system_db_schema") && CHECK_CONTEXT(INIT_CONFIG, context))
2528 if (token != POOL_STRING && token != POOL_UNQUOTED_STRING && token != POOL_KEY)
2534 str = extract_string(yytext, token);
2540 pool_config->system_db_schema = str;
2543 else if (!strcmp(key, "system_db_user") && CHECK_CONTEXT(INIT_CONFIG, context))
2547 if (token != POOL_STRING && token != POOL_UNQUOTED_STRING && token != POOL_KEY)
2553 str = extract_string(yytext, token);
2559 pool_config->system_db_user = str;
2562 else if (!strcmp(key, "system_db_password") && CHECK_CONTEXT(INIT_CONFIG, context))
2566 if (token != POOL_STRING && token != POOL_UNQUOTED_STRING && token != POOL_KEY)
2572 str = extract_string(yytext, token);
2578 pool_config->system_db_password = str;
2581 else if (!strncmp(key, "backend_hostname", 16) &&
2582 CHECK_CONTEXT(INIT_CONFIG|RELOAD_CONFIG, context) &&
2583 mypid == getpid()) /* this parameter must be modified by parent pid */
2588 slot = atoi(key + 16);
2589 if (slot < 0 || slot >= MAX_CONNECTION_SLOTS)
2591 pool_error("pool_config: backend number %s for backend_hostname out of range", key);
2596 str = extract_string(yytext, token);
2602 if (context == INIT_CONFIG ||
2603 (context == RELOAD_CONFIG && BACKEND_INFO(slot).backend_status == CON_UNUSED))
2604 strncpy(BACKEND_INFO(slot).backend_hostname, str, MAX_DB_HOST_NAMELEN);
2607 else if (!strncmp(key, "backend_port", 12) &&
2608 CHECK_CONTEXT(INIT_CONFIG|RELOAD_CONFIG, context) &&
2609 mypid == getpid()) /* this parameter must be modified by parent pid */
2613 slot = atoi(key + 12);
2614 if (slot < 0 || slot >= MAX_CONNECTION_SLOTS)
2616 pool_error("pool_config: host number %s for port number out of range", key);
2620 pool_debug("pool_config: port slot number %d ", slot);
2621 if (context == INIT_CONFIG)
2623 BACKEND_INFO(slot).backend_port = atoi(yytext);
2624 BACKEND_INFO(slot).backend_status = CON_CONNECT_WAIT;
2626 else if (context == RELOAD_CONFIG && BACKEND_INFO(slot).backend_status == CON_UNUSED)
2628 BACKEND_INFO(slot).backend_port = atoi(yytext);
2629 BACKEND_INFO(slot).backend_status = CON_DOWN;
2633 else if (!strncmp(key, "backend_weight", 14) &&
2634 CHECK_CONTEXT(INIT_CONFIG|RELOAD_CONFIG, context) &&
2635 mypid == getpid()) /* this parameter must be modified by parent pid */
2639 BACKEND_STATUS status;
2641 slot = atoi(key + 14);
2642 if (slot < 0 || slot >= MAX_CONNECTION_SLOTS)
2644 pool_error("pool_config: weight number %s for port number out of range", key);
2653 pool_error("pool_config: invalid value %s for %s", yytext, key);
2658 pool_debug("pool_config: weight slot number %d weight: %f", slot, v);
2659 status = BACKEND_INFO(slot).backend_status;
2660 if (context == INIT_CONFIG ||
2661 (context == RELOAD_CONFIG && (context == RELOAD_CONFIG && (status == CON_UNUSED || status == CON_DOWN))))
2663 pool_config->backend_desc->backend_info[slot].unnormalized_weight = v;
2666 else if (!strncmp(key, "backend_data_directory", 22) &&
2667 CHECK_CONTEXT(INIT_CONFIG|RELOAD_CONFIG, context) &&
2668 mypid == getpid()) /* this parameter must be modified by parent pid */
2672 BACKEND_STATUS status;
2674 slot = atoi(key + 22);
2675 if (slot < 0 || slot >= MAX_CONNECTION_SLOTS)
2677 pool_error("pool_config: backend number %s for backend_data_directory out of range", key);
2682 str = extract_string(yytext, token);
2688 status = BACKEND_INFO(slot).backend_status;
2689 if (context == INIT_CONFIG ||
2690 (context == RELOAD_CONFIG && (status == CON_UNUSED || status == CON_DOWN)))
2691 strncpy(BACKEND_INFO(slot).backend_data_directory, str, MAX_PATH_LENGTH);
2693 else if (!strcmp(key, "log_statement") && CHECK_CONTEXT(INIT_CONFIG|RELOAD_CONFIG, context))
2695 int v = eval_logical(yytext);
2699 pool_error("pool_config: invalid value %s for %s", yytext, key);
2702 pool_config->log_statement = v;
2704 else if (!strcmp(key, "log_statement") && CHECK_CONTEXT(INIT_CONFIG|RELOAD_CONFIG, context))
2706 int v = eval_logical(yytext);
2710 pool_error("pool_config: invalid value %s for %s", yytext, key);
2713 pool_config->log_statement = v;
2719 pool_config->backend_desc->num_backends = 0;
2722 for (i=0;i<MAX_CONNECTION_SLOTS;i++)
2724 /* port number == 0 indicates that this server is out of use */
2725 if (BACKEND_INFO(i).backend_port == 0)
2727 clear_host_entry(i);
2732 total_weight += BACKEND_INFO(i).unnormalized_weight;
2733 pool_config->backend_desc->num_backends = i+1;
2737 pool_debug("num_backends: %d num_backends: %d total_weight: %f",
2738 pool_config->backend_desc->num_backends, pool_config->backend_desc->num_backends, total_weight);
2740 * Normalize load balacing weights. What we are doing here is,
2741 * assign 0 to RAND_MAX to each backend's weight according to the
2742 * value weightN. For example, if two backends are assigned 1.0,
2743 * then each backend will get RAND_MAX/2 normalized weight.
2745 for (i=0;i<MAX_CONNECTION_SLOTS;i++)
2748 print_host_entry(i);
2751 if (pool_config->backend_desc->backend_info[i].backend_port != 0)
2753 pool_config->backend_desc->backend_info[i].backend_weight =
2754 (RAND_MAX) * pool_config->backend_desc->backend_info[i].unnormalized_weight / total_weight;
2755 pool_debug("backend %d weight: %f", i, pool_config->backend_desc->backend_info[i].backend_weight);
2759 if (pool_config->parallel_mode || pool_config->enable_query_cache)
2764 system_db_info = malloc(sizeof(POOL_SYSTEMDB_CONNECTION_POOL));
2765 if (system_db_info == NULL)
2767 pool_error("failed to allocate sytem_db_info");
2770 memset(system_db_info, 0, sizeof(*system_db_info));
2772 system_db_info->system_db_status = pool_shared_memory_create(sizeof(BACKEND_STATUS));
2773 if (system_db_info->system_db_status == NULL)
2775 pool_error("failed to allocate system_db_info->system_db_status");
2778 *system_db_info->system_db_status = CON_CONNECT_WAIT; /* which is the same as SYSDB_STATUS = CON_CONNECT_WAIT */
2780 info = malloc(sizeof(SystemDBInfo));
2783 pool_error("failed to allocate info");
2787 system_db_info->info = info;
2788 info->hostname = pool_config->system_db_hostname;
2789 info->port = pool_config->system_db_port;
2790 info->user = pool_config->system_db_user;
2791 info->password = pool_config->system_db_password;
2792 info->database_name = pool_config->system_db_dbname;
2793 info->schema_name = pool_config->system_db_schema;
2794 info->dist_def_num = 0;
2795 info->dist_def_slot = NULL;
2797 if (pool_config->parallel_mode)
2799 dist_num = pool_memset_system_db_info(info);
2802 pool_error("failed to get systemdb info");
2806 if (pool_config->enable_query_cache)
2808 info->query_cache_table_info.register_prepared_statement = NULL;
2809 if (! pool_query_cache_table_exists())
2811 pool_error("failed to locate query_cache table. perhaps it's not defined?");
2815 SYSDB_STATUS = CON_UP;
2821 static char *extract_string(char *value, POOL_TOKEN token)
2825 ret = strdup(value);
2828 pool_error("extract_string: out of memory");
2832 if (token == POOL_STRING)
2834 ret[strlen(ret)-1] = '\0';
2840 static int eval_logical(char *str)
2844 if (!strcasecmp(str, "true"))
2846 else if (!strcasecmp(str, "false"))
2848 else if (!strcmp(str, "1"))
2850 else if (!strcmp(str, "0"))
2859 * extract tokens separated by delimi from str. return value is an
2860 * array of pointers to malloced strings. number of tokens is set to
2861 * n; note that str will be destroyed by strtok(). Also return value
2862 * points to static data, that means subsequent call will change the
2865 #define MAXTOKENS 1024
2866 static char **extract_string_tokens(char *str, char *delimi, int *n)
2869 static char *tokens[MAXTOKENS];
2873 for (token = strtok(str, delimi); token != NULL && *n < MAXTOKENS; token = strtok(NULL, delimi))
2875 tokens[*n] = strdup(token);
2876 if (tokens[*n] == NULL)
2878 pool_error("extract_string_tokens: out of memory");
2881 pool_debug("extract_string_tokens: token: %s", tokens[*n]);
2887 static void clear_host_entry(int slot)
2889 *pool_config->backend_desc->backend_info[slot].backend_hostname = '\0';
2890 pool_config->backend_desc->backend_info[slot].backend_port = 0;
2891 pool_config->backend_desc->backend_info[slot].backend_status = CON_UNUSED;
2892 pool_config->backend_desc->backend_info[slot].backend_weight = 0.0;
2896 static void print_host_entry(int slot)
2898 pool_debug("slot: %d host: %s port: %d status: %d weight: %f",
2900 pool_config->server_hostnames[slot],
2901 pool_config->server_ports[slot],
2902 pool_config->server_status[slot],
2903 pool_config->server_weights[slot]);