|
For Linux, I don't think $XDG_DATA_HOME/mongocryptd.pid and $HOME/.local/share/mongocryptd.pid are appropriate. The "data" and "share" subdirectories are for immutable data like icons, fonts, readme files and such, not for sockets and pid files. These directories may also be read-only.
`/var/run` is the systemwide location for pid files, and https://www.freedesktop.org/software/systemd/man/file-hierarchy.html#Home%20Directory interestingly does not define `~/.local/var` at all. Therefore I would suggest:
if $XDG_RUNTIME_DIR set:
|
$XDG_RUNTIME_DIR/mongocryptd.pid
|
else if $TMPDIR is set
|
$TMPDIR/mongocryptd-$uid/mongocryptd.pid
|
else
|
/tmp/mongocryptd-$uid/mongocryptd.pid
|
... where $uid is the user id of the logged in user. Note that this may yield two instances of mongocryptd if a user sometimes uses MongoDB drivers from within an X session and sometimes not, such as via an SSH login to the same machine.
|