*nix Documentation Project
·  Home
 +   man pages
·  Linux HOWTOs
·  FreeBSD Tips
·  *niX Forums

  man pages->FreeBSD man pages -> kenv (2)              
Title
Content
Arch
Section
 

KENV(2)

Contents


NAME    [Toc]    [Back]

     kenv -- kernel environment

LIBRARY    [Toc]    [Back]

     Standard C Library (libc, -lc)

SYNOPSIS    [Toc]    [Back]

     #include <kenv.h>

     int
     kenv(int action, const char *name, char *value, int len);

DESCRIPTION    [Toc]    [Back]

     The kenv() system call manipulates kernel environment variables.  It supports
 the well known userland actions of getting, setting and unsetting
     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    [Toc]    [Back]

     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    [Toc]    [Back]

     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    [Toc]    [Back]

      
      
     kenv(1)

AUTHORS    [Toc]    [Back]

     This man page was written by Chad David <[email protected]>.

     The kenv() system call was written by Maxime Henrion <[email protected]>.


FreeBSD 5.2.1			April 17, 2002			 FreeBSD 5.2.1
[ Back ]
 Similar pages
Name OS Title
kenv FreeBSD dump or modify the kernel environment
env IRIX set environment for command execution, print environment
printenv Tru64 Displays or sets the current environment, or displays the values of environment variables
env Tru64 Displays or sets the current environment, or displays the values of environment variables
dontdump HP-UX defines which classes of kernel memory pages are not dumped when a kernel panic occurs
alwaysdump HP-UX defines which classes of kernel memory pages are dumped when a kernel panic occurs
kopt Tru64 Displays a menu of optional kernel components that can be selected to build into the kernel
config OpenBSD build kernel compilation directories or modify a kernel
env FreeBSD set and print environment
environ OpenBSD user environment
Copyright © 2004-2005 DeniX Solutions SRL
newsletter delivery service