You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@nuttx.apache.org by gn...@apache.org on 2020/01/31 19:30:50 UTC
[incubator-nuttx] 06/10: Implment SO_ACCEPTCONN
This is an automated email from the ASF dual-hosted git repository.
gnutt pushed a commit to branch pr192
in repository https://gitbox.apache.org/repos/asf/incubator-nuttx.git
commit 5016dee74e839c60731486cb93086fb278d3c3e7
Author: Xiang Xiao <xi...@xiaomi.com>
AuthorDate: Fri Jan 31 17:57:02 2020 +0800
Implment SO_ACCEPTCONN
Change-Id: I97d4d3b561c57941ffab11e580f701d3ecc5df34
Signed-off-by: Xiang Xiao <xi...@xiaomi.com>
---
net/socket/getsockopt.c | 11 ++++++++++-
1 file changed, 10 insertions(+), 1 deletion(-)
diff --git a/net/socket/getsockopt.c b/net/socket/getsockopt.c
index 13d8bc0..2bc1c73 100644
--- a/net/socket/getsockopt.c
+++ b/net/socket/getsockopt.c
@@ -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 */