From owner-p4-projects@FreeBSD.ORG Sat Jul 9 09:18:11 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 C439A16A420; Sat, 9 Jul 2005 09:18:10 +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 826CC16A41C for ; Sat, 9 Jul 2005 09:18:10 +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 43F4243D46 for ; Sat, 9 Jul 2005 09:18:10 +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 j699IAxg045963 for ; Sat, 9 Jul 2005 09:18:10 GMT (envelope-from soc-tyler@freebsd.org) Received: (from perforce@localhost) by repoman.freebsd.org (8.13.1/8.13.1/Submit) id j699I9Bw045960 for perforce@freebsd.org; Sat, 9 Jul 2005 09:18:09 GMT (envelope-from soc-tyler@freebsd.org) Date: Sat, 9 Jul 2005 09:18:09 GMT Message-Id: <200507090918.j699I9Bw045960@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 79811 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: Sat, 09 Jul 2005 09:18:11 -0000 http://perforce.freebsd.org/chv.cgi?CH=79811 Change 79811 by soc-tyler@soc-tyler_launchd on 2005/07/09 09:18:09 replace read_plist_file() and CF2launch_data() with just read_conf_file() which adds the 'properties' linked list as the opaque data type to the launch_data_t pointer and returns Affected files ... .. //depot/projects/soc2005/launchd/NOTES#2 edit .. //depot/projects/soc2005/launchd/includes/launch.h#2 edit .. //depot/projects/soc2005/launchd/launchctl/launchctl.c#5 edit .. //depot/projects/soc2005/launchd/launchers/ftp.launch#3 edit .. //depot/projects/soc2005/launchd/launchers/ssh.launch#3 edit .. //depot/projects/soc2005/launchd/liblaunch.c#2 edit Differences ... ==== //depot/projects/soc2005/launchd/NOTES#2 (text+ko) ==== @@ -9,3 +9,11 @@ There are no plans to incorporate this aspect of launchd(8) into FreeBSD until Zeroconf is stable, and in the base system of FreeBSD (6.xx, 7.xx, X.xx ;)) + + o launch_msg() doesn't need to be reimplemented until launchctl(1) is revamped + to work fully on FreeBSD (well, except for the controlling of launchd(8) part) + + After launchctl(1) is modified correctly, removal of CoreFoundation and + Zeroconf calls from launchd(8) can be made, and finally liblaunch can be + fixed to accomodate. + ==== //depot/projects/soc2005/launchd/includes/launch.h#2 (text+ko) ==== @@ -1,4 +1,31 @@ /* + * $FreeBSD$ + * + * Copyright (c) 2005 R. Tyler Ballance All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL AUTHOR OR CONTRIBUTORS BE LIABLE * + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +/* * Copyright (c) 2005 Apple Computer, Inc. All rights reserved. * * @APPLE_LICENSE_HEADER_START@ @@ -112,6 +139,7 @@ LAUNCH_DATA_BOOL, LAUNCH_DATA_STRING, LAUNCH_DATA_OPAQUE, + LAUNCH_DATA_PROPERTY, LAUNCH_DATA_ERRNO, } launch_data_type_t; ==== //depot/projects/soc2005/launchd/launchctl/launchctl.c#5 (text+ko) ==== @@ -72,6 +72,8 @@ #include #include #include +/* include libutil.h for basic property parsing (see: xx.launch) */ +#include #include #include #include @@ -98,6 +100,7 @@ static void distill_config_file(launch_data_t); static void sock_dict_cb(launch_data_t what, const char *key, void *context); static void sock_dict_edit_entry(launch_data_t tmp, const char *key, launch_data_t fdarray, launch_data_t thejob); +static launch_data_t read_conf_file(const char *, bool, bool); //static launch_data_t CF2launch_data(const void *); //static launch_data_t read_plist_file(const char *file, bool editondisk, bool load); //static const void *CreateMyPropertyListFromFile(const char *); @@ -330,11 +333,30 @@ } static launch_data_t read_conf_file(const char *file, bool editondisk, bool load) { - launch_data_t r = NULL; + /* fill this with an array of launch_data_t structs */ + launch_data_t retval = NULL; + properties conf_props; + int fd; + + fd = open(file, O_RDONLY); + if (fd == -1) + return NULL; /* calling function must check for a NULL pointer */ + + conf_props = properties_read(fd); /* read in config data */ + retval = launch_data_alloc(LAUNCH_DATA_PROPERTY); + launch_data_set_opaque(retval, (const void *)(conf_props), sizeof(properties)); - return r; + /* I figure we'll just add the properties(3) linked list to the + * opaque launch_data_t datatype (opaque ~= void *) + * + * this will probably come back to haunt me + */ + + close(fd); + return retval; } + /* static launch_data_t read_plist_file(const char *file, bool editondisk, bool load) { ==== //depot/projects/soc2005/launchd/launchers/ftp.launch#3 (text+ko) ==== @@ -3,6 +3,7 @@ # Simple, launchd(8) launcher for the ftp daemon # +program = ftpd progpath = /usr/libexec/ftpd #firstboot = /usr/libexec/ftpd progflags = -l @@ -12,6 +13,6 @@ ################################## ## inetd related options +### start this daemon from the (x)inetd super server # inetd = false # inetd_wait = false - ==== //depot/projects/soc2005/launchd/launchers/ssh.launch#3 (text+ko) ==== @@ -3,6 +3,7 @@ # Simple, launchd(8) launcher for the SSH daemon # +program = sshd progpath = /usr/bin/sshd #firstboot = /some/script/to/do/keygen progflags = -i @@ -12,6 +13,6 @@ ################################## ## inetd related options +### start this daemon from the (x)inetd super server # inetd = false # inetd_wait = false - ==== //depot/projects/soc2005/launchd/liblaunch.c#2 (text+ko) ==== @@ -156,6 +156,7 @@ if (d) { d->type = t; switch (t) { + case LAUNCH_DATA_PROPERTY: case LAUNCH_DATA_DICTIONARY: case LAUNCH_DATA_ARRAY: d->_array = malloc(0); @@ -168,10 +169,7 @@ return d; } -launch_data_type_t launch_data_get_type(launch_data_t d) -{ - return d->type; -} +launch_data_type_t launch_data_get_type(launch_data_t d) { return d->type; } void launch_data_free(launch_data_t d) {