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 2023/01/20 17:21:36 UTC

[GitHub] [nuttx] xiaoxiang781216 opened a new pull request, #8205: Implement more pthread API

xiaoxiang781216 opened a new pull request, #8205:
URL: https://github.com/apache/nuttx/pull/8205

   ## Summary
   
   - Documentation: Remove the supported function from the unsupported list 
   - libc/pthread: Implement pthread_rwlockattr API
   - libc/pthread: Implement pthread_attr_[set|get]stackaddr 
   - libc/pthread: Implement pthread_condattr_[set|get]pshared
   
   ## Impact
   
   New API
   
   ## Testing
   
   Pass CI


-- 
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


[GitHub] [nuttx] gustavonihei commented on a diff in pull request #8205: Implement more pthread API

Posted by "gustavonihei (via GitHub)" <gi...@apache.org>.
gustavonihei commented on code in PR #8205:
URL: https://github.com/apache/nuttx/pull/8205#discussion_r1084317974


##########
libs/libc/pthread/pthread_attr_getstack.c:
##########
@@ -38,8 +35,9 @@
  * Description:

Review Comment:
   Function description still missing. Maybe we could use the documentation from the OpenGroup specification:
   ```suggestion
    * Description:
    *   The pthread_attr_getstack() function shall get the thread creation stack
    *   attributes stackaddr and stacksize from the attr object.
   ```



-- 
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


[GitHub] [nuttx] xiaoxiang781216 commented on a diff in pull request #8205: Implement more pthread API

Posted by "xiaoxiang781216 (via GitHub)" <gi...@apache.org>.
xiaoxiang781216 commented on code in PR #8205:
URL: https://github.com/apache/nuttx/pull/8205#discussion_r1084357258


##########
libs/libc/pthread/pthread_attr_setstack.c:
##########
@@ -39,9 +35,9 @@
  * Description:

Review Comment:
   Done.



-- 
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


[GitHub] [nuttx] gustavonihei commented on a diff in pull request #8205: Implement more pthread API

Posted by "gustavonihei (via GitHub)" <gi...@apache.org>.
gustavonihei commented on code in PR #8205:
URL: https://github.com/apache/nuttx/pull/8205#discussion_r1084317974


##########
libs/libc/pthread/pthread_attr_getstack.c:
##########
@@ -38,8 +35,9 @@
  * Description:

Review Comment:
   Function description still missing. Maybe we could use the documentation from the OpenGroup specification:
   ```suggestion
    * Description:
    *   The pthread_attr_getstack() function shall get the thread creation stack
    *   attributes stackaddr and stacksize from the attr object.
   ```
   https://pubs.opengroup.org/onlinepubs/9699919799/functions/pthread_attr_getstack.html



-- 
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


[GitHub] [nuttx] gustavonihei commented on a diff in pull request #8205: Implement more pthread API

Posted by "gustavonihei (via GitHub)" <gi...@apache.org>.
gustavonihei commented on code in PR #8205:
URL: https://github.com/apache/nuttx/pull/8205#discussion_r1084323518


##########
libs/libc/pthread/pthread_attr_setstack.c:
##########
@@ -39,9 +35,9 @@
  * Description:

Review Comment:
   Function description still missing. Maybe we could use the documentation from the OpenGroup specification:
   ```suggestion
    * Description:
    *   The pthread_attr_setstack() function shall set the thread creation stack
    *   attributes stackaddr and stacksize in the attr object.
   ```



-- 
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


[GitHub] [nuttx] gustavonihei commented on a diff in pull request #8205: Implement more pthread API

Posted by "gustavonihei (via GitHub)" <gi...@apache.org>.
gustavonihei commented on code in PR #8205:
URL: https://github.com/apache/nuttx/pull/8205#discussion_r1084156218


