[launchd-changes] [23330] trunk/launchd/src

source_changes at macosforge.org source_changes at macosforge.org
Tue Aug 7 09:29:30 PDT 2007


Revision: 23330
          http://trac.macosforge.org/projects/launchd/changeset/23330
Author:   zarzycki at apple.com
Date:     2007-08-07 09:29:30 -0700 (Tue, 07 Aug 2007)

Log Message:
-----------
Bug 5321044 is rare. I suspect that the kernel is at fault, but I need more data from those few who experience it in the wild.

Modified Paths:
--------------
    trunk/launchd/src/launchd_core_logic.c
    trunk/launchd/src/launchd_runtime.c

Modified: trunk/launchd/src/launchd_core_logic.c
===================================================================
--- trunk/launchd/src/launchd_core_logic.c	2007-08-06 15:24:48 UTC (rev 23329)
+++ trunk/launchd/src/launchd_core_logic.c	2007-08-07 16:29:30 UTC (rev 23330)
@@ -3058,7 +3058,7 @@
 	job_log(j, LOG_DEBUG, "Watching Vnode: %d", si->fd);
 	if (!job_assumes(j, kevent_mod(si->fd, EVFILT_VNODE, EV_ADD, fflags, 0, j) != -1)) {
 		/* Extra logging for 5321044 */
-		job_log(j, LOG_ERR, "Bug (5321044): si->fd == %d fflags = 0x%x j == %p", si->fd, fflags, j);
+		job_log(j, LOG_ERR, "Bug (5321044): si->why == %u si->fd == %d fflags = 0x%x j == %p", si->why, si->fd, fflags, j);
 	}
 }
 

Modified: trunk/launchd/src/launchd_runtime.c
===================================================================
--- trunk/launchd/src/launchd_runtime.c	2007-08-06 15:24:48 UTC (rev 23329)
+++ trunk/launchd/src/launchd_runtime.c	2007-08-07 16:29:30 UTC (rev 23330)
@@ -698,6 +698,7 @@
 kevent_mod(uintptr_t ident, short filter, u_short flags, u_int fflags, intptr_t data, void *udata)
 {
 	struct kevent kev;
+	int r;
 
 	switch (filter) {
 	case EVFILT_READ:
@@ -708,6 +709,8 @@
 		break;
 	}
 
+	flags |= EV_RECEIPT;
+
 	if (flags & EV_ADD && !launchd_assumes(udata != NULL)) {
 		errno = EINVAL;
 		return -1;
@@ -715,7 +718,24 @@
 
 	EV_SET(&kev, ident, filter, flags, fflags, data, udata);
 
-	return kevent(mainkq, &kev, 1, NULL, 0, NULL);
+	r = kevent(mainkq, &kev, 1, &kev, 1, NULL);
+
+#define BUG_5321044_RESEARCH 1
+#if BUG_5321044_RESEARCH
+	if (r != 1) {
+		runtime_syslog(LOG_ERR, "Bug (5321044): kevent_mod() == %d", r);
+		return -1;
+	}
+
+	if (launchd_assumes(kev.flags & EV_ERROR)) {
+		if ((flags & EV_ADD) && kev.data) {
+			runtime_syslog(LOG_ERR, "Bug (5321044): See next line.");
+			log_kevent_struct(LOG_ERR, &kev, 0);
+		}
+	}
+#endif
+
+	return r;
 }
 
 boolean_t

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.macosforge.org/pipermail/launchd-changes/attachments/20070807/78d34d02/attachment.html


More information about the launchd-changes mailing list