git: b5d2165b9046 - main - kern: poll: tap out the pollfd array on successful return

From: Kyle Evans <kevans_at_FreeBSD.org>
Date: Tue, 05 Mar 2024 05:44:14 UTC
The branch main has been updated by kevans:

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

commit b5d2165b9046572c9361a8e8b09323a6001ac586
Author:     Kyle Evans <kevans@FreeBSD.org>
AuthorDate: 2024-03-05 04:14:06 +0000
Commit:     Kyle Evans <kevans@FreeBSD.org>
CommitDate: 2024-03-05 05:44:08 +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
    Differential Revision:  https://reviews.freebsd.org/D44158
---
 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 9c0cb4e739e0..f6190c3fb05f 100644
--- a/sys/kern/sys_generic.c
+++ b/sys/kern/sys_generic.c
@@ -1606,6 +1606,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))