##########
libs/libc/pthread/pthread_attr_getstackaddr.c:
##########
@@ -0,0 +1,70 @@
+/****************************************************************************
+ * libs/libc/pthread/pthread_attr_getstackaddr.c
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.  The
+ * ASF licenses this file to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance with the
+ * License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.  See the
+ * License for the specific language governing permissions and limitations
+ * under the License.
+ *
+ ****************************************************************************/
+
+/****************************************************************************
+ * Included Files
+ ****************************************************************************/
+
+#include <sys/types.h>
+#include <pthread.h>
+#include <string.h>
+#include <debug.h>
+#include <errno.h>
+
+/****************************************************************************
+ * Public Functions
+ ****************************************************************************/
+
+/****************************************************************************
+ * Name:  pthread_attr_getstackaddr
+ *
+ * Description:
+ *
+ * Parameters:
+ *   attr
+ *   stackaddr

Review Comment:
   Missing description



##########
libs/libc/pthread/pthread_attr_setstackaddr.c:
##########
@@ -0,0 +1,70 @@
+/****************************************************************************
+ * libs/libc/pthread/pthread_attr_setstackaddr.c
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.  The
+ * ASF licenses this file to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance with the
+ * License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.  See the
+ * License for the specific language governing permissions and limitations
+ * under the License.
+ *
+ ****************************************************************************/
+
+/****************************************************************************
+ * Included Files
+ ****************************************************************************/
+
+#include <nuttx/config.h>
+
+#include <pthread.h>
+#include <string.h>
+#include <debug.h>
+#include <errno.h>
+
+/****************************************************************************
+ * Public Functions
+ ****************************************************************************/
+
+/****************************************************************************
+ * Name:  pthread_attr_setstackaddr
+ *
+ * Description:
+ *
+ * Parameters:
+ *   attr
+ *   stackaddr

Review Comment:
   Missing description



-- 
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


[GitHub] [nuttx] xiaoxiang781216 commented on a diff in pull request #8205: Implement more pthread API

Posted by "xiaoxiang781216 (via GitHub)" <gi...@apache.org>.
xiaoxiang781216 commented on code in PR #8205:
URL: https://github.com/apache/nuttx/pull/8205#discussion_r1084309794


##########
libs/libc/pthread/pthread_attr_setstackaddr.c:
##########
@@ -0,0 +1,70 @@
+/****************************************************************************
+ * libs/libc/pthread/pthread_attr_setstackaddr.c
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.  The
+ * ASF licenses this file to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance with the
+ * License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.  See the
+ * License for the specific language governing permissions and limitations
+ * under the License.
+ *
+ ****************************************************************************/
+
+/****************************************************************************
+ * Included Files
+ ****************************************************************************/
+
+#include <nuttx/config.h>
+
+#include <pthread.h>
+#include <string.h>
+#include <debug.h>
+#include <errno.h>
+
+/****************************************************************************
+ * Public Functions
+ ****************************************************************************/
+
+/****************************************************************************
+ * Name:  pthread_attr_setstackaddr
+ *
+ * Description:
+ *
+ * Parameters:
+ *   attr
+ *   stackaddr

Review Comment:
   Done.



##########
libs/libc/pthread/pthread_attr_getstackaddr.c:
##########
@@ -0,0 +1,70 @@
+/****************************************************************************
+ * libs/libc/pthread/pthread_attr_getstackaddr.c
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.  The
+ * ASF licenses this file to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance with the
+ * License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.  See the
+ * License for the specific language governing permissions and limitations
+ * under the License.
+ *
+ ****************************************************************************/
+
+/****************************************************************************
+ * Included Files
+ ****************************************************************************/
+
+#include <sys/types.h>
+#include <pthread.h>
+#include <string.h>
+#include <debug.h>
+#include <errno.h>
+
+/****************************************************************************
+ * Public Functions
+ ****************************************************************************/
+
+/****************************************************************************
+ * Name:  pthread_attr_getstackaddr
+ *
+ * Description:
+ *
+ * Parameters:
+ *   attr
+ *   stackaddr

Review Comment:
   Done.



-- 
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


[GitHub] [nuttx] gustavonihei commented on a diff in pull request #8205: Implement more pthread API

Posted by "gustavonihei (via GitHub)" <gi...@apache.org>.
gustavonihei commented on code in PR #8205:
URL: https://github.com/apache/nuttx/pull/8205#discussion_r1084163048


##########
libs/libc/pthread/pthread_attr_getstackaddr.c:
##########
@@ -0,0 +1,70 @@
+/****************************************************************************
+ * libs/libc/pthread/pthread_attr_getstackaddr.c
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.  The
+ * ASF licenses this file to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance with the
+ * License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.  See the
+ * License for the specific language governing permissions and limitations
+ * under the License.
+ *
+ ****************************************************************************/
+
+/****************************************************************************
+ * Included Files
+ ****************************************************************************/
+
+#include <sys/types.h>
+#include <pthread.h>
+#include <string.h>
+#include <debug.h>
+#include <errno.h>
+
+/****************************************************************************
+ * Public Functions
+ ****************************************************************************/
+
+/****************************************************************************
+ * Name:  pthread_attr_getstackaddr
+ *
+ * Description:
+ *
+ * Parameters:
+ *   attr
+ *   stackaddr
+ *
+ * Return Value:
+ *   0 if successful.  Otherwise, an error code.
+ *
+ * Assumptions:
+ *
+ ****************************************************************************/
+
+int pthread_attr_getstackaddr(FAR const pthread_attr_t *attr,
+                              FAR void **stackaddr)
+{
+  int ret;
+
+  linfo("attr=%p stackaddr=%p\n", attr, stackaddr);
+
+  if (!attr || !stackaddr)
+    {
+      ret = EINVAL;
+    }
+  else
+    {
+      *stackaddr = attr->stackaddr;
+      ret = OK;
+    }
+
+  linfo("Returning %d\n", ret);

Review Comment:
   It seems this log message does not contribute too much when the function succeeds. Please consider moving it to the error case as `lerr`.
   
   Or maybe print the returned value on the `stackaddr` pointer.



-- 
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


[GitHub] [nuttx] gustavonihei commented on a diff in pull request #8205: Implement more pthread API

Posted by "gustavonihei (via GitHub)" <gi...@apache.org>.
gustavonihei commented on code in PR #8205:
URL: https://github.com/apache/nuttx/pull/8205#discussion_r1084321488


##########
libs/libc/pthread/pthread_attr_getstackaddr.c:
##########
@@ -0,0 +1,64 @@
+/****************************************************************************
+ * libs/libc/pthread/pthread_attr_getstackaddr.c
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.  The
+ * ASF licenses this file to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance with the
+ * License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.  See the
+ * License for the specific language governing permissions and limitations
+ * under the License.
+ *
+ ****************************************************************************/
+
+/****************************************************************************
+ * Included Files
+ ****************************************************************************/
+
+#include <pthread.h>
+#include <errno.h>
+
+/****************************************************************************
+ * Public Functions
+ ****************************************************************************/
+
+/****************************************************************************
+ * Name:  pthread_attr_getstackaddr
+ *
+ * Description:

Review Comment:
   Function description still missing.



-- 
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


[GitHub] [nuttx] gustavonihei commented on a diff in pull request #8205: Implement more pthread API

Posted by "gustavonihei (via GitHub)" <gi...@apache.org>.
gustavonihei commented on code in PR #8205:
URL: https://github.com/apache/nuttx/pull/8205#discussion_r1084323518


##########
libs/libc/pthread/pthread_attr_setstack.c:
##########
@@ -39,9 +35,9 @@
  * Description:

Review Comment:
   Function description still missing. Maybe we could use the documentation from the OpenGroup specification:
   ```suggestion
    * Description:
    *   The pthread_attr_setstack() function shall set the thread creation stack
    *   attributes stackaddr and stacksize in the attr object.
   ```
   https://pubs.opengroup.org/onlinepubs/9699919799/functions/pthread_attr_getstack.html



-- 
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


[GitHub] [nuttx] xiaoxiang781216 commented on a diff in pull request #8205: Implement more pthread API

Posted by "xiaoxiang781216 (via GitHub)" <gi...@apache.org>.
xiaoxiang781216 commented on code in PR #8205:
URL: https://github.com/apache/nuttx/pull/8205#discussion_r1084357626


##########
libs/libc/pthread/pthread_attr_getstackaddr.c:
##########
@@ -0,0 +1,64 @@
+/****************************************************************************
+ * libs/libc/pthread/pthread_attr_getstackaddr.c
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.  The
+ * ASF licenses this file to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance with the
+ * License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.  See the
+ * License for the specific language governing permissions and limitations
+ * under the License.
+ *
+ ****************************************************************************/
+
+/****************************************************************************
+ * Included Files
+ ****************************************************************************/
+
+#include <pthread.h>
+#include <errno.h>
+
+/****************************************************************************
+ * Public Functions
+ ****************************************************************************/
+
+/****************************************************************************
+ * Name:  pthread_attr_getstackaddr
+ *
+ * Description:

Review Comment:
   Done.



##########
libs/libc/pthread/pthread_attr_setstackaddr.c:
##########
@@ -0,0 +1,63 @@
+/****************************************************************************
+ * libs/libc/pthread/pthread_attr_setstackaddr.c
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.  The
+ * ASF licenses this file to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance with the
+ * License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.  See the
+ * License for the specific language governing permissions and limitations
+ * under the License.
+ *
+ ****************************************************************************/
+
+/****************************************************************************
+ * Included Files
+ ****************************************************************************/
+
+#include <pthread.h>
+#include <errno.h>
+
+/****************************************************************************
+ * Public Functions
+ ****************************************************************************/
+
+/****************************************************************************
+ * Name:  pthread_attr_setstackaddr
+ *
+ * Description:

Review Comment:
   Done.



-- 
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


[GitHub] [nuttx] gustavonihei commented on a diff in pull request #8205: Implement more pthread API

Posted by "gustavonihei (via GitHub)" <gi...@apache.org>.
gustavonihei commented on code in PR #8205:
URL: https://github.com/apache/nuttx/pull/8205#discussion_r1084162258


##########
libs/libc/pthread/pthread_attr_setstackaddr.c:
##########
@@ -0,0 +1,70 @@
+/****************************************************************************
+ * libs/libc/pthread/pthread_attr_setstackaddr.c
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.  The
+ * ASF licenses this file to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance with the
+ * License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.  See the
+ * License for the specific language governing permissions and limitations
+ * under the License.
+ *
+ ****************************************************************************/
+
+/****************************************************************************
+ * Included Files
+ ****************************************************************************/
+
+#include <nuttx/config.h>
+
+#include <pthread.h>
+#include <string.h>
+#include <debug.h>
+#include <errno.h>
+
+/****************************************************************************
+ * Public Functions
+ ****************************************************************************/
+
+/****************************************************************************
+ * Name:  pthread_attr_setstackaddr
+ *
+ * Description:
+ *
+ * Parameters:
+ *   attr
+ *   stackaddr
+ *
+ * Return Value:
+ *   0 if successful.  Otherwise, an error code.
+ *
+ * Assumptions:
+ *
+ ****************************************************************************/
+
+int pthread_attr_setstackaddr(FAR pthread_attr_t *attr, FAR void *stackaddr)
+{
+  int ret;
+
+  linfo("attr=%p stackaddr=%p\n", attr, stackaddr);
+
+  if (!attr || !stackaddr)
+    {
+      ret = EINVAL;
+    }
+  else
+    {
+      attr->stackaddr = stackaddr;
+      ret = OK;
+    }
+
+  linfo("Returning %d\n", ret);

Review Comment:
   It seems this log message does not contribute too much when the function succeeds. Please consider moving it to the error case as `lerr`.



-- 
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


[GitHub] [nuttx] gustavonihei merged pull request #8205: Implement more pthread API

Posted by "gustavonihei (via GitHub)" <gi...@apache.org>.
gustavonihei merged PR #8205:
URL: https://github.com/apache/nuttx/pull/8205


-- 
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


[GitHub] [nuttx] xiaoxiang781216 commented on a diff in pull request #8205: Implement more pthread API

Posted by "xiaoxiang781216 (via GitHub)" <gi...@apache.org>.
xiaoxiang781216 commented on code in PR #8205:
URL: https://github.com/apache/nuttx/pull/8205#discussion_r1084309589


##########
libs/libc/pthread/pthread_attr_getstackaddr.c:
##########
@@ -0,0 +1,70 @@
+/****************************************************************************
+ * libs/libc/pthread/pthread_attr_getstackaddr.c
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.  The
+ * ASF licenses this file to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance with the
+ * License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.  See the
+ * License for the specific language governing permissions and limitations
+ * under the License.
+ *
+ ****************************************************************************/
+
+/****************************************************************************
+ * Included Files
+ ****************************************************************************/
+
+#include <sys/types.h>
+#include <pthread.h>
+#include <string.h>
+#include <debug.h>
+#include <errno.h>
+
+/****************************************************************************
+ * Public Functions
+ ****************************************************************************/
+
+/****************************************************************************
+ * Name:  pthread_attr_getstackaddr
+ *
+ * Description:
+ *
+ * Parameters:
+ *   attr
+ *   stackaddr
+ *
+ * Return Value:
+ *   0 if successful.  Otherwise, an error code.
+ *
+ * Assumptions:
+ *
+ ****************************************************************************/
+
+int pthread_attr_getstackaddr(FAR const pthread_attr_t *attr,
+                              FAR void **stackaddr)
+{
+  int ret;
+
+  linfo("attr=%p stackaddr=%p\n", attr, stackaddr);
+
+  if (!attr || !stackaddr)
+    {
+      ret = EINVAL;
+    }
+  else
+    {
+      *stackaddr = attr->stackaddr;
+      ret = OK;
+    }
+
+  linfo("Returning %d\n", ret);

Review Comment:
   Done.



##########
libs/libc/pthread/pthread_attr_setstackaddr.c:
##########
@@ -0,0 +1,70 @@
+/****************************************************************************
+ * libs/libc/pthread/pthread_attr_setstackaddr.c
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.  The
+ * ASF licenses this file to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance with the
+ * License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.  See the
+ * License for the specific language governing permissions and limitations
+ * under the License.
+ *
+ ****************************************************************************/
+
+/****************************************************************************
+ * Included Files
+ ****************************************************************************/
+
+#include <nuttx/config.h>
+
+#include <pthread.h>
+#include <string.h>
+#include <debug.h>
+#include <errno.h>
+
+/****************************************************************************
+ * Public Functions
+ ****************************************************************************/
+
+/****************************************************************************
+ * Name:  pthread_attr_setstackaddr
+ *
+ * Description:
+ *
+ * Parameters:
+ *   attr
+ *   stackaddr
+ *
+ * Return Value:
+ *   0 if successful.  Otherwise, an error code.
+ *
+ * Assumptions:
+ *
+ ****************************************************************************/
+
+int pthread_attr_setstackaddr(FAR pthread_attr_t *attr, FAR void *stackaddr)
+{
+  int ret;
+
+  linfo("attr=%p stackaddr=%p\n", attr, stackaddr);
+
+  if (!attr || !stackaddr)
+    {
+      ret = EINVAL;
+    }
+  else
+    {
+      attr->stackaddr = stackaddr;
+      ret = OK;
+    }
+
+  linfo("Returning %d\n", ret);

Review Comment:
   Done.



-- 
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


[GitHub] [nuttx] gustavonihei commented on a diff in pull request #8205: Implement more pthread API

Posted by "gustavonihei (via GitHub)" <gi...@apache.org>.
gustavonihei commented on code in PR #8205:
URL: https://github.com/apache/nuttx/pull/8205#discussion_r1084321956


##########
libs/libc/pthread/pthread_attr_setstackaddr.c:
##########
@@ -0,0 +1,63 @@
+/****************************************************************************
+ * libs/libc/pthread/pthread_attr_setstackaddr.c
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.  The
+ * ASF licenses this file to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance with the
+ * License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.  See the
+ * License for the specific language governing permissions and limitations
+ * under the License.
+ *
+ ****************************************************************************/
+
+/****************************************************************************
+ * Included Files
+ ****************************************************************************/
+
+#include <pthread.h>
+#include <errno.h>
+
+/****************************************************************************
+ * Public Functions
+ ****************************************************************************/
+
+/****************************************************************************
+ * Name:  pthread_attr_setstackaddr
+ *
+ * Description:

Review Comment:
   Function description still missing.



-- 
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