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/02/05 09:10:10 UTC
[GitHub] [incubator-nuttx] xiaoxiang781216 opened a new pull request #5417: pthread: Add len argument to pthread_getname_np
xiaoxiang781216 opened a new pull request #5417:
URL: https://github.com/apache/incubator-nuttx/pull/5417
## Summary
follow the spec:
https://man7.org/linux/man-pages/man3/pthread_setname_np.3.html
## Impact
the caller of pthread_getname_np
## 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] [incubator-nuttx] pkarashchenko merged pull request #5417: pthread: Add len argument to pthread_getname_np
Posted by GitBox <gi...@apache.org>.
pkarashchenko merged pull request #5417:
URL: https://github.com/apache/incubator-nuttx/pull/5417
--
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] [incubator-nuttx] pkarashchenko commented on a change in pull request #5417: pthread: Add len argument to pthread_getname_np
Posted by GitBox <gi...@apache.org>.
pkarashchenko commented on a change in pull request #5417:
URL: https://github.com/apache/incubator-nuttx/pull/5417#discussion_r800228617
##########
File path: include/pthread.h
##########
@@ -197,7 +197,7 @@
#define pthread_setname_np(thread, name) \
prctl((int)PR_SET_NAME_EXT, (char*)name, (int)thread)
-#define pthread_getname_np(thread, name) \
+#define pthread_getname_np(thread, name, len) \
Review comment:
I searched the prototype and it was variable parameter count prototype. Or maybe I visited a wrong file.
--
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] [incubator-nuttx] xiaoxiang781216 commented on a change in pull request #5417: pthread: Add len argument to pthread_getname_np
Posted by GitBox <gi...@apache.org>.
xiaoxiang781216 commented on a change in pull request #5417:
URL: https://github.com/apache/incubator-nuttx/pull/5417#discussion_r800289759
##########
File path: include/pthread.h
##########
@@ -197,7 +197,7 @@
#define pthread_setname_np(thread, name) \
prctl((int)PR_SET_NAME_EXT, (char*)name, (int)thread)
-#define pthread_getname_np(thread, name) \
+#define pthread_getname_np(thread, name, len) \
Review comment:
Yes, you are right, but PR_GET_NAME defined by Linux in the same way:
https://man7.org/linux/man-pages/man2/prctl.2.html
```
PR_GET_NAME (since Linux 2.6.11)
Return the name of the calling thread, in the buffer
pointed to by (char *) arg2. The buffer should allow
space for up to 16 bytes; the returned string will be
null-terminated.
```
So, it's better to keep the prototype as it.
--
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] [incubator-nuttx] pkarashchenko commented on a change in pull request #5417: pthread: Add len argument to pthread_getname_np
Posted by GitBox <gi...@apache.org>.
pkarashchenko commented on a change in pull request #5417:
URL: https://github.com/apache/incubator-nuttx/pull/5417#discussion_r800218936
##########
File path: include/pthread.h
##########
@@ -197,7 +197,7 @@
#define pthread_setname_np(thread, name) \
prctl((int)PR_SET_NAME_EXT, (char*)name, (int)thread)
-#define pthread_getname_np(thread, name) \
+#define pthread_getname_np(thread, name, len) \
Review comment:
And also process this argument when copy task name to check length
--
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] [incubator-nuttx] xiaoxiang781216 commented on a change in pull request #5417: pthread: Add len argument to pthread_getname_np
Posted by GitBox <gi...@apache.org>.
xiaoxiang781216 commented on a change in pull request #5417:
URL: https://github.com/apache/incubator-nuttx/pull/5417#discussion_r800293688
##########
File path: include/pthread.h
##########
@@ -197,7 +197,7 @@
#define pthread_setname_np(thread, name) \
prctl((int)PR_SET_NAME_EXT, (char*)name, (int)thread)
-#define pthread_getname_np(thread, name) \
+#define pthread_getname_np(thread, name, len) \
Review comment:
No, please see my above reply.
--
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] [incubator-nuttx] pkarashchenko commented on a change in pull request #5417: pthread: Add len argument to pthread_getname_np
Posted by GitBox <gi...@apache.org>.
pkarashchenko commented on a change in pull request #5417:
URL: https://github.com/apache/incubator-nuttx/pull/5417#discussion_r800218400
##########
File path: include/pthread.h
##########
@@ -197,7 +197,7 @@
#define pthread_setname_np(thread, name) \
prctl((int)PR_SET_NAME_EXT, (char*)name, (int)thread)
-#define pthread_getname_np(thread, name) \
+#define pthread_getname_np(thread, name, len) \
Review comment:
Shouldn't we pass `len` argument to `prctl` call?
--
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] [incubator-nuttx] yamt commented on a change in pull request #5417: pthread: Add len argument to pthread_getname_np
Posted by GitBox <gi...@apache.org>.
yamt commented on a change in pull request #5417:
URL: https://github.com/apache/incubator-nuttx/pull/5417#discussion_r800291095
##########
File path: include/pthread.h
##########
@@ -197,7 +197,7 @@
#define pthread_setname_np(thread, name) \
prctl((int)PR_SET_NAME_EXT, (char*)name, (int)thread)
-#define pthread_getname_np(thread, name) \
+#define pthread_getname_np(thread, name, len) \
Review comment:
why don't you make it a function which perform the size check before calling prctl?
i think it's how it's implemented in linux.
--
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] [incubator-nuttx] xiaoxiang781216 commented on a change in pull request #5417: pthread: Add len argument to pthread_getname_np
Posted by GitBox <gi...@apache.org>.
xiaoxiang781216 commented on a change in pull request #5417:
URL: https://github.com/apache/incubator-nuttx/pull/5417#discussion_r800300034
##########
File path: include/pthread.h
##########
@@ -197,7 +197,7 @@
#define pthread_setname_np(thread, name) \
prctl((int)PR_SET_NAME_EXT, (char*)name, (int)thread)
-#define pthread_getname_np(thread, name) \
+#define pthread_getname_np(thread, name, len) \
Review comment:
Good idea, 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] [incubator-nuttx] xiaoxiang781216 commented on a change in pull request #5417: pthread: Add len argument to pthread_getname_np
Posted by GitBox <gi...@apache.org>.
xiaoxiang781216 commented on a change in pull request #5417:
URL: https://github.com/apache/incubator-nuttx/pull/5417#discussion_r800220026
##########
File path: include/pthread.h
##########
@@ -197,7 +197,7 @@
#define pthread_setname_np(thread, name) \
prctl((int)PR_SET_NAME_EXT, (char*)name, (int)thread)
-#define pthread_getname_np(thread, name) \
+#define pthread_getname_np(thread, name, len) \
Review comment:
It's hard to do that without introduce a new structure since the prototype of prctl is fixed to three arguments. The assumption is that the buffer passed by caller should be at least CONFIG_TASK_NAME_SIZE + 1.
--
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] [incubator-nuttx] xiaoxiang781216 commented on a change in pull request #5417: pthread: Add len argument to pthread_getname_np
Posted by GitBox <gi...@apache.org>.
xiaoxiang781216 commented on a change in pull request #5417:
URL: https://github.com/apache/incubator-nuttx/pull/5417#discussion_r800220026
##########
File path: include/pthread.h
##########
@@ -197,7 +197,7 @@
#define pthread_setname_np(thread, name) \
prctl((int)PR_SET_NAME_EXT, (char*)name, (int)thread)
-#define pthread_getname_np(thread, name) \
+#define pthread_getname_np(thread, name, len) \
Review comment:
It's hard to do that without introduce a new structure since the prototype of prctl is fixed to three argument. The assumption is that the buffer passed by caller should be at least CONFIG_TASK_NAME_SIZE + 1.
--
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