The UNIX and Linux Forums  

Go Back   The UNIX and Linux Forums > OS Specific Forums > HP-UX
Google UNIX.COM


HP-UX HP-UX (Hewlett Packard UniX) is Hewlett-Packard's proprietary implementation of the Unix operating system, based on System V.

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
lvm_queryvg call does not work properly and results in a sudden memory rise. sandiworld AIX 0 11-14-2007 09:57 PM
my case statement doesn't work.. sureshy UNIX for Dummies Questions & Answers 7 10-25-2002 11:25 AM
unmount doesn't work DISTURBED UNIX for Dummies Questions & Answers 2 07-04-2002 03:14 PM
Repquota doesn't work as Cronjob?!? b416 UNIX for Dummies Questions & Answers 1 04-14-2002 05:44 PM
why doesn't this work????? token High Level Programming 1 09-20-2001 07:08 AM

Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 10-15-2007
Registered User
 

Join Date: Oct 2007
Posts: 4
pstat_getdisk() call doesn’t work properly in HPUX 11.31 (11i V3)

As per the man page, pstat_getdisk() call returns the number of instances, which could be 0 upon successful completion, otherwise a value of -1 is returned.

Please have a look at this sample program ->

#include <stdio.h>
#include <sys/pstat.h>

int main()
{
int j = 0, ret;
struct pst_diskinfo sDiskData;

while(1)
{
ret = pstat_getdisk(&sDiskData, sizeof(sDiskData), 1, j);
if(ret<0)
{
printf("\nReturned with code %d \n",ret);
break;
}
printf("\n Ret Code : %d , Device Name : %s%d",ret,sDiskData.psd_drv_name.psd_name,sDiskData.psd_instance);
j++;
}
return 0;
}

On HP-UX 11.11 and 11.23, the call pstat_getdisk() returns series of ‘1’s then single ‘0’ and finally ‘-1’ and the program terminates successfully.

On HP-UX 11.31 the call pstat_getdisk() returns series of ‘1’s followed by series of ‘0’s and never returns ‘-1’, so the same program never terminates.

The workaround would be to replace the condition
if(ret<0)
with
if(ret==0)

But, will this call always returns ‘1’s followed by ‘0’s or there can be a case in which the call will return ‘0’ in between?

In another way, can we get an invalid index in between or all the valid disks are in sequence only?

Last edited by sandiworld; 10-25-2007 at 07:32 AM.
Reply With Quote
Forum Sponsor
  #2 (permalink)  
Old 10-16-2007
...@...
 

Join Date: Feb 2004
Location: NM
Posts: 3,491
I think it's maybe the other way around. 11.31 is working correctly. Anyway. pstat_getdisk is supposed to return -1 on error and return the number of instances processed. You do know you could set the index to start, and get, say, 40 disks with one call?

Read the docset for pstat here (the man pages are, um, not helpful sometimes)
http://docs.hp.com/en/1216/pstat_whitepaper.pdf
Reply With Quote
  #3 (permalink)  
Old 10-25-2007
Registered User
 

Join Date: Oct 2007
Posts: 4
Thanks a lot for your valuable comment.
I need to query this call with 1 element only and I have to process the output.
So is it for sure that pstat_getdisk() always returns 0 at the end of the list only and not in between?
Can we break the loop on if(ret <= 0) condition?
Reply With Quote
Google UNIX.COM
Reply

Thread Tools
Display Modes




All times are GMT -7. The time now is 05:17 PM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited.
The UNIX and Linux Forums Content Copyright ©1993-2008 The CEP Blog All Rights Reserved -Ad Management by RedTyger Visit The Global Fact Book

Content Relevant URLs by vBSEO 3.2.0