您的位置:首页 > 其它

操作系统宏定义

2015-06-12 11:29 295 查看
http://sourceforge.net/p/predef/wiki/OperatingSystems/

收藏一下


AIX

TypeMacroDescription
Identification
_AIX
Version
_AIX'VR'
V = Version

R = Revision
Identification
__TOS_AIX__
Defined by xlC

Example


If
_AIX
is defined, then the following macros can be used to determine the version. Notice that the macros
indicates the mentioned version or higher. For example, if
_AIX43
is defined, then
_AIX41
will
also be defined.
AIX VersionMacro
3.2.x
_AIX3


_AIX32
4.1
_AIX41
4.3
_AIX43


Android

TypeMacroFormatDescription
Identification
__ANDROID__
Version
__ANDROID_API__
VV = API Version

Must be included from
<android/api-level.h>
Notice that Android is based on Linux, and that the Linux macros also are defined for Android.

Example

Android Version
__ANDROID_API__
1.01
1.12
1.53
1.64
2.05
2.0.16
2.17
2.28
2.39
2.3.310
3.011


Amdahl UTS

TypeMacro
Identification
UTS


AmigaOS

TypeMacroDescription
Identification
AMIGA
Identification
__amigaos__
Defined by GNU C


Apollo AEGIS

TypeMacro
Identification
aegis


Apollo Domain/OS

TypeMacro
Identification
apollo


Bada

Based on Nucleus OS.


BeOS

TypeMacro
Identification
__BEOS__


Blue Gene

TypeMacroDescription
Identification
__bg__
All Blue Gene systems

Defined by XL C/C++ and GNU C
Version
__bgq__
Blue Gene/Q

Defined for XL C/C++ and GNU C
Identification
__THW_BLUEGENE__
All Blue Gene systems

Defined by XL C/C++
Version
__TOS_BGQ__
Blue Gene/Q

Defined by XL C/C++


BSD Environment

TypeMacroFormatDescription
Identification
__FreeBSD__


__NetBSD__


__OpenBSD__


__bsdi__


__DragonFly__
Version
BSD
YYYYMMYYYY = Year

MM = Month

Must be included from
<sys/param.h>
Version
BSD4_2


BSD4_3


BSD4_4
Must be included from
<sys/param.h>
Identification
_SYSTYPE_BSD
Defined by DEC C

Example

Version
BSD
Macro
4.3 Net2199103
4.4199306
BSD4_4
4.4BSD-Lite2199506


BSD/OS

TypeMacro
Identification
__bsdi__


ConvexOS

TypeMacro
Identification
__convex__


Cygwin Environment

TypeMacro
Identification
__CYGWIN__


DG/UX

TypeMacro
Identification
DGUX
Identification
__DGUX__
Identification
__dgux__


DragonFly

TypeMacro
Identification
__DragonFly__


DYNIX/ptx

TypeMacro
Identification
_SEQUENT_
Identification
sequent


eCos

TypeMacro
Identification
__ECOS


EMX Environment

TypeMacro
Identification
__EMX__


FreeBSD

TypeMacroFormatDescription
Identification
__FreeBSD__
Identification
__FreeBSD_kernel__
From FreeBSD 8.3, 9.1, and 10.0.1
Version
BSD
Version
__FreeBSD__
VV = Version
Version
__FreeBSD_version
?Must be included from
<osreldate.h>

Example

FreeBSD
__FreeBSD__
__FreeBSD_version
1.x1
2.0-RELEASE2119411
2.2-RELEASE2220000
3.0-RELEASE3300005
4.0-RELEASE4400017
4.5-RELEASE4450000
For more information see the FreeBSD porters handbook.


GNU aka GNU/Hurd

The official name of this operating system is GNU. Hurd is the kernel in the GNU operating system. It is often listed as GNU/Hurd since there is also GNU/Linux and GNU/kFreeBSD, which are most of the GNU operating system with the Linux and FreeBSD kernels respectively.
TypeMacro
Identification
__GNU__
1
Identification
__gnu_hurd__
1


GNU/kFreeBSD

GNU/kFreeBSD is one of the Debian distros that is based on the FreeBSD kernel rather than the Linux or Hurd kernels.
TypeMacro
Identification
__FreeBSD_kernel__
&&
__GLIBC__
Notice that FreeBSD also defines
__FreeBSD_kernel__
so the
__GLIBC__
macro
must be checked to distinguish it.


GNU/Linux

TypeMacro
Identification
__gnu_linux__


HI-UX MPP

