'\" te
.\" Copyright (c) 2003, 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 LGRP_HOME 3LGRP "Jun 1, 2003"
.SH NAME
lgrp_home \- get home lgroup
.SH SYNOPSIS
.LP
.nf
cc [ \fIflag\fR\&.\|.\|. ] \fIfile\fR\&.\|.\|. \fB-llgrp\fR [ \fIlibrary\fR\&.\|.\|. ]
#include <sys/lgrp_user.h>

\fBlgrp_id_t\fR \fBlgrp_home\fR(\fBidtype_t\fR \fIidtype\fR, \fBid_t\fR \fIid\fR);
.fi

.SH DESCRIPTION
.sp
.LP
The \fBlgrp_home()\fR function returns the ID of the home lgroup for the given
process or thread.  A thread can have an affinity for an lgroup in the system
such that the thread will tend to be scheduled to run on that lgroup and
allocate memory from there whenever possible.  The lgroup with the strongest
affinity that the thread can run on is known as the "home lgroup" of the
thread.  If the thread has no affinity for any lgroup that it can run on, the
operating system will choose a home for it.
.sp
.LP
The \fIidtype\fR argument should be \fBP_PID\fR to specify a process and the
\fIid\fR argument should be its process ID.  Otherwise, the \fIidtype\fR
argument should be \fBP_LWPID\fR to specify a thread and the \fIid\fR argument
should be its LWP ID. The value \fBP_MYID\fR can be used for the \fIid\fR
argument to specify the current process or thread.
.SH RETURN VALUES
.sp
.LP
Upon successful completion, \fBlgrp_home()\fR returns the ID of the home lgroup
of the specified process or thread. Otherwise, \(mi1 is returned and
\fBerrno\fR is set to indicate the error.
.SH ERRORS
.sp
.LP
The \fBlgrp_home()\fR function will fail if:
.sp
.ne 2
.na
\fB\fBEINVAL\fR\fR
.ad
.RS 10n
The ID type is not valid.
.RE

.sp
.ne 2
.na
\fB\fBEPERM\fR\fR
.ad
.RS 10n
The effective user of the calling process does not have appropriate privileges,
and its real or effective user ID does not match the real or effective user ID
of one of the threads.
.RE

.sp
.ne 2
.na
\fB\fBESRCH\fR\fR
.ad
.RS 10n
The specified process or thread was not found.
.RE

.SH ATTRIBUTES
.sp
.LP
See \fBattributes\fR(5) for descriptions of the following attributes:
.sp

.sp
.TS
box;
c | c
l | l .
ATTRIBUTE TYPE	ATTRIBUTE VALUE
_
Interface Stability	Evolving
_
MT-Level	MT-Safe
.TE

.SH SEE ALSO
.sp
.LP
\fBlgrp_affinity_get\fR(3LGRP), \fBlgrp_init\fR(3LGRP), \fBattributes\fR(5)