LCOV - code coverage report
Current view: top level - util/io_uring - fd_io_uring_sys.h (source / functions) Hit Total Coverage
Test: cov.lcov Lines: 0 15 0.0 %
Date: 2026-08-14 04:54:57 Functions: 0 0 -

          Line data    Source code
       1             : #ifndef HEADER_fd_src_util_io_fd_io_uring_sys_h
       2             : #define HEADER_fd_src_util_io_fd_io_uring_sys_h
       3             : 
       4             : /* fd_io_uring_sys.h provides the io_uring syscall API. */
       5             : 
       6             : #include "../fd_util_base.h"
       7             : 
       8             : #ifndef IORING_SETUP_R_DISABLED
       9             : #define IORING_SETUP_R_DISABLED (1U<<6)
      10             : #endif
      11             : 
      12             : #ifndef IORING_SETUP_COOP_TASKRUN
      13             : #define IORING_SETUP_COOP_TASKRUN (1U << 8)
      14             : #endif
      15             : 
      16             : #ifndef IORING_SETUP_SINGLE_ISSUER
      17             : #define IORING_SETUP_SINGLE_ISSUER (1U<<12)
      18             : #endif
      19             : 
      20             : #ifndef IORING_SETUP_DEFER_TASKRUN
      21             : #define IORING_SETUP_DEFER_TASKRUN (1U << 13)
      22             : #endif
      23             : 
      24             : #ifndef IORING_SETUP_NO_MMAP
      25             : #define IORING_SETUP_NO_MMAP (1U<<14)
      26             : #endif
      27             : 
      28           0 : #define FD_IORING_REGISTER_BUFFERS       0
      29           0 : #define FD_IORING_REGISTER_FILES         2
      30           0 : #define FD_IORING_REGISTER_FILES_UPDATE  6
      31           0 : #define FD_IORING_REGISTER_RESTRICTIONS 11
      32           0 : #define FD_IORING_REGISTER_ENABLE_RINGS 12
      33             : 
      34           0 : #define FD_IORING_RESTRICTION_REGISTER_OP        0
      35           0 : #define FD_IORING_RESTRICTION_SQE_OP             1
      36           0 : #define FD_IORING_RESTRICTION_SQE_FLAGS_ALLOWED  2
      37           0 : #define FD_IORING_RESTRICTION_SQE_FLAGS_REQUIRED 3
      38             : 
      39             : #define FD_IORING_OP_NOP                     0
      40             : #define FD_IORING_OP_READV                   1
      41             : #define FD_IORING_OP_WRITEV                  2
      42             : #define FD_IORING_OP_FSYNC                   3
      43           0 : #define FD_IORING_OP_READ_FIXED              4
      44             : #define FD_IORING_OP_WRITE_FIXED             5
      45             : #define FD_IORING_OP_POLL_ADD                6
      46             : #define FD_IORING_OP_POLL_REMOVE             7
      47             : #define FD_IORING_OP_SYNC_FILE_RANGE         8
      48             : #define FD_IORING_OP_SENDMSG                 9
      49             : #define FD_IORING_OP_RECVMSG                10
      50             : #define FD_IORING_OP_TIMEOUT                11
      51             : #define FD_IORING_OP_TIMEOUT_REMOVE         12
      52           0 : #define FD_IORING_OP_ACCEPT                 13
      53             : #define FD_IORING_OP_ASYNC_CANCEL           14
      54           0 : #define FD_IORING_OP_LINK_TIMEOUT           15
      55             : #define FD_IORING_OP_CONNECT                16
      56             : #define FD_IORING_OP_FALLOCATE              17
      57             : #define FD_IORING_OP_OPENAT                 18
      58             : #define FD_IORING_OP_CLOSE                  19
      59             : #define FD_IORING_OP_FILES_UPDATE           20
      60             : #define FD_IORING_OP_STATX                  21
      61             : #define FD_IORING_OP_READ                   22
      62             : #define FD_IORING_OP_WRITE                  23
      63             : #define FD_IORING_OP_FADVISE                24
      64             : #define FD_IORING_OP_MADVISE                25
      65           0 : #define FD_IORING_OP_SEND                   26
      66           0 : #define FD_IORING_OP_RECV                   27
      67             : #define FD_IORING_OP_OPENAT2                28
      68             : #define FD_IORING_OP_EPOLL_CTL              29
      69             : #define FD_IORING_OP_SPLICE                 30
      70             : #define FD_IORING_OP_PROVIDE_BUFFERS        31
      71             : #define FD_IORING_OP_REMOVE_BUFFERS         32
      72             : #define FD_IORING_OP_TEE                    33
      73             : #define FD_IORING_OP_SHUTDOWN               34
      74             : #define FD_IORING_OP_RENAMEAT               35
      75             : #define FD_IORING_OP_UNLINKAT               36
      76             : #define FD_IORING_OP_MKDIRAT                37
      77             : #define FD_IORING_OP_SYMLINKAT              38
      78             : #define FD_IORING_OP_LINKAT                 39
      79             : #define FD_IORING_OP_MSG_RING               40
      80             : #define FD_IORING_OP_FSETXATTR              41
      81             : #define FD_IORING_OP_SETXATTR               42
      82             : #define FD_IORING_OP_FGETXATTR              43
      83             : #define FD_IORING_OP_GETXATTR               44
      84             : #define FD_IORING_OP_SOCKET                 45
      85             : #define FD_IORING_OP_URING_CMD              46
      86             : #define FD_IORING_OP_SEND_ZC                47
      87             : #define FD_IORING_OP_SENDMSG_ZC             48
      88             : #define FD_IORING_OP_READ_MULTISHOT         49
      89             : #define FD_IORING_OP_WAITID                 50
      90           0 : #define FD_IORING_OP_FUTEX_WAIT             51
      91             : #define FD_IORING_OP_FUTEX_WAKE             52
      92             : #define FD_IORING_OP_FUTEX_WAITV            53
      93             : 
      94             : #ifndef IOSQE_CQE_SKIP_SUCCESS
      95             : #define IOSQE_CQE_SKIP_SUCCESS (1U<<6)
      96             : #endif
      97             : 
      98             : #ifndef IORING_RECVSEND_FIXED_BUF
      99             : #define IORING_RECVSEND_FIXED_BUF (1U<<2)
     100             : #endif
     101             : 
     102             : #ifndef FUTEX2_SIZE_U32
     103             : #define FUTEX2_SIZE_U32 0x02
     104             : #endif
     105             : 
     106             : struct fd_io_uring_restriction {
     107             :   ushort opcode;
     108             :   union {
     109             :     uchar register_op;
     110             :     uchar sqe_op;
     111             :     uchar sqe_flags;
     112             :   };
     113             :   uchar resv;
     114             :   uint  resv2[3];
     115             : };
     116             : 
     117             : typedef struct fd_io_uring_restriction fd_io_uring_restriction_t;
     118             : 
     119             : struct fd_io_sqring_offsets {
     120             :   uint head;
     121             :   uint tail;
     122             :   uint ring_mask;
     123             :   uint ring_entries;
     124             :   uint flags;
     125             :   uint dropped;
     126             :   uint array;
     127             :   uint resv1;
     128             :   ulong user_addr;
     129             : };
     130             : 
     131             : typedef struct fd_io_sqring_offsets fd_io_sqring_offsets_t;
     132             : 
     133             : struct fd_io_cqring_offsets {
     134             :   uint head;
     135             :   uint tail;
     136             :   uint ring_mask;
     137             :   uint ring_entries;
     138             :   uint overflow;
     139             :   uint cqes;
     140             :   uint flags;
     141             :   uint resv1;
     142             :   ulong user_addr;
     143             : };
     144             : 
     145             : typedef struct fd_io_cqring_offsets fd_io_cqring_offsets_t;
     146             : 
     147             : struct fd_io_uring_params {
     148             :   uint sq_entries;
     149             :   uint cq_entries;
     150             :   uint flags;
     151             :   uint sq_thread_cpu;
     152             :   uint sq_thread_idle;
     153             :   uint features;
     154             :   uint wq_fd;
     155             :   uint resv[3];
     156             :   fd_io_sqring_offsets_t sq_off;
     157             :   fd_io_cqring_offsets_t cq_off;
     158             : };
     159             : 
     160             : typedef struct fd_io_uring_params fd_io_uring_params_t;
     161             : 
     162             : FD_PROTOTYPES_BEGIN
     163             : 
     164             : /* fd_io_uring_enter wraps the fd_io_uring_enter(2) syscall. */
     165             : 
     166             : int
     167             : fd_io_uring_enter( int    ring_fd,
     168             :                    uint   to_submit,
     169             :                    uint   min_complete,
     170             :                    uint   flags,
     171             :                    void * arg,
     172             :                    ulong  arg_sz );
     173             : 
     174             : /* fd_io_uring_register wraps the io_uring_register(2) syscall. */
     175             : 
     176             : int
     177             : fd_io_uring_register( int          ring_fd,
     178             :                       uint         opcode,
     179             :                       void const * arg,
     180             :                       uint         arg_cnt );
     181             : 
     182             : /* fd_io_uring_setup wraps the io_uring_setup(2) syscall. */
     183             : 
     184             : int
     185             : fd_io_uring_setup( uint                   entry_cnt,
     186             :                    fd_io_uring_params_t * p );
     187             : 
     188             : FD_PROTOTYPES_END
     189             : 
     190             : #endif /* HEADER_fd_src_util_io_fd_io_uring_sys_h */

Generated by: LCOV version 1.14