freebsd-ports/emulators/kqemu-kmod-devel/files/patch-kqemu-freebsd.c
Juergen Lock d4679191a5 - Try and fix for real the issue of exiting qemu processes sometimes
stuck in devdrn
- Remove the -DSMP magic, it didn't help the amd64 SMP panics and was
  useless anyway (the panics still exist, the only good workaround I've
  found so far is forcing qemu onto cpu 1 and that is only possible on
  HEAD using the new cpuset feature)
- Only bother with the -DKSE magic for OSVERSIONs where it matters
- Bump PORTREVISION
2008-04-19 15:04:56 +00:00

49 lines
1.1 KiB
C

Index: kqemu-freebsd.c
@@ -208,9 +208,17 @@
int CDECL kqemu_schedule(void)
{
/* kqemu_log("kqemu_schedule\n"); */
+#if __FreeBSD_version < 700044
mtx_lock_spin(&sched_lock);
mi_switch(SW_VOL, NULL);
mtx_unlock_spin(&sched_lock);
+#else
+ /* -current no longer uses sched_lock */
+ struct thread *td = curthread;
+ thread_lock(td);
+ mi_switch(SW_VOL, NULL);
+ thread_unlock(td);
+#endif
return SIGPENDING(curthread);
}
#endif
@@ -320,8 +328,15 @@
#if __FreeBSD_version >= 500000
dev->si_drv1 = NULL;
TAILQ_REMOVE(&kqemuhead, ks, kqemu_ent);
+#if __FreeBSD_version >= 700051
+ destroy_dev_sched(dev);
+#else
+#if __FreeBSD_version >= 700024
+ dev_relthread(dev);
+#endif
destroy_dev(dev);
#endif
+#endif
free(ks, M_KQEMU);
--kqemu_ref_count;
}
@@ -500,7 +515,13 @@
while ((ks = TAILQ_FIRST(&kqemuhead)) != NULL) {
kqemu_destroy(ks);
}
+#if __FreeBSD_version >= 700051
+ drain_dev_clone_events();
+#endif
clone_cleanup(&kqemuclones);
+#if __FreeBSD_version >= 700051
+ destroy_dev_drain(&kqemu_cdevsw);
+#endif
#endif
kqemu_global_delete(kqemu_gs);
kqemu_gs = NULL;