On Thu, Jan 21, 2010 at 2:40 PM, Håkon Bugge <[email protected]> wrote: > ibv_asyncwatch defaults to block-buffering when stdout is redirected to a > file or pipe. This fix makes it more usable in scripted environments. > > Signed-off-by: Hakon Bugge <[email protected]> > --- > diff --git a/examples/asyncwatch.c b/examples/asyncwatch.c > index e56b4dc..f9fe6ff 100644 > --- a/examples/asyncwatch.c > +++ b/examples/asyncwatch.c > @@ -98,6 +98,9 @@ int main(int argc, char *argv[]) > return 1; > } > > + /* Force line-buffering if stdout is redirected */ > + setlinebuf(stdout); > + > printf("%s: async event FD %d\n", > ibv_get_device_name(*dev_list), context->async_fd);
It might be a good idea to replace setlinebuf() by setvbuf(). setlinebuf() is a BSD function while setvbuf is POSIX (see also http://opengroup.org/onlinepubs/009695399/functions/setvbuf.html). Bart. -- To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
