summaryrefslogtreecommitdiff
path: root/libc/src/stdlib/getenv.cpp
AgeCommit message (Collapse)Author
2024-08-08[libc] Implement 'getenv' on the GPU target (#102376)Joseph Huber
Summary: This patch implements 'getenv'. I was torn on how to implement this, since realistically we only have access to this environment pointer in the "loader" interface. An alternative would be to use an RPC call every time, but I think that's overkill for what this will be used for. A better solution is just to emit a common `DataEnvironment` that contains all of the host visible resources to initialize. Right now this is the `env_ptr`, `clock_freq`, and `rpc_client`. I did this by making the `app.h` interface that Linux uses more general, could possibly move that into a separate patch, but I figured it's easier to see with the usage.
2024-07-12[libc] Migrate to using LIBC_NAMESPACE_DECL for namespace declaration (#98597)Petr Hosek
This is a part of #97655.
2024-07-12Revert "[libc] Migrate to using LIBC_NAMESPACE_DECL for namespace ↵Mehdi Amini
declaration" (#98593) Reverts llvm/llvm-project#98075 bots are broken
2024-07-11[libc] Migrate to using LIBC_NAMESPACE_DECL for namespace declaration (#98075)Petr Hosek
This is a part of #97655.
2023-12-04[libc][NFC] unify startup library's code style with the rest (#74041)Schrodinger ZHU Yifan
This PR unifies the startup library's code style with the rest of libc.
2023-09-26[libc] Mass replace enclosing namespace (#67032)Guillaume Chatelet
This is step 4 of https://discourse.llvm.org/t/rfc-customizable-namespace-to-allow-testing-the-libc-when-the-system-libc-is-also-llvms-libc/73079
2022-08-22[libc][NFC] Use STL case for string_viewGuillaume Chatelet
2022-07-18[libc] Fix API for remove_{prefix, suffix}Jeff Bailey
The API in StringView.h for remove_prefix was incorrect and was returning a new StringView rather than just altering the view. As part of this, also removed some of the safety features. The comment correctly noted that the behaviour is undefined in some cases, but the code and test cases checked for that. One caller was relying on the old behaviour, so fixed it and added some comments. Tested: check-libc llvmlibc libc-loader-tests Reviewed By: gchatelet Differential Revision: https://reviews.llvm.org/D129950
2022-02-14Introduce getenv to LLVM libcRaman Tenneti
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@google.com> Reviewed By: sivachandra, rtenneti Differential Revision: https://reviews.llvm.org/D119403