summaryrefslogtreecommitdiffstats
path: root/meta/recipes-core/sysvinit/sysvinit-2.88dsf
diff options
context:
space:
mode:
Diffstat (limited to 'meta/recipes-core/sysvinit/sysvinit-2.88dsf')
-rw-r--r--meta/recipes-core/sysvinit/sysvinit-2.88dsf/crypt-lib.patch25
-rw-r--r--meta/recipes-core/sysvinit/sysvinit-2.88dsf/install.patch83
-rw-r--r--meta/recipes-core/sysvinit/sysvinit-2.88dsf/pidof-add-m-option.patch189
3 files changed, 297 insertions, 0 deletions
diff --git a/meta/recipes-core/sysvinit/sysvinit-2.88dsf/crypt-lib.patch b/meta/recipes-core/sysvinit/sysvinit-2.88dsf/crypt-lib.patch
new file mode 100644
index 0000000000..7b342901e1
--- /dev/null
+++ b/meta/recipes-core/sysvinit/sysvinit-2.88dsf/crypt-lib.patch
@@ -0,0 +1,25 @@
1Upstream-Status: Inappropriate [configuration]
2
3# The src Makefile was checking for libcrypt.a on the host, not in the
4# build environment. This patch checks for $LCRYPT in the environment
5# and uses it if it's there.
6# - jdike@linux.intel.com
7
8Index: sysvinit-2.88dsf/src/Makefile
9===================================================================
10--- sysvinit-2.88dsf.orig/src/Makefile
11+++ sysvinit-2.88dsf/src/Makefile
12@@ -85,9 +85,13 @@ else
13 endif
14
15 # Additional libs for GNU libc.
16+ifneq ($(LCRYPT),)
17+ SULOGINLIBS += $(LCRYPT)
18+else
19 ifneq ($(wildcard /usr/lib*/libcrypt.a),)
20 SULOGINLIBS += -lcrypt
21 endif
22+endif
23
24 all: $(BIN) $(SBIN) $(USRBIN)
25
diff --git a/meta/recipes-core/sysvinit/sysvinit-2.88dsf/install.patch b/meta/recipes-core/sysvinit/sysvinit-2.88dsf/install.patch
new file mode 100644
index 0000000000..6c4225a678
--- /dev/null
+++ b/meta/recipes-core/sysvinit/sysvinit-2.88dsf/install.patch
@@ -0,0 +1,83 @@
1Upstream-Status: Pending
2
3diff --git a/src/Makefile b/src/Makefile
4index e2b8028..3e11e92 100644
5--- a/src/Makefile
6+++ b/src/Makefile
7@@ -65,7 +65,14 @@ else
8 INSTALL_DATA = install -m 644
9 endif
10 INSTALL_DIR = install -m 755 -d
11-MANDIR = /usr/share/man
12+
13+ROOT ?=
14+base_bindir ?= /bin
15+base_sbindir ?= /sbin
16+bindir ?= /usr/bin
17+sysconfdir ?= /etc
18+includedir ?= /usr/include
19+mandir ?= /usr/share/man
20
21 ifeq ($(WITH_SELINUX),yes)
22 SELINUX_DEF = -DWITH_SELINUX
23@@ -138,39 +145,39 @@ clobber: cleanobjs
24 distclean: clobber
25
26 install:
27- $(INSTALL_DIR) $(ROOT)/bin/ $(ROOT)/sbin/
28- $(INSTALL_DIR) $(ROOT)/usr/bin/
29+ $(INSTALL_DIR) $(ROOT)$(base_bindir)/ $(ROOT)$(base_sbindir)/
30+ $(INSTALL_DIR) $(ROOT)$(bindir)/
31 for i in $(BIN); do \
32- $(INSTALL_EXEC) $$i $(ROOT)/bin/ ; \
33+ $(INSTALL_EXEC) $$i $(ROOT)$(base_bindir)/ ; \
34 done
35 for i in $(SBIN); do \
36- $(INSTALL_EXEC) $$i $(ROOT)/sbin/ ; \
37+ $(INSTALL_EXEC) $$i $(ROOT)$(base_sbindir)/ ; \
38 done
39 for i in $(USRBIN); do \
40- $(INSTALL_EXEC) $$i $(ROOT)/usr/bin/ ; \
41+ $(INSTALL_EXEC) $$i $(ROOT)$(bindir)/ ; \
42 done
43- # $(INSTALL_DIR) $(ROOT)/etc/
44- # $(INSTALL_EXEC) initscript.sample $(ROOT)/etc/
45- ln -sf halt $(ROOT)/sbin/reboot
46- ln -sf halt $(ROOT)/sbin/poweroff
47- ln -sf init $(ROOT)/sbin/telinit
48- ln -sf /sbin/killall5 $(ROOT)/bin/pidof
49- if [ ! -f $(ROOT)/usr/bin/lastb ]; then \
50- ln -sf last $(ROOT)/usr/bin/lastb; \
51+ # $(INSTALL_DIR) $(ROOT)$(sysconfdir)/
52+ # $(INSTALL_EXEC) initscript.sample $(ROOT)$(sysconfdir)/
53+ ln -sf halt $(ROOT)$(base_sbindir)/reboot
54+ ln -sf halt $(ROOT)$(base_sbindir)/poweroff
55+ ln -sf init $(ROOT)$(base_sbindir)/telinit
56+ ln -sf $(base_sbindir)/killall5 $(ROOT)$(base_bindir)/pidof
57+ if [ ! -f $(ROOT)$(bindir)/lastb ]; then \
58+ ln -sf last $(ROOT)$(bindir)/lastb; \
59 fi
60- $(INSTALL_DIR) $(ROOT)/usr/include/
61- $(INSTALL_DATA) initreq.h $(ROOT)/usr/include/
62- $(INSTALL_DIR) $(ROOT)$(MANDIR)/man1/
63- $(INSTALL_DIR) $(ROOT)$(MANDIR)/man5/
64- $(INSTALL_DIR) $(ROOT)$(MANDIR)/man8/
65+ $(INSTALL_DIR) $(ROOT)$(includedir)/
66+ $(INSTALL_DATA) initreq.h $(ROOT)$(includedir)/
67+ $(INSTALL_DIR) $(ROOT)$(mandir)/man1/
68+ $(INSTALL_DIR) $(ROOT)$(mandir)/man5/
69+ $(INSTALL_DIR) $(ROOT)$(mandir)/man8/
70 for i in $(MAN1); do \
71- $(INSTALL_DATA) ../man/$$i $(ROOT)$(MANDIR)/man1/; \
72+ $(INSTALL_DATA) ../man/$$i $(ROOT)$(mandir)/man1/; \
73 done
74 for i in $(MAN5); do \
75- $(INSTALL_DATA) ../man/$$i $(ROOT)$(MANDIR)/man5/; \
76+ $(INSTALL_DATA) ../man/$$i $(ROOT)$(mandir)/man5/; \
77 done
78 for i in $(MAN8); do \
79- $(INSTALL_DATA) ../man/$$i $(ROOT)$(MANDIR)/man8/; \
80+ $(INSTALL_DATA) ../man/$$i $(ROOT)$(mandir)/man8/; \
81 done
82 ifeq ($(ROOT),)
83 #
diff --git a/meta/recipes-core/sysvinit/sysvinit-2.88dsf/pidof-add-m-option.patch b/meta/recipes-core/sysvinit/sysvinit-2.88dsf/pidof-add-m-option.patch
new file mode 100644
index 0000000000..5b5dfdc001
--- /dev/null
+++ b/meta/recipes-core/sysvinit/sysvinit-2.88dsf/pidof-add-m-option.patch
@@ -0,0 +1,189 @@
1pidof: add -m option
2
3When used with -o, will also omit any processes that have the same
4argv[0] and argv[1] as any explicitly omitted process ids. This can be
5used to avoid multiple shell scripts concurrently calling pidof returning
6each other's pids.
7
8https://bugzilla.redhat.com/show_bug.cgi?id=883856
9
10Upstream-Status: backport
11Imported patch from: https://bugzilla.redhat.com/attachment.cgi?id=658166
12
13Signed-off-by: Hongxu Jia <hongxu.jia@windriver.com>
14---
15 man/pidof.8 | 6 ++++++
16 src/killall5.c | 62 +++++++++++++++++++++++++++++++++++++++++++++++++++++++---
17 2 files changed, 65 insertions(+), 3 deletions(-)
18
19diff --git a/man/pidof.8 b/man/pidof.8
20--- a/man/pidof.8
21+++ b/man/pidof.8
22@@ -24,6 +24,7 @@ pidof -- find the process ID of a running program.
23 .RB [ \-c ]
24 .RB [ \-n ]
25 .RB [ \-x ]
26+.RB [ \-m ]
27 .RB [ \-o
28 .IR omitpid[,omitpid..] ]
29 .RB [ \-o
30@@ -63,6 +64,11 @@ shells running the named scripts.
31 Tells \fIpidof\fP to omit processes with that process id. The special
32 pid \fB%PPID\fP can be used to name the parent process of the \fIpidof\fP
33 program, in other words the calling shell or shell script.
34+.IP -m
35+When used with -o, will also omit any processes that have the same
36+argv[0] and argv[1] as any explicitly omitted process ids. This can be
37+used to avoid multiple shell scripts concurrently calling pidof returning
38+each other's pids.
39 .SH "EXIT STATUS"
40 .TP
41 .B 0
42diff --git a/src/killall5.c b/src/killall5.c
43index 5937d98..e73885e 100644
44--- a/src/killall5.c
45+++ b/src/killall5.c
46@@ -118,6 +118,7 @@ typedef struct _s_nfs
47
48 /* List of processes. */
49 PROC *plist;
50+PROC *olist;
51
52 /* List of processes to omit. */
53 OMIT *omit;
54@@ -345,6 +346,20 @@ static void clear_mnt(void)
55 }
56 }
57
58+static void clear_omit(void)
59+{
60+ OMIT *o;
61+ PROC *p;
62+ for (o = omit; o; o = omit) {
63+ omit = omit->next;
64+ free(o);
65+ }
66+ for (p = olist; p; p = olist) {
67+ olist = olist->next;
68+ free(p);
69+ }
70+}
71+
72 /*
73 * Check if path is ia shadow off a NFS partition.
74 */
75@@ -452,6 +467,7 @@ int readproc(int do_stat)
76 DIR *dir;
77 FILE *fp;
78 PROC *p, *n;
79+ OMIT *o, *m;
80 struct dirent *d;
81 struct stat st;
82 char path[PATH_MAX+1];
83@@ -624,6 +640,17 @@ int readproc(int do_stat)
84 p->next = plist;
85 plist = p;
86 p->pid = pid;
87+ /* Could be smarter, but it's a small list. */
88+ m = omit;
89+ for (o = omit; m; o = m) {
90+ m = o->next;
91+ if (o->pid == p->pid) {
92+ n = (PROC*)xmalloc(sizeof(PROC));
93+ *n = *p;
94+ n->next = olist;
95+ olist = n;
96+ }
97+ }
98 }
99 closedir(dir);
100
101@@ -813,6 +840,26 @@ PIDQ_HEAD *pidof(char *prog)
102 return q;
103 }
104
105+int matches(PROC *o, PROC *p)
106+{
107+ int ret = 0;
108+ char *oargv1, *pargv1;
109+ if ((o->argv0 && p->argv0 && !strcmp(o->argv0,p->argv0))) {
110+ if (o->argv1 && p->argv1) {
111+ if ((oargv1 = canonicalize_file_name(o->argv1)) == NULL)
112+ oargv1 = strdup(o->argv1);
113+ if ((pargv1 = canonicalize_file_name(p->argv1)) == NULL)
114+ pargv1 = strdup(p->argv1);
115+ if (! strcmp(oargv1, pargv1)) {
116+ ret = 1;
117+ }
118+ free(oargv1);
119+ free(pargv1);
120+ }
121+ }
122+ return ret;
123+}
124+
125 /* Give usage message and exit. */
126 void usage(void)
127 {
128@@ -845,6 +892,7 @@ void nsyslog(int pri, char *fmt, ...)
129 #define PIDOF_SINGLE 0x01
130 #define PIDOF_OMIT 0x02
131 #define PIDOF_NETFS 0x04
132+#define PIDOF_OMIT_OMIT_MATCHES 0x08
133
134 /*
135 * Pidof functionality.
136@@ -861,6 +909,7 @@ int main_pidof(int argc, char **argv)
137 struct stat st;
138 char tmp[512];
139
140+ olist = (PROC*)0;
141 omit = (OMIT*)0;
142 nlist = (NFS*)0;
143 opterr = 0;
144@@ -868,7 +917,7 @@ int main_pidof(int argc, char **argv)
145 if ((token = getenv("PIDOF_NETFS")) && (strcmp(token,"no") != 0))
146 flags |= PIDOF_NETFS;
147
148- while ((opt = getopt(argc,argv,"hco:sxn")) != EOF) switch (opt) {
149+ while ((opt = getopt(argc,argv,"hcmo:sxn")) != EOF) switch (opt) {
150 case '?':
151 nsyslog(LOG_ERR,"invalid options on command line!\n");
152 closelog();
153@@ -907,6 +956,9 @@ int main_pidof(int argc, char **argv)
154 case 'x':
155 scripts_too++;
156 break;
157+ case 'm':
158+ flags |= PIDOF_OMIT_OMIT_MATCHES;
159+ break;
160 case 'n':
161 flags |= PIDOF_NETFS;
162 break;
163@@ -938,10 +990,13 @@ int main_pidof(int argc, char **argv)
164 pid_t spid = 0;
165 while ((p = get_next_from_pid_q(q))) {
166 if ((flags & PIDOF_OMIT) && omit) {
167- OMIT * optr;
168- for (optr = omit; optr; optr = optr->next) {
169+ PROC * optr;
170+ for (optr = olist; optr; optr = optr->next) {
171 if (optr->pid == p->pid)
172 break;
173+ if (flags & PIDOF_OMIT_OMIT_MATCHES)
174+ if (matches(optr, p))
175+ break;
176 }
177
178 /*
179@@ -977,6 +1032,7 @@ int main_pidof(int argc, char **argv)
180 if (!first)
181 printf("\n");
182
183+ clear_omit();
184 clear_mnt();
185
186 closelog();
187--
1881.8.1.2
189