From owner-p4-projects@FreeBSD.ORG Mon Aug 15 04:21:48 2005 Return-Path: X-Original-To: p4-projects@freebsd.org Delivered-To: p4-projects@freebsd.org Received: by hub.freebsd.org (Postfix, from userid 32767) id A8E4116A421; Mon, 15 Aug 2005 04:21:47 +0000 (GMT) X-Original-To: perforce@freebsd.org Delivered-To: perforce@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 6DFF416A41F for ; Mon, 15 Aug 2005 04:21:47 +0000 (GMT) (envelope-from soc-tyler@freebsd.org) Received: from repoman.freebsd.org (repoman.freebsd.org [216.136.204.115]) by mx1.FreeBSD.org (Postfix) with ESMTP id 3139E43D45 for ; Mon, 15 Aug 2005 04:21:47 +0000 (GMT) (envelope-from soc-tyler@freebsd.org) Received: from repoman.freebsd.org (localhost [127.0.0.1]) by repoman.freebsd.org (8.13.1/8.13.1) with ESMTP id j7F4LlgQ010642 for ; Mon, 15 Aug 2005 04:21:47 GMT (envelope-from soc-tyler@freebsd.org) Received: (from perforce@localhost) by repoman.freebsd.org (8.13.1/8.13.1/Submit) id j7F4LkMu010639 for perforce@freebsd.org; Mon, 15 Aug 2005 04:21:46 GMT (envelope-from soc-tyler@freebsd.org) Date: Mon, 15 Aug 2005 04:21:46 GMT Message-Id: <200508150421.j7F4LkMu010639@repoman.freebsd.org> X-Authentication-Warning: repoman.freebsd.org: perforce set sender to soc-tyler@freebsd.org using -f From: soc-tyler To: Perforce Change Reviews Cc: Subject: PERFORCE change 82010 for review X-BeenThere: p4-projects@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: p4 projects tree changes List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 15 Aug 2005 04:21:48 -0000 http://perforce.freebsd.org/chv.cgi?CH=82010 Change 82010 by soc-tyler@soc-tyler_launchd on 2005/08/15 04:21:32 i figure I might as well submit some of my minor/trivial changes while I continue to debug this sucker. I am totally losing the "most p4 submissions" contest to cdjones; why doesnt `set follow-fork-mode child` work in gdb on FreeBSD? Affected files ... .. //depot/projects/soc2005/launchd/includes/launch.h#8 edit .. //depot/projects/soc2005/launchd/launchctl/launchctl.c#6 edit .. //depot/projects/soc2005/launchd/launchd.c#11 edit .. //depot/projects/soc2005/launchd/liblaunch.c#4 edit Differences ... ==== //depot/projects/soc2005/launchd/includes/launch.h#8 (text+ko) ==== @@ -88,13 +88,20 @@ #define LAUNCH_JOBKEY_PID "PID" #define LAUNCH_JOBKEY_UMASK "Umask" #define LAUNCH_JOBKEY_NICE "Nice" + // FreeBSD's sysctl() interface doesn't allow per-process attributes :/ #ifdef _BUILD_DARWIN_ #define LAUNCH_JOBKEY_LOWPRIORITYIO "LowPriorityIO" #endif + #define LAUNCH_JOBKEY_SESSIONCREATE "SessionCreate" #define LAUNCH_JOBKEY_SOFTRESOURCELIMITS "SoftResourceLimits" #define LAUNCH_JOBKEY_HARDRESOURCELIMITS "HardResourceLimits" +/* + * sipc = job_get_bool(j->ldj, LAUNCH_JOBKEY_SERVICEIPC); + * job_get_bool (j=0x0, key=0x4f ) + at launchd.c:687 + */ #define LAUNCH_JOBKEY_SERVICEIPC "ServiceIPC" #define LAUNCH_JOBKEY_STANDARDOUTPATH "StandardOutPath" #define LAUNCH_JOBKEY_STANDARDERRORPATH "StandardErrorPath" ==== //depot/projects/soc2005/launchd/launchctl/launchctl.c#6 (text+ko) ==== @@ -128,6 +128,7 @@ static int getrusage_cmd(int argc, char *const argv[]); static int help_cmd(int argc, char *const argv[]); +static int exit_cmd(int argc, char *const argv[]); static const struct { const char *name; @@ -153,6 +154,7 @@ { "log", logupdate_cmd, "Adjust the logging level or mask of launchd" }, { "umask", umask_cmd, "Change launchd's umask" }, { "help", help_cmd, "This help output" }, + {"exit", exit_cmd, "Exit launchctl" }, }; int main(int argc, char *const argv[]) @@ -870,6 +872,12 @@ return 0; } +static int exit_cmd(int argc, char *const argv[]) { + exit(0); + + return 0; // god help us if we get here ;) +} + static int _fd(int fd) { if (fd >= 0) ==== //depot/projects/soc2005/launchd/launchd.c#11 (text+ko) ==== @@ -252,8 +252,7 @@ static char *pending_stdout = NULL; static char *pending_stderr = NULL; -int main(int argc, char *argv[]) -{ +int main(int argc, char *argv[]) { static const int sigigns[] = { SIGHUP, SIGINT, SIGPIPE, SIGALRM, SIGTERM, SIGURG, SIGTSTP, SIGTSTP, SIGCONT, /*SIGCHLD,*/ SIGTTIN, SIGTTOU, SIGIO, SIGXCPU, SIGXFSZ, SIGVTALRM, SIGPROF, @@ -555,7 +554,6 @@ goto out_bad; } } else { - // XXX: launchd[12139]: mkdir("/var/launchd/1001"): Permission denied syslog(LOG_ERR, "mkdir(\"%s\"): %m", LAUNCHD_SOCK_PREFIX); goto out_bad; } @@ -1680,6 +1678,7 @@ job_ignore(j); break; case 0: + /* child */ close(execspair[0]); /* wait for our parent to say they've attached a kevent to us */ read(_fd(execspair[1]), &c, sizeof(c)); @@ -1699,6 +1698,7 @@ job_start_child(j, execspair[1]); break; default: + /* parent */ close(execspair[1]); j->execfd = _fd(execspair[0]); if (sipc) { @@ -2180,6 +2180,11 @@ TAILQ_FIRST(&jobs)->firstborn = true; } +//! Setup the loopback device +/*! For performance and networking reasons, we are setting up the + * loopback device from inside launchd(8), making it easy to start + * network related daemons before the kernel actually brings up networking + */ static void loopback_setup(void) { struct ifaliasreq ifra; @@ -2247,7 +2252,9 @@ close(s); close(s6); } -/* + +//! Work around for OpenFirmware based machines +/*! * This workaround fixes a bug or two cause because the Xnu kernel wasn't * passing boot-args from OFW to PID 1 correctly, yikes! */ @@ -2348,7 +2355,7 @@ * allows verification against keychains, etc. * http://developer.apple.com/documentation/Darwin/Reference/ManPages/man1/security.1.html * - * This is here because of the securityd team at Apple Inc.....i.e. we don't really need it ;) + * It's here because of the securityd team at Apple Inc. i.e. we don't really need it ;) */ #ifdef _BUILD_DARWIN_ __private_extern__ void launchd_SessionCreate(const char *who) ==== //depot/projects/soc2005/launchd/liblaunch.c#4 (text+ko) ==== @@ -183,8 +183,7 @@ _lc = NULL; } -launch_data_t launch_data_alloc(launch_data_type_t t) -{ +launch_data_t launch_data_alloc(launch_data_type_t t) { launch_data_t d = calloc(1, sizeof(struct _launch)); if (d) {