Core from top-3.3beta (compiled using gcc and solaris-2.4)

Core from top-3.3beta (compiled using gcc and solaris-2.4)

Post by Michael_Hueh » Tue, 07 Feb 1995 22:09:01



Hello out there,

I have a problem making top-3.3beta5 running under solaris-2.4. The
old binary from top-3.3beta4 from solaris-2.3 works. But I want to
know whats wrong with my environment.

My cc is a gcc-2.6.3. The includes are fixed and the compiler has been
build under solaris-2.4. My solaris-2.4 is the SMCC 11/95 version,
containing a lot of fixes:

ls /var/sadm/patch/

101753-01  101920-01  101969-04  101995-01  102024-01  102048-01  102134-01
101829-01  101921-04  101969-06  102001-03  102035-01  102049-01  102137-01
101878-01  101922-04  101973-03  102002-01  102036-01  102062-03  102138-01
101879-01  101923-03  101975-01  102002-02  102037-01  102066-02  102169-01
101880-03  101925-01  101977-03  102003-01  102038-01  102070-01  102216-01
101902-01  101933-01  101979-03  102007-01  102038-02  102079-01  102232-01
101905-01  101945-10  101981-01  102011-02  102039-01  102105-01
101907-02  101945-13  101983-01  102016-01  102042-01  102108-01
101907-03  101959-02  101985-01  102020-02  102044-01  102112-01

Here you can see a backtrace from gdb runing top:

/tmp/top-3.3.5 # gdb ./top
GDB is free software and you are welcome to distribute copies of it
 under certain conditions; type "show copying" to see the conditions.
There is absolutely no warranty for GDB; type "show warranty" for details.
GDB 4.13 (sparc-solaris2), Copyright 1994 Free Software Foundation, Inc...
(gdb) r
Starting program: /home/gnu/gcc/top-3.3.5/top

Program received signal SIGBUS, Bus error.
0x1a3ec in getptable (baseptr=0x429c8) at machine/m_sunos5.c:748
748               weighted_cpu (currproc) =
(gdb)
#0  0x1a3ec in getptable (baseptr=0x429c8) at machine/m_sunos5.c:748
#1  0x19940 in get_process_info (si=0xeffff4f8, sel=0xeffff488,
    compare=0x19eb0 <proc_compare>) at machine/m_sunos5.c:417
#2  0x13810 in main (argc=1, argv=0xeffff5a4) at top.c:483
(gdb)
(gdb) l
743
744           /* Otherwise, it's new, so use all of its CPU time */
745           if (op->oldpid == -1)
746             {
747     #ifdef SOLARIS24
748               weighted_cpu (currproc) =
749                 percent_cpu (currproc);
750     #else
751               if (lasttime.tv_sec)
752                 {
(gdb)

Could someone give a hint ?

--

 Friendly regards,
 mit freundlichen Gr|_en,

   Michael H|hne

      3-S GmbH



     |... My first unix was ...... ////..... a Microsoft Xenix 86 ...|
     |... Why does Microsoft ... 0(o o)0 ... develop a WINDOWS-NT ...|
     *-------- Michael -------oOO--(_)--OOo---------- H|hne ---------*
              CPU Cycles - Use them now or lose them forever

#include <disclaimer.h>

 
 
 

Core from top-3.3beta (compiled using gcc and solaris-2.4)

Post by Casper H.S. D » Tue, 07 Feb 1995 23:27:21



>Hello out there,
>I have a problem making top-3.3beta5 running under solaris-2.4. The
>old binary from top-3.3beta4 from solaris-2.3 works. But I want to
>know whats wrong with my environment.

The fix is to edit machine/m_sunos5.c around line 90:

It should look like:

#ifdef SOLARIS24
    /*
     * snarfed from <sys/procfs.h>:
     * The following percent numbers are 16-bit binary
     * fractions [0 .. 1] with the binary point to the
     * right of the high-order bit (one == 0x8000)
     */
#define percent_cpu(pp) (((double)pp->pr_pctcpu)/0x8000*100)
#define weighted_cpu(pp) (*(double *)&pp->pr_filler[1])          <- change this
#else
#define percent_cpu(pp) (*(double *)pp->pr_filler)
#define weighted_cpu(pp) (*(double *)&pp->pr_filler[2])
#endif

... two extra defines of percent_cpu/weighted_cpu should be deleted here ...

Casper

 
 
 

Core from top-3.3beta (compiled using gcc and solaris-2.4)

Post by Andreas Stolc » Wed, 08 Feb 1995 02:44:45




Quote:>#define percent_cpu(pp) (((double)pp->pr_pctcpu)/0x8000*100)
>#define weighted_cpu(pp) (*(double *)&pp->pr_filler[1])              <- change this
>#else
>#define percent_cpu(pp) (*(double *)pp->pr_filler)
>#define weighted_cpu(pp) (*(double *)&pp->pr_filler[2])
>#endif

Or, to take care of the alignment once and for all, you could use:

#define dbl_align(x)    (((unsigned long)(x)+(sizeof(double)-1)) & \
                                                ~(sizeof(double)-1))
#ifdef SOLARIS24
    /*
     * snarfed from <sys/procfs.h>:
     * The following percent numbers are 16-bit binary
     * fractions [0 .. 1] with the binary point to the
     * right of the high-order bit (one == 0x8000)
     */
#define percent_cpu(pp) (((double)pp->pr_pctcpu)/0x8000*100)
#define weighted_cpu(pp) (*(double *)dbl_align(pp->pr_filler))
#else
#define percent_cpu(pp) (*(double *)dbl_align(&pp->pr_filler[0]))
#define weighted_cpu(pp) (*(double *)dbl_align(&pp->pr_filler[2]))
#endif

--


1947 Center St., Suite 600, Berkeley, CA 94704  (510) 642-4274 ext. 126

 
 
 

Core from top-3.3beta (compiled using gcc and solaris-2.4)

Post by Michael_Hueh » Wed, 08 Feb 1995 19:25:55


Thank you once again Casper,

but I use in this case the following solution from Andreas Stolcke :

Around line 90 in machine.c.

#define dbl_align(x)    (((unsigned long)(x)+(sizeof(double)-1)) & \
                                                ~(sizeof(double)-1))
