Re: [RFE] function to read a file descriptor

2008-08-20 Thread Ralf Wildenhues
* Debarshi Ray wrote on Wed, Aug 20, 2008 at 09:40:13PM CEST: > Oops sorry! This one is hopefully better. I don't think you want to recv more than BUFSIZ bytes; and then you shouldn't need to call realloc for every recv. Only when the next recv answer will not fit in the current buffer size any m

Re: [RFE] function to read a file descriptor

2008-08-20 Thread Debarshi Ray
> What's the use-case of this function? You said that you want to "safely" > read from sockfd, but can you explain what you mean by that? I am actually reading from a PF_NETLINK socket and want the entire data, which can be spread over multiple consecutive messages, in a buffer. Now the BUFSIZ doc

Re: autobuild.m4 time zone fix

2008-08-20 Thread Paul Eggert
Simon Josefsson <[EMAIL PROTECTED]> writes: > - date=`date +%Y%m%d-%H%M%S` > + date=`TZ=UTC date +%Y%m%d-%H%M%S` Although this change will work on many hosts, it is not portable in general. It should say TZ=UTC0 to conform to POSIX.

Re: multithread CPPFLAGS

2008-08-20 Thread Bruno Haible
Yoann Vandoorselaere wrote: > - Isolate thread specific CPP flags into THREADCPPFLAGS (this is useful > for a library to propagate threads specific CPPFLAGS). What do you mean by that? Do you mean that the users of a library need to use the same CPPFLAGS as those with which library was compiled? T

Re: [RFE] function to read a file descriptor

2008-08-20 Thread Bruno Haible
Debarshi Ray wrote: > size_t > recvbuf (int sockfd, void **buffer, size_t *size) > { > size_t block = BUFSIZ; > size_t count = 0; > ssize_t nread; > > if (*buffer == NULL) > *size = block; > > for (;;) > { > *buffer = xrealloc (*buffer, *size); > nread = recv (sockfd

Re: [RFE] function to read a file descriptor

2008-08-20 Thread Debarshi Ray
Oops sorry! This one is hopefully better. size_t recvbuf (int sockfd, void **buffer, size_t *size) { size_t block = BUFSIZ; size_t count = 0; ssize_t nread; if (*buffer == NULL) *size = block; for (;;) { *buffer = xrealloc (*buffer, *size); nread = recv (sockfd, *bu

Re: [RFE] function to read a file descriptor

2008-08-20 Thread Ralf Wildenhues
* Debarshi Ray wrote on Tue, Aug 19, 2008 at 10:57:33PM CEST: > > FWIW, your current algorithm of adding BUFSIZ to size causes nonlinear > > amount of work done in realloc, for reading large files. You might > > want to increase memory by a constant factor or BUFSIZ, whichever is > > larger (e.g.,