Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

syscall.t.sa_sigaction is a nil value #176

Open
eugeneia opened this issue Apr 1, 2015 · 7 comments
Open

syscall.t.sa_sigaction is a nil value #176

eugeneia opened this issue Apr 1, 2015 · 7 comments

Comments

@eugeneia
Copy link

eugeneia commented Apr 1, 2015

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

@justincormack
Copy link
Owner

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
Copy link
Author

eugeneia commented Apr 1, 2015

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?

@justincormack
Copy link
Owner

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
Copy link
Author

@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
Copy link
Author

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
Copy link
Owner

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

@eugeneia
Copy link
Author

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants