[lkml]   [2002]   [Oct]   [28]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
Messages in this thread
    SubjectRe: [PATCH] epoll more scalable than poll
    On Mon, Oct 28, 2002 at 11:14:19AM -0800, Hanna Linder wrote:

    > The results of our testing show not only does the system call
    > interface to epoll perform as well as the /dev interface but also that epoll
    > is many times better than standard poll. No other implementations of poll


    Sure that this works? The following trivial program doesn't work on stdinput
    when I'd expect it to. It just waits until the timeout passes end then
    returns 0. It also does not work on a file, which is to be expected,
    although 'select' returns with an immediate availability of data on a file
    according to SuS.

    Furthermore, there is some const weirdness going on, the ephttpd server has
    a different second argument to sys_epoll_wait.

    I compile this with:
    cc -Wall -I/mnt/linux-2.5.44/include/ epoll.c -o epoll

    #include <stdio.h>
    #include <errno.h>
    #include <asm/page.h>
    #include <asm/poll.h>
    #include <linux/linkage.h>
    #include <linux/eventpoll.h>
    #include <linux/unistd.h>

    #define __sys_epoll_create(maxfds) _syscall1(int, sys_epoll_create, int, maxfds)
    #define __sys_epoll_ctl(epfd, op, fd, events) _syscall4(int, sys_epoll_ctl, \
    int, epfd, int, op, int, fd, unsigned int, events)

    #define __sys_epoll_wait(epfd, events, timeout) _syscall3(int, sys_epoll_wait, \
    int, epfd, struct pollfd const **, events, int, timeout)

    __sys_epoll_ctl(epfd, op, fd, events)
    __sys_epoll_wait(epfd, events, timeout)

    // asmlinkage int sys_epoll_wait(int epfd, struct pollfd const **events, int timeout);

    int main()
    int kdpfd;
    struct pollfd const *pfds;
    int nfds;
    int timeout=2;

    if ((kdpfd = sys_epoll_create(10)) < 0) {
    return -1;
    if (sys_epoll_ctl(kdpfd, EP_CTL_ADD, 0, POLLIN ) < 0) {
    fprintf(stderr, "sys_epoll set insertion error: fd=%d\n", 0);

    return -1;

    nfds = sys_epoll_wait(kdpfd, &pfds, timeout * 1000);
    fprintf(stderr,"sys_epoll_wait returned: %d\n",nfds);
    return 0;

    -- Versatile DNS Software & Services Linux Advanced Routing & Traffic Control HOWTO
    To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
    the body of a message to
    More majordomo info at
    Please read the FAQ at

     \ /
      Last update: 2005-03-22 13:30    [W:0.043 / U:3.240 seconds]
    ©2003-2017 Jasper Spaans. hosted at Digital OceanAdvertise on this site