1 /* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil -*- */
2 /*
3 * Copyright (c) 2004-2005 The Trustees of Indiana University and Indiana
4 * University Research and Technology
5 * Corporation. All rights reserved.
6 * Copyright (c) 2004-2005 The University of Tennessee and The University
7 * of Tennessee Research Foundation. All rights
8 * reserved.
9 * Copyright (c) 2004-2005 High Performance Computing Center Stuttgart,
10 * University of Stuttgart. All rights reserved.
11 * Copyright (c) 2004-2005 The Regents of the University of California.
12 * All rights reserved.
13 * Copyright (c) 2009 Cisco Systems, Inc. All rights reserved.
14 * Copyright (c) 2015 Los Alamos National Security, LLC. All rights
15 * reserved.
16 * Copyright (c) 2016 Intel, Inc. All rights reserved.
17 * $COPYRIGHT$
18 *
19 * Additional copyrights may follow
20 *
21 * $HEADER$
22 */
23
24 #include <src/include/pmix_config.h>
25
26 #include "src/util/output.h"
27 #include "src/mca/mca.h"
28 #include "src/mca/base/base.h"
29 #include "src/mca/base/pmix_mca_base_component_repository.h"
30 #include "pmix_common.h"
31
32 extern int pmix_mca_base_opened;
33
34 /*
35 * Main MCA shutdown.
36 */
37 int pmix_mca_base_close(void)
38 {
39 assert (pmix_mca_base_opened);
40 if (!--pmix_mca_base_opened) {
41 /* deregister all MCA base parameters */
42 int group_id = pmix_mca_base_var_group_find ("pmix", "mca", "base");
43
44 if (-1 < group_id) {
45 pmix_mca_base_var_group_deregister (group_id);
46 }
47
48 /* release the default paths */
49 if (NULL != pmix_mca_base_system_default_path) {
50 free(pmix_mca_base_system_default_path);
51 }
52 if (NULL != pmix_mca_base_user_default_path) {
53 free(pmix_mca_base_user_default_path);
54 }
55
56 /* Close down the component repository */
57 pmix_mca_base_component_repository_finalize();
58
59 /* Shut down the dynamic component finder */
60 pmix_mca_base_component_find_finalize();
61
62 /* Close pmix output stream 0 */
63 pmix_output_close(0);
64 }
65
66 /* All done */
67 return PMIX_SUCCESS;
68 }