Changeset 23589
- Timestamp:
- 2008-04-02 13:57:44 (6 months ago)
- Location:
- trunk/launchd/src
- Files:
-
- 3 modified
-
launchd_core_logic.c (modified) (7 diffs)
-
launchd_runtime.c (modified) (3 diffs)
-
launchd_runtime.h (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/launchd/src/launchd_core_logic.c
r23586 r23589 2327 2327 2328 2328 if (j->sent_sigterm_time) { 2329 uint64_t td_sec, td_usec, td = runtime_ opaque_time_to_nano(runtime_get_opaque_time() -j->sent_sigterm_time);2329 uint64_t td_sec, td_usec, td = runtime_get_nanoseconds_since(j->sent_sigterm_time); 2330 2330 2331 2331 td_sec = td / NSEC_PER_SEC; 2332 2332 td_usec = (td % NSEC_PER_SEC) / NSEC_PER_USEC; 2333 2333 2334 job_log(j, LOG_INFO, "Exited %lld.%06lld seconds after %s was sent", 2335 td_sec, td_usec, signal_to_C_name(j->sent_sigkill ? SIGKILL : SIGTERM)); 2334 job_log(j, LOG_INFO, "Exited %lld.%06lld seconds after %s was sent", td_sec, td_usec, signal_to_C_name(SIGTERM)); 2336 2335 } 2337 2336 … … 2621 2620 } else if (&j->exit_timeout == ident) { 2622 2621 if (j->sent_sigkill) { 2623 uint64_t td = runtime_ opaque_time_to_nano(runtime_get_opaque_time() -j->sent_sigterm_time);2622 uint64_t td = runtime_get_nanoseconds_since(j->sent_sigterm_time); 2624 2623 2625 2624 td /= NSEC_PER_SEC; … … 2753 2752 job_start(job_t j) 2754 2753 { 2755 uint64_t td , tnow = runtime_get_opaque_time();2754 uint64_t td; 2756 2755 int spair[2]; 2757 2756 int execspair[2]; … … 2771 2770 } 2772 2771 2773 job_assumes(j, tnow > j->start_time);2774 2775 2772 /* 2776 2773 * Some users adjust the wall-clock and then expect software to not notice. … … 2778 2775 * wherever possible. 2779 2776 */ 2780 td = runtime_ opaque_time_to_nano(tnow -j->start_time);2777 td = runtime_get_nanoseconds_since(j->start_time); 2781 2778 td /= NSEC_PER_SEC; 2782 2779 … … 2814 2811 job_assumes(j, kevent_mod(j->log_redirect_fd, EVFILT_READ, EV_ADD, 0, 0, j) != -1); 2815 2812 } 2816 2817 j->start_time = tnow;2818 2813 2819 2814 switch (c = runtime_fork(j->weird_bootstrap ? j->j_port : j->mgr->jm_port)) { … … 2853 2848 break; 2854 2849 default: 2850 j->start_time = runtime_get_opaque_time(); 2851 2855 2852 job_log(j, LOG_DEBUG, "Started as PID: %u", c); 2856 2853 -
trunk/launchd/src/launchd_runtime.c
r23580 r23589 118 118 static mach_timebase_info_data_t tbi; 119 119 static uint64_t tbi_safe_math_max; 120 static uint64_t time_of_mach_msg_return; 120 121 static double tbi_float_val; 121 122 … … 1026 1027 msg_size, ipc_port_set, to, MACH_PORT_NULL); 1027 1028 1029 time_of_mach_msg_return = runtime_get_opaque_time(); 1030 1028 1031 tmp_options = options; 1029 1032 … … 1640 1643 1641 1644 INTERNAL_ABI uint64_t 1645 runtime_get_opaque_time_of_event(void) 1646 { 1647 return time_of_mach_msg_return; 1648 } 1649 1650 INTERNAL_ABI uint64_t 1651 runtime_get_nanoseconds_since(uint64_t o) 1652 { 1653 return runtime_opaque_time_to_nano(runtime_get_opaque_time_of_event() - o); 1654 } 1655 1656 INTERNAL_ABI uint64_t 1642 1657 runtime_opaque_time_to_nano(uint64_t o) 1643 1658 { 1644 #if defined(__i386__) 1659 #if defined(__i386__) || defined(__x86_64__) 1645 1660 if (unlikely(tbi.numer != tbi.denom)) { 1646 #elif defined(__ppc__) 1661 #elif defined(__ppc__) || defined(__ppc64__) 1647 1662 if (likely(tbi.numer != tbi.denom)) { 1648 1663 #else -
trunk/launchd/src/launchd_runtime.h
r23580 r23589 188 188 INTERNAL_ABI void runtime_log_push(void); 189 189 190 INTERNAL_ABI int64_t runtime_get_wall_time(void); 191 INTERNAL_ABI uint64_t runtime_get_opaque_time(void); 192 INTERNAL_ABI uint64_t runtime_opaque_time_to_nano(uint64_t o); 190 INTERNAL_ABI int64_t runtime_get_wall_time(void) __attribute__((warn_unused_result)); 191 INTERNAL_ABI uint64_t runtime_get_opaque_time(void) __attribute__((warn_unused_result)); 192 INTERNAL_ABI uint64_t runtime_get_opaque_time_of_event(void) __attribute__((pure, warn_unused_result)); 193 INTERNAL_ABI uint64_t runtime_opaque_time_to_nano(uint64_t o) __attribute__((const, warn_unused_result)); 194 INTERNAL_ABI uint64_t runtime_get_nanoseconds_since(uint64_t o) __attribute__((pure, warn_unused_result)); 193 195 194 196 INTERNAL_ABI kern_return_t launchd_set_bport(mach_port_t name);

