Sendmail Installation and Operation Guide
SMM:08-95
The initialization function is called as
xxx_map_init(MAP *map, char *args)
The map is an internal data structure. The args is a pointer to the portion of the configuration
file line following the map class name; flags and filenames can be extracted from this line. The
initialization function must return
true
if it successfully opened the map,
false
otherwise.
The lookup function is called as
xxx_map_lookup(MAP *map, char buf[], char **av, int *statp)
The map defines the map internally. The buf has the input key. This may be (and often is) used
destructively. The av is a list of arguments passed in from the rewrite line. The lookup function
should return a pointer to the new value. If the map lookup fails, *statp should be set to an exit
status code; in particular, it should be set to
EX_TEMPFAIL
if recovery is to be attempted by the
higher level code.
6.3.4. Queueing Function
The routine shouldqueue is called to decide if a message should be queued or processed
immediately. Typically this compares the message priority to the current load average. The
default definition is:
bool
shouldqueue(pri, ctime)
long pri;
time_t ctime;
{
if (CurrentLA < QueueLA)
return false;
return (pri > (QueueFactor / (CurrentLA - QueueLA + 1)));
}
If the current load average (global variable CurrentLA, which is set before this function is
called) is less than the low threshold load average (option x, variable QueueLA), shouldqueue
returns
false
immediately (that is, it should not queue). If the current load average exceeds the
high threshold load average (option X, variable RefuseLA), shouldqueue returns
true
immedi-
ately. Otherwise, it computes the function based on the message priority, the queue factor
(option q, global variable QueueFactor), and the current and threshold load averages.
An implementation wishing to take the actual age of the message into account can also
use the ctime parameter, which is the time that the message was first submitted to sendmail.
Note that the pri parameter is already weighted by the number of times the message has been
tried (although this tends to lower the priority of the message with time); the expectation is that
the ctime would be used as an "escape clause" to ensure that messages are eventually processed.
6.3.5. Refusing Incoming SMTP Connections
The function refuseconnections returns
true
if incoming SMTP connections should be
refused. The current implementation is based exclusively on the current load average and the
refuse load average option (option X, global variable RefuseLA):
bool
refuseconnections()
{
return (RefuseLA > 0 && CurrentLA >= RefuseLA);
}
A more clever implementation could look at more system resources.