Go to:
Gentoo Home
Documentation
Forums
Lists
Bugs
Planet
Store
Wiki
Get Gentoo!
Gentoo's Bugzilla – Attachment 190044 Details for
Bug 268124
New ebuild: tiny watchdog : wdd
Home
|
New
–
[Ex]
|
Browse
|
Search
|
Privacy Policy
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
add syslog support
wdd-syslog-errors.diff (text/plain), 2.03 KB, created by
Bertrand Jacquin
on 2009-05-01 15:33:44 UTC
(
hide
)
Description:
add syslog support
Filename:
MIME Type:
Creator:
Bertrand Jacquin
Created:
2009-05-01 15:33:44 UTC
Size:
2.03 KB
patch
obsolete
>--- wdd.c 2009-04-24 10:48:29.753640442 +0200 >+++ wdd.c+warn+syslog 2009-04-24 10:47:52.505385951 +0200 >@@ -10,10 +10,22 @@ > #include <unistd.h> > #include <sys/wait.h> > #include <string.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, "%s", 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 >@@ -24,10 +36,10 @@ > > heap = (void*)sbrk(0); > 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"); > } > > /* >@@ -39,7 +51,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 */ >@@ -58,15 +70,15 @@ > > heap = (void*)sbrk(0); > 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; > } >@@ -77,6 +89,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 >@@ -128,6 +145,7 @@ > sleep(1); > } > /* we never get there theorically... */ >+ do_exit_log(0, "main: return 0\n"); > return 0; > } >
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 268124
:
190041
|
190043
| 190044 |
190046
|
190047