- File:
-
- 1 edited
-
libcfa/src/concurrency/io/call.cfa.in (modified) (4 diffs)
Legend:
- Unmodified
- Added
- Removed
-
libcfa/src/concurrency/io/call.cfa.in
rec19b21 rfe9468e2 74 74 ; 75 75 76 extern [* volatilestruct 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 ); 77 77 extern void __submit( struct io_context * ctx, __u32 idx ) __attribute__((nonnull (1))); 78 78 … … 222 222 __u32 idx; 223 223 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; 226 227 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} 239 229 240 230 verify( sqe->user_data == (__u64)(uintptr_t)&future ); … … 322 312 }), 323 313 # 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', 328 318 'accept_flags': 'flags' 329 319 }), … … 474 464 475 465 print(""" 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 #else481 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 found503 if( future.result == -EALREADY) return true; // Entry found but in progress504 if( future.result == -ENOENT ) return false; // Entry not found505 return false;506 #endif507 }508 509 466 //----------------------------------------------------------------------------- 510 467 // Check if a function is has asynchronous
Note:
See TracChangeset
for help on using the changeset viewer.