d2a70789f056fc6c9ce3ab047b52126d80b0e3daRichard Lowe * This file and its contents are supplied under the terms of the
d2a70789f056fc6c9ce3ab047b52126d80b0e3daRichard Lowe * Common Development and Distribution License ("CDDL"), version 1.0.
d2a70789f056fc6c9ce3ab047b52126d80b0e3daRichard Lowe * You may only use this file in accordance with the terms of version
d2a70789f056fc6c9ce3ab047b52126d80b0e3daRichard Lowe * 1.0 of the CDDL.
d2a70789f056fc6c9ce3ab047b52126d80b0e3daRichard Lowe * A full copy of the text of the CDDL should have accompanied this
d2a70789f056fc6c9ce3ab047b52126d80b0e3daRichard Lowe * source. A copy of the CDDL is also available via the Internet at
d2a70789f056fc6c9ce3ab047b52126d80b0e3daRichard Lowe/* Copyright 2015, Richard Lowe. */
d2a70789f056fc6c9ce3ab047b52126d80b0e3daRichard Loweextern const char *__progname;
d2a70789f056fc6c9ce3ab047b52126d80b0e3daRichard Loweprint_flags(const char *set, secflagset_t flags)
d2a70789f056fc6c9ce3ab047b52126d80b0e3daRichard Lowe * Structure defining idtypes known to the priocntl command
d2a70789f056fc6c9ce3ab047b52126d80b0e3daRichard Lowe * along with the corresponding names.
d2a70789f056fc6c9ce3ab047b52126d80b0e3daRichard Lowe * The idtype values themselves are defined in <sys/procset.h>.
d2a70789f056fc6c9ce3ab047b52126d80b0e3daRichard Lowe for (curp = idtypes; curp->name != NULL; curp++) {
d2a70789f056fc6c9ce3ab047b52126d80b0e3daRichard Lowe return (-1);
d2a70789f056fc6c9ce3ab047b52126d80b0e3daRichard Lowe if ((ret = getprojidbyname(value)) != (id_t)-1)
d2a70789f056fc6c9ce3ab047b52126d80b0e3daRichard Lowe while ((opt = getopt(argc, argv, "eFi:ls:")) != -1) {
d2a70789f056fc6c9ce3ab047b52126d80b0e3daRichard Lowe switch (optarg[0]) {
d2a70789f056fc6c9ce3ab047b52126d80b0e3daRichard Lowe if (l_flag && ((idtypename != NULL) || s_flag || (argc != 0)))
d2a70789f056fc6c9ce3ab047b52126d80b0e3daRichard Lowe gettext("usage:\t%s [-F] { pid | core } ...\n"),
d2a70789f056fc6c9ce3ab047b52126d80b0e3daRichard Lowe (void) fprintf(stderr, gettext("\t%s -l\n"), __progname);
d2a70789f056fc6c9ce3ab047b52126d80b0e3daRichard Lowe for (i = 0; (name = secflag_to_str(i)) != NULL; i++)
d2a70789f056fc6c9ce3ab047b52126d80b0e3daRichard Lowe * Don't use the strerror() message for EPERM, "Not Owner"
d2a70789f056fc6c9ce3ab047b52126d80b0e3daRichard Lowe * which is misleading.
d2a70789f056fc6c9ce3ab047b52126d80b0e3daRichard Lowe "security-flags: Permission denied"));
d2a70789f056fc6c9ce3ab047b52126d80b0e3daRichard Lowe err(1, gettext("failed setting security-flags"));
d2a70789f056fc6c9ce3ab047b52126d80b0e3daRichard Lowe } else if (s_flag) {
d2a70789f056fc6c9ce3ab047b52126d80b0e3daRichard Lowe for (i = 0; i < argc; i++) {
d2a70789f056fc6c9ce3ab047b52126d80b0e3daRichard Lowe if ((id = getid(idtype, argv[i])) == (id_t)-1) {
d2a70789f056fc6c9ce3ab047b52126d80b0e3daRichard Lowe * Don't use the strerror() message for EPERM, "Not
d2a70789f056fc6c9ce3ab047b52126d80b0e3daRichard Lowe * Owner" which is misleading.
d2a70789f056fc6c9ce3ab047b52126d80b0e3daRichard Lowe "security-flags: "
d2a70789f056fc6c9ce3ab047b52126d80b0e3daRichard Lowe "Permission denied"));
d2a70789f056fc6c9ce3ab047b52126d80b0e3daRichard Lowe "security-flags"));
d2a70789f056fc6c9ce3ab047b52126d80b0e3daRichard Lowe /* Display the flags for the given pids */
d2a70789f056fc6c9ce3ab047b52126d80b0e3daRichard Lowe while (argc-- > 0) {
d2a70789f056fc6c9ce3ab047b52126d80b0e3daRichard Lowe if ((Pr = proc_arg_grab(arg = *argv++, PR_ARG_ANY,
d2a70789f056fc6c9ce3ab047b52126d80b0e3daRichard Lowe (void) memcpy(&psinfo, Ppsinfo(Pr), sizeof (psinfo_t));
d2a70789f056fc6c9ce3ab047b52126d80b0e3daRichard Lowe (void) printf(gettext("core '%s' of %d:\t%.70s\n"),
d2a70789f056fc6c9ce3ab047b52126d80b0e3daRichard Lowe err(1, gettext("cannot read secflags of %s"), arg);