Search code examples
cvxworkserrno

errno returns zero always in VxWorks PPC


I am running my code on VxWorks PPC and incase of system call failures especially for socket send / recv functions, errno returns 0 always.

After some analysis I found that, errno returns 0 incase of all system call failures.

Is there any initialization which I should be doing for errno to return correct values?


Solution

  • From a shell (either kernel or host), if you type the 'i' command, you will get a list of your tasks. One of the field is the errno value. Find the task that has an error and the errno value should be set.

    When checking errno, you HAVE to be in the same task that caused the error:

    if(ERROR = someSystemFunction())
      printf("errno=%x", errno);
    

    You can't be at the shell and expect to print errno

    -> errno     (<---- will NEVER work)
    errno:0x123455 value: 0 = 0x0