Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions arch/posix/include/posix_cheats.h
Original file line number Diff line number Diff line change
Expand Up @@ -221,6 +221,9 @@ void zephyr_app_main(void);
#define stat zap_stat
#define mkdir zap_mkdir

/* Non-network communications */
#define pipe zap_pipe

#endif /* CONFIG_POSIX_API */

#endif /* ZEPHYR_ARCH_POSIX_INCLUDE_POSIX_CHEATS_H_ */
3 changes: 3 additions & 0 deletions include/posix/unistd.h
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,9 @@ extern ssize_t write(int file, const void *buffer, size_t count);
extern ssize_t read(int file, void *buffer, size_t count);
extern off_t lseek(int file, off_t offset, int whence);

/* Non-network communications */
extern int pipe(int fildes[2]);

/* File System related operations */
extern int rename(const char *old, const char *newp);
extern int unlink(const char *path);
Expand Down
1 change: 1 addition & 0 deletions lib/posix/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ zephyr_library_sources_ifdef(CONFIG_PTHREAD_IPC semaphore.c)
zephyr_library_sources_ifdef(CONFIG_PTHREAD_IPC pthread_key.c)
zephyr_library_sources_ifdef(CONFIG_POSIX_MQUEUE mqueue.c)
zephyr_library_sources_ifdef(CONFIG_POSIX_FS fs.c)
zephyr_library_sources_ifdef(CONFIG_POSIX_PIPE pipe.c)

zephyr_library_include_directories(
${ZEPHYR_BASE}/kernel/include
Expand Down
22 changes: 22 additions & 0 deletions lib/posix/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,28 @@ config SEM_VALUE_MAX

endif # PTHREAD_IPC

config POSIX_PIPE
bool "POSIX pipe support"
default y if POSIX_API
help
This enables a mostly-standards-compliant implementation of
pipe(2) for inter-process communication. The resulting file
descriptors can be used with read(2), write(2), close(2),
fcntl(2), fstat(2), and ioctl(2).

if POSIX_PIPE
# min and max to support fcntl F_SETPIPE_SZ?
# allow size to be 0?
config POSIX_PIPE_SIZE
int "POSIX Pipe capacity"
default 64
range 64 1048576
help
This option specifies the fixed size of POSIX pipes. For more
information see 'man 7 pipe'.

endif # POSIX_PIPE

config POSIX_CLOCK
bool "POSIX clock, timer, and sleep APIs"
default y if POSIX_API
Expand Down
Loading