#568 closed defect (fixed)
Errno error codes should not be negative
Reported by: | Jiri Svoboda | Owned by: | Jiří Zárevúcky |
---|---|---|---|
Priority: | major | Milestone: | 0.7.2 |
Component: | helenos/unspecified | Version: | mainline |
Keywords: | Cc: | ||
Blocker for: | Depends on: | ||
See also: |
Description
In HelenOS errno.h (both kernel and user-space) defines error codes as negative (and EOK as zero). This conflicts with C standard errno.h that defines (many of the same) error codes as positive.
Since the goal is to try to align HelenOS kernel environment with C standard freestanding env. and userspace with C standard hosted env, this should be fixed.
Change History (5)
comment:1 by , 11 years ago
comment:2 by , 9 years ago
Applications compiled in POSIX compatibility mode (i.e. using libposix) have a big problem: Their Exxxx macros are nonnegative. Yet if they called a function from libc (or a function from libposix which just calls a function from libc) and an error occurs, errno will be set to a negative value. Then checks such as errno == Exxx will always fail, trying to human-print the errno value might fail too.
comment:3 by , 7 years ago
Owner: | set to |
---|---|
Status: | new → accepted |
comment:4 by , 7 years ago
Milestone: | → 0.7.2 |
---|---|
Resolution: | → fixed |
Status: | accepted → closed |
Fixed in commit 0d0b3197a149bb5e5c53d21136df5b8c283cdc4a.
This does not mean replacing every occurence of Exxx with -Exxx. On the contrary.
The sign of error codes makes difference in two cases:
rc < 0
which should really berc != 0/EOK
. This just can happen in ported software (and thus we must change it to be compliant with standard), but we can fix it in original HelenOS code, if it is present anywhere (and thus we can change it).