justincormack / ljsyscall

LuaJIT Unix syscall FFI
http://www.myriabit.com/ljsyscall/
Other
440 stars 53 forks source link

syscall.t.sa_sigaction is a nil value #176

Open eugeneia opened 9 years ago

eugeneia commented 9 years ago

examples/sigint.lua uses the syscall.t.sa_sigaction function which is not defined? Where is it?

justincormack commented 9 years ago

I removed the sigaction callback code. I couldn't convince myself that it is safe to execute Lua functions in a random callback like this, although it may well be ok. I recommend using signalfd for signal handling instead if at all possible.

eugeneia commented 9 years ago

Thanks for the quick reply. By quickly reading over the signalfd section in test/linux.lua I think to understand that:

justincormack commented 9 years ago

Yes thats right. It is a really nice interface. You can just read it with your other events (eg with epoll), and it queues events.

eugeneia commented 9 years ago

@justincormack Does ljsyscall provide a way to map a signo to its "string name"? E.g. I have a siginfo object and would like to print its "name" (e.g. SIGINT).

eugeneia commented 9 years ago

I am getting the following when calling S.signalfd (using ljsyscall v0.10-65-g7081d97 on Linux davos 3.13.0-43-generic #72-Ubuntu SMP Mon Dec 8 19:35:06 UTC 2014 x86_64 x86_64 x86_64 GNU/Linux):

syscall/helpers.lua:66: attempt to call method 'getfd' (a nil value)
justincormack commented 9 years ago

Can you give an example program that fails with signalfd? The test in test/linux.lua seems to be passing for me...

eugeneia commented 9 years ago

@justincormack NVM. The error was due to me passing invalid arguments to signalfd (string as a fd).