5 ms·
I haven't done any kernel programming yet, but the curiosity has been there. What has been your main difficulty in finding the right APIs? Lack of documentation
by korethr 6y ago
I haven't done any kernel programming yet, but the curiosity has been there. What has been your main difficulty in finding the right APIs? Lack of documentation? Poor or unclear documentation? Something else?
- woodruffw 6y ago> What has been your main difficulty in finding the right APIs? Lack of documentation? Poor or unclear documentation? Something else? Definitely poor (or more often, old) documentation. In particular, this has popped up for me when trying to write modules that add entries to procfs or sysfs: these interfaces are documented and widely used, but much of the documentation is years old and the APIs (or their best practices) have changed subtly. My best reference has just been the subsystem source itself, as well as other kernel modules that I know work. Another thing that pops up: the Linux kernel is so big and has so many architecture-specific subtrees that it can be difficult to find the "effective" definition for some function or macro. Woboq and Elixir help with this a bit, but it's very easy to go down a rabbit hole.
- mhh__ 6y agoKernel documentation isn't great, and it tends to be distributed as one big long-form text file. This has it's benefits because it encourages explaining the rationale behind a given design, but it also means that you can end up with rotten old information looking just as recent as the new stuff. Man pages often don't actually cover a complete listing of everything an API has, too. eBPF is a good microcosm of this, where using it isn't all that complicated but actually working out what to do can take ages because most resources use a middle-man to talk to the kernel.