This source file includes following definitions.
- MPI_Comm_get_name
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22 #include "ompi_config.h"
23
24 #include <string.h>
25
26 #include "opal/threads/mutex.h"
27 #include "opal/util/string_copy.h"
28
29 #include "ompi/mpi/c/bindings.h"
30 #include "ompi/runtime/params.h"
31 #include "ompi/communicator/communicator.h"
32 #include "ompi/errhandler/errhandler.h"
33 #include "ompi/totalview.h"
34 #include "ompi/memchecker.h"
35
36 #if OMPI_BUILD_MPI_PROFILING
37 #if OPAL_HAVE_WEAK_SYMBOLS
38 #pragma weak MPI_Comm_get_name = PMPI_Comm_get_name
39 #endif
40 #define MPI_Comm_get_name PMPI_Comm_get_name
41 #endif
42
43 static const char FUNC_NAME[] = "MPI_Comm_get_name";
44
45
46 int MPI_Comm_get_name(MPI_Comm comm, char *name, int *length)
47 {
48 MEMCHECKER(
49 memchecker_comm(comm);
50 );
51
52 OPAL_CR_NOOP_PROGRESS();
53
54 if ( MPI_PARAM_CHECK ) {
55 OMPI_ERR_INIT_FINALIZE(FUNC_NAME);
56
57 if ( ompi_comm_invalid ( comm ) )
58 return OMPI_ERRHANDLER_INVOKE ( MPI_COMM_WORLD, MPI_ERR_COMM,
59 FUNC_NAME);
60
61 if ( NULL == name || NULL == length )
62 return OMPI_ERRHANDLER_INVOKE ( comm, MPI_ERR_ARG,
63 FUNC_NAME);
64 }
65 OPAL_THREAD_LOCK(&(comm->c_lock));
66
67
68
69
70
71
72
73
74
75
76 if ( comm->c_flags & OMPI_COMM_NAMEISSET ) {
77 opal_string_copy(name, comm->c_name, MPI_MAX_OBJECT_NAME);
78 *length = (int) strlen(comm->c_name);
79 } else {
80 name[0] = '\0';
81 *length = 0;
82 }
83 OPAL_THREAD_UNLOCK(&(comm->c_lock));
84
85 return MPI_SUCCESS;
86 }