diff options
author | Ingo Molnar <mingo@elte.hu> | 2012-03-05 03:20:08 -0500 |
---|---|---|
committer | Ingo Molnar <mingo@elte.hu> | 2012-03-05 03:20:08 -0500 |
commit | 737f24bda723fdf89ecaacb99fa2bf5683c32799 (patch) | |
tree | 35495fff3e9956679cb5468e74e6814c8e44ee66 /fs/exec.c | |
parent | 8eedce996556d7d06522cd3a0e6069141c8dffe0 (diff) | |
parent | b7c924274c456499264d1cfa3d44063bb11eb5db (diff) |
Merge branch 'perf/urgent' into perf/core
Conflicts:
tools/perf/builtin-record.c
tools/perf/builtin-top.c
tools/perf/perf.h
tools/perf/util/top.h
Merge reason: resolve these cherry-picking conflicts.
Signed-off-by: Ingo Molnar <mingo@elte.hu>
Diffstat (limited to 'fs/exec.c')
-rw-r--r-- | fs/exec.c | 33 |
1 files changed, 17 insertions, 16 deletions
@@ -1073,6 +1073,21 @@ void set_task_comm(struct task_struct *tsk, char *buf) | |||
1073 | perf_event_comm(tsk); | 1073 | perf_event_comm(tsk); |
1074 | } | 1074 | } |
1075 | 1075 | ||
1076 | static void filename_to_taskname(char *tcomm, const char *fn, unsigned int len) | ||
1077 | { | ||
1078 | int i, ch; | ||
1079 | |||
1080 | /* Copies the binary name from after last slash */ | ||
1081 | for (i = 0; (ch = *(fn++)) != '\0';) { | ||
1082 | if (ch == '/') | ||
1083 | i = 0; /* overwrite what we wrote */ | ||
1084 | else | ||
1085 | if (i < len - 1) | ||
1086 | tcomm[i++] = ch; | ||
1087 | } | ||
1088 | tcomm[i] = '\0'; | ||
1089 | } | ||
1090 | |||
1076 | int flush_old_exec(struct linux_binprm * bprm) | 1091 | int flush_old_exec(struct linux_binprm * bprm) |
1077 | { | 1092 | { |
1078 | int retval; | 1093 | int retval; |
@@ -1087,6 +1102,7 @@ int flush_old_exec(struct linux_binprm * bprm) | |||
1087 | 1102 | ||
1088 | set_mm_exe_file(bprm->mm, bprm->file); | 1103 | set_mm_exe_file(bprm->mm, bprm->file); |
1089 | 1104 | ||
1105 | filename_to_taskname(bprm->tcomm, bprm->filename, sizeof(bprm->tcomm)); | ||
1090 | /* | 1106 | /* |
1091 | * Release all of the old mmap stuff | 1107 | * Release all of the old mmap stuff |
1092 | */ | 1108 | */ |
@@ -1118,10 +1134,6 @@ EXPORT_SYMBOL(would_dump); | |||
1118 | 1134 | ||
1119 | void setup_new_exec(struct linux_binprm * bprm) | 1135 | void setup_new_exec(struct linux_binprm * bprm) |
1120 | { | 1136 | { |
1121 | int i, ch; | ||
1122 | const char *name; | ||
1123 | char tcomm[sizeof(current->comm)]; | ||
1124 | |||
1125 | arch_pick_mmap_layout(current->mm); | 1137 | arch_pick_mmap_layout(current->mm); |
1126 | 1138 | ||
1127 | /* This is the point of no return */ | 1139 | /* This is the point of no return */ |
@@ -1132,18 +1144,7 @@ void setup_new_exec(struct linux_binprm * bprm) | |||
1132 | else | 1144 | else |
1133 | set_dumpable(current->mm, suid_dumpable); | 1145 | set_dumpable(current->mm, suid_dumpable); |
1134 | 1146 | ||
1135 | name = bprm->filename; | 1147 | set_task_comm(current, bprm->tcomm); |
1136 | |||
1137 | /* Copies the binary name from after last slash */ | ||
1138 | for (i=0; (ch = *(name++)) != '\0';) { | ||
1139 | if (ch == '/') | ||
1140 | i = 0; /* overwrite what we wrote */ | ||
1141 | else | ||
1142 | if (i < (sizeof(tcomm) - 1)) | ||
1143 | tcomm[i++] = ch; | ||
1144 | } | ||
1145 | tcomm[i] = '\0'; | ||
1146 | set_task_comm(current, tcomm); | ||
1147 | 1148 | ||
1148 | /* Set the new mm task size. We have to do that late because it may | 1149 | /* Set the new mm task size. We have to do that late because it may |
1149 | * depend on TIF_32BIT which is only updated in flush_thread() on | 1150 | * depend on TIF_32BIT which is only updated in flush_thread() on |