From nobody Sat Nov 01 00:45:05 2025 X-Original-To: dev-commits-src-branches@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 4cyzds44y2z6FWXV; Sat, 01 Nov 2025 00:45:05 +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 "R12" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4cyzds2j68z3hDk; Sat, 01 Nov 2025 00:45:05 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1761957905; 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=LuknnM8M5duceAHH5VsulmuGQMSa8YHEcr5u1Iescdw=; b=a3qrAis7Suan9ASGn1JgdQndUOjiDdFKOCDMZbGGLwU3/4BJmV/fPumbnYHG96e9DaPewB q6I2wmqqWE8mQkEyb9A80wUVjBRQZpHtNP9cg9WdDFwOACTv9w8yHbP2uSy33ThTlsHJP/ LFyqGdliDHwZaQrXuo4pxGZhgXWGukX6y9Su/EUf7DSVTVFsdrEL+aZkom30LkOLrQHrdb RzDEpsfnVt+ilJB/02xXhj3Vqltj5mRAOLZSiQ9nHZiBbpxRL6dnmgKiagWgBGApq4hC8q HXmg2nCGqIF1UF8GoV1b4UTJsSswHwTV9OBgYdNTfH9CkJxategDgQQ/bs9q3w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1761957905; 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=LuknnM8M5duceAHH5VsulmuGQMSa8YHEcr5u1Iescdw=; b=wpzgolAItxwdvUW7y0BR3TCLUVhJlz8bltLkqQoWDb3NGukmtrXSVicrAHMXZPECutM0LA cuJo/vmzg9uu6UySlcPel8KOAfepq1Y/C9Z7SSkuT5L0GiK3S5k6oy+WIGILZD98BWsS0a yYtz6YYV1BAs/lz6hKS5CH1ut6tGV/ux8ngYdwDUWUMxVz/P/yolT0+8kIluZKD2sqgSIn rr9rl5x/h3XhSs3WtbyU6XiMEEvVnz+ZRSeO8Cnkf1aZC3Nl//SuJnEQd9JBoBY9kX15v7 R5lOEdvmT96MtVsZBNBVfAJ92775BBGTbs5a/tw+UfXXo+Rzk1uT4pg9/8YR0A== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1761957905; a=rsa-sha256; cv=none; b=MEFWykAAebSLRUGaANdkoMagEL2DyayqARbtOvB/BjOvxBtUWheNRSrHWTuQ+3YBK1RZXS ar5UvRDrAJ74HGn9mIa2+svyLVMWuHV6+IPg6czdjCv8jkkU3B/MeGFzTcgQrc2847z+rG KSiBynuxWT9+tVJf3J8S8Q42izNsCtAsA7PrdhJvBxF5xGtXtuRauHCvuungg3hC6alm2e e06J12tCG2X3t3N6f9WVt5cBZdA+bgxo+ZptpRNWFeCT9OEUdhB6Wiu0795uGWvpJR5t8Z JXr9QOZDp8r88cK1GQSoTigGrR28+d+64mrGgq4gjI1Nnw3yR4AS7tIeWocqTg== ARC-Authentication-Results: i=1; mx1.freebsd.org; none 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 4cyzds2Gvnz1cT; Sat, 01 Nov 2025 00:45:05 +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 5A10j5u5000780; Sat, 1 Nov 2025 00:45:05 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 5A10j5LN000777; Sat, 1 Nov 2025 00:45:05 GMT (envelope-from git) Date: Sat, 1 Nov 2025 00:45:05 GMT Message-Id: <202511010045.5A10j5LN000777@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: ee7be79f7ed3 - stable/15 - kern/kern_event.c: extract kern_kqueue_alloc() from kern_kqueue() List-Id: Commits to the stable branches of the FreeBSD src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-branches List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-branches@freebsd.org Sender: owner-dev-commits-src-branches@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/15 X-Git-Reftype: branch X-Git-Commit: ee7be79f7ed3aa771e13f9e3729f80d70ef3702c Auto-Submitted: auto-generated The branch stable/15 has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=ee7be79f7ed3aa771e13f9e3729f80d70ef3702c commit ee7be79f7ed3aa771e13f9e3729f80d70ef3702c Author: Konstantin Belousov AuthorDate: 2025-08-19 04:32:43 +0000 Commit: Konstantin Belousov CommitDate: 2025-11-01 00:43:13 +0000 kern/kern_event.c: extract kern_kqueue_alloc() from kern_kqueue() (cherry picked from commit 78382caa3edbea4c3d3aad2b47ff9db3d77fc978) --- sys/kern/kern_event.c | 34 +++++++++++++++++++++++++--------- 1 file changed, 25 insertions(+), 9 deletions(-) diff --git a/sys/kern/kern_event.c b/sys/kern/kern_event.c index bd95ee2fc2ed..7552ac5ffc45 100644 --- a/sys/kern/kern_event.c +++ b/sys/kern/kern_event.c @@ -1177,28 +1177,28 @@ kqueue_init(struct kqueue *kq) TASK_INIT(&kq->kq_task, 0, kqueue_task, kq); } -int -kern_kqueue(struct thread *td, int flags, struct filecaps *fcaps) +static int +kern_kqueue_alloc(struct thread *td, struct filedesc *fdp, int *fdip, + struct file **fpp, int flags, struct filecaps *fcaps, + struct kqueue **kqp) { - struct filedesc *fdp; - struct kqueue *kq; - struct file *fp; struct ucred *cred; - int fd, error; + struct kqueue *kq; + int error; - fdp = td->td_proc->p_fd; cred = td->td_ucred; if (!chgkqcnt(cred->cr_ruidinfo, 1, lim_cur(td, RLIMIT_KQUEUES))) return (ENOMEM); - error = falloc_caps(td, &fp, &fd, flags, fcaps); + error = fdip != NULL ? falloc_caps(td, fpp, fdip, flags, fcaps) : + _falloc_noinstall(td, fpp, 2); if (error != 0) { chgkqcnt(cred->cr_ruidinfo, -1, 0); return (error); } /* An extra reference on `fp' has been held for us by falloc(). */ - kq = malloc(sizeof *kq, M_KQUEUE, M_WAITOK | M_ZERO); + kq = malloc(sizeof(*kq), M_KQUEUE, M_WAITOK | M_ZERO); kqueue_init(kq); kq->kq_fdp = fdp; kq->kq_cred = crhold(cred); @@ -1207,6 +1207,22 @@ kern_kqueue(struct thread *td, int flags, struct filecaps *fcaps) TAILQ_INSERT_HEAD(&fdp->fd_kqlist, kq, kq_list); FILEDESC_XUNLOCK(fdp); + *kqp = kq; + return (0); +} + +int +kern_kqueue(struct thread *td, int flags, struct filecaps *fcaps) +{ + struct kqueue *kq; + struct file *fp; + int fd, error; + + error = kern_kqueue_alloc(td, td->td_proc->p_fd, &fd, &fp, flags, + fcaps, &kq); + if (error != 0) + return (error); + finit(fp, FREAD | FWRITE, DTYPE_KQUEUE, kq, &kqueueops); fdrop(fp, td);