Edit File by line
/home/barbar84/public_h.../wp-conte.../plugins/sujqvwi/ExeBy/smexe_ro.../usr/include/gdbm
File: gdbm.h
/* gdbm.h - The include file for dbm users. -*- c -*- */
[0] Fix | Delete
[1] Fix | Delete
/* This file is part of GDBM, the GNU data base manager, by Philip A. Nelson.
[2] Fix | Delete
Copyright (C) 1990-1991, 1993, 2011, 2016-2018 Free Software
[3] Fix | Delete
Foundation, Inc.
[4] Fix | Delete
[5] Fix | Delete
GDBM is free software; you can redistribute it and/or modify
[6] Fix | Delete
it under the terms of the GNU General Public License as published by
[7] Fix | Delete
the Free Software Foundation; either version 2, or (at your option)
[8] Fix | Delete
any later version.
[9] Fix | Delete
[10] Fix | Delete
GDBM is distributed in the hope that it will be useful,
[11] Fix | Delete
but WITHOUT ANY WARRANTY; without even the implied warranty of
[12] Fix | Delete
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
[13] Fix | Delete
GNU General Public License for more details.
[14] Fix | Delete
[15] Fix | Delete
You should have received a copy of the GNU General Public License
[16] Fix | Delete
along with GDBM. If not, see <http://www.gnu.org/licenses/>.
[17] Fix | Delete
[18] Fix | Delete
You may contact the author by:
[19] Fix | Delete
e-mail: phil@cs.wwu.edu
[20] Fix | Delete
us-mail: Philip A. Nelson
[21] Fix | Delete
Computer Science Department
[22] Fix | Delete
Western Washington University
[23] Fix | Delete
Bellingham, WA 98226
[24] Fix | Delete
[25] Fix | Delete
*************************************************************************/
[26] Fix | Delete
[27] Fix | Delete
/* Protection for multiple includes. */
[28] Fix | Delete
#ifndef _GDBM_H_
[29] Fix | Delete
# define _GDBM_H_
[30] Fix | Delete
[31] Fix | Delete
# include <stdio.h>
[32] Fix | Delete
[33] Fix | Delete
/* GDBM C++ support */
[34] Fix | Delete
# if defined(__cplusplus) || defined(c_plusplus)
[35] Fix | Delete
extern "C" {
[36] Fix | Delete
# endif
[37] Fix | Delete
[38] Fix | Delete
/* Parameters to gdbm_open for READERS, WRITERS, and WRITERS who
[39] Fix | Delete
can create the database. */
[40] Fix | Delete
# define GDBM_READER 0 /* A reader. */
[41] Fix | Delete
# define GDBM_WRITER 1 /* A writer. */
[42] Fix | Delete
# define GDBM_WRCREAT 2 /* A writer. Create the db if needed. */
[43] Fix | Delete
# define GDBM_NEWDB 3 /* A writer. Always create a new db. */
[44] Fix | Delete
# define GDBM_OPENMASK 7 /* Mask for the above. */
[45] Fix | Delete
[46] Fix | Delete
# define GDBM_FAST 0x010 /* Write fast! => No fsyncs. OBSOLETE. */
[47] Fix | Delete
# define GDBM_SYNC 0x020 /* Sync operations to the disk. */
[48] Fix | Delete
# define GDBM_NOLOCK 0x040 /* Don't do file locking operations. */
[49] Fix | Delete
# define GDBM_NOMMAP 0x080 /* Don't use mmap(). */
[50] Fix | Delete
# define GDBM_CLOEXEC 0x100 /* Close the underlying fd on exec(3) */
[51] Fix | Delete
# define GDBM_BSEXACT 0x200 /* Don't adjust block_size. Bail out with
[52] Fix | Delete
GDBM_BLOCK_SIZE_ERROR error if unable to
[53] Fix | Delete
set it. */
[54] Fix | Delete
# define GDBM_CLOERROR 0x400 /* Only for gdbm_fd_open: close fd on error. */
[55] Fix | Delete
[56] Fix | Delete
/* Parameters to gdbm_store for simple insertion or replacement in the
[57] Fix | Delete
case that the key is already in the database. */
[58] Fix | Delete
# define GDBM_INSERT 0 /* Never replace old data with new. */
[59] Fix | Delete
# define GDBM_REPLACE 1 /* Always replace old data with new. */
[60] Fix | Delete
[61] Fix | Delete
/* Parameters to gdbm_setopt, specifing the type of operation to perform. */
[62] Fix | Delete
# define GDBM_SETCACHESIZE 1 /* Set the cache size. */
[63] Fix | Delete
# define GDBM_FASTMODE 2 /* Toggle fast mode. OBSOLETE. */
[64] Fix | Delete
# define GDBM_SETSYNCMODE 3 /* Turn on or off sync operations. */
[65] Fix | Delete
# define GDBM_SETCENTFREE 4 /* Keep all free blocks in the header. */
[66] Fix | Delete
# define GDBM_SETCOALESCEBLKS 5 /* Attempt to coalesce free blocks. */
[67] Fix | Delete
# define GDBM_SETMAXMAPSIZE 6 /* Set maximum mapped memory size */
[68] Fix | Delete
# define GDBM_SETMMAP 7 /* Toggle mmap mode */
[69] Fix | Delete
[70] Fix | Delete
/* Compatibility defines: */
[71] Fix | Delete
# define GDBM_CACHESIZE GDBM_SETCACHESIZE
[72] Fix | Delete
# define GDBM_SYNCMODE GDBM_SETSYNCMODE
[73] Fix | Delete
# define GDBM_CENTFREE GDBM_SETCENTFREE
[74] Fix | Delete
# define GDBM_COALESCEBLKS GDBM_SETCOALESCEBLKS
[75] Fix | Delete
[76] Fix | Delete
# define GDBM_GETFLAGS 8 /* Get gdbm_open flags */
[77] Fix | Delete
# define GDBM_GETMMAP 9 /* Get mmap status */
[78] Fix | Delete
# define GDBM_GETCACHESIZE 10 /* Get current cache side */
[79] Fix | Delete
# define GDBM_GETSYNCMODE 11 /* Get synch mode */
[80] Fix | Delete
# define GDBM_GETCENTFREE 12 /* Get "centfree" status */
[81] Fix | Delete
# define GDBM_GETCOALESCEBLKS 13 /* Get free block coalesce status */
[82] Fix | Delete
# define GDBM_GETMAXMAPSIZE 14 /* Get maximum mapped memory size */
[83] Fix | Delete
# define GDBM_GETDBNAME 15 /* Return database file name */
[84] Fix | Delete
# define GDBM_GETBLOCKSIZE 16 /* Return block size */
[85] Fix | Delete
[86] Fix | Delete
typedef unsigned long long int gdbm_count_t;
[87] Fix | Delete
[88] Fix | Delete
/* The data and key structure. */
[89] Fix | Delete
typedef struct
[90] Fix | Delete
{
[91] Fix | Delete
char *dptr;
[92] Fix | Delete
int dsize;
[93] Fix | Delete
} datum;
[94] Fix | Delete
[95] Fix | Delete
[96] Fix | Delete
/* A pointer to the GDBM file. */
[97] Fix | Delete
typedef struct gdbm_file_info *GDBM_FILE;
[98] Fix | Delete
[99] Fix | Delete
/* External variable, the gdbm build release string. */
[100] Fix | Delete
extern const char *gdbm_version;
[101] Fix | Delete
[102] Fix | Delete
# define GDBM_VERSION_MAJOR 1
[103] Fix | Delete
# define GDBM_VERSION_MINOR 18
[104] Fix | Delete
# define GDBM_VERSION_PATCH 0
[105] Fix | Delete
[106] Fix | Delete
extern int const gdbm_version_number[3];
[107] Fix | Delete
[108] Fix | Delete
/* GDBM external functions. */
[109] Fix | Delete
[110] Fix | Delete
extern GDBM_FILE gdbm_fd_open (int fd, const char *file_name, int block_size,
[111] Fix | Delete
int flags, void (*fatal_func) (const char *));
[112] Fix | Delete
extern GDBM_FILE gdbm_open (const char *, int, int, int,
[113] Fix | Delete
void (*)(const char *));
[114] Fix | Delete
extern int gdbm_close (GDBM_FILE);
[115] Fix | Delete
extern int gdbm_store (GDBM_FILE, datum, datum, int);
[116] Fix | Delete
extern datum gdbm_fetch (GDBM_FILE, datum);
[117] Fix | Delete
extern int gdbm_delete (GDBM_FILE, datum);
[118] Fix | Delete
extern datum gdbm_firstkey (GDBM_FILE);
[119] Fix | Delete
extern datum gdbm_nextkey (GDBM_FILE, datum);
[120] Fix | Delete
extern int gdbm_reorganize (GDBM_FILE);
[121] Fix | Delete
[122] Fix | Delete
extern int gdbm_sync (GDBM_FILE);
[123] Fix | Delete
extern int gdbm_exists (GDBM_FILE, datum);
[124] Fix | Delete
extern int gdbm_setopt (GDBM_FILE, int, void *, int);
[125] Fix | Delete
extern int gdbm_fdesc (GDBM_FILE);
[126] Fix | Delete
[127] Fix | Delete
extern int gdbm_export (GDBM_FILE, const char *, int, int);
[128] Fix | Delete
extern int gdbm_export_to_file (GDBM_FILE dbf, FILE *fp);
[129] Fix | Delete
[130] Fix | Delete
extern int gdbm_import (GDBM_FILE, const char *, int);
[131] Fix | Delete
extern int gdbm_import_from_file (GDBM_FILE dbf, FILE *fp, int flag);
[132] Fix | Delete
[133] Fix | Delete
extern int gdbm_count (GDBM_FILE dbf, gdbm_count_t *pcount);
[134] Fix | Delete
[135] Fix | Delete
typedef struct gdbm_recovery_s
[136] Fix | Delete
{
[137] Fix | Delete
/* Input members.
[138] Fix | Delete
These are initialized before call to gdbm_recover. The flags argument
[139] Fix | Delete
specifies which of them are initialized. */
[140] Fix | Delete
void (*errfun) (void *data, char const *fmt, ...);
[141] Fix | Delete
void *data;
[142] Fix | Delete
[143] Fix | Delete
size_t max_failed_keys;
[144] Fix | Delete
size_t max_failed_buckets;
[145] Fix | Delete
size_t max_failures;
[146] Fix | Delete
[147] Fix | Delete
/* Output members.
[148] Fix | Delete
The gdbm_recover function fills these before returning. */
[149] Fix | Delete
size_t recovered_keys;
[150] Fix | Delete
size_t recovered_buckets;
[151] Fix | Delete
size_t failed_keys;
[152] Fix | Delete
size_t failed_buckets;
[153] Fix | Delete
size_t duplicate_keys;
[154] Fix | Delete
char *backup_name;
[155] Fix | Delete
} gdbm_recovery;
[156] Fix | Delete
[157] Fix | Delete
#define GDBM_RCVR_DEFAULT 0x00 /* Default settings */
[158] Fix | Delete
#define GDBM_RCVR_ERRFUN 0x01 /* errfun is initialized */
[159] Fix | Delete
#define GDBM_RCVR_MAX_FAILED_KEYS 0x02 /* max_failed_keys is initialized */
[160] Fix | Delete
#define GDBM_RCVR_MAX_FAILED_BUCKETS 0x04 /* max_failed_buckets is initialized */
[161] Fix | Delete
#define GDBM_RCVR_MAX_FAILURES 0x08 /* max_failures is initialized */
[162] Fix | Delete
#define GDBM_RCVR_BACKUP 0x10 /* Keep backup copy of the
[163] Fix | Delete
original database on success */
[164] Fix | Delete
#define GDBM_RCVR_FORCE 0x20 /* Force recovery by skipping the
[165] Fix | Delete
check pass */
[166] Fix | Delete
[167] Fix | Delete
extern int gdbm_recover (GDBM_FILE dbf, gdbm_recovery *rcvr, int flags);
[168] Fix | Delete
[169] Fix | Delete
[170] Fix | Delete
#define GDBM_DUMP_FMT_BINARY 0
[171] Fix | Delete
#define GDBM_DUMP_FMT_ASCII 1
[172] Fix | Delete
[173] Fix | Delete
#define GDBM_META_MASK_MODE 0x01
[174] Fix | Delete
#define GDBM_META_MASK_OWNER 0x02
[175] Fix | Delete
[176] Fix | Delete
extern int gdbm_dump (GDBM_FILE, const char *, int fmt, int open_flags,
[177] Fix | Delete
int mode);
[178] Fix | Delete
extern int gdbm_dump_to_file (GDBM_FILE, FILE *, int fmt);
[179] Fix | Delete
[180] Fix | Delete
extern int gdbm_load (GDBM_FILE *, const char *, int replace,
[181] Fix | Delete
int meta_flags,
[182] Fix | Delete
unsigned long *line);
[183] Fix | Delete
extern int gdbm_load_from_file (GDBM_FILE *, FILE *, int replace,
[184] Fix | Delete
int meta_flags,
[185] Fix | Delete
unsigned long *line);
[186] Fix | Delete
[187] Fix | Delete
extern int gdbm_copy_meta (GDBM_FILE dst, GDBM_FILE src);
[188] Fix | Delete
[189] Fix | Delete
# define GDBM_NO_ERROR 0
[190] Fix | Delete
# define GDBM_MALLOC_ERROR 1
[191] Fix | Delete
# define GDBM_BLOCK_SIZE_ERROR 2
[192] Fix | Delete
# define GDBM_FILE_OPEN_ERROR 3
[193] Fix | Delete
# define GDBM_FILE_WRITE_ERROR 4
[194] Fix | Delete
# define GDBM_FILE_SEEK_ERROR 5
[195] Fix | Delete
# define GDBM_FILE_READ_ERROR 6
[196] Fix | Delete
# define GDBM_BAD_MAGIC_NUMBER 7
[197] Fix | Delete
# define GDBM_EMPTY_DATABASE 8
[198] Fix | Delete
# define GDBM_CANT_BE_READER 9
[199] Fix | Delete
# define GDBM_CANT_BE_WRITER 10
[200] Fix | Delete
# define GDBM_READER_CANT_DELETE 11
[201] Fix | Delete
# define GDBM_READER_CANT_STORE 12
[202] Fix | Delete
# define GDBM_READER_CANT_REORGANIZE 13
[203] Fix | Delete
# define GDBM_UNKNOWN_ERROR 14
[204] Fix | Delete
# define GDBM_ITEM_NOT_FOUND 15
[205] Fix | Delete
# define GDBM_REORGANIZE_FAILED 16
[206] Fix | Delete
# define GDBM_CANNOT_REPLACE 17
[207] Fix | Delete
# define GDBM_ILLEGAL_DATA 18
[208] Fix | Delete
# define GDBM_OPT_ALREADY_SET 19
[209] Fix | Delete
# define GDBM_OPT_ILLEGAL 20
[210] Fix | Delete
# define GDBM_BYTE_SWAPPED 21
[211] Fix | Delete
# define GDBM_BAD_FILE_OFFSET 22
[212] Fix | Delete
# define GDBM_BAD_OPEN_FLAGS 23
[213] Fix | Delete
# define GDBM_FILE_STAT_ERROR 24
[214] Fix | Delete
# define GDBM_FILE_EOF 25
[215] Fix | Delete
# define GDBM_NO_DBNAME 26
[216] Fix | Delete
# define GDBM_ERR_FILE_OWNER 27
[217] Fix | Delete
# define GDBM_ERR_FILE_MODE 28
[218] Fix | Delete
# define GDBM_NEED_RECOVERY 29
[219] Fix | Delete
# define GDBM_BACKUP_FAILED 30
[220] Fix | Delete
# define GDBM_DIR_OVERFLOW 31
[221] Fix | Delete
# define GDBM_BAD_BUCKET 32
[222] Fix | Delete
# define GDBM_BAD_HEADER 33
[223] Fix | Delete
# define GDBM_BAD_AVAIL 34
[224] Fix | Delete
# define GDBM_BAD_HASH_TABLE 35
[225] Fix | Delete
# define GDBM_BAD_DIR_ENTRY 36
[226] Fix | Delete
# define GDBM_FILE_CLOSE_ERROR 37
[227] Fix | Delete
# define GDBM_FILE_SYNC_ERROR 38
[228] Fix | Delete
# define GDBM_FILE_TRUNCATE_ERROR 39
[229] Fix | Delete
[230] Fix | Delete
# define _GDBM_MIN_ERRNO 0
[231] Fix | Delete
# define _GDBM_MAX_ERRNO GDBM_FILE_TRUNCATE_ERROR
[232] Fix | Delete
[233] Fix | Delete
/* This one was never used and will be removed in the future */
[234] Fix | Delete
# define GDBM_UNKNOWN_UPDATE GDBM_UNKNOWN_ERROR
[235] Fix | Delete
[236] Fix | Delete
typedef int gdbm_error;
[237] Fix | Delete
extern int *gdbm_errno_location (void);
[238] Fix | Delete
#define gdbm_errno (*gdbm_errno_location ())
[239] Fix | Delete
extern const char * const gdbm_errlist[];
[240] Fix | Delete
extern int const gdbm_syserr[];
[241] Fix | Delete
[242] Fix | Delete
extern gdbm_error gdbm_last_errno (GDBM_FILE dbf);
[243] Fix | Delete
extern int gdbm_last_syserr (GDBM_FILE dbf);
[244] Fix | Delete
extern void gdbm_set_errno (GDBM_FILE dbf, gdbm_error ec, int fatal);
[245] Fix | Delete
extern void gdbm_clear_error (GDBM_FILE dbf);
[246] Fix | Delete
extern int gdbm_needs_recovery (GDBM_FILE dbf);
[247] Fix | Delete
extern int gdbm_check_syserr (gdbm_error n);
[248] Fix | Delete
[249] Fix | Delete
/* extra prototypes */
[250] Fix | Delete
[251] Fix | Delete
extern const char *gdbm_strerror (gdbm_error);
[252] Fix | Delete
extern const char *gdbm_db_strerror (GDBM_FILE dbf);
[253] Fix | Delete
[254] Fix | Delete
extern int gdbm_version_cmp (int const a[], int const b[]);
[255] Fix | Delete
[256] Fix | Delete
#if 0
[257] Fix | Delete
# define GDBM_DEBUG_ENABLE 1
[258] Fix | Delete
[259] Fix | Delete
typedef void (*gdbm_debug_printer_t) (char const *, ...);
[260] Fix | Delete
extern gdbm_debug_printer_t gdbm_debug_printer;
[261] Fix | Delete
extern int gdbm_debug_flags;
[262] Fix | Delete
[263] Fix | Delete
# define GDBM_DEBUG_ERR 0x00000001
[264] Fix | Delete
# define GDBM_DEBUG_OPEN 0x00000002
[265] Fix | Delete
# define GDBM_DEBUG_READ 0x00000004
[266] Fix | Delete
# define GDBM_DEBUG_STORE 0x00000008
[267] Fix | Delete
# define GDBM_DEBUG_LOOKUP 0x00000010
[268] Fix | Delete
[269] Fix | Delete
# define GDBM_DEBUG_ALL 0xffffffff
[270] Fix | Delete
[271] Fix | Delete
extern int gdbm_debug_token (char const *tok);
[272] Fix | Delete
extern void gdbm_debug_parse_state (int (*f) (void *, int, char const *),
[273] Fix | Delete
void *d);
[274] Fix | Delete
[275] Fix | Delete
extern void gdbm_debug_datum (datum dat, char const *pfx);
[276] Fix | Delete
[277] Fix | Delete
#endif
[278] Fix | Delete
[279] Fix | Delete
# if defined(__cplusplus) || defined(c_plusplus)
[280] Fix | Delete
}
[281] Fix | Delete
# endif
[282] Fix | Delete
[283] Fix | Delete
#endif
[284] Fix | Delete
[285] Fix | Delete
It is recommended that you Edit text format, this type of Fix handles quite a lot in one request
Function