blob: da0f064a9456070820a097929e3838aff1bf0200 [file] [log] [blame]
# Copyright 2017 The Chromium OS Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
description "Chrome OS MIDI server"
author "chromium-os-dev@chromium.org"
stop on stopping ui
respawn
expect fork
# Allow the MIDI server real time priority.
limit rtprio 20 20
pre-start script
# Check if ui is still running before starting MIDI server.
# This is to prevent new dbus-activated instances from getting started once
# the system is beginning to shut down.
if ! initctl status ui | grep -q running; then
stop
exit 0
fi
end script
# Needs access to /dev to perform device enumeration.
# Needs access to /run/dbus to connect to D-Bus.
# Needs access to /run/systemd/journal for logging (crbug.com/932761)
exec minijail0 -i -l -p -N -n -v -P /mnt/empty -b / -b /dev -b /proc \
-k 'tmpfs,/run,tmpfs,MS_NOSUID|MS_NODEV|MS_NOEXEC' -b /run/dbus \
-b /run/systemd/journal -t -r \
-S /usr/share/policy/midis-seccomp.policy \
-c 0 -u midis -g midis -G -- /usr/bin/midis
# Wait for daemon to claim its D-Bus name before transitioning to started.
post-start exec minijail0 -u midis -g midis /usr/bin/gdbus \
wait --system --timeout 15 org.chromium.Midis