ESBMC
Efficient SMT-based Context-Bounded Model Checker
Loading...
Searching...
No Matches
posix_features.hpp
Go to the documentation of this file.
1// (C) Copyright John Maddock 2001 - 2003.
2// Use, modification and distribution are subject to the
3// Boost Software License, Version 1.0. (See accompanying file
4// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
5
6// See http://www.boost.org for most recent version.
7
8// All POSIX feature tests go in this file,
9// Note that we test _POSIX_C_SOURCE and _XOPEN_SOURCE as well
10// _POSIX_VERSION and _XOPEN_VERSION: on some systems POSIX API's
11// may be present but none-functional unless _POSIX_C_SOURCE and
12// _XOPEN_SOURCE have been defined to the right value (it's up
13// to the user to do this *before* including any header, although
14// in most cases the compiler will do this for you).
15
16#if defined(BOOST_HAS_UNISTD_H)
17# include <unistd.h>
18
19// XOpen has <nl_types.h>, but is this the correct version check?
20# if defined(_XOPEN_VERSION) && (_XOPEN_VERSION >= 3)
21# define BOOST_HAS_NL_TYPES_H
22# endif
23
24// POSIX version 6 requires <stdint.h>
25# if defined(_POSIX_VERSION) && (_POSIX_VERSION >= 200100)
26# define BOOST_HAS_STDINT_H
27# endif
28
29// POSIX version 2 requires <dirent.h>
30# if defined(_POSIX_VERSION) && (_POSIX_VERSION >= 199009L)
31# define BOOST_HAS_DIRENT_H
32# endif
33
34// POSIX version 3 requires <signal.h> to have sigaction:
35# if defined(_POSIX_VERSION) && (_POSIX_VERSION >= 199506L)
36# define BOOST_HAS_SIGACTION
37# endif
38// POSIX defines _POSIX_THREADS > 0 for pthread support,
39// however some platforms define _POSIX_THREADS without
40// a value, hence the (_POSIX_THREADS+0 >= 0) check.
41// Strictly speaking this may catch platforms with a
42// non-functioning stub <pthreads.h>, but such occurrences should
43// occur very rarely if at all.
44# if defined(_POSIX_THREADS) && (_POSIX_THREADS + 0 >= 0) && \
45 !defined(BOOST_HAS_WINTHREADS) && !defined(BOOST_HAS_MPTASKS)
46# define BOOST_HAS_PTHREADS
47# endif
48
49// BOOST_HAS_NANOSLEEP:
50// This is predicated on _POSIX_TIMERS or _XOPEN_REALTIME:
51# if (defined(_POSIX_TIMERS) && (_POSIX_TIMERS + 0 >= 0)) || \
52 (defined(_XOPEN_REALTIME) && (_XOPEN_REALTIME + 0 >= 0))
53# define BOOST_HAS_NANOSLEEP
54# endif
55
56// BOOST_HAS_CLOCK_GETTIME:
57// This is predicated on _POSIX_TIMERS (also on _XOPEN_REALTIME
58// but at least one platform - linux - defines that flag without
59// defining clock_gettime):
60# if (defined(_POSIX_TIMERS) && (_POSIX_TIMERS + 0 >= 0))
61# define BOOST_HAS_CLOCK_GETTIME
62# endif
63
64// BOOST_HAS_SCHED_YIELD:
65// This is predicated on _POSIX_PRIORITY_SCHEDULING or
66// on _POSIX_THREAD_PRIORITY_SCHEDULING or on _XOPEN_REALTIME.
67# if defined(_POSIX_PRIORITY_SCHEDULING) && \
68 (_POSIX_PRIORITY_SCHEDULING + 0 > 0) || \
69 (defined(_POSIX_THREAD_PRIORITY_SCHEDULING) && \
70 (_POSIX_THREAD_PRIORITY_SCHEDULING + 0 > 0)) || \
71 (defined(_XOPEN_REALTIME) && (_XOPEN_REALTIME + 0 >= 0))
72# define BOOST_HAS_SCHED_YIELD
73# endif
74
75// BOOST_HAS_GETTIMEOFDAY:
76// BOOST_HAS_PTHREAD_MUTEXATTR_SETTYPE:
77// These are predicated on _XOPEN_VERSION, and appears to be first released
78// in issue 4, version 2 (_XOPEN_VERSION > 500).
79// Likewise for the functions log1p and expm1.
80# if defined(_XOPEN_VERSION) && (_XOPEN_VERSION + 0 >= 500)
81# define BOOST_HAS_GETTIMEOFDAY
82# if defined(_XOPEN_SOURCE) && (_XOPEN_SOURCE + 0 >= 500)
83# define BOOST_HAS_PTHREAD_MUTEXATTR_SETTYPE
84# endif
85# ifndef BOOST_HAS_LOG1P
86# define BOOST_HAS_LOG1P
87# endif
88# ifndef BOOST_HAS_EXPM1
89# define BOOST_HAS_EXPM1
90# endif
91# endif
92
93#endif