From owner-freebsd-arch@freebsd.org Tue May 29 20:43:26 2018 Return-Path: Delivered-To: freebsd-arch@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 A8DD7F74999 for ; Tue, 29 May 2018 20:43:26 +0000 (UTC) (envelope-from 6yearold@gmail.com) Received: from mail-pf0-f169.google.com (mail-pf0-f169.google.com [209.85.192.169]) (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)) by mx1.freebsd.org (Postfix) with ESMTPS id 2E5347E203 for ; Tue, 29 May 2018 20:43:26 +0000 (UTC) (envelope-from 6yearold@gmail.com) Received: by mail-pf0-f169.google.com with SMTP id p14-v6so7839723pfh.9 for ; Tue, 29 May 2018 13:43:26 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:from:date:message-id:subject:to; bh=1Lo7lwd8RoKAt76bzYJp75lRTnq65pK7IrFO/clGREc=; b=bEuBt1c4w7s4arDqxkvJ476JCOuRpagOC9u3ZLlsUvHzh7unX7fR4SxO+l6v0JkJDy odRpa8hSgFAMqGx/LIkbu+2NkE3S/KTdBzObdOJhvipbXS2EATbzkxjAC7+y4XjJVZZ4 DCtC6GY2Rw1xguceUTgB+dXszGcjPneBbdbU6YjMwffPJ0mneMCY/nlitcZlcwFlGxe1 rSHOeDDpoZMJYFhKVLn3pjgzReEUWjxbEci05jGAY5RGO1JM4AaoAiM/3k0iRUkC7e/r LXG5L5uSb8PV8Jd5E1mtS9pZgR3PPOLM5omZTPySm+h783Lq1iXPVXSNUtKZAHuuuK5Y yneA== X-Gm-Message-State: ALKqPweDYkekv/Um+zEq6PfP+WjuV0yVFyw30umPS5Hf5nKnG6AAgW4A Sp2q+apc7vYMPdTxLpXjczGhVKSV X-Google-Smtp-Source: AB8JxZq6S8q+Yfc6E8P/o39+HVV8rvEg7gj0223hm+hfbA2URs1oaZgBKL2v7AJJUoEkLg8C1EPFTA== X-Received: by 2002:aa7:83c7:: with SMTP id j7-v6mr18765168pfn.50.1527626598862; Tue, 29 May 2018 13:43:18 -0700 (PDT) Received: from mail-pg0-f47.google.com (mail-pg0-f47.google.com. [74.125.83.47]) by smtp.gmail.com with ESMTPSA id q24-v6sm212063pfh.26.2018.05.29.13.43.18 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 29 May 2018 13:43:18 -0700 (PDT) Received: by mail-pg0-f47.google.com with SMTP id e21-v6so7096141pgv.0 for ; Tue, 29 May 2018 13:43:18 -0700 (PDT) X-Received: by 2002:a63:6e4f:: with SMTP id j76-v6mr248235pgc.16.1527626598262; Tue, 29 May 2018 13:43:18 -0700 (PDT) MIME-Version: 1.0 Received: by 2002:a17:90a:c502:0:0:0:0 with HTTP; Tue, 29 May 2018 13:42:47 -0700 (PDT) From: Gleb Popov Date: Tue, 29 May 2018 23:42:47 +0300 X-Gmail-Original-Message-ID: Message-ID: Subject: Rationale for setting COMMLEN to 19 in struct kinfo_proc To: freebsd-arch@freebsd.org Content-Type: text/plain; charset="UTF-8" X-Content-Filtered-By: Mailman/MimeDel 2.1.26 X-BeenThere: freebsd-arch@freebsd.org X-Mailman-Version: 2.1.26 Precedence: list List-Id: Discussion related to FreeBSD architecture List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 29 May 2018 20:43:26 -0000 Hello. I've been debugging a failing Qt (KDE, to be precise) test and found that process name returned in kinfo_proc structure gets truncated to 19 symbols. This causes other errors in the application. I'm wondering why is this field so small and is there possibility to increase it? I think, having applications with names longer than 19 characters is not that rare. Relevant header: /usr/include/sys/user.h Simple testcase to feature the problem: # cat k.cpp #include #include #include #include #include #include #include #include int main() { auto pid = getpid(); struct kinfo_proc kp; int mib[4] = { CTL_KERN, KERN_PROC, KERN_PROC_PID, (int)pid }; size_t len = sizeof(kp); u_int mib_len = sizeof(mib)/sizeof(u_int); if (sysctl(mib, mib_len, &kp, &len, NULL, 0) < 0) return -1; puts(kp.ki_tdname); puts(kp.ki_comm); return 0; } # c++ -o abcdefghijklmnopqrstuvwxyz # ./abcdefghijklmnopqrstuvwxyz abcdefghijklmnop abcdefghijklmnopqrs