Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 3 Sep 2005 06:23:38 GMT
From:      soc-tyler <soc-tyler@FreeBSD.org>
To:        Perforce Change Reviews <perforce@freebsd.org>
Subject:   PERFORCE change 83057 for review
Message-ID:  <200509030623.j836Nc9x026593@repoman.freebsd.org>

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

Change 83057 by soc-tyler@soc-tyler_launchd on 2005/09/03 06:22:59

	Clean up some code, and remove a lot of stupid and/or disgusting 
	debuggery nonsense. Fix the Makefiles for some development-foo to let
	murray@ along with everybody else use this correctly (d'oh!)
	
	hackery I say, hackery

Affected files ...

.. //depot/projects/soc2005/launchd/Makefile#16 edit
.. //depot/projects/soc2005/launchd/includes/launch.h#13 edit
.. //depot/projects/soc2005/launchd/init.c#10 edit
.. //depot/projects/soc2005/launchd/launchctl/Makefile#9 edit
.. //depot/projects/soc2005/launchd/launchctl/launchctl.c#21 edit
.. //depot/projects/soc2005/launchd/launchd.c#20 edit

Differences ...

==== //depot/projects/soc2005/launchd/Makefile#16 (text+ko) ====

@@ -12,12 +12,14 @@
 NO_SHARED?=	YES
 
 
-CFLAGS+= -g -Wall -W -Wshadow -Wpadded -Iincludes -D_LAUNCHD_
+CFLAGS+= -g -Wall -W -Wshadow -Wpadded -Iincludes
 # init.c related CFLAGS (from src/sbin/init/Makefile)
 # -DSECURE to make secure single-user logins (enter root passwd, etc)
 # -DDEBUGSHELL ? we don't need no stinkin' DEBUGSHELL
-CFLAGS+= -DLOGIN_CAP -DCOMPAT_SYSV_INIT
-
+CFLAGS+= -DLOGIN_CAP -DCOMPAT_SYSV_INIT \
+	-DLAUNCHD_PATH=`echo \"$$PWD/launchd\"` \
+	-DLAUNCHCTL_PATH=`echo \"$$PWD/launchctl/launchctl\"`
+# defining LAUNCHD_PATH and LAUNCHCTL_PATH is for development only
 
 # -lcrypt needed by original FreeBSD init(8) code
 DPADD=	${LIBUTIL} ${LIBCRYPT}

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

@@ -33,11 +33,6 @@
 #include <stddef.h>
 #include <stdbool.h>
 
-#ifdef _LAUNCHD_
-#define LAUNCHD_PATH "/home/tyler/perforce/launchd/launchd"
-#define LAUNCHCTL_PATH "/home/tyler/perforce/launchd/launchctl/launchctl"
-#endif
-
 #ifndef LAUNCHCTL_PATH
 #define LAUNCHCTL_PATH "/sbin/launchctl"
 #endif

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

@@ -213,6 +213,7 @@
 
 /* init_pre_kevent() was borrowed from launchd(8)'s original init.c file */
 void init_pre_kevent(void) {
+#ifdef _BE_INIT_
 	session_t s;
 
 	if (single_user_mode && single_user_pid == 0)
@@ -233,13 +234,12 @@
 /* XXX: I'm not exactly sure what this macro call's purpose is, so I'm
  * not going to touch it until it's time to execute launchd(8) as PID 1
  */
-#ifndef _LAUNCHD_
 		TAILQ_FOREACH(s, &sessions, tqe) {
 			if (s->se_process == 0)
 				session_launch(s);
 		}
+	}
 #endif
-	}
 }
 
 /*
@@ -457,7 +457,7 @@
 /* XXX: I'm not touching this until it's time to hack launchd(8) into
  * becoming PID #1
  */
-#ifndef _LAUNCHD_
+#ifdef _BE_INIT_
 	pid_t pid, wpid;
 	int status;
 	sigset_t mask;
