/*++ /* NAME /* mkmap_open 3 /* SUMMARY /* create or rewrite database, generic interface /* SYNOPSIS /* #include <mkmap.h> /* /* typedef struct MKMAP {
/* struct DICT *(*open) (const char *, int, int); /* dict_xx_open() */ /* struct DICT *dict; /* dict_xx_open() result */ /* void (*after_open) (struct MKMAP *); /* may be null */ /* void (*after_close) (struct MKMAP *); /* may be null */ /* int multi_writer; /* multi-writer safe */ /* } MKMAP; /* /* MKMAP *mkmap_open(type, path, open_flags, dict_flags) /* char *type; /* char *path; /* int open_flags; /* int dict_flags; /* /* void mkmap_append(mkmap, key, value, lineno) /* MKMAP *mkmap; /* char *key; /* char *value; /* int lineno; /* /* void mkmap_close(mkmap) /* MKMAP *mkmap; /* DESCRIPTION /* This module adds support for creating Postfix databases from /* scratch. See dict(3) for a description of the \fBopen_flags\fR /* and \fBdict_flags\fR arguments. /* /* To create a database from scratch (open_flags contains O_TRUNC), /* the plugin code for the database type must provide a /* mkmap_<type>_open() function that maintains a global lock for /* exclusive access until the database is closed. /* /* To access a database type that has no global locking support /* (no mkmap_<type>_open() function), mkmap_open() opens the database /* requesting its dict(3) built-in per-update locking. /* /* mkmap_open() suspends signal delivery before opening a database /* and resumes signal delivery when it is safe: before the first /* update if the database implements transaction safety, otherwise /* after the database is closed. /* /* All mkmap_open() errors are fatal. /* /* mkmap_append() appends the named (key, value) pair to the /* database. Update errors are fatal; duplicate keys are ignored /* (but a warning is issued). The \fBlineno\fR argument is used /* for diagnostic messages. /* /* mkmap_close() closes the database, releases any locks, and /* resumes signal delivery. All errors are fatal. /* SEE ALSO /* sigdelay(3) suspend/resume signal delivery /* LICENSE /* .ad /* .fi /* The Secure Mailer license must be distributed with this software. /* AUTHOR(S) /* Wietse Venema /* IBM T.J. Watson Research /* P.O. Box 704 /* Yorktown Heights, NY 10598, USA /* /* Wietse Venema /* Google, Inc. /* 111 8th Avenue /* New York, NY 10011, USA /* /* Wietse Venema /* porcupine.org
/*--*/
/* *Createoropenadatabasethatsupportsgloballocking.Weexplicitly *clobbertheper-tablelock_fdtotriggerafatalerrorwhenatable *wantstoreleaseitslockafteranindividualtransaction.Weclobber *stat_fdaswell,becausethat,too,isusedonlyfornon-bulk *applications.
*/ if (dp->mkmap_fn != 0) { /* Global lock */
mkmap->dict = mkmap->open(path, open_flags, dict_flags);
mkmap->dict->lock_fd = -1; /* XXX just in case */
mkmap->dict->stat_fd = -1; /* XXX just in case */
}
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.