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

source_changes at macosforge.org source_changes at macosforge.org
Thu May 10 14:23:35 PDT 2007


Revision: 23250
          http://trac.macosforge.org/projects/launchd/changeset/23250
Author:   zarzycki at apple.com
Date:     2007-05-10 14:23:35 -0700 (Thu, 10 May 2007)

Log Message:
-----------
Let's start using the EV_RECEIPT feature I added to the kernel kqueue logic.

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

Modified: trunk/launchd/src/launchd_core_logic.c
===================================================================
--- trunk/launchd/src/launchd_core_logic.c	2007-05-09 17:12:03 UTC (rev 23249)
+++ trunk/launchd/src/launchd_core_logic.c	2007-05-10 21:23:35 UTC (rev 23250)
@@ -3068,6 +3068,7 @@
 void
 socketgroup_watch(job_t j, struct socketgroup *sg)
 {
+	struct kevent kev[sg->fd_cnt];
 	char buf[10000];
 	unsigned int i, buf_off = 0;
 
@@ -3081,8 +3082,16 @@
 	job_log(j, LOG_DEBUG, "Watching sockets:%s", buf);
 
 	for (i = 0; i < sg->fd_cnt; i++) {
-		job_assumes(j, kevent_mod(sg->fds[i], EVFILT_READ, EV_ADD, 0, 0, j) != -1);
+		EV_SET(&kev[i], sg->fds[i], EVFILT_READ, EV_ADD, 0, 0, j);
 	}
+
+	job_assumes(j, kevent_bulk_mod(kev, sg->fd_cnt) != -1);
+
+	for (i = 0; i < sg->fd_cnt; i++) {
+		job_assumes(j, kev[i].flags & EV_ERROR);
+		errno = kev[i].data;
+		job_assumes(j, kev[i].data == 0);
+	}
 }
 
 void

Modified: trunk/launchd/src/launchd_runtime.c
===================================================================
--- trunk/launchd/src/launchd_runtime.c	2007-05-09 17:12:03 UTC (rev 23249)
+++ trunk/launchd/src/launchd_runtime.c	2007-05-10 21:23:35 UTC (rev 23250)
@@ -676,6 +676,18 @@
 }
 
 int
+kevent_bulk_mod(struct kevent *kev, size_t kev_cnt)
+{
+	size_t i;
+
+	for (i = 0; i < kev_cnt; i++) {
+		kev[i].flags |= EV_CLEAR|EV_RECEIPT;
+	}
+
+	return kevent(mainkq, kev, kev_cnt, kev, kev_cnt, NULL);
+}
+
+int
 kevent_mod(uintptr_t ident, short filter, u_short flags, u_int fflags, intptr_t data, void *udata)
 {
 	struct kevent kev;

Modified: trunk/launchd/src/launchd_runtime.h
===================================================================
--- trunk/launchd/src/launchd_runtime.h	2007-05-09 17:12:03 UTC (rev 23249)
+++ trunk/launchd/src/launchd_runtime.h	2007-05-10 21:23:35 UTC (rev 23250)
@@ -71,6 +71,7 @@
 const char *reboot_flags_to_C_names(unsigned int flags);
 
 
+int kevent_bulk_mod(struct kevent *kev, size_t kev_cnt);
 int kevent_mod(uintptr_t ident, short filter, u_short flags, u_int fflags, intptr_t data, void *udata);
 
 pid_t runtime_fork(mach_port_t bsport);

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


More information about the launchd-changes mailing list