Skip to content

Commit d4da667

Browse files
authored
Merge pull request #46 from talex5/uring-2.1
Update to liburing 2.1
2 parents f41a1f4 + ce392e9 commit d4da667

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

101 files changed

+5164
-1479
lines changed

lib/uring/dune

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
(language c)
88
(names uring_stubs)
99
(include_dirs include)
10+
(flags :standard "-D_GNU_SOURCE")
1011
(extra_deps include/liburing/compat.h)))
1112

1213
(rule
@@ -29,7 +30,7 @@
2930
"%{ocaml-config:ocamlc_cflags}"
3031
(run make -j -C src))))
3132
(copy %{project_root}/vendor/liburing/src/liburing.a liburing.a)
32-
(copy %{project_root}/vendor/liburing/src/liburing.so.2.0.0 dlluring.so)
33+
(copy %{project_root}/vendor/liburing/src/liburing.so.2.1.0 dlluring.so)
3334
(copy %{project_root}/vendor/liburing/src/include/liburing.h liburing.h)
3435
(copy %{project_root}/vendor/liburing/src/include/liburing/io_uring.h
3536
io_uring.h)

lib/uring/uring_stubs.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -478,6 +478,7 @@ value ocaml_uring_wait_cqe_timeout(value v_timeout, value v_uring)
478478
int res;
479479
dprintf("cqe: waiting, timeout %fs\n", timeout);
480480
caml_enter_blocking_section();
481+
io_uring_submit(ring);
481482
res = io_uring_wait_cqe_timeout(ring, &cqe, &t);
482483
caml_leave_blocking_section();
483484
if (res < 0) {
@@ -502,6 +503,7 @@ value ocaml_uring_wait_cqe(value v_uring)
502503
int res;
503504
dprintf("cqe: waiting\n");
504505
caml_enter_blocking_section();
506+
io_uring_submit(ring);
505507
res = io_uring_wait_cqe(ring, &cqe);
506508
caml_leave_blocking_section();
507509
if (res < 0) {

vendor/liburing/.gitignore

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@
4545
/test/defer
4646
/test/double-poll-crash
4747
/test/eeed8b54e0df-test
48+
/test/empty-eownerdead
4849
/test/eventfd
4950
/test/eventfd-disable
5051
/test/eventfd-ring
@@ -57,6 +58,7 @@
5758
/test/files-exit-hang-timeout
5859
/test/fixed-link
5960
/test/fsync
61+
/test/hardlink
6062
/test/io-cancel
6163
/test/io_uring_enter
6264
/test/io_uring_register
@@ -68,6 +70,7 @@
6870
/test/link-timeout
6971
/test/link_drain
7072
/test/madvise
73+
/test/mkdir
7174
/test/nop
7275
/test/nop-all-sizes
7376
/test/open-close
@@ -91,6 +94,7 @@
9194
/test/self
9295
/test/send_recv
9396
/test/send_recvmsg
97+
/test/sendmsg_fs_cve
9498
/test/shared-wq
9599
/test/short-read
96100
/test/shutdown
@@ -103,18 +107,28 @@
103107
/test/sq-poll-dup
104108
/test/sq-poll-kthread
105109
/test/sq-poll-share
110+
/test/sqpoll-disable-exit
111+
/test/sqpoll-exit-hang
106112
/test/sqpoll-sleep
107113
/test/sq-space_left
108114
/test/statx
109115
/test/stdout
110116
/test/submit-reuse
117+
/test/symlink
111118
/test/teardowns
112119
/test/thread-exit
113120
/test/timeout
114121
/test/timeout-new
115122
/test/timeout-overflow
116123
/test/unlink
117124
/test/wakeup-hang
125+
/test/multicqes_drain
126+
/test/poll-mshot-update
127+
/test/rsrc_tags
128+
/test/rw_merge_test
129+
/test/sqpoll-cancel-hang
130+
/test/testfile
131+
/test/submit-link-fail
118132
/test/*.dmesg
119133

120134
config-host.h

vendor/liburing/Makefile

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,8 @@ install: $(NAME).pc
5656
$(INSTALL) -m 644 man/*.2 $(DESTDIR)$(mandir)/man2
5757
$(INSTALL) -m 755 -d $(DESTDIR)$(mandir)/man3
5858
$(INSTALL) -m 644 man/*.3 $(DESTDIR)$(mandir)/man3
59+
$(INSTALL) -m 755 -d $(DESTDIR)$(mandir)/man7
60+
$(INSTALL) -m 644 man/*.7 $(DESTDIR)$(mandir)/man7
5961

6062
install-tests:
6163
@$(MAKE) -C test install prefix=$(DESTDIR)$(prefix) datadir=$(DESTDIR)$(datadir)

vendor/liburing/configure

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,8 @@ Options: [defaults in brackets after descriptions]
6969
--libdevdir=PATH install development libraries in PATH [$libdevdir]
7070
--mandir=PATH install man pages in PATH [$mandir]
7171
--datadir=PATH install shared data in PATH [$datadir]
72+
--cc=CMD use CMD as the C compiler
73+
--cxx=CMD use CMD as the C++ compiler
7274
EOF
7375
exit 0
7476
fi
@@ -191,6 +193,37 @@ print_and_output_mak "relativelibdir" "$relativelibdir"
191193
print_and_output_mak "mandir" "$mandir"
192194
print_and_output_mak "datadir" "$datadir"
193195

196+
##########################################
197+
# check for compiler -Wstringop-overflow
198+
stringop_overflow="no"
199+
cat > $TMPC << EOF
200+
#include <linux/fs.h>
201+
int main(int argc, char **argv)
202+
{
203+
return 0;
204+
}
205+
EOF
206+
if compile_prog "-Werror -Wstringop-overflow=0" "" "stringop_overflow"; then
207+
stringop_overflow="yes"
208+
fi
209+
print_config "stringop_overflow" "$stringop_overflow"
210+
211+
##########################################
212+
# check for compiler -Warryr-bounds
213+
array_bounds="no"
214+
cat > $TMPC << EOF
215+
#include <linux/fs.h>
216+
int main(int argc, char **argv)
217+
{
218+
return 0;
219+
}
220+
EOF
221+
if compile_prog "-Werror -Warray-bounds=0" "" "array_bounds"; then
222+
array_bounds="yes"
223+
fi
224+
print_config "array_bounds" "$array_bounds"
225+
226+
194227
##########################################
195228
# check for __kernel_rwf_t
196229
__kernel_rwf_t="no"
@@ -296,6 +329,7 @@ int main(int argc, char **argv)
296329
{
297330
ucontext_t ctx;
298331
getcontext(&ctx);
332+
makecontext(&ctx, 0, 0);
299333
return 0;
300334
}
301335
EOF
@@ -325,6 +359,12 @@ fi
325359
if test "$has_ucontext" = "yes"; then
326360
output_sym "CONFIG_HAVE_UCONTEXT"
327361
fi
362+
if test "$stringop_overflow" = "yes"; then
363+
output_sym "CONFIG_HAVE_STRINGOP_OVERFLOW"
364+
fi
365+
if test "$array_bounds" = "yes"; then
366+
output_sym "CONFIG_HAVE_ARRAY_BOUNDS"
367+
fi
328368

329369
echo "CC=$cc" >> $config_host_mak
330370
print_config "CC" "$cc"

vendor/liburing/debian/rules

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ install-arch: check-arch
5151
DESTDIR=$(CURDIR)/debian/tmp \
5252
libdir=/lib/$(DEB_HOST_MULTIARCH) \
5353
libdevdir=/usr/lib/$(DEB_HOST_MULTIARCH) \
54-
relativelibdir=/lib/$(DEB_HOST_MULTIARCH)
54+
relativelibdir=/lib/$(DEB_HOST_MULTIARCH)/
5555

5656
binary: binary-indep binary-arch
5757

vendor/liburing/examples/Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ CPPFLAGS ?=
22
override CPPFLAGS += -D_GNU_SOURCE -I../src/include/
33
CFLAGS ?= -g -O2
44
XCFLAGS =
5-
override CFLAGS += -Wall -L../src/
5+
override CFLAGS += -D_GNU_SOURCE -Wall -L../src/
66

77
include ../Makefile.quiet
88

vendor/liburing/examples/io_uring-cp.c

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -221,6 +221,25 @@ static int copy_file(struct io_uring *ring, off_t insize)
221221
}
222222
}
223223

224+
/* wait out pending writes */
225+
while (writes) {
226+
struct io_data *data;
227+
228+
ret = io_uring_wait_cqe(ring, &cqe);
229+
if (ret) {
230+
fprintf(stderr, "wait_cqe=%d\n", ret);
231+
return 1;
232+
}
233+
if (cqe->res < 0) {
234+
fprintf(stderr, "write res=%d\n", cqe->res);
235+
return 1;
236+
}
237+
data = io_uring_cqe_get_data(cqe);
238+
free(data);
239+
writes--;
240+
io_uring_cqe_seen(ring, cqe);
241+
}
242+
224243
return 0;
225244
}
226245

vendor/liburing/examples/link-cp.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ static int handle_cqe(struct io_uring *ring, struct io_uring_cqe *cqe)
9898
queue_rw_pair(ring, BS, data->offset);
9999
inflight += 2;
100100
} else {
101-
printf("cqe error: %s\n", strerror(cqe->res));
101+
printf("cqe error: %s\n", strerror(-cqe->res));
102102
ret = 1;
103103
}
104104
}
@@ -145,7 +145,7 @@ static int copy_file(struct io_uring *ring, off_t insize)
145145

