anchao opened a new pull request #1336: URL: https://github.com/apache/incubator-nuttx/pull/1336
## Summary syscall/prctl: fix PR_SET_NAME failure if without <pid> arg add PR_SET_NAME_EXT/PR_GET_NAME_EXT extension to avoid semantic conflicts, use extened version for pthread_setname_np/pthread_getname_np ``` PRCTL(2) NAME prctl - operations on a process .... DESCRIPTION .... PR_SET_NAME (since Linux 2.6.9) Set the name of the calling thread, using the value in the location pointed to by (char *) arg2. The name can be up to 16 bytes long, including the terminating null byte. (If the length of the string, including the terminating null byte, exceeds 16 bytes, the string is silently truncated.) ``` ## Impact prctl(PR_SET_NAME, "test name") ## Testing Set the specified name to self and pause the current process: ``` $ git diff . diff --git a/examples/hello/hello_main.c b/examples/hello/hello_main.c index 953597a..f21b74b 100644 --- a/examples/hello/hello_main.c +++ b/examples/hello/hello_main.c @@ -50,6 +50,9 @@ int main(int argc, FAR char *argv[]) { + prctl(PR_SET_NAME, "test name"); printf("Hello, World!!\n"); + pause(); return 0; } ``` Before patch: ``` $ hello & Hello, World!! $ ps PID PPID PRI POLICY TYPE NPX STATE EVENT SIGMASK STACK COMMAND 0 0 0 FIFO Kthread N-- Ready 00000000 004096 Idle Task 2 1 100 FIFO Task --- Running 00000000 008160 /system/bin/nsh 3 2 100 FIFO Task --- Waiting Signal 00000000 008176 hello ``` After patch: ``` $ hello & Hello, World!! $ ps PID PPID PRI POLICY TYPE NPX STATE EVENT SIGMASK STACK COMMAND 0 0 0 FIFO Kthread N-- Ready 00000000 004096 Idle Task 2 1 100 FIFO Task --- Running 00000000 008160 /system/bin/nsh 3 2 100 FIFO Task --- Waiting Signal 00000000 008176 test name ``` ---------------------------------------------------------------- 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. For queries about this service, please contact Infrastructure at: us...@infra.apache.org