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
This commit is contained in:
Konstantin Belousov 2016-02-09 16:30:16 +00:00
parent f75ef22a66
commit db57c70a5b
12 changed files with 18 additions and 19 deletions

View File

@ -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,

View File

@ -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"

View File

@ -337,7 +337,7 @@ typedef struct nt_dispatch_header nt_dispatch_header;
#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)

View File

@ -1009,7 +1009,7 @@ pmc_attach_one_process(struct proc *p, struct pmc *pm)
/* 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 {

View File

@ -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);

View File

@ -1037,7 +1037,7 @@ fork_exit(void (*callout)(void *, struct trapframe *), void *arg,
* 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();

View File

@ -104,7 +104,7 @@ kproc_create(void (*func)(void *), void *arg,
/* 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;

View File

@ -3010,8 +3010,7 @@ stop_all_proc(void)
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;
}

View File

@ -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;

View File

@ -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. */

View File

@ -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);

View File

@ -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,