Skip to contentSkip to conversation

Compilation fix for system not providing OOM_SCORE_ADJ_MIN

PATCH New Hannes Reinecke 1 participant 1 message Apr 19, 2012 Device mapper

lore
Share & tools
lore
#0 lore raw

PATCH 1/2 Compilation fix for system not providing OOM_SCORE_ADJ_MIN

Newer systems do not provide a definition for OOM_SCORE_ADJ_MIN, so we need to test against this.

---
 multipathd/main.c |    6 ++++++
 1 files changed, 6 insertions(+), 0 deletions(-)
multipathd/main.c +6 -0
index 3845880..a3f82d1 100644
@@ -1483,9 +1483,15 @@ setscheduler (void)
 static void
 set_oom_adj (void)
 {
+#ifdef OOM_SCORE_ADJ_MIN
 	int retry = 1;
 	char *file = "/proc/self/oom_score_adj";
 	int score = OOM_SCORE_ADJ_MIN;
+#else
+	int retry = 0;
+	char *file = "/proc/self/oom_adj";
+	int score = OOM_ADJUST_MIN;
+#endif
 	FILE *fp;
 	struct stat st;
 
Signature · 1 line
1.7.3.4