Android-cuttlefish cvd tool
cdefs.h
Go to the documentation of this file.
1/*
2 * Copyright (C) 2026 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/* <sys/cdefs.h> is a glibc-internal header that apps shouldn't use, but
18 * unfortunately android_system_logging does. to enable compilation with
19 * musl, redefine only the macros used here. Probe for the host's header
20 * rather than assume that !glibc means musl.
21 */
22#if __has_include_next(<sys/cdefs.h>)
23# include_next <sys/cdefs.h>
24#else
25# ifdef __cplusplus
26# define __BEGIN_DECLS extern "C" {
27# define __END_DECLS }
28# else
29# define __BEGIN_DECLS
30# define __END_DECLS
31# endif
32#endif
33/* This is really from unistd.h, but overriding that header in
34 * android_system_logging has consequences for downstream, so do it here.
35 * Only glibc and bionic define it.
36 */
37#ifndef TEMP_FAILURE_RETRY
38# define TEMP_FAILURE_RETRY(expression) \
39 (__extension__ \
40 ({ long int __result; \
41 do __result = (long int) (expression); \
42 while (__result == -1L && errno == EINTR); \
43 __result; }))
44#endif