3 ms·
> You can program KVM using the well known UNIX file paradigm. Does anyone know why the API was designed this way? Sending a bunch of ioctls to modify the KVM
by saagarjha 7y ago
> You can program KVM using the well known UNIX file paradigm.
Does anyone know why the API was designed this way? Sending a bunch of ioctls to modify the KVM state seems no better than just having normal function calls for it…
- wyldfire 7y ago> Sending a bunch of ioctls to modify the KVM state seems no better than just having normal function calls for it Seeing as how they're mmap()ing the fds, it makes some sense to leverage the other file_operations.
- rwmj 7y agoWhat would "normal function calls" mean? This is happening on the Linux syscall boundary.
- saagarjha 7y agoRight; why isn’t there a sys_kvm syscall that you can just call from a C program?
- shuss 7y agoIt it's not the file paradigm, it has to be system calls (plenty of them) set in stone, which could quickly turn into a problem or you probably mean a wrapper library?
- q3k 7y agoIt's Linux style. Syscalls are last resort - they're low level and have to be maintained forever. Instead, there are more robust and purpose specific abstractions built on top of them: - ioctls on char/blkdevs for either physical or logical devices (which also allow for a 'handle' paradigm of operation, and for event polling via epoll/select) - sysfs and procfs entries for system and process tunables and data - debugfs for day to day debugging (which is explicitely unstable and not enabled in most production kernels) - prctl, fcntl, ... In addition, all of the above is 'automatically' ported across architectures. Some Linux architecture ports have their own syscall tables (with own numbering) and need to be explicitly modified any time a syscall is added.
- deleted 7y ago[deleted]