git: 1eada4295600 - main - getrandom(2): add kern_getrandom

From: Brooks Davis <brooks_at_FreeBSD.org>
Date: Wed, 11 Nov 2026 09:58:18 UTC
The branch main has been updated by brooks:

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

commit 1eada4295600ecb4bc639cd7e9dcd4f743a9298a
Author:     Brooks Davis <brooks@FreeBSD.org>
AuthorDate: 2026-11-11 09:40:41 +0000
Commit:     Brooks Davis <brooks@FreeBSD.org>
CommitDate: 2026-11-11 09:40:41 +0000

    getrandom(2): add kern_getrandom
    
    Effort:         CHERI upstreaming
    Sponsored by:   Innovate UK
    Pull Request:   https://github.com/freebsd/freebsd-src/pull/2284
---
 sys/kern/sys_getrandom.c | 3 ++-
 sys/sys/syscallsubr.h    | 2 ++
 2 files changed, 4 insertions(+), 1 deletion(-)

diff --git a/sys/kern/sys_getrandom.c b/sys/kern/sys_getrandom.c
index 922418402df5..308104bdf029 100644
--- a/sys/kern/sys_getrandom.c
+++ b/sys/kern/sys_getrandom.c
@@ -31,6 +31,7 @@
 #include <sys/limits.h>
 #include <sys/proc.h>
 #include <sys/random.h>
+#include <sys/syscallsubr.h>
 #include <sys/sysproto.h>
 #include <sys/systm.h>
 #include <sys/uio.h>
@@ -44,7 +45,7 @@
  */
 CTASSERT(EWOULDBLOCK == EAGAIN);
 
-static int
+int
 kern_getrandom(struct thread *td, void *user_buf, size_t buflen,
     unsigned int flags)
 {
diff --git a/sys/sys/syscallsubr.h b/sys/sys/syscallsubr.h
index f2ef85b9b9a5..674a864449ab 100644
--- a/sys/sys/syscallsubr.h
+++ b/sys/sys/syscallsubr.h
@@ -269,6 +269,8 @@ int	kern_getloginclass(struct thread *td, char *namebuf, size_t namelen);
 int	kern_getppid(struct thread *);
 int	kern_getpeername(struct thread *td, int fd, struct sockaddr *sa);
 int	kern_getpriority(struct thread *td, int which, int who);
+int	kern_getrandom(struct thread *td, void *user_buf, size_t buflen,
+	    unsigned int flags);
 int	kern_getresgid(struct thread *td, gid_t *rgid, gid_t *egid,
 	    gid_t *sgid);
 int	kern_getresuid(struct thread *td, uid_t *ruid, uid_t *euid,