Files
clang-p2996/compiler-rt/test/msan/getutent.cc
Kamil Rytarowski 3d7fbb052f Adding Msan support to FreeBSD
Summary:
Enabling the memory sanitizer support for FreeBSD, most of unit tests are compatible.
- Adding fstat and stressor_r interceptors.
- Updating the struct link_map access since most likely the struct Obj_Entry had been updated since.
- Disabling few unit tests until further work is needed (or we can assume it can work in real world code).

Patch by: David CARLIER

Reviewers: vitalybuka, krytarowski

Reviewed By: vitalybuka

Subscribers: eugenis, dim, srhines, emaste, kubamracek, mgorny, fedor.sergeev, hintonda, llvm-commits, #sanitizers

Differential Revision: https://reviews.llvm.org/D43080

llvm-svn: 326644
2018-03-03 11:43:11 +00:00

22 lines
449 B
C++

// RUN: %clangxx_msan -O0 -g %s -o %t && %run %t
#ifndef __FreeBSD__
#include <utmp.h>
#endif
#include <utmpx.h>
#include <sanitizer/msan_interface.h>
int main(void) {
#ifndef __FreeBSD__
setutent();
while (struct utmp *ut = getutent())
__msan_check_mem_is_initialized(ut, sizeof(*ut));
endutent();
#endif
setutxent();
while (struct utmpx *utx = getutxent())
__msan_check_mem_is_initialized(utx, sizeof(*utx));
endutxent();
}