/*
* 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.
*/
#include <stdlib.h>
#include <stdio.h>
#include <stdio_ext.h>
#include <limits.h>
#include <libproc.h>
#include <sys/sysmacros.h>
#include <string.h>
#include <strings.h>
#include <errno.h>
#include <zone.h>
static char *pname;
static void
struct ps_prochandle *P)
{
char *p, *s;
int got_uts = 0;
size--;
break;
p++;
switch (*p) {
case 'p':
break;
case 'u':
break;
case 'g':
break;
case 'f':
break;
case 'd':
len = 0;
break;
*s = '\0';
break;
case 'n':
if (got_uts++ == 0)
break;
case 'm':
if (got_uts++ == 0)
break;
case 't':
break;
case 'z':
/*
* getzonenamebyid() returns the size including the
* terminating null byte so we need to adjust len.
*/
size)) < 0)
else
len--;
break;
case '%':
*fname = '%';
len = 1;
break;
default:
}
return;
path = p + 1;
}
}
static void
int *errp)
{
} else {
(*errp)++;
}
}
int
{
struct ps_prochandle *P;
int gerr;
int opt;
int oflags = 0;
int i;
int err = 0;
else
switch (opt) {
case 'o':
break;
case 'c':
goto usage;
}
opt_c = 1;
break;
case 'F':
oflags |= PGRAB_FORCE;
break;
case 'p':
opt_p = 1;
break;
case 'g':
opt_g = 1;
break;
default:
goto usage;
}
}
prefix = "core";
} else {
int options;
perror("core_get_options()");
return (1);
}
"are disabled (ignoring -p)\n", pname);
opt_p = 0;
}
"are disabled (ignoring -g)\n", pname);
opt_g = 0;
}
return (1);
}
if (argc == 0)
goto usage;
/*
* Make sure we'll have enough file descriptors to handle a target
* that has many many mappings.
*/
}
for (i = 0; i < argc; i++) {
if (P == NULL) {
err++;
continue;
}
}
if (opt_p) {
if (!opt_c)
}
if (opt_g) {
/*
* Global core files are always just readable and
* writable by their owner so we temporarily change
* the umask.
*/
if (!opt_c)
(void) core_get_global_content(&content);
}
Prelease(P, 0);
}
return (err != 0);
"[ -pgF ] [ -o filename ] [ -c content ] pid ...\n", pname);
return (2);
}