From nobody Mon Oct 07 10:51:34 2024 X-Original-To: dev-commits-src-main@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 4XMbYg1740z5Xj40; Mon, 07 Oct 2024 10:51:35 +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 4XMbYf5qd5z4D2d; Mon, 7 Oct 2024 10:51:34 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1728298294; 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=bR7qCNMDIA/juYQ9IHYoip7k4ick55txQuJD3C5cyEY=; b=mxwKrjPLMyBJ2iSbgIMMSXh251dMyxlhxEP7InBFkuaZPKQPZqaLJsRBIjpjONdyE7nwsE clizW1xxZWiG07Y7WFxoenoWhaKvmUOsRyqRK8Zzy9UUDBjhIDSHExOu4W66IZsQ7wvsHh otooJvgkcS9Sc7QUyCwliWQZ5rjSoLXpz0Pdu5gC9BUlQzVAvngaeHwV7in9fJ53dQtrZN mH0e9rQx/30cSCKYatvAfZr+QY+RJvGLOExdiRHpiC/fUapuh0WdF2BcsZTKnZKTS7irsL ZlSVbjXy/RIG4czQgldzsXLvXmENk0h1/pG4f0xqEqLbeUUHD+YVdc8CDwcDjg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1728298294; 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=bR7qCNMDIA/juYQ9IHYoip7k4ick55txQuJD3C5cyEY=; b=NCNUSqSYuBDI9NLbuFnswdWRtSKDzlUj30dobeGM05p0oM60naEhecH0JLuoB4qYBDY4k5 84G0zZTOrVV0dfYJAGrnqi+WoS2ZemkMahshdxaICOqMztP3xI7HbMLGQZ/BM5DNiwQNqB 7wKuj5348HzAtrEU5i4AAiMTRYnZKZ7wXHkivl/tfaKx57K4vqiRq7YTzmrRJ/u21lz8sn eszxtzfA9T9ZiepgrB83kE9qqKfPZgdLt06p/Z658cdHKrt18Gku3ck62Hlcp1x2DCzi0R kiefR8GhfnQjmmPcIc4t9SjUL1W21eayIIb89mKWepu6vzTjiHGGHknRiOc4HQ== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1728298294; a=rsa-sha256; cv=none; b=BAmuqoepXhXj4f9t1F/9Ajcxptewa8Ke+raOYgYL4mQd7QLAJn5yo9eg2ZZNdjxfopB+hq ZTljt7xbb+/NRGbx3hHjTOs/ipK/Rgdy5YG5Fo8D54utSvVOJIc7X9u+qDfw/mYcTg7wTv a+R3r7vHIMN6OqHuFBiM6tPq5Z+5IrOQM2yOUIWzSevoMx4rK09yfYMzWYBqLLkCyfhxgk FAya2GnxJNv6ghmTX+TgucLVTuEhQrIMN2qZojlp5xiQtqfJhWPUh8Gl26uIARN7MhFZMZ ySN9rnKaZLolexmmPVhzWNyqJElNEY/yHYIqyG5dCqgyPyNKvoMT4hMaJYzqyw== 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 4XMbYf44LPzk7Z; Mon, 7 Oct 2024 10:51:34 +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 497ApYlE064421; Mon, 7 Oct 2024 10:51:34 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 497ApYUb064418; Mon, 7 Oct 2024 10:51:34 GMT (envelope-from git) Date: Mon, 7 Oct 2024 10:51:34 GMT Message-Id: <202410071051.497ApYUb064418@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Konstantin Belousov Subject: git: cdd9629921c6 - main - sysctl.3: document missing oids from kern.proc. node List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-main@freebsd.org Sender: owner-dev-commits-src-main@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/main X-Git-Reftype: branch X-Git-Commit: cdd9629921c6551abac583aeafc5c6bd380ccac2 Auto-Submitted: auto-generated The branch main has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=cdd9629921c6551abac583aeafc5c6bd380ccac2 commit cdd9629921c6551abac583aeafc5c6bd380ccac2 Author: Konstantin Belousov AuthorDate: 2024-09-27 03:32:15 +0000 Commit: Konstantin Belousov CommitDate: 2024-10-07 10:50:00 +0000 sysctl.3: document missing oids from kern.proc. node Reviewed by: olce Sponsored by: The FreeBSD Foundation MFC after: 1 week Differential revision: https://reviews.freebsd.org/D46823 --- 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 92e30cd6cdb4..bf526169a4ce 100644 --- a/lib/libc/gen/sysctl.3 +++ b/lib/libc/gen/sysctl.3 @@ -477,31 +477,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