[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Possible bug with grep/sed/tail?

From: Brian Dessent
Subject: Re: Possible bug with grep/sed/tail?
Date: Thu, 20 Nov 2008 17:02:27 -0800

Pádraig Brady wrote:

> It's probably useful to add this functionality to all coreutil filters.
> I still need to be convinced that glibc is not the correct place for this.
> If it was there then any users of stdio could be controlled.

It has been said before in previous threads but I want to re-state that
this is possible in a very simple and general way with the LD_PRELOAD facility:

$ echo '__attribute__((constructor)) void f() { setvbuf (stdout, NULL, _IOLBF, 
0); }' | \
  gcc -include stdio.h -x c - -fPIC -shared -o linebuf.so

$ ( while true; do echo "foo"; sleep 1; done ) | LD_PRELOAD=./linebuf.so grep 
foo | cat
... # immediate output


reply via email to

[Prev in Thread] Current Thread [Next in Thread]