diff options
Diffstat (limited to '')
-rw-r--r-- | debian/manpages/tdb.3 | 32 | ||||
-rw-r--r-- | debian/manpages/tdb_chainlock.3 | 31 | ||||
-rw-r--r-- | debian/manpages/tdb_close.3 | 19 | ||||
-rw-r--r-- | debian/manpages/tdb_delete.3 | 35 | ||||
-rw-r--r-- | debian/manpages/tdb_error.3 | 25 | ||||
-rw-r--r-- | debian/manpages/tdb_exists.3 | 37 | ||||
-rw-r--r-- | debian/manpages/tdb_fetch.3 | 45 | ||||
-rw-r--r-- | debian/manpages/tdb_firstkey.3 | 82 | ||||
-rw-r--r-- | debian/manpages/tdb_open.3 | 59 | ||||
-rw-r--r-- | debian/manpages/tdb_store.3 | 55 | ||||
-rw-r--r-- | debian/manpages/tdb_traverse.3 | 52 |
11 files changed, 472 insertions, 0 deletions
diff --git a/debian/manpages/tdb.3 b/debian/manpages/tdb.3 new file mode 100644 index 0000000..9b4dc04 --- /dev/null +++ b/debian/manpages/tdb.3 @@ -0,0 +1,32 @@ +.TH TDB 3 "Aug 16, 2000" "Samba" "Linux Programmer's Manual" +.SH NAME +tdb - trivial database +.SH SYNOPSIS +A database similar to gdbm which allows multiple simultaneous writers. +.SH DESCRIPTION +This is a simple database API. It was inspired by the realisation that +in Samba we have several ad-hoc bits of code that essentially +implement small databases for sharing structures between parts of +Samba. As I was about to add another I realised that a generic +database module was called for to replace all the ad-hoc bits. +.sp +I based the interface on gdbm. I couldn't use gdbm as we need to be +able to have multiple writers to the databases at one time. +.SH AUTHORS +Software: Andrew Tridgell <tridge@linuxcare.com> and +Luke Kenneth Casson Leighton +Man page: Ben Woodard <ben@valinux.com> +.SH "SEE ALSO" +.BR gdbm (3), +.BR tdb_open (3), +.BR tdb_close (3), +.BR tdb_delete (3), +.BR tdb_error (3), +.BR tdb_exists (3), +.BR tdb_fetch (3), +.BR tdb_firstkey (3), +.BR tdb_store (3), +.BR tdb_traverse (3), +.BR tdb_lockall (3), +.BR tdb_lockkeys (3), +.BR tdb_chainlock (3) diff --git a/debian/manpages/tdb_chainlock.3 b/debian/manpages/tdb_chainlock.3 new file mode 100644 index 0000000..ffc56ff --- /dev/null +++ b/debian/manpages/tdb_chainlock.3 @@ -0,0 +1,31 @@ +.TH TDB_CHAINLOCK 3 "Oct 13, 2000" "Samba" "Linux Programmer's Manual" +.SH NAME +tdb_chainlock \- lock a group of keys +tdb_chainunlock \- unlock a previously locked group of keys +.SH SYNOPSIS +.nf +.B #include <tdb.h> +.sp +.BI "int tdb_chainlock(TDB_CONTEXT *" tdb ", TDB_DATA " key ");" +.BI "void tdb_chainunlock(TDB_CONTEXT *" tdb ", TDB_DATA " key ");" +.sp +.SH DESCRIPTION +.I tdb_chainlock +is a low\-level function used to lock a particular key (and a number of +other keys) without any checking: any other process attempting to +perform tdb operations on those keys will block until +.I tdb_chainunlock +is called. +.SH NOTES +It is the user's responsibility to ensure that they do not deadlock +the database using these functions: something which is impossible +using the other access functions. +.SH "RETURN VALUE" +A return value of 0 indicates success and \-1 indicates failure. +.SH AUTHORS +Software: Andrew Tridgell <tridge@linuxcare.com> +Man page: Rusty. +.SH "SEE ALSO" +.BR gdbm (3), +.BR tdb (3), +.BR tdb_lockall (3). diff --git a/debian/manpages/tdb_close.3 b/debian/manpages/tdb_close.3 new file mode 100644 index 0000000..a666657 --- /dev/null +++ b/debian/manpages/tdb_close.3 @@ -0,0 +1,19 @@ +.TH TDB_CLOSE 3 "Aug 16, 2000" "Samba" "Linux Programmer's Manual" +.SH NAME +tdb_close \- close a tdb database +.SH SYNOPSIS +.nf +.B #include <tdb.h> +.sp +.BI "int tdb_close(TDB_CONTEXT *" tdb ");" +.sp +.SH DESCRIPTION +Closes a TDB database and frees memory any memory that was used. +.SH "RETURN VALUE" +Returns zero on success and \-1 on failure. +.SH AUTHORS +Software: Andrew Tridgell and Luke Kenneth Casson Leighton +Man page: Ben Woodard <ben@valinux.com> +.SH "SEE ALSO" +.BR gdbm (3), +.BR tdb(3) diff --git a/debian/manpages/tdb_delete.3 b/debian/manpages/tdb_delete.3 new file mode 100644 index 0000000..dd3d0ad --- /dev/null +++ b/debian/manpages/tdb_delete.3 @@ -0,0 +1,35 @@ +.TH TDB_DELETE 3 "Aug 16, 2000" "Samba" "Linux Programmer's Manual" +.SH NAME +tdb_delete \- delete a record from a tdb database +.SH SYNOPSIS +.nf +.B #include <tdb.h> +.sp +.BI "int tdb_delete(TDB_CONTEXT *" tdb ", TDB_DATA " key ");" +.sp +.SH DESCRIPTION +Delete the record from the +.I tdb +database whose key matches +.I key +, a lump of data that is used as the index into the database. The +TDB_DATA structure is defined as: +.PP +.RS +.nf +typedef struct { + char *dptr; + size_t dsize; +} TDB_DATA; +.fi +.RE +.PP +.SH "RETURN VALUE" +A return value of 0 indicates success and \-1 indicates failure. +.SH AUTHORS +Software: Andrew Tridgell <tridge@linuxcare.com> and +Luke Kenneth Casson Leighton +Man page: Ben Woodard <ben@valinux.com> +.SH "SEE ALSO" +.BR gdbm (3), +.BR tdb(3) diff --git a/debian/manpages/tdb_error.3 b/debian/manpages/tdb_error.3 new file mode 100644 index 0000000..f7f9d0a --- /dev/null +++ b/debian/manpages/tdb_error.3 @@ -0,0 +1,25 @@ +.TH TDB_ERROR 3 "Aug 16, 2000" "Samba" "Linux Programmer's Manual" +.SH NAME +tdb_error - return tdb database error state information. +tdb_errorstr - return a printable string representing the error state of a tdb\ + database +.SH SYNOPSIS +.nf +.B #include <tdb.h> +.sp +.BI "enum TDB_ERROR tdb_error(TDB_CONTEXT *" tdb ");" +.BI "char *tdb_errorstr(TDB_CONTEXT *" tdb ");" +.sp +.SH DESCRIPTION +.I tdb_error returns the current error state of the +.I tdb +database. +.I tdb_errorstr +returns a printable string that describes the error state of the +database. +.SH AUTHORS +Software: Andrew Tridgell <tridge@linuxcare.com> and Luke Kenneth +Casson Leighton Man page: Ben Woodard <ben@valinux.com> +.SH "SEE ALSO" +.BR gdbm (3), +.BR tdb(3) diff --git a/debian/manpages/tdb_exists.3 b/debian/manpages/tdb_exists.3 new file mode 100644 index 0000000..c1a1c13 --- /dev/null +++ b/debian/manpages/tdb_exists.3 @@ -0,0 +1,37 @@ +.TH TDB_EXISTS 3 "Aug 17, 2000" "Samba" "Linux Programmer's Manual" +.SH NAME +tdb_exists - check for the existence of a record in a tdb database +.SH SYNOPSIS +.nf +.B #include <tdb.h> +.sp +.BI "int tdb_exists(TDB_CONTEXT *" tdb ", TDB_DATA " key ");" +.sp +.SH DESCRIPTION +Test to see if a key exists. +.I tdb +is a pointer returned by +.B tdb_open +and +.I key +is a lump of data that is used as the index into the database. The TDB_DATA +structure is defined as: +.PP +.RS +.nf +typedef struct { + char *dptr; + size_t dsize; +} TDB_DATA; +.fi +.RE +.PP +.SH "RETURN VALUE" +If the key is found, 1 is returned; otherwise 0 is returned. +.SH AUTHORS +Software: Andrew Tridgell <tridge@linuxcare.com> and +Luke Kenneth Casson Leighton +Man page: Ben Woodard <ben@valinux.com> +.SH "SEE ALSO" +.BR gdbm (3), +.BR tdb(3) diff --git a/debian/manpages/tdb_fetch.3 b/debian/manpages/tdb_fetch.3 new file mode 100644 index 0000000..9f3df51 --- /dev/null +++ b/debian/manpages/tdb_fetch.3 @@ -0,0 +1,45 @@ +.TH TDB_FETCH 3 "Aug 16, 2000" "Samba" "Linux Programmer's Manual" +.SH NAME +tdb_fetch - fetch a record from a tdb database +.SH SYNOPSIS +.nf +.B #include <tdb.h> +.sp +.BI "TDB_DATA tdb_fetch(TDB_CONTEXT *" tdb ", TDB_DATA " key ");" +.sp +.SH DESCRIPTION +Fetch the record from the +.I tdb +database whose key matches +.I key +, a lump of data that is used as the index into the database. +.sp +The TDB_DATA structure used for both the key and the return value is +defined as: +.PP +.RS +.nf +typedef struct { + char *dptr; + size_t dsize; +} TDB_DATA; +.fi +.RE +.PP +.SH "RETURN VALUE" +If the call succeeds, then a TDB_DATA structure is returned with the +.I dptr +structure filled in. If the call fails then +.I dptr +will be set to NULL. +.sp +.B NOTE: +The caller is responsible for freeing the data pointed to by +.I dptr. +.SH AUTHORS +Software: Andrew Tridgell <tridge@linuxcare.com> and +Luke Kenneth Casson Leighton +Man page: Ben Woodard <ben@valinux.com> +.SH "SEE ALSO" +.BR gdbm (3), +.BR tdb(3) diff --git a/debian/manpages/tdb_firstkey.3 b/debian/manpages/tdb_firstkey.3 new file mode 100644 index 0000000..ca902a4 --- /dev/null +++ b/debian/manpages/tdb_firstkey.3 @@ -0,0 +1,82 @@ +.TH TDB_FIRSTKEY 3 "Aug 16, 2000" "Samba" "Linux Programmer's Manual" +.SH NAME +tdb_firstkey - return the key of the first record in a tdb database +tdb_nextkey - return the key of next record in the tdb database +.SH SYNOPSIS +.nf +.B #include <tdb.h> +.sp +.BI "TDB_DATA tdb_firstkey(TDB_CONTEXT *" tdb ");" +.BI "TDB_DATA tdb_nextkey(TDB_CONTEXT *" tdb ", TDB_DATA " prev_key ");" +.sp +.SH DESCRIPTION +.I tdb_firstkey +fetches the key of the first entry in the +.I tdb +database. +.I tdb_nextkey +fetches the key of the entry immediately after +.I prev_key +in the database. +.sp +The TDB_DATA structure returned by both these functions is defined as: +.PP +.RS +.nf +typedef struct { + char *dptr; + size_t dsize; +} TDB_DATA; +.fi +.RE +.PP +.sp +The order in which this traverses the database is its own internal +hash order. Do not expect the keys to be in any recognizably sorted +order. +.sp +These functions are reliable even if other writers are accessing the +database (or you are replacing or deleting elements as you traverse), +except in the case of nested +.I tdb_firstkey +or +.I tdb_nextkey +calls. For example, the following outer traversal may fail to +traverse all the elements, or may even traverse elements twice if +other processes are manipulating the database: +.PP +.RS +.nf + TDB_DATA i, j; + + for (i = tdb_firstkey(tdb); i.dptr; i = tdb_nextkey(tdb, i)) { + for (j = tdb_firstkey(tdb); j.dptr; j = tdb_nextkey(tdb, j)) { + ... + } + } +.fi +.RE +.PP +If such behaviour is desired, use +.I tdb_traverse +instead. +.sp +.SH "RETURN VALUE" +If the call succeeds, then a TDB_DATA structure is returned with the +.I dptr +structure filled in. If the call fails or you have reached the end of +the database then +.I dptr +will be set to NULL. +.sp +.B NOTE: +The caller is responsible for freeing the data pointed to by +.I dptr +. +.SH AUTHORS +Software: Andrew Tridgell <tridge@linuxcare.com> and +Luke Kenneth Casson Leighton +Man page: Ben Woodard <ben@valinux.com> +.SH "SEE ALSO" +.BR gdbm (3), +.BR tdb(3) diff --git a/debian/manpages/tdb_open.3 b/debian/manpages/tdb_open.3 new file mode 100644 index 0000000..595274b --- /dev/null +++ b/debian/manpages/tdb_open.3 @@ -0,0 +1,59 @@ +.TH TDB_OPEN 3 "Aug 16, 2000" "Samba" "Linux Programmer's Manual" +.SH NAME +tdb_open \- Open a tdb database. +.SH SYNOPSIS +.nf +.B #include <tdb.h> +.sp +.BI "TDB_CONTEXT *tdb_open(const char *" pathname ", int " hash_size "," +.BI " int " tdb_flags ", int " open_flags ", mode_t " mode " );" +.sp +.SH DESCRIPTION +Open the database, creating it if necessary. The +.I hash +size is advisory, use zero for a default value. +.I tdb_flags +can be one of +.TP +.B TDB_CLEAR_IF_FIRST +Clear database if we are the only one with it open. +.TP +.B TDB_INTERNAL +Don't use a file, instead store the data in memory. The +.I pathname +, +.I open_flags +, and +.I mode +are ignored in +this case. This is useful if you need a quick associative array or map. +.TP +.B TDB_NOLOCK +Don't do any locking (this is always turned on for read-only file +descriptors) +.TP +.B TDB_NOMMAP +Don't use mmap. +.TP +.B TDB_CONVERT +Create a database in the reverse of native endian: normally when the +database is created (or cleared with TDB_CLEAR_IF_FIRST), it is +created in native endian order. This flag is set (or unset) +automatically for existing databases. +.PP +The +.I open_flags +and +.I mode +are passed straight to the open call on the database file. A flags +value of O_WRONLY is invalid. +.SH "RETURN VALUE" +On success a pointer to an opaque data structure, a TDB_CONTEXT is +returned. On error a NULL is returned. +.SH AUTHORS +Software: Andrew Tridgell <tridge@linuxcare.com> and Luke Kenneth Casson Leighton +Man page: Ben Woodard <ben@valinux.com> +.SH "SEE ALSO" +.BR open (2), +.BR gdbm (3), +.BR tdb(3) diff --git a/debian/manpages/tdb_store.3 b/debian/manpages/tdb_store.3 new file mode 100644 index 0000000..d701963 --- /dev/null +++ b/debian/manpages/tdb_store.3 @@ -0,0 +1,55 @@ +.TH TDB_STORE 3 "Aug 16, 2000" "Samba" "Linux Programmer's Manual" +.SH NAME +tdb_store \- store a record in a tdb database. +.SH SYNOPSIS +.nf +.B #include <tdb.h> +.sp +.BI "int tdb_store(TDB_CONTEXT *" tdb ", TDB_DATA " key ", TDB_DATA " record ", int " flag ");" +.sp +.SH DESCRIPTION +Store a lump of data pointed to by +.I record +in the +.I tdb +database under the index pointed to by +.I key. +The TDB_DATA structure used by both +.I key +and +.I record +is defined as: +.PP +.RS +.nf +typedef struct { + char *dptr; + size_t dsize; +} TDB_DATA; +.fi +.RE +.PP +The +.I flag +determines the way that tdb_store behaves and can be any one of the +following values. +.TP +.B TDB_REPLACE +Insert a record creating a new one or overwriting an existing one. +.TP +.B TDB_INSERT +Insert a new entry but refuse to overwrite an existing entry. +.TP +.B TDB_MODIFY +Replace an existing record with a new one. This will fail if, +a record does not already exist. +.PP +.SH "RETURN VALUE" +A return value of 0 indicates success and \-1 indicates failure. +.SH AUTHORS +Software: Andrew Tridgell <tridge@linuxcare.com> and +Luke Kenneth Casson Leighton +Man page: Ben Woodard <ben@valinux.com> +.SH "SEE ALSO" +.BR gdbm (3), +.BR tdb(3) diff --git a/debian/manpages/tdb_traverse.3 b/debian/manpages/tdb_traverse.3 new file mode 100644 index 0000000..f2c9f22 --- /dev/null +++ b/debian/manpages/tdb_traverse.3 @@ -0,0 +1,52 @@ +.TH TDB_TRAVERSE 3 "Aug 16, 2000" "Samba" "Linux Programmer's Manual" +.SH NAME +tdb_traverse \- visit every element in a tdb database +.SH SYNOPSIS +.nf +.B #include <tdb.h> +.sp +.BI "int tdb_traverse(TDB_CONTEXT *" tdb ", " +.BI " int (*" fn ")(TDB_CONTEXT *,TDB_DATA,TDB_DATA,void *)," +.BI " void *state);" +.sp +.SH DESCRIPTION +.I tdb_traverse is the only sure way to visit all the items within a +given database, +.I tdb +Because this function has intimate knowledge of the internals of the +database, it is able to cope with writers touching the database at the +same time it is trying to traverse it. +.sp +If +.I fn +is supplied it will be called with the +.I state parameter +for each element in the database, as the forth argument. The First argument is +the database +.I tdb +the second is the key and the third is the data. If this function call returns +anything but 0, the traversal will stop. Unlike in tdb_fetch() the programmer +is not required to free either the pointer from either the key or data +parameters that are passed into the function. The +.I fn +function should have the prototype: +.nf +.in 10 +int (*tdb_traverse_func)(TDB_CONTEXT *, TDB_DATA, TDB_DATA, void *); +.fi +.PP +.sp +Calling tdb_traverse with a NULL +.I fn +parameter is the appropriate way to count the number of elements in +the database. +.SH "RETURN VALUE" +The return value is the number of elements traversed or \-1 if there +was an error. +.SH AUTHORS +Software: Andrew Tridgell <tridge@linuxcare.com> and +Luke Kenneth Casson Leighton +Man page: Ben Woodard <ben@valinux.com> +.SH "SEE ALSO" +.BR gdbm (3), +.BR tdb(3) |