Update to version 1.0pre3
(Some bugfixes and Boxboro-EX enhancements) Minor pidfile handling adjustance in service file OBS-URL: https://build.opensuse.org/package/show/Base:System/mcelog?expand=0&rev=9
This commit is contained in:
parent
ffdd3ca8e4
commit
ca30e6e939
@ -1,17 +0,0 @@
|
|||||||
---
|
|
||||||
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,12 +1,3 @@
|
|||||||
-------------------------------------------------------------------
|
|
||||||
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
|
||||||
|
|
||||||
|
@ -81,17 +81,6 @@ 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
|
||||||
|
18
mcelog.spec
18
mcelog.spec
@ -1,5 +1,5 @@
|
|||||||
#
|
#
|
||||||
# spec file for package mcelog (Version 1.0pre3)
|
# spec file for package mcelog (Version 1.0pre1)
|
||||||
#
|
#
|
||||||
# Copyright (c) 2010 SUSE LINUX Products GmbH, Nuernberg, Germany.
|
# Copyright (c) 2010 SUSE LINUX Products GmbH, Nuernberg, Germany.
|
||||||
#
|
#
|
||||||
@ -28,7 +28,6 @@ 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
|
||||||
Patch1: fix_cache_trigger.patch
|
|
||||||
Group: System/Monitoring
|
Group: System/Monitoring
|
||||||
BuildRoot: %{_tmppath}/%{name}-%{version}-build
|
BuildRoot: %{_tmppath}/%{name}-%{version}-build
|
||||||
|
|
||||||
@ -50,19 +49,19 @@ Authors:
|
|||||||
|
|
||||||
%prep
|
%prep
|
||||||
%setup
|
%setup
|
||||||
%patch1 -p1
|
|
||||||
|
|
||||||
%build
|
%build
|
||||||
make CFLAGS="$RPM_OPT_FLAGS"
|
make CFLAGS="$RPM_OPT_FLAGS"
|
||||||
|
|
||||||
%install
|
%install
|
||||||
export prefix=$RPM_BUILD_ROOT/usr
|
mkdir -p $RPM_BUILD_ROOT/usr/sbin/
|
||||||
export etcprefix=$RPM_BUILD_ROOT
|
mkdir -p $RPM_BUILD_ROOT/%{_mandir}/man8
|
||||||
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
|
||||||
@ -74,10 +73,10 @@ if [ -c /dev/mcelog ];then
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
%preun
|
%preun
|
||||||
%{stop_on_removal mcelog}
|
%stop_on_removal mcelog
|
||||||
|
|
||||||
%postun
|
%postun
|
||||||
%{restart_on_update mcelog}
|
%restart_on_update
|
||||||
%insserv_cleanup
|
%insserv_cleanup
|
||||||
|
|
||||||
%files
|
%files
|
||||||
@ -86,9 +85,6 @@ 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
|
||||||
|
85
mcelog_daemon_create_pid_file.patch
Normal file
85
mcelog_daemon_create_pid_file.patch
Normal file
@ -0,0 +1,85 @@
|
|||||||
|
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