Lines Matching +full:resource +full:- +full:id

1 /*-
2 * SPDX-License-Identifier: BSD-2-Clause
58 *uidp = pwd->pw_uid; in parse_user()
69 if ((size_t)(end - s) != strlen(s)) { in parse_user()
71 "after numerical id", unexpanded_rule); in parse_user()
86 *gidp = grp->gr_gid; in parse_group()
97 if ((size_t)(end - s) != strlen(s)) { in parse_group()
99 "after numerical id", unexpanded_rule); in parse_group()
107 * Replace human-readable number with its expanded form.
113 const char *subject, *subject_id, *resource, *action, *amount, *per; in expand_amount() local
125 resource = strsep(&copy, ":"); in expand_amount()
145 assert(resource != NULL); in expand_amount()
157 subject, subject_id, resource, action, (uintmax_t)num); in expand_amount()
160 subject, subject_id, resource, action, (uintmax_t)num, per); in expand_amount()
177 id_t id; in expand_rule() local
214 error = parse_user(textid, &id, rule); in expand_rule()
219 ret = asprintf(&resolved, "%s:%d:%s", subject, (int)id, rest); in expand_rule()
222 error = parse_group(textid, &id, rule); in expand_rule()
227 ret = asprintf(&resolved, "%s:%d:%s", subject, (int)id, rest); in expand_rule()
249 id_t id; in humanize_ids() local
267 id = strtod(textid, &end); in humanize_ids()
268 if ((size_t)(end - textid) != strlen(textid)) in humanize_ids()
270 pwd = getpwuid(id); in humanize_ids()
272 textid = pwd->pw_name; in humanize_ids()
274 id = strtod(textid, &end); in humanize_ids()
275 if ((size_t)(end - textid) != strlen(textid)) in humanize_ids()
277 grp = getgrgid(id); in humanize_ids()
279 textid = grp->gr_name; in humanize_ids()
298 if ((size_t)(end - str) != strlen(str)) in str2int64()
308 const char *subject, *subject_id, *resource, *action, *amount, *per; in humanize_amount() local
318 resource = strsep(&copy, ":"); in humanize_amount()
331 assert(resource != NULL); in humanize_amount()
335 HN_DECIMAL | HN_NOSPACE) == -1) in humanize_amount()
340 subject, subject_id, resource, action, buf); in humanize_amount()
343 subject, subject_id, resource, action, buf, per); in humanize_amount()
461 const char *resource, *amount; in humanize_usage_amount() local
469 resource = strsep(&copy, "="); in humanize_usage_amount()
472 assert(resource != NULL); in humanize_usage_amount()
477 HN_DECIMAL | HN_NOSPACE) == -1) { in humanize_usage_amount()
482 ret = asprintf(&humanized, "%s=%s", resource, buf); in humanize_usage_amount()
491 * Query the kernel about a resource usage and print it out.
513 warn("failed to show resource consumption for '%s'", in show_usage()
537 * Query the kernel about resource limit rules and print them out.
580 fprintf(stderr, "usage: rctl [ -h ] [-a rule | -l filter | -r filter " in usage()
581 "| -u filter | filter]\n"); in usage()
593 while ((ch = getopt(argc, argv, "ahlnru")) != -1) { in main()
620 argc -= optind; in main()
624 errx(1, "at most one of -a, -l, -r, or -u may be specified"); in main()
643 * Skip resolving if passed -n _and_ -a. Ignore -n otherwise, in main()
644 * so we can still do "rctl -n u:root" and see the rules without in main()