Hi everyone,
I've been writing an interface for the linux Unix-domain socket api. Upon
the program termination I must ensure that any socket file created must be
unlinked.
To deal with that I added a call to unlink in the destructor of the struct
I use to hold the socket descriptor. This works well when the program
terminates normally, however when it's terminated by a signal, the
destructor isn't called and the file never gets unlinked.

So I added an interface for the sigaction api which allows me to catch
stuff like SIGINT/SIGTERM but when I call a function in libstd from inside
the handler, it ends up calling abort(). I can call local functions as long
as they don't call more complex functions, and I can call native libc
functions as well (unlink works just fine actually).

Is that to be expected because of rust implementation? As i understood, the
stack segments representation in memory differs from the C one, but I'm not
sure if that means rust code can't work in a signal handler stack. Or maybe
just a problem with the context from inside the signal handler?

btw here are some back traces i get when trying to call println() or send()
from the signal handler :
http://pastebin.mozilla.org/2635629
http://pastebin.mozilla.org/2635630

Raphael
_______________________________________________
Rust-dev mailing list
[email protected]
https://mail.mozilla.org/listinfo/rust-dev

Reply via email to