]> git.sur5r.net Git - openldap/blob - servers/slapd/back-ldbm/close.c
0458b556447312bc2ae1a6f946feee25501704b8
[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-2008 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 = be->be_private;
30
31         Debug( LDAP_DEBUG_TRACE, "ldbm backend syncing\n", 0, 0, 0 );
32
33         ldbm_cache_flush_all( be );
34         Debug( LDAP_DEBUG_TRACE, "ldbm backend done syncing\n", 0, 0, 0 );
35
36         cache_release_all( &li->li_cache );
37         if ( alock_close( &li->li_alock_info )) {
38                 Debug( LDAP_DEBUG_ANY,
39                         "ldbm_back_db_close: alock_close failed\n", 0, 0, 0 );
40         }
41
42         return 0;
43 }