blob: fbc75cbeea28ff16014b9863c1e773900f5d7477 [file] [log] [blame]
"Robert P. J. Day"63fc1a92006-07-02 19:47:05 +00001/* vi: set sw=4 ts=4: */
Rob Landley6eb1e412005-06-20 04:30:36 +00002/*
3 * ipcs.c -- provides information on allocated ipc resources.
4 *
5 * 01 Sept 2004 - Rodney Radford <rradford@mindspring.com>
6 * Adapted for busybox from util-linux-2.12a.
7 *
Bernhard Reutner-Fischera38330c2006-04-03 11:25:48 +00008 * Licensed under GPLv2 or later, see file LICENSE in this tarball for details.
Rob Landley6eb1e412005-06-20 04:30:36 +00009 */
10
11#include <stdio.h>
12#include <stdlib.h>
13#include <getopt.h>
14#include <errno.h>
15#include <time.h>
16#include <pwd.h>
17#include <grp.h>
18
19/* X/OPEN tells us to use <sys/{types,ipc,sem}.h> for semctl() */
20/* X/OPEN tells us to use <sys/{types,ipc,msg}.h> for msgctl() */
21/* X/OPEN tells us to use <sys/{types,ipc,shm}.h> for shmctl() */
22#include <sys/types.h>
23#include <sys/ipc.h>
24#include <sys/sem.h>
25#include <sys/msg.h>
26#include <sys/shm.h>
27
28#include "busybox.h"
29
30/*-------------------------------------------------------------------*/
31/* SHM_DEST and SHM_LOCKED are defined in kernel headers,
32 but inside #ifdef __KERNEL__ ... #endif */
33#ifndef SHM_DEST
34/* shm_mode upper byte flags */
35#define SHM_DEST 01000 /* segment will be destroyed on last detach */
36#define SHM_LOCKED 02000 /* segment will not be swapped */
37#endif
38
39/* For older kernels the same holds for the defines below */
40#ifndef MSG_STAT
41#define MSG_STAT 11
42#define MSG_INFO 12
43#endif
44
45#ifndef SHM_STAT
46#define SHM_STAT 13
47#define SHM_INFO 14
48struct shm_info {
49 int used_ids;
50 ulong shm_tot; /* total allocated shm */
51 ulong shm_rss; /* total resident shm */
52 ulong shm_swp; /* total swapped shm */
53 ulong swap_attempts;
54 ulong swap_successes;
55};
56#endif
57
58#ifndef SEM_STAT
59#define SEM_STAT 18
60#define SEM_INFO 19
61#endif
62
63/* Some versions of libc only define IPC_INFO when __USE_GNU is defined. */
64#ifndef IPC_INFO
65#define IPC_INFO 3
66#endif
67/*-------------------------------------------------------------------*/
68
69/* The last arg of semctl is a union semun, but where is it defined?
70 X/OPEN tells us to define it ourselves, but until recently
71 Linux include files would also define it. */
72#if defined (__GNU_LIBRARY__) && !defined(_SEM_SEMUN_UNDEFINED)
73/* union semun is defined by including <sys/sem.h> */
74#else
75/* according to X/OPEN we have to define it ourselves */
76union semun {
77 int val;
78 struct semid_ds *buf;
79 unsigned short int *array;
80 struct seminfo *__buf;
81};
82#endif
83
84/* X/OPEN (Jan 1987) does not define fields key, seq in struct ipc_perm;
85 libc 4/5 does not mention struct ipc_term at all, but includes
86 <linux/ipc.h>, which defines a struct ipc_perm with such fields.
87 glibc-1.09 has no support for sysv ipc.
88 glibc 2 uses __key, __seq */
89#if defined (__GNU_LIBRARY__) && __GNU_LIBRARY__ > 1
90#define KEY __key
91#else
92#define KEY key
93#endif
94
95#define LIMITS 1
96#define STATUS 2
97#define CREATOR 3
98#define TIME 4
99#define PID 5
100
Bernhard Reutner-Fischera38330c2006-04-03 11:25:48 +0000101
102static void print_perms (int id, struct ipc_perm *ipcp) {
103 struct passwd *pw;
104 struct group *gr;
105
106 bb_printf ("%-10d %-10o", id, ipcp->mode & 0777);
107
108 if ((pw = getpwuid(ipcp->cuid)))
109 bb_printf(" %-10s", pw->pw_name);
110 else
111 bb_printf(" %-10d", ipcp->cuid);
112 if ((gr = getgrgid(ipcp->cgid)))
113 bb_printf(" %-10s", gr->gr_name);
114 else
115 bb_printf(" %-10d", ipcp->cgid);
116
117 if ((pw = getpwuid(ipcp->uid)))
118 bb_printf(" %-10s", pw->pw_name);
119 else
120 bb_printf(" %-10d", ipcp->uid);
121 if ((gr = getgrgid(ipcp->gid)))
122 bb_printf(" %-10s\n", gr->gr_name);
123 else
124 bb_printf(" %-10d\n", ipcp->gid);
125}
126
127
128static void do_shm (char format)
129{
130 int maxid, shmid, id;
131 struct shmid_ds shmseg;
132 struct shm_info shm_info;
133 struct shminfo shminfo;
134 struct ipc_perm *ipcp = &shmseg.shm_perm;
135 struct passwd *pw;
136
137 maxid = shmctl (0, SHM_INFO, (struct shmid_ds *) (void *) &shm_info);
138 if (maxid < 0) {
139 bb_printf ("kernel not configured for shared memory\n");
140 return;
141 }
142
143 switch (format) {
144 case LIMITS:
145 bb_printf ("------ Shared Memory Limits --------\n");
146 if ((shmctl (0, IPC_INFO, (struct shmid_ds *) (void *) &shminfo)) < 0 )
147 return;
148 /* glibc 2.1.3 and all earlier libc's have ints as fields
149 of struct shminfo; glibc 2.1.91 has unsigned long; ach */
150 bb_printf ("max number of segments = %lu\n"
151 "max seg size (kbytes) = %lu\n"
152 "max total shared memory (pages) = %lu\n"
153 "min seg size (bytes) = %lu\n",
154 (unsigned long) shminfo.shmmni,
155 (unsigned long) (shminfo.shmmax >> 10),
156 (unsigned long) shminfo.shmall,
157 (unsigned long) shminfo.shmmin);
158 return;
159
160 case STATUS:
161 bb_printf ("------ Shared Memory Status --------\n"
162 "segments allocated %d\n"
163 "pages allocated %ld\n"
164 "pages resident %ld\n"
165 "pages swapped %ld\n"
166 "Swap performance: %ld attempts\t %ld successes\n",
167 shm_info.used_ids,
168 shm_info.shm_tot,
169 shm_info.shm_rss,
170 shm_info.shm_swp,
171 shm_info.swap_attempts, shm_info.swap_successes);
172 return;
173
174 case CREATOR:
175 bb_printf ("------ Shared Memory Segment Creators/Owners --------\n"
176 "%-10s %-10s %-10s %-10s %-10s %-10s\n",
177 "shmid","perms","cuid","cgid","uid","gid");
178 break;
179
180 case TIME:
181 bb_printf ("------ Shared Memory Attach/Detach/Change Times --------\n"
182 "%-10s %-10s %-20s %-20s %-20s\n",
183 "shmid","owner","attached","detached","changed");
184 break;
185
186 case PID:
187 bb_printf ("------ Shared Memory Creator/Last-op --------\n"
188 "%-10s %-10s %-10s %-10s\n",
189 "shmid","owner","cpid","lpid");
190 break;
191
192 default:
193 bb_printf ("------ Shared Memory Segments --------\n"
194 "%-10s %-10s %-10s %-10s %-10s %-10s %-12s\n",
195 "key","shmid","owner","perms","bytes","nattch","status");
196 break;
197 }
198
199 for (id = 0; id <= maxid; id++) {
200 shmid = shmctl (id, SHM_STAT, &shmseg);
201 if (shmid < 0)
202 continue;
203 if (format == CREATOR) {
204 print_perms (shmid, ipcp);
205 continue;
206 }
207 pw = getpwuid(ipcp->uid);
208 switch (format) {
209 case TIME:
210 if (pw)
211 bb_printf ("%-10d %-10.10s", shmid, pw->pw_name);
212 else
213 bb_printf ("%-10d %-10d", shmid, ipcp->uid);
214 /* ctime uses static buffer: use separate calls */
215 bb_printf(" %-20.16s", shmseg.shm_atime
216 ? ctime(&shmseg.shm_atime) + 4 : "Not set");
217 bb_printf(" %-20.16s", shmseg.shm_dtime
218 ? ctime(&shmseg.shm_dtime) + 4 : "Not set");
219 bb_printf(" %-20.16s\n", shmseg.shm_ctime
220 ? ctime(&shmseg.shm_ctime) + 4 : "Not set");
221 break;
222 case PID:
223 if (pw)
224 bb_printf ("%-10d %-10.10s", shmid, pw->pw_name);
225 else
226 bb_printf ("%-10d %-10d", shmid, ipcp->uid);
227 bb_printf (" %-10d %-10d\n",
228 shmseg.shm_cpid, shmseg.shm_lpid);
229 break;
230
231 default:
232 bb_printf("0x%08x ",ipcp->KEY );
233 if (pw)
234 bb_printf ("%-10d %-10.10s", shmid, pw->pw_name);
235 else
236 bb_printf ("%-10d %-10d", shmid, ipcp->uid);
237 bb_printf ("%-10o %-10lu %-10ld %-6s %-6s\n",
238 ipcp->mode & 0777,
239 /*
240 * earlier: int, Austin has size_t
241 */
242 (unsigned long) shmseg.shm_segsz,
243 /*
244 * glibc-2.1.3 and earlier has unsigned short;
245 * Austin has shmatt_t
246 */
247 (long) shmseg.shm_nattch,
248 ipcp->mode & SHM_DEST ? "dest" : " ",
249 ipcp->mode & SHM_LOCKED ? "locked" : " ");
250 break;
251 }
252 }
253 return;
254}
255
256
257static void do_sem (char format)
258{
259 int maxid, semid, id;
260 struct semid_ds semary;
261 struct seminfo seminfo;
262 struct ipc_perm *ipcp = &semary.sem_perm;
263 struct passwd *pw;
264 union semun arg;
265
266 arg.array = (ushort *) (void *) &seminfo;
267 maxid = semctl (0, 0, SEM_INFO, arg);
268 if (maxid < 0) {
269 bb_printf ("kernel not configured for semaphores\n");
270 return;
271 }
272
273 switch (format) {
274 case LIMITS:
275 bb_printf ("------ Semaphore Limits --------\n");
276 arg.array = (ushort *) (void *) &seminfo; /* damn union */
277 if ((semctl (0, 0, IPC_INFO, arg)) < 0 )
278 return;
279 bb_printf ("max number of arrays = %d\n"
280 "max semaphores per array = %d\n"
281 "max semaphores system wide = %d\n"
282 "max ops per semop call = %d\n"
283 "semaphore max value = %d\n",
284 seminfo.semmni,
285 seminfo.semmsl,
286 seminfo.semmns,
287 seminfo.semopm,
288 seminfo.semvmx);
289 return;
290
291 case STATUS:
292 bb_printf ("------ Semaphore Status --------\n"
293 "used arrays = %d\n"
294 "allocated semaphores = %d\n",
295 seminfo.semusz,
296 seminfo.semaem);
297 return;
298
299 case CREATOR:
300 bb_printf ("------ Semaphore Arrays Creators/Owners --------\n"
301 "%-10s %-10s %-10s %-10s %-10s %-10s\n",
302 "semid","perms","cuid","cgid","uid","gid");
303 break;
304
305 case TIME:
306 bb_printf ("------ Shared Memory Operation/Change Times --------\n"
307 "%-8s %-10s %-26.24s %-26.24s\n",
308 "shmid","owner","last-op","last-changed");
309 break;
310
311 case PID:
312 break;
313
314 default:
315 bb_printf ("------ Semaphore Arrays --------\n"
316 "%-10s %-10s %-10s %-10s %-10s\n",
317 "key","semid","owner","perms","nsems");
318 break;
319 }
320
321 for (id = 0; id <= maxid; id++) {
322 arg.buf = (struct semid_ds *) &semary;
323 semid = semctl (id, 0, SEM_STAT, arg);
324 if (semid < 0)
325 continue;
326 if (format == CREATOR) {
327 print_perms (semid, ipcp);
328 continue;
329 }
330 pw = getpwuid(ipcp->uid);
331 switch (format) {
332 case TIME:
333 if (pw)
334 bb_printf ("%-8d %-10.10s", semid, pw->pw_name);
335 else
336 bb_printf ("%-8d %-10d", semid, ipcp->uid);
337 bb_printf (" %-26.24s", semary.sem_otime
338 ? ctime(&semary.sem_otime) : "Not set");
339 bb_printf (" %-26.24s\n", semary.sem_ctime
340 ? ctime(&semary.sem_ctime) : "Not set");
341 break;
342 case PID:
343 break;
344
345 default:
346 bb_printf("0x%08x ", ipcp->KEY);
347 if (pw)
348 bb_printf ("%-10d %-10.9s", semid, pw->pw_name);
349 else
350 bb_printf ("%-10d %-9d", semid, ipcp->uid);
351 bb_printf ("%-10o %-10ld\n",
352 ipcp->mode & 0777,
353 /*
354 * glibc-2.1.3 and earlier has unsigned short;
355 * glibc-2.1.91 has variation between
356 * unsigned short and unsigned long
357 * Austin prescribes unsigned short.
358 */
359 (long) semary.sem_nsems);
360 break;
361 }
362 }
363}
364
365
366static void do_msg (char format)
367{
368 int maxid, msqid, id;
369 struct msqid_ds msgque;
370 struct msginfo msginfo;
371 struct ipc_perm *ipcp = &msgque.msg_perm;
372 struct passwd *pw;
373
374 maxid = msgctl (0, MSG_INFO, (struct msqid_ds *) (void *) &msginfo);
375 if (maxid < 0) {
376 bb_printf ("kernel not configured for message queues\n");
377 return;
378 }
379
380 switch (format) {
381 case LIMITS:
382 if ((msgctl (0, IPC_INFO, (struct msqid_ds *) (void *) &msginfo)) < 0 )
383 return;
384 bb_printf ("------ Messages: Limits --------\n"
385 "max queues system wide = %d\n"
386 "max size of message (bytes) = %d\n"
387 "default max size of queue (bytes) = %d\n",
388 msginfo.msgmni,
389 msginfo.msgmax,
390 msginfo.msgmnb);
391 return;
392
393 case STATUS:
394 bb_printf ("------ Messages: Status --------\n"
395 "allocated queues = %d\n"
396 "used headers = %d\n"
397 "used space = %d bytes\n",
398 msginfo.msgpool,
399 msginfo.msgmap,
400 msginfo.msgtql);
401 return;
402
403 case CREATOR:
404 bb_printf ("------ Message Queues: Creators/Owners --------\n"
405 "%-10s %-10s %-10s %-10s %-10s %-10s\n",
406 "msqid","perms","cuid","cgid","uid","gid");
407 break;
408
409 case TIME:
410 bb_printf ("------ Message Queues Send/Recv/Change Times --------\n"
411 "%-8s %-10s %-20s %-20s %-20s\n",
412 "msqid","owner","send","recv","change");
413 break;
414
415 case PID:
416 bb_printf ("------ Message Queues PIDs --------\n"
417 "%-10s %-10s %-10s %-10s\n",
418 "msqid","owner","lspid","lrpid");
419 break;
420
421 default:
422 bb_printf ("------ Message Queues --------\n"
423 "%-10s %-10s %-10s %-10s %-12s %-12s\n",
424 "key","msqid","owner","perms","used-bytes","messages");
425 break;
426 }
427
428 for (id = 0; id <= maxid; id++) {
429 msqid = msgctl (id, MSG_STAT, &msgque);
430 if (msqid < 0)
431 continue;
432 if (format == CREATOR) {
433 print_perms (msqid, ipcp);
434 continue;
435 }
436 pw = getpwuid(ipcp->uid);
437 switch (format) {
438 case TIME:
439 if (pw)
440 bb_printf ("%-8d %-10.10s", msqid, pw->pw_name);
441 else
442 bb_printf ("%-8d %-10d", msqid, ipcp->uid);
443 bb_printf (" %-20.16s", msgque.msg_stime
444 ? ctime(&msgque.msg_stime) + 4 : "Not set");
445 bb_printf (" %-20.16s", msgque.msg_rtime
446 ? ctime(&msgque.msg_rtime) + 4 : "Not set");
447 bb_printf (" %-20.16s\n", msgque.msg_ctime
448 ? ctime(&msgque.msg_ctime) + 4 : "Not set");
449 break;
450 case PID:
451 if (pw)
452 bb_printf ("%-8d %-10.10s", msqid, pw->pw_name);
453 else
454 bb_printf ("%-8d %-10d", msqid, ipcp->uid);
455 bb_printf (" %5d %5d\n",
456 msgque.msg_lspid, msgque.msg_lrpid);
457 break;
458
459 default:
460 bb_printf( "0x%08x ",ipcp->KEY );
461 if (pw)
462 bb_printf ("%-10d %-10.10s", msqid, pw->pw_name);
463 else
464 bb_printf ("%-10d %-10d", msqid, ipcp->uid);
465 bb_printf (" %-10o %-12ld %-12ld\n",
466 ipcp->mode & 0777,
467 /*
468 * glibc-2.1.3 and earlier has unsigned short;
469 * glibc-2.1.91 has variation between
470 * unsigned short, unsigned long
471 * Austin has msgqnum_t
472 */
473 (long) msgque.msg_cbytes,
474 (long) msgque.msg_qnum);
475 break;
476 }
477 }
478 return;
479}
480
481
482static void print_shm (int shmid)
483{
484 struct shmid_ds shmds;
485 struct ipc_perm *ipcp = &shmds.shm_perm;
486
487 if (shmctl (shmid, IPC_STAT, &shmds) == -1) {
488 perror ("shmctl ");
489 return;
490 }
491
492 bb_printf ("\nShared memory Segment shmid=%d\n"
493 "uid=%d\tgid=%d\tcuid=%d\tcgid=%d\n"
494 "mode=%#o\taccess_perms=%#o\n"
495 "bytes=%ld\tlpid=%d\tcpid=%d\tnattch=%ld\n"
496 "att_time=%-26.24s\n"
497 "det_time=%-26.24s\n"
498 "change_time=%-26.24s\n"
499 "\n",
500 shmid,
501 ipcp->uid, ipcp->gid, ipcp->cuid, ipcp->cgid,
502 ipcp->mode, ipcp->mode & 0777,
503 (long) shmds.shm_segsz, shmds.shm_lpid, shmds.shm_cpid,
504 (long) shmds.shm_nattch,
505 shmds.shm_atime ? ctime (&shmds.shm_atime) : "Not set",
506 shmds.shm_dtime ? ctime (&shmds.shm_dtime) : "Not set",
507 ctime (&shmds.shm_ctime));
508 return;
509}
510
511
512static void print_msg (int msqid)
513{
514 struct msqid_ds buf;
515 struct ipc_perm *ipcp = &buf.msg_perm;
516
517 if (msgctl (msqid, IPC_STAT, &buf) == -1) {
518 perror ("msgctl ");
519 return;
520 }
521
522 bb_printf ("\nMessage Queue msqid=%d\n"
523 "uid=%d\tgid=%d\tcuid=%d\tcgid=%d\tmode=%#o\n"
524 "cbytes=%ld\tqbytes=%ld\tqnum=%ld\tlspid=%d\tlrpid=%d\n"
525 "send_time=%-26.24s\n"
526 "rcv_time=%-26.24s\n"
527 "change_time=%-26.24s\n"
528 "\n",
529 msqid,
530 ipcp->uid, ipcp->gid, ipcp->cuid, ipcp->cgid, ipcp->mode,
531 /*
532 * glibc-2.1.3 and earlier has unsigned short;
533 * glibc-2.1.91 has variation between
534 * unsigned short, unsigned long
535 * Austin has msgqnum_t (for msg_qbytes)
536 */
537 (long) buf.msg_cbytes, (long) buf.msg_qbytes,
538 (long) buf.msg_qnum, buf.msg_lspid, buf.msg_lrpid,
539 buf.msg_stime ? ctime (&buf.msg_stime) : "Not set",
540 buf.msg_rtime ? ctime (&buf.msg_rtime) : "Not set",
541 buf.msg_ctime ? ctime (&buf.msg_ctime) : "Not set");
542 return;
543}
544
545static void print_sem (int semid)
546{
547 struct semid_ds semds;
548 struct ipc_perm *ipcp = &semds.sem_perm;
549 union semun arg;
550 unsigned int i;
551
552 arg.buf = &semds;
553 if (semctl (semid, 0, IPC_STAT, arg) < 0) {
554 perror ("semctl ");
555 return;
556 }
557
558 bb_printf ("\nSemaphore Array semid=%d\n"
559 "uid=%d\t gid=%d\t cuid=%d\t cgid=%d\n"
560 "mode=%#o, access_perms=%#o\n"
561 "nsems = %ld\n"
562 "otime = %-26.24s\n"
563 "ctime = %-26.24s\n"
564 "%-10s %-10s %-10s %-10s %-10s\n",
565 semid,
566 ipcp->uid, ipcp->gid, ipcp->cuid, ipcp->cgid,
567 ipcp->mode, ipcp->mode & 0777,
568 (long) semds.sem_nsems,
569 semds.sem_otime ? ctime (&semds.sem_otime) : "Not set",
570 ctime (&semds.sem_ctime),
571 "semnum","value","ncount","zcount","pid");
572
573 arg.val = 0;
574 for (i=0; i < semds.sem_nsems; i++) {
575 int val, ncnt, zcnt, pid;
576 val = semctl (semid, i, GETVAL, arg);
577 ncnt = semctl (semid, i, GETNCNT, arg);
578 zcnt = semctl (semid, i, GETZCNT, arg);
579 pid = semctl (semid, i, GETPID, arg);
580 if (val < 0 || ncnt < 0 || zcnt < 0 || pid < 0) {
581 perror ("semctl ");
582 bb_fflush_stdout_and_exit (1);
583 }
584 bb_printf ("%-10d %-10d %-10d %-10d %-10d\n",
585 i, val, ncnt, zcnt, pid);
586 }
587 bb_printf ("\n");
588 return;
589}
Rob Landley6eb1e412005-06-20 04:30:36 +0000590
591int ipcs_main (int argc, char **argv) {
Tim Rikerc1ef7bd2006-01-25 00:08:53 +0000592 int opt, msg = 0, sem = 0, shm = 0, id=0, print=0;
Rob Landley6eb1e412005-06-20 04:30:36 +0000593 char format = 0;
594 char options[] = "atclupsmqi:ih?";
595
596 while ((opt = getopt (argc, argv, options)) != -1) {
597 switch (opt) {
598 case 'i':
599 id = atoi (optarg);
600 print = 1;
601 break;
602 case 'a':
603 msg = shm = sem = 1;
604 break;
605 case 'q':
606 msg = 1;
607 break;
608 case 's':
609 sem = 1;
610 break;
611 case 'm':
612 shm = 1;
613 break;
614 case 't':
615 format = TIME;
616 break;
617 case 'c':
618 format = CREATOR;
619 break;
620 case 'p':
621 format = PID;
622 break;
623 case 'l':
624 format = LIMITS;
625 break;
626 case 'u':
627 format = STATUS;
628 break;
Tim Rikerc1ef7bd2006-01-25 00:08:53 +0000629 case 'h':
Rob Landley6eb1e412005-06-20 04:30:36 +0000630 case '?':
631 bb_show_usage();
632 bb_fflush_stdout_and_exit (0);
633 }
634 }
635
636 if (print) {
Tim Rikerc1ef7bd2006-01-25 00:08:53 +0000637 if (shm) {
Rob Landley6eb1e412005-06-20 04:30:36 +0000638 print_shm (id);
639 bb_fflush_stdout_and_exit (0);
640 }
Tim Rikerc1ef7bd2006-01-25 00:08:53 +0000641 if (sem) {
Rob Landley6eb1e412005-06-20 04:30:36 +0000642 print_sem (id);
643 bb_fflush_stdout_and_exit (0);
644 }
645 if (msg) {
646 print_msg (id);
647 bb_fflush_stdout_and_exit (0);
648 }
649 bb_show_usage();
650 bb_fflush_stdout_and_exit (0);
651 }
652
653 if ( !shm && !msg && !sem)
654 msg = sem = shm = 1;
655 bb_printf ("\n");
656
Tim Rikerc1ef7bd2006-01-25 00:08:53 +0000657 if (shm) {
Rob Landley6eb1e412005-06-20 04:30:36 +0000658 do_shm (format);
659 bb_printf ("\n");
660 }
Tim Rikerc1ef7bd2006-01-25 00:08:53 +0000661 if (sem) {
Rob Landley6eb1e412005-06-20 04:30:36 +0000662 do_sem (format);
663 bb_printf ("\n");
664 }
Tim Rikerc1ef7bd2006-01-25 00:08:53 +0000665 if (msg) {
Rob Landley6eb1e412005-06-20 04:30:36 +0000666 do_msg (format);
667 bb_printf ("\n");
668 }
669 return 0;
670}
671