]> git.sur5r.net Git - openldap/blob - servers/slapd/back-bdb2/close.c
Integration of the BDB2 backend into the new init/startup/shutdown schema.
[openldap] / servers / slapd / back-bdb2 / close.c
1 /* close.c - close bdb2 backend database */
2
3 #include "portable.h"
4
5 #include <stdio.h>
6
7 #include <ac/socket.h>
8
9 #include "slap.h"
10 #include "back-bdb2.h"
11
12 static int
13 bdb2i_back_db_close_internal( BackendDB *be )
14 {
15         Debug( LDAP_DEBUG_TRACE, "bdb2 backend saving nextid\n", 0, 0, 0 );
16         if ( bdb2i_next_id_save( be ) < 0 ) {
17                 Debug( LDAP_DEBUG_ANY, "bdb2 backend nextid save failed!\n", 0, 0, 0 );
18         }
19
20         /*  close all DB files  */
21         Debug( LDAP_DEBUG_TRACE, "bdb2 backend closing DB files\n", 0, 0, 0 );
22         bdb2i_txn_close_files( be );
23         Debug( LDAP_DEBUG_TRACE, "bdb2 backend done closing DB files\n", 0, 0, 0 );
24
25         return 0;
26 }
27
28
29 int
30 bdb2_back_db_close( BackendDB *be )
31 {
32         struct timeval  time1, time2;
33         char   *elapsed_time;
34         int    ret;
35
36         gettimeofday( &time1, NULL );
37
38         ret = bdb2i_back_db_close_internal( be );
39
40         if ( bdb2i_do_timing ) {
41
42                 gettimeofday( &time2, NULL);
43                 elapsed_time = bdb2i_elapsed( time1, time2 );
44                 Debug( LDAP_DEBUG_ANY, "CLOSE elapsed=%s\n",
45                                 elapsed_time, 0, 0 );
46                 free( elapsed_time );
47
48         }
49
50         return( ret );
51 }
52
53