summaryrefslogtreecommitdiff
path: root/components/libc/posix/Kconfig
blob: cae76f7af46905d83e72142c8265573b3cf4f490 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
menu "POSIX (Portable Operating System Interface) layer"

config RT_USING_POSIX_FS
    bool "Enable POSIX file system and I/O"
    select RT_USING_DFS
    select DFS_USING_POSIX
    default n
    help
        Enable POSIX-compliant file system and I/O APIs.
        
        Provides standard POSIX file operations:
        - File I/O: open(), read(), write(), close(), lseek()
        - Directory: opendir(), readdir(), closedir()
        - File control: fcntl(), ioctl()
        - File status: stat(), fstat(), access()
        - File operations: unlink(), rename(), chmod()
        
        Benefits:
        - Source code compatibility with Linux/Unix
        - Easier porting of existing applications
        - Standard API familiar to developers
        - Better integration with third-party libraries
        
        Requirements:
        - RT_USING_DFS must be enabled
        - File system support (FAT, ROM-FS, etc.)
        
        Enable for applications requiring POSIX file I/O compatibility.
        Essential for porting Linux/Unix applications to RT-Thread.

if RT_USING_POSIX_FS
    config RT_USING_POSIX_DEVIO
        bool "Enable devices as file descriptors"
        select RT_USING_DFS_DEVFS
        default n
        help
            Access devices through file descriptors like regular files.
            
            Allows opening devices in /dev using standard file operations:
            - fd = open("/dev/uart1", O_RDWR)
            - read(fd, buffer, size) / write(fd, buffer, size)
            - ioctl(fd, cmd, arg) for device control
            - close(fd)
            
            Benefits:
            - Unified I/O model for files and devices
            - Compatible with select/poll for device I/O
            - Easier application design
            
            Automatically enables devfs (/dev filesystem).
            
            Enable for POSIX-style device access.
            Required for RT_USING_POSIX_STDIO.

    config RT_USING_POSIX_STDIO
        bool "Enable standard I/O devices, e.g. STDOUT_FILENO"
        select RT_USING_POSIX_DEVIO
        default n
        help
            Enable standard POSIX I/O file descriptors.
            
            Provides standard file descriptors:
            - STDIN_FILENO (0): Standard input
            - STDOUT_FILENO (1): Standard output
            - STDERR_FILENO (2): Standard error
            
            Allows using printf, scanf, fprintf with standard streams.
            
            Benefits:
            - Compatible with standard C library I/O
            - Easier debugging with stderr
            - Standard input/output redirection
            
            Requires RT_USING_POSIX_DEVIO (device file descriptors).
            
            Enable for applications using stdin/stdout/stderr.

    config RT_USING_POSIX_POLL
        bool "Enable I/O Multiplexing poll() <poll.h>"
        default y if RT_USING_SMART
        default n
        help
            Enable POSIX poll() for I/O multiplexing.
            
            poll() monitors multiple file descriptors for I/O events:
            - Wait for data available on sockets/files
            - Detect when writing won't block
            - Error and hangup conditions
            - Timeout support
            
            Use cases:
            - Network servers handling multiple connections
            - Monitoring multiple devices simultaneously
            - Event-driven I/O programming
            
            More portable than select() (no FD_SETSIZE limit).
            
            Automatically enabled in RT-Smart mode.
            Enable for I/O multiplexing applications.

    config RT_USING_POSIX_SELECT
        bool "Enable I/O Multiplexing select() <sys/select.h>"
        select RT_USING_POSIX_POLL
        default y if RT_USING_SMART
        default n
        help
            Enable POSIX select() for I/O multiplexing.
            
            select() monitors file descriptors for I/O readiness:
            - Check multiple sockets/files for data
            - Wait with timeout
            - Detect errors and exceptions
            
            Compatible with BSD sockets and standard POSIX API.
            
            Advantages over poll():
            + More widely known API
            + Compatible with older code
            
            Disadvantages:
            - Limited to FD_SETSIZE file descriptors (typically 1024)
            - Less efficient for large numbers of FDs
            
            Automatically enables poll() (implementation uses poll).
            
            Enable for applications using select() API.

    config RT_USING_POSIX_EVENTFD
        bool "Enable I/O event eventfd <sys/eventfd.h>"
        select RT_USING_POSIX_POLL
        default y if RT_USING_SMART
        default n
        help
            Enable Linux-style eventfd for event notification.
            
            eventfd provides a file descriptor for event notification:
            - Create event object: eventfd(initval, flags)
            - Signal event: write(efd, &value, 8)
            - Wait for event: read(efd, &value, 8)
            - Integrates with poll/select/epoll
            
            Features:
            - Semaphore-style counting (EFD_SEMAPHORE)
            - Non-blocking mode (EFD_NONBLOCK)
            - Cloexec flag support (EFD_CLOEXEC)
            
            Use cases:
            - Thread/process notification
            - Event-driven architectures
            - Integrating with poll/epoll event loops
            
            Lighter weight than pipes for simple notifications.
            
            Enable for Linux-compatible event notification.

    if RT_USING_SMART
        config RT_USING_POSIX_EPOLL
            bool "Enable I/O Multiplexing epoll <sys/epoll.h>"
            select RT_USING_POSIX_POLL
            default y
            help
                Enable Linux epoll for scalable I/O multiplexing.
                
                epoll is designed for handling large numbers of file descriptors:
                - No FD_SETSIZE limit (unlike select)
                - O(1) performance (vs O(n) for select/poll)
                - Edge-triggered and level-triggered modes
                - One-shot mode support
                
                API:
                - epoll_create(): Create epoll instance
                - epoll_ctl(): Add/modify/remove file descriptors
                - epoll_wait(): Wait for I/O events
                
                Benefits:
                - Scales to thousands of connections
                - Better performance for large FD sets
                - More flexible event notification
                
                Use cases:
                - High-performance network servers
                - Event-driven applications
                - Systems with many concurrent I/O operations
                
                Required for RT-Smart. Recommended for server applications.

        config RT_USING_POSIX_SIGNALFD
            bool "Enable Signalfd <sys/signalfd.h>"
            select RT_USING_POSIX_POLL
            default y
            help
                Enable signalfd for receiving signals via file descriptor.
                
                signalfd converts signal delivery into file I/O:
                - Create: signalfd(fd, &mask, flags)
                - Read signal info: read(sfd, &siginfo, sizeof(siginfo))
                - Integrate with poll/select/epoll
                
                Benefits:
                - Unified event handling (signals + I/O)
                - Avoid signal handler race conditions
                - Easier signal processing in event loops
                
                Use cases:
                - Event-driven applications handling signals
                - Integrating signals with epoll event loops
                - Safe signal handling without signal handlers
                
                Required for RT-Smart signal handling integration.

        if RT_USING_POSIX_SIGNALFD
            config RT_SIGNALFD_MAX_NUM
                int "signaled The maximum number of concurrent firing signals"
                range 1 20
                default 10
                help
                    Maximum number of signals that can be queued in signalfd.
                    
                    Default: 10 signals
                    
                    Limits memory usage for signal buffering.
                    Increase if applications generate many concurrent signals.
                    
                    Each signal uses ~128 bytes for siginfo structure.
        endif
    endif

    config RT_USING_POSIX_TIMERFD
            bool "Enable I/O timerfd <sys/timerfd.h>"
            default y if RT_USING_SMART
            default n
            help
                Enable timerfd for timer notification via file descriptor.
                
                timerfd provides timer expiration as file I/O events:
                - Create: timerfd_create(clockid, flags)
                - Set timer: timerfd_settime(fd, flags, &spec, NULL)
                - Read expiration: read(tfd, &expirations, 8)
                - Integrate with poll/select/epoll
                
                Features:
                - One-shot and periodic timers
                - Absolute and relative timeouts
                - Can be monitored with epoll
                
                Benefits:
                - Unified event handling (timers + I/O)
                - Multiple independent timers
                - Compatible with event-driven design
                
                Use cases:
                - Event loop timers
                - Timeout handling in servers
                - Periodic tasks in event-driven apps
                
                Enable for file-descriptor-based timer notification.

    config RT_USING_POSIX_SOCKET
        bool "Enable BSD Socket I/O <sys/socket.h> <netdb.h>"
        select RT_USING_POSIX_SELECT
        select RT_USING_SAL
        default n
        help
            Enable POSIX BSD socket API for network programming.
            
            Provides standard socket APIs:
            - socket(), bind(), listen(), accept(), connect()
            - send(), recv(), sendto(), recvfrom()
            - setsockopt(), getsockopt()
            - getaddrinfo(), gethostbyname()
            
            Requires SAL (Socket Abstraction Layer) for network stack.
            
            Enables network application development with standard API.
            See Network -> SAL configuration for protocol stack selection.

    config RT_USING_POSIX_TERMIOS
        bool "Enable Terminal I/O <termios.h>"
        select RT_USING_POSIX_STDIO
        default n
        help
            Enable POSIX terminal I/O control (termios).
            
            Provides terminal control APIs:
            - tcgetattr(), tcsetattr(): Get/set terminal attributes
            - cfsetispeed(), cfsetospeed(): Set baud rates
            - tcdrain(), tcflush(), tcflow(): Terminal flow control
            
            Features:
            - Raw and canonical mode control
            - Baud rate configuration
            - Character size and parity settings
            - Flow control (hardware/software)
            
            Use cases:
            - Serial terminal configuration
            - Raw mode for binary protocols
            - Terminal emulation applications
            
            Requires RT_USING_POSIX_STDIO (standard I/O).
            
            Enable for POSIX terminal control compatibility.

    config RT_USING_POSIX_AIO
        bool "Enable Asynchronous I/O <aio.h>"
        default n
        help
            Enable POSIX Asynchronous I/O APIs.
            
            Provides async I/O operations:
            - aio_read(), aio_write(): Asynchronous read/write
            - aio_fsync(): Asynchronous file sync
            - aio_suspend(): Wait for async operations
            - aio_error(), aio_return(): Check status
            
            Benefits:
            - Non-blocking I/O operations
            - Better CPU utilization
            - Overlap I/O with computation
            
            Use cases:
            - High-performance file I/O
            - Database systems
            - Large file operations
            
            Note: Requires careful memory management.
            Overhead: ~200-400 bytes per async operation.

    config RT_USING_POSIX_MMAN
        bool "Enable Memory-Mapped I/O <sys/mman.h>"
        default n
        help
            Enable POSIX memory mapping (mmap).
            
            Provides memory mapping APIs:
            - mmap(): Map files or devices into memory
            - munmap(): Unmap memory regions
            - mprotect(): Set memory protection
            - msync(): Synchronize memory with file
            
            Benefits:
            - Efficient file I/O (no read/write calls)
            - Shared memory between processes
            - Large file handling
            
            Use cases:
            - Large file access
            - Shared memory IPC
            - Memory-mapped device registers
            
            Requires MMU or MPU support.
            Available in RT-Smart with proper hardware support.