@@ -612,7 +612,7 @@
  */
 void runcom(void) {
 /* XXX: I'm not touching this until it's time to get launchd(8) to act as PID 1 */
-#ifndef _LAUNCHD_
+#ifdef _BE_INIT_
 	pid_t pid, wpid;
 	int status;
 	char *argv[4];
@@ -1070,7 +1070,7 @@
 collect_child(pid_t pid)
 {
 /* XXX: Don't touch this until we want launchd(8) as PID 1 */
-#ifndef _LAUNCHD_
+#ifdef _BE_INIT_
 	session_t *sp, *sprev, *snext;
 
 	if (! sessions)
@@ -1109,12 +1109,9 @@
 /*
  * Catch a signal and request a state transition.
  */
-void
-transition_handler(int sig)
-{
+void transition_handler(int sig) {
 /* XXX: Don't touch this until we want launchd(8) as PID 1 */
-#ifndef _LAUNCHD_
-
+#ifdef _BE_INIT_
 	switch (sig) {
 	case SIGHUP:
 		requested_transition = clean_ttys;
@@ -1145,7 +1142,7 @@
 multi_user(void)
 {
 /* XXX: Don't touch this until we want launchd(8) as PID 1 */
-#ifndef _LAUNCHD_
+#ifdef _BE_INIT_
 	pid_t pid;
 	session_t *sp;
 
@@ -1357,7 +1354,7 @@
 runshutdown(void)
 {
 /* XXX: Don't touch this until we want launchd(8) as PID 1 */
-#ifndef _LAUNCHD_
+#ifdef _BE_INIT_
 	pid_t pid, wpid;
 	int status;
 	int shutdowntimeout;

==== //depot/projects/soc2005/launchd/launchctl/Makefile#9 (text+ko) ====

@@ -5,10 +5,12 @@
 SRCS=	launchctl.c liblaunch.c property.c
 MAN=	launchctl.1
 
-MAINTAINER= tyler@tamu.edu
 LAUNCHD=  ${.CURDIR}/../
 
-CFLAGS+= -g -Wall -W -Wshadow -Wpadded -I${LAUNCHD}/includes -D_LAUNCHD_
+CFLAGS+= -g -Wall -W -Wshadow -Wpadded -I${LAUNCHD}/includes
+CFLAGS+= -DLAUNCHD_PATH=`echo \"$$PWD/../launchd\"` \
+	-DLAUNCHCTL_PATH=`echo \"$$PWD/launchctl\"`
+# defining LAUNCHD_PATH and LAUNCHCTL_PATH is for development only
 LDADD+=	-lreadline -lutil -lpthread
 
 .PATH: ${LAUNCHD}

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

@@ -99,7 +99,7 @@
 
 // FreeBSD related functions (for forwards compat? :P 
 #ifndef _BUILD_DARWIN
-static launch_data_t read_conf_file(const char *, bool, bool);
+static launch_data_t read_conf_file(const char *);
 static launch_data_t Conf2launch_data(void *);
 #endif
 
@@ -334,9 +334,7 @@
 }
 
 #ifndef _BUILD_DARWIN
-// Just using this method for testing (until that plist parser is written)
-#ifdef _LAUNCHD_
-static launch_data_t read_conf_file(const char *file, bool editondisk, bool load) {
+static launch_data_t read_conf_file(const char *file) {
 	/* fill this with an array of launch_data_t structs */
 	launch_data_t r; 
 	properties conf_props; // libutil.h and -lutil are required for this..
@@ -407,7 +405,6 @@
 	exit(EXIT_FAILURE);
 }
 #endif
-#endif
 
 #ifdef _BUILD_DARWIN_
 static launch_data_t read_plist_file(const char *file, bool editondisk, bool load) {
@@ -480,7 +477,7 @@
 
 	gethostname(ourhostname, sizeof(ourhostname));
 #ifndef _BUILD_DARWIN_
-	if (NULL == (thejob = read_conf_file(what, editondisk, load))) {
+	if (NULL == (thejob = read_conf_file(what))) {
 		fprintf(stderr, "%s: no config file was returned for: %s\n", getprogname(), what);
 		return;
 	}
@@ -1224,7 +1221,7 @@
 
 	pass1 = launch_data_alloc(LAUNCH_DATA_ARRAY);
 
-	thejob = read_conf_file(argv[1], false, true);
+	thejob = read_conf_file(argv[1]);
 	label = launch_data_dict_lookup(thejob, LAUNCH_JOBKEY_LABEL);
 
 	/* XXX: assuming data has been read correctly */

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




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