Open MPI logo

PLPA Users' Mailing List Archives

  |   Home   |   Support   |   FAQ   |   all PLPA Users mailing list

Subject: [PLPA users] [PATCH 5/5] introduce get_socket_info3() to get also the min_socket_id
From: Bert Wesarg (bert.wesarg_at_[hidden])
Date: 2009-07-23 17:47:50


---
 src/libplpa/plpa.h.in  |    6 ++++++
 src/libplpa/plpa_map.c |   15 ++++++++++++++-
 2 files changed, 20 insertions(+), 1 deletions(-)
diff --git a/src/libplpa/plpa.h.in b/src/libplpa/plpa.h.in
index 6ee3e4a..945d018 100644
--- a/src/libplpa/plpa.h.in
+++ b/src/libplpa/plpa.h.in
@@ -239,6 +239,12 @@ int PLPA_NAME(get_processor_id)(int processor_num,
    Returns 0 on success. */
 int PLPA_NAME(get_processor_flags)(int processor_id, int *exists, int *online);
 
+/* Returns the number of sockets in the system and the min- and maximum
+   socket ID number (in case there are "holes" in the list of available
+   socket IDs).  Returns 0 upon sucess. */
+int PLPA_NAME(get_socket_info3)(int *num_sockets,
+                                int *min_socket_id, int *max_socket_id);
+
 /* Returns both the number of sockets in the system and the maximum
    socket ID number (in case there are "holes" in the list of available
    socket IDs).  Returns 0 upon sucess. */
diff --git a/src/libplpa/plpa_map.c b/src/libplpa/plpa_map.c
index 8882782..4dec82c 100644
--- a/src/libplpa/plpa_map.c
+++ b/src/libplpa/plpa_map.c
@@ -841,9 +841,20 @@ int PLPA_NAME(get_processor_flags)(int processor_id,
     return 0;
 }
 
+
 /* Return the max socket number */
 int PLPA_NAME(get_socket_info)(int *num_sockets_arg, int *max_socket_id_arg)
 {
+    int dummy;
+
+    return PLPA_NAME(get_socket_info3)(num_sockets_arg,
+                                       &dummy, max_socket_id_arg);
+}
+
+/* Return the min/max socket number */
+int PLPA_NAME(get_socket_info3)(int *num_sockets_arg,
+                                int *min_socket_id_arg, int *max_socket_id_arg)
+{
     int ret;
 
     /* Initialize if not already done so */
@@ -864,12 +875,14 @@ int PLPA_NAME(get_socket_info)(int *num_sockets_arg, int *max_socket_id_arg)
     }
 
     /* Check for bozo arguments */
-    if (NULL == max_socket_id_arg || NULL == num_sockets_arg) {
+    if (NULL == max_socket_id_arg || NULL == min_socket_id_arg ||
+        NULL == num_sockets_arg) {
         return EINVAL;
     }
 
     /* All done */
     *num_sockets_arg = num_sockets;
+    *min_socket_id_arg = min_socket_id;
     *max_socket_id_arg = max_socket_id;
     return 0;
 }
-- 
1.6.3.3.618.gce7bf