Changes in / [3f06c05:463cb33]


Ignore:
Files:
2 added
6 edited

Legend:

Unmodified
Added
Removed
  • benchmark/io/http/main.cfa

    r3f06c05 r463cb33  
    77extern "C" {
    88        #include <sys/socket.h>
    9         #include <sys/types.h>
    109        #include <netinet/in.h>
    1110}
     
    1817#include "filecache.hfa"
    1918#include "options.hfa"
     19#include "parseargs.hfa"
    2020#include "worker.hfa"
    2121
     
    5757int main( int argc, char * argv[] ) {
    5858        int port      = 8080;
    59         int ret       = 0;
    6059        int backlog   = 10;
    6160        int nprocs    = 1;
     
    6665        //===================
    6766        // Parse args
     67        static cfa_option opt[] = {
     68                {'p', "port", "Port the server will listen on", port},
     69                {'c', "cpus", "Number of processors to use", nprocs},
     70                {'t', "threads", "Number of worker threads to use", nworkers},
     71                {'b', "accept-backlog", "Maximum number of pending accepts", backlog},
     72                {'B', "channel-size", "Maximum number of accepted connection pending", chan_size}
     73        };
     74        int opt_cnt = sizeof(opt) / sizeof(cfa_option);
     75
     76        char **left;
     77      parse_args( argc, argv, opt, opt_cnt, "[OPTIONS] [PATH]  -- cforall http server", left );
     78
    6879
    6980        //===================
     
    8091        }
    8192
     93        int ret = 0;
    8294        struct sockaddr_in address;
    8395        int addrlen = sizeof(address);
  • benchmark/io/http/worker.cfa

    r3f06c05 r463cb33  
    77#include <string.h>
    88extern "C" {
     9        #include <fcntl.h>
    910        #include <sys/socket.h>
    1011        #include <sys/types.h>
    11         #include <linux/fcntl.h>
    12         #include <linux/stat.h>
    1312        #include <netinet/in.h>
    1413}
     
    3736        ssize_t ret;
    3837        SPLICE1: while(count > 0) {
    39                 ret = cfa_splice(ans_fd, &offset, this.pipe[1], 0p, count, 5);
     38                ret = cfa_splice(ans_fd, &offset, this.pipe[1], 0p, count, SPLICE_F_MOVE | SPLICE_F_MORE);
    4039                if( ret < 0 ) {
    4140                        if( errno != EAGAIN && errno != EWOULDBLOCK) continue SPLICE1;
     
    4746                size_t in_pipe = ret;
    4847                SPLICE2: while(in_pipe > 0) {
    49                         ret = cfa_splice(this.pipe[0], 0p, fd, 0p, in_pipe, 5);
     48                        ret = cfa_splice(this.pipe[0], 0p, fd, 0p, in_pipe, SPLICE_F_MOVE | SPLICE_F_MORE);
    5049                        if( ret < 0 ) {
    5150                                if( errno != EAGAIN && errno != EWOULDBLOCK) continue SPLICE2;
  • libcfa/src/bits/containers.hfa

    r3f06c05 r463cb33  
    194194
    195195                int ?!=?( const __queue(T) & this, __attribute__((unused)) zero_t zero ) {
    196                         return this.head != 0;
     196                        return this.head != 1p;
    197197                }
    198198        }
  • libcfa/src/concurrency/iocall.cfa

    r3f06c05 r463cb33  
    345345}
    346346
     347int cfa_statx(int dirfd, const char *pathname, int flags, unsigned int mask, struct statx *statxbuf) {
     348        #if !defined(HAVE_LINUX_IO_URING_H) || !defined(IORING_OP_STATX)
     349                return syscall( __NR_statx, dirfd, pathname, flags, mask, statxbuf );
     350        #else
     351                __submit_prelude
     352
     353                (*sqe){ IORING_OP_STATX, dirfd, pathname, mask, (uint64_t)statxbuf };
     354                sqe->flags = flags;
     355
     356                __submit_wait
     357        #endif
     358}
     359
    347360ssize_t cfa_read(int fd, void *buf, size_t count) {
    348361        #if !defined(HAVE_LINUX_IO_URING_H) || !defined(IORING_OP_READ)
     
    396409                __submit_wait
    397410        #endif
    398 }
    399 
    400 ssize_t cfa_sendfile(int out_fd, int in_fd, off_t *offset, size_t count) {
    401         return cfa_splice(in_fd, offset, out_fd, 0p, count, 0);
    402411}
    403412
  • libcfa/src/concurrency/iofwd.hfa

    r3f06c05 r463cb33  
    1616#pragma once
    1717
     18#include <unistd.h>
    1819extern "C" {
    1920        #include <sys/types.h>
    2021}
     22#include "bits/defs.hfa"
     23
     24struct iovec;
     25struct msghdr;
     26struct sockaddr;
     27struct statx;
    2128
    2229extern ssize_t cfa_preadv2(int fd, const struct iovec *iov, int iovcnt, off_t offset, int flags);
     
    4047extern ssize_t cfa_splice(int fd_in, loff_t *off_in, int fd_out, loff_t *off_out, size_t len, unsigned int flags);
    4148extern ssize_t cfa_tee(int fd_in, int fd_out, size_t len, unsigned int flags);
    42 extern ssize_t cfa_sendfile(int out_fd, int in_fd, off_t *offset, size_t count);
    4349
    4450//-----------------------------------------------------------------------------
  • libcfa/src/concurrency/mutex.cfa

    r3f06c05 r463cb33  
    3030        this.lock{};
    3131        this.blocked_threads{};
     32        this.is_locked = false;
    3233}
    3334
Note: See TracChangeset for help on using the changeset viewer.