]> git.saurik.com Git - apple/libc.git/blame_incremental - os/api.h
Libc-1353.11.2.tar.gz
[apple/libc.git] / os / api.h
... / ...
CommitLineData
1/*
2 * Copyright (c) 2018 Apple Inc. All rights reserved.
3 *
4 * @APPLE_LICENSE_HEADER_START@
5 *
6 * This file contains Original Code and/or Modifications of Original Code
7 * as defined in and that are subject to the Apple Public Source License
8 * Version 2.0 (the 'License'). You may not use this file except in
9 * compliance with the License. Please obtain a copy of the License at
10 * http://www.opensource.apple.com/apsl/ and read it before using this
11 * file.
12 *
13 * The Original Code and all software distributed under the License are
14 * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
15 * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
16 * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
17 * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
18 * Please see the License for the specific language governing rights and
19 * limitations under the License.
20 *
21 * @APPLE_LICENSE_HEADER_END@
22 */
23
24/*!
25 * @header
26 * API macros. libdarwin provides APIs for low-level userspace projects in the
27 * Darwin operating system.
28 *
29 * - C language additions
30 * - POSIX and BSD API additions
31 * - POSIX and BSD convenience wrappers
32 * - Mach API additions and wrappers with clearer semantics
33 *
34 * Additions which extend the C language are not prefixed and are therefore not
35 * included by default when including this header.
36 *
37 * Additions to API families conforming to ANSI C carry the "os_" prefix.
38 *
39 * Additions to API families conforming to POSIX carry the "_np" ("Not POSIX")
40 * suffix.
41 *
42 * Additions to API families conforming to both POSIX and ANSI C carry the "_np"
43 * suffix.
44 *
45 * Convenience wrappers for POSIX and BSD APIs carry the "os_" prefix.
46 *
47 * New APIs formalizing Darwin workflows carry the "os_" prefix.
48 */
49#ifndef __DARWIN_API_H
50#define __DARWIN_API_H
51
52#include <os/availability.h>
53#include <stdint.h>
54
55/*!
56 * @const DARWIN_API_VERSION
57 * The API version of the library. This version will be changed in accordance
58 * with new API introductions so that callers may submit code to the build that
59 * adopts those new APIs before the APIs land by using the following pattern:
60 *
61 * #if DARWIN_API_VERSION >= 20180424
62 * darwin_new_api();
63 * #endif
64 *
65 * In this example, the libdarwin maintainer and API adopter agree on an API
66 * version of 20180424 ahead of time for the introduction of
67 * darwin_new_api_call(). When a libdarwin with that API version is submitted,
68 * the project is rebuilt, and the new API becomes active.
69 *
70 * Breaking API changes will be both covered under this mechanism as well as
71 * individual preprocessor macros in this header that declare new behavior as
72 * required.
73 */
74#define DARWIN_API_VERSION 20181020u
75
76#if !DARWIN_BUILDING_LIBSYSTEM_DARWIN
77#define DARWIN_API_AVAILABLE_20170407 \
78 API_AVAILABLE(macos(10.14), ios(12.0), tvos(12.0), watchos(5.0))
79#define DARWIN_API_AVAILABLE_20180727 \
80 API_AVAILABLE(macos(10.15), ios(13.0), tvos(13.0), watchos(6.0))
81#define DARWIN_API_AVAILABLE_20181020 \
82 API_AVAILABLE(macos(10.15), ios(13.0), tvos(13.0), watchos(6.0))
83#else
84#define DARWIN_API_AVAILABLE_20170407
85#define DARWIN_API_AVAILABLE_20180727
86#define DARWIN_API_AVAILABLE_20181020
87#endif
88
89/*!
90 * @typedef os_struct_magic_t
91 * A type representing the magic number of a transparent structure.
92 */
93typedef uint32_t os_struct_magic_t;
94
95/*!
96 * @typedef os_struct_version_t
97 * A type representing the version of a transparent structure.
98 */
99typedef uint32_t os_struct_version_t;
100
101#endif // __DARWIN_API_H