Author: rlibby Date: Wed Jun 14 07:46:52 2017 New Revision: 319938 URL: https://svnweb.freebsd.org/changeset/base/319938
Log: 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 Modified: head/sys/kern/kern_descrip.c Modified: head/sys/kern/kern_descrip.c ============================================================================== --- head/sys/kern/kern_descrip.c Wed Jun 14 05:12:09 2017 (r319937) +++ head/sys/kern/kern_descrip.c Wed Jun 14 07:46:52 2017 (r319938) @@ -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) _______________________________________________ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"