summaryrefslogtreecommitdiffstats
path: root/lib/libc
diff options
context:
space:
mode:
authortedu <tedu@openbsd.org>2016-05-07 21:58:06 +0000
committertedu <tedu@openbsd.org>2016-05-07 21:58:06 +0000
commit1a1d4aeafad0882d446641c29429496600a9e8e1 (patch)
tree509b0fdd6a64c07e717e443c92eee4d7a51123b5 /lib/libc
parentsync (diff)
downloadwireguard-openbsd-1a1d4aeafad0882d446641c29429496600a9e8e1.tar.xz
wireguard-openbsd-1a1d4aeafad0882d446641c29429496600a9e8e1.zip
remove ancient dbm functions (ndbm remains). nothing uses them in forever.
Diffstat (limited to 'lib/libc')
-rw-r--r--lib/libc/Symbols.list7
-rw-r--r--lib/libc/db/hash/ndbm.c124
-rw-r--r--lib/libc/db/man/dbm.3162
-rw-r--r--lib/libc/hidden/dbm.h31
4 files changed, 1 insertions, 323 deletions
diff --git a/lib/libc/Symbols.list b/lib/libc/Symbols.list
index 201a98ecdcc..d29a5e22a30 100644
--- a/lib/libc/Symbols.list
+++ b/lib/libc/Symbols.list
@@ -454,14 +454,7 @@ dbm_nextkey
dbm_open
dbm_rdonly
dbm_store
-dbmclose
-dbminit
dbopen
-delete
-fetch
-firstkey
-nextkey
-store
/* dlfcn */
__progname
diff --git a/lib/libc/db/hash/ndbm.c b/lib/libc/db/hash/ndbm.c
index ccb1b4fdbc4..01c521f14cc 100644
--- a/lib/libc/db/hash/ndbm.c
+++ b/lib/libc/db/hash/ndbm.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ndbm.c,v 1.25 2015/11/01 03:45:28 guenther Exp $ */
+/* $OpenBSD: ndbm.c,v 1.26 2016/05/07 21:58:06 tedu Exp $ */
/*-
* Copyright (c) 1990, 1993
@@ -39,7 +39,6 @@
#include <string.h>
#include <ndbm.h>
-#include <dbm.h>
#include "hash.h"
/*
@@ -54,127 +53,6 @@ static DBM *_dbm_open(const char *, const char *, int, mode_t);
/*
* Returns:
- * 0 on success
- * <0 on failure
- */
-int
-dbminit(file)
- const char *file;
-{
-
- if (__cur_db != NULL)
- (void)dbm_close(__cur_db);
- if ((__cur_db = _dbm_open(file, ".pag", O_RDWR, 0)) != NULL)
- return (0);
- if ((__cur_db = _dbm_open(file, ".pag", O_RDONLY, 0)) != NULL)
- return (0);
- return (-1);
-}
-
-/*
- * Returns:
- * 0 on success
- * <0 on failure
- */
-int
-dbmclose()
-{
- int rval;
-
- if (__cur_db == NULL)
- return (-1);
- rval = (__cur_db->close)(__cur_db);
- __cur_db = NULL;
- return (rval);
-}
-
-/*
- * Returns:
- * DATUM on success
- * NULL on failure
- */
-datum
-fetch(key)
- datum key;
-{
- datum item;
-
- if (__cur_db == NULL) {
- item.dptr = NULL;
- item.dsize = 0;
- return (item);
- }
- return (dbm_fetch(__cur_db, key));
-}
-
-/*
- * Returns:
- * DATUM on success
- * NULL on failure
- */
-datum
-firstkey()
-{
- datum item;
-
- if (__cur_db == NULL) {
- item.dptr = NULL;
- item.dsize = 0;
- return (item);
- }
- return (dbm_firstkey(__cur_db));
-}
-
-/*
- * Returns:
- * DATUM on success
- * NULL on failure
- */
-datum
-nextkey(datum key)
-{
- datum item;
-
- if (__cur_db == NULL) {
- item.dptr = NULL;
- item.dsize = 0;
- return (item);
- }
- return (dbm_nextkey(__cur_db));
-}
-
-/*
- * Returns:
- * 0 on success
- * <0 on failure
- */
-int
-delete(key)
- datum key;
-{
-
- if (__cur_db == NULL || dbm_rdonly(__cur_db))
- return (-1);
- return (dbm_delete(__cur_db, key));
-}
-
-/*
- * Returns:
- * 0 on success
- * <0 on failure
- */
-int
-store(key, dat)
- datum key, dat;
-{
-
- if (__cur_db == NULL || dbm_rdonly(__cur_db))
- return (-1);
- return (dbm_store(__cur_db, key, dat, DBM_REPLACE));
-}
-
-/*
- * Returns:
* *DBM on success
* NULL on failure
*/
diff --git a/lib/libc/db/man/dbm.3 b/lib/libc/db/man/dbm.3
deleted file mode 100644
index e7fb9032bad..00000000000
--- a/lib/libc/db/man/dbm.3
+++ /dev/null
@@ -1,162 +0,0 @@
-.\" $OpenBSD: dbm.3,v 1.15 2015/11/30 17:03:05 jmc Exp $
-.\"
-.\" Copyright (c) 1999 Todd C. Miller <Todd.Miller@courtesan.com>
-.\"
-.\" Permission to use, copy, modify, and distribute this software for any
-.\" purpose with or without fee is hereby granted, provided that the above
-.\" copyright notice and this permission notice appear in all copies.
-.\"
-.\" THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
-.\" WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
-.\" MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
-.\" ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
-.\" WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
-.\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
-.\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
-.\"
-.Dd $Mdocdate: November 30 2015 $
-.Dt DBMINIT 3
-.Os
-.Sh NAME
-.Nm dbminit ,
-.Nm dbmclose ,
-.Nm fetch ,
-.Nm store ,
-.Nm delete ,
-.Nm firstkey ,
-.Nm nextkey
-.Nd database subroutines
-.Sh SYNOPSIS
-.In dbm.h
-.Ft int
-.Fn dbminit "const char *file"
-.Ft int
-.Fn dbmclose "void"
-.Ft datum
-.Fn fetch "datum key"
-.Ft int
-.Fn store "datum key" "datum content"
-.Ft int
-.Fn delete "datum key"
-.Ft datum
-.Fn firstkey "void"
-.Ft datum
-.Fn nextkey "datum key"
-.Sh DESCRIPTION
-These functions provide a dbm-compatible interface to the
-database access methods described in
-.Xr dbopen 3 .
-Each unique record in the database is a key/content pair,
-the components of which may be any arbitrary binary data.
-The key and the content data are described by the
-.Ft datum
-data structure:
-.Bd -literal -offset indent
-typedef struct {
- void *dptr;
- size_t dsize;
-} datum;
-.Ed
-.Pp
-The
-.Fn dbminit
-function is used to open a database.
-Before the call to
-.Fn dbminit ,
-the files
-.Pa file.pag
-and
-.Pa file.dir
-must exist.
-The user is responsible for creating the zero-length
-.Pa \&.pag
-and
-.Pa \&.dir
-files.
-.Pp
-Once the database is open,
-.Fn fetch
-is used to retrieve the data content associated with the specified
-.Fa key .
-Similarly,
-.Fn store
-is used to store the
-.Fa content
-data with the specified
-.Fa key .
-.Pp
-The
-.Fn delete
-function removes the specified
-.Fa key
-and its associated content from the database.
-.Pp
-The functions
-.Fn firstkey
-and
-.Fn nextkey
-are used to iterate over all of the records in the database.
-Each record will be reached exactly once, but in no particular order.
-The
-.Fn firstkey
-function returns the first record of the database, and thereafter
-.Fn nextkey
-returns the following records.
-The following code traverses the entire database:
-.Bd -literal -offset indent
-for (key = firstkey(); key.dptr != NULL; key = nextkey(key))
-.Ed
-.Pp
-The behaviour of
-.Fn nextkey
-is undefined if the database is modified after a call to
-.Fn firstkey .
-.Pp
-The database is closed with the
-.Fn dbmclose
-function (it must be closed before a new one can be opened).
-.Ss Implementation notes
-The underlying database is a
-.Xr hash 3
-database with a
-bucket size of 4096,
-a filling factor of 40,
-default hashing function and cache size,
-and uses the host's native byte order.
-.Sh RETURN VALUES
-Upon successful completion, all functions that return
-.Ft int
-return a value of 0, otherwise a negative value is returned.
-.Pp
-Functions that return a
-.Ft datum
-indicate errors by setting the
-.Va dptr
-field to
-.Dv NULL .
-.Sh SEE ALSO
-.Xr dbopen 3 ,
-.Xr hash 3 ,
-.Xr ndbm 3
-.Sh HISTORY
-The functions
-.Fn dbminit ,
-.Fn fetch ,
-.Fn store ,
-.Fn delete ,
-.Fn firstkey ,
-and
-.Fn nextkey
-first appeared in
-.At v7 .
-.Sh BUGS
-Because the
-.Nm dbm
-routines are implemented on top of those described in
-.Xr dbopen 3 ,
-only a single file,
-.Pa file.pag ,
-is used to actually store the database.
-The references to
-.Pa file.dir
-are purely for backwards compatibility with historic implementations.
diff --git a/lib/libc/hidden/dbm.h b/lib/libc/hidden/dbm.h
deleted file mode 100644
index 44a431c03ff..00000000000
--- a/lib/libc/hidden/dbm.h
+++ /dev/null
@@ -1,31 +0,0 @@
-/* $OpenBSD: dbm.h,v 1.1 2015/09/12 15:20:52 guenther Exp $ */
-/*
- * Copyright (c) 2015 Philip Guenther <guenther@openbsd.org>
- *
- * Permission to use, copy, modify, and distribute this software for any
- * purpose with or without fee is hereby granted, provided that the above
- * copyright notice and this permission notice appear in all copies.
- *
- * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
- * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
- * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
- * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
- * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
- * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
- * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
- */
-
-#ifndef _LIBC_DBM_H_
-#define _LIBC_DBM_H_
-
-#include_next <dbm.h>
-
-PROTO_DEPRECATED(dbmclose);
-PROTO_DEPRECATED(dbminit);
-PROTO_DEPRECATED(delete);
-PROTO_DEPRECATED(fetch);
-PROTO_DEPRECATED(firstkey);
-PROTO_DEPRECATED(nextkey);
-PROTO_DEPRECATED(store);
-
-#endif /* _LIBC_DBM_H_ */