Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
A
AndroidSystemCore
Manage
Activity
Members
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Container registry
Model registry
Analyze
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Werner Sembach
AndroidSystemCore
Commits
f6eba8fa
Commit
f6eba8fa
authored
Oct 28, 2009
by
Erik Gilling
Browse files
Options
Downloads
Patches
Plain Diff
cutils: make set_process_name set kernel thread name as well
Signed-off-by:
Erik Gilling
<
konkers@android.com
>
parent
5e7db233
Branches
Branches containing commit
Tags
Tags containing commit
No related merge requests found
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
libcutils/process_name.c
+14
-1
14 additions, 1 deletion
libcutils/process_name.c
with
14 additions
and
1 deletion
libcutils/process_name.c
+
14
−
1
View file @
f6eba8fa
...
@@ -22,6 +22,10 @@
...
@@ -22,6 +22,10 @@
#include
<sys/stat.h>
#include
<sys/stat.h>
#include
<fcntl.h>
#include
<fcntl.h>
#if defined(HAVE_PRCTL)
#include
<sys/prctl.h>
#endif
#define PROCESS_NAME_DEVICE "/sys/qemu_trace/process_name"
#define PROCESS_NAME_DEVICE "/sys/qemu_trace/process_name"
static
const
char
*
process_name
=
"unknown"
;
static
const
char
*
process_name
=
"unknown"
;
...
@@ -35,10 +39,19 @@ void set_process_name(const char* new_name) {
...
@@ -35,10 +39,19 @@ void set_process_name(const char* new_name) {
}
}
// We never free the old name. Someone else could be using it.
// We never free the old name. Someone else could be using it.
char
*
copy
=
(
char
*
)
malloc
(
strlen
(
new_name
)
+
1
);
int
len
=
strlen
(
new_name
);
char
*
copy
=
(
char
*
)
malloc
(
len
+
1
);
strcpy
(
copy
,
new_name
);
strcpy
(
copy
,
new_name
);
process_name
=
(
const
char
*
)
copy
;
process_name
=
(
const
char
*
)
copy
;
#if defined(HAVE_PRCTL)
if
(
len
<
16
)
{
prctl
(
PR_SET_NAME
,
(
unsigned
long
)
new_name
,
0
,
0
,
0
);
}
else
{
prctl
(
PR_SET_NAME
,
(
unsigned
long
)
new_name
+
len
-
15
,
0
,
0
,
0
);
}
#endif
// If we know we are not running in the emulator, then return.
// If we know we are not running in the emulator, then return.
if
(
running_in_emulator
==
0
)
{
if
(
running_in_emulator
==
0
)
{
return
;
return
;
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment