[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: CVS update [cvs1-11-x-branch]: /ccvs/src/
From: |
Derek Robert Price |
Subject: |
Re: CVS update [cvs1-11-x-branch]: /ccvs/src/ |
Date: |
Thu, 26 Aug 2004 12:10:41 -0400 |
User-agent: |
Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.7.2) Gecko/20040803 |
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Larry Jones wrote:
>>In an ideal world, we would probably move away from using the stdio
>>library entirely and use raw file operations such as the write() and
>>select() and pay close attention to the return values.
>
>
>Heavens, no! Why should we write system-specific code to deal with
>non-blocking FDs when we don't need or want non-blocking behavior? The
>right thing to do, as I said before, is to turn off non-blocking mode
>and continue to use stdio.
What about the case in question, when output is redirected, piped, and
some other program sets O_NONBLOCK? Ideally, stdio would handle this,
but it currently does not. We had a long discussion about this
before:
<http://groups.google.com/groups?hl=en&lr=&ie=UTF-8&c2coff=1&threadm=sisn2833gc.fsf%40daffy.airs.com&rnum=1&prev=/groups%3Fq%3Dgnu.cvs.bug%2BRMS%2BSTDIO%26hl%3Den%26lr%3D%26ie%3DUTF-8%26c2coff%3D1%26selm%3Dsisn2833gc.fsf%2540daffy.airs.com%26rnum%3D1>.
Since I haven't heard anything about Paul Eggert's proposed STDIO
extension in the two intervening years, what would you say about my
writing one myself? Something along the lines of fwrite_block(),
fputc_block(), & fputs_block() functions that always imitate blocking
behavior by watching for low byte count returns and responding with a
select() and a retry with any remaining data? All fwrite_block()
calls would be converted to write objects of size 1 before calling the
system fwrite() so that we could depend on the file position indicator.
Ideally, I would contribute the code back to GNULIB and have it
supported there, but it could just as well be CVS specific. Either
way, I would probably #define the original stdio function names to
call the new versions in a header a la unlocked-io.h but I'm open, of
course, to dissenting opinions about this.
Cheers,
Derek
- --
*8^)
Email: derek@ximbiot.com
Get CVS support at <http://ximbiot.com>!
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.3 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org
iD8DBQFBLguALD1OTBfyMaQRAp70AJ9r5QENzW2n4/V5PCIoJygsrWE2rACg1Ay1
0AMErF99lO8MpPRPbsBTBp8=
=UtyD
-----END PGP SIGNATURE-----