local_socket: default set block mode if accept() a new socket

reference:
https: //man7.org/linux/man-pages/man2/accept.2.html

1. default set block mode if accept() a new socket
2. local_socket support FIONBIO

Signed-off-by: ligd <liguiding1@xiaomi.com>
This commit is contained in:
ligd 2021-12-08 23:27:39 +08:00 committed by Xiang Xiao
parent 5b027f5260
commit ad9ba8f454
2 changed files with 13 additions and 4 deletions

View File

@ -181,8 +181,7 @@ int local_accept(FAR struct socket *psock, FAR struct sockaddr *addr,
* block.
*/
ret = local_open_server_tx(
conn, _SS_ISNONBLOCK(server->lc_conn.s_flags));
ret = local_open_server_tx(conn, false);
if (ret < 0)
{
nerr("ERROR: Failed to open write-only FIFOs for %s: %d\n",
@ -201,8 +200,7 @@ int local_accept(FAR struct socket *psock, FAR struct sockaddr *addr,
* for writing.
*/
ret = local_open_server_rx(
conn, _SS_ISNONBLOCK(server->lc_conn.s_flags));
ret = local_open_server_rx(conn, false);
if (ret < 0)
{
nerr("ERROR: Failed to open read-only FIFOs for %s: %d\n",

View File

@ -718,6 +718,17 @@ static int local_ioctl(FAR struct socket *psock, int cmd,
switch (cmd)
{
case FIONBIO:
if (conn->lc_infile.f_inode != NULL)
{
ret = file_ioctl(&conn->lc_infile, cmd, arg);
}
if (ret >= 0 && conn->lc_outfile.f_inode != NULL)
{
ret = file_ioctl(&conn->lc_outfile, cmd, arg);
}
break;
case FIONREAD:
if (conn->lc_infile.f_inode != NULL)
{