# The following cleanup is provided for platforms that restart Application on
# suspend and need to rebuild the state of the ipc directory. For other
# platforms it is benign.
[ -e /tmp/ipc/mqueue ] && umount -l /tmp/ipc/mqueue
rm -rf /tmp/ipc

mkdir -m 0777 /tmp/ipc
mkdir -m 0755 /tmp/ipc/reg
chown app.app /tmp/ipc/reg
mkdir -m 0700 /tmp/ipc/resource
chown app.app /tmp/ipc/resource
mkdir -m 0755 /tmp/reg
chown app.app /tmp/reg

# Message queue file system
mkdir -m 0777 /tmp/ipc/mqueue
mount -t mqueue none /tmp/ipc/mqueue
echo "16" > /proc/sys/fs/mqueue/msg_max

mount --make-shared /media
mount --make-shared /tmp
# As we made the /tmp mount point shared, we need to make /tmp/trymount mount point private,
# because automount.sh is doing "mount -o move" from /tmp/trymount to /media, but both
# of them are shared, so we have circular sharing dependency, which is not supported by
# kernel.
mkdir -m 0777 /tmp/trymount
mount -t tmpfs -o mode=01777 tmpfs /tmp/trymount
mount --make-private /tmp/trymount
