Lines Matching +full:ps +full:- +full:hold
1 /*-
8 * Copyright (c) 1989 - 1994, William LeFebvre, Northwestern University
70 struct process_select ps; variable
88 { "cpu-display-mode", no_argument, NULL, 'C' }, /* differs from orignal */
91 { "idle-procs", no_argument, NULL, 'I' },
93 { "per-cpu", no_argument, NULL, 'P' },
94 { "system-procs", no_argument, NULL, 'S' },
95 { "thread-id", no_argument, NULL, 'T' }, /* differs from orignal */
102 { "jail-id", no_argument, NULL, 'j' },
103 { "display-mode", required_argument, NULL, 'm' },
105 { "sort-order", required_argument, NULL, 'o' },
113 { "system-idle-procs", no_argument, NULL, 'z' },
121 ps.uid[i] = -1; in reset_uids()
132 if (ps.uid[i] == -1 || ps.uid[i] == uid) in add_uid()
134 ps.uid[i] = uid; in add_uid()
148 /* Look for the user to remove - no problem if it's not there */ in rem_uid()
151 if (ps.uid[i] == -1) in rem_uid()
153 if (ps.uid[i] == uid) in rem_uid()
160 ps.uid[where] = ps.uid[i-1]; in rem_uid()
161 ps.uid[i-1] = -1; in rem_uid()
169 int uid = -1; in handle_user()
179 if (buf[0] == '+' || buf[0] == '-') in handle_user()
190 if ((uid = userid(buf2)) == -1) in handle_user()
200 ps.uid[0] = uid; in handle_user()
246 int ac = -1; in main()
277 ps.idle = true; in main()
278 ps.self = true; in main()
279 ps.system = false; in main()
281 ps.thread = false; in main()
282 ps.wcpu = 1; in main()
283 ps.jid = -1; in main()
284 ps.jail = false; in main()
285 ps.swap = false; in main()
286 ps.kidle = true; in main()
287 ps.pid = -1; in main()
288 ps.command = NULL; in main()
289 ps.thread_id = false; in main()
327 if ((ps.uid[0] = userid(optarg)) == -1) in main()
334 ps.system = true; in main()
338 ps.idle = !ps.idle; in main()
345 case 'n': /* batch, or non-interactive */ in main()
357 warnx("warning: display count should be positive -- option ignored"); in main()
374 ps.pid = (pid_t)num; in main()
375 ps.system = true; in main()
389 warnx("warning: seconds delay should be positive -- using default"); in main()
395 delay.tv_usec = (delay_d - delay.tv_sec) * 1e6; in main()
403 if (i == -1 && errno != 0) { in main()
404 warnx("warning: `-q' option failed (%m)"); in main()
415 errx(1, "warning: `-m' option can only take args 'io' or 'cpu'"); in main()
424 ps.self = !ps.self; in main()
428 ps.wcpu = !ps.wcpu; in main()
432 ps.thread = !ps.thread; in main()
436 ps.thread_id = !ps.thread_id; in main()
440 ps.jail = !ps.jail; in main()
444 if ((ps.jid = jail_getid(optarg)) == -1) in main()
449 ps.jail = 1; in main()
457 ps.swap = 1; in main()
461 ps.kidle = !ps.kidle; in main()
466 "[-abCHIijnPqSTtuvwz] [-d count] [-J jail] [-m cpu | io] [-o field]\n" in main()
467 " [-p pid] [-s time] [-U username] [number]"); in main()
476 warnx("warning: process display count should be non-negative -- using default"); in main()
500 if (machine_init(&statics) == -1) in main()
508 if ((order_index = string_index(order_name, statics.order_names)) == -1) in main()
531 if ((max_topn = display_init(&statics)) == -1) in main()
575 /* hold interrupt signals while setting up the screen and the handlers */ in main()
599 * main loop -- repeat while display count is positive or while it in main()
600 * indicates infinity (by being -1) in main()
603 while ((displays == -1) || (displays-- > 0)) in main()
615 get_process_info(&system_info, &ps, compare); in main()
676 /* do end-screen processing */ in main()
746 sigsetmask(sigblock(0) & ~(1 << (SIGTSTP - 1))); in main()
784 /* something to read -- clear the message area first */ in main()
788 /* (use "change" as a temporary to hold strchr) */ in main()
791 /* read error: either 0 or -1 */ in main()
800 while (cptr->c != '\0') { in main()
801 if (cptr->c == ch) { in main()
806 if (cptr->c == '\0') { in main()
811 if (overstrike && !cptr->available_to_dumb) in main()
819 switch(cptr->id) in main()
864 if (newval > -1) in main()
903 delay.tv_usec = (delay_d - delay.tv_sec) * 1e6; in main()
913 free(ps.command); in main()
915 ps.command = NULL; in main()
916 } else if ((ps.command = strdup(tempbuf1)) == NULL) in main()
925 displays == -1 ? "infinite" : in main()
973 ps.idle = !ps.idle; in main()
976 ps.idle ? "D" : "Not d"); in main()
981 ps.self = !ps.self; in main()
984 (ps.self) ? "D" : "Not d"); in main()
994 ps.thread = !ps.thread; in main()
997 ps.thread ? "separately" : "as a count"); in main()
1004 ps.thread_id = !ps.thread_id; in main()
1007 ps.thread_id ? "tid" : "pid"); in main()
1014 ps.wcpu = !ps.wcpu; in main()
1017 ps.wcpu ? "weighted" : "raw"); in main()
1033 ps.system = !ps.system; in main()
1036 ps.system ? "D" : "Not d"); in main()
1050 if ((i = string_index(tempbuf2, statics.order_names)) == -1) in main()
1068 ps.jail = !ps.jail; in main()
1071 ps.jail ? "D" : "Not d"); in main()
1085 ps.jid = -1; in main()
1087 else if ((i = jail_getid(tempbuf2)) == -1) in main()
1095 ps.jid = i; in main()
1097 if (ps.jail == 0) { in main()
1098 ps.jail = 1; in main()
1115 ps.kidle = !ps.kidle; in main()
1118 ps.kidle ? "D" : "Not d"); in main()
1125 pcpu_stats ? "per-" : "global "); in main()
1132 ps.swap = !ps.swap; in main()
1134 " %sisplaying per-process swap usage.", in main()
1135 ps.swap ? "D" : "Not d"); in main()
1146 ps.pid = (pid_t)-1; in main()
1159 ps.pid = (pid_t)num; in main()
1185 * reset_display() - reset all the display routine pointers so that entire
1209 leave(int i __unused) /* exit under normal conditions -- INT handler */ in leave()