From owner-svn-src-stable@freebsd.org Fri Mar 10 20:07:39 2017 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 57D55D067E4; Fri, 10 Mar 2017 20:07:39 +0000 (UTC) (envelope-from vangyzen@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 326161C59; Fri, 10 Mar 2017 20:07:39 +0000 (UTC) (envelope-from vangyzen@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v2AK7cA8020599; Fri, 10 Mar 2017 20:07:38 GMT (envelope-from vangyzen@FreeBSD.org) Received: (from vangyzen@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v2AK7c3v020598; Fri, 10 Mar 2017 20:07:38 GMT (envelope-from vangyzen@FreeBSD.org) Message-Id: <201703102007.v2AK7c3v020598@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: vangyzen set sender to vangyzen@FreeBSD.org using -f From: Eric van Gyzen Date: Fri, 10 Mar 2017 20:07:38 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r315024 - stable/10/lib/libc/sys X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 10 Mar 2017 20:07:39 -0000 Author: vangyzen Date: Fri Mar 10 20:07:38 2017 New Revision: 315024 URL: https://svnweb.freebsd.org/changeset/base/315024 Log: MFC r314055 Make several improvements and corrections in the kenv(2) man page Sponsored by: Dell EMC Modified: stable/10/lib/libc/sys/kenv.2 Directory Properties: stable/10/ (props changed) Modified: stable/10/lib/libc/sys/kenv.2 ============================================================================== --- stable/10/lib/libc/sys/kenv.2 Fri Mar 10 20:06:17 2017 (r315023) +++ stable/10/lib/libc/sys/kenv.2 Fri Mar 10 20:07:38 2017 (r315024) @@ -26,7 +26,7 @@ .\" .\" $FreeBSD$ .\" -.Dd April 17, 2002 +.Dd February 20, 2017 .Dt KENV 2 .Os .Sh NAME @@ -51,71 +51,59 @@ The argument can be one of the following: .Bl -tag -width ".Dv KENV_UNSET" .It Dv 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 -.Va errno -is set to -.Er ENOENT . -Only the number of bytes available in +Get the +.Fa value +of the variable with the given +.Fa name . +The size of the .Fa value -are copied out. +buffer is given by +.Fa len , +which should be at least +.Dv KENV_MVALLEN ++ 1 bytes to avoid truncation and to ensure NUL termination. .It Dv KENV_SET -Sets or adds a new kernel environment variable. +Set or add a variable. +The +.Fa name +and +.Fa value +are limited to +.Dv KENV_MNAMELEN +and +.Dv KENV_MVALLEN +characters, respectively +.Pq not including the NUL terminator. +The +.Fa len +argument indicates the length of the +.Fa value +and must include the NUL terminator. This option is only available to the superuser. .It Dv KENV_UNSET -Unsets the kernel environment variable +Unset the variable with the given .Fa name . -If the variable does not exist, \-1 is returned and -the global variable -.Va errno -is set to -.Er EINVAL . +The +.Fa value +and +.Fa len +arguments are ignored. This option is only available to the superuser. .It Dv KENV_DUMP -Dumps as much of the kernel environment as will fit in -.Fa value . +Dump as much of the kernel environment as will fit in +.Fa value , +whose size is given in +.Fa len . If .Fa value is .Dv NULL , .Fn kenv will return the number of bytes required to copy out the entire environment. -.El -.Pp -The -.Fa name -argument is the name of the environment variable to be affected. -In the case of -.Dv KENV_DUMP -it is ignored. -.Pp The -.Fa value -argument contains either the value to set the environment variable .Fa name -to in the case of -.Dv KENV_SET , -or it points to the location where -.Fn kenv -should copy return data to in the case of -.Dv KENV_DUMP -and -.Dv KENV_GET . -If -.Fa value -is -.Dv NULL -in the case of -.Dv KENV_DUMP , -.Fn kenv -will return the number of bytes required to copy out the entire environment. -.Pp -The -.Fa len -argument indicates how many bytes of storage -.Fa value -points to. +is ignored. +.El .Sh RETURN VALUES The .Fn kenv @@ -148,23 +136,31 @@ is not a valid option, or the length of is less than 1 for a .Dv KENV_SET . .It Bq Er ENOENT -no value could be found for +No value could be found for .Fa name for a -.Dv KENV_SET +.Dv KENV_GET or .Dv KENV_UNSET . .It Bq Er EPERM -a user other than the superuser attempted to set or unset a kernel +A user other than the superuser attempted to set or unset a kernel environment variable. .It Bq Er EFAULT -bad address was encountered while attempting to copy in user arguments, +A bad address was encountered while attempting to copy in user arguments or copy out value(s). .It Bq Er ENAMETOOLONG -the name of a variable supplied by the user is longer than +The +.Fa name +or the +.Fa value +is longer than .Dv KENV_MNAMELEN -or the value of a variable is longer than -.Dv KENV_MVALLEN . +or +.Dv KENV_MVALLEN +characters, respectively, or +.Fa len +did not include the NUL terminator for a +.Dv KENV_SET . .El .Sh SEE ALSO .Xr kenv 1