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$
17 *
18 * Additional copyrights may follow
19 *
20 * $HEADER$
21 */
22
23 #include "opal_config.h"
24
25 #include "opal/util/output.h"
26 #include "opal/mca/mca.h"
27 #include "opal/mca/base/base.h"
28 #include "opal/mca/base/mca_base_component_repository.h"
29 #include "opal/constants.h"
30
31 extern int mca_base_opened;
32
33 /*
34 * Main MCA shutdown.
35 */
36
37 void mca_base_close (void)
38 {
39 assert (mca_base_opened);
40 if (--mca_base_opened) {
41 return;
42 }
43
44 /* deregister all MCA base parameters */
45 int group_id = mca_base_var_group_find ("opal", "mca", "base");
46
47 if (-1 < group_id) {
48 mca_base_var_group_deregister (group_id);
49 }
50
51 /* release the default paths */
52 free (mca_base_system_default_path);
53 mca_base_system_default_path = NULL;
54
55 free (mca_base_user_default_path);
56 mca_base_user_default_path = NULL;
57
58 /* Close down the component repository */
59 mca_base_component_repository_finalize();
60
61 /* Shut down the dynamic component finder */
62 mca_base_component_find_finalize();
63
64 /* Close opal output stream 0 */
65 opal_output_close(0);
66 }