select() fails on AIX 5.2, but errno is not set - Aix

This is a discussion on select() fails on AIX 5.2, but errno is not set - Aix ; Hi people, I've the following problem in an AIX 5.2 machine. I've an application written in C that, in some portion of it, use select(): n = select(.....); if(n fprintf(stderr,"select() failed, %s\n",strerror_r(errno)); else ..... The curiousity is that I'm getting: ...

+ Reply to Thread
Results 1 to 2 of 2

Thread: select() fails on AIX 5.2, but errno is not set

  1. select() fails on AIX 5.2, but errno is not set

    Hi people, I've the following problem in an AIX 5.2 machine.

    I've an application written in C that, in some portion of it,
    use select():

    n = select(.....);
    if(n < 0)
    fprintf(stderr,"select() failed, %s\n",strerror_r(errno));
    else
    .....

    The curiousity is that I'm getting:

    select() failed, Error 0 (?!?!?!?!)

    (I'm using strerror_r due to the fact that the app is multithreaded and
    _THREAD_SAFE has been declared correctly.

    Any clues about what can be happening? The select() manual in AIX
    specify all the possible errno values returned in error, but never
    0 :-(

    Thanks a lot for your help.

  2. Re: select() fails on AIX 5.2, but errno is not set

    On Jul 27, 9:56 pm, Alvaro Palma wrote:
    > Hi people, I've the following problem in an AIX 5.2 machine.
    >
    > I've an application written in C that, in some portion of it,
    > use select():
    >
    > n = select(.....);
    > if(n < 0)
    > fprintf(stderr,"select() failed, %s\n",strerror_r(errno));
    > else
    > .....
    >
    > The curiousity is that I'm getting:
    >
    > select() failed, Error 0 (?!?!?!?!)
    >
    > (I'm using strerror_r due to the fact that the app is multithreaded and
    > _THREAD_SAFE has been declared correctly.
    >
    > Any clues about what can be happening? The select() manual in AIX
    > specify all the possible errno values returned in error, but never
    > 0 :-(
    >
    > Thanks a lot for your help.


    1) your test of < 0 does not match the documentation. It should be:
    if (n == -1)
    Since the definition of the return value for select is rather complex.

    2) you might try giving strerror_r all of its arguments:
    extern int strerror_r(int, char *, size_t);

    3) strerror_r returns an int, not a string
    -- S


+ Reply to Thread