Hello community,
here is the log from the commit of package sysvinit for openSUSE:Factory
checked in at Fri Aug 21 17:42:21 CEST 2009.
--------
--- sysvinit/sysvinit.changes 2009-07-28 16:51:32.000000000 +0200
+++ sysvinit/sysvinit.changes 2009-08-20 14:22:05.000000000 +0200
@@ -1,0 +2,10 @@
+Thu Aug 20 14:17:32 CEST 2009 - werner@suse.de
+
+- Make a new showconsole version 1.10
+ * Add time stamps to blogger API (fate #305596)
+ * Add newline before writing out blogger fifo content
+- Make a new startpar version 0.52
+ * Use blogd API (fate #305596)
+- Make a new killproc version 2.16
+
+-------------------------------------------------------------------
calling whatdependson for head-i586
Old:
----
killproc-2.15.dif
killproc-2.15.tar.bz2
showconsole-1.09-blogd-coarse-locking.diff
showconsole-1.09.dif
showconsole-1.09.tar.bz2
startpar-0.53.dif
startpar-0.53.tar.bz2
startpar-bootchart.diff
startpar-preload.diff
New:
----
killproc-2.16.dif
killproc-2.16.tar.bz2
showconsole-1.10.dif
showconsole-1.10.tar.bz2
startpar-0.54.dif
startpar-0.54.tar.bz2
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Other differences:
------------------
++++++ sysvinit.spec ++++++
--- /var/tmp/diff_new_pack.TmL1xl/_old 2009-08-21 17:40:22.000000000 +0200
+++ /var/tmp/diff_new_pack.TmL1xl/_new 2009-08-21 17:40:22.000000000 +0200
@@ -21,24 +21,24 @@
Name: sysvinit
%define MGVER 0.9.6s
%define PDVER 2.0.2
-%define KPVER 2.15
-%define SCVER 1.09
+%define KPVER 2.16
+%define SCVER 1.10
%define SIVER 2.86
-%define START 0.53
+%define START 0.54
License: GPL v2 or later
Group: System/Base
PreReq: coreutils
AutoReqProv: on
Version: 2.86
-Release: 212
+Release: 213
Summary: SysV-Style init
BuildRoot: %{_tmppath}/%{name}-%{version}-build
BuildRequires: libselinux-devel libsepol-devel
Source: sysvinit-2.86.tar.bz2
-Source2: killproc-2.15.tar.bz2
+Source2: killproc-2.16.tar.bz2
Source3: powerd-2.0.2.tar.bz2
-Source4: showconsole-1.09.tar.bz2
-Source5: startpar-0.53.tar.bz2
+Source4: showconsole-1.10.tar.bz2
+Source5: startpar-0.54.tar.bz2
Source6: rc.powerd
Source7: sysvinit-rpmlintrc
Source8: mkinitrd-boot.sh
@@ -47,25 +47,22 @@
Patch: sysvinit-2.86.dif
Patch1: sysvinit-2.86-nfs4pidof.patch
Patch2: powerd-2.0.2.dif
-Patch3: killproc-2.15.dif
+Patch3: killproc-2.16.dif
Patch5: sysvinit-2.86-sulogin.patch
Patch6: sysvinit-2.82-startstop.patch
Patch7: sysvinit-2.85-suse.patch
Patch8: sysvinit-2.85-paths.patch
Patch9: sysvinit-2.86-utmp.patch
-Patch10: showconsole-1.09.dif
+Patch10: showconsole-1.10.dif
Patch11: sysvinit-2.86-race.patch
Patch12: sysvinit-2.86-lib64.patch
Patch13: sysvinit-2.82-multiline.patch
-Patch14: startpar-0.53.dif
+Patch14: startpar-0.54.dif
Patch15: sysvinit-2.86-usage-message.patch
Patch16: sysvinit-2.86-full-time.patch
Patch17: sysvinit-2.86-hddown.patch
Patch18: sysvinit-2.86-selinux.patch
Patch19: sysvinit-2.86-fuse-no-kill.patch
-Patch20: startpar-preload.diff
-Patch21: startpar-bootchart.diff
-Patch22: showconsole-1.09-blogd-coarse-locking.diff
%description
System V style init programs by Miquel van Smoorenburg that control the
@@ -110,12 +107,9 @@
popd
pushd ../showconsole-%{SCVER}
%patch -P 10
-%patch -P 22 -p1
popd
pushd ../startpar-%{START}
%patch -P 14
-%patch -P 20
-%patch -P 21
popd
%_fixowner .
%_fixgroup .
@@ -145,7 +139,7 @@
%endif
popd
pushd ../startpar-%{START}
- make CFLAGS="$CFLAGS"
+ make INC="-I../showconsole-%{SCVER} -L../showconsole-%{SCVER}"
popd
%install
++++++ killproc-2.15.dif -> killproc-2.16.dif ++++++
--- sysvinit/killproc-2.15.dif 2009-05-27 13:27:36.000000000 +0200
+++ sysvinit/killproc-2.16.dif 2009-08-20 14:22:02.000000000 +0200
@@ -1,128 +1,4 @@
---- Makefile
-+++ Makefile 2009-05-27 12:05:43.117901008 +0200
-@@ -27,6 +27,7 @@ endif
- #
- # egcs used with -O2 includes -fno-force-mem which is/was buggy (1998/10/08)
- #
-+ LDFLAGS = -Wl,--as-needed,--hash-size=8599,-O2
- CFLAGS = $(RPM_OPT_FLAGS) $(COPTS) $(DEBUG) $(INC) -D_GNU_SOURCE -Wall -pipe
- CLOOP = -funroll-loops
- CC = gcc
-@@ -80,13 +81,13 @@ sig.def:
- done
-
- killproc: killproc.c libinit.o
-- $(CC) $(CFLAGS) $(CLOOP) -o $@ $^ $(LIBS)
-+ $(CC) $(CFLAGS) $(CLOOP) $(LDFLAGS) -o $@ $^ $(LIBS)
-
- startproc: startproc.c libinit.o
-- $(CC) $(CFLAGS) $(CLOOP) -o $@ $^ $(LIBS)
-+ $(CC) $(CFLAGS) $(CLOOP) $(LDFLAGS) -o $@ $^ $(LIBS)
-
- checkproc: checkproc.c libinit.o
-- $(CC) $(CFLAGS) $(CLOOP) -o $@ $^ $(LIBS)
-+ $(CC) $(CFLAGS) $(CLOOP) $(LDFLAGS) -o $@ $^ $(LIBS)
-
- usleep: usleep.c
- $(CC) $(CFLAGS) -o $@ $^
---- mkill.c
-+++ mkill.c 2009-04-29 12:55:49.480409712 +0200
-@@ -100,6 +100,7 @@ int main(int argc, char* argv[])
- {
- const pid_t pid = getpid();
- const pid_t sid = getsid(0);
-+ const pid_t ppid = getppid();
- proc_t * this, *ptr, * last;
- struct dirent * dent;
- int dfd, num, nsig = SIGTERM;
-@@ -210,6 +211,9 @@ int main(int argc, char* argv[])
- if (sid == curr)
- continue;
-
-+ if (ppid == curr)
-+ continue;
-+
- found = false;
-
- strcpy(path, dent->d_name);
-@@ -308,6 +312,8 @@ int main(int argc, char* argv[])
- for (ptr = procs; this; ptr = this) {
- last = ptr->prev;
- this = ptr->next;
-+ if (ptr->pid != curr)
-+ continue;
- if (ptr == procs) {
- if (this) this->prev = (proc_t*)0;
- procs = this;
---- usleep.c
-+++ usleep.c 2009-04-30 11:40:00.065901445 +0200
-@@ -20,20 +20,25 @@
- #ifdef __NO_STRING_INLINES
- # undef __NO_STRING_INLINES
- #endif
-+#include
-+#include
- #include
--#include
-+#include
-+#include
- #include
- #include
-+#include
-+#include
-+#include
-+#include
- #include
--#ifdef _POSIX_PRIORITY_SCHEDULING
--# include
--#endif
- #define USAGE "Usage:\t%s [ microseconds ]\n", we_are
-
- static char *we_are;
- int main(int argc, char **argv)
- {
- unsigned long int usec = 1;
-+ int fd;
-
- if (argc > 2)
- goto err;
-@@ -45,12 +50,35 @@ int main(int argc, char **argv)
- goto err;
- }
-
-- if (usec)
-+ if ((fd = open("/dev/null", O_RDWR|O_NOCTTY|O_CLOEXEC)) >= 0) {
-+ dup2(fd, 0);
-+ dup2(fd, 1);
-+ dup2(fd, 2);
-+ if (fd > 2) close(fd);
-+ }
-+
-+ if (usec) {
-+#if defined(_POSIX_C_SOURCE) && (_POSIX_C_SOURCE >= 199309L)
-+ struct timespec req = {0, 0}, rem = {0, 0};
-+ int ret;
-+
-+ while (usec >= 1000000UL) {
-+ req.tv_sec++;
-+ usec -= 1000000UL;
-+ }
-+ req.tv_nsec = usec * 1000;
-+
-+ do {
-+ ret = nanosleep(&req, &rem);
-+ if (ret == 0 || errno != EINTR)
-+ break;
-+ req = rem;
-+ } while (req.tv_nsec > 0 || req.tv_sec > 0);
-+#else
- usleep(usec);
--#ifdef _POSIX_PRIORITY_SCHEDULING
-- else
-- (void)sched_yield();
- #endif
-+ } else
-+ (void)sched_yield();
- _exit(0);
-
- /* Do this at the end for speed */
+--- .dummy
++++ .dummy 2009-08-19 12:18:39.181901099 +0200
+@@ -0,0 +1 @@
++this is a dummy, remove if real changes are required
++++++ killproc-2.15.tar.bz2 -> killproc-2.16.tar.bz2 ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/killproc-2.15/Makefile new/killproc-2.16/Makefile
--- old/killproc-2.15/Makefile 2009-03-26 18:41:22.000000000 +0100
+++ new/killproc-2.16/Makefile 2009-08-20 14:04:40.000000000 +0200
@@ -12,7 +12,7 @@
PREFIX = /usr
DEBUG =
DESTDIR =
-VERSION = 2.15
+VERSION = 2.16
DATE = $(shell date +'%d%b%y' | tr '[:lower:]' '[:upper:]')
ifneq ($(INC),)
@@ -27,6 +27,7 @@
#
# egcs used with -O2 includes -fno-force-mem which is/was buggy (1998/10/08)
#
+ LDFLAGS = -Wl,--as-needed,--hash-size=8599,-O2
CFLAGS = $(RPM_OPT_FLAGS) $(COPTS) $(DEBUG) $(INC) -D_GNU_SOURCE -Wall -pipe
CLOOP = -funroll-loops
CC = gcc
@@ -80,13 +81,13 @@
done
killproc: killproc.c libinit.o
- $(CC) $(CFLAGS) $(CLOOP) -o $@ $^ $(LIBS)
+ $(CC) $(CFLAGS) $(CLOOP) $(LDFLAGS) -o $@ $^ $(LIBS)
startproc: startproc.c libinit.o
- $(CC) $(CFLAGS) $(CLOOP) -o $@ $^ $(LIBS)
+ $(CC) $(CFLAGS) $(CLOOP) $(LDFLAGS) -o $@ $^ $(LIBS)
checkproc: checkproc.c libinit.o
- $(CC) $(CFLAGS) $(CLOOP) -o $@ $^ $(LIBS)
+ $(CC) $(CFLAGS) $(CLOOP) $(LDFLAGS) -o $@ $^ $(LIBS)
usleep: usleep.c
$(CC) $(CFLAGS) -o $@ $^
@@ -173,9 +174,9 @@
Copying-policy: GPL\n\
End" | sed 's@^ @@g;s@^x@@g' > killproc-$(VERSION).lsm
cp $(FILES) killproc-$(VERSION)
- tar -c -zf killproc-$(VERSION).tar.gz killproc-$(VERSION)/
+ tar -cps -jf killproc-$(VERSION).tar.bz2 killproc-$(VERSION)/
$(RMDIR) killproc-$(VERSION)
- set -- `gzip -l killproc-$(VERSION).tar.gz | tail -1` ; \
+ set -- `find killproc-$(VERSION).tar.bz2 -printf '%s'` ; \
sed "s:@UNKNOWN:$$1:" < killproc-$(VERSION).lsm > \
killproc-$(VERSION).lsm.tmp ; \
mv killproc-$(VERSION).lsm.tmp killproc-$(VERSION).lsm
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/killproc-2.15/killproc-2.15.lsm new/killproc-2.16/killproc-2.15.lsm
--- old/killproc-2.15/killproc-2.15.lsm 2009-03-26 18:41:22.000000000 +0100
+++ new/killproc-2.16/killproc-2.15.lsm 1970-01-01 01:00:00.000000000 +0100
@@ -1,18 +0,0 @@
-Begin3
-Title: killproc and assorted tools for boot scripts
-Version: 2.15
-Entered-date: 26MAR09
-Description: Some useful programs for a replacment of the shell functions
- daemom and killproc found in the Linux System V init suite.
- killproc(8) for signaling or terminating, checkproc(8) for
- checking and startproc(8) for starting processes.
- Each program has its own manual page.
-Keywords: killproc, startproc, checkproc, process control
-Author: Werner Fink
-Maintained-by: Werner Fink
-Primary-site: sunsite.unc.edu /pub/Linux/system/daemons/init
- @UNKNOWN killproc-2.15.tar.gz
-Alternate-site: ftp.suse.com /pub/projects/init
-Platforms: Linux with System VR2 or higher boot scheme
-Copying-policy: GPL
-End
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/killproc-2.15/killproc-2.16.lsm new/killproc-2.16/killproc-2.16.lsm
--- old/killproc-2.15/killproc-2.16.lsm 1970-01-01 01:00:00.000000000 +0100
+++ new/killproc-2.16/killproc-2.16.lsm 2009-08-20 14:04:40.000000000 +0200
@@ -0,0 +1,18 @@
+Begin3
+Title: killproc and assorted tools for boot scripts
+Version: 2.16
+Entered-date: 20AUG09
+Description: Some useful programs for a replacment of the shell functions
+ daemom and killproc found in the Linux System V init suite.
+ killproc(8) for signaling or terminating, checkproc(8) for
+ checking and startproc(8) for starting processes.
+ Each program has its own manual page.
+Keywords: killproc, startproc, checkproc, process control
+Author: Werner Fink
+Maintained-by: Werner Fink
+Primary-site: sunsite.unc.edu /pub/Linux/system/daemons/init
+ @UNKNOWN killproc-2.16.tar.gz
+Alternate-site: ftp.suse.com /pub/projects/init
+Platforms: Linux with System VR2 or higher boot scheme
+Copying-policy: GPL
+End
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/killproc-2.15/mkill.c new/killproc-2.16/mkill.c
--- old/killproc-2.15/mkill.c 2009-03-26 18:41:22.000000000 +0100
+++ new/killproc-2.16/mkill.c 2009-08-20 14:04:40.000000000 +0200
@@ -100,6 +100,7 @@
{
const pid_t pid = getpid();
const pid_t sid = getsid(0);
+ const pid_t ppid = getppid();
proc_t * this, *ptr, * last;
struct dirent * dent;
int dfd, num, nsig = SIGTERM;
@@ -210,6 +211,9 @@
if (sid == curr)
continue;
+ if (ppid == curr)
+ continue;
+
found = false;
strcpy(path, dent->d_name);
@@ -308,6 +312,8 @@
for (ptr = procs; this; ptr = this) {
last = ptr->prev;
this = ptr->next;
+ if (ptr->pid != curr)
+ continue;
if (ptr == procs) {
if (this) this->prev = (proc_t*)0;
procs = this;
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/killproc-2.15/usleep.c new/killproc-2.16/usleep.c
--- old/killproc-2.15/usleep.c 2009-03-26 18:41:22.000000000 +0100
+++ new/killproc-2.16/usleep.c 2009-08-20 14:04:40.000000000 +0200
@@ -20,20 +20,25 @@
#ifdef __NO_STRING_INLINES
# undef __NO_STRING_INLINES
#endif
+#include
+#include
#include
-#include
+#include
+#include
#include
#include
+#include
+#include
+#include
+#include
#include
-#ifdef _POSIX_PRIORITY_SCHEDULING
-# include
-#endif
#define USAGE "Usage:\t%s [ microseconds ]\n", we_are
static char *we_are;
int main(int argc, char **argv)
{
unsigned long int usec = 1;
+ int fd;
if (argc > 2)
goto err;
@@ -45,12 +50,35 @@
goto err;
}
- if (usec)
+ if ((fd = open("/dev/null", O_RDWR|O_NOCTTY|O_CLOEXEC)) >= 0) {
+ dup2(fd, 0);
+ dup2(fd, 1);
+ dup2(fd, 2);
+ if (fd > 2) close(fd);
+ }
+
+ if (usec) {
+#if defined(_POSIX_C_SOURCE) && (_POSIX_C_SOURCE >= 199309L)
+ struct timespec req = {0, 0}, rem = {0, 0};
+ int ret;
+
+ while (usec >= 1000000UL) {
+ req.tv_sec++;
+ usec -= 1000000UL;
+ }
+ req.tv_nsec = usec * 1000;
+
+ do {
+ ret = nanosleep(&req, &rem);
+ if (ret == 0 || errno != EINTR)
+ break;
+ req = rem;
+ } while (req.tv_nsec > 0 || req.tv_sec > 0);
+#else
usleep(usec);
-#ifdef _POSIX_PRIORITY_SCHEDULING
- else
- (void)sched_yield();
#endif
+ } else
+ (void)sched_yield();
_exit(0);
/* Do this at the end for speed */
++++++ showconsole-1.09.dif -> showconsole-1.10.dif ++++++
--- sysvinit/showconsole-1.09.dif 2009-05-04 14:04:37.000000000 +0200
+++ sysvinit/showconsole-1.10.dif 2009-08-20 14:22:01.000000000 +0200
@@ -1,227 +1,4 @@
---- Makefile
-+++ Makefile 2009-05-04 12:21:20.643778409 +0200
-@@ -71,10 +71,10 @@ libblogger.a: libblogger.o
- $(AR) $@ $^
-
- showconsole: showconsole.c libconsole.o
-- $(CC) $(CFLAGS) $(CLOOP) -o $@ $^ -pthread
-+ $(CC) $(CFLAGS) $(CLOOP) -o $@ $^ -Wl,--as-needed -pthread
-
- blogd: blogd.c libconsole.o
-- $(CC) $(CFLAGS) $(CLOOP) -o $@ $^ -lutil -pthread
-+ $(CC) $(CFLAGS) $(CLOOP) -o $@ $^ -Wl,--as-needed -lutil -pthread
-
- blogger: blogger.c libblogger.a
- $(CC) $(CFLAGS) $(CLOOP) -o $@ $^
---- blogd.c
-+++ blogd.c 2009-05-04 12:04:11.566915578 +0200
-@@ -220,10 +220,12 @@ int main(int argc, char *argv[])
- {
- int fd, fd2, flags;
- int ptm, pts, cntrtty = 1;
-- pid_t pid, ppid = getppid();
-+ const pid_t ppid = getppid();
-+ const pid_t pgrp = getpgid(ppid);
- char ptsname[NAME_MAX+1];
- struct termios t;
- struct winsize w;
-+ pid_t pid;
- time_t tt;
- char *stt, *name = ttyname(0);
-
-@@ -276,7 +278,7 @@ int main(int argc, char *argv[])
- if (!w.ws_row)
- w.ws_row = 24;
- if (!w.ws_col)
-- w.ws_row = 80;
-+ w.ws_col = 80;
-
- fd2 = -1;
- do {
-@@ -337,6 +339,7 @@ int main(int argc, char *argv[])
- dup2(ptm, 0);
- dup2(fd, 1);
- dup2(fd, 2);
-+ close(pts);
- close(ptm);
- if (fd > 2)
- close(fd);
-@@ -362,7 +365,7 @@ int main(int argc, char *argv[])
- exit(0);
- }
- pidfile();
-- prepareIO(reconnect, 0, 1, fd2);
-+ prepareIO(reconnect, pgrp, 0, 1, fd2);
- while (!signaled)
- safeIO();
-
-@@ -380,9 +383,6 @@ int main(int argc, char *argv[])
- close(1);
- (void)tcflush(2, TCOFLUSH);
- close(2);
--
-- (void)tcflush(pts, TCIOFLUSH);
-- close(pts);
- (void)tcflush(0, TCIFLUSH);
- close(0);
- rmfpid();
---- libconsole.c
-+++ libconsole.c 2009-05-04 12:06:34.477901880 +0200
-@@ -15,6 +15,7 @@
- #include /* Defines the macros major and minor */
- #include
- #include
-+#include
- #include
- #include
- #include
-@@ -215,7 +216,7 @@ static inline void safeout (int fd, cons
- /*
- * Twice used: safe in
- */
--static inline ssize_t safein (int fd, char *ptr, size_t s)
-+static inline ssize_t safein (int fd, char *ptr, size_t s, const int noerr)
- {
- int saveerr = errno;
- ssize_t r = 0;
-@@ -223,7 +224,7 @@ static inline ssize_t safein (int fd, c
- static int repeated;
-
- if (s > SSIZE_MAX)
-- error("Can not read from fd %d: %m", fd, strerror(EINVAL));
-+ s = SSIZE_MAX;
-
- if ((ioctl(fd, FIONREAD, &t) < 0) || (t == 0)) {
- fd_set check;
-@@ -242,8 +243,11 @@ static inline ssize_t safein (int fd, c
- } while (r < 0 && (errno == EINTR || errno == EAGAIN));
-
- /* Do not exit on a broken FIFO */
-- if (r < 0 && errno != EPIPE)
-+ if (r < 0 && errno != EPIPE) {
-+ if (noerr)
-+ goto out;
- error("Can not read from fd %d: %s\n", fd, STRERR);
-+ }
-
- goto out;
- }
-@@ -261,6 +265,8 @@ static inline ssize_t safein (int fd, c
- errno = 0;
- continue;
- }
-+ if (noerr)
-+ goto out;
- error("Can not read from fd %d: %s\n", fd, STRERR);
- }
- repeated = 0;
-@@ -724,10 +730,12 @@ static void *action(void *dummy)
- * Prepare I/O
- */
- static const char *fifo_name = _PATH_BLOG_FIFO;
-+static pid_t pgroup = -1;
-
--void prepareIO(void (*rfunc)(int), const int in, const int out, const int second)
-+void prepareIO(void (*rfunc)(int), const pid_t pgrp, const int in, const int out, const int second)
- {
- vc_reconnect = rfunc;
-+ pgroup = pgrp;
- fdread = in;
- fdwrite = out;
- fdsec = second;
-@@ -744,12 +752,13 @@ void prepareIO(void (*rfunc)(int), const
- warn("can not open named fifo %s: %s\n", fifo_name, STRERR);
- }
- }
-+ (void)mlockall(MCL_FUTURE);
- }
-
- /*
- * Seek for input, more input ...
- */
--static void more_input (struct timeval *timeout)
-+static void more_input (struct timeval *timeout, const int noerr)
- {
- fd_set watch;
- int nfds, wfds;
-@@ -777,10 +786,20 @@ static void more_input (struct timeval *
- goto nothing;
-
- if (FD_ISSET(fdread, &watch)) {
-- const ssize_t cnt = safein(fdread, (char*)trans, sizeof(trans));
-+ const ssize_t cnt = safein(fdread, (char*)trans, sizeof(trans), noerr);
-+ static struct winsize owz;
-+ struct winsize wz;
-
- if (cnt > 0) {
-- parselog(trans, cnt); /* Parse and make copy of the input */
-+ if (ioctl(fdwrite, TIOCGWINSZ, &wz) == 0) {
-+ if (memcmp(&owz, &wz, sizeof(struct winsize))) {
-+ ioctl(fdread, TIOCSWINSZ, &wz);
-+ (void)memcpy(&owz, &wz, sizeof(struct winsize));
-+ if (pgroup > 1)
-+ killpg(pgroup, SIGWINCH);
-+ }
-+ }
-+ parselog(trans, cnt); /* Parse and make copy of the input */
-
- safeout(fdwrite, (char*)trans, cnt); /* Write copy of input to real tty */
- (void)tcdrain(fdwrite);
-@@ -795,7 +814,7 @@ static void more_input (struct timeval *
- }
-
- if (fdfifo > 0 && FD_ISSET(fdfifo, &watch)) {
-- const ssize_t cnt = safein(fdfifo, (char*)trans, sizeof(trans));
-+ const ssize_t cnt = safein(fdfifo, (char*)trans, sizeof(trans), noerr);
-
- if (cnt > 0) {
- copylog(trans, cnt); /* Make copy of the input */
-@@ -873,7 +892,7 @@ skip:
-
- timeout.tv_sec = 5;
- timeout.tv_usec = 0;
-- more_input(&timeout);
-+ more_input(&timeout, 0);
-
- if (flog && !running) {
- int policy = SCHED_RR;
-@@ -895,7 +914,7 @@ skip:
- void closeIO(void)
- {
- struct timeval timeout;
-- int n = 6;
-+ int n = 240;
-
- /* Maybe we've catched a signal, therefore */
- if (flog) {
-@@ -918,9 +937,9 @@ void closeIO(void)
- n--;
-
- timeout.tv_sec = 0;
-- timeout.tv_usec = 5*100*1000; /* A half second */
-+ timeout.tv_usec = 25*1000;
-
-- more_input(&timeout);
-+ more_input(&timeout, 1);
-
- if (!flog)
- break;
-@@ -968,7 +987,7 @@ static void ctty(pid_t pid, unsigned int
- sprintf(fetched, "/proc/%d/stat", (int)pid);
- if ((fd = open(fetched, O_RDONLY|O_NOCTTY)) < 0)
- error("can not open(%s): %s\n", fetched, STRERR);
-- cnt = safein(fd, fetched, sizeof(fetched));
-+ cnt = safein(fd, fetched, sizeof(fetched), 0);
- close(fd);
-
- if (cnt <= 0)
---- libconsole.h
-+++ libconsole.h 2008-06-13 13:31:59.302034000 +0200
-@@ -2,6 +2,6 @@ extern void pushd(const char * path);
- extern void popd(void);
- extern char * fetchtty(const pid_t pid, const pid_t ppid, unsigned int *mjmi);
- extern char * secondtty(char * compare);
--extern void prepareIO(void (*rfunc)(int), const int in, const int out, const int second);
-+extern void prepareIO(void (*rfunc)(int), const pid_t pgrp, const int in, const int out, const int second);
- extern void safeIO (void);
- extern void closeIO(void);
+--- .dummy
++++ .dummy 2009-08-19 12:18:39.181901099 +0200
+@@ -0,0 +1 @@
++this is a dummy, remove if real changes are required
++++++ showconsole-1.09.tar.bz2 -> showconsole-1.10.tar.bz2 ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/showconsole-1.09/Makefile new/showconsole-1.10/Makefile
--- old/showconsole-1.09/Makefile 2008-03-13 16:45:14.000000000 +0100
+++ new/showconsole-1.10/Makefile 2009-08-20 11:28:54.000000000 +0200
@@ -13,7 +13,7 @@
#DESTDIR = /tmp/root
DEBUG =
DESTDIR =
-VERSION = 1.09
+VERSION = 1.10
DATE = $(shell date +'%d%b%y' | tr '[:lower:]' '[:upper:]')
COPTS =
@@ -71,10 +71,10 @@
$(AR) $@ $^
showconsole: showconsole.c libconsole.o
- $(CC) $(CFLAGS) $(CLOOP) -o $@ $^ -pthread
+ $(CC) $(CFLAGS) $(CLOOP) -o $@ $^ -Wl,--as-needed -pthread
blogd: blogd.c libconsole.o
- $(CC) $(CFLAGS) $(CLOOP) -o $@ $^ -lutil -pthread
+ $(CC) $(CFLAGS) $(CLOOP) -o $@ $^ -Wl,--as-needed -lutil -pthread
blogger: blogger.c libblogger.a
$(CC) $(CFLAGS) $(CLOOP) -o $@ $^
@@ -129,7 +129,7 @@
dest:
$(MKDIR) showconsole-$(VERSION)
- @echo -e 'Begin3\n\
+ @echo -e "Begin3\n\
Title: console tools for boot scripts\n\
Version: $(VERSION)\n\
Entered-date: $(DATE)\n\
@@ -143,11 +143,11 @@
Alternate-site: ftp.suse.com /pub/projects/init\n\
Platforms: Linux with System VR2 or higher boot scheme\n\
Copying-policy: GPL\n\
-End' | sed 's@^ @@g;s@^x@@g' > showconsole-$(VERSION).lsm
+End" | sed 's@^ @@g;s@^x@@g' > showconsole-$(VERSION).lsm
cp -p $(FILES) showconsole-$(VERSION)
- tar -c -zf showconsole-$(VERSION).tar.gz showconsole-$(VERSION)/
+ tar -cps -jf showconsole-$(VERSION).tar.bz2 showconsole-$(VERSION)/
$(RMDIR) showconsole-$(VERSION)
- set -- `gzip -l showconsole-$(VERSION).tar.gz | tail -1` ; \
+ set -- `find showconsole-$(VERSION).tar.bz2 -printf '%s'` ; \
sed "s:@UNKNOWN:$$1:" < showconsole-$(VERSION).lsm > \
showconsole-$(VERSION).lsm.tmp ; \
mv showconsole-$(VERSION).lsm.tmp showconsole-$(VERSION).lsm
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/showconsole-1.09/blogd.c new/showconsole-1.10/blogd.c
--- old/showconsole-1.09/blogd.c 2008-03-13 17:59:41.000000000 +0100
+++ new/showconsole-1.10/blogd.c 2009-05-04 12:04:11.000000000 +0200
@@ -220,10 +220,12 @@
{
int fd, fd2, flags;
int ptm, pts, cntrtty = 1;
- pid_t pid, ppid = getppid();
+ const pid_t ppid = getppid();
+ const pid_t pgrp = getpgid(ppid);
char ptsname[NAME_MAX+1];
struct termios t;
struct winsize w;
+ pid_t pid;
time_t tt;
char *stt, *name = ttyname(0);
@@ -276,7 +278,7 @@
if (!w.ws_row)
w.ws_row = 24;
if (!w.ws_col)
- w.ws_row = 80;
+ w.ws_col = 80;
fd2 = -1;
do {
@@ -337,6 +339,7 @@
dup2(ptm, 0);
dup2(fd, 1);
dup2(fd, 2);
+ close(pts);
close(ptm);
if (fd > 2)
close(fd);
@@ -362,7 +365,7 @@
exit(0);
}
pidfile();
- prepareIO(reconnect, 0, 1, fd2);
+ prepareIO(reconnect, pgrp, 0, 1, fd2);
while (!signaled)
safeIO();
@@ -380,9 +383,6 @@
close(1);
(void)tcflush(2, TCOFLUSH);
close(2);
-
- (void)tcflush(pts, TCIOFLUSH);
- close(pts);
(void)tcflush(0, TCIFLUSH);
close(0);
rmfpid();
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/showconsole-1.09/libblogger.c new/showconsole-1.10/libblogger.c
--- old/showconsole-1.09/libblogger.c 2002-07-04 14:55:10.000000000 +0200
+++ new/showconsole-1.10/libblogger.c 2009-08-20 11:23:55.000000000 +0200
@@ -1,16 +1,18 @@
#ifndef _PATH_BLOG_FIFO
# define _PATH_BLOG_FIFO "/dev/blog"
#endif
-#include
-#include
+#include
#include
+#include
+#include
#include
#include
#include
-#include
+#include
+#include
+#include
+#include
#include
-#include
-#include
#include "libblogger.h"
/*
@@ -21,11 +23,11 @@
* Problem: Does not work on serial console.
*/
-#define ESNN "<notice>" /* Notice */
-#define ESND "<done>" /* Done */
-#define ESNF "<failed>" /* Failed */
-#define ESNS "<skipped>" /* Skipped */
-#define ESNU "<unused>" /* Unused */
+#define ESNN "notice" /* Notice */
+#define ESND "done" /* Done */
+#define ESNF "failed" /* Failed */
+#define ESNS "skipped" /* Skipped */
+#define ESNU "unused" /* Unused */
static int fdfifo = -1;
static char * fifo_name = _PATH_BLOG_FIFO;
@@ -93,8 +95,20 @@
break;
}
- if (head)
- write(fdfifo, head, strlen(head));
+ if (head) {
+ const struct tm *local;
+ struct timeval now;
+ char stamp[72], strnow[56];
+
+ if ((gettimeofday(&now, (struct timezone*)0) == 0) &&
+ ((local = localtime(&now.tv_sec)) != (struct tm*)0) &&
+ (strftime(strnow, sizeof(strnow), "%b %e %T", local) > 0))
+ snprintf(stamp, sizeof(stamp), "<%s -- %s.%lu> ", head, strnow, now.tv_usec*1000UL);
+ else
+ snprintf(stamp, sizeof(stamp), "<%s> ", head);
+
+ write(fdfifo, stamp, strlen(stamp));
+ }
va_start(ap, fmt);
vsnprintf(buf, sizeof(buf), fmt, ap);
va_end(ap);
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/showconsole-1.09/libconsole.c new/showconsole-1.10/libconsole.c
--- old/showconsole-1.09/libconsole.c 2008-03-13 18:13:46.000000000 +0100
+++ new/showconsole-1.10/libconsole.c 2009-08-20 14:00:28.000000000 +0200
@@ -15,6 +15,7 @@
#include /* Defines the macros major and minor */
#include
#include
+#include
#include
#include
#include
@@ -215,7 +216,7 @@
/*
* Twice used: safe in
*/
-static inline ssize_t safein (int fd, char *ptr, size_t s)
+static inline ssize_t safein (int fd, char *ptr, size_t s, const int noerr)
{
int saveerr = errno;
ssize_t r = 0;
@@ -223,7 +224,7 @@
static int repeated;
if (s > SSIZE_MAX)
- error("Can not read from fd %d: %m", fd, strerror(EINVAL));
+ s = SSIZE_MAX;
if ((ioctl(fd, FIONREAD, &t) < 0) || (t == 0)) {
fd_set check;
@@ -242,8 +243,11 @@
} while (r < 0 && (errno == EINTR || errno == EAGAIN));
/* Do not exit on a broken FIFO */
- if (r < 0 && errno != EPIPE)
+ if (r < 0 && errno != EPIPE) {
+ if (noerr)
+ goto out;
error("Can not read from fd %d: %s\n", fd, STRERR);
+ }
goto out;
}
@@ -261,6 +265,8 @@
errno = 0;
continue;
}
+ if (noerr)
+ goto out;
error("Can not read from fd %d: %s\n", fd, STRERR);
}
repeated = 0;
@@ -343,7 +349,6 @@
static inline void storelog(const unsigned char *const buf, const size_t len)
{
- lock(&llock);
if (len > end - tail) {
static int be_warned = 0;
if (!be_warned) {
@@ -355,13 +360,11 @@
memcpy(tail, buf, len);
avail = (tail += len) - head;
xout:
- unlock(&llock);
return;
}
static inline void addlog(const unsigned char c)
{
- lock(&llock);
if (end - tail <= 0) {
static int be_warned = 0;
if (!be_warned) {
@@ -373,7 +376,6 @@
*tail = c;
avail = (tail += 1) - head;
xout:
- unlock(&llock);
return;
}
@@ -487,6 +489,8 @@
ssize_t r = s, up;
unsigned char uprt[16];
+ lock(&llock);
+
while (r > 0) {
c = (unsigned char)*buf;
@@ -669,11 +673,14 @@
unsigned char echo[64];
ssize_t len;
+ /* Release the lock while doing IO */
+ unlock(&llock);
if ((len = snprintf(echo, sizeof(echo), "\033[%lu;%dR", line, nl)) > 0)
safeout(fdread, echo, len);
else
safeout(fdread, "\033R", 2);
tcdrain(fdread);
+ lock(&llock);
}
break;
#endif
@@ -681,11 +688,19 @@
buf++;
r--;
}
+
+ unlock(&llock);
}
static void copylog(const unsigned char *buf, const size_t s)
{
+ lock(&llock);
+ if (!nl) {
+ addlog('\n');
+ nl = 1;
+ }
storelog(buf, s);
+ unlock(&llock);
}
static void *action(void *dummy)
@@ -724,10 +739,12 @@
* Prepare I/O
*/
static const char *fifo_name = _PATH_BLOG_FIFO;
+static pid_t pgroup = -1;
-void prepareIO(void (*rfunc)(int), const int in, const int out, const int second)
+void prepareIO(void (*rfunc)(int), const pid_t pgrp, const int in, const int out, const int second)
{
vc_reconnect = rfunc;
+ pgroup = pgrp;
fdread = in;
fdwrite = out;
fdsec = second;
@@ -744,12 +761,13 @@
warn("can not open named fifo %s: %s\n", fifo_name, STRERR);
}
}
+ (void)mlockall(MCL_FUTURE);
}
/*
* Seek for input, more input ...
*/
-static void more_input (struct timeval *timeout)
+static void more_input (struct timeval *timeout, const int noerr)
{
fd_set watch;
int nfds, wfds;
@@ -777,10 +795,20 @@
goto nothing;
if (FD_ISSET(fdread, &watch)) {
- const ssize_t cnt = safein(fdread, (char*)trans, sizeof(trans));
+ const ssize_t cnt = safein(fdread, (char*)trans, sizeof(trans), noerr);
+ static struct winsize owz;
+ struct winsize wz;
if (cnt > 0) {
- parselog(trans, cnt); /* Parse and make copy of the input */
+ if (ioctl(fdwrite, TIOCGWINSZ, &wz) == 0) {
+ if (memcmp(&owz, &wz, sizeof(struct winsize))) {
+ ioctl(fdread, TIOCSWINSZ, &wz);
+ (void)memcpy(&owz, &wz, sizeof(struct winsize));
+ if (pgroup > 1)
+ killpg(pgroup, SIGWINCH);
+ }
+ }
+ parselog(trans, cnt); /* Parse and make copy of the input */
safeout(fdwrite, (char*)trans, cnt); /* Write copy of input to real tty */
(void)tcdrain(fdwrite);
@@ -795,7 +823,7 @@
}
if (fdfifo > 0 && FD_ISSET(fdfifo, &watch)) {
- const ssize_t cnt = safein(fdfifo, (char*)trans, sizeof(trans));
+ const ssize_t cnt = safein(fdfifo, (char*)trans, sizeof(trans), noerr);
if (cnt > 0) {
copylog(trans, cnt); /* Make copy of the input */
@@ -873,7 +901,7 @@
timeout.tv_sec = 5;
timeout.tv_usec = 0;
- more_input(&timeout);
+ more_input(&timeout, 0);
if (flog && !running) {
int policy = SCHED_RR;
@@ -895,7 +923,7 @@
void closeIO(void)
{
struct timeval timeout;
- int n = 6;
+ int n = 240;
/* Maybe we've catched a signal, therefore */
if (flog) {
@@ -918,9 +946,9 @@
n--;
timeout.tv_sec = 0;
- timeout.tv_usec = 5*100*1000; /* A half second */
+ timeout.tv_usec = 25*1000;
- more_input(&timeout);
+ more_input(&timeout, 1);
if (!flog)
break;
@@ -968,7 +996,7 @@
sprintf(fetched, "/proc/%d/stat", (int)pid);
if ((fd = open(fetched, O_RDONLY|O_NOCTTY)) < 0)
error("can not open(%s): %s\n", fetched, STRERR);
- cnt = safein(fd, fetched, sizeof(fetched));
+ cnt = safein(fd, fetched, sizeof(fetched), 0);
close(fd);
if (cnt <= 0)
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/showconsole-1.09/libconsole.h new/showconsole-1.10/libconsole.h
--- old/showconsole-1.09/libconsole.h 2008-03-13 17:59:52.000000000 +0100
+++ new/showconsole-1.10/libconsole.h 2008-06-13 13:31:59.000000000 +0200
@@ -2,6 +2,6 @@
extern void popd(void);
extern char * fetchtty(const pid_t pid, const pid_t ppid, unsigned int *mjmi);
extern char * secondtty(char * compare);
-extern void prepareIO(void (*rfunc)(int), const int in, const int out, const int second);
+extern void prepareIO(void (*rfunc)(int), const pid_t pgrp, const int in, const int out, const int second);
extern void safeIO (void);
extern void closeIO(void);
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/showconsole-1.09/showconsole-1.09.lsm new/showconsole-1.10/showconsole-1.09.lsm
--- old/showconsole-1.09/showconsole-1.09.lsm 2008-03-13 18:14:08.000000000 +0100
+++ new/showconsole-1.10/showconsole-1.09.lsm 1970-01-01 01:00:00.000000000 +0100
@@ -1,29 +0,0 @@
-Begin3
-\
-Title: console tools for boot scripts
-\
-Version: 1.09
-\
-Entered-date: 13MAR08
-\
-Description: Used for fetch the real device in boot scripts
-\
- running on /dev/console.
-\
-Keywords: boot control
-\
-Author: Werner Fink
-\
-Maintained-by: Werner Fink
-\
-Primary-site: sunsite.unc.edu /pub/Linux/system/daemons/init
-\
- @UNKNOWN showconsole-1.09.tar.gz
-\
-Alternate-site: ftp.suse.com /pub/projects/init
-\
-Platforms: Linux with System VR2 or higher boot scheme
-\
-Copying-policy: GPL
-\
-End
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/showconsole-1.09/showconsole-1.10.lsm new/showconsole-1.10/showconsole-1.10.lsm
--- old/showconsole-1.09/showconsole-1.10.lsm 1970-01-01 01:00:00.000000000 +0100
+++ new/showconsole-1.10/showconsole-1.10.lsm 2009-08-20 14:00:32.000000000 +0200
@@ -0,0 +1,15 @@
+Begin3
+Title: console tools for boot scripts
+Version: 1.10
+Entered-date: 20AUG09
+Description: Used for fetch the real device in boot scripts
+ running on /dev/console.
+Keywords: boot control
+Author: Werner Fink
+Maintained-by: Werner Fink
+Primary-site: sunsite.unc.edu /pub/Linux/system/daemons/init
+ @UNKNOWN showconsole-1.10.tar.gz
+Alternate-site: ftp.suse.com /pub/projects/init
+Platforms: Linux with System VR2 or higher boot scheme
+Copying-policy: GPL
+End
++++++ startpar-0.53.dif -> startpar-0.54.dif ++++++
--- sysvinit/startpar-0.53.dif 2009-07-28 16:51:31.000000000 +0200
+++ sysvinit/startpar-0.54.dif 2009-08-20 14:22:04.000000000 +0200
@@ -1,214 +1,4 @@
---- Makefile
-+++ Makefile 2009-03-13 15:01:12.317145442 +0100
-@@ -15,17 +15,17 @@ OBJS = $(SRCS:.c=.o)
-
- CC = gcc
- OPTFLAGS = -O2 -g -Wall -W
--CFLAGS = $(OPTFLAGS) -D_GNU_SOURCE $(ISSUSE)
-+CFLAGS = $(OPTFLAGS) -D_GNU_SOURCE
-
- ifeq ($(MAKECMDGOALS),makeboot)
- CFLAGS += -DTEST
- endif
-
- .c.o:
-- $(CC) $(CFLAGS) -DVERSION=\"$(VERSION)\" -c $<
-+ $(CC) $(CFLAGS) -DVERSION=\"$(VERSION)\" $(ISSUSE) -c $<
-
- startpar: $(OBJS)
-- $(CC) $(CFLAGS) -DVERSION=\"$(VERSION)\" -o $@ $(OBJS)
-+ $(CC) $(CFLAGS) -DVERSION=\"$(VERSION)\" $(ISSUSE) -o $@ $(OBJS)
-
- makeboot: makeboot.c
-
---- makeboot.c
-+++ makeboot.c 2009-06-29 12:51:15.794401972 +0200
-@@ -46,18 +46,19 @@ static struct makenode *lookup_target(co
- */
- static struct makenode *add_target(const char *name)
- {
-- struct makenode *node;
-+ struct makenode *__restrict node;
- struct makenode *prev, *t;
-
- node = lookup_target(name);
- if (node)
- return node;
-- node = xcalloc(1, sizeof(*node));
-- node->name = strdup(name);
-- if (! node->name) {
-+ if (posix_memalign((void*)&node, sizeof(void*), alignof(struct makenode)+strsize(name)) < 0) {
- fprintf(stderr, "Can't malloc: %s\n", strerror(errno));
- exit(1);
- }
-+ memset(node, 0, alignof(struct makenode)+strsize(name));
-+ node->name = ((char*)node)+alignof(struct makenode);
-+ strcpy(node->name, name);
-
- /* append to the list in alphabetical order */
- prev = NULL;
-@@ -278,15 +279,20 @@ static void filter_files(const char *dir
- #endif
- ndirs = scandir(path, &dirlist, dirfilter, alphasort);
- #if defined _XOPEN_SOURCE && (_XOPEN_SOURCE - 0) >= 600
-- if (i >= 0)
-+ if (i >= 0) {
- (void)posix_fadvise(i, 0, 0, POSIX_FADV_DONTNEED);
-+ close(i);
-+ }
- #endif
- /* mark all matching nodes */
- if (ndirs >= 0) {
- for (i = 0; i < ndirs; i++) {
- t = lookup_target(dirlist[i]->d_name + 3);
-- if (t)
-+ if (t) {
- t->status = 1;
-+ if (asprintf(&t->arg0, "%s/%s", path, dirlist[i]->d_name) < 0)
-+ t->arg0 = (char*)0;
-+ }
- free(dirlist[i]);
- }
- free(dirlist);
-@@ -524,8 +530,6 @@ int main(int argc, char **argv)
- goto out;
- }
-
-- nodevec = xcalloc(1, sizeof(*nodevec));
--
- snprintf(makefile, sizeof(makefile), "depend.%s", argv[1]);
- parse_makefile(makefile);
-
-@@ -534,7 +538,7 @@ int main(int argc, char **argv)
- check_run_files(argv[1], argv[2], argv[3]);
- out:
- while ((nodevec = pickup_task())) {
-- fprintf(stdout, "%s\n", nodevec->name);
-+ fprintf(stdout, "%s (%s)\n", nodevec->name, nodevec->arg0);
- finish_task(nodevec);
- }
-
---- makeboot.h
-+++ makeboot.h 2009-06-29 12:41:15.473901451 +0200
-@@ -8,6 +8,7 @@ enum {
- /* target nodes */
- struct makenode {
- char *name;
-+ char *arg0;
- int num_deps;
- struct makelist *depend;
- int num_sels;
-@@ -33,3 +34,6 @@ extern struct makenode *pickup_task(void
- extern void finish_task(struct makenode *n);
- extern void *xcalloc(size_t nmemb, size_t size);
- extern void print_run_result(int *resvec, struct makenode **nodevec, const char *action);
-+
-+#define alignof(type) ((sizeof(type)+(sizeof(void*)-1)) & ~(sizeof(void*)-1))
-+#define strsize(string) ((strlen(string)+1)*sizeof(char))
---- startpar.c
-+++ startpar.c 2009-07-28 16:47:11.198401578 +0200
-@@ -66,7 +66,8 @@ static struct makenode **nodevec;
-
- #define PBUF_SIZE 8192
- struct prg {
-- char *name;
-+ const char *name;
-+ const char *arg0;
- int num;
- int fd;
- pid_t pid;
-@@ -150,9 +151,9 @@ void closeall(void)
- close(pidpipe[1]);
- }
-
--void callsplash(int n, char *path, char *action)
-+void callsplash(int n, const char *path, char *action)
- {
-- char *p;
-+ const char *p;
- char sbuf[32];
- char tbuf[256];
- pid_t pid;
-@@ -345,17 +346,17 @@ void run(struct prg *p)
- {
- char path[128];
- snprintf(path, sizeof(path), "/etc/init.d/%s", p->name);
-- execlp(path, path, arg, (char *)0);
-+ execlp(path, p->arg0, arg, (char *)0);
- }
- else if (arg)
-- execlp(p->name, p->name, arg, (char *)0);
-+ execlp(p->name, p->arg0, arg, (char *)0);
- else
-- execlp(p->name, p->name, (char *)0);
-+ execlp(p->name, p->arg0, (char *)0);
- perror(p->name);
- _exit(1);
- }
-
--int run_single(char *prg, int spl)
-+int run_single(const char *prg, const char *arg0, int spl)
- {
- pid_t pid;
- int r;
-@@ -382,12 +383,12 @@ int run_single(char *prg, int spl)
- {
- char path[128];
- snprintf(path, sizeof(path), "/etc/init.d/%s", prg);
-- execlp(path, path, arg, (char *)0);
-+ execlp(path, arg0 ? arg0 : path, arg, (char *)0);
- }
- else if (arg)
-- execlp(prg, prg, arg, (char *)0);
-+ execlp(prg, arg0 ? arg0 : prg, arg, (char *)0);
- else
-- execlp(prg, prg, (char *)0);
-+ execlp(prg, arg0 ? arg0 : prg, (char *)0);
- perror(prg);
- _exit(1);
- }
-@@ -415,6 +416,7 @@ void do_forward(void)
- rr = r;
- }
- r -= rr;
-+ b += rr;
- }
- }
- _exit(0);
-@@ -710,11 +712,11 @@ int main(int argc, char **argv)
- {
- if ((*nodevec = pickup_task()))
- {
-- *resvec = run_single((*nodevec)->name, calcsplash(0, 1, splashopt));
-+ *resvec = run_single((*nodevec)->name, (*nodevec)->arg0, calcsplash(0, 1, splashopt));
- finish_task(*nodevec);
- }
- } else
-- *resvec = run_single(*argv, calcsplash(0, 1, splashopt));
-+ *resvec = run_single(*argv, *argv, calcsplash(0, 1, splashopt));
- goto finished;
- }
-
-@@ -818,9 +820,12 @@ int main(int argc, char **argv)
- if (nodevec[num]->interactive)
- interactive_task = p;
- p->name = nodevec[num]->name;
-+ p->arg0 = nodevec[num]->arg0 ? nodevec[num]->arg0 : nodevec[num]->name;
- }
-- else
-+ else {
- p->name = *argv++;
-+ p->arg0 = p->name;
-+ }
- p->splashadd = calcsplash(num, argc, splashopt);
- p->num = num++;
- if (interactive_task)
-@@ -855,7 +860,7 @@ int main(int argc, char **argv)
- if (active == 0)
- {
- p = interactive_task;
-- resvec[p->num] = run_single(p->name, p->splashadd);
-+ resvec[p->num] = run_single(p->name, p->arg0, p->splashadd);
- if (run_mode)
- finish_task(nodevec[p->num]);
- p->pid = 0;
+--- .dummy
++++ .dummy 2009-08-19 12:18:39.181901099 +0200
+@@ -0,0 +1 @@
++this is a dummy, remove if real changes are required
++++++ startpar-0.53.tar.bz2 -> startpar-0.54.tar.bz2 ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/startpar-0.53/Makefile new/startpar-0.54/Makefile
--- old/startpar-0.53/Makefile 2009-03-09 13:27:57.000000000 +0100
+++ new/startpar-0.54/Makefile 2009-08-20 13:26:23.000000000 +0200
@@ -1,4 +1,4 @@
-VERSION = 0.53
+VERSION = 0.54
ISSUSE = -DSUSE
INSTALL = install -m 755
@@ -13,19 +13,23 @@
REST = COPYING Makefile startpar.8
OBJS = $(SRCS:.c=.o)
-CC = gcc
-OPTFLAGS = -O2 -g -Wall -W
-CFLAGS = $(OPTFLAGS) -D_GNU_SOURCE $(ISSUSE)
+ifneq ($(INC),)
+ LIBS += -lblogger
+ COPTS += -DUSE_BLOGD
+endif
+
+CC = gcc
+CFLAGS = $(RPM_OPT_FLAGS) $(COPTS) -D_GNU_SOURCE $(INC) -Wall -W -pipe
ifeq ($(MAKECMDGOALS),makeboot)
CFLAGS += -DTEST
endif
.c.o:
- $(CC) $(CFLAGS) -DVERSION=\"$(VERSION)\" -c $<
+ $(CC) $(CFLAGS) -DVERSION=\"$(VERSION)\" $(ISSUSE) -c $<
startpar: $(OBJS)
- $(CC) $(CFLAGS) -DVERSION=\"$(VERSION)\" -o $@ $(OBJS)
+ $(CC) $(CFLAGS) -DVERSION=\"$(VERSION)\" $(ISSUSE) -o $@ $(OBJS) $(LIBS)
makeboot: makeboot.c
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/startpar-0.53/makeboot.c new/startpar-0.54/makeboot.c
--- old/startpar-0.53/makeboot.c 2009-03-09 13:27:31.000000000 +0100
+++ new/startpar-0.54/makeboot.c 2009-08-20 13:43:48.000000000 +0200
@@ -12,13 +12,22 @@
#include
#include
#include
-#include "makeboot.h"
#if defined _XOPEN_SOURCE && (_XOPEN_SOURCE - 0) >= 600
# include
# include
# include
+#ifndef POSIX_FADV_SEQUENTIAL
+#define posix_fadvise(fd, off, len, adv) (-1)
+#endif
+#ifndef O_DIRECT
+#define O_DIRECT 0
+#endif
static int o_flags = O_RDONLY;
#endif
+#ifdef USE_BLOGD
+# include
+#endif
+#include "makeboot.h"
int tree_entries = 0;
@@ -46,18 +55,19 @@
*/
static struct makenode *add_target(const char *name)
{
- struct makenode *node;
+ struct makenode *__restrict node;
struct makenode *prev, *t;
node = lookup_target(name);
if (node)
return node;
- node = xcalloc(1, sizeof(*node));
- node->name = strdup(name);
- if (! node->name) {
+ if (posix_memalign((void*)&node, sizeof(void*), alignof(struct makenode)+strsize(name)) < 0) {
fprintf(stderr, "Can't malloc: %s\n", strerror(errno));
exit(1);
}
+ memset(node, 0, alignof(struct makenode)+strsize(name));
+ node->name = ((char*)node)+alignof(struct makenode);
+ strcpy(node->name, name);
/* append to the list in alphabetical order */
prev = NULL;
@@ -110,7 +120,7 @@
fprintf(stderr, "loop exists %s in %s!\n", dep->name, src->name);
return 1;
}
- if (loop++ > 999)
+ if (loop++ > 99999)
return 1;
if (check_loop(s->node, src))
return 1;
@@ -278,15 +288,20 @@
#endif
ndirs = scandir(path, &dirlist, dirfilter, alphasort);
#if defined _XOPEN_SOURCE && (_XOPEN_SOURCE - 0) >= 600
- if (i >= 0)
+ if (i >= 0) {
(void)posix_fadvise(i, 0, 0, POSIX_FADV_DONTNEED);
+ close(i);
+ }
#endif
/* mark all matching nodes */
if (ndirs >= 0) {
for (i = 0; i < ndirs; i++) {
t = lookup_target(dirlist[i]->d_name + 3);
- if (t)
+ if (t) {
t->status = 1;
+ if (asprintf(&t->arg0, "%s/%s", path, dirlist[i]->d_name) < 0)
+ t->arg0 = (char*)0;
+ }
free(dirlist[i]);
}
free(dirlist);
@@ -367,25 +382,10 @@
/*
- * call blogger
+ * call blogd
*/
-#if 0
-static void blogger(char *fmt, ...)
-{
- va_list ap;
- char buf[128];
- int len;
-
- strcpy(buf, "blogger \"");
- len = strlen(buf);
- va_start(ap, fmt);
- vsnprintf(buf + len, sizeof(buf) - len - 1, fmt, ap);
- strcat(buf, "\"");
- system(buf);
- va_end(ap);
-}
-#else
-# define blogger(arg...)
+#ifndef USE_BLOGD
+# define bootlog(arg...)
#endif
@@ -415,7 +415,7 @@
close(fd);
}
#endif
- blogger("service %s", best->name);
+ bootlog(B_NOTICE, "service %s %s", best->name, (filter_prefix == 'K') ? "stop" : "start");
best->status = T_RUNNING;
}
return best;
@@ -444,7 +444,7 @@
}
#endif
node->status = T_FINISHED;
- blogger("service %s done", node->name);
+ bootlog(B_NOTICE, "service %s done", node->name);
}
@@ -524,8 +524,6 @@
goto out;
}
- nodevec = xcalloc(1, sizeof(*nodevec));
-
snprintf(makefile, sizeof(makefile), "depend.%s", argv[1]);
parse_makefile(makefile);
@@ -534,7 +532,7 @@
check_run_files(argv[1], argv[2], argv[3]);
out:
while ((nodevec = pickup_task())) {
- fprintf(stdout, "%s\n", nodevec->name);
+ fprintf(stdout, "%s (%s)\n", nodevec->name, nodevec->arg0);
finish_task(nodevec);
}
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/startpar-0.53/makeboot.h new/startpar-0.54/makeboot.h
--- old/startpar-0.53/makeboot.h 2007-06-18 14:37:01.000000000 +0200
+++ new/startpar-0.54/makeboot.h 2009-07-10 16:28:19.000000000 +0200
@@ -8,6 +8,7 @@
/* target nodes */
struct makenode {
char *name;
+ char *arg0;
int num_deps;
struct makelist *depend;
int num_sels;
@@ -33,3 +34,6 @@
extern void finish_task(struct makenode *n);
extern void *xcalloc(size_t nmemb, size_t size);
extern void print_run_result(int *resvec, struct makenode **nodevec, const char *action);
+
+#define alignof(type) ((sizeof(type)+(sizeof(void*)-1)) & ~(sizeof(void*)-1))
+#define strsize(string) ((strlen(string)+1)*sizeof(char))
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/startpar-0.53/startpar.c new/startpar-0.54/startpar.c
--- old/startpar-0.53/startpar.c 2008-07-18 13:25:50.000000000 +0200
+++ new/startpar-0.54/startpar.c 2009-08-20 13:11:03.000000000 +0200
@@ -22,6 +22,13 @@
#define _GNU_SOURCE 1
#endif
+#ifdef SUSE
+# define USE_PRELOAD
+# undef CHECK_FORDEVPTS
+#else
+# undef USE_PRELOAD
+# define CHECK_FORDEVPTS
+#endif
#include
#include
#include
@@ -29,8 +36,13 @@
#include
#include
#include
+#include
+#include
#include
#include
+#ifdef CHECK_FORDEVPTS
+# include
+#endif
#include
#include
#include
@@ -66,7 +78,8 @@
#define PBUF_SIZE 8192
struct prg {
- char *name;
+ const char *name;
+ const char *arg0;
int num;
int fd;
pid_t pid;
@@ -81,6 +94,22 @@
static int pidpipe[2];
static double iorate = 800.0;
+#ifdef USE_PRELOAD
+static enum { Unknown, Preload, NoPreload } ispreload = Unknown;
+
+static void sighandler_nopreload(int x __attribute__((unused)))
+{
+ ispreload = NoPreload;
+}
+
+static void sighandler_preload(int x __attribute__((unused)))
+{
+ ispreload = Preload;
+}
+
+# define SOCK_PATH "/dev/shm/preload_sock"
+#endif
+
void *xcalloc(size_t nmemb, size_t size)
{
void *r;
@@ -150,9 +179,9 @@
close(pidpipe[1]);
}
-void callsplash(int n, char *path, char *action)
+void callsplash(int n, const char *path, char *action)
{
- char *p;
+ const char *p;
char sbuf[32];
char tbuf[256];
pid_t pid;
@@ -248,11 +277,17 @@
if (read_proc(&prcs_run, &prcs_blked))
return par;
+#ifdef USE_PRELOAD
+ /* if we have preload running, we expect I/O not to be a problem */
+ if (ispreload != NoPreload)
+ prcs_blked = 0;
+#endif
+
newpar = (par*numcpu) - prcs_run + 1; /* +1 for startpar its self */
newpar -= (int)(((double)prcs_blked)*iorate); /* I/O load reduction */
#if DEBUG
- fprintf(stderr, "checksystem par=%d newpar=%d (prcs_run=%u) %ld\n", par, newpar, prcs_run, time(0));
+ fprintf(stderr, "checksystem par=%d newpar=%d (prcs_run=%lu) %ld\n", par, newpar, prcs_run, time(0));
dump_status();
#endif
if (newpar <= 0)
@@ -271,9 +306,75 @@
return checksystem(par, start, false);
}
+#ifdef CHECK_FORDEVPTS
+/*
+ * Based on __posix_openpt() from glibc. Reimplemented here to work
+ * around the problem with getpt() failing for the entire process life
+ * time if /dev/pts/ is missing the first time it is called but
+ * mounted while the process is running. BSD style pts is not
+ * supported, but might be copied from glibc too if there is need.
+ */
+# define DEVFS_SUPER_MAGIC 0x1373
+# define DEVPTS_SUPER_MAGIC 0x1cd1
+
+static int startpar_getpt(void) {
+ int fd = open("/dev/ptmx", O_RDWR|O_NOCTTY);
+
+ if (fd != -1)
+ {
+ struct statfs fsbuf;
+
+ /* Check that the /dev/pts filesystem is mounted
+ or if /dev is a devfs filesystem (this implies /dev/pts). */
+ if ((statfs ("/dev/pts", &fsbuf) == 0
+ && fsbuf.f_type == DEVPTS_SUPER_MAGIC)
+ || (statfs ("/dev", &fsbuf) == 0
+ && fsbuf.f_type == DEVFS_SUPER_MAGIC))
+ {
+ /* Everything is ok, switch to the getpt() in libc. */
+ return fd;
+ }
+
+ /* If /dev/pts is not mounted then the UNIX98 pseudo terminals
+ are not usable. */
+ close (fd);
+ }
+
+ return -1;
+}
+
+static int checkdevpts(void)
+{
+ int ptsfd = startpar_getpt();
+
+ if (ptsfd == -1)
+ {
+ return 0;
+ }
+ else if (ptsname(ptsfd) == 0 || grantpt(ptsfd) || unlockpt(ptsfd))
+ {
+ close(ptsfd);
+ return 0;
+ }
+ else
+ {
+ close(ptsfd);
+ return 1;
+ }
+}
+#else
+static int __attribute__ ((unused)) checkdevpts(void)
+{
+ return 1; /* /dev/pts is always mounted */
+}
+#endif
+
void run(struct prg *p)
{
- char *m = 0;
+ const char * m = (char*)0;
+#ifdef USE_PRELOAD
+ pid_t parent;
+#endif
p->len = 0;
p->pid = (pid_t)0;
@@ -290,6 +391,9 @@
close(p->fd);
p->fd = 0;
}
+#ifdef USE_PRELOAD
+ parent = getpid();
+#endif
if ((p->pid = fork()) == (pid_t)-1)
{
perror("fork");
@@ -341,21 +445,73 @@
closeall();
+#ifdef USE_PRELOAD
+ if (!strcmp(arg, "start"))
+ {
+ int s;
+
+ if ((s = socket(AF_UNIX, SOCK_STREAM, 0)) != -1)
+ {
+ struct sockaddr_un remote;
+ pid_t child;
+ int t, len;
+
+ memset(&remote, 0, sizeof(struct sockaddr_un));
+ remote.sun_family = AF_UNIX;
+ strcpy(remote.sun_path, SOCK_PATH);
+ len = strlen(remote.sun_path) + sizeof(remote.sun_family);
+
+ if ((t = connect(s, (struct sockaddr *)&remote, len)) != -1)
+ {
+ char str[100];
+ if (ispreload != Preload)
+ kill(parent, SIGUSR1);
+ send(s, p->name, strlen(p->name), 0);
+ recv(s, str, sizeof(str), 0);
+ }
+ else if (ispreload == Unknown)
+ {
+ /*
+ * if we connected to preload once, we know it ran.
+ * In case we can't connect to it later, it means it did
+ * its job and we can guess I/O is no longer a problem.
+ */
+ kill(parent, SIGUSR2);
+ }
+ close(s);
+ /*
+ * if we use preload, we fork again to make bootcharts easier to read.
+ * The reason is that the name of the init script will otherwise be used
+ * when in reality the above code waited for preload. If we fork away
+ * before the exec, the waiting code will be folded into startpar
+ */
+ if ((child = fork()))
+ {
+ int status;
+ int ret = waitpid(child, &status, 0);
+ if (ret == -1)
+ perror("waitpid");
+ exit(WEXITSTATUS(status));
+ }
+ }
+ }
+#endif
+
if (run_mode)
{
char path[128];
snprintf(path, sizeof(path), "/etc/init.d/%s", p->name);
- execlp(path, path, arg, (char *)0);
+ execlp(path, p->arg0, arg, (char *)0);
}
else if (arg)
- execlp(p->name, p->name, arg, (char *)0);
+ execlp(p->name, p->arg0, arg, (char *)0);
else
- execlp(p->name, p->name, (char *)0);
+ execlp(p->name, p->arg0, (char *)0);
perror(p->name);
_exit(1);
}
-int run_single(char *prg, int spl)
+int run_single(const char *prg, const char *arg0, int spl)
{
pid_t pid;
int r;
@@ -382,12 +538,12 @@
{
char path[128];
snprintf(path, sizeof(path), "/etc/init.d/%s", prg);
- execlp(path, path, arg, (char *)0);
+ execlp(path, arg0 ? arg0 : path, arg, (char *)0);
}
else if (arg)
- execlp(prg, prg, arg, (char *)0);
+ execlp(prg, arg0 ? arg0 : prg, arg, (char *)0);
else
- execlp(prg, prg, (char *)0);
+ execlp(prg, arg0 ? arg0 : prg, (char *)0);
perror(prg);
_exit(1);
}
@@ -415,6 +571,7 @@
rr = r;
}
r -= rr;
+ b += rr;
}
}
_exit(0);
@@ -710,11 +867,11 @@
{
if ((*nodevec = pickup_task()))
{
- *resvec = run_single((*nodevec)->name, calcsplash(0, 1, splashopt));
+ *resvec = run_single((*nodevec)->name, (*nodevec)->arg0, calcsplash(0, 1, splashopt));
finish_task(*nodevec);
}
} else
- *resvec = run_single(*argv, calcsplash(0, 1, splashopt));
+ *resvec = run_single(*argv, *argv, calcsplash(0, 1, splashopt));
goto finished;
}
@@ -764,6 +921,26 @@
exit(1);
}
+#ifdef USE_PRELOAD
+ sa.sa_handler = sighandler_preload;
+ sa.sa_flags = SA_RESTART;
+ (void)sigemptyset(&sa.sa_mask);
+ if (sigaction(SIGUSR1, &sa, 0))
+ {
+ perror("sigusr1(preload) sigaction");
+ exit(1);
+ }
+
+ sa.sa_handler = sighandler_nopreload;
+ sa.sa_flags = SA_RESTART;
+ (void)sigemptyset(&sa.sa_mask);
+ if (sigaction(SIGUSR2, &sa, 0))
+ {
+ perror("sigusr2(preload) sigaction");
+ exit(1);
+ }
+#endif
+
gettimeofday(&glastio, 0);
limit = checklimit(inpar, isstart);
lastlim = glastio;
@@ -775,6 +952,9 @@
pid_t pid = 0;
int r = 0, s;
long diff;
+#ifdef CHECK_FORDEVPTS
+ int devpts = 0;
+#endif
gettimeofday(&now, 0);
FD_ZERO(&rset);
@@ -796,6 +976,10 @@
for (s = 0; s < par; s++) /* never leave this with break!! */
{
account: /* for the new process below */
+#ifdef CHECK_FORDEVPTS
+ if (!devpts)
+ devpts = checkdevpts();
+#endif
p = prgs + s;
if (p == interactive_task)
continue; /* don't count this here */
@@ -818,13 +1002,23 @@
if (nodevec[num]->interactive)
interactive_task = p;
p->name = nodevec[num]->name;
+ p->arg0 = nodevec[num]->arg0 ? nodevec[num]->arg0 : nodevec[num]->name;
}
- else
+ else {
p->name = *argv++;
+ p->arg0 = p->name;
+ }
p->splashadd = calcsplash(num, argc, splashopt);
p->num = num++;
if (interactive_task)
continue; /* don't start this here */
+#ifdef CHECK_FORDEVPTS
+ if (!devpts)
+ {
+ interactive_task = p; /* no /dev/pts, treat as interactive */
+ continue;
+ }
+#endif
run(p);
if (p->pid == 0)
{
@@ -855,7 +1049,7 @@
if (active == 0)
{
p = interactive_task;
- resvec[p->num] = run_single(p->name, p->splashadd);
+ resvec[p->num] = run_single(p->name, p->arg0, p->splashadd);
if (run_mode)
finish_task(nodevec[p->num]);
p->pid = 0;
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Remember to have fun...
--
To unsubscribe, e-mail: opensuse-commit+unsubscribe@opensuse.org
For additional commands, e-mail: opensuse-commit+help@opensuse.org