Linux and UNIX Man Pages

Linux & Unix Commands - Search Man Pages

kenv(2) [opensolaris man page]

KENV(2)                                                       BSD System Calls Manual                                                      KENV(2)

NAME
kenv -- kernel environment LIBRARY
Standard C Library (libc, -lc) SYNOPSIS
#include <kenv.h> int kenv(int action, const char *name, char *value, int len); DESCRIPTION
The kenv() system call manipulates kernel environment variables. It supports the well known userland actions of getting, setting and unset- ting environment variables, as well as the ability to dump all of the entries in the kernel environment. The action argument can be one of the following: KENV_GET Returns the value associated with the named kernel environment variable. If the variable is not found, -1 is returned and the global variable errno is set to ENOENT. Only the number of bytes available in value are copied out. KENV_SET Sets or adds a new kernel environment variable. This option is only available to the superuser. KENV_UNSET Unsets the kernel environment variable name. If the variable does not exist, -1 is returned and the global variable errno is set to EINVAL. This option is only available to the superuser. KENV_DUMP Dumps as much of the kernel environment as will fit in value. If value is NULL, kenv() will return the number of bytes required to copy out the entire environment. The name argument is the name of the environment variable to be affected. In the case of KENV_DUMP it is ignored. The value argument contains either the value to set the environment variable name to in the case of KENV_SET, or it points to the location where kenv() should copy return data to in the case of KENV_DUMP and KENV_GET. If value is NULL in the case of KENV_DUMP, kenv() will return the number of bytes required to copy out the entire environment. The len argument indicates how many bytes of storage value points to. RETURN VALUES
The kenv() system call returns 0 if successful in the case of KENV_SET and KENV_UNSET, and the number of bytes copied into value in the case of KENV_DUMP and KENV_GET. If an error occurs, a value of -1 is returned and the global variable errno is set to indicate the error. ERRORS
The kenv() system call will fail if: [EINVAL] The action argument is not a valid option, or the length of the value is less than 1 for a KENV_SET. [ENOENT] no value could be found for name for a KENV_SET or KENV_UNSET. [EPERM] a user other than the superuser attempted to set or unset a kernel environment variable. [EFAULT] bad address was encountered while attempting to copy in user arguments, or copy out value(s). [ENAMETOOLONG] the name of a variable supplied by the user is longer than KENV_MNAMELEN or the value of a variable is longer than KENV_MVALLEN. SEE ALSO
kenv(1) AUTHORS
This manual page was written by Chad David <davidc@FreeBSD.org>. The kenv() system call was written by Maxime Henrion <mux@FreeBSD.org>. BSD April 17, 2002 BSD

Check Out this Related Man Page

set(1F) 							   FMLI Commands							   set(1F)

NAME
set, unset - set and unset local or global environment variables SYNOPSIS
set [-l variable [=value]] ... set [-e variable [=value]] ... set [-ffile variable [=value]]... ... unset -l variable... unset -f file variable... DESCRIPTION
The set command sets variable in the environment, or adds variable=value to file. If variable is not equated it to a value, set expects the value to be on stdin. The unset command removes variable. Note that the FMLI predefined, read-only variables (such as ARG1), may not be set or unset. Note that at least one of the above options must be used for each variable being set or unset. If you set a variable with the -ffilename option, you must thereafter include filename in references to that variable. For example, ${(file)VARIABLE}. FMLI inherits the UNIX environment when invoked. OPTIONS
-l Sets or unsets the specified variable in the local environment. Variables set with -l will not be inherited by processes invoked from FMLI. -e Sets the specified variable in the UNIX environment. Variables set with -e will be inherited by any processes started from FMLI. Note that these variables cannot be unset. -ffile Sets or unsets the specified variable in the global environment. The argument file is the name, or pathname, of a file containing lines of the form variable=value. file will be created if it does not already exist. Note that no space intervenes between -f and file. EXAMPLES
Example 1 A sample output of set command. Storing a selection made in a menu: name=Selection 2 action=`set -l SELECTION=2`close NOTES
Variables set to be available to the UNIX environment (those set using the -e option) can only be set for the current fmli process and the processes it calls. When using the -f option, unless file is unique to the process, other users of FMLI on the same machine will be able to expand these vari- ables, depending on the read/write permissions on file. A variable set in one frame may be referenced or unset in any other frame. This includes local variables. ATTRIBUTES
See attributes(5) for descriptions of the following attributes: +-----------------------------+-----------------------------+ | ATTRIBUTE TYPE | ATTRIBUTE VALUE | +-----------------------------+-----------------------------+ |Availability |SUNWcsu | +-----------------------------+-----------------------------+ SEE ALSO
env(1), sh(1), attributes(5) SunOS 5.11 5 Jul 1990 set(1F)
Man Page