7 #include <linux/kernel.h> 17 #include <api/fs/fs.h> 23 if (pid == thread->
tid || pid == -1) {
33 return thread->
mg ? 0 : -1;
56 snprintf(comm_str, 32,
":%d", tid);
63 refcount_set(&thread->
refcnt, 1);
64 RB_CLEAR_NODE(&thread->
rb_node);
81 BUG_ON(!RB_EMPTY_NODE(&thread->
rb_node));
90 list_for_each_entry_safe(namespaces, tmp_namespaces,
92 list_del(&namespaces->
list);
98 list_for_each_entry_safe(comm, tmp_comm, &thread->
comm_list,
list) {
99 list_del(&comm->
list);
115 refcount_inc(&thread->
refcnt);
121 if (thread && refcount_dec_and_test(&thread->
refcnt)) {
126 list_del_init(&thread->
node);
150 if (timestamp && curr) {
156 curr = list_next_entry(
new,
list);
196 u64 timestamp,
bool exec)
238 if (!(snprintf(path,
sizeof(path),
"%d/task/%d/comm",
239 thread->
pid_, thread->
tid) >= (
int)
sizeof(path)) &&
240 procfs__read_str(path, &comm, &sz) == 0) {
304 bool initialized =
false;
313 if (err || initialized)
333 struct thread *parent)
339 if (thread->
mg == parent->
mg) {
340 pr_debug(
"broken map groups on thread %d/%d parent %d/%d\n",
372 const u8 cpumodes[] = {
373 PERF_RECORD_MISC_USER,
374 PERF_RECORD_MISC_KERNEL,
375 PERF_RECORD_MISC_GUEST_USER,
376 PERF_RECORD_MISC_GUEST_KERNEL
379 for (i = 0; i < ARRAY_SIZE(cpumodes); i++) {
388 if (thread->
pid_ == thread->
tid)
391 if (thread->
pid_ == -1)
struct nsinfo * nsinfo__new(pid_t pid)
static int ____thread__set_comm(struct thread *thread, const char *str, u64 timestamp, bool exec)
struct comm * comm__new(const char *str, u64 timestamp, bool exec)
void namespaces__free(struct namespaces *namespaces)
int map_groups__clone(struct thread *thread, struct map_groups *parent)
static int thread__prepare_access(struct thread *thread)
void unwind__finish_access(struct thread *thread)
void thread_stack__free(struct thread *thread)
struct list_head comm_list
#define nsinfo__zput(nsi)
struct thread * __machine__findnew_thread(struct machine *machine, pid_t pid, pid_t tid)
static const char * __thread__comm_str(const struct thread *thread)
int up_write(struct rw_semaphore *sem)
void thread__delete(struct thread *thread)
static int __thread__prepare_access(struct thread *thread)
int thread__init_map_groups(struct thread *thread, struct machine *machine)
int down_read(struct rw_semaphore *sem)
struct rw_semaphore namespaces_lock
struct comm * thread__exec_comm(const struct thread *thread)
void thread__find_cpumode_addr_location(struct thread *thread, u64 addr, struct addr_location *al)
struct namespaces * thread__namespaces(const struct thread *thread)
struct thread * machine__find_thread(struct machine *machine, pid_t pid, pid_t tid)
int thread__comm_len(struct thread *thread)
struct map * maps__first(struct maps *maps)
int exit_rwsem(struct rw_semaphore *sem)
const char * thread__comm_str(const struct thread *thread)
static int thread__clone_map_groups(struct thread *thread, struct thread *parent)
#define pr_debug(fmt,...)
struct map * map__next(struct map *map)
int thread__set_comm_from_proc(struct thread *thread)
struct namespaces * namespaces__new(struct namespaces_event *event)
size_t map_groups__fprintf(struct map_groups *mg, FILE *fp)
struct rw_semaphore comm_lock
static int str(yyscan_t scanner, int token)
const char * comm__str(const struct comm *comm)
int thread__fork(struct thread *thread, struct thread *parent, u64 timestamp)
int comm__override(struct comm *comm, const char *str, u64 timestamp, bool exec)
int thread__set_namespaces(struct thread *thread, u64 timestamp, struct namespaces_event *event)
int unwind__prepare_access(struct thread *thread, struct map *map, bool *initialized)
void unwind__flush_access(struct thread *thread)
struct thread * thread__main_thread(struct machine *machine, struct thread *thread)
static int thread__set_comm(struct thread *thread, const char *comm, u64 timestamp)
struct map_groups * map_groups__new(struct machine *machine)
int init_rwsem(struct rw_semaphore *sem)
void comm__free(struct comm *comm)
void thread__put(struct thread *thread)
void map_groups__put(struct map_groups *mg)
static struct map_groups * map_groups__get(struct map_groups *mg)
struct thread * thread__new(pid_t pid, pid_t tid)
struct symbol * thread__find_symbol(struct thread *thread, u8 cpumode, u64 addr, struct addr_location *al)
static int __thread__set_namespaces(struct thread *thread, u64 timestamp, struct namespaces_event *event)
int thread__insert_map(struct thread *thread, struct map *map)
int down_write(struct rw_semaphore *sem)
size_t thread__fprintf(struct thread *thread, FILE *fp)
struct comm * thread__comm(const struct thread *thread)
struct thread * thread__get(struct thread *thread)
int map_groups__fixup_overlappings(struct map_groups *mg, struct map *map, FILE *fp)
struct list_head namespaces_list
static void map_groups__insert(struct map_groups *mg, struct map *map)
int up_read(struct rw_semaphore *sem)
int __thread__set_comm(struct thread *thread, const char *str, u64 timestamp, bool exec)
void static void * zalloc(size_t size)