This is the mail archive of the libstdc++@gcc.gnu.org mailing list for the libstdc++ project.
| Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
|---|---|---|
| Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |
| Other format: | [Raw text] | |
On Thu, Mar 13, 2003 at 01:54:48PM +0100, Paolo Carlini wrote:Too bad. Anyway, thanks for your comments: I will try to prepare an updated version during
the below fixes the problem by implementing a non-trivial showmanyc(), as discussed thoroughly on the list during the last weeks.
In particular, I would appreciate by reassured that the new
__basic_file<>::showmanyc_helper deals correctly with the various
possibilities.
This patch needs some cleanup. I apologize for the delay in replying; I was sick as a dog all of last week.
First, the above code can only reveal information about sockets, and not, unfortunately, pipes. (On a pipe it reports failure.) So, the comment is not right. Still, sockets are important enough to merit the special treatment.Ok.
Second, passing zeroes to the recv() arguments isn't portable. I findI see. This is really unfortunate, that we have to actually read the data :(
that, on Linux, (1) we must actually provide a buffer for it to copy the characters into, and (2) it won't return a value larger than the indicated buffer size (even with MSG_TRUNC). This means you can't avoid having it copy the characters. (Drat.) The buffer used might as well be the actual stream buffer. This is still less expensive than an actual underflow, potentially, because we don't have to run the codecvt operation afterward. Further, we haven't actually messed with the socket state.
I would prefer to express the above asYes, this is much more clean. I have to learn a bit more about the configury machinery in order to
+#ifdef _GLIBCPP_S_ISREG_OR_S_IFREG
+ // Regular files.
+ struct stat __buffer;
+ int __ret = fstat(this->fd(), &__buffer);
+ if (!__ret && _GLIBCPP_S_ISREG_OR_S_IFREG(__buffer.st_mode))
+ if (__stdio)
+ return __buffer.st_size - ftell(_M_cfile);
+ else
+ return __buffer.st_size - lseek(this->fd(), 0, ios_base::cur);
+#endif
with a corresponding definition for _GLIBCPP_S_ISREG_OR_S_IFREG constructed in configure.
Ok. To be honest, I didn't follow your exchanges with Gaby about this and the conclusions you+As in several other patches that have come through, I believe this member name must be uglified. I don't mind if they're all fixed up
+ streamsize
+ showmanyc_helper(bool __stdio);
in a separate patch.
| Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
|---|---|---|
| Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |