#include <stdio.h>Include dependency graph for pipeline.h:

This graph shows which files directly or indirectly include this file:

Go to the source code of this file.
Enumerations | |
| enum | pipelineOpts { pipelineRead = 0x01, pipelineWrite = 0x02, pipelineNoAbort = 0x04, pipelineMemInput = 0x08 } |
Functions | |
| pipeline * | pipelineOpenFd (char ***cmds, unsigned opts, int otherEndFd, int stderrFd) |
| pipeline * | pipelineOpen (char ***cmds, unsigned opts, char *otherEndFile, char *stderrFile) |
| void | pipelineDumpCmds (char ***cmds) |
| pipeline * | pipelineOpenMem (char ***cmds, unsigned opts, void *otherEndBuf, size_t otherEndBufSize, int stderrFd) |
| pipeline * | pipelineOpenFd1 (char **cmd, unsigned opts, int otherEndFd, int stderrFd) |
| pipeline * | pipelineOpen1 (char **cmd, unsigned opts, char *otherEndFile, char *stderrFile) |
| pipeline * | pipelineOpenMem1 (char **cmd, unsigned opts, void *otherEndBuf, size_t otherEndBufSize, int stderrFd) |
| char * | pipelineDesc (struct pipeline *pl) |
| int | pipelineFd (struct pipeline *pl) |
| FILE * | pipelineFile (struct pipeline *pl) |
| lineFile * | pipelineLineFile (struct pipeline *pl) |
| int | pipelineWait (struct pipeline *pl) |
| void | pipelineFree (struct pipeline **plPtr) |
| enum pipelineOpts |
Definition at line 68 of file pipeline.h.
00070 { 00071 pipelineRead = 0x01, /* read from pipeline */ 00072 pipelineWrite = 0x02, /* write to pipeline */ 00073 pipelineNoAbort = 0x04, /* don't abort if a process exits non-zero, 00074 * wait will return exit code instead. 00075 * Still aborts if process signals. */ 00076 /* these are internal options */ 00077 pipelineMemInput = 0x08 /* pipeline takes input from memory */ 00078 };
| char* pipelineDesc | ( | struct pipeline * | pl | ) |
Definition at line 444 of file pipeline.c.
References pipeline::procName.
Referenced by pipelineLineFile().
00446 { 00447 return pl->procName; 00448 }
Here is the caller graph for this function:

| void pipelineDumpCmds | ( | char *** | cmds | ) |
Definition at line 552 of file pipeline.c.
References plProc::cmd, FALSE, and TRUE.
00554 { 00555 char **cmd; 00556 boolean first = TRUE; 00557 while ((cmd = *cmds++) != NULL) 00558 { 00559 char *word; 00560 if (first) 00561 first = FALSE; 00562 else 00563 printf("| "); 00564 while ((word = *cmd++) != NULL) 00565 printf("%s ", word); 00566 } 00567 printf("<BR>\n"); 00568 }
| int pipelineFd | ( | struct pipeline * | pl | ) |
Definition at line 450 of file pipeline.c.
References pipeline::pipeFd.
Referenced by lineFileDecompress(), lineFileDecompressFd(), lineFileDecompressMem(), and textOutInit().
00452 { 00453 return pl->pipeFd; 00454 }
Here is the caller graph for this function:

| FILE* pipelineFile | ( | struct pipeline * | pl | ) |
Definition at line 456 of file pipeline.c.
References errAbort(), errnoAbort(), FILE_BUF_SIZE, needLargeMem(), pipeline::options, pipeline::pipeFd, pipeline::pipeFh, pipeline::pipeLf, pipelineRead, pipeline::procName, and pipeline::stdioBuf.
00460 { 00461 if (pl->pipeFh == NULL) 00462 { 00463 /* create FILE* on first access */ 00464 char *mode = (pl->options & pipelineRead) ? "r" : "w"; 00465 if (pl->pipeLf != NULL) 00466 errAbort("can't call pipelineFile after having associated a lineFile with a pipeline"); 00467 pl->pipeFh = fdopen(pl->pipeFd, mode); 00468 if (pl->pipeFh == NULL) 00469 errnoAbort("fdopen failed for: %s", pl->procName); 00470 pl->stdioBuf = needLargeMem(FILE_BUF_SIZE); 00471 setvbuf(pl->pipeFh, pl->stdioBuf, _IOFBF, FILE_BUF_SIZE); 00472 } 00473 return pl->pipeFh; 00474 }
Here is the call graph for this function:

| void pipelineFree | ( | struct pipeline ** | plPtr | ) |
Definition at line 244 of file pipeline.c.
References freez(), plProc::next, plProc::pl, plProcFree(), pipeline::procName, pipeline::procs, and pipeline::stdioBuf.
Referenced by lineFileClose(), and textOutClose().
00246 { 00247 struct pipeline *pl = *plPtr; 00248 if (pl != NULL) 00249 { 00250 struct plProc *proc = pl->procs; 00251 while (proc != NULL) 00252 { 00253 struct plProc *delProc = proc; 00254 proc = proc->next; 00255 plProcFree(delProc); 00256 } 00257 freez(&pl->procName); 00258 freez(&pl->stdioBuf); 00259 freez(plPtr); 00260 } 00261 }
Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 476 of file pipeline.c.
References errAbort(), lineFileAttach(), pipeline::options, pipeline::pipeFd, pipeline::pipeFh, pipeline::pipeLf, pipelineDesc(), pipelineWrite, lineFile::pl, and TRUE.
00480 { 00481 if (pl->pipeLf == NULL) 00482 { 00483 /* create line on first acess */ 00484 if (pl->pipeFh != NULL) 00485 errAbort("can't call pipelineLineFile after having associated a FILE with a pipeline"); 00486 if (pl->options & pipelineWrite) 00487 errAbort("can't associated a lineFile with a write pipeline"); 00488 pl->pipeLf = lineFileAttach(pipelineDesc(pl), TRUE, pl->pipeFd); 00489 } 00490 return pl->pipeLf; 00491 }
Here is the call graph for this function:

| struct pipeline* pipelineOpen | ( | char *** | cmds, | |
| unsigned | opts, | |||
| char * | otherEndFile, | |||
| char * | stderrFile | |||
| ) | [read] |
Definition at line 375 of file pipeline.c.
References checkOpts(), openRead(), openWrite(), pipelineOpenFd(), pipelineRead, and safeClose().
Referenced by pipelineOpen1().
00379 { 00380 int otherEndFd; 00381 int stderrFd = (stderrFile == NULL) ? STDERR_FILENO : openWrite(stderrFile); 00382 00383 checkOpts(opts); 00384 if (opts & pipelineRead) 00385 otherEndFd = (otherEndFile == NULL) ? STDIN_FILENO : openRead(otherEndFile); 00386 else 00387 otherEndFd = (otherEndFile == NULL) ? STDOUT_FILENO : openWrite(otherEndFile); 00388 struct pipeline *pl = pipelineOpenFd(cmds, opts, otherEndFd, stderrFd); 00389 safeClose(&otherEndFd); 00390 if (stderrFile != NULL) 00391 safeClose(&stderrFd); 00392 return pl; 00393 }
Here is the call graph for this function:

Here is the caller graph for this function:

| struct pipeline* pipelineOpen1 | ( | char ** | cmd, | |
| unsigned | opts, | |||
| char * | otherEndFile, | |||
| char * | stderrFile | |||
| ) | [read] |
Definition at line 423 of file pipeline.c.
References pipelineOpen().
Referenced by lineFileDecompress(), and textOutInit().
00426 { 00427 char **cmds[2]; 00428 cmds[0] = cmd; 00429 cmds[1] = NULL; 00430 return pipelineOpen(cmds, opts, otherEndFile, stderrFile); 00431 }
Here is the call graph for this function:

Here is the caller graph for this function:

| struct pipeline* pipelineOpenFd | ( | char *** | cmds, | |
| unsigned | opts, | |||
| int | otherEndFd, | |||
| int | stderrFd | |||
| ) | [read] |
Definition at line 359 of file pipeline.c.
References checkOpts(), pipelineNew(), pipelineRead, pipelineStartRead(), and pipelineStartWrite().
Referenced by pipelineOpen(), and pipelineOpenFd1().
00363 { 00364 struct pipeline *pl; 00365 00366 checkOpts(opts); 00367 pl = pipelineNew(cmds, opts); 00368 if (opts & pipelineRead) 00369 pipelineStartRead(pl, otherEndFd, stderrFd, NULL, 0); 00370 else 00371 pipelineStartWrite(pl, otherEndFd, stderrFd); 00372 return pl; 00373 }
Here is the call graph for this function:

Here is the caller graph for this function:

| struct pipeline* pipelineOpenFd1 | ( | char ** | cmd, | |
| unsigned | opts, | |||
| int | otherEndFd, | |||
| int | stderrFd | |||
| ) | [read] |
Definition at line 413 of file pipeline.c.
References pipelineOpenFd().
Referenced by lineFileDecompressFd().
00416 { 00417 char **cmds[2]; 00418 cmds[0] = cmd; 00419 cmds[1] = NULL; 00420 return pipelineOpenFd(cmds, opts, otherEndFd, stderrFd); 00421 }
Here is the call graph for this function:

Here is the caller graph for this function:

| struct pipeline* pipelineOpenMem | ( | char *** | cmds, | |
| unsigned | opts, | |||
| void * | otherEndBuf, | |||
| size_t | otherEndBufSize, | |||
| int | stderrFd | |||
| ) | [read] |
Definition at line 395 of file pipeline.c.
References checkOpts(), errAbort(), pipelineMemInput, pipelineNew(), pipelineStartRead(), and pipelineWrite.
Referenced by pipelineOpenMem1().
00401 { 00402 struct pipeline *pl; 00403 checkOpts(opts); 00404 if (opts & pipelineWrite) 00405 errAbort("pipelineOpenMem only supports read pipelines at this time"); 00406 opts |= pipelineMemInput; 00407 00408 pl = pipelineNew(cmds, opts); 00409 pipelineStartRead(pl, STDIN_FILENO, stderrFd, otherEndBuf, otherEndBufSize); 00410 return pl; 00411 }
Here is the call graph for this function:

Here is the caller graph for this function:

| struct pipeline* pipelineOpenMem1 | ( | char ** | cmd, | |
| unsigned | opts, | |||
| void * | otherEndBuf, | |||
| size_t | otherEndBufSize, | |||
| int | stderrFd | |||
| ) | [read] |
Definition at line 433 of file pipeline.c.
References pipelineOpenMem().
Referenced by lineFileDecompressMem().
00437 { 00438 char **cmds[2]; 00439 cmds[0] = cmd; 00440 cmds[1] = NULL; 00441 return pipelineOpenMem(cmds, opts, otherEndBuf, otherEndBufSize, stderrFd); 00442 }
Here is the call graph for this function:

Here is the caller graph for this function:

| int pipelineWait | ( | struct pipeline * | pl | ) |
Definition at line 525 of file pipeline.c.
References closePipeline(), plProc::next, pipeline::options, pipelineRead, pipelineWrite, plProc::pl, plProcWait(), plProc::status, and WEXITSTATUS.
Referenced by lineFileClose(), and textOutClose().
00529 { 00530 struct plProc *proc; 00531 int exitCode = 0; 00532 00533 /* must close before waits for output pipeline */ 00534 if (pl->options & pipelineWrite) 00535 closePipeline(pl); 00536 00537 /* wait on each process in order */ 00538 for (proc = pl->procs; proc != NULL; proc = proc->next) 00539 { 00540 plProcWait(proc); 00541 if ((WEXITSTATUS(proc->status) != 0) && (exitCode == 0)) 00542 exitCode = WEXITSTATUS(proc->status); 00543 } 00544 00545 /* must close after waits for input pipeline */ 00546 if (pl->options & pipelineRead) 00547 closePipeline(pl); 00548 00549 return exitCode; 00550 }
Here is the call graph for this function:

Here is the caller graph for this function:

1.5.2