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