From owner-svn-soc-all@FreeBSD.ORG Thu Jul 25 12:07:49 2013 Return-Path: Delivered-To: svn-soc-all@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTP id 4EDBB5CD for ; Thu, 25 Jul 2013 12:07:49 +0000 (UTC) (envelope-from dpl@FreeBSD.org) Received: from socsvn.freebsd.org (socsvn.freebsd.org [IPv6:2001:1900:2254:206a::50:2]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id 3BBC924C4 for ; Thu, 25 Jul 2013 12:07:49 +0000 (UTC) Received: from socsvn.freebsd.org ([127.0.1.124]) by socsvn.freebsd.org (8.14.7/8.14.7) with ESMTP id r6PC7nEX028390 for ; Thu, 25 Jul 2013 12:07:49 GMT (envelope-from dpl@FreeBSD.org) Received: (from www@localhost) by socsvn.freebsd.org (8.14.7/8.14.6/Submit) id r6PC7nrG028377 for svn-soc-all@FreeBSD.org; Thu, 25 Jul 2013 12:07:49 GMT (envelope-from dpl@FreeBSD.org) Date: Thu, 25 Jul 2013 12:07:49 GMT Message-Id: <201307251207.r6PC7nrG028377@socsvn.freebsd.org> X-Authentication-Warning: socsvn.freebsd.org: www set sender to dpl@FreeBSD.org using -f From: dpl@FreeBSD.org To: svn-soc-all@FreeBSD.org Subject: socsvn commit: r255156 - soc2013/dpl MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-soc-all@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the entire Summer of Code repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 25 Jul 2013 12:07:49 -0000 Author: dpl Date: Thu Jul 25 12:07:48 2013 New Revision: 255156 URL: http://svnweb.FreeBSD.org/socsvn/?view=rev&rev=255156 Log: Made some little updates to code to be more explainable. Modified: soc2013/dpl/caller.c Modified: soc2013/dpl/caller.c ============================================================================== --- soc2013/dpl/caller.c Thu Jul 25 11:02:17 2013 (r255155) +++ soc2013/dpl/caller.c Thu Jul 25 12:07:48 2013 (r255156) @@ -12,6 +12,9 @@ pid_t child = 0; int sv[2], i; + +/* commands will live here */ +/* I will malloc it this afternoon */ int buf[32]; pid_t startChild(); @@ -32,12 +35,6 @@ } atexit(killChild); - printf("buf:\n"); - for( i=0; i<32; ++i){ - printf("%d\t", buf[i]); - if( (i+1) % 8 == 0 ) - printf("\n"); - } return 0; } @@ -61,6 +58,8 @@ close(STDERR_FILENO); waitCommand(); + signal( + /* Should we call signal() to exit more cleanly? */ } @@ -76,14 +75,16 @@ fds[0].revents = 0; while(1) { - if ((p = poll(fds, 1, 0)) > 0){ + p = poll(fds, 1, 0); + if (p > 0){ if( fds[0].revents & POLLIN || fds[0].revents & POLLPRI){ + /* Read command */ read(sv[1], buf, sizeof(buf)); } else if( fds[0].revents & POLLOUT) { + /* Write answer */ } } } - printf("Child's out of while.\n"); } @@ -95,6 +96,5 @@ void killChild() { - printf("About to kill %d\n", child); kill(child, SIGINT); } \ No newline at end of file