SharedMemoryKey

The key to enable shared memory V8.12 and later

Shared memory is used by sendmail to store the amount of available disk space of the queue disks and the total number of messages queued across all queues (Print the Number of Messages in the Queue on page 425). For sendmail to do these two tasks, the binary must have been compiled with shared memory support (SM_CONF_SHM on page 142), and this SharedMemoryKey option must be declared.

You declare the SharedMemoryKey option like this:

O SharedMemoryKey=keyconfiguration file (V8.12 and later)
-OSharedMemoryKey=keycommand line (V8.12 and later)
define(`confSHARED_MEMORY_KEY',key)   ← mc configuration (V8.12 and later)

Here, key is of type numeric and can be positive, negative, or zero. A non-numeric key evaluates to zero. A key of zero causes use of shared memory to be disabled. Otherwise, the value specified becomes the key used by shmget(2).

If you specify the SharedMemoryKey option, and shared memory support was not included in sendmail, the following error is printed and logged:

Option: SharedMemoryKey requires shared memory support (-DSM_CONF_SHM)

If shared memory is used, only the initial daemon will create and destroy it. If you run multiple initial daemons, you must be careful not to specify the same key for each. For example, two lines in a boot-time rc file might look like this:

/usr/sbin/sendmail -OSharedMemoryKey=1001 -C /etc/mail/fast.cf -q10m /usr/sbin/sendmail -OSharedMemoryKey=1002 -C /etc/mail/slow.cf -q1h ...

Get sendmail, 4th Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.