1 /* alock.h - access lock header */
3 /* This work is part of OpenLDAP Software <http://www.openldap.org/>.
5 * Copyright 2005 The OpenLDAP Foundation.
6 * Portions Copyright 2004-2005 Symas Corporation.
9 * Redistribution and use in source and binary forms, with or without
10 * modification, are permitted only as authorized by the OpenLDAP
13 * A copy of this license is available in the file LICENSE in the
14 * top-level directory of the distribution or, alternatively, at
15 * <http://www.OpenLDAP.org/license.html>.
18 * This work was initially developed by Matthew Backes at Symas
19 * Corporation for inclusion in OpenLDAP Software.
27 #include <ac/unistd.h>
29 /* environment states (all the slots together) */
30 #define ALOCK_CLEAN (0)
31 #define ALOCK_RECOVER (1)
32 #define ALOCK_BUSY (2)
33 #define ALOCK_UNSTABLE (3)
35 /* lock user types and states */
36 #define ALOCK_UNLOCKED (0)
37 #define ALOCK_LOCKED (1)
38 #define ALOCK_UNIQUE (2)
39 #define ALOCK_DIRTY (3)
42 #define ALOCK_SLOT_SIZE (1024)
43 #define ALOCK_SLOT_IATTRS (4)
44 #define ALOCK_MAX_APPNAME (ALOCK_SLOT_SIZE - 8 * ALOCK_SLOT_IATTRS)
45 #define ALOCK_MAGIC (0x12345678)
49 typedef struct alock_info {
54 typedef struct alock_slot {
61 LDAP_SLAPD_F (int) alock_open LDAP_P(( alock_info_t * info, const char * appname,
62 const char * envdir, int locktype ));
63 LDAP_SLAPD_F (int) alock_scan LDAP_P(( alock_info_t * info ));
64 LDAP_SLAPD_F (int) alock_close LDAP_P(( alock_info_t * info ));
65 LDAP_SLAPD_F (int) alock_recover LDAP_P(( alock_info_t * info ));