Projects
Browse Source     Search     Timeline     Wiki

Changeset 23542

Show
Ignore:
Timestamp:
03/06/08 16:20:27 (9 months ago)
Author:
zarzycki@…
Message:

Misc.

Location:
trunk/launchd/src
Files:
4 modified

Legend:

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

    r23507 r23542  
    107107main(int argc, char *const *argv) 
    108108{ 
     109        const char *stdouterr_path = low_level_debug ? _PATH_CONSOLE : _PATH_DEVNULL; 
    109110        bool sflag = false; 
    110111        int ch; 
    111112 
    112113        testfd_or_openfd(STDIN_FILENO, _PATH_DEVNULL, O_RDONLY); 
    113         testfd_or_openfd(STDOUT_FILENO, _PATH_DEVNULL, O_WRONLY); 
    114         testfd_or_openfd(STDERR_FILENO, _PATH_DEVNULL, O_WRONLY); 
     114        testfd_or_openfd(STDOUT_FILENO, stdouterr_path, O_WRONLY); 
     115        testfd_or_openfd(STDERR_FILENO, stdouterr_path, O_WRONLY); 
    115116 
    116117        while ((ch = getopt(argc, argv, "s")) != -1) { 
  • trunk/launchd/src/launchd_runtime.c

    r23535 r23542  
    125125bool pid1_magic; 
    126126bool do_apple_internal_logging; 
     127bool low_level_debug; 
    127128 
    128129 
     
    136137 
    137138static int internal_mask_pri = LOG_UPTO(LOG_NOTICE); 
    138 //static int internal_mask_pri = LOG_UPTO(LOG_DEBUG); 
    139139 
    140140 
     
    12061206 
    12071207        vsnprintf(newmsg, sizeof(newmsg), message, args); 
     1208 
     1209        if (unlikely(low_level_debug)) { 
     1210                fprintf(stderr, "%s %u\t%s %u\t%s\n", attr->from_name, attr->from_pid, 
     1211                                attr->about_name, attr->about_pid, newmsg); 
     1212        } 
     1213 
    12081214        logmsg_add(attr, saved_errno, newmsg); 
    12091215} 
     
    16511657                do_apple_internal_logging = true; 
    16521658        } 
    1653 } 
     1659 
     1660        if (stat("/var/db/.debug_launchd", &sb) == 0) { 
     1661                internal_mask_pri = LOG_UPTO(LOG_DEBUG); 
     1662                low_level_debug = true; 
     1663        } 
     1664} 
  • trunk/launchd/src/launchd_runtime.h

    r23519 r23542  
    106106extern bool pid1_magic; 
    107107extern bool do_apple_internal_logging; 
     108extern bool low_level_debug; 
    108109 
    109110INTERNAL_ABI mach_port_t runtime_get_kernel_port(void); 
  • trunk/launchd/src/liblaunch.c

    r23462 r23542  
    733733} 
    734734 
    735 int launchd_msg_send(launch_t lh, launch_data_t d) 
     735int 
     736launchd_msg_send(launch_t lh, launch_data_t d) 
    736737{ 
    737738        struct launch_msg_header lmh; 
     
    949950} 
    950951 
    951 int launchd_msg_recv(launch_t lh, void (*cb)(launch_data_t, void *), void *context) 
     952int 
     953launchd_msg_recv(launch_t lh, void (*cb)(launch_data_t, void *), void *context) 
    952954{ 
    953955        struct cmsghdr *cm = alloca(4096);  
     
    10401042} 
    10411043 
    1042 launch_data_t launch_data_copy(launch_data_t o) 
     1044launch_data_t 
     1045launch_data_copy(launch_data_t o) 
    10431046{ 
    10441047        launch_data_t r = launch_data_alloc(o->type); 
     
    10911094} 
    10921095 
    1093 static int _fd(int fd) 
     1096int 
     1097_fd(int fd) 
    10941098{ 
    10951099        if (fd >= 0) 
     
    10981102} 
    10991103 
    1100 launch_data_t launch_data_new_errno(int e) 
     1104launch_data_t 
     1105launch_data_new_errno(int e) 
    11011106{ 
    11021107        launch_data_t r = launch_data_alloc(LAUNCH_DATA_ERRNO); 
     
    11081113} 
    11091114 
    1110 launch_data_t launch_data_new_fd(int fd) 
     1115launch_data_t 
     1116launch_data_new_fd(int fd) 
    11111117{ 
    11121118        launch_data_t r = launch_data_alloc(LAUNCH_DATA_FD); 
     
    11181124} 
    11191125 
    1120 launch_data_t launch_data_new_machport(mach_port_t p) 
     1126launch_data_t 
     1127launch_data_new_machport(mach_port_t p) 
    11211128{ 
    11221129        launch_data_t r = launch_data_alloc(LAUNCH_DATA_MACHPORT); 
     
    11281135} 
    11291136 
    1130 launch_data_t launch_data_new_integer(long long n) 
     1137launch_data_t 
     1138launch_data_new_integer(long long n) 
    11311139{ 
    11321140        launch_data_t r = launch_data_alloc(LAUNCH_DATA_INTEGER); 
     
    11381146} 
    11391147 
    1140 launch_data_t launch_data_new_bool(bool b) 
     1148launch_data_t 
     1149launch_data_new_bool(bool b) 
    11411150{ 
    11421151        launch_data_t r = launch_data_alloc(LAUNCH_DATA_BOOL); 
     
    11481157} 
    11491158 
    1150 launch_data_t launch_data_new_real(double d) 
     1159launch_data_t 
     1160launch_data_new_real(double d) 
    11511161{ 
    11521162        launch_data_t r = launch_data_alloc(LAUNCH_DATA_REAL); 
     
    11581168} 
    11591169 
    1160 launch_data_t launch_data_new_string(const char *s) 
     1170launch_data_t 
     1171launch_data_new_string(const char *s) 
    11611172{ 
    11621173        launch_data_t r = launch_data_alloc(LAUNCH_DATA_STRING); 
     
    11731184} 
    11741185 
    1175 launch_data_t launch_data_new_opaque(const void *o, size_t os) 
     1186launch_data_t 
     1187launch_data_new_opaque(const void *o, size_t os) 
    11761188{ 
    11771189        launch_data_t r = launch_data_alloc(LAUNCH_DATA_OPAQUE);