From cd606813a04748f91410b074a93c0770f44cb8d1 Mon Sep 17 00:00:00 2001
From: Jim Garlick <garlick@llnl.gov>
Date: Sun, 2 Jun 2002 07:52:01 +0000
Subject: [PATCH] Modify configure.ac to look for -lrmscall not -lrms. Update
 src/test/runqsw.c to fail if it fails to determine network Id. Update
 src/common/qsw.c to work with new driver (elan3_create requires a handle from
 elan3_control_open now instead of _elan3_init).

---
 configure.ac      |  2 +-
 src/common/qsw.c  | 14 +++++++++++++-
 src/test/runqsw.c |  4 ++++
 3 files changed, 18 insertions(+), 2 deletions(-)

diff --git a/configure.ac b/configure.ac
index 18ddff97ff9..2ba08788b60 100644
--- a/configure.ac
+++ b/configure.ac
@@ -66,7 +66,7 @@ if test $with_elan; then
     [], 
     [AC_MSG_ERROR([unable to find the Elan3 library needed for Elan support.])], 
   )
-  AC_CHECK_LIB(rms, rms_prgcreate, 
+  AC_CHECK_LIB(rmscall, rms_prgcreate, 
     [],
     [AC_MSG_ERROR([unable to find the RMS library needed for Elan support])],
   )
diff --git a/src/common/qsw.c b/src/common/qsw.c
index 5fcbdd1a04c..2ccff41f9dc 100644
--- a/src/common/qsw.c
+++ b/src/common/qsw.c
@@ -538,7 +538,11 @@ void
 qsw_prog_fini(qsw_jobinfo_t jobinfo)
 {
 	if (jobinfo->j_ctx) {
+#if OLD_ELAN_DRIVER
 		_elan3_fini(jobinfo->j_ctx);
+#else
+		elan3_control_close(jobinfo->j_ctx);
+#endif
 		jobinfo->j_ctx = NULL;
 	}
 }
@@ -550,10 +554,14 @@ int
 qsw_prog_init(qsw_jobinfo_t jobinfo, uid_t uid)
 {
 	int err;
-
+#if OLD_ELAN_DRIVER
 	/* obtain an Elan context (not the same as a hardware context num!) */
 	if ((jobinfo->j_ctx = _elan3_init(0)) == NULL)
 		goto fail;
+#else
+	if ((jobinfo->j_ctx = elan3_control_open(0)) == NULL)
+		goto fail;
+#endif
 
 	/* associate this process and its children with prgnum */
 	if (rms_prgcreate(jobinfo->j_prognum, uid, 1) < 0)
@@ -605,7 +613,11 @@ qsw_getnodeid(void)
 
 	if (ctx) {
 		nodeid = ctx->devinfo.NodeId;
+#if OLD_ELAN_DRIVER
 		_elan3_fini(ctx);
+#else
+		elan3_control_close(ctx);
+#endif
 	}
 	return nodeid;
 }
diff --git a/src/test/runqsw.c b/src/test/runqsw.c
index 9ad5fba1896..82acf2de6b0 100644
--- a/src/test/runqsw.c
+++ b/src/test/runqsw.c
@@ -200,6 +200,10 @@ main(int argc, char *argv[])
 		usage();
 	if (nprocs == 0)
 		nprocs = 2;
+	if (nodeid < 0) {
+		fprintf(stderr, "runqsw: could not determine elan address\n");
+		exit(1);
+	}
 	while (optind < argc)
 		sprintf(cmdbuf + strlen(cmdbuf), "%s ", argv[optind++]);
 	cmdbuf[strlen(cmdbuf) - 1] = '\0';
-- 
GitLab