[BUG] Rust: libc::PTHREAD_MUTEX_INITIALIZER is incorrect
Maintainer thường phản hồi trong vòng 1 ngày
Chưa có ai nhận issue này.
Đánh giá
- Độ khó
- 5/5
- Thời gian dự kiến
- Hơn một tuần
- Mức phù hợp với người mới
- 35/100
- Loại issue
- Lỗi
- Độ rõ ràng
- Cần làm rõ
- Mức độ hoạt động
- Sôi nổi
- Lĩnh vực
- embedded-iot, operating-systems
Hướng nghiên cứu
Compare Rust libc's definition in src/unix/nuttx/mod.rs with NuttX's PTHREAD_MUTEX_INITIALIZER in include/pthread.h and NXSEM_NO_MHOLDER in include/nuttx/semaphore.h. Then inspect Rust std's use in library/std/src/sys/pal/unix/sync/mutex.rs. Done means an agreed approach produces a valid mutex initializer across the relevant NuttX configurations.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
Description / Steps to reproduce the issue
Rust libc initializes PTHREAD_MUTEX_INITIALIZER to 0: https://github.com/rust-lang/libc/blob/c2744242b816317ea8b5c8e306eb829c080cb2b9/src/unix/nuttx/mod.rs#L310
But in NuttX this is generally not 0.
For example, defined here: https://github.com/apache/nuttx/blob/master/include/pthread.h#L359
Going into https://github.com/apache/nuttx/blob/master/include/pthread.h#L353
Which makes use of NXSEM_NO_MHOLDER, defined here: https://github.com/apache/nuttx/blob/master/include/nuttx/semaphore.h#L70
Furthermore, the initialization also depends on the configuration.
In Rust, std makes use of the constant to init mutexes, e.g. here: https://github.com/rust-lang/rust/blob/7d2cd0fbc092625ea371da704f15f80216d2220e/library/std/src/sys/pal/unix/sync/mutex.rs#L12
I'm not sure what the best solution is, I see some options:
- remove the symbol definition from Rust (and update std to use
pthread_mutex_initinstead) - init the Rust definition to a matching value and either require a certain config or make sure the position of the non-zero values is independent from the config
- update NuttX so the definition is always 0 (in addition to requiring a specific config)
On which OS does this issue occur?
[OS: Linux], [OS: BSD], [OS: Mac], [OS: Windows]
What is the version of your OS?
Irrelevant
NuttX Version
master
Issue Architecture
[Arch: all]
Issue Area
[Area: Posix], [Area: Applications]
Host information
No response
Verification
- I have verified before submitting the report.
- Ngôn ngữ chính
- C
- Star
- 4.1k
- Fork
- 1.8k
- Merge trung bình
- 1 ngày 5 giờ
- Pull request đã merge (30 ngày)
- 841
Chuẩn bị môi trường
- Không có Dockerfile hay tệp Docker Compose
- Có mẫu pull request
- Đọc hướng dẫn đóng góp
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của apache/nuttx
-
Please rerun `pre-commit run -a`Đang mởArch: all Arch: arm Area: Build system OS: Linux Type: Bug
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 65/100
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
apache/nuttx#19435 · 9 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Arch: all OS: Linux Type: Bug
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 68/100
apache/nuttx#16249 · 7 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Type: Enhancement
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 22/100
Maintainer thường phản hồi trong vòng 1 ngày
-
Arch: simulator Arch: xtensa Area: Kernel OS: Mac Type: Bug
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 48/100
apache/nuttx#21499 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
Issue tương tự
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
Maintainer thường phản hồi trong vòng 1 ngày
-
hil-contract: a background hil_remote.py launch is killed at the Bash default 10 min timeoutĐang mởfollow-up Prio 📌
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 84/100
Maintainer thường phản hồi trong vòng 1 ngày
-
area: test kind: bug preview-effort: small priority: low
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 65/100
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 65/100
libsdl-org/SDL#16684 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 82/100