Solaris 2.6 #define

Solaris 2.6 #define

Post by natar » Sat, 25 Oct 1997 04:00:00

   Is there a pre-defined #define
   which i can use to see which version of
   Solaris it is ??

   I cannot use __svr4__ or SOLARIS because
   i need to distinguish between two versions
   of Solaris (5.3 and 5.6)

   The solution i need are compile time flags (#ifdef..)
   not runtime.

   Any ideas  ??



Solaris 2.6 #define

Post by Paul Egge » Sat, 25 Oct 1997 04:00:00

>   Is there a pre-defined #define
>   which i can use to see which version of
>   Solaris it is ??

No (thank goodness).

If you want brain damage like that,
compile with -DSOLARIS_VERSION="\"`uname -r`\"".

But really, you should be testing based on whatever feature you want to use,
and not be writing awful code that looks at the Solaris version.  For
example, if you want to use fseeko (new to Solaris 2.6), you should
#ifdef it with HAVE_FSEEKO (if you use autoconf) or perhaps with
_LARGEFILE_SOURCE (if you believe in the Large File Spec);
don't use something ugly and incorrect like


1. Why are lots of typedefs not defined unless __STDC__ == 0 on Solaris 2.6?

I've been working on a program to display process trees dynamically to
work non-suid for Solaris 2.6 and up. I've been getting compiler
errors with egcs (the only compiler I have and have tried) because
lots of typedefs are missing such as for sigset_t and uint64_t (used
by "sys/procfs.h").

In /usr/include/sys/int_types.h we have
#if __STDC__ - 0 == 0 && !defined(_NO_LONGLONG)
typedef unsigned long long      uint64_t;

Looking at /usr/include/sys/signal.h we have:

#if defined(__EXTENSIONS__) || (__STDC__ - 0 == 0) || ...

Actually, the C-Preprocssor logic for sigset_t in sys/signal.h is
so complicated that I really have a hard time pinpointing why it is
not defined, other than knowing that you can #define __EXTENSIONS__ or
#define __STDC__ 0 and that will work.

Anyway, the question is what are the various meanings of the values of
__STDC__? Is this documented somewhere?

2. Newbie can't get to dollar prompt

3. Defining a gateway under Solaris 2.6 (Intel)

4. Automatic password Generation!

5. can't read Solaris 2.6 x86 hard disk on Solaris 2.6 Ultra-1 ?!?

6. Sco Open Server 5.2 and Internet

7. Upgrade from Solaris 2.6 with Volume Manager 2.6 to Solaris 8 with Volume Manager 3.2

8. Cann't add users. (fwd)

9. gcc #define #define #define

10. Why are lots of typedefs not defined unless __STDC__ == 0 on 2.6?

11. SambaTNG 2.6 Alpha: How Do I Define a User

12. SC 5.0 / sol 2.6 - multiple defines in sys includes

13. SunOS 5.6 vs Solaris 2.6 vs Solaris 7 vs Solaris 8