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.
Illumos based kernels such as SmartOS and OpenIndiana use __sun
and it is sometimes suggested to check for both __sun
and __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
Update:
There will soon be an __illumos__
macro:
https://www.illumos.org/issues/13726