xref: /netbsd-src/lib/libc/sys/_lwp_getprivate.2 (revision 6c208a44f4ba47e1a3bc08ddf3bb809a8765db15)
1*6c208a44Snjoly.\"	$NetBSD: _lwp_getprivate.2,v 1.6 2013/10/05 09:18:56 njoly Exp $
23fdac2b8Sthorpej.\"
33fdac2b8Sthorpej.\" Copyright (c) 2003 The NetBSD Foundation, Inc.
43fdac2b8Sthorpej.\" All rights reserved.
53fdac2b8Sthorpej.\"
63fdac2b8Sthorpej.\" This code is derived from software contributed to The NetBSD Foundation
73fdac2b8Sthorpej.\" by Jason R. Thorpe of Wasabi Systems, Inc.
83fdac2b8Sthorpej.\"
93fdac2b8Sthorpej.\" Redistribution and use in source and binary forms, with or without
103fdac2b8Sthorpej.\" modification, are permitted provided that the following conditions
113fdac2b8Sthorpej.\" are met:
123fdac2b8Sthorpej.\" 1. Redistributions of source code must retain the above copyright
133fdac2b8Sthorpej.\"    notice, this list of conditions and the following disclaimer.
143fdac2b8Sthorpej.\" 2. Redistributions in binary form must reproduce the above copyright
153fdac2b8Sthorpej.\"    notice, this list of conditions and the following disclaimer in the
163fdac2b8Sthorpej.\"    documentation and/or other materials provided with the distribution.
173fdac2b8Sthorpej.\"
183fdac2b8Sthorpej.\" THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
193fdac2b8Sthorpej.\" ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
203fdac2b8Sthorpej.\" TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
213fdac2b8Sthorpej.\" PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
223fdac2b8Sthorpej.\" BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
233fdac2b8Sthorpej.\" CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
243fdac2b8Sthorpej.\" SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
253fdac2b8Sthorpej.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
263fdac2b8Sthorpej.\" CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
273fdac2b8Sthorpej.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
283fdac2b8Sthorpej.\" POSSIBILITY OF SUCH DAMAGE.
293fdac2b8Sthorpej.\"
30cfc4d546Syamt.Dd September 7, 2013
313fdac2b8Sthorpej.Dt _LWP_GETPRIVATE 2
323fdac2b8Sthorpej.Os
333fdac2b8Sthorpej.Sh NAME
343fdac2b8Sthorpej.Nm _lwp_getprivate ,
353fdac2b8Sthorpej.Nm _lwp_setprivate
363fdac2b8Sthorpej.Nd get and set light-weight process private data
373fdac2b8Sthorpej.Sh LIBRARY
383fdac2b8Sthorpej.Lb libc
393fdac2b8Sthorpej.Sh SYNOPSIS
40472351e1Swiz.In lwp.h
413fdac2b8Sthorpej.Ft void *
423fdac2b8Sthorpej.Fn _lwp_getprivate void
433fdac2b8Sthorpej.Ft void
443fdac2b8Sthorpej.Fn _lwp_setprivate "void *ptr"
453fdac2b8Sthorpej.Sh DESCRIPTION
463fdac2b8Sthorpej.Fn _lwp_setprivate
473fdac2b8Sthorpejstores the pointer to private data
483fdac2b8Sthorpej.Fa ptr
493fdac2b8Sthorpejin a location private to the LWP.
503fdac2b8Sthorpej.Pp
513fdac2b8Sthorpej.Fn _lwp_getprivate
523fdac2b8Sthorpejreturns the pointer to private data for the LWP.
53cfc4d546Syamt.Pp
54cfc4d546SyamtSome platforms provide alternative ways quicker than
55cfc4d546Syamt.Fn _lwp_getprivate
56cfc4d546Syamtto use the pointer.
57cfc4d546Syamt.Bl -tag -width amd64
58cfc4d546Syamt.It alpha
59cfc4d546SyamtThe pointer can be retrieved by call_pal PAL_rdunique.
60cfc4d546Syamt.It amd64
61cfc4d546SyamtThe base address of
62cfc4d546Syamt.Dv %fs
63cfc4d546Syamtregister is set to the pointer so that the private data can be
64cfc4d546Syamtaccessed using the selector.
65cfc4d546Syamt.It i386
66cfc4d546SyamtThe base address of
67cfc4d546Syamt.Dv %gs
68cfc4d546Syamtregister is set to the pointer so that the private data can be
69cfc4d546Syamtaccessed using the selector.
70cfc4d546Syamt.It sparc
71cfc4d546Syamt.Dv %g7
72cfc4d546Syamtregister is set to the pointer.
73*6c208a44Snjoly.El
743fdac2b8Sthorpej.Sh ERRORS
753fdac2b8SthorpejThe
763fdac2b8Sthorpej.Fn _lwp_getprivate
773fdac2b8Sthorpejand
783fdac2b8Sthorpej.Fn _lwp_setprivate
793fdac2b8Sthorpejfunctions are always successful, and no return value is reserved to indicate
803fdac2b8Sthorpejan error.
813fdac2b8Sthorpej.Sh SEE ALSO
823fdac2b8Sthorpej.Xr _lwp_makecontext 3
833fdac2b8Sthorpej.Sh HISTORY
843fdac2b8SthorpejThe
853fdac2b8Sthorpej.Fn _lwp_getprivate
863fdac2b8Sthorpejand
873fdac2b8Sthorpej.Fn _lwp_setprivate
883fdac2b8Sthorpejsystem calls first appeared in
893fdac2b8Sthorpej.Nx 2.0 .
90