[launchd-changes] [23378] trunk/launchd/src

source_changes at macosforge.org source_changes at macosforge.org
Thu Sep 13 10:16:54 PDT 2007


Revision: 23378
          http://trac.macosforge.org/projects/launchd/changeset/23378
Author:   zarzycki at apple.com
Date:     2007-09-13 10:16:54 -0700 (Thu, 13 Sep 2007)

Log Message:
-----------
White space clean up.

Modified Paths:
--------------
    trunk/launchd/src/launchctl.c
    trunk/launchd/src/launchd.c
    trunk/launchd/src/launchd_core_logic.c
    trunk/launchd/src/launchd_runtime.c
    trunk/launchd/src/launchproxy.c
    trunk/launchd/src/liblaunch.c

Modified: trunk/launchd/src/launchctl.c
===================================================================
--- trunk/launchd/src/launchctl.c	2007-09-13 00:50:24 UTC (rev 23377)
+++ trunk/launchd/src/launchctl.c	2007-09-13 17:16:54 UTC (rev 23378)
@@ -81,8 +81,8 @@
 #define MACHINIT_JOBKEY_SERVERPORT	"ServerPort"
 #define MACHINIT_JOBKEY_SERVICEPORT	"ServicePort"
 
-#define assumes(e)      \
-	        (__builtin_expect(!(e), 0) ? _log_launchctl_bug(__rcs_file_version__, __FILE__, __LINE__, #e), false : true)
+#define assumes(e)	\
+	(__builtin_expect(!(e), 0) ? _log_launchctl_bug(__rcs_file_version__, __FILE__, __LINE__, #e), false : true)
 
 
 struct load_unload_state {
@@ -738,7 +738,7 @@
 	}
 
 	if (!(S_ISREG(sb.st_mode) || S_ISDIR(sb.st_mode))) {
-		fprintf(stderr, "%s: Dubious path. Not a regular file or directory (skipping):  %s\n", getprogname(), path);
+		fprintf(stderr, "%s: Dubious path. Not a regular file or directory (skipping): %s\n", getprogname(), path);
 		return false;
 	}
 
@@ -894,9 +894,9 @@
 			setm = true;
 		}
 
-		if (passive) {                  
+		if (passive) {
 			if (unlink(sun.sun_path) == -1 && errno != ENOENT) {
-				close(sfd);     
+				close(sfd);
 				return;
 			}
 			oldmask = umask(S_IRWXG|S_IRWXO);
@@ -1621,7 +1621,7 @@
 int
 load_and_unload_cmd(int argc, char *const argv[])
 {
-        NSSearchPathEnumerationState es = 0;
+	NSSearchPathEnumerationState es = 0;
 	char nspath[PATH_MAX * 2]; /* safe side, we need to append */
 	bool badopts = false;
 	struct load_unload_state lus;
@@ -2595,7 +2595,7 @@
 is_legacy_mach_job(launch_data_t obj)
 {
 	bool has_servicename = launch_data_dict_lookup(obj, MACHINIT_JOBKEY_SERVICENAME);
-	bool has_command  = launch_data_dict_lookup(obj, MACHINIT_JOBKEY_COMMAND);
+	bool has_command = launch_data_dict_lookup(obj, MACHINIT_JOBKEY_COMMAND);
 	bool has_label = launch_data_dict_lookup(obj, LAUNCH_JOBKEY_LABEL);
 
 	return has_command && has_servicename && !has_label;

Modified: trunk/launchd/src/launchd.c
===================================================================
--- trunk/launchd/src/launchd.c	2007-09-13 00:50:24 UTC (rev 23377)
+++ trunk/launchd/src/launchd.c	2007-09-13 17:16:54 UTC (rev 23378)
@@ -115,7 +115,7 @@
 
 	while ((ch = getopt(argc, argv, "s")) != -1) {
 		switch (ch) {
-		case 's': sflag = true;   break;	/* single user */
+		case 's': sflag = true; break;	/* single user */
 		case '?': /* we should do something with the global optopt variable here */
 		default:
 			fprintf(stderr, "%s: ignoring unknown arguments\n", getprogname());

Modified: trunk/launchd/src/launchd_core_logic.c
===================================================================
--- trunk/launchd/src/launchd_core_logic.c	2007-09-13 00:50:24 UTC (rev 23377)
+++ trunk/launchd/src/launchd_core_logic.c	2007-09-13 17:16:54 UTC (rev 23378)
@@ -273,8 +273,8 @@
 	char name[0];
 };
 
-#define jobmgr_assumes(jm, e)      \
-	                (__builtin_expect(!(e), 0) ? jobmgr_log_bug(jm, __rcs_file_version__, __FILE__, __LINE__, #e), false : true)
+#define jobmgr_assumes(jm, e)	\
+	(__builtin_expect(!(e), 0) ? jobmgr_log_bug(jm, __rcs_file_version__, __FILE__, __LINE__, #e), false : true)
 
 static jobmgr_t jobmgr_new(jobmgr_t jm, mach_port_t requestorport, mach_port_t transfer_port, bool sflag, const char *name);
 static job_t jobmgr_import2(jobmgr_t jm, launch_data_t pload);
@@ -369,8 +369,8 @@
 static size_t hash_ms(const char *msstr) __attribute__((pure));
 
 
-#define job_assumes(j, e)      \
-	                (__builtin_expect(!(e), 0) ? job_log_bug(j, __rcs_file_version__, __FILE__, __LINE__, #e), false : true)
+#define job_assumes(j, e)	\
+	(__builtin_expect(!(e), 0) ? job_log_bug(j, __rcs_file_version__, __FILE__, __LINE__, #e), false : true)
 
 static void job_import_keys(launch_data_t obj, const char *key, void *context);
 static void job_import_bool(job_t j, const char *key, bool value);
@@ -421,15 +421,15 @@
 	const char *key;
 	int val;
 } launchd_keys2limits[] = {
-	{ LAUNCH_JOBKEY_RESOURCELIMIT_CORE,    RLIMIT_CORE    },
-	{ LAUNCH_JOBKEY_RESOURCELIMIT_CPU,     RLIMIT_CPU     },
-	{ LAUNCH_JOBKEY_RESOURCELIMIT_DATA,    RLIMIT_DATA    },
-	{ LAUNCH_JOBKEY_RESOURCELIMIT_FSIZE,   RLIMIT_FSIZE   },
-	{ LAUNCH_JOBKEY_RESOURCELIMIT_MEMLOCK, RLIMIT_MEMLOCK },
-	{ LAUNCH_JOBKEY_RESOURCELIMIT_NOFILE,  RLIMIT_NOFILE  },
-	{ LAUNCH_JOBKEY_RESOURCELIMIT_NPROC,   RLIMIT_NPROC   },
-	{ LAUNCH_JOBKEY_RESOURCELIMIT_RSS,     RLIMIT_RSS     },
-	{ LAUNCH_JOBKEY_RESOURCELIMIT_STACK,   RLIMIT_STACK   },
+	{ LAUNCH_JOBKEY_RESOURCELIMIT_CORE,	RLIMIT_CORE	},
+	{ LAUNCH_JOBKEY_RESOURCELIMIT_CPU,	RLIMIT_CPU	},
+	{ LAUNCH_JOBKEY_RESOURCELIMIT_DATA,	RLIMIT_DATA	},
+	{ LAUNCH_JOBKEY_RESOURCELIMIT_FSIZE,	RLIMIT_FSIZE	},
+	{ LAUNCH_JOBKEY_RESOURCELIMIT_MEMLOCK,	RLIMIT_MEMLOCK	},
+	{ LAUNCH_JOBKEY_RESOURCELIMIT_NOFILE,	RLIMIT_NOFILE	},
+	{ LAUNCH_JOBKEY_RESOURCELIMIT_NPROC,	RLIMIT_NPROC	},
+	{ LAUNCH_JOBKEY_RESOURCELIMIT_RSS,	RLIMIT_RSS	},
+	{ LAUNCH_JOBKEY_RESOURCELIMIT_STACK,	RLIMIT_STACK	},
 };
 
 static time_t cronemu(int mon, int mday, int hour, int min);
@@ -716,7 +716,7 @@
 	} else if (getpid() == 1) {
 		jobmgr_log(jm, LOG_DEBUG, "About to call: reboot(%s)", reboot_flags_to_C_names(jm->reboot_flags));
 		runtime_closelog();
-		jobmgr_assumes(jm,  reboot(jm->reboot_flags) != -1);
+		jobmgr_assumes(jm, reboot(jm->reboot_flags) != -1);
 		runtime_closelog();
 	} else {
 		runtime_closelog();
@@ -3070,9 +3070,9 @@
 	}
 }
 
-void    
+void
 semaphoreitem_ignore(job_t j, struct semaphoreitem *si)
-{       
+{
 	if (si->fd != -1) {
 		job_log(j, LOG_DEBUG, "Ignoring Vnode: %d", si->fd);
 		job_assumes(j, kevent_mod(si->fd, EVFILT_VNODE, EV_DELETE, 0, 0, NULL) != -1);
@@ -4336,8 +4336,8 @@
 	job_assumes(ms->job, launchd_mport_notify_req(ms->port, which) == KERN_SUCCESS);
 }
 
-#define NELEM(x)                (sizeof(x)/sizeof(x[0]))
-#define END_OF(x)               (&(x)[NELEM(x)])
+#define NELEM(x)	(sizeof(x)/sizeof(x[0]))
+#define END_OF(x)	(&(x)[NELEM(x)])
 
 char **
 mach_cmd2argv(const char *string)
@@ -4737,11 +4737,11 @@
 		return true;
 	}
 
-        if (mon < wtm->tm_mon) {
+	if (mon < wtm->tm_mon) {
 		return false;
 	}
 
-        if (mon > wtm->tm_mon) {
+	if (mon > wtm->tm_mon) {
 		wtm->tm_mon = mon;
 		wtm->tm_mday = 1;
 		wtm->tm_hour = 0;
@@ -4772,11 +4772,11 @@
 		return true;
 	}
 
-        if (mday < wtm->tm_mday) {
+	if (mday < wtm->tm_mday) {
 		return false;
 	}
 
-        if (mday > wtm->tm_mday) {
+	if (mday > wtm->tm_mday) {
 		wtm->tm_mday = mday;
 		wtm->tm_hour = 0;
 		wtm->tm_min = 0;

Modified: trunk/launchd/src/launchd_runtime.c
===================================================================
--- trunk/launchd/src/launchd_runtime.c	2007-09-13 00:50:24 UTC (rev 23377)
+++ trunk/launchd/src/launchd_runtime.c	2007-09-13 17:16:54 UTC (rev 23378)
@@ -142,7 +142,7 @@
 	launchd_assert(pthread_create(&kqueue_demand_thread, &attr, kqueue_demand_loop, NULL) == 0);
 	pthread_attr_destroy(&attr);
 
-        pthread_attr_init(&attr);
+	pthread_attr_init(&attr);
 	pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_DETACHED);
 	pthread_attr_setstacksize(&attr, PTHREAD_STACK_MIN);
 	launchd_assert(pthread_create(&demand_thread, &attr, mport_demand_loop, NULL) == 0);
@@ -1173,7 +1173,7 @@
 	char *data_off;
 	struct logmsg_s *lm;
 
-#define ROUND_TO_64BIT_WORD_SIZE(x)     ((x + 7) & ~7)
+#define ROUND_TO_64BIT_WORD_SIZE(x)	((x + 7) & ~7)
 
 	/* we do this to make the unpacking for the log_drain cause unalignment faults */
 	lm_sz = ROUND_TO_64BIT_WORD_SIZE(lm_sz);

Modified: trunk/launchd/src/launchproxy.c
===================================================================
--- trunk/launchd/src/launchproxy.c	2007-09-13 00:50:24 UTC (rev 23377)
+++ trunk/launchd/src/launchproxy.c	2007-09-13 17:16:54 UTC (rev 23378)
@@ -48,12 +48,12 @@
 
 static void find_fds(launch_data_t o, const char *key __attribute__((unused)), void *context __attribute__((unused)))
 {
-        struct kevent kev;
-        size_t i;
+	struct kevent kev;
+	size_t i;
 	int fd;
 
-        switch (launch_data_get_type(o)) {
-        case LAUNCH_DATA_FD:
+	switch (launch_data_get_type(o)) {
+	case LAUNCH_DATA_FD:
 		fd = launch_data_get_fd(o);
 		if (-1 == fd)
 			break;
@@ -61,17 +61,17 @@
 		EV_SET(&kev, fd, EVFILT_READ, EV_ADD, 0, 0, NULL);
 		if (kevent(kq, &kev, 1, NULL, 0, NULL) == -1)
 			syslog(LOG_DEBUG, "kevent(%d): %m", fd);
-                break;
-        case LAUNCH_DATA_ARRAY:
-                for (i = 0; i < launch_data_array_get_count(o); i++)
-                        find_fds(launch_data_array_get_index(o, i), NULL, NULL);
-                break;
-        case LAUNCH_DATA_DICTIONARY:
-                launch_data_dict_iterate(o, find_fds, NULL);
-                break;
-        default:
-                break;
-        }
+		break;
+	case LAUNCH_DATA_ARRAY:
+		for (i = 0; i < launch_data_array_get_count(o); i++)
+			find_fds(launch_data_array_get_index(o, i), NULL, NULL);
+		break;
+	case LAUNCH_DATA_DICTIONARY:
+		launch_data_dict_iterate(o, find_fds, NULL);
+		break;
+	default:
+		break;
+	}
 }
 
 int main(int argc __attribute__((unused)), char *argv[])

Modified: trunk/launchd/src/liblaunch.c
===================================================================
--- trunk/launchd/src/liblaunch.c	2007-09-13 00:50:24 UTC (rev 23377)
+++ trunk/launchd/src/liblaunch.c	2007-09-13 17:16:54 UTC (rev 23378)
@@ -372,7 +372,7 @@
 launch_data_array_pop_first(launch_data_t where)
 {
 	launch_data_t r = NULL;
-       
+
 	if (where->_array_cnt > 0) {
 		r = where->_array[0];
 		memmove(where->_array, where->_array + 1, (where->_array_cnt - 1) * sizeof(launch_data_t));
@@ -525,23 +525,23 @@
 launch_t
 launchd_fdopen(int fd)
 {
-        launch_t c;
+	launch_t c;
 
-        c = calloc(1, sizeof(struct _launch));
+	c = calloc(1, sizeof(struct _launch));
 	if (!c)
 		return NULL;
 
-        c->fd = fd;
+	c->fd = fd;
 
 	fcntl(fd, F_SETFL, O_NONBLOCK);
 
-        if ((c->sendbuf = malloc(0)) == NULL)
+	if ((c->sendbuf = malloc(0)) == NULL)
 		goto out_bad;
-        if ((c->sendfds = malloc(0)) == NULL)
+	if ((c->sendfds = malloc(0)) == NULL)
 		goto out_bad;
-        if ((c->recvbuf = malloc(0)) == NULL)
+	if ((c->recvbuf = malloc(0)) == NULL)
 		goto out_bad;
-        if ((c->recvfds = malloc(0)) == NULL)
+	if ((c->recvfds = malloc(0)) == NULL)
 		goto out_bad;
 
 	return c;
@@ -770,10 +770,10 @@
 		iov[0].iov_base = &lmh;
 		iov[0].iov_len = sizeof(lmh);
 		mh.msg_iov = iov;
-        	mh.msg_iovlen = 2;
+		mh.msg_iovlen = 2;
 	} else {
 		mh.msg_iov = iov + 1;
-        	mh.msg_iovlen = 1;
+		mh.msg_iovlen = 1;
 	}
 
 	iov[1].iov_base = lh->sendbuf;
@@ -916,7 +916,7 @@
 				goto out;
 		} while (launchd_msg_send(_lc->l, NULL) == -1);
 	}
-       
+
 	while (resp == NULL) {
 		if (d == NULL && launch_data_array_get_count(_lc->async_resp) > 0) {
 			resp = launch_data_array_pop_first(_lc->async_resp);
@@ -950,13 +950,13 @@
 	struct cmsghdr *cm = alloca(4096); 
 	launch_data_t rmsg = NULL;
 	size_t data_offset, fd_offset;
-        struct msghdr mh;
-        struct iovec iov;
+	struct msghdr mh;
+	struct iovec iov;
 	int r;
 
-        memset(&mh, 0, sizeof(mh));
-        mh.msg_iov = &iov;
-        mh.msg_iovlen = 1;
+	memset(&mh, 0, sizeof(mh));
+	mh.msg_iov = &iov;
+	mh.msg_iovlen = 1;
 
 	lh->recvbuf = reallocf(lh->recvbuf, lh->recvlen + 8*1024);
 
@@ -1099,7 +1099,7 @@
 	launch_data_t r = launch_data_alloc(LAUNCH_DATA_ERRNO);
 
 	if (r)
-	       launch_data_set_errno(r, e);
+		launch_data_set_errno(r, e);
 
 	return r;
 }
@@ -1109,7 +1109,7 @@
 	launch_data_t r = launch_data_alloc(LAUNCH_DATA_FD);
 
 	if (r)
-	       launch_data_set_fd(r, fd);
+		launch_data_set_fd(r, fd);
 
 	return r;
 }
@@ -1119,7 +1119,7 @@
 	launch_data_t r = launch_data_alloc(LAUNCH_DATA_MACHPORT);
 
 	if (r)
-	       launch_data_set_machport(r, p);
+		launch_data_set_machport(r, p);
 
 	return r;
 }

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.macosforge.org/pipermail/launchd-changes/attachments/20070913/07de0c4e/attachment.html


More information about the launchd-changes mailing list