Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 23 Dec 2001 13:38:06 -0800 (PST)
From:      Anders Nor Berle <debolaz@debolaz.com>
To:        freebsd-gnats-submit@FreeBSD.org
Subject:   kern/33124: kthread_create doesnt mark kthreads as kthreads.
Message-ID:  <200112232138.fBNLc6m53871@freefall.freebsd.org>

next in thread | raw e-mail | index | archive | help

>Number:         33124
>Category:       kern
>Synopsis:       kthread_create doesnt mark kthreads as kthreads.
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    freebsd-bugs
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Sun Dec 23 13:40:00 PST 2001
>Closed-Date:
>Last-Modified:
>Originator:     Anders Nor Berle
>Release:        RELENG_4_4
>Organization:
Amphibic Online
>Environment:
FreeBSD goliath.amphibic.net 4.4-RELEASE-p2 FreeBSD 4.4-RELEASE-p2 #1: Sun Dec 23 21:46:44 CET 2001     debolaz@goliath.amphibic.net:/usr/src/sys/compile/GOLIATH  i386

>Description:
When kthread_create spawns a kernel thread, it doesnt mark it with the flag P_KTHREADP which at least according to its description, should be used to mark kernel threads.


>How-To-Repeat:
Spawn a kthread and check for P_KTHREADP in p->p_flag.


>Fix:
This is submitted through the web interface and probably wont apply correctly, but it shows how to fix it.

diff --recursive --show-c-function --unified src.old/sys/kern/kern_kthread.c src/sys/kern/kern_kthread.c
--- src.old/sys/kern/kern_kthread.c	Fri Jun 15 11:37:55 2001
+++ src/sys/kern/kern_kthread.c	Sun Dec 23 21:12:51 2001
@@ -83,7 +83,7 @@ kthread_create(void (*func)(void *), voi
 		*newpp = p2;
 
 	/* this is a non-swapped system process */
-	p2->p_flag |= P_INMEM | P_SYSTEM;
+	p2->p_flag |= P_INMEM | P_SYSTEM | P_KTHREADP;
 	p2->p_procsig->ps_flag |= PS_NOCLDWAIT;
 	PHOLD(p2);
 

>Release-Note:
>Audit-Trail:
>Unformatted:

To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-bugs" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200112232138.fBNLc6m53871>