Projects
Browse Source     Search     Timeline     Wiki

Changeset 23513

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

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

Files:
1 modified

Legend:

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

    r23495 r23513  
    462462 
    463463/* miscellaneous file local functions */ 
     464static size_t get_kern_max_proc(void); 
    464465static void ensure_root_bkgd_setup(void); 
    465466static int dir_has_files(job_t j, const char *path); 
     
    21052106{ 
    21062107        int mib[] = { CTL_KERN, KERN_PROC, KERN_PROC_PGRP, j->p }; 
    2107         size_t i, kp_cnt, len = 10*1024*1024; 
     2108        size_t i, kp_cnt, len = sizeof(struct kinfo_proc) * get_kern_max_proc(); 
    21082109        struct kinfo_proc *kp; 
     2110 
     2111#if TARGET_OS_EMBEDDED 
     2112        if (!do_apple_internal_logging) { 
     2113                return; 
     2114        } 
     2115#endif 
    21092116 
    21102117        runtime_ktrace(RTKT_LAUNCHD_FINDING_STRAY_PG, j->p, 0, 0); 
     
    24182425#endif 
    24192426        int mib_sz = sizeof(mib) / sizeof(mib[0]); 
    2420         size_t i, kp_cnt, len = 10*1024*1024; 
     2427        size_t i, kp_cnt, len = sizeof(struct kinfo_proc) * get_kern_max_proc(); 
    24212428        struct kinfo_proc *kp; 
    24222429 
     
    29592966{ 
    29602967        int mib[] = { CTL_KERN, KERN_PROC, KERN_PROC_ALL }; 
    2961         size_t i, kp_cnt, len = 10*1024*1024; 
    2962         struct kinfo_proc *kp = malloc(len); 
     2968        size_t i, kp_cnt, len = sizeof(struct kinfo_proc) * get_kern_max_proc(); 
     2969        struct kinfo_proc *kp; 
    29632970        uid_t u = j->mach_uid; 
     2971 
     2972#if TARGET_OS_EMBEDDED 
     2973        if (!do_apple_internal_logging) { 
     2974                return; 
     2975        } 
     2976#endif 
     2977        kp = malloc(len); 
    29642978 
    29652979        if (!job_assumes(j, kp != NULL)) { 
     
    44654479{ 
    44664480        int mib[] = { CTL_KERN, KERN_PROC, KERN_PROC_ALL }; 
    4467         size_t i, kp_cnt = 0, kp_skipped = 0, len = 10*1024*1024; 
     4481        size_t i, kp_cnt = 0, kp_skipped = 0, len = sizeof(struct kinfo_proc) * get_kern_max_proc(); 
    44684482        struct kinfo_proc *kp; 
     4483 
     4484#if TARGET_OS_EMBEDDED 
     4485        if (!do_apple_internal_logging) { 
     4486                return; 
     4487        } 
     4488#endif 
    44694489 
    44704490        if (likely(jm->parentmgr || !pid1_magic)) { 
     
    69666986        } while ((returned == (sizeof(buf) / sizeof(buf[0]))) && (found > 0)); 
    69676987} 
     6988 
     6989size_t 
     6990get_kern_max_proc(void) 
     6991{ 
     6992        int mib[] = { CTL_KERN, KERN_MAXPROC }; 
     6993        int max = 100; 
     6994        size_t max_sz = sizeof(max); 
     6995         
     6996        launchd_assumes(sysctl(mib, 2, &max, &max_sz, NULL, 0) != -1); 
     6997         
     6998        return max; 
     6999}