[launchd-changes] [23359] trunk/launchd/src
source_changes at macosforge.org
source_changes at macosforge.org
Thu Sep 6 15:24:34 PDT 2007
Revision: 23359
http://trac.macosforge.org/projects/launchd/changeset/23359
Author: zarzycki at apple.com
Date: 2007-09-06 15:24:34 -0700 (Thu, 06 Sep 2007)
Log Message:
-----------
Create a wrapper around fsync().
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-09-05 21:14:09 UTC (rev 23358)
+++ trunk/launchd/src/launchd_core_logic.c 2007-09-06 22:24:34 UTC (rev 23359)
@@ -4492,7 +4492,7 @@
}
if (logfile_fd != -1) {
- job_assumes(j, fcntl(logfile_fd, F_FULLFSYNC, 0) != -1);
+ job_assumes(j, runtime_fsync(logfile_fd) != -1);
job_assumes(j, runtime_close(logfile_fd) != -1);
}
Modified: trunk/launchd/src/launchd_runtime.c
===================================================================
--- trunk/launchd/src/launchd_runtime.c 2007-09-05 21:14:09 UTC (rev 23358)
+++ trunk/launchd/src/launchd_runtime.c 2007-09-06 22:24:34 UTC (rev 23359)
@@ -1036,11 +1036,18 @@
runtime_closelog(void)
{
if (ourlogfile) {
- fflush(ourlogfile);
+ launchd_assumes(fflush(ourlogfile) == 0);
+ launchd_assumes(runtime_fsync(fileno(ourlogfile)) != -1);
+ }
+}
- if (debug_shutdown_hangs) {
- fcntl(fileno(ourlogfile), F_FULLFSYNC, NULL);
- }
+int
+runtime_fsync(int fd)
+{
+ if (debug_shutdown_hangs) {
+ return fcntl(fd, F_FULLFSYNC, NULL);
+ } else {
+ return fsync(fd);
}
}
Modified: trunk/launchd/src/launchd_runtime.h
===================================================================
--- trunk/launchd/src/launchd_runtime.h 2007-09-05 21:14:09 UTC (rev 23358)
+++ trunk/launchd/src/launchd_runtime.h 2007-09-06 22:24:34 UTC (rev 23359)
@@ -61,6 +61,7 @@
void launchd_runtime(void) __attribute__((noreturn));
int runtime_close(int fd);
+int runtime_fsync(int fd);
void runtime_set_timeout(timeout_callback to_cb, mach_msg_timeout_t to);
kern_return_t runtime_add_mport(mach_port_t name, mig_callback demux, mach_msg_size_t msg_size);
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.macosforge.org/pipermail/launchd-changes/attachments/20070906/508a6430/attachment.html
More information about the launchd-changes
mailing list