#How to ignore SIGCHLD signal in Rust??

8 messages · Page 1 of 1 (latest)

lapis hill
#

How to ignore SIGCHLD signal in Rust??

in C i would do:
signal(SIGCHLD, SIG_IGN);
also i want to be able to pass my function instead of SIG_IGN sometimes

tender sierra
#

SIGCHLD is Ignored by default btw.

You can use the signal_hook crate's signal_hook::low_level::register to register an arbitrary handler (with note that you must uphold the safety requirements yourself, since it's an unsafe fn)

#

If you really want to, you can also use libc::sigaction to directly call the C library.

which I guess you may need to since explicitly SIG_IGNing SIGCHLD does something different than the default ignoring https://stackoverflow.com/questions/40601337/what-is-the-use-of-ignoring-sigchld-signal-with-sigaction2

lapis hill
#

i want to achieve same behavior like with "signal(SIGCHLD, SIG_IGN);" but i want safe way if possible

tender sierra
# lapis hill

Yes, that's what I said in my second message where I linked that exact stackexchange post.

tender sierra
lapis hill
#

hmm so whats better, using native signal function or signal_hook