unstack, sort: cleanup and improvement
[minix.git] / commands / ipcs / ipcs.c
blob640efdb8f53eef1c7d749284567dfe7855b6701c
1 /* Original author unknown, may be "krishna balasub@cis.ohio-state.edu" */
2 /*
4 Modified Sat Oct 9 10:55:28 1993 for 0.99.13
6 Patches from Mike Jagdis (jaggy@purplet.demon.co.uk) applied Wed Feb
7 8 12:12:21 1995 by faith@cs.unc.edu to print numeric uids if no
8 passwd file entry.
10 Patch from arnolds@ifns.de (Heinz-Ado Arnolds) applied Mon Jul 1
11 19:30:41 1996 by janl@math.uio.no to add code missing in case PID:
12 clauses.
14 Patched to display the key field -- hy@picksys.com 12/18/96
16 1999-02-22 Arkadiusz Mi秌iewicz <misiek@pld.ORG.PL>
17 - added Native Language Support
21 #define __USE_MISC
23 #include <stdio.h>
24 #include <stdlib.h>
25 #include <errno.h>
26 #include <time.h>
27 #include <pwd.h>
28 #include <grp.h>
29 #include <unistd.h>
30 #include <stdarg.h>
31 #include <sys/types.h>
32 #include <sys/ipc.h>
33 #include <sys/shm.h>
34 #include <sys/sem.h>
36 /* remove _() stuff */
37 #define _(a) a
38 #ifndef __NBSD_LIBC
39 typedef unsigned long ulong;
40 void err(int eval, const char *fmt, ...)
42 va_list ap;
43 va_start(ap, fmt);
44 vfprintf(stderr, fmt, ap);
45 va_end(ap);
46 exit(eval);
48 #endif
50 /*-------------------------------------------------------------------*/
51 /* SHM_DEST and SHM_LOCKED are defined in kernel headers,
52 but inside #ifdef __KERNEL__ ... #endif */
53 #ifndef SHM_DEST
54 /* shm_mode upper byte flags */
55 #define SHM_DEST 01000 /* segment will be destroyed on last detach */
56 #define SHM_LOCKED 02000 /* segment will not be swapped */
57 #endif
59 /* For older kernels the same holds for the defines below */
60 #ifndef MSG_STAT
61 #define MSG_STAT 11
62 #define MSG_INFO 12
63 #endif
65 #ifndef SHM_STAT
66 #define SHM_STAT 13
67 #define SHM_INFO 14
68 struct shm_info {
69 int used_ids;
70 ulong shm_tot; /* total allocated shm */
71 ulong shm_rss; /* total resident shm */
72 ulong shm_swp; /* total swapped shm */
73 ulong swap_attempts;
74 ulong swap_successes;
76 #endif
78 #ifndef SEM_STAT
79 #define SEM_STAT 18
80 #define SEM_INFO 19
81 #endif
83 /* Some versions of libc only define IPC_INFO when __USE_GNU is defined. */
84 #ifndef IPC_INFO
85 #define IPC_INFO 3
86 #endif
87 /*-------------------------------------------------------------------*/
89 /* The last arg of semctl is a union semun, but where is it defined?
90 X/OPEN tells us to define it ourselves, but until recently
91 Linux include files would also define it. */
92 #if defined (__GNU_LIBRARY__) && !defined(_SEM_SEMUN_UNDEFINED)
93 /* union semun is defined by including <sys/sem.h> */
94 #else
95 /* according to X/OPEN we have to define it ourselves */
96 union semun {
97 int val;
98 struct semid_ds *buf;
99 unsigned short int *array;
100 struct seminfo *__buf;
102 #endif
104 /* X/OPEN (Jan 1987) does not define fields key, seq in struct ipc_perm;
105 libc 4/5 does not mention struct ipc_term at all, but includes
106 <linux/ipc.h>, which defines a struct ipc_perm with such fields.
107 glibc-1.09 has no support for sysv ipc.
108 glibc 2 uses __key, __seq */
109 #if defined (__GNU_LIBRARY__) && __GNU_LIBRARY__ > 1
110 #define KEY __key
111 #else
112 #define KEY key
113 #endif
115 #define LIMITS 1
116 #define STATUS 2
117 #define CREATOR 3
118 #define TIME 4
119 #define PID 5
121 void do_shm (char format);
122 void do_sem (char format);
123 void do_msg (char format);
124 void print_shm (int id);
125 void print_msg (int id);
126 void print_sem (int id);
128 static char *progname;
130 static void
131 usage(int rc) {
132 printf (_("usage : %s -asmq -tclup \n"), progname);
133 printf (_("\t%s [-s -m -q] -i id\n"), progname);
134 printf (_("\t%s -h for help.\n"), progname);
135 exit(rc);
138 static void
139 help (int rc) {
140 printf (_("%s provides information on ipc facilities for"
141 " which you have read access.\n"), progname);
142 printf (_("Resource Specification:\n\t-m : shared_mem\n\t-q : messages\n"));
143 printf (_("\t-s : semaphores\n\t-a : all (default)\n"));
144 printf (_("Output Format:\n\t-t : time\n\t-p : pid\n\t-c : creator\n"));
145 printf (_("\t-l : limits\n\t-u : summary\n"));
146 printf (_("-i id [-s -q -m] : details on resource identified by id\n"));
147 usage(rc);
151 main (int argc, char **argv) {
152 int opt, msg = 0, sem = 0, shm = 0, id=0, print=0;
153 char format = 0;
154 char options[] = "atcluphsmqi:";
156 progname = argv[0];
157 while ((opt = getopt (argc, argv, options)) != -1) {
158 switch (opt) {
159 case 'i':
160 id = atoi (optarg);
161 print = 1;
162 break;
163 case 'a':
164 msg = shm = sem = 1;
165 break;
166 case 'q':
167 msg = 1;
168 break;
169 case 's':
170 sem = 1;
171 break;
172 case 'm':
173 shm = 1;
174 break;
175 case 't':
176 format = TIME;
177 break;
178 case 'c':
179 format = CREATOR;
180 break;
181 case 'p':
182 format = PID;
183 break;
184 case 'l':
185 format = LIMITS;
186 break;
187 case 'u':
188 format = STATUS;
189 break;
190 case 'h':
191 help(EXIT_SUCCESS);
192 case '?':
193 usage(EXIT_SUCCESS);
197 if (print) {
198 if (shm)
199 print_shm (id);
200 else if (sem)
201 print_sem (id);
202 else if (msg)
203 print_msg (id);
204 else
205 usage (EXIT_FAILURE);
206 } else {
207 if ( !shm && !msg && !sem)
208 msg = sem = shm = 1;
209 printf ("\n");
211 if (shm) {
212 do_shm (format);
213 printf ("\n");
215 if (sem) {
216 do_sem (format);
217 printf ("\n");
219 if (msg) {
220 do_msg (format);
221 printf ("\n");
224 return EXIT_SUCCESS;
228 static void
229 print_perms (int id, struct ipc_perm *ipcp) {
230 struct passwd *pw;
231 struct group *gr;
233 printf ("%-10d %-10o", id, ipcp->mode & 0777);
235 if ((pw = getpwuid(ipcp->cuid)))
236 printf(" %-10s", pw->pw_name);
237 else
238 printf(" %-10d", ipcp->cuid);
239 if ((gr = getgrgid(ipcp->cgid)))
240 printf(" %-10s", gr->gr_name);
241 else
242 printf(" %-10d", ipcp->cgid);
244 if ((pw = getpwuid(ipcp->uid)))
245 printf(" %-10s", pw->pw_name);
246 else
247 printf(" %-10d", ipcp->uid);
248 if ((gr = getgrgid(ipcp->gid)))
249 printf(" %-10s\n", gr->gr_name);
250 else
251 printf(" %-10d\n", ipcp->gid);
255 void do_shm (char format)
257 int maxid, shmid, id;
258 struct shmid_ds shmseg;
259 struct shm_info shm_info;
260 struct shminfo shminfo;
261 struct ipc_perm *ipcp = &shmseg.shm_perm;
262 struct passwd *pw;
264 maxid = shmctl (0, SHM_INFO, (struct shmid_ds *) (void *) &shm_info);
265 if (maxid < 0 && errno == ENOSYS) {
266 printf (_("kernel not configured for shared memory\n"));
267 return;
270 switch (format) {
271 case LIMITS:
272 printf (_("------ Shared Memory Limits --------\n"));
273 if ((shmctl (0, IPC_INFO, (struct shmid_ds *) (void *) &shminfo)) < 0 )
274 return;
275 /* glibc 2.1.3 and all earlier libc's have ints as fields
276 of struct shminfo; glibc 2.1.91 has unsigned long; ach */
277 printf (_("max number of segments = %lu\n"),
278 (unsigned long) shminfo.shmmni);
279 printf (_("max seg size (kbytes) = %lu\n"),
280 (unsigned long) (shminfo.shmmax >> 10));
281 printf (_("max total shared memory (kbytes) = %lu\n"),
282 getpagesize() / 1024 * (unsigned long) shminfo.shmall);
283 printf (_("min seg size (bytes) = %lu\n"),
284 (unsigned long) shminfo.shmmin);
285 return;
287 case STATUS:
288 printf (_("------ Shared Memory Status --------\n"));
289 printf (_("segments allocated %d\n"), shm_info.used_ids);
290 printf (_("pages allocated %ld\n"), shm_info.shm_tot);
291 printf (_("pages resident %ld\n"), shm_info.shm_rss);
292 printf (_("pages swapped %ld\n"), shm_info.shm_swp);
293 printf (_("Swap performance: %ld attempts\t %ld successes\n"),
294 shm_info.swap_attempts, shm_info.swap_successes);
295 return;
297 case CREATOR:
298 printf (_("------ Shared Memory Segment Creators/Owners --------\n"));
299 printf ("%-10s %-10s %-10s %-10s %-10s %-10s\n",
300 _("shmid"),_("perms"),_("cuid"),_("cgid"),_("uid"),_("gid"));
301 break;
303 case TIME:
304 printf (_("------ Shared Memory Attach/Detach/Change Times --------\n"));
305 printf ("%-10s %-10s %-20s %-20s %-20s\n",
306 _("shmid"),_("owner"),_("attached"),_("detached"),
307 _("changed"));
308 break;
310 case PID:
311 printf (_("------ Shared Memory Creator/Last-op --------\n"));
312 printf ("%-10s %-10s %-10s %-10s\n",
313 _("shmid"),_("owner"),_("cpid"),_("lpid"));
314 break;
316 default:
317 printf (_("------ Shared Memory Segments --------\n"));
318 printf ("%-10s %-10s %-10s %-10s %-10s %-10s %-12s\n",
319 _("key"),_("shmid"),_("owner"),_("perms"),_("bytes"),
320 _("nattch"),_("status"));
321 break;
324 for (id = 0; id <= maxid; id++) {
325 shmid = shmctl (id, SHM_STAT, &shmseg);
326 if (shmid < 0)
327 continue;
328 if (format == CREATOR) {
329 print_perms (shmid, ipcp);
330 continue;
332 pw = getpwuid(ipcp->uid);
333 switch (format) {
334 case TIME:
335 if (pw)
336 printf ("%-10d %-10.10s", shmid, pw->pw_name);
337 else
338 printf ("%-10d %-10d", shmid, ipcp->uid);
339 /* ctime uses static buffer: use separate calls */
340 printf(" %-20.16s", shmseg.shm_atime
341 ? ctime(&shmseg.shm_atime) + 4 : _("Not set"));
342 printf(" %-20.16s", shmseg.shm_dtime
343 ? ctime(&shmseg.shm_dtime) + 4 : _("Not set"));
344 printf(" %-20.16s\n", shmseg.shm_ctime
345 ? ctime(&shmseg.shm_ctime) + 4 : _("Not set"));
346 break;
347 case PID:
348 if (pw)
349 printf ("%-10d %-10.10s", shmid, pw->pw_name);
350 else
351 printf ("%-10d %-10d", shmid, ipcp->uid);
352 printf (" %-10d %-10d\n",
353 shmseg.shm_cpid, shmseg.shm_lpid);
354 break;
356 default:
357 printf("0x%08x ",ipcp->KEY );
358 if (pw)
359 printf ("%-10d %-10.10s", shmid, pw->pw_name);
360 else
361 printf ("%-10d %-10d", shmid, ipcp->uid);
362 printf (" %-10o %-10lu %-10ld %-6s %-6s\n",
363 ipcp->mode & 0777,
365 * earlier: int, Austin has size_t
367 (unsigned long) shmseg.shm_segsz,
369 * glibc-2.1.3 and earlier has unsigned short;
370 * Austin has shmatt_t
372 (long) shmseg.shm_nattch,
373 ipcp->mode & SHM_DEST ? _("dest") : " ",
374 ipcp->mode & SHM_LOCKED ? _("locked") : " ");
375 break;
378 return;
382 void do_sem (char format)
384 int maxid, semid, id;
385 struct semid_ds semary;
386 struct seminfo seminfo;
387 struct ipc_perm *ipcp = &semary.sem_perm;
388 struct passwd *pw;
389 union semun arg;
391 arg.array = (unsigned short *) (void *) &seminfo;
392 maxid = semctl (0, 0, SEM_INFO, arg);
393 if (maxid < 0) {
394 printf (_("kernel not configured for semaphores\n"));
395 return;
398 switch (format) {
399 case LIMITS:
400 printf (_("------ Semaphore Limits --------\n"));
401 arg.array = (unsigned short *) (void *) &seminfo; /* damn union */
402 if ((semctl (0, 0, IPC_INFO, arg)) < 0 )
403 return;
404 printf (_("max number of arrays = %d\n"), seminfo.semmni);
405 printf (_("max semaphores per array = %d\n"), seminfo.semmsl);
406 printf (_("max semaphores system wide = %d\n"), seminfo.semmns);
407 printf (_("max ops per semop call = %d\n"), seminfo.semopm);
408 printf (_("semaphore max value = %d\n"), seminfo.semvmx);
409 return;
411 case STATUS:
412 printf (_("------ Semaphore Status --------\n"));
413 printf (_("used arrays = %d\n"), seminfo.semusz);
414 printf (_("allocated semaphores = %d\n"), seminfo.semaem);
415 return;
417 case CREATOR:
418 printf (_("------ Semaphore Arrays Creators/Owners --------\n"));
419 printf ("%-10s %-10s %-10s %-10s %-10s %-10s\n",
420 _("semid"),_("perms"),_("cuid"),_("cgid"),_("uid"),_("gid"));
421 break;
423 case TIME:
424 printf (_("------ Semaphore Operation/Change Times --------\n"));
425 printf ("%-8s %-10s %-26.24s %-26.24s\n",
426 _("semid"),_("owner"),_("last-op"),_("last-changed"));
427 break;
429 case PID:
430 break;
432 default:
433 printf (_("------ Semaphore Arrays --------\n"));
434 printf ("%-10s %-10s %-10s %-10s %-10s\n",
435 _("key"),_("semid"),_("owner"),_("perms"),_("nsems"));
436 break;
439 for (id = 0; id <= maxid; id++) {
440 arg.buf = (struct semid_ds *) &semary;
441 semid = semctl (id, 0, SEM_STAT, arg);
442 if (semid < 0)
443 continue;
444 if (format == CREATOR) {
445 print_perms (semid, ipcp);
446 continue;
448 pw = getpwuid(ipcp->uid);
449 switch (format) {
450 case TIME:
451 if (pw)
452 printf ("%-8d %-10.10s", semid, pw->pw_name);
453 else
454 printf ("%-8d %-10d", semid, ipcp->uid);
455 printf (" %-26.24s", semary.sem_otime
456 ? ctime(&semary.sem_otime) : _("Not set"));
457 printf (" %-26.24s\n", semary.sem_ctime
458 ? ctime(&semary.sem_ctime) : _("Not set"));
459 break;
460 case PID:
461 break;
463 default:
464 printf("0x%08x ", ipcp->KEY);
465 if (pw)
466 printf ("%-10d %-10.10s", semid, pw->pw_name);
467 else
468 printf ("%-10d %-10d", semid, ipcp->uid);
469 printf (" %-10o %-10ld\n",
470 ipcp->mode & 0777,
472 * glibc-2.1.3 and earlier has unsigned short;
473 * glibc-2.1.91 has variation between
474 * unsigned short and unsigned long
475 * Austin prescribes unsigned short.
477 (long) semary.sem_nsems);
478 break;
484 void do_msg (char format)
486 #if 0
487 int maxid, msqid, id;
488 struct msqid_ds msgque;
489 struct msginfo msginfo;
490 struct ipc_perm *ipcp = &msgque.msg_perm;
491 struct passwd *pw;
493 maxid = msgctl (0, MSG_INFO, (struct msqid_ds *) (void *) &msginfo);
494 if (maxid < 0) {
495 printf (_("kernel not configured for message queues\n"));
496 return;
499 switch (format) {
500 case LIMITS:
501 if ((msgctl (0, IPC_INFO, (struct msqid_ds *) (void *) &msginfo)) < 0 )
502 return;
503 printf (_("------ Messages: Limits --------\n"));
504 printf (_("max queues system wide = %d\n"), msginfo.msgmni);
505 printf (_("max size of message (bytes) = %d\n"), msginfo.msgmax);
506 printf (_("default max size of queue (bytes) = %d\n"), msginfo.msgmnb);
507 return;
509 case STATUS:
510 printf (_("------ Messages: Status --------\n"));
511 printf (_("allocated queues = %d\n"), msginfo.msgpool);
512 printf (_("used headers = %d\n"), msginfo.msgmap);
513 printf (_("used space = %d bytes\n"), msginfo.msgtql);
514 return;
516 case CREATOR:
517 printf (_("------ Message Queues: Creators/Owners --------\n"));
518 printf ("%-10s %-10s %-10s %-10s %-10s %-10s\n",
519 _("msqid"),_("perms"),_("cuid"),_("cgid"),_("uid"),_("gid"));
520 break;
522 case TIME:
523 printf (_("------ Message Queues Send/Recv/Change Times --------\n"));
524 printf ("%-8s %-10s %-20s %-20s %-20s\n",
525 _("msqid"),_("owner"),_("send"),_("recv"),_("change"));
526 break;
528 case PID:
529 printf (_("------ Message Queues PIDs --------\n"));
530 printf ("%-10s %-10s %-10s %-10s\n",
531 _("msqid"),_("owner"),_("lspid"),_("lrpid"));
532 break;
534 default:
535 printf (_("------ Message Queues --------\n"));
536 printf ("%-10s %-10s %-10s %-10s %-12s %-12s\n",
537 _("key"), _("msqid"), _("owner"), _("perms"),
538 _("used-bytes"), _("messages"));
539 break;
542 for (id = 0; id <= maxid; id++) {
543 msqid = msgctl (id, MSG_STAT, &msgque);
544 if (msqid < 0)
545 continue;
546 if (format == CREATOR) {
547 print_perms (msqid, ipcp);
548 continue;
550 pw = getpwuid(ipcp->uid);
551 switch (format) {
552 case TIME:
553 if (pw)
554 printf ("%-8d %-10.10s", msqid, pw->pw_name);
555 else
556 printf ("%-8d %-10d", msqid, ipcp->uid);
557 printf (" %-20.16s", msgque.msg_stime
558 ? ctime(&msgque.msg_stime) + 4 : _("Not set"));
559 printf (" %-20.16s", msgque.msg_rtime
560 ? ctime(&msgque.msg_rtime) + 4 : _("Not set"));
561 printf (" %-20.16s\n", msgque.msg_ctime
562 ? ctime(&msgque.msg_ctime) + 4 : _("Not set"));
563 break;
564 case PID:
565 if (pw)
566 printf ("%-8d %-10.10s", msqid, pw->pw_name);
567 else
568 printf ("%-8d %-10d", msqid, ipcp->uid);
569 printf (" %5d %5d\n",
570 msgque.msg_lspid, msgque.msg_lrpid);
571 break;
573 default:
574 printf( "0x%08x ",ipcp->KEY );
575 if (pw)
576 printf ("%-10d %-10.10s", msqid, pw->pw_name);
577 else
578 printf ("%-10d %-10d", msqid, ipcp->uid);
579 printf (" %-10o %-12ld %-12ld\n",
580 ipcp->mode & 0777,
582 * glibc-2.1.3 and earlier has unsigned short;
583 * glibc-2.1.91 has variation between
584 * unsigned short, unsigned long
585 * Austin has msgqnum_t
587 (long) msgque.msg_cbytes,
588 (long) msgque.msg_qnum);
589 break;
592 return;
593 #endif
597 void print_shm (int shmid)
599 struct shmid_ds shmds;
600 struct ipc_perm *ipcp = &shmds.shm_perm;
602 if (shmctl (shmid, IPC_STAT, &shmds) == -1)
603 err(EXIT_FAILURE, _("shmctl failed"));
605 printf (_("\nShared memory Segment shmid=%d\n"), shmid);
606 printf (_("uid=%d\tgid=%d\tcuid=%d\tcgid=%d\n"),
607 ipcp->uid, ipcp->gid, ipcp->cuid, ipcp->cgid);
608 printf (_("mode=%#o\taccess_perms=%#o\n"),
609 ipcp->mode, ipcp->mode & 0777);
610 printf (_("bytes=%ld\tlpid=%d\tcpid=%d\tnattch=%ld\n"),
611 (long) shmds.shm_segsz, shmds.shm_lpid, shmds.shm_cpid,
612 (long) shmds.shm_nattch);
613 printf (_("att_time=%-26.24s\n"),
614 shmds.shm_atime ? ctime (&shmds.shm_atime) : _("Not set"));
615 printf (_("det_time=%-26.24s\n"),
616 shmds.shm_dtime ? ctime (&shmds.shm_dtime) : _("Not set"));
617 printf (_("change_time=%-26.24s\n"), ctime (&shmds.shm_ctime));
618 printf ("\n");
619 return;
623 void print_msg (int msqid)
625 #if 0
626 struct msqid_ds buf;
627 struct ipc_perm *ipcp = &buf.msg_perm;
629 if (msgctl (msqid, IPC_STAT, &buf) == -1)
630 err(EXIT_FAILURE, _("msgctl failed"));
632 printf (_("\nMessage Queue msqid=%d\n"), msqid);
633 printf (_("uid=%d\tgid=%d\tcuid=%d\tcgid=%d\tmode=%#o\n"),
634 ipcp->uid, ipcp->gid, ipcp->cuid, ipcp->cgid, ipcp->mode);
635 printf (_("cbytes=%ld\tqbytes=%ld\tqnum=%ld\tlspid=%d\tlrpid=%d\n"),
637 * glibc-2.1.3 and earlier has unsigned short;
638 * glibc-2.1.91 has variation between
639 * unsigned short, unsigned long
640 * Austin has msgqnum_t (for msg_qbytes)
642 (long) buf.msg_cbytes, (long) buf.msg_qbytes,
643 (long) buf.msg_qnum, buf.msg_lspid, buf.msg_lrpid);
644 printf (_("send_time=%-26.24s\n"),
645 buf.msg_stime ? ctime (&buf.msg_stime) : _("Not set"));
646 printf (_("rcv_time=%-26.24s\n"),
647 buf.msg_rtime ? ctime (&buf.msg_rtime) : _("Not set"));
648 printf (_("change_time=%-26.24s\n"),
649 buf.msg_ctime ? ctime (&buf.msg_ctime) : _("Not set"));
650 printf ("\n");
651 return;
652 #endif
655 void print_sem (int semid)
657 struct semid_ds semds;
658 struct ipc_perm *ipcp = &semds.sem_perm;
659 union semun arg;
660 int i;
662 arg.buf = &semds;
663 if (semctl (semid, 0, IPC_STAT, arg) < 0)
664 err(EXIT_FAILURE, _("semctl failed"));
666 printf (_("\nSemaphore Array semid=%d\n"), semid);
667 printf (_("uid=%d\t gid=%d\t cuid=%d\t cgid=%d\n"),
668 ipcp->uid, ipcp->gid, ipcp->cuid, ipcp->cgid);
669 printf (_("mode=%#o, access_perms=%#o\n"),
670 ipcp->mode, ipcp->mode & 0777);
671 printf (_("nsems = %ld\n"), (long) semds.sem_nsems);
672 printf (_("otime = %-26.24s\n"),
673 semds.sem_otime ? ctime (&semds.sem_otime) : _("Not set"));
674 printf (_("ctime = %-26.24s\n"), ctime (&semds.sem_ctime));
676 printf ("%-10s %-10s %-10s %-10s %-10s\n",
677 _("semnum"),_("value"),_("ncount"),_("zcount"),_("pid"));
678 arg.val = 0;
679 for (i=0; i< semds.sem_nsems; i++) {
680 int val, ncnt, zcnt, pid;
681 val = semctl (semid, i, GETVAL, arg);
682 ncnt = semctl (semid, i, GETNCNT, arg);
683 zcnt = semctl (semid, i, GETZCNT, arg);
684 pid = semctl (semid, i, GETPID, arg);
685 if (val < 0 || ncnt < 0 || zcnt < 0 || pid < 0)
686 err(EXIT_FAILURE, _("semctl failed"));
688 printf ("%-10d %-10d %-10d %-10d %-10d\n",
689 i, val, ncnt, zcnt, pid);
691 printf ("\n");
692 return;