gpm icon indicating copy to clipboard operation
gpm copied to clipboard

Fix signal handler

Open elfring opened this issue 11 years ago • 5 comments

The functions "ioctl" and "exit" do not belong to the list of async-signal-safe functions. I guess that a different program design will be needed for your functions "gpm_winch_hook" and "killed".

elfring avatar Jul 29 '14 11:07 elfring

@elfring It is nice to point out - are you going to submit a PR later on?

telmich avatar Jul 29 '14 15:07 telmich

Would you like to consider software design options like the following?

elfring avatar Jul 29 '14 16:07 elfring

In theory yes, the question is more about who is going to implement them, I guess

telmich avatar Jul 29 '14 19:07 telmich

Are you willing to dedicate another thread for receiving of notifications by the function "sigwaitinfo" or "select"?

elfring avatar Jul 29 '14 20:07 elfring

that random link is broken now, so here's the official list of async-signal-safe functions.

wrt kill, none of those funcs are safe -- printf (via CLEAR), fprintf, or exit. I/O streams can be holding locks when the signal comes in, and exit can run atexit handlers which can do anything. so that func should be changed to use write;fsync;_exit and it should be fine.

vapier avatar Mar 11 '16 17:03 vapier