#ifdef SOLARIS24
    /*
     * snarfed from <sys/procfs.h>:
     * The following percent numbers are 16-bit binary
     * fractions [0 .. 1] with the binary point to the
     * right of the high-order bit (one == 0x8000)
     */
#define percent_cpu(pp) (((double)pp->pr_pctcpu)/0x8000*100)
#define weighted_cpu(pp) (*(double *)dbl_align(pp->pr_filler))
#else
#define percent_cpu(pp) (*(double *)dbl_align(&pp->pr_filler[0]))
#define weighted_cpu(pp) (*(double *)dbl_align(&pp->pr_filler[2]))
#endif

... two extra defines of percent_cpu/weighted_cpu should be deleted
here ... I found this part by myselve :-)

And have a nice week Casper.
--

 mit freundlichen Gr|_en,

   Michael H|hne

     3-S GmbH



     |... My first unix was ...... //// ..... a Microsoft Xenix 86 ...|
     |... Why does Microsoft ... 0(o o)0 ... proclaim a WINDOWS-NT ...|
     *-------- Michael -------oOO--(_)--OOo---------- H|hne ----------*
              CPU Cycles - Use them now or lose them forever

 #include <disclaimer.h>

 
 
 

Core from top-3.3beta (compiled using gcc and solaris-2.4)

Post by Michael_Hueh » Wed, 08 Feb 1995 19:29:34


Hello Andreas,

thank you very much for your help. Top is now ok again.
--

 Friendly regards,
 mit freundlichen Gr|_en,

   Michael H|hne

     3-S GmbH



     |... My first unix was ...... //// ..... a Microsoft Xenix 86 ...|
     |... Why does Microsoft ... 0(o o)0 ... proclaim a WINDOWS-NT ...|
     *-------- Michael -------oOO--(_)--OOo---------- H|hne ----------*
              CPU Cycles - Use them now or lose them forever

 #include <disclaimer.h>

 
 
 

1. SunSoft Solaris 2.4 and top-3.3beta w gcc

When trying to build top-3.3beta with gcc-2.6.1 on Sunsoft Solaris 2.4
i have problems compiling getopt.c:
    getopt.c: In function 'getopt':
    getopt.c:32: argument 'argv' doesn't match prototype
    /pgm/pub/lib/gcc-lib/sparc-sun-solaris2.4/2.6.1/include/stdio.h:288: \
    prototype declaration
    getopt.c:32: argument 'opts' doesn't match prototype
    /pgm/pub/lib/gcc-lib/sparc-sun-solaris2.4/2.6.1/include/stdio.h:288: \
    prototype declaration
    make: *** [getopt.o] Error 1

Any ideas ?
--

CelsiusTech AB, J{rf{lla, Sweden

2. CDROM Conundrum (Chicken and the Egg...)

3. top-3.3beta for MP machines running Solaris 2.3???

4. Sony CPD-1730 with Elite3d

5. Compiling with gcc 2.95 on Solaris 8 --> core dump

6. How to get "libfam.so.0"

7. top-3.5beta6 on Solaris 2.6 with gcc

8. fast disk writes

9. Compile Emacs on Solaris 9 using GCC 3.2

10. Motif 2.0 compiled on Solaris 2.3 using gcc 2.6.3?

11. Compiling 32 bit applications on Solaris 8 using cc or gcc

12. * Trouble compiling BASH using gcc under Solaris 2.5 x86 *

13. Compiling X11R6.4 under Solaris 7 using gcc-2.8.1