I was snooping around looking at various kernel header files and stumbled across <linux/kernel.h>. Inside it is a structure called sysinfo.
I’ve tried using it out of the box so to speak and all the values in the structure returned 0. Im guessing I need to use the poplating function above called do_sysinfo(struct sysinfo *info).
The thing is I can’t find any info which references how to use it. I tried the function out of the box and it failed because it couldn’t be linked. Anyone have any information about how to use this or why it’s failing? I am a newbie in this area. Would like any links to good guides/info if you have them, that would be great.
I’m guessing you tried to call that function from userspace. That is not possible, since that header is for kernel use only, except for the struct sysinfo that is “shared”.
You probably want to use the system call
int sysinfo(struct sysinfo *info)by includingsys/sysinfo.hin order to populate thestruct sysinfo.