Dr. Werner Fink 2009-12-04 14:15:20 +00:00 committed by Git OBS Bridge
parent 30ec649d5a
commit 3a8b3fee71
7 changed files with 292 additions and 40 deletions

View File

@ -1,6 +1,70 @@
--- .dummy
+++ .dummy 2009-08-19 10:18:39.181901099 +0000
@@ -0,0 +1 @@
+this is a dummy, remove if real changes are required
--- checkproc.c
+++ checkproc.c 2009-12-03 16:44:04.899747448 +0000
@@ -92,7 +92,6 @@ int main(int argc, char **argv)
/* Allocate here: address optarg (current *argv) isn't freeable */
if (optarg && !pid_file) {
pid_file = xstrdup(optarg);
- pid_forced = true;
} else
error(WRGSYNTAX, "Option -p requires pid file to read pid from\n");
break;
@@ -148,7 +147,8 @@ int main(int argc, char **argv)
pid_file = (char*) xmalloc(DEFPIDLEN+strlen(basename)+1);
pid_file = strcat(strcat(strcpy(pid_file,DEFPIDDIR),basename),DEFPIDEXT);
}
- }
+ } else
+ pid_forced = true;
/* Check and verify the pid file */
errno = 0;
--- killproc.c
+++ killproc.c 2009-12-03 16:54:05.999429895 +0000
@@ -135,7 +135,6 @@ int main(int argc, char **argv)
/* Allocate here: address optarg (current *argv) isn't freeable */
if (optarg && !pid_file) {
pid_file = xstrdup(optarg);
- pid_forced = true;
} else
error(LSB_WRGSYN,"Option -p requires pid file to read pid from\n");
break;
@@ -218,7 +217,8 @@ int main(int argc, char **argv)
/* No pid file means that we have to search in /proc/ */
free(pid_file);
pid_file = NULL;
- }
+ } else
+ pid_forced = true;
if (pid_file && !st.st_size) {
warn("Empty pid file %s for %s\n", pid_file, fullname);
--- libinit.c
+++ libinit.c 2009-09-29 10:42:09.875428620 +0200
@@ -446,9 +446,9 @@ static pid_t getpppid(const pid_t ppid)
+++ libinit.c 2009-10-28 09:47:13.711429753 +0000
@@ -320,13 +320,15 @@ static ssize_t xread(int fd, void *inbuf
while (1) {
errno = 0;
bytes = read(fd, inbuf, count);
- if (bytes < 0 && (errno == EINTR || errno == EAGAIN))
- continue;
- if (bytes < 0)
+ if (bytes < 0) {
+ if (errno == EINTR || errno == EAGAIN)
+ continue;
+ if (errno == ESRCH)
+ goto out;
break;
+ }
goto out;
}
-
warn("xread error: %s\n", strerror(errno));
out:
errno = olderr;
@@ -446,9 +448,9 @@ static pid_t getpppid(const pid_t ppid)
goto out;
if ((fp = open(proc(pid, "stat"), O_PROCMODE)) != -1) {
@ -12,7 +76,7 @@
warn("can not read ppid for process %d!\n", ppid);
}
out:
@@ -591,10 +591,11 @@ int pidof (const char * inname, const ch
@@ -591,10 +593,11 @@ int pidof (const char * inname, const ch
char ent[3];
boolean thread;
ssize_t len;
@ -25,7 +89,7 @@
continue;
thread = (strncmp(ent, "0 ", 2) == 0);
@@ -682,6 +683,9 @@ int pidof (const char * inname, const ch
@@ -682,6 +685,9 @@ int pidof (const char * inname, const ch
len = xread(fp, entry, PATH_MAX);
close(fp);
@ -35,7 +99,7 @@
/* Seek for a script not for a binary */
if (!(scrpt = checkscripts(entry, root, len, d->d_name)))
continue;
@@ -713,7 +717,7 @@ int pidof (const char * inname, const ch
@@ -713,7 +719,7 @@ int pidof (const char * inname, const ch
len = xread(fp, entry, PATH_MAX);
close(fp);
@ -44,7 +108,7 @@
continue;
comm = index(entry, ' ');
@@ -764,7 +768,8 @@ int verify_pidfile (const char * pid_fil
@@ -764,7 +770,8 @@ int verify_pidfile (const char * pid_fil
const char * root, unsigned short flags,
const boolean ignore)
{
@ -54,7 +118,7 @@
boolean isscrpt = false;
pid_t pid;
char *swapname = NULL, *bufp;
@@ -789,11 +794,12 @@ int verify_pidfile (const char * pid_fil
@@ -789,11 +796,12 @@ int verify_pidfile (const char * pid_fil
}
errno = 0;
@ -69,7 +133,7 @@
buf[cnt] = '\0';
bufp = buf;
@@ -847,10 +853,11 @@ int verify_pidfile (const char * pid_fil
@@ -847,10 +855,11 @@ int verify_pidfile (const char * pid_fil
char ent[3];
boolean thread;
ssize_t len;
@ -82,7 +146,7 @@
goto out;
thread = (strncmp(ent, "0 ", 2) == 0);
@@ -932,6 +939,9 @@ int verify_pidfile (const char * pid_fil
@@ -932,6 +941,9 @@ int verify_pidfile (const char * pid_fil
len = xread(fp, entry, PATH_MAX);
close(fp);
@ -92,7 +156,7 @@
/* Seek for a script not for a binary */
if (!(scrpt = checkscripts(entry, root, len, buf)))
goto out; /* Nothing found */
@@ -951,7 +961,7 @@ int verify_pidfile (const char * pid_fil
@@ -951,7 +963,7 @@ int verify_pidfile (const char * pid_fil
len = xread(fp, entry, PATH_MAX);
close(fp);
@ -101,7 +165,7 @@
goto out;
comm = index(entry, ' ');
@@ -1040,7 +1050,7 @@ int check_pids (const char * inname, con
@@ -1040,7 +1052,7 @@ int check_pids (const char * inname, con
len = xread(fp, ent, sizeof(ent));
close(fp);
@ -110,7 +174,7 @@
goto ignore; /* Bogus */
thread = (strncmp(ent, "0 ", 2) == 0);
@@ -1111,7 +1121,7 @@ int check_pids (const char * inname, con
@@ -1111,7 +1123,7 @@ int check_pids (const char * inname, con
len = xread(fp, entry, PATH_MAX);
close(fp);
@ -119,7 +183,7 @@
goto ignore; /* Bogus */
/* Seek for a script not for a binary */
@@ -1131,7 +1141,7 @@ int check_pids (const char * inname, con
@@ -1131,7 +1143,7 @@ int check_pids (const char * inname, con
len = xread(fp, entry, PATH_MAX);
close(fp);
@ -128,3 +192,109 @@
goto ignore; /* Bogus */
comm = index(entry, ' ');
--- startproc.8
+++ startproc.8 2009-12-03 17:00:05.739929445 +0000
@@ -59,9 +59,15 @@ processes are found. Note that
is designed to start a daemon but not a kernel thread or
a program which enables a kernel thread.
.PP
+Without any option
.B startproc
-does not use the pid to search for a process but the full
-path of the corresponding program which is used to identify the executable
+does search for a process by using the full
+path of the corresponding program and a default pid file
+.RB (/var/run/ <basename> .pid)
+which are used together to identify the executable
+out from the
+.I /proc
+file system
.RB (see " proc" (5)).
Only if the inode number
.RB (/proc/ <pid> /exe)
@@ -81,7 +87,7 @@ changed due to the LSB specification).
If this option is specified,
.B startproc
tries to check against the pid read from this file
-instead of the default
+instead of the default pid file
.RB (/var/run/ <basename> .pid).
The pid read from this file is compared against the pids of possible
running processes that use the specified executable. In order to avoid
--- startproc.c
+++ startproc.c 2009-12-03 16:49:23.567929544 +0000
@@ -41,7 +41,8 @@ static int do_start(const char *name, ch
static void closefds(FILE *not);
static void waiton(const char *list);
-static int quiet = 1, supprmsg = 0, sess = 0, seconds = 0, sigchld = 0, force = 0, dialog = 0;
+static int quiet = true, supprmsg = false, sess = false, seconds = false;
+static int sigchld = false, force = false, dialog = false;
static struct passwd *user = NULL;
static struct group *grp = NULL;
static int syslogd = 0;
@@ -54,7 +55,7 @@ static void (*save_sigquit) = SIG_DFL;
static void sig_quit(int nsig)
{
(void)signal(nsig, save_sigquit);
- signaled = 1;
+ signaled = true;
}
static void sig_chld(int nsig)
@@ -113,10 +114,10 @@ int main(int argc, char **argv)
error(LSB_WRGSYN,"Option -c requires special root directory\n");
break;
case 'e':
- env = 1;
+ env = true;
break;
case 'd':
- dialog = 1;
+ dialog = true;
seconds = 15;
break;
case 'p': /* Former option -f */
@@ -129,7 +130,7 @@ int main(int argc, char **argv)
error(LSB_WRGSYN,"Option -p requires pid file to read pid from\n");
break;
case 'f': /* Newer option -f for force start (LSB specs!) */
- force++;
+ force = true;
break;
case 'l':
if (optarg && optarg[0] != '-' && !log_file) {
@@ -158,11 +159,11 @@ int main(int argc, char **argv)
error(LSB_WRGSYN,"Option -n requires nice level\n");
break;
case 'q':
- supprmsg = 1;
+ supprmsg = true;
break;
case 's':
if (sdaemon) goto fail;
- sess = 1;
+ sess = true;
break;
case 'u':
if (optarg && optarg[0] != '/' && optarg[0] != '-') {
@@ -288,7 +289,8 @@ int main(int argc, char **argv)
pid_file = (char*) xmalloc(DEFPIDLEN+strlen(basename)+1);
pid_file = strcat(strcat(strcpy(pid_file,DEFPIDDIR),basename),DEFPIDEXT);
}
- }
+ } else
+ force = true;
/* Check and verify the pid file */
errno = 0;
@@ -299,6 +301,9 @@ int main(int argc, char **argv)
/* No pid file means that we have to search in /proc/ */
free(pid_file);
pid_file = NULL;
+
+ if (force && errno == ENOENT)
+ goto force;
}
if (pid_file && !st.st_size) {

View File

@ -1,6 +1,8 @@
--- man/init.8
+++ man/init.8 Fri Mar 12 12:44:29 2004
@@ -232,7 +232,7 @@
Index: man/init.8
===================================================================
--- man/init.8.orig
+++ man/init.8
@@ -232,7 +232,7 @@ It activates the \fIkbrequest\fP action.
.SH CONFORMING TO
\fBInit\fP is compatible with the System V init. It works closely
together with the scripts in the directories
@ -9,11 +11,13 @@
If your system uses this convention, there should be a \fIREADME\fP
file in the directory \fI/etc/init.d\fP explaining how these scripts work.
.\"}}}
--- src/paths.h
+++ src/paths.h Fri Mar 12 12:45:00 2004
@@ -25,10 +25,10 @@
#define SDPID "/var/run/shutdown.pid" /* PID of shutdown program */
Index: src/paths.h
===================================================================
--- src/paths.h.orig
+++ src/paths.h
@@ -26,10 +26,10 @@
#define SHELL "/bin/sh" /* Default shell */
#define SULOGIN "/sbin/sulogin" /* Sulogin */
#define INITSCRIPT "/etc/initscript" /* Initscript. */
-#define PWRSTAT "/etc/powerstatus" /* COMPAT: SIGPWR reason (OK/BAD) */
+#define PWRSTAT "/var/run/powerstatus" /* COMPAT: SIGPWR reason (OK/BAD) */

View File

@ -0,0 +1,42 @@
---
src/killall5.c | 10 ++++++++--
1 file changed, 8 insertions(+), 2 deletions(-)
Index: src/killall5.c
===================================================================
--- src/killall5.c.orig
+++ src/killall5.c
@@ -62,6 +62,7 @@ typedef struct proc {
char isfuse; /* Provides FUSE filesystems */
char isudev; /* Is the uevent handler */
char nfs; /* Binary is loacted on NFS part. */
+ char ismdmon; /* Is an instance of /sbin/mdmon. */
struct proc *next; /* Pointer to next struct. */
} PROC;
@@ -609,6 +610,9 @@ int readproc()
/* Check for uevent handler */
p->isudev = (strncmp(buf, "/sbin/udevd", 11) == 0);
+ /* Check for mdmon */
+ p->ismdmon = (strcmp(buf, "/sbin/mdmon") == 0);
+
/* Check for provider of FUSE filesystems */
p->isfuse = is_fuse(d->d_name);
@@ -947,11 +951,13 @@ int main(int argc, char **argv)
}
clear_mnt();
- /* Now kill all processes except init (pid 1), our session, and FUSE filesystems. */
+ /* Now kill all processes except init (pid 1), our session,
+ * FUSE filesystems and /sbin/mdmon */
sid = (int)getsid(0);
pid = (int)getpid();
for (p = plist; p; p = p->next) {
- if (p->pid == 1 || p->pid == pid || p->sid == sid || p->kernel || p->isfuse) {
+ if (p->pid == 1 || p->pid == pid || p->sid == sid || p->kernel
+ || p->isfuse || p->ismdmon) {
kill(p->pid, SIGCONT);
continue;
}

View File

@ -1,5 +1,7 @@
--- src/init.c
+++ src/init.c 2005-10-19 12:01:15.000000000 +0200
Index: src/init.c
===================================================================
--- src/init.c.orig
+++ src/init.c
@@ -20,6 +20,14 @@
*
*/
@ -15,7 +17,7 @@
#include <sys/types.h>
#include <sys/stat.h>
#include <sys/ioctl.h>
@@ -966,6 +974,7 @@
@@ -976,6 +984,7 @@ int spawn(CHILD *ch, int *res)
dup(f);
dup(f);
}
@ -23,7 +25,7 @@
if ((pid = fork()) < 0) {
initlog(L_VB, "cannot fork");
exit(1);
@@ -978,7 +987,6 @@
@@ -988,7 +997,6 @@ int spawn(CHILD *ch, int *res)
SETSIG(sa, SIGINT, SIG_IGN, SA_RESTART);
SETSIG(sa, SIGTSTP, SIG_IGN, SA_RESTART);
SETSIG(sa, SIGQUIT, SIG_IGN, SA_RESTART);

View File

@ -1,6 +1,8 @@
--- src/init.c
+++ src/init.c 2006-08-22 15:04:27.000000000 +0200
@@ -115,6 +115,8 @@ sig_atomic_t got_signals; /* Set if we r
Index: src/init.c
===================================================================
--- src/init.c.orig
+++ src/init.c
@@ -107,6 +107,8 @@ sig_atomic_t got_signals; /* Set if we r
int emerg_shell = 0; /* Start emergency shell? */
int wrote_wtmp_reboot = 1; /* Set when we wrote the reboot record */
int wrote_utmp_reboot = 1; /* Set when we wrote the reboot record */
@ -9,7 +11,7 @@
int sltime = 5; /* Sleep time between TERM and KILL */
char *argv0; /* First arguments; show up in ps listing */
int maxproclen; /* Maximal length of argv[0] with \0 */
@@ -184,6 +186,8 @@ struct {
@@ -176,6 +178,8 @@ struct {
{ "-WU", D_WROTE_UTMP_REBOOT},
{ "-ST", D_SLTIME },
{ "-DB", D_DIDBOOT },
@ -18,7 +20,7 @@
{ "", 0 }
};
struct {
@@ -379,6 +383,12 @@ static CHILD *get_record(FILE *f)
@@ -371,6 +375,12 @@ static CHILD *get_record(FILE *f)
case D_DIDBOOT:
fscanf(f, "%d\n", &did_boot);
break;
@ -31,7 +33,7 @@
default:
if (cmd > 0 || cmd == C_EOF) {
oops_error = -1;
@@ -1705,6 +1715,8 @@ int read_level(int arg)
@@ -1697,6 +1707,8 @@ int read_level(int arg)
}
/* Store both the old and the new runlevel. */
@ -40,7 +42,7 @@
write_utmp_wtmp("runlevel", "~~", foo + 256*runlevel, RUN_LVL, "~");
thislevel = foo;
prevlevel = runlevel;
@@ -1905,6 +1917,25 @@ void re_exec(void)
@@ -1897,6 +1909,25 @@ void re_exec(void)
initlog(L_CO, "Attempt to re-exec failed");
}
@ -66,7 +68,7 @@
/*
* We got a change runlevel request through the
@@ -1936,6 +1967,7 @@ void fifo_new_level(int level)
@@ -1928,6 +1959,7 @@ void fifo_new_level(int level)
if (oldlevel != 'S' && runlevel == 'S') console_stty();
if (runlevel == '6' || runlevel == '0' ||
runlevel == '1') console_stty();
@ -74,7 +76,7 @@
read_inittab();
fail_cancel();
setproctitle("init [%c]", runlevel);
@@ -2231,6 +2263,8 @@ void boot_transitions()
@@ -2223,6 +2255,8 @@ void boot_transitions()
}
if (loglevel > 0) {
initlog(L_VB, "Entering runlevel: %c", runlevel);
@ -83,7 +85,7 @@
write_utmp_wtmp("runlevel", "~~", runlevel + 256 * oldlevel, RUN_LVL, "~");
thislevel = runlevel;
prevlevel = oldlevel;
@@ -2409,6 +2443,7 @@ int init_main()
@@ -2401,6 +2435,7 @@ int init_main()
console_init();
if (!reload) {
@ -91,7 +93,7 @@
/* Close whatever files are open, and reset the console. */
close(0);
@@ -2426,7 +2461,8 @@ int init_main()
@@ -2418,7 +2453,8 @@ int init_main()
* Initialize /var/run/utmp (only works if /var is on
* root and mounted rw)
*/
@ -101,8 +103,10 @@
/*
* Say hello to the world
--- src/init.h
+++ src/init.h 2006-08-22 14:29:39.000000000 +0200
Index: src/init.h
===================================================================
--- src/init.h.orig
+++ src/init.h
@@ -99,6 +99,10 @@ typedef struct _child_ {
extern CHILD *family;
extern int wrote_wtmp_reboot;
@ -121,8 +125,10 @@
+#define D_WROTE_WTMP_RLEVEL -16
+#define D_WROTE_UTMP_RLEVEL -17
--- src/utmp.c
+++ src/utmp.c 2006-08-22 14:28:52.000000000 +0200
Index: src/utmp.c
===================================================================
--- src/utmp.c.orig
+++ src/utmp.c
@@ -49,6 +49,12 @@ char *line) /* Which line is this */
struct utsname uname_buf;

View File

@ -1,3 +1,29 @@
-------------------------------------------------------------------
Thu Dec 3 18:01:10 CET 2009 - werner@suse.de
- Add missed line to startproc.c and also make manual page more
clear how startproc works (caused by bnc#559534)
-------------------------------------------------------------------
Sun Nov 15 14:01:30 CET 2009 - meissner@suse.de
- refresh all patches with fuzz=0
-------------------------------------------------------------------
Mon Nov 2 17:10:48 CET 2009 - mmarek@suse.cz
- fixed killproc-2.16.dif.
-------------------------------------------------------------------
Thu Oct 29 22:39:27 CET 2009 - mmarek@suse.cz
- killall5: do not kill /sbin/mdmon (fate#306823).
-------------------------------------------------------------------
Wed Oct 28 10:47:42 CET 2009 - werner@suse.de
- Avoid message on terminated process during reading its /proc files
-------------------------------------------------------------------
Tue Sep 29 10:48:03 CEST 2009 - werner@suse.de

View File

@ -30,7 +30,7 @@ Group: System/Base
PreReq: coreutils
AutoReqProv: on
Version: 2.86
Release: 214
Release: 215
Summary: SysV-Style init
BuildRoot: %{_tmppath}/%{name}-%{version}-build
BuildRequires: libselinux-devel libsepol-devel
@ -63,6 +63,7 @@ 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: sysvinit-2.86-mdmon-no-kill.patch
%description
System V style init programs by Miquel van Smoorenburg that control the
@ -98,6 +99,7 @@ Authors:
%patch -P 17 -b .hddown
%patch -P 18 -b .selinux
%patch -P 19 -b .fuse
%patch -P 20 -b .mdmon
%patch
pushd ../powerd-%{PDVER}
%patch -P 2