Changeset 0ea6c5a


Ignore:
Timestamp:
Apr 24, 2020, 2:44:44 PM (17 months ago)
Author:
Thierry Delisle <tdelisle@…>
Branches:
arm-eh, jacob/cs343-translation, master, new-ast, new-ast-unique-expr
Children:
038be32
Parents:
d384787
Message:

Replaced some headers with forward declarations to speed-up build

File:
1 edited

Legend:

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

    rd384787 r0ea6c5a  
    412412// I/O Interface
    413413//=============================================================================================
    414 extern "C" {
    415         #define __USE_GNU
    416         #define _GNU_SOURCE
    417         #include <fcntl.h>
    418         #include <sys/uio.h>
    419         #include <sys/socket.h>
    420         #include <sys/stat.h>
    421 }
    422 
    423414#if defined(HAVE_LINUX_IO_URING_H)
    424415        #define __submit_prelude \
     
    437428#endif
    438429
     430// Some forward declarations
     431extern "C" {
     432        #include <sys/types.h>
     433        struct iovec;
     434        extern ssize_t preadv2 (int fd, const struct iovec *iov, int iovcnt, off_t offset, int flags);
     435        extern ssize_t pwritev2(int fd, const struct iovec *iov, int iovcnt, off_t offset, int flags);
     436
     437        extern int fsync(int fd);
     438        extern int sync_file_range(int fd, int64_t offset, int64_t nbytes, unsigned int flags);
     439
     440        struct msghdr;
     441        struct sockaddr;
     442        extern ssize_t sendmsg(int sockfd, const struct msghdr *msg, int flags);
     443        extern ssize_t recvmsg(int sockfd, struct msghdr *msg, int flags);
     444        extern ssize_t send(int sockfd, const void *buf, size_t len, int flags);
     445        extern ssize_t recv(int sockfd, void *buf, size_t len, int flags);
     446        extern int accept4(int sockfd, struct sockaddr *addr, socklen_t *addrlen, int flags);
     447        extern int connect(int sockfd, const struct sockaddr *addr, socklen_t addrlen);
     448
     449        extern int fallocate(int fd, int mode, uint64_t offset, uint64_t len);
     450        extern int posix_fadvise(int fd, uint64_t offset, uint64_t len, int advice);
     451        extern int madvise(void *addr, size_t length, int advice);
     452
     453        extern int openat(int dirfd, const char *pathname, int flags, mode_t mode);
     454        extern int close(int fd);
     455
     456        struct statx;
     457        extern int statx(int dirfd, const char *pathname, int flags, unsigned int mask, struct statx *statxbuf);
     458
     459        extern ssize_t read (int fd, void *buf, size_t count);
     460}
     461
    439462//-----------------------------------------------------------------------------
    440463// Asynchronous operations
     
    549572int cfa_accept4(int sockfd, struct sockaddr *addr, socklen_t *addrlen, int flags) {
    550573        #if !defined(HAVE_LINUX_IO_URING_H) || !defined(IORING_OP_ACCEPT)
    551                 #pragma GCC diagnostic push
    552                 #pragma GCC diagnostic ignored "-Wattributes"
    553                         __SOCKADDR_ARG _addr;
    554                         _addr.__sockaddr__ = addr;
    555                         return accept4( sockfd, _addr, addrlen, flags );
    556                 #pragma GCC diagnostic pop
     574                return accept4( sockfd, addr, addrlen, flags );
    557575        #else
    558576                __submit_prelude
     
    569587int cfa_connect(int sockfd, const struct sockaddr *addr, socklen_t addrlen) {
    570588        #if !defined(HAVE_LINUX_IO_URING_H) || !defined(IORING_OP_CONNECT)
    571                 #pragma GCC diagnostic push
    572                 #pragma GCC diagnostic ignored "-Wattributes"
    573                         __CONST_SOCKADDR_ARG _addr;
    574                         _addr.__sockaddr__ = addr;
    575                         return connect( sockfd, _addr, addrlen );
    576                 #pragma GCC diagnostic pop
     589                return connect( sockfd, addr, addrlen );
    577590        #else
    578591                __submit_prelude
     
    766779                        return IS_DEFINED(IORING_OP_FALLOCATE);
    767780
    768                 if( /*func == (fptr_t)fadvise || */
     781                if( /*func == (fptr_t)posix_fadvise || */
    769782                        func == (fptr_t)cfa_fadvise )
    770783                        #define _CFA_IO_FEATURE_IORING_OP_FADVISE ,
Note: See TracChangeset for help on using the changeset viewer.