endif

config RT_USING_POSIX_DELAY
    select RT_USING_KTIME
    bool "Enable delay APIs, sleep()/usleep()/msleep() etc"
    default n
    help
        Enable POSIX delay/sleep functions.
        
        Provides standard delay APIs:
        - sleep(seconds): Sleep for seconds
        - usleep(microseconds): Sleep for microseconds  
        - msleep(milliseconds): Sleep for milliseconds
        - nanosleep(timespec): High-precision sleep
        
        Based on RT-Thread's kernel time (ktime) for accuracy.
        
        Benefits:
        - Standard POSIX API for delays
        - Better code portability
        - Microsecond precision
        
        Enable for POSIX-compatible delay functions.
        Automatically selected by RT_USING_POSIX_CLOCK.

config RT_USING_POSIX_CLOCK
    bool "Enable clock/time APIs, clock_gettime()/clock_settime() etc"
    select RT_USING_POSIX_DELAY
    default n
    help
        Enable POSIX clock and time APIs.
        
        Provides standard time functions:
        - clock_gettime(): Get clock time
        - clock_settime(): Set clock time
        - clock_getres(): Get clock resolution
        
        Supported clocks:
        - CLOCK_REALTIME: System-wide real-time clock
        - CLOCK_MONOTONIC: Monotonic time (doesn't jump)
        - CLOCK_PROCESS_CPUTIME_ID: Process CPU time
        - CLOCK_THREAD_CPUTIME_ID: Thread CPU time
        
        Benefits:
        - Standard time API
        - High-resolution timestamps
        - Monotonic time for intervals
        
        Required by pthreads and POSIX timers.
        Enable for POSIX time functionality.

config RT_USING_POSIX_TIMER
    select RT_USING_KTIME
    select RT_USING_RESOURCE_ID
    bool "Enable timer APIs, timer_create()/timer_gettime() etc"
    default n
    help
        Enable POSIX interval timers.
        
        Provides POSIX timer APIs:
        - timer_create(): Create a timer
        - timer_settime(): Arm/disarm timer
        - timer_gettime(): Get timer status
        - timer_delete(): Delete timer
        
        Features:
        - Per-process timers
        - One-shot and periodic modes
        - Signal-based or thread-based notification
        - Absolute and relative timeouts
        
        Use cases:
        - Periodic task execution
        - Timeout handling
        - Watchdog timers
        - Scheduled events
        
        Requires KTIME and resource ID management.
        Enable for POSIX timer functionality.

config RT_USING_PTHREADS
    bool "Enable pthreads APIs"
    select RT_USING_POSIX_CLOCK
    default n
    help
        Enable POSIX threads (pthreads) API.
        
        Provides standard threading APIs:
        - Thread management: pthread_create(), pthread_join(), pthread_exit()
        - Mutex: pthread_mutex_lock(), pthread_mutex_unlock()
        - Condition variables: pthread_cond_wait(), pthread_cond_signal()
        - Read-write locks: pthread_rwlock_*()
        - Barriers: pthread_barrier_*()
        - Thread-specific data: pthread_key_create(), pthread_setspecific()
        
        Benefits:
        - Standard threading API for portability
        - Compatible with Linux/Unix applications
        - Rich synchronization primitives
        
        Implementation:
        - Maps to RT-Thread native threads
        - Full POSIX thread attribute support
        - Detached and joinable threads
        
        Essential for porting multi-threaded POSIX applications.
        
        Configure maximum threads with PTHREAD_NUM_MAX.

if RT_USING_PTHREADS
    config PTHREAD_NUM_MAX
        int "Maximum number of pthreads"
        default 8
        help
            Maximum number of POSIX threads (pthreads) that can exist simultaneously.
            
            Default: 8 threads
            
            Each pthread uses:
            - Thread control block (~100-200 bytes)
            - Stack (configured per thread)
            - pthread-specific data storage
            
            Increase for applications creating many threads.
            Decrease to save memory on constrained systems.
            
            Note: This is separate from RT-Thread native thread limit.
endif

config RT_USING_MODULE
    bool "Enable dynamic module APIs, dlopen()/dlsym()/dlclose() etc"
    default n
    help
        Enable POSIX dynamic module loading (dlopen/dlsym).
        
        Provides dynamic library APIs:
        - dlopen(): Load shared library
        - dlsym(): Get symbol address from library
        - dlclose(): Unload library
        - dlerror(): Get error string
        
        Features:
        - Runtime loading of .so files
        - Symbol resolution
        - Lazy and immediate binding
        - RTLD_GLOBAL and RTLD_LOCAL scope
        
        Use cases:
        - Plugin architectures
        - Optional feature loading
        - Runtime extensibility
        - Reduce initial memory footprint
        
        Requires:
        - DFS for file system access
        - Module support in build system
        
        Note: Increases complexity and security considerations.
        Enable for dynamic module/plugin support.

if RT_USING_MODULE
    config RT_USING_CUSTOM_DLMODULE
        bool "Enable load dynamic module by custom"
        default n
        help
            Enable custom dynamic module loader.
            
            Allows implementing custom module loading logic:
            - Custom file format support
            - Special initialization sequences
            - Security checks and validation
            - Custom symbol resolution
            
            Use cases:
            - Proprietary module formats
            - Enhanced security validation
            - Special loading requirements
            
            Disable for standard ELF module loading.
            Enable only if custom loader needed.
endif

rsource "ipc/Kconfig"

endmenu