reduce the use of stack in BPF programs
See for the
discussion.
@@ -390,9 +390,9 @@ int %s(struct pt_regs *ctx) {
arg_type = arg['type']
if arg_name in appdata_field_set:
- c += " // %s %s (appdata)\n" % (arg_type, arg_name)
+ c += " { // %s %s (appdata)\n" % (arg_type, arg_name)
else:
- c += " // %s %s\n" % (arg_type, arg_name)
+ c += " { // %s %s\n" % (arg_type, arg_name)
if is_str_type(arg_type) or is_bin_type(arg_type):
c += " bpf_usdt_readarg(%d, ctx, &buf);\n" % (i+1)
@@ -428,6 +428,7 @@ int %s(struct pt_regs *ctx) {
c += " bpf_usdt_readarg(%d, ctx, &event.%s.%s);\n" % (i + 1, probe_name, arg_name)
else:
c += " bpf_usdt_readarg(%d, ctx, &event.%s.%s);\n" % (i + 1, probe_name, arg_name)
+ c += " }\n"
if fully_specified_probe_name == "h2o:send_response_header":
# handle -s option
c += r"""
