s3:registry: fix seqnum race in regdb_fetch_keys_internal
[Samba/vl.git] / source3 / include / g_lock.h
blob1ac841892230e3c59cdaa0725eb364a53efc4d6c
1 /*
2 Unix SMB/CIFS implementation.
3 global locks based on dbwrap and messaging
4 Copyright (C) 2009 by Volker Lendecke
6 This program is free software; you can redistribute it and/or modify
7 it under the terms of the GNU General Public License as published by
8 the Free Software Foundation; either version 3 of the License, or
9 (at your option) any later version.
11 This program is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 GNU General Public License for more details.
16 You should have received a copy of the GNU General Public License
17 along with this program. If not, see <http://www.gnu.org/licenses/>.
20 #ifndef _G_LOCK_H_
21 #define _G_LOCK_H_
23 #include "dbwrap/dbwrap.h"
25 struct g_lock_ctx;
27 enum g_lock_type {
28 G_LOCK_READ = 0,
29 G_LOCK_WRITE = 1,
32 struct g_lock_ctx *g_lock_ctx_init(TALLOC_CTX *mem_ctx,
33 struct messaging_context *msg);
35 NTSTATUS g_lock_lock(struct g_lock_ctx *ctx, const char *name,
36 enum g_lock_type lock_type, struct timeval timeout);
37 NTSTATUS g_lock_unlock(struct g_lock_ctx *ctx, const char *name);
38 NTSTATUS g_lock_get(struct g_lock_ctx *ctx, const char *name,
39 struct server_id *pid);
41 NTSTATUS g_lock_do(const char *name, enum g_lock_type lock_type,
42 struct timeval timeout,
43 void (*fn)(void *private_data), void *private_data);
45 int g_lock_locks(struct g_lock_ctx *ctx,
46 int (*fn)(const char *name, void *private_data),
47 void *private_data);
48 NTSTATUS g_lock_dump(struct g_lock_ctx *ctx, const char *name,
49 int (*fn)(struct server_id pid,
50 enum g_lock_type lock_type,
51 void *private_data),
52 void *private_data);
54 #endif