From nobody Thu Oct 10 09:11:31 2024 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4XPPBq5YX1z5YjNB; Thu, 10 Oct 2024 09:11:31 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R11" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4XPPBq3qJRz4mkh; Thu, 10 Oct 2024 09:11:31 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1728551491; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=o9EozY0ilxghL9vSet9zuS4Ul/vOnInWTEQroOeSsPI=; b=BpkYlgg9n98kz+2b3pvGY5z3G6yrI9aksG1J27WCY+dh2zVvMh6VY+uQ8iClxvXVMfktvM hTn4WTiFd7FN64F6gPjjQeo9ugKH+qca3DdJMQLuxfohzMLxxAS2Avy5dOQd/xmot//PDU eisGHvCnxNKhj+2U0y3XMsUvpZAZFgnxRJSZI8mbD+446PP9BVjDJUS7hocqwXhHIzgk/q UiMqM0NHdBlXhFi4mIQnvoUiQJZqKQSUQZqx3g4UFcPBHxE6YdpjFiAfmLXG1JRneD6epy WnsN4aZqNLCvv7b6wwtY/jlET1SPoRBelYeOgLobp/PURcha7d3g6x5lktpNHw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1728551491; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=o9EozY0ilxghL9vSet9zuS4Ul/vOnInWTEQroOeSsPI=; b=FltD7dkGjGwGe+0Aeo/0BRYXGxLaGhlUnvkZkAPVSBHAjhiPyJZ+DR27wXoA4apyLHGHQ8 zlG3wId3EprZJXUyH7QM2xBWtsvRWqup8V3mFJ5XlTOAG1d+ortSyWETpmmxOtLBL9XxuC GumoUdYWTnS1ubQGf2vi2RwQnmHmGh8+BB1R3DglAdIXyQ4hdJXqicpW+V7EyqvengCqHg 7cEpdFJxoKKCJo8KEKUm972n9HuzPlbYNyWL+pgrKu0fAd2PVsNNrk6Kzrd6yWhYRx108e ArVPQPZ1cHB+Y/pIHubsCQIFDX5UX8dE71r781ssMB2r9uKRPCwcPiim0vQxtA== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1728551491; a=rsa-sha256; cv=none; b=hFKef1SZNHPDJr1AIKiJLAtDPP5qYgTT2Ao7qiie7eGGOCMcr8gfLAXUqoxx3BUaODS2Ll /GYriE7UCrZWsLfpNRPP3UL/Gu1ia6Cy49cXEUkvjbgQN0BOfgo77P01+hRxP+wKoFpLVC FG9hXo/GEvpvm+649O3UKdzWsNxaUQCMlnbUN8RQs/6f8TZlc9pf1tcsSWlVNuy44GwJbr j6q462EwRAZ776RpEswIkemzgPcRn65IuZVfq8QFBo5eiOh5EG8H6tD/vSvI+FWgcyutru oaoDqMhQ0DH5a0BVtCGoNnrgBhw/KG7muTdcjQLFJob9+wnSUACYpOS/8xFRUw== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4XPPBq3PD3zrYc; Thu, 10 Oct 2024 09:11:31 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.18.1/8.18.1) with ESMTP id 49A9BV3P064022; Thu, 10 Oct 2024 09:11:31 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 49A9BVJL064019; Thu, 10 Oct 2024 09:11:31 GMT (envelope-from git) Date: Thu, 10 Oct 2024 09:11:31 GMT Message-Id: <202410100911.49A9BVJL064019@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Konstantin Belousov Subject: git: d19c86f203da - stable/14 - sysctl.3: document missing oids from kern.proc. node List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-all@freebsd.org Sender: owner-dev-commits-src-all@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kib X-Git-Repository: src X-Git-Refname: refs/heads/stable/14 X-Git-Reftype: branch X-Git-Commit: d19c86f203da8ed0adf6bcf1b98ebe8378b80309 Auto-Submitted: auto-generated The branch stable/14 has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=d19c86f203da8ed0adf6bcf1b98ebe8378b80309 commit d19c86f203da8ed0adf6bcf1b98ebe8378b80309 Author: Konstantin Belousov AuthorDate: 2024-09-27 03:32:15 +0000 Commit: Konstantin Belousov CommitDate: 2024-10-10 09:10:33 +0000 sysctl.3: document missing oids from kern.proc. node (cherry picked from commit cdd9629921c6551abac583aeafc5c6bd380ccac2) --- lib/libc/gen/sysctl.3 | 114 +++++++++++++++++++++++++++++++++++++++++++------- 1 file changed, 98 insertions(+), 16 deletions(-) diff --git a/lib/libc/gen/sysctl.3 b/lib/libc/gen/sysctl.3 index 485cd7b455e4..836b52128ada 100644 --- a/lib/libc/gen/sysctl.3 +++ b/lib/libc/gen/sysctl.3 @@ -479,31 +479,113 @@ whose size depends on the current number of such objects in the system. .It Dv KERN_PROC_ALL Ta None .It Dv KERN_PROC_PID Ta A process ID .It Dv KERN_PROC_PGRP Ta A process group +.It Dv KERN_PROC_SESSION Ta A session .It Dv KERN_PROC_TTY Ta A tty device -.It Dv KERN_PROC_UID Ta A user ID +.It Dv KERN_PROC_UID Ta An effective user ID .It Dv KERN_PROC_RUID Ta A real user ID +.It Dv KERN_PROC_GID Ta An effective group ID +.It Dv KERN_PROC_RGID Ta A real group ID .El .Pp -If the third level name is -.Dv KERN_PROC_ARGS -then the command line argument +For the following names, the miscellaneous information about the target +process, which is specified by the fourth level of the oid name, +is returned. +A process ID of +.Li \-1 +specifies the current process. +.Bl -column "Third Level NameXXXXXX" "TypeXXXXXX" -offset indent +.It Sy Third Level Name Ta Sy Fourth Level +.It Dv KERN_PROC_ARGS Ta "Set of strings" +.It Dv KERN_PROC_PATHNAME Ta "String" +.It Dv KERN_PROC_KSTACK Ta "struct kinfo_stack []" +.It Dv KERN_PROC_VMMAP Ta "struct kinfo_vmentry []" +.It Dv KERN_PROC_FILEDESC Ta "struct kinfo_file []" +.It Dv KERN_PROC_GROUPS Ta "gid_t []" +.It Dv KERN_PROC_ENV Ta "Set of strings" +.It Dv KERN_PROC_AUXV Ta "Elf_Auxinfo []" +.It Dv KERN_PROC_RLIMIT Ta "Integer" +.It Dv KERN_PROC_RLIMIT_USAGE Ta "rlim_t []" +.It Dv KERN_PROC_PS_STRINGS Ta "Integer" +.It Dv KERN_PROC_UMASK Ta "Integer/short" +.It Dv KERN_PROC_OSREL Ta "Integer" +.It Dv KERN_PROC_SIGTRAMP Ta "Integer" +.It Dv KERN_PROC_CWD Ta "String" +.It Dv KERN_PROC_NFDS Ta "Integer" +.It Dv KERN_PROC_SIGFASTBLK Ta "Integer" +.It Dv KERN_PROC_VM_LAYOUT Ta "struct kinfo_vm_layout" +.El +.Pp +.Bl -tag -compact +.It Dv KERN_PROC_ARGS +The command line argument array is returned in a flattened form, i.e., zero-terminated arguments follow each other. The total size of array is returned. It is also possible for a process to set its own process title this way. -If the third level name is -.Dv KERN_PROC_PATHNAME , -the path of the -process' text file is stored. -For -.Dv KERN_PROC_PATHNAME , -a process ID of +.It Dv KERN_PROC_PATHNAME +The path of the process' text file is returned. +.It Dv KERN_PROC_KSTACK +The in-kernel call stacks for the threads of the specified process. +.It Dv KERN_PROC_VMMAP +The description of the map entries for the process. +.It Dv KERN_PROC_FILEDESC +The file descriptors for files opened in the specified process. +.It Dv KERN_PROC_GROUPS +Groups associated with the process. +.It Dv KERN_PROC_ENV +The set of strings representing the environment of the specified process. +.Pp +Note that from the kernel point of view, environment exists only at the +time of +.Xr execve 2 +system call. +This node method tries to reconstruct the environment from the known +breadcrumbs left in the process address space, but it is not guaranteed +to succeed or to represent the current value as maintained by the program. +.It Dv KERN_PROC_AUXV +The set of ELF auxv entries. +See the note above about environment, which is also applicable to auxv. +.It Dv KERN_PROC_RLIMIT +Additinal OID name element must be supplied, specifiing the resource name +as in +.Xr getrlimit 2 . +The call returns the given resource limit for the process. +.It Dv KERN_PROC_RLIMIT_USAGE +Like +.Dv KERN_PROC_RLIMIT , +but instead of the limit, returns the accounted resource usage. +For resources which do not have a meaningful current value, .Li \-1 -implies the current process. -.Bl -column "Third Level NameXXXXXX" "Fourth LevelXXXXXX" -offset indent -.It Sy Third Level Name Ta Sy Fourth Level -.It Dv KERN_PROC_ARGS Ta "A process ID" -.It Dv KERN_PROC_PATHNAME Ta "A process ID" +is returned. +.It Dv KERN_PROC_PS_STRINGS +Returns the location of the +.Vt ps_strings +structure at the time of the last call to +.Xr execve 2 +in the specified process. +.It Dv KERN_PROC_UMASK +The current umask value, see +.Xr umask 2 . +.It Dv KERN_PROC_OSREL +The value of osrel for the process, that is the osrel the currently executed +image was compiled for. +Read from the note of the elf executable at +.Xr execve 2 +time. +Might be modified by the process. +.It Dv KERN_PROC_SIGTRAMP +Address of the signal trampoline in the process address space, +where, simplifying, the kernel passes control for signal delivery. +.It Dv KERN_PROC_CWD +Returns the current working directory for the process. +.It Dv KERN_PROC_NFDS +Returns the total number of opened file descriptors for the process. +.It Dv KERN_PROC_SIGFASTBLK +Returns the address of the +.Xr sigfastblock 2 +location, if active. +.It Dv KERN_PROC_VM_LAYOUT +Fills a structure describing process virtual address space layout. .El .It Li KERN_PS_STRINGS Reports the location of the process