Android-cuttlefish cvd tool
vm_sockets.h
Go to the documentation of this file.
1/*
2 * Copyright (C) 2025 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#pragma once
17
18#include <sys/socket.h> // IWYU pragma: keep
19
20#ifdef __linux__
21// Must be included after <sys/socket.h> to support older libc.
22#include <linux/vm_sockets.h> // IWYU pragma: export
23#elif defined(__APPLE__)
24#include <sys/vsock.h> // IWYU pragma: export
25#endif
26
27#ifndef VMADDR_CID_ANY
28#define VMADDR_CID_ANY (-1U)
29#endif
30#ifndef VMADDR_PORT_ANY
31#define VMADDR_PORT_ANY (-1U)
32#endif
33#ifndef VMADDR_CID_HYPERVISOR
34#define VMADDR_CID_HYPERVISOR 0U
35#endif
36#ifndef VMADDR_CID_LOCAL
37#define VMADDR_CID_LOCAL 1U
38#endif
39#ifndef VMADDR_CID_HOST
40#define VMADDR_CID_HOST 2U
41#endif