Print this page
3946 ::gcore
Reviewed by: Adam Leventhal <ahl@delphix.com>
Reviewed by: Matthew Ahrens <mahrens@delphix.com>
*** 23,32 ****
--- 23,33 ----
* Copyright 2009 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
/*
* Copyright (c) 2013, Joyent, Inc. All rights reserved.
+ * Copyright (c) 2013 by Delphix. All rights reserved.
*/
#include <assert.h>
#include <dlfcn.h>
#include <errno.h>
*** 229,255 ****
* name based on the zone id if this is a live process.
*/
char *
Pzonename(struct ps_prochandle *P, char *s, size_t n)
{
! if (P->state == PS_IDLE) {
! errno = ENODATA;
! return (NULL);
! }
!
! if (P->state == PS_DEAD) {
! if (P->core->core_zonename == NULL) {
! errno = ENODATA;
! return (NULL);
! }
! (void) strlcpy(s, P->core->core_zonename, n);
! } else {
! if (getzonenamebyid(P->status.pr_zoneid, s, n) < 0)
! return (NULL);
! s[n - 1] = '\0';
! }
! return (s);
}
char *
Pzoneroot(struct ps_prochandle *P, char *s, size_t n)
{
--- 230,240 ----
* name based on the zone id if this is a live process.
*/
char *
Pzonename(struct ps_prochandle *P, char *s, size_t n)
{
! return (P->ops.pop_zonename(P, s, n, P->data));
}
char *
Pzoneroot(struct ps_prochandle *P, char *s, size_t n)
{