By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
454,605 Members | 1,391 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 454,605 IT Pros & Developers. It's quick & easy.

HP-UX sysinfo usage

P: n/a
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

Nov 15 '06 #1
Share this Question
Share on Google+
3 Replies


P: n/a
k.********@gmail.com said:
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.
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.
Nov 15 '06 #2

P: n/a
k.********@gmail.com wrote:
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.
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
>
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
Nov 15 '06 #3

P: n/a
Richard Heathfield wrote:
k.********@gmail.com said:
Hi,

i'm new to HP-UX and of course 've got some issues...
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
Nov 15 '06 #4

This discussion thread is closed

Replies have been disabled for this discussion.