source: libcfa/src/concurrency/iocall.cfa @ 1a39a5a

arm-ehenumforall-pointer-decayjacob/cs343-translationnew-astnew-ast-unique-exprpthread-emulationqualifiedEnum
Last change on this file since 1a39a5a was 1a39a5a, checked in by Thierry Delisle <tdelisle@…>, 3 years ago

Fixed compilation failure without io_uring

  • Property mode set to 100644
File size: 18.8 KB
Line 
1//
2// Cforall Version 1.0.0 Copyright (C) 2020 University of Waterloo
3//
4// The contents of this file are covered under the licence agreement in the
5// file "LICENCE" distributed with Cforall.
6//
7// iocall.cfa --
8//
9// Author           : Thierry Delisle
10// Created On       : Wed Jul  1 14:51:00 2020
11// Last Modified By :
12// Last Modified On :
13// Update Count     :
14//
15
16#define __cforall_thread__
17
18#include "bits/defs.hfa"
19#include "kernel.hfa"
20
21//=============================================================================================
22// I/O uring backend
23//=============================================================================================
24
25#if defined(CFA_HAVE_LINUX_IO_URING_H)
26        #include <assert.h>
27        #include <stdint.h>
28        #include <errno.h>
29        #include <linux/io_uring.h>
30
31        #include "kernel/fwd.hfa"
32        #include "io/types.hfa"
33
34        extern [* struct io_uring_sqe, uint32_t] __submit_alloc( struct __io_data & ring, uint64_t data );
35        extern void __submit( struct io_context * ctx, uint32_t idx ) __attribute__((nonnull (1)));
36
37        static inline void ?{}(struct io_uring_sqe & this, uint8_t opcode, int fd) {
38                this.opcode = opcode;
39                #if !defined(IOSQE_ASYNC)
40                        this.flags = 0;
41                #else
42                        this.flags = IOSQE_ASYNC;
43                #endif
44                this.ioprio = 0;
45                this.fd = fd;
46                this.off = 0;
47                this.addr = 0;
48                this.len = 0;
49                this.rw_flags = 0;
50                this.__pad2[0] = this.__pad2[1] = this.__pad2[2] = 0;
51        }
52
53        static inline void ?{}(struct io_uring_sqe & this, uint8_t opcode, int fd, void * addr, uint32_t len, uint64_t off ) {
54                (this){ opcode, fd };
55                this.off = off;
56                this.addr = (uint64_t)(uintptr_t)addr;
57                this.len = len;
58        }
59
60        static inline io_context * __get_io_context( void ) {
61                cluster * cltr = active_cluster();
62                /* paranoid */ verifyf( cltr, "No active cluster for io operation\n");
63                assertf( cltr->io.cnt > 0, "Cluster %p has no default io contexts and no context was specified\n", cltr );
64                /* paranoid */ verifyf( cltr->io.ctxs, "default io contexts for cluster %p are missing\n", cltr);
65                return &cltr->io.ctxs[ __tls_rand() % cltr->io.cnt ];
66        }
67
68
69      #if defined(CFA_HAVE_IOSQE_FIXED_FILE) && defined(CFA_HAVE_IOSQE_IO_DRAIN) && defined(CFA_HAVE_IOSQE_ASYNC)
70                #define REGULAR_FLAGS (IOSQE_FIXED_FILE | IOSQE_IO_DRAIN | IOSQE_ASYNC)
71        #elif defined(CFA_HAVE_IOSQE_FIXED_FILE) && defined(CFA_HAVE_IOSQE_ASYNC)
72                #define REGULAR_FLAGS (IOSQE_FIXED_FILE | IOSQE_ASYNC)
73      #elif defined(CFA_HAVE_IOSQE_FIXED_FILE) && defined(CFA_HAVE_IOSQE_IO_DRAIN)
74                #define REGULAR_FLAGS (IOSQE_FIXED_FILE | IOSQE_IO_DRAIN)
75      #elif defined(CFA_HAVE_IOSQE_IO_DRAIN) && defined(CFA_HAVE_IOSQE_ASYNC)
76                #define REGULAR_FLAGS (IOSQE_IO_DRAIN | IOSQE_ASYNC)
77        #elif defined(CFA_HAVE_IOSQE_FIXED_FILE)
78                #define REGULAR_FLAGS (IOSQE_FIXED_FILE)
79      #elif defined(CFA_HAVE_IOSQE_IO_DRAIN)
80                #define REGULAR_FLAGS (IOSQE_IO_DRAIN)
81      #elif defined(CFA_HAVE_IOSQE_ASYNC)
82                #define REGULAR_FLAGS (IOSQE_ASYNC)
83        #else
84                #define REGULAR_FLAGS (0)
85        #endif
86
87        #if defined(CFA_HAVE_IOSQE_IO_LINK) && defined(CFA_HAVE_IOSQE_IO_HARDLINK)
88                #define LINK_FLAGS (IOSQE_IO_LINK | IOSQE_IO_HARDLINK)
89        #elif defined(CFA_HAVE_IOSQE_IO_LINK)
90                #define LINK_FLAGS (IOSQE_IO_LINK)
91        #elif defined(CFA_HAVE_IOSQE_IO_HARDLINK)
92                #define LINK_FLAGS (IOSQE_IO_HARDLINK)
93        #else
94                #define LINK_FLAGS (0)
95        #endif
96
97        #if defined(CFA_HAVE_SPLICE_F_FD_IN_FIXED)
98                #define SPLICE_FLAGS (SPLICE_F_FD_IN_FIXED)
99        #else
100                #define SPLICE_FLAGS (0)
101        #endif
102
103
104        #define __submit_prelude \
105                if( 0 != (submit_flags & LINK_FLAGS) ) { errno = ENOTSUP; return -1; } \
106                (void)timeout; (void)cancellation; \
107                if( !context ) context = __get_io_context(); \
108                __io_user_data_t data = { 0, active_thread() }; \
109                struct __io_data & ring = *context->thrd.ring; \
110                struct io_uring_sqe * sqe; \
111                uint32_t idx; \
112                [sqe, idx] = __submit_alloc( ring, (uint64_t)(uintptr_t)&data ); \
113                sqe->flags = REGULAR_FLAGS & submit_flags;
114
115        #define __submit_wait \
116                /*__cfaabi_bits_print_safe( STDERR_FILENO, "Preparing user data %p for %p\n", &data, data.thrd );*/ \
117                verify( sqe->user_data == (uint64_t)(uintptr_t)&data ); \
118                __submit( context, idx ); \
119                park( __cfaabi_dbg_ctx ); \
120                if( data.result < 0 ) { \
121                        errno = -data.result; \
122                        return -1; \
123                } \
124                return data.result;
125#endif
126
127//=============================================================================================
128// I/O Forwards
129//=============================================================================================
130#include <time.hfa>
131
132// Some forward declarations
133#include <errno.h>
134#include <unistd.h>
135
136extern "C" {
137        #include <sys/types.h>
138        #include <sys/socket.h>
139        #include <sys/syscall.h>
140
141#if defined(HAVE_PREADV2)
142        struct iovec;
143        extern ssize_t preadv2 (int fd, const struct iovec *iov, int iovcnt, off_t offset, int flags);
144#endif
145#if defined(HAVE_PWRITEV2)
146        struct iovec;
147        extern ssize_t pwritev2(int fd, const struct iovec *iov, int iovcnt, off_t offset, int flags);
148#endif
149
150        extern int fsync(int fd);
151        extern int sync_file_range(int fd, int64_t offset, int64_t nbytes, unsigned int flags);
152
153        struct msghdr;
154        struct sockaddr;
155        extern ssize_t sendmsg(int sockfd, const struct msghdr *msg, int flags);
156        extern ssize_t recvmsg(int sockfd, struct msghdr *msg, int flags);
157        extern ssize_t send(int sockfd, const void *buf, size_t len, int flags);
158        extern ssize_t recv(int sockfd, void *buf, size_t len, int flags);
159        extern int accept4(int sockfd, struct sockaddr *addr, socklen_t *addrlen, int flags);
160        extern int connect(int sockfd, const struct sockaddr *addr, socklen_t addrlen);
161
162        extern int fallocate(int fd, int mode, uint64_t offset, uint64_t len);
163        extern int posix_fadvise(int fd, uint64_t offset, uint64_t len, int advice);
164        extern int madvise(void *addr, size_t length, int advice);
165
166        extern int openat(int dirfd, const char *pathname, int flags, mode_t mode);
167        extern int close(int fd);
168
169        extern ssize_t read (int fd, void *buf, size_t count);
170
171        extern ssize_t splice(int fd_in, loff_t *off_in, int fd_out, loff_t *off_out, size_t len, unsigned int flags);
172        extern ssize_t tee(int fd_in, int fd_out, size_t len, unsigned int flags);
173}
174
175//=============================================================================================
176// I/O Interface
177//=============================================================================================
178
179//-----------------------------------------------------------------------------
180// Asynchronous operations
181#if defined(HAVE_PREADV2)
182        ssize_t cfa_preadv2(int fd, const struct iovec *iov, int iovcnt, off_t offset, int flags, int submit_flags, Duration timeout, io_cancellation * cancellation, io_context * context) {
183                #if !defined(CFA_HAVE_LINUX_IO_URING_H) || !defined(CFA_HAVE_IORING_OP_READV)
184                        return preadv2(fd, iov, iovcnt, offset, flags);
185                #else
186                        __submit_prelude
187
188                        (*sqe){ IORING_OP_READV, fd, iov, iovcnt, offset };
189
190                        __submit_wait
191                #endif
192        }
193#endif
194
195#if defined(HAVE_PWRITEV2)
196        ssize_t cfa_pwritev2(int fd, const struct iovec *iov, int iovcnt, off_t offset, int flags, int submit_flags, Duration timeout, io_cancellation * cancellation, io_context * context) {
197                #if !defined(CFA_HAVE_LINUX_IO_URING_H) || !defined(CFA_HAVE_IORING_OP_WRITEV)
198                        return pwritev2(fd, iov, iovcnt, offset, flags);
199                #else
200                        __submit_prelude
201
202                        (*sqe){ IORING_OP_WRITEV, fd, iov, iovcnt, offset };
203
204                        __submit_wait
205                #endif
206        }
207#endif
208
209int cfa_fsync(int fd, int submit_flags, Duration timeout, io_cancellation * cancellation, io_context * context) {
210        #if !defined(CFA_HAVE_LINUX_IO_URING_H) || !defined(CFA_HAVE_IORING_OP_FSYNC)
211                return fsync(fd);
212        #else
213                __submit_prelude
214
215                (*sqe){ IORING_OP_FSYNC, fd };
216
217                __submit_wait
218        #endif
219}
220
221int cfa_sync_file_range(int fd, int64_t offset, int64_t nbytes, unsigned int flags, int submit_flags, Duration timeout, io_cancellation * cancellation, io_context * context) {
222        #if !defined(CFA_HAVE_LINUX_IO_URING_H) || !defined(CFA_HAVE_IORING_OP_SYNC_FILE_RANGE)
223                return sync_file_range(fd, offset, nbytes, flags);
224        #else
225                __submit_prelude
226
227                (*sqe){ IORING_OP_SYNC_FILE_RANGE, fd };
228                sqe->off = offset;
229                sqe->len = nbytes;
230                sqe->sync_range_flags = flags;
231
232                __submit_wait
233        #endif
234}
235
236
237ssize_t cfa_sendmsg(int sockfd, const struct msghdr *msg, int flags, int submit_flags, Duration timeout, io_cancellation * cancellation, io_context * context) {
238        #if !defined(CFA_HAVE_LINUX_IO_URING_H) || !defined(CFA_HAVE_IORING_OP_SENDMSG)
239                return sendmsg(sockfd, msg, flags);
240        #else
241                __submit_prelude
242
243                (*sqe){ IORING_OP_SENDMSG, sockfd, msg, 1, 0 };
244                sqe->msg_flags = flags;
245
246                __submit_wait
247        #endif
248}
249
250ssize_t cfa_recvmsg(int sockfd, struct msghdr *msg, int flags, int submit_flags, Duration timeout, io_cancellation * cancellation, io_context * context) {
251        #if !defined(CFA_HAVE_LINUX_IO_URING_H) || !defined(CFA_HAVE_IORING_OP_RECVMSG)
252                return recvmsg(sockfd, msg, flags);
253        #else
254                __submit_prelude
255
256                (*sqe){ IORING_OP_RECVMSG, sockfd, msg, 1, 0 };
257                sqe->msg_flags = flags;
258
259                __submit_wait
260        #endif
261}
262
263ssize_t cfa_send(int sockfd, const void *buf, size_t len, int flags, int submit_flags, Duration timeout, io_cancellation * cancellation, io_context * context) {
264        #if !defined(CFA_HAVE_LINUX_IO_URING_H) || !defined(CFA_HAVE_IORING_OP_SEND)
265                return send( sockfd, buf, len, flags );
266        #else
267                __submit_prelude
268
269                (*sqe){ IORING_OP_SEND, sockfd };
270                sqe->addr = (uint64_t)buf;
271                sqe->len = len;
272                sqe->msg_flags = flags;
273
274                __submit_wait
275        #endif
276}
277
278ssize_t cfa_recv(int sockfd, void *buf, size_t len, int flags, int submit_flags, Duration timeout, io_cancellation * cancellation, io_context * context) {
279        #if !defined(CFA_HAVE_LINUX_IO_URING_H) || !defined(CFA_HAVE_IORING_OP_RECV)
280                return recv( sockfd, buf, len, flags );
281        #else
282                __submit_prelude
283
284                (*sqe){ IORING_OP_RECV, sockfd };
285                sqe->addr = (uint64_t)buf;
286                sqe->len = len;
287                sqe->msg_flags = flags;
288
289                __submit_wait
290        #endif
291}
292
293int cfa_accept4(int sockfd, struct sockaddr *addr, socklen_t *addrlen, int flags, int submit_flags, Duration timeout, io_cancellation * cancellation, io_context * context) {
294        #if !defined(CFA_HAVE_LINUX_IO_URING_H) || !defined(CFA_HAVE_IORING_OP_ACCEPT)
295                return accept4( sockfd, addr, addrlen, flags );
296        #else
297                __submit_prelude
298
299                (*sqe){ IORING_OP_ACCEPT, sockfd };
300                sqe->addr = addr;
301                sqe->addr2 = addrlen;
302                sqe->accept_flags = flags;
303
304                __submit_wait
305        #endif
306}
307
308int cfa_connect(int sockfd, const struct sockaddr *addr, socklen_t addrlen, int submit_flags, Duration timeout, io_cancellation * cancellation, io_context * context) {
309        #if !defined(CFA_HAVE_LINUX_IO_URING_H) || !defined(CFA_HAVE_IORING_OP_CONNECT)
310                return connect( sockfd, addr, addrlen );
311        #else
312                __submit_prelude
313
314                (*sqe){ IORING_OP_CONNECT, sockfd };
315                sqe->addr = (uint64_t)addr;
316                sqe->off = addrlen;
317
318                __submit_wait
319        #endif
320}
321
322int cfa_fallocate(int fd, int mode, uint64_t offset, uint64_t len, int submit_flags, Duration timeout, io_cancellation * cancellation, io_context * context) {
323        #if !defined(CFA_HAVE_LINUX_IO_URING_H) || !defined(CFA_HAVE_IORING_OP_FALLOCATE)
324                return fallocate( fd, mode, offset, len );
325        #else
326                __submit_prelude
327
328                (*sqe){ IORING_OP_FALLOCATE, fd };
329                sqe->off = offset;
330                sqe->len = length;
331                sqe->mode = mode;
332
333                __submit_wait
334        #endif
335}
336
337int cfa_fadvise(int fd, uint64_t offset, uint64_t len, int advice, int submit_flags, Duration timeout, io_cancellation * cancellation, io_context * context) {
338        #if !defined(CFA_HAVE_LINUX_IO_URING_H) || !defined(CFA_HAVE_IORING_OP_FADVISE)
339                return posix_fadvise( fd, offset, len, advice );
340        #else
341                __submit_prelude
342
343                (*sqe){ IORING_OP_FADVISE, fd };
344                sqe->off = (uint64_t)offset;
345                sqe->len = length;
346                sqe->fadvise_advice = advice;
347
348                __submit_wait
349        #endif
350}
351
352int cfa_madvise(void *addr, size_t length, int advice, int submit_flags, Duration timeout, io_cancellation * cancellation, io_context * context) {
353        #if !defined(CFA_HAVE_LINUX_IO_URING_H) || !defined(CFA_HAVE_IORING_OP_MADVISE)
354                return madvise( addr, length, advice );
355        #else
356                __submit_prelude
357
358                (*sqe){ IORING_OP_MADVISE, 0 };
359                sqe->addr = (uint64_t)addr;
360                sqe->len = length;
361                sqe->fadvise_advice = advice;
362
363                __submit_wait
364        #endif
365}
366
367int cfa_openat(int dirfd, const char *pathname, int flags, mode_t mode, int submit_flags, Duration timeout, io_cancellation * cancellation, io_context * context) {
368        #if !defined(CFA_HAVE_LINUX_IO_URING_H) || !defined(CFA_HAVE_IORING_OP_OPENAT)
369                return openat( dirfd, pathname, flags, mode );
370        #else
371                __submit_prelude
372
373                (*sqe){ IORING_OP_OPENAT, dirfd };
374                sqe->addr = (uint64_t)pathname;
375                sqe->open_flags = flags;
376                sqe->mode = mode;
377
378                __submit_wait
379        #endif
380}
381
382int cfa_close(int fd, int submit_flags, Duration timeout, io_cancellation * cancellation, io_context * context) {
383        #if !defined(CFA_HAVE_LINUX_IO_URING_H) || !defined(CFA_HAVE_IORING_OP_CLOSE)
384                return close( fd );
385        #else
386                __submit_prelude
387
388                (*sqe){ IORING_OP_CLOSE, fd };
389
390                __submit_wait
391        #endif
392}
393
394// Forward declare in case it is not supported
395struct statx;
396int cfa_statx(int dirfd, const char *pathname, int flags, unsigned int mask, struct statx *statxbuf, int submit_flags, Duration timeout, io_cancellation * cancellation, io_context * context) {
397        #if !defined(CFA_HAVE_LINUX_IO_URING_H) || !defined(CFA_HAVE_IORING_OP_STATX)
398                #if defined(__NR_statx)
399                        return syscall( __NR_statx, dirfd, pathname, flags, mask, statxbuf );
400                #else
401                        errno = ENOTSUP;
402                        return -1;
403                #endif
404        #else
405                __submit_prelude
406
407                (*sqe){ IORING_OP_STATX, dirfd, pathname, mask, (uint64_t)statxbuf };
408                sqe->statx_flags = flags;
409
410                __submit_wait
411        #endif
412}
413
414ssize_t cfa_read(int fd, void *buf, size_t count, int submit_flags, Duration timeout, io_cancellation * cancellation, io_context * context) {
415        #if !defined(CFA_HAVE_LINUX_IO_URING_H) || !defined(CFA_HAVE_IORING_OP_READ)
416                return read( fd, buf, count );
417        #else
418                __submit_prelude
419
420                (*sqe){ IORING_OP_READ, fd, buf, count, 0 };
421
422                __submit_wait
423        #endif
424}
425
426ssize_t cfa_write(int fd, void *buf, size_t count, int submit_flags, Duration timeout, io_cancellation * cancellation, io_context * context) {
427        #if !defined(CFA_HAVE_LINUX_IO_URING_H) || !defined(CFA_HAVE_IORING_OP_WRITE)
428                return read( fd, buf, count );
429        #else
430                __submit_prelude
431
432                (*sqe){ IORING_OP_WRITE, fd, buf, count, 0 };
433
434                __submit_wait
435        #endif
436}
437
438ssize_t cfa_splice(int fd_in, loff_t *off_in, int fd_out, loff_t *off_out, size_t len, unsigned int flags, int submit_flags, Duration timeout, io_cancellation * cancellation, io_context * context) {
439        #if !defined(CFA_HAVE_LINUX_IO_URING_H) || !defined(CFA_HAVE_IORING_OP_SPLICE)
440                return splice( fd_in, off_in, fd_out, off_out, len, flags );
441        #else
442                __submit_prelude
443
444                (*sqe){ IORING_OP_SPLICE, fd_out, 0p, len, off_out };
445                sqe->splice_fd_in  = fd_in;
446                sqe->splice_off_in = off_in;
447                sqe->splice_flags  = flags | (SPLICE_FLAGS & submit_flags);
448
449                __submit_wait
450        #endif
451}
452
453ssize_t cfa_tee(int fd_in, int fd_out, size_t len, unsigned int flags, int submit_flags, Duration timeout, io_cancellation * cancellation, io_context * context) {
454        #if !defined(CFA_HAVE_LINUX_IO_URING_H) || !defined(CFA_HAVE_IORING_OP_TEE)
455                return tee( fd_in, fd_out, len, flags );
456        #else
457                __submit_prelude
458
459                (*sqe){ IORING_OP_TEE, fd_out, 0p, len, 0 };
460                sqe->splice_fd_in = fd_in;
461                sqe->splice_flags  = flags | (SPLICE_FLAGS & submit_flags);
462
463                __submit_wait
464        #endif
465}
466
467//-----------------------------------------------------------------------------
468// Check if a function is asynchronous
469
470// Macro magic to reduce the size of the following switch case
471#define IS_DEFINED_APPLY(f, ...) f(__VA_ARGS__)
472#define IS_DEFINED_SECOND(first, second, ...) second
473#define IS_DEFINED_TEST(expansion) _CFA_IO_FEATURE_##expansion
474#define IS_DEFINED(macro) IS_DEFINED_APPLY( IS_DEFINED_SECOND,IS_DEFINED_TEST(macro) false, true)
475
476bool has_user_level_blocking( fptr_t func ) {
477        #if defined(CFA_HAVE_LINUX_IO_URING_H)
478                #if defined(HAVE_PREADV2)
479                        if( /*func == (fptr_t)preadv2 || */
480                                func == (fptr_t)cfa_preadv2 )
481                                #define _CFA_IO_FEATURE_CFA_HAVE_IORING_OP_READV ,
482                                return IS_DEFINED(CFA_HAVE_IORING_OP_READV);
483                #endif
484
485                #if defined(HAVE_PWRITEV2)
486                        if( /*func == (fptr_t)pwritev2 || */
487                                func == (fptr_t)cfa_pwritev2 )
488                                #define _CFA_IO_FEATURE_CFA_HAVE_IORING_OP_WRITEV ,
489                                return IS_DEFINED(CFA_HAVE_IORING_OP_WRITEV);
490                #endif
491
492                if( /*func == (fptr_t)fsync || */
493                        func == (fptr_t)cfa_fsync )
494                        #define _CFA_IO_FEATURE_CFA_HAVE_IORING_OP_FSYNC ,
495                        return IS_DEFINED(CFA_HAVE_IORING_OP_FSYNC);
496
497                if( /*func == (fptr_t)ync_file_range || */
498                        func == (fptr_t)cfa_sync_file_range )
499                        #define _CFA_IO_FEATURE_CFA_HAVE_IORING_OP_SYNC_FILE_RANGE ,
500                        return IS_DEFINED(CFA_HAVE_IORING_OP_SYNC_FILE_RANGE);
501
502                if( /*func == (fptr_t)sendmsg || */
503                        func == (fptr_t)cfa_sendmsg )
504                        #define _CFA_IO_FEATURE_CFA_HAVE_IORING_OP_SENDMSG ,
505                        return IS_DEFINED(CFA_HAVE_IORING_OP_SENDMSG);
506
507                if( /*func == (fptr_t)recvmsg || */
508                        func == (fptr_t)cfa_recvmsg )
509                        #define _CFA_IO_FEATURE_CFA_HAVE_IORING_OP_RECVMSG ,
510                        return IS_DEFINED(CFA_HAVE_IORING_OP_RECVMSG);
511
512                if( /*func == (fptr_t)send || */
513                        func == (fptr_t)cfa_send )
514                        #define _CFA_IO_FEATURE_CFA_HAVE_IORING_OP_SEND ,
515                        return IS_DEFINED(CFA_HAVE_IORING_OP_SEND);
516
517                if( /*func == (fptr_t)recv || */
518                        func == (fptr_t)cfa_recv )
519                        #define _CFA_IO_FEATURE_CFA_HAVE_IORING_OP_RECV ,
520                        return IS_DEFINED(CFA_HAVE_IORING_OP_RECV);
521
522                if( /*func == (fptr_t)accept4 || */
523                        func == (fptr_t)cfa_accept4 )
524                        #define _CFA_IO_FEATURE_CFA_HAVE_IORING_OP_ACCEPT ,
525                        return IS_DEFINED(CFA_HAVE_IORING_OP_ACCEPT);
526
527                if( /*func == (fptr_t)connect || */
528                        func == (fptr_t)cfa_connect )
529                        #define _CFA_IO_FEATURE_CFA_HAVE_IORING_OP_CONNECT ,
530                        return IS_DEFINED(CFA_HAVE_IORING_OP_CONNECT);
531
532                if( /*func == (fptr_t)fallocate || */
533                        func == (fptr_t)cfa_fallocate )
534                        #define _CFA_IO_FEATURE_CFA_HAVE_IORING_OP_FALLOCATE ,
535                        return IS_DEFINED(CFA_HAVE_IORING_OP_FALLOCATE);
536
537                if( /*func == (fptr_t)posix_fadvise || */
538                        func == (fptr_t)cfa_fadvise )
539                        #define _CFA_IO_FEATURE_CFA_HAVE_IORING_OP_FADVISE ,
540                        return IS_DEFINED(CFA_HAVE_IORING_OP_FADVISE);
541
542                if( /*func == (fptr_t)madvise || */
543                        func == (fptr_t)cfa_madvise )
544                        #define _CFA_IO_FEATURE_CFA_HAVE_IORING_OP_MADVISE ,
545                        return IS_DEFINED(CFA_HAVE_IORING_OP_MADVISE);
546
547                if( /*func == (fptr_t)openat || */
548                        func == (fptr_t)cfa_openat )
549                        #define _CFA_IO_FEATURE_CFA_HAVE_IORING_OP_OPENAT ,
550                        return IS_DEFINED(CFA_HAVE_IORING_OP_OPENAT);
551
552                if( /*func == (fptr_t)close || */
553                        func == (fptr_t)cfa_close )
554                        #define _CFA_IO_FEATURE_CFA_HAVE_IORING_OP_CLOSE ,
555                        return IS_DEFINED(CFA_HAVE_IORING_OP_CLOSE);
556
557                if( /*func == (fptr_t)read || */
558                        func == (fptr_t)cfa_read )
559                        #define _CFA_IO_FEATURE_CFA_HAVE_IORING_OP_READ ,
560                        return IS_DEFINED(CFA_HAVE_IORING_OP_READ);
561
562                if( /*func == (fptr_t)write || */
563                        func == (fptr_t)cfa_write )
564                        #define _CFA_IO_FEATURE_CFA_HAVE_IORING_OP_WRITE ,
565                        return IS_DEFINED(CFA_HAVE_IORING_OP_WRITE);
566
567                if( /*func == (fptr_t)splice || */
568                        func == (fptr_t)cfa_splice )
569                        #define _CFA_IO_FEATURE_CFA_HAVE_IORING_OP_SPLICE ,
570                        return IS_DEFINED(CFA_HAVE_IORING_OP_SPLICE);
571
572                if( /*func == (fptr_t)tee || */
573                        func == (fptr_t)cfa_tee )
574                        #define _CFA_IO_FEATURE_CFA_HAVE_IORING_OP_TEE ,
575                        return IS_DEFINED(CFA_HAVE_IORING_OP_TEE);
576        #endif
577
578        return false;
579}
Note: See TracBrowser for help on using the repository browser.