blob: 8fb14dece6f2a0d37b7f7745e623f0b4319b5036 [file] [edit]
# Copyright 2022 The ChromiumOS Authors
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
description "Chrome OS RGB Keyboard service"
author "chromium-os-dev@chromium.org"
# This is started by D-Bus service activation through
# org.chromium.Rgbkbd.service
stop on stopping system-services
respawn
# If the service restarts 10 times in 5 seconds, stop trying.
respawn limit 10 5
# Specify that program is potentially expected to exit with return code 0
normal exit 0
# Minijail actually forks off the desired process.
expect fork
# Make it killable.
oom score -100
# Let the daemon crash if it grows too much. "as" for "address space".
# TODO(michaelcheco): Check memory usage after some development. Currently set
# to 100 MB.
limit as 100000000 unlimited
script
OPTIONAL_ARGS=""
# Make bind-mounting croc_ec optional as the file does not exist on some
# platforms, notably betty.
if [ -e "/dev/cros_ec" ]; then
OPTIONAL_ARGS="${OPTIONAL_ARGS} -b /dev/cros_ec"
fi
exec minijail0 --config /usr/share/minijail/rgbkbd.conf \
${OPTIONAL_ARGS} \
-- /usr/sbin/rgbkbd
end script
post-start exec minijail0 -u rgbkbd -g rgbkbd /usr/bin/gdbus \
wait --system --timeout 15 org.chromium.Rgbkbd