Index: third_party/tcmalloc/chromium/src/base/sysinfo.cc |
diff --git a/third_party/tcmalloc/chromium/src/base/sysinfo.cc b/third_party/tcmalloc/chromium/src/base/sysinfo.cc |
index 285630e3a9d0e85457d470dff5d74d1bd552949d..2559158b9db2585bb816e3019c429243eb7093ea 100644 |
--- a/third_party/tcmalloc/chromium/src/base/sysinfo.cc |
+++ b/third_party/tcmalloc/chromium/src/base/sysinfo.cc |
@@ -86,12 +86,20 @@ |
// time, so prefer making the syscalls directly if we can. |
#ifdef HAVE_SYS_SYSCALL_H |
# include <sys/syscall.h> |
+#endif |
+#ifdef SYS_open // solaris 11, at least sometimes, only defines SYS_openat |
# define safeopen(filename, mode) syscall(SYS_open, filename, mode) |
-# define saferead(fd, buffer, size) syscall(SYS_read, fd, buffer, size) |
-# define safeclose(fd) syscall(SYS_close, fd) |
#else |
# define safeopen(filename, mode) open(filename, mode) |
+#endif |
+#ifdef SYS_read |
+# define saferead(fd, buffer, size) syscall(SYS_read, fd, buffer, size) |
+#else |
# define saferead(fd, buffer, size) read(fd, buffer, size) |
+#endif |
+#ifdef SYS_close |
+# define safeclose(fd) syscall(SYS_close, fd) |
+#else |
# define safeclose(fd) close(fd) |
#endif |
@@ -179,9 +187,6 @@ const char* GetenvBeforeMain(const char* name) { |
// in their first character! If that assumption is violated, we'll |
// still get a profile, but one with an unexpected name. |
// TODO(csilvers): set an envvar instead when we can do it reliably. |
-// |
-// In Chromium this hack is intentionally disabled, because the path is not |
-// re-initialized upon fork. |
bool GetUniquePathFromEnv(const char* env_name, char* path) { |
char* envval = getenv(env_name); |
if (envval == NULL || *envval == '\0') |
@@ -191,9 +196,7 @@ bool GetUniquePathFromEnv(const char* env_name, char* path) { |
envval[0] & 127, envval+1, (unsigned int)(getpid())); |
} else { |
snprintf(path, PATH_MAX, "%s", envval); |
-#if 0 |
envval[0] |= 128; // set high bit for kids to see |
-#endif |
} |
return true; |
} |