Skip to content
  • Simon McVittie's avatar
    build: Introduce ${runstatedir} and use it for the pid file · 1477ca50
    Simon McVittie authored
    By default ${runstatedir} is the same as ${localstatedir}/run, but many
    Linux distributions configure it to be /run and mount a tmpfs in that
    location. All other factors being equal, it is preferable to use /run
    where available because it is guaranteed to be local, whereas traversing
    /var might involve automounting a networked filesystem (even though
    /var/run itself is very likely to be a tmpfs).
    
    /run or /var/run is currently only used in a few places in dbus, but
    I plan to make more use of it during the development of
    <https://bugs.freedesktop.org/show_bug.cgi?id=100344>.
    
    The pid file is not part of the API between dbus and other software
    (other than distribution init scripts for dbus itself), so we do not
    need to keep it strictly compatible; so it is OK to move it.
    
    We do not yet use /run for the system bus socket, because that is
    part of the API between D-Bus clients and servers, and has always been
    "officially" /var/run/dbus/system_bus_socket.
    <https://bugs.freedesktop.org/show_bug.cgi?id=101628> tracks the
    possibility of changing that.
    
    Similarly, we do not replace /var/run/console with /run/console, because
    that path is part of the API between dbus-daemon and the obsolete PAM
    modules pam_console and pam_foreground that used /var/run/console.
    <https://bugs.freedesktop.org/show_bug.cgi?id=101629
    
    > tracks the possible
    future removal of that code path.
    
    In the CMake build system, the equivalent of ${runstatedir} remains
    hard-coded to the equivalent of ${localstatedir}/run for simplicity. For
    the sort of system-wide installations that would consider redefining
    ${runstatedir} to /run, the Autotools build system is strongly
    recommended: in particular this is what Linux distributions are expected
    to use.
    
    Signed-off-by: default avatarSimon McVittie <smcv@collabora.com>
    Reviewed-by: default avatarPhilip Withnall <withnall@endlessm.com>
    Bug: https://bugs.freedesktop.org/show_bug.cgi?id=101569
    1477ca50