mirror of https://gitee.com/openkylin/nodejs.git
[PATCH] src: use getauxval in node_main.cc
This commit suggests using getauxval in node_main.cc. The motivation for this is that getauxval was introduced in glibc 2.16 and looking at BUILDING.md, in the 'Platform list' section, it looks like we now support glibc >= 2.17 and perhaps this change would be alright now. PR-URL: https://github.com/nodejs/node/pull/33693 Refs: https://github.com/nodejs/node/pull/12548 Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl> Reviewed-By: David Carlier <devnexen@gmail.com> Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com> Gbp-Pq: Name 7232c2a1604d241ce0455d919ba9b0b8e9959f81.patch
This commit is contained in:
parent
9f936f2f6a
commit
44d40c9382
|
@ -74,13 +74,7 @@ int wmain(int argc, wchar_t* wargv[]) {
|
||||||
#else
|
#else
|
||||||
// UNIX
|
// UNIX
|
||||||
#ifdef __linux__
|
#ifdef __linux__
|
||||||
#include <elf.h>
|
#include <sys/auxv.h>
|
||||||
#ifdef __LP64__
|
|
||||||
#define Elf_auxv_t Elf64_auxv_t
|
|
||||||
#else
|
|
||||||
#define Elf_auxv_t Elf32_auxv_t
|
|
||||||
#endif // __LP64__
|
|
||||||
extern char** environ;
|
|
||||||
#endif // __linux__
|
#endif // __linux__
|
||||||
#if defined(__POSIX__) && defined(NODE_SHARED_MODE)
|
#if defined(__POSIX__) && defined(NODE_SHARED_MODE)
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
@ -109,15 +103,7 @@ int main(int argc, char* argv[]) {
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(__linux__)
|
#if defined(__linux__)
|
||||||
char** envp = environ;
|
node::per_process::linux_at_secure = getauxval(AT_SECURE);
|
||||||
while (*envp++ != nullptr) {}
|
|
||||||
Elf_auxv_t* auxv = reinterpret_cast<Elf_auxv_t*>(envp);
|
|
||||||
for (; auxv->a_type != AT_NULL; auxv++) {
|
|
||||||
if (auxv->a_type == AT_SECURE) {
|
|
||||||
node::per_process::linux_at_secure = auxv->a_un.a_val;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
#endif
|
#endif
|
||||||
// Disable stdio buffering, it interacts poorly with printf()
|
// Disable stdio buffering, it interacts poorly with printf()
|
||||||
// calls elsewhere in the program (e.g., any logging from V8.)
|
// calls elsewhere in the program (e.g., any logging from V8.)
|
||||||
|
|
Loading…
Reference in New Issue