-
-
Notifications
You must be signed in to change notification settings - Fork 49
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add capabilities, priority, and oom-score-adjustment support on Linux #404
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -208,6 +208,9 @@ for var in PREFIX \ | |
SHUTDOWN_PREFIX \ | ||
BUILD_SHUTDOWN \ | ||
SUPPORT_CGROUPS \ | ||
SUPPORT_CAPABILITIES \ | ||
SUPPORT_IOPRIO \ | ||
SUPPORT_OOM_ADJ \ | ||
USE_UTMPX \ | ||
USE_INITGROUPS \ | ||
SYSCONTROLSOCKET \ | ||
|
@@ -239,6 +242,12 @@ for arg in "$@"; do | |
--disable-shutdown|--enable-shutdown=no) BUILD_SHUTDOWN=no ;; | ||
--enable-cgroups|--enable-cgroups=yes) SUPPORT_CGROUPS=1 ;; | ||
--disable-cgroups|--enable-cgroups=no) SUPPORT_CGROUPS=0 ;; | ||
--enable-capabilities|--enable-capabilities=yes) SUPPORT_CAPABILITIES=1 ;; | ||
--disable-capabilities|--enable-capabilities=no) SUPPORT_CAPABILITIES=0 ;; | ||
--enable-ioprio|--enable-ioprio=yes) SUPPORT_IOPRIO=1 ;; | ||
--disable-ioprio|--enable-ioprio=no) SUPPORT_IOPRIO=0 ;; | ||
--enable-oom-adj|--enable-oom-adj=yes) SUPPORT_OOM_ADJ=1 ;; | ||
--disable-oom-adj|--enable-oom-adj=no) SUPPORT_OOM_ADJ=0 ;; | ||
--enable-utmpx|--enable-utmpx=yes) USE_UTMPX=1 ;; | ||
--disable-utmpx|--enable-utmpx=no) USE_UTMPX=0 ;; | ||
--enable-initgroups|--enable-initgroups=yes) USE_INITGROUPS=1 ;; | ||
|
@@ -278,10 +287,16 @@ done | |
if [ "$PLATFORM" = "Linux" ]; then | ||
: "${BUILD_SHUTDOWN:="yes"}" | ||
: "${SUPPORT_CGROUPS:="1"}" | ||
: "${SUPPORT_CAPABILITIES:="1"}" | ||
: "${SUPPORT_IOPRIO:="1"}" | ||
: "${SUPPORT_OOM_ADJ:="1"}" | ||
: "${SYSCONTROLSOCKET:="/run/dinitctl"}" | ||
else | ||
: "${BUILD_SHUTDOWN:="no"}" | ||
: "${SUPPORT_CGROUPS:="0"}" | ||
: "${SUPPORT_CAPABILITIES:="0"}" | ||
: "${SUPPORT_IOPRIO:="0"}" | ||
: "${SUPPORT_OOM_ADJ:="0"}" | ||
: "${SYSCONTROLSOCKET:="/var/run/dinitctl"}" | ||
fi | ||
|
||
|
@@ -467,6 +482,9 @@ STRIPOPTS=$STRIPOPTS | |
# Feature settings | ||
SUPPORT_CGROUPS=$SUPPORT_CGROUPS | ||
USE_INITGROUPS=$USE_INITGROUPS | ||
SUPPORT_CAPABILITIES=$SUPPORT_CAPABILITIES | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. If |
||
SUPPORT_IOPRIO=$SUPPORT_IOPRIO | ||
SUPPORT_OOM_ADJ=$SUPPORT_OOM_ADJ | ||
|
||
# Optional settings | ||
SHUTDOWN_PREFIX=${SHUTDOWN_PREFIX:-} | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -9,6 +9,10 @@ ifeq ($(BUILD_SHUTDOWN),yes) | |
SHUTDOWN=$(SHUTDOWN_PREFIX)shutdown | ||
endif | ||
|
||
ifeq ($(SUPPORT_CAPABILITIES),1) | ||
ALL_LDFLAGS+=-lcap | ||
endif | ||
Comment on lines
+12
to
+14
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It should already be |
||
|
||
dinit_objects = dinit.o load-service.o service.o proc-service.o baseproc-service.o control.o dinit-log.o \ | ||
dinit-main.o run-child-proc.o options-processing.o dinit-env.o settings.o | ||
|
||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Given this requires a dependency (in libcap), I'd prefer the default here was
SUPPORT_CAPABILITIES=0
. It's fine to have it on-by-default in theconfigure
script since we can check the dependency is available there (but that should be implemented).There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
it may add a dependency, but it's a dependency that's present on virtually any linux system (it's required by things like... udev), imo it makes much more sense to keep it on
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The library will be present but not necessarily the headers, and people using a straight Makefile-based build are often just trying out Dinit for personal use. I'd like to make sure that this scenario still works as easily as possible.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yes, but those people can easily disable it; i don't think it's right to default to a configuration where capabilities are not supported, the default build should imo be one that is as distros should build it
it's trivial to disable for somebody just trying it (it's also trivial to just install libcap-devel or whatever, in 99% of scenarios it's easily doable, and you already need to install a development toolchain)