[drivers][serial] ioctl add F_SETFL cmd (#5876)
This commit is contained in:
parent
7c99148f78
commit
7f1157e0de
|
@ -115,6 +115,8 @@ static int serial_fops_close(struct dfs_fd *fd)
|
|||
static int serial_fops_ioctl(struct dfs_fd *fd, int cmd, void *args)
|
||||
{
|
||||
rt_device_t device;
|
||||
int flags = (int)(rt_base_t)args;
|
||||
int mask = O_NONBLOCK | O_APPEND;
|
||||
|
||||
device = (rt_device_t)fd->data;
|
||||
switch (cmd)
|
||||
|
@ -123,6 +125,11 @@ static int serial_fops_ioctl(struct dfs_fd *fd, int cmd, void *args)
|
|||
break;
|
||||
case FIONWRITE:
|
||||
break;
|
||||
case F_SETFL:
|
||||
flags &= mask;
|
||||
fd->flags &= ~mask;
|
||||
fd->flags |= flags;
|
||||
break;
|
||||
}
|
||||
|
||||
return rt_device_control(device, cmd, args);
|
||||
|
|
|
@ -94,6 +94,8 @@ static int serial_fops_close(struct dfs_fd *fd)
|
|||
static int serial_fops_ioctl(struct dfs_fd *fd, int cmd, void *args)
|
||||
{
|
||||
rt_device_t device;
|
||||
int flags = (int)(rt_base_t)args;
|
||||
int mask = O_NONBLOCK | O_APPEND;
|
||||
|
||||
device = (rt_device_t)fd->data;
|
||||
switch (cmd)
|
||||
|
@ -102,6 +104,11 @@ static int serial_fops_ioctl(struct dfs_fd *fd, int cmd, void *args)
|
|||
break;
|
||||
case FIONWRITE:
|
||||
break;
|
||||
case F_SETFL:
|
||||
flags &= mask;
|
||||
fd->flags &= ~mask;
|
||||
fd->flags |= flags;
|
||||
break;
|
||||
}
|
||||
|
||||
return rt_device_control(device, cmd, args);
|
||||
|
|
Loading…
Reference in New Issue