From e6163a885dbd739e5a60eaa05eafd2d831631bfd Mon Sep 17 00:00:00 2001 From: Jerry Jelinek Date: Tue, 30 Aug 2011 08:06:31 -0700 Subject: [PATCH] 4655 add %Z corefile name pattern for zonepath Reviewed by: Robert Mustacchi Reviewed by: Dan McDonald Approved by: Richard Lowe --- usr/src/man/man1m/coreadm.1m | 12 +++++++++++- usr/src/uts/common/os/core.c | 10 ++++++++++ 2 files changed, 21 insertions(+), 1 deletion(-) diff --git a/usr/src/man/man1m/coreadm.1m b/usr/src/man/man1m/coreadm.1m index f5f7083d87..8b7b25e387 100644 --- a/usr/src/man/man1m/coreadm.1m +++ b/usr/src/man/man1m/coreadm.1m @@ -3,7 +3,7 @@ .\" 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 or http://www.opensolaris.org/os/licensing. 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] -.TH COREADM 1M "Sep 30, 2008" +.TH COREADM 1M "Feb 28, 2014" .SH NAME coreadm \- core file administration .SH SYNOPSIS @@ -134,6 +134,16 @@ Name of the zone in which process executed (\fBzonename\fR) .sp .ne 2 .na +.B %Z +.ad +.sp .6 +.RS 4n +The path to the root of the zone in which process executed +.RE + +.sp +.ne 2 +.na \fB\fB%%\fR\fR .ad .sp .6 diff --git a/usr/src/uts/common/os/core.c b/usr/src/uts/common/os/core.c index 71242af678..d4dddbe477 100644 --- a/usr/src/uts/common/os/core.c +++ b/usr/src/uts/common/os/core.c @@ -21,6 +21,7 @@ /* * Copyright (c) 1989, 2010, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2011, Joyent Inc. All rights reserved. */ /* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */ @@ -534,6 +535,10 @@ expand_string(const char *pat, char *fp, int size, cred_t *cr) case 'z': s = p->p_zone->zone_name; break; + case 'Z': + /* This is zonepath + "/root/", except for GZ */ + s = p->p_zone->zone_rootpath; + break; case '%': (void) strcpy((s = buf), "%"); break; @@ -548,6 +553,11 @@ expand_string(const char *pat, char *fp, int size, cred_t *cr) if ((size -= len) <= 0) return (ENAMETOOLONG); (void) strcpy(fp, s); + /* strip trailing "/root/" from non-GZ zonepath string */ + if (c == 'Z' && len > 6) { + len -= 6; + ASSERT(strncmp(fp + len, "/root/", 6) == 0); + } fp += len; } -- 2.11.4.GIT