sanitizer_libc.h revision ae4d9caa4f47fa6abcd641719e9f520622940c17
116e0075746b21ed866ec3be21ef0d1e46f0efed5Kostya Serebryany//===-- sanitizer_libc.h ----------------------------------------*- C++ -*-===//
2b3cedf98a3c8545da2234c2d35cb5d687984035fKostya Serebryany//
3b3cedf98a3c8545da2234c2d35cb5d687984035fKostya Serebryany//                     The LLVM Compiler Infrastructure
4b3cedf98a3c8545da2234c2d35cb5d687984035fKostya Serebryany//
5b3cedf98a3c8545da2234c2d35cb5d687984035fKostya Serebryany// This file is distributed under the University of Illinois Open Source
6b3cedf98a3c8545da2234c2d35cb5d687984035fKostya Serebryany// License. See LICENSE.TXT for details.
7b3cedf98a3c8545da2234c2d35cb5d687984035fKostya Serebryany//
8b3cedf98a3c8545da2234c2d35cb5d687984035fKostya Serebryany//===----------------------------------------------------------------------===//
9b3cedf98a3c8545da2234c2d35cb5d687984035fKostya Serebryany//
10b3cedf98a3c8545da2234c2d35cb5d687984035fKostya Serebryany// This file is shared between AddressSanitizer and ThreadSanitizer
11b3cedf98a3c8545da2234c2d35cb5d687984035fKostya Serebryany// run-time libraries.
12b3cedf98a3c8545da2234c2d35cb5d687984035fKostya Serebryany// These tools can not use some of the libc functions directly because those
13b3cedf98a3c8545da2234c2d35cb5d687984035fKostya Serebryany// functions are intercepted. Instead, we implement a tiny subset of libc here.
14b3cedf98a3c8545da2234c2d35cb5d687984035fKostya Serebryany//
15b3cedf98a3c8545da2234c2d35cb5d687984035fKostya Serebryany// We also define several basic types here to avoid using system headers
16b3cedf98a3c8545da2234c2d35cb5d687984035fKostya Serebryany// as the latter complicate portability of this low-level code.
17b3cedf98a3c8545da2234c2d35cb5d687984035fKostya Serebryany//===----------------------------------------------------------------------===//
189aead37421a6e4bf43265e5195c6ac31fc519982Kostya Serebryany#ifndef SANITIZER_LIBC_H
199aead37421a6e4bf43265e5195c6ac31fc519982Kostya Serebryany#define SANITIZER_LIBC_H
20b3cedf98a3c8545da2234c2d35cb5d687984035fKostya Serebryany
213836ff2733d40e1182e301ef7de3eff9469777aeAlexey Samsonov#include "sanitizer_defs.h"
223836ff2733d40e1182e301ef7de3eff9469777aeAlexey Samsonov
2316e0075746b21ed866ec3be21ef0d1e46f0efed5Kostya Serebryany// No code here yet. Will move more code in the next changes.
24b3cedf98a3c8545da2234c2d35cb5d687984035fKostya Serebryanynamespace __sanitizer {
25b3cedf98a3c8545da2234c2d35cb5d687984035fKostya Serebryany
26b3cedf98a3c8545da2234c2d35cb5d687984035fKostya Serebryanyvoid MiniLibcStub();
27b3cedf98a3c8545da2234c2d35cb5d687984035fKostya Serebryany
283836ff2733d40e1182e301ef7de3eff9469777aeAlexey Samsonov// internal_X() is a custom implementation of X() for use in RTL.
29c0d78c1de1f2607c874020d27b72cf989c5ce092Alexey Samsonovint internal_strcmp(const char *s1, const char *s2);
303836ff2733d40e1182e301ef7de3eff9469777aeAlexey Samsonovchar *internal_strncpy(char *dst, const char *src, uptr n);
313836ff2733d40e1182e301ef7de3eff9469777aeAlexey Samsonov
32ae4d9caa4f47fa6abcd641719e9f520622940c17Alexey Samsonov#ifndef _WIN32
33ae4d9caa4f47fa6abcd641719e9f520622940c17Alexey Samsonovvoid *internal_mmap(void *addr, uptr length, int prot, int flags,
34ae4d9caa4f47fa6abcd641719e9f520622940c17Alexey Samsonov                    int fd, u64 offset);
35ae4d9caa4f47fa6abcd641719e9f520622940c17Alexey Samsonov#endif  // _WIN32
36ae4d9caa4f47fa6abcd641719e9f520622940c17Alexey Samsonov
37b3cedf98a3c8545da2234c2d35cb5d687984035fKostya Serebryany}  // namespace __sanitizer
38b3cedf98a3c8545da2234c2d35cb5d687984035fKostya Serebryany
399aead37421a6e4bf43265e5195c6ac31fc519982Kostya Serebryany#endif  // SANITIZER_LIBC_H
40