device: /dev/repeat

Dave Cinege (dcinege@psychosis.com)
Wed, 23 Dec 1998 03:25:51 -0500


Jason Burrell wrote:
>
>
> There are problems in multi-process setups. Say I have one process
> which wants to have /dev/repeat return 01010101. I have another
> process which wants 00000000, and another which wants 11111111. The
> first process writes 01010101 to /dev/repeat. The second writes
> 00000000. Then the first finally gets around to reading
> /dev/repeat. Then the third process writes 11111111, and the second
> process reads. Oops. :)

Unlike the blabering in the rest of this thread, this is actually a real
problem.

I guess the same this exists with serial ports, an that is 'solved' (somewhat)
with lock files. /dev/repeat0-9 could also be available to help this.
Any better ideas?

> I could be wrong, but it seems that one of the primary uses of
> /dev/zero are to mmap it and get copy-on-write pages. Adding different
> device objects for different bit patterns doesn't seem too useful to
> me.

Well sure. Example: In the 'wipe' thread it was brought up that random and
urandom are too slow.

dd if=/dev/random of=/dev/repeat bs=512 count=1.
cat /dev/repeat
Very fast, and refilled several times over the operation, random enough.

> If you want a particular repeated pattern, use a function like
> memfill() from Lars Wirzenius's 'publib' library.

IMO you should be able to accomplish this without resorting to C.

-- 
http://www.linkscape.net/       Linkscape Internet Services   732-541-4214
http://www.linuxrouter.org/     Linux Router Project

At 19981216.11:59 Zulu, Mach 1 was broken with a 1.0080162GHz Dual CPU machine. I'm the Degenerate Overclocker that did it. http://www.psychosis.com/doa/

- 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/