Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 23 Aug 2009 11:22:46 +0000 (UTC)
From:      Pawel Jakub Dawidek <pjd@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r196456 - head/sys/cddl/compat/opensolaris/sys
Message-ID:  <200908231122.n7NBMkJq059355@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: pjd
Date: Sun Aug 23 11:22:46 2009
New Revision: 196456
URL: http://svn.freebsd.org/changeset/base/196456

Log:
  - Give minclsyspri and maxclsyspri real values (consulted with kmacy).
  - Honour 'pri' argument for thread_create().

Modified:
  head/sys/cddl/compat/opensolaris/sys/mutex.h
  head/sys/cddl/compat/opensolaris/sys/proc.h

Modified: head/sys/cddl/compat/opensolaris/sys/mutex.h
==============================================================================
--- head/sys/cddl/compat/opensolaris/sys/mutex.h	Sun Aug 23 09:58:06 2009	(r196455)
+++ head/sys/cddl/compat/opensolaris/sys/mutex.h	Sun Aug 23 11:22:46 2009	(r196456)
@@ -32,9 +32,9 @@
 #ifdef _KERNEL
 
 #include <sys/param.h>
-#include <sys/proc.h>
 #include <sys/lock.h>
 #include_next <sys/mutex.h>
+#include <sys/proc.h>
 #include <sys/sx.h>
 
 typedef enum {

Modified: head/sys/cddl/compat/opensolaris/sys/proc.h
==============================================================================
--- head/sys/cddl/compat/opensolaris/sys/proc.h	Sun Aug 23 09:58:06 2009	(r196455)
+++ head/sys/cddl/compat/opensolaris/sys/proc.h	Sun Aug 23 11:22:46 2009	(r196456)
@@ -34,13 +34,16 @@
 #include_next <sys/proc.h>
 #include <sys/stdint.h>
 #include <sys/smp.h>
+#include <sys/sched.h>
+#include <sys/lock.h>
+#include <sys/mutex.h>
 #include <sys/debug.h>
 
 #ifdef _KERNEL
 
 #define	CPU		curcpu
-#define	minclsyspri	0
-#define	maxclsyspri	0
+#define	minclsyspri	PRIBIO
+#define	maxclsyspri	PVM
 #define	max_ncpus	mp_ncpus
 #define	boot_max_ncpus	mp_ncpus
 
@@ -58,6 +61,7 @@ static __inline kthread_t *
 thread_create(caddr_t stk, size_t stksize, void (*proc)(void *), void *arg,
     size_t len, proc_t *pp, int state, pri_t pri)
 {
+	kthread_t *td;
 	proc_t *p;
 	int error;
 
@@ -70,7 +74,15 @@ thread_create(caddr_t stk, size_t stksiz
 
 	error = kproc_create(proc, arg, &p, 0, stksize / PAGE_SIZE,
 	    "solthread %p", proc);
-	return (error == 0 ? FIRST_THREAD_IN_PROC(p) : NULL);
+	if (error != 0)
+		td = NULL;
+	else {
+		td = FIRST_THREAD_IN_PROC(p);
+		thread_lock(td);
+		sched_prio(td, pri);
+		thread_unlock(td);
+	}
+	return (td);
 }
 
 #define	thread_exit()	kproc_exit(0)



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