Database macros are special forms of defined macros.
When used with certain special operators, they can cause rules to
access information in external files.
Database macros offer these advantages:
Information may be easily changed without having to kill and
, because database information
is external to the configuration file.
program starts up faster, because
only the location of the information is stored at startup, rather
than the information itself.
Rules are more versatile because
database information can be used in the RHS side of rules.
Class macros are still of use in the LHS.
To fully appreciate
databases, consider the only
For example, mail that is sent by using UUCP is a typical
application that requires lists of information:
Here, the external file
contains a list
of UUCP hosts connected to the local machine.
If the list rarely changes, the
command is appropriate.
On the other hand, if the list is volatile and changes often,
command has drawbacks. The file
is read only when the configuration file is processed. Any change to
that file is ignored by a running
(such as the daemon).
To make the change effective, the daemon needs to be killed and
In such volatile situations, storing UUCP information in a database
is preferred. A change to a database is immediately available
to the running daemon, eliminating the need to kill and restart.
is designed to rewrite addresses on the basis of
information looked up in external databases or in its internal symbol table.
It can use a wide variety of database forms, ranging from
(3) files (see
Section 33.8.3, dbm
) to Hesiod network maps
Section 33.8.6, hesiod
configuration command (see
Section 33.3, "The K Configuration Command"
is used to declare the name,
location, and other parameters of databases or to modify use of
its symbol table.
database operators (see
Section 33.4, "Use Maps with $( and $) in Rules"
are used in the RHS of rules to access and utilize that information.
Vendors that provide V8
in precompiled form may or
may not provide access to all the types of databases that V8
supports. If your online documentation lacks this
information, you can run
what it supports:
strings /usr/lib/sendmail | grep map_open
ndbm_map_open(%s, %s, %d)
hash_map_open(%s, %s, %d)
text_map_open(%s, %s, %d)
text_map_open: file name required
text_map_open(%s): file name must be fully qualified
text_map_open(%s): can not stat %s
text_map_open(%s): %s is not a file
text_map_open(%s): -k should specify a number, not %s
text_map_open(%s): -v should specify a number, not %s
text_map_open(%s): delimiter = %c
impl_map_open(%s, %s, %d)
switch_map_open(%s, %s, %d)
In this implementation of
, NDBM (the
and Berkeley DB (the
) type database files are
available. Sun style NIS maps (the
) are also
The others (
) are always automatically included.
maps are not supported by
If you download and compile
yourself, you may include
any supported databases. Support is declared on
the DBMDEF= line in the appropriate
for your system.
Possible definitions for DBMDEF= are shown in
file might include this line:
DBMDEF= -DNDBM -DNEWDB -DNIS
which includes support for
file might include the following:
DBMDEF= -DNDBM -DNIS -DNISPLUS
(3) support but includes
If you omit all database support (by undefining DBMDEF, for example,
or not supplying support indications after the equal sign),
be unable to maintain its aliases in database format. Also, any
attempt to rebuild the aliases database (with
) will fail with the following error message:
Cannot rebuild aliases: no database format defined
Cannot create database for alias file /etc/aliases: No such device
Note that if you add new map types, you may have to also add libraries
to the LIBS= line in your