Flo
Flo

Reputation: 11

getsysinfo(GSI_BOOTEDFILE,...) rehosting

I am rehosting a program from tru64 to linux. I can't find a replacement for getsysinfo(GSI_BOOTEDFILE,...) in C man getsysinfo

How can I get the name of the file from which the currently running kernel was booted under SUSE11 in C? I am out of solution. Thank you

Upvotes: 1

Views: 187

Answers (2)

Zan Lynx
Zan Lynx

Reputation: 54325

There is /proc/version and /proc/cmdline which will tell you the version information of the running kernel and what options were passed to it on its command-line.

Between these two files you should be able to figure out which kernel is running, unless for some reason you have several kernel files of the same version lying about.

Upvotes: 1

user149341
user149341

Reputation:

There's no general way of doing this, and it's not always possible -- for instance, if the machine is PXE booted, or if it's an embedded system, the kernel may not exist on disk at all. On an x86 system, you can make a guess by attempting to parse the lilo/grub config, but this won't give reliable results.

Upvotes: 0

Related Questions