nightly: remove unused BINARCHIVE
[unleashed.git] / share / man / man3c / getzoneid.3c
blob1395537a816336cd1557e152eb1e05c28e1534f6
1 '\" te
2 .\" Copyright (c) 2004, Sun Microsystems, Inc. All Rights Reserved.
3 .\" 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.
4 .\" 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.
5 .\" 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]
6 .TH GETZONEID 3C "Nov 1, 2004"
7 .SH NAME
8 getzoneid, getzoneidbyname, getzonenamebyid \-  map between zone id and name
9 .SH SYNOPSIS
10 .LP
11 .nf
12 #include <zone.h>
14 \fBzoneid_t\fR \fBgetzoneid\fR(\fBvoid\fR);
15 .fi
17 .LP
18 .nf
19 \fBzoneid_t\fR \fBgetzoneidbyname\fR(\fBconst char *\fR\fIname\fR);
20 .fi
22 .LP
23 .nf
24 \fBssize_t\fR \fBgetzonenamebyid\fR(\fBzoneid_t\fR \fIid\fR, \fBchar *\fR\fIbuf\fR, \fBsize_t\fR \fIbuflen\fR);
25 .fi
27 .SH DESCRIPTION
28 .sp
29 .LP
30 The \fBgetzoneid()\fR function returns the zone ID of the calling process.
31 .sp
32 .LP
33 The \fBgetzoneidbyname()\fR function returns the zone ID corresponding to the
34 named zone, if that zone is currently active. If \fIname\fR is \fINULL\fR, the
35 function returns the zone ID of the calling process.
36 .sp
37 .LP
38 The \fBgetzonenamebyid()\fR function stores the name of the zone with ID
39 specified by \fIid\fR in the location specified by \fIbuf\fR. The \fIbufsize\fR
40 argument specifies the size in bytes of the buffer. If the buffer is too small
41 to hold the complete null-terminated name, the first \fIbufsize\fR bytes of the
42 name are stored in the buffer. A buffer of size {\fBZONENAME_MAX\fR} is
43 sufficient to hold any zone name. If \fIbuf\fR is \fINULL\fR or \fIbufsize\fR
44 is 0, the name is not copied into the buffer.
45 .SH RETURN VALUES
46 .sp
47 .LP
48 On successful completion, \fBgetzoneid()\fR and \fBgetzoneidbyname()\fR return
49 a non-negative zone ID. Otherwise, \fBgetzoneidbyname()\fR returns \(mi1 and
50 sets \fBerrno\fR to indicate the error.
51 .sp
52 .LP
53 On successful completion, the \fBgetzonenamebyid()\fR function returns the
54 buffer size required to hold the full null-terminated name. Otherwise, it
55 returns \(mi1 and sets \fBerrno\fR to indicate the error.
56 .SH ERRORS
57 .sp
58 .LP
59 The \fBgetzoneidbyname()\fR function will fail if:
60 .sp
61 .ne 2
62 .na
63 \fB\fBEFAULT\fR\fR
64 .ad
65 .RS 16n
66 The \fIname\fR argument is non-null and points to an illegal address.
67 .RE
69 .sp
70 .ne 2
71 .na
72 \fB\fBEINVAL\fR\fR
73 .ad
74 .RS 16n
75 A zone with the indicated \fIname\fR is not active.
76 .RE
78 .sp
79 .ne 2
80 .na
81 \fB\fBENAMETOOLONG\fR\fR
82 .ad
83 .RS 16n
84 The length of the \fIname\fR argument exceeds {\fBZONENAME_MAX\fR}.
85 .RE
87 .sp
88 .LP
89 The \fBgetzonenamebyid()\fR function will fail if:
90 .sp
91 .ne 2
92 .na
93 \fB\fBEINVAL\fR\fR
94 .ad
95 .RS 10n
96 A zone with the specified ID is not active.
97 .RE
99 .sp
100 .ne 2
102 \fB\fBEFAULT\fR\fR
104 .RS 10n
105 The \fIbuf\fR argument points to an illegal address.
108 .SH ATTRIBUTES
111 See \fBattributes\fR(5) for descriptions of the following attributes:
116 box;
117 c | c
118 l | l .
119 ATTRIBUTE TYPE  ATTRIBUTE VALUE
121 Interface Stability     Evolving
123 MT-Level        Safe
126 .SH SEE ALSO
129 \fBIntro\fR(2), \fBchroot\fR(2), \fBmalloc\fR(3C), \fBattributes\fR(5),
130 \fBzones\fR(5)