diff options
Diffstat (limited to 'meta/recipes-core/sysvinit/sysvinit/pidof-add-m-option.patch')
-rw-r--r-- | meta/recipes-core/sysvinit/sysvinit/pidof-add-m-option.patch | 64 |
1 files changed, 33 insertions, 31 deletions
diff --git a/meta/recipes-core/sysvinit/sysvinit/pidof-add-m-option.patch b/meta/recipes-core/sysvinit/sysvinit/pidof-add-m-option.patch index 5b5dfdc001..494aa0e012 100644 --- a/meta/recipes-core/sysvinit/sysvinit/pidof-add-m-option.patch +++ b/meta/recipes-core/sysvinit/sysvinit/pidof-add-m-option.patch | |||
@@ -1,4 +1,7 @@ | |||
1 | pidof: add -m option | 1 | From 6c490ea6579a132fabb7dbd25387bb521f820371 Mon Sep 17 00:00:00 2001 |
2 | From: Hongxu Jia <hongxu.jia@windriver.com> | ||
3 | Date: Wed, 24 Jul 2013 17:07:22 +0800 | ||
4 | Subject: [PATCH] pidof: add -m option | ||
2 | 5 | ||
3 | When used with -o, will also omit any processes that have the same | 6 | When used with -o, will also omit any processes that have the same |
4 | argv[0] and argv[1] as any explicitly omitted process ids. This can be | 7 | argv[0] and argv[1] as any explicitly omitted process ids. This can be |
@@ -11,23 +14,25 @@ Upstream-Status: backport | |||
11 | Imported patch from: https://bugzilla.redhat.com/attachment.cgi?id=658166 | 14 | Imported patch from: https://bugzilla.redhat.com/attachment.cgi?id=658166 |
12 | 15 | ||
13 | Signed-off-by: Hongxu Jia <hongxu.jia@windriver.com> | 16 | Signed-off-by: Hongxu Jia <hongxu.jia@windriver.com> |
17 | |||
14 | --- | 18 | --- |
15 | man/pidof.8 | 6 ++++++ | 19 | man/pidof.8 | 6 +++++ |
16 | src/killall5.c | 62 +++++++++++++++++++++++++++++++++++++++++++++++++++++++--- | 20 | src/killall5.c | 62 +++++++++++++++++++++++++++++++++++++++++++++++--- |
17 | 2 files changed, 65 insertions(+), 3 deletions(-) | 21 | 2 files changed, 65 insertions(+), 3 deletions(-) |
18 | 22 | ||
19 | diff --git a/man/pidof.8 b/man/pidof.8 | 23 | diff --git a/man/pidof.8 b/man/pidof.8 |
24 | index ebe5f55..2fdc4d3 100644 | ||
20 | --- a/man/pidof.8 | 25 | --- a/man/pidof.8 |
21 | +++ b/man/pidof.8 | 26 | +++ b/man/pidof.8 |
22 | @@ -24,6 +24,7 @@ pidof -- find the process ID of a running program. | 27 | @@ -25,6 +25,7 @@ pidof -- find the process ID of a running program. |
23 | .RB [ \-c ] | ||
24 | .RB [ \-n ] | 28 | .RB [ \-n ] |
25 | .RB [ \-x ] | 29 | .RB [ \-x ] |
30 | .RB [ \-z ] | ||
26 | +.RB [ \-m ] | 31 | +.RB [ \-m ] |
27 | .RB [ \-o | 32 | .RB [ \-o |
28 | .IR omitpid[,omitpid..] ] | 33 | .IR omitpid[,omitpid...] ] |
29 | .RB [ \-o | 34 | .RB [ \-o |
30 | @@ -63,6 +64,11 @@ shells running the named scripts. | 35 | @@ -76,6 +77,11 @@ is shown. The default separator is a space. |
31 | Tells \fIpidof\fP to omit processes with that process id. The special | 36 | 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 | 37 | 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. | 38 | program, in other words the calling shell or shell script. |
@@ -40,10 +45,10 @@ diff --git a/man/pidof.8 b/man/pidof.8 | |||
40 | .TP | 45 | .TP |
41 | .B 0 | 46 | .B 0 |
42 | diff --git a/src/killall5.c b/src/killall5.c | 47 | diff --git a/src/killall5.c b/src/killall5.c |
43 | index 5937d98..e73885e 100644 | 48 | index 8b5cb38..a664954 100644 |
44 | --- a/src/killall5.c | 49 | --- a/src/killall5.c |
45 | +++ b/src/killall5.c | 50 | +++ b/src/killall5.c |
46 | @@ -118,6 +118,7 @@ typedef struct _s_nfs | 51 | @@ -126,6 +126,7 @@ typedef struct _s_nfs |
47 | 52 | ||
48 | /* List of processes. */ | 53 | /* List of processes. */ |
49 | PROC *plist; | 54 | PROC *plist; |
@@ -51,7 +56,7 @@ index 5937d98..e73885e 100644 | |||
51 | 56 | ||
52 | /* List of processes to omit. */ | 57 | /* List of processes to omit. */ |
53 | OMIT *omit; | 58 | OMIT *omit; |
54 | @@ -345,6 +346,20 @@ static void clear_mnt(void) | 59 | @@ -361,6 +362,20 @@ static void clear_mnt(void) |
55 | } | 60 | } |
56 | } | 61 | } |
57 | 62 | ||
@@ -70,9 +75,9 @@ index 5937d98..e73885e 100644 | |||
70 | +} | 75 | +} |
71 | + | 76 | + |
72 | /* | 77 | /* |
73 | * Check if path is ia shadow off a NFS partition. | 78 | * Check if path is a shadow off a NFS partition. |
74 | */ | 79 | */ |
75 | @@ -452,6 +467,7 @@ int readproc(int do_stat) | 80 | @@ -486,6 +501,7 @@ int readproc(int do_stat) |
76 | DIR *dir; | 81 | DIR *dir; |
77 | FILE *fp; | 82 | FILE *fp; |
78 | PROC *p, *n; | 83 | PROC *p, *n; |
@@ -80,7 +85,7 @@ index 5937d98..e73885e 100644 | |||
80 | struct dirent *d; | 85 | struct dirent *d; |
81 | struct stat st; | 86 | struct stat st; |
82 | char path[PATH_MAX+1]; | 87 | char path[PATH_MAX+1]; |
83 | @@ -624,6 +640,17 @@ int readproc(int do_stat) | 88 | @@ -733,6 +749,17 @@ int readproc(int do_stat) |
84 | p->next = plist; | 89 | p->next = plist; |
85 | plist = p; | 90 | plist = p; |
86 | p->pid = pid; | 91 | p->pid = pid; |
@@ -98,7 +103,7 @@ index 5937d98..e73885e 100644 | |||
98 | } | 103 | } |
99 | closedir(dir); | 104 | closedir(dir); |
100 | 105 | ||
101 | @@ -813,6 +840,26 @@ PIDQ_HEAD *pidof(char *prog) | 106 | @@ -944,6 +971,26 @@ PIDQ_HEAD *pidof(char *prog) |
102 | return q; | 107 | return q; |
103 | } | 108 | } |
104 | 109 | ||
@@ -125,42 +130,42 @@ index 5937d98..e73885e 100644 | |||
125 | /* Give usage message and exit. */ | 130 | /* Give usage message and exit. */ |
126 | void usage(void) | 131 | void usage(void) |
127 | { | 132 | { |
128 | @@ -845,6 +892,7 @@ void nsyslog(int pri, char *fmt, ...) | 133 | @@ -994,6 +1041,7 @@ void nsyslog(int pri, char *fmt, ...) |
129 | #define PIDOF_SINGLE 0x01 | ||
130 | #define PIDOF_OMIT 0x02 | 134 | #define PIDOF_OMIT 0x02 |
131 | #define PIDOF_NETFS 0x04 | 135 | #define PIDOF_NETFS 0x04 |
136 | #define PIDOF_QUIET 0x08 | ||
132 | +#define PIDOF_OMIT_OMIT_MATCHES 0x08 | 137 | +#define PIDOF_OMIT_OMIT_MATCHES 0x08 |
133 | 138 | ||
134 | /* | 139 | /* |
135 | * Pidof functionality. | 140 | * Pidof functionality. |
136 | @@ -861,6 +909,7 @@ int main_pidof(int argc, char **argv) | 141 | @@ -1011,6 +1059,7 @@ int main_pidof(int argc, char **argv) |
137 | struct stat st; | ||
138 | char tmp[512]; | 142 | char tmp[512]; |
143 | char sep = ' '; | ||
139 | 144 | ||
140 | + olist = (PROC*)0; | 145 | + olist = (PROC*)0; |
141 | omit = (OMIT*)0; | 146 | omit = (OMIT*)0; |
142 | nlist = (NFS*)0; | 147 | nlist = (NFS*)0; |
143 | opterr = 0; | 148 | opterr = 0; |
144 | @@ -868,7 +917,7 @@ int main_pidof(int argc, char **argv) | 149 | @@ -1018,7 +1067,7 @@ int main_pidof(int argc, char **argv) |
145 | if ((token = getenv("PIDOF_NETFS")) && (strcmp(token,"no") != 0)) | 150 | if ((token = getenv("PIDOF_NETFS")) && (strcmp(token,"no") != 0)) |
146 | flags |= PIDOF_NETFS; | 151 | flags |= PIDOF_NETFS; |
147 | 152 | ||
148 | - while ((opt = getopt(argc,argv,"hco:sxn")) != EOF) switch (opt) { | 153 | - while ((opt = getopt(argc,argv,"qhco:d:sxzn")) != EOF) switch (opt) { |
149 | + while ((opt = getopt(argc,argv,"hcmo:sxn")) != EOF) switch (opt) { | 154 | + while ((opt = getopt(argc,argv,"qhcmo:d:sxzn")) != EOF) switch (opt) { |
150 | case '?': | 155 | case '?': |
151 | nsyslog(LOG_ERR,"invalid options on command line!\n"); | 156 | nsyslog(LOG_ERR,"invalid options on command line!\n"); |
152 | closelog(); | 157 | closelog(); |
153 | @@ -907,6 +956,9 @@ int main_pidof(int argc, char **argv) | 158 | @@ -1069,6 +1118,9 @@ int main_pidof(int argc, char **argv) |
154 | case 'x': | 159 | case 'z': |
155 | scripts_too++; | 160 | list_dz_processes = TRUE; |
156 | break; | 161 | break; |
157 | + case 'm': | 162 | + case 'm': |
158 | + flags |= PIDOF_OMIT_OMIT_MATCHES; | 163 | + flags |= PIDOF_OMIT_OMIT_MATCHES; |
159 | + break; | 164 | + break; |
160 | case 'n': | 165 | case 'n': |
161 | flags |= PIDOF_NETFS; | 166 | flags |= PIDOF_NETFS; |
162 | break; | 167 | break; |
163 | @@ -938,10 +990,13 @@ int main_pidof(int argc, char **argv) | 168 | @@ -1100,10 +1152,13 @@ int main_pidof(int argc, char **argv) |
164 | pid_t spid = 0; | 169 | pid_t spid = 0; |
165 | while ((p = get_next_from_pid_q(q))) { | 170 | while ((p = get_next_from_pid_q(q))) { |
166 | if ((flags & PIDOF_OMIT) && omit) { | 171 | if ((flags & PIDOF_OMIT) && omit) { |
@@ -176,14 +181,11 @@ index 5937d98..e73885e 100644 | |||
176 | } | 181 | } |
177 | 182 | ||
178 | /* | 183 | /* |
179 | @@ -977,6 +1032,7 @@ int main_pidof(int argc, char **argv) | 184 | @@ -1145,6 +1200,7 @@ int main_pidof(int argc, char **argv) |
180 | if (!first) | ||
181 | printf("\n"); | 185 | printf("\n"); |
186 | } | ||
182 | 187 | ||
183 | + clear_omit(); | 188 | + clear_omit(); |
184 | clear_mnt(); | 189 | clear_mnt(); |
185 | 190 | ||
186 | closelog(); | 191 | closelog(); |
187 | -- | ||
188 | 1.8.1.2 | ||
189 | |||