empty-eownerdead.c 956 B

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. #include "../config-host.h"
  2. /* SPDX-License-Identifier: MIT */
  3. /*
  4. * Test if entering with nothing to submit/wait for SQPOLL returns an error.
  5. */
  6. #include <stdio.h>
  7. #include <errno.h>
  8. #include <string.h>
  9. #include "liburing.h"
  10. #include "helpers.h"
  11. #include "../src/syscall.h"
  12. int main(int argc, char *argv[])
  13. {
  14. struct io_uring_params p = {};
  15. struct io_uring ring;
  16. int ret;
  17. if (argc > 1)
  18. return T_EXIT_SKIP;
  19. p.flags = IORING_SETUP_SQPOLL;
  20. p.sq_thread_idle = 100;
  21. ret = t_create_ring_params(1, &ring, &p);
  22. if (ret == T_SETUP_SKIP)
  23. return T_EXIT_SKIP;
  24. else if (ret < 0)
  25. goto err;
  26. ret = __sys_io_uring_enter(ring.ring_fd, 0, 0, 0, NULL);
  27. if (ret < 0) {
  28. int __e = errno;
  29. if (__e == EOWNERDEAD)
  30. fprintf(stderr, "sqe submit unexpected failure due old kernel bug: %s\n", strerror(__e));
  31. else
  32. fprintf(stderr, "sqe submit unexpected failure: %s\n", strerror(__e));
  33. goto err;
  34. }
  35. return T_EXIT_PASS;
  36. err:
  37. return T_EXIT_FAIL;
  38. }