summaryrefslogtreecommitdiff
path: root/tools/hi-q.c
diff options
context:
space:
mode:
authorJohn Denker <jsd@av8n.com>2012-07-15 02:07:47 -0700
committerJohn Denker <jsd@av8n.com>2012-07-15 02:07:47 -0700
commit1c2fd04a23b88f1f2361653caf90bfe86ca5e81c (patch)
tree43ccdfa3f86ba863c05eaef82f0c3fe0e88a640e /tools/hi-q.c
parent40cafb32414e203e227def29dc1fd8b4b5688d1f (diff)
still doesn't work
Diffstat (limited to 'tools/hi-q.c')
-rw-r--r--tools/hi-q.c33
1 files changed, 20 insertions, 13 deletions
diff --git a/tools/hi-q.c b/tools/hi-q.c
index 3de9f1c..2078c60 100644
--- a/tools/hi-q.c
+++ b/tools/hi-q.c
@@ -265,13 +265,22 @@ int main(int argc, char** argv, char const * const * env) {
// equal to pid of kid#0
if (ii) kidgroup = kidpid[0];
if (setpgid(0, kidgroup) != 0) {
- cerr << "setpgid failed! " << errno << " ... ";
+ cerr << "*** kid " << ii
+ << " setpgid failed! " << errno << " ... ";
perror(0);
+ } else {
+ cerr << "*** kid " << ii << " setpgid OK" << endl;
}
- if (ii == 0) {
- int junk(1);
- write(sync[wEnd], &junk, 1);
- //cerr << "sync sent" << endl;
+
+ if (ii==0) {
+ int junk;
+ cerr << "about to read sync" << endl;
+ ssize_t rslt = read(sync[rEnd], &junk, 1);
+ if (rslt != 1) {
+ cerr << "bad sync ... 1 != " << rslt << endl;
+ } else {
+ cerr << "back from read sync, good: " << rslt << endl;
+ }
}
#if 1
@@ -324,14 +333,6 @@ int main(int argc, char** argv, char const * const * env) {
////////??? if (1) usleep(0);
///////??? if (ii == 0) usleep(1);
- if (ii==0) {
- int junk;
- //cerr << "about to read sync" << endl;
- ssize_t rslt = read(sync[rEnd], &junk, 1);
- //cerr << "back from read sync: " << rslt << endl;
- if (rslt) {}
- }
-
#if 0
cerr << "apparent kid #" << ii
<< " (" << kidpid[ii] << ") "
@@ -339,6 +340,12 @@ int main(int argc, char** argv, char const * const * env) {
#endif
} /* end loop starting all kids */
+ { // release the hold on kid #0
+ int junk(1);
+ write(sync[wEnd], &junk, 1);
+ cerr << "sync sent" << endl;
+ }
+
// here with the whole pipeline of kids launched
close(0); // the reading end of stdin was