Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/usr.bin/ipcs Remove KVM support.
details: https://anonhg.NetBSD.org/src/rev/71880b223048
branches: trunk
changeset: 329834:71880b223048
user: joerg <joerg%NetBSD.org@localhost>
date: Wed Jun 11 14:57:55 2014 +0000
description:
Remove KVM support.
diffstat:
usr.bin/ipcs/Makefile | 4 +-
usr.bin/ipcs/ipcs.1 | 22 +----
usr.bin/ipcs/ipcs.c | 237 ++-----------------------------------------------
3 files changed, 14 insertions(+), 249 deletions(-)
diffs (truncated from 376 to 300 lines):
diff -r a8d7f92e2d93 -r 71880b223048 usr.bin/ipcs/Makefile
--- a/usr.bin/ipcs/Makefile Wed Jun 11 14:54:32 2014 +0000
+++ b/usr.bin/ipcs/Makefile Wed Jun 11 14:57:55 2014 +0000
@@ -1,7 +1,5 @@
-# $NetBSD: Makefile,v 1.10 2009/04/14 22:15:21 lukem Exp $
+# $NetBSD: Makefile,v 1.11 2014/06/11 14:57:55 joerg Exp $
PROG= ipcs
-DPADD+= ${LIBKVM}
-LDADD+= -lkvm
.include <bsd.prog.mk>
diff -r a8d7f92e2d93 -r 71880b223048 usr.bin/ipcs/ipcs.1
--- a/usr.bin/ipcs/ipcs.1 Wed Jun 11 14:54:32 2014 +0000
+++ b/usr.bin/ipcs/ipcs.1 Wed Jun 11 14:57:55 2014 +0000
@@ -1,4 +1,4 @@
-.\" $NetBSD: ipcs.1,v 1.19 2014/03/18 18:20:45 riastradh Exp $
+.\" $NetBSD: ipcs.1,v 1.20 2014/06/11 14:57:55 joerg Exp $
.\"
.\" Copyright (c) 1994 SigmaSoft, Th. Lockert
.\" All rights reserved.
@@ -23,7 +23,7 @@
.\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
.\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
.\"
-.Dd March 21, 2004
+.Dd June 11, 2014
.Dt IPCS 1
.Os
.Sh NAME
@@ -32,8 +32,6 @@
.Sh SYNOPSIS
.Nm
.Op Fl abcmopqstMQST
-.Op Fl C Ar system
-.Op Fl N Ar core
.Sh DESCRIPTION
The
.Nm
@@ -95,17 +93,8 @@
the last send or receive of a message,
the last attach or detach of a shared memory segment,
or the last operation on a semaphore.
-.It Fl C Ar system
-Extract the name list from the specified system instead of the
-default
-.Dq Pa /netbsd .
.It Fl M
Display system information about shared memory.
-.It Fl N Ar core
-Extract values associated with the name list from the specified
-core instead of the default
-.Dq Pa /dev/kmem .
-and semaphores.
.It Fl Q
Display system information about messages queues.
.It Fl S
@@ -138,13 +127,6 @@
is running; the output of
.Nm
is not guaranteed to be consistent.
-.Sh FILES
-.Bl -tag -width /etc/passwd -compact
-.It Pa /dev/kmem
-default kernel memory
-.It Pa /netbsd
-default system name list
-.El
.Sh SEE ALSO
.Xr ipcrm 1 ,
.Xr shmat 2 ,
diff -r a8d7f92e2d93 -r 71880b223048 usr.bin/ipcs/ipcs.c
--- a/usr.bin/ipcs/ipcs.c Wed Jun 11 14:54:32 2014 +0000
+++ b/usr.bin/ipcs/ipcs.c Wed Jun 11 14:57:55 2014 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: ipcs.c,v 1.42 2009/01/18 01:10:34 lukem Exp $ */
+/* $NetBSD: ipcs.c,v 1.43 2014/06/11 14:57:55 joerg Exp $ */
/*-
* Copyright (c) 2000 The NetBSD Foundation, Inc.
@@ -66,9 +66,7 @@
#include <err.h>
#include <fcntl.h>
#include <grp.h>
-#include <kvm.h>
#include <limits.h>
-#include <nlist.h>
#include <paths.h>
#include <pwd.h>
#include <stdio.h>
@@ -90,13 +88,11 @@
#define PID 8
#define TIME 16
-static char *core = NULL, *namelist = NULL;
static int display = 0;
static int option = 0;
static void cvt_time(time_t, char *, size_t);
static char *fmt_perm(u_short);
-static void ipcs_kvm(void);
static void msg_sysctl(void);
static void sem_sysctl(void);
static void shm_sysctl(void);
@@ -174,7 +170,7 @@
int i;
time_t now;
- while ((i = getopt(argc, argv, "MmQqSsabC:cN:optT")) != -1)
+ while ((i = getopt(argc, argv, "MmQqSsabcoptT")) != -1)
switch (i) {
case 'M':
display |= SHMTOTAL;
@@ -203,15 +199,9 @@
case 'b':
option |= BIGGEST;
break;
- case 'C':
- core = optarg;
- break;
case 'c':
option |= CREATOR;
break;
- case 'N':
- namelist = optarg;
- break;
case 'o':
option |= OUTSTANDING;
break;
@@ -229,22 +219,19 @@
usage();
(void)time(&now);
- (void)printf("IPC status from %s as of %s\n",
+ (void)printf("IPC status from <running system> as of %s\n",
/* and extra \n from ctime(3) */
- core == NULL ? "<running system>" : core, ctime(&now));
+ ctime(&now));
if (display == 0)
display = SHMINFO | MSGINFO | SEMINFO;
- if (core == NULL) {
- if (display & (MSGINFO | MSGTOTAL))
- msg_sysctl();
- if (display & (SHMINFO | SHMTOTAL))
- shm_sysctl();
- if (display & (SEMINFO | SEMTOTAL))
- sem_sysctl();
- } else
- ipcs_kvm();
+ if (display & (MSGINFO | MSGTOTAL))
+ msg_sysctl();
+ if (display & (SHMINFO | SHMTOTAL))
+ shm_sysctl();
+ if (display & (SEMINFO | SEMTOTAL))
+ sem_sysctl();
return 0;
}
@@ -680,214 +667,12 @@
free(buf);
}
-static struct nlist symbols[] = {
- { .n_name = "_sema" },
-#define X_SEMA 0
- { .n_name = "_seminfo" },
-#define X_SEMINFO 1
- { .n_name = "_semu" },
-#define X_SEMU 2
- { .n_name = "_msginfo" },
-#define X_MSGINFO 3
- { .n_name = "_msqids" },
-#define X_MSQIDS 4
- { .n_name = "_shminfo" },
-#define X_SHMINFO 5
- { .n_name = "_shmsegs" },
-#define X_SHMSEGS 6
- { .n_name = NULL }
-};
-
-static void
-ipcs_kvm(void)
-{
- struct msginfo msginfo;
- struct msqid_ds *msqids;
- struct seminfo seminfo;
- struct semid_ds *sema;
- struct shminfo shminfo;
- struct shmid_ds *shmsegs;
- kvm_t *kd;
- char errbuf[_POSIX2_LINE_MAX];
- int32_t i;
- uint32_t u;
-
- if ((kd = kvm_openfiles(namelist, core, NULL, O_RDONLY,
- errbuf)) == NULL)
- errx(1, "can't open kvm: %s", errbuf);
-
-
- switch (kvm_nlist(kd, symbols)) {
- case 0:
- break;
- case -1:
- errx(1, "%s: unable to read symbol table.",
- namelist == NULL ? _PATH_UNIX : namelist);
- /* NOTREACHED */
- default:
-#ifdef notdef /* they'll be told more civilly later */
- warnx("nlist failed");
- for (i = 0; symbols[i].n_name != NULL; i++)
- if (symbols[i].n_value == 0)
- warnx("symbol %s not found",
- symbols[i].n_name);
-#endif
- break;
- }
-
- if ((display & (MSGINFO | MSGTOTAL)) &&
- (kvm_read(kd, symbols[X_MSGINFO].n_value,
- &msginfo, sizeof(msginfo)) == sizeof(msginfo))) {
-
- if (display & MSGTOTAL)
- show_msgtotal(&msginfo);
-
- if (display & MSGINFO) {
- struct msqid_ds *xmsqids;
-
- if (kvm_read(kd, symbols[X_MSQIDS].n_value,
- &msqids, sizeof(msqids)) != sizeof(msqids))
- errx(1, "kvm_read (%s): %s",
- symbols[X_MSQIDS].n_name, kvm_geterr(kd));
-
- xmsqids = malloc(sizeof(struct msqid_ds) *
- msginfo.msgmni);
-
- if ((size_t)kvm_read(kd, (u_long)msqids, xmsqids,
- sizeof(struct msqid_ds) * msginfo.msgmni) !=
- sizeof(struct msqid_ds) * msginfo.msgmni)
- errx(1, "kvm_read (msqids): %s",
- kvm_geterr(kd));
-
- show_msginfo_hdr();
- for (i = 0; i < msginfo.msgmni; i++) {
- struct msqid_ds *msqptr = &xmsqids[i];
- if (msqptr->msg_qbytes != 0)
- show_msginfo(msqptr->msg_stime,
- msqptr->msg_rtime,
- msqptr->msg_ctime,
- IXSEQ_TO_IPCID(i, msqptr->msg_perm),
- (u_int64_t)msqptr->msg_perm._key,
- msqptr->msg_perm.mode,
- msqptr->msg_perm.uid,
- msqptr->msg_perm.gid,
- msqptr->msg_perm.cuid,
- msqptr->msg_perm.cgid,
- (u_int64_t)msqptr->_msg_cbytes,
- (u_int64_t)msqptr->msg_qnum,
- (u_int64_t)msqptr->msg_qbytes,
- msqptr->msg_lspid,
- msqptr->msg_lrpid);
- }
- (void)printf("\n");
- free(xmsqids);
- }
- } else
- if (display & (MSGINFO | MSGTOTAL))
- unconfmsg();
- if ((display & (SHMINFO | SHMTOTAL)) &&
- (kvm_read(kd, symbols[X_SHMINFO].n_value, &shminfo,
- sizeof(shminfo)) == sizeof(shminfo))) {
-
- if (display & SHMTOTAL)
- show_shmtotal(&shminfo);
-
- if (display & SHMINFO) {
- struct shmid_ds *xshmids;
-
- if (kvm_read(kd, symbols[X_SHMSEGS].n_value, &shmsegs,
- sizeof(shmsegs)) != sizeof(shmsegs))
- errx(1, "kvm_read (%s): %s",
- symbols[X_SHMSEGS].n_name, kvm_geterr(kd));
-
- xshmids = malloc(sizeof(struct shmid_ds) *
- shminfo.shmmni);
-
- if ((size_t)kvm_read(kd, (u_long)shmsegs, xshmids,
- sizeof(struct shmid_ds) * shminfo.shmmni) !=
- sizeof(struct shmid_ds) * shminfo.shmmni)
- errx(1, "kvm_read (shmsegs): %s",
- kvm_geterr(kd));
-
- show_shminfo_hdr();
- for (u = 0; u < shminfo.shmmni; u++) {
- struct shmid_ds *shmptr = &xshmids[u];
- if (shmptr->shm_perm.mode & 0x0800)
- show_shminfo(shmptr->shm_atime,
- shmptr->shm_dtime,
- shmptr->shm_ctime,
Home |
Main Index |
Thread Index |
Old Index