The branch main has been updated by kib:

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

commit cc29f221aaa218297ee4948b92da53f6126bc658
Author:     Konstantin Belousov <[email protected]>
AuthorDate: 2022-08-17 16:57:20 +0000
Commit:     Konstantin Belousov <[email protected]>
CommitDate: 2022-08-20 17:33:17 +0000

    ksiginfo_alloc(): change to directly take M_WAITOK/NOWAIT flags
    
    Also style, and remove unneeded cast.
    
    Reviewed by:    markj
    Tested by:      pho
    Sponsored by:   The FreeBSD Foundation
    MFC after:      2 weeks
    Differential revision:  https://reviews.freebsd.org/D36207
---
 sys/kern/kern_exit.c   |  2 +-
 sys/kern/kern_sig.c    | 13 ++++++-------
 sys/kern/kern_thread.c |  2 +-
 sys/sys/signalvar.h    |  2 +-
 4 files changed, 9 insertions(+), 10 deletions(-)

diff --git a/sys/kern/kern_exit.c b/sys/kern/kern_exit.c
index 68500c3b8721..4c3821ddfa72 100644
--- a/sys/kern/kern_exit.c
+++ b/sys/kern/kern_exit.c
@@ -498,7 +498,7 @@ exit1(struct thread *td, int rval, int signo)
                wakeup(q->p_reaper);
        for (; q != NULL; q = nq) {
                nq = LIST_NEXT(q, p_sibling);
-               ksi = ksiginfo_alloc(TRUE);
+               ksi = ksiginfo_alloc(M_WAITOK);
                PROC_LOCK(q);
                q->p_sigparent = SIGCHLD;
 
diff --git a/sys/kern/kern_sig.c b/sys/kern/kern_sig.c
index 7780d4ce4a6c..27aff0998c90 100644
--- a/sys/kern/kern_sig.c
+++ b/sys/kern/kern_sig.c
@@ -365,14 +365,13 @@ sigqueue_start(void)
 }
 
 ksiginfo_t *
-ksiginfo_alloc(int wait)
+ksiginfo_alloc(int mwait)
 {
-       int flags;
+       MPASS(mwait == M_WAITOK || mwait == M_NOWAIT);
 
-       flags = M_ZERO | (wait ? M_WAITOK : M_NOWAIT);
-       if (ksiginfo_zone != NULL)
-               return ((ksiginfo_t *)uma_zalloc(ksiginfo_zone, flags));
-       return (NULL);
+       if (ksiginfo_zone == NULL)
+               return (NULL);
+       return (uma_zalloc(ksiginfo_zone, mwait | M_ZERO));
 }
 
 void
@@ -513,7 +512,7 @@ sigqueue_add(sigqueue_t *sq, int signo, ksiginfo_t *si)
        if (p != NULL && p->p_pendingcnt >= max_pending_per_proc) {
                signal_overflow++;
                ret = EAGAIN;
-       } else if ((ksi = ksiginfo_alloc(0)) == NULL) {
+       } else if ((ksi = ksiginfo_alloc(M_NOWAIT)) == NULL) {
                signal_alloc_fail++;
                ret = EAGAIN;
        } else {
diff --git a/sys/kern/kern_thread.c b/sys/kern/kern_thread.c
index 729b4bf45c25..a15488b29cb6 100644
--- a/sys/kern/kern_thread.c
+++ b/sys/kern/kern_thread.c
@@ -468,7 +468,7 @@ proc_linkup(struct proc *p, struct thread *td)
 {
 
        sigqueue_init(&p->p_sigqueue, p);
-       p->p_ksi = ksiginfo_alloc(1);
+       p->p_ksi = ksiginfo_alloc(M_WAITOK);
        if (p->p_ksi != NULL) {
                /* XXX p_ksi may be null if ksiginfo zone is not ready */
                p->p_ksi->ksi_flags = KSI_EXT | KSI_INS;
diff --git a/sys/sys/signalvar.h b/sys/sys/signalvar.h
index 85538abeedf9..59b26105effd 100644
--- a/sys/sys/signalvar.h
+++ b/sys/sys/signalvar.h
@@ -384,7 +384,7 @@ int cursig(struct thread *td);
 void   execsigs(struct proc *p);
 void   gsignal(int pgid, int sig, ksiginfo_t *ksi);
 void   killproc(struct proc *p, const char *why);
-ksiginfo_t * ksiginfo_alloc(int wait);
+ksiginfo_t *ksiginfo_alloc(int mwait);
 void   ksiginfo_free(ksiginfo_t *ksi);
 int    pksignal(struct proc *p, int sig, ksiginfo_t *ksi);
 void   pgsigio(struct sigio **sigiop, int sig, int checkctty);

Reply via email to