From: Michael 'Mickey' Lauer Date: Tue, 1 Mar 2011 15:20:27 +0000 (+0100) Subject: Linux: add epoll(7) and friends X-Git-Tag: 0.11.7~36 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=68ec877c7ca709cf21bedc047ffba2e4a957cc0c;p=thirdparty%2Fvala.git Linux: add epoll(7) and friends Based on a patch by Stefano Debenedetti Closes bug #641790 --- diff --git a/THANKS b/THANKS index 088a52ab0..2a143580a 100644 --- a/THANKS +++ b/THANKS @@ -122,6 +122,7 @@ Sebastian Pölsterl Sebastian Spaeth Shawn Ferris Simon Wenner +Stefano Debenedetti Stéphan Kochen Tai Chi Minh Ralph Eastwood Thijs Vermeir diff --git a/vapi/linux.vapi b/vapi/linux.vapi index 93babcdc0..2611011d4 100644 --- a/vapi/linux.vapi +++ b/vapi/linux.vapi @@ -295,6 +295,55 @@ namespace Linux { public int eventfd_read (int fd, out uint64 value); public int eventfd_write (int fd, uint64 value); + /* + * Epoll + */ + [CCode (cprefix = "EPOLL_", cheader_filename = "sys/epoll.h")] + public enum EpollFdFlags { + CLOEXEC, + } + + [CCode (cheader_filename = "sys/epoll.h", cname = "union epoll_data")] + public struct EpollData { + public void* ptr; + public int fd; + public uint32 u32; + public uint64 u64; + } + + [CCode (cheader_filename = "sys/epoll.h", cname = "struct epoll_event")] + public struct EpollEvent { + public uint32 events; + public EpollData data; + } + + [CCode (cheader_filename = "sys/epoll.h")] + public int epoll_create (int size = 0); + [CCode (cheader_filename = "sys/epoll.h")] + public int epoll_create1 (int flags = 0); + [CCode (cheader_filename = "sys/epoll.h")] + public int epoll_wait (int epfd, EpollEvent[] events, int timeout); + [CCode (cheader_filename = "sys/epoll.h")] + public int epoll_pwait (int epfd, EpollEvent[] events, Posix.sigset_t? sigmask, int timeout); + [CCode (cheader_filename = "sys/epoll.h")] + public int epoll_ctl (int epfd, int op, int fd, EpollEvent? ev); + [CCode (cheader_filename = "sys/epoll.h")] + public const int EPOLLIN; + [CCode (cheader_filename = "sys/epoll.h")] + public const int EPOLLOUT; + [CCode (cheader_filename = "sys/epoll.h")] + public const int EPOLLERR; + [CCode (cheader_filename = "sys/epoll.h")] + public const int EPOLLHUP; + [CCode (cheader_filename = "sys/epoll.h")] + public const int EPOLLET; + [CCode (cheader_filename = "sys/epoll.h")] + public const int EPOLL_CTL_ADD; + [CCode (cheader_filename = "sys/epoll.h")] + public const int EPOLL_CTL_MOD; + [CCode (cheader_filename = "sys/epoll.h")] + public const int EPOLL_CTL_DEL; + /* * Framebuffer */