Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 11 Jul 2005 03:58:40 GMT
From:      soc-tyler <soc-tyler@FreeBSD.org>
To:        Perforce Change Reviews <perforce@freebsd.org>
Subject:   PERFORCE change 79958 for review
Message-ID:  <200507110358.j6B3weMG061156@repoman.freebsd.org>

next in thread | raw e-mail | index | archive | help
http://perforce.freebsd.org/chv.cgi?CH=79958

Change 79958 by soc-tyler@soc-tyler_launchd on 2005/07/11 03:58:02

	Add launchd(8)'s init code, and a few modifications to the main source file. Remove final traces of XML code, I think we'll go with a property(3) based configuration file format for the duration of the SoC

Affected files ...

.. //depot/projects/soc2005/launchd/includes/launchd.h#2 edit
.. //depot/projects/soc2005/launchd/init.8#1 add
.. //depot/projects/soc2005/launchd/init.c#1 add
.. //depot/projects/soc2005/launchd/launchd.c#2 edit
.. //depot/projects/soc2005/launchd/launchd_xml.c#3 delete

Differences ...

==== //depot/projects/soc2005/launchd/includes/launchd.h#2 (text+ko) ====

@@ -28,7 +28,8 @@
 typedef void (*kq_callback)(void *, struct kevent *);
 
 extern kq_callback kqsimple_zombie_reaper;
-extern mach_port_t launchd_bootstrap_port;
+/* Mac OS/NeXT specific */
+//extern mach_port_t launchd_bootstrap_port;
 extern sigset_t blocked_signals;
 
 #ifdef PID1_REAP_ADOPTED_CHILDREN

==== //depot/projects/soc2005/launchd/launchd.c#2 (text+ko) ====

@@ -1,4 +1,31 @@
 /*
+ * $FreeBSD$
+ *
+ * Copyright (c) 2005 R. Tyler Ballance <tyler@tamu.edu> 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@
@@ -20,6 +47,10 @@
  * 
  * @APPLE_LICENSE_HEADER_END@
  */
+ 
+/* Mac OS specific frameworks (and NeXT-specific for that matter) 
+ * XXX: these need to be implemented or worked around in another manner
+--------------------------------------------------------------------------------
 #include <Security/Authorization.h>
 #include <Security/AuthorizationTags.h>
 #include <Security/AuthSession.h>
@@ -27,15 +58,20 @@
 #include <mach/mach_error.h>
 #include <mach/port.h>
 #endif
+--------------------------------------------------------------------------------
+ */
 #include <sys/types.h>
 #include <sys/queue.h>
 #include <sys/event.h>
 #include <sys/stat.h>
+/* sys/param.h defines NGROUPS which is necessary for sys/ucred.h */
+#include <sys/param.h>
 #include <sys/ucred.h>
 #include <sys/fcntl.h>
 #include <sys/un.h>
 #include <sys/wait.h>
 #include <sys/sysctl.h>
+#include <sys/socket.h>
 #include <sys/sockio.h>
 #include <sys/time.h>
 #include <sys/resource.h>
@@ -65,7 +101,10 @@
 #include "launch_priv.h"
 #include "launchd.h"
 
+/* Another mach/Mac OS specific header that's been stripped out for FreeBSD 
+ * related work, similar items on FreeBSD might be related to init(8)
 #include "bootstrap_internal.h"
+ */
 
 #define LAUNCHD_MIN_JOB_RUN_TIME 10
 #define LAUNCHD_REWARD_JOB_RUN_TIME 60
@@ -73,8 +112,10 @@
 #define PID1LAUNCHD_CONF "/etc/launchd.conf"
 #define LAUNCHD_CONF ".launchd.conf"
 #define LAUNCHCTL_PATH "/bin/launchctl"
+/* Mac OS specific
 #define SECURITY_LIB "/System/Library/Frameworks/Security.framework/Versions/A/Security"
 #define VOLFSDIR "/.vol"
+ */
 
 extern char **environ;
 
@@ -180,13 +221,17 @@
 static bool launchd_inited = false;
 static bool shutdown_in_progress = false;
 static pthread_t mach_server_loop_thread;
+/* We undeclared this variable in includes/launchd.h so we will do so here as
+ * well. (on Darwin, mach_port_t is an unsigned int, it's purpose escapes me..
+ * I would assume it's related to mach's bootstrap concept, so I should probably 
+ * hit it as I replace init(8)
 mach_port_t launchd_bootstrap_port = MACH_PORT_NULL;
+ */
 sigset_t blocked_signals = 0;
 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,



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200507110358.j6B3weMG061156>