#include "parse.h"
#include "analyze.h"
+#include "pidlib.h"
void print_help_and_die(char *name)
{
#define OPT_WITH_THREADS 0x101
+static void get_all_pids_by_name(struct parse_opts *opts, char *name)
+{
+ struct pidlist *pidlist;
+ DIR *dir = NULL;
+ int pid;
+
+ while ((pid = get_next_pid_by_name(&dir, name))) {
+ pidlist = alloc_pidlist();
+ if (pidlist == NULL)
+ return;
+ pidlist->pid = pid;
+ list_add_tail(&pidlist->list, &opts->pidlist);
+ }
+}
+
void read_args(int argc, char *argv[], struct parse_opts *opts)
{
int optind = 0, c;
break;
}
case 'P':
- opts->parse_mask |= PARSE_PROCESS_NAME;
- opts->name = optarg;
+ get_all_pids_by_name(opts, optarg);
+ opts->parse_mask |= PARSE_PID;
break;
case 'm':
opts->parse_mask |= PARSE_MAP_NAME;