]> gitweb.factorcode.org Git - factor.git/blob - basis/unix/linux/epoll/epoll.factor
use radix literals
[factor.git] / basis / unix / linux / epoll / epoll.factor
1 ! Copyright (C) 2008, 2011 Slava Pestov.
2 ! See http://factorcode.org/license.txt for BSD license.
3 IN: unix.linux.epoll
4 USING: alien.c-types alien.syntax classes.struct math
5 unix.types ;
6
7 FUNCTION: int epoll_create ( int size ) ;
8
9 UNION-STRUCT: epoll-data
10     { ptr void*    }
11     { fd  int      }
12     { u32 uint32_t }
13     { u64 uint64_t } ;
14
15 PACKED-STRUCT: epoll-event
16     { events uint32_t   }
17     { data   epoll-data } ;
18
19 FUNCTION: int epoll_ctl ( int epfd, int op, int fd, epoll-event* event ) ;
20
21 FUNCTION: int epoll_wait ( int epfd, epoll-event* events, int maxevents, int timeout ) ;
22
23 CONSTANT: EPOLL_CTL_ADD 1 ! Add a file decriptor to the interface.
24 CONSTANT: EPOLL_CTL_DEL 2 ! Remove a file decriptor from the interface.
25 CONSTANT: EPOLL_CTL_MOD 3 ! Change file decriptor epoll_event structure.
26
27 CONSTANT: EPOLLIN      0x001
28 CONSTANT: EPOLLPRI     0x002
29 CONSTANT: EPOLLOUT     0x004
30 CONSTANT: EPOLLRDNORM  0x040
31 CONSTANT: EPOLLRDBAND  0x080
32 CONSTANT: EPOLLWRNORM  0x100
33 CONSTANT: EPOLLWRBAND  0x200
34 CONSTANT: EPOLLMSG     0x400
35 CONSTANT: EPOLLERR     0x008
36 CONSTANT: EPOLLHUP     0x010
37 CONSTANT: EPOLLRDHUP   0x2000
38 : EPOLLONESHOT ( -- n ) 30 2^ ; inline
39 : EPOLLET      ( -- n ) 31 2^ ; inline