Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Read linux kernel version using C?

Tags:

c

linux-kernel

I am using Ubuntu and I want to read the version of its kernel. I found a file named version in /proc/ that records the version of the current kernel.

If I dont want to read file, is there any other way, like built-in function in C, that I can read the version in C?

Thanks

like image 998
ipkiss Avatar asked Jun 07 '10 06:06

ipkiss


2 Answers

You can use the uname() system call.

like image 150
Unknown Avatar answered Nov 13 '22 14:11

Unknown


Check the uname function. It gives you a lot of information without the need to parse output of some linux executables.

like image 10
INS Avatar answered Nov 13 '22 14:11

INS