Hi Dan,

Thanks for your suggestion! I am not frequent user of dtrace. So I can rely on 
the C preprocessor and perform like C program. And I wonder if there is any 
solaris command to get such information. 

Thanks,

/Mitsu


-----Original Message-----
From: Dan McDonald [mailto:[EMAIL PROTECTED] 
Sent: den 11 november 2008 14:57
To: Mitsuhiro Nakamura
Cc: dtrace-discuss@opensolaris.org
Subject: Re: [dtrace-discuss] endianness

> Is it possible to get know endianness on the solaris target by using 
> dtrace?

My first suggestion would be to find a C preprocessor directive that'd tell you 
the answer.  Lacking that, you could do something like:

        #!/usr/sbin/dtrace -Cs

        /* Look for little-endian archs and set appropriately. */
        #ifdef i386
        #define LITTLE_ENDIAN
        #endif

        ::ip_input:entry
        {
        #ifdef LITTLE_ENDIAN
                printf("Little!\n");
        #else
                printf("Big!\n");
        #endif
                exit(0);
        }

Dan
_______________________________________________
dtrace-discuss mailing list
dtrace-discuss@opensolaris.org

Reply via email to