Projects
Browse Source     Search     Timeline     Wiki

Changeset 23464

Show
Ignore:
Timestamp:
12/12/07 13:12:28 (12 months ago)
Author:
zarzycki@…
Message:

Let's do some more stuff in user-land so that we can benchmark it.

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • trunk/launchd/src/launchd_core_logic.c

    r23463 r23464  
    454454static void do_first_per_user_launchd_hack(void); 
    455455static void do_file_init(void) __attribute__((constructor)); 
     456static void do_unmounts(void); 
    456457 
    457458/* file local globals */ 
     
    755756                jobmgr_log(jm, LOG_DEBUG, "About to call: sync()"); 
    756757                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(); 
    757760                launchd_log_vm_stats(); 
    758761                jobmgr_log(jm, LOG_DEBUG, "About to call: reboot(%s)", reboot_flags_to_C_names(jm->reboot_flags)); 
     
    66956698 
    66966699} 
     6700 
     6701void 
     6702do_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}