Re: /dev/one - why not /dev/repeat?

Damien Miller (dmiller@ilogic.com.au)
Sat, 26 Dec 1998 09:47:21 +1100 (EST)


On Fri, 25 Dec 1998, Dave Cinege wrote:

> One use would be for low level file (device) acesss as mentioned in
> the 'wipe' thread. Compounding two pipes, to strip 4,000,000,000
> line feeds, from using the 'yes' | 'tr' is slow and sloppy. It also
> assumes both commands are actually available.

There is no reason to believe that a kernel-based version would be
significantly faster or smaller than a user-space version.

cat >> repeat.c
#include <stdio.h>
int main(int argc, char **argv)
{
if (argc != 2) {
fprintf(stderr, "Usage: repeat [text]\n");
exit(1);
}
while(1)
printf("%s", argv[1]);
exit(0);
}

[dmiller@mothra dmiller]$ gcc repeat.c -o repeat
[dmiller@mothra dmiller]$ strip repeat
[dmiller@mothra dmiller]$ ls -l repeat
-rwxrwxr-x 1 dmiller dmiller 2876 Dec 26 09:36 repeat

Surely that wasn't worth all the whinging.

Regards,
Damien Miller

--
| "Bombay is 250ms from New York in the new world order" - Alan Cox
| Damien Miller - http://www.ilogic.com.au/~dmiller

- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.rutgers.edu Please read the FAQ at http://www.tux.org/lkml/