PERFORCE change 82311 for review
soc-tyler
soc-tyler at FreeBSD.org
Sat Aug 20 08:17:11 GMT 2005
http://perforce.freebsd.org/chv.cgi?CH=82311
Change 82311 by soc-tyler at soc-tyler_launchd on 2005/08/20 08:16:41
Update printf()'s for before and after the pthread_once() call
from within liblaunch.c:launch_msg() to bug freebsd-hackers@
about the muffling of stdout and stderr :)
Affected files ...
.. //depot/projects/soc2005/launchd/launchctl/Makefile#5 edit
.. //depot/projects/soc2005/launchd/liblaunch.c#7 edit
Differences ...
==== //depot/projects/soc2005/launchd/launchctl/Makefile#5 (text+ko) ====
@@ -8,7 +8,7 @@
MAINTAINER= tyler at tamu.edu
LAUNCHD= ${.CURDIR}/../
-CFLAGS+= -g -Wall -W -Wshadow -Wpadded -I${LAUNCHD}/includes
+CFLAGS+= -g -Wall -W -Wshadow -Wpadded -I${LAUNCHD}/includes -D_LAUNCHD_
LDADD+= -lreadline -lutil
.PATH: ${LAUNCHD}
==== //depot/projects/soc2005/launchd/liblaunch.c#7 (text+ko) ====
@@ -122,12 +122,18 @@
char *where = getenv(LAUNCHD_SOCKET_ENV);
char *_launchd_fd = getenv(LAUNCHD_TRUSTED_FD_ENV);
int r, dfd, lfd = -1, tries;
+
+#ifdef _LAUNCHD_
+ printf("starting launch_client_init() in liblaunch.c:%d\n", __LINE__);
+#endif
_lc = calloc(1, sizeof(struct _launch_client));
// if we can't calloc() _lc, exit function
- if (_lc == NULL)
+ if (_lc == NULL) {
+ printf("we can't calloc(_lc) in liblaunch.c:%d\n", __LINE__);
return;
+ }
pthread_mutex_init(&_lc->mtx, NULL);
@@ -182,8 +188,8 @@
if (_lc)
free(_lc);
_lc = NULL;
-
- fprintf(stderr, "liblaunch.c:launch_client_init():out_bad called\n");
+ printf("running out_bad on line: %d\n",__LINE__);
+
}
launch_data_t launch_data_alloc(launch_data_type_t t) {
@@ -687,14 +693,25 @@
{
launch_data_t resp = NULL;
+#ifdef _LAUNCHD_
+ printf("Starting launch_msg() in liblaunch.c:%d\n", __LINE__);
+#endif
+
+ // XXX: this call doesn't put something at &_lc
pthread_once(&_lc_once, launch_client_init);
-
- // we error out and say "Socket not connected" here
+
+ // XXX: we keep evaluating for true here, and error out
if (_lc == NULL) {
+#ifdef _LAUNCHD_
+ printf("_lc evaluated as equal to NULL, liblaunch.c:%d\n", __LINE__);
+#endif
errno = ENOTCONN;
return NULL;
}
+#ifdef _LAUNCHD_
+ printf("Executing pthread_mutex_lock() in liblaunch.c:%d\n", __LINE__);
+#endif
pthread_mutex_lock(&_lc->mtx);
if (d && launchd_msg_send(_lc->l, d) == -1) {
More information about the p4-projects
mailing list