This commit is contained in:
parent
b8ae9c4ad6
commit
f1d2754bb7
17
fix_cache_trigger.patch
Normal file
17
fix_cache_trigger.patch
Normal file
@ -0,0 +1,17 @@
|
|||||||
|
---
|
||||||
|
triggers/cache-error-trigger | 2 +-
|
||||||
|
1 file changed, 1 insertion(+), 1 deletion(-)
|
||||||
|
|
||||||
|
Index: mcelog-1.0pre3/triggers/cache-error-trigger
|
||||||
|
===================================================================
|
||||||
|
--- mcelog-1.0pre3.orig/triggers/cache-error-trigger
|
||||||
|
+++ mcelog-1.0pre3/triggers/cache-error-trigger
|
||||||
|
@@ -25,7 +25,7 @@ for i in $CPUS_AFFECTED ; do
|
||||||
|
logger -s -p daemon.crit -t mcelog "Offlining CPU $i due to cache error threshold"
|
||||||
|
F=$(printf "/sys/devices/system/cpu/cpu%d/online" $i)
|
||||||
|
echo 0 > $F
|
||||||
|
- if [ "$(< $F)" != "0" ] then
|
||||||
|
+ if [ "$(< $F)" != "0" ]; then
|
||||||
|
logger -s -p daemon.warn -t mcelog "Offlining CPU $i failed"
|
||||||
|
fi
|
||||||
|
done
|
@ -1,3 +0,0 @@
|
|||||||
version https://git-lfs.github.com/spec/v1
|
|
||||||
oid sha256:80b0593c8d1923bc33a07ab72c84654aee492de0c3b5806553ac13fb6f8ee719
|
|
||||||
size 759376
|
|
3
mcelog-1.0pre3.tar.bz2
Normal file
3
mcelog-1.0pre3.tar.bz2
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
version https://git-lfs.github.com/spec/v1
|
||||||
|
oid sha256:5472acd0808cc20ade275578ca88b6eca33b945c73cffe834982809bfa2d9bb3
|
||||||
|
size 167193
|
@ -1,3 +1,12 @@
|
|||||||
|
-------------------------------------------------------------------
|
||||||
|
Fri Feb 19 00:39:36 CET 2010 - ro@suse.de
|
||||||
|
|
||||||
|
- Update to version 1.0pre3
|
||||||
|
- Boxboro-EX enhancements
|
||||||
|
- Bugfixes
|
||||||
|
Minor pidfile handling adjusting in service file
|
||||||
|
- Added missing conf file and trigger scripts
|
||||||
|
|
||||||
-------------------------------------------------------------------
|
-------------------------------------------------------------------
|
||||||
Thu Dec 3 12:12:40 CET 2009 - trenn@suse.de
|
Thu Dec 3 12:12:40 CET 2009 - trenn@suse.de
|
||||||
|
|
||||||
|
@ -46,13 +46,13 @@
|
|||||||
rc_reset
|
rc_reset
|
||||||
|
|
||||||
mcelog="/usr/sbin/mcelog"
|
mcelog="/usr/sbin/mcelog"
|
||||||
mcelog_params=" --daemon "
|
|
||||||
mcedev=/dev/mcelog
|
|
||||||
mcelog_pid="/var/run/mcelog.pid"
|
mcelog_pid="/var/run/mcelog.pid"
|
||||||
|
mcelog_params=" --daemon --pidfile ${mcelog_pid}"
|
||||||
|
mcedev=/dev/mcelog
|
||||||
|
|
||||||
check="checkproc -p ${mcelog_pid} ${mcelog}"
|
check="checkproc ${mcelog}"
|
||||||
kill="killproc -p ${mcelog_pid} ${mcelog}"
|
kill="killproc ${mcelog}"
|
||||||
start="startproc -p ${mcelog_pid} ${mcelog} ${mcelog_params}"
|
start="startproc ${mcelog} ${mcelog_params}"
|
||||||
|
|
||||||
test_kernel_support()
|
test_kernel_support()
|
||||||
{
|
{
|
||||||
@ -81,6 +81,17 @@ case "$1" in
|
|||||||
${kill}
|
${kill}
|
||||||
rc_status -v
|
rc_status -v
|
||||||
;;
|
;;
|
||||||
|
try-restart)
|
||||||
|
## Do a restart only if the service was active before.
|
||||||
|
$0 status
|
||||||
|
if test $? = 0; then
|
||||||
|
$0 restart
|
||||||
|
else
|
||||||
|
rc_reset # Not running is not a failure.
|
||||||
|
fi
|
||||||
|
# Remember status and be quiet
|
||||||
|
rc_status
|
||||||
|
;;
|
||||||
reload|restart)
|
reload|restart)
|
||||||
/etc/init.d/mcelog stop
|
/etc/init.d/mcelog stop
|
||||||
/etc/init.d/mcelog start
|
/etc/init.d/mcelog start
|
||||||
|
22
mcelog.spec
22
mcelog.spec
@ -1,5 +1,5 @@
|
|||||||
#
|
#
|
||||||
# spec file for package mcelog (Version 1.0pre1)
|
# spec file for package mcelog (Version 1.0pre3)
|
||||||
#
|
#
|
||||||
# Copyright (c) 2010 SUSE LINUX Products GmbH, Nuernberg, Germany.
|
# Copyright (c) 2010 SUSE LINUX Products GmbH, Nuernberg, Germany.
|
||||||
#
|
#
|
||||||
@ -21,14 +21,14 @@
|
|||||||
Name: mcelog
|
Name: mcelog
|
||||||
License: GPLv2+
|
License: GPLv2+
|
||||||
Summary: Log Machine Check Events
|
Summary: Log Machine Check Events
|
||||||
Version: 1.0pre1
|
Version: 1.0pre3
|
||||||
Release: 1
|
Release: 1
|
||||||
AutoReqProv: on
|
AutoReqProv: on
|
||||||
ExclusiveArch: x86_64
|
ExclusiveArch: x86_64
|
||||||
PreReq: %insserv_prereq
|
PreReq: %insserv_prereq
|
||||||
Source: mcelog-%{version}.tar.bz2
|
Source: mcelog-%{version}.tar.bz2
|
||||||
Source1: mcelog.service
|
Source1: mcelog.service
|
||||||
Patch0: mcelog_daemon_create_pid_file.patch
|
Patch1: fix_cache_trigger.patch
|
||||||
Group: System/Monitoring
|
Group: System/Monitoring
|
||||||
BuildRoot: %{_tmppath}/%{name}-%{version}-build
|
BuildRoot: %{_tmppath}/%{name}-%{version}-build
|
||||||
|
|
||||||
@ -50,20 +50,19 @@ Authors:
|
|||||||
|
|
||||||
%prep
|
%prep
|
||||||
%setup
|
%setup
|
||||||
%patch0 -p1
|
%patch1 -p1
|
||||||
|
|
||||||
%build
|
%build
|
||||||
make CFLAGS="$RPM_OPT_FLAGS"
|
make CFLAGS="$RPM_OPT_FLAGS"
|
||||||
|
|
||||||
%install
|
%install
|
||||||
mkdir -p $RPM_BUILD_ROOT/usr/sbin/
|
export prefix=$RPM_BUILD_ROOT/usr
|
||||||
mkdir -p $RPM_BUILD_ROOT/%{_mandir}/man8
|
export etcprefix=$RPM_BUILD_ROOT
|
||||||
|
make -e install
|
||||||
mkdir -p $RPM_BUILD_ROOT/etc/logrotate.d/
|
mkdir -p $RPM_BUILD_ROOT/etc/logrotate.d/
|
||||||
mkdir -p $RPM_BUILD_ROOT/etc/init.d
|
mkdir -p $RPM_BUILD_ROOT/etc/init.d
|
||||||
install -m755 %SOURCE1 $RPM_BUILD_ROOT/etc/init.d/mcelog
|
install -m755 %SOURCE1 $RPM_BUILD_ROOT/etc/init.d/mcelog
|
||||||
ln -s /etc/init.d/mcelog $RPM_BUILD_ROOT/usr/sbin/rcmcelog
|
ln -s /etc/init.d/mcelog $RPM_BUILD_ROOT/usr/sbin/rcmcelog
|
||||||
install -m755 mcelog $RPM_BUILD_ROOT/usr/sbin
|
|
||||||
install -m644 mcelog.8 $RPM_BUILD_ROOT/%{_mandir}/man8
|
|
||||||
install -m644 mcelog.logrotate $RPM_BUILD_ROOT/etc/logrotate.d/mcelog
|
install -m644 mcelog.logrotate $RPM_BUILD_ROOT/etc/logrotate.d/mcelog
|
||||||
|
|
||||||
%clean
|
%clean
|
||||||
@ -75,10 +74,10 @@ if [ -c /dev/mcelog ];then
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
%preun
|
%preun
|
||||||
%stop_on_removal mcelog
|
%{stop_on_removal mcelog}
|
||||||
|
|
||||||
%postun
|
%postun
|
||||||
%restart_on_update
|
%{restart_on_update mcelog}
|
||||||
%insserv_cleanup
|
%insserv_cleanup
|
||||||
|
|
||||||
%files
|
%files
|
||||||
@ -87,6 +86,9 @@ fi
|
|||||||
/usr/sbin/mcelog
|
/usr/sbin/mcelog
|
||||||
%config /etc/logrotate.d/mcelog
|
%config /etc/logrotate.d/mcelog
|
||||||
/etc/init.d/mcelog
|
/etc/init.d/mcelog
|
||||||
|
%dir /etc/mcelog
|
||||||
|
%config /etc/mcelog/mcelog.conf
|
||||||
|
/etc/mcelog/*trigger
|
||||||
/usr/sbin/rcmcelog
|
/usr/sbin/rcmcelog
|
||||||
|
|
||||||
%changelog
|
%changelog
|
||||||
|
@ -1,85 +0,0 @@
|
|||||||
mcelog daemon: Add pid file handling
|
|
||||||
|
|
||||||
Signed-off-by: Thomas Renninger <trenn@suse.de>
|
|
||||||
|
|
||||||
---
|
|
||||||
mcelog.c | 41 +++++++++++++++++++++++++++++++++++++++--
|
|
||||||
paths.h | 2 ++
|
|
||||||
2 files changed, 41 insertions(+), 2 deletions(-)
|
|
||||||
|
|
||||||
diff --git a/mcelog.c b/mcelog.c
|
|
||||||
index e166f57..a556664 100644
|
|
||||||
--- a/mcelog.c
|
|
||||||
+++ b/mcelog.c
|
|
||||||
@@ -35,6 +35,8 @@
|
|
||||||
#include <stddef.h>
|
|
||||||
#include <assert.h>
|
|
||||||
#include <pwd.h>
|
|
||||||
+#include <signal.h>
|
|
||||||
+
|
|
||||||
#include "mcelog.h"
|
|
||||||
#include "paths.h"
|
|
||||||
#include "k8.h"
|
|
||||||
@@ -977,6 +979,37 @@ static void process_mcefd(struct pollfd *pfd, void *data)
|
|
||||||
process(pfd->fd, d->recordlen, d->loglen, d->buf);
|
|
||||||
}
|
|
||||||
|
|
||||||
+void exit_handler (int signal)
|
|
||||||
+{
|
|
||||||
+ remove(DAEMON_PID_PATH);
|
|
||||||
+}
|
|
||||||
+
|
|
||||||
+static int daemonize(int foreground)
|
|
||||||
+{
|
|
||||||
+ int ret;
|
|
||||||
+ pid_t pid;
|
|
||||||
+ FILE *fd;
|
|
||||||
+
|
|
||||||
+ fd = fopen(DAEMON_PID_PATH, "r");
|
|
||||||
+ if (!fd) {
|
|
||||||
+ if (!foreground) {
|
|
||||||
+ ret = daemon(0, need_stdout());
|
|
||||||
+ if (ret < 0)
|
|
||||||
+ return ret;
|
|
||||||
+ }
|
|
||||||
+ fd = fopen(DAEMON_PID_PATH, "w+");
|
|
||||||
+ if (!fd)
|
|
||||||
+ return -1;
|
|
||||||
+ pid = getpid();
|
|
||||||
+ fprintf(fd, "%d\n", pid);
|
|
||||||
+ fclose(fd);
|
|
||||||
+ signal(SIGKILL, exit_handler);
|
|
||||||
+ signal(SIGTERM, exit_handler);
|
|
||||||
+ return 0;
|
|
||||||
+ } else
|
|
||||||
+ return -1;
|
|
||||||
+}
|
|
||||||
+
|
|
||||||
int main(int ac, char **av)
|
|
||||||
{
|
|
||||||
struct mcefd_data d = {};
|
|
||||||
@@ -1031,8 +1064,12 @@ int main(int ac, char **av)
|
|
||||||
page_setup();
|
|
||||||
drop_cred();
|
|
||||||
register_pollcb(fd, POLLIN, process_mcefd, &d);
|
|
||||||
- if (!foreground && daemon(0, need_stdout()) < 0)
|
|
||||||
- err("daemon");
|
|
||||||
+ if (daemonize(foreground) < 0) {
|
|
||||||
+ fprintf(stderr, "Could not run in background or create"
|
|
||||||
+ " pidfile: " DAEMON_PID_PATH "\n");
|
|
||||||
+ fprintf(stderr, "Is the daemon already running?\n");
|
|
||||||
+ exit(1);
|
|
||||||
+ }
|
|
||||||
eventloop();
|
|
||||||
} else {
|
|
||||||
process(fd, d.recordlen, d.loglen, d.buf);
|
|
||||||
diff --git a/paths.h b/paths.h
|
|
||||||
index 6780552..efda627 100644
|
|
||||||
--- a/paths.h
|
|
||||||
+++ b/paths.h
|
|
||||||
@@ -5,3 +5,5 @@
|
|
||||||
#define CONFIG_FILENAME PREFIX "/etc/mcelog/mcelog.conf"
|
|
||||||
|
|
||||||
#define SOCKET_PATH "/var/run/mcelog-client"
|
|
||||||
+
|
|
||||||
+#define DAEMON_PID_PATH "/var/run/mcelog.pid"
|
|
Loading…
Reference in New Issue
Block a user