polyphony 0.94 → 0.95
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.github/workflows/test.yml +2 -2
- data/.gitignore +3 -3
- data/CHANGELOG.md +14 -0
- data/docs/api-reference/fiber.md +2 -2
- data/docs/api-reference/object.md +3 -3
- data/docs/main-concepts/exception-handling.md +2 -2
- data/ext/polyphony/backend_common.c +3 -3
- data/ext/polyphony/backend_io_uring.c +18 -16
- data/ext/polyphony/event.c +1 -1
- data/ext/polyphony/extconf.rb +5 -3
- data/ext/polyphony/fiber.c +5 -13
- data/ext/polyphony/io_extensions.c +1 -1
- data/ext/polyphony/pipe.c +1 -1
- data/ext/polyphony/polyphony.c +1 -1
- data/ext/polyphony/polyphony_ext.c +1 -1
- data/ext/polyphony/queue.c +1 -1
- data/ext/polyphony/ring_buffer.c +1 -0
- data/ext/polyphony/socket_extensions.c +1 -1
- data/ext/polyphony/thread.c +1 -1
- data/lib/polyphony/extensions/enumerator.rb +16 -0
- data/lib/polyphony/extensions/socket.rb +2 -0
- data/lib/polyphony/extensions.rb +1 -0
- data/lib/polyphony/version.rb +1 -1
- data/polyphony.gemspec +2 -2
- data/test/test_backend.rb +5 -1
- data/test/test_enumerator.rb +46 -0
- data/test/test_io.rb +241 -216
- data/test/test_socket.rb +1 -1
- data/test/test_thread_pool.rb +3 -3
- data/vendor/liburing/.github/workflows/build.yml +51 -5
- data/vendor/liburing/.github/workflows/shellcheck.yml +1 -1
- data/vendor/liburing/.gitignore +6 -123
- data/vendor/liburing/CHANGELOG +35 -0
- data/vendor/liburing/CITATION.cff +11 -0
- data/vendor/liburing/LICENSE +16 -3
- data/vendor/liburing/Makefile +3 -1
- data/vendor/liburing/Makefile.common +1 -0
- data/vendor/liburing/README +14 -2
- data/vendor/liburing/SECURITY.md +6 -0
- data/vendor/liburing/configure +16 -15
- data/vendor/liburing/examples/Makefile +4 -1
- data/vendor/liburing/examples/io_uring-udp.c +395 -0
- data/vendor/liburing/examples/poll-bench.c +101 -0
- data/vendor/liburing/examples/send-zerocopy.c +339 -0
- data/vendor/liburing/liburing.spec +1 -1
- data/vendor/liburing/man/io_uring.7 +38 -11
- data/vendor/liburing/man/io_uring_buf_ring_add.3 +53 -0
- data/vendor/liburing/man/io_uring_buf_ring_advance.3 +31 -0
- data/vendor/liburing/man/io_uring_buf_ring_cq_advance.3 +41 -0
- data/vendor/liburing/man/io_uring_buf_ring_init.3 +30 -0
- data/vendor/liburing/man/io_uring_buf_ring_mask.3 +27 -0
- data/vendor/liburing/man/io_uring_cq_advance.3 +29 -15
- data/vendor/liburing/man/io_uring_cq_has_overflow.3 +25 -0
- data/vendor/liburing/man/io_uring_cq_ready.3 +9 -8
- data/vendor/liburing/man/io_uring_cqe_get_data.3 +32 -13
- data/vendor/liburing/man/io_uring_cqe_get_data64.3 +1 -0
- data/vendor/liburing/man/io_uring_cqe_seen.3 +22 -12
- data/vendor/liburing/man/io_uring_enter.2 +249 -32
- data/vendor/liburing/man/io_uring_enter2.2 +1 -0
- data/vendor/liburing/man/io_uring_free_probe.3 +11 -8
- data/vendor/liburing/man/io_uring_get_events.3 +33 -0
- data/vendor/liburing/man/io_uring_get_probe.3 +9 -8
- data/vendor/liburing/man/io_uring_get_sqe.3 +29 -10
- data/vendor/liburing/man/io_uring_opcode_supported.3 +11 -10
- data/vendor/liburing/man/io_uring_peek_cqe.3 +38 -0
- data/vendor/liburing/man/io_uring_prep_accept.3 +197 -0
- data/vendor/liburing/man/io_uring_prep_accept_direct.3 +1 -0
- data/vendor/liburing/man/io_uring_prep_cancel.3 +118 -0
- data/vendor/liburing/man/io_uring_prep_cancel64.3 +1 -0
- data/vendor/liburing/man/io_uring_prep_close.3 +59 -0
- data/vendor/liburing/man/io_uring_prep_close_direct.3 +1 -0
- data/vendor/liburing/man/io_uring_prep_connect.3 +66 -0
- data/vendor/liburing/man/io_uring_prep_fadvise.3 +59 -0
- data/vendor/liburing/man/io_uring_prep_fallocate.3 +59 -0
- data/vendor/liburing/man/io_uring_prep_files_update.3 +92 -0
- data/vendor/liburing/man/io_uring_prep_fsync.3 +70 -0
- data/vendor/liburing/man/io_uring_prep_link.3 +1 -0
- data/vendor/liburing/man/io_uring_prep_linkat.3 +91 -0
- data/vendor/liburing/man/io_uring_prep_madvise.3 +56 -0
- data/vendor/liburing/man/io_uring_prep_mkdir.3 +1 -0
- data/vendor/liburing/man/io_uring_prep_mkdirat.3 +83 -0
- data/vendor/liburing/man/io_uring_prep_msg_ring.3 +39 -25
- data/vendor/liburing/man/io_uring_prep_multishot_accept.3 +1 -0
- data/vendor/liburing/man/io_uring_prep_multishot_accept_direct.3 +1 -0
- data/vendor/liburing/man/io_uring_prep_nop.3 +28 -0
- data/vendor/liburing/man/io_uring_prep_openat.3 +117 -0
- data/vendor/liburing/man/io_uring_prep_openat2.3 +117 -0
- data/vendor/liburing/man/io_uring_prep_openat2_direct.3 +1 -0
- data/vendor/liburing/man/io_uring_prep_openat_direct.3 +1 -0
- data/vendor/liburing/man/io_uring_prep_poll_add.3 +72 -0
- data/vendor/liburing/man/io_uring_prep_poll_multishot.3 +1 -0
- data/vendor/liburing/man/io_uring_prep_poll_remove.3 +55 -0
- data/vendor/liburing/man/io_uring_prep_poll_update.3 +89 -0
- data/vendor/liburing/man/io_uring_prep_provide_buffers.3 +131 -0
- data/vendor/liburing/man/io_uring_prep_read.3 +33 -14
- data/vendor/liburing/man/io_uring_prep_read_fixed.3 +39 -21
- data/vendor/liburing/man/io_uring_prep_readv.3 +49 -15
- data/vendor/liburing/man/io_uring_prep_readv2.3 +49 -17
- data/vendor/liburing/man/io_uring_prep_recv.3 +105 -0
- data/vendor/liburing/man/io_uring_prep_recv_multishot.3 +1 -0
- data/vendor/liburing/man/io_uring_prep_recvmsg.3 +124 -0
- data/vendor/liburing/man/io_uring_prep_recvmsg_multishot.3 +1 -0
- data/vendor/liburing/man/io_uring_prep_remove_buffers.3 +52 -0
- data/vendor/liburing/man/io_uring_prep_rename.3 +1 -0
- data/vendor/liburing/man/io_uring_prep_renameat.3 +96 -0
- data/vendor/liburing/man/io_uring_prep_send.3 +57 -0
- data/vendor/liburing/man/io_uring_prep_send_zc.3 +64 -0
- data/vendor/liburing/man/io_uring_prep_sendmsg.3 +69 -0
- data/vendor/liburing/man/io_uring_prep_shutdown.3 +53 -0
- data/vendor/liburing/man/io_uring_prep_socket.3 +118 -0
- data/vendor/liburing/man/io_uring_prep_socket_direct.3 +1 -0
- data/vendor/liburing/man/io_uring_prep_socket_direct_alloc.3 +1 -0
- data/vendor/liburing/man/io_uring_prep_splice.3 +80 -0
- data/vendor/liburing/man/io_uring_prep_statx.3 +74 -0
- data/vendor/liburing/man/io_uring_prep_symlink.3 +1 -0
- data/vendor/liburing/man/io_uring_prep_symlinkat.3 +85 -0
- data/vendor/liburing/man/io_uring_prep_sync_file_range.3 +59 -0
- data/vendor/liburing/man/io_uring_prep_tee.3 +74 -0
- data/vendor/liburing/man/io_uring_prep_timeout.3 +95 -0
- data/vendor/liburing/man/io_uring_prep_timeout_remove.3 +1 -0
- data/vendor/liburing/man/io_uring_prep_timeout_update.3 +98 -0
- data/vendor/liburing/man/io_uring_prep_unlink.3 +1 -0
- data/vendor/liburing/man/io_uring_prep_unlinkat.3 +82 -0
- data/vendor/liburing/man/io_uring_prep_write.3 +32 -15
- data/vendor/liburing/man/io_uring_prep_write_fixed.3 +39 -21
- data/vendor/liburing/man/io_uring_prep_writev.3 +50 -16
- data/vendor/liburing/man/io_uring_prep_writev2.3 +50 -17
- data/vendor/liburing/man/io_uring_queue_exit.3 +3 -4
- data/vendor/liburing/man/io_uring_queue_init.3 +58 -13
- data/vendor/liburing/man/io_uring_queue_init_params.3 +1 -0
- data/vendor/liburing/man/io_uring_recvmsg_cmsg_firsthdr.3 +1 -0
- data/vendor/liburing/man/io_uring_recvmsg_cmsg_nexthdr.3 +1 -0
- data/vendor/liburing/man/io_uring_recvmsg_name.3 +1 -0
- data/vendor/liburing/man/io_uring_recvmsg_out.3 +78 -0
- data/vendor/liburing/man/io_uring_recvmsg_payload.3 +1 -0
- data/vendor/liburing/man/io_uring_recvmsg_payload_length.3 +1 -0
- data/vendor/liburing/man/io_uring_recvmsg_validate.3 +1 -0
- data/vendor/liburing/man/io_uring_register.2 +153 -13
- data/vendor/liburing/man/io_uring_register_buf_ring.3 +140 -0
- data/vendor/liburing/man/io_uring_register_buffers.3 +32 -12
- data/vendor/liburing/man/io_uring_register_eventfd.3 +51 -0
- data/vendor/liburing/man/io_uring_register_eventfd_async.3 +1 -0
- data/vendor/liburing/man/io_uring_register_file_alloc_range.3 +52 -0
- data/vendor/liburing/man/io_uring_register_files.3 +33 -11
- data/vendor/liburing/man/io_uring_register_files_sparse.3 +1 -0
- data/vendor/liburing/man/io_uring_register_iowq_aff.3 +61 -0
- data/vendor/liburing/man/io_uring_register_iowq_max_workers.3 +71 -0
- data/vendor/liburing/man/io_uring_register_ring_fd.3 +49 -0
- data/vendor/liburing/man/io_uring_register_sync_cancel.3 +71 -0
- data/vendor/liburing/man/io_uring_setup.2 +119 -13
- data/vendor/liburing/man/io_uring_sq_ready.3 +14 -8
- data/vendor/liburing/man/io_uring_sq_space_left.3 +9 -9
- data/vendor/liburing/man/io_uring_sqe_set_data.3 +29 -11
- data/vendor/liburing/man/io_uring_sqe_set_data64.3 +1 -0
- data/vendor/liburing/man/io_uring_sqe_set_flags.3 +38 -11
- data/vendor/liburing/man/io_uring_sqring_wait.3 +13 -9
- data/vendor/liburing/man/io_uring_submit.3 +29 -12
- data/vendor/liburing/man/io_uring_submit_and_get_events.3 +31 -0
- data/vendor/liburing/man/io_uring_submit_and_wait.3 +16 -12
- data/vendor/liburing/man/io_uring_submit_and_wait_timeout.3 +30 -23
- data/vendor/liburing/man/io_uring_unregister_buf_ring.3 +30 -0
- data/vendor/liburing/man/io_uring_unregister_buffers.3 +11 -10
- data/vendor/liburing/man/io_uring_unregister_eventfd.3 +1 -0
- data/vendor/liburing/man/io_uring_unregister_files.3 +11 -10
- data/vendor/liburing/man/io_uring_unregister_iowq_aff.3 +1 -0
- data/vendor/liburing/man/io_uring_unregister_ring_fd.3 +32 -0
- data/vendor/liburing/man/io_uring_wait_cqe.3 +19 -12
- data/vendor/liburing/man/io_uring_wait_cqe_nr.3 +21 -14
- data/vendor/liburing/man/io_uring_wait_cqe_timeout.3 +27 -13
- data/vendor/liburing/man/io_uring_wait_cqes.3 +24 -14
- data/vendor/liburing/src/Makefile +8 -7
- data/vendor/liburing/src/arch/aarch64/lib.h +48 -0
- data/vendor/liburing/src/arch/aarch64/syscall.h +0 -4
- data/vendor/liburing/src/arch/generic/lib.h +0 -4
- data/vendor/liburing/src/arch/generic/syscall.h +29 -16
- data/vendor/liburing/src/arch/syscall-defs.h +41 -14
- data/vendor/liburing/src/arch/x86/lib.h +0 -21
- data/vendor/liburing/src/arch/x86/syscall.h +146 -10
- data/vendor/liburing/src/include/liburing/io_uring.h +245 -5
- data/vendor/liburing/src/include/liburing.h +468 -35
- data/vendor/liburing/src/int_flags.h +1 -0
- data/vendor/liburing/src/lib.h +20 -16
- data/vendor/liburing/src/liburing.map +16 -0
- data/vendor/liburing/src/nolibc.c +1 -1
- data/vendor/liburing/src/queue.c +87 -55
- data/vendor/liburing/src/register.c +129 -53
- data/vendor/liburing/src/setup.c +65 -28
- data/vendor/liburing/src/syscall.c +14 -32
- data/vendor/liburing/src/syscall.h +12 -64
- data/vendor/liburing/test/{232c93d07b74-test.c → 232c93d07b74.c} +8 -9
- data/vendor/liburing/test/{35fa71a030ca-test.c → 35fa71a030ca.c} +4 -4
- data/vendor/liburing/test/{500f9fbadef8-test.c → 500f9fbadef8.c} +7 -7
- data/vendor/liburing/test/{7ad0e4b2f83c-test.c → 7ad0e4b2f83c.c} +8 -7
- data/vendor/liburing/test/{8a9973408177-test.c → 8a9973408177.c} +4 -3
- data/vendor/liburing/test/{917257daa0fe-test.c → 917257daa0fe.c} +3 -2
- data/vendor/liburing/test/Makefile +60 -62
- data/vendor/liburing/test/{a0908ae19763-test.c → a0908ae19763.c} +3 -2
- data/vendor/liburing/test/{a4c0b3decb33-test.c → a4c0b3decb33.c} +3 -2
- data/vendor/liburing/test/accept-link.c +5 -4
- data/vendor/liburing/test/accept-reuse.c +17 -16
- data/vendor/liburing/test/accept-test.c +14 -10
- data/vendor/liburing/test/accept.c +529 -107
- data/vendor/liburing/test/across-fork.c +7 -6
- data/vendor/liburing/test/{b19062a56726-test.c → b19062a56726.c} +3 -2
- data/vendor/liburing/test/{b5837bd5311d-test.c → b5837bd5311d.c} +10 -9
- data/vendor/liburing/test/buf-ring.c +420 -0
- data/vendor/liburing/test/{ce593a6c480a-test.c → ce593a6c480a.c} +15 -12
- data/vendor/liburing/test/connect.c +8 -7
- data/vendor/liburing/test/cq-full.c +5 -4
- data/vendor/liburing/test/cq-overflow.c +242 -12
- data/vendor/liburing/test/cq-peek-batch.c +5 -4
- data/vendor/liburing/test/cq-ready.c +5 -4
- data/vendor/liburing/test/cq-size.c +5 -4
- data/vendor/liburing/test/{d4ae271dfaae-test.c → d4ae271dfaae.c} +2 -2
- data/vendor/liburing/test/{d77a67ed5f27-test.c → d77a67ed5f27.c} +6 -6
- data/vendor/liburing/test/defer-taskrun.c +336 -0
- data/vendor/liburing/test/defer.c +26 -14
- data/vendor/liburing/test/double-poll-crash.c +15 -5
- data/vendor/liburing/test/drop-submit.c +5 -3
- data/vendor/liburing/test/{eeed8b54e0df-test.c → eeed8b54e0df.c} +7 -6
- data/vendor/liburing/test/empty-eownerdead.c +4 -4
- data/vendor/liburing/test/eventfd-disable.c +48 -20
- data/vendor/liburing/test/eventfd-reg.c +10 -9
- data/vendor/liburing/test/eventfd-ring.c +13 -12
- data/vendor/liburing/test/eventfd.c +13 -12
- data/vendor/liburing/test/exit-no-cleanup.c +1 -1
- data/vendor/liburing/test/fadvise.c +3 -3
- data/vendor/liburing/test/fallocate.c +16 -9
- data/vendor/liburing/test/{fc2a85cb02ef-test.c → fc2a85cb02ef.c} +4 -3
- data/vendor/liburing/test/fd-pass.c +187 -0
- data/vendor/liburing/test/file-register.c +302 -36
- data/vendor/liburing/test/file-update.c +62 -4
- data/vendor/liburing/test/file-verify.c +6 -2
- data/vendor/liburing/test/files-exit-hang-poll.c +11 -25
- data/vendor/liburing/test/files-exit-hang-timeout.c +13 -10
- data/vendor/liburing/test/fixed-buf-iter.c +115 -0
- data/vendor/liburing/test/fixed-link.c +10 -10
- data/vendor/liburing/test/fixed-reuse.c +160 -0
- data/vendor/liburing/test/fpos.c +6 -3
- data/vendor/liburing/test/fsync.c +3 -3
- data/vendor/liburing/test/hardlink.c +10 -6
- data/vendor/liburing/test/helpers.c +137 -4
- data/vendor/liburing/test/helpers.h +27 -0
- data/vendor/liburing/test/io-cancel.c +16 -11
- data/vendor/liburing/test/io_uring_enter.c +46 -81
- data/vendor/liburing/test/io_uring_passthrough.c +451 -0
- data/vendor/liburing/test/io_uring_register.c +59 -229
- data/vendor/liburing/test/io_uring_setup.c +24 -29
- data/vendor/liburing/test/iopoll-leak.c +85 -0
- data/vendor/liburing/test/iopoll.c +16 -9
- data/vendor/liburing/test/lfs-openat-write.c +3 -1
- data/vendor/liburing/test/link-timeout.c +4 -3
- data/vendor/liburing/test/link.c +8 -7
- data/vendor/liburing/test/madvise.c +2 -2
- data/vendor/liburing/test/mkdir.c +9 -5
- data/vendor/liburing/test/msg-ring.c +46 -20
- data/vendor/liburing/test/multicqes_drain.c +51 -12
- data/vendor/liburing/test/nolibc.c +60 -0
- data/vendor/liburing/test/nop.c +78 -16
- data/vendor/liburing/test/nvme.h +168 -0
- data/vendor/liburing/test/open-direct-link.c +188 -0
- data/vendor/liburing/test/open-direct-pick.c +180 -0
- data/vendor/liburing/test/openat2.c +3 -3
- data/vendor/liburing/test/poll-cancel-all.c +472 -0
- data/vendor/liburing/test/poll-link.c +9 -18
- data/vendor/liburing/test/poll-mshot-overflow.c +162 -0
- data/vendor/liburing/test/poll-mshot-update.c +83 -33
- data/vendor/liburing/test/pollfree.c +2 -2
- data/vendor/liburing/test/read-before-exit.c +112 -0
- data/vendor/liburing/test/read-write.c +83 -1
- data/vendor/liburing/test/recv-msgall-stream.c +398 -0
- data/vendor/liburing/test/recv-msgall.c +265 -0
- data/vendor/liburing/test/recv-multishot.c +505 -0
- data/vendor/liburing/test/rename.c +2 -5
- data/vendor/liburing/test/ring-leak.c +97 -0
- data/vendor/liburing/test/ringbuf-read.c +200 -0
- data/vendor/liburing/test/rsrc_tags.c +25 -13
- data/vendor/liburing/test/runtests-quiet.sh +11 -0
- data/vendor/liburing/test/runtests.sh +18 -20
- data/vendor/liburing/test/rw_merge_test.c +3 -2
- data/vendor/liburing/test/send-zerocopy.c +684 -0
- data/vendor/liburing/test/send_recv.c +49 -2
- data/vendor/liburing/test/send_recvmsg.c +165 -55
- data/vendor/liburing/test/shutdown.c +3 -4
- data/vendor/liburing/test/sigfd-deadlock.c +22 -8
- data/vendor/liburing/test/single-issuer.c +171 -0
- data/vendor/liburing/test/socket-rw-eagain.c +2 -12
- data/vendor/liburing/test/socket-rw-offset.c +2 -11
- data/vendor/liburing/test/socket-rw.c +2 -11
- data/vendor/liburing/test/socket.c +409 -0
- data/vendor/liburing/test/sq-poll-dup.c +1 -1
- data/vendor/liburing/test/sq-poll-share.c +1 -1
- data/vendor/liburing/test/statx.c +2 -2
- data/vendor/liburing/test/submit-and-wait.c +108 -0
- data/vendor/liburing/test/submit-link-fail.c +5 -3
- data/vendor/liburing/test/submit-reuse.c +0 -2
- data/vendor/liburing/test/sync-cancel.c +235 -0
- data/vendor/liburing/test/test.h +35 -0
- data/vendor/liburing/test/timeout-overflow.c +11 -11
- data/vendor/liburing/test/timeout.c +7 -7
- data/vendor/liburing/test/tty-write-dpoll.c +60 -0
- data/vendor/liburing/test/unlink.c +1 -1
- data/vendor/liburing/test/xattr.c +425 -0
- metadata +143 -22
- data/Gemfile.lock +0 -78
@@ -0,0 +1,85 @@
|
|
1
|
+
/* SPDX-License-Identifier: MIT */
|
2
|
+
/*
|
3
|
+
* Description: test a mem leak with IOPOLL
|
4
|
+
*/
|
5
|
+
#include <errno.h>
|
6
|
+
#include <stdio.h>
|
7
|
+
#include <unistd.h>
|
8
|
+
#include <stdlib.h>
|
9
|
+
#include <string.h>
|
10
|
+
#include <fcntl.h>
|
11
|
+
#include <sys/types.h>
|
12
|
+
#include <sys/wait.h>
|
13
|
+
#include "helpers.h"
|
14
|
+
#include "liburing.h"
|
15
|
+
|
16
|
+
#define FILE_SIZE (128 * 1024)
|
17
|
+
#define BS 4096
|
18
|
+
#define BUFFERS (FILE_SIZE / BS)
|
19
|
+
|
20
|
+
static int do_iopoll(const char *fname)
|
21
|
+
{
|
22
|
+
struct io_uring_sqe *sqe;
|
23
|
+
struct io_uring ring;
|
24
|
+
struct iovec *iov;
|
25
|
+
int fd;
|
26
|
+
|
27
|
+
fd = open(fname, O_RDONLY | O_DIRECT);
|
28
|
+
if (fd < 0) {
|
29
|
+
perror("open");
|
30
|
+
return T_EXIT_SKIP;
|
31
|
+
}
|
32
|
+
|
33
|
+
iov = t_create_buffers(1, 4096);
|
34
|
+
|
35
|
+
t_create_ring(2, &ring, IORING_SETUP_IOPOLL);
|
36
|
+
|
37
|
+
sqe = io_uring_get_sqe(&ring);
|
38
|
+
io_uring_prep_read(sqe, fd, iov->iov_base, iov->iov_len, 0);
|
39
|
+
io_uring_submit(&ring);
|
40
|
+
|
41
|
+
close(fd);
|
42
|
+
return T_EXIT_PASS;
|
43
|
+
}
|
44
|
+
|
45
|
+
static int test(const char *fname)
|
46
|
+
{
|
47
|
+
if (fork()) {
|
48
|
+
int stat;
|
49
|
+
|
50
|
+
wait(&stat);
|
51
|
+
return WEXITSTATUS(stat);
|
52
|
+
} else {
|
53
|
+
int ret;
|
54
|
+
|
55
|
+
ret = do_iopoll(fname);
|
56
|
+
exit(ret);
|
57
|
+
}
|
58
|
+
}
|
59
|
+
|
60
|
+
int main(int argc, char *argv[])
|
61
|
+
{
|
62
|
+
char buf[256];
|
63
|
+
char *fname;
|
64
|
+
int i, ret;
|
65
|
+
|
66
|
+
if (argc > 1) {
|
67
|
+
fname = argv[1];
|
68
|
+
} else {
|
69
|
+
srand((unsigned)time(NULL));
|
70
|
+
snprintf(buf, sizeof(buf), ".iopoll-leak-%u-%u",
|
71
|
+
(unsigned)rand(), (unsigned)getpid());
|
72
|
+
fname = buf;
|
73
|
+
t_create_file(fname, FILE_SIZE);
|
74
|
+
}
|
75
|
+
|
76
|
+
for (i = 0; i < 16; i++) {
|
77
|
+
ret = test(fname);
|
78
|
+
if (ret == T_EXIT_SKIP || ret == T_EXIT_FAIL)
|
79
|
+
break;
|
80
|
+
}
|
81
|
+
|
82
|
+
if (fname != argv[1])
|
83
|
+
unlink(fname);
|
84
|
+
return ret;
|
85
|
+
}
|
@@ -201,7 +201,7 @@ err:
|
|
201
201
|
return 1;
|
202
202
|
}
|
203
203
|
|
204
|
-
extern
|
204
|
+
extern unsigned __io_uring_flush_sq(struct io_uring *ring);
|
205
205
|
|
206
206
|
/*
|
207
207
|
* if we are polling io_uring_submit needs to always enter the
|
@@ -274,7 +274,7 @@ ok:
|
|
274
274
|
}
|
275
275
|
|
276
276
|
static int test_io(const char *file, int write, int sqthread, int fixed,
|
277
|
-
int buf_select)
|
277
|
+
int buf_select, int defer)
|
278
278
|
{
|
279
279
|
struct io_uring ring;
|
280
280
|
int ret, ring_flags = IORING_SETUP_IOPOLL;
|
@@ -282,6 +282,10 @@ static int test_io(const char *file, int write, int sqthread, int fixed,
|
|
282
282
|
if (no_iopoll)
|
283
283
|
return 0;
|
284
284
|
|
285
|
+
if (defer)
|
286
|
+
ring_flags |= IORING_SETUP_SINGLE_ISSUER |
|
287
|
+
IORING_SETUP_DEFER_TASKRUN;
|
288
|
+
|
285
289
|
ret = t_create_ring(64, &ring, ring_flags);
|
286
290
|
if (ret == T_SETUP_SKIP)
|
287
291
|
return 0;
|
@@ -323,7 +327,7 @@ int main(int argc, char *argv[])
|
|
323
327
|
char *fname;
|
324
328
|
|
325
329
|
if (probe_buf_select())
|
326
|
-
return
|
330
|
+
return T_EXIT_FAIL;
|
327
331
|
|
328
332
|
if (argc > 1) {
|
329
333
|
fname = argv[1];
|
@@ -337,19 +341,22 @@ int main(int argc, char *argv[])
|
|
337
341
|
|
338
342
|
vecs = t_create_buffers(BUFFERS, BS);
|
339
343
|
|
340
|
-
nr =
|
344
|
+
nr = 32;
|
341
345
|
if (no_buf_select)
|
342
346
|
nr = 8;
|
347
|
+
else if (!t_probe_defer_taskrun())
|
348
|
+
nr = 16;
|
343
349
|
for (i = 0; i < nr; i++) {
|
344
350
|
int write = (i & 1) != 0;
|
345
351
|
int sqthread = (i & 2) != 0;
|
346
352
|
int fixed = (i & 4) != 0;
|
347
353
|
int buf_select = (i & 8) != 0;
|
354
|
+
int defer = (i & 16) != 0;
|
348
355
|
|
349
|
-
ret = test_io(fname, write, sqthread, fixed, buf_select);
|
356
|
+
ret = test_io(fname, write, sqthread, fixed, buf_select, defer);
|
350
357
|
if (ret) {
|
351
|
-
fprintf(stderr, "test_io failed %d/%d/%d/%d\n",
|
352
|
-
write, sqthread, fixed, buf_select);
|
358
|
+
fprintf(stderr, "test_io failed %d/%d/%d/%d/%d\n",
|
359
|
+
write, sqthread, fixed, buf_select, defer);
|
353
360
|
goto err;
|
354
361
|
}
|
355
362
|
if (no_iopoll)
|
@@ -364,9 +371,9 @@ int main(int argc, char *argv[])
|
|
364
371
|
|
365
372
|
if (fname != argv[1])
|
366
373
|
unlink(fname);
|
367
|
-
return
|
374
|
+
return T_EXIT_PASS;
|
368
375
|
err:
|
369
376
|
if (fname != argv[1])
|
370
377
|
unlink(fname);
|
371
|
-
return
|
378
|
+
return T_EXIT_FAIL;
|
372
379
|
}
|
@@ -14,6 +14,8 @@
|
|
14
14
|
#include <sys/resource.h>
|
15
15
|
#include <unistd.h>
|
16
16
|
|
17
|
+
#include "helpers.h"
|
18
|
+
|
17
19
|
static const int RSIZE = 2;
|
18
20
|
static const int OPEN_FLAGS = O_RDWR | O_CREAT;
|
19
21
|
static const mode_t OPEN_MODE = S_IRUSR | S_IWUSR;
|
@@ -100,7 +102,7 @@ int main(int argc, char *argv[])
|
|
100
102
|
int dfd, ret;
|
101
103
|
|
102
104
|
if (argc > 1)
|
103
|
-
return
|
105
|
+
return T_EXIT_SKIP;
|
104
106
|
|
105
107
|
dfd = open("/tmp", O_RDONLY | O_DIRECTORY);
|
106
108
|
if (dfd < 0)
|
@@ -12,6 +12,7 @@
|
|
12
12
|
#include <poll.h>
|
13
13
|
|
14
14
|
#include "liburing.h"
|
15
|
+
#include "helpers.h"
|
15
16
|
|
16
17
|
static int test_fail_lone_link_timeouts(struct io_uring *ring)
|
17
18
|
{
|
@@ -1011,12 +1012,12 @@ int main(int argc, char *argv[])
|
|
1011
1012
|
int ret;
|
1012
1013
|
|
1013
1014
|
if (argc > 1)
|
1014
|
-
return
|
1015
|
+
return T_EXIT_SKIP;
|
1015
1016
|
|
1016
1017
|
ret = io_uring_queue_init(8, &ring, 0);
|
1017
1018
|
if (ret) {
|
1018
1019
|
printf("ring setup failed\n");
|
1019
|
-
return
|
1020
|
+
return T_EXIT_FAIL;
|
1020
1021
|
}
|
1021
1022
|
|
1022
1023
|
ret = test_timeout_link_chain1(&ring);
|
@@ -1103,5 +1104,5 @@ int main(int argc, char *argv[])
|
|
1103
1104
|
return ret;
|
1104
1105
|
}
|
1105
1106
|
|
1106
|
-
return
|
1107
|
+
return T_EXIT_PASS;
|
1107
1108
|
}
|
data/vendor/liburing/test/link.c
CHANGED
@@ -11,6 +11,7 @@
|
|
11
11
|
#include <fcntl.h>
|
12
12
|
|
13
13
|
#include "liburing.h"
|
14
|
+
#include "helpers.h"
|
14
15
|
|
15
16
|
static int no_hardlink;
|
16
17
|
|
@@ -178,7 +179,7 @@ static int test_single_link_fail(struct io_uring *ring)
|
|
178
179
|
goto err;
|
179
180
|
}
|
180
181
|
|
181
|
-
|
182
|
+
io_uring_prep_remove_buffers(sqe, 10, 1);
|
182
183
|
sqe->flags |= IOSQE_IO_LINK;
|
183
184
|
|
184
185
|
sqe = io_uring_get_sqe(ring);
|
@@ -205,8 +206,8 @@ static int test_single_link_fail(struct io_uring *ring)
|
|
205
206
|
printf("failed to get cqe\n");
|
206
207
|
goto err;
|
207
208
|
}
|
208
|
-
if (i == 0 && cqe->res != -
|
209
|
-
printf("sqe0 failed with %d, wanted -
|
209
|
+
if (i == 0 && cqe->res != -ENOENT) {
|
210
|
+
printf("sqe0 failed with %d, wanted -ENOENT\n", cqe->res);
|
210
211
|
goto err;
|
211
212
|
}
|
212
213
|
if (i == 1 && cqe->res != -ECANCELED) {
|
@@ -435,19 +436,19 @@ int main(int argc, char *argv[])
|
|
435
436
|
int ret;
|
436
437
|
|
437
438
|
if (argc > 1)
|
438
|
-
return
|
439
|
+
return T_EXIT_SKIP;
|
439
440
|
|
440
441
|
ret = io_uring_queue_init(8, &ring, 0);
|
441
442
|
if (ret) {
|
442
443
|
printf("ring setup failed\n");
|
443
|
-
return
|
444
|
+
return T_EXIT_FAIL;
|
444
445
|
|
445
446
|
}
|
446
447
|
|
447
448
|
ret = io_uring_queue_init(8, &poll_ring, IORING_SETUP_IOPOLL);
|
448
449
|
if (ret) {
|
449
450
|
printf("poll_ring setup failed\n");
|
450
|
-
return
|
451
|
+
return T_EXIT_FAIL;
|
451
452
|
}
|
452
453
|
|
453
454
|
ret = test_single_link(&ring);
|
@@ -492,5 +493,5 @@ int main(int argc, char *argv[])
|
|
492
493
|
return ret;
|
493
494
|
}
|
494
495
|
|
495
|
-
return
|
496
|
+
return T_EXIT_PASS;
|
496
497
|
}
|
@@ -187,9 +187,9 @@ int main(int argc, char *argv[])
|
|
187
187
|
if (fname != argv[1])
|
188
188
|
unlink(fname);
|
189
189
|
io_uring_queue_exit(&ring);
|
190
|
-
return
|
190
|
+
return T_EXIT_PASS;
|
191
191
|
err:
|
192
192
|
if (fname != argv[1])
|
193
193
|
unlink(fname);
|
194
|
-
return
|
194
|
+
return T_EXIT_FAIL;
|
195
195
|
}
|
@@ -10,6 +10,7 @@
|
|
10
10
|
#include <unistd.h>
|
11
11
|
|
12
12
|
#include "liburing.h"
|
13
|
+
#include "helpers.h"
|
13
14
|
|
14
15
|
static int do_mkdirat(struct io_uring *ring, const char *fn)
|
15
16
|
{
|
@@ -59,7 +60,7 @@ int main(int argc, char *argv[])
|
|
59
60
|
struct io_uring ring;
|
60
61
|
|
61
62
|
if (argc > 1)
|
62
|
-
return
|
63
|
+
return T_EXIT_SKIP;
|
63
64
|
|
64
65
|
ret = io_uring_queue_init(8, &ring, 0);
|
65
66
|
if (ret) {
|
@@ -71,7 +72,7 @@ int main(int argc, char *argv[])
|
|
71
72
|
if (ret < 0) {
|
72
73
|
if (ret == -EBADF || ret == -EINVAL) {
|
73
74
|
fprintf(stdout, "mkdirat not supported, skipping\n");
|
74
|
-
goto
|
75
|
+
goto skip;
|
75
76
|
}
|
76
77
|
fprintf(stderr, "mkdirat: %s\n", strerror(-ret));
|
77
78
|
goto err;
|
@@ -96,13 +97,16 @@ int main(int argc, char *argv[])
|
|
96
97
|
goto err1;
|
97
98
|
}
|
98
99
|
|
99
|
-
out:
|
100
100
|
unlinkat(AT_FDCWD, fn, AT_REMOVEDIR);
|
101
101
|
io_uring_queue_exit(&ring);
|
102
|
-
return
|
102
|
+
return T_EXIT_PASS;
|
103
|
+
skip:
|
104
|
+
unlinkat(AT_FDCWD, fn, AT_REMOVEDIR);
|
105
|
+
io_uring_queue_exit(&ring);
|
106
|
+
return T_EXIT_SKIP;
|
103
107
|
err1:
|
104
108
|
unlinkat(AT_FDCWD, fn, AT_REMOVEDIR);
|
105
109
|
err:
|
106
110
|
io_uring_queue_exit(&ring);
|
107
|
-
return
|
111
|
+
return T_EXIT_FAIL;
|
108
112
|
}
|
@@ -12,6 +12,7 @@
|
|
12
12
|
#include <pthread.h>
|
13
13
|
|
14
14
|
#include "liburing.h"
|
15
|
+
#include "helpers.h"
|
15
16
|
|
16
17
|
static int no_msg;
|
17
18
|
|
@@ -54,10 +55,6 @@ static int test_own(struct io_uring *ring)
|
|
54
55
|
}
|
55
56
|
break;
|
56
57
|
case 0x1234:
|
57
|
-
if (!(cqe->flags & IORING_CQE_F_MSG)) {
|
58
|
-
fprintf(stderr, "invalid flags %x\n", cqe->flags);
|
59
|
-
return -1;
|
60
|
-
}
|
61
58
|
if (cqe->res != 0x10) {
|
62
59
|
fprintf(stderr, "invalid len %x\n", cqe->res);
|
63
60
|
return -1;
|
@@ -87,10 +84,6 @@ static void *wait_cqe_fn(void *data)
|
|
87
84
|
goto err;
|
88
85
|
}
|
89
86
|
|
90
|
-
if (!(cqe->flags & IORING_CQE_F_MSG)) {
|
91
|
-
fprintf(stderr, "invalid flags %x\n", cqe->flags);
|
92
|
-
goto err;
|
93
|
-
}
|
94
87
|
if (cqe->user_data != 0x5aa5) {
|
95
88
|
fprintf(stderr, "user_data %llx\n", (long long) cqe->user_data);
|
96
89
|
goto err;
|
@@ -146,19 +139,30 @@ err:
|
|
146
139
|
return 1;
|
147
140
|
}
|
148
141
|
|
149
|
-
static int test_invalid(struct io_uring *ring)
|
142
|
+
static int test_invalid(struct io_uring *ring, bool fixed)
|
150
143
|
{
|
151
144
|
struct io_uring_cqe *cqe;
|
152
145
|
struct io_uring_sqe *sqe;
|
153
|
-
int ret;
|
146
|
+
int ret, fd = 1;
|
154
147
|
|
155
148
|
sqe = io_uring_get_sqe(ring);
|
156
149
|
if (!sqe) {
|
157
150
|
fprintf(stderr, "get sqe failed\n");
|
158
|
-
|
151
|
+
return 1;
|
152
|
+
}
|
153
|
+
|
154
|
+
if (fixed) {
|
155
|
+
ret = io_uring_register_files(ring, &fd, 1);
|
156
|
+
if (ret) {
|
157
|
+
fprintf(stderr, "file register %d\n", ret);
|
158
|
+
return 1;
|
159
|
+
}
|
160
|
+
io_uring_prep_msg_ring(sqe, 0, 0, 0x8989, 0);
|
161
|
+
sqe->flags |= IOSQE_FIXED_FILE;
|
162
|
+
} else {
|
163
|
+
io_uring_prep_msg_ring(sqe, 1, 0, 0x8989, 0);
|
159
164
|
}
|
160
165
|
|
161
|
-
io_uring_prep_msg_ring(sqe, 1, 0, 0x8989, 0);
|
162
166
|
sqe->user_data = 1;
|
163
167
|
|
164
168
|
ret = io_uring_submit(ring);
|
@@ -178,30 +182,39 @@ static int test_invalid(struct io_uring *ring)
|
|
178
182
|
}
|
179
183
|
|
180
184
|
io_uring_cqe_seen(ring, cqe);
|
185
|
+
if (fixed)
|
186
|
+
io_uring_unregister_files(ring);
|
181
187
|
return 0;
|
182
188
|
err:
|
189
|
+
if (fixed)
|
190
|
+
io_uring_unregister_files(ring);
|
183
191
|
return 1;
|
184
192
|
}
|
185
193
|
|
186
194
|
int main(int argc, char *argv[])
|
187
195
|
{
|
188
|
-
struct io_uring ring, ring2;
|
196
|
+
struct io_uring ring, ring2, pring;
|
189
197
|
pthread_t thread;
|
190
198
|
void *tret;
|
191
|
-
int ret;
|
199
|
+
int ret, i;
|
192
200
|
|
193
201
|
if (argc > 1)
|
194
|
-
return
|
202
|
+
return T_EXIT_SKIP;
|
195
203
|
|
196
204
|
ret = io_uring_queue_init(8, &ring, 0);
|
197
205
|
if (ret) {
|
198
206
|
fprintf(stderr, "ring setup failed: %d\n", ret);
|
199
|
-
return
|
207
|
+
return T_EXIT_FAIL;
|
200
208
|
}
|
201
209
|
ret = io_uring_queue_init(8, &ring2, 0);
|
202
210
|
if (ret) {
|
203
211
|
fprintf(stderr, "ring setup failed: %d\n", ret);
|
204
|
-
return
|
212
|
+
return T_EXIT_FAIL;
|
213
|
+
}
|
214
|
+
ret = io_uring_queue_init(8, &pring, IORING_SETUP_IOPOLL);
|
215
|
+
if (ret) {
|
216
|
+
fprintf(stderr, "ring setup failed: %d\n", ret);
|
217
|
+
return T_EXIT_FAIL;
|
205
218
|
}
|
206
219
|
|
207
220
|
ret = test_own(&ring);
|
@@ -211,15 +224,28 @@ int main(int argc, char *argv[])
|
|
211
224
|
}
|
212
225
|
if (no_msg) {
|
213
226
|
fprintf(stdout, "Skipped\n");
|
214
|
-
return
|
227
|
+
return T_EXIT_SKIP;
|
228
|
+
}
|
229
|
+
ret = test_own(&pring);
|
230
|
+
if (ret) {
|
231
|
+
fprintf(stderr, "test_own iopoll failed\n");
|
232
|
+
return ret;
|
215
233
|
}
|
216
234
|
|
217
|
-
ret = test_invalid(&ring);
|
235
|
+
ret = test_invalid(&ring, 0);
|
218
236
|
if (ret) {
|
219
237
|
fprintf(stderr, "test_invalid failed\n");
|
220
238
|
return ret;
|
221
239
|
}
|
222
240
|
|
241
|
+
for (i = 0; i < 2; i++) {
|
242
|
+
ret = test_invalid(&ring, 1);
|
243
|
+
if (ret) {
|
244
|
+
fprintf(stderr, "test_invalid fixed failed\n");
|
245
|
+
return ret;
|
246
|
+
}
|
247
|
+
}
|
248
|
+
|
223
249
|
pthread_create(&thread, NULL, wait_cqe_fn, &ring2);
|
224
250
|
|
225
251
|
ret = test_remote(&ring, &ring2);
|
@@ -230,5 +256,5 @@ int main(int argc, char *argv[])
|
|
230
256
|
|
231
257
|
pthread_join(thread, &tret);
|
232
258
|
|
233
|
-
return
|
259
|
+
return T_EXIT_PASS;
|
234
260
|
}
|
@@ -17,6 +17,7 @@
|
|
17
17
|
#include <poll.h>
|
18
18
|
|
19
19
|
#include "liburing.h"
|
20
|
+
#include "helpers.h"
|
20
21
|
|
21
22
|
enum {
|
22
23
|
multi,
|
@@ -116,7 +117,7 @@ __u8 generate_flags(int sqe_op)
|
|
116
117
|
/*
|
117
118
|
* avoid below case:
|
118
119
|
* sqe0(multishot, link)->sqe1(nop, link)->sqe2(nop)->sqe3(cancel_sqe0)
|
119
|
-
* sqe3 may
|
120
|
+
* sqe3 may execute before sqe0 so that sqe0 isn't cancelled
|
120
121
|
*/
|
121
122
|
if (sqe_op == multi)
|
122
123
|
flags &= ~IOSQE_IO_LINK;
|
@@ -224,7 +225,7 @@ static int test_generic_drain(struct io_uring *ring)
|
|
224
225
|
goto err;
|
225
226
|
}
|
226
227
|
|
227
|
-
sleep(
|
228
|
+
sleep(1);
|
228
229
|
// TODO: randomize event triggerring order
|
229
230
|
for (i = 0; i < max_entry; i++) {
|
230
231
|
if (si[i].op != multi && si[i].op != single)
|
@@ -232,8 +233,10 @@ static int test_generic_drain(struct io_uring *ring)
|
|
232
233
|
|
233
234
|
if (trigger_event(pipes[i]))
|
234
235
|
goto err;
|
236
|
+
|
237
|
+
io_uring_get_events(ring);
|
235
238
|
}
|
236
|
-
sleep(
|
239
|
+
sleep(1);
|
237
240
|
i = 0;
|
238
241
|
while (!io_uring_peek_cqe(ring, &cqe)) {
|
239
242
|
cqe_data[i] = cqe->user_data;
|
@@ -245,7 +248,7 @@ static int test_generic_drain(struct io_uring *ring)
|
|
245
248
|
* compl_bits is a bit map to record completions.
|
246
249
|
* eg. sqe[0], sqe[1], sqe[2] fully completed
|
247
250
|
* then compl_bits is 000...00111b
|
248
|
-
*
|
251
|
+
*
|
249
252
|
*/
|
250
253
|
unsigned long long compl_bits = 0;
|
251
254
|
for (j = 0; j < i; j++) {
|
@@ -294,7 +297,12 @@ static int test_simple_drain(struct io_uring *ring)
|
|
294
297
|
io_uring_prep_poll_add(sqe[1], pipe2[0], POLLIN);
|
295
298
|
sqe[1]->user_data = 1;
|
296
299
|
|
297
|
-
|
300
|
+
/* This test relies on multishot poll to trigger events continually.
|
301
|
+
* however with IORING_SETUP_DEFER_TASKRUN this will only happen when
|
302
|
+
* triggered with a get_events. Hence we sprinkle get_events whenever
|
303
|
+
* there might be work to process in order to get the same result
|
304
|
+
*/
|
305
|
+
ret = io_uring_submit_and_get_events(ring);
|
298
306
|
if (ret < 0) {
|
299
307
|
printf("sqe submit failed\n");
|
300
308
|
goto err;
|
@@ -306,9 +314,11 @@ static int test_simple_drain(struct io_uring *ring)
|
|
306
314
|
for (i = 0; i < 2; i++) {
|
307
315
|
if (trigger_event(pipe1))
|
308
316
|
goto err;
|
317
|
+
io_uring_get_events(ring);
|
309
318
|
}
|
310
319
|
if (trigger_event(pipe2))
|
311
320
|
goto err;
|
321
|
+
io_uring_get_events(ring);
|
312
322
|
|
313
323
|
for (i = 0; i < 2; i++) {
|
314
324
|
sqe[i] = io_uring_get_sqe(ring);
|
@@ -354,25 +364,27 @@ err:
|
|
354
364
|
return 1;
|
355
365
|
}
|
356
366
|
|
357
|
-
int
|
367
|
+
static int test(bool defer_taskrun)
|
358
368
|
{
|
359
369
|
struct io_uring ring;
|
360
370
|
int i, ret;
|
371
|
+
unsigned int flags = 0;
|
361
372
|
|
362
|
-
if (
|
363
|
-
|
373
|
+
if (defer_taskrun)
|
374
|
+
flags = IORING_SETUP_SINGLE_ISSUER |
|
375
|
+
IORING_SETUP_DEFER_TASKRUN;
|
364
376
|
|
365
|
-
ret = io_uring_queue_init(1024, &ring,
|
377
|
+
ret = io_uring_queue_init(1024, &ring, flags);
|
366
378
|
if (ret) {
|
367
379
|
printf("ring setup failed\n");
|
368
|
-
return
|
380
|
+
return T_EXIT_FAIL;
|
369
381
|
}
|
370
382
|
|
371
383
|
for (i = 0; i < 5; i++) {
|
372
384
|
ret = test_simple_drain(&ring);
|
373
385
|
if (ret) {
|
374
386
|
fprintf(stderr, "test_simple_drain failed\n");
|
375
|
-
|
387
|
+
return T_EXIT_FAIL;
|
376
388
|
}
|
377
389
|
}
|
378
390
|
|
@@ -380,8 +392,35 @@ int main(int argc, char *argv[])
|
|
380
392
|
ret = test_generic_drain(&ring);
|
381
393
|
if (ret) {
|
382
394
|
fprintf(stderr, "test_generic_drain failed\n");
|
383
|
-
|
395
|
+
return T_EXIT_FAIL;
|
384
396
|
}
|
385
397
|
}
|
398
|
+
|
399
|
+
io_uring_queue_exit(&ring);
|
400
|
+
|
401
|
+
return T_EXIT_PASS;
|
402
|
+
}
|
403
|
+
|
404
|
+
int main(int argc, char *argv[])
|
405
|
+
{
|
406
|
+
int ret;
|
407
|
+
|
408
|
+
if (argc > 1)
|
409
|
+
return T_EXIT_SKIP;
|
410
|
+
|
411
|
+
ret = test(false);
|
412
|
+
if (ret != T_EXIT_PASS) {
|
413
|
+
fprintf(stderr, "%s: test(false) failed\n", argv[0]);
|
414
|
+
return ret;
|
415
|
+
}
|
416
|
+
|
417
|
+
if (t_probe_defer_taskrun()) {
|
418
|
+
ret = test(true);
|
419
|
+
if (ret != T_EXIT_PASS) {
|
420
|
+
fprintf(stderr, "%s: test(true) failed\n", argv[0]);
|
421
|
+
return ret;
|
422
|
+
}
|
423
|
+
}
|
424
|
+
|
386
425
|
return ret;
|
387
426
|
}
|
@@ -0,0 +1,60 @@
|
|
1
|
+
/* SPDX-License-Identifier: MIT */
|
2
|
+
/*
|
3
|
+
* Test liburing nolibc functionality.
|
4
|
+
*
|
5
|
+
* Currently, supported architectures are:
|
6
|
+
* 1) x86
|
7
|
+
* 2) x86-64
|
8
|
+
* 3) aarch64
|
9
|
+
*
|
10
|
+
*/
|
11
|
+
#include "helpers.h"
|
12
|
+
|
13
|
+
#if !defined(__x86_64__) && !defined(__i386__) && !defined(__aarch64__)
|
14
|
+
|
15
|
+
/*
|
16
|
+
* This arch doesn't support nolibc.
|
17
|
+
*/
|
18
|
+
int main(void)
|
19
|
+
{
|
20
|
+
return T_EXIT_SKIP;
|
21
|
+
}
|
22
|
+
|
23
|
+
#else /* #if !defined(__x86_64__) && !defined(__i386__) && !defined(__aarch64__) */
|
24
|
+
|
25
|
+
#ifndef CONFIG_NOLIBC
|
26
|
+
#define CONFIG_NOLIBC
|
27
|
+
#endif
|
28
|
+
|
29
|
+
#include <stdio.h>
|
30
|
+
#include <unistd.h>
|
31
|
+
#include "../src/lib.h"
|
32
|
+
|
33
|
+
static int test_get_page_size(void)
|
34
|
+
{
|
35
|
+
long a, b;
|
36
|
+
|
37
|
+
a = sysconf(_SC_PAGESIZE);
|
38
|
+
b = get_page_size();
|
39
|
+
if (a != b) {
|
40
|
+
fprintf(stderr, "get_page_size() fails, %ld != %ld", a, b);
|
41
|
+
return -1;
|
42
|
+
}
|
43
|
+
return 0;
|
44
|
+
}
|
45
|
+
|
46
|
+
int main(int argc, char *argv[])
|
47
|
+
{
|
48
|
+
int ret;
|
49
|
+
|
50
|
+
if (argc > 1)
|
51
|
+
return T_EXIT_SKIP;
|
52
|
+
|
53
|
+
ret = test_get_page_size();
|
54
|
+
if (ret)
|
55
|
+
return T_EXIT_FAIL;
|
56
|
+
|
57
|
+
return T_EXIT_PASS;
|
58
|
+
}
|
59
|
+
|
60
|
+
#endif /* #if !defined(__x86_64__) && !defined(__i386__) && !defined(__aarch64__) */
|