<!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>[23025] trunk/launchd/src</title>
</head>
<body>

<div id="msg">
<dl>
<dt>Revision</dt> <dd><a href="http://trac.macosforge.org/projects/launchd/changeset/23025">23025</a></dd>
<dt>Author</dt> <dd>zarzycki@apple.com</dd>
<dt>Date</dt> <dd>2007-01-28 13:15:53 -0800 (Sun, 28 Jan 2007)</dd>
</dl>

<h3>Log Message</h3>
<pre>The last remaining customer (loginwindow) of /etc/ttys has switched to launchd.

This is the easy part or removing init.c. The next stage will be to deal with
single-user-mode in launchd proper and clean up launchd's self-bootstrap logic.
Then we can finally delete init.c.</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#trunklaunchdsrcinitc">trunk/launchd/src/init.c</a></li>
<li><a href="#trunklaunchdsrclaunchctl1">trunk/launchd/src/launchctl.1</a></li>
<li><a href="#trunklaunchdsrclaunchctlc">trunk/launchd/src/launchctl.c</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_unix_ipcc">trunk/launchd/src/launchd_unix_ipc.c</a></li>
<li><a href="#trunklaunchdsrcliblaunch_privateh">trunk/launchd/src/liblaunch_private.h</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunklaunchdsrcinitc"></a>
<div class="modfile"><h4>Modified: trunk/launchd/src/init.c (23024 => 23025)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/launchd/src/init.c        2007-01-26 23:45:13 UTC (rev 23024)
+++ trunk/launchd/src/init.c        2007-01-28 21:15:53 UTC (rev 23025)
</span><span class="lines">@@ -55,10 +55,6 @@
</span><span class="cx"> 
</span><span class="cx"> static const char *const __rcs_file_version__ = &quot;$Revision$&quot;;
</span><span class="cx"> 
</span><del>-#include &lt;Security/Authorization.h&gt;
-#include &lt;Security/AuthorizationTags.h&gt;
-#include &lt;Security/AuthSession.h&gt;
-
</del><span class="cx"> #include &lt;sys/types.h&gt;
</span><span class="cx"> #include &lt;sys/queue.h&gt;
</span><span class="cx"> #include &lt;sys/param.h&gt;
</span><span class="lines">@@ -91,14 +87,7 @@
</span><span class="cx"> 
</span><span class="cx"> #define _PATH_RUNCOM            &quot;/etc/rc&quot;
</span><span class="cx"> 
</span><del>-/*
- * Sleep times; used to prevent thrashing.
- */
-#define        GETTY_SPACING                 5        /* N secs minimum getty spacing */
-#define        GETTY_SLEEP                30        /* sleep N secs after spacing problem */
</del><span class="cx"> #define        STALL_TIMEOUT                30        /* wait N secs after warning */
</span><del>-#define        DEATH_WATCH                10        /* wait N secs for procs to die */
-#define FAILED_HW_PASS                 5        /* wait N secs before croaking user */
</del><span class="cx"> 
</span><span class="cx"> static void stall(char *, ...);
</span><span class="cx"> 
</span><span class="lines">@@ -117,58 +106,8 @@
</span><span class="cx"> 
</span><span class="cx"> static void setctty(const char *, int);
</span><span class="cx"> 
</span><del>-// gvdl@next.com 14 Aug 1995
-//   - from ~apps/loginwindow_proj/loginwindow/common.h
-#define REALLY_EXIT_TO_CONSOLE                  229
-
-// From old init.c
-// These flags are used in the se_flags field of the init_session structure
-#define        SE_SHUTDOWN        0x1                /* session won't be restarted */
-
-// The flags below control what sort of getty is launched.
-#define SE_GETTY_LAUNCH        0x30        /* What type of getty to launch */ 
-#define SE_COMMON        0x00        /* Usual command that is run - getty */
-#define SE_ONERROR        0x10        /* Command to run if error condition occurs.
-                                 * This will almost always be the windowserver
-                                 * and loginwindow.  This is so if the w.s.
-                                 * ever dies, that the naive user (stan)
-                                 * doesn't ever see the console window. */
-#define SE_ONOPTION         0x20        /* Command to run when loginwindow exits with
-                                 * special error code (229).  This signifies
-                                 * that the user typed &quot;console&quot; at l.w. and
-                                 * l.w. wants to exit and have init run getty
-                                 * which will then put up a console window. */
-
-typedef struct _se_command {
-        char        *path;                /* what to run on that port */
-        char        **argv;                /* pre-parsed argument array */
-} se_cmd_t;
-
-typedef struct init_session {
-        kq_callback se_callback;        /* run loop callback */
-        int        se_index;                /* index of entry in ttys file */
-        pid_t        se_process;                /* controlling process */
-        time_t        se_started;                /* used to avoid thrashing */
-        int        se_flags;                /* status of session */
-        char        *se_device;                /* filename of port */
-        se_cmd_t se_getty;                /* what to run on that port */
-        se_cmd_t se_onerror;                /* See SE_ONERROR above */
-        se_cmd_t se_onoption;                /* See SE_ONOPTION above */
-        TAILQ_ENTRY(init_session) tqe;
-} *session_t;
-
-static TAILQ_HEAD(sessionshead, init_session) sessions = TAILQ_HEAD_INITIALIZER(sessions);
-
-static void session_new(int, struct ttyent *);
-static void session_free(session_t);
-static void session_launch(session_t);
-static void session_reap(session_t);
-static void session_callback(void *, struct kevent *);
-
-static char **construct_argv(char *);
</del><span class="cx"> static void setsecuritylevel(int);
</span><span class="cx"> static int getsecuritylevel(void);
</span><del>-static int setupargv(session_t, struct ttyent *);
</del><span class="cx"> static bool should_fsck(void);
</span><span class="cx"> 
</span><span class="cx"> void
</span><span class="lines">@@ -183,8 +122,6 @@
</span><span class="cx"> void
</span><span class="cx"> init_pre_kevent(void)
</span><span class="cx"> {
</span><del>-        session_t s;
-
</del><span class="cx">         if (single_user_pid || runcom_pid)
</span><span class="cx">                 return;
</span><span class="cx"> 
</span><span class="lines">@@ -200,16 +137,12 @@
</span><span class="cx">          * mode, and the run script has not set a higher level of security 
</span><span class="cx">          * than level 1, then put the kernel into secure mode.
</span><span class="cx">          */
</span><del>-        if (getsecuritylevel() == 0)
</del><ins>+        if (getsecuritylevel() == 0) {
</ins><span class="cx">                 setsecuritylevel(1);
</span><del>-
-        TAILQ_FOREACH(s, &amp;sessions, tqe) {
-                if (s-&gt;se_process == 0)
-                        session_launch(s);
</del><span class="cx">         }
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-static void
</del><ins>+void
</ins><span class="cx"> stall(char *message, ...)
</span><span class="cx"> {
</span><span class="cx">         va_list ap;
</span><span class="lines">@@ -220,7 +153,7 @@
</span><span class="cx">         sleep(STALL_TIMEOUT);
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-static int
</del><ins>+int
</ins><span class="cx"> getsecuritylevel(void)
</span><span class="cx"> {
</span><span class="cx">         int name[2], curlevel;
</span><span class="lines">@@ -236,7 +169,7 @@
</span><span class="cx">         return curlevel;
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-static void
</del><ins>+void
</ins><span class="cx"> setsecuritylevel(int newlevel)
</span><span class="cx"> {
</span><span class="cx">         int name[2], curlevel;
</span><span class="lines">@@ -259,7 +192,7 @@
</span><span class="cx">  * Start a session and allocate a controlling terminal.
</span><span class="cx">  * Only called by children of init after forking.
</span><span class="cx">  */
</span><del>-static void
</del><ins>+void
</ins><span class="cx"> setctty(const char *name, int flags)
</span><span class="cx"> {
</span><span class="cx">         int fd;
</span><span class="lines">@@ -275,7 +208,7 @@
</span><span class="cx">         }
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-static void
</del><ins>+void
</ins><span class="cx"> single_user(void)
</span><span class="cx"> {
</span><span class="cx">         bool runcom_fsck = should_fsck();
</span><span class="lines">@@ -315,7 +248,7 @@
</span><span class="cx">         }
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-static void
</del><ins>+void
</ins><span class="cx"> single_user_callback(void *obj __attribute__((unused)), struct kevent *kev __attribute__((unused)))
</span><span class="cx"> {
</span><span class="cx">         int status;
</span><span class="lines">@@ -338,10 +271,11 @@
</span><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> static struct timeval runcom_start_tv = { 0, 0 };
</span><ins>+
</ins><span class="cx"> /*
</span><span class="cx">  * Run the system startup script.
</span><span class="cx">  */
</span><del>-static void
</del><ins>+void
</ins><span class="cx"> runcom(void)
</span><span class="cx"> {
</span><span class="cx">         char *argv[] = { &quot;/bin/launchctl&quot;, &quot;bootstrap&quot;, NULL };
</span><span class="lines">@@ -389,7 +323,7 @@
</span><span class="cx">         exit(EXIT_FAILURE);
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-static void
</del><ins>+void
</ins><span class="cx"> runcom_callback(void *obj __attribute__((unused)), struct kevent *kev __attribute__((unused)))
</span><span class="cx"> {
</span><span class="cx">         int status;
</span><span class="lines">@@ -421,323 +355,9 @@
</span><span class="cx">         single_user_mode = true;
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-/*
- * Construct an argument vector from a command line.
- */
-char **
-construct_argv(command)
-        char *command;
</del><ins>+bool
+init_check_pid(pid_t p)
</ins><span class="cx"> {
</span><del>-        int argc = 0;
-        char **argv = (char **) malloc(((strlen(command) + 1) / 2 + 1)
-                                                * sizeof (char *));
-        static const char separators[] = &quot; \t&quot;;
-
-        if ((argv[argc++] = strtok(command, separators)) == 0)
-                return 0;
-        while ((argv[argc++] = strtok(NULL, separators)))
-                continue;
-        return argv;
-}
-
-/*
- * Deallocate a session descriptor.
- */
-
-static void free_command(se_cmd_t *se_cmd)
-{
-    if (se_cmd-&gt;path) {
-        free(se_cmd-&gt;path);
-        free(se_cmd-&gt;argv);
-    }
-}
-
-void
-session_free(session_t s)
-{
-        TAILQ_REMOVE(&amp;sessions, s, tqe);
-        if (s-&gt;se_process) {
-                if (kevent_mod(s-&gt;se_process, EVFILT_PROC, EV_ADD, 
-                                        NOTE_EXIT, 0, &amp;kqsimple_zombie_reaper) == -1)
-                        session_reap(s);
-                else
-                        kill(s-&gt;se_process, SIGHUP);
-        }
-        free(s-&gt;se_device);
-        free_command(&amp;s-&gt;se_getty);
-        free_command(&amp;s-&gt;se_onerror);
-        free_command(&amp;s-&gt;se_onoption);
-        free(s);
-}
-
-static int setup_command(se_cmd_t *se_cmd, char *command, char *arg )
-{
-        char *commandWithArg;
-
-        asprintf(&amp;commandWithArg, &quot;%s %s&quot;, command, arg);
-
-        free_command(se_cmd);
-
-        se_cmd-&gt;path = commandWithArg;
-        se_cmd-&gt;argv = construct_argv(commandWithArg);
-        if (se_cmd-&gt;argv == NULL) {
-                free(se_cmd-&gt;path);
-                se_cmd-&gt;path = NULL;
-                return 0;
-        }
-        return 1;
-}
-
-/*
- * Calculate getty and if useful window argv vectors.
- */
-static int
-setupargv(sp, typ)
-        session_t sp;
-        struct ttyent *typ;
-{
-    char *type;
-
-    if ( !setup_command(&amp;sp-&gt;se_getty, typ-&gt;ty_getty, typ-&gt;ty_name) )
-    {
-        type = &quot;getty&quot;;
-        goto bad_args;
-    }
-
-    if (typ-&gt;ty_onerror
-    &amp;&amp; !setup_command(&amp;sp-&gt;se_onerror, typ-&gt;ty_onerror, typ-&gt;ty_name) )
-    {
-        type = &quot;onerror&quot;;
-        goto bad_args;
-    }
-
-    if (typ-&gt;ty_onoption
-    &amp;&amp; !setup_command(&amp;sp-&gt;se_onoption, typ-&gt;ty_onoption, typ-&gt;ty_name) )
-    {
-        type = &quot;onoption&quot;;
-        goto bad_args;
-    }
-
-    return 1;
-
-bad_args:
-    syslog(LOG_WARNING, &quot;can't parse %s for port %s&quot;, type, sp-&gt;se_device);
-    return 0;
-}
-
-
-/*
- * Allocate a new session descriptor.
- */
-void
-session_new(session_index, typ)
-        int session_index;
-        struct ttyent *typ;
-{
-        session_t s;
-
-        if ((typ-&gt;ty_status &amp; TTY_ON) == 0 ||
-            typ-&gt;ty_name == 0 ||
-            typ-&gt;ty_getty == 0)
-                return;
-
-        s = calloc(1, sizeof(struct init_session));
-
-        s-&gt;se_callback = session_callback;
-        s-&gt;se_index = session_index;
-
-        TAILQ_INSERT_TAIL(&amp;sessions, s, tqe);
-
-        asprintf(&amp;s-&gt;se_device, &quot;%s%s&quot;, _PATH_DEV, typ-&gt;ty_name);
-
-        if (setupargv(s, typ) == 0)
-                session_free(s);
-}
-
-static void
-session_launch(session_t s)
-{
-        pid_t pid;
-        sigset_t mask;
-        se_cmd_t *se_cmd;
-        const char *session_type = NULL;
-        time_t current_time      = time(NULL);
-        bool is_loginwindow = false;
-
-        // Setup the default values;
-        switch (s-&gt;se_flags &amp; SE_GETTY_LAUNCH) {
-        case SE_ONOPTION:
-                if (s-&gt;se_onoption.path) {
-                        se_cmd       = &amp;s-&gt;se_onoption;
-                        session_type = &quot;onoption&quot;;
-                        break;
-                }
-                /* No break */
-        case SE_ONERROR:
-                if (s-&gt;se_onerror.path) {
-                        se_cmd       = &amp;s-&gt;se_onerror;
-                        session_type = &quot;onerror&quot;;
-                        break;
-                }
-                /* No break */
-        case SE_COMMON:
-        default:
-                se_cmd       = &amp;s-&gt;se_getty;
-                session_type = &quot;getty&quot;;
-                break;
-        }
-
-        if (strcmp(se_cmd-&gt;argv[0], &quot;/System/Library/CoreServices/loginwindow.app/Contents/MacOS/loginwindow&quot;) == 0)
-                is_loginwindow = true;
-
-        pid = launchd_fork();
-
-        if (pid == -1) {
-                syslog(LOG_ERR, &quot;can't fork for %s on port %s: %m&quot;,
-                                session_type, s-&gt;se_device);
-                return;
-        }
-
-        if (pid) {
-                s-&gt;se_process = pid;
-                s-&gt;se_started = time(NULL);
-                s-&gt;se_flags  &amp;= ~SE_GETTY_LAUNCH; // clear down getty launch type
-                if (kevent_mod(pid, EVFILT_PROC, EV_ADD, NOTE_EXIT, 0, &amp;s-&gt;se_callback) == -1)
-                        session_reap(s);
-                return;
-        }
-
-        if (current_time &gt; s-&gt;se_started &amp;&amp;
-            current_time - s-&gt;se_started &lt; GETTY_SPACING) {
-                syslog(LOG_WARNING, &quot;%s repeating too quickly on port %s, sleeping&quot;,
-                        session_type, s-&gt;se_device);
-                sleep(GETTY_SLEEP);
-        }
-
-        sigemptyset(&amp;mask);
-        sigprocmask(SIG_SETMASK, &amp;mask, NULL);
-
-
-        if (!is_loginwindow)
-                launchd_SessionCreate();
-
-        execv(se_cmd-&gt;argv[0], se_cmd-&gt;argv);
-        stall(&quot;can't exec %s '%s' for port %s: %m&quot;, session_type,
-                se_cmd-&gt;argv[0], s-&gt;se_device);
-        exit(EXIT_FAILURE);
-}
-
-static void
-session_callback(void *obj, struct kevent *kev __attribute__((unused)))
-{
-        session_t s = obj;
-
-        session_reap(s);
-        if (s-&gt;se_flags &amp; SE_SHUTDOWN) {
-                session_free(s);
-        } else {
-                session_launch(s);
-        }
-}
-
-static void
-session_reap(session_t s)
-{
-        char *line;
-        int status;
-
-        if (!launchd_assumes(waitpid(s-&gt;se_process, &amp;status, 0) == s-&gt;se_process))
-                return;
-
-        if (WIFSIGNALED(status)) {
-                syslog(LOG_WARNING, &quot;%s port %s exited abnormally: %s&quot;,
-                                s-&gt;se_getty.path, s-&gt;se_device, strsignal(WTERMSIG(status)));
-                s-&gt;se_flags |= SE_ONERROR; 
-        } else if (WEXITSTATUS(status) == REALLY_EXIT_TO_CONSOLE) {
-                /* WIFEXITED(status) assumed */
-                s-&gt;se_flags |= SE_ONOPTION;
-        } else {
-                s-&gt;se_flags |= SE_ONERROR;
-        }
-
-        s-&gt;se_process = 0;
-        line = s-&gt;se_device + sizeof(_PATH_DEV) - 1;
-
-        if (logout(line))
-                logwtmp(line, &quot;&quot;, &quot;&quot;);
-}
-
-/*
- * This is an n-squared algorithm.  We hope it isn't run often...
- */
-void
-update_ttys(void)
-{
-        session_t sp;
-        struct ttyent *typ;
-        int session_index = 0;
-        int devlen;
-
-        devlen = sizeof(_PATH_DEV) - 1;
-        while ((typ = getttyent())) {
-                ++session_index;
-
-                TAILQ_FOREACH(sp, &amp;sessions, tqe) {
-                        if (strcmp(typ-&gt;ty_name, sp-&gt;se_device + devlen) == 0)
-                                break;
-                }
-
-                if (sp == NULL) {
-                        session_new(session_index, typ);
-                        continue;
-                }
-
-                if (sp-&gt;se_index != session_index) {
-                        syslog(LOG_INFO, &quot;port %s changed utmp index from %d to %d&quot;,
-                               sp-&gt;se_device, sp-&gt;se_index,
-                               session_index);
-                        sp-&gt;se_index = session_index;
-                }
-
-                if ((typ-&gt;ty_status &amp; TTY_ON) == 0 ||
-                    typ-&gt;ty_getty == 0) {
-                        session_free(sp);
-                        continue;
-                }
-
-                sp-&gt;se_flags &amp;= ~SE_SHUTDOWN;
-
-                if (setupargv(sp, typ) == 0) {
-                        syslog(LOG_WARNING, &quot;can't parse getty for port %s&quot;,
-                                sp-&gt;se_device);
-                        session_free(sp);
-                }
-        }
-
-        endttyent();
-}
-
-/*
- * Block further logins.
- */
-void
-catatonia(void)
-{
-        session_t s;
-
-        TAILQ_FOREACH(s, &amp;sessions, tqe)
-                s-&gt;se_flags |= SE_SHUTDOWN;
-}
-
-bool init_check_pid(pid_t p)
-{
-        session_t s;
-
-        TAILQ_FOREACH(s, &amp;sessions, tqe) {
-                if (s-&gt;se_process == p)
-                        return true;
-        }
-
</del><span class="cx">         if (single_user_pid == p)
</span><span class="cx">                 return true;
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunklaunchdsrclaunchctl1"></a>
<div class="modfile"><h4>Modified: trunk/launchd/src/launchctl.1 (23024 => 23025)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/launchd/src/launchctl.1        2007-01-26 23:45:13 UTC (rev 23024)
+++ trunk/launchd/src/launchctl.1        2007-01-28 21:15:53 UTC (rev 23025)
</span><span class="lines">@@ -140,10 +140,6 @@
</span><span class="cx"> Tell
</span><span class="cx"> .Nm launchd
</span><span class="cx"> to prepare for shutdown by removing all jobs.
</span><del>-.It Ar reloadttys
-Tell
-.Nm launchd
-to reread /etc/ttys. This option may go away in a future release.
</del><span class="cx"> .It Ar umask Op Ar newmask
</span><span class="cx"> Get or optionally set the
</span><span class="cx"> .Xr umask 2
</span></span></pre></div>
<a id="trunklaunchdsrclaunchctlc"></a>
<div class="modfile"><h4>Modified: trunk/launchd/src/launchctl.c (23024 => 23025)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/launchd/src/launchctl.c        2007-01-26 23:45:13 UTC (rev 23024)
+++ trunk/launchd/src/launchctl.c        2007-01-28 21:15:53 UTC (rev 23025)
</span><span class="lines">@@ -134,7 +134,6 @@
</span><span class="cx"> static void empty_dir(const char *thedir, struct stat *psb);
</span><span class="cx"> static int touch_file(const char *path, mode_t m);
</span><span class="cx"> static void do_sysversion_sysctl(void);
</span><del>-static void workaround4465949(void);
</del><span class="cx"> static void do_application_firewall_magic(int sfd, launch_data_t thejob);
</span><span class="cx"> static void preheat_page_cache_hack(void);
</span><span class="cx"> static void do_bootroot_magic(void);
</span><span class="lines">@@ -185,7 +184,6 @@
</span><span class="cx">         { &quot;stderr&quot;,        stdio_cmd,                &quot;Redirect launchd's standard error to the given path&quot; },
</span><span class="cx">         { &quot;shutdown&quot;,        fyi_cmd,                &quot;Prepare for system shutdown&quot; },
</span><span class="cx">         { &quot;singleuser&quot;,        fyi_cmd,                &quot;Switch to single-user mode&quot; },
</span><del>-        { &quot;reloadttys&quot;,        fyi_cmd,                &quot;Reload /etc/ttys&quot; },
</del><span class="cx">         { &quot;getrusage&quot;,        getrusage_cmd,                &quot;Get resource usage statistics from launchd&quot; },
</span><span class="cx">         { &quot;log&quot;,        logupdate_cmd,                &quot;Adjust the logging level or mask of launchd&quot; },
</span><span class="cx">         { &quot;umask&quot;,        umask_cmd,                &quot;Change launchd's umask&quot; },
</span><span class="lines">@@ -1279,8 +1277,6 @@
</span><span class="cx">         const char *SystemStarter_tool[] = { &quot;SystemStarter&quot;, NULL };
</span><span class="cx">         assumes(fwexec(SystemStarter_tool, false) != -1);
</span><span class="cx"> 
</span><del>-        workaround4465949();
-
</del><span class="cx">         if (path_check(&quot;/etc/rc.local&quot;)) {
</span><span class="cx">                 const char *rc_local_tool[] = { _PATH_BSHELL, &quot;/etc/rc.local&quot;, NULL };
</span><span class="cx">                 assumes(fwexec(rc_local_tool, false) != -1);
</span><span class="lines">@@ -1289,32 +1285,6 @@
</span><span class="cx">         return 0;
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-void
-workaround4465949(void)
-{
-        const char *pbs_tool[] = { &quot;/System/Library/CoreServices/pbs&quot;, NULL };
-        const char *lca_tool[] = { &quot;/System/Library/CoreServices/Language Chooser.app/Contents/MacOS/Language Chooser&quot;, NULL};
-        char *const reloadttys_argv[] = { &quot;reloadttys&quot;, NULL };
-        int wstatus;
-        pid_t pbs_p;
-
-        if (path_check(&quot;/System/Library/LaunchDaemons/com.apple.loginwindow.plist&quot;)) {
-                return;
-        }
-
-        if (path_check(pbs_tool[0]) &amp;&amp; path_check(lca_tool[0]) &amp;&amp;
-                        !path_check(&quot;/var/db/.AppleSetupDone&quot;) &amp;&amp;
-                        path_check(&quot;/var/db/.RunLanguageChooserToo&quot;)) {
-                if (assumes((pbs_p = fwexec(pbs_tool, false)) != -1)) {
-                        assumes(fwexec(lca_tool, true) != -1);
-                        assumes(kill(pbs_p, SIGTERM) != -1);
-                        assumes(waitpid(pbs_p, &amp;wstatus, 0) != -1);
-                }
-        }
-
-        assumes(fyi_cmd(1, reloadttys_argv) == 0);
-}
-
</del><span class="cx"> int
</span><span class="cx"> load_and_unload_cmd(int argc, char *const argv[])
</span><span class="cx"> {
</span><span class="lines">@@ -1763,7 +1733,7 @@
</span><span class="cx"> fyi_cmd(int argc, char *const argv[])
</span><span class="cx"> {
</span><span class="cx">         launch_data_t resp, msg;
</span><del>-        const char *lmsgk = LAUNCH_KEY_RELOADTTYS;
</del><ins>+        const char *lmsgk = NULL;
</ins><span class="cx">         int e, r = 0;
</span><span class="cx"> 
</span><span class="cx">         if (argc != 1) {
</span><span class="lines">@@ -1775,6 +1745,8 @@
</span><span class="cx">                 lmsgk = LAUNCH_KEY_SHUTDOWN;
</span><span class="cx">         } else if (!strcmp(argv[0], &quot;singleuser&quot;)) {
</span><span class="cx">                 lmsgk = LAUNCH_KEY_SINGLEUSER;
</span><ins>+        } else {
+                return 1;
</ins><span class="cx">         }
</span><span class="cx"> 
</span><span class="cx">         msg = launch_data_new_string(lmsgk);
</span></span></pre></div>
<a id="trunklaunchdsrclaunchdc"></a>
<div class="modfile"><h4>Modified: trunk/launchd/src/launchd.c (23024 => 23025)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/launchd/src/launchd.c        2007-01-26 23:45:13 UTC (rev 23024)
+++ trunk/launchd/src/launchd.c        2007-01-28 21:15:53 UTC (rev 23025)
</span><span class="lines">@@ -469,10 +469,6 @@
</span><span class="cx">         rlcj = NULL;
</span><span class="cx"> 
</span><span class="cx">         jobmgr_remove_all_inactive(root_jobmgr);
</span><del>-
-        if (getpid() == 1) {
-                catatonia();
-        }
</del><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> void
</span></span></pre></div>
<a id="trunklaunchdsrclaunchdh"></a>
<div class="modfile"><h4>Modified: trunk/launchd/src/launchd.h (23024 => 23025)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/launchd/src/launchd.h        2007-01-26 23:45:13 UTC (rev 23024)
+++ trunk/launchd/src/launchd.h        2007-01-28 21:15:53 UTC (rev 23025)
</span><span class="lines">@@ -55,9 +55,6 @@
</span><span class="cx"> void init_boot(bool sflag);
</span><span class="cx"> void init_pre_kevent(void);
</span><span class="cx"> 
</span><del>-void update_ttys(void);
-void catatonia(void);
-
</del><span class="cx"> void mach_start_shutdown(void);
</span><span class="cx"> void mach_init_init(mach_port_t);
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunklaunchdsrclaunchd_unix_ipcc"></a>
<div class="modfile"><h4>Modified: trunk/launchd/src/launchd_unix_ipc.c (23024 => 23025)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/launchd/src/launchd_unix_ipc.c        2007-01-26 23:45:13 UTC (rev 23024)
+++ trunk/launchd/src/launchd_unix_ipc.c        2007-01-28 21:15:53 UTC (rev 23025)
</span><span class="lines">@@ -352,9 +352,6 @@
</span><span class="cx">                         } else {
</span><span class="cx">                                 resp = launch_data_new_errno(EACCES);
</span><span class="cx">                         }
</span><del>-                } else if (!strcmp(cmd, LAUNCH_KEY_RELOADTTYS)) {
-                        update_ttys();
-                        resp = launch_data_new_errno(0);
</del><span class="cx">                 } else if (!strcmp(cmd, LAUNCH_KEY_SHUTDOWN)) {
</span><span class="cx">                         launchd_shutdown();
</span><span class="cx">                         resp = launch_data_new_errno(0);
</span></span></pre></div>
<a id="trunklaunchdsrcliblaunch_privateh"></a>
<div class="modfile"><h4>Modified: trunk/launchd/src/liblaunch_private.h (23024 => 23025)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/launchd/src/liblaunch_private.h        2007-01-26 23:45:13 UTC (rev 23024)
+++ trunk/launchd/src/liblaunch_private.h        2007-01-28 21:15:53 UTC (rev 23025)
</span><span class="lines">@@ -37,7 +37,6 @@
</span><span class="cx"> #define LAUNCH_KEY_SINGLEUSER                &quot;SingleUser&quot;
</span><span class="cx"> #define LAUNCH_KEY_GETRESOURCELIMITS        &quot;GetResourceLimits&quot;
</span><span class="cx"> #define LAUNCH_KEY_SETRESOURCELIMITS        &quot;SetResourceLimits&quot;
</span><del>-#define LAUNCH_KEY_RELOADTTYS                &quot;ReloadTTYS&quot;
</del><span class="cx"> #define LAUNCH_KEY_SETLOGMASK                &quot;SetLogMask&quot;
</span><span class="cx"> #define LAUNCH_KEY_GETLOGMASK                &quot;GetLogMask&quot;
</span><span class="cx"> #define LAUNCH_KEY_SETUMASK                &quot;SetUmask&quot;
</span></span></pre>
</div>
</div>

</body>
</html>