Lines Matching +full:multi +full:- +full:core
1 /*-
2 * SPDX-License-Identifier: BSD-2-Clause
72 * - usage field is abused to hold the pointer to the function
76 /* arguments are the same as for pwdx: pid or core file */
102 { "fd", "files", "[-C]", &procstat_files, &cmdopt_files,
104 { "file", "files", "[-C]", &procstat_files, &cmdopt_files,
106 { "kstack", "kstack", "[-v]", &procstat_kstack, &cmdopt_verbose,
120 { "rusage", "rusage", "[-Ht]", &procstat_rusage, &cmdopt_rusage,
124 { "signal", "signals", "[-n]", &procstat_sigs, &cmdopt_signals,
128 { "tsignal", "thread_signals", "[-n]", &procstat_threads_sigs,
137 int multi; in usage() local
139 if (cmd == NULL || (cmd->cmp & PS_MODE_COMPAT) == 0) { in usage()
140 xo_error("usage: procstat [--libxo] [-h] [-M core] [-N system]" in usage()
141 " [-w interval] command\n" in usage()
142 " [pid ... | core ...]\n" in usage()
143 " procstat [--libxo] -a [-h] [-M core] [-N system] " in usage()
144 " [-w interval] command\n" in usage()
145 " procstat [--libxo] [-h] [-M core] [-N system]" in usage()
146 " [-w interval]\n" in usage()
147 " [-S | -b | -c | -e | -f [-C] | -i [-n] | " in usage()
148 "-j [-n] | -k [-k] |\n" in usage()
149 " -l | -r [-H] | -s | -t | -v | -x] " in usage()
150 "[pid ... | core ...]\n" in usage()
151 " procstat [--libxo] -a [-h] [-M core] [-N system]" in usage()
152 " [-w interval]\n" in usage()
153 " [-S | -b | -c | -e | -f [-C] | -i [-n] | " in usage()
154 "-j [-n] | -k [-k] |\n" in usage()
155 " -l | -r [-H] | -s | -t | -v | -x]\n" in usage()
156 " procstat [--libxo] -L [-h] [-M core] [-N system] core ...\n" in usage()
159 multi = i + 1 < l && cmd_table[i].cmd == in usage()
161 xo_error(" %s%s%s", multi ? "[" : "", in usage()
169 if (multi) in usage()
176 xo_error("usage: %s [--libxo] pid ...\n", progname); in usage()
188 asprintf(&pidstr, "%d", kipp->ki_pid); in procstat()
192 cmd->cmd(prstat, kipp); in procstat()
205 i = ((const struct kinfo_proc *)a)->ki_pid - in kinfo_proc_compare()
206 ((const struct kinfo_proc *)b)->ki_pid; in kinfo_proc_compare()
209 i = ((const struct kinfo_proc *)a)->ki_tid - in kinfo_proc_compare()
210 ((const struct kinfo_proc *)b)->ki_tid; in kinfo_proc_compare()
226 strlcpy(name, kipp->ki_tdname, sizeof(name)); in kinfo_proc_thread_name()
227 strlcat(name, kipp->ki_moretdname, sizeof(name)); in kinfo_proc_thread_name()
228 if (name[0] == '\0' || strcmp(kipp->ki_comm, name) == 0) { in kinfo_proc_thread_name()
229 name[0] = '-'; in kinfo_proc_thread_name()
266 s = l > 1 && strcasecmp(str + l - 1, "s") == 0; in getcmd()
273 cmp = strncasecmp(str, cmd_table[i].command, l - in getcmd()
277 cmp = strncasecmp(str, cmd_table[i].command, l - 1); in getcmd()
307 while ((ch = getopt(argc, argv, "abCcefHhijkLlM:N:nrSstvw:x")) != -1) { in main()
352 if (cmd != NULL && cmd->cmd == procstat_kstack) { in main()
425 argc -= optind; in main()
431 if (cmd->opt != NULL) { in main()
434 cmd->opt(argc, argv); in main()
435 if ((cmd->cmp & PS_MODE_COMPAT) == 0) { in main()
436 argc -= optind; in main()
440 argc -= 1; in main()
446 if (cmd->cmd != procstat_files && in main()
448 (cmd->cmp & PS_MODE_COMPAT) == 0) in main()
452 /* Must specify either the -a flag or a list of pids. */ in main()
454 (cmd->cmp & PS_MODE_NO_KINFO_PROC) == 0) in main()
464 xocontainer = cmd->xocontainer != NULL ? cmd->xocontainer : in main()
465 cmd->command; in main()
470 if ((cmd->cmp & PS_MODE_NO_KINFO_PROC) != 0) { in main()
471 cmd->cmd(prstat, NULL); in main()
504 if ((cmd->cmp & PS_MODE_COMPAT) == 0) { in main()
511 KERN_PROC_PID, -1, &cnt); in main()
524 if ((cmd->cmp & PS_MODE_COMPAT) == 0) { in main()
548 while ((ch = getopt(argc, argv, "")) != -1) { in cmdopt_none()
562 while ((ch = getopt(argc, argv, "v")) != -1) { in cmdopt_verbose()
579 while ((ch = getopt(argc, argv, "n")) != -1) { in cmdopt_signals()
596 while ((ch = getopt(argc, argv, "Ht")) != -1) { in cmdopt_rusage()
615 while ((ch = getopt(argc, argv, "C")) != -1) { in cmdopt_files()