1

Here's my code:

#include <sys/types.h>
#include <stdio.h>
#include <dirent.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <unistd.h>
#include <time.h> 
#include <sys/time.h>
#include <assert.h>
#include <errno.h>
#include <string.h>
#include <stdlib.h>
#include <signal.h>

int main(int argc, char** argv) {

sigignore(SIGTERM);
return 0;
}

Why do I get the following warning and how could I remove it?

implicit declaration of function ‘sigignore’ [-Wimplicit-function-declaration] sigignore(SIGTERM);

The program must be compiled like this: gcc -o foo.o foo.c.

Thanks

LiorGolan
  • 355
  • 1
  • 4
  • 11

2 Answers2

2

Man sigignore tells you to use #define _XOPEN_SOURCE 500 to enable sigignore. More on X/Open can be found here

Community
  • 1
  • 1
Stasik
  • 2,568
  • 1
  • 25
  • 44
  • 1
    For completeness the POSIX documentation here: http://pubs.opengroup.org/onlinepubs/9699919799/functions/sighold.html, as well as the up-to-date Linux man-page here: http://man7.org/linux/man-pages/man3/sigset.3.html – alk Apr 18 '16 at 14:37
0

The function you want to call has been marked as obsolete 15 years ago. The normal way to discourage people from using those functions (without actually breaking programs) is to have the implementation of the function left in the standard library, but remove the declaration from header files (or at least make it hard to enable).

Use sigaction or sigprocmask (depending on what you actually want to accomplish).

Art
  • 19,807
  • 1
  • 34
  • 60