'\" te .\" Copyright (c) 2004, Sun Microsystems, Inc. All Rights Reserved. .\" 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 GETZONEID 3C "Nov 1, 2004" .SH NAME getzoneid, getzoneidbyname, getzonenamebyid \- map between zone id and name .SH SYNOPSIS .LP .nf #include \fBzoneid_t\fR \fBgetzoneid\fR(\fBvoid\fR); .fi .LP .nf \fBzoneid_t\fR \fBgetzoneidbyname\fR(\fBconst char *\fR\fIname\fR); .fi .LP .nf \fBssize_t\fR \fBgetzonenamebyid\fR(\fBzoneid_t\fR \fIid\fR, \fBchar *\fR\fIbuf\fR, \fBsize_t\fR \fIbuflen\fR); .fi .SH DESCRIPTION .sp .LP The \fBgetzoneid()\fR function returns the zone ID of the calling process. .sp .LP The \fBgetzoneidbyname()\fR function returns the zone ID corresponding to the named zone, if that zone is currently active. If \fIname\fR is \fINULL\fR, the function returns the zone ID of the calling process. .sp .LP The \fBgetzonenamebyid()\fR function stores the name of the zone with ID specified by \fIid\fR in the location specified by \fIbuf\fR. The \fIbufsize\fR argument specifies the size in bytes of the buffer. If the buffer is too small to hold the complete null-terminated name, the first \fIbufsize\fR bytes of the name are stored in the buffer. A buffer of size {\fBZONENAME_MAX\fR} is sufficient to hold any zone name. If \fIbuf\fR is \fINULL\fR or \fIbufsize\fR is 0, the name is not copied into the buffer. .SH RETURN VALUES .sp .LP On successful completion, \fBgetzoneid()\fR and \fBgetzoneidbyname()\fR return a non-negative zone ID. Otherwise, \fBgetzoneidbyname()\fR returns \(mi1 and sets \fBerrno\fR to indicate the error. .sp .LP On successful completion, the \fBgetzonenamebyid()\fR function returns the buffer size required to hold the full null-terminated name. Otherwise, it returns \(mi1 and sets \fBerrno\fR to indicate the error. .SH ERRORS .sp .LP The \fBgetzoneidbyname()\fR function will fail if: .sp .ne 2 .na \fB\fBEFAULT\fR\fR .ad .RS 16n The \fIname\fR argument is non-null and points to an illegal address. .RE .sp .ne 2 .na \fB\fBEINVAL\fR\fR .ad .RS 16n A zone with the indicated \fIname\fR is not active. .RE .sp .ne 2 .na \fB\fBENAMETOOLONG\fR\fR .ad .RS 16n The length of the \fIname\fR argument exceeds {\fBZONENAME_MAX\fR}. .RE .sp .LP The \fBgetzonenamebyid()\fR function will fail if: .sp .ne 2 .na \fB\fBEINVAL\fR\fR .ad .RS 10n A zone with the specified ID is not active. .RE .sp .ne 2 .na \fB\fBEFAULT\fR\fR .ad .RS 10n The \fIbuf\fR argument points to an illegal address. .RE .SH ATTRIBUTES .sp .LP See \fBattributes\fR(7) for descriptions of the following attributes: .sp .sp .TS box; c | c l | l . ATTRIBUTE TYPE ATTRIBUTE VALUE _ Interface Stability Evolving _ MT-Level Safe .TE .SH SEE ALSO .sp .LP .BR Intro (2), .BR chroot (2), .BR malloc (3C), .BR attributes (7), .BR zones (7)