TypeMacro
Identification
__hiuxmpp


HP-UX

TypeMacroDescription
Identification
_hpux
Defined by HP UPC
Identification
hpux
Identification
__hpux


IBM OS/400

TypeMacro
Identification
__OS400__


INTEGRITY

TypeMacro
Identification
__INTEGRITY


Interix Environment

TypeMacroDescription
Identification
__INTERIX
Defined by GNU C and Visual Studio


IRIX

TypeMacro
Identification
sgi
Identification
__sgi


Linux kernel

Systems based on the Linux kernel define these macros. There are two major Linux-based operating systems: GNU/Linuxand Android,
and numerous others like Ångström or OpenEmbedded
TypeMacroDescription
Identification
__linux__
1
Identification
linux
Obsolete (not POSIX compliant)
Identification
__linux
Obsolete (not POSIX compliant)


LynxOS

TypeMacro
Identification
__Lynx__


MacOS

TypeMacroDescription
Identification
macintosh
Mac OS 9
Identification
Macintosh
Mac OS 9
Identification
__APPLE__
&&
__MACH__
Mac OS X

Defined by GNU C and Intel C++


Microware OS-9

TypeMacroDescription
Identification
__OS9000
Defined by Ultimate C/C++
Identification
_OSK
Defined by Ultimate C/C++


MINIX

TypeMacro
Identification
__minix


MorphOS

TypeMacro
Identification
__MORPHOS__


MPE/iX

TypeMacro
Identification
mpeix
Identification
__mpexl


MSDOS

TypeMacro
Identification
MSDOS
Identification
__MSDOS__
Identification
_MSDOS
Identification
__DOS__


NetBSD

TypeMacroFormatDescription
Identification
__NetBSD__
Version
BSD
Version
NetBSD'V'_'R'
V = Version

R = Revision

Must be included from
<sys/param.h>
Version
__NetBSD_Version__
VVRRAAPP00VV = Version

RR = Revision

AA = Release

PP = Patch

From NetBSD 1.2D (?) until NetBSD 2.0H

Must be included from
<sys/param.h>
Version
__NetBSD_Version__
VVRR00PP00VV = Version

RR = Revision

PP = Patch

From NetBSD 2.99.9

Must be included from
<sys/param.h>

Example

NetBSD
__NetBSD_Version__
Macro
0.8
NetBSD0_8
0.9
NetBSD0_9
1.0
NetBSD1_0
= 1
1.0A
NetBSD1_0
= 2
1.2D102040000
1.2.1102000100


NonStop

TypeMacro
Identification
__TANDEM


Nucleus RTOS

TypeMacro
Identification
__nucleus__


OpenBSD

TypeMacroFormatDescription
Identification
__OpenBSD__
Version
BSD
Version
OpenBSD'V'_'R'
V = Version

R = Revision

Must be included from
<sys/param.h>

Example

OpenBSDMacro
3.1
OpenBSD3_1
3.9
OpenBSD3_9


OS/2

TypeMacro
Identification
OS2
Identification
_OS2
Identification
__OS2__
Identification
__TOS_OS2__


Palm OS

TypeMacroDescription
Identification
__palmos__
Defined by GNU C in PRC-Tools


Plan 9

TypeMacro
Identification
EPLAN9


Pyramid DC/OSx

TypeMacro
Identification
pyr


QNX

TypeMacroFormatDescription
Identification
__QNX__
QNX 4.x
Identification
__QNXNTO__
QNX 6.x
Version
_NTO_VERSION
VRRV = Version

RR = Revision

Only available when
__QNXNTO__
is defined.

Must be included from
<sys/neutrino.h>
Version
BBNDK_VERSION_CURRENT
VVRRRRPPPPV = Version

RRRR = Revision

PPPP = Patch

Only available on Blackberry 10

From Blackberry 10.1.0

Must be included from
<bbndk.h>

Example

QNX
_NTO_VERSION
6.2620


Reliant UNIX

TypeMacro
Identification
sinux


SCO OpenServer

TypeMacroDescription
Identification
M_I386
Defined by GNU C
Identification
M_XENIX
Defined by GNU C
Identification
_SCO_DS


Solaris

TypeMacroDescription
Identification
sun
Identification
__sun
Version
__'System'_'Version'
System =
uname -s


Version =
uname -r


Any illegal character is replaced by an underscore.

Defined by Sun Studio
Use the SVR4 macros to distinguish between Solaris and SunOS.

#if defined(sun) || defined(__sun)
# if defined(__SVR4) || defined(__svr4__)
/* Solaris */
# else
/* SunOS */
# endif
#endif



