Warning: That file was not part of the compilation database. It may have many parsing errors.

1/* gdbm.h - The include file for dbm users. -*- c -*- */
2
3/* This file is part of GDBM, the GNU data base manager, by Philip A. Nelson.
4 Copyright (C) 1990, 1991, 1993, 2011 Free Software Foundation, Inc.
5
6 GDBM 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 2, or (at your option)
9 any later version.
10
11 GDBM 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.
15
16 You should have received a copy of the GNU General Public License
17 along with GDBM. If not, see <http://www.gnu.org/licenses/>.
18
19 You may contact the author by:
20 e-mail: phil@cs.wwu.edu
21 us-mail: Philip A. Nelson
22 Computer Science Department
23 Western Washington University
24 Bellingham, WA 98226
25
26*************************************************************************/
27
28/* Protection for multiple includes. */
29#ifndef _GDBM_H_
30# define _GDBM_H_
31
32# include <stdio.h>
33
34/* GDBM C++ support */
35# if defined(__cplusplus) || defined(c_plusplus)
36extern "C" {
37# endif
38
39/* Parameters to gdbm_open for READERS, WRITERS, and WRITERS who
40 can create the database. */
41# define GDBM_READER 0 /* A reader. */
42# define GDBM_WRITER 1 /* A writer. */
43# define GDBM_WRCREAT 2 /* A writer. Create the db if needed. */
44# define GDBM_NEWDB 3 /* A writer. Always create a new db. */
45# define GDBM_OPENMASK 7 /* Mask for the above. */
46
47# define GDBM_FAST 0x010 /* Write fast! => No fsyncs. OBSOLETE. */
48# define GDBM_SYNC 0x020 /* Sync operations to the disk. */
49# define GDBM_NOLOCK 0x040 /* Don't do file locking operations. */
50# define GDBM_NOMMAP 0x080 /* Don't use mmap(). */
51# define GDBM_CLOEXEC 0x100 /* Close the underlying fd on exec(3) */
52
53/* Parameters to gdbm_store for simple insertion or replacement in the
54 case that the key is already in the database. */
55# define GDBM_INSERT 0 /* Never replace old data with new. */
56# define GDBM_REPLACE 1 /* Always replace old data with new. */
57
58/* Parameters to gdbm_setopt, specifing the type of operation to perform. */
59# define GDBM_SETCACHESIZE 1 /* Set the cache size. */
60# define GDBM_FASTMODE 2 /* Toggle fast mode. OBSOLETE. */
61# define GDBM_SETSYNCMODE 3 /* Turn on or off sync operations. */
62# define GDBM_SETCENTFREE 4 /* Keep all free blocks in the header. */
63# define GDBM_SETCOALESCEBLKS 5 /* Attempt to coalesce free blocks. */
64# define GDBM_SETMAXMAPSIZE 6 /* Set maximum mapped memory size */
65# define GDBM_SETMMAP 7 /* Toggle mmap mode */
66
67/* Compatibility defines: */
68# define GDBM_CACHESIZE GDBM_SETCACHESIZE
69# define GDBM_SYNCMODE GDBM_SETSYNCMODE
70# define GDBM_CENTFREE GDBM_SETCENTFREE
71# define GDBM_COALESCEBLKS GDBM_SETCOALESCEBLKS
72
73# define GDBM_GETFLAGS 8 /* Get gdbm_open flags */
74# define GDBM_GETMMAP 9 /* Get mmap status */
75# define GDBM_GETCACHESIZE 10 /* Get current cache side */
76# define GDBM_GETSYNCMODE 11 /* Get synch mode */
77# define GDBM_GETCENTFREE 12 /* Get "centfree" status */
78# define GDBM_GETCOALESCEBLKS 13 /* Get free block coalesce status */
79# define GDBM_GETMAXMAPSIZE 14 /* Get maximum mapped memory size */
80# define GDBM_GETDBNAME 15 /* Return database file name */
81
82typedef unsigned long long int gdbm_count_t;
83
84/* The data and key structure. */
85typedef struct {
86 char *dptr;
87 int dsize;
88 } datum;
89
90
91/* A pointer to the GDBM file. */
92typedef struct gdbm_file_info *GDBM_FILE;
93
94/* External variable, the gdbm build release string. */
95extern const char *gdbm_version;
96
97# define GDBM_VERSION_MAJOR 1
98# define GDBM_VERSION_MINOR 11
99# define GDBM_VERSION_PATCH 0
100
101extern int const gdbm_version_number[3];
102
103/* GDBM external functions. */
104
105extern GDBM_FILE gdbm_open (const char *, int, int, int,
106 void (*)(const char *));
107extern void gdbm_close (GDBM_FILE);
108extern int gdbm_store (GDBM_FILE, datum, datum, int);
109extern datum gdbm_fetch (GDBM_FILE, datum);
110extern int gdbm_delete (GDBM_FILE, datum);
111extern datum gdbm_firstkey (GDBM_FILE);
112extern datum gdbm_nextkey (GDBM_FILE, datum);
113extern int gdbm_reorganize (GDBM_FILE);
114extern void gdbm_sync (GDBM_FILE);
115extern int gdbm_exists (GDBM_FILE, datum);
116extern int gdbm_setopt (GDBM_FILE, int, void *, int);
117extern int gdbm_fdesc (GDBM_FILE);
118
119extern int gdbm_export (GDBM_FILE, const char *, int, int);
120extern int gdbm_export_to_file (GDBM_FILE dbf, FILE *fp);
121
122extern int gdbm_import (GDBM_FILE, const char *, int);
123extern int gdbm_import_from_file (GDBM_FILE dbf, FILE *fp, int flag);
124
125extern int gdbm_count (GDBM_FILE dbf, gdbm_count_t *pcount);
126
127#define GDBM_DUMP_FMT_BINARY 0
128#define GDBM_DUMP_FMT_ASCII 1
129
130#define GDBM_META_MASK_MODE 0x01
131#define GDBM_META_MASK_OWNER 0x02
132
133extern int gdbm_dump (GDBM_FILE, const char *, int fmt, int open_flags,
134 int mode);
135extern int gdbm_dump_to_file (GDBM_FILE, FILE *, int fmt);
136
137extern int gdbm_load (GDBM_FILE *, const char *, int replace,
138 int meta_flags,
139 unsigned long *line);
140extern int gdbm_load_from_file (GDBM_FILE *, FILE *, int replace,
141 int meta_flags,
142 unsigned long *line);
143
144# define GDBM_NO_ERROR 0
145# define GDBM_MALLOC_ERROR 1
146# define GDBM_BLOCK_SIZE_ERROR 2
147# define GDBM_FILE_OPEN_ERROR 3
148# define GDBM_FILE_WRITE_ERROR 4
149# define GDBM_FILE_SEEK_ERROR 5
150# define GDBM_FILE_READ_ERROR 6
151# define GDBM_BAD_MAGIC_NUMBER 7
152# define GDBM_EMPTY_DATABASE 8
153# define GDBM_CANT_BE_READER 9
154# define GDBM_CANT_BE_WRITER 10
155# define GDBM_READER_CANT_DELETE 11
156# define GDBM_READER_CANT_STORE 12
157# define GDBM_READER_CANT_REORGANIZE 13
158# define GDBM_UNKNOWN_UPDATE 14
159# define GDBM_ITEM_NOT_FOUND 15
160# define GDBM_REORGANIZE_FAILED 16
161# define GDBM_CANNOT_REPLACE 17
162# define GDBM_ILLEGAL_DATA 18
163# define GDBM_OPT_ALREADY_SET 19
164# define GDBM_OPT_ILLEGAL 20
165# define GDBM_BYTE_SWAPPED 21
166# define GDBM_BAD_FILE_OFFSET 22
167# define GDBM_BAD_OPEN_FLAGS 23
168# define GDBM_FILE_STAT_ERROR 24
169# define GDBM_FILE_EOF 25
170# define GDBM_NO_DBNAME 26
171# define GDBM_ERR_FILE_OWNER 27
172# define GDBM_ERR_FILE_MODE 28
173
174# define _GDBM_MIN_ERRNO 0
175# define _GDBM_MAX_ERRNO GDBM_ERR_FILE_MODE
176typedef int gdbm_error; /* For compatibilities sake. */
177extern gdbm_error gdbm_errno;
178extern const char * const gdbm_errlist[];
179
180/* extra prototypes */
181
182extern const char *gdbm_strerror (gdbm_error);
183extern int gdbm_version_cmp (int const a[], int const b[]);
184
185# if defined(__cplusplus) || defined(c_plusplus)
186}
187# endif
188
189#endif
190

Warning: That file was not part of the compilation database. It may have many parsing errors.