OBS User unknown 2008-06-23 02:34:49 +00:00 committed by Git OBS Bridge
parent d9a0503d97
commit 73f7c9f223
4 changed files with 196 additions and 11 deletions

99
showconsole-1.09.dif Normal file
View File

@ -0,0 +1,99 @@
--- blogd.c
+++ blogd.c 2008-06-13 13:30:56.867756846 +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 2008-06-13 13:38:25.436903735 +0200
@@ -724,10 +724,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;
@@ -778,9 +780,19 @@ static void more_input (struct timeval *
if (FD_ISSET(fdread, &watch)) {
const ssize_t cnt = safein(fdread, (char*)trans, sizeof(trans));
+ 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);
--- libconsole.h
+++ libconsole.h 2008-06-13 13:31:59.302034490 +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);

View File

@ -1,5 +1,5 @@
--- COPYING
+++ COPYING 2008-01-07 15:43:31.885812792 +0100
+++ COPYING 2008-01-07 15:43:31.885812000 +0100
@@ -2,7 +2,7 @@
Version 2, June 1991
@ -22,7 +22,7 @@
Also add information on how to contact you by electronic and paper mail.
--- makeboot.c
+++ makeboot.c 2007-10-31 18:42:03.145266987 +0100
+++ makeboot.c 2007-10-31 18:42:03.145266000 +0100
@@ -339,6 +339,10 @@ struct makenode *pickup_task(void)
best = node;
}
@ -72,7 +72,7 @@
+}
+#endif
--- proc.c
+++ proc.c 2008-01-07 15:43:31.809803114 +0100
+++ proc.c 2008-01-07 15:43:31.809803000 +0100
@@ -13,8 +13,8 @@
*
* You should have received a copy of the GNU General Public License
@ -93,7 +93,7 @@
blocked = scan_one(StatBuf, "procs_blocked");
--- proc.h
+++ proc.h 2008-01-07 15:43:31.913816357 +0100
+++ proc.h 2008-01-07 15:43:31.913816000 +0100
@@ -12,8 +12,8 @@
*
* You should have received a copy of the GNU General Public License
@ -106,7 +106,7 @@
****************************************************************
*/
--- startpar.8
+++ startpar.8 2008-01-07 15:43:31.845807697 +0100
+++ startpar.8 2008-01-07 15:43:31.845807000 +0100
@@ -85,11 +85,11 @@ like behaviour. This option takes three
.IR boot ", " start ", and " stop
for reading
@ -131,7 +131,7 @@
.SH COPYRIGHT
2003,2004 SuSE Linux AG, Nuernberg, Germany.
--- startpar.c
+++ startpar.c 2008-01-07 15:43:31.801802095 +0100
+++ startpar.c 2008-06-17 15:01:28.643966080 +0200
@@ -12,8 +12,8 @@
*
* You should have received a copy of the GNU General Public License
@ -143,6 +143,15 @@
*
****************************************************************
*/
@@ -48,7 +48,7 @@ static long int numcpu = -1;
static char *myname;
static struct termios tio;
static struct winsize wz;
-static int wzok;
+static sig_atomic_t wzok;
static char *arg;
static struct sigaction sa;
static struct timeval glastio;
@@ -72,7 +72,7 @@ struct prg {
static struct prg *prgs;
static int inpar, par;
@ -163,7 +172,41 @@
#if DEBUG
fprintf(stderr, "checksystem par=%d newpar=%d (prcs_run=%u) %ld\n", par, newpar, prcs_run, time(0));
@@ -573,9 +573,9 @@ int main(int argc, char **argv)
@@ -318,7 +318,7 @@ void run(struct prg *p)
tio.c_oflag &= ~OPOST;
if (tcsetattr(1, TCSANOW, &tio))
perror("tcsetattr");
- if (wzok && ioctl(0, TIOCSWINSZ, &wz))
+ if (wzok && ioctl(1, TIOCSWINSZ, &wz))
perror("TIOCSWINSZ");
}
else
@@ -490,12 +490,23 @@ void detach(struct prg *p, const int sto
p->fd = 0;
}
-void sigchld(int sig __attribute__ ((unused)))
+static void sigchld(int sig __attribute__ ((unused)))
{
char c = 0;
write(pidpipe[1], &c, 1);
}
+static void sigwinch(int sig __attribute__ ((unused)))
+{
+ if (ioctl(0, TIOCGWINSZ, &wz) < 0)
+ {
+ wzok = 0;
+ return;
+ }
+ if (wz.ws_row == 0) wz.ws_row = 24;
+ if (wz.ws_col == 0) wz.ws_col = 80;
+}
+
void usage(int status)
{
fprintf(stderr, "usage: startpar [options] [-a arg] prgs\n");
@@ -573,9 +584,9 @@ int main(int argc, char **argv)
usage(0);
break;
case 'i':
@ -176,7 +219,32 @@
break;
default:
usage(1);
@@ -1036,9 +1036,13 @@ int main(int argc, char **argv)
@@ -691,6 +702,15 @@ int main(int argc, char **argv)
if (!gtimo_buf)
gtimo_bufsize = 0; /* Accept error due memory shortage */
+ sa.sa_handler = sigwinch;
+ sa.sa_flags = SA_RESTART|SA_NODEFER;
+ (void)sigemptyset(&sa.sa_mask);
+ if (sigaction(SIGWINCH, &sa, 0))
+ {
+ perror("sigwinch sigaction");
+ exit(1);
+ }
+
if (tcgetattr(0, &tio))
{
perror("tcgetattr");
@@ -698,6 +718,8 @@ int main(int argc, char **argv)
}
if (ioctl(0, TIOCGWINSZ, &wz) == 0)
wzok = 1;
+ if (wz.ws_row == 0) wz.ws_row = 24;
+ if (wz.ws_col == 0) wz.ws_col = 80;
if (pipe(pidpipe))
{
@@ -1036,9 +1058,13 @@ int main(int argc, char **argv)
exit (1);
}
#endif

View File

@ -1,3 +1,15 @@
-------------------------------------------------------------------
Fri Jun 13 13:41:43 CEST 2008 - werner@suse.de
- Let blogd detect changes of screen size, set new size pty pair,
and if process group is not init send a SIGWINCH (bnc#259577)
- In startpar use a signal handler on SIGWINCH (bnc#259577)
-------------------------------------------------------------------
Wed Jun 11 14:58:49 CEST 2008 - werner@suse.de
- Startpar: try to reduce race if kbd change tty size (bnc#259577)
-------------------------------------------------------------------
Tue May 20 14:31:14 CEST 2008 - werner@suse.de

View File

@ -23,7 +23,7 @@ Group: System/Base
PreReq: coreutils
AutoReqProv: on
Version: 2.86
Release: 146
Release: 150
Summary: SysV-Style init
BuildRoot: %{_tmppath}/%{name}-%{version}-build
Source: sysvinit-2.86.tar.bz2
@ -42,7 +42,7 @@ 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.09.dif
Patch11: sysvinit-2.86-race.patch
Patch12: sysvinit-2.86-lib64.patch
Patch13: sysvinit-2.82-multiline.patch
@ -91,7 +91,7 @@ pushd ../killproc-%{KPVER}
#%patch -P 3
popd
pushd ../showconsole-%{SCVER}
#%patch -P 10
%patch -P 10
popd
pushd ../startpar-%{START}
%patch -P 14
@ -285,6 +285,12 @@ rm -rf ${RPM_BUILD_ROOT}
%doc %{_mandir}/man8/startpar.8.gz
%changelog
* Fri Jun 13 2008 werner@suse.de
- Let blogd detect changes of screen size, set new size pty pair,
and if process group is not init send a SIGWINCH (bnc#259577)
- In startpar use a signal handler on SIGWINCH (bnc#259577)
* Wed Jun 11 2008 werner@suse.de
- Startpar: try to reduce race if kbd change tty size (bnc#259577)
* Tue May 20 2008 werner@suse.de
- On halt flush not only unmanged disk but also removable devices
like usb sticks (bnc#386487 related to bnc#229210)