I'm writing an app that uses OpenVPN library, which by default reads and writes to a tun device through a file descriptor. I want to create a file descriptor for my app and pass to OpenVPN so it can send IP packets through this file descriptor.
However, I don't know which type of file to open. If I open an IP socket, then all the data I send to this socket will go to the system, which is not what I want. If I open a simple file, it'll get written to the disk which is not what I want. Is there a 'virtual' file that can be opened by my app and written/read only from the app and no other apps can access?
If possible, this system call should be the same on all operating systems