Externally disabling signals for a Linux program

前端 未结 5 2060
慢半拍i
慢半拍i 2021-02-13 13:00

On Linux, is it possible to somehow disable signaling for programs externally... that is, without modifying their source code?

Context:

5条回答
  •  抹茶落季
    2021-02-13 13:40

    This is example code of enabling signals like Ctrl+C for programs which block it.

    fixControlC.c

    #include 
    #include 
    int sigaddset(sigset_t *set, int signo) {
        printf("int sigaddset(sigset_t *set=%p, int signo=%d)\n", set, signo);
        return 0;
    }
    

    Compile it:

    gcc -fPIC -shared -o fixControlC.so fixControlC.c
    

    Run it:

    LD_LIBRARY_PATH=. LD_PRELOAD=fixControlC.so mysqld
    

提交回复
热议问题