RT-Thread / RT-Thread/rt-thread
[Idea] 💡 建立POSIX SIG
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
POSIX(Portable Operating System Interface,可移植操作系统接口)是由IEEE制定的跨平台操作系统接口标准,旨在统一UNIX-like系统的应用程序接口(API),确保软件在不同系统间的可移植性。
POSIX是RT-Thread上极为看重的一点,需要在这块上做得更完善,更好。
Describe your preferred solution
POSIX标准概述
1. POSIX的定义与核心目标
POSIX(Portable Operating System Interface,可移植操作系统接口)是由IEEE制定的跨平台操作系统接口标准,旨在统一UNIX-like系统的应用程序接口(API),确保软件在不同系统间的可移植性。其核心目标包括:
- 标准化接口:定义文件操作、进程控制、线程管理、信号处理等基础API,形成统一的编程规范。
- 跨平台兼容:通过规范源代码级接口,使开发者无需修改代码即可在不同系统(如Linux、macOS、嵌入式RTOS)上运行程序。
- 模块化扩展:POSIX标准分为多个子集(如POSIX.1、POSIX.1b等),支持按需实现特定功能。
2. POSIX的版本与结构
- 核心版本:POSIX.1是最基础的规范,涵盖进程管理、内存分配、错误处理等系统接口。
- 集成标准:后续版本如POSIX.1b(实时扩展)、POSIX.1c(线程)逐步加入高级功能。
- 统一整合:2008年后,多个子标准合并为IEEE Std 1003.1-2008(即POSIX.1-2008),包含基础定义、系统接口、Shell工具等模块。
PSE51/52/53/54:实时与嵌入式系统配置文件
这些子标准属于IEEE 1003.13-2003,专为实时和嵌入式系统设计,按功能递增分为四层:
1. PSE51:最小实时系统配置文件(Minimal Real-time System Profile)
- 适用场景:资源极度受限的嵌入式设备(如传感器节点)。
- 核心特性:
- 仅支持单进程,无多线程或多进程功能。
- 不包含文件系统或进程间通信(IPC)。
- 提供基础API如信号处理(
sigaction())、定时器(nanosleep())和内存锁定(mlock())等。
- 典型应用:AP AUTOSAR的应用程序层。
2. PSE52:实时控制器配置文件(Real-time Controller Profile)
- 功能扩展:在PSE51基础上增加多线程、信号量及消息队列。
- 关键接口:
- 线程调度(
pthread_create())、互斥锁(pthread_mutex_lock())。 - 实时消息传递(
mq_send())和同步I/O(msync())。
- 线程调度(
3. PSE53:专用实时集成配置文件(Dedicated Real-time Integration Profile)
- 增强功能:
- 引入共享内存(
shm_open())、高级信号跳转(sigsetjmp())和内存保护(mprotect())等。 - 支持多进程(
fork()、vfork())和管道通信(pipe())。
- 引入共享内存(
- 典型实现:RT-Thread Smart操作系统用户态兼容PSE53,适用于需要复杂通信的机器人控制。
4. PSE54:通用实时集成配置文件(General Real-time Integration Profile)
- 完整特性:
- 包含完整文件系统(
chmod())、套接字(socket())和用户权限管理(geteuid())。 - 支持多用户环境和Shell工具(如
fnmatch())。
- 包含完整文件系统(
建议成立POSIX SIG,对POSIX进行持续改善。
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
Start by reviewing the POSIX interfaces and profiles named in the issue, including PSE51–PSE54 and the RT-Thread Smart user-space compatibility claim. Define the intended SIG scope, target profile, supported APIs, and acceptance criteria before identifying implementation files or tests; the issue does not name specific entry points.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- c
- Domain
- embedded-iot, operating-systems
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 20/100