Q (HP-UX 11.31): pstat_getproc() - HP UX

This is a discussion on Q (HP-UX 11.31): pstat_getproc() - HP UX ; Hi, there's something I don't understand in a very current HP-UX 11.31: pstat_getproc() fills an array of structures with process information, returning the count of entries put there. If I pass a large array (>400 entries), pstat_getproc() returns -- say ...

+ Reply to Thread
Results 1 to 2 of 2

Thread: Q (HP-UX 11.31): pstat_getproc()

  1. Q (HP-UX 11.31): pstat_getproc()

    Hi,

    there's something I don't understand in a very current HP-UX 11.31:
    pstat_getproc() fills an array of structures with process information,
    returning the count of entries put there.

    If I pass a large array (>400 entries), pstat_getproc() returns -- say -- 280
    entries. If I call the routine again with an updated index (as long a sthe
    previous result was > 0), pstat_getproc() will return 8 entries, then maybe 1
    and another one, and eventually zero entries. Now the entries after the first
    chunk all seem duplicates.

    I wonder if pstat_getproc() is broken.

    The example code does memset the array to zero before calling it, but that
    seems not necessary WHEN pstat_getproc() does return the count of process
    structures filled in.

    Can anybody explain?

    Regards,
    Ulrich

  2. Re: Q (HP-UX 11.31): pstat_getproc()

    Ulrich Windl writes:

    > Hi,
    >
    > there's something I don't understand in a very current HP-UX 11.31:
    > pstat_getproc() fills an array of structures with process information,
    > returning the count of entries put there.
    >
    > If I pass a large array (>400 entries), pstat_getproc() returns -- say -- 280
    > entries. If I call the routine again with an updated index (as long a sthe
    > previous result was > 0), pstat_getproc() will return 8 entries, then maybe 1
    > and another one, and eventually zero entries. Now the entries after the first
    > chunk all seem duplicates.
    >
    > I wonder if pstat_getproc() is broken.


    MEA CULPA - BLAME ME!: I was under time pressure, and I messed up providing
    the correct "index" for pstat_getproc(). Actually the value is not documented
    very well, except for the shortcut case. You'll have to stuidy the examples.

    Now my program works as expected.

    Ulrich


    >
    > The example code does memset the array to zero before calling it, but that
    > seems not necessary WHEN pstat_getproc() does return the count of process
    > structures filled in.
    >
    > Can anybody explain?
    >
    > Regards,
    > Ulrich


+ Reply to Thread