From owner-p4-projects@FreeBSD.ORG Sat Aug 20 08:17:10 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 32FBE16A422; Sat, 20 Aug 2005 08:17: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 E2D1916A41F for ; Sat, 20 Aug 2005 08:17:09 +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 7DD6C43D45 for ; Sat, 20 Aug 2005 08:17:09 +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 j7K8H97P012569 for ; Sat, 20 Aug 2005 08:17:09 GMT (envelope-from soc-tyler@freebsd.org) Received: (from perforce@localhost) by repoman.freebsd.org (8.13.1/8.13.1/Submit) id j7K8H9sG012566 for perforce@freebsd.org; Sat, 20 Aug 2005 08:17:09 GMT (envelope-from soc-tyler@freebsd.org) Date: Sat, 20 Aug 2005 08:17:09 GMT Message-Id: <200508200817.j7K8H9sG012566@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 82311 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, 20 Aug 2005 08:17:11 -0000 http://perforce.freebsd.org/chv.cgi?CH=82311 Change 82311 by soc-tyler@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@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) {