/*
* CDDL HEADER START
*
* The contents of this file are subject to the terms of the
* Common Development and Distribution License (the "License").
* You may not use this file except in compliance with the License.
*
* You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
* See the License for the specific language governing permissions
* and limitations under the License.
*
* When distributing Covered Code, include this CDDL HEADER in each
* file and include the License file at usr/src/OPENSOLARIS.LICENSE.
* If applicable, add the following below this CDDL HEADER, with the
* fields enclosed by brackets "[]" replaced with your own identifying
* information: Portions Copyright [yyyy] [name of copyright owner]
*
* CDDL HEADER END
*/
/*
*/
#include <stdlib.h>
#include <unistd.h>
#include <fcntl.h>
#include <stdio.h>
#include <synch.h>
#include <errno.h>
#include "bindings.h"
void
usage()
{
(void) printf("usage: dumpbind [-pqsc] <bindings.data>\n");
(void) printf("\t-p\tdisplay output in parsable format\n");
(void) printf("\t-q\tquery all mutex_locks in data buffer\n");
(void) printf("\t-c\tclear all mutex_locks in data buffer\n");
(void) printf("\t-s\tset all mutex_locks in data buffer\n");
(void) printf("\t-b\tprint bucket usage statistics\n");
}
/*
* Returns 1 if lock held - 0 otherwise.
*/
static int
if (_lwp_mutex_trylock(lock) == 0) {
(void) _lwp_mutex_unlock(lock);
return (0);
} else
return (1);
}
static void
{
int i, bkt_locks_held = 0;
(void) printf("bh_strlock: ");
(void) printf("lock held\n");
else
(void) printf("free\n");
(void) printf("bh_lock: ");
(void) printf("lock held\n");
else
(void) printf("free\n");
(void) printf("\tbkt[%d]: lock held\n", i);
}
}
if (bkt_locks_held == 0)
(void) printf("\tnone.\n");
else
}
static void
{
int i;
(void) printf("bh_strlock: cleared\n");
}
(void) printf("bh_lock: cleared\n");
}
(void) printf("bkt[%d]: lock cleared\n", i);
}
}
}
static void
{
int i;
}
int
{
int fd;
int i, c;
switch (c) {
case 'b':
bflag++;
break;
case 'p':
pflag++;
break;
case 'q':
qflag++;
break;
case 'c':
cflag++;
break;
case 's':
sflag++;
break;
case '?':
usage();
return (1);
}
usage();
return (1);
}
"dumpbindings: unable to open file: %s\n", fname);
perror("open");
return (1);
}
/* LINTED */
perror("mmap");
return (1);
}
if (qflag) {
return (0);
}
if (cflag) {
return (0);
}
if (sflag) {
return (0);
}
/* LINTED */
perror("mmap");
return (1);
}
if (pflag)
format_string = "%s|%s|%8d\n";
else {
if (!bflag) {
(void) printf(" "
"Bindings Summary Report\n\n"
"Library Symbol"
" Call Count\n"
"----------------------------------------------"
"--------------------------\n");
}
format_string = "%-35s %-25s %5d\n";
}
symcount = 0;
callcount = 0;
int ent_cnt = 0;
while (bep_off) {
/* LINTED */
if (!bflag) {
/* LINTED */
(void) printf(format_string,
symcount++;
}
ent_cnt++;
}
if (bflag)
}
(void) printf("----------------------------------------------"
"--------------------------\n"
"Symbol Count: %lu Call Count: %lu\n\n",
}
return (0);
}