146146
ret = io_uring_wait_cqe(ring, &cqe);
147147
if (ret < 0) {
148-
printf("wait cqe: %s\n", strerror(ret));
148+
printf("wait cqe: %s\n", strerror(-ret));
149149
return 1;
150150
}
151151
if (handle_cqe(ring, cqe))

vendor/liburing/examples/ucontext-cp.c

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@
2828

2929
typedef struct {
3030
struct io_uring *ring;
31-
unsigned char stack_buf[SIGSTKSZ];
31+
unsigned char *stack_buf;
3232
ucontext_t ctx_main, ctx_fnew;
3333
} async_context;
3434

@@ -115,8 +115,13 @@ static int setup_context(async_context *pctx, struct io_uring *ring)
115115
perror("getcontext");
116116
return -1;
117117
}
118-
pctx->ctx_fnew.uc_stack.ss_sp = &pctx->stack_buf;
119-
pctx->ctx_fnew.uc_stack.ss_size = sizeof(pctx->stack_buf);
118+
pctx->stack_buf = malloc(SIGSTKSZ);
119+
if (!pctx->stack_buf) {
120+
perror("malloc");
121+
return -1;
122+
}
123+
pctx->ctx_fnew.uc_stack.ss_sp = pctx->stack_buf;
124+
pctx->ctx_fnew.uc_stack.ss_size = SIGSTKSZ;
120125
pctx->ctx_fnew.uc_link = &pctx->ctx_main;
121126

122127
return 0;
@@ -174,6 +179,7 @@ static void copy_file_wrapper(arguments_bundle *pbundle)
174179
free(iov.iov_base);
175180
close(pbundle->infd);
176181
close(pbundle->outfd);
182+
free(pbundle->pctx->stack_buf);
177183
free(pbundle->pctx);
178184
free(pbundle);
179185

0 commit comments

Comments
 (0)