5 * The contents of this file are subject to the terms of the
6 * Common Development and Distribution License, Version 1.0 only
7 * (the "License"). You may not use this file except in compliance
10 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
11 * or http://www.opensolaris.org/os/licensing.
12 * See the License for the specific language governing permissions
13 * and limitations under the License.
15 * When distributing Covered Code, include this CDDL HEADER in each
16 * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
17 * If applicable, add the following below this CDDL HEADER, with the
18 * fields enclosed by brackets "[]" replaced with your own identifying
19 * information: Portions Copyright [yyyy] [name of copyright owner]
23 * Copyright (c) 1994, by Sun Microsytems, Inc.
26 #pragma ident "%Z%%M% %I% %E% SMI"
74 #include <sys/types.h>
87 extern
void help_on_topic
(char *topic
);
88 extern
void help_on_command
(int cmd
);
89 extern boolean_t g_kernelmode
;
90 extern tnfctl_handle_t
*g_hndl
;
92 void quit
(boolean_t killtarget
, boolean_t runtarget
);
93 extern
void help
(void);
94 extern
void process_cmd
(tnfctl_handle_t
*hndl
, cmd_t
*cmd
);
95 extern
void cmd_listtracefile
();
107 %type
<strval
> SETNAME FCNNAME IDENT VALSTR REGEXP
108 %type
<intval
> CONTINUE DISABLE ENABLE HELP LIST QUIT SOURCE TRACE UNTRACE BUFFER KTRACE PFILTER CLEAR CONNECT command
109 %type
<exprval
> expr exprlist
110 %type
<specval
> spec speclist
111 %type
<pidlistval
> pidlist
112 %type
<intval
> SCALED_INT singlepid
116 file
: statement_list
119 statement_list
: /* empty */ { prompt
(); }
120 | statement_list statement
123 prbk_warn_pfilter_empty
();
128 statement
: empty_statement
144 | listhistory_statement
145 | listtracefile_statement
147 | listprobes_statement
148 | listvalues_statement
149 |
error NL
{ yyerrok; }
155 command
: CONTINUE
{ $$
= $1; } /* user&kernel */
156 | DISABLE
{ $$
= $1; }
157 | ENABLE
{ $$
= $1; }
161 | SOURCE
{ $$
= $1; }
163 | UNTRACE
{ $$
= $1; }
164 | BUFFER
{ $$
= $1; } /* kernel only */
165 | KTRACE
{ $$
= $1; }
166 | PFILTER
{ $$
= $1; }
167 | CLEAR
{ $$
= $1; } /* user only */
168 | CONNECT
{ $$
= $1; }
171 help_statement
: HELP NL
{ help
(); }
172 | HELP command NL
{ help_on_command
($2); }
173 | HELP IDENT NL
{ help_on_topic
($2); }
176 continue_statement
: CONTINUE NL
178 if
(!g_kernelmode
) YYACCEPT;
182 quit_statement
: QUIT NL
{ quit
(B_TRUE
, B_TRUE
); }
183 | QUIT KILL NL
{ quit
(B_TRUE
, B_FALSE
); }
184 | QUIT RESUME NL
{ quit
(B_FALSE
, B_TRUE
); }
185 | QUIT SUSPEND NL
{ quit
(B_FALSE
, B_FALSE
); }
188 enable_statement
: ENABLE SETNAME NL
191 cmd_p
= cmd_set
($2, CMD_ENABLE
, NULL
);
193 process_cmd
(g_hndl
, cmd_p
);
198 cmd_p
= cmd_expr
($2, CMD_ENABLE
, NULL
);
200 process_cmd
(g_hndl
, cmd_p
);
204 disable_statement
: DISABLE SETNAME NL
207 cmd_p
= cmd_set
($2, CMD_DISABLE
, NULL
);
209 process_cmd
(g_hndl
, cmd_p
);
211 | DISABLE exprlist NL
214 cmd_p
= cmd_expr
($2, CMD_DISABLE
, NULL
);
216 process_cmd
(g_hndl
, cmd_p
);
220 trace_statement
: TRACE SETNAME NL
223 cmd_p
= cmd_set
($2, CMD_TRACE
, NULL
);
225 process_cmd
(g_hndl
, cmd_p
);
230 cmd_p
= cmd_expr
($2, CMD_TRACE
, NULL
);
232 process_cmd
(g_hndl
, cmd_p
);
236 untrace_statement
: UNTRACE SETNAME NL
239 cmd_p
= cmd_set
($2, CMD_UNTRACE
, NULL
);
241 process_cmd
(g_hndl
, cmd_p
);
243 | UNTRACE exprlist NL
246 cmd_p
= cmd_expr
($2, CMD_UNTRACE
, NULL
);
248 process_cmd
(g_hndl
, cmd_p
);
252 connect_statement
: CONNECT FCNNAME SETNAME NL
255 cmd_p
= cmd_set
($3, CMD_CONNECT
, $2);
257 process_cmd
(g_hndl
, cmd_p
);
259 | CONNECT FCNNAME exprlist NL
262 cmd_p
= cmd_expr
($3, CMD_CONNECT
, $2);
264 process_cmd
(g_hndl
, cmd_p
);
268 clear_statement
: CLEAR SETNAME NL
271 cmd_p
= cmd_set
($2, CMD_CLEAR
, NULL
);
273 process_cmd
(g_hndl
, cmd_p
);
278 cmd_p
= cmd_expr
($2, CMD_CLEAR
, NULL
);
280 process_cmd
(g_hndl
, cmd_p
);
284 create_statement
: CREATE SETNAME exprlist NL
{ (void) set
($2, $3); }
285 | CREATE FCNNAME IDENT NL
{ fcn
($2, $3); }
288 source_statement
: SOURCE VALSTR NL
{ source_file
($2); }
289 | SOURCE IDENT NL
{ source_file
($2); }
292 listsets_statement
: LIST SETS NL
{ set_list
(); }
295 listhistory_statement
: LIST HISTORY NL
{ cmd_list
(); }
298 listtracefile_statement
: LIST TRACEFILE NL
{ cmd_listtracefile
(); }
301 listfcns_statement
: LIST FCNS NL
{ fcn_list
(); }
306 pfilter_statement
: PFILTER ON NL
307 { prbk_set_pfilter_mode
(B_TRUE
); }
309 { prbk_set_pfilter_mode
(B_FALSE
); }
310 | PFILTER ADD pidlist NL
311 { prbk_pfilter_add
($3); }
312 | PFILTER DELETE pidlist NL
313 { prbk_pfilter_drop
($3); }
315 { prbk_show_pfilter_mode
(); }
318 ktrace_statement
: KTRACE ON NL
319 { prbk_set_tracing
(B_TRUE
); }
321 { prbk_set_tracing
(B_FALSE
); }
323 { prbk_show_tracing
(); }
326 listprobes_statement
: LIST speclist PROBES SETNAME NL
327 { list_set
($2, $4); }
328 | LIST speclist PROBES exprlist NL
329 { list_expr
($2, $4); }
332 listvalues_statement
: LIST VALUES speclist NL
{ list_values
($3); }
335 exprlist
: /* empty */ { $$
= NULL
; }
336 | exprlist expr
{ $$
= expr_list
($1, $2); }
339 speclist
: /* empty */ { $$
= NULL
; }
340 | speclist spec
{ $$
= spec_list
($1, $2); }
343 expr
: spec EQ spec
{ $$
= expr
($1, $3); }
344 | spec
{ $$
= expr
(spec
(strdup
("keys"),
348 spec
: IDENT
{ $$
= spec
($1, SPEC_EXACT
); }
349 | VALSTR
{ $$
= spec
($1, SPEC_EXACT
); }
350 | REGEXP
{ $$
= spec
($1, SPEC_REGEXP
); }
353 pidlist
: pidlist COMMA singlepid
354 { $$
= prbk_pidlist_add
($1, $3); }
356 { $$
= prbk_pidlist_add
(NULL
, $1); }
359 singlepid
: SCALED_INT
362 buffer_statement
: BUFFER NL
368 extern
int g_outsize
;
369 prbk_buffer_alloc
(g_outsize
);
371 | BUFFER ALLOC SCALED_INT NL
373 prbk_buffer_alloc
($3);
377 prbk_buffer_dealloc
();