Changeset 3113

Show
Ignore:
Timestamp:
08/19/08 23:34:16 (2 years ago)
Author:
phk
Message:

Integrate Solaris patches, with a bit of polishing.

Don't look for umem on FreeBSD, which have dummy stub version for
dtrace or ZFS compatibility.

Generally restrict probes for Solaris specific stuff to when we
run on solaris, no need to make configure slower than it is.

Don't pretend we can get anywhere without poll(2) we use it for
lots of things: Remove #if conditionals around poll-acceptor.

Sort a couple of lists, before they get too unsorted.

Submitted by: Theo Schlossnagle

Location:
trunk/varnish-cache
Files:
2 added
8 modified

Legend:

Unmodified
Added
Removed
  • trunk/varnish-cache/bin/varnishd/Makefile.am

    r3089 r3113  
    1010        cache_acceptor.c \ 
    1111        cache_acceptor_epoll.c \ 
     12        cache_acceptor_kqueue.c \ 
    1213        cache_acceptor_poll.c \ 
    13         cache_acceptor_kqueue.c \ 
     14        cache_acceptor_ports.c \ 
    1415        cache_backend.c \ 
    1516        cache_backend_cfg.c \ 
     
    2829        cache_main.c \ 
    2930        cache_panic.c \ 
     31        cache_pipe.c \ 
    3032        cache_pool.c \ 
    31         cache_pipe.c \ 
    3233        cache_response.c \ 
    3334        cache_session.c \ 
     
    3637        cache_vrt.c \ 
    3738        cache_vrt_acl.c \ 
     39        cache_vrt_esi.c \ 
    3840        cache_vrt_re.c \ 
    39         cache_vrt_esi.c \ 
    4041        cache_ws.c \ 
     42        hash_classic.c \ 
    4143        hash_simple_list.c \ 
    42         hash_classic.c \ 
    4344        instance.c \ 
    4445        mgt_child.c \ 
     
    5253        storage_malloc.c \ 
    5354        storage_synth.c \ 
     55        storage_umem.c \ 
    5456        tcp.c \ 
    5557        varnishd.c 
     
    5860        acct_fields.h \ 
    5961        cache.h \ 
     62        cache_acceptor.h \ 
    6063        cache_backend.h \ 
    6164        cache_backend_poll.h \ 
    62         cache_acceptor.h \ 
    6365        common.h \ 
    6466        default_vcl.h \ 
  • trunk/varnish-cache/bin/varnishd/cache_acceptor.c

    r3072 r3113  
    4747#include <sys/socket.h> 
    4848 
    49 #include "config.h" 
    5049#include "cli.h" 
    5150#include "cli_priv.h" 
     
    6160        &acceptor_epoll, 
    6261#endif 
    63 #if defined(HAVE_POLL) 
     62#if defined(HAVE_PORT_CREATE) 
     63        &acceptor_ports, 
     64#endif 
    6465        &acceptor_poll, 
    65 #endif 
    6666        NULL, 
    6767}; 
  • trunk/varnish-cache/bin/varnishd/cache_acceptor.h

    r2632 r3113  
    4949#endif 
    5050 
    51 #if defined(HAVE_POLL) 
    5251extern struct acceptor acceptor_poll; 
     52 
     53#if defined(HAVE_PORT_CREATE) 
     54extern struct acceptor acceptor_ports; 
    5355#endif 
    5456 
  • trunk/varnish-cache/bin/varnishd/cache_acceptor_poll.c

    r2972 r3113  
    3232 
    3333#include "config.h" 
    34  
    35 #if defined(HAVE_POLL) 
    3634 
    3735#include <stdio.h> 
     
    168166        .init =         vca_poll_init, 
    169167}; 
    170  
    171 #endif /* defined(HAVE_POLL) */ 
  • trunk/varnish-cache/bin/varnishd/cache_pool.c

    r3079 r3113  
    5252#include <sys/socket.h> 
    5353#elif defined(__linux__) 
     54#include <sys/sendfile.h> 
     55#elif defined(__sun) 
    5456#include <sys/sendfile.h> 
    5557#else 
     
    192194                        w->werr++; 
    193195        } while (0); 
     196#elif defined(__sun) 
     197#ifdef HAVE_SENDFILEV 
     198        do { 
     199                sendfilevec_t svvec[HTTP_HDR_MAX * 2 + 1]; 
     200                size_t xferred = 0, expected = 0; 
     201                int i; 
     202                for (i = 0; i < w->niov; i++) { 
     203                        svvec[i].sfv_fd = SFV_FD_SELF; 
     204                        svvec[i].sfv_flag = 0; 
     205                        svvec[i].sfv_off = (off_t) w->iov[i].iov_base; 
     206                        svvec[i].sfv_len = w->iov[i].iov_len; 
     207                        expected += svvec[i].sfv_len; 
     208                } 
     209                svvec[i].sfv_fd = fd; 
     210                svvec[i].sfv_flag = 0; 
     211                svvec[i].sfv_off = off; 
     212                svvec[i].sfv_len = len; 
     213                expected += svvec[i].sfv_len; 
     214                if (sendfilev(*w->wfd, svvec, i, &xferred) == -1 || 
     215                    xferred != expected) 
     216                        w->werr++; 
     217                w->liov = 0; 
     218                w->niov = 0; 
     219        } while (0); 
     220#else 
     221        do { 
     222                if (WRK_Flush(w) == 0 && 
     223                    sendfile(*w->wfd, fd, &off, len) != len) 
     224                        w->werr++; 
     225        } while (0); 
     226#endif 
    194227#else 
    195228#error Unknown sendfile() implementation 
  • trunk/varnish-cache/bin/varnishd/tcp.c

    r3083 r3113  
    3939#include <errno.h> 
    4040#include <sys/ioctl.h> 
     41#ifdef HAVE_SYS_FILIO_H 
     42#include <sys/filio.h> 
     43#endif 
    4144#include <netdb.h> 
    4245#include <poll.h> 
  • trunk/varnish-cache/bin/varnishd/varnishd.c

    r3077 r3113  
    114114extern struct stevedore sma_stevedore; 
    115115extern struct stevedore smf_stevedore; 
     116#ifdef HAVE_LIBUMEM 
     117extern struct stevedore smu_stevedore; 
     118#endif 
    116119 
    117120static struct choice stv_choice[] = { 
    118121        { "file",       &smf_stevedore }, 
    119122        { "malloc",     &sma_stevedore }, 
     123#ifdef HAVE_LIBUMEM 
     124        { "umem",       &smu_stevedore }, 
     125#endif 
    120126        { NULL,         NULL } 
    121127}; 
     
    215221            "-s kind[,storageoptions]", "Backend storage specification"); 
    216222        fprintf(stderr, FMT, "", "  -s malloc"); 
     223#ifdef HAVE_LIBUMEM 
     224        fprintf(stderr, FMT, "", "  -s umem"); 
     225#endif 
    217226        fprintf(stderr, FMT, "", "  -s file  [default: use /tmp]"); 
    218227        fprintf(stderr, FMT, "", "  -s file,<dir_or_file>"); 
  • trunk/varnish-cache/configure.ac

    r3092 r3113  
    130130        fi 
    131131        ;; 
     132*-*-solaris*) 
     133        AC_CHECK_HEADERS([sys/filio.h]) 
     134        AC_CHECK_LIB(sendfile, sendfile) 
     135        AC_CHECK_LIB(umem, malloc) 
     136        AC_CHECK_HEADERS([umem.h]) 
     137 
     138        if test "$ac_cv_lib_sendfile_sendfile" = yes; then 
     139                save_LIBS="${LIBS}" 
     140                LIBS="${NET_LIBS}" 
     141                AC_CHECK_FUNCS([sendfile]) 
     142                AC_CHECK_FUNCS([sendfilev]) 
     143                LIBS="${save_LIBS}" 
     144        fi 
     145        ;; 
    132146*) 
    133147        AC_MSG_WARN([won't look for sendfile() on $host]) 
     
    192206fi 
    193207 
    194 # --enable-poll 
    195 AC_ARG_ENABLE(poll, 
    196     AS_HELP_STRING([--enable-poll], 
    197         [use poll if available (default is YES)]), 
     208# --enable-ports 
     209AC_ARG_ENABLE(ports, 
     210    AS_HELP_STRING([--enable-ports], 
     211        [use ports if available (default is YES)]), 
    198212    , 
    199     [enable_poll=yes]) 
    200  
    201 if test "$enable_poll" = yes; then 
    202         AC_CHECK_FUNCS([poll]) 
     213    [enable_ports=yes]) 
     214 
     215if test "$enable_ports" = yes; then 
     216        AC_CHECK_FUNCS([port_create]) 
    203217else 
    204         ac_cv_func_poll=no 
    205 fi 
    206  
    207 if test "$ac_cv_func_kqueue" != yes && 
    208    test "$ac_cv_func_epoll_ctl" != yes && 
    209    test "$ac_cv_func_poll" != yes; then 
    210         AC_MSG_ERROR([no usable acceptor mechanism]) 
     218        ac_cv_func_port_create=no 
    211219fi 
    212220