From 0b30a844ec7a6b5fc31cd87cca4e34d1b9810ca4 Mon Sep 17 00:00:00 2001
From: Moe Jette <jette1@llnl.gov>
Date: Tue, 26 Feb 2002 18:31:53 +0000
Subject: [PATCH] Minor tweaks for new makefiles. - Jette

---
 src/slurmctld/Makefile.am     |  3 +--
 src/slurmctld/Node_Mgr.c      | 46 +++++++++++++++++++++++------------
 src/slurmctld/Partition_Mgr.c | 12 +++++++--
 src/slurmctld/Read_Config.c   | 17 +++++++------
 4 files changed, 51 insertions(+), 27 deletions(-)

diff --git a/src/slurmctld/Makefile.am b/src/slurmctld/Makefile.am
index a85910ec54c..5b2a5b90ca2 100644
--- a/src/slurmctld/Makefile.am
+++ b/src/slurmctld/Makefile.am
@@ -32,7 +32,6 @@ slurmctld_SOURCES = Controller.c \
 #Mach_Stat_Mgr_CFLAGS = -DDEBUG_MODULE $(AM_CFLAGS)
 #Partition_Mgr_CFLAGS = -DDEBUG_MODULE $(AM_CFLAGS)
 #Read_Config_CFLAGS   = -DDEBUG_MODULE $(AM_CFLAGS)
-#Read_Proc_CFLAGS     = -DDEBUG_MODULE $(AM_CFLAGS)
 
 # debug modules to built as binaries:
 #
@@ -41,7 +40,7 @@ slurmctld_SOURCES = Controller.c \
 #
 # Note: automake 1.5 will complain about these...
 #
-Read_Config   : Read_Config_d.o
+Read_Config   : Read_Config_d.o Node_Mgr.o Partition_Mgr.o
 Controller    : Controller_d.o
 Node_Mgr      : Node_Mgr_d.o
 Partition_Mgr : Partition_Mgr_d.o
diff --git a/src/slurmctld/Node_Mgr.c b/src/slurmctld/Node_Mgr.c
index 56187adc7f8..b73f4611069 100644
--- a/src/slurmctld/Node_Mgr.c
+++ b/src/slurmctld/Node_Mgr.c
@@ -5,6 +5,8 @@
  * Author: Moe Jette, jette@llnl.gov
  */
 
+#define DEBUG_SYSTEM 1
+
 #ifdef HAVE_CONFIG_H
 #  include <config.h>
 #endif 
