Opened 15 years ago

Closed 12 years ago

#5628 closed bug (fixed)

sem_timedwait() return invalid error code

Reported by: kaliber Owned by: korli
Priority: normal Milestone: R1
Component: System/POSIX Version: R1/Development
Keywords: Cc:
Blocked By: Blocking:
Platform: All

Description

Attachments (1)

0001-sem_timedwait-fix-errno-return-value-and-NULL-behavi.patch (1.4 KB ) - added by korli 12 years ago.
gci 2012

Download all attachments as: .zip

Change History (6)

comment:1 by korli, 12 years ago

patch: 01

comment:2 by bonefish, 12 years ago

Calling the syscall twice isn't a nice solution. The following approach would be better:

if (timeout parameter invalid) {
    call _kern_realtime_sem_wait() with 0 timeout;
    if error is B_WOULD_BLOCK, return EINVAL, otherwise the returned error;
}
translate timeout and call _kern_realtime_sem_wait();

Since B_WOULD_BLOCK is not an error code specified by POSIX, it should be translated to ETIMEDOUT in case the timeout parameter is valid.

comment:3 by korli, 12 years ago

Right, I'll amend the patch before applying. Thanks!

comment:4 by korli, 12 years ago

Owner: changed from nobody to korli
Status: newassigned

comment:5 by korli, 12 years ago

Resolution: fixed
Status: assignedclosed

Patch amended with Ingo's remarks and applied in hrev44996

Note: See TracTickets for help on using tickets.