Browse Source

fix watchdog for musl

Waldemar Brodkorb 10 năm trước cách đây
mục cha
commit
1259281171

+ 4 - 3
package/watchdog/Makefile

@@ -4,9 +4,9 @@
 include ${TOPDIR}/rules.mk
 
 PKG_NAME:=		watchdog
-PKG_VERSION:=		5.7
-PKG_RELEASE:=		3
-PKG_MD5SUM:=		31766450ecfc9aff70fe966c0b9df06d
+PKG_VERSION:=		5.13
+PKG_RELEASE:=		1
+PKG_MD5SUM:=		153455f008f1cf8f65f6ad9586a21ff1
 PKG_DESCR:=		watchdog daemon
 PKG_SECTION:=		utils
 PKG_DEPENDS:=		libtirpc
@@ -17,6 +17,7 @@ include ${TOPDIR}/mk/package.mk
 
 $(eval $(call PKG_template,WATCHDOG,watchdog,${PKG_VERSION}-${PKG_RELEASE},${PKG_DEPENDS},${PKG_DESCR},${PKG_SECTION}))
 
+TARGET_CPPFLAGS+=	-D_GNU_SOURCE
 TARGET_CFLAGS+=		-I$(STAGING_TARGET_DIR)/usr/include/tirpc
 TARGET_LDFLAGS+=	-ltirpc
 

+ 9 - 0
package/watchdog/patches/patch-include_extern_h

@@ -0,0 +1,9 @@
+--- watchdog-5.13.orig/include/extern.h	2013-02-01 12:15:44.000000000 +0100
++++ watchdog-5.13/include/extern.h	2014-03-22 15:41:57.000000000 +0100
+@@ -1,5 +1,6 @@
+ #include <netinet/in.h>
+ #include <stdio.h>
++#include <time.h>
+ 
+ /* external variables */
+ extern int softboot, watchdog, temp, maxtemp, tint, lastts, nrts;

+ 11 - 0
package/watchdog/patches/patch-src_memory_c

@@ -0,0 +1,11 @@
+--- watchdog-5.13.orig/src/memory.c	2013-02-01 12:15:44.000000000 +0100
++++ watchdog-5.13/src/memory.c	2014-03-22 16:07:15.000000000 +0100
+@@ -81,7 +81,7 @@ int check_memory(void)
+ 	syslog(LOG_INFO, "currently there are %d kB of free memory available", free);
+ #endif				/* USE_SYSLOG */
+ 
+-    if (free < minpages * (EXEC_PAGESIZE / 1024)) {
++    if (free < minpages * (4096 / 1024)) {
+ #if USE_SYSLOG
+ 	syslog(LOG_ERR, "memory %d kB is less than %d pages", free, minpages);
+ #endif				/* USE_SYSLOG */

+ 0 - 11
package/watchdog/patches/patch-src_mntent_c

@@ -1,11 +0,0 @@
---- watchdog-5.7.orig/src/mntent.c	2010-01-06 13:42:08.000000000 +0100
-+++ watchdog-5.7/src/mntent.c	2010-02-06 04:39:34.804334839 +0100
-@@ -157,7 +157,7 @@ my_getmntent (mntFILE *mfp) {
- 		if (fgets (buf, sizeof(buf), mfp->mntent_fp) == NULL)
- 			return NULL;
- 
--		s = index (buf, '\n');
-+		s = strchr (buf, '\n');
- 		if (s == NULL) {
- 			/* extremely long line - assume file was corrupted */
- 			mfp->mntent_errs = 1;

+ 10 - 0
package/watchdog/patches/patch-src_net_c

@@ -0,0 +1,10 @@
+--- watchdog-5.13.orig/src/net.c	2013-02-01 12:15:44.000000000 +0100
++++ watchdog-5.13/src/net.c	2014-03-22 16:18:27.000000000 +0100
+@@ -6,6 +6,7 @@
+ 
+ #include <errno.h>
+ #include <sys/time.h>
++#include <sys/types.h>
+ #include <netinet/ip.h>
+ #include <netinet/ip_icmp.h>
+ 

+ 18 - 0
package/watchdog/patches/patch-src_shutdown_c

@@ -0,0 +1,18 @@
+--- watchdog-5.13.orig/src/shutdown.c	2013-02-01 12:15:44.000000000 +0100
++++ watchdog-5.13/src/shutdown.c	2014-03-22 16:29:44.000000000 +0100
+@@ -186,6 +186,7 @@ static void mnt_off()
+     FILE *fp;
+     struct mntent *mnt;
+ 
++#if defined __GLIBC__
+     fp = setmntent(MNTTAB, "r");
+     /* in some rare cases fp might be NULL so be careful */
+     while (fp != NULL && ((mnt = getmntent(fp)) != (struct mntent *) 0)) {
+@@ -241,6 +242,7 @@ static void mnt_off()
+ #endif
+     }
+     endmntent(fp);
++#endif
+ }
+ 
+ /* Parts of the following two functions are taken from Miquel van */

+ 0 - 11
package/watchdog/patches/patch-src_umount_c

@@ -1,11 +0,0 @@
---- watchdog-5.7.orig/src/umount.c	2010-01-06 13:42:08.000000000 +0100
-+++ watchdog-5.7/src/umount.c	2010-02-06 04:39:47.664334843 +0100
-@@ -212,7 +212,7 @@ umount_one (const char *spec, const char
- 	    if (res < 0)
- 		 umnt_err2 = errno;
- 	    /* Do not complain about remote NFS mount points */
--	    if (errno == ENOENT && index(spec, ':'))
-+	    if (errno == ENOENT && strchr(spec, ':'))
- 		 umnt_err2 = 0;
-        }
-   }