00001
00002
00003
00004
00005
00006
00007
00008
00009 #include "mpioimpl.h"
00010
00011 #ifdef HAVE_WEAK_SYMBOLS
00012
00013 #if defined(HAVE_PRAGMA_WEAK)
00014 #pragma weak MPI_Info_get = PMPI_Info_get
00015 #elif defined(HAVE_PRAGMA_HP_SEC_DEF)
00016 #pragma _HP_SECONDARY_DEF PMPI_Info_get MPI_Info_get
00017 #elif defined(HAVE_PRAGMA_CRI_DUP)
00018 #pragma _CRI duplicate MPI_Info_get as PMPI_Info_get
00019
00020 #endif
00021
00022
00023 #define MPIO_BUILD_PROFILING
00024 #include "mpioprof.h"
00025 #endif
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037
00038
00039
00040
00041 int MPI_Info_get(MPI_Info info, char *key, int valuelen, char *value, int *flag)
00042 {
00043 MPI_Info curr;
00044
00045 if ((info <= (MPI_Info) 0) || (info->cookie != MPIR_INFO_COOKIE)) {
00046 FPRINTF(stderr, "MPI_Info_get: Invalid info object\n");
00047 MPI_Abort(MPI_COMM_WORLD, 1);
00048 }
00049
00050 if (key <= (char *) 0) {
00051 FPRINTF(stderr, "MPI_Info_get: key is an invalid address\n");
00052 MPI_Abort(MPI_COMM_WORLD, 1);
00053 }
00054
00055 if (strlen(key) > MPI_MAX_INFO_KEY) {
00056 FPRINTF(stderr, "MPI_Info_get: key is longer than MPI_MAX_INFO_KEY\n");
00057 MPI_Abort(MPI_COMM_WORLD, 1);
00058 }
00059
00060 if (!strlen(key)) {
00061 FPRINTF(stderr, "MPI_Info_get: key is a null string\n");
00062 MPI_Abort(MPI_COMM_WORLD, 1);
00063 }
00064
00065 if (valuelen <= 0) {
00066 FPRINTF(stderr, "MPI_Info_get: Invalid valuelen argument\n");
00067 MPI_Abort(MPI_COMM_WORLD, 1);
00068 }
00069
00070 if (value <= (char *) 0) {
00071 FPRINTF(stderr, "MPI_Info_get: value is an invalid address\n");
00072 MPI_Abort(MPI_COMM_WORLD, 1);
00073 }
00074
00075 curr = info->next;
00076 *flag = 0;
00077
00078 while (curr) {
00079 if (!strcmp(curr->key, key)) {
00080 strncpy(value, curr->value, valuelen);
00081 value[valuelen] = '\0';
00082 *flag = 1;
00083 break;
00084 }
00085 curr = curr->next;
00086 }
00087
00088 return MPI_SUCCESS;
00089 }