From bc45c643c623b3ad89c8164372f200bb8954b9d1 Mon Sep 17 00:00:00 2001
From: Tim Wickberg <tim@schedmd.com>
Date: Mon, 29 Apr 2019 16:56:07 -0600
Subject: [PATCH] macOS - bypass functions involving cpuset_t.

These should ideally be split off from the task plugin interface since
they're tied to a specific implementations.

And the core_spec code itself does not really belong directly in
slurmd.c.
---
 src/slurmd/common/task_plugin.c | 12 ++++++++++++
 src/slurmd/slurmd/slurmd.c      |  4 ++++
 2 files changed, 16 insertions(+)

diff --git a/src/slurmd/common/task_plugin.c b/src/slurmd/common/task_plugin.c
index b25dae44504..c438dad3637 100644
--- a/src/slurmd/common/task_plugin.c
+++ b/src/slurmd/common/task_plugin.c
@@ -510,6 +510,9 @@ extern int task_g_add_pid(pid_t pid)
 extern void task_slurm_chkaffinity(cpu_set_t *mask, stepd_step_rec_t *job,
 				   int statval)
 {
+#if defined(__APPLE__)
+	fatal("%s: not supported on macOS", __func__);
+#else
 	char *bind_type, *action, *status, *units;
 	char mstr[1 + CPU_SETSIZE / 4];
 	int task_gid = job->envtp->procid;
@@ -570,10 +573,14 @@ extern void task_slurm_chkaffinity(cpu_set_t *mask, stepd_step_rec_t *job,
 			task_cpuset_to_str(mask, mstr),
 			action,
 			status);
+#endif
 }
 
 extern char *task_cpuset_to_str(const cpu_set_t *mask, char *str)
 {
+#if defined(__APPLE__)
+	fatal("%s: not supported on macOS", __func__);
+#else
 	int base;
 	char *ptr = str;
 	char *ret = NULL;
@@ -594,10 +601,14 @@ extern char *task_cpuset_to_str(const cpu_set_t *mask, char *str)
 	}
 	*ptr = '\0';
 	return ret ? ret : ptr - 1;
+#endif
 }
 
 extern int task_str_to_cpuset(cpu_set_t *mask, const char* str)
 {
+#if defined(__APPLE__)
+	fatal("%s: not supported on macOS", __func__);
+#else
 	int len = strlen(str);
 	const char *ptr = str + len - 1;
 	int base = 0;
@@ -625,4 +636,5 @@ extern int task_str_to_cpuset(cpu_set_t *mask, const char* str)
 	}
 
 	return 0;
+#endif
 }
diff --git a/src/slurmd/slurmd/slurmd.c b/src/slurmd/slurmd/slurmd.c
index 6fc3dd19e34..582306f1b13 100644
--- a/src/slurmd/slurmd/slurmd.c
+++ b/src/slurmd/slurmd/slurmd.c
@@ -2250,6 +2250,9 @@ static bool _is_core_spec_cray(void)
  */
 static int _core_spec_init(void)
 {
+#if defined(__APPLE__)
+	fatal("%s: not supported on macOS", __func__);
+#else
 	int i, rval;
 	pid_t pid;
 	uint32_t task_params;
@@ -2369,6 +2372,7 @@ static int _core_spec_init(void)
 	_resource_spec_fini();
 
 	return SLURM_SUCCESS;
+#endif
 }
 
 /*
-- 
GitLab