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:
parent
2bf434214e
commit
7e90855d76
1 changed files with 17 additions and 1 deletions
|
@ -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
|
||||
****************************************************************************/
|
||||
|
|
Loading…
Reference in a new issue