Open eugeneia opened 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.
Thanks for the quick reply. By quickly reading over the signalfd section in test/linux.lua
I think to understand that:
signalfd
enables me to read queued signals from a file descriptor?sigprocmask
prevents signals from killing the process and puts them into the queue instead?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.
@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).
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)
Can you give an example program that fails with signalfd? The test in test/linux.lua seems to be passing for me...
@justincormack NVM. The error was due to me passing invalid arguments to signalfd
(string as a fd).
examples/sigint.lua
uses thesyscall.t.sa_sigaction
function which is not defined? Where is it?