/dev/primes is what I want without writing C code just python which I have known and easily written the program.
The device file should be similar to /dev/urandom that outputs primes instead of random stream!!
I am excited if linux could do it!
Character devices are provided by Linux kernel modules.
Linux kernel modules are written in C.
You can, in theory, use a programming language other than C. But your program needs to be compiled into a binary that can be loaded into the kernel. In particular, you need to define an initialization handler, an exit handler, as well as the functions
dev_release with well-defined signatures.
You cannot do this in Python (truly exotic approaches may exist, but I do not know of any).
For more information on how to write a Linux kernel module in C, confer to any guide (contents not inserted here due to copyright) you like.