Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 3 Jun 2004 01:34:59 +0200
From:      Juergen Lock <nox@jelal.kn-bremen.de>
To:        freebsd-hackers@freebsd.org
Subject:   qemu; emulators/rtc doesnt send SIGIO, is this patch right?
Message-ID:  <20040603013459.A40942@saturn.kn-bremen.de>

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

 Is the following patch to the emulators/rtc port right?  qemu
(see http://www.freebsd.org/cgi/query-pr.cgi?pr=67506) expects it
to send SIGIO and i'm not that good at kernel hacking to know
if the following is correct...  it seems to work for me tho.

 (Anyone interested in helping fixing the other problems mentioned
in the pkg-descr is welcome also.  This looks like a coool project...)

Index: files/rtc.c
===================================================================
RCS file: /home/ncvs/ports/emulators/rtc/files/rtc.c,v
retrieving revision 1.15
diff -u -r1.15 rtc.c
--- files/rtc.c	13 Mar 2004 21:20:03 -0000	1.15
+++ files/rtc.c	1 Jun 2004 15:46:19 -0000
@@ -74,6 +74,11 @@
 		int	opened:1;
 		int 	enabled:1;
 	 } flags;
+#if __FreeBSD_version >= 500023
+	struct thread *sproc;
+#else
+	struct proc *sproc;
+#endif
 	struct callout rtc_handle;
 	struct timespec lasttime;
 	struct selinfo sip;
@@ -207,6 +212,7 @@
 	if (sc->var.flags.opened)
 		return (EBUSY);
 	
+	sc->var.sproc = NULL;
 	sc->var.flags.opened = 1;
 	
 	return 0;
@@ -222,6 +228,7 @@
 	struct rtc_softc *sc = (struct rtc_softc *) dev->si_drv1;
 
 	rtc_detach(dev, sc);
+	sc->var.sproc = NULL;
 	sc->var.flags.opened = 0;
 	return 0;
 }
@@ -261,6 +268,7 @@
 		break;
 	case RTCIO_PIE_ON:
 		sc->var.flags.enabled = 1;
+		sc->var.sproc = p;
 		DLog(Linfo, "Enable interrupts");
 		break;
 	default:
@@ -394,6 +402,7 @@
 		return;
 	/* Wakeup sleepers */
 	sc->var.woken++;
+	psignal(sc->var.sproc, SIGIO);
 	selwakeup(&sc->var.sip);
 	wakeup(&sc->var.rtc_ident);
 
 Thanks,
	Juergen



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