Kconfig 19 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537
  1. menu "POSIX (Portable Operating System Interface) layer"
  2. config RT_USING_POSIX_FS
  3. bool "Enable POSIX file system and I/O"
  4. select RT_USING_DFS
  5. select DFS_USING_POSIX
  6. default n
  7. help
  8. Enable POSIX-compliant file system and I/O APIs.
  9. Provides standard POSIX file operations:
  10. - File I/O: open(), read(), write(), close(), lseek()
  11. - Directory: opendir(), readdir(), closedir()
  12. - File control: fcntl(), ioctl()
  13. - File status: stat(), fstat(), access()
  14. - File operations: unlink(), rename(), chmod()
  15. Benefits:
  16. - Source code compatibility with Linux/Unix
  17. - Easier porting of existing applications
  18. - Standard API familiar to developers
  19. - Better integration with third-party libraries
  20. Requirements:
  21. - RT_USING_DFS must be enabled
  22. - File system support (FAT, ROM-FS, etc.)
  23. Enable for applications requiring POSIX file I/O compatibility.
  24. Essential for porting Linux/Unix applications to RT-Thread.
  25. if RT_USING_POSIX_FS
  26. config RT_USING_POSIX_DEVIO
  27. bool "Enable devices as file descriptors"
  28. select RT_USING_DFS_DEVFS
  29. default n
  30. help
  31. Access devices through file descriptors like regular files.
  32. Allows opening devices in /dev using standard file operations:
  33. - fd = open("/dev/uart1", O_RDWR)
  34. - read(fd, buffer, size) / write(fd, buffer, size)
  35. - ioctl(fd, cmd, arg) for device control
  36. - close(fd)
  37. Benefits:
  38. - Unified I/O model for files and devices
  39. - Compatible with select/poll for device I/O
  40. - Easier application design
  41. Automatically enables devfs (/dev filesystem).
  42. Enable for POSIX-style device access.
  43. Required for RT_USING_POSIX_STDIO.
  44. config RT_USING_POSIX_STDIO
  45. bool "Enable standard I/O devices, e.g. STDOUT_FILENO"
  46. select RT_USING_POSIX_DEVIO
  47. default n
  48. help
  49. Enable standard POSIX I/O file descriptors.
  50. Provides standard file descriptors:
  51. - STDIN_FILENO (0): Standard input
  52. - STDOUT_FILENO (1): Standard output
  53. - STDERR_FILENO (2): Standard error
  54. Allows using printf, scanf, fprintf with standard streams.
  55. Benefits:
  56. - Compatible with standard C library I/O
  57. - Easier debugging with stderr
  58. - Standard input/output redirection
  59. Requires RT_USING_POSIX_DEVIO (device file descriptors).
  60. Enable for applications using stdin/stdout/stderr.
  61. config RT_USING_POSIX_POLL
  62. bool "Enable I/O Multiplexing poll() <poll.h>"
  63. default y if RT_USING_SMART
  64. default n
  65. help
  66. Enable POSIX poll() for I/O multiplexing.
  67. poll() monitors multiple file descriptors for I/O events:
  68. - Wait for data available on sockets/files
  69. - Detect when writing won't block
  70. - Error and hangup conditions
  71. - Timeout support
  72. Use cases:
  73. - Network servers handling multiple connections
  74. - Monitoring multiple devices simultaneously
  75. - Event-driven I/O programming
  76. More portable than select() (no FD_SETSIZE limit).
  77. Automatically enabled in RT-Smart mode.
  78. Enable for I/O multiplexing applications.
  79. config RT_USING_POSIX_SELECT
  80. bool "Enable I/O Multiplexing select() <sys/select.h>"
  81. select RT_USING_POSIX_POLL
  82. default y if RT_USING_SMART
  83. default n
  84. help
  85. Enable POSIX select() for I/O multiplexing.
  86. select() monitors file descriptors for I/O readiness:
  87. - Check multiple sockets/files for data
  88. - Wait with timeout
  89. - Detect errors and exceptions
  90. Compatible with BSD sockets and standard POSIX API.
  91. Advantages over poll():
  92. + More widely known API
  93. + Compatible with older code
  94. Disadvantages:
  95. - Limited to FD_SETSIZE file descriptors (typically 1024)
  96. - Less efficient for large numbers of FDs
  97. Automatically enables poll() (implementation uses poll).
  98. Enable for applications using select() API.
  99. config RT_USING_POSIX_EVENTFD
  100. bool "Enable I/O event eventfd <sys/eventfd.h>"
  101. select RT_USING_POSIX_POLL
  102. default y if RT_USING_SMART
  103. default n
  104. help
  105. Enable Linux-style eventfd for event notification.
  106. eventfd provides a file descriptor for event notification:
  107. - Create event object: eventfd(initval, flags)
  108. - Signal event: write(efd, &value, 8)
  109. - Wait for event: read(efd, &value, 8)
  110. - Integrates with poll/select/epoll
  111. Features:
  112. - Semaphore-style counting (EFD_SEMAPHORE)
  113. - Non-blocking mode (EFD_NONBLOCK)
  114. - Cloexec flag support (EFD_CLOEXEC)
  115. Use cases:
  116. - Thread/process notification
  117. - Event-driven architectures
  118. - Integrating with poll/epoll event loops
  119. Lighter weight than pipes for simple notifications.
  120. Enable for Linux-compatible event notification.
  121. if RT_USING_SMART
  122. config RT_USING_POSIX_EPOLL
  123. bool "Enable I/O Multiplexing epoll <sys/epoll.h>"
  124. select RT_USING_POSIX_POLL
  125. default y
  126. help
  127. Enable Linux epoll for scalable I/O multiplexing.
  128. epoll is designed for handling large numbers of file descriptors:
  129. - No FD_SETSIZE limit (unlike select)
  130. - O(1) performance (vs O(n) for select/poll)
  131. - Edge-triggered and level-triggered modes
  132. - One-shot mode support
  133. API:
  134. - epoll_create(): Create epoll instance
  135. - epoll_ctl(): Add/modify/remove file descriptors
  136. - epoll_wait(): Wait for I/O events
  137. Benefits:
  138. - Scales to thousands of connections
  139. - Better performance for large FD sets
  140. - More flexible event notification
  141. Use cases:
  142. - High-performance network servers
  143. - Event-driven applications
  144. - Systems with many concurrent I/O operations
  145. Required for RT-Smart. Recommended for server applications.
  146. config RT_USING_POSIX_SIGNALFD
  147. bool "Enable Signalfd <sys/signalfd.h>"
  148. select RT_USING_POSIX_POLL
  149. default y
  150. help
  151. Enable signalfd for receiving signals via file descriptor.
  152. signalfd converts signal delivery into file I/O:
  153. - Create: signalfd(fd, &mask, flags)
  154. - Read signal info: read(sfd, &siginfo, sizeof(siginfo))
  155. - Integrate with poll/select/epoll
  156. Benefits:
  157. - Unified event handling (signals + I/O)
  158. - Avoid signal handler race conditions
  159. - Easier signal processing in event loops
  160. Use cases:
  161. - Event-driven applications handling signals
  162. - Integrating signals with epoll event loops
  163. - Safe signal handling without signal handlers
  164. Required for RT-Smart signal handling integration.
  165. if RT_USING_POSIX_SIGNALFD
  166. config RT_SIGNALFD_MAX_NUM
  167. int "signaled The maximum number of concurrent firing signals"
  168. range 1 20
  169. default 10
  170. help
  171. Maximum number of signals that can be queued in signalfd.
  172. Default: 10 signals
  173. Limits memory usage for signal buffering.
  174. Increase if applications generate many concurrent signals.
  175. Each signal uses ~128 bytes for siginfo structure.
  176. endif
  177. endif
  178. config RT_USING_POSIX_TIMERFD
  179. bool "Enable I/O timerfd <sys/timerfd.h>"
  180. default y if RT_USING_SMART
  181. default n
  182. help
  183. Enable timerfd for timer notification via file descriptor.
  184. timerfd provides timer expiration as file I/O events:
  185. - Create: timerfd_create(clockid, flags)
  186. - Set timer: timerfd_settime(fd, flags, &spec, NULL)
  187. - Read expiration: read(tfd, &expirations, 8)
  188. - Integrate with poll/select/epoll
  189. Features:
  190. - One-shot and periodic timers
  191. - Absolute and relative timeouts
  192. - Can be monitored with epoll
  193. Benefits:
  194. - Unified event handling (timers + I/O)
  195. - Multiple independent timers
  196. - Compatible with event-driven design
  197. Use cases:
  198. - Event loop timers
  199. - Timeout handling in servers
  200. - Periodic tasks in event-driven apps
  201. Enable for file-descriptor-based timer notification.
  202. config RT_USING_POSIX_SOCKET
  203. bool "Enable BSD Socket I/O <sys/socket.h> <netdb.h>"
  204. select RT_USING_POSIX_SELECT
  205. select RT_USING_SAL
  206. default n
  207. help
  208. Enable POSIX BSD socket API for network programming.
  209. Provides standard socket APIs:
  210. - socket(), bind(), listen(), accept(), connect()
  211. - send(), recv(), sendto(), recvfrom()
  212. - setsockopt(), getsockopt()
  213. - getaddrinfo(), gethostbyname()
  214. Requires SAL (Socket Abstraction Layer) for network stack.
  215. Enables network application development with standard API.
  216. See Network -> SAL configuration for protocol stack selection.
  217. config RT_USING_POSIX_TERMIOS
  218. bool "Enable Terminal I/O <termios.h>"
  219. select RT_USING_POSIX_STDIO
  220. default n
  221. help
  222. Enable POSIX terminal I/O control (termios).
  223. Provides terminal control APIs:
  224. - tcgetattr(), tcsetattr(): Get/set terminal attributes
  225. - cfsetispeed(), cfsetospeed(): Set baud rates
  226. - tcdrain(), tcflush(), tcflow(): Terminal flow control
  227. Features:
  228. - Raw and canonical mode control
  229. - Baud rate configuration
  230. - Character size and parity settings
  231. - Flow control (hardware/software)
  232. Use cases:
  233. - Serial terminal configuration
  234. - Raw mode for binary protocols
  235. - Terminal emulation applications
  236. Requires RT_USING_POSIX_STDIO (standard I/O).
  237. Enable for POSIX terminal control compatibility.
  238. config RT_USING_POSIX_AIO
  239. bool "Enable Asynchronous I/O <aio.h>"
  240. default n
  241. help
  242. Enable POSIX Asynchronous I/O APIs.
  243. Provides async I/O operations:
  244. - aio_read(), aio_write(): Asynchronous read/write
  245. - aio_fsync(): Asynchronous file sync
  246. - aio_suspend(): Wait for async operations
  247. - aio_error(), aio_return(): Check status
  248. Benefits:
  249. - Non-blocking I/O operations
  250. - Better CPU utilization
  251. - Overlap I/O with computation
  252. Use cases:
  253. - High-performance file I/O
  254. - Database systems
  255. - Large file operations
  256. Note: Requires careful memory management.
  257. Overhead: ~200-400 bytes per async operation.
  258. config RT_USING_POSIX_MMAN
  259. bool "Enable Memory-Mapped I/O <sys/mman.h>"
  260. default n
  261. help
  262. Enable POSIX memory mapping (mmap).
  263. Provides memory mapping APIs:
  264. - mmap(): Map files or devices into memory
  265. - munmap(): Unmap memory regions
  266. - mprotect(): Set memory protection
  267. - msync(): Synchronize memory with file
  268. Benefits:
  269. - Efficient file I/O (no read/write calls)
  270. - Shared memory between processes
  271. - Large file handling
  272. Use cases:
  273. - Large file access
  274. - Shared memory IPC
  275. - Memory-mapped device registers
  276. Requires MMU or MPU support.
  277. Available in RT-Smart with proper hardware support.
  278. endif
  279. config RT_USING_POSIX_DELAY
  280. select RT_USING_KTIME
  281. bool "Enable delay APIs, sleep()/usleep()/msleep() etc"
  282. default n
  283. help
  284. Enable POSIX delay/sleep functions.
  285. Provides standard delay APIs:
  286. - sleep(seconds): Sleep for seconds
  287. - usleep(microseconds): Sleep for microseconds
  288. - msleep(milliseconds): Sleep for milliseconds
  289. - nanosleep(timespec): High-precision sleep
  290. Based on RT-Thread's kernel time (ktime) for accuracy.
  291. Benefits:
  292. - Standard POSIX API for delays
  293. - Better code portability
  294. - Microsecond precision
  295. Enable for POSIX-compatible delay functions.
  296. Automatically selected by RT_USING_POSIX_CLOCK.
  297. config RT_USING_POSIX_CLOCK
  298. bool "Enable clock/time APIs, clock_gettime()/clock_settime() etc"
  299. select RT_USING_POSIX_DELAY
  300. default n
  301. help
  302. Enable POSIX clock and time APIs.
  303. Provides standard time functions:
  304. - clock_gettime(): Get clock time
  305. - clock_settime(): Set clock time
  306. - clock_getres(): Get clock resolution
  307. Supported clocks:
  308. - CLOCK_REALTIME: System-wide real-time clock
  309. - CLOCK_MONOTONIC: Monotonic time (doesn't jump)
  310. - CLOCK_PROCESS_CPUTIME_ID: Process CPU time
  311. - CLOCK_THREAD_CPUTIME_ID: Thread CPU time
  312. Benefits:
  313. - Standard time API
  314. - High-resolution timestamps
  315. - Monotonic time for intervals
  316. Required by pthreads and POSIX timers.
  317. Enable for POSIX time functionality.
  318. config RT_USING_POSIX_TIMER
  319. select RT_USING_KTIME
  320. select RT_USING_RESOURCE_ID
  321. bool "Enable timer APIs, timer_create()/timer_gettime() etc"
  322. default n
  323. help
  324. Enable POSIX interval timers.
  325. Provides POSIX timer APIs:
  326. - timer_create(): Create a timer
  327. - timer_settime(): Arm/disarm timer
  328. - timer_gettime(): Get timer status
  329. - timer_delete(): Delete timer
  330. Features:
  331. - Per-process timers
  332. - One-shot and periodic modes
  333. - Signal-based or thread-based notification
  334. - Absolute and relative timeouts
  335. Use cases:
  336. - Periodic task execution
  337. - Timeout handling
  338. - Watchdog timers
  339. - Scheduled events
  340. Requires KTIME and resource ID management.
  341. Enable for POSIX timer functionality.
  342. config RT_USING_PTHREADS
  343. bool "Enable pthreads APIs"
  344. select RT_USING_POSIX_CLOCK
  345. default n
  346. help
  347. Enable POSIX threads (pthreads) API.
  348. Provides standard threading APIs:
  349. - Thread management: pthread_create(), pthread_join(), pthread_exit()
  350. - Mutex: pthread_mutex_lock(), pthread_mutex_unlock()
  351. - Condition variables: pthread_cond_wait(), pthread_cond_signal()
  352. - Read-write locks: pthread_rwlock_*()
  353. - Barriers: pthread_barrier_*()
  354. - Thread-specific data: pthread_key_create(), pthread_setspecific()
  355. Benefits:
  356. - Standard threading API for portability
  357. - Compatible with Linux/Unix applications
  358. - Rich synchronization primitives
  359. Implementation:
  360. - Maps to RT-Thread native threads
  361. - Full POSIX thread attribute support
  362. - Detached and joinable threads
  363. Essential for porting multi-threaded POSIX applications.
  364. Configure maximum threads with PTHREAD_NUM_MAX.
  365. if RT_USING_PTHREADS
  366. config PTHREAD_NUM_MAX
  367. int "Maximum number of pthreads"
  368. default 8
  369. help
  370. Maximum number of POSIX threads (pthreads) that can exist simultaneously.
  371. Default: 8 threads
  372. Each pthread uses:
  373. - Thread control block (~100-200 bytes)
  374. - Stack (configured per thread)
  375. - pthread-specific data storage
  376. Increase for applications creating many threads.
  377. Decrease to save memory on constrained systems.
  378. Note: This is separate from RT-Thread native thread limit.
  379. endif
  380. config RT_USING_MODULE
  381. bool "Enable dynamic module APIs, dlopen()/dlsym()/dlclose() etc"
  382. default n
  383. help
  384. Enable POSIX dynamic module loading (dlopen/dlsym).
  385. Provides dynamic library APIs:
  386. - dlopen(): Load shared library
  387. - dlsym(): Get symbol address from library
  388. - dlclose(): Unload library
  389. - dlerror(): Get error string
  390. Features:
  391. - Runtime loading of .so files
  392. - Symbol resolution
  393. - Lazy and immediate binding
  394. - RTLD_GLOBAL and RTLD_LOCAL scope
  395. Use cases:
  396. - Plugin architectures
  397. - Optional feature loading
  398. - Runtime extensibility
  399. - Reduce initial memory footprint
  400. Requires:
  401. - DFS for file system access
  402. - Module support in build system
  403. Note: Increases complexity and security considerations.
  404. Enable for dynamic module/plugin support.
  405. if RT_USING_MODULE
  406. config RT_USING_CUSTOM_DLMODULE
  407. bool "Enable load dynamic module by custom"
  408. default n
  409. help
  410. Enable custom dynamic module loader.
  411. Allows implementing custom module loading logic:
  412. - Custom file format support
  413. - Special initialization sequences
  414. - Security checks and validation
  415. - Custom symbol resolution
  416. Use cases:
  417. - Proprietary module formats
  418. - Enhanced security validation
  419. - Special loading requirements
  420. Disable for standard ELF module loading.
  421. Enable only if custom loader needed.
  422. endif
  423. rsource "ipc/Kconfig"
  424. endmenu