[clang] [clang-tools-extra] [llvm] [flang] [flang] GETLOG runtime and extension implementation: get login username (PR #74628)

Yi Wu via cfe-commits cfe-commits at lists.llvm.org
Wed Dec 13 09:28:16 PST 2023


================
@@ -10,13 +10,29 @@
 // extensions that will eventually be implemented in Fortran.
 
 #include "flang/Runtime/extensions.h"
+#include "flang/Runtime/character.h"
 #include "flang/Runtime/command.h"
 #include "flang/Runtime/descriptor.h"
 #include "flang/Runtime/io-api.h"
 
+#if _REENTRANT || _POSIX_C_SOURCE >= 199506L
+// System is posix-compliant and has getlogin_r
+#include <unistd.h>
+#endif
+
 extern "C" {
 
 namespace Fortran::runtime {
+
+void GetUsernameEnvVar(
+    const char *envName, std::byte *arg, std::int64_t length) {
+  Descriptor name{
+      *Descriptor::Create(1, sizeof(envName), const_cast<char *>(envName), 0)};
----------------
yi-wu-arm wrote:

Thanks, I should pay more attention to this.

https://github.com/llvm/llvm-project/pull/74628


More information about the cfe-commits mailing list