Author: kib
Date: Tue Feb  9 16:30:16 2016
New Revision: 295435
URL: https://svnweb.freebsd.org/changeset/base/295435

Log:
  Rename P_KTHREAD struct proc p_flag to P_KPROC.
  
  I left as is an apparent bug in ntoskrnl_var.h:AT_PASSIVE_LEVEL()
  definition.
  
  Suggested by: jhb
  Sponsored by: The FreeBSD Foundation

Modified:
  head/bin/pkill/pkill.c
  head/bin/ps/ps.1
  head/sys/compat/ndis/ntoskrnl_var.h
  head/sys/dev/hwpmc/hwpmc_mod.c
  head/sys/kern/init_main.c
  head/sys/kern/kern_fork.c
  head/sys/kern/kern_kthread.c
  head/sys/kern/kern_proc.c
  head/sys/kern/kern_racct.c
  head/sys/sys/proc.h
  head/usr.bin/top/machine.c
  head/usr.sbin/bsnmpd/modules/snmp_hostres/hostres_snmp.h

Modified: head/bin/pkill/pkill.c
==============================================================================
--- head/bin/pkill/pkill.c      Tue Feb  9 14:35:23 2016        (r295434)
+++ head/bin/pkill/pkill.c      Tue Feb  9 16:30:16 2016        (r295435)
@@ -71,7 +71,7 @@ __FBSDID("$FreeBSD$");
 
 /* Ignore system-processes (if '-S' flag is not specified) and myself. */
 #define        PSKIP(kp)       ((kp)->ki_pid == mypid ||                       
