pstat_getdisk() call doesn’t work properly in HPUX 11.31 (11i V3)


 
Thread Tools Search this Thread
Operating Systems HP-UX pstat_getdisk() call doesn’t work properly in HPUX 11.31 (11i V3)
# 1  
Old 10-15-2007
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 11:32 AM..
# 2  
Old 10-16-2007
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
# 3  
Old 10-25-2007
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?
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Red Hat

TAB button doesn't work properly

Hi, I have list of files under a directory as shown below. /home/root -rw-r--r-- 1 user 0 Aug 27 06:08 rough.txt -rw-r--r-- 1 user 0 Aug 27 06:08 test.sh Now when i use to read the rough.txt, i did cat r and then pressed TAB button. Below is the resulting string after pressing TAB... (2 Replies)
Discussion started by: vel4ever
2 Replies

2. HP-UX

wcsftime() on HPUX doesn't work

Hi, I'm wrote a small program on HPUX that uses wcsftime, but this function seems to be not working - I get 0 as a result, the output buffer returns empty, and errno is 0 : #include <iostream> using namespace std; int main () { size_t formattedTimeLength = 0; wchar_t formattedTime... (9 Replies)
Discussion started by: itaiy
9 Replies

3. HP-UX

minimum hardware requirement for HPUX 11i V3

I am new for HPUX OS and want to pursue my career in HPUX Administration. I could not able to get following information from HP.com site, that why I need an assistance to know that - can I install HPUX 11i V3 OS on old HP B2000 & B1000 workstations (these workstation are 4 to 5 year old) or not,... (5 Replies)
Discussion started by: girish.batra
5 Replies

4. UNIX and Linux Applications

Gvim doesn't work properly

Hello All, I am using gvim ( redhat linux machine). backspace doesnot work properly. can some boby suggest a solution ? i have checked with older version. backspace works in it. Thanks Shiv (1 Reply)
Discussion started by: shiv.emf
1 Replies

5. Solaris

Solaris Network doesn't work properly

Hi to all! I want to learn step by step easily how to configure my Solaris for network. I know alot about Solaris Network configuration. But I have some problems. When I install Solaris, and I plug-in my network cable to Solaris. Then I run: ifconfig -a plumb then I do ifconfig bge0 dhcp... (7 Replies)
Discussion started by: SecureXCode
7 Replies

6. AIX

lvm_queryvg call does not work properly and results in a sudden memory rise.

On AIX 5.3 host, the lvm_queryvg call does not work properly and results in a sudden memory rise. This is happening on one particular host and the call works fine on another host. Is this a known issue and is there any patch available for this? (0 Replies)
Discussion started by: sandiworld
0 Replies

7. UNIX for Advanced & Expert Users

ksh read bug in HPUX 11i

Is this a bug in ksh on HPUX 11i or is read impromperly documented? INPUT Thu Jan 18 09:14:52 PST : CIFS: Virus Detected - File ONTAP_ADMIN$\vol\vol0\DDD\Ventana\Strattoni\Race Stuff\Rumor.exe in share DDD accessed by client CLIENT (111.11.11.111) running as user USER is infected. The filer... (3 Replies)
Discussion started by: Jackaroe
3 Replies

8. HP-UX

backspace deletion hpux 11i

how i can enable backspace or charector deletion in hpux11i shell prompt. (12 Replies)
Discussion started by: jestinabel
12 Replies

9. UNIX for Dummies Questions & Answers

Script doesn't work, but commands inside work

Howdie everyone... I have a shell script RemoveFiles.sh Inside this file, it only has two commands as below: rm -f ../../reportToday/temp/* rm -f ../../report/* My problem is that when i execute this script, nothing happened. Files remained unremoved. I don't see any error message as it... (2 Replies)
Discussion started by: cheongww
2 Replies

10. HP-UX

is nedit available in hpux 11i version 2?

hi 1).in the command "set" result, the 2nd line is EDITOR=vi is it means the vi editor is the default editor? 2). is "nedit"editor available in hpux 11iv2? if no how to install or work in nedit in hpux 11i? (0 Replies)
Discussion started by: sekar sundaram
0 Replies
Login or Register to Ask a Question