home *** CD-ROM | disk | FTP | other *** search
/ Usenet 1994 January / usenetsourcesnewsgroupsinfomagicjanuary1994.iso / sources / unix / volume3 / sps / part2 / readstatus.c < prev    next >
Encoding:
C/C++ Source or Header  |  1986-11-30  |  1.1 KB  |  34 lines

  1. # include       "sps.h"
  2. # include       <h/text.h>
  3.  
  4. /* READSTATUS - Reads the kernel memory for current processes and texts */
  5. readstatus ( process, text )
  6.  
  7. register struct process         *process ;
  8. struct text                     *text ;
  9.  
  10. {
  11.     register struct proc    *p ;
  12.     register struct proc    *p0 ;
  13.     register struct process *pr ;
  14.     extern struct info      Info ;
  15.     extern int              Flkmem ;
  16.     char                    *getcore() ;
  17.  
  18.     /* Read current text information */
  19.     memseek( Flkmem, (long)Info.i_text0 ) ;
  20.     if ( read( Flkmem, (char*)text, Info.i_ntext * sizeof( struct text ) )
  21.     != Info.i_ntext * sizeof( struct text ) )
  22.         prexit( "sps - Can't read system text table\n" ) ;
  23.     /* Read current process information */
  24.     p0 = (struct proc*)getcore( sizeof( struct proc )*Info.i_nproc ) ;
  25.     memseek( Flkmem, (long)Info.i_proc0 ) ;
  26.     if ( read( Flkmem, (char*)p0, Info.i_nproc * sizeof( struct proc ) )
  27.     != Info.i_nproc * sizeof( struct proc ) )
  28.         prexit( "sps - Can't read system process table\n" ) ;
  29.     /* Copy process information into our own array */
  30.     for ( p = p0, pr = process ; pr < &process[ Info.i_nproc ] ; p++, pr++ )
  31.         pr->pr_p = *p ;
  32.     free( (char*)p0 ) ;
  33. }
  34.