File: test_147_1_spank_plugin.c

package info (click to toggle)
slurm-wlm-contrib 24.11.5-2
  • links: PTS, VCS
  • area: contrib
  • in suites: trixie
  • size: 50,596 kB
  • sloc: ansic: 529,598; exp: 64,795; python: 17,051; sh: 9,411; javascript: 6,528; makefile: 4,030; perl: 3,762; pascal: 131
file content (39 lines) | stat: -rw-r--r-- 1,175 bytes parent folder | download | duplicates (2)
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 <stdlib.h>
#include <fcntl.h>
#include <slurm/spank.h>

SPANK_PLUGIN(test_spank_plugin, 1);

int slurm_spank_user_init(spank_t sp, int ac, char **av) {
	FILE *file = fopen("/tmp/test_147_1_private/slurm_spank_user_init_log", "w");
	if (file == NULL) {
		slurm_error("Failed to open slurm_spank_user_init_log file\n");
		return ESPANK_ERROR;
	}
	fprintf(file, "slurm_spank_user_init_executed\n");
	fclose(file);
	return ESPANK_SUCCESS;
}

int slurm_spank_task_post_fork(spank_t sp, int ac, char **av) {
	FILE *file = fopen("/tmp/test_147_1_private/slurm_spank_task_post_fork_log", "w");
	if (file == NULL) {
		slurm_error("Failed to open slurm_spank_task_post_fork_log file\n");
		return ESPANK_ERROR;
	}
	fprintf(file, "slurm_spank_task_post_fork_executed\n");
	fclose(file);
	return ESPANK_SUCCESS;
}

int slurm_spank_task_exit(spank_t sp, int ac, char **av) {
	FILE *file = fopen("/tmp/test_147_1_private/slurm_spank_task_exit_log", "w");
	if (file == NULL) {
		slurm_error("Failed to open slurm_spank_task_exit_log file\n");
		return ESPANK_ERROR;
	}
	fprintf(file, "slurm_spank_task_exit_executed\n");
	fclose(file);
	return ESPANK_SUCCESS;
}