RT-Thread / RT-Thread/rt-thread
[Feature] rt_set_errno()设置的错误码为正值还是负值不统一
Open
Nobody has claimed this yet.
- Dominant language
- C
- Stars
- 12.2k
- Forks
- 5.4k
- Avg merge
- 4d 12h
- Merged PRs (30d)
- 40
Description
Describe problem solved by the proposed feature
代码中对于错误码__rt_errno的值应为正还是为负,在多处调用rt_set_errno()的地方不统一,有些地方传入的参数是正值,如rt_set_errno(EPERM);, 有些地方又是把标准错误码取负后再传入,类似rt_set_errno(-EPERM); 这样,如果函数调用方通过rt_get_errno()获取errno,并根据errno做逻辑时有较大出错风险。
Describe your preferred solution
建议统一将 errno 设定为正整数,与linux一致。
Describe possible alternatives
No response
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Search the repository for every rt_set_errno() call and inspect how rt_get_errno() is consumed. Compare positive and negative errno usage across these call sites, then verify that the affected callers consistently use positive standard error codes as requested; the issue names no specific files or tests.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- c
- Domain
- embedded-iot, operating-systems
- Issue type
- Refactor
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100