![]() |
|
|
|
|
|||||||
| Forums | Portal | Register | Rules & FAQ | Contribute | Members List | Arcade | Search | Today's Posts | Mark Forums Read |
| HP-UX HP-UX (Hewlett Packard UniX) is Hewlett-Packard's proprietary implementation of the Unix operating system, based on System V. |
|
|
||||
| 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 |
|
|
LinkBack | Thread Tools | Display Modes |
|
|||
|
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. |
| Forum Sponsor | ||
|
|
|
|||
|
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 |
|
|||
|
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? |
|||
| Google UNIX.COM |