From 7db1b072f8972d7e88c4174401bfb9256488958f Mon Sep 17 00:00:00 2001 From: Slava Pestov Date: Sun, 20 Jan 2008 17:06:38 -0500 Subject: [PATCH] epoll() binding --- extra/unix/linux/epoll/epoll.factor | 30 +++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) create mode 100644 extra/unix/linux/epoll/epoll.factor diff --git a/extra/unix/linux/epoll/epoll.factor b/extra/unix/linux/epoll/epoll.factor new file mode 100644 index 0000000000..946c387acc --- /dev/null +++ b/extra/unix/linux/epoll/epoll.factor @@ -0,0 +1,30 @@ +! Copyright (C) 2008 Slava Pestov. +! See http://factorcode.org/license.txt for BSD license. +IN: unix.linux.epoll +USING: alien.syntax ; + +FUNCTION: int epoll_create ( int size ) ; + +FUNCTION: int epoll_ctl ( int epfd, int op, int fd, epoll_event* event ) ; + +C-STRUCT: epoll-event + { "uint" "events" } + { "uint" "fd" } ; + +FUNCTION: int epoll_wait ( int epfd, epoll_event* events, int maxevents, int timeout ) ; + +: EPOLL_CTL_ADD 1 ; inline ! Add a file decriptor to the interface. +: EPOLL_CTL_DEL 2 ; inline ! Remove a file decriptor from the interface. +: EPOLL_CTL_MOD 3 ; inline ! Change file decriptor epoll_event structure. + +: EPOLLIN HEX: 001 ; inline +: EPOLLPRI HEX: 002 ; inline +: EPOLLOUT HEX: 004 ; inline +: EPOLLRDNORM HEX: 040 ; inline +: EPOLLRDBAND HEX: 080 ; inline +: EPOLLWRNORM HEX: 100 ; inline +: EPOLLWRBAND HEX: 200 ; inline +: EPOLLMSG HEX: 400 ; inline +: EPOLLERR HEX: 008 ; inline +: EPOLLHUP HEX: 010 ; inline +: EPOLLET 31 2^ ; inline