safe_macros: Move safe_get/setpgid() to C source

Fixes numerous "implicit function declaration" warnings (for all sources
that include the header) on slightly older distributions since
get/setpgid() required either _XOPEN_SOURCE or _GNU_SOURCE on older
glibc.

Note that defining _GNU_SOURCE in the tst_safe_macros.h is not a
solution since it has to be defined before any libc headers are
included.

So this commit adds tst_safe_macros.c that defines _GNU_SOURCE and puts
these two functions there.

Signed-off-by: Cyril Hrubis <chrubis@suse.cz>
diff --git a/include/tst_safe_macros.h b/include/tst_safe_macros.h
index d352d5a3..df858be 100644
--- a/include/tst_safe_macros.h
+++ b/include/tst_safe_macros.h
@@ -138,35 +138,13 @@
 #define SAFE_GETRESGID(rgid, egid, sgid) \
 	safe_getresgid(__FILE__, __LINE__, NULL, (rgid), (egid), (sgid))
 
-static inline int safe_setpgid(const char *file, const int lineno,
-                               pid_t pid, pid_t pgid)
-{
-	int rval;
+int safe_setpgid(const char *file, const int lineno, pid_t pid, pid_t pgid);
 
-	rval = setpgid(pid, pgid);
-	if (rval) {
-		tst_brk_(file, lineno, TBROK | TERRNO,
-		         "setpgid(%i, %i) failed", pid, pgid);
-	}
-
-	return rval;
-}
 #define SAFE_SETPGID(pid, pgid) \
 	safe_setpgid(__FILE__, __LINE__, (pid), (pgid));
 
-static inline pid_t safe_getpgid(const char *file, const int lineno,
-				 pid_t pid)
-{
-	pid_t pgid;
+pid_t safe_getpgid(const char *file, const int lineno, pid_t pid);
 
-	pgid = getpgid(pid);
-	if (pgid == -1) {
-		tst_brk_(file, lineno, TBROK | TERRNO,
-			 "getpgid(%i) failed", pid);
-	}
-
-	return pgid;
-}
 #define SAFE_GETPGID(pid) \
 	safe_getpgid(__FILE__, __LINE__, (pid))