.
OBS-URL: https://build.opensuse.org/package/show/Base:System/sysvinit?expand=0&rev=216
This commit is contained in:
parent
fb512c6276
commit
58045f9e96
@ -1,7 +1,7 @@
|
||||
#
|
||||
# spec file for package powerd
|
||||
#
|
||||
# Copyright (c) 2015 SUSE LINUX Products GmbH, Nuernberg, Germany.
|
||||
# Copyright (c) 2016 SUSE LINUX GmbH, Nuernberg, Germany.
|
||||
#
|
||||
# All modifications and additions to the file contributed by third parties
|
||||
# remain the property of their copyright owners, unless otherwise agreed
|
||||
|
@ -1,78 +0,0 @@
|
||||
From 05c3f60fe02370f4c8d15b996bcc8d6f3dc57e12 Mon Sep 17 00:00:00 2001
|
||||
From: Ludwig Nussel <ludwig.nussel@suse.de>
|
||||
Date: Thu, 21 Jun 2012 09:09:19 +0200
|
||||
Subject: [PATCH] fix deadlock
|
||||
|
||||
writelog() must not call pthread_yield() with the lock held that the
|
||||
main thread tries to get to cancel the writer thread. writelog()
|
||||
on the other hand needs to empty the buffer always to make sure
|
||||
poll() blocks again an doesn't cause a loop.
|
||||
---
|
||||
libconsole.c | 25 +++++++++++++++++--------
|
||||
1 files changed, 17 insertions(+), 8 deletions(-)
|
||||
|
||||
diff --git a/libconsole.c b/libconsole.c
|
||||
index b962032..54b353a 100644
|
||||
--- a/libconsole.c
|
||||
+++ b/libconsole.c
|
||||
@@ -429,21 +429,28 @@ xout:
|
||||
|
||||
static inline void writelog(void)
|
||||
{
|
||||
- if (!flog)
|
||||
+ lock(&llock);
|
||||
+ if (!flog) { /* log file closed, reset buffer */
|
||||
+ resetlog();
|
||||
+ unlock(&llock);
|
||||
return;
|
||||
+ }
|
||||
clearerr(flog);
|
||||
- lock(&llock);
|
||||
while (avail > 0) {
|
||||
size_t ret = (size_t)avail;
|
||||
|
||||
if (avail > TRANS_BUFFER_SIZE)
|
||||
ret = TRANS_BUFFER_SIZE;
|
||||
|
||||
- if (!flog || nsigsys)
|
||||
+ if (!flog || nsigsys) { /* log file closed, reset buffer */
|
||||
+ resetlog();
|
||||
break;
|
||||
+ }
|
||||
ret = fwrite(head, sizeof(unsigned char), ret, flog);
|
||||
- if (!ret && ferror(flog))
|
||||
+ if (!ret && ferror(flog)) { /* cannot write anymore, reset buffer */
|
||||
+ resetlog();
|
||||
break;
|
||||
+ }
|
||||
head += ret;
|
||||
|
||||
if (head >= tail) { /* empty, reset buffer */
|
||||
@@ -498,8 +505,13 @@ static inline int poll(int msec, mutex_t *outer)
|
||||
if (err == ETIMEDOUT || err == EBUSY)
|
||||
ret = 0;
|
||||
}
|
||||
- } else
|
||||
+#if 0
|
||||
+ } else {
|
||||
+ unlock(&ljoin);
|
||||
pthread_yield();
|
||||
+ lock(&ljoin);
|
||||
+#endif
|
||||
+ }
|
||||
|
||||
return ret;
|
||||
}
|
||||
@@ -772,9 +784,6 @@ static void *action(void *dummy attribute((unused)))
|
||||
if (!poll(30, &ljoin))
|
||||
continue;
|
||||
|
||||
- if (!flog)
|
||||
- break;
|
||||
-
|
||||
writelog();
|
||||
}
|
||||
unlock(&ljoin);
|
||||
--
|
||||
1.7.7
|
||||
|
@ -1,122 +0,0 @@
|
||||
--- libconsole.c
|
||||
+++ libconsole.c 2012-08-02 11:45:26.456510085 +0000
|
||||
@@ -358,7 +358,9 @@ static void sigio(int sig)
|
||||
*/
|
||||
|
||||
typedef struct _mutex {
|
||||
- int locked;
|
||||
+ volatile int locked;
|
||||
+ volatile int canceled;
|
||||
+ volatile int used;
|
||||
pthread_mutex_t mutex;
|
||||
pthread_t thread;
|
||||
} mutex_t;
|
||||
@@ -380,8 +382,8 @@ static inline void unlock(mutex_t *mutex
|
||||
}
|
||||
}
|
||||
|
||||
-static mutex_t llock = { 0, PTHREAD_MUTEX_INITIALIZER, 0 };
|
||||
-static mutex_t ljoin = { 0, PTHREAD_MUTEX_INITIALIZER, 0 };
|
||||
+static mutex_t llock = { 0, 0, 1, PTHREAD_MUTEX_INITIALIZER, 0 };
|
||||
+static mutex_t ljoin = { 0, 0, 1, PTHREAD_MUTEX_INITIALIZER, 0 };
|
||||
static pthread_cond_t lcond = PTHREAD_COND_INITIALIZER;
|
||||
static pthread_t lthread;
|
||||
static volatile int running;
|
||||
@@ -429,10 +431,14 @@ xout:
|
||||
|
||||
static inline void writelog(void)
|
||||
{
|
||||
+ int oldstate;
|
||||
+
|
||||
+ pthread_setcancelstate(PTHREAD_CANCEL_DISABLE, &oldstate);
|
||||
lock(&llock);
|
||||
if (!flog) { /* log file closed, reset buffer */
|
||||
resetlog();
|
||||
unlock(&llock);
|
||||
+ pthread_setcancelstate(oldstate, NULL);
|
||||
return;
|
||||
}
|
||||
clearerr(flog);
|
||||
@@ -468,11 +474,12 @@ static inline void writelog(void)
|
||||
fflush(flog);
|
||||
fdatasync(fileno(flog));
|
||||
}
|
||||
+ pthread_setcancelstate(oldstate, NULL);
|
||||
}
|
||||
|
||||
static inline void flushlog(void)
|
||||
{
|
||||
- if (running) pthread_cond_broadcast(&lcond);
|
||||
+ if (ljoin.canceled == 0) pthread_cond_broadcast(&lcond);
|
||||
}
|
||||
|
||||
static inline int poll(int msec, mutex_t *outer)
|
||||
@@ -495,11 +502,13 @@ static inline int poll(int msec, mutex_t
|
||||
abstime.tv_nsec = now.tv_usec * 1000;
|
||||
|
||||
do {
|
||||
- int locked = outer->locked;
|
||||
/* Note: pthread_cond_timedwait() atomically unlocks the mutex */
|
||||
- outer->locked = 0;
|
||||
- err = pthread_cond_timedwait(&lcond, &outer->mutex, &abstime);
|
||||
- outer->locked = locked;
|
||||
+ if (outer->canceled == 0) {
|
||||
+ volatile int locked = outer->locked;
|
||||
+ outer->locked = 0;
|
||||
+ err = pthread_cond_timedwait(&lcond, &outer->mutex, &abstime);
|
||||
+ outer->locked = locked;
|
||||
+ }
|
||||
} while (err == EINTR);
|
||||
|
||||
if (err == ETIMEDOUT || err == EBUSY)
|
||||
@@ -507,9 +516,9 @@ static inline int poll(int msec, mutex_t
|
||||
}
|
||||
#if 0
|
||||
} else {
|
||||
- unlock(&ljoin);
|
||||
+ unlock(&outer->mutex);
|
||||
pthread_yield();
|
||||
- lock(&ljoin);
|
||||
+ lock(&outer->mutex);
|
||||
#endif
|
||||
}
|
||||
|
||||
@@ -789,6 +798,7 @@ static void *action(void *dummy attribut
|
||||
unlock(&ljoin);
|
||||
|
||||
(void)pthread_sigmask(SIG_SETMASK, &save_oldset, NULL);
|
||||
+ ljoin.used = 0;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
@@ -1004,6 +1014,8 @@ void closeIO(void)
|
||||
(void)tcdrain(c->fd); /* Hold in sync with console */
|
||||
}
|
||||
|
||||
+ flushlog();
|
||||
+
|
||||
do {
|
||||
/*
|
||||
* Repeat this as long as required,
|
||||
@@ -1020,14 +1032,19 @@ void closeIO(void)
|
||||
more_input(&timeout, 1);
|
||||
(void)tcdrain(fdread);
|
||||
|
||||
+ flushlog();
|
||||
+
|
||||
} while (timeout.tv_sec || timeout.tv_nsec);
|
||||
|
||||
if (running) {
|
||||
lock(&ljoin);
|
||||
running = 0;
|
||||
unlock(&ljoin);
|
||||
- flushlog();
|
||||
- pthread_cancel(lthread);
|
||||
+ ljoin.canceled = 1;
|
||||
+ pthread_cond_broadcast(&lcond);
|
||||
+ pthread_yield();
|
||||
+ if (ljoin.used && lthread)
|
||||
+ pthread_cancel(lthread);
|
||||
}
|
||||
|
||||
if (flog) {
|
@ -1,19 +0,0 @@
|
||||
--- libconsole.c
|
||||
+++ libconsole.c 2012-03-01 09:49:44.493932912 +0000
|
||||
@@ -902,16 +902,6 @@ void safeIO (void)
|
||||
#ifdef DEBUG_SIGIO
|
||||
if (nsigio < 0)
|
||||
goto skip;
|
||||
-#else
|
||||
- if (nsigio < 0) {
|
||||
- /*
|
||||
- * Maybe access() does lie under kernel 2.6
|
||||
- * or the root file system is rw mounted
|
||||
- */
|
||||
- const char *runlevel = getenv("RUNLEVEL");
|
||||
- if (runlevel && (*runlevel < '0' || *runlevel > '6'))
|
||||
- goto skip;
|
||||
- }
|
||||
#endif
|
||||
if (access(BOOT_LOGFILE, W_OK) < 0) {
|
||||
if (errno != ENOENT && errno != EROFS)
|
@ -1,3 +0,0 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:578c8f49c393790150d9028755f44634a78bac4b0147879e0f2b065afcac5c46
|
||||
size 25738
|
@ -1,3 +1,8 @@
|
||||
-------------------------------------------------------------------
|
||||
Thu Jan 21 11:35:01 UTC 2016 - werner@suse.de
|
||||
|
||||
- Split off showconsole as its separate package called blog
|
||||
|
||||
-------------------------------------------------------------------
|
||||
Fri Dec 4 15:24:01 UTC 2015 - sweet_f_a@gmx.de
|
||||
|
||||
|
@ -1,7 +1,7 @@
|
||||
#
|
||||
# spec file for package sysvinit
|
||||
#
|
||||
# Copyright (c) 2015 SUSE LINUX Products GmbH, Nuernberg, Germany.
|
||||
# Copyright (c) 2016 SUSE LINUX GmbH, Nuernberg, Germany.
|
||||
#
|
||||
# All modifications and additions to the file contributed by third parties
|
||||
# remain the property of their copyright owners, unless otherwise agreed
|
||||
@ -26,13 +26,13 @@ Release: 0
|
||||
Summary: SysV-Style init
|
||||
License: GPL-2.0+
|
||||
Group: System/Base
|
||||
BuildRequires: blog-devel
|
||||
BuildRoot: %{_tmppath}/%{name}-%{version}-build
|
||||
#!BuildIgnore: sysvinit-tools
|
||||
Url: http://savannah.nongnu.org/projects/sysvinit/
|
||||
Source: sysvinit-%{SIVER}dsf.tar.bz2
|
||||
Source2: killproc-%{KPVER}.tar.bz2
|
||||
Source4: showconsole-%{SCVER}.tar.bz2
|
||||
Source5: startpar-%{START}.tar.bz2
|
||||
Source1: killproc-%{KPVER}.tar.bz2
|
||||
Source2: startpar-%{START}.tar.bz2
|
||||
Patch: %{name}-%{version}dsf.dif
|
||||
Patch2: %{name}-2.88dsf-suse.patch
|
||||
Patch3: %{name}-2.88dsf-scripts2.patch
|
||||
@ -43,9 +43,6 @@ Patch11: %{name}-%{version}dsf-dostat.patch
|
||||
Patch12: %{name}-%{version}dsf-sulogin.diff
|
||||
Patch30: killproc-%{KPVER}.dif
|
||||
Patch31: killproc-2.18-open_flags.dif
|
||||
Patch40: showconsole-%{SCVER}.dif
|
||||
Patch41: showconsole-1.16-deadlock.diff
|
||||
Patch42: showconsole-1.16-glibc.dif
|
||||
Patch50: startpar-%{START}.dif
|
||||
|
||||
%description
|
||||
@ -61,6 +58,7 @@ more information.
|
||||
%package tools
|
||||
Summary: Tools for basic booting
|
||||
Group: System/Base
|
||||
Requires: blog
|
||||
|
||||
%description tools
|
||||
Helper tools from sysvinit that support booting, including but not exclusive
|
||||
@ -68,7 +66,7 @@ to startpar, killproc and pidof. System V init specific programs are in the
|
||||
sysvinit package.
|
||||
|
||||
%prep
|
||||
%setup -n %{name}-%{SIVER}dsf -q -b 2 -b 4 -b 5
|
||||
%setup -n %{name}-%{SIVER}dsf -q -b 1 -b 2
|
||||
%patch2 -p0 -b .suse
|
||||
%patch3 -p0 -b .scripts2
|
||||
%patch4 -p0 -b .pam
|
||||
@ -77,19 +75,13 @@ sysvinit package.
|
||||
%patch12 -p0 -b .ka5
|
||||
%patch
|
||||
pushd doc
|
||||
mkdir killproc showconsole
|
||||
mkdir killproc
|
||||
popd
|
||||
pushd ../killproc-%{KPVER}
|
||||
%patch30
|
||||
%patch31 -p0 -b .dialog
|
||||
ln -t../%{name}-%{SIVER}dsf/doc/killproc README
|
||||
popd
|
||||
pushd ../showconsole-%{SCVER}
|
||||
%patch40
|
||||
%patch41 -p1
|
||||
%patch42 -p0
|
||||
ln -t../%{name}-%{SIVER}dsf/doc/showconsole README
|
||||
popd
|
||||
pushd ../startpar-%{START}
|
||||
%patch50
|
||||
popd
|
||||
@ -102,21 +94,15 @@ popd
|
||||
CC=%__cc
|
||||
export RPM_OPT_FLAGS CC
|
||||
make %{?_smp_mflags} WITH_SELINUX=yes DISTRO=SuSE
|
||||
pushd ../showconsole-%{SCVER}
|
||||
pushd ../killproc-%{KPVER}
|
||||
make %{?_smp_mflags} CC="%__cc"
|
||||
popd
|
||||
pushd ../killproc-%{KPVER}
|
||||
make %{?_smp_mflags} INC="-I../showconsole-%{SCVER} -L../showconsole-%{SCVER}" CC="%__cc"
|
||||
popd
|
||||
pushd ../startpar-%{START}
|
||||
make %{?_smp_mflags} INC="-I../showconsole-%{SCVER} -L../showconsole-%{SCVER}" CC="%__cc"
|
||||
make %{?_smp_mflags} CC="%__cc"
|
||||
popd
|
||||
|
||||
%install
|
||||
make install -C src MANPATH=%{_mandir} ROOT=%{buildroot} DISTRO=SuSE
|
||||
pushd ../showconsole-%{SCVER}
|
||||
make install MANPATH=%{_mandir} INSTBINFLAGS="-m 0700" DESTDIR=%{buildroot}
|
||||
popd
|
||||
pushd ../killproc-%{KPVER}
|
||||
make install MANPATH=%{_mandir} INSTBINFLAGS="-m 0755" DESTDIR=%{buildroot}
|
||||
popd
|
||||
@ -126,24 +112,17 @@ popd
|
||||
#
|
||||
# Remove files not packed:
|
||||
#
|
||||
rm %{buildroot}/usr/include/{initreq.h,libblogger.h}
|
||||
rm %{buildroot}/usr/lib/libblogger.a
|
||||
chmod 444 %{buildroot}%{_mandir}/man?/*
|
||||
rm -vf %{buildroot}/usr/include/initreq.h
|
||||
|
||||
%files tools
|
||||
%defattr (-,root,root,755)
|
||||
%doc COPYING COPYRIGHT doc/Propaganda
|
||||
%doc doc/Changelog doc/killproc doc/showconsole
|
||||
%doc doc/Changelog doc/killproc
|
||||
%config /etc/pam.d/init
|
||||
/bin/pidof
|
||||
/bin/usleep
|
||||
/bin/fsync
|
||||
/sbin/blogger
|
||||
/sbin/blogd
|
||||
/sbin/fstab-decode
|
||||
/sbin/showconsole
|
||||
/sbin/setconsole
|
||||
/sbin/isserial
|
||||
/sbin/checkproc
|
||||
/sbin/pidofproc
|
||||
/sbin/killproc
|
||||
@ -157,14 +136,7 @@ popd
|
||||
/sbin/start_daemon
|
||||
%doc %{_mandir}/man1/usleep.1.gz
|
||||
%doc %{_mandir}/man1/fsync.1.gz
|
||||
# /usr/include/libblogger.h
|
||||
# /usr/lib/libblogger.a
|
||||
%doc %{_mandir}/man8/blogger.8.gz
|
||||
%doc %{_mandir}/man8/blogd.8.gz
|
||||
%doc %{_mandir}/man8/fstab-decode.8.gz
|
||||
%doc %{_mandir}/man8/showconsole.8.gz
|
||||
%doc %{_mandir}/man8/setconsole.8.gz
|
||||
%doc %{_mandir}/man8/isserial.8.gz
|
||||
%doc %{_mandir}/man8/checkproc.8.gz
|
||||
%doc %{_mandir}/man8/pidofproc.8.gz
|
||||
%doc %{_mandir}/man8/killall5.8.gz
|
||||
|
Loading…
x
Reference in New Issue
Block a user