Opened 10 years ago

Closed 7 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:
Has a Patch: yes Platform: All

Description

Attachments (1)

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

Download all attachments as: .zip

Change History (6)

comment:1 by korli, 7 years ago

Has a Patch: set

comment:2 by bonefish, 7 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, 7 years ago

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

comment:4 by korli, 7 years ago

Owner: changed from nobody to korli
Status: newassigned

comment:5 by korli, 7 years ago

Resolution: fixed
Status: assignedclosed

Patch amended with Ingo's remarks and applied in hrev44996

Note: See TracTickets for help on using tickets.