| /* Skip "." and ".." directories */ |
| static int filter(const struct dirent *dir) |
| if (dir->d_name[0] == '.') |
| struct thread_map *thread_map__new_by_pid(pid_t pid) |
| struct thread_map *threads; |
| struct dirent **namelist = NULL; |
| sprintf(name, "/proc/%d/task", pid); |
| items = scandir(name, &namelist, filter, NULL); |
| threads = malloc(sizeof(*threads) + sizeof(pid_t) * items); |
| for (i = 0; i < items; i++) |
| threads->map[i] = atoi(namelist[i]->d_name); |
| struct thread_map *thread_map__new_by_tid(pid_t tid) |
| struct thread_map *threads = malloc(sizeof(*threads) + sizeof(pid_t)); |
| struct thread_map *thread_map__new(pid_t pid, pid_t tid) |
| return thread_map__new_by_pid(pid); |
| return thread_map__new_by_tid(tid); |
| void thread_map__delete(struct thread_map *threads) |