svcadm(8)을 검색하려면 섹션에서 8 을 선택하고, 맨 페이지 이름에 svcadm을 입력하고 검색을 누른다.
getenv(3c)
Standard C Library Functions getenv(3C)
NAME
getenv, secure_getenv, getenv_s - return value for environment name
SYNOPSIS
#include <stdlib.h>
char *getenv(const char *name);
char *secure_getenv(const char *name);
#define __STDC_WANT_LIB_EXT1__ 1
#include <stdlib.h>
errno_t getenv_s(size_t *restrict len, char *restrict value,
size_t maxsize, const char *restrict name);
DESCRIPTION
The getenv() function searches the environment list (see environ(7))
for a string of the form name=value and, if the string is present,
returns a pointer to the value in the current environment.
The secure_getenv() function behaves like getenv() except that it
returns a null pointer if the issetugid() calls returns a non-zero
value. For more information, see the issetugid(2) man page.
The getenv_s() function is part of the bounds checking interfaces spec‐
ified in the C11 standard, Annex K. It behaves in a manner similar to
the getenv() function, but with differing parameters and return type in
order to provide additional safety checks in the form of explicit run‐
time-constraints as defined in the C11 standard. See runtime_con‐
straint_handler(3C) and INCITS/ISO/IEC 9899:2011.
RETURN VALUES
If successful, getenv() and secure_getenv() return a pointer to the
value in the current environment; otherwise, they return a null
pointer.
If the specified name is found and the associated string was success‐
fully stored in value, the getenv_s() function returns zero; otherwise,
it returns a non-zero value.
EINVAL Null pointer is passed
ERANGE size argument is not a valid value
ENOENT No such file or directory
USAGE
The getenv() and secure_getenv() functions can be safely called from a
multithreaded application. Care must be exercised when using either
getenv() or secure_getenv() functions with putenv(3C) in a multi‐
threaded application. These functions examine and modify the environ‐
ment list, which is shared by all threads in an application. The system
prevents the list from being accessed simultaneously by two different
threads. It does not, however, prevent two threads from successively
accessing the environment list using getenv(), secure_getenv(), or
putenv(3C).
The secure_getenv() function is intended for use in general-purpose
libraries to avoid vulnerabilities that could occur if programs with
raised privilege accidentally trusted the environment.
ATTRIBUTES
See attributes(7) for descriptions of the following attributes:
tab() box; cw(2.75i) |cw(2.75i) lw(2.75i) |lw(2.75i) ATTRIBUTE TYPEAT‐
TRIBUTE VALUE _ Interface StabilityCommitted _ MT-LevelSee below _
StandardSee below
The getenv() and secure_getenv() functions can be used safely in multi‐
threaded applications, with the caveats noted above.
The getenv_s() function cannot be used safely in a multithreaded appli‐
cation due to the runtime constraint handler. For more information, see
the runtime_constraint_handler(3C) man page.
The getenv() function is specified by the ISO C and XPG standards. The
getenv_s() function is specified by the ISO C11 standard. The
secure_getenv() function is not specified by any current standards. See
standards(7) for further details.
SEE ALSO
exec(2), issetugid(2), putenv(3C), attributes(7), environ(7), stan‐
dards(7), runtime_constraint_handler(3C)
HISTORY
The getenv_s() function was added to Oracle Solaris in the 11.4
release.
The secure_getenv() function was added to Oracle Solaris in the 11.3
SRU 10 release.
Oracle Solaris 11.4 9 Jul 2018 getenv(3C)