[lkml]   [2002]   [Oct]   [20]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
Messages in this thread
    Subject[patch] sys_epoll ...

    Per Linus request I implemented a syscall interface to the old /dev/epoll
    to avoid the creation of magic inodes inside /dev. Since the new
    implementation shares 95% of the code with the old one, the old interface
    is maintained for compatibility with existing users. The new syscall
    interface adds three system calls ( Linus doesn't like multiplexing ) :

    #define EP_CTL_ADD 1
    #define EP_CTL_DEL 2
    #define EP_CTL_MOD 3

    asmlinkage int sys_epoll_create(int maxfds);
    asmlinkage int sys_epoll_ctl(int epfd, int op, int fd, unsigned int events);
    asmlinkage int sys_epoll_wait(int epfd, struct pollfd **events, int timeout);

    The function sys_epoll_create() creates a sys_epoll "object" by allocation
    space for "maxfds" descriptors. The sys_epoll "object" is basically a
    file descriptor, and this enable the new interface to :

    1) Mantain compatibility with the existing interface
    2) Avoid the creation of a sys_epoll_close() syscall
    3) Reuse 95% of the existing code
    4) Inherit the file* automatic cleanup code w/out having to code a
    dedicated one

    The function sys_epoll_ctl() is the controller interface and what it does
    is pretty obvious. The "op" parameter is either EP_CTL_ADD, EP_CTL_DEL or
    EP_CTL_MOD and the parameter "fd" is the target of the operation. The last
    parameter "events" is used in both EP_CTL_ADD and EP_CTL_MOD and rapresent
    the event interest mask. The function sys_epoll_wait() waits for events by
    allowing a maximum timeout "timeout" in milliseconds and returns the
    number of events ( struct pollfd ) that the caller will find available at
    "*events". The port of the old /dev/epoll to 2.5.44 and the new sys_epoll
    are available at :

    - Davide

    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.019 / U:10.952 seconds]
    ©2003-2016 Jasper Spaans. hosted at Digital OceanAdvertise on this site