• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (C) 2022 The Android Open Source Project
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  *      http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16 
17 #ifndef INCLUDE_PERFETTO_EXT_BASE_SYS_TYPES_H_
18 #define INCLUDE_PERFETTO_EXT_BASE_SYS_TYPES_H_
19 
20 // This headers deals with sys types commonly used in the codebase that are
21 // missing on Windows.
22 
23 #include <sys/types.h>
24 
25 #include "perfetto/base/build_config.h"
26 
27 #if PERFETTO_BUILDFLAG(PERFETTO_OS_WIN)
28 
29 #if !PERFETTO_BUILDFLAG(PERFETTO_COMPILER_GCC)
30 // MinGW has these. clang-cl and MSVC, which use just the Windows SDK, don't.
31 using uid_t = unsigned int;
32 using pid_t = int;
33 #endif  // !GCC
34 
35 #if defined(_WIN64)
36 using ssize_t = int64_t;
37 #else
38 using ssize_t = long;
39 #endif  // _WIN64
40 
41 #endif  // OS_WIN
42 
43 namespace perfetto {
44 namespace base {
45 
46 constexpr uid_t kInvalidUid = static_cast<uid_t>(-1);
47 constexpr pid_t kInvalidPid = static_cast<pid_t>(-1);
48 
49 }  // namespace base
50 }  // namespace perfetto
51 
52 #endif  // INCLUDE_PERFETTO_EXT_BASE_SYS_TYPES_H_
53