xref: /memcached-1.4.29/BUILD (revision 2c35a3fd)
1a5b8ef85SBrad FitzpatrickIdeally, you want to make a static binary, otherwise the dynamic
2a5b8ef85SBrad Fitzpatricklinker pollutes your address space with shared libs right in the
37917af40SBrad Fitzpatrickmiddle.  (NOTE: actually, this shouldn't matter so much anymore, now
47917af40SBrad Fitzpatrickthat we only allocate huge, fixed-size slabs)
5a5b8ef85SBrad Fitzpatrick
6a5b8ef85SBrad FitzpatrickMake sure your libevent has epoll (Linux) or kqueue (BSD) support.
7a5b8ef85SBrad FitzpatrickUsing poll or select only is slow, and works for testing, but
87917af40SBrad Fitzpatrickshouldn't be used for high-traffic memcache installations.
9a5b8ef85SBrad Fitzpatrick
10*2c35a3fdSBrad FitzpatrickTo build libevent with epoll on Linux, you need two things. First,
11*2c35a3fdSBrad Fitzpatrickyou need /usr/include/sys/epoll.h . To get it, you can install the
12*2c35a3fdSBrad Fitzpatrickuserspace epoll library, epoll-lib. The link to the latest version
13*2c35a3fdSBrad Fitzpatrickis buried inside
14*2c35a3fdSBrad Fitzpatrickhttp://www.xmailserver.org/linux-patches/nio-improve.html ; currently
15*2c35a3fdSBrad Fitzpatrickit's http://www.xmailserver.org/linux-patches/epoll-lib-0.9.tar.gz .
16*2c35a3fdSBrad FitzpatrickIf you're having any trouble building/installing it, you can just copy
17*2c35a3fdSBrad Fitzpatrickepoll.h from that tarball to /usr/include/sys as that's the only thing
18*2c35a3fdSBrad Fitzpatrickfrom there that libevent really needs.
19*2c35a3fdSBrad Fitzpatrick
20*2c35a3fdSBrad FitzpatrickSecondly, you need to declare syscall numbers of epoll syscalls, so
21*2c35a3fdSBrad Fitzpatricklibevent can use them. Put these declarations somewhere
22*2c35a3fdSBrad Fitzpatrickinside <sys/epoll.h>:
23a5b8ef85SBrad Fitzpatrick
24a5b8ef85SBrad Fitzpatrick#define __NR_epoll_create               254
25a5b8ef85SBrad Fitzpatrick#define __NR_epoll_ctl          255
26a5b8ef85SBrad Fitzpatrick#define __NR_epoll_wait         256
27a5b8ef85SBrad Fitzpatrick
28*2c35a3fdSBrad FitzpatrickAfter this you should be able to build libevent with epoll support.
29*2c35a3fdSBrad FitzpatrickOnce you build/install libevent, you don't need <sys/epoll.h> to
30*2c35a3fdSBrad Fitzpatrickcompile memcache or link it against libevent. Don't forget that for epoll
31*2c35a3fdSBrad Fitzpatricksupport to actually work at runtime you need to use a kernel with epoll
32*2c35a3fdSBrad Fitzpatricksupport patch applied, as explained in the README file.
33a5b8ef85SBrad Fitzpatrick
34a5b8ef85SBrad FitzpatrickBSD users are luckier, and will get kqueue support by default.
35a5b8ef85SBrad Fitzpatrick
36a5b8ef85SBrad Fitzpatrick
37a5b8ef85SBrad Fitzpatrick
38