]> git.sur5r.net Git - openldap/blob - servers/slapd/back-ldbm/close.c
67d8965baab1b4b9eb72845e0f528b81736da789
[openldap] / servers / slapd / back-ldbm / close.c
1 /* close.c - close ldbm backend */
2 /* $OpenLDAP$ */
3 /* This work is part of OpenLDAP Software <http://www.openldap.org/>.
4  *
5  * Copyright 1998-2004 The OpenLDAP Foundation.
6  * All rights reserved.
7  *
8  * Redistribution and use in source and binary forms, with or without
9  * modification, are permitted only as authorized by the OpenLDAP
10  * Public License.
11  *
12  * A copy of this license is available in the file LICENSE in the
13  * top-level directory of the distribution or, alternatively, at
14  * <http://www.OpenLDAP.org/license.html>.
15  */
16
17 #include "portable.h"
18
19 #include <stdio.h>
20
21 #include <ac/socket.h>
22
23 #include "slap.h"
24 #include "back-ldbm.h"
25
26 int
27 ldbm_back_db_close( Backend *be )
28 {
29         struct ldbminfo *li = (struct ldbminfo *) be->be_private;
30         if ( li->li_dbsyncfreq > 0 )
31         {
32                 li->li_dbshutdown++;
33                 ldap_pvt_thread_join( li->li_dbsynctid, (void *) NULL );
34         }
35         Debug( LDAP_DEBUG_TRACE, "ldbm backend syncing\n", 0, 0, 0 );
36
37         ldbm_cache_flush_all( be );
38         Debug( LDAP_DEBUG_TRACE, "ldbm backend done syncing\n", 0, 0, 0 );
39
40
41         cache_release_all( &((struct ldbminfo *) be->be_private)->li_cache );
42
43         return 0;
44 }