home *** CD-ROM | disk | FTP | other *** search
/ Source Code 1992 March / Source_Code_CD-ROM_Walnut_Creek_March_1992.iso / usenet / altsrcs / 2 / 2154 < prev    next >
Encoding:
Internet Message Format  |  1990-12-28  |  7.6 KB

  1. From: mf@ircam.fr (Michel Fingerhut)
  2. Newsgroups: alt.sources
  3. Subject: Unofficial patches to sps for DEC/MIPS + Ultrix 4.x
  4. Message-ID: <1990Nov25.230124.1828@ircam.fr>
  5. Date: 25 Nov 90 23:01:24 GMT
  6.  
  7. Here are the patches.  Thanks to Alan Rollow from Dec for his tip.
  8.  
  9. ------------------------------------------------------------------------------------
  10.  
  11. diff -c /old/sps/Makefile.dec3100 sps/Makefile.dec3100
  12. *** /old/sps/Makefile.dec3100    Sun Nov 25 23:52:57 1990
  13. --- sps/Makefile.dec3100    Sun Nov 25 23:42:34 1990
  14. ***************
  15. *** 9,17 ****
  16.           selectproc.o selecttty.o termwidth.o ttystatus.o waitingfor.o
  17.   INCS    =       sps.h
  18.   CC      =       cc
  19. ! CFLAGS  =       -DBSD42 -DULTRIX20 -DULTRIX30 -DVPRINTF -DDEC3100 -I/sys
  20.   LIBS    =       -ltermlib
  21. ! DIRINSTALL =    /bin
  22.   
  23.   all:            $(PROG)
  24.   .c.o:
  25. --- 9,18 ----
  26.           selectproc.o selecttty.o termwidth.o ttystatus.o waitingfor.o
  27.   INCS    =       sps.h
  28.   CC      =       cc
  29. ! CFLAGS  =       -DBSD42 -DULTRIX20 -DULTRIX30 -DULTRIX40 -DVPRINTF -DDEC3100 -I/sys
  30.   LIBS    =       -ltermlib
  31. ! DIRINSTALL =    /usr/local/bin
  32. ! DIRMAN  =       /usr/local/man/man1
  33.   
  34.   all:            $(PROG)
  35.   .c.o:
  36. ***************
  37. *** 26,36 ****
  38.           $(CC) -o $@ $(OBJS) $(LIBS)
  39.   
  40.   install:        $(PROG)
  41. !         strip $(PROG)
  42. !         mv $(PROG) $(DIRINSTALL)/$(PROG)
  43. !         /etc/chown root $(DIRINSTALL)/$(PROG)
  44. !         chgrp kmem $(DIRINSTALL)/$(PROG)
  45. !         chmod 2755 $(DIRINSTALL)/$(PROG)
  46.   
  47.   lint:
  48.           lint -x -b $(CFLAGS) *.c
  49. --- 27,34 ----
  50.           $(CC) -o $@ $(OBJS) $(LIBS)
  51.   
  52.   install:        $(PROG)
  53. !         install -s -c -o root -g kmem -m 2755 $(PROG) $(DIRINSTALL)/$(PROG)
  54. !         install -c -o root -g wheel -m 644 sps.l $(DIRMAN)/sps.1
  55.   
  56.   lint:
  57.           lint -x -b $(CFLAGS) *.c
  58. Common subdirectories: /old/sps/SCCS and sps/SCCS
  59. diff -c /old/sps/getcmd.c sps/getcmd.c
  60. *** /old/sps/getcmd.c    Sun Nov 25 23:52:56 1990
  61. --- sps/getcmd.c    Wed Nov 21 18:31:52 1990
  62. ***************
  63. *** 54,60 ****
  64. --- 54,64 ----
  65.       p->pr_upag = 0 ;
  66.       if ( p->pr_p.p_stat == SZOMB )
  67.           return ( "** Exit **" ) ;
  68. + # ifdef ULTRIX40
  69. +     if ( !(p->pr_p.p_sched & SLOAD) && Flg.flg_o )
  70. + # else
  71.       if ( !(p->pr_p.p_flag & SLOAD) && Flg.flg_o )
  72. + # endif
  73.           return ( "** Swapped out **" ) ;
  74.       /* Find the process' upage */
  75.   # ifdef KVM
  76. ***************
  77. *** 65,71 ****
  78. --- 69,79 ----
  79.           return ( "** No upage **" ) ;
  80.       p->pr_upag = 1 ;
  81.       /* Is this a system process ? */
  82. + # ifdef ULTRIX40
  83. +     if ( p->pr_p.p_type & SSYS )            
  84. + # else
  85.       if ( p->pr_p.p_flag & SSYS )            
  86. + # endif    
  87.           switch ( p->pr_p.p_pid )
  88.           {
  89.               case 0 :
  90. ***************
  91. *** 142,148 ****
  92. --- 150,160 ----
  93.       /* Look at the top of the upage to locate the command arguments.
  94.          The page is loaded if the process itself is loaded and the pte
  95.          contains is marked as valid. */
  96. + # ifdef ULTRIX40
  97. +     if ( (p->pr_p.p_sched & SLOAD)
  98. + # else
  99.       if ( (p->pr_p.p_flag & SLOAD)
  100. + # endif
  101.       && !ptetbl[0].pg_fod && ptetbl[0].pg_pfnum )
  102.       {       /* If the page is loaded, read the arguments from
  103.              physical memory. */
  104. ***************
  105. *** 152,158 ****
  106. --- 164,174 ----
  107.       }
  108.       else                            
  109.       {       /* Otherwise the page is on the swap device */
  110. + # ifdef ULTRIX40
  111. +         vstodb( 0, ctod( CLSIZE ), &User.u_us.u_procp->p_smap, &db, 1) ;
  112. + # else
  113.           vstodb( 0, ctod( CLSIZE ), &User.u_us.u_smap, &db, 1 ) ;
  114. + # endif
  115.   #  ifdef BSD42
  116.           swseek( (long)dtob( db.db_base ) ) ;
  117.   #  else
  118. diff -c /old/sps/getupage.c sps/getupage.c
  119. *** /old/sps/getupage.c    Sun Nov 25 23:52:57 1990
  120. --- sps/getupage.c    Sun Nov 25 21:04:36 1990
  121. ***************
  122. *** 40,52 ****
  123. --- 40,67 ----
  124.       extern int              Flmem, Flkmem, Flswap ;
  125.   
  126.       /* If the process is not loaded, look for the upage on the swap device*/
  127. + # ifdef ULTRIX40
  128. +     if ( !(p->pr_p.p_sched & SLOAD) )
  129. + # else
  130.       if ( !(p->pr_p.p_flag & SLOAD) )
  131. + # endif
  132.       {                               
  133. + # ifdef ULTRIX40
  134. +                 struct dmap l_dmap;
  135. +         int ublkno;
  136. +             memseek( Flkmem, (long)p->pr_p.p_smap );
  137. +             read( Flkmem, (char*)&l_dmap, sizeof( struct dmap ));
  138. +         memseek( Flkmem, l_dmap.dm_ptdaddr );
  139. +         read( Flkmem, (char *)&ublkno, sizeof(int));
  140. +         swseek( (long)dtob(ublkno) );
  141. + # else ULTRIX40
  142.   # ifdef BSD42
  143.           swseek( (long)dtob( p->pr_p.p_swaddr ) ) ;
  144.   # else BSD42
  145.           swseek( (long)ctob( p->pr_p.p_swaddr ) ) ;
  146.   # endif BSD42
  147. + # endif ULTRIX40
  148.   # ifdef SUN
  149.           if ( read( Flswap, (char*)&User.u_us, sizeof( union userstate ))
  150.           != sizeof( union userstate ) )
  151. diff -c /old/sps/needed.c sps/needed.c
  152. *** /old/sps/needed.c    Sun Nov 25 23:52:57 1990
  153. --- sps/needed.c    Sun Nov 25 23:38:17 1990
  154. ***************
  155. *** 78,84 ****
  156. --- 78,89 ----
  157.       uid = getuid() ;
  158.       for ( p = process ; p < lastp ; p++ )
  159.       {                               
  160. + # ifdef ULTRIX40
  161. +         if ( !p->pr_p.p_stat 
  162. +             || p->pr_p.p_pid==0 && p->pr_p.p_stat == SIDL)
  163. + # else
  164.           if ( !p->pr_p.p_stat )
  165. + # endif
  166.               continue ;
  167.           /* Count processes and sizes */
  168.           summarise( p ) ;
  169. ***************
  170. *** 150,156 ****
  171. --- 155,165 ----
  172.   # endif
  173.       Summary.sm_kloaded += p->pr_p.p_rssize ;
  174.       Summary.sm_kswapped += p->pr_p.p_swrss ;
  175. + # ifdef ULTRIX40
  176. +     if ( p->pr_p.p_sched & SLOAD )
  177. + # else
  178.       if ( p->pr_p.p_flag & SLOAD )
  179. + # endif
  180.           Summary.sm_nloaded++ ;
  181.       else
  182.           Summary.sm_nswapped++ ;
  183. diff -c /old/sps/percentmem.c sps/percentmem.c
  184. *** /old/sps/percentmem.c    Sun Nov 25 23:52:57 1990
  185. --- sps/percentmem.c    Thu Nov 22 08:31:59 1990
  186. ***************
  187. *** 34,40 ****
  188. --- 34,44 ----
  189.       fracmem = ( (double)p->pr_p.p_rssize + szptudot ) ;
  190.   # else
  191.       tp = p->pr_p.p_textp ;
  192. + # ifdef ULTRIX40
  193. +     if ( !(p->pr_p.p_sched & SLOAD) || !tp )
  194. + # else
  195.       if ( !(p->pr_p.p_flag & SLOAD) || !tp )
  196. + # endif
  197.           return ( 0.0 ) ;
  198.       szptudot = UPAGES + clrnd( ctopt( p->pr_p.p_dsize + p->pr_p.p_ssize ) );
  199.       fracmem = ( (double)p->pr_p.p_rssize + szptudot ) / CLSIZE ;
  200. diff -c /old/sps/printproc.c sps/printproc.c
  201. *** /old/sps/printproc.c    Sun Nov 25 23:52:57 1990
  202. --- sps/printproc.c    Thu Nov 22 08:38:06 1990
  203. ***************
  204. *** 138,146 ****
  205. --- 138,158 ----
  206.               break ;
  207.       }
  208.       /* If the process is loaded, list the status information in capitals */
  209. + # ifdef ULTRIX40
  210. +     printf( "%-6.6s ", p->pr_p.p_sched & SLOAD ?
  211. + # else
  212.       printf( "%-6.6s ", p->pr_p.p_flag & SLOAD ?
  213. + # endif
  214.           (capitals( chp, chbuf ), chbuf) : chp ) ;
  215.       /* List process flags */
  216. + # ifdef ULTRIX40
  217. +     printf( "%c%c%c", p->pr_p.p_type & SSYS ? 'U' :
  218. +         p->pr_p.p_trace & STRC ? 'T' : ' ',
  219. +         p->pr_p.p_vm & SVFORK ? 'V' :
  220. +         p->pr_p.p_vm & SPHYSIO ? 'I' : ' ',
  221. +         p->pr_p.p_vm & SUANOM ? 'A' :
  222. +         p->pr_p.p_vm & SSEQL ? 'S' : ' ' ) ;
  223. + # else
  224.       printf( "%c%c%c", p->pr_p.p_flag & SSYS ? 'U' :
  225.           p->pr_p.p_flag & STRC ? 'T' : ' ',
  226.           p->pr_p.p_flag & SVFORK ? 'V' :
  227. ***************
  228. *** 147,152 ****
  229. --- 159,165 ----
  230.           p->pr_p.p_flag & SPHYSIO ? 'I' : ' ',
  231.           p->pr_p.p_flag & SUANOM ? 'A' :
  232.           p->pr_p.p_flag & SSEQL ? 'S' : ' ' ) ;
  233. + # endif
  234.       /* List process niceness */
  235.       if ( p->pr_p.p_nice != NZERO )          
  236.           printf( "%3d ", p->pr_p.p_nice - NZERO ) ;
  237. diff -c /old/sps/waitingfor.c sps/waitingfor.c
  238. *** /old/sps/waitingfor.c    Sun Nov 25 23:52:57 1990
  239. --- sps/waitingfor.c    Thu Nov 22 08:41:47 1990
  240. ***************
  241. *** 79,85 ****
  242. --- 79,89 ----
  243.           return ( "null" ) ;
  244.       /* Waiting for a child process, alternatively in a vfork() ? */
  245.       if ( INRANGE( w, Info.i_proc0, &Info.i_proc0[ Info.i_nproc ] ) )
  246. + # ifdef ULTRIX40
  247. +         return ( p->pr_p.p_vm & SNOVM ? "vfork" : "child" ) ;
  248. + # else
  249.           return ( p->pr_p.p_flag & SNOVM ? "vfork" : "child" ) ;
  250. + # endif
  251.   # ifndef SUNOS40
  252.       /* Waiting for a page to be brought in ? */
  253.       if ( INRANGE( w, Info.i_swbuf0, &Info.i_swbuf0[ Info.i_nswbuf ] ) )
  254. -- 
  255. Michael Fingerhut    email: mf@ircam.fr    voice:     +33 1 42770105
  256. IRCAM, 31 rue St Merri, 75004 Paris, France    fax:     +33 1 42772947    
  257.