You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@nuttx.apache.org by GitBox <gi...@apache.org> on 2022/11/22 08:02:34 UTC

[GitHub] [incubator-nuttx] pkarashchenko commented on a diff in pull request #7651: net/sockif: add si_getsockopt and si_setsockopt to simply getsockopt and setsockopt

pkarashchenko commented on code in PR #7651:
URL: https://github.com/apache/incubator-nuttx/pull/7651#discussion_r1028980959


##########
net/bluetooth/bluetooth_sockif.c:
##########
@@ -673,6 +683,73 @@ static int bluetooth_getpeername(FAR struct socket *psock,
   return OK;
 }
 
+#ifdef CONFIG_NET_SOCKOPTS
+
+/****************************************************************************
+ * Name: bluetooth_getsockopt
+ *
+ * Description:
+ *   bluetooth_getsockopt() retrieve the value for the option specified by
+ *   the 'option' argument at the protocol level specified by the 'level'
+ *   argument. If the size of the option value is greater than 'value_len',
+ *   the value stored in the object pointed to by the 'value' argument will
+ *   be silently truncated. Otherwise, the length pointed to by the
+ *   'value_len' argument will be modified to indicate the actual length
+ *   of the 'value'.
+ *
+ *   The 'level' argument specifies the protocol level of the option. To
+ *   retrieve options at the socket level, specify the level argument as
+ *   SOL_SOCKET.
+ *
+ *   See <sys/socket.h> a complete list of values for the 'option' argument.
+ *
+ * Input Parameters:
+ *   psock     Socket structure of the socket to query
+ *   level     Protocol level to set the option
+ *   option    identifies the option to get
+ *   value     Points to the argument value
+ *   value_len The length of the argument value
+ *
+ ****************************************************************************/
+
+static int bluetooth_getsockopt(FAR struct socket *psock, int level,
+                                 int option, FAR void *value,
+                                 FAR socklen_t *value_len)

Review Comment:
   ```suggestion
   static int bluetooth_getsockopt(FAR struct socket *psock, int level,
                                   int option, FAR void *value,
                                   FAR socklen_t *value_len)
   ```



##########
include/sys/socket.h:
##########
@@ -330,6 +333,13 @@ struct cmsghdr
   int cmsg_type;                /* Protocol-specific type */
 };
 
+struct ucred
+{
+  pid_t pid;
+  pid_t uid;
+  pid_t gid;

Review Comment:
   ```suggestion
     uid_t uid;
     gid_t gid;
   ```



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@nuttx.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org