prog_run.bpf.c 707 B

123456789101112131415161718192021222324252627282930313233
  1. /* SPDX-License-Identifier: GPL-2.0 */
  2. /*
  3. * A scheduler that validates that we can invoke sched_ext kfuncs in
  4. * BPF_PROG_TYPE_SYSCALL programs.
  5. *
  6. * Copyright (c) 2024 Meta Platforms, Inc. and affiliates.
  7. * Copyright (c) 2024 David Vernet <dvernet@meta.com>
  8. */
  9. #include <scx/common.bpf.h>
  10. UEI_DEFINE(uei);
  11. char _license[] SEC("license") = "GPL";
  12. SEC("syscall")
  13. int BPF_PROG(prog_run_syscall)
  14. {
  15. scx_bpf_create_dsq(0, -1);
  16. scx_bpf_exit(0xdeadbeef, "Exited from PROG_RUN");
  17. return 0;
  18. }
  19. void BPF_STRUCT_OPS(prog_run_exit, struct scx_exit_info *ei)
  20. {
  21. UEI_RECORD(uei, ei);
  22. }
  23. SEC(".struct_ops.link")
  24. struct sched_ext_ops prog_run_ops = {
  25. .exit = (void *) prog_run_exit,
  26. .name = "prog_run",
  27. };