FreeBSD/Linux Kernel Cross Reference
sys/sys/_clock_id.h
1 /*-
2 * SPDX-License-Identifier: BSD-2-Clause
3 *
4 * Copyright (c) 2021 Netflix, Inc.
5 *
6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions
8 * are met:
9 * 1. Redistributions of source code must retain the above copyright
10 * notice, this list of conditions and the following disclaimer.
11 * 2. Redistributions in binary form must reproduce the above copyright
12 * notice, this list of conditions and the following disclaimer in the
13 * documentation and/or other materials provided with the distribution.
14 *
15 * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
16 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
17 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
18 * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
19 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
20 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
21 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
22 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
23 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
24 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
25 * SUCH DAMAGE.
26 */
27
28 #ifndef _SYS_SYS__CLOCK_ID_H
29 #define _SYS_SYS__CLOCK_ID_H
30
31 /*
32 * These macros are shared between time.h and sys/time.h.
33 */
34
35 /*
36 * Note: The values shown below as a comment for the __POSIX_VISIBLE values are
37 * the ones FreeBSD traditionally used based on our reading of the POSIX
38 * standards. However, glibc uses 199309 for all of them, even those many were
39 * not defined there. To remain bug compatible with glibc means more software
40 * that relied on the glibc behavior will compile easily on FreeBSD.
41 *
42 * Also, CLOCK_UPTIME_FAST is improperly visible temporarily for the lang/pocl
43 * port until it can be updated properly. It incorrectly assumes that this was a
44 * standard value. It will be moved back to the __BSD_VISIBLE section once the
45 * issue is corrected.
46 */
47
48 #if __POSIX_VISIBLE >= 199309 /* 199506 */
49 #define CLOCK_REALTIME 0
50 #endif /* __POSIX_VISIBLE >= 199309 */
51 #ifdef __BSD_VISIBLE
52 #define CLOCK_VIRTUAL 1
53 #define CLOCK_PROF 2
54 #endif /* __BSD_VISIBLE */
55 #if __POSIX_VISIBLE >= 199309 /* 200112 */
56 #define CLOCK_MONOTONIC 4
57 #define CLOCK_UPTIME_FAST 8
58 #endif /* __POSIX_VISIBLE >= 199309 */
59 #ifdef __BSD_VISIBLE
60 /*
61 * FreeBSD-specific clocks.
62 */
63 #define CLOCK_UPTIME 5
64 #define CLOCK_UPTIME_PRECISE 7
65 #define CLOCK_REALTIME_PRECISE 9
66 #define CLOCK_REALTIME_FAST 10
67 #define CLOCK_MONOTONIC_PRECISE 11
68 #define CLOCK_MONOTONIC_FAST 12
69 #define CLOCK_SECOND 13
70 #endif /* __BSD_VISIBLE */
71
72 #if __POSIX_VISIBLE >= 199309 /* 200112 */
73 #define CLOCK_THREAD_CPUTIME_ID 14
74 #define CLOCK_PROCESS_CPUTIME_ID 15
75 #endif /* __POSIX_VISIBLE >= 199309 */
76
77 /*
78 * Linux compatible names.
79 */
80 #if __BSD_VISIBLE
81 #define CLOCK_BOOTTIME CLOCK_UPTIME
82 #define CLOCK_REALTIME_COARSE CLOCK_REALTIME_FAST
83 #define CLOCK_MONOTONIC_COARSE CLOCK_MONOTONIC_FAST
84 #endif
85
86 #if __BSD_VISIBLE
87 #define TIMER_RELTIME 0x0 /* relative timer */
88 #endif
89 #if __POSIX_VISIBLE >= 199309
90 #define TIMER_ABSTIME 0x1 /* absolute timer */
91 #endif /* __POSIX_VISIBLE >= 199309 */
92
93 #endif /* _SYS_SYS__CLOCK_ID_H */
Cache object: d0a655ed16aaeb587696ba49f0cec26f
|