Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(6)

Side by Side Diff: base/process_util_linux.cc

Issue 15405003: add a macro that really identifies glibc (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: nitpick fixup Created 7 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | build/build_config.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "base/process_util.h" 5 #include "base/process_util.h"
6 6
7 #include <dirent.h> 7 #include <dirent.h>
8 #include <malloc.h> 8 #include <malloc.h>
9 #include <sys/time.h> 9 #include <sys/time.h>
10 #include <sys/types.h> 10 #include <sys/types.h>
(...skipping 727 matching lines...) Expand 10 before | Expand all | Expand 10 after
738 LOG(FATAL) << "Out of memory, size = " << size; 738 LOG(FATAL) << "Out of memory, size = " << size;
739 LOG(FATAL) << "Out of memory."; 739 LOG(FATAL) << "Out of memory.";
740 } 740 }
741 741
742 void OnNoMemory() { 742 void OnNoMemory() {
743 OnNoMemorySize(0); 743 OnNoMemorySize(0);
744 } 744 }
745 745
746 } // namespace 746 } // namespace
747 747
748 #if !defined(OS_ANDROID) && !defined(USE_TCMALLOC) && \ 748 #if !defined(ADDRESS_SANITIZER) && !defined(MEMORY_SANITIZER) && \
749 !defined(ADDRESS_SANITIZER) && !defined(MEMORY_SANITIZER) && \
750 !defined(THREAD_SANITIZER) 749 !defined(THREAD_SANITIZER)
751 750
751 #if defined(LIBC_GLIBC) && !defined(USE_TCMALLOC)
752
752 extern "C" { 753 extern "C" {
753 void* __libc_malloc(size_t size); 754 void* __libc_malloc(size_t size);
754 void* __libc_realloc(void* ptr, size_t size); 755 void* __libc_realloc(void* ptr, size_t size);
755 void* __libc_calloc(size_t nmemb, size_t size); 756 void* __libc_calloc(size_t nmemb, size_t size);
756 void* __libc_valloc(size_t size); 757 void* __libc_valloc(size_t size);
757 void* __libc_pvalloc(size_t size); 758 void* __libc_pvalloc(size_t size);
758 void* __libc_memalign(size_t alignment, size_t size); 759 void* __libc_memalign(size_t alignment, size_t size);
759 760
760 // Overriding the system memory allocation functions: 761 // Overriding the system memory allocation functions:
761 // 762 //
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after
819 int posix_memalign(void** ptr, size_t alignment, size_t size) 820 int posix_memalign(void** ptr, size_t alignment, size_t size)
820 __attribute__ ((visibility("default"))); 821 __attribute__ ((visibility("default")));
821 822
822 int posix_memalign(void** ptr, size_t alignment, size_t size) { 823 int posix_memalign(void** ptr, size_t alignment, size_t size) {
823 // This will use the safe version of memalign, above. 824 // This will use the safe version of memalign, above.
824 *ptr = memalign(alignment, size); 825 *ptr = memalign(alignment, size);
825 return 0; 826 return 0;
826 } 827 }
827 828
828 } // extern C 829 } // extern C
829 #endif // ANDROID, TCMALLOC, *_SANITIZER 830
831 #else
832
833 // TODO(mostynb@opera.com): dlsym dance
834
835 #endif // LIBC_GLIBC && !USE_TCMALLOC
836
837 #endif // !*_SANITIZER
830 838
831 void EnableTerminationOnHeapCorruption() { 839 void EnableTerminationOnHeapCorruption() {
832 // On Linux, there nothing to do AFAIK. 840 // On Linux, there nothing to do AFAIK.
833 } 841 }
834 842
835 void EnableTerminationOnOutOfMemory() { 843 void EnableTerminationOnOutOfMemory() {
836 #if defined(OS_ANDROID) 844 #if defined(OS_ANDROID)
837 // Android doesn't support setting a new handler. 845 // Android doesn't support setting a new handler.
838 DLOG(WARNING) << "Not feasible."; 846 DLOG(WARNING) << "Not feasible.";
839 #else 847 #else
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
879 int score_len = static_cast<int>(score_str.length()); 887 int score_len = static_cast<int>(score_str.length());
880 return (score_len == file_util::WriteFile(oom_file, 888 return (score_len == file_util::WriteFile(oom_file,
881 score_str.c_str(), 889 score_str.c_str(),
882 score_len)); 890 score_len));
883 } 891 }
884 892
885 return false; 893 return false;
886 } 894 }
887 895
888 } // namespace base 896 } // namespace base
OLDNEW
« no previous file with comments | « no previous file | build/build_config.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698