DragonFly On-Line Manual Pages
VARSYM(1) DragonFly General Commands Manual VARSYM(1)
varsym -- get and set user and system-wide variables for variant symlinks
varsym [-adpqsux] [var[=data] ...]
varsym -x [var[=data] ...] command args
The varsym program manages user and system-wide variables. These vari-
ables are typically used by the system to resolve variant symlinks but
may also be used generally.
For each operand set, modify, retrieve, or delete the specified variable.
By default variables specified without data are retrieved and variables
specified with data are set. Variables may be set to empty.
-a List all variables at the specified level. Note that per-
process variables override per-user variables and per-user
variables override system-wide variables. By default, per-
user variables are listed.
-d Delete mode. The specified variables are deleted. Any
specified data is ignored.
-p This option causes variables to be set on a per-process
basis and restricts retrievals to process-specific vari-
ables. Note that since varsym is run as its own process,
using this option to set a variable will not affect your
shell's namespace. Instead you might want to use the -x
option to set local varsyms and exec a command.
-q Quiet mode. When retrieving a variable only its data is
-s This option causes variables to be set system-wide and
restricts retrievals to system-specific variables.
-u This option causes variables to be set on a per-user-id
basis and restricts retrievals to user-specific variables.
This is the default unless -x is used.
-x This option causes variables to be set only within the
varsym process and its children, and also allows you to
specify a command and arguments to exec after the var=data
The varsym utility exits with one of the following values:
0 No errors occurred.
1 A requested variable could not be found
2 A requested variable could not be set
ln(1), varsym(2), varsym.conf(5)
DragonFly 5.3 September 27, 2009 DragonFly 5.3
VARSYM(2) DragonFly System Calls Manual VARSYM(2)
varsym_get, varsym_set, varsym_list -- variant symlink variables
Standard C Library (libc, -lc)
varsym_get(int mask, const char *wild, char *buf, int bufsize);
varsym_set(int level, const char *name, const char *data);
varsym_list(int level, char *buf, int maxsize, int *marker);
The varsym_get() system call retrieves the value of the first variable
whose left side matches wild and return the value in buf. Bufsize speci-
fies the length of the buffer and mask can be used to further restrict
the search to variables of certain type. A value of VARSYM_ALL_MASK will
search all variables (see below for other mask definitions).
Varsym_set() sets the variable name of type level to the value pointed to
The varsym_list() system call fills the buffer buf with variable settings
for the specified level. A maximum of maxsize bytes of settings are
returned and marker is set to the actual number of name/value pairs read,
or -1 if no more remain. Varsym_list() must be called repeatedly until
marker is -1 if all settings are to be retrieved. The format of the buf-
fer is ``\000name\000value\000name\000value...''.
The following varsym levels (and masks) are defined in <sys/varsym.h>:
System wide variables.
The varsym_get() and varsym_set() functions return the value 0 if suc-
cessful; otherwise the value -1 is returned and the global variable errno
is set to indicate the error.
The varsym_list() function returns the number of bytes read if success-
ful; otherwise the value -1 is returned and the global variable errno is
set to indicate the error.
The varsym system calls will fail when one of the following occurs:
[EINVAL] An invalid level was specified.
[ENOENT] A variable could not be found.
[EOVERFLOW] Insufficient space for storing variable values was
The varsym system calls first appeared in DragonFly 1.0.
The varsym system calls were written by Matthew Dillon and this manual
page was written by Sascha Wildner.
DragonFly 5.3 February 21, 2008 DragonFly 5.3