Ask HN: A kernel module that adds a syscall
How awesome would it be if I could write a kernel module that could enable a syscall like functionality. Example: I want to make something like pipe() or fork() but with highly customized behavior that runs with the kernel and produces an FD to be used by userspace software.
eg:
int fd = my_custom_syscall_like_functionality_related_to_my_hardware(FLAG_X | FLAG_Y);
int rc = read(fd, ...);
rc = write(fd, ...);
close(fd)
Does this or something similar already exists? I can write kernel modules that add devices and stuff for connected hardware but I only recently learned how to do that so I dont know what I dont know.
1 comment
[ 2.0 ms ] story [ 233 ms ] thread“In computing, ioctl (an abbreviation of input/output control) is a system call for device-specific input/output operations and other operations which cannot be expressed by regular system calls. It takes a parameter specifying a request code; the effect of a call depends completely on the request code. Request codes are often device-specific. For instance, a CD-ROM device driver which can instruct a physical device to eject a disc would provide an ioctl request code to do so.”