Implment SO_ACCEPTCONN

This commit is contained in:
Xiang Xiao 2020-01-31 17:57:02 +08:00 committed by Gregory Nutt
parent cf2ddbb2b1
commit 7e67add999
1 changed files with 10 additions and 1 deletions

View File

@ -131,6 +131,16 @@ static int psock_socketlevel_option(FAR struct socket *psock, int option,
switch (option)
{
case SO_ACCEPTCONN: /* Reports whether socket listening is enabled */
if (*value_len < sizeof(int))
{
return -EINVAL;
}
*(FAR int *)value = _SS_ISLISTENING(psock->s_flags);
*value_len = sizeof(int);
break;
/* The following options take a point to an integer boolean value.
* We will blindly report the bit here although the implementation
* is outside of the scope of getsockopt.
@ -268,7 +278,6 @@ static int psock_socketlevel_option(FAR struct socket *psock, int option,
/* The following are not yet implemented (return values other than {0,1) */
case SO_ACCEPTCONN: /* Reports whether socket listening is enabled */
case SO_LINGER: /* Lingers on a close() if data is present */
case SO_RCVBUF: /* Sets receive buffer size */
case SO_RCVLOWAT: /* Sets the minimum number of bytes to input */