9330 stack overflow when creating a deeply nested dataset
[unleashed.git] / usr / src / man / man3lgrp / lgrp_init.3lgrp
blob69ebff507d9cf8766eb196acfa7db9b6d1b00625
1 '\" te
2 .\" Copyright (c) 2005, 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 LGRP_INIT 3LGRP "Jan 26, 2005"
7 .SH NAME
8 lgrp_init \- initialize lgroup interface
9 .SH SYNOPSIS
10 .LP
11 .nf
12 cc [ \fIflag\fR... ] \fIfile\fR\&.\|.\|. \fB-llgrp\fR [ \fIlibrary\fR... ]
13 #include <sys/lgrp_user.h>
15 \fBlgrp_cookie_t\fR \fBlgrp_init\fR(\fBlgrp_view_t\fR \fIview\fR);
16 .fi
18 .SH DESCRIPTION
19 .sp
20 .LP
21 The \fBlgrp_init()\fR function initializes the lgroup interface and takes a
22 snapshot of the lgroup hierarchy with the given \fIview\fR.  If the given
23 \fIview\fR is \fBLGRP_VIEW_CALLER\fR, the snapshot contains only the resources
24 that are available to the caller (for example, with respect to processor sets).
25 When the \fIview\fR is \fBLGRP_VIEW_OS\fR, the snapshot contains what is
26 available to the operating system.
27 .sp
28 .LP
29 Given the \fIview\fR, \fBlgrp_init()\fR returns a cookie representing this
30 snapshot of the lgroup hierarchy. This cookie should be used with other
31 routines in the lgroup interface needing the lgroup hierarchy. The
32 \fBlgrp_fini\fR(3LGRP) function should be called with the cookie when it is no
33 longer needed.
34 .sp
35 .LP
36 The lgroup hiearchy represents the latency topology of the machine.  The
37 hierarchy is simplified to be a tree and can be used to find the nearest
38 resources.
39 .sp
40 .LP
41 The lgroup hiearchy consists of a root lgroup, which is the maximum  bounding
42 locality group of the system, contains all the CPU and memory resources of the
43 machine, and may contain  other locality groups that contain CPUs and memory
44 within a smaller locality. The leaf lgroups contain resources within the
45 smallest latency.
46 .sp
47 .LP
48 The resources of a given lgroup come directly from the lgroup itself or from
49 leaf lgroups contained within the lgroup. Leaf lgroups directly contain their
50 own resources and do not encapsulate any other lgroups.
51 .sp
52 .LP
53 The lgroup hierarchy can be used to find the nearest resources. From a given
54 lgroup, the closest resources can be found in the lgroup itself. After that,
55 the next nearest resources can be found in its parent lgroup, and so on until
56 the root lgroup is reached where all the resources of the machine are located.
57 .SH RETURN VALUES
58 .sp
59 .LP
60 Upon successful completion, \fBlgrp_init()\fR returns a cookie. Otherwise it
61 returns \fBLGRP_COOKIE_NONE\fR and sets \fBerrno\fR to indicate the error.
62 .SH ERRORS
63 .sp
64 .LP
65 The \fBlgrp_init()\fR function will fail if:
66 .sp
67 .ne 2
68 .na
69 \fB\fBEINVAL\fR\fR
70 .ad
71 .RS 10n
72 The view is not valid.
73 .RE
75 .sp
76 .ne 2
77 .na
78 \fB\fBENOMEM\fR\fR
79 .ad
80 .RS 10n
81 There was not enough memory to allocate the snapshot of the lgroup hierarchy.
82 .RE
84 .SH ATTRIBUTES
85 .sp
86 .LP
87 See \fBattributes\fR(5) for descriptions of the following attributes:
88 .sp
90 .sp
91 .TS
92 box;
93 c | c
94 l | l .
95 ATTRIBUTE TYPE  ATTRIBUTE VALUE
97 Interface Stability     Evolving
99 MT-Level        MT-Safe
102 .SH SEE ALSO
105 \fBlgrp_children\fR(3LGRP), \fBlgrp_cookie_stale\fR(3LGRP),
106 \fBlgrp_cpus\fR(3LGRP), \fBlgrp_fini\fR(3LGRP), \fBlgrp_mem_size\fR(3LGRP),
107 \fBlgrp_nlgrps\fR(3LGRP), \fBlgrp_parents\fR(3LGRP),
108 \fBlgrp_resources\fR(3LGRP), \fBlgrp_root\fR(3LGRP), \fBlgrp_view\fR(3LGRP),
109 \fBliblgrp\fR(3LIB), \fBattributes\fR(5)