xref: /dflybsd-src/lib/libc/sys/varsym.2 (revision 86d7f5d305c6adaa56ff4582ece9859d73106103)
186d7f5d3SJohn Marino.\"
286d7f5d3SJohn Marino.\" Copyright (c) 2008
386d7f5d3SJohn Marino.\"	The DragonFly Project.  All rights reserved.
486d7f5d3SJohn Marino.\"
586d7f5d3SJohn Marino.\" Redistribution and use in source and binary forms, with or without
686d7f5d3SJohn Marino.\" modification, are permitted provided that the following conditions
786d7f5d3SJohn Marino.\" are met:
886d7f5d3SJohn Marino.\"
986d7f5d3SJohn Marino.\" 1. Redistributions of source code must retain the above copyright
1086d7f5d3SJohn Marino.\"    notice, this list of conditions and the following disclaimer.
1186d7f5d3SJohn Marino.\" 2. Redistributions in binary form must reproduce the above copyright
1286d7f5d3SJohn Marino.\"    notice, this list of conditions and the following disclaimer in
1386d7f5d3SJohn Marino.\"    the documentation and/or other materials provided with the
1486d7f5d3SJohn Marino.\"    distribution.
1586d7f5d3SJohn Marino.\" 3. Neither the name of The DragonFly Project nor the names of its
1686d7f5d3SJohn Marino.\"    contributors may be used to endorse or promote products derived
1786d7f5d3SJohn Marino.\"    from this software without specific, prior written permission.
1886d7f5d3SJohn Marino.\"
1986d7f5d3SJohn Marino.\" THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
2086d7f5d3SJohn Marino.\" ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
2186d7f5d3SJohn Marino.\" LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
2286d7f5d3SJohn Marino.\" FOR A PARTICULAR PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE
2386d7f5d3SJohn Marino.\" COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
2486d7f5d3SJohn Marino.\" INCIDENTAL, SPECIAL, EXEMPLARY OR CONSEQUENTIAL DAMAGES (INCLUDING,
2586d7f5d3SJohn Marino.\" BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
2686d7f5d3SJohn Marino.\" LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
2786d7f5d3SJohn Marino.\" AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
2886d7f5d3SJohn Marino.\" OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
2986d7f5d3SJohn Marino.\" OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
3086d7f5d3SJohn Marino.\" SUCH DAMAGE.
3186d7f5d3SJohn Marino.\"
3286d7f5d3SJohn Marino.Dd February 21, 2008
3386d7f5d3SJohn Marino.Dt VARSYM 2
3486d7f5d3SJohn Marino.Os
3586d7f5d3SJohn Marino.Sh NAME
3686d7f5d3SJohn Marino.Nm varsym_get ,
3786d7f5d3SJohn Marino.Nm varsym_set ,
3886d7f5d3SJohn Marino.Nm varsym_list
3986d7f5d3SJohn Marino.Nd variant symlink variables
4086d7f5d3SJohn Marino.Sh LIBRARY
4186d7f5d3SJohn Marino.Lb libc
4286d7f5d3SJohn Marino.Sh SYNOPSIS
4386d7f5d3SJohn Marino.In unistd.h
4486d7f5d3SJohn Marino.In sys/varsym.h
4586d7f5d3SJohn Marino.Ft int
4686d7f5d3SJohn Marino.Fn varsym_get "int mask" "const char *wild" "char *buf" "int bufsize"
4786d7f5d3SJohn Marino.Ft int
4886d7f5d3SJohn Marino.Fn varsym_set "int level" "const char *name" "const char *data"
4986d7f5d3SJohn Marino.Ft int
5086d7f5d3SJohn Marino.Fn varsym_list "int level" "char *buf" "int maxsize" "int *marker"
5186d7f5d3SJohn Marino.Sh DESCRIPTION
5286d7f5d3SJohn MarinoThe
5386d7f5d3SJohn Marino.Fn varsym_get
5486d7f5d3SJohn Marinosystem call retrieves the value of the first variable whose left side matches
5586d7f5d3SJohn Marino.Fa wild
5686d7f5d3SJohn Marinoand return the value in
5786d7f5d3SJohn Marino.Fa buf .
5886d7f5d3SJohn Marino.Fa Bufsize
5986d7f5d3SJohn Marinospecifies the length of the buffer and
6086d7f5d3SJohn Marino.Fa mask
6186d7f5d3SJohn Marinocan be used to further restrict the search to variables of certain type.
6286d7f5d3SJohn MarinoA value of
6386d7f5d3SJohn Marino.Dv VARSYM_ALL_MASK
6486d7f5d3SJohn Marinowill search all variables (see below for other mask definitions).
6586d7f5d3SJohn Marino.Pp
6686d7f5d3SJohn Marino.Fn Varsym_set
6786d7f5d3SJohn Marinosets the variable
6886d7f5d3SJohn Marino.Fa name
6986d7f5d3SJohn Marinoof type
7086d7f5d3SJohn Marino.Fa level
7186d7f5d3SJohn Marinoto the value pointed to by
7286d7f5d3SJohn Marino.Fa data .
7386d7f5d3SJohn Marino.Pp
7486d7f5d3SJohn MarinoThe
7586d7f5d3SJohn Marino.Fn varsym_list
7686d7f5d3SJohn Marinosystem call fills the buffer
7786d7f5d3SJohn Marino.Fa buf
7886d7f5d3SJohn Marinowith variable settings for the specified
7986d7f5d3SJohn Marino.Fa level .
8086d7f5d3SJohn MarinoA maximum of
8186d7f5d3SJohn Marino.Fa maxsize
8286d7f5d3SJohn Marinobytes of settings are returned and
8386d7f5d3SJohn Marino.Fa marker
8486d7f5d3SJohn Marinois set to the actual number of name/value pairs read, or -1 if no more
8586d7f5d3SJohn Marinoremain.
8686d7f5d3SJohn Marino.Fn Varsym_list
8786d7f5d3SJohn Marinomust be called repeatedly until
8886d7f5d3SJohn Marino.Fa marker
8986d7f5d3SJohn Marinois -1 if all settings are to be retrieved.
9086d7f5d3SJohn MarinoThe format of the buffer is
9186d7f5d3SJohn Marino.Dq \e000name\e000value\e000name\e000value... .
9286d7f5d3SJohn Marino.Pp
9386d7f5d3SJohn MarinoThe following
9486d7f5d3SJohn Marino.Nm varsym
9586d7f5d3SJohn Marinolevels (and masks) are defined in
9686d7f5d3SJohn Marino.In sys/varsym.h :
9786d7f5d3SJohn Marino.Bl -tag -width indent
9886d7f5d3SJohn Marino.It Dv VARSYM_PROC Pq Dv VARSYM_PROC_MASK
9986d7f5d3SJohn MarinoPer-process variables.
10086d7f5d3SJohn Marino.\".It Dv VARSYM_USER Pq Dv VARSYM_USER_MASK
10186d7f5d3SJohn Marino.\"Per-user variables.
10286d7f5d3SJohn Marino.It Dv VARSYM_SYS Pq Dv VARSYM_SYS_MASK
10386d7f5d3SJohn MarinoSystem wide variables.
10486d7f5d3SJohn Marino.It Dv VARSYM_PRISON
10586d7f5d3SJohn MarinoUsed internally.
10686d7f5d3SJohn Marino.El
10786d7f5d3SJohn Marino.Sh RETURN VALUES
10886d7f5d3SJohn Marino.Rv -std varsym_get varsym_set
10986d7f5d3SJohn Marino.Pp
11086d7f5d3SJohn MarinoThe
11186d7f5d3SJohn Marino.Fn varsym_list
11286d7f5d3SJohn Marinofunction returns the number of bytes read if successful;
11386d7f5d3SJohn Marinootherwise the value -1 is returned and the global variable
11486d7f5d3SJohn Marino.Fa errno
11586d7f5d3SJohn Marinois set to indicate the error.
11686d7f5d3SJohn Marino.Sh ERRORS
11786d7f5d3SJohn MarinoThe
11886d7f5d3SJohn Marino.Nm varsym
11986d7f5d3SJohn Marinosystem calls will fail when one of the following occurs:
12086d7f5d3SJohn Marino.Bl -tag -width Er
12186d7f5d3SJohn Marino.It Bq Er EINVAL
12286d7f5d3SJohn MarinoAn invalid
12386d7f5d3SJohn Marino.Fa level
12486d7f5d3SJohn Marinowas specified.
12586d7f5d3SJohn Marino.It Bq Er ENOENT
12686d7f5d3SJohn MarinoA variable could not be found.
12786d7f5d3SJohn Marino.It Bq Er EOVERFLOW
12886d7f5d3SJohn MarinoInsufficient space for storing variable values was specified.
12986d7f5d3SJohn Marino.El
13086d7f5d3SJohn Marino.Sh SEE ALSO
13186d7f5d3SJohn Marino.Xr varsym 1
13286d7f5d3SJohn Marino.Sh HISTORY
13386d7f5d3SJohn MarinoThe
13486d7f5d3SJohn Marino.Nm varsym
13586d7f5d3SJohn Marinosystem calls first appeared in
13686d7f5d3SJohn Marino.Dx 1.0 .
13786d7f5d3SJohn Marino.Sh AUTHORS
13886d7f5d3SJohn Marino.An -nosplit
13986d7f5d3SJohn MarinoThe
14086d7f5d3SJohn Marino.Nm varsym
14186d7f5d3SJohn Marinosystem calls were written by
14286d7f5d3SJohn Marino.An Matthew Dillon
14386d7f5d3SJohn Marinoand this manual page was written by
14486d7f5d3SJohn Marino.An Sascha Wildner .
145