Projects
Browse Source     Search     Timeline     Wiki

Changeset 23512

Show
Ignore:
Timestamp:
02/06/08 18:15:19 (10 months ago)
Author:
zarzycki@…
Message:

<rdar://problem/5725563> Device hung on "slide to unlock" screen

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • branches/SULeopard/launchd/src/launchd_core_logic.c

    r23499 r23512  
    463463static void extract_rcsid_substr(const char *i, char *o, size_t osz); 
    464464static void do_first_per_user_launchd_hack(void); 
     465static size_t get_kern_max_proc(void); 
    465466static void do_file_init(void) __attribute__((constructor)); 
    466467 
    467468/* file local globals */ 
     469static bool do_apple_internal_magic; 
    468470static size_t total_children; 
    469471static size_t total_anon_children; 
     
    20472049{ 
    20482050        int mib[] = { CTL_KERN, KERN_PROC, KERN_PROC_PGRP, j->p }; 
    2049         size_t i, kp_cnt, len = 10*1024*1024; 
     2051        size_t i, kp_cnt, len = sizeof(struct kinfo_proc) * get_kern_max_proc(); 
    20502052        struct kinfo_proc *kp; 
     2053 
     2054#if TARGET_OS_EMBEDDED 
     2055        if (!do_apple_internal_magic) { 
     2056                return; 
     2057        } 
     2058#endif 
    20512059 
    20522060        if (!job_assumes(j, (kp = malloc(len)) != NULL)) { 
     
    28222830{ 
    28232831        int mib[] = { CTL_KERN, KERN_PROC, KERN_PROC_ALL }; 
    2824         size_t i, kp_cnt, len = 10*1024*1024; 
    2825         struct kinfo_proc *kp = malloc(len); 
     2832        size_t i, kp_cnt, len = sizeof(struct kinfo_proc) * get_kern_max_proc(); 
     2833        struct kinfo_proc *kp; 
    28262834        uid_t u = j->mach_uid; 
     2835 
     2836#if TARGET_OS_EMBEDDED 
     2837        if (!do_apple_internal_magic) { 
     2838                return; 
     2839        } 
     2840#endif 
     2841        kp = malloc(len); 
    28272842 
    28282843        if (!job_assumes(j, kp != NULL)) { 
     
    43034318{ 
    43044319        int mib[] = { CTL_KERN, KERN_PROC, KERN_PROC_ALL }; 
    4305         size_t i, kp_cnt, len = 10*1024*1024; 
     4320        size_t i, kp_cnt, len = sizeof(struct kinfo_proc) * get_kern_max_proc(); 
    43064321        struct kinfo_proc *kp; 
    43074322 
     4323#if TARGET_OS_EMBEDDED 
     4324        if (!do_apple_internal_magic) { 
     4325                return; 
     4326        } 
     4327#endif 
    43084328        if (jm->parentmgr || getpid() != 1) { 
    43094329                return; 
     
    67796799} 
    67806800 
     6801size_t 
     6802get_kern_max_proc(void) 
     6803{ 
     6804        int mib[] = { CTL_KERN, KERN_MAXPROC }; 
     6805        int max = 100; 
     6806        size_t max_sz = sizeof(max); 
     6807 
     6808        launchd_assumes(sysctl(mib, 2, &max, &max_sz, NULL, 0) != -1); 
     6809 
     6810        return max; 
     6811} 
     6812 
    67816813void 
    67826814do_file_init(void) 
    67836815{ 
     6816        struct stat sb; 
     6817 
    67846818        launchd_assert(mach_timebase_info(&tbi) == 0); 
    67856819 
    6786 } 
     6820        if (stat("/AppleInternal", &sb) == 0) { 
     6821                do_apple_internal_magic = true; 
     6822        } 
     6823}