tests: Conditionally add prctl to test process

prctl was already bypassed on Cygwin systems. This extends to
non-Linux systems such as kFreeBSD and Hurd.

References:
 https://bugs.debian.org/816237
This commit is contained in:
Craig Small 2016-04-17 09:09:41 +10:00
parent abc3679712
commit 0c78f4f954
2 changed files with 3 additions and 2 deletions

1
NEWS
View File

@ -3,6 +3,7 @@ procps-ng-NEXT
* ps: sort by cgroup Debian #692279 * ps: sort by cgroup Debian #692279
* ps: display control group name with -o cgname * ps: display control group name with -o cgname
* ps: Fallback to attr/current for context Debian #786956 * ps: Fallback to attr/current for context Debian #786956
* tests: Conditionally add prctl Debian #816237
procps-ng-3.3.11 procps-ng-3.3.11
---------------- ----------------

View File

@ -21,7 +21,7 @@
#include <stdlib.h> #include <stdlib.h>
#include <unistd.h> #include <unistd.h>
#include <signal.h> #include <signal.h>
#ifndef __CYGWIN__ #ifdef __linux__
#include <sys/prctl.h> #include <sys/prctl.h>
#endif #endif
#include "c.h" #include "c.h"
@ -80,7 +80,7 @@ int main(int argc, char *argv[])
sigaction(SIGUSR1, &signal_action, NULL); sigaction(SIGUSR1, &signal_action, NULL);
sigaction(SIGUSR2, &signal_action, NULL); sigaction(SIGUSR2, &signal_action, NULL);
#ifndef __CYGWIN__ #ifdef __linux__
/* set process name */ /* set process name */
prctl(PR_SET_NAME, MY_NAME, NULL, NULL, NULL); prctl(PR_SET_NAME, MY_NAME, NULL, NULL, NULL);
#endif #endif