diff options
author | Denis Vlasenko <vda.linux@googlemail.com> | 2006-11-16 02:27:24 +0000 |
---|---|---|
committer | Denis Vlasenko <vda.linux@googlemail.com> | 2006-11-16 02:27:24 +0000 |
commit | 83ea643d8dc9b6f53706ba30bc4b53338f4f7994 (patch) | |
tree | 3a5f790604219213666cbf5cccd747c02528912c /runit/chpst.c | |
parent | 3672fe9e9141c0684cae1e72e84cb2704f2a8702 (diff) | |
download | busybox-w32-83ea643d8dc9b6f53706ba30bc4b53338f4f7994.tar.gz busybox-w32-83ea643d8dc9b6f53706ba30bc4b53338f4f7994.tar.bz2 busybox-w32-83ea643d8dc9b6f53706ba30bc4b53338f4f7994.zip |
svlogd: new applet. +9k. Still too big, but it was 12k yesterday.
Diffstat (limited to 'runit/chpst.c')
-rw-r--r-- | runit/chpst.c | 47 |
1 files changed, 30 insertions, 17 deletions
diff --git a/runit/chpst.c b/runit/chpst.c index de6a33764..3fcef8eec 100644 --- a/runit/chpst.c +++ b/runit/chpst.c | |||
@@ -26,6 +26,7 @@ ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | |||
26 | */ | 26 | */ |
27 | 27 | ||
28 | /* Busyboxed by Denis Vlasenko <vda.linux@googlemail.com> */ | 28 | /* Busyboxed by Denis Vlasenko <vda.linux@googlemail.com> */ |
29 | /* Dependencies on runit_lib.c removed */ | ||
29 | 30 | ||
30 | #include "busybox.h" | 31 | #include "busybox.h" |
31 | 32 | ||
@@ -94,7 +95,9 @@ static void edir(const char *directory_name) | |||
94 | errno = 0; | 95 | errno = 0; |
95 | d = readdir(dir); | 96 | d = readdir(dir); |
96 | if (!d) { | 97 | if (!d) { |
97 | if (errno) bb_perror_msg_and_die("readdir %s", directory_name); | 98 | if (errno) |
99 | bb_perror_msg_and_die("readdir %s", | ||
100 | directory_name); | ||
98 | break; | 101 | break; |
99 | } | 102 | } |
100 | if (d->d_name[0] == '.') continue; | 103 | if (d->d_name[0] == '.') continue; |
@@ -102,12 +105,12 @@ static void edir(const char *directory_name) | |||
102 | if (fd < 0) { | 105 | if (fd < 0) { |
103 | if ((errno == EISDIR) && env_dir) { | 106 | if ((errno == EISDIR) && env_dir) { |
104 | if (OPT_verbose) | 107 | if (OPT_verbose) |
105 | bb_perror_msg("warning: %s/%s is a directory", directory_name, | 108 | bb_perror_msg("warning: %s/%s is a directory", |
106 | d->d_name); | 109 | directory_name, d->d_name); |
107 | continue; | 110 | continue; |
108 | } else | 111 | } else |
109 | bb_perror_msg_and_die("open %s/%s", directory_name, /* was exiting 111 */ | 112 | bb_perror_msg_and_die("open %s/%s", |
110 | d->d_name); | 113 | directory_name, d->d_name); |
111 | } | 114 | } |
112 | if (fd >= 0) { | 115 | if (fd >= 0) { |
113 | char buf[256]; | 116 | char buf[256]; |
@@ -116,8 +119,8 @@ static void edir(const char *directory_name) | |||
116 | 119 | ||
117 | size = safe_read(fd, buf, sizeof(buf)-1); | 120 | size = safe_read(fd, buf, sizeof(buf)-1); |
118 | if (size < 0) | 121 | if (size < 0) |
119 | bb_perror_msg_and_die("read %s/%s", directory_name, /* was exiting 111 */ | 122 | bb_perror_msg_and_die("read %s/%s", |
120 | d->d_name); | 123 | directory_name, d->d_name); |
121 | if (size == 0) { | 124 | if (size == 0) { |
122 | unsetenv(d->d_name); | 125 | unsetenv(d->d_name); |
123 | continue; | 126 | continue; |
@@ -158,21 +161,24 @@ static void slimit(void) | |||
158 | #ifdef RLIMIT_DATA | 161 | #ifdef RLIMIT_DATA |
159 | limit(RLIMIT_DATA, limitd); | 162 | limit(RLIMIT_DATA, limitd); |
160 | #else | 163 | #else |
161 | if (OPT_verbose) bb_error_msg("system does not support %s", "RLIMIT_DATA"); | 164 | if (OPT_verbose) bb_error_msg("system does not support %s", |
165 | "RLIMIT_DATA"); | ||
162 | #endif | 166 | #endif |
163 | } | 167 | } |
164 | if (limits >= -1) { | 168 | if (limits >= -1) { |
165 | #ifdef RLIMIT_STACK | 169 | #ifdef RLIMIT_STACK |
166 | limit(RLIMIT_STACK, limits); | 170 | limit(RLIMIT_STACK, limits); |
167 | #else | 171 | #else |
168 | if (OPT_verbose) bb_error_msg("system does not support %s", "RLIMIT_STACK"); | 172 | if (OPT_verbose) bb_error_msg("system does not support %s", |
173 | "RLIMIT_STACK"); | ||
169 | #endif | 174 | #endif |
170 | } | 175 | } |
171 | if (limitl >= -1) { | 176 | if (limitl >= -1) { |
172 | #ifdef RLIMIT_MEMLOCK | 177 | #ifdef RLIMIT_MEMLOCK |
173 | limit(RLIMIT_MEMLOCK, limitl); | 178 | limit(RLIMIT_MEMLOCK, limitl); |
174 | #else | 179 | #else |
175 | if (OPT_verbose) bb_error_msg("system does not support %s", "RLIMIT_MEMLOCK"); | 180 | if (OPT_verbose) bb_error_msg("system does not support %s", |
181 | "RLIMIT_MEMLOCK"); | ||
176 | #endif | 182 | #endif |
177 | } | 183 | } |
178 | if (limita >= -1) { | 184 | if (limita >= -1) { |
@@ -183,7 +189,8 @@ static void slimit(void) | |||
183 | limit(RLIMIT_AS, limita); | 189 | limit(RLIMIT_AS, limita); |
184 | #else | 190 | #else |
185 | if (OPT_verbose) | 191 | if (OPT_verbose) |
186 | bb_error_msg("system does not support %s", "RLIMIT_VMEM"); | 192 | bb_error_msg("system does not support %s", |
193 | "RLIMIT_VMEM"); | ||
187 | #endif | 194 | #endif |
188 | #endif | 195 | #endif |
189 | } | 196 | } |
@@ -195,7 +202,8 @@ static void slimit(void) | |||
195 | limit(RLIMIT_OFILE, limito); | 202 | limit(RLIMIT_OFILE, limito); |
196 | #else | 203 | #else |
197 | if (OPT_verbose) | 204 | if (OPT_verbose) |
198 | bb_error_msg("system does not support %s", "RLIMIT_NOFILE"); | 205 | bb_error_msg("system does not support %s", |
206 | "RLIMIT_NOFILE"); | ||
199 | #endif | 207 | #endif |
200 | #endif | 208 | #endif |
201 | } | 209 | } |
@@ -203,35 +211,40 @@ static void slimit(void) | |||
203 | #ifdef RLIMIT_NPROC | 211 | #ifdef RLIMIT_NPROC |
204 | limit(RLIMIT_NPROC, limitp); | 212 | limit(RLIMIT_NPROC, limitp); |
205 | #else | 213 | #else |
206 | if (OPT_verbose) bb_error_msg("system does not support %s", "RLIMIT_NPROC"); | 214 | if (OPT_verbose) bb_error_msg("system does not support %s", |
215 | "RLIMIT_NPROC"); | ||
207 | #endif | 216 | #endif |
208 | } | 217 | } |
209 | if (limitf >= -1) { | 218 | if (limitf >= -1) { |
210 | #ifdef RLIMIT_FSIZE | 219 | #ifdef RLIMIT_FSIZE |
211 | limit(RLIMIT_FSIZE, limitf); | 220 | limit(RLIMIT_FSIZE, limitf); |
212 | #else | 221 | #else |
213 | if (OPT_verbose) bb_error_msg("system does not support %s", "RLIMIT_FSIZE"); | 222 | if (OPT_verbose) bb_error_msg("system does not support %s", |
223 | "RLIMIT_FSIZE"); | ||
214 | #endif | 224 | #endif |
215 | } | 225 | } |
216 | if (limitc >= -1) { | 226 | if (limitc >= -1) { |
217 | #ifdef RLIMIT_CORE | 227 | #ifdef RLIMIT_CORE |
218 | limit(RLIMIT_CORE, limitc); | 228 | limit(RLIMIT_CORE, limitc); |
219 | #else | 229 | #else |
220 | if (OPT_verbose) bb_error_msg("system does not support %s", "RLIMIT_CORE"); | 230 | if (OPT_verbose) bb_error_msg("system does not support %s", |
231 | "RLIMIT_CORE"); | ||
221 | #endif | 232 | #endif |
222 | } | 233 | } |
223 | if (limitr >= -1) { | 234 | if (limitr >= -1) { |
224 | #ifdef RLIMIT_RSS | 235 | #ifdef RLIMIT_RSS |
225 | limit(RLIMIT_RSS, limitr); | 236 | limit(RLIMIT_RSS, limitr); |
226 | #else | 237 | #else |
227 | if (OPT_verbose) bb_error_msg("system does not support %s", "RLIMIT_RSS"); | 238 | if (OPT_verbose) bb_error_msg("system does not support %s", |
239 | "RLIMIT_RSS"); | ||
228 | #endif | 240 | #endif |
229 | } | 241 | } |
230 | if (limitt >= -1) { | 242 | if (limitt >= -1) { |
231 | #ifdef RLIMIT_CPU | 243 | #ifdef RLIMIT_CPU |
232 | limit(RLIMIT_CPU, limitt); | 244 | limit(RLIMIT_CPU, limitt); |
233 | #else | 245 | #else |
234 | if (OPT_verbose) bb_error_msg("system does not support %s", "RLIMIT_CPU"); | 246 | if (OPT_verbose) bb_error_msg("system does not support %s", |
247 | "RLIMIT_CPU"); | ||
235 | #endif | 248 | #endif |
236 | } | 249 | } |
237 | } | 250 | } |