ddb show files: fix up file types and whitespace

This makes ddb show files more descriptive and also adjusts the
whitespace to align the columns for non-32-bit architectures.

Reviewed by:	cem (previous version), jhb
Approved by:	markj (mentor)
Differential Revision:	https://reviews.freebsd.org/D11061
This commit is contained in:
Ryan Libby 2017-06-14 07:46:52 +00:00
parent 37ea599bf7
commit 76f2c27264
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=319938

View File

@ -3821,23 +3821,33 @@ file_type_to_name(short type)
case 0:
return ("zero");
case DTYPE_VNODE:
return ("vnod");
return ("vnode");
case DTYPE_SOCKET:
return ("sock");
return ("socket");
case DTYPE_PIPE:
return ("pipe");
case DTYPE_FIFO:
return ("fifo");
case DTYPE_KQUEUE:
return ("kque");
return ("kqueue");
case DTYPE_CRYPTO:
return ("crpt");
return ("crypto");
case DTYPE_MQUEUE:
return ("mque");
return ("mqueue");
case DTYPE_SHM:
return ("shm");
case DTYPE_SEM:
return ("ksem");
case DTYPE_PTS:
return ("pts");
case DTYPE_DEV:
return ("dev");
case DTYPE_PROCDESC:
return ("proc");
case DTYPE_LINUXEFD:
return ("levent");
case DTYPE_LINUXTFD:
return ("ltimer");
default:
return ("unkn");
}
@ -3872,17 +3882,21 @@ file_to_first_proc(struct file *fp)
static void
db_print_file(struct file *fp, int header)
{
#define XPTRWIDTH ((int)howmany(sizeof(void *) * NBBY, 4))
struct proc *p;
if (header)
db_printf("%8s %4s %8s %8s %4s %5s %6s %8s %5s %12s\n",
"File", "Type", "Data", "Flag", "GCFl", "Count",
"MCount", "Vnode", "FPID", "FCmd");
db_printf("%*s %6s %*s %8s %4s %5s %6s %*s %5s %s\n",
XPTRWIDTH, "File", "Type", XPTRWIDTH, "Data", "Flag",
"GCFl", "Count", "MCount", XPTRWIDTH, "Vnode", "FPID",
"FCmd");
p = file_to_first_proc(fp);
db_printf("%8p %4s %8p %08x %04x %5d %6d %8p %5d %12s\n", fp,
file_type_to_name(fp->f_type), fp->f_data, fp->f_flag,
0, fp->f_count, 0, fp->f_vnode,
db_printf("%*p %6s %*p %08x %04x %5d %6d %*p %5d %s\n", XPTRWIDTH,
fp, file_type_to_name(fp->f_type), XPTRWIDTH, fp->f_data,
fp->f_flag, 0, fp->f_count, 0, XPTRWIDTH, fp->f_vnode,
p != NULL ? p->p_pid : -1, p != NULL ? p->p_comm : "-");
#undef XPTRWIDTH
}
DB_SHOW_COMMAND(file, db_show_file)