Example

SolarisMacro
2.7
__SunOS_5_7
8
__SunOS_5_8


Stratus VOS

TypeMacroFormatDescription
Identification
__VOS__
Version
__VOS__
VV = Version
Notice that the
__VOS__
macro is defined by the compiler, but as several compilers can co-exist in the same
OS release, the version number is not reliable.


SVR4 Environment

TypeMacroDescription
Identification
__sysv__
Identification
__SVR4
Identification
__svr4__
Identification
_SYSTYPE_SVR4
Defined on IRIX


Syllable

TypeMacro
Identification
__SYLLABLE__


Symbian OS

TypeMacro
Identification
__SYMBIAN32__


Tru64 (OSF/1)

TypeMacro
Identification
__osf__
Identification
__osf


Ultrix

TypeMacro
Identification
ultrix
Identification
__ultrix
Identification
__ultrix__
Identification
unix
&
vax


UNICOS

TypeMacroFormatDescription
Identification
_UNICOS
Version
_UNICOS
VV = Version


UNICOS/mp

TypeMacroDescription
Identification
_CRAY


__crayx1


UNIX Environment

TypeMacro
Identification
__unix__
Identification
__unix
Notice that not all compilers defines these macros, e.g. the xlC or the DEC C/C++ compiler, so it may be better to use the POSIX or X/Open standard macros instead.


UnixWare

TypeMacro
Identification
sco
Identification
_UNIXWARE7


U/Win Environment

TypeMacro
Identification
_UWIN


VMS

TypeMacroFormatDescription
Identification
VMS
Identification
__VMS
Version
__VMS_VER
VVRREPPTTVV = Version

RR = Revision

E = Edit number

PP = Patch (01 = A, ... 26 = Z)

TT = Type (22 = official)

Example

VMS
__VMS_VER
6.160100022
6.260200022
6.2-1I60210922


VxWorks

TypeMacroDescription
Identification
__VXWORKS__
Defined by GNU C and Diab (from ?)
Identification
__vxworks
Defined by GNU C and Diab (from ?)
Version
_WRS_VXWORKS_MAJOR
Version

Must be included from
<version.h>
Version
_WRS_VXWORKS_MINOR
Revision

Must be included from
<version.h>
Version
_WRS_VXWORKS_MAINT
Patch/maintenance

Must be included from
<version.h>
Mode
__RTP__
For real-time mode
Mode
_WRS_KERNEL
For kernel mode

Example

VxWorks
_WRS_VXWORKS_MAJOR
_WRS_VXWORKS_MINOR
_WRS_VXWORKS_MAINT
6.2620


Windows

TypeMacroDescription
Identification
_WIN16
Defined for 16-bit environments 1
Identification
_WIN32
Defined for both 32-bit and 64-bit environments 1
Identification
_WIN64
Defined for 64-bit environments 1
Identification
__WIN32__
Defined by Borland C++
Identification
__TOS_WIN__
Defined by xlC
Identification
__WINDOWS__
Defined by Watcom C/C++


Windows CE

TypeMacroFormatDescription
Identification
_WIN32_WCE
Defined by Embedded Visual Studio C++
Version
_WIN32_WCE
VRRV = Version

R = Revision
Identification
WIN32_PLATFORM_'P'
P = Platform
Version
WIN32_PLATFORM_'P'
VP = Platform

V = Version

Example

Version
_WIN32_WCE
2.01201
2.11211
3.0300
4.0400
4.1410
4.2420
5.0501
PlatformMacroValue
H/PC 2000
WIN32_PLATFORM_HPC2000
H/PC Pro 2.11
WIN32_PLATFORM_HPCPRO
211
H/PC Pro 3.0
WIN32_PLATFORM_HPCPRO
300
Pocket PC
WIN32_PLATFORM_PSPC
1
Pocket PC 2002
WIN32_PLATFORM_PSPC
310
Windows Mobile 2003
WIN32_PLATFORM_PSPC
400
Smartphone 2002
WIN32_PLATFORM_WFSP
100


Wind/U Environment

TypeMacroFormatDescription
Identification
_WINDU_SOURCE
Version
_WINDU_SOURCE
0xVVRRPPVV = Version

RR = Revision

PP = Patch

Example

Wind/U
_WINDU_SOURCE
3.1.20x030102


z/OS

TypeMacroDescription
Identification
__MVS__
Host
Identification
__HOS_MVS__
Host
Identification
__TOS_MVS__
Target

内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: