<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><meta http-equiv="content-type" content="text/html; charset=utf-8" /><style type="text/css"><!--
#msg dl { border: 1px #006 solid; background: #369; padding: 6px; color: #fff; }
#msg dt { float: left; width: 6em; font-weight: bold; }
#msg dt:after { content:':';}
#msg dl, #msg dt, #msg ul, #msg li, #header, #footer { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; }
#msg dl a { font-weight: bold}
#msg dl a:link { color:#fc3; }
#msg dl a:active { color:#ff0; }
#msg dl a:visited { color:#cc6; }
h3 { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; font-weight: bold; }
#msg pre { overflow: auto; background: #ffc; border: 1px #fc0 solid; padding: 6px; }
#msg ul, pre { overflow: auto; }
#header, #footer { color: #fff; background: #636; border: 1px #300 solid; padding: 6px; }
#patch { width: 100%; }
#patch h4 {font-family: verdana,arial,helvetica,sans-serif;font-size:10pt;padding:8px;background:#369;color:#fff;margin:0;}
#patch .propset h4, #patch .binary h4 {margin:0;}
#patch pre {padding:0;line-height:1.2em;margin:0;}
#patch .diff {width:100%;background:#eee;padding: 0 0 10px 0;overflow:auto;}
#patch .propset .diff, #patch .binary .diff {padding:10px 0;}
#patch span {display:block;padding:0 10px;}
#patch .modfile, #patch .addfile, #patch .delfile, #patch .propset, #patch .binary, #patch .copfile {border:1px solid #ccc;margin:10px 0;}
#patch ins {background:#dfd;text-decoration:none;display:block;padding:0 10px;}
#patch del {background:#fdd;text-decoration:none;display:block;padding:0 10px;}
#patch .lines, .info {color:#888;background:#fff;}
--></style>
<title>[23045] trunk/launchd/src</title>
</head>
<body>
<div id="msg">
<dl>
<dt>Revision</dt> <dd><a href="http://trac.macosforge.org/projects/launchd/changeset/23045">23045</a></dd>
<dt>Author</dt> <dd>zarzycki@apple.com</dd>
<dt>Date</dt> <dd>2007-02-08 10:04:06 -0800 (Thu, 08 Feb 2007)</dd>
</dl>
<h3>Log Message</h3>
<pre>Dead code deletion.</pre>
<h3>Modified Paths</h3>
<ul>
<li><a href="#trunklaunchdsrclaunchd8">trunk/launchd/src/launchd.8</a></li>
<li><a href="#trunklaunchdsrclaunchdc">trunk/launchd/src/launchd.c</a></li>
<li><a href="#trunklaunchdsrclaunchdh">trunk/launchd/src/launchd.h</a></li>
<li><a href="#trunklaunchdsrclaunchd_core_logicc">trunk/launchd/src/launchd_core_logic.c</a></li>
</ul>
</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunklaunchdsrclaunchd8"></a>
<div class="modfile"><h4>Modified: trunk/launchd/src/launchd.8 (23044 => 23045)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/launchd/src/launchd.8        2007-02-08 17:26:17 UTC (rev 23044)
+++ trunk/launchd/src/launchd.8        2007-02-08 18:04:06 UTC (rev 23045)
</span><span class="lines">@@ -37,14 +37,10 @@
</span><span class="cx"> is invoked by the kernel to run as the first process on the system and to further bootstrap the rest of the system.
</span><span class="cx"> .Sh OPTIONS
</span><span class="cx"> .Bl -tag -width -indent
</span><del>-.It Fl d
-Daemonize. Useful when passing a command to launchd on the command line.
</del><span class="cx"> .It Fl D
</span><span class="cx"> Debug. Prints syslog messages to stderr and adjusts logging via
</span><span class="cx"> .Xr syslog 3
</span><span class="cx"> to LOG_DEBUG.
</span><del>-.It Fl S Ar SessionType
-Instruct launchd to which session type it is.
</del><span class="cx"> .El
</span><span class="cx"> .Sh OPTIONS WHEN RUN AS PID 1
</span><span class="cx"> .Bl -tag -width -indent
</span></span></pre></div>
<a id="trunklaunchdsrclaunchdc"></a>
<div class="modfile"><h4>Modified: trunk/launchd/src/launchd.c (23044 => 23045)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/launchd/src/launchd.c        2007-02-08 17:26:17 UTC (rev 23044)
+++ trunk/launchd/src/launchd.c        2007-02-08 18:04:06 UTC (rev 23045)
</span><span class="lines">@@ -83,12 +83,10 @@
</span><span class="cx"> extern char **environ;
</span><span class="cx">
</span><span class="cx"> static void signal_callback(void *, struct kevent *);
</span><del>-static void ppidexit_callback(void);
</del><span class="cx"> static void debugshutdown_callback(void);
</span><span class="cx"> static void pfsystem_callback(void *, struct kevent *);
</span><span class="cx">
</span><span class="cx"> static kq_callback kqsignal_callback = signal_callback;
</span><del>-static kq_callback kqppidexit_callback = (kq_callback)ppidexit_callback;
</del><span class="cx"> static kq_callback kqdebugshutdown_callback = (kq_callback)debugshutdown_callback;
</span><span class="cx"> static kq_callback kqpfsystem_callback = pfsystem_callback;
</span><span class="cx">
</span><span class="lines">@@ -123,17 +121,15 @@
</span><span class="cx">                 SIGTTIN, SIGTTOU, SIGIO, SIGXCPU, SIGXFSZ, SIGVTALRM, SIGPROF,
</span><span class="cx">                 SIGWINCH, SIGINFO, SIGUSR1, SIGUSR2
</span><span class="cx">         };
</span><del>-        bool sflag = false, dflag = false, Dflag = false;
</del><ins>+        bool sflag = false, Dflag = false;
</ins><span class="cx">         char ldconf[PATH_MAX] = PID1LAUNCHD_CONF;
</span><span class="cx">         const char *h = getenv("HOME");
</span><del>-        const char *session_type = NULL;
</del><span class="cx">         const char *optargs = NULL;
</span><del>-        job_t fbj = NULL;
</del><span class="cx">         struct stat sb;
</span><span class="cx">         size_t i, checkin_fdcnt = 0;
</span><span class="cx">         int *checkin_fds = NULL;
</span><span class="cx">         mach_port_t checkin_mport = MACH_PORT_NULL;
</span><del>-        int ch, ker, logopts;
</del><ins>+        int ch, logopts;
</ins><span class="cx">
</span><span class="cx">         testfd_or_openfd(STDIN_FILENO, _PATH_DEVNULL, O_RDONLY);
</span><span class="cx">         testfd_or_openfd(STDOUT_FILENO, _PATH_DEVNULL, O_WRONLY);
</span><span class="lines">@@ -200,14 +196,12 @@
</span><span class="cx">         if (getpid() == 1) {
</span><span class="cx">                 optargs = "s";
</span><span class="cx">         } else {
</span><del>-                optargs = "DS:dh";
</del><ins>+                optargs = "Dh";
</ins><span class="cx">         }
</span><span class="cx">
</span><span class="cx">         while ((ch = getopt(argc, argv, optargs)) != -1) {
</span><span class="cx">                 switch (ch) {
</span><del>-                case 'S': session_type = optarg; break;        /* what type of session we're creating */
</del><span class="cx">                 case 'D': Dflag = true; break;        /* debug */
</span><del>-                case 'd': dflag = true; break;        /* daemonize */
</del><span class="cx">                 case 's': sflag = true; break;        /* single user */
</span><span class="cx">                 case 'h': usage(stdout); break;        /* help */
</span><span class="cx">                 case '?': /* we should do something with the global optopt variable here */
</span><span class="lines">@@ -222,10 +216,6 @@
</span><span class="cx">
</span><span class="cx">         /* main phase three: get the party started */
</span><span class="cx">
</span><del>-        if (dflag) {
-                launchd_assumes(daemon(0, 0) == 0);
-        }
-
</del><span class="cx">         logopts = LOG_PID|LOG_CONS;
</span><span class="cx">         if (Dflag) {
</span><span class="cx">                 logopts |= LOG_PERROR;
</span><span class="lines">@@ -254,10 +244,6 @@
</span><span class="cx">         rlcj = job_new(root_jobmgr, READCONF_LABEL, NULL, launchctl_bootstrap_tool, ldconf);
</span><span class="cx">         launchd_assert(rlcj != NULL);
</span><span class="cx">
</span><del>-        if (argv[0]) {
-                fbj = job_new(root_jobmgr, FIRSTBORN_LABEL, NULL, (const char *const *)argv, NULL);
-        }
-
</del><span class="cx">         if (NULL == getenv("PATH")) {
</span><span class="cx">                 setenv("PATH", _PATH_STDPATH, 1);
</span><span class="cx">         }
</span><span class="lines">@@ -270,27 +256,6 @@
</span><span class="cx">
</span><span class="cx">         monitor_networking_state();
</span><span class="cx">
</span><del>-        if (session_type) {
-                pid_t pp = getppid();
-
-                /* As a per session launchd, we need to exit if our parent dies.
-                 *
-                 * Normally, in Unix, SIGHUP would cause us to exit, but we're a
-                 * daemon, and daemons use SIGHUP to signal the need to reread
-                 * configuration files. "Weee."
-                 */
-
-                if (pp == 1) {
-                        exit(EXIT_SUCCESS);
-                }
-
-                ker = kevent_mod(pp, EVFILT_PROC, EV_ADD, NOTE_EXIT, 0, &kqppidexit_callback);
-
-                if (ker == -1) {
-                        exit(launchd_assumes(errno == ESRCH) ? EXIT_SUCCESS : EXIT_FAILURE);
-                }
-        }
-
</del><span class="cx">         /*
</span><span class="cx">          * We cannot stat() anything in the home directory right now.
</span><span class="cx">          *
</span><span class="lines">@@ -304,10 +269,6 @@
</span><span class="cx">                 rlcj = job_dispatch(rlcj, true);
</span><span class="cx">         }
</span><span class="cx">
</span><del>-        if (fbj) {
-                fbj = job_dispatch(fbj, true);
-        }
-
</del><span class="cx">         char *doom_why = "at instruction";
</span><span class="cx">         switch (setjmp(doom_doom_doom)) {
</span><span class="cx">                 case 0:
</span><span class="lines">@@ -431,17 +392,6 @@
</span><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> void
</span><del>-ppidexit_callback(void)
-{
-        syslog(LOG_INFO, "Parent process exited");
-
-        launchd_shutdown();
-
-        /* Let's just bail for now. We should really try to wait for jobs to exit first. */
-        exit(EXIT_SUCCESS);
-}
-
-void
</del><span class="cx"> launchd_shutdown(void)
</span><span class="cx"> {
</span><span class="cx">         if (shutdown_in_progress) {
</span></span></pre></div>
<a id="trunklaunchdsrclaunchdh"></a>
<div class="modfile"><h4>Modified: trunk/launchd/src/launchd.h (23044 => 23045)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/launchd/src/launchd.h        2007-02-08 17:26:17 UTC (rev 23044)
+++ trunk/launchd/src/launchd.h        2007-02-08 18:04:06 UTC (rev 23045)
</span><span class="lines">@@ -26,7 +26,6 @@
</span><span class="cx"> #include "libbootstrap_public.h"
</span><span class="cx"> #include "launchd_runtime.h"
</span><span class="cx">
</span><del>-#define FIRSTBORN_LABEL "com.apple.launchd.firstborn"
</del><span class="cx"> #define READCONF_LABEL "com.apple.launchd.readconfig"
</span><span class="cx">
</span><span class="cx"> struct kevent;
</span></span></pre></div>
<a id="trunklaunchdsrclaunchd_core_logicc"></a>
<div class="modfile"><h4>Modified: trunk/launchd/src/launchd_core_logic.c (23044 => 23045)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/launchd/src/launchd_core_logic.c        2007-02-08 17:26:17 UTC (rev 23044)
+++ trunk/launchd/src/launchd_core_logic.c        2007-02-08 18:04:06 UTC (rev 23045)
</span><span class="lines">@@ -263,10 +263,9 @@
</span><span class="cx">         time_t start_time;
</span><span class="cx">         time_t min_run_time;
</span><span class="cx">         unsigned int start_interval;
</span><del>-        unsigned int checkedin:1, firstborn:1, debug:1, inetcompat:1, inetcompat_wait:1,
</del><ins>+        unsigned int checkedin:1, anonymous:1, debug:1, inetcompat:1, inetcompat_wait:1,
</ins><span class="cx">                  ondemand:1, session_create:1, low_pri_io:1, no_init_groups:1, priv_port_has_senders:1,
</span><del>-                 importing_global_env:1, importing_hard_limits:1, setmask:1, legacy_mach_job:1, runatload:1,
-                 anonymous:1;
</del><ins>+                 importing_global_env:1, importing_hard_limits:1, setmask:1, legacy_mach_job:1, runatload:1;
</ins><span class="cx">         mode_t mask;
</span><span class="cx">         unsigned int globargv:1, wait4debugger:1, unload_at_exit:1, stall_before_exec:1, only_once:1,
</span><span class="cx">                  currently_ignored:1, forced_peers_to_demand_mode:1, setnice:1, hopefully_exits_last:1;
</span><span class="lines">@@ -926,7 +925,6 @@
</span><span class="cx">         j->currently_ignored = true;
</span><span class="cx">         j->ondemand = true;
</span><span class="cx">         j->checkedin = true;
</span><del>-        j->firstborn = (strcmp(label, FIRSTBORN_LABEL) == 0);
</del><span class="cx">
</span><span class="cx">         if (prog) {
</span><span class="cx">                 j->prog = strdup(prog);
</span><span class="lines">@@ -1760,13 +1758,7 @@
</span><span class="cx">         switch (kev->filter) {
</span><span class="cx">         case EVFILT_PROC:
</span><span class="cx">                 job_reap(j);
</span><del>-
-                if (j->firstborn) {
-                        job_log(j, LOG_DEBUG, "first born died, begin shutdown");
-                        launchd_shutdown();
-                } else {
-                        job_dispatch(j, false);
-                }
</del><ins>+                job_dispatch(j, false);
</ins><span class="cx">                 break;
</span><span class="cx">         case EVFILT_TIMER:
</span><span class="cx">                 if ((uintptr_t)j == kev->ident || (uintptr_t)&j->start_interval == kev->ident) {
</span><span class="lines">@@ -1879,14 +1871,6 @@
</span><span class="cx">                 job_assumes(j, close(execspair[0]) == 0);
</span><span class="cx">                 /* wait for our parent to say they've attached a kevent to us */
</span><span class="cx">                 read(_fd(execspair[1]), &c, sizeof(c));
</span><del>-                if (j->firstborn) {
-                        setpgid(getpid(), getpid());
-                        if (isatty(STDIN_FILENO)) {
-                                if (tcsetpgrp(STDIN_FILENO, getpid()) == -1) {
-                                        job_log_error(j, LOG_WARNING, "tcsetpgrp()");
-                                }
-                        }
-                }
</del><span class="cx">
</span><span class="cx">                 if (sipc) {
</span><span class="cx">                         job_assumes(j, close(spair[0]) == 0);
</span></span></pre>
</div>
</div>
</body>
</html>