Changeset 23464
- Timestamp:
- 12/12/07 13:12:28 (12 months ago)
- Files:
-
- 1 modified
-
trunk/launchd/src/launchd_core_logic.c (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/launchd/src/launchd_core_logic.c
r23463 r23464 454 454 static void do_first_per_user_launchd_hack(void); 455 455 static void do_file_init(void) __attribute__((constructor)); 456 static void do_unmounts(void); 456 457 457 458 /* file local globals */ … … 755 756 jobmgr_log(jm, LOG_DEBUG, "About to call: sync()"); 756 757 sync(); /* We're are going to rely on log timestamps to benchmark this call */ 758 jobmgr_log(jm, LOG_DEBUG, "Unmounting all filesystems except / and /dev"); 759 do_unmounts(); 757 760 launchd_log_vm_stats(); 758 761 jobmgr_log(jm, LOG_DEBUG, "About to call: reboot(%s)", reboot_flags_to_C_names(jm->reboot_flags)); … … 6695 6698 6696 6699 } 6700 6701 void 6702 do_unmounts(void) 6703 { 6704 struct statfs buf[100]; 6705 int i, found, returned; 6706 6707 do { 6708 returned = getfsstat(buf, sizeof(buf), MNT_NOWAIT); 6709 found = 0; 6710 6711 if (!launchd_assumes(returned != -1)) { 6712 return; 6713 } 6714 6715 for (i = 0; i < returned; i++) { 6716 if (strcmp(buf[i].f_mntonname, "/") == 0) { 6717 continue; 6718 } else if (strncmp(buf[i].f_mntonname, "/dev", strlen("/dev")) == 0) { 6719 continue; 6720 } 6721 6722 runtime_syslog(LOG_DEBUG, "About to unmount: %s", buf[i].f_mntonname); 6723 if (launchd_assumes(unmount(buf[i].f_mntonname, 0) != -1)) { 6724 found++; 6725 } 6726 } 6727 } while ((returned == (sizeof(buf) / sizeof(buf[0]))) && (found > 0)); 6728 }

