Hello community,
here is the log from the commit of package sysvinit for openSUSE:Factory
checked in at Tue Aug 24 18:11:38 CEST 2010.
--------
--- sysvinit/sysvinit.changes 2010-07-29 18:24:11.000000000 +0200
+++ sysvinit/sysvinit.changes 2010-08-24 14:54:12.000000000 +0200
@@ -1,0 +2,10 @@
+Mon Aug 23 17:40:12 CEST 2010 - werner@suse.de
+
+- New showconsole version 1.11
+ * Handle more than two console devices
+ * Speed up used pts/tty pair by enabling raw mode
+ * Implement termios locking scheme but disable it as it may
+ interfere with sulogin and others using the old console
+- Enabling full raw mode for pty/tty pairs of startpar
+
+-------------------------------------------------------------------
calling whatdependson for head-i586
Old:
----
showconsole-1.10.dif
showconsole-1.10.tar.bz2
New:
----
showconsole-1.11.dif
showconsole-1.11.tar.bz2
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Other differences:
------------------
++++++ sysvinit.spec ++++++
--- /var/tmp/diff_new_pack.Z6yACZ/_old 2010-08-24 18:08:23.000000000 +0200
+++ /var/tmp/diff_new_pack.Z6yACZ/_new 2010-08-24 18:08:23.000000000 +0200
@@ -22,14 +22,14 @@
%define MGVER 0.9.6s
%define PDVER 2.0.2
%define KPVER 2.16
-%define SCVER 1.10
+%define SCVER 1.11
%define SIVER 2.88
%define START 0.56
License: GPLv2+
Group: System/Base
AutoReqProv: on
Version: 2.88
-Release: 14
+Release: 15
Summary: SysV-Style init
BuildRoot: %{_tmppath}/%{name}-%{version}-build
BuildRequires: audit-devel libselinux-devel libsepol-devel pam-devel
@@ -37,7 +37,7 @@
Source: http://download.savannah.gnu.org/releases/sysvinit/sysvinit-2.88dsf.tar.bz2
Source2: killproc-2.16.tar.bz2
Source3: powerd-2.0.2.tar.bz2
-Source4: showconsole-1.10.tar.bz2
+Source4: showconsole-1.11.tar.bz2
Source5: startpar-0.56.tar.bz2
Source6: rc.powerd
Source7: sysvinit-rpmlintrc
@@ -55,7 +55,7 @@
Patch20: powerd-2.0.2.dif
Patch21: powerd-2.0.2-getaddrinfo.patch
Patch30: killproc-2.16.dif
-Patch40: showconsole-1.10.dif
+Patch40: showconsole-1.11.dif
Patch50: startpar-0.56.dif
Requires: sysvinit-tools
Provides: sbin_init
++++++ showconsole-1.10.dif -> showconsole-1.11.dif ++++++
--- sysvinit/showconsole-1.10.dif 2010-05-28 16:35:00.000000000 +0200
+++ sysvinit/showconsole-1.11.dif 2010-08-24 14:54:12.000000000 +0200
@@ -1,254 +1,4 @@
---- Makefile
-+++ Makefile 2010-05-28 14:15:39.662925024 +0000
-@@ -62,7 +62,7 @@ TODO = showconsole blogd blogger isseria
- all: $(TODO)
-
- libconsole.o: libconsole.c libconsole.h
-- $(CC) $(CFLAGS) $(CLOOP) -c $< -pthread
-+ $(CC) $(CFLAGS) $(CLOOP) -D_REENTRANT -c $< -pthread
-
- libblogger.o: libblogger.c libblogger.h
- $(CC) $(CFLAGS) $(CLOOP) -c $<
-@@ -74,7 +74,7 @@ showconsole: showconsole.c libconsole.o
- $(CC) $(CFLAGS) $(CLOOP) -o $@ $^ -Wl,--as-needed -pthread
-
- blogd: blogd.c libconsole.o
-- $(CC) $(CFLAGS) $(CLOOP) -o $@ $^ -Wl,--as-needed -lutil -pthread
-+ $(CC) $(CFLAGS) $(CLOOP) -D_REENTRANT -o $@ $^ -Wl,--as-needed -lutil -pthread
-
- blogger: blogger.c libblogger.a
- $(CC) $(CFLAGS) $(CLOOP) -o $@ $^
---- blogd.8
-+++ blogd.8 2010-05-04 09:57:15.679656772 +0000
-@@ -58,6 +58,13 @@ that now it is able to write on
- which means that the file system is
- mounted read/write and the kernel
- messages are written to that file.
-+.TP
-+.B SIGSYS
-+says
-+.B blogd
-+that it should stop writing to disk but
-+continue to repeat messages to the old
-+devices of the system console.
- \."
- .SH BUGS
- .B blogd
---- blogd.c
-+++ blogd.c 2010-05-28 14:31:23.748444849 +0000
-@@ -24,6 +24,7 @@
- #include
- #include
- #include "libconsole.h"
-+extern volatile sig_atomic_t nsigsys;
-
- /*
- * Internal logger
-@@ -102,11 +103,22 @@ static struct sigaction saved_sighup;
- static struct sigaction saved_sigint;
- static struct sigaction saved_sigquit;
- static struct sigaction saved_sigterm;
-+static struct sigaction saved_sigsys;
- static volatile sig_atomic_t signaled = 0;
-
- static void sighandle(int sig)
- {
-- signaled = sig;
-+ if (nsigsys && (sig == SIGTERM))
-+ return;
-+ signaled = (volatile sig_atomic_t)sig;
-+}
-+
-+/*
-+ * Stop writing logs to disk, only repeat messages
-+ */
-+static void sigsys(int sig)
-+{
-+ nsigsys = (volatile sig_atomic_t)sig;
- }
-
- static void set_signal(int sig, struct sigaction *old, sighandler_t handler)
-@@ -116,7 +128,7 @@ static void set_signal(int sig, struct s
- break;
- } while (errno == EINTR);
-
-- if (old->sa_handler != handler) {
-+ if (old && old->sa_handler != handler) {
- struct sigaction new;
- sigset_t sigset;
-
-@@ -143,7 +155,7 @@ static void reset_signal(int sig, struct
- break;
- } while (errno == EINTR);
-
-- if (old->sa_handler == cur.sa_handler) {
-+ if (old && old->sa_handler == cur.sa_handler) {
- do {
- if (sigaction(sig, old, NULL) == 0)
- break;
-@@ -320,6 +332,7 @@ int main(int argc, char *argv[])
- if (ioctl(pts, TIOCCONS, NULL) < 0)
- error("can not set console device to %s: %s\n", ptsname, strerror(errno));
-
-+ nsigsys = 0;
- set_signal(SIGTTIN, &saved_sigttin, SIG_IGN);
- set_signal(SIGTTOU, &saved_sigttou, SIG_IGN);
- set_signal(SIGTSTP, &saved_sigtstp, SIG_IGN);
-@@ -327,9 +340,11 @@ int main(int argc, char *argv[])
- set_signal(SIGINT, &saved_sigint, sighandle);
- set_signal(SIGQUIT, &saved_sigquit, sighandle);
- set_signal(SIGTERM, &saved_sigterm, sighandle);
-+ set_signal(SIGSYS, &saved_sigsys, sigsys);
- (void)siginterrupt(SIGINT, 0);
- (void)siginterrupt(SIGQUIT, 0);
- (void)siginterrupt(SIGTERM, 0);
-+ (void)siginterrupt(SIGSYS, 0);
-
- switch ((pid = fork())) {
- case 0:
-@@ -364,11 +379,22 @@ int main(int argc, char *argv[])
- fflush(stdout);
- exit(0);
- }
-- pidfile();
-- prepareIO(reconnect, pgrp, 0, 1, fd2);
-+
-+ prepareIO(reconnect, pidfile, pgrp, 0, 1, fd2);
- while (!signaled)
- safeIO();
-
-+ (void)tcdrain(1);
-+ (void)tcdrain(2);
-+ if (fd2 > 0)
-+ (void)tcdrain(fd2);
-+
-+ errno = 0;
-+ if ((fd = open("/dev/console", O_RDWR|O_NOCTTY)) >= 0) {
-+ (void)ioctl(fd, TIOCCONS, NULL); /* Restore old console mapping */
-+ close(fd);
-+ }
-+
- if (!cntrtty)
- kill(ppid, SIGSTOP);
- closeIO();
-@@ -394,6 +420,7 @@ int main(int argc, char *argv[])
- reset_signal(SIGINT, &saved_sigint);
- reset_signal(SIGQUIT, &saved_sigquit);
- reset_signal(SIGTERM, &saved_sigterm);
-+ reset_signal(SIGSYS, &saved_sigsys);
-
- return 0;
- }
---- libconsole.c
-+++ libconsole.c 2010-05-28 13:57:01.458924791 +0000
-@@ -155,7 +155,7 @@ out:
- /*
- * Arg used: safe out
- */
--static void (*vc_reconnect)(int fd) = NULL;
-+static void (*vc_reconnect)(int fd);
- static inline void safeout (int fd, const char *ptr, size_t s)
- {
- int saveerr = errno;
-@@ -291,6 +291,7 @@ static int fdfifo = -1;
- /*
- * Signal control for writing on log file
- */
-+volatile sig_atomic_t nsigsys = 0;
- static volatile sig_atomic_t nsigio = -1;
- static sigset_t save_oldset;
-
-@@ -382,7 +383,7 @@ xout:
- static inline void writelog(void)
- {
- if (!flog)
-- goto xout;;
-+ goto xout;
- clearerr(flog);
- lock(&llock);
- while (avail > 0) {
-@@ -715,6 +716,7 @@ static void *action(void *dummy)
- sigaddset(&sigset, SIGINT);
- sigaddset(&sigset, SIGQUIT);
- sigaddset(&sigset, SIGTERM);
-+ sigaddset(&sigset, SIGSYS);
- (void)pthread_sigmask(SIG_BLOCK, &sigset, &save_oldset);
-
- lock(&ljoin);
-@@ -739,11 +741,13 @@ static void *action(void *dummy)
- * Prepare I/O
- */
- static const char *fifo_name = _PATH_BLOG_FIFO;
-+static void (*vr_access)(void);
- static pid_t pgroup = -1;
-
--void prepareIO(void (*rfunc)(int), const pid_t pgrp, const int in, const int out, const int second)
-+void prepareIO(void (*rfunc)(int), void (*pfunc)(void), const pid_t pgrp, const int in, const int out, const int second)
- {
- vc_reconnect = rfunc;
-+ vr_access = pfunc;
- pgroup = pgrp;
- fdread = in;
- fdwrite = out;
-@@ -871,6 +875,10 @@ void safeIO (void)
- error("Can not open %s: %s\n", BOOT_LOGFILE, STRERR);
- goto skip;
- }
-+ if (vr_access) {
-+ (*vr_access)();
-+ vr_access = NULL;
-+ }
- if ((flog = fdopen (log, "a")) == NULL)
- error("Can not open %s: %s\n", BOOT_LOGFILE, STRERR);
-
-@@ -915,6 +923,15 @@ skip:
- pthread_setschedparam(pthread_self(), policy, ¶m);
- pthread_setschedparam(lthread, policy, ¶m);
- }
-+
-+ if (nsigsys) { /* Stop writing logs to disk, only repeat messages */
-+ if (flog)
-+ closeIO();
-+ if (nsigio < 0) {
-+ nsigio = SIGIO;
-+ (void)signal(SIGIO, SIG_IGN);
-+ }
-+ }
- }
-
- /*
-@@ -926,11 +943,9 @@ void closeIO(void)
- int n = 240;
-
- /* Maybe we've catched a signal, therefore */
-- if (flog) {
-- fflush(flog); /* Clear out stdio buffers */
-- fdatasync(fileno(flog));
-- } else
-+ if (!flog && !nsigsys)
- warn("no message logging because /var file system is not accessible\n");
-+
- (void)tcdrain(fdwrite); /* Hold in sync with console */
- if (fdsec > 0)
- (void)tcdrain(fdsec); /* Hold in sync with second console */
-@@ -949,9 +964,8 @@ void closeIO(void)
- timeout.tv_usec = 25*1000;
-
- more_input(&timeout, 1);
-+ (void)tcdrain(fdread);
-
-- if (!flog)
-- break;
- } while (timeout.tv_sec || timeout.tv_usec);
-
- if (running) {
---- libconsole.h
-+++ libconsole.h 2009-12-21 14:54:41.299449887 +0000
-@@ -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 pid_t pgrp, const int in, const int out, const int second);
-+extern void prepareIO(void (*rfunc)(int), void (*pfunc)(void), const pid_t pgrp, const int in, const int out, const int second);
- extern void safeIO (void);
- extern void closeIO(void);
+--- .dummy
++++ .dummy 2010-08-23 17:38:50.000000000 +0000
+@@ -0,0 +1 @@
++this is a dummy, remove if real changes are required
++++++ showconsole-1.10.tar.bz2 -> showconsole-1.11.tar.bz2 ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/showconsole-1.10/Makefile new/showconsole-1.11/Makefile
--- old/showconsole-1.10/Makefile 2009-08-20 11:28:54.000000000 +0200
+++ new/showconsole-1.11/Makefile 2010-05-04 18:32:20.000000000 +0200
@@ -13,7 +13,7 @@
#DESTDIR = /tmp/root
DEBUG =
DESTDIR =
-VERSION = 1.10
+VERSION = 1.11
DATE = $(shell date +'%d%b%y' | tr '[:lower:]' '[:upper:]')
COPTS =
@@ -62,7 +62,7 @@
all: $(TODO)
libconsole.o: libconsole.c libconsole.h
- $(CC) $(CFLAGS) $(CLOOP) -c $< -pthread
+ $(CC) $(CFLAGS) $(CLOOP) -D_REENTRANT -c $< -pthread
libblogger.o: libblogger.c libblogger.h
$(CC) $(CFLAGS) $(CLOOP) -c $<
@@ -74,7 +74,7 @@
$(CC) $(CFLAGS) $(CLOOP) -o $@ $^ -Wl,--as-needed -pthread
blogd: blogd.c libconsole.o
- $(CC) $(CFLAGS) $(CLOOP) -o $@ $^ -Wl,--as-needed -lutil -pthread
+ $(CC) $(CFLAGS) $(CLOOP) -D_REENTRANT -o $@ $^ -Wl,--as-needed -lutil -pthread
blogger: blogger.c libblogger.a
$(CC) $(CFLAGS) $(CLOOP) -o $@ $^
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/showconsole-1.10/blogd.8 new/showconsole-1.11/blogd.8
--- old/showconsole-1.10/blogd.8 2001-01-29 20:17:12.000000000 +0100
+++ new/showconsole-1.11/blogd.8 2010-05-04 11:57:15.000000000 +0200
@@ -58,6 +58,13 @@
which means that the file system is
mounted read/write and the kernel
messages are written to that file.
+.TP
+.B SIGSYS
+says
+.B blogd
+that it should stop writing to disk but
+continue to repeat messages to the old
+devices of the system console.
\."
.SH BUGS
.B blogd
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/showconsole-1.10/blogd.c new/showconsole-1.11/blogd.c
--- old/showconsole-1.10/blogd.c 2009-05-04 12:04:11.000000000 +0200
+++ new/showconsole-1.11/blogd.c 2010-08-24 15:50:42.000000000 +0200
@@ -1,5 +1,17 @@
-#ifndef LOG_BUFFER_SIZE
-# define LOG_BUFFER_SIZE 65536
+/*
+ * blogd.c
+ *
+ * Copyright 2000 Werner Fink, 2000 SuSE GmbH Nuernberg, Germany.
+ *
+ * This source is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ */
+
+#undef LOCK_TERMIOS
+#ifndef _GNU_SOURCE
+# define _GNU_SOURCE
#endif
#ifndef BOOT_LOGFILE
# define BOOT_LOGFILE "/var/log/boot.msg"
@@ -23,7 +35,12 @@
#include
#include
#include
+#include
#include "libconsole.h"
+#ifndef _POSIX_MAX_CANON
+# define _POSIX_MAX_CANON 255
+#endif
+extern volatile sig_atomic_t nsigsys;
/*
* Internal logger
@@ -102,11 +119,22 @@
static struct sigaction saved_sigint;
static struct sigaction saved_sigquit;
static struct sigaction saved_sigterm;
+static struct sigaction saved_sigsys;
static volatile sig_atomic_t signaled = 0;
static void sighandle(int sig)
{
- signaled = sig;
+ if (nsigsys && (sig == SIGTERM))
+ return;
+ signaled = (volatile sig_atomic_t)sig;
+}
+
+/*
+ * Stop writing logs to disk, only repeat messages
+ */
+static void sigsys(int sig)
+{
+ nsigsys = (volatile sig_atomic_t)sig;
}
static void set_signal(int sig, struct sigaction *old, sighandler_t handler)
@@ -116,7 +144,7 @@
break;
} while (errno == EINTR);
- if (old->sa_handler != handler) {
+ if (old && old->sa_handler != handler) {
struct sigaction new;
sigset_t sigset;
@@ -143,7 +171,7 @@
break;
} while (errno == EINTR);
- if (old->sa_handler == cur.sa_handler) {
+ if (old && old->sa_handler == cur.sa_handler) {
do {
if (sigaction(sig, old, NULL) == 0)
break;
@@ -154,62 +182,48 @@
/*
* To be able to reconnect to real tty on EIO
*/
-static char * tty;
-static char * second;
static void reconnect(int fd)
{
- int newfd = -1;
+ struct console * c;
- switch (fd) {
- case 0: /* Standard in */
+ for (c = cons; c; c = c->next) {
+ int newfd;
- if (tty == (char*)0)
- break;
+ if (!c->tty) continue;
- if ((newfd = open(tty, O_RDWR|O_NONBLOCK|O_NOCTTY)) < 0)
- error("can not open %s: %s\n", tty, strerror(errno));
+ if (c->fd != fd) continue;
- if (newfd != 0) {
- dup2(newfd, 0);
- close(newfd);
- }
+ switch (c->fd) {
+ case 1: /* Standard out */
+ case 2: /* Standard error */
- break;
+ if ((newfd = open(c->tty, O_WRONLY|O_NONBLOCK|O_NOCTTY)) < 0)
+ error("can not open %s: %s\n", c->tty, strerror(errno));
- case 1: /* Standard out */
- case 2: /* Standard error */
+ if (newfd != 1)
+ dup2(newfd, 1);
+ if (newfd != 2)
+ dup2(newfd, 2);
+ if (newfd > 2)
+ close(newfd);
- if (tty == (char*)0)
break;
- if ((newfd = open(tty, O_WRONLY|O_NONBLOCK|O_NOCTTY)) < 0)
- error("can not open %s: %s\n", tty, strerror(errno));
+ default: /* IO of further consoles */
- if (newfd != 1)
- dup2(newfd, 1);
- if (newfd != 2)
- dup2(newfd, 2);
- if (newfd > 2)
- close(newfd);
+ if ((newfd = open(c->tty, O_WRONLY|O_NONBLOCK|O_NOCTTY)) < 0)
+ error("can not open %s: %s\n", c->tty, strerror(errno));
- break;
-
- default: /* IO of second console */
+ if (newfd != c->fd) {
+ dup2(newfd, c->fd);
+ close(newfd);
+ }
- if (second == (char*)0)
- break;
-
- if ((newfd = open(second, O_WRONLY|O_NONBLOCK|O_NOCTTY)) < 0)
- error("can not open %s: %s\n", second, strerror(errno));
-
- if (newfd != fd) {
- dup2(newfd, fd);
- close(newfd);
- }
-
- case -1: /* Weired */
+ case 0:
+ case -1: /* Weired */
break;
+ }
}
}
@@ -218,16 +232,18 @@
*/
int main(int argc, char *argv[])
{
- int fd, fd2, flags;
+ int fd, flags;
int ptm, pts, cntrtty = 1;
const pid_t ppid = getppid();
const pid_t pgrp = getpgid(ppid);
char ptsname[NAME_MAX+1];
- struct termios t;
+ struct console *c;
+ struct termios o;
struct winsize w;
+ struct stat st;
pid_t pid;
time_t tt;
- char *stt, *name = ttyname(0);
+ char *tty, *stt, *name = ttyname(0);
myname = basename(*argv);
@@ -251,28 +267,36 @@
if (strcmp(tty, name) == 0)
error("console=%s, stdin=%s, must differ, boot logging disabled\n", tty, name);
- if ((fd = open(tty, O_WRONLY|O_NONBLOCK|O_NOCTTY)) < 0)
+ if (posix_memalign((void*)&cons, sizeof(void*), alignof(typeof(struct console))) != 0)
+ error("memory allocation: %s\n", strerror(errno));
+
+ cons->next = (struct console*)0;
+ cons->tty = tty;
+ if ((cons->fd = open(cons->tty, O_WRONLY|O_NONBLOCK|O_NOCTTY)) < 0)
error("can not open %s: %s\n", tty, strerror(errno));
- if ((flags = fcntl(fd, F_GETFL)) < 0)
+ if ((flags = fcntl(cons->fd, F_GETFL)) < 0)
error("can not get terminal flags of %s: %s\n", tty, strerror(errno));
flags &= ~(O_NONBLOCK);
flags |= O_NOCTTY;
- if (fcntl(fd, F_SETFL, flags) < 0)
+ if (fcntl(cons->fd, F_SETFL, flags) < 0)
error("can not set terminal flags of %s: %s\n", tty, strerror(errno));
- if (tcgetattr(fd, &t) < 0)
+ if (tcgetattr(cons->fd, &cons->otio) < 0)
error("can not get terminal parameters of %s: %s\n", tty, strerror(errno));
- cfsetispeed(&t, B38400);
- cfsetospeed(&t, B38400);
- if (tcgetpgrp(fd) < 0)
+ if (fstat(cons->fd, &st) == 0 && major(st.st_rdev) == TTY_MAJOR) {
+ cfsetispeed(&cons->otio, B38400);
+ cfsetospeed(&cons->otio, B38400);
+ }
+
+ if (tcgetpgrp(cons->fd) < 0)
cntrtty = 0;
w.ws_row = 0;
w.ws_col = 0;
- if (ioctl(fd, TIOCGWINSZ, &w) < 0)
+ if (ioctl(cons->fd, TIOCGWINSZ, &w) < 0)
error("can not get window size of %s: %s\n", tty, strerror(errno));
if (!w.ws_row)
@@ -280,46 +304,56 @@
if (!w.ws_col)
w.ws_col = 80;
- fd2 = -1;
- do {
-
- if ((second = secondtty(tty)) == (char*)0)
- break;
+ memcpy(&o, &cons->otio, sizeof(o));
- if ((fd2 = open(second, O_WRONLY|O_NONBLOCK|O_NOCTTY)) < 0) {
- warn("can not open %s: %s\n", second, strerror(errno));
- goto err;
- }
-
- if ((flags = fcntl(fd2, F_GETFL)) < 0) {
- warn("can not get terminal flags of %s: %s\n", second, strerror(errno));
- goto err;
- }
+ cfmakeraw(&o);
+ o.c_oflag |= ONLCR;
- flags &= ~(O_NONBLOCK);
- flags |= O_NOCTTY;
- if (fcntl(fd2, F_SETFL, flags) < 0) {
- warn("can not set terminal flags of %s: %s\n", second, strerror(errno));
- goto err;
- }
-
- break;
-
- err:
- if (fd2 > -1) close(fd2);
- fd2 = -1;
- free(second);
- second = (char*)0;
+ if (openpty(&ptm, &pts, ptsname, &o, &w) < 0)
+ error("can not open pty/tty pair: %s\n", strerror(errno));
- } while (0);
+ if (fstat(pts, &st) < 0)
+ error("can not stat slave pty : %s\n", strerror(errno));
- if (openpty(&ptm, &pts, ptsname, &t, &w) < 0)
- error("can not open pty/tty pair: %s\n", strerror(errno));
+ secondtty(cons, st.st_rdev);
(void)ioctl(0, TIOCCONS, NULL); /* Undo any current map if any */
if (ioctl(pts, TIOCCONS, NULL) < 0)
error("can not set console device to %s: %s\n", ptsname, strerror(errno));
+ for (c = cons; c; c = c->next) {
+#ifdef _PC_MAX_CANON
+ if ((c->max_canon = (ssize_t)fpathconf(c->fd, _PC_MAX_CANON)) <= 0)
+#endif
+ c->max_canon = _POSIX_MAX_CANON;
+ c->tlock = 0;
+ if (tcgetattr(cons->fd, &cons->otio) < 0)
+ continue;
+ if ((c->otio.c_lflag & ICANON) == 0) {
+ c->otio.c_lflag |= ICANON | IEXTEN | ISIG | ECHO|ECHOE|ECHOK|ECHOKE;
+ c->otio.c_oflag |= OPOST;
+ c->otio.c_iflag |= BRKINT;
+ c->otio.c_iflag &= ~IGNBRK;
+ }
+ c->tlock = 1;
+ memcpy(&c->ltio, &c->otio, sizeof(&c->ltio));
+ if (ioctl(c->fd, TIOCGLCKTRMIOS, &c->ltio) == 0) {
+#ifdef LOCK_TERMIOS
+ struct termios lock;
+ memset(&lock, 0xff, sizeof(lock));
+ (void)ioctl(c->fd, TIOCSLCKTRMIOS, &lock);
+#endif
+ c->tlock = 2;
+ }
+ }
+
+ if (ioctl(pts, TIOCGLCKTRMIOS, &o) == 0) {
+ struct termios lock;
+ memset(&lock, 0xff, sizeof(lock));
+ (void)ioctl(pts, TIOCSLCKTRMIOS, &lock);
+ }
+
+ nsigsys = 0;
set_signal(SIGTTIN, &saved_sigttin, SIG_IGN);
set_signal(SIGTTOU, &saved_sigttou, SIG_IGN);
set_signal(SIGTSTP, &saved_sigtstp, SIG_IGN);
@@ -327,9 +361,11 @@
set_signal(SIGINT, &saved_sigint, sighandle);
set_signal(SIGQUIT, &saved_sigquit, sighandle);
set_signal(SIGTERM, &saved_sigterm, sighandle);
+ set_signal(SIGSYS, &saved_sigsys, sigsys);
(void)siginterrupt(SIGINT, 0);
(void)siginterrupt(SIGQUIT, 0);
(void)siginterrupt(SIGTERM, 0);
+ (void)siginterrupt(SIGSYS, 0);
switch ((pid = fork())) {
case 0:
@@ -337,55 +373,79 @@
setsid();
/* Reconnect our own terminal I/O */
dup2(ptm, 0);
- dup2(fd, 1);
- dup2(fd, 2);
+ dup2(cons->fd, 1);
+ dup2(cons->fd, 2);
+ if (cons->fd > 2) {
+ close(cons->fd);
+ cons->fd = 1; /* Choose stdout */
+ }
close(pts);
close(ptm);
- if (fd > 2)
- close(fd);
break;
case -1:
close(pts);
close(ptm);
- close(fd);
- if (fd2 > 0)
- close(fd2);
- error("can not fork to become daemon: %s\n", strerror(errno));
- break;
+ warn("can not fork to become daemon: %s\n", strerror(errno));
+ goto err;
default:
time(&tt);
stt = ctime(&tt);
close(pts);
close(ptm);
- close(fd);
- if (fd2 > 0)
- close(fd2);
+ close(cons->fd);
+ cons->fd = -1;
+ for (c = cons; c; c = c->next) {
+ if (c->fd > 0) {
+ close(c->fd);
+ c->fd = -1;
+ }
+ }
fprintf(stdout, "\rBoot logging started on %s(%s) at %.24s\n", tty, name, stt);
fflush(stdout);
exit(0);
}
- pidfile();
- prepareIO(reconnect, pgrp, 0, 1, fd2);
+
+ prepareIO(reconnect, pidfile, pgrp, 0);
while (!signaled)
safeIO();
+ (void)tcdrain(1);
+ (void)tcdrain(2);
+
if (!cntrtty)
kill(ppid, SIGSTOP);
closeIO();
if (!cntrtty)
kill(ppid, SIGCONT);
- if (fd2 > 0) {
- (void)tcflush(fd2, TCOFLUSH);
- close(fd2);
- }
- (void)tcflush(1, TCOFLUSH);
- close(1);
- (void)tcflush(2, TCOFLUSH);
- close(2);
- (void)tcflush(0, TCIFLUSH);
- close(0);
- rmfpid();
+ (void)ioctl(0, TIOCSLCKTRMIOS, &o);
+err:
+ for (c = cons; c; c = c->next) {
+ if (c->fd > 0) {
+ if (c->tlock > 1)
+ (void)ioctl(c->fd, TIOCSLCKTRMIOS, &c->ltio);
+ if (c->tlock)
+ tcsetattr(c->fd, TCSANOW, &c->otio);
+ close(c->fd);
+ c->fd = -1;
+ }
+ }
+
+ errno = 0;
+ if ((fd = open("/dev/console", O_RDWR|O_NOCTTY)) >= 0) {
+ (void)ioctl(fd, TIOCCONS, NULL); /* Restore old console mapping */
+ close(fd);
+ }
+
+ if (pid > 0) {
+ (void)tcflush(1, TCOFLUSH);
+ close(1);
+ (void)tcflush(2, TCOFLUSH);
+ close(2);
+ (void)tcflush(0, TCIFLUSH);
+ close(0);
+ rmfpid();
+ }
reset_signal(SIGTTIN, &saved_sigttin);
reset_signal(SIGTTOU, &saved_sigttou);
@@ -394,6 +454,7 @@
reset_signal(SIGINT, &saved_sigint);
reset_signal(SIGQUIT, &saved_sigquit);
reset_signal(SIGTERM, &saved_sigterm);
+ reset_signal(SIGSYS, &saved_sigsys);
return 0;
}
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/showconsole-1.10/blogger.c new/showconsole-1.11/blogger.c
--- old/showconsole-1.10/blogger.c 2003-04-30 16:45:41.000000000 +0200
+++ new/showconsole-1.11/blogger.c 2010-08-24 11:13:21.000000000 +0200
@@ -1,3 +1,17 @@
+/*
+ * blogger.c
+ *
+ * Copyright 2000 Werner Fink, 2000 SuSE GmbH Nuernberg, Germany.
+ *
+ * This source is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ */
+
+#ifndef _GNU_SOURCE
+# define _GNU_SOURCE
+#endif
#include
#include
#include
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/showconsole-1.10/isserial.8 new/showconsole-1.11/isserial.8
--- old/showconsole-1.10/isserial.8 2004-01-09 13:56:54.000000000 +0100
+++ new/showconsole-1.11/isserial.8 2010-08-24 11:17:06.000000000 +0200
@@ -13,7 +13,7 @@
Isserial \- determines if the underlying tty of stdin is a serial line
.br
.SH SYNOPSIS
-.B iserial [< /dev/console]
+.B isserial [< /dev/console]
.SH DESCRIPTION
.B iserial
determines if the underlying character device of
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/showconsole-1.10/isserial.c new/showconsole-1.11/isserial.c
--- old/showconsole-1.10/isserial.c 2004-01-09 13:56:54.000000000 +0100
+++ new/showconsole-1.11/isserial.c 2010-08-19 14:24:19.000000000 +0200
@@ -1,3 +1,14 @@
+/*
+ * isserial.c
+ *
+ * Copyright 2000 Werner Fink, 2000 SuSE GmbH Nuernberg, Germany.
+ *
+ * This source is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ */
+
#include
#include
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/showconsole-1.10/libblogger.c new/showconsole-1.11/libblogger.c
--- old/showconsole-1.10/libblogger.c 2009-08-20 11:23:55.000000000 +0200
+++ new/showconsole-1.11/libblogger.c 2010-08-24 13:10:05.000000000 +0200
@@ -1,3 +1,14 @@
+/*
+ * libblogger.c
+ *
+ * Copyright 2000 Werner Fink, 2000 SuSE GmbH Nuernberg, Germany.
+ *
+ * This source is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ */
+
#ifndef _PATH_BLOG_FIFO
# define _PATH_BLOG_FIFO "/dev/blog"
#endif
@@ -32,7 +43,7 @@
static int fdfifo = -1;
static char * fifo_name = _PATH_BLOG_FIFO;
-static int bootlog_init(const int lvl)
+static int bootlog_init(const int lvl __attribute__((__unused__)))
{
int ret = -1;
struct stat st;
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/showconsole-1.10/libblogger.h new/showconsole-1.11/libblogger.h
--- old/showconsole-1.10/libblogger.h 2001-12-14 18:34:46.000000000 +0100
+++ new/showconsole-1.11/libblogger.h 2010-08-24 11:13:53.000000000 +0200
@@ -1,3 +1,14 @@
+/*
+ * libblogger.h
+ *
+ * Copyright 2000 Werner Fink, 2000 SuSE GmbH Nuernberg, Germany.
+ *
+ * This source is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ */
+
extern int bootlog(const int lvl, const char *fmt, ...);
extern void closeblog();
#define B_NOTICE ((int)'n') /* Notice */
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/showconsole-1.10/libconsole.c new/showconsole-1.11/libconsole.c
--- old/showconsole-1.10/libconsole.c 2009-08-20 14:00:28.000000000 +0200
+++ new/showconsole-1.11/libconsole.c 2010-08-24 13:08:15.000000000 +0200
@@ -1,4 +1,18 @@
+/*
+ * libconsole.c
+ *
+ * Copyright 2000 Werner Fink, 2000 SuSE GmbH Nuernberg, Germany.
+ *
+ * This source is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ */
+
#undef BLOGD_EXT
+#ifndef _GNU_SOURCE
+# define _GNU_SOURCE
+#endif
#ifndef LOG_BUFFER_SIZE
# define LOG_BUFFER_SIZE 65536
#endif
@@ -107,7 +121,7 @@
iprev = st->st_ino;
do {
- size_t cnt;
+ ssize_t cnt;
char *prev_file;
if (!S_ISLNK(st->st_mode)) // Not a symlink
@@ -155,15 +169,15 @@
/*
* Arg used: safe out
*/
-static void (*vc_reconnect)(int fd) = NULL;
-static inline void safeout (int fd, const char *ptr, size_t s)
+static void (*vc_reconnect)(int fd);
+static inline void safeout (int fd, const char *ptr, size_t s, ssize_t max)
{
int saveerr = errno;
int repeated = 0;
static int eiocount;
while (s > 0) {
- ssize_t p = write (fd, ptr, s);
+ ssize_t p = write (fd, ptr, (max < 0) ? s : ((s < (size_t)max) ? s : (size_t)max));
if (p < 0) {
if (errno == EPIPE) {
warn("error on writing to fd %d: %s\n", fd, STRERR);
@@ -216,7 +230,7 @@
/*
* Twice used: safe in
*/
-static inline ssize_t safein (int fd, char *ptr, size_t s, const int noerr)
+static inline ssize_t safein (int fd, char *ptr, size_t s, const int noerr)
{
int saveerr = errno;
ssize_t r = 0;
@@ -282,15 +296,15 @@
/*
* The stdio file pointer for our log file
*/
+struct console *restrict cons;
static FILE * flog = NULL;
-static int fdwrite = -1;
-static int fdsec = -1;
static int fdread = -1;
static int fdfifo = -1;
/*
* Signal control for writing on log file
*/
+volatile sig_atomic_t nsigsys = 0;
static volatile sig_atomic_t nsigio = -1;
static sigset_t save_oldset;
@@ -349,7 +363,7 @@
static inline void storelog(const unsigned char *const buf, const size_t len)
{
- if (len > end - tail) {
+ if (len > (size_t)(end - tail)) {
static int be_warned = 0;
if (!be_warned) {
warn("log buffer exceeded\n");
@@ -382,7 +396,7 @@
static inline void writelog(void)
{
if (!flog)
- goto xout;;
+ goto xout;
clearerr(flog);
lock(&llock);
while (avail > 0) {
@@ -676,9 +690,9 @@
/* Release the lock while doing IO */
unlock(&llock);
if ((len = snprintf(echo, sizeof(echo), "\033[%lu;%dR", line, nl)) > 0)
- safeout(fdread, echo, len);
+ safeout(fdread, echo, len, -1);
else
- safeout(fdread, "\033R", 2);
+ safeout(fdread, "\033R", 2, -1);
tcdrain(fdread);
lock(&llock);
}
@@ -703,7 +717,7 @@
unlock(&llock);
}
-static void *action(void *dummy)
+static void *action(void *dummy attribute((unused)))
{
sigset_t sigset, save_oldset;
sigemptyset(&sigset);
@@ -715,6 +729,7 @@
sigaddset(&sigset, SIGINT);
sigaddset(&sigset, SIGQUIT);
sigaddset(&sigset, SIGTERM);
+ sigaddset(&sigset, SIGSYS);
(void)pthread_sigmask(SIG_BLOCK, &sigset, &save_oldset);
lock(&ljoin);
@@ -739,15 +754,15 @@
* Prepare I/O
*/
static const char *fifo_name = _PATH_BLOG_FIFO;
+static void (*vr_access)(void);
static pid_t pgroup = -1;
-void prepareIO(void (*rfunc)(int), const pid_t pgrp, const int in, const int out, const int second)
+void prepareIO(void (*rfunc)(int), void (*pfunc)(void), const pid_t pgrp, const int in)
{
vc_reconnect = rfunc;
+ vr_access = pfunc;
pgroup = pgrp;
fdread = in;
- fdwrite = out;
- fdsec = second;
if (fifo_name && fdfifo < 0) {
struct stat st;
@@ -800,7 +815,9 @@
struct winsize wz;
if (cnt > 0) {
- if (ioctl(fdwrite, TIOCGWINSZ, &wz) == 0) {
+ struct console * c;
+
+ if (ioctl(cons->fd, TIOCGWINSZ, &wz) == 0) {
if (memcmp(&owz, &wz, sizeof(struct winsize))) {
ioctl(fdread, TIOCSWINSZ, &wz);
(void)memcpy(&owz, &wz, sizeof(struct winsize));
@@ -810,12 +827,11 @@
}
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);
-
- if (fdsec > 0) {
- safeout(fdsec, (char*)trans, cnt); /* Write copy of input to second tty */
- (void)tcdrain(fdsec);
+ for (c = cons; c; c = c->next) {
+ if (c->fd < 0)
+ continue;
+ safeout(c->fd, (char*)trans, cnt, c->max_canon);
+ (void)tcdrain(c->fd); /* Write copy of input to real tty */
}
flushlog();
@@ -871,6 +887,10 @@
error("Can not open %s: %s\n", BOOT_LOGFILE, STRERR);
goto skip;
}
+ if (vr_access) {
+ (*vr_access)();
+ vr_access = NULL;
+ }
if ((flog = fdopen (log, "a")) == NULL)
error("Can not open %s: %s\n", BOOT_LOGFILE, STRERR);
@@ -915,6 +935,15 @@
pthread_setschedparam(pthread_self(), policy, ¶m);
pthread_setschedparam(lthread, policy, ¶m);
}
+
+ if (nsigsys) { /* Stop writing logs to disk, only repeat messages */
+ if (flog)
+ closeIO();
+ if (nsigio < 0) {
+ nsigio = SIGIO;
+ (void)signal(SIGIO, SIG_IGN);
+ }
+ }
}
/*
@@ -923,17 +952,18 @@
void closeIO(void)
{
struct timeval timeout;
+ struct console * c;
int n = 240;
/* Maybe we've catched a signal, therefore */
- if (flog) {
- fflush(flog); /* Clear out stdio buffers */
- fdatasync(fileno(flog));
- } else
+ if (!flog && !nsigsys)
warn("no message logging because /var file system is not accessible\n");
- (void)tcdrain(fdwrite); /* Hold in sync with console */
- if (fdsec > 0)
- (void)tcdrain(fdsec); /* Hold in sync with second console */
+
+ for (c = cons; c; c = c->next) {
+ if (c->fd < 0)
+ continue;
+ (void)tcdrain(c->fd); /* Hold in sync with console */
+ }
do {
/*
@@ -949,9 +979,8 @@
timeout.tv_usec = 25*1000;
more_input(&timeout, 1);
+ (void)tcdrain(fdread);
- if (!flog)
- break;
} while (timeout.tv_sec || timeout.tv_usec);
if (running) {
@@ -976,10 +1005,11 @@
(void)fclose(flog);
flog = NULL;
xout:
- (void)tcdrain(fdwrite);
- if (fdsec > 0)
- (void)tcdrain(fdsec);
-
+ for (c = cons; c; c = c->next) {
+ if (c->fd < 0)
+ continue;
+ (void)tcdrain(c->fd);
+ }
return;
}
@@ -1082,7 +1112,7 @@
return tty;
}
-static int checkdev(char ** retname, unsigned int tty, DIR * dev)
+static int checkdev(char ** retname, const dev_t rdev, DIR * dev)
{
int found = 0;
struct dirent * d;
@@ -1164,7 +1194,7 @@
error("can not opendir(%s): %s\n", name, STRERR);
pushd(name);
deep++;
- found = checkdev(retname, tty, cur);
+ found = checkdev(retname, rdev, cur);
deep--;
popd();
closedir(cur);
@@ -1178,7 +1208,7 @@
if (!S_ISCHR(st.st_mode))
continue;
- if ((dev_t)tty != st.st_rdev)
+ if (rdev != st.st_rdev)
continue;
/*
@@ -1256,30 +1286,32 @@
}
/* Do we have some more system console around? */
-char * secondtty(char * compare)
+void secondtty(struct console *restrict cons, const dev_t tty)
{
- char buf[1024], *ptr, *shcmp, *res = (char*)0;
- unsigned int tty = 0, found = 0;
+ char buf[1024], *ptr, *shcmp;
int fd = -1, len;
char * name = (char*)0;
DIR * dev;
+ if (!cons || !cons->tty)
+ error("no primary console\n");
+
if ((fd = open("/proc/cmdline", O_RDONLY|O_NOCTTY)) < 0) {
warn("can not open /proc/cmdline\n");
- goto out;
+ return;
}
if ((len = read(fd, buf, sizeof(buf) - 1)) < 0) {
warn("can not read /proc/cmdline\n");
close(fd);
- goto out;
+ return;
}
close(fd);
if (len == 0)
- goto out;
+ return;
- shcmp = compare;
+ shcmp = cons->tty;
if (!strncmp(shcmp, "/dev/", 5))
shcmp += 5;
@@ -1288,15 +1320,20 @@
*/
if (!strncmp(shcmp, "tty", 3)) {
size_t len = strspn(shcmp + 3, "123456789");
-
- if (strlen(shcmp) == len + 3) {
- compare = "/dev/tty0";
+ if (strlen(shcmp) == len + 3)
shcmp = "tty0";
- }
}
+ if (!(dev = opendir("/dev")))
+ error("can not opendir(/dev): %s\n", STRERR);
+ pushd("/dev");
+
ptr = &buf[len];
while (ptr >= &buf[0]) {
+ char *res = (char*)0;
+ struct stat st;
+ int flags;
+
if (*ptr == ',' || *ptr == ' ' || *ptr == '\t' || *ptr == '\r' || *ptr == '\n') {
*ptr-- = 0;
continue;
@@ -1307,71 +1344,61 @@
if (!strncmp(console, "/dev/", 5))
console += 5;
+ if (!strcmp(console, "brl"))
+ console += 4;
+
/*
* Compare known console tty with that of the kernel command
* line. If already known skip this console tty and search
* for the next one.
*/
- if (strcmp(shcmp, console)) {
+ if (strcmp(shcmp, console))
res = console; /* New device not identical to tty */
- break;
- }
}
ptr--;
- }
- if (!res)
- goto out;
-
- if (!(dev = opendir("/dev")))
- error("can not opendir(/dev): %s\n", STRERR);
- pushd("/dev");
-
- /* Open second console e.g. /dev/tty0 */
- if ((fd = open(res, O_RDWR|O_NONBLOCK|O_NOCTTY)) < 0)
- goto out;
+ if (!res)
+ continue;
- /*
- * We do this because if we would write out the buffered
- * messages to e.g. /dev/tty0 after this we would (re)read
- * those and buffer them again which leads to an endless loop.
- */
-#ifdef TIOCGDEV
- if (ioctl (fd, TIOCGDEV, &tty) < 0) {
- if (errno == EINVAL && !getenv("NOTIOCGDEV"))
- warn("Warning: the ioctl TIOCGDEV is not known by the kernel\n");
- close(fd);
- popd();
- closedir(dev);
- goto out;
- }
-#else
-# error The ioctl TIOCGDEV is not defined (SuSE TIOCGDEV patch is missed)
-#endif
- close(fd);
+ if (stat(res, &st) < 0) {
+ warn("can not stat /dev/%s: %s\n", res, strerror(errno));
+ continue;
+ }
- /* Try to open the real device e.g. /dev/tty1 */
- found = checkdev(&name, tty, dev);
+ if (st.st_rdev == tty)
+ continue;
- popd();
- closedir(dev);
+ if (!checkdev(&name, st.st_rdev, dev) || !name) {
+ if (name) {
+ free(name);
+ name = (char*)0;
+ }
+ continue;
+ }
- if (!name)
- goto out;
+ cons = cons->next;
+ if (posix_memalign((void*)&cons, sizeof(void*), alignof(typeof(struct console))) != 0)
+ error("memory allocation: %s\n", strerror(errno));
+
+ cons->next = (struct console*)0;
+ cons->tty = name;
+ if ((cons->fd = open(cons->tty, O_WRONLY|O_NONBLOCK|O_NOCTTY)) < 0) {
+ warn("can not open %s: %s\n", cons->tty, strerror(errno));
+ continue;
+ }
- if (!found) {
- free(name);
- name = (char*)0;
- goto out;
- }
+ if ((flags = fcntl(cons->fd, F_GETFL)) < 0) {
+ warn("can not get terminal flags of %s: %s\n", cons->tty, strerror(errno));
+ continue;
+ }
- if (!strcmp(compare, name)) {
- free(name);
- name = (char*)0;
- goto out; /* Already in use */
+ flags &= ~(O_NONBLOCK);
+ flags |= O_NOCTTY;
+ if (fcntl(cons->fd, F_SETFL, flags) < 0) {
+ warn("can not set terminal flags of %s: %s\n", cons->tty, strerror(errno));
+ }
}
- return name;
-out:
- return (char*)0;
+ popd();
+ closedir(dev);
}
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/showconsole-1.10/libconsole.h new/showconsole-1.11/libconsole.h
--- old/showconsole-1.10/libconsole.h 2008-06-13 13:31:59.000000000 +0200
+++ new/showconsole-1.11/libconsole.h 2010-08-24 13:25:41.000000000 +0200
@@ -1,7 +1,50 @@
-extern void pushd(const char * path);
+/*
+ * listing.h
+ *
+ * Copyright 2000 Werner Fink, 2000 SuSE GmbH Nuernberg, Germany.
+ *
+ * This source is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ */
+
+#include
+#include
+#if !defined(__STDC_VERSION__) || (__STDC_VERSION__ < 199901L)
+# ifndef inline
+# define inline __inline__
+# endif
+# ifndef restrict
+# define restrict __restrict__
+# endif
+# ifndef volatile
+# define volatile __volatile__
+# endif
+# ifndef asm
+# define asm __asm__
+# endif
+# ifndef extension
+# define extension __extension__
+# endif
+#endif
+#ifndef attribute
+# define attribute(attr) __attribute__(attr)
+#endif
+struct console {
+ char * tty;
+ int fd, tlock;
+ ssize_t max_canon;
+ struct termios ltio, otio;
+ struct console *restrict next;
+};
+extern void pushd(const char *);
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 pid_t pgrp, const int in, const int out, const int second);
+extern char * fetchtty(const pid_t, const pid_t, unsigned int *);
+extern void secondtty(struct console *restrict, const dev_t);
+extern void prepareIO(void (*rfunc)(int), void (*pfunc)(void), const pid_t, const int);
extern void safeIO (void);
extern void closeIO(void);
+extern struct console *restrict cons;
+#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/showconsole-1.10/showconsole-1.10.lsm new/showconsole-1.11/showconsole-1.10.lsm
--- old/showconsole-1.10/showconsole-1.10.lsm 2009-08-20 14:00:32.000000000 +0200
+++ new/showconsole-1.11/showconsole-1.10.lsm 1970-01-01 01:00:00.000000000 +0100
@@ -1,15 +0,0 @@
-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
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/showconsole-1.10/showconsole-1.11.lsm new/showconsole-1.11/showconsole-1.11.lsm
--- old/showconsole-1.10/showconsole-1.11.lsm 1970-01-01 01:00:00.000000000 +0100
+++ new/showconsole-1.11/showconsole-1.11.lsm 2010-08-24 15:53:51.000000000 +0200
@@ -0,0 +1,15 @@
+Begin3
+Title: console tools for boot scripts
+Version: 1.11
+Entered-date: 24AUG10
+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.11.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.10/showconsole.c new/showconsole-1.11/showconsole.c
--- old/showconsole-1.10/showconsole.c 2008-03-13 16:43:29.000000000 +0100
+++ new/showconsole-1.11/showconsole.c 2010-08-19 14:26:50.000000000 +0200
@@ -1,3 +1,14 @@
+/*
+ * showconsole.c
+ *
+ * Copyright 2000 Werner Fink, 2000 SuSE GmbH Nuernberg, Germany.
+ *
+ * This source is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ */
+
#include /* Defines the macros major and minor */
#include
#include
++++++ startpar-0.56.dif ++++++
--- /var/tmp/diff_new_pack.Z6yACZ/_old 2010-08-24 18:08:24.000000000 +0200
+++ /var/tmp/diff_new_pack.Z6yACZ/_new 2010-08-24 18:08:24.000000000 +0200
@@ -1,4 +1,12 @@
---- .dummy
-+++ .dummy 2010-07-29 16:15:03.330924455 +0000
-@@ -0,0 +1 @@
-+Dummy
+--- startpar.c
++++ startpar.c 2010-08-24 12:33:01.061618653 +0000
+@@ -464,7 +464,8 @@ void run(struct prg *p)
+ _exit(1);
+ }
+ TEMP_FAILURE_RETRY(dup2(1, 2));
+- tio.c_oflag &= ~OPOST;
++ cfmakeraw(&tio);
++ tio.c_oflag |= ONLCR;
+ if (tcsetattr(1, TCSANOW, &tio))
+ perror("tcsetattr");
+ if (wzok)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Remember to have fun...
--
To unsubscribe, e-mail: opensuse-commit+unsubscribe@opensuse.org
For additional commands, e-mail: opensuse-commit+help@opensuse.org