blob: 18147daf80722f99aad19913c22abf0610455446 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
|
//===-- sanitizer_platform_limits_linux.cc --------------------------------===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
//
// This file is a part of Sanitizer common code.
//
// Sizes and layouts of linux kernel data structures.
//===----------------------------------------------------------------------===//
// This is a separate compilation unit for linux headers that conflict with
// userspace headers.
// Most "normal" includes go in sanitizer_platform_limits_posix.cc
#include "sanitizer_platform.h"
#if SANITIZER_LINUX
#include "sanitizer_internal_defs.h"
#include "sanitizer_platform_limits_posix.h"
// For offsetof -> __builtin_offsetof definition.
#include <stddef.h>
// This header seems to contain the definitions of _kernel_ stat* structs.
#include <asm/stat.h>
#include <linux/aio_abi.h>
#if SANITIZER_ANDROID
#include <asm/statfs.h>
#else
#include <sys/statfs.h>
#endif
#if !SANITIZER_ANDROID
#include <linux/perf_event.h>
#endif
namespace __sanitizer {
unsigned struct___old_kernel_stat_sz = sizeof(struct __old_kernel_stat);
unsigned struct_kernel_stat_sz = sizeof(struct stat);
unsigned struct_io_event_sz = sizeof(struct io_event);
unsigned struct_statfs64_sz = sizeof(struct statfs64);
unsigned iocb_cmd_pread = IOCB_CMD_PREAD;
unsigned iocb_cmd_pwrite = IOCB_CMD_PWRITE;
#if !defined(_LP64) && !defined(__x86_64__)
unsigned struct_kernel_stat64_sz = sizeof(struct stat64);
#else
unsigned struct_kernel_stat64_sz = 0;
#endif
#if !SANITIZER_ANDROID
unsigned struct_perf_event_attr_sz = sizeof(struct perf_event_attr);
#endif
} // namespace __sanitizer
CHECK_TYPE_SIZE(iocb);
CHECK_SIZE_AND_OFFSET(iocb, aio_data);
// Skip aio_key, it's weird.
CHECK_SIZE_AND_OFFSET(iocb, aio_lio_opcode);
CHECK_SIZE_AND_OFFSET(iocb, aio_reqprio);
CHECK_SIZE_AND_OFFSET(iocb, aio_fildes);
CHECK_SIZE_AND_OFFSET(iocb, aio_buf);
CHECK_SIZE_AND_OFFSET(iocb, aio_nbytes);
CHECK_SIZE_AND_OFFSET(iocb, aio_offset);
#endif // SANITIZER_LINUX
|