From source_changes at macosforge.org Wed Dec 2 16:21:06 2009 From: source_changes at macosforge.org (source_changes at macosforge.org) Date: Wed, 2 Dec 2009 16:21:06 -0800 (PST) Subject: [launchd-changes] [23962] branches/PR-7431992/ Message-ID: <20091203002106.D514B376091F@beta.macosforge.org> Revision: 23962 http://trac.macosforge.org/projects/launchd/changeset/23962 Author: dsorresso at apple.com Date: 2009-12-02 16:21:03 -0800 (Wed, 02 Dec 2009) Log Message: ----------- "Branch for PR-7431992 from https://svn.macosforge.org/repository/launchd/trunk" Added Paths: ----------- branches/PR-7431992/ Property changes on: branches/PR-7431992 ___________________________________________________________________ Added: svn:ignore + build Added: svn:mergeinfo + /branches/PR-5092682:23731-23742 /branches/PR-5898404:23681-23700 /branches/PR-5978442:23651-23701 /branches/PR-6132016:23719-23738 /branches/PR-6271234:23818-23822 /branches/PR-6562592:23812-23822 /branches/PR-6564965:23832-23851 /branches/PR-6589133:23810-23822 /branches/PR-6609410:23828 /branches/PR-7084138:23944-23955 /branches/PR-7178164:23935-23940 /branches/PR-7386864:23946-23957 -------------- next part -------------- An HTML attachment was scrubbed... URL: From source_changes at macosforge.org Wed Dec 2 17:39:39 2009 From: source_changes at macosforge.org (source_changes at macosforge.org) Date: Wed, 2 Dec 2009 17:39:39 -0800 (PST) Subject: [launchd-changes] [23963] branches/PR-7431992/launchd/src Message-ID: <20091203013940.976923765261@beta.macosforge.org> Revision: 23963 http://trac.macosforge.org/projects/launchd/changeset/23963 Author: dsorresso at apple.com Date: 2009-12-02 17:39:35 -0800 (Wed, 02 Dec 2009) Log Message: ----------- Hopeful fix for . Modified Paths: -------------- branches/PR-7431992/launchd/src/launchd_runtime.c branches/PR-7431992/launchd/src/launchd_runtime.h Modified: branches/PR-7431992/launchd/src/launchd_runtime.c =================================================================== --- branches/PR-7431992/launchd/src/launchd_runtime.c 2009-12-03 00:21:03 UTC (rev 23962) +++ branches/PR-7431992/launchd/src/launchd_runtime.c 2009-12-03 01:39:35 UTC (rev 23963) @@ -102,8 +102,8 @@ static struct ldcred ldc; static size_t runtime_busy_cnt; static size_t runtime_standby_cnt; +static size_t runtime_busy_time; - static STAILQ_HEAD(, logmsg_s) logmsg_queue = STAILQ_HEAD_INITIALIZER(logmsg_queue); static size_t logmsg_queue_sz; static size_t logmsg_queue_cnt; @@ -1579,7 +1579,9 @@ _vproc_transaction_begin(); #endif } + runtime_busy_cnt++; + runtime_remove_timer(); } void @@ -1595,7 +1597,9 @@ _vproc_transaction_end(); #endif } + runtime_busy_cnt--; + runtime_install_timer(); } void @@ -1620,6 +1624,22 @@ runtime_standby_cnt--; } +void +runtime_install_timer(void) +{ + if( !pid1_magic && runtime_busy_cnt == 0 ) { + launchd_assumes(kevent_mod((uintptr_t)&runtime_busy_time, EVFILT_TIMER, EV_ADD, NOTE_SECONDS, 30, NULL) != -1); + } +} + +void +runtime_remove_timer(void) +{ + if( !pid1_magic && runtime_busy_cnt > 0 ) { + launchd_assumes(kevent_mod((uintptr_t)&runtime_busy_time, EVFILT_TIMER, EV_DELETE, 0, 0, NULL) != -1); + } +} + kern_return_t catch_mach_exception_raise(mach_port_t exception_port __attribute__((unused)), mach_port_t thread, mach_port_t task, exception_type_t exception, mach_exception_data_t code, mach_msg_type_number_t codeCnt) Modified: branches/PR-7431992/launchd/src/launchd_runtime.h =================================================================== --- branches/PR-7431992/launchd/src/launchd_runtime.h 2009-12-03 00:21:03 UTC (rev 23962) +++ branches/PR-7431992/launchd/src/launchd_runtime.h 2009-12-03 01:39:35 UTC (rev 23963) @@ -118,6 +118,8 @@ void runtime_del_ref(void); void runtime_add_weak_ref(void); void runtime_del_weak_ref(void); +void runtime_install_timer(void); +void runtime_remove_timer(void); void launchd_runtime_init(void); void launchd_runtime_init2(void); -------------- next part -------------- An HTML attachment was scrubbed... URL: From source_changes at macosforge.org Wed Dec 2 18:13:33 2009 From: source_changes at macosforge.org (source_changes at macosforge.org) Date: Wed, 2 Dec 2009 18:13:33 -0800 (PST) Subject: [launchd-changes] [23964] branches/PR-7431992/launchd/src Message-ID: <20091203021334.612A83766147@beta.macosforge.org> Revision: 23964 http://trac.macosforge.org/projects/launchd/changeset/23964 Author: dsorresso at apple.com Date: 2009-12-02 18:13:30 -0800 (Wed, 02 Dec 2009) Log Message: ----------- Uh... yeah. Actually do something when the timer fires this time. Also, handle the case of anonymous jobs creating subsets. Those should have hard references now. Modified Paths: -------------- branches/PR-7431992/launchd/src/launchd_core_logic.c branches/PR-7431992/launchd/src/launchd_runtime.c branches/PR-7431992/launchd/src/launchd_runtime.h Modified: branches/PR-7431992/launchd/src/launchd_core_logic.c =================================================================== --- branches/PR-7431992/launchd/src/launchd_core_logic.c 2009-12-03 01:39:35 UTC (rev 23963) +++ branches/PR-7431992/launchd/src/launchd_core_logic.c 2009-12-03 02:13:30 UTC (rev 23964) @@ -547,7 +547,7 @@ clean_exit_timer_expired :1, /* The job was clean, received SIGKILL and failed to exit after LAUNCHD_CLEAN_KILL_TIMER seconds. */ embedded_special_privileges :1, /* The job runs as a non-root user on embedded but has select privileges of the root user. */ did_exec :1, /* The job exec(2)ed successfully. */ - migratory :1, /* The (anonymous) job called vprocmgr_switch_to_session(). */ + holds_ref :1, /* The (anonymous) job called vprocmgr_switch_to_session(). */ jetsam_properties :1; /* The job has Jetsam limits in place. */ mode_t mask; pid_t tracing_pid; @@ -668,6 +668,7 @@ bool g_shutdown_debugging = false; bool g_verbose_boot = false; bool g_embedded_privileged_action = false; +bool g_runtime_busy_time = false; void job_ignore(job_t j) @@ -2777,7 +2778,7 @@ if (j->anonymous) { total_anon_children--; - if( j->migratory ) { + if( j->holds_ref ) { runtime_del_ref(); } } else { @@ -3499,6 +3500,8 @@ jobmgr_still_alive_with_check(jm); } else if( kev->ident == (uintptr_t)&jm->reboot_flags ) { jobmgr_do_garbage_collection(jm); + } else if( kev->ident == (uintptr_t)&g_runtime_busy_time ) { + return launchd_shutdown(); } break; case EVFILT_VNODE: @@ -5573,8 +5576,8 @@ if( phase == JOBMGR_PHASE_HOPEFULLY_EXITS_FIRST && !ji->hopefully_exits_first ) { continue; } else if( phase == JOBMGR_PHASE_NORMAL ) { - if( ji->migratory ) { - /* If we're shutting down, release the hold migratory jobs + if( ji->holds_ref ) { + /* If we're shutting down, release the hold holds_ref jobs * have on us. */ job_remove(ji); @@ -8318,7 +8321,7 @@ } j->mgr = target_jm; - j->migratory = true; + j->holds_ref = true; *new_bsport = target_jm->jm_port; /* Anonymous jobs which move around are particularly interesting to us, so we want to @@ -8507,6 +8510,11 @@ *subsetportp = jmr->jm_port; jmr->properties |= BOOTSTRAP_PROPERTY_EXPLICITSUBSET; + if( j->anonymous ) { + j->holds_ref = true; + runtime_add_ref(); + } + job_log(j, LOG_DEBUG, "Job created a subset named \"%s\"", jmr->name); return BOOTSTRAP_SUCCESS; } Modified: branches/PR-7431992/launchd/src/launchd_runtime.c =================================================================== --- branches/PR-7431992/launchd/src/launchd_runtime.c 2009-12-03 01:39:35 UTC (rev 23963) +++ branches/PR-7431992/launchd/src/launchd_runtime.c 2009-12-03 02:13:30 UTC (rev 23964) @@ -102,7 +102,6 @@ static struct ldcred ldc; static size_t runtime_busy_cnt; static size_t runtime_standby_cnt; -static size_t runtime_busy_time; static STAILQ_HEAD(, logmsg_s) logmsg_queue = STAILQ_HEAD_INITIALIZER(logmsg_queue); static size_t logmsg_queue_sz; @@ -1628,7 +1627,7 @@ runtime_install_timer(void) { if( !pid1_magic && runtime_busy_cnt == 0 ) { - launchd_assumes(kevent_mod((uintptr_t)&runtime_busy_time, EVFILT_TIMER, EV_ADD, NOTE_SECONDS, 30, NULL) != -1); + launchd_assumes(kevent_mod((uintptr_t)&g_runtime_busy_time, EVFILT_TIMER, EV_ADD, NOTE_SECONDS, 30, root_jobmgr) != -1); } } @@ -1636,7 +1635,7 @@ runtime_remove_timer(void) { if( !pid1_magic && runtime_busy_cnt > 0 ) { - launchd_assumes(kevent_mod((uintptr_t)&runtime_busy_time, EVFILT_TIMER, EV_DELETE, 0, 0, NULL) != -1); + launchd_assumes(kevent_mod((uintptr_t)&g_runtime_busy_time, EVFILT_TIMER, EV_DELETE, 0, 0, NULL) != -1); } } Modified: branches/PR-7431992/launchd/src/launchd_runtime.h =================================================================== --- branches/PR-7431992/launchd/src/launchd_runtime.h 2009-12-03 01:39:35 UTC (rev 23963) +++ branches/PR-7431992/launchd/src/launchd_runtime.h 2009-12-03 02:13:30 UTC (rev 23964) @@ -108,6 +108,7 @@ extern bool g_log_per_user_shutdown; extern bool g_log_strict_usage; extern bool g_embedded_shutdown_log; +extern bool g_runtime_busy_time; extern int32_t g_sync_frequency; extern pid_t g_wsp; -------------- next part -------------- An HTML attachment was scrubbed... URL: