aboutsummaryrefslogtreecommitdiffstats
path: root/testing/low-memory-monitor
diff options
context:
space:
mode:
authorLeo <thinkabit.ukim@gmail.com>2019-09-20 14:51:05 -0300
committerKevin Daudt <kdaudt@alpinelinux.org>2019-09-28 08:29:18 +0000
commit83418e96462b6bec30b66a4cb2db3cf32c316f89 (patch)
treec0b19d6d27bc50ad0d01a71d32e59c576b207791 /testing/low-memory-monitor
parent975d478a4330d86a76f5cc9991c11af72af11764 (diff)
downloadaports-83418e96462b6bec30b66a4cb2db3cf32c316f89.tar.bz2
aports-83418e96462b6bec30b66a4cb2db3cf32c316f89.tar.xz
testing/low-memory-monitor: new aport
https://gitlab.freedesktop.org/hadess/low-memory-monitor Daemon to monitor memory usage and signal processes and the kernel Closes !101
Diffstat (limited to 'testing/low-memory-monitor')
-rw-r--r--testing/low-memory-monitor/APKBUILD38
-rw-r--r--testing/low-memory-monitor/low-memory-monitor.initd18
-rw-r--r--testing/low-memory-monitor/musl.patch22
3 files changed, 78 insertions, 0 deletions
diff --git a/testing/low-memory-monitor/APKBUILD b/testing/low-memory-monitor/APKBUILD
new file mode 100644
index 0000000000..55815ace3a
--- /dev/null
+++ b/testing/low-memory-monitor/APKBUILD
@@ -0,0 +1,38 @@
+# Contributor: Leo <thinkabit.ukim@gmail.com>
+# Maintainer: Leo <thinkabit.ukim@gmail.com>
+pkgname=low-memory-monitor
+pkgver=1.0
+pkgrel=0
+pkgdesc="Daemon to monitor memory usage and signal processes and the kernel"
+options="!check" # No testsuite
+url="https://gitlab.freedesktop.org/hadess/low-memory-monitor"
+arch="all"
+license="GPL-3.0-or-later"
+makedepends="meson glib-dev"
+source="https://gitlab.freedesktop.org/hadess/low-memory-monitor/-/archive/$pkgver/low-memory-monitor-$pkgver.tar.gz
+ low-memory-monitor.initd
+ musl.patch
+ "
+
+build() {
+ meson \
+ --prefix=/usr \
+ --sysconfdir=/etc \
+ --localstatedir=/var \
+ -Dgtk_doc=false \
+ -Dsystemdsystemunitdir=/DELETEME \
+ . output
+ ninja -C output
+}
+
+package() {
+ DESTDIR="$pkgdir" ninja -C output install
+
+ # Remove systemd service
+ rm -rf "$pkgdir"/DELETEME
+
+ install -Dm644 "$srcdir"/low-memory-monitor.initd "$pkgdir"/etc/init.d/low-memory-monitor
+}
+sha512sums="caf270aaf1b8f0bc3f7b57702d166106e3aadcc18113da94ea704296081a8c16ee6271b95d3ab8f431c718d0184dfec3976e3cb144aa5f077a15f4491ed64489 low-memory-monitor-1.0.tar.gz
+3ff5e250974c4ac474da4eb45317acd2d782b42997ee336b7d006481043a5c0cba57b9d06d13ed68bca61bd228e31b47993eae4f9da4977a863eaaa704bce866 low-memory-monitor.initd
+7cd0bfa4e2b374a3b7d252a18fc83ff4ecbd52d22c40e406e10ba776daad80e7dc3d3c339b556a89a97786fe541e2aff7f32097aed5473a069612344d981ab23 musl.patch"
diff --git a/testing/low-memory-monitor/low-memory-monitor.initd b/testing/low-memory-monitor/low-memory-monitor.initd
new file mode 100644
index 0000000000..5821d5090c
--- /dev/null
+++ b/testing/low-memory-monitor/low-memory-monitor.initd
@@ -0,0 +1,18 @@
+#!/sbin/openrc-run
+supervisor=supervise-daemon
+
+name="Low Memory Monitor"
+description="Read memory pressure information and signal user processes and kernel OOM accordingly"
+
+command=/usr/libexec/low-memory-monitor
+
+depend() {
+ need localmount
+}
+
+start_pre() {
+ # We need /proc/pressure directory that contains information about memory
+ # pressure. this requires CONFIG_PSI=y, if CONFIG_PSI_DEFAULT_DISABLED is
+ # also used then you need to pass pse=1 on the kernel cmdline
+ checkpath --directory /proc/pressure
+}
diff --git a/testing/low-memory-monitor/musl.patch b/testing/low-memory-monitor/musl.patch
new file mode 100644
index 0000000000..b2faac74dd
--- /dev/null
+++ b/testing/low-memory-monitor/musl.patch
@@ -0,0 +1,22 @@
+diff --git a/src/memory-pressure-monitor.c b/src/memory-pressure-monitor.c
+index f59af0a..0863c13 100644
+--- a/src/memory-pressure-monitor.c
++++ b/src/memory-pressure-monitor.c
+@@ -12,6 +12,16 @@
+ #include <glib-unix.h>
+ #include <errno.h>
+
++/* taken from glibc unistd.h and fixes musl */
++#ifndef TEMP_FAILURE_RETRY
++#define TEMP_FAILURE_RETRY(expression) \
++ (__extension__ \
++ ({ long int __result; \
++ do __result = (long int) (expression); \
++ while (__result == -1L && errno == EINTR); \
++ __result; }))
++#endif
++
+ /* Constants */
+ #define MEMORY_PRESSURE_PATH "/proc/pressure/memory"
+
+