Projects
Browse Source     Search     Timeline     Wiki

Changeset 23045

Show
Ignore:
Timestamp:
02/08/07 10:04:06 (22 months ago)
Author:
zarzycki@…
Message:

Dead code deletion.

Location:
trunk/launchd/src
Files:
4 modified

Legend:

Unmodified
Added
Removed
  • trunk/launchd/src/launchd.8

    r20773 r23045  
    3838.Sh OPTIONS 
    3939.Bl -tag -width -indent 
    40 .It Fl d 
    41 Daemonize. Useful when passing a command to launchd on the command line. 
    4240.It Fl D 
    4341Debug. Prints syslog messages to stderr and adjusts logging via 
    4442.Xr syslog 3 
    4543to LOG_DEBUG. 
    46 .It Fl S Ar SessionType 
    47 Instruct launchd to which session type it is. 
    4844.El 
    4945.Sh OPTIONS WHEN RUN AS PID 1 
  • trunk/launchd/src/launchd.c

    r23042 r23045  
    8484 
    8585static void signal_callback(void *, struct kevent *); 
    86 static void ppidexit_callback(void); 
    8786static void debugshutdown_callback(void); 
    8887static void pfsystem_callback(void *, struct kevent *); 
    8988 
    9089static kq_callback kqsignal_callback = signal_callback; 
    91 static kq_callback kqppidexit_callback = (kq_callback)ppidexit_callback; 
    9290static kq_callback kqdebugshutdown_callback = (kq_callback)debugshutdown_callback; 
    9391static kq_callback kqpfsystem_callback = pfsystem_callback; 
     
    124122                SIGWINCH, SIGINFO, SIGUSR1, SIGUSR2 
    125123        }; 
    126         bool sflag = false, dflag = false, Dflag = false; 
     124        bool sflag = false, Dflag = false; 
    127125        char ldconf[PATH_MAX] = PID1LAUNCHD_CONF; 
    128126        const char *h = getenv("HOME"); 
    129         const char *session_type = NULL; 
    130127        const char *optargs = NULL; 
    131         job_t fbj = NULL; 
    132128        struct stat sb; 
    133129        size_t i, checkin_fdcnt = 0; 
    134130        int *checkin_fds = NULL; 
    135131        mach_port_t checkin_mport = MACH_PORT_NULL; 
    136         int ch, ker, logopts; 
     132        int ch, logopts; 
    137133 
    138134        testfd_or_openfd(STDIN_FILENO, _PATH_DEVNULL, O_RDONLY); 
     
    201197                optargs = "s"; 
    202198        } else { 
    203                 optargs = "DS:dh"; 
     199                optargs = "Dh"; 
    204200        } 
    205201 
    206202        while ((ch = getopt(argc, argv, optargs)) != -1) { 
    207203                switch (ch) { 
    208                 case 'S': session_type = optarg; break; /* what type of session we're creating */ 
    209204                case 'D': Dflag = true;   break;        /* debug */ 
    210                 case 'd': dflag = true;   break;        /* daemonize */ 
    211205                case 's': sflag = true;   break;        /* single user */ 
    212206                case 'h': usage(stdout);  break;        /* help */ 
     
    223217        /* main phase three: get the party started */ 
    224218 
    225         if (dflag) { 
    226                 launchd_assumes(daemon(0, 0) == 0); 
    227         } 
    228  
    229219        logopts = LOG_PID|LOG_CONS; 
    230220        if (Dflag) { 
     
    255245        launchd_assert(rlcj != NULL); 
    256246 
    257         if (argv[0]) { 
    258                 fbj = job_new(root_jobmgr, FIRSTBORN_LABEL, NULL, (const char *const *)argv, NULL); 
    259         } 
    260  
    261247        if (NULL == getenv("PATH")) { 
    262248                setenv("PATH", _PATH_STDPATH, 1); 
     
    270256 
    271257        monitor_networking_state(); 
    272  
    273         if (session_type) { 
    274                 pid_t pp = getppid(); 
    275  
    276                 /* As a per session launchd, we need to exit if our parent dies. 
    277                  * 
    278                  * Normally, in Unix, SIGHUP would cause us to exit, but we're a 
    279                  * daemon, and daemons use SIGHUP to signal the need to reread 
    280                  * configuration files. "Weee." 
    281                  */ 
    282  
    283                 if (pp == 1) { 
    284                         exit(EXIT_SUCCESS); 
    285                 } 
    286  
    287                 ker = kevent_mod(pp, EVFILT_PROC, EV_ADD, NOTE_EXIT, 0, &kqppidexit_callback); 
    288  
    289                 if (ker == -1) { 
    290                         exit(launchd_assumes(errno == ESRCH) ? EXIT_SUCCESS : EXIT_FAILURE); 
    291                 } 
    292         } 
    293258 
    294259        /* 
     
    303268        if (!h && stat(ldconf, &sb) == 0) { 
    304269                rlcj = job_dispatch(rlcj, true); 
    305         } 
    306  
    307         if (fbj) { 
    308                 fbj = job_dispatch(fbj, true); 
    309270        } 
    310271 
     
    432393 
    433394void 
    434 ppidexit_callback(void) 
    435 { 
    436         syslog(LOG_INFO, "Parent process exited"); 
    437  
    438         launchd_shutdown(); 
    439  
    440         /* Let's just bail for now. We should really try to wait for jobs to exit first. */ 
    441         exit(EXIT_SUCCESS); 
    442 } 
    443  
    444 void 
    445395launchd_shutdown(void) 
    446396{ 
  • trunk/launchd/src/launchd.h

    r23042 r23045  
    2727#include "launchd_runtime.h" 
    2828 
    29 #define FIRSTBORN_LABEL "com.apple.launchd.firstborn" 
    3029#define READCONF_LABEL "com.apple.launchd.readconfig" 
    3130 
  • trunk/launchd/src/launchd_core_logic.c

    r23042 r23045  
    264264        time_t min_run_time; 
    265265        unsigned int start_interval; 
    266         unsigned int checkedin:1, firstborn:1, debug:1, inetcompat:1, inetcompat_wait:1, 
     266        unsigned int checkedin:1, anonymous:1, debug:1, inetcompat:1, inetcompat_wait:1, 
    267267                     ondemand:1, session_create:1, low_pri_io:1, no_init_groups:1, priv_port_has_senders:1, 
    268                      importing_global_env:1, importing_hard_limits:1, setmask:1, legacy_mach_job:1, runatload:1, 
    269                      anonymous:1; 
     268                     importing_global_env:1, importing_hard_limits:1, setmask:1, legacy_mach_job:1, runatload:1; 
    270269        mode_t mask; 
    271270        unsigned int globargv:1, wait4debugger:1, unload_at_exit:1, stall_before_exec:1, only_once:1, 
     
    927926        j->ondemand = true; 
    928927        j->checkedin = true; 
    929         j->firstborn = (strcmp(label, FIRSTBORN_LABEL) == 0); 
    930928 
    931929        if (prog) { 
     
    17611759        case EVFILT_PROC: 
    17621760                job_reap(j); 
    1763  
    1764                 if (j->firstborn) { 
    1765                         job_log(j, LOG_DEBUG, "first born died, begin shutdown"); 
    1766                         launchd_shutdown(); 
    1767                 } else { 
    1768                         job_dispatch(j, false); 
    1769                 } 
     1761                job_dispatch(j, false); 
    17701762                break; 
    17711763        case EVFILT_TIMER: 
     
    18801872                /* wait for our parent to say they've attached a kevent to us */ 
    18811873                read(_fd(execspair[1]), &c, sizeof(c)); 
    1882                 if (j->firstborn) { 
    1883                         setpgid(getpid(), getpid()); 
    1884                         if (isatty(STDIN_FILENO)) { 
    1885                                 if (tcsetpgrp(STDIN_FILENO, getpid()) == -1) { 
    1886                                         job_log_error(j, LOG_WARNING, "tcsetpgrp()"); 
    1887                                 } 
    1888                         } 
    1889                 } 
    18901874 
    18911875                if (sipc) {