diff --git a/drivers/pipes/pipe_common.c b/drivers/pipes/pipe_common.c index bf715c9d92..0254c3a142 100644 --- a/drivers/pipes/pipe_common.c +++ b/drivers/pipes/pipe_common.c @@ -846,7 +846,9 @@ int pipecommon_ioctl(FAR struct file *filep, int cmd, unsigned long arg) DEBUGASSERT(peek && peek->buf); - ret = circbuf_peek(&dev->d_buffer, peek->buf, peek->size); + ret = circbuf_peekat(&dev->d_buffer, + dev->d_buffer.tail + peek->offset, + peek->buf, peek->size); } break; diff --git a/include/nuttx/fs/ioctl.h b/include/nuttx/fs/ioctl.h index 7e5a6951ab..ffd16f1082 100644 --- a/include/nuttx/fs/ioctl.h +++ b/include/nuttx/fs/ioctl.h @@ -717,6 +717,7 @@ struct pipe_peek_s { FAR void *buf; + size_t offset; size_t size; };