1292928Sdim//===----------------------- config_elast.h -------------------------------===//
2292928Sdim//
3353358Sdim// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4353358Sdim// See https://llvm.org/LICENSE.txt for license information.
5353358Sdim// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6292928Sdim//
7292928Sdim//===----------------------------------------------------------------------===//
8292928Sdim
9292928Sdim#ifndef _LIBCPP_CONFIG_ELAST
10292928Sdim#define _LIBCPP_CONFIG_ELAST
11292928Sdim
12314564Sdim#include <__config>
13314564Sdim
14341825Sdim#if defined(_LIBCPP_MSVCRT_LIKE)
15292928Sdim#include <stdlib.h>
16292928Sdim#else
17292928Sdim#include <errno.h>
18292928Sdim#endif
19292928Sdim
20292928Sdim#if defined(ELAST)
21292928Sdim#define _LIBCPP_ELAST ELAST
22292928Sdim#elif defined(_NEWLIB_VERSION)
23292928Sdim#define _LIBCPP_ELAST __ELASTERROR
24314564Sdim#elif defined(__Fuchsia__)
25314564Sdim// No _LIBCPP_ELAST needed on Fuchsia
26353358Sdim#elif defined(__wasi__)
27353358Sdim// No _LIBCPP_ELAST needed on WASI
28327952Sdim#elif defined(__linux__) || defined(_LIBCPP_HAS_MUSL_LIBC)
29292928Sdim#define _LIBCPP_ELAST 4095
30292928Sdim#elif defined(__APPLE__)
31292928Sdim// No _LIBCPP_ELAST needed on Apple
32292928Sdim#elif defined(__sun__)
33292928Sdim#define _LIBCPP_ELAST ESTALE
34341825Sdim#elif defined(_LIBCPP_MSVCRT_LIKE)
35314564Sdim#define _LIBCPP_ELAST (_sys_nerr - 1)
36292928Sdim#else
37292928Sdim// Warn here so that the person doing the libcxx port has an easier time:
38292928Sdim#warning ELAST for this platform not yet implemented
39292928Sdim#endif
40292928Sdim
41292928Sdim#endif // _LIBCPP_CONFIG_ELAST
42