git: 416547ba79c3 - stable/14 - kern: poll: tap out the pollfd array on successful return

From: Kyle Evans <kevans_at_FreeBSD.org>
Date: Mon, 18 Mar 2024 15:53:19 UTC
The branch stable/14 has been updated by kevans:

URL: https://cgit.FreeBSD.org/src/commit/?id=416547ba79c3dec8e69502174abecf33dbf74606

commit 416547ba79c3dec8e69502174abecf33dbf74606
Author:     Kyle Evans <kevans@FreeBSD.org>
AuthorDate: 2024-03-05 04:14:06 +0000
Commit:     Kyle Evans <kevans@FreeBSD.org>
CommitDate: 2024-03-18 15:52:57 +0000

    kern: poll: tap out the pollfd array on successful return
    
    We do this in kern_poll() to include freebsd32 but exclude the linux
    compat layer.  The ABI should be the same, but the POLL constants are
    probably different or should be assumed so.
    
    Reviewed by:    bapt, jhb
    
    (cherry picked from commit b5d2165b9046572c9361a8e8b09323a6001ac586)
---
 sys/kern/sys_generic.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/sys/kern/sys_generic.c b/sys/kern/sys_generic.c
index b569a9f808d5..d0d0b1efa354 100644
--- a/sys/kern/sys_generic.c
+++ b/sys/kern/sys_generic.c
@@ -1608,6 +1608,11 @@ kern_poll(struct thread *td, struct pollfd *ufds, u_int nfds,
 	error = kern_poll_kfds(td, kfds, nfds, tsp, set);
 	if (error == 0)
 		error = pollout(td, kfds, ufds, nfds);
+#ifdef KTRACE
+	if (error == 0 && KTRPOINT(td, KTR_STRUCT_ARRAY))
+		ktrstructarray("pollfd", UIO_USERSPACE, ufds, nfds,
+		    sizeof(*ufds));
+#endif
 
 out:
 	if (nfds > nitems(stackfds))