OBS User unknown 2009-03-26 23:43:28 +00:00 committed by Git OBS Bridge
parent 9d6013b133
commit 7a8f1764ed
4 changed files with 131 additions and 1 deletions

31
startpar-bootchart.diff Normal file
View File

@ -0,0 +1,31 @@
--- startpar.c 2009-03-25 16:52:25.357391610 +0100
+++ startpar.c 2009-03-25 21:22:50.145032810 +0100
@@ -368,6 +368,7 @@
if (!strcmp(arg, "start"))
{
int s, t, len;
+ pid_t child;
struct sockaddr_un remote;
char str[100];
@@ -397,6 +398,20 @@
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
+ */
+ child = fork();
+ if (child) {
+ int status;
+ int ret = waitpid(child, &status, 0);
+ if (ret == -1)
+ perror("waitpid");
+ exit(WEXITSTATUS(status));
+ }
}
}

77
startpar-preload.diff Normal file
View File

@ -0,0 +1,77 @@
--- startpar.c 2009-03-25 16:16:59.308479056 +0100
+++ startpar.c 2009-03-25 16:52:25.357391610 +0100
@@ -85,6 +85,19 @@
static int pidpipe[2];
static double iorate = 800.0;
+void sighandler_nopreload(int x)
+{
+ (void)x;
+ ispreload = NoPreload;
+}
+
+
+void sighandler_preload(int x)
+{
+ (void)x;
+ ispreload = Preload;
+}
+
void *xcalloc(size_t nmemb, size_t size)
{
void *r;
@@ -253,14 +266,14 @@
return par;
/* if we have preload running, we expect I/O not to be a problem */
- if (ispreload == Preload)
+ if (ispreload != NoPreload)
prcs_blked = 0;
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)
@@ -284,6 +297,7 @@
void run(struct prg *p)
{
char *m = 0;
+ pid_t parent = getpid();
p->len = 0;
p->pid = (pid_t)0;
@@ -368,7 +382,8 @@
t = connect(s, (struct sockaddr *)&remote, len);
if (t != -1)
{
- ispreload = Preload;
+ if (ispreload != Preload)
+ kill(parent, SIGUSR1);
send(s, p->name, strlen(p->name), 0);
recv(s, str, 100, 0);
}
@@ -379,7 +394,7 @@
* 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.
*/
- ispreload = NoPreload;
+ kill(parent, SIGUSR2);
}
close(s);
}
@@ -601,6 +616,9 @@
char *run_level = getenv("RUNLEVEL");
char *splashopt = 0;
+ (void)signal(SIGUSR1, sighandler_preload);
+ (void)signal(SIGUSR2, sighandler_nopreload);
+
(void)signal(SIGCHLD, SIG_DFL);
numcpu = sysconf(_SC_NPROCESSORS_ONLN);
myname = argv[0];

View File

@ -1,3 +1,15 @@
-------------------------------------------------------------------
Wed Mar 25 21:32:51 CET 2009 - coolo@suse.de
- exec one more time so that the preload part does not appear
under the name of the init script in bootcharts
-------------------------------------------------------------------
Wed Mar 25 18:06:13 CET 2009 - coolo@suse.de
- fix the preload functionality in telling the parent process through
SIGUSR1 and SIGUSR2 about preload's presence
------------------------------------------------------------------- -------------------------------------------------------------------
Fri Mar 13 17:58:53 CET 2009 - werner@suse.de Fri Mar 13 17:58:53 CET 2009 - werner@suse.de

View File

@ -30,7 +30,7 @@ Group: System/Base
PreReq: coreutils PreReq: coreutils
AutoReqProv: on AutoReqProv: on
Version: 2.86 Version: 2.86
Release: 201 Release: 202
Summary: SysV-Style init Summary: SysV-Style init
BuildRoot: %{_tmppath}/%{name}-%{version}-build BuildRoot: %{_tmppath}/%{name}-%{version}-build
BuildRequires: libselinux-devel libsepol-devel BuildRequires: libselinux-devel libsepol-devel
@ -63,6 +63,8 @@ Patch16: sysvinit-2.86-full-time.patch
Patch17: sysvinit-2.86-hddown.patch Patch17: sysvinit-2.86-hddown.patch
Patch18: sysvinit-2.86-selinux.patch Patch18: sysvinit-2.86-selinux.patch
Patch19: sysvinit-2.86-fuse-no-kill.patch Patch19: sysvinit-2.86-fuse-no-kill.patch
Patch20: startpar-preload.diff
Patch21: startpar-bootchart.diff
%description %description
System V style init programs by Miquel van Smoorenburg that control the System V style init programs by Miquel van Smoorenburg that control the
@ -110,6 +112,8 @@ pushd ../showconsole-%{SCVER}
popd popd
pushd ../startpar-%{START} pushd ../startpar-%{START}
%patch -P 14 %patch -P 14
%patch -P 20
%patch -P 21
popd popd
%_fixowner . %_fixowner .
%_fixgroup . %_fixgroup .
@ -323,6 +327,12 @@ rm -rf ${RPM_BUILD_ROOT}
%doc %{_mandir}/man8/mkill.8.gz %doc %{_mandir}/man8/mkill.8.gz
%changelog %changelog
* Wed Mar 25 2009 coolo@suse.de
- exec one more time so that the preload part does not appear
under the name of the init script in bootcharts
* Wed Mar 25 2009 coolo@suse.de
- fix the preload functionality in telling the parent process through
SIGUSR1 and SIGUSR2 about preload's presence
* Fri Mar 13 2009 werner@suse.de * Fri Mar 13 2009 werner@suse.de
- mkill: avoid signaling process which are on shadow mounts points - mkill: avoid signaling process which are on shadow mounts points
that is e.g. processes on /dev/pts while running mkill on /dev that is e.g. processes on /dev/pts while running mkill on /dev