File: test7.15.prog.c

package info (click to toggle)
slurm-wlm 22.05.8-4%2Bdeb12u3
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 48,492 kB
  • sloc: ansic: 475,246; exp: 69,020; sh: 8,862; javascript: 6,528; python: 6,444; makefile: 4,185; perl: 4,069; pascal: 131
file content (39 lines) | stat: -rw-r--r-- 1,052 bytes parent folder | download | duplicates (9)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
#include <stdio.h>
#include <signal.h>
#include <unistd.h>
#include <string.h>
#include <stdlib.h>

int main (int ac, char **av)
{
	char *hostname = NULL;
	int i, rc = 0;
	struct sigaction act;

	if (!(hostname = getenv("SLURMD_NODENAME"))) {
		fprintf (stderr, "Failed to get hostname on this node\n");
		hostname = "Unknown";
	}

	for (i = 1; i < SIGRTMAX; i++) {
		sigaction (i, NULL, &act);
		/* NOTE: If the slurmd is started from a terminal such as
		 * rxvt-unicode or anything like it (aterm) it will ignore
		 * SIGFPE (8) thus failing this test.
		 */
		if (act.sa_handler == SIG_IGN) {
			fprintf (stderr, "%s: Signal %d is ignored!\n",
				 hostname, i);
			if (i == SIGFPE)
				fprintf (stderr, "%s: Terminals like rxvt-unicode/aterm will ignore SIGFPE.  Rerun this test where the slurmd isn't started from that terminal if you get this message.\n",
					 hostname);
			rc = 1;
		} else if (act.sa_handler != SIG_DFL) {
			fprintf (stderr,
				 "%s: Signal %d has handler function!\n",
				 hostname, i);
			rc = 1;
		}
	}
	return (rc);
}