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
Following http://dev.haiku-os.org/ticket/5334#comment:3
In the following test case, sem_timedwait() should return EINVAL, but it return ETIMEDOUT
Spec: http://www.opengroup.org/onlinepubs/9699919799/functions/sem_timedwait.html
Attachments (1)
Change History (6)
by , 12 years ago
Attachment: | 0001-sem_timedwait-fix-errno-return-value-and-NULL-behavi.patch added |
---|
comment:1 by , 12 years ago
patch: | 0 → 1 |
---|
comment:2 by , 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:4 by , 12 years ago
Owner: | changed from | to
---|---|
Status: | new → assigned |
comment:5 by , 12 years ago
Resolution: | → fixed |
---|---|
Status: | assigned → closed |
Patch amended with Ingo's remarks and applied in hrev44996
Note:
See TracTickets
for help on using tickets.
gci 2012