Changeset 23484
- Timestamp:
- 01/16/08 12:56:12 (11 months ago)
- Location:
- trunk/launchd/src
- Files:
-
- 5 modified
-
launchd.c (modified) (4 diffs)
-
launchd.h (modified) (1 diff)
-
launchd_core_logic.c (modified) (3 diffs)
-
launchd_runtime.c (modified) (6 diffs)
-
launchd_runtime.h (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/launchd/src/launchd.c
r23481 r23484 78 78 #define LAUNCHD_CONF ".launchd.conf" 79 79 #define SECURITY_LIB "/System/Library/Frameworks/Security.framework/Versions/A/Security" 80 #define SHUTDOWN_LOG_DIR "/var/log/shutdown"81 80 82 81 … … 94 93 static void fatal_signal_handler(int sig, siginfo_t *si, void *uap); 95 94 static void handle_pid1_crashes_separately(void); 96 static void prep_shutdown_log_dir(void);97 95 98 96 static bool re_exec_in_single_user_mode; … … 237 235 } 238 236 239 void240 prep_shutdown_log_dir(void)241 {242 launchd_assumes(mkdir(SHUTDOWN_LOG_DIR, S_IRWXU) != -1 || errno == EEXIST);243 }244 245 237 INTERNAL_ABI void 246 238 launchd_shutdown(void) … … 260 252 */ 261 253 runtime_setlogmask(LOG_UPTO(LOG_DEBUG)); 262 prep_shutdown_log_dir();263 254 } 264 255 -
trunk/launchd/src/launchd.h
r23479 r23484 27 27 #include "launchd_runtime.h" 28 28 29 #define SHUTDOWN_LOG_DIR "/var/log/shutdown"30 31 29 struct kevent; 32 30 struct conncb; -
trunk/launchd/src/launchd_core_logic.c
r23482 r23484 97 97 #define LAUNCHD_SIGKILL_TIMER 5 98 98 99 #define SHUTDOWN_LOG_DIR "/var/log/shutdown" 99 100 100 101 #define TAKE_SUBSET_NAME "TakeSubsetName" … … 715 716 } 716 717 717 if (do_apple_internal_logging ()&& jm->parentmgr == NULL && pid1_magic) {718 if (do_apple_internal_logging && jm->parentmgr == NULL && pid1_magic) { 718 719 runtime_set_timeout(still_alive_with_check, 5); 719 720 } … … 4863 4864 pid_t sp; 4864 4865 4865 if (!do_apple_internal_logging ()) {4866 if (!do_apple_internal_logging) { 4866 4867 return; 4867 4868 } 4868 4869 4870 if (!job_assumes(j, mkdir(SHUTDOWN_LOG_DIR, S_IRWXU) != -1 || errno == EEXIST)) { 4871 return; 4872 } 4873 4869 4874 snprintf(pidstr, sizeof(pidstr), "%u", j->p); 4870 4875 snprintf(logfile, sizeof(logfile), SHUTDOWN_LOG_DIR "/%s-%u.sample.txt", j->label, j->p); -
trunk/launchd/src/launchd_runtime.c
r23483 r23484 122 122 static FILE *ourlogfile; 123 123 bool pid1_magic; 124 bool do_apple_internal_logging; 125 124 126 125 127 INTERNAL_ABI mach_port_t … … 1146 1148 { 1147 1149 #if 0 1148 if (do_apple_internal_logging ()) {1150 if (do_apple_internal_logging) { 1149 1151 return fcntl(fd, F_FULLFSYNC, NULL); 1150 1152 } else { … … 1188 1190 1189 1191 if (attr->priority == LOG_APPLEONLY) { 1190 if (do_apple_internal_logging ()) {1192 if (do_apple_internal_logging) { 1191 1193 attr->priority = LOG_NOTICE; 1192 1194 } else { … … 1553 1555 } 1554 1556 1555 INTERNAL_ABI bool1556 do_apple_internal_logging(void)1557 {1558 static int apple_internal_logging = 1;1559 struct stat sb;1560 1561 if (unlikely(apple_internal_logging == 1)) {1562 apple_internal_logging = stat("/AppleInternal", &sb);1563 }1564 1565 return (apple_internal_logging == 0);1566 }1567 1568 1557 INTERNAL_ABI int64_t 1569 1558 runtime_get_wall_time(void) … … 1613 1602 do_file_init(void) 1614 1603 { 1604 struct stat sb; 1605 1615 1606 launchd_assert(mach_timebase_info(&tbi) == 0); 1616 1607 tbi_float_val = tbi.numer; … … 1620 1611 pid1_magic = true; 1621 1612 } 1622 } 1613 1614 if (stat("/AppleInternal", &sb) != -1) { 1615 do_apple_internal_logging = true; 1616 } 1617 } -
trunk/launchd/src/launchd_runtime.h
r23481 r23484 105 105 106 106 extern bool pid1_magic; 107 extern bool do_apple_internal_logging; 107 108 108 109 INTERNAL_ABI mach_port_t runtime_get_kernel_port(void); … … 130 131 INTERNAL_ABI const char *reboot_flags_to_C_names(unsigned int flags); 131 132 INTERNAL_ABI const char *proc_flags_to_C_names(unsigned int flags); 132 133 INTERNAL_ABI bool do_apple_internal_logging(void);134 133 135 134 INTERNAL_ABI int kevent_bulk_mod(struct kevent *kev, size_t kev_cnt);

