C API to get Total SWAP installed on a HPUX machine
From: Manish Baronia (manishbaronia_at_hotmail.com)
Date: 08/25/03
- Next message: Dave Steele: "Re: Ping IP Address outside of Network Firewall"
- Previous message: banzai: "Re: Samba problems sharing a drive to W2000 (with usermap and SHARE security)"
- Next in thread: Mike Stroyan: "Re: C API to get Total SWAP installed on a HPUX machine"
- Reply: Mike Stroyan: "Re: C API to get Total SWAP installed on a HPUX machine"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: Mon, 25 Aug 2003 18:47:30 +0530
Hi All,
I want to find out total swap installed on a HP Unix machine (In
C/C++). For this I got following code somewhere:
struct pst_swapinfo swapinfo;
unsigned long total_swap, free_swap =0;
int MAX_SWAP_AREAS = 1024;
for (int i = 0 ; i < MAX_SWAP_AREAS ; i++)
{
pstat_getswap(&swapinfo, sizeof(swapinfo), (size_t)1, i);
if (swapinfo.pss_idx == (unsigned)i)
{
swapinfo.pss_nfpgs *= 4; // nfpgs is in 512 Byte Blocks....
if (swapinfo.pss_nblksenabled == 0) // == 0 ??
swapinfo.pss_nblksenabled = swapinfo.pss_nfpgs;
total_swap += (((unsigned long)swapinfo.pss_nblksenabled) *
1024);
free_swap += (((unsigned long)swapinfo.pss_nfpgs ) *
1024);
}
}
Can someone tell me if this is the correct way to find swap on HP UX
machines. I have tried it on 3 HP machines. It runs fine on one and
fails on other two.
TIA,
Manish
- Next message: Dave Steele: "Re: Ping IP Address outside of Network Firewall"
- Previous message: banzai: "Re: Samba problems sharing a drive to W2000 (with usermap and SHARE security)"
- Next in thread: Mike Stroyan: "Re: C API to get Total SWAP installed on a HPUX machine"
- Reply: Mike Stroyan: "Re: C API to get Total SWAP installed on a HPUX machine"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|