Date: Thu, 25 Jul 2013 12:07:49 GMT From: dpl@FreeBSD.org To: svn-soc-all@FreeBSD.org Subject: socsvn commit: r255156 - soc2013/dpl Message-ID: <201307251207.r6PC7nrG028377@socsvn.freebsd.org>
next in thread | raw e-mail | index | archive | help
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
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201307251207.r6PC7nrG028377>