P
P
pixik2015-10-21 13:15:46
linux
pixik, 2015-10-21 13:15:46

How to create a spooled file type device in linux?

Good afternoon!
The situation is such that a number of programs are written that write something to a regular file. Now there is a need to transfer data in a special way - write to a 1Kb file and make a delay of 100ms. Is there a way in Linux to do this without changing the code of already working programs?
I assumed that you can create a device in linux, in which you can write something like this:

cat > /dev/mydev 
или
ofstream of("/dev/mydev");
или
cat ofile > /dev/mydev
.
And already this device on its side will buffer and write in portions of 1 KB to the desired file with the necessary delay. Is it possible?
Thank you for your attention:)

Answer the question

In order to leave comments, you need to log in

3 answer(s)
A
Aves, 2015-10-21
@Aves

There is a buffer
cat file | buffer -s 1k -u 100000 -o outfile

O
Oleg Tsilyurik, 2015-10-21
@Olej

> I assumed that you can create a device It is possible to
create that device , but for this you must write a kernel module, master the technique of kernel modules.
> And already this device on its side will buffer and write in portions of 1 KB to the desired file with the necessary delay.
Actually, the device (from the kernel) does not write anywhere else.
In principle, this can also be done ... but this is already a perversion ... in the ideology of Linux.

S
Saboteur, 2015-10-21
@saboteur_kiev

"Now there is a need to transfer data in a special way - write to a 1Kb file and make a delay of 100ms."
Are you sure that the need appeared precisely in the recording with a delay of 100ms?
Can you describe why such a need is needed, and there will be a much more adequate solution?

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question