1831912 Members
3535 Online
110031 Solutions
New Discussion

Re: HPUX kernel version

 
yck
Advisor

HPUX kernel version

Hi all,

Is that possible to get kernel version of HPUX machine at runtime by using C/C++ code or API? If yes, how could we do it? Thanks.

-ck
ck
11 REPLIES 11
harry d brown jr
Honored Contributor

Re: HPUX kernel version

man sysconf


live free or die
harry
Live Free or Die
harry d brown jr
Honored Contributor

Re: HPUX kernel version

and man getconf


live free or die
harry
Live Free or Die
A. Clay Stephenson
Acclaimed Contributor

Re: HPUX kernel version

There are 2 system calls that can be of use: uname() and sysconf. Man 2 sysconf and man 2 uname for details. You should be warned that you may be writing non-portable code.
If it ain't broke, I can fix that.
harry d brown jr
Honored Contributor

Re: HPUX kernel version

Clay, you can if/def it, right?

live free or die
harry
Live Free or Die
yck
Advisor

Re: HPUX kernel version

Hi all,

Actually I'm trying to refer to sysconf, getconf but there is no parameter to let me get kernel version of a local HPUX machine. Do I miss out somethings?

- ck
ck
T G Manikandan
Honored Contributor

Re: HPUX kernel version

How about using the

uname -r

THanks
yck
Advisor

Re: HPUX kernel version

That is operating system version... Not kernel version.

-ck
ck
Michael Tully
Honored Contributor

Re: HPUX kernel version

Hi CK,

# what /stand/vmunix

This gives lots of kernel related information.

Michael
Anyone for a Mutiny ?
yck
Advisor

Re: HPUX kernel version

However, I need to retrieve the kernel version of HPUX machine by using C/++ API..
Could it be possible to do it?

Thanks

-ck

ck
doug hosking
Esteemed Contributor

Re: HPUX kernel version

A bare bones version of what you are asking
for would seem to be:

#include
main()
{
struct utsname u;
uname(&u);
printf("%s\n", u.release);
exit(0);
}
harry d brown jr
Honored Contributor

Re: HPUX kernel version