diff options
author | sjg <sjg@FreeBSD.org> | 2015-05-27 01:19:58 +0000 |
---|---|---|
committer | sjg <sjg@FreeBSD.org> | 2015-05-27 01:19:58 +0000 |
commit | 65145fa4c81da358fcbc3b650156dab705dfa34e (patch) | |
tree | 55c065b6730aaac2afb6c29933ee6ec5fa4c4249 /usr.bin/ipcs | |
parent | 60ff4eb0dff94a04d75d0d52a3957aaaf5f8c693 (diff) | |
parent | e6b664c390af88d4a87208bc042ce503da664c3b (diff) | |
download | FreeBSD-src-65145fa4c81da358fcbc3b650156dab705dfa34e.zip FreeBSD-src-65145fa4c81da358fcbc3b650156dab705dfa34e.tar.gz |
Merge sync of head
Diffstat (limited to 'usr.bin/ipcs')
-rw-r--r-- | usr.bin/ipcs/Makefile | 5 | ||||
-rw-r--r-- | usr.bin/ipcs/ipc.c | 21 | ||||
-rw-r--r-- | usr.bin/ipcs/ipc.h | 5 | ||||
-rw-r--r-- | usr.bin/ipcs/ipcs.c | 55 |
4 files changed, 40 insertions, 46 deletions
diff --git a/usr.bin/ipcs/Makefile b/usr.bin/ipcs/Makefile index 0d422e1..d14723f 100644 --- a/usr.bin/ipcs/Makefile +++ b/usr.bin/ipcs/Makefile @@ -2,9 +2,6 @@ PROG= ipcs SRCS= ipcs.c ipc.c -DPADD= ${LIBKVM} -LDADD= -lkvm - -WARNS?= 1 +LIBADD= kvm .include <bsd.prog.mk> diff --git a/usr.bin/ipcs/ipc.c b/usr.bin/ipcs/ipc.c index 4c62743..306d659 100644 --- a/usr.bin/ipcs/ipc.c +++ b/usr.bin/ipcs/ipc.c @@ -55,16 +55,15 @@ struct msginfo msginfo; struct msqid_kernel *msqids; struct shminfo shminfo; struct shmid_kernel *shmsegs; -void kget(int idx, void *addr, size_t size); struct nlist symbols[] = { - {"sema"}, - {"seminfo"}, - {"msginfo"}, - {"msqids"}, - {"shminfo"}, - {"shmsegs"}, - {NULL} + { .n_name = "sema" }, + { .n_name = "seminfo" }, + { .n_name = "msginfo" }, + { .n_name = "msqids" }, + { .n_name = "shminfo" }, + { .n_name = "shmsegs" }, + { .n_name = NULL } }; #define SHMINFO_XVEC X(shmmax, sizeof(u_long)) \ @@ -92,13 +91,13 @@ struct nlist symbols[] = { #define X(a, b) { "kern.ipc." #a, offsetof(TYPEC, a), (b) }, #define TYPEC struct shminfo -struct scgs_vector shminfo_scgsv[] = { SHMINFO_XVEC { NULL } }; +static struct scgs_vector shminfo_scgsv[] = { SHMINFO_XVEC { .sysctl=NULL } }; #undef TYPEC #define TYPEC struct seminfo -struct scgs_vector seminfo_scgsv[] = { SEMINFO_XVEC { NULL } }; +static struct scgs_vector seminfo_scgsv[] = { SEMINFO_XVEC { .sysctl=NULL } }; #undef TYPEC #define TYPEC struct msginfo -struct scgs_vector msginfo_scgsv[] = { MSGINFO_XVEC { NULL } }; +static struct scgs_vector msginfo_scgsv[] = { MSGINFO_XVEC { .sysctl=NULL } }; #undef TYPEC #undef X diff --git a/usr.bin/ipcs/ipc.h b/usr.bin/ipcs/ipc.h index 640c3fd..0b6188a 100644 --- a/usr.bin/ipcs/ipc.h +++ b/usr.bin/ipcs/ipc.h @@ -52,7 +52,7 @@ /* SysCtlGatherStruct structure. */ struct scgs_vector { const char *sysctl; - off_t offset; + size_t offset; size_t size; }; @@ -64,8 +64,5 @@ extern struct nlist symbols[]; extern kvm_t *kd; extern struct semid_kernel *sema; -extern struct seminfo seminfo; -extern struct msginfo msginfo; extern struct msqid_kernel *msqids; -extern struct shminfo shminfo; extern struct shmid_kernel *shmsegs; diff --git a/usr.bin/ipcs/ipcs.c b/usr.bin/ipcs/ipcs.c index 1d8e354..be6ca56 100644 --- a/usr.bin/ipcs/ipcs.c +++ b/usr.bin/ipcs/ipcs.c @@ -112,6 +112,7 @@ main(int argc, char *argv[]) char *core = NULL, *user = NULL, *namelist = NULL; char kvmoferr[_POSIX2_LINE_MAX]; /* Error buf for kvm_openfiles. */ int i; + u_long shmidx; uid_t uid = 0; while ((i = getopt(argc, argv, "MmQqSsabC:cN:optTu:y")) != -1) @@ -247,13 +248,13 @@ main(int argc, char *argv[]) print_kshmheader(option); - for (i = 0; i < shminfo.shmmni; i += 1) { - if (kxshmids[i].u.shm_perm.mode & 0x0800) { + for (shmidx = 0; shmidx < shminfo.shmmni; shmidx += 1) { + if (kxshmids[shmidx].u.shm_perm.mode & 0x0800) { if (user && - uid != kxshmids[i].u.shm_perm.uid) + uid != kxshmids[shmidx].u.shm_perm.uid) continue; - print_kshmptr(i, option, &kxshmids[i]); + print_kshmptr(shmidx, option, &kxshmids[shmidx]); } } printf("\n"); @@ -309,22 +310,22 @@ main(int argc, char *argv[]) } void -print_kmsqtotal(struct msginfo msginfo) +print_kmsqtotal(struct msginfo local_msginfo) { printf("msginfo:\n"); printf("\tmsgmax: %12d\t(max characters in a message)\n", - msginfo.msgmax); + local_msginfo.msgmax); printf("\tmsgmni: %12d\t(# of message queues)\n", - msginfo.msgmni); + local_msginfo.msgmni); printf("\tmsgmnb: %12d\t(max characters in a message queue)\n", - msginfo.msgmnb); + local_msginfo.msgmnb); printf("\tmsgtql: %12d\t(max # of messages in system)\n", - msginfo.msgtql); + local_msginfo.msgtql); printf("\tmsgssz: %12d\t(size of a message segment)\n", - msginfo.msgssz); + local_msginfo.msgssz); printf("\tmsgseg: %12d\t(# of message segments in system)\n\n", - msginfo.msgseg); + local_msginfo.msgseg); } void print_kmsqheader(int option) @@ -390,20 +391,20 @@ print_kmsqptr(int i, int option, struct msqid_kernel *kmsqptr) } void -print_kshmtotal(struct shminfo shminfo) +print_kshmtotal(struct shminfo local_shminfo) { printf("shminfo:\n"); printf("\tshmmax: %12lu\t(max shared memory segment size)\n", - shminfo.shmmax); + local_shminfo.shmmax); printf("\tshmmin: %12lu\t(min shared memory segment size)\n", - shminfo.shmmin); + local_shminfo.shmmin); printf("\tshmmni: %12lu\t(max number of shared memory identifiers)\n", - shminfo.shmmni); + local_shminfo.shmmni); printf("\tshmseg: %12lu\t(max shared memory segments per process)\n", - shminfo.shmseg); + local_shminfo.shmseg); printf("\tshmall: %12lu\t(max amount of shared memory in pages)\n\n", - shminfo.shmall); + local_shminfo.shmall); } void @@ -470,28 +471,28 @@ print_kshmptr(int i, int option, struct shmid_kernel *kshmptr) } void -print_ksemtotal(struct seminfo seminfo) +print_ksemtotal(struct seminfo local_seminfo) { printf("seminfo:\n"); printf("\tsemmni: %12d\t(# of semaphore identifiers)\n", - seminfo.semmni); + local_seminfo.semmni); printf("\tsemmns: %12d\t(# of semaphores in system)\n", - seminfo.semmns); + local_seminfo.semmns); printf("\tsemmnu: %12d\t(# of undo structures in system)\n", - seminfo.semmnu); + local_seminfo.semmnu); printf("\tsemmsl: %12d\t(max # of semaphores per id)\n", - seminfo.semmsl); + local_seminfo.semmsl); printf("\tsemopm: %12d\t(max # of operations per semop call)\n", - seminfo.semopm); + local_seminfo.semopm); printf("\tsemume: %12d\t(max # of undo entries per process)\n", - seminfo.semume); + local_seminfo.semume); printf("\tsemusz: %12d\t(size in bytes of undo structure)\n", - seminfo.semusz); + local_seminfo.semusz); printf("\tsemvmx: %12d\t(semaphore maximum value)\n", - seminfo.semvmx); + local_seminfo.semvmx); printf("\tsemaem: %12d\t(adjust on exit max value)\n\n", - seminfo.semaem); + local_seminfo.semaem); } void |