# Re: \[PATCH 01/17\] libtracefs: Added new API tracefs\_sql()

- From: Namhyung Kim \<namhyung@kernel.org\>
- Date: 2021-08-02 23:45:56 
- List: linux-rt-users
- Page: https://ratatoskr.run/linux-rt-users/2021/08/1465904
- Thread: https://ratatoskr.run/linux-rt-users/2021/07/1463747/t.md

```text
Hi Steve,

On Fri, Jul 30, 2021 at 3:18 PM Steven Rostedt [ref] wrote:
>
> From: "Steven Rostedt (VMware)" <rostedt@goodmis.org>
>
> This adds the API tracefs_sql() that takes a tep_handle handler, a name,
> and a SQL string and parses it to produce a tracefs_synth synthetic event
> handler.
>
> Currently it only supports simple SQL of the type:
>
>   SELECT start.common_pid AS pid, end.common_timestamp.usecs AS usecs
>     FROM sched_waking AS start on sched_switch AS end
>     ON start.pid = end.next_pid
>
> Signed-off-by: Steven Rostedt (VMware) <rostedt@goodmis.org>
> ---

[SNIP]
> diff --git a/src/sqlhist.l b/src/sqlhist.l
> new file mode 100644
> index 000000000000..3f394f37b738
> --- /dev/null
> +++ b/src/sqlhist.l
> @@ -0,0 +1,88 @@
> +%{
> +/* code here */
> +
> +#include <stdarg.h>
> +#include "sqlhist-parse.h"
> +
> +extern int my_yyinput(char *buf, int max);
> +
> +#undef YY_INPUT
> +#define YY_INPUT(b, r, m) ({r = my_yyinput(b, m);})
> +
> +#define YY_NO_INPUT
> +#define YY_NO_UNPUT
> +
> +#define YY_EXTRA_TYPE struct sqlhist_bison *
> +
> +#define HANDLE_COLUMN do { sb->line_idx += strlen(yytext); } while (0)
> +
> +%}
> +
> +%option caseless
> +
> +field          [a-z_][a-z0-9_\.]*
> +qstring                \"[^\"]*\"
> +hexnum         0x[0-9a-z]+
> +number         [0-9a-z]+

Do you mean a-f ?

Thanks,
Namhyung
```
