libc/unistd: Replace pipe() macro with proper function implementation

Replace the pipe() macro definition with a proper function implementation
to improve POSIX compliance and debugging capabilities. The new pipe()
function serves as a wrapper around pipe2() with flags set to 0.

Changes include:
- Convert pipe() from macro to function declaration in unistd.h
- Add lib_pipe.c implementation file with proper function documentation
- Update build system files (CMakeLists.txt and Make.defs) to include
  the new source file when CONFIG_PIPES is enabled
- Add pipe() entry to libc.csv for symbol tracking

This change allows for better debugging, proper symbol resolution,
and follows NuttX coding standards for library function implementations.

Signed-off-by: Huang Qi <huangqi3@xiaomi.com>
This commit is contained in:
Huang Qi
2025-11-07 12:30:47 +08:00
committed by archer
parent 8f91054b1d
commit 311f42bbac
5 changed files with 70 additions and 1 deletions
+1
View File
@@ -192,6 +192,7 @@
"ntohs","arpa/inet.h","","uint16_t","uint16_t"
"opendir","dirent.h","","FAR DIR *","FAR const char *"
"perror","stdio.h","defined(CONFIG_FILE_STREAM)","void","FAR const char *"
"pipe","unistd.h","defined(CONFIG_PIPES) && CONFIG_DEV_PIPE_SIZE > 0","int","int [2]|FAR int *"
"posix_fallocate","fcntl.h","","int","int","off_t","off_t"
"posix_memalign","stdlib.h","","int","FAR void **","size_t","size_t"
"preadv","sys/uio.h","","ssize_t","int","FAR const struct iovec *","int","off_t"
1 __assert assert.h void FAR const char * int FAR const char *
192 ntohs arpa/inet.h uint16_t uint16_t
193 opendir dirent.h FAR DIR * FAR const char *
194 perror stdio.h defined(CONFIG_FILE_STREAM) void FAR const char *
195 pipe unistd.h defined(CONFIG_PIPES) && CONFIG_DEV_PIPE_SIZE > 0 int int [2]|FAR int *
196 posix_fallocate fcntl.h int int off_t off_t
197 posix_memalign stdlib.h int FAR void ** size_t size_t
198 preadv sys/uio.h ssize_t int FAR const struct iovec * int