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/05/14 13:53:25 UTC

[incubator-nuttx] branch master updated (0bd5dda -> 03f462c)

This is an automated email from the ASF dual-hosted git repository.

gnutt pushed a change to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-nuttx.git.


    from 0bd5dda  boards: spresense: Remove CONFIG_EXAMPLES_FTPC=y to avoid compile error on CI
     new 608436a  net/sockopt: do not set the errno to SO_ERROR
     new 03f462c  net/sockopt: fix nxstyle warning

The 2 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 net/socket/getsockopt.c | 15 ++++++++++-----
 net/socket/setsockopt.c | 17 ++++++++++-------
 2 files changed, 20 insertions(+), 12 deletions(-)


[incubator-nuttx] 02/02: net/sockopt: fix nxstyle warning

Posted by gn...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

gnutt pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-nuttx.git

commit 03f462c5cd684c26e6cba3a77d0acf023eb6b126
Author: chao.an <an...@xiaomi.com>
AuthorDate: Thu May 14 17:45:29 2020 +0800

    net/sockopt: fix nxstyle warning
    
    Signed-off-by: chao.an <an...@xiaomi.com>
---
 net/socket/getsockopt.c | 13 +++++++++----
 net/socket/setsockopt.c | 15 +++++++++------
 2 files changed, 18 insertions(+), 10 deletions(-)

diff --git a/net/socket/getsockopt.c b/net/socket/getsockopt.c
index 45cf495..e7474ad 100644
--- a/net/socket/getsockopt.c
+++ b/net/socket/getsockopt.c
@@ -92,7 +92,8 @@
  ****************************************************************************/
 
 static int psock_socketlevel_option(FAR struct socket *psock, int option,
-                                    FAR void *value, FAR socklen_t *value_len)
+                                    FAR void *value,
+                                    FAR socklen_t *value_len)
 {
   /* Verify that the socket option if valid (but might not be supported ) */
 
@@ -121,7 +122,8 @@ static int psock_socketlevel_option(FAR struct socket *psock, int option,
 
           default:          /* Other options are passed to usrsock daemon. */
             {
-              return usrsock_getsockopt(conn, SOL_SOCKET, option, value, value_len);
+              return usrsock_getsockopt(conn, SOL_SOCKET,
+                                        option, value, value_len);
             }
         }
     }
@@ -276,7 +278,9 @@ static int psock_socketlevel_option(FAR struct socket *psock, int option,
         }
         break;
 
-      /* The following are not yet implemented (return values other than {0,1) */
+      /* The following are not yet implemented
+       * (return values other than {0,1})
+       */
 
       case SO_LINGER:     /* Lingers on a close() if data is present */
       case SO_RCVBUF:     /* Sets receive buffer size */
@@ -431,7 +435,8 @@ int psock_getsockopt(FAR struct socket *psock, int level, int option,
  *
  ****************************************************************************/
 
-int getsockopt(int sockfd, int level, int option, void *value, socklen_t *value_len)
+int getsockopt(int sockfd, int level, int option,
+               void *value, socklen_t *value_len)
 {
   FAR struct socket *psock;
   int ret;
diff --git a/net/socket/setsockopt.c b/net/socket/setsockopt.c
index 468d06c..211a1df 100644
--- a/net/socket/setsockopt.c
+++ b/net/socket/setsockopt.c
@@ -87,7 +87,8 @@
  ****************************************************************************/
 
 static int psock_socketlevel_option(FAR struct socket *psock, int option,
-                                    FAR const void *value, socklen_t value_len)
+                                    FAR const void *value,
+                                    socklen_t value_len)
 {
   /* Verify that the socket option if valid (but might not be supported ) */
 
@@ -259,7 +260,9 @@ static int psock_socketlevel_option(FAR struct socket *psock, int option,
 
           net_lock();
 
-          /* Set or clear the linger option bit and linger time (in deciseconds) */
+          /* Set or clear the linger option bit and linger time
+           * (in deciseconds)
+           */
 
           if (setting->l_onoff)
             {
@@ -315,8 +318,8 @@ static int psock_socketlevel_option(FAR struct socket *psock, int option,
  *   See <sys/socket.h> a complete list of values for the socket level
  *   'option' argument.
  *
- *   Protocol level options, such as SOL_TCP, are defined in protocol-specific
- *   header files, for example include/netinet/tcp.h
+ *   Protocol level options, such as SOL_TCP, are defined in
+ *   protocol-specific header files, for example include/netinet/tcp.h
  *
  * Input Parameters:
  *   psock     Socket structure of socket to operate on
@@ -419,8 +422,8 @@ int psock_setsockopt(FAR struct socket *psock, int level, int option,
  *   See <sys/socket.h> a complete list of values for the socket level
  *   'option' argument.
  *
- *   Protocol level options, such as SOL_TCP, are defined in protocol-specific
- *   header files, for example include/netinet/tcp.h
+ *   Protocol level options, such as SOL_TCP, are defined in
+ *   protocol-specific header files, for example include/netinet/tcp.h
  *
  * Input Parameters:
  *   sockfd    Socket descriptor of socket


[incubator-nuttx] 01/02: net/sockopt: do not set the errno to SO_ERROR

Posted by gn...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

gnutt pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-nuttx.git

commit 608436a75f167d09d3c9cca4dd9b80f1e284a6f7
Author: chao.an <an...@xiaomi.com>
AuthorDate: Wed May 13 12:08:32 2020 +0800

    net/sockopt: do not set the errno to SO_ERROR
    
    SO_ERROR is used to report asynchronous errors that are the result
    of events within the network stack and not synchronous errors that
    are the result of a library call(send/recv/connect)
    
    Synchronous results are reported via errno.
    
    Linux Programmer's Manual
    ...
    NAME
           getsockopt, setsockopt - get and set options on sockets
    ...
    RETURN VALUE
    ...
           On error, -1 is returned, and errno is set appropriately
    
    Change-Id: I1a1a05a684dff8672aaf47eabee157ac0d275c2d
    Signed-off-by: chao.an <an...@xiaomi.com>
---
 net/socket/getsockopt.c | 2 +-
 net/socket/setsockopt.c | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/net/socket/getsockopt.c b/net/socket/getsockopt.c
index 2bc1c73..45cf495 100644
--- a/net/socket/getsockopt.c
+++ b/net/socket/getsockopt.c
@@ -445,7 +445,7 @@ int getsockopt(int sockfd, int level, int option, void *value, socklen_t *value_
   ret = psock_getsockopt(psock, level, option, value, value_len);
   if (ret < 0)
     {
-      _SO_SETERRNO(psock, -ret);
+      set_errno(-ret);
       return ERROR;
     }
 
diff --git a/net/socket/setsockopt.c b/net/socket/setsockopt.c
index e968467..468d06c 100644
--- a/net/socket/setsockopt.c
+++ b/net/socket/setsockopt.c
@@ -470,7 +470,7 @@ int setsockopt(int sockfd, int level, int option, const void *value,
   ret = psock_setsockopt(psock, level, option, value, value_len);
   if (ret < 0)
     {
-      _SO_SETERRNO(psock, -ret);
+      set_errno(-ret);
       return ERROR;
     }