mirror of
https://github.com/termux/termux-packages.git
synced 2024-11-23 16:06:16 +00:00
3d8f09c2f4
vnstatd needs to be run as root since it reads /sys/class/net. vnstat also needs root since it reads databse from vnstatd. vnstati pulls in libgd as dependency which depends on x11 libs - service script + service finish - vnstati subpackage closes #10143
26 lines
582 B
Diff
26 lines
582 B
Diff
diff --git a/src/daemon.c b/src/daemon.c
|
|
index 98c9f5b..46dd2ea 100644
|
|
--- a/src/daemon.c
|
|
+++ b/src/daemon.c
|
|
@@ -11,6 +11,20 @@
|
|
#include "id.h"
|
|
#include "daemon.h"
|
|
|
|
+/*
|
|
+ * Bionic implemention from initial aosp commit :)))
|
|
+ * https://android.googlesource.com/platform/bionic/+/a799b53f10e5a6fd51fef4436cfb7ec99836a516/libc/unistd/getdtablesize.c
|
|
+ */
|
|
+#include <sys/resource.h>
|
|
+int getdtablesize()
|
|
+{
|
|
+ struct rlimit r;
|
|
+ if (getrlimit(RLIMIT_NOFILE, &r) < 0) {
|
|
+ return sysconf(_SC_OPEN_MAX);
|
|
+ }
|
|
+ return r.rlim_cur;
|
|
+}
|
|
+
|
|
void daemonize(void)
|
|
{
|
|
int i;
|