Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • libcfa/src/concurrency/io.cfa

    rd3605f8 r2514f68b  
    3333                #include <sys/syscall.h>
    3434                #include <sys/eventfd.h>
    35                 #include <sys/uio.h>
    3635
    3736                #include <linux/io_uring.h>
     
    134133        }
    135134
    136         bool __cfa_io_flush( processor * proc, int min_comp ) {
     135        bool __cfa_io_flush( processor * proc, bool wait ) {
    137136                /* paranoid */ verify( ! __preemption_enabled() );
    138137                /* paranoid */ verify( proc );
     
    145144
    146145                __STATS__( true, io.calls.flush++; )
    147                 int ret = syscall( __NR_io_uring_enter, ctx.fd, ctx.sq.to_submit, min_comp, min_comp > 0 ? IORING_ENTER_GETEVENTS : 0, (sigset_t *)0p, _NSIG / 8);
     146                int ret = syscall( __NR_io_uring_enter, ctx.fd, ctx.sq.to_submit, wait ? 1 : 0, 0, (sigset_t *)0p, _NSIG / 8);
    148147                if( ret < 0 ) {
    149148                        switch((int)errno) {
     
    303302                ctx->proc->io.dirty   = true;
    304303                if(sq.to_submit > 30 || !lazy) {
    305                         __cfa_io_flush( ctx->proc, 0 );
     304                        __cfa_io_flush( ctx->proc, false );
    306305                }
    307306        }
     
    503502        }
    504503
    505         #if defined(CFA_WITH_IO_URING_IDLE)
    506                 bool __kernel_read(processor * proc, io_future_t & future, iovec & iov, int fd) {
     504        #if defined(IO_URING_IDLE)
     505                bool __kernel_read(processor * proc, io_future_t & future, char buf[], int fd) {
    507506                        $io_context * ctx = proc->io.ctx;
    508507                        /* paranoid */ verify( ! __preemption_enabled() );
     
    519518                        __fill( &sqe, 1, &idx, ctx );
    520519
     520                        sqe->opcode = IORING_OP_READ;
    521521                        sqe->user_data = (uintptr_t)&future;
    522522                        sqe->flags = 0;
    523                         sqe->fd = fd;
     523                        sqe->ioprio = 0;
     524                        sqe->fd = 0;
    524525                        sqe->off = 0;
    525                         sqe->ioprio = 0;
    526526                        sqe->fsync_flags = 0;
    527527                        sqe->__pad2[0] = 0;
    528528                        sqe->__pad2[1] = 0;
    529529                        sqe->__pad2[2] = 0;
    530 
    531                         #if defined(CFA_HAVE_IORING_OP_READ)
    532                                 sqe->opcode = IORING_OP_READ;
    533                                 sqe->addr = (uint64_t)iov.iov_base;
    534                                 sqe->len = iov.iov_len;
    535                         #elif defined(CFA_HAVE_READV) && defined(CFA_HAVE_IORING_OP_READV)
    536                                 sqe->opcode = IORING_OP_READV;
    537                                 sqe->addr = (uintptr_t)&iov;
    538                                 sqe->len = 1;
    539                         #else
    540                                 #error CFA_WITH_IO_URING_IDLE but none of CFA_HAVE_READV, CFA_HAVE_IORING_OP_READV or CFA_HAVE_IORING_OP_READ defined
    541                         #endif
     530                        sqe->addr = (uintptr_t)buf;
     531                        sqe->len = sizeof(uint64_t);
    542532
    543533                        asm volatile("": : :"memory");
Note: See TracChangeset for help on using the changeset viewer.