Project Home
Project Home
Documents
Documents
Wiki
Wiki
Discussion Forums
Discussions
Project Information
Project Info
BroadcastCommunity.qnx.com will be offline from May 31 6:00pm until June 2 12:00AM for upcoming system upgrades. For more information please go to https://community.qnx.com/sf/discussion/do/listPosts/projects.bazaar/discussion.bazaar.topc28418
Forum Topic - dispatch_block() in resource manager reporting unexpected errno messages: (4 Items)
   
dispatch_block() in resource manager reporting unexpected errno messages  
Hi:

I running QNX632 on a ppc405ep processor. I am puzzled by the following errno messages I periodically see sprinkled in 
my slogs that correspond to my resource manager from the call to dispatch_block in my main loop:
ESRCH            3  /* No such process
EAGAIN          11  /* Resource unavailable, try again
ENOSYS          89  /* Unknown system call   

From my understanding of the dispatch_block() call is it just waits on a message queue for a message sent to your 
resource manager. So I'm a bit confused by the context of the above errno messages i.e. no such process - the RM process
 is still there, it hasn't died. 

Here is basically the code in question. Note that a timer is also to used to force the dispatch_block to timeout - this 
main loop is used to process incoming messages to the RM and also do some other work that is periodic and independent of
 the messages (Not how I would have done it but that's the code I inherited).

// reset errno  
int err = EOK;

int rc = TimerTimeout_r(CLOCK_MONOTONIC,_NTO_TIMEOUT_RECEIVE,
                  &event,&mtimeout,&time_left ); //*/
new_ctp = dispatch_block(ctp);
err = errno;

if (err!=ETIMEDOUT && err!=EOK) 
{
      slogf(SLOG_OPCODE_MRA_GEN, _SLOG_ERROR,
        "DPR: dispatch_block() error %s! on %s %s 0x%x",strerror(err), 
        dpr_path, dpr_cdr_path, dpr_cdr_devaddr[0]);
}

The documentation for dispatch_block() does not mention any of the above errno messages as possibly being returned. Also
 TimerTimeout_r() shouldn't set errno either. Any idea why dispatch_block() would be returning these errors?

Thanks
robert
RE: dispatch_block() in resource manager reporting unexpected errno messages  
Shouldn't you check that dispatch_block() returns NULL first, prior to
checking errno ?

-----Original Message-----
From: Robert D'Attilio [mailto:community-noreply@qnx.com] 
Sent: February 1, 2010 2:26 PM
To: ostech-core_os
Subject: dispatch_block() in resource manager reporting unexpected errno
messages

Hi:

I running QNX632 on a ppc405ep processor. I am puzzled by the following
errno messages I periodically see sprinkled in my slogs that correspond
to my resource manager from the call to dispatch_block in my main loop:
ESRCH            3  /* No such process
EAGAIN          11  /* Resource unavailable, try again
ENOSYS          89  /* Unknown system call   

From my understanding of the dispatch_block() call is it just waits on a
message queue for a message sent to your resource manager. So I'm a bit
confused by the context of the above errno messages i.e. no such process
- the RM process is still there, it hasn't died. 

Here is basically the code in question. Note that a timer is also to
used to force the dispatch_block to timeout - this main loop is used to
process incoming messages to the RM and also do some other work that is
periodic and independent of the messages (Not how I would have done it
but that's the code I inherited).

// reset errno  
int err = EOK;

int rc = TimerTimeout_r(CLOCK_MONOTONIC,_NTO_TIMEOUT_RECEIVE,
                  &event,&mtimeout,&time_left ); //*/
new_ctp = dispatch_block(ctp);
err = errno;

if (err!=ETIMEDOUT && err!=EOK) 
{
      slogf(SLOG_OPCODE_MRA_GEN, _SLOG_ERROR,
        "DPR: dispatch_block() error %s! on %s %s 0x%x",strerror(err), 
        dpr_path, dpr_cdr_path, dpr_cdr_devaddr[0]);
}

The documentation for dispatch_block() does not mention any of the above
errno messages as possibly being returned. Also TimerTimeout_r()
shouldn't set errno either. Any idea why dispatch_block() would be
returning these errors?

Thanks
robert



_______________________________________________

OSTech
http://community.qnx.com/sf/go/post46338
Re: dispatch_block() in resource manager reporting unexpected errno messages  
In POSIX style APIs errno is only meaningful if function fails. If function succeeds it DOES NOT set errno and 
(normally) is to preserve in errno whatever was there before the call.
Re: dispatch_block() in resource manager reporting unexpected errno messages  
Actually the return value from dispatch_block() is checked *after* checking errno. So I'll fix that taking into 
consideration what you said. 

However, if dispatch_block() times out (because of the immediately preceeding call to TimerTimeout_r() ) is that 
considered a failure which will return a null value and set errno? From what I see, a non-null context is returned is 
always returned and **most** of the time errno is set to  ETIMEDOUT - but occasionally it is set to those values I 
mentioned previously in my post.