[libc-commits] [PATCH] D119403: Introduce getenv to LLVM libc

Raman Tenneti via Phabricator via libc-commits libc-commits at lists.llvm.org
Wed Feb 9 19:22:19 PST 2022


rtenneti created this revision.
Herald added subscribers: libc-commits, mgorny.
Herald added a project: libc-project.
rtenneti requested review of this revision.

Add support for getenv as defined by the Open Group's "System Interface &
 Header" in https://pubs.opengroup.org/onlinepubs/7908799/xsh/getenv.html

getenv requires a standard way of accessing the environment,
so a pointer to the environment is added to the startup in crt1.
Consquently, this function is not usable on top of other libcs.

Added starts_with method to StringView. getenv function uses it.

Co-authored-by: Jeff Bailey <jeffbailey at google.com>


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D119403

Files:
  libc/config/linux/aarch64/entrypoints.txt
  libc/config/linux/app.h
  libc/config/linux/x86_64/entrypoints.txt
  libc/loader/linux/x86_64/start.cpp
  libc/spec/posix.td
  libc/src/__support/CPP/StringView.h
  libc/src/stdlib/CMakeLists.txt
  libc/src/stdlib/getenv.cpp
  libc/src/stdlib/getenv.h
  libc/test/loader/linux/CMakeLists.txt
  libc/test/loader/linux/getenv_test.cpp
  libc/test/loader/linux/loader_test.h
  libc/test/utils/CPP/stringview_test.cpp

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D119403.407375.patch
Type: text/x-patch
Size: 10204 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/libc-commits/attachments/20220210/6bccdca8/attachment-0001.bin>


More information about the libc-commits mailing list