crash-stack: Drop unused get_threads() 95/255695/1
authorKarol Lewandowski <k.lewandowsk@samsung.com>
Mon, 22 Mar 2021 15:39:07 +0000 (16:39 +0100)
committerKarol Lewandowski <k.lewandowsk@samsung.com>
Mon, 22 Mar 2021 15:41:59 +0000 (16:41 +0100)
Change-Id: I8146fe9c52889d872967dadfa12065dabb42cc3f

src/crash-stack/proc.c
src/crash-stack/proc.h

index 0a2c969..858336e 100644 (file)
@@ -252,53 +252,6 @@ int print_proc_maps(int pid)
     return system(cmd);
 }
 
-/*
- * filter for scandir(). choose only thread identifiers
- */
-static int dir_select(const struct dirent *entry)
-{
-    const char *c = entry->d_name;
-    while (*c)
-        if (!isdigit(*c++))
-            return 0;
-    return 1;
-}
-
-int get_threads(int pid, int **tids)
-{
-    char buf[32];
-    struct dirent **namelist;
-    int cur, i, n, res;
-
-    snprintf(buf, sizeof(buf), "/proc/%d/task", pid);
-
-    n = scandir(buf, &namelist, dir_select, NULL);
-    res = n;
-    if (n < 0) {
-        perror(buf);
-        return -1;
-    } else {
-        *tids = malloc(sizeof(int)*n);
-        if (*tids == NULL) {
-            res = -1;
-            goto exit;
-        }
-
-        i = 0;
-        while (i < n) {
-            cur = atoi(namelist[i]->d_name);
-            (*tids)[i] = cur;
-        }
-    }
-
-exit:
-    for (i = 0; i < n; i++)
-        free(namelist[i]);
-    free(namelist);
-
-    return res;
-}
-
 char *get_thread_states(const int *tids, int n)
 {
     int i;
index 00c8c1c..69d6e92 100644 (file)
@@ -50,11 +50,6 @@ struct mem_map *create_maps(int pid);
 int print_proc_maps(int pid);
 
 /*
- * get thread identifiers of the process
- */
-int get_threads(int pid, int **tids);
-
-/*
  * returns a pointer to dynamically allocated array of characters representing
  * thread states as found in /proc/<pid>/status
  */