Changeset 08a994e


Ignore:
Timestamp:
May 5, 2020, 4:23:46 PM (17 months ago)
Author:
Thierry Delisle <tdelisle@…>
Branches:
arm-eh, jacob/cs343-translation, master, new-ast, new-ast-unique-expr
Children:
4385e8b, c66f6cb
Parents:
d3ab183
Message:

Added automatic detection of support for preadv2 and pwritev2

Location:
libcfa
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • libcfa/configure

    rd3ab183 r08a994e  
    1696216962done
    1696316963
     16964for ac_func in preadv2 pwritev2
     16965do :
     16966  as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh`
     16967ac_fn_c_check_func "$LINENO" "$ac_func" "$as_ac_var"
     16968if eval test \"x\$"$as_ac_var"\" = x"yes"; then :
     16969  cat >>confdefs.h <<_ACEOF
     16970#define `$as_echo "HAVE_$ac_func" | $as_tr_cpp` 1
     16971_ACEOF
     16972
     16973fi
     16974done
     16975
    1696416976
    1696516977ac_config_files="$ac_config_files Makefile src/Makefile prelude/Makefile"
  • libcfa/configure.ac

    rd3ab183 r08a994e  
    119119
    120120AC_CHECK_HEADERS([linux/io_uring.h])
     121AC_CHECK_FUNCS([preadv2 pwritev2])
    121122
    122123AC_CONFIG_FILES([
  • libcfa/prelude/defines.hfa.in

    rd3ab183 r08a994e  
    1616#undef HAVE_LINUX_IO_URING_H
    1717
     18#undef HAVE_PREADV2
     19#undef HAVE_PWRITEV2
     20
    1821// #define __CFA_IO_POLLING_USER__
    1922// #define __CFA_IO_POLLING_KERNEL__
  • libcfa/src/Makefile.in

    rd3ab183 r08a994e  
    241241        containers/vector.hfa bitmanip.hfa math.hfa gmp.hfa time_t.hfa \
    242242        bits/align.hfa bits/containers.hfa bits/defs.hfa \
    243         bits/debug.hfa bits/locks.hfa concurrency/coroutine.hfa \
    244         concurrency/thread.hfa concurrency/kernel.hfa \
    245         concurrency/monitor.hfa concurrency/mutex.hfa \
    246         concurrency/invoke.h
     243        bits/debug.hfa bits/locks.hfa containers/list.hfa \
     244        concurrency/coroutine.hfa concurrency/thread.hfa \
     245        concurrency/kernel.hfa concurrency/monitor.hfa \
     246        concurrency/mutex.hfa concurrency/invoke.h
    247247HEADERS = $(nobase_cfa_include_HEADERS)
    248248am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP)
     
    463463
    464464#----------------------------------------------------------------------------------------------------------------
    465 @BUILDLIB_TRUE@headers_nosrc = bitmanip.hfa math.hfa gmp.hfa time_t.hfa bits/align.hfa bits/containers.hfa bits/defs.hfa bits/debug.hfa bits/locks.hfa
     465@BUILDLIB_TRUE@headers_nosrc = bitmanip.hfa math.hfa gmp.hfa time_t.hfa bits/align.hfa bits/containers.hfa bits/defs.hfa bits/debug.hfa bits/locks.hfa containers/list.hfa
    466466@BUILDLIB_FALSE@headers =
    467467@BUILDLIB_TRUE@headers = fstream.hfa iostream.hfa iterator.hfa limits.hfa rational.hfa time.hfa stdlib.hfa common.hfa \
  • libcfa/src/concurrency/io.cfa

    rd3ab183 r08a994e  
    544544        #include <sys/socket.h>
    545545        #include <sys/syscall.h>
     546
     547#if defined(HAVE_PREADV2)
    546548        struct iovec;
    547549        extern ssize_t preadv2 (int fd, const struct iovec *iov, int iovcnt, off_t offset, int flags);
     550#endif
     551#if defined(HAVE_PWRITEV2)
     552        struct iovec;
    548553        extern ssize_t pwritev2(int fd, const struct iovec *iov, int iovcnt, off_t offset, int flags);
     554#endif
    549555
    550556        extern int fsync(int fd);
     
    572578//-----------------------------------------------------------------------------
    573579// Asynchronous operations
    574 ssize_t cfa_preadv2(int fd, const struct iovec *iov, int iovcnt, off_t offset, int flags) {
    575         #if !defined(HAVE_LINUX_IO_URING_H) || !defined(IORING_OP_READV)
    576                 return preadv2(fd, iov, iovcnt, offset, flags);
    577         #else
    578                 __submit_prelude
    579 
    580                 (*sqe){ IORING_OP_READV, fd, iov, iovcnt, offset };
    581 
    582                 __submit_wait
    583         #endif
    584 }
    585 
    586 ssize_t cfa_pwritev2(int fd, const struct iovec *iov, int iovcnt, off_t offset, int flags) {
    587         #if !defined(HAVE_LINUX_IO_URING_H) || !defined(IORING_OP_WRITEV)
    588                 return pwritev2(fd, iov, iovcnt, offset, flags);
    589         #else
    590                 __submit_prelude
    591 
    592                 (*sqe){ IORING_OP_WRITEV, fd, iov, iovcnt, offset };
    593 
    594                 __submit_wait
    595         #endif
    596 }
     580#if defined(HAVE_PREADV2)
     581        ssize_t cfa_preadv2(int fd, const struct iovec *iov, int iovcnt, off_t offset, int flags) {
     582                #if !defined(HAVE_LINUX_IO_URING_H) || !defined(IORING_OP_READV)
     583                        return preadv2(fd, iov, iovcnt, offset, flags);
     584                #else
     585                        __submit_prelude
     586
     587                        (*sqe){ IORING_OP_READV, fd, iov, iovcnt, offset };
     588
     589                        __submit_wait
     590                #endif
     591        }
     592#endif
     593
     594#if defined(HAVE_PWRITEV2)
     595        ssize_t cfa_pwritev2(int fd, const struct iovec *iov, int iovcnt, off_t offset, int flags) {
     596                #if !defined(HAVE_LINUX_IO_URING_H) || !defined(IORING_OP_WRITEV)
     597                        return pwritev2(fd, iov, iovcnt, offset, flags);
     598                #else
     599                        __submit_prelude
     600
     601                        (*sqe){ IORING_OP_WRITEV, fd, iov, iovcnt, offset };
     602
     603                        __submit_wait
     604                #endif
     605        }
     606#endif
    597607
    598608int cfa_fsync(int fd) {
     
    822832                        return IS_DEFINED(IORING_OP_READV);
    823833
    824                 if( /*func == (fptr_t)pwritev2 || */
    825                         func == (fptr_t)cfa_pwritev2 )
    826                         #define _CFA_IO_FEATURE_IORING_OP_WRITEV ,
    827                         return IS_DEFINED(IORING_OP_WRITEV);
    828 
    829                 if( /*func == (fptr_t)fsync || */
    830                         func == (fptr_t)cfa_fsync )
    831                         #define _CFA_IO_FEATURE_IORING_OP_FSYNC ,
    832                         return IS_DEFINED(IORING_OP_FSYNC);
     834                #if defined(HAVE_PREADV2)
     835                        if( /*func == (fptr_t)pwritev2 || */
     836                                func == (fptr_t)cfa_pwritev2 )
     837                                #define _CFA_IO_FEATURE_IORING_OP_WRITEV ,
     838                                return IS_DEFINED(IORING_OP_WRITEV);
     839                #endif
     840
     841                #if defined(HAVE_PWRITEV2)
     842                        if( /*func == (fptr_t)fsync || */
     843                                func == (fptr_t)cfa_fsync )
     844                                #define _CFA_IO_FEATURE_IORING_OP_FSYNC ,
     845                                return IS_DEFINED(IORING_OP_FSYNC);
     846                #endif
    833847
    834848                if( /*func == (fptr_t)ync_file_range || */
Note: See TracChangeset for help on using the changeset viewer.