Ignore:
File:
1 edited

Legend:

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

    rec19b21 rfe9468e2  
    7474        ;
    7575
    76         extern [* volatile struct io_uring_sqe, __u32] __submit_alloc( struct __io_data & ring, __u64 data );
     76        extern [* struct io_uring_sqe, __u32] __submit_alloc( struct __io_data & ring, __u64 data );
    7777        extern void __submit( struct io_context * ctx, __u32 idx ) __attribute__((nonnull (1)));
    7878
     
    222222                __u32 idx;
    223223                struct io_uring_sqe * sqe;
    224                 [(volatile struct io_uring_sqe *) sqe, idx] = __submit_alloc( ring, (__u64)(uintptr_t)&future );
    225 
     224                [sqe, idx] = __submit_alloc( ring, (__u64)(uintptr_t)&future );
     225
     226                sqe->__pad2[0] = sqe->__pad2[1] = sqe->__pad2[2] = 0;
    226227                sqe->opcode = IORING_OP_{op};
    227                 sqe->flags = sflags;
    228                 sqe->ioprio = 0;
    229                 sqe->fd = 0;
    230                 sqe->off = 0;
    231                 sqe->addr = 0;
    232                 sqe->len = 0;
    233                 sqe->fsync_flags = 0;
    234                 sqe->__pad2[0] = 0;
    235                 sqe->__pad2[1] = 0;
    236                 sqe->__pad2[2] = 0;{body}
    237 
    238                 asm volatile("": : :"memory");
     228                sqe->flags = sflags;{body}
    239229
    240230                verify( sqe->user_data == (__u64)(uintptr_t)&future );
     
    322312        }),
    323313        # CFA_HAVE_IORING_OP_ACCEPT
    324         Call('ACCEPT', 'int accept4(int sockfd, struct sockaddr *addr, socklen_t *addrlen, int flags)', {
    325                 'fd': 'sockfd',
    326                 'addr': '(__u64)addr',
    327                 'addr2': '(__u64)addrlen',
     314        Call('ACCEPT4', 'int accept4(int sockfd, struct sockaddr *addr, socklen_t *addrlen, int flags)', {
     315                'fd': 'sockfd',
     316                'addr': 'addr',
     317                'addr2': 'addrlen',
    328318                'accept_flags': 'flags'
    329319        }),
     
    474464
    475465print("""
    476 //-----------------------------------------------------------------------------
    477 bool cancel(io_cancellation & this) {
    478         #if !defined(CFA_HAVE_LINUX_IO_URING_H) || !defined(CFA_HAVE_IORING_OP_ASYNC_CANCEL)
    479                 return false;
    480         #else
    481                 io_future_t future;
    482 
    483                 io_context * context = __get_io_context();
    484 
    485                 __u8 sflags = 0;
    486                 struct __io_data & ring = *context->thrd.ring;
    487 
    488                 __u32 idx;
    489                 volatile struct io_uring_sqe * sqe;
    490                 [sqe, idx] = __submit_alloc( ring, (__u64)(uintptr_t)&future );
    491 
    492                 sqe->__pad2[0] = sqe->__pad2[1] = sqe->__pad2[2] = 0;
    493                 sqe->opcode = IORING_OP_ASYNC_CANCEL;
    494                 sqe->flags = sflags;
    495                 sqe->addr = this.target;
    496 
    497                 verify( sqe->user_data == (__u64)(uintptr_t)&future );
    498                 __submit( context, idx );
    499 
    500                 wait(future);
    501 
    502                 if( future.result == 0 ) return true; // Entry found
    503                 if( future.result == -EALREADY) return true; // Entry found but in progress
    504                 if( future.result == -ENOENT ) return false; // Entry not found
    505                 return false;
    506         #endif
    507 }
    508 
    509466//-----------------------------------------------------------------------------
    510467// Check if a function is has asynchronous
Note: See TracChangeset for help on using the changeset viewer.