Signed-off-by: Gabriel Krisman Bertazi <krisman@xxxxxxx> --- src/include/liburing.h | 25 +++++++++++++++++++++++++ src/include/liburing/io_uring.h | 3 +++ 2 files changed, 28 insertions(+) diff --git a/src/include/liburing.h b/src/include/liburing.h index 627fc47..6d344b1 100644 --- a/src/include/liburing.h +++ b/src/include/liburing.h @@ -1229,6 +1229,31 @@ IOURINGINLINE void io_uring_prep_socket_direct_alloc(struct io_uring_sqe *sqe, __io_uring_set_target_fixed_file(sqe, IORING_FILE_INDEX_ALLOC - 1); } +static inline void io_uring_prep_clone(struct io_uring_sqe *sqe) +{ + io_uring_prep_rw(IORING_OP_CLONE, sqe, 0, NULL, 0, 0); +} + +static inline void io_uring_prep_execveat(struct io_uring_sqe *sqe, int dfd, + const char *filename, char *const *argv, + char *const *envp, int flags) +{ + io_uring_prep_rw(IORING_OP_EXECVEAT, sqe, dfd, filename, 0, 0); + sqe->addr2 = (unsigned long)(void *)argv; + sqe->addr3 = (unsigned long)(void *)envp; + sqe->execve_flags = flags; +} + +static inline void io_uring_prep_exec(struct io_uring_sqe *sqe, + const char *filename, char *const *argv, + char *const *envp) +{ + io_uring_prep_rw(IORING_OP_EXECVEAT, sqe, 0, filename, 0, 0); + sqe->addr2 = (unsigned long)(void *)argv; + sqe->addr3 = (unsigned long)(void *)envp; +} + + /* * Prepare commands for sockets */ diff --git a/src/include/liburing/io_uring.h b/src/include/liburing/io_uring.h index 7659198..a198969 100644 --- a/src/include/liburing/io_uring.h +++ b/src/include/liburing/io_uring.h @@ -73,6 +73,7 @@ struct io_uring_sqe { __u32 futex_flags; __u32 install_fd_flags; __u32 nop_flags; + __u32 execve_flags; }; __u64 user_data; /* data to be passed back at completion time */ /* pack this to avoid bogus arm OABI complaints */ @@ -262,6 +263,8 @@ enum io_uring_op { IORING_OP_FTRUNCATE, IORING_OP_BIND, IORING_OP_LISTEN, + IORING_OP_CLONE, + IORING_OP_EXECVEAT, /* this goes last, obviously */ IORING_OP_LAST, -- 2.47.0