/*
* CDDL HEADER START
*
* The contents of this file are subject to the terms of the
* Common Development and Distribution License (the "License").
* You may not use this file except in compliance with the License.
*
* You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
* See the License for the specific language governing permissions
* and limitations under the License.
*
* When distributing Covered Code, include this CDDL HEADER in each
* file and include the License file at usr/src/OPENSOLARIS.LICENSE.
* If applicable, add the following below this CDDL HEADER, with the
* fields enclosed by brackets "[]" replaced with your own identifying
* information: Portions Copyright [yyyy] [name of copyright owner]
*
* CDDL HEADER END
*/
/*
* Copyright 2006 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
/* Copyright (c) 2012 by Delphix. All rights reserved */
#include <sys/contract.h>
#include <signal.h>
#include <unistd.h>
#include <dirent.h>
#include <stdlib.h>
#include <string.h>
#include <libintl.h>
#include <locale.h>
#include <stdio.h>
#include <fcntl.h>
#include <ctype.h>
#include <wchar.h>
#include <limits.h>
#include <libuutil.h>
#include <libcontract_priv.h>
#include <procfs.h>
#include <project.h>
#include <pwd.h>
#include <grp.h>
#include <zone.h>
#include "psexp.h"
#include "pgrep.h"
#ifndef TEXT_DOMAIN
#endif
static int opt_euid(char, char *);
static int opt_uid(char, char *);
static int opt_gid(char, char *);
static int opt_ppid(char, char *);
static int opt_pgrp(char, char *);
static int opt_sid(char, char *);
static int opt_term(char, char *);
static int opt_projid(char, char *);
static int opt_taskid(char, char *);
static int opt_zoneid(char, char *);
static int opt_ctid(char, char *);
{ 0, 0, 0, 0 }, /* 'A' */
{ 0, 0, 0, 0 }, /* 'B' */
{ 0, 0, 0, 0 }, /* 'C' */
{ 0, 0, 0, 0 }, /* 'E' */
{ 0, 0, 0, 0 }, /* 'F' */
{ 0, 0, 0, 0 }, /* 'H' */
{ 0, 0, 0, 0 }, /* 'I' */
{ 0, 0, 0, 0 }, /* 'K' */
{ 0, 0, 0, 0 }, /* 'L' */
{ 0, 0, 0, 0 }, /* 'M' */
{ 0, 0, 0, 0 }, /* 'N' */
{ 0, 0, 0, 0 }, /* 'O' */
{ 0, 0, 0, 0 }, /* 'Q' */
{ 0, 0, 0, 0 }, /* 'R' */
{ 0, 0, 0, 0 }, /* 'S' */
{ 0, 0, 0, 0 }, /* 'V' */
{ 0, 0, 0, 0 }, /* 'W' */
{ 0, 0, 0, 0 }, /* 'X' */
{ 0, 0, 0, 0 }, /* 'Y' */
{ 0, 0, 0, 0 }, /* 'Z' */
{ 0, 0, 0, 0 }, /* '[' */
{ 0, 0, 0, 0 }, /* '\\' */
{ 0, 0, 0, 0 }, /* ']' */
{ 0, 0, 0, 0 }, /* '^' */
{ 0, 0, 0, 0 }, /* '_' */
{ 0, 0, 0, 0 }, /* '`' */
{ 0, 0, 0, 0 }, /* 'a' */
{ 0, 0, 0, 0 }, /* 'b' */
{ 0, 0, 0, 0 }, /* 'e' */
{ 0, 0, 0, 0 }, /* 'h' */
{ 0, 0, 0, 0 }, /* 'i' */
{ 0, 0, 0, 0 }, /* 'j' */
{ 0, 0, 0, 0 }, /* 'k' */
{ 0, 0, 0, 0 }, /* 'm' */
{ 0, 0, 0, 0 }, /* 'p' */
{ 0, 0, 0, 0 }, /* 'q' */
{ 0, 0, 0, 0 }, /* 'r' */
{ 0, 0, 0, 0 }, /* 'w' */
{ 0, 0, 0, 0 }, /* 'y' */
};
Usage: %s [-flnovx] [-d delim] [-P ppidlist] [-g pgrplist] [-s sidlist]\n\
[-u euidlist] [-U uidlist] [-G gidlist] [-J projidlist]\n\
[-T taskidlist] [-t termlist] [-z zonelist] [-c ctidlist] [pattern]\n";
Usage: %s [-signal] [-fnovx] [-P ppidlist] [-g pgrplist] [-s sidlist]\n\
[-u euidlist] [-U uidlist] [-G gidlist] [-J projidlist]\n\
[-T taskidlist] [-t termlist] [-z zonelist] [-c ctidlist] [pattern]\n";
static void
{
else {
}
}
static char *
{
char *p;
int n;
p = buf;
while (*p != '\0') {
if (n < 0)
n = sizeof (char);
if (nbytes <= n) {
*p = '\0';
break;
}
} else {
nbytes -= n;
p += n;
}
}
return (buf);
}
static void
{
char *name;
if (g_flags & F_LONG_FMT)
else
else {
}
}
static void
{
}
static DIR *
{
return (NULL);
}
return (NULL);
}
return (NULL);
}
return (dirp);
}
static int
{
int procfd;
if (g_flags & F_LONG_FMT)
flags |= PSEXP_PSARGS;
if (g_flags & F_EXACT_MATCH)
flags |= PSEXP_EXACT;
continue;
continue;
/* LINTED - opsinfo use ok */
sizeof (psinfo_t));
ovalid = 1;
}
sizeof (psinfo_t));
ovalid = 1;
}
} else {
nmatches++;
}
}
}
nmatches++;
}
return (nmatches);
}
static int
{
else
uu_warn("invalid argument for option '%c' -- %s\n",
return (-1);
}
}
return (0);
}
static int
{
continue;
}
}
else
goto err;
}
return (0);
err:
return (-1);
}
static int
{
continue;
}
}
else
goto err;
}
return (0);
err:
return (-1);
}
static int
{
char *ptr;
continue;
}
if (seen_console)
continue;
seen_console++;
}
goto err;
}
return (0);
err:
return (-1);
}
static int
{
continue;
}
}
else
goto err;
}
return (0);
err:
return (-1);
}
static int
{
char *ptr;
return (-1);
}
}
return (0);
}
/*ARGSUSED*/
static int
{
}
/*ARGSUSED*/
static int
{
}
/*ARGSUSED*/
static int
{
}
static int
{
}
static int
{
}
static int
{
}
/*ARGSUSED*/
static int
{
}
/*ARGSUSED*/
static int
{
}
static int
{
}
/*ARGSUSED*/
static int
{
}
static int
{
}
static void
{
else
}
int
{
const char *optstr;
int nmatches, c;
(void) textdomain(TEXT_DOMAIN);
argv++;
argc--;
}
optstr = PKILL_OPTS;
} else
optstr = PGREP_OPTS;
opterr = 0;
if (c == ':' || c == '?' ||
if (c == ':') {
gettext("missing argument -- %c\n"),
optopt);
} else if (optopt != '?') {
gettext("illegal option -- %c\n"),
optopt);
}
return (E_USAGE);
}
g_flags |= F_HAVE_CRIT;
return (E_USAGE);
}
}
return (E_USAGE);
}
g_flags |= F_HAVE_CRIT;
}
}
return (E_USAGE);
}
if ((g_flags & F_HAVE_CRIT) == 0) {
return (E_USAGE);
}
return (E_USAGE);
}
return (E_ERROR);
else if (g_flags & F_LONG_OUT)
else
funcp = print_proc;
}