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

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