llvm/compiler-rt/lib/nsan/nsan_interceptors.cpp

//===- nsan_interceptors.cpp ----------------------------------------------===//
//
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
// See https://llvm.org/LICENSE.txt for license information.
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//===----------------------------------------------------------------------===//
//
// Interceptors for standard library functions.
//
// A note about `printf`: Make sure none of the interceptor code calls any
// part of the nsan framework that can call `printf`, since this could create
// a loop (`printf` itself uses the libc). printf-free functions are documented
// as such in nsan.h.
//
//===----------------------------------------------------------------------===//

#include "interception/interception.h"
#include "nsan.h"
#include "nsan_thread.h"
#include "sanitizer_common/sanitizer_common.h"
#include "sanitizer_common/sanitizer_linux.h"

#include <wchar.h>

usingnamespace__nsan;
usingnamespace__sanitizer;

template <typename T> T min(T a, T b) {}

INTERCEPTOR(void *, memset, void *dst, int v, uptr size) {}

INTERCEPTOR(wchar_t *, wmemset, wchar_t *dst, wchar_t v, uptr size) {}

INTERCEPTOR(void *, memmove, void *dst, const void *src, uptr size) {}

INTERCEPTOR(wchar_t *, wmemmove, wchar_t *dst, const wchar_t *src, uptr size) {}

INTERCEPTOR(void *, memcpy, void *dst, const void *src, uptr size) {}

INTERCEPTOR(wchar_t *, wmemcpy, wchar_t *dst, const wchar_t *src, uptr size) {}

INTERCEPTOR(char *, strfry, char *s) {}

INTERCEPTOR(char *, strsep, char **Stringp, const char *delim) {}

INTERCEPTOR(char *, strtok, char *str, const char *delim) {}

static void nsanCopyZeroTerminated(char *dst, const char *src, uptr n) {}

static void nsanWCopyZeroTerminated(wchar_t *dst, const wchar_t *src, uptr n) {}

INTERCEPTOR(char *, strdup, const char *S) {}

INTERCEPTOR(wchar_t *, wcsdup, const wchar_t *S) {}

INTERCEPTOR(char *, strndup, const char *S, uptr size) {}

INTERCEPTOR(char *, strcpy, char *dst, const char *src) {}

INTERCEPTOR(wchar_t *, wcscpy, wchar_t *dst, const wchar_t *src) {}

INTERCEPTOR(char *, strncpy, char *dst, const char *src, uptr size) {}

INTERCEPTOR(char *, strcat, char *dst, const char *src) {}

INTERCEPTOR(wchar_t *, wcscat, wchar_t *dst, const wchar_t *src) {}

INTERCEPTOR(char *, strncat, char *dst, const char *src, uptr size) {}

INTERCEPTOR(char *, stpcpy, char *dst, const char *src) {}

INTERCEPTOR(wchar_t *, wcpcpy, wchar_t *dst, const wchar_t *src) {}

INTERCEPTOR(uptr, strxfrm, char *dst, const char *src, uptr size) {}

extern "C" int pthread_attr_init(void *attr);
extern "C" int pthread_attr_destroy(void *attr);

static void *NsanThreadStartFunc(void *arg) {}

INTERCEPTOR(int, pthread_create, void *th, void *attr,
            void *(*callback)(void *), void *param) {}

void __nsan::InitializeInterceptors() {}