\
-                        (!kthreads && ((kp)->ki_flag & P_KTHREAD) != 0))
+                        (!kthreads && ((kp)->ki_flag & P_KPROC) != 0))
 
 enum listtype {
        LT_GENERIC,

Modified: head/bin/ps/ps.1
==============================================================================
--- head/bin/ps/ps.1    Tue Feb  9 14:35:23 2016        (r295434)
+++ head/bin/ps/ps.1    Tue Feb  9 16:30:16 2016        (r295435)
@@ -318,7 +318,7 @@ the include file
 .Bl -column P_SINGLE_BOUNDARY 0x40000000
 .It Dv "P_ADVLOCK" Ta No "0x00001" Ta "Process may hold a POSIX advisory lock"
 .It Dv "P_CONTROLT" Ta No "0x00002" Ta "Has a controlling terminal"
-.It Dv "P_KTHREAD" Ta No "0x00004" Ta "Kernel thread"
+.It Dv "P_KPROC" Ta No "0x00004" Ta "Kernel process"
 .It Dv "P_FOLLOWFORK" Ta No "0x00008" Ta "Attach debugger to new children"
 .It Dv "P_PPWAIT" Ta No "0x00010" Ta "Parent is waiting for child to exec/exit"
 .It Dv "P_PROFIL" Ta No "0x00020" Ta "Has started profiling"

Modified: head/sys/compat/ndis/ntoskrnl_var.h
==============================================================================
--- head/sys/compat/ndis/ntoskrnl_var.h Tue Feb  9 14:35:23 2016        
(r295434)
+++ head/sys/compat/ndis/ntoskrnl_var.h Tue Feb  9 16:30:16 2016        
(r295435)
@@ -337,7 +337,7 @@ typedef struct nt_dispatch_header nt_dis
 #define        SYNC_LEVEL_MP           (IPI_LEVEL - 1)
 
 #define        AT_PASSIVE_LEVEL(td)            \
-       ((td)->td_proc->p_flag & P_KTHREAD == FALSE)
+       ((td)->td_proc->p_flag & P_KPROC == FALSE)
 
 #define        AT_DISPATCH_LEVEL(td)           \
        ((td)->td_base_pri == PI_REALTIME)

Modified: head/sys/dev/hwpmc/hwpmc_mod.c
==============================================================================
--- head/sys/dev/hwpmc/hwpmc_mod.c      Tue Feb  9 14:35:23 2016        
(r295434)
+++ head/sys/dev/hwpmc/hwpmc_mod.c      Tue Feb  9 16:30:16 2016        
(r295435)
@@ -1009,7 +1009,7 @@ pmc_attach_one_process(struct proc *p, s
 
        /* issue an attach event to a configured log file */
        if (pm->pm_owner->po_flags & PMC_PO_OWNS_LOGFILE) {
-               if (p->p_flag & P_KTHREAD) {
+               if (p->p_flag & P_KPROC) {
                        fullpath = kernelname;
                        freepath = NULL;
                } else {

Modified: head/sys/kern/init_main.c
==============================================================================
--- head/sys/kern/init_main.c   Tue Feb  9 14:35:23 2016        (r295434)
+++ head/sys/kern/init_main.c   Tue Feb  9 16:30:16 2016        (r295435)
@@ -479,7 +479,7 @@ proc0_init(void *dummy __unused)
        session0.s_leader = p;
 
        p->p_sysent = &null_sysvec;
-       p->p_flag = P_SYSTEM | P_INMEM | P_KTHREAD;
+       p->p_flag = P_SYSTEM | P_INMEM | P_KPROC;
        p->p_flag2 = 0;
        p->p_state = PRS_NORMAL;
        knlist_init_mtx(&p->p_klist, &p->p_mtx);

Modified: head/sys/kern/kern_fork.c
==============================================================================
--- head/sys/kern/kern_fork.c   Tue Feb  9 14:35:23 2016        (r295434)
+++ head/sys/kern/kern_fork.c   Tue Feb  9 16:30:16 2016        (r295435)
@@ -1037,7 +1037,7 @@ fork_exit(void (*callout)(void *, struct
         * Check if a kernel thread misbehaved and returned from its main
         * function.
         */
-       if (p->p_flag & P_KTHREAD) {
+       if (p->p_flag & P_KPROC) {
                printf("Kernel thread \"%s\" (pid %d) exited prematurely.\n",
                    td->td_name, p->p_pid);
                kthread_exit();

Modified: head/sys/kern/kern_kthread.c
==============================================================================
--- head/sys/kern/kern_kthread.c        Tue Feb  9 14:35:23 2016        
(r295434)
+++ head/sys/kern/kern_kthread.c        Tue Feb  9 16:30:16 2016        
(r295435)
@@ -104,7 +104,7 @@ kproc_create(void (*func)(void *), void 
        /* this is a non-swapped system process */
        PROC_LOCK(p2);
        td = FIRST_THREAD_IN_PROC(p2);
-       p2->p_flag |= P_SYSTEM | P_KTHREAD;
+       p2->p_flag |= P_SYSTEM | P_KPROC;
        td->td_pflags |= TDP_KTHREAD;
        mtx_lock(&p2->p_sigacts->ps_mtx);
        p2->p_sigacts->ps_flag |= PS_NOCLDWAIT;
@@ -181,7 +181,7 @@ kproc_suspend(struct proc *p, int timo)
         * use the p_siglist field.
         */
        PROC_LOCK(p);
-       if ((p->p_flag & P_KTHREAD) == 0) {
+       if ((p->p_flag & P_KPROC) == 0) {
                PROC_UNLOCK(p);
                return (EINVAL);
        }
@@ -198,7 +198,7 @@ kproc_resume(struct proc *p)
         * use the p_siglist field.
         */
        PROC_LOCK(p);
-       if ((p->p_flag & P_KTHREAD) == 0) {
+       if ((p->p_flag & P_KPROC) == 0) {
                PROC_UNLOCK(p);
                return (EINVAL);
        }
@@ -411,7 +411,7 @@ kthread_resume(struct thread *td)
  * and notify the caller that is has happened.
  */
 void
-kthread_suspend_check()
+kthread_suspend_check(void)
 {
        struct proc *p;
        struct thread *td;

Modified: head/sys/kern/kern_proc.c
==============================================================================
--- head/sys/kern/kern_proc.c   Tue Feb  9 14:35:23 2016        (r295434)
+++ head/sys/kern/kern_proc.c   Tue Feb  9 16:30:16 2016        (r295435)
@@ -3010,8 +3010,7 @@ allproc_loop:
                LIST_REMOVE(cp, p_list);
                LIST_INSERT_AFTER(p, cp, p_list);
                PROC_LOCK(p);
-               if ((p->p_flag & (P_KTHREAD | P_SYSTEM |
-                   P_TOTAL_STOP)) != 0) {
+               if ((p->p_flag & (P_KPROC | P_SYSTEM | P_TOTAL_STOP)) != 0) {
                        PROC_UNLOCK(p);
                        continue;
                }

Modified: head/sys/kern/kern_racct.c
==============================================================================
--- head/sys/kern/kern_racct.c  Tue Feb  9 14:35:23 2016        (r295434)
+++ head/sys/kern/kern_racct.c  Tue Feb  9 16:30:16 2016        (r295435)
@@ -1099,7 +1099,7 @@ racct_proc_throttle(struct proc *p)
         * Do not block kernel processes.  Also do not block processes with
         * low %cpu utilization to improve interactivity.
         */
-       if (((p->p_flag & (P_SYSTEM | P_KTHREAD)) != 0) ||
+       if (((p->p_flag & (P_SYSTEM | P_KPROC)) != 0) ||
            (p->p_racct->r_resources[RACCT_PCTCPU] <= pcpu_threshold))
                return;
        p->p_throttled = 1;

Modified: head/sys/sys/proc.h
==============================================================================
--- head/sys/sys/proc.h Tue Feb  9 14:35:23 2016        (r295434)
+++ head/sys/sys/proc.h Tue Feb  9 16:30:16 2016        (r295435)
@@ -658,7 +658,7 @@ struct proc {
 /* These flags are kept in p_flag. */
 #define        P_ADVLOCK       0x00001 /* Process may hold a POSIX advisory 
lock. */
 #define        P_CONTROLT      0x00002 /* Has a controlling terminal. */
-#define        P_KTHREAD       0x00004 /* Kernel thread (*). */
+#define        P_KPROC         0x00004 /* Kernel process. */
 #define        P_FOLLOWFORK    0x00008 /* Attach parent debugger to children. 
*/
 #define        P_PPWAIT        0x00010 /* Parent is waiting for child to 
exec/exit. */
 #define        P_PROFIL        0x00020 /* Has started profiling. */

Modified: head/usr.bin/top/machine.c
==============================================================================
--- head/usr.bin/top/machine.c  Tue Feb  9 14:35:23 2016        (r295434)
+++ head/usr.bin/top/machine.c  Tue Feb  9 16:30:16 2016        (r295435)
@@ -1160,7 +1160,7 @@ format_nice(const struct kinfo_proc *pp)
        static char nicebuf[4 + 1];
 
        fifo = PRI_NEED_RR(pp->ki_pri.pri_class) ? "" : "F";
-       kthread = (pp->ki_flag & P_KTHREAD) ? "k" : "";
+       kthread = (pp->ki_flag & P_KPROC) ? "k" : "";
        switch (PRI_BASE(pp->ki_pri.pri_class)) {
        case PRI_ITHD:
                return ("-");
@@ -1185,19 +1185,19 @@ format_nice(const struct kinfo_proc *pp)
                 * values like "kr31F", but such values shouldn't occur,
                 * and if they do then the tailing "F" is not displayed.
                 */
-               rtpri = ((pp->ki_flag & P_KTHREAD) ? pp->ki_pri.pri_native :
+               rtpri = ((pp->ki_flag & P_KPROC) ? pp->ki_pri.pri_native :
                    pp->ki_pri.pri_user) - PRI_MIN_REALTIME;
                snprintf(nicebuf, sizeof(nicebuf), "%sr%d%s",
                    kthread, rtpri, fifo);
                break;
        case PRI_TIMESHARE:
-               if (pp->ki_flag & P_KTHREAD)
+               if (pp->ki_flag & P_KPROC)
                        return ("-");
                snprintf(nicebuf, sizeof(nicebuf), "%d", pp->ki_nice - NZERO);
                break;
        case PRI_IDLE:
                /* XXX: as above. */
-               rtpri = ((pp->ki_flag & P_KTHREAD) ? pp->ki_pri.pri_native :
+               rtpri = ((pp->ki_flag & P_KPROC) ? pp->ki_pri.pri_native :
                    pp->ki_pri.pri_user) - PRI_MIN_IDLE;
                snprintf(nicebuf, sizeof(nicebuf), "%si%d%s",
                    kthread, rtpri, fifo);

Modified: head/usr.sbin/bsnmpd/modules/snmp_hostres/hostres_snmp.h
==============================================================================
--- head/usr.sbin/bsnmpd/modules/snmp_hostres/hostres_snmp.h    Tue Feb  9 
14:35:23 2016        (r295434)
+++ head/usr.sbin/bsnmpd/modules/snmp_hostres/hostres_snmp.h    Tue Feb  9 
16:30:16 2016        (r295435)
@@ -85,7 +85,7 @@ struct statfs;
 /* path to devd(8) output pipe */
 #define        PATH_DEVD_PIPE  "/var/run/devd.pipe"
 
-#define        IS_KERNPROC(kp) (((kp)->ki_flag & P_KTHREAD) == P_KTHREAD)
+#define        IS_KERNPROC(kp) (((kp)->ki_flag & P_KPROC) == P_KPROC)
 
 enum snmpTCTruthValue {
        SNMP_TRUE = 1,
_______________________________________________
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"

Reply via email to