0001-Disable-use-of-__NR_io_getevents-when-not-defined.patch 1.3 KB

123456789101112131415161718192021222324252627282930313233343536
  1. From 771dd6aa45dd0bbbb7d7c7a7b116e1b5666fbd7a Mon Sep 17 00:00:00 2001
  2. From: Khem Raj <raj.khem@gmail.com>
  3. Date: Sun, 15 Nov 2020 18:05:48 -0800
  4. Subject: [PATCH] Disable use of __NR_io_getevents when not defined
  5. Architectures like riscv32 do not define this syscall, therefore return
  6. ENOSYS on such architectures
  7. Upstream-Status: Submitted [https://github.com/smuellerDD/libkcapi/pull/100]
  8. Signed-off-by: Khem Raj <raj.khem@gmail.com>
  9. ---
  10. lib/internal.h | 12 ++++++++++++
  11. 1 file changed, 12 insertions(+)
  12. --- a/lib/internal.h
  13. +++ b/lib/internal.h
  14. @@ -325,10 +325,17 @@ static inline int io_submit(aio_context_
  15. return syscall(__NR_io_submit, ctx, n, iocb);
  16. }
  17. -static inline int io_getevents(aio_context_t ctx, long min, long max,
  18. - struct io_event *events, struct timespec *timeout)
  19. +static inline int io_getevents(__attribute__((unused)) aio_context_t ctx,
  20. + __attribute__((unused)) long min,
  21. + __attribute__((unused)) long max,
  22. + __attribute__((unused)) struct io_event *events,
  23. + __attribute__((unused)) struct timespec *timeout)
  24. {
  25. +#ifdef __NR_io_getevents
  26. return syscall(__NR_io_getevents, ctx, min, max, events, timeout);
  27. +#else
  28. + return -ENOSYS;
  29. +#endif
  30. }
  31. /************************************************************