svn commit: r202877 - user/kmacy/releng_8_rump/lib/libunet/unet_sys

Kip Macy kmacy at FreeBSD.org
Sat Jan 23 08:45:23 UTC 2010


Author: kmacy
Date: Sat Jan 23 08:45:22 2010
New Revision: 202877
URL: http://svn.freebsd.org/changeset/base/202877

Log:
  emulate kproc_kthread_add

Modified:
  user/kmacy/releng_8_rump/lib/libunet/unet_sys/unet_compat.c
  user/kmacy/releng_8_rump/lib/libunet/unet_sys/unet_kern_intr.c

Modified: user/kmacy/releng_8_rump/lib/libunet/unet_sys/unet_compat.c
==============================================================================
--- user/kmacy/releng_8_rump/lib/libunet/unet_sys/unet_compat.c	Sat Jan 23 08:43:21 2010	(r202876)
+++ user/kmacy/releng_8_rump/lib/libunet/unet_sys/unet_compat.c	Sat Jan 23 08:45:22 2010	(r202877)
@@ -6,7 +6,10 @@
 #include <sys/refcount.h>
 #include <sys/ucred.h>
 #include <sys/time.h>
+#include <sys/proc.h>
 
+
+#include <pthread.h>
 struct malloc_type;
 
 vm_offset_t kmem_malloc(void * map, int bytes, int wait);
@@ -95,5 +98,20 @@ getmicrotime(struct timeval *tvp)
 	gettimeofday(&tv, NULL);
 }
 
+int
+kproc_kthread_add(void (*start_routine)(void *), void *arg,
+    struct proc **p,  struct thread **td,
+    int flags, int pages,
+    char * procname, const char *str, ...)
+{
+	int error;
+	pthread_t thread;
+	pthread_attr_t attr;
 
+	*td = malloc(sizeof(struct thread));
+	pthread_attr_init(&attr);
+	
+	error = pthread_create(&thread, &attr, start_routine, arg);
 
+	return (error);
+}

Modified: user/kmacy/releng_8_rump/lib/libunet/unet_sys/unet_kern_intr.c
==============================================================================
--- user/kmacy/releng_8_rump/lib/libunet/unet_sys/unet_kern_intr.c	Sat Jan 23 08:43:21 2010	(r202876)
+++ user/kmacy/releng_8_rump/lib/libunet/unet_sys/unet_kern_intr.c	Sat Jan 23 08:45:22 2010	(r202877)
@@ -361,15 +361,16 @@ ithread_create(const char *name)
 
 	ithd = malloc(sizeof(struct intr_thread), M_ITHREAD, M_WAITOK | M_ZERO);
 
-#ifdef notyet
 	error = kproc_kthread_add(ithread_loop, ithd, &intrproc,
 		    &td, RFSTOPPED | RFHIGHPID,
 	    	    0, "intr", "%s", name);
+
+	
 	if (error)
 		panic("kproc_create() failed with %d", error);
 	td->td_pflags |= TDP_ITHREAD;
 	ithd->it_thread = td;
-#endif	
+
 	CTR2(KTR_INTR, "%s: created %s", __func__, name);
 	return (ithd);
 }


More information about the svn-src-user mailing list