@@ -103,12 +105,12 @@ main(int argc, char * argv[]) {
 	printf("Find_Node_Record failure 2\n");
     else if (Node_Ptr->LastResponse != (time_t)678) 
 	printf("Node defaults not set\n");
-    printf("NOTE: We execte Delete_Node_Record to report not finding a record for lx04\n");
+    printf("NOTE: We expect Delete_Node_Record to report not finding a record for lx04\n");
     Error_Code = Delete_Node_Record("lx04");
     if (Error_Code != ENOENT) printf("Delete_Node_Record failure 1\n");
     Error_Code = Delete_Node_Record("lx02");
     if (Error_Code != 0) printf("Delete_Node_Record failure 2\n");
-    printf("NOTE: We execte Delete_Node_Record to report not finding a record for lx02\n");
+    printf("NOTE: We expect Find_Node_Record to report not finding a record for lx02\n");
     Node_Ptr   = Find_Node_Record("lx02");
     if (Node_Ptr != 0) printf("Find_Node_Record failure 3\n");
 
@@ -175,7 +177,7 @@ unsigned *BitMapCopy(unsigned *BitMap) {
 #if DEBUG_SYSTEM
 	fprintf(stderr, "BitMapCopy: unable to allocate memory\n");
 #else
-	syslog(LOG_ALERT, "BitMapCopy: unable to allocate memory\n")
+	syslog(LOG_ALERT, "BitMapCopy: unable to allocate memory\n");
 #endif
 	return NULL;
     } /* if */
@@ -220,7 +222,7 @@ char *BitMapPrint(unsigned *BitMap) {
 #if DEBUG_SYSTEM
 	fprintf(stderr, "BitMapPrint: unable to allocate memory\n");
 #else
-	syslog(LOG_ALERT, "BitMapPrint: unable to allocate memory\n")
+	syslog(LOG_ALERT, "BitMapPrint: unable to allocate memory\n");
 #endif
 	return NULL;
     } /* if */
@@ -293,7 +295,7 @@ struct Config_Record *Create_Config_Record(int *Error_Code) {
 #if DEBUG_SYSTEM
 	fprintf(stderr, "Create_Config_Record: unable to allocate memory\n");
 #else
-	syslog(LOG_ALERT, "Create_Config_Record: unable to allocate memory\n")
+	syslog(LOG_ALERT, "Create_Config_Record: unable to allocate memory\n");
 #endif
 	*Error_Code = ENOMEM;
 	return (struct Config_Record *)NULL;
@@ -313,7 +315,7 @@ struct Config_Record *Create_Config_Record(int *Error_Code) {
 #if DEBUG_SYSTEM
 	    fprintf(stderr, "Create_Config_Record: unable to allocate memory\n");
 #else
-	    syslog(LOG_ALERT, "Create_Config_Record: unable to allocate memory\n")
+	    syslog(LOG_ALERT, "Create_Config_Record: unable to allocate memory\n");
 #endif
 	    free(Config_Point);
 	    *Error_Code = ENOMEM;
@@ -326,7 +328,7 @@ struct Config_Record *Create_Config_Record(int *Error_Code) {
 #if DEBUG_SYSTEM
 	fprintf(stderr, "Create_Config_Record: unable to allocate memory\n");
 #else
-	syslog(LOG_ALERT, "Create_Config_Record: unable to allocate memory\n")
+	syslog(LOG_ALERT, "Create_Config_Record: unable to allocate memory\n");
 #endif
 	if (Config_Point->Feature != (char *)NULL) free(Config_Point->Feature);
 	free(Config_Point);
@@ -389,7 +391,14 @@ int Delete_Node_Record(char *name) {
     struct Node_Record *Node_Record_Point;	/* Pointer to Node_Record */
 
     Node_Record_Point = Find_Node_Record(name);
-    if (Node_Record_Point == NULL) return ENOENT;
+    if (Node_Record_Point == (struct Node_Record *)NULL) {
+#if DEBUG_MODULE
+	fprintf(stderr, "Delete_Node_Record: Attempt to delete non-existent node %s\n", name);
+#else
+	syslog(LOG_ALERT, "Delete_Node_Record: Attempt to delete non-existent node %s\n", name);
+#endif
+	return ENOENT;
+    } /* if */
 
     strcpy(Node_Record_Point->Name, "");
     Node_Record_Point->NodeState = STATE_DOWN;
@@ -403,7 +412,7 @@ void Dump_Hash() {
 
     if (Hash_Table ==  NULL) return;
     for (i=0; i<Node_Record_Count; i++) {
-	if (Hash_Table[i] == (int)NULL) continue;
+	if (strlen((Node_Record_Table_Ptr+Hash_Table[i])->Name) == 0) continue;
 	printf("Hash:%d:%s\n", i, (Node_Record_Table_Ptr+Hash_Table[i])->Name);
     } /* for */
 } /* Dump_Hash */
@@ -426,7 +435,7 @@ struct Node_Record *Find_Node_Record(char *name) {
 #if DEBUG_SYSTEM
 	fprintf(stderr, "Find_Node_Record: Hash table lookup failure for %s\n", name);
 #else
-	syslog(LOG_DEBUG, "Find_Node_Record: Hash table lookup failure for %s\n", name)
+	syslog(LOG_DEBUG, "Find_Node_Record: Hash table lookup failure for %s\n", name);
 #endif
     } /* if */
 
@@ -443,6 +452,11 @@ struct Node_Record *Find_Node_Record(char *name) {
 	return (Node_Record_Table_Ptr+i);
     } /* for */
 
+#if DEBUG_SYSTEM
+    fprintf(stderr, "Find_Node_Record: Lookup failure for %s\n", name);
+#else
+    syslog(LOG_ERR, "Find_Node_Record: Lookup failure for %s\n", name);
+#endif
     return (struct Node_Record *)NULL;
 } /* Find_Node_Record */
 
@@ -527,7 +541,7 @@ int Init_Node_Conf() {
 #if DEBUG_SYSTEM
 	fprintf(stderr, "Init_Node_Conf: list_create can not allocate memory\n");
 #else
-	syslog(LOG_ALARM, "Init_Node_Conf: list_create can not allocate memory\n");
+	syslog(LOG_ALERT, "Init_Node_Conf: list_create can not allocate memory\n");
 #endif
 	return ENOMEM;
     } /* if */
@@ -556,7 +570,7 @@ int Parse_Node_Name(char *NodeName, char **Format, int *Start_Inx, int *End_Inx,
 #if DEBUG_SYSTEM
 	fprintf(stderr, "Parse_Node_Name: unable to allocate memory\n");
 #else
-	syslog(LOG_ERR, "Parse_Node_Name: unable to allocate memory\n")
+	syslog(LOG_ERR, "Parse_Node_Name: unable to allocate memory\n");
 #endif
 	return ENOMEM;
     } /* if */
@@ -579,7 +593,7 @@ int Parse_Node_Name(char *NodeName, char **Format, int *Start_Inx, int *End_Inx,
 #if DEBUG_SYSTEM
 		fprintf(stderr, "Parse_Node_Name: Invalid '[' in node name %s\n", NodeName);
 #else
-		syslog(LOG_ALERT, "Parse_Node_Name: Invalid '[' in node name %s\n", NodeName)
+		syslog(LOG_ALERT, "Parse_Node_Name: Invalid '[' in node name %s\n", NodeName);
 #endif
 		free(Format[0]);
 		return EINVAL;
@@ -607,7 +621,7 @@ int Parse_Node_Name(char *NodeName, char **Format, int *Start_Inx, int *End_Inx,
 			NodeName[i], NodeName);
 #else
 		syslog(LOG_ALERT, "Parse_Node_Name: Invalid '%c' in node name %s\n", 
-			NodeName[i], NodeName)
+			NodeName[i], NodeName);
 #endif
 		free(Format[0]);
 		return EINVAL;
@@ -626,7 +640,7 @@ int Parse_Node_Name(char *NodeName, char **Format, int *Start_Inx, int *End_Inx,
 			NodeName[i], NodeName);
 #else
 		syslog(LOG_ALERT, "Parse_Node_Name: Invalid '%c' in node name %s\n", 
-			NodeName[i], NodeName)
+			NodeName[i], NodeName);
 #endif
 		free(Format[0]);
 		return EINVAL;
@@ -671,7 +685,7 @@ void Rehash() {
 #endif
 	return;
     } /* if */
-    memset(Hash_Table, 0, (sizeof(int *) * Node_Record_Count));
+    memset(Hash_Table, 0, (sizeof(int) * Node_Record_Count));
 
     for (i=0; i<Node_Record_Count; i++) {
 	if (strlen((Node_Record_Table_Ptr+i)->Name) == 0) continue;
diff --git a/src/slurmctld/Partition_Mgr.c b/src/slurmctld/Partition_Mgr.c
index b1d42167c3d..89c88d86cde 100644
--- a/src/slurmctld/Partition_Mgr.c
+++ b/src/slurmctld/Partition_Mgr.c
@@ -5,6 +5,8 @@
  * Author: Moe Jette, jette@llnl.gov
  */
 
+#define DEBUG_SYSTEM 1
+
 #ifdef HAVE_CONFIG_H
 #  include <config.h>
 #endif
@@ -36,6 +38,7 @@ main(int argc, char * argv[]) {
     Default_Part.MaxTime     = 223344;
     Default_Part.MaxNodes    = 556677;
 
+    printf("Create some partitions and test defaults\n");
     Part_Ptr = Create_Part_Record(&Error_Code);
     if (Error_Code) 
 	printf("Create_Part_Record error %d\n", Error_Code);
@@ -139,7 +142,7 @@ struct Part_Record *Create_Part_Record(int *Error_Code) {
 #if DEBUG_SYSTEM
 	fprintf(stderr, "Create_Part_Record: unable to allocate memory\n");
 #else
-	syslog(LOG_ALERT, "Create_Part_Record: unable to allocate memory\n")
+	syslog(LOG_ALERT, "Create_Part_Record: unable to allocate memory\n");
 #endif
 	if (Part_Record_Point->Nodes       != NULL) free(Part_Record_Point->Nodes);
 	if (Part_Record_Point->AllowGroups != NULL) free(Part_Record_Point->AllowGroups);
@@ -189,6 +192,11 @@ int Delete_Part_Record(char *name) {
     } /* while */
 
     list_iterator_destroy(Part_Record_Iterator);
+#if DEBUG_SYSTEM
+    fprintf(stderr, "Delete_Part_Record: Attempt to delete non-existent partition %s\n", name);
+#else
+    syslog(LOG_ERR, "Delete_Part_Record: Attempt to delete non-existent partition %s\n", name);
+#endif
     return ENOENT;
 } /* Delete_Part_Record */
 
@@ -239,7 +247,7 @@ int Init_Part_Conf() {
 #if DEBUG_SYSTEM
 	fprintf(stderr, "Init_Part_Conf: list_create can not allocate memory\n");
 #else
-	syslog(LOG_ALARM, "Init_Part_Conf: list_create can not allocate memory\n");
+	syslog(LOG_ALERT, "Init_Part_Conf: list_create can not allocate memory\n");
 #endif
 	return ENOMEM;
     } /* if */
diff --git a/src/slurmctld/Read_Config.c b/src/slurmctld/Read_Config.c
index 4677cb471ef..f9ece98a6a7 100644
--- a/src/slurmctld/Read_Config.c
+++ b/src/slurmctld/Read_Config.c
@@ -6,6 +6,8 @@
  * Author: Moe Jette, jette@llnl.gov
  */
 
+#define DEBUG_SYSTEM 1
+
 #ifdef HAVE_CONFIG_H
 #  include <config.h>
 #endif
@@ -14,6 +16,7 @@
 #include <errno.h>
 #include <stdio.h>
 #include <string.h>
+#include <syslog.h>
 
 #include "slurm.h"
 #include "list.h"
@@ -143,7 +146,7 @@ int Build_BitMaps() {
 #if DEBUG_SYSTEM
 	fprintf(stderr, "Build_BitMaps: unable to allocate memory\n");
 #else
-	syslog(LOG_ALERT, "Build_BitMaps: unable to allocate memory\n")
+	syslog(LOG_ALERT, "Build_BitMaps: unable to allocate memory\n");
 #endif
 	return ENOMEM;
     } /* if */
@@ -172,7 +175,7 @@ int Build_BitMaps() {
 #if DEBUG_SYSTEM
 	    fprintf(stderr, "Build_BitMaps: unable to allocate memory\n");
 #else
-	    syslog(LOG_ALERT, "Build_BitMaps: unable to allocate memory\n")
+	    syslog(LOG_ALERT, "Build_BitMaps: unable to allocate memory\n");
 #endif
 	    return ENOMEM;
 	} /* if */
@@ -208,7 +211,7 @@ int Build_BitMaps() {
 #if DEBUG_SYSTEM
 	fprintf(stderr, "Build_BitMaps: unable to allocate memory\n");
 #else
-	syslog(LOG_ALERT, "Build_BitMaps: unable to allocate memory\n")
+	syslog(LOG_ALERT, "Build_BitMaps: unable to allocate memory\n");
 #endif
 	return ENOMEM;
     } /* if */
@@ -229,7 +232,7 @@ int Build_BitMaps() {
 #if DEBUG_SYSTEM
 	    fprintf(stderr, "Build_BitMaps: unable to allocate memory\n");
 #else
-	    syslog(LOG_ALERT, "Build_BitMaps: unable to allocate memory\n")
+	    syslog(LOG_ALERT, "Build_BitMaps: unable to allocate memory\n");
 #endif
 	    free(AllPart_NodeBitMap);
 	    return ENOMEM;
@@ -740,7 +743,7 @@ int Read_SLURM_Conf (char *File_Name) {
 #if DEBUG_SYSTEM
 	    fprintf(stderr, "Read_SLURM_Conf: unable to allocate memory\n");
 #else
-	    syslog(LOG_ALERT, "Read_SLURM_Conf: unable to allocate memory\n")
+	    syslog(LOG_ALERT, "Read_SLURM_Conf: unable to allocate memory\n");
 #endif
 	    return ENOMEM;
 	} /* if */
@@ -748,14 +751,14 @@ int Read_SLURM_Conf (char *File_Name) {
 #if DEBUG_SYSTEM
     fprintf(stderr, "Read_SLURM_Conf: BackupController value not specified.\n");
 #else
-    syslog(LOG_WARN, "Read_SLURM_Conf: BackupController value not specified.\n")
+    syslog(LOG_WARNING, "Read_SLURM_Conf: BackupController value not specified.\n");
 #endif
     } /* if */
     if (ControlMachine == NULL) {
 #if DEBUG_SYSTEM
 	fprintf(stderr, "Read_SLURM_Conf: ControlMachine value not specified.\n");
 #else
-	syslog(LOG_ALERT, "Read_SLURM_Conf: ControlMachine value not specified.\n")
+	syslog(LOG_ALERT, "Read_SLURM_Conf: ControlMachine value not specified.\n");
 #endif
 	return EINVAL;
     } /* if */
-- 
GitLab