From owner-svn-src-head@freebsd.org Wed Jun 14 07:46:53 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 838DBD87FAE; Wed, 14 Jun 2017 07:46:53 +0000 (UTC) (envelope-from rlibby@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 540047DD46; Wed, 14 Jun 2017 07:46:53 +0000 (UTC) (envelope-from rlibby@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v5E7kqH5050860; Wed, 14 Jun 2017 07:46:52 GMT (envelope-from rlibby@FreeBSD.org) Received: (from rlibby@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v5E7kqUW050859; Wed, 14 Jun 2017 07:46:52 GMT (envelope-from rlibby@FreeBSD.org) Message-Id: <201706140746.v5E7kqUW050859@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: rlibby set sender to rlibby@FreeBSD.org using -f From: Ryan Libby Date: Wed, 14 Jun 2017 07:46:52 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r319938 - head/sys/kern X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 14 Jun 2017 07:46:53 -0000 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)