diff options
Diffstat (limited to 'cddl/contrib/opensolaris/cmd/lockstat')
-rw-r--r-- | cddl/contrib/opensolaris/cmd/lockstat/lockstat.c | 6 | ||||
-rw-r--r-- | cddl/contrib/opensolaris/cmd/lockstat/sym.c | 21 |
2 files changed, 11 insertions, 16 deletions
diff --git a/cddl/contrib/opensolaris/cmd/lockstat/lockstat.c b/cddl/contrib/opensolaris/cmd/lockstat/lockstat.c index a7378980bc56..2cbad3442efb 100644 --- a/cddl/contrib/opensolaris/cmd/lockstat/lockstat.c +++ b/cddl/contrib/opensolaris/cmd/lockstat/lockstat.c @@ -606,14 +606,14 @@ predicate_add(char **pred, char *what, char *cmp, uintptr_t value) if (*pred[0] != '\0') { if (cmp != NULL) { - (void) sprintf(new, "(%s) && (%s %s 0x%p)", + (void) sprintf(new, "(%s) && (%s %s %p)", *pred, what, cmp, (void *)value); } else { (void) sprintf(new, "(%s) && (%s)", *pred, what); } } else { if (cmp != NULL) { - (void) sprintf(new, "%s %s 0x%p", + (void) sprintf(new, "%s %s %p", what, cmp, (void *)value); } else { (void) sprintf(new, "%s", what); @@ -632,7 +632,7 @@ predicate_destroy(char **pred) } static void -filter_add(char **filt, char *what, uintptr_t base, uintptr_t size) +filter_add(char **filt, char *what, uintptr_t base, size_t size) { char buf[256], *c = buf, *new; int len, newlen; diff --git a/cddl/contrib/opensolaris/cmd/lockstat/sym.c b/cddl/contrib/opensolaris/cmd/lockstat/sym.c index b5366c566857..7516e7d435f4 100644 --- a/cddl/contrib/opensolaris/cmd/lockstat/sym.c +++ b/cddl/contrib/opensolaris/cmd/lockstat/sym.c @@ -42,6 +42,7 @@ #include <libelf.h> #include <link.h> #include <elf.h> +#include <gelf.h> #ifdef illumos #include <sys/machelf.h> @@ -54,7 +55,6 @@ #endif #include <sys/cpuvar.h> - typedef struct syment { uintptr_t addr; char *name; @@ -73,11 +73,6 @@ static char maxsymname[64]; #endif #endif -#define __sElfN(x) typedef __CONCAT(__CONCAT(__CONCAT(Elf,__ELF_WORD_SIZE),_),x) x -__sElfN(Sym); -__sElfN(Shdr); -#define elf_getshdr __elfN(getshdr) - static void add_symbol(char *name, uintptr_t addr, size_t size) { @@ -174,7 +169,7 @@ symtab_init(void) { Elf *elf; Elf_Scn *scn = NULL; - Sym *symtab, *symp, *lastsym; + GElf_Sym *symtab, *symp, *lastsym; char *strtab; uint_t cnt; int fd; @@ -198,13 +193,13 @@ symtab_init(void) (void) elf_version(EV_CURRENT); elf = elf_begin(fd, ELF_C_READ, NULL); - for (cnt = 1; (scn = elf_nextscn(elf, scn)) != NULL; cnt++) { - Shdr *shdr = elf_getshdr(scn); - if (shdr->sh_type == SHT_SYMTAB) { - symtab = (Sym *)elf_getdata(scn, NULL)->d_buf; - nsyms = shdr->sh_size / shdr->sh_entsize; - strindex = shdr->sh_link; + GElf_Shdr shdr; + (void) gelf_getshdr(scn, &shdr); + if (shdr.sh_type == SHT_SYMTAB) { + symtab = (GElf_Sym *)elf_getdata(scn, NULL)->d_buf; + nsyms = shdr.sh_size / shdr.sh_entsize; + strindex = shdr.sh_link; } } |