From owner-svn-src-all@freebsd.org Sat May 26 05:42:48 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 2D112EFEAEB for ; Sat, 26 May 2018 05:42:48 +0000 (UTC) (envelope-from eadler@freebsd.org) Received: from smtp.freebsd.org (smtp.freebsd.org [96.47.72.83]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "smtp.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id D168F836F4 for ; Sat, 26 May 2018 05:42:47 +0000 (UTC) (envelope-from eadler@freebsd.org) Received: from mail-yw0-f176.google.com (mail-yw0-f176.google.com [209.85.161.176]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) (Authenticated sender: eadler) by smtp.freebsd.org (Postfix) with ESMTPSA id 956CE20310 for ; Sat, 26 May 2018 05:42:47 +0000 (UTC) (envelope-from eadler@freebsd.org) Received: by mail-yw0-f176.google.com with SMTP id j190-v6so2266348ywe.4 for ; Fri, 25 May 2018 22:42:47 -0700 (PDT) X-Gm-Message-State: ALKqPweQVz3L1ql1ZoSajjPqAHBHhjieIc1Xa4M2PuUsNRpbYBtQJLqR vimVAEN4yS6lwi8PrsvtG6VHKrjnKwB0I/QVSDP3Yg== X-Google-Smtp-Source: ADUXVKK3g7l843zN0H/5HFCHF1si3LKgPDPc4+Mvl2txKNmBEk89aPze4DdjdLsLirNc98aMGAdBsd98Gk9rZYtuduI= X-Received: by 2002:a81:a68a:: with SMTP id d132-v6mr2900901ywh.387.1527313366931; Fri, 25 May 2018 22:42:46 -0700 (PDT) MIME-Version: 1.0 Received: by 2002:a25:c709:0:0:0:0:0 with HTTP; Fri, 25 May 2018 22:42:16 -0700 (PDT) In-Reply-To: <20180521063953.GA70671@FreeBSD.org> References: <201805202319.w4KNJ9hj038452@repo.freebsd.org> <20180521094344.Q1053@besplex.bde.org> <20180521063953.GA70671@FreeBSD.org> From: Eitan Adler Date: Fri, 25 May 2018 22:42:16 -0700 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: svn commit: r333945 - head/usr.bin/top To: Alexey Dokuchaev Cc: Bruce Evans , svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers Content-Type: text/plain; charset="UTF-8" X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.26 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 26 May 2018 05:42:48 -0000 On 20 May 2018 at 23:39, Alexey Dokuchaev wrote: > On Mon, May 21, 2018 at 10:32:30AM +1000, Bruce Evans wrote: >> ... >> > if (smpmode && namelength > SMPUNAMELEN) >> > namelength = SMPUNAMELEN; >> > else if (namelength > UPUNAMELEN) >> ... what about this? commit 7d041879b4d0ad11818b5f5875b1198a722841d7 Author: Eitan Adler Date: Sat May 26 04:30:48 2018 +0000 top(1): allow to configure the max username length Some users prefer shorter names, and MAXLOGNAME is not a perfect method of coming up with a default. Use 8, by request, and allow users to configure it. diff --git a/usr.bin/top/machine.c b/usr.bin/top/machine.c index 0f31d87..d6a9b41 100644 --- a/usr.bin/top/machine.c +++ b/usr.bin/top/machine.c @@ -50,8 +50,9 @@ #include "layout.h" #define GETSYSCTL(name, var) getsysctl(name, &(var), sizeof(var)) -#define SMPUNAMELEN 13 -#define UPUNAMELEN 15 +#ifndef MAXTOPNAMELEN +#define MAXTOPNAMELEN 8 +#endif extern struct timeval timeout; static int smpmode; @@ -329,11 +330,7 @@ machine_init(struct statics *statics) NULL, 0) == 0 && carc_en == 1) carc_enabled = 1; - namelength = MAXLOGNAME; - if (smpmode && namelength > SMPUNAMELEN) - namelength = SMPUNAMELEN; - else if (namelength > UPUNAMELEN) - namelength = UPUNAMELEN; + namelength = MAXTOPNAMELEN; kd = kvm_open(NULL, _PATH_DEVNULL, NULL, O_RDONLY, "kvm_open"); if (kd == NULL) -- Eitan Adler Source, Ports, Doc committer Bugmeister, Ports Security teams