drivers/pipes: Add offset support for PIPEIOC_PEEK

Signed-off-by: Zhe Weng <wengzhe@xiaomi.com>
This commit is contained in:
Zhe Weng 2024-02-01 11:14:27 +08:00 committed by Alan Carvalho de Assis
parent 6a267fe019
commit a591adc6d5
2 changed files with 4 additions and 1 deletions

View File

@ -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;

View File

@ -717,6 +717,7 @@
struct pipe_peek_s
{
FAR void *buf;
size_t offset;
size_t size;
};