1
0
Fork 0
forked from nuttx/nuttx-update

drivers/pipe: implement pipe mmap just return ENODEV

The fd of pipe type is not supported by mmap, mmap() shall failed
with ENODEV. If pipe mmap is not implemented, mmap will forward to
rammap() and get unexpected error.

Implement pipe mmap just return ENODEV. That is to pass LTP posix
test case mmap/23-1.c

https://pubs.opengroup.org/onlinepubs/9699919799/functions/mmap.html

Signed-off-by: fangxinyong <fangxinyong@xiaomi.com>
This commit is contained in:
fangxinyong 2023-07-18 20:32:59 +08:00 committed by Xiang Xiao
parent 2bf434214e
commit 7e90855d76

View file

@ -49,6 +49,9 @@
static int pipe_close(FAR struct file *filep);
static int pipe_mmap(FAR struct file *filep,
FAR struct mm_map_entry_s *entry);
/****************************************************************************
* Private Data
****************************************************************************/
@ -61,7 +64,7 @@ static const struct file_operations g_pipe_fops =
pipecommon_write, /* write */
NULL, /* seek */
pipecommon_ioctl, /* ioctl */
NULL, /* mmap */
pipe_mmap, /* mmap */
NULL, /* truncate */
pipecommon_poll /* poll */
};
@ -122,6 +125,19 @@ static int pipe_close(FAR struct file *filep)
return ret;
}
/****************************************************************************
* Name: pipe_mmap
****************************************************************************/
static int pipe_mmap(FAR struct file *filep,
FAR struct mm_map_entry_s *entry)
{
UNUSED(filep);
UNUSED(entry);
return -ENODEV;
}
/****************************************************************************
* Name: pipe_register
****************************************************************************/