Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src Remove tpfmt(1). Its code was merged into tprof(8).
details: https://anonhg.NetBSD.org/src/rev/7b5c122e8c28
branches: trunk
changeset: 324043:7b5c122e8c28
user: maxv <maxv%NetBSD.org@localhost>
date: Fri Jul 13 11:14:14 2018 +0000
description:
Remove tpfmt(1). Its code was merged into tprof(8).
diffstat:
distrib/sets/lists/base/mi | 4 +-
distrib/sets/lists/debug/mi | 4 +-
distrib/sets/lists/man/mi | 8 +-
usr.bin/Makefile | 4 +-
usr.bin/tpfmt/Makefile | 14 --
usr.bin/tpfmt/README | 3 -
usr.bin/tpfmt/sym.c | 185 ---------------------------
usr.bin/tpfmt/sym.h | 30 ----
usr.bin/tpfmt/tpfmt.1 | 94 -------------
usr.bin/tpfmt/tpfmt.c | 298 --------------------------------------------
usr.sbin/tprof/tprof.8 | 3 +-
11 files changed, 11 insertions(+), 636 deletions(-)
diffs (truncated from 755 to 300 lines):
diff -r 0da6dc59af0e -r 7b5c122e8c28 distrib/sets/lists/base/mi
--- a/distrib/sets/lists/base/mi Fri Jul 13 11:13:10 2018 +0000
+++ b/distrib/sets/lists/base/mi Fri Jul 13 11:14:14 2018 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: mi,v 1.1178 2018/06/29 12:34:14 roy Exp $
+# $NetBSD: mi,v 1.1179 2018/07/13 11:14:14 maxv Exp $
#
# Note: Don't delete entries from here - mark them as "obsolete" instead,
# unless otherwise stated below.
@@ -974,7 +974,7 @@
./usr/bin/tn3270 base-obsolete obsolete
./usr/bin/top base-util-bin
./usr/bin/touch base-util-bin
-./usr/bin/tpfmt base-util-bin
+./usr/bin/tpfmt base-obsolete obsolete
./usr/bin/tpm_sealdata base-tpm-bin tpm
./usr/bin/tpm_unsealdata base-tpm-bin tpm
./usr/bin/tpm_version base-tpm-bin tpm
diff -r 0da6dc59af0e -r 7b5c122e8c28 distrib/sets/lists/debug/mi
--- a/distrib/sets/lists/debug/mi Fri Jul 13 11:13:10 2018 +0000
+++ b/distrib/sets/lists/debug/mi Fri Jul 13 11:14:14 2018 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: mi,v 1.256 2018/06/29 12:34:14 roy Exp $
+# $NetBSD: mi,v 1.257 2018/07/13 11:14:14 maxv Exp $
./etc/mtree/set.debug comp-sys-root
./usr/lib comp-sys-usr compatdir
./usr/lib/i18n/libBIG5_g.a comp-c-debuglib debuglib,compatfile
@@ -803,7 +803,7 @@
./usr/libdata/debug/usr/bin/tn3270.debug comp-obsolete obsolete
./usr/libdata/debug/usr/bin/top.debug comp-util-debug debug
./usr/libdata/debug/usr/bin/touch.debug comp-util-debug debug
-./usr/libdata/debug/usr/bin/tpfmt.debug comp-util-debug debug
+./usr/libdata/debug/usr/bin/tpfmt.debug comp-obsolete obsolete
./usr/libdata/debug/usr/bin/tpm_sealdata.debug comp-tpm-debug tpm,debug
./usr/libdata/debug/usr/bin/tpm_unsealdata.debug comp-tpm-debug tpm,debug
./usr/libdata/debug/usr/bin/tpm_version.debug comp-tpm-debug tpm,debug
diff -r 0da6dc59af0e -r 7b5c122e8c28 distrib/sets/lists/man/mi
--- a/distrib/sets/lists/man/mi Fri Jul 13 11:13:10 2018 +0000
+++ b/distrib/sets/lists/man/mi Fri Jul 13 11:14:14 2018 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: mi,v 1.1597 2018/07/13 09:15:56 maxv Exp $
+# $NetBSD: mi,v 1.1598 2018/07/13 11:14:14 maxv Exp $
#
# Note: don't delete entries from here - mark them as "obsolete" instead.
#
@@ -573,7 +573,7 @@
./usr/share/man/cat1/tn3270.0 man-obsolete obsolete
./usr/share/man/cat1/top.0 man-util-catman .cat
./usr/share/man/cat1/touch.0 man-util-catman .cat
-./usr/share/man/cat1/tpfmt.0 man-util-catman .cat
+./usr/share/man/cat1/tpfmt.0 man-obsolete obsolete
./usr/share/man/cat1/tpm_sealdata.0 man-tpm-catman tpm,.cat
./usr/share/man/cat1/tpm_version.0 man-tpm-catman tpm,.cat
./usr/share/man/cat1/tput.0 man-util-catman .cat
@@ -3777,7 +3777,7 @@
./usr/share/man/html1/tn3270.html man-obsolete obsolete
./usr/share/man/html1/top.html man-util-htmlman html
./usr/share/man/html1/touch.html man-util-htmlman html
-./usr/share/man/html1/tpfmt.html man-util-htmlman html
+./usr/share/man/html1/tpfmt.html man-obsolete obsolete
./usr/share/man/html1/tpm_sealdata.html man-tpm-htmlman tpm,html
./usr/share/man/html1/tpm_version.html man-tpm-htmlman tpm,html
./usr/share/man/html1/tput.html man-util-htmlman html
@@ -6635,7 +6635,7 @@
./usr/share/man/man1/tn3270.1 man-obsolete obsolete
./usr/share/man/man1/top.1 man-util-man .man
./usr/share/man/man1/touch.1 man-util-man .man
-./usr/share/man/man1/tpfmt.1 man-util-man .man
+./usr/share/man/man1/tpfmt.1 man-obsolete obsolete
./usr/share/man/man1/tpm_sealdata.1 man-tpm-man tpm,.man
./usr/share/man/man1/tpm_version.1 man-tpm-man tpm,.man
./usr/share/man/man1/tput.1 man-util-man .man
diff -r 0da6dc59af0e -r 7b5c122e8c28 usr.bin/Makefile
--- a/usr.bin/Makefile Fri Jul 13 11:13:10 2018 +0000
+++ b/usr.bin/Makefile Fri Jul 13 11:14:14 2018 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: Makefile,v 1.230 2018/07/13 11:13:10 mrg Exp $
+# $NetBSD: Makefile,v 1.231 2018/07/13 11:14:14 maxv Exp $
# from: @(#)Makefile 8.3 (Berkeley) 1/7/94
.include <bsd.own.mk>
@@ -28,7 +28,7 @@
showmount shuffle sockstat sort sortinfo \
spell split stat su sys_info systat \
tabs tail talk tcopy tee telnet tftp tic time timeout tip touch \
- tpfmt tput \
+ tput \
tr true tset tsort tty ul uname unexpand unifdef \
uniq units unvis unzip usbhidaction usbhidctl users utoppya \
uudecode uuencode uuidgen vacation vgrind videoctl vis \
diff -r 0da6dc59af0e -r 7b5c122e8c28 usr.bin/tpfmt/Makefile
--- a/usr.bin/tpfmt/Makefile Fri Jul 13 11:13:10 2018 +0000
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,14 +0,0 @@
-# $NetBSD: Makefile,v 1.4 2011/11/26 16:15:09 yamt Exp $
-
-PROG= tpfmt
-
-CPPFLAGS+= -I${NETBSDSRCDIR}/sys/
-SRCS= tpfmt.c sym.c
-
-LDADD+= -lelf
-LDADD+= -lutil
-DPADD+= ${LIBELF}
-DPADD+= ${LIBUTIL}
-
-.include <bsd.own.mk>
-.include <bsd.prog.mk>
diff -r 0da6dc59af0e -r 7b5c122e8c28 usr.bin/tpfmt/README
--- a/usr.bin/tpfmt/README Fri Jul 13 11:13:10 2018 +0000
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,3 +0,0 @@
-$Id: README,v 1.1 2010/11/23 20:48:40 yamt Exp $
-
-it's a C-version of tpfmt.sh. see usr.sbin/tprof/README for the usage.
diff -r 0da6dc59af0e -r 7b5c122e8c28 usr.bin/tpfmt/sym.c
--- a/usr.bin/tpfmt/sym.c Fri Jul 13 11:13:10 2018 +0000
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,185 +0,0 @@
-/* $NetBSD: sym.c,v 1.4 2012/02/03 05:06:08 yamt Exp $ */
-
-/*-
- * Copyright (c) 2010,2011,2012 YAMAMOTO Takashi,
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-#include <sys/cdefs.h>
-#ifndef lint
-__RCSID("$NetBSD: sym.c,v 1.4 2012/02/03 05:06:08 yamt Exp $");
-#endif /* not lint */
-
-#include <assert.h>
-#include <err.h>
-#include <fcntl.h>
-#include <gelf.h>
-#include <inttypes.h>
-#include <libelf.h>
-#include <stdlib.h>
-#include <string.h>
-#include <util.h>
-
-#include "sym.h"
-
-struct sym {
- char *name;
- uint64_t value;
- uint64_t size;
-};
-
-static struct sym **syms = NULL;
-static size_t nsyms = 0;
-
-static int
-compare_value(const void *p1, const void *p2)
-{
- const struct sym *s1 = *(const struct sym * const *)p1;
- const struct sym *s2 = *(const struct sym * const *)p2;
-
- if (s1->value > s2->value) {
- return -1;
- } else if (s1->value < s2->value) {
- return 1;
- }
- /*
- * to produce a stable result, it's better not to return 0
- * even for __strong_alias.
- */
- if (s1->size > s2->size) {
- return -1;
- } else if (s1->size < s2->size) {
- return 1;
- }
- return strcmp(s1->name, s2->name);
-}
-
-void
-ksymload(const char *ksyms)
-{
- Elf *e;
- Elf_Scn *s;
- GElf_Shdr sh_store;
- GElf_Shdr *sh;
- Elf_Data *d;
- int fd;
- size_t size, i;
-
- fd = open(ksyms, O_RDONLY);
- if (fd == -1) {
- err(EXIT_FAILURE, "open");
- }
- if (elf_version(EV_CURRENT) == EV_NONE) {
- goto elffail;
- }
- e = elf_begin(fd, ELF_C_READ, NULL);
- if (e == NULL) {
- goto elffail;
- }
- for (s = elf_nextscn(e, NULL); s != NULL; s = elf_nextscn(e, s)) {
- sh = gelf_getshdr(s, &sh_store);
- if (sh == NULL) {
- goto elffail;
- }
- if (sh->sh_type == SHT_SYMTAB) {
- break;
- }
- }
- if (s == NULL) {
- errx(EXIT_FAILURE, "no symtab");
- }
- d = elf_getdata(s, NULL);
- if (d == NULL) {
- goto elffail;
- }
- assert(sh->sh_size == d->d_size);
- size = sh->sh_size / sh->sh_entsize;
- for (i = 1; i < size; i++) {
- GElf_Sym st_store;
- GElf_Sym *st;
- struct sym *sym;
-
- st = gelf_getsym(d, (int)i, &st_store);
- if (st == NULL) {
- goto elffail;
- }
- if (ELF_ST_TYPE(st->st_info) != STT_FUNC) {
- continue;
- }
- sym = emalloc(sizeof(*sym));
- sym->name = estrdup(elf_strptr(e, sh->sh_link, st->st_name));
- sym->value = (uint64_t)st->st_value;
- sym->size = st->st_size;
- nsyms++;
- syms = erealloc(syms, sizeof(*syms) * nsyms);
- syms[nsyms - 1] = sym;
- }
- qsort(syms, nsyms, sizeof(*syms), compare_value);
- return;
-elffail:
- errx(EXIT_FAILURE, "libelf: %s", elf_errmsg(elf_errno()));
-}
-
-const char *
-ksymlookup(uint64_t value, uint64_t *offset)
-{
- size_t hi;
- size_t lo;
- size_t i;
-
- /*
- * try to find the smallest i for which syms[i]->value <= value.
- * syms[] is ordered by syms[]->value in the descending order.
- */
-
- hi = nsyms - 1;
- lo = 0;
- while (lo < hi) {
- const size_t mid = (lo + hi) / 2;
- const struct sym *sym = syms[mid];
-
- assert(syms[lo]->value >= sym->value);
- assert(sym->value >= syms[hi]->value);
- if (sym->value <= value) {
- hi = mid;
- continue;
- }
- lo = mid + 1;
- }
- assert(lo == nsyms - 1 || syms[lo]->value <= value);
- assert(lo == 0 || syms[lo - 1]->value > value);
- for (i = lo; i < nsyms; i++) {
- const struct sym *sym = syms[i];
-
- if (sym->value <= value &&
- (sym->size == 0 || value - sym->value <= sym->size )) {
- *offset = value - sym->value;
- return sym->name;
- }
- if (sym->size != 0 && sym->value + sym->size < value) {
- break;
Home |
Main Index |
Thread Index |
Old Index