Connecting Tech Pros Worldwide Forums | Help | Site Map

HP-UX sysinfo usage

k.szczesny@gmail.com
Guest
 
Posts: n/a
#1: Nov 15 '06
Hi,

i'm new to HP-UX and of course 've got some issues...

I want to make some use of sys/sysinfo.h but when running program i
get:
Invalid argument

Here's a short code sample:

#include <stdlib.h>
#include <stdio.h>
#include <sys/sysinfo.h>

int main(int argc, const char *argv[])
{
struct minfo s_info;
int ret = sysinfo(&s_info);

if(ret == -1){
perror("");
exit(-1);
}
return 1;
}

I bet it's lame, but i don't know how to solv this...
Please, help me with this one...

Best regards,
Krystian


Richard Heathfield
Guest
 
Posts: n/a
#2: Nov 15 '06

re: HP-UX sysinfo usage


k.szczesny@gmail.com said:
Quote:
Hi,
>
i'm new to HP-UX and of course 've got some issues...
>
I want to make some use of sys/sysinfo.h but when running program i
get:
Invalid argument
>
Here's a short code sample:
>
#include <stdlib.h>
#include <stdio.h>
#include <sys/sysinfo.h>
That's a non-standard header, so you should beware the following reply,
which is based on my inspection of my own system headers, which may be
completely different to yours.
Quote:
int main(int argc, const char *argv[])
{
struct minfo s_info;
Look up sysinfo(), and check that it really does take a pointer to a struct
minfo object. On my system, it doesn't. So the topical, ISO C answer to
your question is that you appear to be passing a pointer of one type to a
function that expects a pointer to a different type.

Your best bets for the exact semantics and usage of sysinfo() are:

(1) consult your system's documentation;
(2) ask in comp.unix.programmer if you get stuck.

--
Richard Heathfield
"Usenet is a strange place" - dmr 29/7/1999
http://www.cpax.org.uk
email: normal service will be restored as soon as possible. Please do not
adjust your email clients.
Don Morris
Guest
 
Posts: n/a
#3: Nov 15 '06

re: HP-UX sysinfo usage


k.szczesny@gmail.com wrote:
Quote:
Hi,
>
Note: This is entirely OffTopic in comp.lang.c -- hence followups
are set to comp.sys.hp.hpux where this belongs. Gentle (or not
so gentle) readers of comp.lang.c, please ignore the rest of this OT
reply -- thanks.
Quote:
i'm new to HP-UX and of course 've got some issues...
Using undocumented system calls strikes me as a rather
odd way to start.

I will say that I don't think sysinfo() takes the arguments you think
it does. And given that this is a undocumented call.. those are
undocumented for a reason [i.e. HP doesn't really intend folks to
call it unless they're partners with some type of support/development
agreement...].

My suggestion? If you want the type of information that's in the
minfo structure (although some of that structure I can't tell
exactly what it thinks it would get exactly, mind you) -- use
the documented, supported interfaces for it. Assuming you're running
on anything vaguely recent, that should be pstat(). Likely you'll
want one or more of pstat_getvminfo(), pstat_getstatic() and
pstat_getdynamic(). "man 2 pstat" for your system -- note particularly
the section telling you where the headers for the structures live
[this varies by release], check the structure definitions for field
descriptions.

If you were trying for something more arcane/machine dependent such
as CPU type, etc. "man 2 sysconf"

Don
Quote:
>
I want to make some use of sys/sysinfo.h but when running program i
get:
Invalid argument
>
Here's a short code sample:
>
#include <stdlib.h>
#include <stdio.h>
#include <sys/sysinfo.h>
>
int main(int argc, const char *argv[])
{
struct minfo s_info;
int ret = sysinfo(&s_info);
>
if(ret == -1){
perror("");
exit(-1);
}
return 1;
}
>
I bet it's lame, but i don't know how to solv this...
Please, help me with this one...
>
Best regards,
Krystian
>
Default User
Guest
 
Posts: n/a
#4: Nov 15 '06

re: HP-UX sysinfo usage


Richard Heathfield wrote:
Quote:
k.szczesny@gmail.com said:
>
Quote:
Hi,

i'm new to HP-UX and of course 've got some issues...
Quote:
Your best bets for the exact semantics and usage of sysinfo() are:
>
(1) consult your system's documentation;
(2) ask in comp.unix.programmer if you get stuck.

A possible avenue would be the comp.sys.hp.hpux newsgroup as well.





Brian
Closed Thread