mirror of
https://github.com/apache/nuttx.git
synced 2026-06-06 08:36:24 +08:00
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:
+17
-1
@@ -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
|
||||
****************************************************************************/
|
||||
|
||||
Reference in New Issue
Block a user