summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBertrand Jacquin <beber@meleeweb.net>2008-04-21 10:23:38 +0200
committerBertrand Jacquin <beber@meleeweb.net>2008-04-21 10:23:38 +0200
commit5852184570e8814de1e15fe79c5ba95a547050c4 (patch)
treeaa33104ca75227a839ea5f8c16fa093f7795b7aa
parentexim: dovecot plugins is there for a while in mainstream, pruning that (diff)
downloadportage-5852184570e8814de1e15fe79c5ba95a547050c4.tar.xz
wdd with syslog support
-rw-r--r--sys-apps/wdd/Manifest2
-rw-r--r--sys-apps/wdd/files/wdd-syslog-errors.diff91
-rw-r--r--sys-apps/wdd/wdd-0-r1.ebuild44
3 files changed, 137 insertions, 0 deletions
diff --git a/sys-apps/wdd/Manifest b/sys-apps/wdd/Manifest
index e30a36ca..f57bafd6 100644
--- a/sys-apps/wdd/Manifest
+++ b/sys-apps/wdd/Manifest
@@ -1,6 +1,8 @@
AUX warning.patch 774 RMD160 4c7147c373d8872cf35ddd4eb4b67f50b52749ac SHA1 6c84a76542769c001bc8912558f87a63b983e42e SHA256 918e0fcd1acadbc574f5bdb4e90e1a62a4f607497ec2a689498d0d89254ae7d6
+AUX wdd-syslog-errors.diff 2138 RMD160 a35c58c4d04f666cda623de854fbd84444e467be SHA1 cea53e22e8627d125a48355ef57bbbe3e026b692 SHA256 301b5d8ba0b8220bd9d1a750e03175060889fe85d5cde583aad7265cbe114951
AUX wdd.confd 63 RMD160 0c72c3dc55da3c82231ecd4fc479fe64a1b49a66 SHA1 fe35c35f956e38f1ff18277838cb8741998af56a SHA256 bd66a212cb55fdf74bf967917f5d5a68e08ab855d3b44a97d3a634da19da8d88
AUX wdd.initd 421 RMD160 f42dd9c91bbd1efe38253db237b7fee70f303c67 SHA1 36b4ef136e32ea9de5f837e4c08672128025dec6 SHA256 9d123e1ea41d90404520f33922d12cb2622cc4b913f62277d4b11bdfe0d3b684
DIST wdd.8 3198 RMD160 34aa288bd79e0f15229ca75f8567bde8d45f76a1 SHA1 1f83bdc0fd2f8aaeb439ac60f1d79487a8e88f88 SHA256 7129d465b7fa4c96dd488f22a4dc265a0d2d343e1c40ac0aa6827e53dd8aec2b
DIST wdd.c 2841 RMD160 f4555a2132545e371d7325bc71755c48f64a57b9 SHA1 b68d654ec1511bbce66a1a07d40bf9b7c3272243 SHA256 66be5e748b6199f7afbdbc7b6aaed6cbbfa2e0634aa90d3c0aefa743756ae6a7
+EBUILD wdd-0-r1.ebuild 902 RMD160 f7becfbb2bfd8081869f294b61fe5630013f83db SHA1 7b535b3610d5c87cf627840c4088be8ee0f482da SHA256 1db5296b020ff4db819d3170ccc166c3d0265690cfde6f79144669c88a2288c0
EBUILD wdd-0.ebuild 756 RMD160 d6b133180c7ad6e45e021ab5cccc022ff5d08e99 SHA1 07062968c759ec3eefaea0a08b935ca3e6616712 SHA256 dbaa31f81d629ff15c6615dbad4a088fd256cf0a9a977e6d2465f9ca160fb0d6
diff --git a/sys-apps/wdd/files/wdd-syslog-errors.diff b/sys-apps/wdd/files/wdd-syslog-errors.diff
new file mode 100644
index 00000000..93d61672
--- /dev/null
+++ b/sys-apps/wdd/files/wdd-syslog-errors.diff
@@ -0,0 +1,91 @@
+--- wdd.c 2008-04-09 14:23:47.000000000 +0200
++++ wdd.c 2008-04-09 14:40:45.000000000 +0200
+@@ -3,13 +3,27 @@
+ */
+
+ #include <stdio.h>
++#include <stdlib.h>
++#include <string.h>
+ #include <sys/types.h>
+ #include <sys/stat.h>
+ #include <fcntl.h>
++#ifdef _USE_SYSLOG_
++#include <syslog.h>
++#endif /* _USE_SYSLOG_ */
+
+ const char dev_wd_str[] = "/dev/watchdog";
+ const char root_str[] = "/";
+
++void do_exit_log (int ret, char* string) {
++
++#ifdef _USE_SYSLOG_
++ syslog(LOG_EMERG, string);
++#endif /* _USE_SYSLOG_ */
++
++ exit (ret);
++}
++
+ /*
+ * This function checks if the system can allocate memory
+ * In case of failure, we exit so that the watchdog device
+@@ -20,10 +34,10 @@
+
+ heap = (void*)sbrk(NULL);
+ if (brk(heap + 4096))
+- exit(1);
++ do_exit_log(1, "try_malloc: brk(heap + 4096) failed\n");
+ memset(heap, 0, 4096);
+ if (brk(heap))
+- exit(1);
++ do_exit_log(1, "try_malloc: brk(heap) failed\n");
+ }
+
+ /*
+@@ -35,7 +49,7 @@
+ int pid;
+ pid = fork();
+ if (pid < 0) /* exit on error */
+- exit(1);
++ do_exit_log(1, "try_fork: fork() failed\n");
+ else if (pid == 0) /* child returns cleanly */
+ exit(0);
+ if (waitpid(pid, NULL, 0) != pid) /* father checks child */
+@@ -54,15 +68,15 @@
+
+ heap = (void*)sbrk(NULL);
+ if (brk(heap + sizeof (struct stat)))
+- exit(1);
++ do_exit_log(1, "try_stat: brk(heap + sizeof (struct stat)\n");
+ memset(heap, 0, sizeof (struct stat));
+ ret = stat(file, heap);
+ if (brk(heap))
+- exit(1);
++ do_exit_log(1, "try_stat: brk(heap) failed\n");
+
+ if (ret == -1) {
+ if (do_exit)
+- exit(1);
++ do_exit_log(1, "try_stat: do_exit_log\n");
+ else
+ return 0;
+ }
+@@ -73,6 +87,11 @@
+ int dev;
+ int curr_file;
+
++#ifdef _USE_SYSLOG_
++ openlog ("wdd", LOG_PID|LOG_NDELAY, LOG_DAEMON);
++ syslog(LOG_INFO, "wdd started\n");
++#endif /* _USE_SYSLOG_ */
++
+ if (argc > 1) {
+ /* we'll do a quick check on all the arguments to
+ * ensure that they are valid at load time, and avoid
+@@ -124,6 +143,7 @@
+ sleep(1);
+ }
+ /* we never get there theorically... */
++ do_exit_log(0, "main: return 0\n");
+ return 0;
+ }
+
diff --git a/sys-apps/wdd/wdd-0-r1.ebuild b/sys-apps/wdd/wdd-0-r1.ebuild
new file mode 100644
index 00000000..38fc4aef
--- /dev/null
+++ b/sys-apps/wdd/wdd-0-r1.ebuild
@@ -0,0 +1,44 @@
+# Copyright 1999-2007 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: $
+
+inherit eutils
+
+DESCRIPTION="Simple Watchdog Daemon"
+HOMEPAGE="http://linux.exosec.fr/watchdog/"
+SRC_URI="http://linux.exosec.fr/watchdog/daemon/wdd.c
+ http://linux.exosec.fr/watchdog/daemon/wdd.8"
+
+LICENSE="Public-Domain"
+SLOT="0"
+KEYWORDS="~x86 ~amd64"
+IUSE="syslog"
+
+DEPEND=""
+RDEPEND=""
+
+src_unpack () {
+ mkdir -p ${S}
+ mv ${DISTDIR}/wdd.{c,8} ${S}
+
+ cd ${S}
+ #epatch ${FILESDIR}/warning.patch
+ use syslog && epatch ${FILESDIR}/wdd-syslog-errors.diff
+}
+
+src_compile () {
+ local flags=""
+ use syslog && flags="${flags} -D_USE_SYSLOG_"
+
+ echo "gcc -W -Wall $CFLAGS ${flags} -o wdd wdd.c"
+ gcc -W -Wall $CFLAGS ${flags} -o wdd wdd.c || die "compile failed"
+}
+
+src_install () {
+ dosbin wdd
+ doman wdd.8
+
+ newinitd ${FILESDIR}/wdd.initd wdd
+ newconfd ${FILESDIR}/wdd.confd wdd
+}
+