Support slim switch for cfg graph dump
[official-gcc.git] / libsanitizer / sanitizer_common / sanitizer_platform_limits_posix.cc
blobc4be1aa42da0c9361665f210666815b6094a22cc
1 //===-- sanitizer_platform_limits_posix.cc --------------------------------===//
2 //
3 // This file is distributed under the University of Illinois Open Source
4 // License. See LICENSE.TXT for details.
5 //
6 //===----------------------------------------------------------------------===//
7 //
8 // This file is a part of Sanitizer common code.
9 //
10 // Sizes and layouts of platform-specific POSIX data structures.
11 //===----------------------------------------------------------------------===//
13 #if defined(__linux__) || defined(__APPLE__)
15 #include "sanitizer_internal_defs.h"
16 #include "sanitizer_platform_limits_posix.h"
18 #include <dirent.h>
19 #include <sys/utsname.h>
20 #include <sys/types.h>
21 #include <sys/stat.h>
22 #include <sys/time.h>
23 #include <sys/resource.h>
24 #include <sys/socket.h>
25 #include <time.h>
27 #if defined(__linux__)
28 #include <sys/vfs.h>
29 #include <sys/epoll.h>
30 #endif // __linux__
32 namespace __sanitizer {
33 unsigned struct_utsname_sz = sizeof(struct utsname);
34 unsigned struct_stat_sz = sizeof(struct stat);
35 unsigned struct_stat64_sz = sizeof(struct stat64);
36 unsigned struct_rusage_sz = sizeof(struct rusage);
37 unsigned struct_tm_sz = sizeof(struct tm);
39 #if defined(__linux__)
40 unsigned struct_rlimit_sz = sizeof(struct rlimit);
41 unsigned struct_dirent_sz = sizeof(struct dirent);
42 unsigned struct_statfs_sz = sizeof(struct statfs);
43 unsigned struct_epoll_event_sz = sizeof(struct epoll_event);
44 #endif // __linux__
46 #if defined(__linux__) && !defined(__ANDROID__)
47 unsigned struct_rlimit64_sz = sizeof(struct rlimit64);
48 unsigned struct_statfs64_sz = sizeof(struct statfs64);
49 #endif // __linux__ && !__ANDROID__
51 void* __sanitizer_get_msghdr_iov_iov_base(void* msg, int idx) {
52 return ((struct msghdr *)msg)->msg_iov[idx].iov_base;
55 uptr __sanitizer_get_msghdr_iov_iov_len(void* msg, int idx) {
56 return ((struct msghdr *)msg)->msg_iov[idx].iov_len;
59 uptr __sanitizer_get_msghdr_iovlen(void* msg) {
60 return ((struct msghdr *)msg)->msg_iovlen;
63 uptr __sanitizer_get_socklen_t(void* socklen_ptr) {
64 return *(socklen_t*)socklen_ptr;
66 } // namespace __sanitizer
68 #endif // __linux__ || __APPLE__