AIX

AIX

Connect with fellow AIX users and experts to gain knowledge, share insights, and solve problems.

 View Only

Identifying a pid that does not exist

  • 1.  Identifying a pid that does not exist

    Posted Thu January 01, 2009 01:59 AM

    Originally posted by: drajarsh


    Hi,

    I am invoking the api getprocs64 () passing a pid e.g. 124 which does not exist (is not part of ps -eaf output). getprocs64 () returns EINVAL. However, it can return EINVAL for a host of error conditions such as (from IBM infocenter):

    EINVAL : The ProcessSize or FileSize parameters are invalid, or the IndexPointer parameter does not point to a valid process identifier, or the Count parameter is not greater than zero.

    Query 1: If I see the return value of getprocs64 () to be EINVAL, is there a definite (unique) way to confirm that the error happened due to a invalid pid being passed as above (and not any of the other conditions that can also result in a EINVAL)? Possibly by checking the value of some other parameters returned in struct procsinfo/info64 ?

    Query 2: If I pass 123 in the above case, I know that it is a unsupported pid # (since its odd). Can this case be distinguished from the case in query 1 (where the pid # is supported but it does not exist) although both will return EINVAL?

    Thanks in advance for all the help,
    Rajarshi