# Prefer /dev/shm because it's an in-memory
# space that we can use to store data without
# having bits laying around in sectors.
tmpdir=/dev/shm
# Fall back to /tmp - /dev/shm is Linux-only & /tmp
# and shared memory space on other operating systems
# have non-standard methods of setup/access.
[ -w /dev/shm ] || tmpdir=/tmp

tmpfile=$(printf 'mkstemp(%s/pa.XXXXXX)' "${tmpdir}" | m4) \
  || die "couldn't create a shared memory file"

trap 'rm -f "$tmpfile"' EXIT
