Re: epoll_wait() returns fd=0 or fd=1 which I don't add to epoll

  • From: Justin Cormack <justin@xxxxxxxxxxxxxxxxxxxxx>
  • To: luajit@xxxxxxxxxxxxx
  • Date: Mon, 11 Feb 2013 09:08:44 +0000

The epoll_event struct is defined as packed on x86_64 where your example
does not work (it works fine on x86).

I see from your examples you did look at my ljsyscall library - recommend
either using it, or borrowing more of the code (it is more modular now than
it used to be), as there are a lot of random things like this that will
waste your time!

Justin



On Mon, Feb 11, 2013 at 2:23 AM, Hiroaki Nakamura <hnakamur@xxxxxxxxx>wrote:

> Hi, all.
>
> I'm trying to write an epoll based socket server example in LuaJIT and ffi.
>
> https://github.com/hnakamur/luajit-examples/blob/master/socket/epoll-dummy-http-server.lua
>
> It works when I run a single client with curl. But when I run siege -r 10
> -c 10,
> siege stop after printing "Lifting the server siege..".
> I notice epoll_wait return fd=0 or fd=1 in the server, but I don't add
> those to epoll.
>
> Could you help me fix this problem?
>
> By the way, the above example is a port of a C example below
>
> https://github.com/hnakamur/luajit-examples/blob/master/socket/c/epoll-server.c
> which is copied from
> https://banu.com/blog/2/how-to-use-epoll-a-complete-example-in-c/
> and modified a bit.
> This C example works ok when I run siege -r 10 -c 10.
>
> Thanks.
>
> --
> )Hiroaki Nakamura)
>
>

Other related posts: