diff options
author | dgp <dgp@users.sourceforge.net> | 2008-03-07 22:05:01 (GMT) |
---|---|---|
committer | dgp <dgp@users.sourceforge.net> | 2008-03-07 22:05:01 (GMT) |
commit | e295a4ddd722dd78b3dcc40e624b6aad8d05dde8 (patch) | |
tree | 76401e3e6e86441e3aeb2b15143d14c44963f5f4 /unix/tclUnixPipe.c | |
parent | 20556ad7dfd6e3e293b260eef2fd540e3d63346a (diff) | |
download | tcl-e295a4ddd722dd78b3dcc40e624b6aad8d05dde8.zip tcl-e295a4ddd722dd78b3dcc40e624b6aad8d05dde8.tar.gz tcl-e295a4ddd722dd78b3dcc40e624b6aad8d05dde8.tar.bz2 |
merge updates from HEAD
Diffstat (limited to 'unix/tclUnixPipe.c')
-rw-r--r-- | unix/tclUnixPipe.c | 51 |
1 files changed, 4 insertions, 47 deletions
diff --git a/unix/tclUnixPipe.c b/unix/tclUnixPipe.c index 383034a..c11ce0b 100644 --- a/unix/tclUnixPipe.c +++ b/unix/tclUnixPipe.c @@ -10,7 +10,7 @@ * See the file "license.terms" for information on usage and redistribution of * this file, and for a DISCLAIMER OF ALL WARRANTIES. * - * RCS: @(#) $Id: tclUnixPipe.c,v 1.38.2.1 2007/06/21 16:04:57 dgp Exp $ + * RCS: @(#) $Id: tclUnixPipe.c,v 1.38.2.2 2008/03/07 22:05:11 dgp Exp $ */ #include "tclInt.h" @@ -841,61 +841,18 @@ PipeBlockModeProc( * TCL_MODE_BLOCKING or * TCL_MODE_NONBLOCKING. */ { - PipeState *psPtr = (PipeState *) instanceData; - int curStatus; - int fd; + PipeState *psPtr = instanceData; -#ifndef USE_FIONBIO if (psPtr->inFile) { - fd = GetFd(psPtr->inFile); - curStatus = fcntl(fd, F_GETFL); - if (mode == TCL_MODE_BLOCKING) { - curStatus &= (~(O_NONBLOCK)); - } else { - curStatus |= O_NONBLOCK; - } - if (fcntl(fd, F_SETFL, curStatus) < 0) { + if (TclUnixSetBlockingMode(GetFd(psPtr->inFile), mode) < 0) { return errno; } } if (psPtr->outFile) { - fd = GetFd(psPtr->outFile); - curStatus = fcntl(fd, F_GETFL); - if (mode == TCL_MODE_BLOCKING) { - curStatus &= (~(O_NONBLOCK)); - } else { - curStatus |= O_NONBLOCK; - } - if (fcntl(fd, F_SETFL, curStatus) < 0) { - return errno; - } - } -#endif /* !FIONBIO */ - -#ifdef USE_FIONBIO - if (psPtr->inFile) { - fd = GetFd(psPtr->inFile); - if (mode == TCL_MODE_BLOCKING) { - curStatus = 0; - } else { - curStatus = 1; - } - if (ioctl(fd, (int) FIONBIO, &curStatus) < 0) { - return errno; - } - } - if (psPtr->outFile != NULL) { - fd = GetFd(psPtr->outFile); - if (mode == TCL_MODE_BLOCKING) { - curStatus = 0; - } else { - curStatus = 1; - } - if (ioctl(fd, (int) FIONBIO, &curStatus) < 0) { + if (TclUnixSetBlockingMode(GetFd(psPtr->outFile), mode) < 0) { return errno; } } -#endif /* USE_FIONBIO */ psPtr->isNonBlocking = (mode == TCL_MODE_NONBLOCKING); |