From nobody Sun May 12 15:23: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 4Vcmbp535Bz5KCN1; Sun, 12 May 2024 15:23:34 +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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Vcmbp4FRVz4KT3; Sun, 12 May 2024 15:23:34 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1715527414; 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=zKhQI2tWMoYaAEWEFt+PScGk5ZOPuUbq1jEDH/QPssM=; b=GYssMYZEpYpS0RhJDwkF1KK57LOVemWg2ijsz7mGaByjGzj3Zj4aBnfU0wYxbnZC2s/xsQ N0KlpuNtVYGK0oIUA4qIC+VDIrutB9COiFQTwF4PBPjeWxhaBb2PCaZLlWjj1HnPJ1Fiw5 S9DSSRet/DdhfR3wyfkN1WCjHhzSSBT32NRYG51GQ9XCQ5E4AcZxzyfl/DJLciU30Q5cEy 9sMmvzTVYh6xrn9usrc3uY3B6v/KicsdZwD+IqXdsLi7UEA4zje9Wg5EubI2LxTFeNrE8z B0humL1JB75IxjI3hXd9+cELUX6VwlypzqfdFsitzGCF0smMuimP2Sj3SxHLMw== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1715527414; a=rsa-sha256; cv=none; b=Qpgoftg/3hixBNn1UzKSEppEISlfTB7dsbozfazawW4ejx5uBHaZLgItbdBkycV+bthaMQ OitaVmfcHvAYjFUyBZYvgzsE1TxkMSk2SRJSaKj02XVk27U1/M8SpZhgtJPE+F7KQKP0pr LBoKPescedDoYZrnFrJbWCwUucG2TzS1zFbv7kHkT2naYuhOKRM386nYR5Xppafk++Bxhi A+V3gDuVBILiQzeSimU8aLgZIOmu+gE7Uv1yRlYiR6LMkL0l/lFnaq63elC0iyLPTS0H5Y TBYGJonr5xCna19pOT7s1n9K4EUl0OZnC1NyKgHMKxK4eLhKKUUqy5SuuPBmIQ== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1715527414; 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=zKhQI2tWMoYaAEWEFt+PScGk5ZOPuUbq1jEDH/QPssM=; b=I0A09SrSWvFy1Xo8kzM3h+5F6ZsiGxrWBDt8jnOleuHsf0T5mxPHjhJEx5ZSyu5LZsdPYz QGYT7hjtTneRNIe/e70JnOhkHead+JQUL7Di+ehKRnHhdLmvi9cpuqFsKdWf4cUtcJPhav 8BvoH5XMy7pmejSVJ8gA70yQQNXp26F1R2TfHCZm9ZORN6E0gVjU83m6oFMoZNx/wRzMGJ sn/UXAsecayzWTa0o3gZFQAo9ozLbs1NkGsm5RflufflDTp0ODzFQr7viO/1/yWySOpIqb XHywGPQhlt6IoQFXVqRBbgfm/Alyc+P+yx/IOnp+nmXL2g5hNXjORL5+PTCgKg== 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 4Vcmbp3rfjz18d8; Sun, 12 May 2024 15:23:34 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.17.1/8.17.1) with ESMTP id 44CFNYWd056425; Sun, 12 May 2024 15:23:34 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 44CFNYI5056422; Sun, 12 May 2024 15:23:34 GMT (envelope-from git) Date: Sun, 12 May 2024 15:23:34 GMT Message-Id: <202405121523.44CFNYI5056422@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Warner Losh Subject: git: 71ffda413069 - main - Revert linprocfs commits 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: imp X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 71ffda413069ca39eabebbe83151df02d01c9103 Auto-Submitted: auto-generated The branch main has been updated by imp: URL: https://cgit.FreeBSD.org/src/commit/?id=71ffda413069ca39eabebbe83151df02d01c9103 commit 71ffda413069ca39eabebbe83151df02d01c9103 Author: Warner Losh AuthorDate: 2024-05-12 15:08:39 +0000 Commit: Warner Losh CommitDate: 2024-05-12 15:09:03 +0000 Revert linprocfs commits There's a race in these that I missed in my review that needs to be resolved. This reverts commit ee2e36686e846d412deac23344185f4b8a8c0285. This reverts commit 02f481a30b8269c7cad24ec2920ca09751708a1e. This reverts commit 099a81a4173bc5b121e50d4e27ea5fafdda8475b. --- sys/compat/linprocfs/linprocfs.c | 182 --------------------------------------- 1 file changed, 182 deletions(-) diff --git a/sys/compat/linprocfs/linprocfs.c b/sys/compat/linprocfs/linprocfs.c index dd04adc054db..391d5f679ee5 100644 --- a/sys/compat/linprocfs/linprocfs.c +++ b/sys/compat/linprocfs/linprocfs.c @@ -126,9 +126,6 @@ #define P2K(x) ((x) << (PAGE_SHIFT - 10)) /* pages to kbytes */ #define TV2J(x) ((x)->tv_sec * 100UL + (x)->tv_usec / 10000) -/* Value defined in sys/kern/sysv_shm.c */ -#define SHMSEG_ALLOCATED 0x0800 - /** * @brief Mapping of ki_stat in struct kinfo_proc to the linux state * @@ -2095,176 +2092,6 @@ linprocfs_domax_map_cnt(PFS_FILL_ARGS) return (0); } -/* - * Filler function for proc/sysvipc/msg - */ -static int -linprocfs_dosysvipc_msg(PFS_FILL_ARGS) -{ - struct msqid_kernel *msqids; - u_long id, msgmni; - size_t sz; - int error; - - sbuf_printf(sb, - "%10s %10s %4s %10s %10s %5s %5s %5s %5s %5s %5s %10s %10s %10s\n", - "key", "msqid", "perms", "cbytes", "qnum", "lspid", "lrpid", - "uid", "gid", "cuid", "cgid", "stime", "rtime", "ctime"); - -again: - msgmni = msginfo.msgmni; - sz = sizeof(struct msqid_kernel) * msgmni; - msqids = malloc(sz, M_TEMP, M_NOWAIT); - if (msqids == NULL) - return (ENOMEM); - if (msgmni != msginfo.msgmni) { - free(msqids, M_TEMP); - goto again; - } - - error = kernel_sysctlbyname(curthread, "kern.ipc.msqids", msqids, &sz, - NULL, 0, 0, 0); - if (error != 0) { - free(msqids, M_TEMP); - return (error); - } - msgmni = sz / sizeof(struct msqid_kernel); - - for (id = 0; id < msgmni; id++) - if (msqids[id].u.msg_qbytes != 0) - sbuf_printf(sb, - "%10d %10lu %4o %10lu %10lu %5u %5u %5u %5u %5u %5u %10lld %10lld %10lld\n", - (int) msqids[id].u.msg_perm.key, - IXSEQ_TO_IPCID(id, msqids[id].u.msg_perm), - msqids[id].u.msg_perm.mode, - msqids[id].u.msg_cbytes, - msqids[id].u.msg_qnum, - msqids[id].u.msg_lspid, - msqids[id].u.msg_lrpid, - msqids[id].u.msg_perm.uid, - msqids[id].u.msg_perm.gid, - msqids[id].u.msg_perm.cuid, - msqids[id].u.msg_perm.cgid, - (long long)msqids[id].u.msg_stime, - (long long)msqids[id].u.msg_rtime, - (long long)msqids[id].u.msg_ctime); - - free(msqids, M_TEMP); - return (0); -} - -/* - * Filler function for proc/sysvipc/sem - */ -static int -linprocfs_dosysvipc_sem(PFS_FILL_ARGS) -{ - struct semid_kernel *semids; - u_long id, semmni; - size_t sz; - int error; - - sbuf_printf(sb, "%10s %10s %4s %10s %5s %5s %5s %5s %10s %10s\n", - "key", "semid", "perms", "nsems", "uid", "gid", "cuid", "cgid", - "otime", "ctime"); - -again: - semmni = seminfo.semmni; - sz = sizeof(struct semid_kernel) * semmni; - semids = malloc(sz, M_TEMP, M_NOWAIT); - if (semids == NULL) - return (ENOMEM); - if (semmni != seminfo.semmni) { - free(semids, M_TEMP); - goto again; - } - - error = kernel_sysctlbyname(curthread, "kern.ipc.sema", semids, &sz, - NULL, 0, 0, 0); - if (error != 0) { - free(semids, M_TEMP); - return (error); - } - semmni = sz / sizeof(struct semid_kernel); - - for (id = 0; id < semmni; id++) - if ((semids[id].u.sem_perm.mode & SEM_ALLOC) != 0) - sbuf_printf(sb, - "%10d %10lu %4o %10u %5u %5u %5u %5u %10lld %10lld\n", - (int) semids[id].u.sem_perm.key, - IXSEQ_TO_IPCID(id, semids[id].u.sem_perm), - semids[id].u.sem_perm.mode, - semids[id].u.sem_nsems, - semids[id].u.sem_perm.uid, - semids[id].u.sem_perm.gid, - semids[id].u.sem_perm.cuid, - semids[id].u.sem_perm.cgid, - (long long)semids[id].u.sem_otime, - (long long)semids[id].u.sem_ctime); - - free(semids, M_TEMP); - return (0); -} - -/* - * Filler function for proc/sysvipc/shm - */ -static int -linprocfs_dosysvipc_shm(PFS_FILL_ARGS) -{ - struct shmid_kernel *shmids; - u_long id, shmmni; - size_t sz; - int error; - - sbuf_printf(sb, - "%10s %10s %s %21s %5s %5s %5s %5s %5s %5s %5s %10s %10s %10s %21s %21s\n", - "key", "shmid", "perms", "size", "cpid", "lpid", "nattch", "uid", - "gid", "cuid", "cgid", "atime", "dtime", "ctime", "rss", "swap"); - -again: - shmmni = shminfo.shmmni; - sz = sizeof(struct shmid_kernel) * shmmni; - shmids = malloc(sz, M_TEMP, M_NOWAIT); - if (shmids == NULL) - return (ENOMEM); - if (shmmni != shminfo.shmmni) { - free(shmids, M_TEMP); - goto again; - } - - error = kernel_sysctlbyname(curthread, "kern.ipc.shmsegs", shmids, &sz, - NULL, 0, 0, 0); - if (error != 0) { - free(shmids, M_TEMP); - return (error); - } - shmmni = sz / sizeof(struct shmid_kernel); - - for (id = 0; id < shmmni; id++) - if ((shmids[id].u.shm_perm.mode & SHMSEG_ALLOCATED) != 0) - sbuf_printf(sb, - "%10d %10lu %4o %21zu %5u %5u %5u %5u %5u %5u %5u %10lld %10lld %10lld %21d %21d\n", - (int) shmids[id].u.shm_perm.key, - IXSEQ_TO_IPCID(id, shmids[id].u.shm_perm), - shmids[id].u.shm_perm.mode, - shmids[id].u.shm_segsz, - shmids[id].u.shm_cpid, - shmids[id].u.shm_lpid, - shmids[id].u.shm_nattch, - shmids[id].u.shm_perm.uid, - shmids[id].u.shm_perm.gid, - shmids[id].u.shm_perm.cuid, - shmids[id].u.shm_perm.cgid, - (long long)shmids[id].u.shm_atime, - (long long)shmids[id].u.shm_dtime, - (long long)shmids[id].u.shm_ctime, - 0, 0); /* XXX rss & swp are not supported */ - - free(shmids, M_TEMP); - return (0); -} - /* * Constructor */ @@ -2414,15 +2241,6 @@ linprocfs_init(PFS_INIT_ARGS) pfs_create_file(dir, "max_map_count", &linprocfs_domax_map_cnt, NULL, NULL, NULL, PFS_RD); - /* /proc/sysvipc/... */ - dir = pfs_create_dir(root, "sysvipc", NULL, NULL, NULL, 0); - pfs_create_file(dir, "msg", &linprocfs_dosysvipc_msg, - NULL, NULL, NULL, PFS_RD); - pfs_create_file(dir, "sem", &linprocfs_dosysvipc_sem, - NULL, NULL, NULL, PFS_RD); - pfs_create_file(dir, "shm", &linprocfs_dosysvipc_shm, - NULL, NULL, NULL, PFS_RD); - return (0); }