Sync usage with man page.
[netbsd-mini2440.git] / external / bsd / openldap / dist / servers / slapd / alock.h
blob5195ad9a3b9d34ee94bd5459fc6a32bcb0403fde
1 /* alock.h - access lock header */
2 /* $OpenLDAP: pkg/ldap/servers/slapd/alock.h,v 1.3.2.4 2008/02/11 23:26:43 kurt Exp $ */
3 /* This work is part of OpenLDAP Software <http://www.openldap.org/>.
5 * Copyright 2005-2008 The OpenLDAP Foundation.
6 * Portions Copyright 2004-2005 Symas Corporation.
7 * All rights reserved.
9 * Redistribution and use in source and binary forms, with or without
10 * modification, are permitted only as authorized by the OpenLDAP
11 * Public License.
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>.
17 /* ACKNOWLEDGEMENTS:
18 * This work was initially developed by Matthew Backes at Symas
19 * Corporation for inclusion in OpenLDAP Software.
22 #ifndef _ALOCK_H_
23 #define _ALOCK_H_
25 #include "portable.h"
26 #include <ac/time.h>
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)
41 #define ALOCK_SMASK 3
43 /* lock/state where recovery is not available */
44 #define ALOCK_NOSAVE 4
46 /* constants */
47 #define ALOCK_SLOT_SIZE (1024)
48 #define ALOCK_SLOT_IATTRS (4)
49 #define ALOCK_MAX_APPNAME (ALOCK_SLOT_SIZE - 8 * ALOCK_SLOT_IATTRS)
50 #define ALOCK_MAGIC (0x12345678)
52 LDAP_BEGIN_DECL
54 typedef struct alock_info {
55 int al_fd;
56 int al_slot;
57 } alock_info_t;
59 typedef struct alock_slot {
60 unsigned int al_lock;
61 time_t al_stamp;
62 pid_t al_pid;
63 char * al_appname;
64 } alock_slot_t;
66 LDAP_SLAPD_F (int) alock_open LDAP_P(( alock_info_t * info, const char * appname,
67 const char * envdir, int locktype ));
68 LDAP_SLAPD_F (int) alock_scan LDAP_P(( alock_info_t * info ));
69 LDAP_SLAPD_F (int) alock_close LDAP_P(( alock_info_t * info, int nosave ));
70 LDAP_SLAPD_F (int) alock_recover LDAP_P(( alock_info_t * info ));
72 LDAP_END_DECL
74 #endif