Hi,

In grepping for ps_flags in /sys, it is confusing to see that ps_flags is 
associated with

1) PWM_POLARITY (power regulation?).
        Proposed to rename to ps_pwmflags?
2) process signals: struct sigacts in /sys/sys/signalvar.h
3) its rightful usage as ps_flags for struct process in /sys/sys/proc.h


So, to reduce confusion while grepping, the below diff simply renames usages of 
ps_flags in relation to struct sigacts (#2 above) to ps_sigflags.

Thanks

Index: kern/init_main.c
===================================================================
RCS file: /cvs/src/sys/kern/init_main.c,v
retrieving revision 1.296
diff -u -p -u -p -r1.296 init_main.c
--- kern/init_main.c    25 Feb 2020 16:55:33 -0000      1.296
+++ kern/init_main.c    12 Mar 2020 12:58:41 -0000
@@ -639,7 +639,7 @@ start_init(void *arg)
        check_console(p);
 
        /* process 0 ignores SIGCHLD, but we can't */
-       p->p_p->ps_sigacts->ps_flags = 0;
+       p->p_p->ps_sigacts->ps_sigflags = 0;
 
        /*
         * Need just enough stack to hold the faked-up "execve()" arguments.
Index: kern/kern_exit.c
===================================================================
RCS file: /cvs/src/sys/kern/kern_exit.c,v
retrieving revision 1.185
diff -u -p -u -p -r1.185 kern_exit.c
--- kern/kern_exit.c    1 Mar 2020 18:50:52 -0000       1.185
+++ kern/kern_exit.c    12 Mar 2020 12:58:42 -0000
@@ -215,7 +215,7 @@ exit1(struct proc *p, int xexit, int xsi
                 * If parent has the SAS_NOCLDWAIT flag set, we're not
                 * going to become a zombie.
                 */
-               if (pr->ps_pptr->ps_sigacts->ps_flags & SAS_NOCLDWAIT)
+               if (pr->ps_pptr->ps_sigacts->ps_sigflags & SAS_NOCLDWAIT)
                        atomic_setbits_int(&pr->ps_flags, PS_NOZOMBIE);
        }
 
Index: kern/kern_sig.c
===================================================================
RCS file: /cvs/src/sys/kern/kern_sig.c,v
retrieving revision 1.252
diff -u -p -u -p -r1.252 kern_sig.c
--- kern/kern_sig.c     11 Mar 2020 15:45:03 -0000      1.252
+++ kern/kern_sig.c     12 Mar 2020 12:58:42 -0000
@@ -285,9 +285,9 @@ sys_sigaction(struct proc *p, void *v, r
                if ((ps->ps_siginfo & bit) != 0)
                        sa->sa_flags |= SA_SIGINFO;
                if (signum == SIGCHLD) {
-                       if ((ps->ps_flags & SAS_NOCLDSTOP) != 0)
+                       if ((ps->ps_sigflags & SAS_NOCLDSTOP) != 0)
                                sa->sa_flags |= SA_NOCLDSTOP;
-                       if ((ps->ps_flags & SAS_NOCLDWAIT) != 0)
+                       if ((ps->ps_sigflags & SAS_NOCLDWAIT) != 0)
                                sa->sa_flags |= SA_NOCLDWAIT;
                }
                if ((sa->sa_mask & bit) == 0)
@@ -336,9 +336,9 @@ setsigvec(struct proc *p, int signum, st
        ps->ps_catchmask[signum] = sa->sa_mask &~ sigcantmask;
        if (signum == SIGCHLD) {
                if (sa->sa_flags & SA_NOCLDSTOP)
-                       atomic_setbits_int(&ps->ps_flags, SAS_NOCLDSTOP);
+                       atomic_setbits_int(&ps->ps_sigflags, SAS_NOCLDSTOP);
                else
-                       atomic_clearbits_int(&ps->ps_flags, SAS_NOCLDSTOP);
+                       atomic_clearbits_int(&ps->ps_sigflags, SAS_NOCLDSTOP);
                /*
                 * If the SA_NOCLDWAIT flag is set or the handler
                 * is SIG_IGN we reparent the dying child to PID 1
@@ -350,9 +350,9 @@ setsigvec(struct proc *p, int signum, st
                if (initprocess->ps_sigacts != ps &&
                    ((sa->sa_flags & SA_NOCLDWAIT) ||
                    sa->sa_handler == SIG_IGN))
-                       atomic_setbits_int(&ps->ps_flags, SAS_NOCLDWAIT);
+                       atomic_setbits_int(&ps->ps_sigflags, SAS_NOCLDWAIT);
                else
-                       atomic_clearbits_int(&ps->ps_flags, SAS_NOCLDWAIT);
+                       atomic_clearbits_int(&ps->ps_sigflags, SAS_NOCLDWAIT);
        }
        if ((sa->sa_flags & SA_RESETHAND) != 0)
                ps->ps_sigreset |= bit;
@@ -406,7 +406,7 @@ siginit(struct process *pr)
        for (i = 0; i < NSIG; i++)
                if (sigprop[i] & SA_IGNORE && i != SIGCONT)
                        ps->ps_sigignore |= sigmask(i);
-       ps->ps_flags = SAS_NOCLDWAIT | SAS_NOCLDSTOP;
+       ps->ps_sigflags = SAS_NOCLDWAIT | SAS_NOCLDSTOP;
 }
 
 /*
@@ -442,7 +442,7 @@ execsigs(struct proc *p)
         * Clear set of signals caught on the signal stack.
         */
        sigstkinit(&p->p_sigstk);
-       atomic_clearbits_int(&ps->ps_flags, SAS_NOCLDWAIT);
+       atomic_clearbits_int(&ps->ps_sigflags, SAS_NOCLDWAIT);
        if (ps->ps_sigact[SIGCHLD] == SIG_IGN)
                ps->ps_sigact[SIGCHLD] = SIG_DFL;
 }
@@ -1360,7 +1360,7 @@ proc_stop_sweep(void *v)
                        continue;
                atomic_clearbits_int(&pr->ps_flags, PS_STOPPED);
 
-               if ((pr->ps_pptr->ps_sigacts->ps_flags & SAS_NOCLDSTOP) == 0)
+               if ((pr->ps_pptr->ps_sigacts->ps_sigflags & SAS_NOCLDSTOP) == 0)
                        prsignal(pr->ps_pptr, SIGCHLD);
                wakeup(pr->ps_pptr);
        }
Index: sys/signalvar.h
===================================================================
RCS file: /cvs/src/sys/sys/signalvar.h,v
retrieving revision 1.39
diff -u -p -u -p -r1.39 signalvar.h
--- sys/signalvar.h     11 Mar 2020 15:45:04 -0000      1.39
+++ sys/signalvar.h     12 Mar 2020 12:58:42 -0000
@@ -53,7 +53,7 @@ struct        sigacts {
        sigset_t ps_siginfo;            /* signals that provide siginfo */
        sigset_t ps_sigignore;          /* signals being ignored */
        sigset_t ps_sigcatch;           /* signals being caught by user */
-       int     ps_flags;               /* signal flags, below */
+       int     ps_sigflags;            /* signal flags, below */
 };
 
 /* signal flags */

Reply via email to