I can't find any info on what macro to use in an ifdef to determine the illumos kernel. I use __linux to catch Linux.
Filler for stackoverflow grammar check filler filler filler filler.
I can't find any info on what macro to use in an ifdef to determine the illumos kernel. I use __linux to catch Linux.
Filler for stackoverflow grammar check filler filler filler filler.
SmartOS 和 OpenIndiana 等基于 Illumos 的内核使用__sun
,有时建议同时检查__sun
和__SVR4
.
[root@mysmartostestzone ~]# uname -a
SunOS mysmartostestzone 5.11 joyent_20170202T033902Z i86pc i386 i86pc Solaris
[root@mysmartostestzone ~]# cat test.c
#include <stdio.h>
int
main(int argc, char **argv)
{
#ifdef sun
printf("sun\n");
#endif
#ifdef __sun
printf("__sun\n");
#endif
#if defined(__sun) && defined(__SVR4)
printf("__sun && __SVR4\n");
#endif
}
[root@mysmartostestzone ~]# cc test.c
[root@mysmartostestzone ~]# ./a.out
sun
__sun
__sun && __SVR4