Skip to content

bpf_printk: breaking skeleton generation #155

@mimullin-bbry

Description

@mimullin-bbry

The following patch breaks compilation of examples

diff --git a/examples/runqslower/src/bpf/runqslower.bpf.c b/examples/runqslower/src/bpf/runqslower.bpf.c
index cf821da..eca67ff 100644
--- a/examples/runqslower/src/bpf/runqslower.bpf.c
+++ b/examples/runqslower/src/bpf/runqslower.bpf.c
@@ -56,6 +56,7 @@ int handle__sched_wakeup(u64 *ctx)
        /* TP_PROTO(struct task_struct *p) */
        struct task_struct *p = (void *)ctx[0];

+       bpf_printk("this causes an error, but shouldn't");
        return trace_enqueue(p->tgid, p->pid);
 }

The following is observed during a cargo build


   Compiling capable v0.1.0 (/code/libbpf-rs-mainline/examples/capable)
error: failed to run custom build command for `runqslower v0.1.0 (/code/libbpf-rs-mainline/examples/runqslower)`

Caused by:
  process didn't exit successfully: `/code/libbpf-rs-mainline/target/debug/build/runqslower-b81ac9d4cca6e1bc/build-script-build` (exit status: 101)
  --- stderr
  Warning: unrecognized map: .maps
  Warning: unrecognized map: license
  error: expected `:`, found `.`
     --> <stdin>:167:29
      |
  167 |     pub handle__sched_wakeup.____fmt: [i8; 36],
      |                             ^ expected `:`

  thread 'main' panicked at 'called `Result::unwrap()` on an `Err` value: Generate("Failed to generate skeleton for /tmp/.tmpizMHT9/runqslower.o: Failed to rustfmt: exit status: 1")', examples/runqslower/build.rs:19:47
  note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
warning: build failed, waiting for other jobs to finish...
error: build failed

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions