[BUG] Rust: libc::PTHREAD_MUTEX_INITIALIZER is incorrect
Los mantenedores suelen responder en 1 día
Nadie ha tomado este issue todavía.
Evaluación
- Dificultad
- 5/5
- Tiempo estimado
- Más de una semana
- Aptitud para principiantes
- 35/100
- Tipo de issue
- Error
- Claridad
- Necesita aclaración
- Estado de actividad
- Activo
Línea de trabajo
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.
Escrito por el modelo de indexación a partir del texto del issue.
Descripción
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.
- Lenguaje dominante
- C
- Estrellas
- 4.1k
- Forks
- 1.8k
- Merge medio
- 1 d 5 h
- PR fusionados (30 d)
- 841
Preparar el entorno
- Sin Dockerfile ni archivo de Docker Compose
- Tiene una plantilla de pull request
- Leer la guía de contribución
Primeros pasos
- Lee el issue completo y luego la guía de contribución del proyecto.
- Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
- Haz un fork del repositorio y trabaja en una rama.
- Abre un pull request que haga referencia al número del issue.
Más de apache/nuttx
-
Please rerun `pre-commit run -a`AbiertoArch: all Arch: arm Area: Build system OS: Linux Type: Bug
Dificultad 2/5 1-3 horas Aptitud para principiantes 65/100
Los mantenedores suelen responder en 1 día
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 72/100
apache/nuttx#19435 · 9 comentarios ·
Los mantenedores suelen responder en 1 día
-
Arch: all OS: Linux Type: Bug
Dificultad 2/5 1-3 horas Aptitud para principiantes 68/100
apache/nuttx#16249 · 7 comentarios ·
Los mantenedores suelen responder en 1 día
-
Type: Enhancement
Dificultad 4/5 3-5 días Aptitud para principiantes 22/100
Los mantenedores suelen responder en 1 día
-
Arch: simulator Arch: xtensa Area: Kernel OS: Mac Type: Bug
Dificultad 4/5 3-5 días Aptitud para principiantes 48/100
apache/nuttx#21499 · 1 comentario ·
Los mantenedores suelen responder en 1 día
Todos los issues de apache/nuttx
Issues similares
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 78/100
Los mantenedores suelen responder en 1 día
-
area: test kind: bug preview-effort: small priority: low
Dificultad 2/5 1-3 horas Aptitud para principiantes 65/100
Los mantenedores suelen responder en 1 día
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 65/100
libsdl-org/SDL#16684 ·
Los mantenedores suelen responder en 1 día
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 82/100
-
Issue-Bug Needs-Triage
Dificultad 2/5 1-3 horas Aptitud para principiantes 78/100
Los mantenedores suelen responder en 2 días